-
Notifications
You must be signed in to change notification settings - Fork 0
/
renombrar.pas
121 lines (94 loc) · 2.2 KB
/
renombrar.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
unit renombrar;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics,
Dialogs, StdCtrls, ActnList, Spin, BCListBox, BCMDButton, BCPanel, BCButton,
BCLabel, RichView, RVStyle, LCLType;
type
{ TFRenombrar }
TFRenombrar = class(TForm)
BCPaperPanel2: TBCPaperPanel;
Cancel: TAction;
EdIndex: TSpinEdit;
Ok: TAction;
ActionList1: TActionList;
BCButton1: TBCButton;
BCButton2: TBCButton;
BCLabel1: TBCLabel;
BCLabel2: TBCLabel;
BCPanel1: TBCPanel;
BCPaperPanel1: TBCPaperPanel;
EdName: TEdit;
Nota: TRichView;
RVStyle1: TRVStyle;
procedure CancelExecute(Sender: TObject);
procedure EdChange(Sender: TObject);
procedure EdKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure OkExecute(Sender: TObject);
private
public
end;
var
FRenombrar: TFRenombrar;
implementation
uses main;
{$R *.lfm}
{ TFRenombrar }
procedure TFRenombrar.CancelExecute(Sender: TObject);
begin
ModalResult:=mrCancel;
end;
procedure RefreshNota;
var
str: String;
str2: String;
begin
with FRenombrar.Nota do
begin
Clear();
AddTextFromNewLine('Old: ', 1);
FmtStr(str, '%.2d', [Indice]);
AddTextFromNewLine(str+Nombre, 0);
AddBreak();
AddTextFromNewLine('New: ', 1);
FmtStr(str, '%.2d', [FRenombrar.EdIndex.Value]);
str2 := FRenombrar.EdName.Text;
if ExtractFileExt(str2) <> '.png' then
str2 := str2+'.png';
AddTextFromNewLine(str+str2, 0);
AddBreak();
Format();
Paint();
end;
end;
procedure TFRenombrar.EdChange(Sender: TObject);
begin
RefreshNota;
end;
procedure TFRenombrar.EdKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_RETURN then
OkExecute(Sender);
if Key = VK_ESCAPE then
CancelExecute(Sender);
end;
procedure TFRenombrar.FormCreate(Sender: TObject);
begin
end;
procedure TFRenombrar.FormShow(Sender: TObject);
begin
EdIndex.Value:=Indice;
EdName.Text:=ExtractFileNameWithoutExt(Nombre);
RefreshNota;
EdName.SelectAll;
EdName.SetFocus;
end;
procedure TFRenombrar.OkExecute(Sender: TObject);
begin
ModalResult:=mrOK;
end;
end.