• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision10 (tree)
Time2018-12-24 22:10:23
Authorkentamaken

Log Message

検索オプション

Change Summary

Incremental Difference

--- textdefind.dproj (revision 9)
+++ textdefind.dproj (revision 10)
@@ -5,7 +5,7 @@
55 <FrameworkType>VCL</FrameworkType>
66 <MainSource>textdefind.dpr</MainSource>
77 <Base>True</Base>
8- <Config Condition="'$(Config)'==''">Debug</Config>
8+ <Config Condition="'$(Config)'==''">Release</Config>
99 <Platform Condition="'$(Platform)'==''">Win32</Platform>
1010 <TargetedPlatforms>1</TargetedPlatforms>
1111 <AppType>Application</AppType>
--- textdefindunit.pas (revision 9)
+++ textdefindunit.pas (revision 10)
@@ -3,10 +3,11 @@
33 interface
44
55 uses
6- Winapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,System.Classes,Vcl.Graphics,
6+ Winapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,
7+ System.Classes,Vcl.Graphics,
78 Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.StdCtrls,Vcl.ExtCtrls,Vcl.Grids,
89 types,inifiles,
9- Vcl.ComCtrls,ShlObj,ActiveX,Vcl.Menus;
10+ Vcl.ComCtrls,ShlObj,ActiveX,Vcl.Menus,Vcl.CheckLst;
1011
1112 type
1213 TStringSelf=class(TStringList)
@@ -15,7 +16,6 @@
1516 function this:TStringList;
1617 end;
1718
18-
1919 TStringsHelper=class helper for TStrings
2020 function setstrings(sa:TStringDynArray):Integer;
2121 end;
@@ -47,7 +47,7 @@
4747 procedure MouseDown(Button:TMouseButton;Shift:TShiftState;X,Y:Integer);override;
4848 procedure MouseMove(Shift:TShiftState;X,Y:Integer);override;
4949
50- procedure SetEditText(ACol, ARow: Integer; const Value: string);override;
50+ procedure SetEditText(ACol,ARow:Integer;const Value:string);override;
5151
5252 function DoMouseWheelDown(Shift:TShiftState;MousePos:TPoint):boolean;override;
5353 function DoMouseWheelUp(Shift:TShiftState;MousePos:TPoint):boolean;override;
@@ -58,8 +58,8 @@
5858
5959 public
6060 downinselection:boolean;
61- saverect :TGridRect;
62- buf :TGrid;
61+ saverect:TGridRect;
62+ buf:TGrid;
6363
6464 procedure cutcopy(modecut:boolean);
6565 function paste:TGridRect;
@@ -91,7 +91,7 @@
9191 Panel1:TPanel;
9292 Path:TComboBox;
9393 Find:TButton;
94- GridFiles: TStringGrid;
94+ GridFiles:TStringGrid;
9595 PopupMenu2:TPopupMenu;
9696 PFileCut:TMenuItem;
9797 PFileCopy:TMenuItem;
@@ -108,27 +108,35 @@
108108 TMP:TComboBox;
109109 SaveDialog:TSaveDialog;
110110 OpenDialog:TOpenDialog;
111- LeftPanel: TPanel;
112- Name: TComboBox;
113- Text: TRichEdit;
114- Tree: TTreeView;
115- Button1: TButton;
116- Splitter1: TSplitter;
117- PFileExec: TMenuItem;
118- PFileFolder: TMenuItem;
119- Panel3: TPanel;
120- Url: TComboBox;
121- FindUrlButton: TButton;
122- UrlEditButton: TButton;
123- PathEditButton: TButton;
124- PTextFind: TMenuItem;
125- PTextFindUrl: TMenuItem;
126- N1: TMenuItem;
127- PathSelButton: TButton;
111+ LeftPanel:TPanel;
112+ Name:TComboBox;
113+ Text:TRichEdit;
114+ Tree:TTreeView;
115+ Button1:TButton;
116+ Splitter1:TSplitter;
117+ PFileExec:TMenuItem;
118+ PFileFolder:TMenuItem;
119+ Panel3:TPanel;
120+ Url:TComboBox;
121+ FindUrlButton:TButton;
122+ UrlEditButton:TButton;
123+ PathEditButton:TButton;
124+ PTextFind:TMenuItem;
125+ PTextFindUrl:TMenuItem;
126+ N1:TMenuItem;
127+ PathSelButton:TButton;
128+ OpURLPanel:TPanel;
129+ OpURLEscape:TCheckBox;
130+ OpUrlSpace:TCheckBox;
131+ OpURLZenkaku:TCheckBox;
132+ OpURLEscapeEdit:TEdit;
133+ OpURLSpaceEdit:TEdit;
134+ OptionUrlDQuote:TCheckBox;
135+ OpURLComment:TCheckBox;
136+ OpURLButton:TButton;
128137 procedure FindClick(Sender:TObject);
129138 procedure FormCreate(Sender:TObject);
130- procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton;
131- Shift:TShiftState;X,Y:Integer);
139+ procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
132140 procedure PFileCutClick(Sender:TObject);
133141 procedure PFileCopyClick(Sender:TObject);
134142 procedure PFilePasteClick(Sender:TObject);
@@ -140,22 +148,21 @@
140148 procedure PTextSaveAsClick(Sender:TObject);
141149 procedure PTextOpenClick(Sender:TObject);
142150 procedure FormDestroy(Sender:TObject);
143- procedure NameChange(Sender: TObject);
144- procedure TreeClick(Sender: TObject);
145- procedure Button1Click(Sender: TObject);
146- procedure PFileFolderClick(Sender: TObject);
147- procedure PFileExecClick(Sender: TObject);
148- procedure FindUrlButtonClick(Sender: TObject);
149- procedure TextMouseUp(Sender: TObject; Button: TMouseButton;
150- Shift: TShiftState; X, Y: Integer);
151- procedure UrlEditButtonClick(Sender: TObject);
152- procedure PathEditButtonClick(Sender: TObject);
153- procedure PTextFindClick(Sender: TObject);
154- procedure PTextFindUrlClick(Sender: TObject);
155- procedure PathSelButtonClick(Sender: TObject);
156- procedure GridFilesSetEditText(Sender: TObject; ACol, ARow: Integer;
157- const Value: string);
158- procedure FormClose(Sender: TObject; var Action: TCloseAction);
151+ procedure NameChange(Sender:TObject);
152+ procedure TreeClick(Sender:TObject);
153+ procedure Button1Click(Sender:TObject);
154+ procedure PFileFolderClick(Sender:TObject);
155+ procedure PFileExecClick(Sender:TObject);
156+ procedure FindUrlButtonClick(Sender:TObject);
157+ procedure TextMouseUp(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
158+ procedure UrlEditButtonClick(Sender:TObject);
159+ procedure PathEditButtonClick(Sender:TObject);
160+ procedure PTextFindClick(Sender:TObject);
161+ procedure PTextFindUrlClick(Sender:TObject);
162+ procedure PathSelButtonClick(Sender:TObject);
163+ procedure GridFilesSetEditText(Sender:TObject;ACol,ARow:Integer;const Value:string);
164+ procedure FormClose(Sender:TObject;var Action:TCloseAction);
165+ procedure OpURLButtonClick(Sender:TObject);
159166 private
160167 { Private 宣言 }
161168 public
@@ -176,27 +183,28 @@
176183 uses strutils,IOUtils,masks,clipbrd,SHELLAPI,Vcl.FileCtrl,IdGlobal,IdURI;
177184
178185 var
179- Malloc :IMalloc;
186+ Malloc:IMalloc;
180187 FMouseDownPt:TPoint;
181- SL :TStringDynArray;
182- Ini :TMemIniFile;
183- Inifile :TMemIniFile;
184- inidir :string;
185- pname :string;
188+ sl:TStringDynArray;
189+ Ini:TMemInifile;
190+ Inifile:TMemInifile;
191+ inidir:string;
192+ pname:string;
186193
187194 const
188- MAXLIST =4096;
195+ MAXLIST=4096;
189196 TKNMAXLEN=1024;
190- NULLNULL =#0#0;
191- CR =#13;
192- LF =#10;
193- CRLF =#13#10;
194- TAB =#9;
195- CTEXT =1;
196- CFILE =2;
197- CPATH =3;
197+ NULLNULL=#0#0;
198+ CR=#13;
199+ LF=#10;
200+ CRLF=#13#10;
201+ TAB=#9;
202+ CTEXT=1;
203+ CFILE=2;
204+ CPATH=3;
205+
198206 var
199- CHEAD:TStringDynArray =['','検索文字','ファイル','パス'];
207+ CHEAD:TStringDynArray=['','検索文字','ファイル','パス'];
200208
201209 {$R *.dfm}
202210
@@ -203,46 +211,55 @@
203211 function INCBS(const s:string):string;
204212 begin
205213 Result:=s;
206- if not IsPathDelimiter(Result,Length(Result)) then Result:=Result+'\';
214+ if not IsPathDelimiter(Result,Length(Result)) then
215+ Result:=Result+'\';
207216 end;
208217
209218 function EXCBS(const s:string):string;
210219 begin
211220 Result:=s;
212- if IsPathDelimiter(Result,Length(Result)) then SetLength(Result,Length(Result)-1);
221+ if IsPathDelimiter(Result,Length(Result)) then
222+ SetLength(Result,Length(Result)-1);
213223 end;
214224
215-function zenkaku(Str : String) : String;//半角全角
225+function zenkaku(Str:String):String; // 半角全角
216226 var
217- Buf:array [0 .. 1023] of Char;
227+ buf: array [0..1023] of Char;
218228 begin
219- LCMapString(GetUserDefaultLCID, LCMAP_FULLWIDTH, PChar(Str), Length(Str)+1, Buf, 1024);
220- Result:=String(Buf);
229+ LCMapString(GetUserDefaultLCID,LCMAP_FULLWIDTH,PChar(Str),Length(Str)+1,buf,1024);
230+ Result:=String(buf);
221231 end;
222232
223-function hankaku(Str : String) : String;//全角半角
233+function hankaku(Str:String):String; // 全角半角
224234 var
225- Buf:array [0 .. 1023] of Char;
235+ buf: array [0..1023] of Char;
226236 begin
227- LCMapString(GetUserDefaultLCID, LCMAP_HALFWIDTH, PChar(Str), Length(Str)+1, Buf, 1024);
228- Result:=String(Buf);
237+ LCMapString(GetUserDefaultLCID,LCMAP_HALFWIDTH,PChar(Str),Length(Str)+1,buf,1024);
238+ Result:=String(buf);
229239 end;
230-function hira(Str : String) : String; //カタカナひらがな
240+
241+function hira(Str:String):String; // カタカナひらがな
231242 var
232- Buf:array [0 .. 1023] of Char;
243+ buf: array [0..1023] of Char;
233244 begin
234- LCMapString(GetUserDefaultLCID, LCMAP_FULLWIDTH, PChar(Str), Length(Str)+1, Buf, 1024);
235- Str:=String(Buf);
236- LCMapString(GetUserDefaultLCID, LCMAP_HIRAGANA, PChar(Str), Length(Str)+1, Buf, 1024);
237- Result:=String(Buf);
245+ LCMapString(GetUserDefaultLCID,LCMAP_FULLWIDTH,PChar(Str),Length(Str)+1,buf,1024);
246+ Str:=String(buf);
247+ LCMapString(GetUserDefaultLCID,LCMAP_HIRAGANA,PChar(Str),Length(Str)+1,buf,1024);
248+ Result:=String(buf);
238249 end;
239250
251+procedure TTextDeFindForm.FormCreate(Sender:TObject);
252+ procedure LoadChecked(C:TComponent);
253+ begin
254+ if C.ClassType=TMenuItem then
255+ TMenuItem(C).Checked:=Ini.ReadBool('',C.Name,TMenuItem(C).Checked);
256+ if C.ClassType=TCheckBox then
257+ TCheckBox(C).Checked:=Ini.ReadBool('',C.Name,TCheckBox(C).Checked);
258+ end;
240259
241-
242-procedure TTextDeFindForm.FormCreate(Sender:TObject);
243260 begin
244- Ini:=TMemIniFile.Create(ChangeFileExt(Application.ExeName,'.ini'));
245- Inifile:=TMemIniFile.Create(ChangeFileExt(Application.ExeName,'.txt'));
261+ Ini:=TMemInifile.Create(ChangeFileExt(Application.ExeName,'.ini'));
262+ Inifile:=TMemInifile.Create(ChangeFileExt(Application.ExeName,'.txt'));
246263 inidir:=Ini.ReadString('','inidir',inidir);
247264 OpenDialog.InitialDir:=ExtractFileDir(Application.ExeName);
248265 SaveDialog.InitialDir:=ExtractFileDir(Application.ExeName);
@@ -252,16 +269,24 @@
252269 LeftPanel.Width:=Ini.ReadInteger('','LeftPanel.Width',LeftPanel.Width);
253270 Font.Size:=Ini.ReadInteger('','Font.Size',Font.Size);
254271
272+ LoadChecked(OpURLComment);
273+ LoadChecked(OpUrlSpace);
274+ OpURLSpaceEdit.Text:=Ini.ReadString('','OpURLSpaceEdit',OpURLSpaceEdit.Text);
275+ LoadChecked(OpURLEscape);
276+ OpURLEscapeEdit.Text:=Ini.ReadString('','OpURLEscape',OpURLEscapeEdit.Text);
277+ LoadChecked(OpURLZenkaku);
278+ LoadChecked(OptionUrlDQuote);
279+
255280 Path.Text:=Ini.ReadString('','Path.Text','');
256281 Url.Text:=Ini.ReadString('','Url.Text','');
257282 Ini.readstrings('Url.Items',Url.Items);
258283 Inifile.readtreeview('Tree',Tree);
259284
260-// Files:=GridFiles;
285+ // Files:=GridFiles;
261286 Files:=TGrid.CreateEX(GridFiles);
262287
263288 try
264-// Tree.LoadFromFile(ChangeFileExt(Application.ExeName,'.txt'));
289+ // Tree.LoadFromFile(ChangeFileExt(Application.ExeName,'.txt'));
265290 NameChange(Sender);
266291 pname:=Name.Text;
267292 TreeClick(Sender);
@@ -271,9 +296,19 @@
271296 end;
272297 end;
273298
274-procedure TTextDeFindForm.FormClose(Sender: TObject; var Action: TCloseAction);
299+procedure TTextDeFindForm.FormClose(Sender:TObject;var Action:TCloseAction);
300+
301+ procedure SaveChecked(C:TComponent);
302+ begin
303+ if C.ClassType=TMenuItem then
304+ Ini.WriteBool('',C.Name,TMenuItem(C).Checked);
305+ if C.ClassType=TCheckBox then
306+ Ini.WriteBool('',C.Name,TCheckBox(C).Checked);
307+ end;
308+
275309 begin
276- if Application.Terminated then exit;
310+ if Application.Terminated then
311+ exit;
277312
278313 Ini.WriteInteger('','Width',Width);
279314 Ini.WriteInteger('','Height',Height);
@@ -283,9 +318,17 @@
283318 Ini.WriteString('','Url.Text',Url.Text);
284319 Ini.writestrings('Url.Items',Url.Items);
285320
321+ SaveChecked(OpURLComment);
322+ SaveChecked(OpUrlSpace);
323+ Ini.WriteString('','OpURLSpaceEdit',OpURLSpaceEdit.Text);
324+ SaveChecked(OpURLEscape);
325+ Ini.WriteString('','OpURLEscape',OpURLEscapeEdit.Text);
326+ SaveChecked(OpURLZenkaku);
327+ SaveChecked(OptionUrlDQuote);
328+
286329 NameChange(Sender);
287330 Inifile.writetreeview('Tree',Tree);
288-// Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt'));
331+ // Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt'));
289332
290333 Ini.UpdateFile;
291334 Inifile.UpdateFile;
@@ -299,73 +342,94 @@
299342
300343 end;
301344
302-
303-
304-function TTextDeFindForm.QueryContinueDrag(fEscapePressed:BOOL;
305- grfKeyState:Longint):HResult;
345+function TTextDeFindForm.QueryContinueDrag(fEscapePressed:BOOL;grfKeyState:Longint):HResult;
306346 begin
307- //ESC が押されたか、両方のボタンが押されている場合は中止する
308- if fEscapePressed or((MK_LBUTTON or MK_RBUTTON)=(grfKeyState and(MK_LBUTTON or MK_RBUTTON))) then Result:=DRAGDROP_S_CANCEL
347+ // ESC が押されたか、両方のボタンが押されている場合は中止する
348+ if fEscapePressed or((MK_LBUTTON or MK_RBUTTON)=(grfKeyState and(MK_LBUTTON or MK_RBUTTON))) then
349+ Result:=DRAGDROP_S_CANCEL
309350
310- //マウスの左ボタンが離された場合はドロップ処理へ
311- else if grfKeyState and MK_LBUTTON=0 then Result:=DRAGDROP_S_DROP
351+ // マウスの左ボタンが離された場合はドロップ処理へ
352+ else if grfKeyState and MK_LBUTTON=0 then
353+ Result:=DRAGDROP_S_DROP
312354
313- //それ以外はD&D継続
314- else Result:=S_OK;
355+ // それ以外はD&D継続
356+ else
357+ Result:=S_OK;
315358 end;
316359
317-
318360 function TTextDeFindForm.GiveFeedback(dwEffect:Longint):HResult;
319361 begin
320- //デフォルトのカーソルを使う
362+ // デフォルトのカーソルを使う
321363 Result:=DRAGDROP_S_USEDEFAULTCURSORS;
322364 end;
323365
324-
325366 procedure TTextDeFindForm.PFileCopyClick(Sender:TObject);
326367 begin
327- files.cutcopy(false);
368+ Files.cutcopy(false);
328369 end;
329370
330371 procedure TTextDeFindForm.PFileCutClick(Sender:TObject);
331372 begin
332- files.cutcopy(true);
373+ Files.cutcopy(true);
333374 end;
334375
335-
336-
337-procedure TTextDeFindForm.FindUrlButtonClick(Sender: TObject);
376+procedure TTextDeFindForm.FindUrlButtonClick(Sender:TObject);
338377 var
339378 s,ss:string;
340- ls,le,i,count:integer;
341- function escape(url: String): String;
342- var
343- c,cc:Char;
344- begin
345- for c in ':/?#[]@!$&''()*+,;=' do begin
346- url:=url.Replace(c,format('%%%x',[(Ord(c))]));
347- end;
348- result:=url;
349- end;
379+ ls,le,i,count:Integer;
350380
381+ function option(Url:String):String;
382+ var
383+ C,cc:Char;
384+ begin
385+
386+ if OpURLComment.Checked then begin
387+ if Url.IndexOf('//')>=0 then
388+ Url:=Url.Substring(0,Url.IndexOf('//'));
389+ end;
390+
391+ if OpUrlSpace.Checked then begin
392+ for C in OpURLSpaceEdit.Text do begin
393+ Url:=Url.Replace(C,' ');
394+ end;
395+ end;
396+
397+ if OpURLEscape.Checked then begin
398+ for C in OpURLEscapeEdit.Text do begin
399+ Url:=Url.Replace(C,format('%%%x',[(Ord(C))]));
400+ end;
401+ end;
402+
403+ if OpURLZenkaku.Checked then begin
404+ Url:=zenkaku(Url);
405+ end;
406+ if OptionUrlDQuote.Checked then begin
407+ Url:='\"'+Url+'\"';
408+ end;
409+
410+ Result:=Url;
411+ end;
412+
351413 begin
352414 urlrun:=not urlrun;
353-// with GridFiles do begin
354-// for i:=selection.top to selection.Bottom do begin
355-// end;
415+ // with GridFiles do begin
416+ // for i:=selection.top to selection.Bottom do begin
417+ // end;
356418 Screen.Cursor:=crHourGlass;
357- ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart, 0);
358- le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*integer(Text.SelLength>0),0);
419+ ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0);
420+ le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*Integer(Text.SelLength>0),0);
359421 for i:=ls to le do begin
360422 FindUrlButton.Caption:='中止';
361423 ss:=Text.lines[i];
362- if not urlrun then break;
424+ if not urlrun then
425+ break;
363426 Application.ProcessMessages;
364- s:=Url.text;
365- if s='' then continue;
366- s:=s.Replace('%リスト名%',zenkaku(Name.text));
367- s:=s.Replace('%検索文字%',zenkaku(ss));
368- ShellExecute(Handle,'open',Pchar(s),'','',1);
427+ s:=Url.Text;
428+ if s='' then
429+ continue;
430+ s:=s.Replace('%リスト名%',option(Name.Text));
431+ s:=s.Replace('%検索文字%',option(ss));
432+ ShellExecute(Handle,'open',PChar(s),'','',1);
369433 sleep(3000);
370434 end;
371435 FindUrlButton.Caption:='URL検索';
@@ -373,16 +437,16 @@
373437 Screen.Cursor:=crDefault;
374438 end;
375439
376-procedure TTextDeFindForm.PFileExecClick(Sender: TObject);
440+procedure TTextDeFindForm.PFileExecClick(Sender:TObject);
377441 begin
378442 with GridFiles do
379- ShellExecute(Handle,'open',Pchar(INCBS(cells[CPATH,row])+cells[CFILE,row]),'','',1);
443+ ShellExecute(Handle,'open',PChar(INCBS(cells[CPATH,row])+cells[CFILE,row]),'','',1);
380444 end;
381445
382-procedure TTextDeFindForm.PFileFolderClick(Sender: TObject);
446+procedure TTextDeFindForm.PFileFolderClick(Sender:TObject);
383447 begin
384448 with GridFiles do
385- ShellExecute(Handle,'open',Pchar(INCBS(cells[CPATH,row])),'','',1);
449+ ShellExecute(Handle,'open',PChar(INCBS(cells[CPATH,row])),'','',1);
386450
387451 end;
388452
@@ -390,12 +454,13 @@
390454 begin
391455 OpenDialog.DefaultExt:='csv';
392456 OpenDialog.Filter:='csv|csv|*|*';
393- if OpenDialog.Execute then files.save(OpenDialog.FileName);
457+ if OpenDialog.Execute then
458+ Files.save(OpenDialog.FileName);
394459 end;
395460
396461 procedure TTextDeFindForm.PFilePasteClick(Sender:TObject);
397462 begin
398- files.paste;
463+ Files.paste;
399464 end;
400465
401466 procedure TTextDeFindForm.PFileSaveAsClick(Sender:TObject);
@@ -402,7 +467,8 @@
402467 begin
403468 SaveDialog.DefaultExt:='csv';
404469 SaveDialog.Filter:='csv|csv|*|*';
405- if SaveDialog.Execute then files.save(SaveDialog.FileName);
470+ if SaveDialog.Execute then
471+ Files.save(SaveDialog.FileName);
406472 end;
407473
408474 procedure TTextDeFindForm.PTextCopyClick(Sender:TObject);
@@ -415,12 +481,12 @@
415481 Text.CutToClipboard;
416482 end;
417483
418-procedure TTextDeFindForm.PTextFindClick(Sender: TObject);
484+procedure TTextDeFindForm.PTextFindClick(Sender:TObject);
419485 begin
420486 FindClick(Sender);
421487 end;
422488
423-procedure TTextDeFindForm.PTextFindUrlClick(Sender: TObject);
489+procedure TTextDeFindForm.PTextFindUrlClick(Sender:TObject);
424490 begin
425491 FindUrlButtonClick(Sender);
426492 end;
@@ -429,7 +495,8 @@
429495 begin
430496 OpenDialog.DefaultExt:='txt';
431497 OpenDialog.Filter:='txt|txt|*|*';
432- if OpenDialog.Execute then Text.lines.LoadFromFile(OpenDialog.FileName);
498+ if OpenDialog.Execute then
499+ Text.lines.LoadFromFile(OpenDialog.FileName);
433500 end;
434501
435502 procedure TTextDeFindForm.PTextPasteClick(Sender:TObject);
@@ -441,176 +508,169 @@
441508 begin
442509 SaveDialog.DefaultExt:='txt';
443510 SaveDialog.Filter:='txt|txt|*|*';
444- if SaveDialog.Execute then Text.lines.SaveToFile(SaveDialog.FileName);
511+ if SaveDialog.Execute then
512+ Text.lines.SaveToFile(SaveDialog.FileName);
445513
446514 end;
447515
448-
449-
450-
451516 function gridInRect(X,Y:Integer;const r:TGridRect):boolean;
452517 begin
453518 Result:=true;
454- if ((X<r.left)or(X>r.right)or(Y<r.top)or(Y>r.Bottom)) then Result:=false;
519+ if ((X<r.left)or(X>r.right)or(Y<r.top)or(Y>r.Bottom)) then
520+ Result:=false;
455521 end;
456522
457-procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton;
458- Shift:TShiftState;X,Y:Integer);
523+procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
459524 var
460525 ACol,ARow:Longint;
461526
462527 begin
463528 Files.MouseToCell(X,Y,ACol,ARow);
464- if gridInRect(ACol,ARow,Files.selection) then exit;
529+ if gridInRect(ACol,ARow,Files.selection) then
530+ exit;
465531 Files.MouseToCell(X,Y,ACol,ARow);
466532
467533 end;
468534
469-
470-procedure TTextDeFindForm.GridFilesSetEditText(Sender: TObject; ACol,
471- ARow: Integer; const Value: string);
535+procedure TTextDeFindForm.GridFilesSetEditText(Sender:TObject;ACol,ARow:Integer;const Value:string);
472536 begin
473-// ShowMessage(Value);
474-// GridFiles.Options:=GridFiles.Options-[goEditing]+[goRangeSelect];
537+ // ShowMessage(Value);
538+ // GridFiles.Options:=GridFiles.Options-[goEditing]+[goRangeSelect];
475539
476540 end;
477541
478-procedure TTextDeFindForm.TextMouseUp(Sender: TObject; Button: TMouseButton;
479- Shift: TShiftState; X, Y: Integer);
480-var l:integer;
542+procedure TTextDeFindForm.TextMouseUp(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
543+var
544+ l:Integer;
481545 begin
482546 if Text.SelLength=0 then begin
483- l:=Text.Perform(EM_LINEFROMCHAR, System.NativeUInt(-1), 0);
547+ l:=Text.Perform(EM_LINEFROMCHAR,System.NativeUInt(-1),0);
484548 Text.SelStart:=Text.Perform(EM_LINEINDEX,System.NativeUInt(l),0);
485549 Text.SelLength:=Text.Perform(EM_LINEINDEX,System.NativeUInt(l+1),0)-Text.SelStart;
486550 end;
487551 end;
488552
489-procedure TTextDeFindForm.TreeClick(Sender: TObject);
490-var N:TTreeNode;
491-ppname:string;
492-i:integer;
553+procedure TTextDeFindForm.TreeClick(Sender:TObject);
554+var
555+ N:TTreeNode;
556+ ppname:string;
557+ i:Integer;
493558
494-
495559 begin
496560
497561 ppname:=Name.Text;
498562
499563
500-// for i:=Name.Items.Count-1 downto 1 do
501-// Name.Items.Delete(i);
564+ // for i:=Name.Items.Count-1 downto 1 do
565+ // Name.Items.Delete(i);
502566
503- Tmp.Clear;
567+ TMP.clear;
504568 N:=Tree.Items.GetFirstNode;
505569 while N<>nil do begin
506- Tmp.Items.add(N.Text);
570+ TMP.Items.add(N.Text);
507571 N:=N.getNextSibling;
508572 end;
509573 Name.Enabled:=false;
510- Name.Items.Text:=Tmp.Items.text;
511-// Name.ItemIndex:=-1;
512-// Name.Text:=ppname;
574+ Name.Items.Text:=TMP.Items.Text;
575+ // Name.ItemIndex:=-1;
576+ // Name.Text:=ppname;
513577 Name.ItemIndex:=Name.Items.IndexOf(ppname);
514-// Application.ProcessMessages;
578+ // Application.ProcessMessages;
515579 Name.Enabled:=true;
516580 end;
517581
518-
519-function inputtextbox(P:TForm;C:TWinControl;text:string):string;
582+function inputtextbox(P:TForm;C:TWinControl;Text:string):string;
520583 var
521- F:Tform;
522- M:TMemo;
523- R:TRect;
584+ f:TForm;
585+ M:TMemo;
586+ r:TRect;
524587 begin
525- F:=TForm.Create(P);
526- M:=TMemo.Create(F);
588+ f:=TForm.Create(P);
589+ M:=TMemo.Create(f);
527590 try
528- F.Font:=P.Font;
529-// F.BorderStyle:=bsSingle;
530- R:=P.BoundsRect;
531- R.Top:=C.ClientToScreen(C.BoundsRect.BottomRight).Y;
532- R.Height:=200;
533-// R.Inflate(0,0,0,100);
534- F.BoundsRect:=R;
535- M.Parent:=F;
591+ f.Font:=P.Font;
592+ // F.BorderStyle:=bsSingle;
593+ r:=P.BoundsRect;
594+ r.top:=C.ClientToScreen(C.BoundsRect.BottomRight).Y;
595+ r.Height:=200;
596+ // R.Inflate(0,0,0,100);
597+ f.BoundsRect:=r;
598+ M.Parent:=f;
536599 M.Align:=alClient;
537- M.Text:=text;
538- F.Position:=poDesigned;
539- F.ShowModal;
540- result:=M.text;
600+ M.Text:=Text;
601+ f.Position:=poDesigned;
602+ f.ShowModal;
603+ Result:=M.Text;
541604 finally
542- F.Free;
605+ f.Free;
543606 end;
544607 end;
545608
546-
547-procedure TTextDeFindForm.PathEditButtonClick(Sender: TObject);
609+procedure TTextDeFindForm.PathEditButtonClick(Sender:TObject);
548610 begin
549611 Path.Items.Text:=inputtextbox(self,Path,Path.Items.Text);
550612 end;
551613
552-
553-procedure TTextDeFindForm.PathSelButtonClick(Sender: TObject);
614+procedure TTextDeFindForm.PathSelButtonClick(Sender:TObject);
554615 var
555- SelectFolder : String;
616+ SelectFolder:String;
556617 begin
557- SelectFolder := Path.text;
558- if SelectDirectory(Path.text,'',SelectFolder,[sdNewUI, sdNewFolder, sdShowEdit],Self) then begin
559- Path.text:=SelectFolder;
560- end;
618+ SelectFolder:=Path.Text;
619+ if SelectDirectory(Path.Text,'',SelectFolder,[sdNewUI,sdNewFolder,sdShowEdit],self) then begin
620+ Path.Text:=SelectFolder;
621+ end;
561622 end;
562623
563-procedure TTextDeFindForm.UrlEditButtonClick(Sender: TObject);
624+procedure TTextDeFindForm.UrlEditButtonClick(Sender:TObject);
564625 begin
565626 Url.Items.Text:=inputtextbox(self,Url,Url.Items.Text);
566627 end;
567628
568-procedure TTextDeFindForm.Button1Click(Sender: TObject);
629+procedure TTextDeFindForm.Button1Click(Sender:TObject);
569630 begin
570631 TreeClick(Sender);
571632 end;
572633
634+procedure TTextDeFindForm.NameChange(Sender:TObject);
635+var
636+ N,NN:TTreeNode;
637+ s:string;
638+ function childtext(N:TTreeNode):string;
639+ begin
640+ N:=N.getFirstChild;
641+ while N<>nil do begin
642+ Text.lines.add(N.Text);
643+ N:=N.getNextSibling;
644+ end;
573645
574-procedure TTextDeFindForm.NameChange(Sender: TObject);
575-var N,NN:TTreeNode;
576-s:string;
577- function childtext(N:TTreeNode):string;
578- begin
579- N:=N.getFirstChild;
580- while N<>nil do begin
581- Text.Lines.add(N.Text);
582- N:=N.getNextSibling;
583646 end;
584647
585- end;
586-
587-
588648 begin
589649 if Trim(pname)<>'' then begin
590650 N:=Tree.Items.GetFirstNode;
591651 NN:=nil;
592652 while N<>nil do begin
593- if N.text=pname then begin
653+ if N.Text=pname then begin
594654 NN:=N;
595655 break;
596656 end;
597657 N:=N.getNextSibling;
598658 end;
599- if Trim(Text.lines.Text)='' then begin //空ならリストから消す
659+ if Trim(Text.lines.Text)='' then begin // 空ならリストから消す
600660 if NN<>nil then begin
601661 NN.Delete;
602662 TreeClick(Sender);
603663 end;
604664
605- end else begin //空以外ならリストへ
665+ end
666+ else begin // 空以外ならリストへ
606667 if NN=nil then begin
607- NN:=Tree.Items.Add(nil,pname);
668+ NN:=Tree.Items.add(nil,pname);
608669 TreeClick(Sender);
609670 end;
610671
611- NN.DeleteChildren;
612- for s in Text.lines do
613- Tree.Items.AddChild(NN,Trim(s));
672+ NN.DeleteChildren;
673+ for s in Text.lines do Tree.Items.AddChild(NN,Trim(s));
614674
615675 Inifile.writegrid('grid\'+pname,TGrid(GridFiles));
616676 end;
@@ -620,9 +680,9 @@
620680 Text.Text:='';
621681 N:=Tree.Items.GetFirstNode;
622682 while N<>nil do begin
623- if N.text=Name.text then begin
683+ if N.Text=Name.Text then begin
624684 childtext(N);
625- Inifile.readgrid('grid\'+Name.text,TGrid(GridFiles));
685+ Inifile.readgrid('grid\'+Name.Text,TGrid(GridFiles));
626686 end;
627687 N:=N.getNextSibling;
628688 end;
@@ -631,33 +691,37 @@
631691
632692
633693
634-// if Trim(Text.lines.Text)<>'' then begin
635-// Ini.EraseSection(Name.Text);
636-//
637-// Tmp.Items.LoadFromFile(Ini.FileName);
638-// Tmp.Items.Add('['+Name.Text+']');
639-// Tmp.Items.AddStrings(Text.Lines);
640-// Tmp.Items.SaveToFile(Ini.FileName);
641-//
642-// end;
643-// Ini.ReadSection(Name.Text,Tmp.Items);
644-// Text.lines.Text:=Tmp.Items.Text;
645-// Text.lines.Text:=
646-// Ini.ReadSectionValues(Name.Text,Text.lines);
694+ // if Trim(Text.lines.Text)<>'' then begin
695+ // Ini.EraseSection(Name.Text);
696+ //
697+ // Tmp.Items.LoadFromFile(Ini.FileName);
698+ // Tmp.Items.Add('['+Name.Text+']');
699+ // Tmp.Items.AddStrings(Text.Lines);
700+ // Tmp.Items.SaveToFile(Ini.FileName);
701+ //
702+ // end;
703+ // Ini.ReadSection(Name.Text,Tmp.Items);
704+ // Text.lines.Text:=Tmp.Items.Text;
705+ // Text.lines.Text:=
706+ // Ini.ReadSectionValues(Name.Text,Text.lines);
647707
648708 pname:=Name.Text;
649709 end;
650710
711+procedure TTextDeFindForm.OpURLButtonClick(Sender:TObject);
712+begin
713+ OpURLPanel.Visible:=not OpURLPanel.Visible;
714+end;
651715
652716 procedure TTextDeFindForm.FindClick(Sender:TObject);
653717 var
654- op :TSearchOption;
655- SA :TStringDynArray;
656- s,ss :string;
718+ op:TSearchOption;
719+ sa:TStringDynArray;
720+ s,ss:string;
657721 snm,nm:string;
658- sub :boolean;
659- hit :boolean;
660- ls,le,i,j,count:integer;
722+ sub:boolean;
723+ hit:boolean;
724+ ls,le,i,j,count:Integer;
661725 pathtext:string;
662726
663727 function findr(s:string):string;
@@ -664,34 +728,32 @@
664728 begin
665729 s:=s.ToUpper;
666730 s:=zenkaku(s);
667-// s:=s.Replace(' ','');
668-// s:=s.Replace('・','');
669- result:=s;
731+ // s:=s.Replace(' ','');
732+ // s:=s.Replace('・','');
733+ Result:=s;
670734 end;
671735
672736 function procfind(ssss:string):string;
673- var s,ss,sss:string;
674- i,j,si:integer;
737+ var
738+ s,ss,sss:string;
739+ i,j,si:Integer;
675740 begin
676741 sss:=findr(ssss);
677742 si:=pos(' ',sss);
678- if si=0 then
679- si:=pos('・',sss);
680- if si=0 then
681- si:=4;
743+ if si=0 then si:=pos('・',sss);
744+ if si=0 then si:=4;
682745 si:=si-1;
683746
747+ for j:=Length(sss) downto si do begin
684748
685- for j:=length(sss) downto si do begin
686-
687749 ss:=sss.Substring(0,j);
688- for s in SA do begin
750+ for s in sa do begin
689751 nm:=Trim((ss));
690- if nm='' then continue;
752+ if nm='' then
753+ continue;
691754
692- if Pos('*',nm)=0 then
693- if Pos('?',nm)=0 then
694- nm:='*'+nm+'*';
755+ if pos('*',nm)=0 then
756+ if pos('?',nm)=0 then nm:='*'+nm+'*';
695757 snm:=findr(ExtractFileName(s));
696758 if MatchesMask(snm,nm) then begin
697759 Files.RowCount:=Files.RowCount+1;
@@ -701,41 +763,42 @@
701763 hit:=true;
702764 end;
703765 end;
704- if hit then break;
766+ if hit then
767+ break;
705768 end;
706769 end;
707770
708-
709771 begin
710772 try
711773 Screen.Cursor:=crHourGlass;
712774 Application.ProcessMessages;
713775
714- ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart, 0);
776+ ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0);
715777 pathtext:=Path.Text;
716- pathtext:=pathtext.Replace('%リスト名%',Name.text);
778+ pathtext:=pathtext.Replace('%リスト名%',Name.Text);
717779 pathtext:=pathtext.Replace('%検索文字%',Text.lines[ls]);
718- pathtext:=incbs(pathtext);
719-// snm:=ExtractFileName(Path.Text);
720-// if snm='' then
780+ pathtext:=INCBS(pathtext);
781+ // snm:=ExtractFileName(Path.Text);
782+ // if snm='' then
721783 snm:='*';
722784
723- // if sub then
785+ // if sub then
724786 op:=TSearchOption.soAllDirectories;
725- // else
726- // op := TSearchOption.soTopDirectoryOnly;
727- SA:=TDirectory.GetFiles(PathText,snm,op);
787+ // else
788+ // op := TSearchOption.soTopDirectoryOnly;
789+ sa:=TDirectory.GetFiles(pathtext,snm,op);
728790 Files.RowCount:=1;
729791 Files.ColCount:=4;
730792 Files.Rows[0].setstrings(['','検索文字','ファイル','パス']);
731793
732- if sender=Find then begin
794+ if Sender=Find then begin
733795 ls:=0;
734- le:=Text.Lines.Count-1;
796+ le:=Text.lines.count-1;
735797
736- end else begin
737- ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart, 0);
738- le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*integer(Text.SelLength>0),0);
798+ end
799+ else begin
800+ ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0);
801+ le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*Integer(Text.SelLength>0),0);
739802 end;
740803 for i:=ls to le do begin
741804 ss:=Text.lines[i];
@@ -752,39 +815,43 @@
752815 Files.ColExpand(10);
753816 Files.FixedRows:=1;
754817
755- finally Screen.Cursor:=crDefault;
818+ finally
819+ Screen.Cursor:=crDefault;
756820 end;
757821 end;
758822
759-
760-
761823 function TTextDeFindForm.GetFilePathDataObject(G:TStringGrid):IDataObject;
762824 var
763825 ISFD,ISF:IShellFolder;
764- PItems :packed array of PItemIDList;
765- PItem :PItemIDList;
766- pchEaten,dwAttributes :Cardinal;
767- fn,fnpath :Widestring;
768- i,count :Integer;
826+ PItems:packed array of PItemIDList;
827+ PItem:PItemIDList;
828+ pchEaten,dwAttributes:Cardinal;
829+ fn,fnpath:Widestring;
830+ i,count:Integer;
769831 begin
770832 Result:=nil;
771833 count:=0;
772834
773835 SHGetDesktopFolder(ISFD);
774- if Failed(ISFD.ParseDisplayName(0,nil,PWideChar(Path.text),pchEaten,PItem,dwAttributes)) then exit;
775- if Failed(ISFD.BindToObject(PItem,nil,IID_IShellFolder,ISF)) then exit;
836+ if Failed(ISFD.ParseDisplayName(0,nil,PWideChar(Path.Text),pchEaten,PItem,dwAttributes)) then
837+ exit;
838+ if Failed(ISFD.BindToObject(PItem,nil,IID_IShellFolder,ISF)) then
839+ exit;
776840
777841 for i:=G.selection.top to G.selection.Bottom do begin
778842 fn:=INCBS(G.cells[CPATH,i])+G.cells[CFILE,i];
779843
780- if not FileExists(fn) then continue;
844+ if not FileExists(fn) then
845+ continue;
781846 inc(count);
782847 SetLength(PItems,count);
783- fnpath:=ExtractRelativePath(INCBS(Path.text),fn);
848+ fnpath:=ExtractRelativePath(INCBS(Path.Text),fn);
784849
785- if Failed(ISF.ParseDisplayName(0,nil,PWideChar(fnpath),pchEaten,PItems[count-1],dwAttributes)) then exit;
850+ if Failed(ISF.ParseDisplayName(0,nil,PWideChar(fnpath),pchEaten,PItems[count-1],dwAttributes)) then
851+ exit;
786852 end;
787- if count<1 then exit;
853+ if count<1 then
854+ exit;
788855
789856 ISF.GetUIObjectOf(0,count,PItems[0],IDataObject,nil,Pointer(Result));
790857 end;
@@ -791,12 +858,8 @@
791858
792859
793860
794-//--------------------------------------------------------------------------------
861+// --------------------------------------------------------------------------------
795862
796-
797-
798-
799-
800863 procedure TGrid.copy(G:TGrid);
801864 var
802865 r:TGridRect;
@@ -805,7 +868,8 @@
805868 RowCount:=G.RowCount;
806869 r:=G.selection;
807870 G.selection:=TGridRect(rect(1,1,G.ColCount-1,G.RowCount-1));
808- G.selrowdo(procedure(X,Y:Integer)
871+ G.selrowdo(
872+ procedure(X,Y:Integer)
809873 begin
810874 Rows[Y]:=G.Rows[Y];
811875 end);
@@ -818,12 +882,12 @@
818882 MS:TMemoryStream;
819883 begin
820884 Create(Origin.Owner);
821- Self.Parent:=Origin.Parent;
822- Self.Options:=Origin.Options;
823- Self.OnSetEditText:=Origin.OnSetEditText;
824- Self.OnMouseDown:=Origin.OnMouseDown;
825- Self.OnMouseMove:=Origin.OnMouseMove;
826- buf:=TGrid.Create(Self);
885+ self.Parent:=Origin.Parent;
886+ self.Options:=Origin.Options;
887+ self.OnSetEditText:=Origin.OnSetEditText;
888+ self.OnMouseDown:=Origin.OnMouseDown;
889+ self.OnMouseMove:=Origin.OnMouseMove;
890+ buf:=TGrid.Create(self);
827891
828892 MS:=TMemoryStream.Create;
829893 try
@@ -830,54 +894,61 @@
830894 MS.WriteComponent(Origin);
831895 Origin.Free;
832896 MS.Position:=0;
833- MS.ReadComponent(Self);
834- finally MS.Free;
897+ MS.ReadComponent(self);
898+ finally
899+ MS.Free;
835900 end;
836901 end;
837902
838903 procedure TGrid.WMChar(var Msg:TWMChar);
839904 begin
840- // if (EnableEdit) and (AnsiChar(Msg.CharCode) in [^H, #32..#255]) then begin
905+ // if (EnableEdit) and (AnsiChar(Msg.CharCode) in [^H, #32..#255]) then begin
841906 if ((CharInSet(Char(Msg.CharCode),[^H])or(Char(Msg.CharCode)>=#32))) then begin
842907 Options:=Options+[goEditing];
843908 EditorMode:=true;
844909
845- // ShowObject(Word(Msg.CharCode));
846- // if Edit.Visible then
847- // PostMessage(Edit.Handle, WM_CHAR, Word(Msg.CharCode), 0);
848- // if Combo.Visible then
849- // PostMessage(Combo.Handle, WM_CHAR, Word(Msg.CharCode), 0);
910+ // ShowObject(Word(Msg.CharCode));
911+ // if Edit.Visible then
912+ // PostMessage(Edit.Handle, WM_CHAR, Word(Msg.CharCode), 0);
913+ // if Combo.Visible then
914+ // PostMessage(Combo.Handle, WM_CHAR, Word(Msg.CharCode), 0);
850915
851916 end
852- else inherited;
917+ else
918+ inherited;
853919 end;
854920
855921 procedure TGrid.cutcopy(modecut:boolean);
856922 var
857- i,j :Integer;
923+ i,j:Integer;
858924 xs,ys,xw,yw:Integer;
859- Txt :TStringList;
860- s,ss :String;
861- r :TGridRect;
925+ Txt:TStringList;
926+ s,ss:String;
927+ r:TGridRect;
862928
863929 function d_dquotedstr(const s,d:string):string;
864930 var
865- c:Char;
931+ C:Char;
866932 b:boolean;
867933 begin
868934 Result:=s;
869935 b:=false;
870- if d='' then b:=true;
871- for c in s do
872- if Pos(c,d)>0 then b:=true;
936+ if d='' then
937+ b:=true;
938+ for C in s do
939+ if pos(C,d)>0 then
940+ b:=true;
873941
874- if not b then exit;
942+ if not b then
943+ exit;
875944 Result:='"'+s+'"';
876945 end;
877946
878947 begin
879- if not Focused then exit;
880- if modecut then buf.copy(Self);
948+ if not Focused then
949+ exit;
950+ if modecut then
951+ buf.copy(self);
881952
882953 ys:=selection.top;
883954 xs:=selection.left;
@@ -888,12 +959,15 @@
888959 for i:=0 to yw do begin
889960 s:='';
890961 for j:=0 to xw do begin
891- if j>0 then s:=s+#9;
892- ss:=StringReplace(cells[xs+j,ys+i],#9,'',[rfReplaceAll]);//タブは削除
893- //if Pos(ss,CRLF)>0 then
962+ if j>0 then
963+ s:=s+#9;
964+ ss:=StringReplace(cells[xs+j,ys+i],#9,'',[rfReplaceAll]);
965+ // タブは削除
966+ // if Pos(ss,CRLF)>0 then
894967 ss:=d_dquotedstr(ss,CRLF);
895968 s:=s+ss;
896- if modecut then cells[xs+j,ys+i]:='';
969+ if modecut then
970+ cells[xs+j,ys+i]:='';
897971 end;
898972 Txt.add(s);
899973 end;
@@ -905,20 +979,22 @@
905979
906980 function TGrid.paste:TGridRect;
907981 var
908- i,j,si,colcnt :Integer;
909- s :String;
910- Txt :TStringList;
911- ltxt :string;
982+ i,j,si,colcnt:Integer;
983+ s:String;
984+ Txt:TStringList;
985+ ltxt:string;
912986 xs,ys,xw,yw,cnt:Integer;
913- cols :TStringDynArray;
987+ cols:TStringDynArray;
914988
915989 begin
916- if not Focused then exit;
917- buf.copy(Self);
990+ if not Focused then
991+ exit;
992+ buf.copy(self);
918993
919994 Txt:=TStringList.Create;
920995 s:=StringReplace(Clipboard.AsText,CRLF,CR,[rfReplaceAll]);
921- for ltxt in SplitString(s,CR) do Txt.add(ltxt);
996+ for ltxt in SplitString(s,CR) do
997+ Txt.add(ltxt);
922998
923999 ys:=selection.top;
9241000 xs:=selection.left;
@@ -927,7 +1003,8 @@
9271003 for i:=0 to yw do begin
9281004 s:=Txt[i];
9291005 colcnt:=SplitString(s,#9).count;
930- if xw<colcnt then xw:=colcnt;
1006+ if xw<colcnt then
1007+ xw:=colcnt;
9311008 end;
9321009 dec(xw);
9331010
@@ -946,7 +1023,7 @@
9461023 procedure TGrid.savebuf;
9471024 begin
9481025 saverect:=selection;
949- buf.copy(Self);
1026+ buf.copy(self);
9501027 end;
9511028
9521029 function TGrid.save(fn:string):boolean;
@@ -954,14 +1031,14 @@
9541031 i:Integer;
9551032 begin
9561033 try
957- SL.clear;
1034+ sl.clear;
9581035 for i:=0 to RowCount-1 do begin
9591036 Rows[i].StrictDelimiter:=true;
9601037 Rows[i].Delimiter:=',';
9611038 Rows[i].QuoteChar:='"';
962- SL.add(Rows[i].DelimitedText);
1039+ sl.add(Rows[i].DelimitedText);
9631040 end;
964- SL.save(fn);
1041+ sl.save(fn);
9651042 except
9661043
9671044 end;
@@ -969,13 +1046,15 @@
9691046
9701047 procedure TGrid.setfixed;
9711048 begin
972- if colcount>1 then FixedCols:=1;
973- if rowcount>1 then FixedRows:=1;
1049+ if ColCount>1 then
1050+ FixedCols:=1;
1051+ if RowCount>1 then
1052+ FixedRows:=1;
9741053 end;
9751054
9761055 function TGrid.load(fn:string):boolean;
9771056 var
978- i :Integer;
1057+ i:Integer;
9791058 TMP:TStringList;
9801059 begin
9811060 try
@@ -983,13 +1062,13 @@
9831062 RowCount:=1;
9841063 DrawingStyle:=gdsClassic;
9851064 DefaultRowHeight:=round(-Font.Height*1.5);
986- SL.load(fn);
987- RowCount:=SL.count;
988- for i:=0 to SL.hi do begin
1065+ sl.load(fn);
1066+ RowCount:=sl.count;
1067+ for i:=0 to sl.hi do begin
9891068 TMP.Delimiter:=',';
9901069 TMP.QuoteChar:='"';
9911070 TMP.StrictDelimiter:=true;
992- TMP.DelimitedText:=SL[i];
1071+ TMP.DelimitedText:=sl[i];
9931072 Rows[i]:=TMP;
9941073 end;
9951074
@@ -999,7 +1078,8 @@
9991078
10001079 savebuf;
10011080 ColExpand(10);
1002- finally TMP.Free;
1081+ finally
1082+ TMP.Free;
10031083 end;
10041084 end;
10051085
@@ -1006,7 +1086,8 @@
10061086 procedure TGrid.seldel;
10071087 begin
10081088 savebuf;
1009- seldo(procedure(X,Y:Integer)
1089+ seldo(
1090+ procedure(X,Y:Integer)
10101091 begin
10111092 cells[X,Y]:='';
10121093 end);
@@ -1017,7 +1098,8 @@
10171098 i,j:Integer;
10181099 begin
10191100 for i:=selection.top to selection.Bottom do
1020- for j:=selection.left to selection.right do func(j,i);
1101+ for j:=selection.left to selection.right do
1102+ func(j,i);
10211103 end;
10221104
10231105 function TGrid.alldo(func:TFuncXY):Integer;
@@ -1024,8 +1106,9 @@
10241106 var
10251107 i,j:Integer;
10261108 begin
1027- for i:=0 to rowcount-1 do
1028- for j:=0 to colcount-1 do func(j,i);
1109+ for i:=0 to RowCount-1 do
1110+ for j:=0 to ColCount-1 do
1111+ func(j,i);
10291112 end;
10301113
10311114 function TGrid.selrowdo(func:TFuncXY):Integer;
@@ -1032,21 +1115,22 @@
10321115 var
10331116 i:Integer;
10341117 begin
1035- for i:=selection.top to selection.Bottom do func(0,i);
1118+ for i:=selection.top to selection.Bottom do
1119+ func(0,i);
10361120 end;
10371121
1038-procedure TGrid.SetEditText(ACol, ARow: Integer;
1039- const Value: string);
1122+procedure TGrid.SetEditText(ACol,ARow:Integer;const Value:string);
10401123 begin
1041- inherited;
1124+ inherited;
10421125 Options:=Options-[goEditing]+[goRangeSelect];
10431126 end;
10441127
1045-function TGrid.rowdo(func: TFuncXY): Integer;
1128+function TGrid.rowdo(func:TFuncXY):Integer;
10461129 var
10471130 i:Integer;
10481131 begin
1049- for i:=0 to rowcount-1 do func(0,i);
1132+ for i:=0 to RowCount-1 do
1133+ func(0,i);
10501134
10511135 end;
10521136
@@ -1055,16 +1139,18 @@
10551139 w:Word;
10561140 begin
10571141 if ssCtrl in Shift then begin
1058- if Key=17 then exit;
1142+ if Key=17 then
1143+ exit;
10591144 case Key of
1060- Word('X'):cutcopy(true);
1061- Word('C'):cutcopy(false);
1062- Word('V'):paste;
1063- Word('Z'):copy(buf);
1145+ Word('X'):cutcopy(true);
1146+ Word('C'):cutcopy(false);
1147+ Word('V'):paste;
1148+ Word('Z'):copy(buf);
10641149 end;
1065- end else begin
1150+ end
1151+ else begin
10661152 case Key of
1067- VK_DELETE:seldel;
1153+ VK_DELETE:seldel;
10681154 end;
10691155 end;
10701156
@@ -1081,38 +1167,35 @@
10811167 if ssDouble in Shift then begin
10821168 Options:=Options+[goEditing]-[goRangeSelect];
10831169 Col:=ACol;
1084- Row:=ARow;
1170+ row:=ARow;
10851171 EditorMode:=true;
1086- end;
1087- if downinselection then exit;
1172+ end;
1173+ if downinselection then
1174+ exit;
10881175
1089- // Options:=Options-[goEditing]+[goRangeSelect];
1176+ // Options:=Options-[goEditing]+[goRangeSelect];
10901177 //
1091- // if(Button=mbLeft)then begin
1092- // if(FixedRows>0) and (ARow=0) and (ACol>0) and not Sizing(X,Y) then begin
1093- // end else if (FixedCols>0) and (ACol=0) and (ARow>0) and not Sizing(X,Y) then begin
1094- // end else if((Col=ACol) and (Row=ARow))then begin
1095- // Options:=Options+[goEditing]-[goRangeSelect];
1096- // EditorMode:=true;
1097- // end else begin
1098- // EditorMode:=false;
1099- // end;
1100- // end;
1178+ // if(Button=mbLeft)then begin
1179+ // if(FixedRows>0) and (ARow=0) and (ACol>0) and not Sizing(X,Y) then begin
1180+ // end else if (FixedCols>0) and (ACol=0) and (ARow>0) and not Sizing(X,Y) then begin
1181+ // end else if((Col=ACol) and (Row=ARow))then begin
1182+ // Options:=Options+[goEditing]-[goRangeSelect];
1183+ // EditorMode:=true;
1184+ // end else begin
1185+ // EditorMode:=false;
1186+ // end;
1187+ // end;
11011188 inherited;
11021189 end;
11031190
1104-
1105-
11061191 procedure TGrid.MouseMove(Shift:TShiftState;X,Y:Integer);
11071192 var
11081193 DataObject:IDataObject;
1109- s :string;
1110- dwEffect :Integer;
1111- ACol,ARow :Longint;
1112- savesel :TGridRect;
1194+ s:string;
1195+ dwEffect:Integer;
1196+ ACol,ARow:Longint;
1197+ savesel:TGridRect;
11131198
1114-
1115-
11161199 begin
11171200 MouseToCell(X,Y,ACol,ARow);
11181201 if not downinselection then begin
@@ -1120,23 +1203,24 @@
11201203 exit;
11211204
11221205 end;
1123- if not(csLButtonDown in ControlState) then exit;
1206+ if not(csLButtonDown in ControlState) then
1207+ exit;
11241208
11251209 s:=Application.ExeName;
1126- //左ボタンが押された状態で、マウスの位置が閾値を超えたらドラッグ開始
1210+ // 左ボタンが押された状態で、マウスの位置が閾値を超えたらドラッグ開始
11271211
11281212 if (csLButtonDown in ControlState)and((Abs(X-FMouseDownPt.X)>=Mouse.DragThreshold)or(Abs(Y-FMouseDownPt.Y)>=Mouse.DragThreshold)) then begin
11291213
11301214 savesel:=selection;
1131- //コントロールにMouseupのメッセージを送っておく
1215+ // コントロールにMouseupのメッセージを送っておく
11321216 Perform(WM_LBUTTONUP,0,MakeLong(X,Y));
1133- // Files.Enabled:=false;
1217+ // Files.Enabled:=false;
11341218 selection:=savesel;
1135- //BeginDrag(true);
1219+ // BeginDrag(true);
11361220
1137- //ファイル名からIDataObjectを取得
1138- DataObject:=TextDeFindForm.GetFilePathDataObject(Self);
1139- //OLEドラッグ&ドロップ開始
1221+ // ファイル名からIDataObjectを取得
1222+ DataObject:=TextDeFindForm.GetFilePathDataObject(self);
1223+ // OLEドラッグ&ドロップ開始
11401224 dwEffect:=DROPEFFECT_NONE;
11411225 DoDragDrop(DataObject,TextDeFindForm,DROPEFFECT_COPY,dwEffect);
11421226 end;
@@ -1151,7 +1235,8 @@
11511235 var
11521236 i:Integer;
11531237 begin
1154- for i:=1 to GetNumScrollLines do SendMessage(Handle,WM_VSCROLL,SB_LINEDOWN,0);
1238+ for i:=1 to GetNumScrollLines do
1239+ SendMessage(Handle,WM_VSCROLL,SB_LINEDOWN,0);
11551240 Result:=true;
11561241 end;
11571242
@@ -1159,13 +1244,14 @@
11591244 var
11601245 i:Integer;
11611246 begin
1162- for i:=1 to GetNumScrollLines do SendMessage(Handle,WM_VSCROLL,SB_LINEUP,0);
1247+ for i:=1 to GetNumScrollLines do
1248+ SendMessage(Handle,WM_VSCROLL,SB_LINEUP,0);
11631249 Result:=true;
11641250 end;
11651251
11661252 function TGrid.ColExpand(min:Integer):Integer;
11671253 var
1168- i,j :Integer;
1254+ i,j:Integer;
11691255 w1,w2,w3:Integer;
11701256 begin
11711257 w3:=0;
@@ -1174,14 +1260,17 @@
11741260 w1:=0;
11751261 for i:=0 to RowCount-1 do begin
11761262 w2:=Canvas.TextWidth('['+cells[j,i]);
1177- if (w1<w2) then w1:=w2;
1263+ if (w1<w2) then
1264+ w1:=w2;
11781265 end;
1179- if w1<min then w1:=min;
1266+ if w1<min then
1267+ w1:=min;
11801268 ColWidths[j]:=w1;
11811269 w3:=w3+(w1)+GridLineWidth;
11821270 end;
11831271 for j:=0 to ColCount-1 do
1184- if ColWidths[j]>gridWidth then ColWidths[j]:=trunc(gridWidth/2);
1272+ if ColWidths[j]>gridWidth then
1273+ ColWidths[j]:=trunc(gridWidth/2);
11851274
11861275 DefaultRowHeight:=Canvas.TextHeight('あ')+2;
11871276 Result:=w3+4;
@@ -1193,9 +1282,12 @@
11931282 w:Integer;
11941283 begin
11951284 Result:=0;
1196- if cnt<0 then exit;
1197- if Y<0 then exit;
1198- if Y>=RowCount then exit;
1285+ if cnt<0 then
1286+ exit;
1287+ if Y<0 then
1288+ exit;
1289+ if Y>=RowCount then
1290+ exit;
11991291 w:=RowCount-cnt;
12001292 for i:=Y to w-1 do begin
12011293 Rows[i]:=Rows[i+cnt];
@@ -1205,14 +1297,15 @@
12051297 RowCount:=w;
12061298 end;
12071299
1208-
12091300 function TGrid.RowInsert(Y,cnt:Integer):Integer;
12101301 var
1211- i :Integer;
1302+ i:Integer;
12121303 lcnt:Integer;
12131304 begin
1214- if cnt<0 then exit;
1215- if (Y<0)or(Y>=RowCount) then Y:=RowCount;
1305+ if cnt<0 then
1306+ exit;
1307+ if (Y<0)or(Y>=RowCount) then
1308+ Y:=RowCount;
12161309 RowCount:=RowCount+cnt;
12171310 lcnt:=RowCount;
12181311
@@ -1220,7 +1313,8 @@
12201313 Rows[i]:=Rows[i-cnt];
12211314 RowHeights[i]:=RowHeights[i-cnt];
12221315 end;
1223- for i:=0 to cnt-1 do Rows[Y+i].clear();
1316+ for i:=0 to cnt-1 do
1317+ Rows[Y+i].clear();
12241318 Result:=0;
12251319 end;
12261320
@@ -1228,33 +1322,36 @@
12281322 var
12291323 i:Integer;
12301324 begin
1231- if (Y<0) then Y:=0;
1232- if Y>=RowCount then Y:=RowCount;
1233- for i:=0 to cnt-1 do Rows[Y+i].clear();
1325+ if (Y<0) then
1326+ Y:=0;
1327+ if Y>=RowCount then
1328+ Y:=RowCount;
1329+ for i:=0 to cnt-1 do
1330+ Rows[Y+i].clear();
12341331 Result:=0
12351332 end;
12361333
12371334 function TStringDynArrayHelper.add(s:string):Integer;
12381335 begin
1239- SetLength(Self,Length(Self)+1);
1240- Self[Length(Self)-1]:=s;
1241- Result:=Length(Self);
1336+ SetLength(self,Length(self)+1);
1337+ self[Length(self)-1]:=s;
1338+ Result:=Length(self);
12421339
12431340 end;
12441341
12451342 function TStringDynArrayHelper.getcount:Integer;
12461343 begin
1247- Result:=Length(Self);
1344+ Result:=Length(self);
12481345 end;
12491346
12501347 procedure TStringDynArrayHelper.setcount(const i:Integer);
12511348 begin
1252- SetLength(Self,i);
1349+ SetLength(self,i);
12531350 end;
12541351
12551352 function TStringDynArrayHelper.hi:Integer;
12561353 begin
1257- Result:=High(Self);
1354+ Result:=High(self);
12581355
12591356 end;
12601357
@@ -1261,16 +1358,20 @@
12611358 function TStringDynArrayHelper.item(i:Integer):String;
12621359 begin
12631360 Result:='';
1264- if i<0 then exit;
1265- if i>High(Self) then exit;
1266- Result:=Self[i];
1361+ if i<0 then
1362+ exit;
1363+ if i>High(self) then
1364+ exit;
1365+ Result:=self[i];
12671366 end;
12681367
12691368 function TStringDynArrayHelper.save(f:string):boolean;
12701369 begin
12711370 with stringselfcreate do
1272- try SaveToFile(f,TEncoding.UTF8);
1273- except Free;
1371+ try
1372+ SaveToFile(f,TEncoding.UTF8);
1373+ except
1374+ Free;
12741375 end;
12751376 end;
12761377
@@ -1279,8 +1380,9 @@
12791380 with TStringList.Create do
12801381 try
12811382 LoadFromFile(f);
1282- Self:=TStringDynArray(ToStringArray);
1283- except Free;
1383+ self:=TStringDynArray(ToStringArray);
1384+ except
1385+ Free;
12841386 end;
12851387 end;
12861388
@@ -1289,7 +1391,8 @@
12891391 s:string;
12901392 begin
12911393 Result:=TStringSelf.Create;
1292- for s in Self do Result.add(s);
1394+ for s in self do
1395+ Result.add(s);
12931396 end;
12941397
12951398 function TStringDynArrayHelper.adduni(s:string):Integer;
@@ -1297,7 +1400,8 @@
12971400 i:Integer;
12981401 begin
12991402 for i:=0 to hi do
1300- if Self[i]=s then exit(-1);
1403+ if self[i]=s then
1404+ exit(-1);
13011405 add(s);
13021406 Result:=count;
13031407 end;
@@ -1304,134 +1408,152 @@
13041408
13051409 function TStringDynArrayHelper.cat(s,e:string):String;
13061410 var
1307- t:string;
1411+ T:string;
13081412 begin
1309- for t in Self do Result:=Result+s+t+e;
1413+ for T in self do
1414+ Result:=Result+s+T+e;
13101415 end;
13111416
13121417 procedure TStringDynArrayHelper.clear;
13131418 begin
1314- SetLength(Self,0);
1419+ SetLength(self,0);
13151420 end;
13161421
13171422 function TStringSelf.this:TStringList;
13181423 begin
1319- exit(Self);
1424+ exit(self);
13201425 end;
13211426
1322-//初期化処理
1427+// 初期化処理
13231428 { TStringsHelper }
13241429
1325-function TStringsHelper.setstrings(sa: TStringDynArray): Integer;
1326-var i:integer;
1430+function TStringsHelper.setstrings(sa:TStringDynArray):Integer;
1431+var
1432+ i:Integer;
13271433 begin
1328- for i:=0 to sa.Count-1 do
1329- if i<Count then
1330- Self[i]:=sa[i];
1434+ for i:=0 to sa.count-1 do
1435+ if i<count then self[i]:=sa[i];
13311436 end;
13321437
13331438 { TIniFileHelper }
13341439
1335-procedure TMemIniFileHelper.readgrid(sc: string; G: TGrid);
1336-var x,y:integer;
1440+procedure TMemIniFileHelper.readgrid(sc:string;G:TGrid);
1441+var
1442+ X,Y:Integer;
13371443 s:string;
13381444 begin
1339- G.rowdo(procedure(X,Y:Integer)begin
1340- G.rows[y].clear;
1341- end);
1342- G.rowcount:=1;
1343- for y:=0 to MAXLIST do begin
1344- for x:=0 to G.ColCount-1 do begin
1345- s:=inttostr(y)+','+inttostr(x);
1346- if not ValueExists(sc,s) then break;
1347- if x>=G.colcount then G.colcount:=x+1;
1348- if y>=G.rowcount then G.rowcount:=y+1;
1349- G.cells[x,y]:=ReadString(sc,inttostr(y)+','+inttostr(x),'');
1445+ G.rowdo(
1446+ procedure(X,Y:Integer)
1447+ begin
1448+ G.Rows[Y].clear;
1449+ end);
1450+ G.RowCount:=1;
1451+ for Y:=0 to MAXLIST do begin
1452+ for X:=0 to G.ColCount-1 do begin
1453+ s:=inttostr(Y)+','+inttostr(X);
1454+ if not ValueExists(sc,s) then
1455+ break;
1456+ if X>=G.ColCount then
1457+ G.ColCount:=X+1;
1458+ if Y>=G.RowCount then
1459+ G.RowCount:=Y+1;
1460+ G.cells[X,Y]:=ReadString(sc,inttostr(Y)+','+inttostr(X),'');
13501461 end;
13511462 end;
1352- if G.rowcount<2 then G.rowcount:=2;
1353- G.fixedrows:=1;
1463+ if G.RowCount<2 then
1464+ G.RowCount:=2;
1465+ G.FixedRows:=1;
13541466 G.Rows[0].setstrings(CHEAD);
13551467 G.ColExpand(10);
13561468 end;
13571469
1358-procedure TMemIniFileHelper.writegrid(sc: string; G: TGrid);
1470+procedure TMemIniFileHelper.writegrid(sc:string;G:TGrid);
13591471 begin
13601472 EraseSection(sc);
1361- G.alldo(procedure(X,Y:Integer)begin
1362- WriteString(sc,inttostr(y)+','+inttostr(x),G.cells[x,y]);
1363- end);
1473+ G.alldo(
1474+ procedure(X,Y:Integer)
1475+ begin
1476+ WriteString(sc,inttostr(Y)+','+inttostr(X),G.cells[X,Y]);
1477+ end);
13641478
13651479 end;
13661480
1367-procedure TMemIniFileHelper.readstrings(sc: string; sl:TStrings);
1368-var i:integer;
1481+procedure TMemIniFileHelper.readstrings(sc:string;sl:TStrings);
1482+var
1483+ i:Integer;
13691484 s:string;
13701485 begin
1371- if SectionExists(sc) then sl.clear;
1486+ if SectionExists(sc) then
1487+ sl.clear;
13721488 for i:=0 to MAXLIST do begin
1373- if not ValueExists(sc,inttostr(i)) then break;
1489+ if not ValueExists(sc,inttostr(i)) then
1490+ break;
13741491 sl.add(ReadString(sc,inttostr(i),''));
13751492 end;
13761493 end;
13771494
1378-
1379-
1380-procedure TMemIniFileHelper.writestrings(sc: string; sl: TStrings);
1381-var i:integer;
1495+procedure TMemIniFileHelper.writestrings(sc:string;sl:TStrings);
1496+var
1497+ i:Integer;
13821498 begin
13831499 EraseSection(sc);
1384- for i:=0 to sl.Count-1 do
1385- WriteString(sc,inttostr(i),sl[i]);
1500+ for i:=0 to sl.count-1 do WriteString(sc,inttostr(i),sl[i]);
13861501 end;
13871502
1388-procedure TMemIniFileHelper.readtreeview(sc: string; T: TTreeView);
1503+procedure TMemIniFileHelper.readtreeview(sc:string;T:TTreeView);
13891504 var
13901505 N:TTreeNode;
1391- i:integer;
1392- procedure sub(key:string;N:TTreeNode);
1393- var i:integer;
1506+ i:Integer;
1507+ procedure sub(Key:string;N:TTreeNode);
1508+ var
1509+ i:Integer;
13941510 k:string;
13951511 begin
13961512 for i:=0 to MAXLIST do begin
1397- k:=key+','+inttostr(i);
1398- if not ValueExists(sc,k) then break;
1513+ k:=Key+','+inttostr(i);
1514+ if not ValueExists(sc,k) then
1515+ break;
13991516 T.Items.AddChild(N,ReadString(sc,k,''));
14001517 sub(k,N);
14011518 end;
14021519 end;
1520+
14031521 begin
1404- if SectionExists(sc) then T.Items.clear;
1522+ if SectionExists(sc) then
1523+ T.Items.clear;
14051524 for i:=0 to MAXLIST do begin
1406- if not ValueExists(sc,inttostr(i)) then break;
1407- N:=T.Items.Add(nil,ReadString(sc,inttostr(i),''));
1525+ if not ValueExists(sc,inttostr(i)) then
1526+ break;
1527+ N:=T.Items.add(nil,ReadString(sc,inttostr(i),''));
14081528 sub(inttostr(i),N);
14091529 end;
14101530
14111531 end;
14121532
1413-procedure TMemIniFileHelper.writetreeview(sc: string; T: TTreeView);
1533+procedure TMemIniFileHelper.writetreeview(sc:string;T:TTreeView);
14141534 var
14151535 N:TTreeNode;
1416- i:integer;
1417- procedure sub(key: string;N:TTreeNode);
1418- var i:integer;
1536+ i:Integer;
1537+ procedure sub(Key:string;N:TTreeNode);
1538+ var
1539+ i:Integer;
14191540 begin
14201541 N:=N.getFirstChild;
14211542 i:=0;
14221543 while N<>nil do begin
1423- WriteString(sc,key+','+inttostr(N.index),N.text);
1544+ WriteString(sc,Key+','+inttostr(N.index),N.Text);
14241545 sub(sc,N);
14251546 N:=N.getNextSibling;
14261547 inc(i);
14271548 end;
14281549 end;
1550+
14291551 begin
14301552 EraseSection(sc);
14311553 i:=0;
14321554 N:=T.Items.GetFirstNode;
14331555 while N<>nil do begin
1434- WriteString(sc,inttostr(N.index),N.text);
1556+ WriteString(sc,inttostr(N.index),N.Text);
14351557 sub(inttostr(N.index),N);
14361558 N:=N.getNextSibling;
14371559 inc(i);
@@ -1443,7 +1565,7 @@
14431565 SHGetMalloc(Malloc);
14441566 OleInitialize(nil);
14451567
1446-//終了処理
1568+// 終了処理
14471569 finalization
14481570
14491571 OleUninitialize;