• R/O
  • SSH
  • HTTPS

dzinifileformatter: Commit


Commit MetaInfo

Revision10 (tree)
Zeit2014-06-29 04:50:06
Autortwm

Log Message

display the template as well as the original and output

Ändern Zusammenfassung

Diff

--- trunk/src/dzIniFileFormatter_version.ini (revision 9)
+++ trunk/src/dzIniFileFormatter_version.ini (revision 10)
@@ -1,6 +1,6 @@
11 [Version Info]
22 AutoIncBuild=0
3-Build=20
3+Build=25
44 MajorVer=1
55 MinorVer=0
66 Release=0
@@ -7,7 +7,7 @@
77 Revision=0
88
99 [Version Info Keys]
10-FileVersion=1.0.0.20
10+FileVersion=1.0.0.25
1111 ProductVersion={today}
1212 FileDescription=INI file formatter
1313 OriginalFilename=IniFileFormatter
--- trunk/src/w_IniFileFormatter.pas (revision 9)
+++ trunk/src/w_IniFileFormatter.pas (revision 10)
@@ -12,7 +12,9 @@
1212 Controls,
1313 Forms,
1414 Dialogs,
15- StdCtrls;
15+ StdCtrls,
16+ ComCtrls,
17+ u_dzTranslator;
1618
1719 type
1820 Tf_IniFileFormatter = class(TForm)
@@ -20,9 +22,13 @@
2022 ed_Filename: TEdit;
2123 od_Filename: TOpenDialog;
2224 b_Filename: TButton;
23- l_Original: TLabel;
25+ pc_Input: TPageControl;
26+ ts_Original: TTabSheet;
27+ ts_Template: TTabSheet;
2428 m_Original: TMemo;
25- l_Preview: TLabel;
29+ m_Template: TMemo;
30+ pc_Output: TPageControl;
31+ ts_Preview: TTabSheet;
2632 m_Preview: TMemo;
2733 gb_SortSections: TGroupBox;
2834 rb_SectionsUnsorted: TRadioButton;
@@ -47,13 +53,14 @@
4753 procedure b_TemplateClick(Sender: TObject);
4854 private
4955 procedure LoadAndSort(const _Filename: string);
50- function FormatIni: boolean;
56+ function FormatIni: Boolean;
5157 public
58+ constructor Create(_Owner: TComponent); override;
5259 procedure SetSrcFile(const _Value: string);
53- procedure SetSortSections(_Idx: integer);
54- procedure SetSortItems(_Idx: integer);
60+ procedure SetSortSections(_Idx: Integer);
61+ procedure SetSortItems(_Idx: Integer);
5562 procedure SetTemplate(const _Value: string);
56- function Execute(const _Value: string): boolean;
63+ function Execute(const _Value: string): Boolean;
5764 end;
5865
5966 implementation
@@ -62,8 +69,19 @@
6269
6370 uses
6471 u_dzIniFileFormatter,
65- u_dzIniSections;
72+ u_dzIniSections,
73+ u_dzVclUtils;
6674
75+constructor Tf_IniFileFormatter.Create(_Owner: TComponent);
76+begin
77+ inherited;
78+
79+ TranslateComponent(Self);
80+ TControl_SetMinConstraints(Self);
81+ TForm_AppendVersion(Self);
82+ pc_Input.ActivePage := ts_Original;
83+end;
84+
6785 procedure Tf_IniFileFormatter.b_CloseClick(Sender: TObject);
6886 begin
6987 Close;
@@ -71,9 +89,9 @@
7189
7290 procedure Tf_IniFileFormatter.b_FilenameClick(Sender: TObject);
7391 begin
74- od_Filename.FileName := ed_Filename.Text;
92+ od_Filename.Filename := ed_Filename.Text;
7593 if od_Filename.Execute then begin
76- ed_Filename.Text := od_Filename.FileName;
94+ ed_Filename.Text := od_Filename.Filename;
7795 LoadAndSort(ed_Filename.Text);
7896 end;
7997 end;
@@ -80,9 +98,9 @@
8098
8199 procedure Tf_IniFileFormatter.b_TemplateClick(Sender: TObject);
82100 begin
83- od_Filename.FileName := ed_Template.Text;
101+ od_Filename.Filename := ed_Template.Text;
84102 if od_Filename.Execute then begin
85- ed_Template.Text := od_Filename.FileName;
103+ ed_Template.Text := od_Filename.Filename;
86104 end;
87105 FormatIni;
88106 end;
@@ -89,12 +107,12 @@
89107
90108 procedure Tf_IniFileFormatter.b_SaveAsClick(Sender: TObject);
91109 begin
92- sd_Filename.FileName := ed_Filename.Text;
110+ sd_Filename.Filename := ed_Filename.Text;
93111 if sd_Filename.Execute then
94- m_Preview.Lines.SaveToFile(sd_Filename.FileName);
112+ m_Preview.Lines.SaveToFile(sd_Filename.Filename);
95113 end;
96114
97-function Tf_IniFileFormatter.Execute(const _Value: string): boolean;
115+function Tf_IniFileFormatter.Execute(const _Value: string): Boolean;
98116 begin
99117 Result := FormatIni;
100118 if Result then
@@ -101,23 +119,23 @@
101119 m_Preview.Lines.SaveToFile(_Value);
102120 end;
103121
104-procedure Tf_IniFileFormatter.SetSortItems(_Idx: integer);
122+procedure Tf_IniFileFormatter.SetSortItems(_Idx: Integer);
105123 begin
106124 case _Idx of
107- 0: rb_ItemsUnsorted.Checked := true;
108- 2: rb_ItemsByTemplate.Checked := true;
125+ 0: rb_ItemsUnsorted.Checked := True;
126+ 2: rb_ItemsByTemplate.Checked := True;
109127 else
110- rb_ItemsAlpha.Checked := true;
128+ rb_ItemsAlpha.Checked := True;
111129 end;
112130 end;
113131
114-procedure Tf_IniFileFormatter.SetSortSections(_Idx: integer);
132+procedure Tf_IniFileFormatter.SetSortSections(_Idx: Integer);
115133 begin
116134 case _Idx of
117- 0: rb_SectionsUnsorted.Checked := true;
118- 2: rb_SectionsByTemplate.Checked := true;
135+ 0: rb_SectionsUnsorted.Checked := True;
136+ 2: rb_SectionsByTemplate.Checked := True;
119137 else
120- rb_SectionsAlpha.Checked := true;
138+ rb_SectionsAlpha.Checked := True;
121139 end;
122140 end;
123141
@@ -142,12 +160,11 @@
142160 w: Integer;
143161 l: Integer;
144162 begin
145- w := (ClientWidth - m_Original.Left * 3) div 2;
146- m_Original.Width := w;
147- m_Preview.Width := w;
148- l := m_Original.Left * 2 + w;
149- m_Preview.Left := l;
150- l_Preview.Left := l;
163+ w := (ClientWidth - pc_Input.Left * 3) div 2;
164+ pc_Input.Width := w;
165+ pc_Output.Width := w;
166+ l := pc_Input.Left * 2 + w;
167+ pc_Output.Left := l;
151168 end;
152169
153170 procedure Tf_IniFileFormatter.LoadAndSort(const _Filename: string);
@@ -156,9 +173,9 @@
156173 FormatIni;
157174 end;
158175
159-function Tf_IniFileFormatter.FormatIni: boolean;
176+function Tf_IniFileFormatter.FormatIni: Boolean;
160177 var
161- b: boolean;
178+ b: Boolean;
162179 Formatter: TIniFileFormatter;
163180 Template: TIniFileFormatter;
164181 SortTemplate: TStringList;
@@ -165,15 +182,20 @@
165182 Sections: TStringList;
166183 s: string;
167184 begin
168- Result := false;
185+ Result := False;
169186
170187 Template := nil;
171188
189+ if ed_Template.Text = '' then
190+ m_Template.Lines.Clear
191+ else
192+ m_Template.Lines.LoadFromFile(ed_Template.Text);
193+
172194 b := rb_SectionsByTemplate.Checked or rb_ItemsByTemplate.Checked;
173195 if b then begin
174196 if (ed_Template.Text = '') then begin
175197 m_Preview.Lines.Clear;
176- exit;
198+ Exit;
177199 end;
178200 Template := TIniFileFormatter.Create;
179201 try
@@ -229,7 +251,7 @@
229251 FreeAndNil(Formatter);
230252 FreeAndNil(Template);
231253 end;
232- Result := true;
254+ Result := True;
233255 end;
234256
235257 end.
--- trunk/translations/de/default.po (revision 9)
+++ trunk/translations/de/default.po (revision 10)
@@ -56,7 +56,7 @@
5656 #. f_IniFileFormatter..gb_SortItems..rb_ItemsUnsorted..Caption
5757 #: w_IniFileFormatter.dfm:138 w_IniFileFormatter.dfm:175
5858 msgid "Unsorted"
59-msgstr "unsortiert"
59+msgstr "Unsortiert"
6060
6161 #. f_IniFileFormatter..gb_SortSections..rb_SectionsAlpha..Caption
6262 #. f_IniFileFormatter..gb_SortItems..rb_ItemsAlpha..Caption
@@ -68,7 +68,7 @@
6868 #. f_IniFileFormatter..gb_SortItems..rb_ItemsByTemplate..Caption
6969 #: w_IniFileFormatter.dfm:158 w_IniFileFormatter.dfm:195
7070 msgid "By Template"
71-msgstr "nach einer Vorlage"
71+msgstr "Nach einer Vorlage"
7272
7373 #. f_IniFileFormatter..gb_SortItems..Caption
7474 #: w_IniFileFormatter.dfm:168
Show on old repository browser