• R/O
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Révision11 (tree)
l'heure2018-12-25 20:09:10
Auteurkentamaken

Message de Log

ituneで開く

Change Summary

Modification

--- textdefind.dproj (revision 10)
+++ textdefind.dproj (revision 11)
@@ -78,6 +78,7 @@
7878 <DCC_RemoteDebug>false</DCC_RemoteDebug>
7979 <BT_BuildType>Debug</BT_BuildType>
8080 <AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
81+ <DCC_Warnings>false</DCC_Warnings>
8182 </PropertyGroup>
8283 <PropertyGroup Condition="'$(Cfg_2)'!=''">
8384 <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
--- textdefindunit.pas (revision 10)
+++ textdefindunit.pas (revision 11)
@@ -7,7 +7,9 @@
77 System.Classes,Vcl.Graphics,
88 Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.StdCtrls,Vcl.ExtCtrls,Vcl.Grids,
99 types,inifiles,
10- Vcl.ComCtrls,ShlObj,ActiveX,Vcl.Menus,Vcl.CheckLst;
10+ Vcl.ComCtrls,ShlObj,ActiveX,Vcl.Menus,Vcl.CheckLst, IdBaseComponent,
11+ IdComponent, IdTCPConnection, IdTCPClient,IdGlobal, IdURI, IdHTTP, Vcl.OleCtrls, SHDocVw,
12+ IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL;
1113
1214 type
1315 TStringSelf=class(TStringList)
@@ -51,10 +53,6 @@
5153
5254 function DoMouseWheelDown(Shift:TShiftState;MousePos:TPoint):boolean;override;
5355 function DoMouseWheelUp(Shift:TShiftState;MousePos:TPoint):boolean;override;
54- function ColExpand(min:Integer):Integer;
55- function RowDelete(Y,cnt:Integer):Integer;
56- function RowInsert(Y,cnt:Integer):Integer;
57- function RowClear(Y,cnt:Integer):Integer;
5856
5957 public
6058 downinselection:boolean;
@@ -61,6 +59,15 @@
6159 saverect:TGridRect;
6260 buf:TGrid;
6361
62+ function ColExpand(min:Integer):Integer;
63+ function RowDelete(Y,cnt:Integer):Integer;
64+ function RowInsert(Y,cnt:Integer):Integer;
65+ function RowClear(Y,cnt:Integer):Integer;
66+ function ColDelete(X,cnt:Integer):Integer;
67+ function ColInsert(X,cnt:Integer):Integer;
68+ function ColClear(X,cnt:Integer):Integer;
69+
70+
6471 procedure cutcopy(modecut:boolean);
6572 function paste:TGridRect;
6673 function selrowdo(func:TFuncXY):Integer;
@@ -70,9 +77,11 @@
7077 procedure copy(G:TGrid);
7178 procedure savebuf;
7279 procedure seldel;
80+ function seltext:string;
7381 procedure setfixed;
7482 function load(fn:string):boolean;
7583 function save(fn:string):boolean;
84+ procedure clear;
7685
7786 published
7887 property InplaceEditor;
@@ -109,7 +118,7 @@
109118 SaveDialog:TSaveDialog;
110119 OpenDialog:TOpenDialog;
111120 LeftPanel:TPanel;
112- Name:TComboBox;
121+ ListName: TComboBox;
113122 Text:TRichEdit;
114123 Tree:TTreeView;
115124 Button1:TButton;
@@ -134,6 +143,19 @@
134143 OptionUrlDQuote:TCheckBox;
135144 OpURLComment:TCheckBox;
136145 OpURLButton:TButton;
146+ Web: TWebBrowser;
147+ IdHTTP: TIdHTTP;
148+ IdSSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
149+ Memo1: TMemo;
150+ OpURLFile: TCheckBox;
151+ OpURLitune: TCheckBox;
152+ PFileUpdate: TMenuItem;
153+ PColAdd: TMenuItem;
154+ PColDel: TMenuItem;
155+ PRowAdd: TMenuItem;
156+ PRowDel: TMenuItem;
157+ N5: TMenuItem;
158+ PClear: TMenuItem;
137159 procedure FindClick(Sender:TObject);
138160 procedure FormCreate(Sender:TObject);
139161 procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
@@ -148,7 +170,7 @@
148170 procedure PTextSaveAsClick(Sender:TObject);
149171 procedure PTextOpenClick(Sender:TObject);
150172 procedure FormDestroy(Sender:TObject);
151- procedure NameChange(Sender:TObject);
173+ procedure ListNameChange(Sender:TObject);
152174 procedure TreeClick(Sender:TObject);
153175 procedure Button1Click(Sender:TObject);
154176 procedure PFileFolderClick(Sender:TObject);
@@ -163,6 +185,15 @@
163185 procedure GridFilesSetEditText(Sender:TObject;ACol,ARow:Integer;const Value:string);
164186 procedure FormClose(Sender:TObject;var Action:TCloseAction);
165187 procedure OpURLButtonClick(Sender:TObject);
188+ procedure PFileUpdateClick(Sender: TObject);
189+ procedure PTextFindUrlAddClick(Sender: TObject);
190+ procedure PColAddClick(Sender: TObject);
191+ procedure GridFilesSelectCell(Sender: TObject; ACol, ARow: Integer;
192+ var CanSelect: Boolean);
193+ procedure PRowDelClick(Sender: TObject);
194+ procedure PRowAddClick(Sender: TObject);
195+ procedure PColDelClick(Sender: TObject);
196+ procedure PClearClick(Sender: TObject);
166197 private
167198 { Private 宣言 }
168199 public
@@ -180,7 +211,7 @@
180211
181212 implementation
182213
183-uses strutils,IOUtils,masks,clipbrd,SHELLAPI,Vcl.FileCtrl,IdGlobal,IdURI;
214+uses strutils,IOUtils,masks,clipbrd,SHELLAPI,Vcl.FileCtrl,ComObj,System.JSON;
184215
185216 var
186217 Malloc:IMalloc;
@@ -199,12 +230,22 @@
199230 LF=#10;
200231 CRLF=#13#10;
201232 TAB=#9;
202- CTEXT=1;
203- CFILE=2;
204- CPATH=3;
233+ CTEXT='検索文字';
234+ CFILE='ファイル';
235+ CPATH='パス';
236+ CNAME='アーティスト';
237+ COPEN='開く';
238+ COPEN2='開く2';
205239
206240 var
207- CHEAD:TStringDynArray=['','検索文字','ファイル','パス'];
241+ NTEXT:integer;
242+ NFILE:integer;
243+ NPATH:integer;
244+ NNAME:integer;
245+ NOPEN:integer;
246+ NOPEN2:integer;
247+ CHEAD:TStringDynArray=['',CTEXT,CFILE,CPATH];
248+ CHEADWEB:TStringDynArray=['',CTEXT,CFILE,COPEN,COPEN2,CPATH,CNAME];
208249
209250 {$R *.dfm}
210251
@@ -248,15 +289,44 @@
248289 Result:=String(buf);
249290 end;
250291
251-procedure TTextDeFindForm.FormCreate(Sender:TObject);
252- procedure LoadChecked(C:TComponent);
292+
293+procedure OptionSaveLoad(C:TPanel;bsave:boolean);
294+var
295+ i:integer;
296+ s:string;
297+ B:TButton;
298+ procedure Save(C:TComponent);
253299 begin
254300 if C.ClassType=TMenuItem then
301+ Ini.WriteBool('',C.Name,TMenuItem(C).Checked);
302+ if C.ClassType=TCheckBox then
303+ Ini.WriteBool('',C.Name,TCheckBox(C).Checked);
304+ if C.ClassType=TEdit then
305+ Ini.WriteString('',C.Name,TEdit(C).Text);
306+ end;
307+
308+ procedure Load(C:TComponent);
309+ begin
310+ if C.ClassType=TMenuItem then
255311 TMenuItem(C).Checked:=Ini.ReadBool('',C.Name,TMenuItem(C).Checked);
256312 if C.ClassType=TCheckBox then
257313 TCheckBox(C).Checked:=Ini.ReadBool('',C.Name,TCheckBox(C).Checked);
314+ if C.ClassType=TEdit then begin
315+ s:=Ini.ReadString('',C.Name,TEdit(C).Text);
316+ if s<>'' then TEdit(C).Text:=s;
317+ end;
258318 end;
319+begin
320+ for i:=0 to C.ControlCount-1 do begin
321+ if bsave then Save(C.Controls[i]) else Load(C.Controls[i]);
322+ end;
259323
324+end;
325+
326+
327+
328+procedure TTextDeFindForm.FormCreate(Sender:TObject);
329+
260330 begin
261331 Ini:=TMemInifile.Create(ChangeFileExt(Application.ExeName,'.ini'));
262332 Inifile:=TMemInifile.Create(ChangeFileExt(Application.ExeName,'.txt'));
@@ -269,13 +339,7 @@
269339 LeftPanel.Width:=Ini.ReadInteger('','LeftPanel.Width',LeftPanel.Width);
270340 Font.Size:=Ini.ReadInteger('','Font.Size',Font.Size);
271341
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);
342+ OptionSaveLoad(OpURLPanel,false);
279343
280344 Path.Text:=Ini.ReadString('','Path.Text','');
281345 Url.Text:=Ini.ReadString('','Url.Text','');
@@ -287,8 +351,8 @@
287351
288352 try
289353 // Tree.LoadFromFile(ChangeFileExt(Application.ExeName,'.txt'));
290- NameChange(Sender);
291- pname:=Name.Text;
354+ ListNameChange(Sender);
355+ pname:=ListName.Text;
292356 TreeClick(Sender);
293357 except
294358 ShowMessage('ツリーテキストを読み込めませんでした');
@@ -298,13 +362,6 @@
298362
299363 procedure TTextDeFindForm.FormClose(Sender:TObject;var Action:TCloseAction);
300364
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;
308365
309366 begin
310367 if Application.Terminated then
@@ -318,15 +375,10 @@
318375 Ini.WriteString('','Url.Text',Url.Text);
319376 Ini.writestrings('Url.Items',Url.Items);
320377
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);
378+ OptionSaveLoad(OpURLPanel,true);
328379
329- NameChange(Sender);
380+
381+ ListNameChange(Sender);
330382 Inifile.writetreeview('Tree',Tree);
331383 // Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt'));
332384
@@ -375,7 +427,7 @@
375427
376428 procedure TTextDeFindForm.FindUrlButtonClick(Sender:TObject);
377429 var
378- s,ss:string;
430+ urls,s,ss:string;
379431 ls,le,i,count:Integer;
380432
381433 function option(Url:String):String;
@@ -407,19 +459,109 @@
407459 Url:='\"'+Url+'\"';
408460 end;
409461
410- Result:=Url;
462+ Result:=trim(Url);
411463 end;
412464
465+ function iddownload(url:string):string;
466+ var
467+ S : TStringStream;
468+ begin
469+ IdHTTP.HandleRedirects := True;
470+ S := TStringStream.Create('',TEncoding.UTF8);
471+ try
472+ url:=TIdURI.URLEncode(url,IndyTextEncoding_UTF8);
473+ IdHTTP.Get(url, S);
474+ S.Position:=0;
475+ result:=S.ReadString(S.Size);
476+ finally
477+ FreeAndNil(S);
478+ end;
479+ IdHTTP.Disconnect;
480+
481+ end;
482+
483+ function jsontogrid(url:string):string;
484+ var
485+ obj: TJSONObject;
486+ val: TJSONValue;
487+ vresults: TJSONArray;
488+ vitem: TJSONObject;
489+ pair: TJSONPair;
490+ i,r:integer;
491+ data:string;
492+ function getval(k:string):string;
493+ begin
494+ try
495+ result:=vitem.GetValue(k).Value;
496+ except
497+ result:='';
498+ end;
499+ end;
500+
501+ begin
502+ data:=iddownload(url);
503+// memo1.Lines.LoadFromFile('D:\utilsrad10\textdefind\Win32\Debug\1-10.txt',TEncoding.UTF8);
504+// data:=memo1.Lines.text;
505+ try
506+ obj := TJSONObject.ParseJSONValue(Data) as TJSONObject;
507+ vresults:=obj.GetValue('results') as TJSONArray;
508+ for i:=0 to vresults.count-1 do begin
509+ vitem:=vresults.items[i] as TJSONObject;;
510+ r:=Files.RowCount;
511+ Files.RowCount:=r+1;
512+ Files.cells[NTEXT,r]:=option(ss);
513+ Files.cells[NFILE,r]:=GetVal('trackName');
514+ Files.cells[NPATH,r]:=GetVal('trackViewUrl').Replace('https:','itmss:');
515+ Files.cells[NNAME,r]:=GetVal('artistName');
516+ Files.cells[NOPEN,r]:='M';
517+ Files.cells[NOPEN2,r]:='S';
518+ end;
519+ if vresults.count=0 then begin
520+ r:=Files.RowCount;
521+ Files.RowCount:=r+1;
522+ Files.cells[NTEXT,r]:=option(ss);
523+ end;
524+
525+ except
526+ end;
527+ end;
528+
529+ function datatogrid(url:string):string;
530+ var
531+ data:string;
532+ i,r:integer;
533+ begin
534+ data:=iddownload(url);
535+ r:=Files.RowCount;
536+ Files.RowCount:=r+1;
537+ Files.cells[NTEXT,r]:=option(ss);
538+ Files.cells[NFILE,r]:=data;
539+ end;
540+
541+
542+
543+
413544 begin
414545 urlrun:=not urlrun;
415546 // with GridFiles do begin
416547 // for i:=selection.top to selection.Bottom do begin
417548 // end;
549+
550+// if Sender<>PTextFindUrlAdd then begin
551+// Files.clear;
552+// Files.RowCount:=1;
553+// end;
554+
555+ Files.ColCount:=CHEADWEB.count;
556+ Files.Rows[0].setstrings(CHEADWEB);
557+ PFileUpdateClick(Sender);
558+
418559 Screen.Cursor:=crHourGlass;
419560 ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0);
420561 le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*Integer(Text.SelLength>0),0);
421562 for i:=ls to le do begin
422563 FindUrlButton.Caption:='中止';
564+ Caption:=Self.Name+Format(' %d/%d',[i,le]);
423565 ss:=Text.lines[i];
424566 if not urlrun then
425567 break;
@@ -427,11 +569,26 @@
427569 s:=Url.Text;
428570 if s='' then
429571 continue;
430- s:=s.Replace('%リスト名%',option(Name.Text));
572+ s:=s.Replace('%リスト名%',option(ListName.Text));
431573 s:=s.Replace('%検索文字%',option(ss));
432- ShellExecute(Handle,'open',PChar(s),'','',1);
433- sleep(3000);
574+ urls:=s;
575+
576+ if OpURLFile.Checked then
577+ datatogrid(urls)
578+ else if OpURLitune.Checked and (urls.IndexOf('itmss:')=0) then begin
579+ urls:=urls.Replace('itmss:','https:');
580+ jsontogrid(urls);
581+ end else
582+ ShellExecute(Handle,'open',PChar(urls),'','',1);
583+
584+ if Files.RowCount>(Files.VisibleRowCount+1) then
585+ Files.TopRow:=Files.RowCount-Files.VisibleRowCount;
586+ Files.ColExpand(10);
587+ Files.setfixed;
588+
589+ sleep(1000);
434590 end;
591+
435592 FindUrlButton.Caption:='URL検索';
436593 urlrun:=false;
437594 Screen.Cursor:=crDefault;
@@ -440,13 +597,13 @@
440597 procedure TTextDeFindForm.PFileExecClick(Sender:TObject);
441598 begin
442599 with GridFiles do
443- ShellExecute(Handle,'open',PChar(INCBS(cells[CPATH,row])+cells[CFILE,row]),'','',1);
600+ ShellExecute(Handle,'open',PChar(INCBS(cells[NPATH,row])+cells[NFILE,row]),'','',1);
444601 end;
445602
446603 procedure TTextDeFindForm.PFileFolderClick(Sender:TObject);
447604 begin
448605 with GridFiles do
449- ShellExecute(Handle,'open',PChar(INCBS(cells[CPATH,row])),'','',1);
606+ ShellExecute(Handle,'open',PChar(INCBS(cells[NPATH,row])),'','',1);
450607
451608 end;
452609
@@ -471,6 +628,26 @@
471628 Files.save(SaveDialog.FileName);
472629 end;
473630
631+procedure TTextDeFindForm.PFileUpdateClick(Sender: TObject);
632+begin
633+ NTEXT:=Files.Rows[0].IndexOf(CTEXT);
634+ NFILE:=Files.Rows[0].IndexOf(CFILE);
635+ NPATH:=Files.Rows[0].IndexOf(CPATH);
636+ NNAME:=Files.Rows[0].IndexOf(CNAME);
637+ NOPEN:=Files.Rows[0].IndexOf(COPEN);
638+ NOPEN2:=Files.Rows[0].IndexOf(COPEN2);
639+end;
640+
641+procedure TTextDeFindForm.PRowAddClick(Sender: TObject);
642+begin
643+ Files.RowInsert(Files.Selection.Top,Files.Selection.Bottom-Files.Selection.Top+1)
644+end;
645+
646+procedure TTextDeFindForm.PRowDelClick(Sender: TObject);
647+begin
648+ Files.RowDelete(Files.Selection.Top,Files.Selection.Bottom-Files.Selection.Top+1)
649+end;
650+
474651 procedure TTextDeFindForm.PTextCopyClick(Sender:TObject);
475652 begin
476653 Text.CopyToClipboard;
@@ -486,6 +663,11 @@
486663 FindClick(Sender);
487664 end;
488665
666+procedure TTextDeFindForm.PTextFindUrlAddClick(Sender: TObject);
667+begin
668+ FindUrlButtonClick(Sender);
669+end;
670+
489671 procedure TTextDeFindForm.PTextFindUrlClick(Sender:TObject);
490672 begin
491673 FindUrlButtonClick(Sender);
@@ -520,6 +702,7 @@
520702 Result:=false;
521703 end;
522704
705+
523706 procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
524707 var
525708 ACol,ARow:Longint;
@@ -532,6 +715,29 @@
532715
533716 end;
534717
718+
719+procedure TTextDeFindForm.GridFilesSelectCell(Sender: TObject; ACol,
720+ ARow: Integer; var CanSelect: Boolean);
721+var
722+s:string;
723+begin
724+ PFileUpdateClick(sender);
725+ if ACol=NOPEN then
726+ s:=Files.cells[NPATH,arow];
727+ if ACol=NOPEN2 then
728+ s:=Files.cells[NPATH,arow]+'&app=itunes';
729+
730+ if s='' then exit;
731+
732+ ShellExecute(Handle,'open',PChar(s),'','',1);
733+
734+// if s.IndexOf('http:')<>0 then
735+// if s.IndexOf('https:')<>0 then
736+// if s.IndexOf('itmss:')<>0 then
737+// exit;
738+
739+end;
740+
535741 procedure TTextDeFindForm.GridFilesSetEditText(Sender:TObject;ACol,ARow:Integer;const Value:string);
536742 begin
537743 // ShowMessage(Value);
@@ -558,7 +764,7 @@
558764
559765 begin
560766
561- ppname:=Name.Text;
767+ ppname:=ListName.Text;
562768
563769
564770 // for i:=Name.Items.Count-1 downto 1 do
@@ -570,13 +776,13 @@
570776 TMP.Items.add(N.Text);
571777 N:=N.getNextSibling;
572778 end;
573- Name.Enabled:=false;
574- Name.Items.Text:=TMP.Items.Text;
779+ ListName.Enabled:=false;
780+ ListName.Items.Text:=TMP.Items.Text;
575781 // Name.ItemIndex:=-1;
576782 // Name.Text:=ppname;
577- Name.ItemIndex:=Name.Items.IndexOf(ppname);
783+ ListName.ItemIndex:=ListName.Items.IndexOf(ppname);
578784 // Application.ProcessMessages;
579- Name.Enabled:=true;
785+ ListName.Enabled:=true;
580786 end;
581787
582788 function inputtextbox(P:TForm;C:TWinControl;Text:string):string;
@@ -621,6 +827,22 @@
621827 end;
622828 end;
623829
830+procedure TTextDeFindForm.PClearClick(Sender: TObject);
831+begin
832+ Files.clear;
833+ Files.RowCOunt:=1;
834+end;
835+
836+procedure TTextDeFindForm.PColAddClick(Sender: TObject);
837+begin
838+ Files.ColInsert(Files.Col,1);
839+end;
840+
841+procedure TTextDeFindForm.PColDelClick(Sender: TObject);
842+begin
843+ Files.ColDelete(Files.Col,1);
844+end;
845+
624846 procedure TTextDeFindForm.UrlEditButtonClick(Sender:TObject);
625847 begin
626848 Url.Items.Text:=inputtextbox(self,Url,Url.Items.Text);
@@ -631,7 +853,7 @@
631853 TreeClick(Sender);
632854 end;
633855
634-procedure TTextDeFindForm.NameChange(Sender:TObject);
856+procedure TTextDeFindForm.ListNameChange(Sender:TObject);
635857 var
636858 N,NN:TTreeNode;
637859 s:string;
@@ -680,9 +902,9 @@
680902 Text.Text:='';
681903 N:=Tree.Items.GetFirstNode;
682904 while N<>nil do begin
683- if N.Text=Name.Text then begin
905+ if N.Text=ListName.Text then begin
684906 childtext(N);
685- Inifile.readgrid('grid\'+Name.Text,TGrid(GridFiles));
907+ Inifile.readgrid('grid\'+ListName.Text,TGrid(GridFiles));
686908 end;
687909 N:=N.getNextSibling;
688910 end;
@@ -705,7 +927,7 @@
705927 // Text.lines.Text:=
706928 // Ini.ReadSectionValues(Name.Text,Text.lines);
707929
708- pname:=Name.Text;
930+ pname:=ListName.Text;
709931 end;
710932
711933 procedure TTextDeFindForm.OpURLButtonClick(Sender:TObject);
@@ -757,9 +979,9 @@
757979 snm:=findr(ExtractFileName(s));
758980 if MatchesMask(snm,nm) then begin
759981 Files.RowCount:=Files.RowCount+1;
760- Files.cells[CTEXT,Files.RowCount-1]:=Trim(ssss);
761- Files.cells[CPATH,Files.RowCount-1]:=ExtractFileDir(s);
762- Files.cells[CFILE,Files.RowCount-1]:=ExtractFileName(s);
982+ Files.cells[NTEXT,Files.RowCount-1]:=Trim(ssss);
983+ Files.cells[NPATH,Files.RowCount-1]:=ExtractFileDir(s);
984+ Files.cells[NFILE,Files.RowCount-1]:=ExtractFileName(s);
763985 hit:=true;
764986 end;
765987 end;
@@ -775,7 +997,7 @@
775997
776998 ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0);
777999 pathtext:=Path.Text;
778- pathtext:=pathtext.Replace('%リスト名%',Name.Text);
1000+ pathtext:=pathtext.Replace('%リスト名%',ListName.Text);
7791001 pathtext:=pathtext.Replace('%検索文字%',Text.lines[ls]);
7801002 pathtext:=INCBS(pathtext);
7811003 // snm:=ExtractFileName(Path.Text);
@@ -788,8 +1010,9 @@
7881010 // op := TSearchOption.soTopDirectoryOnly;
7891011 sa:=TDirectory.GetFiles(pathtext,snm,op);
7901012 Files.RowCount:=1;
791- Files.ColCount:=4;
792- Files.Rows[0].setstrings(['','検索文字','ファイル','パス']);
1013+ Files.ColCount:=CHEAD.count;
1014+ Files.Rows[0].setstrings(CHEAD);
1015+ PFileUpdateClick(Sender);
7931016
7941017 if Sender=Find then begin
7951018 ls:=0;
@@ -807,9 +1030,9 @@
8071030
8081031 if not hit then begin
8091032 Files.RowCount:=Files.RowCount+1;
810- Files.cells[CTEXT,Files.RowCount-1]:=Trim(ss);
811- Files.cells[CPATH,Files.RowCount-1]:='';
812- Files.cells[CFILE,Files.RowCount-1]:='';
1033+ Files.cells[NTEXT,Files.RowCount-1]:=Trim(ss);
1034+ Files.cells[NPATH,Files.RowCount-1]:='';
1035+ Files.cells[NFILE,Files.RowCount-1]:='';
8131036 end;
8141037 end;
8151038 Files.ColExpand(10);
@@ -839,7 +1062,7 @@
8391062 exit;
8401063
8411064 for i:=G.selection.top to G.selection.Bottom do begin
842- fn:=INCBS(G.cells[CPATH,i])+G.cells[CFILE,i];
1065+ fn:=INCBS(G.cells[NPATH,i])+G.cells[NFILE,i];
8431066
8441067 if not FileExists(fn) then
8451068 continue;
@@ -860,6 +1083,7 @@
8601083
8611084 // --------------------------------------------------------------------------------
8621085
1086+
8631087 procedure TGrid.copy(G:TGrid);
8641088 var
8651089 r:TGridRect;
@@ -885,6 +1109,7 @@
8851109 self.Parent:=Origin.Parent;
8861110 self.Options:=Origin.Options;
8871111 self.OnSetEditText:=Origin.OnSetEditText;
1112+ self.OnSelectCell:=Origin.OnSelectCell;
8881113 self.OnMouseDown:=Origin.OnMouseDown;
8891114 self.OnMouseMove:=Origin.OnMouseMove;
8901115 buf:=TGrid.Create(self);
@@ -977,6 +1202,7 @@
9771202 Txt.Free;
9781203 end;
9791204
1205+
9801206 function TGrid.paste:TGridRect;
9811207 var
9821208 i,j,si,colcnt:Integer;
@@ -1020,6 +1246,7 @@
10201246 Result:=TGridRect(rect(xs,ys,xs+xw,ys+yw));
10211247 end;
10221248
1249+
10231250 procedure TGrid.savebuf;
10241251 begin
10251252 saverect:=selection;
@@ -1046,10 +1273,8 @@
10461273
10471274 procedure TGrid.setfixed;
10481275 begin
1049- if ColCount>1 then
1050- FixedCols:=1;
1051- if RowCount>1 then
1052- FixedRows:=1;
1276+ if ColCount>1 then FixedCols:=1;
1277+ if RowCount>1 then FixedRows:=1;
10531278 end;
10541279
10551280 function TGrid.load(fn:string):boolean;
@@ -1119,6 +1344,11 @@
11191344 func(0,i);
11201345 end;
11211346
1347+function TGrid.seltext: string;
1348+begin
1349+ result:=cells[col,row];
1350+end;
1351+
11221352 procedure TGrid.SetEditText(ACol,ARow:Integer;const Value:string);
11231353 begin
11241354 inherited;
@@ -1134,6 +1364,7 @@
11341364
11351365 end;
11361366
1367+
11371368 procedure TGrid.KeyDown(var Key:Word;Shift:TShiftState);
11381369 var
11391370 w:Word;
@@ -1188,6 +1419,7 @@
11881419 inherited;
11891420 end;
11901421
1422+
11911423 procedure TGrid.MouseMove(Shift:TShiftState;X,Y:Integer);
11921424 var
11931425 DataObject:IDataObject;
@@ -1276,6 +1508,73 @@
12761508 Result:=w3+4;
12771509 end;
12781510
1511+procedure TGrid.clear;
1512+begin
1513+ alldo(
1514+ procedure(X,Y:Integer)
1515+ begin
1516+ cells[X,Y]:='';
1517+ end);
1518+end;
1519+
1520+function TGrid.ColClear(X, cnt: Integer): Integer;
1521+var
1522+ i:Integer;
1523+begin
1524+ if (X<0) then
1525+ X:=0;
1526+ if X>=ColCount then
1527+ X:=ColCount;
1528+ for i:=0 to cnt-1 do
1529+ Cols[X+i].clear();
1530+ Result:=0
1531+
1532+end;
1533+
1534+function TGrid.ColDelete(X, cnt: Integer): Integer;
1535+var
1536+ i:Integer;
1537+ w:Integer;
1538+begin
1539+ Result:=0;
1540+ if cnt<0 then
1541+ exit;
1542+ if X<0 then
1543+ exit;
1544+ if X>=ColCount then
1545+ exit;
1546+ w:=ColCount-cnt;
1547+ for i:=X to w-1 do begin
1548+ Cols[i]:=Cols[i+cnt];
1549+ ColWidths[i]:=ColWidths[i+cnt];
1550+ end;
1551+ RowClear(w,cnt);
1552+ ColCount:=w;
1553+end;
1554+
1555+
1556+function TGrid.ColInsert(X, cnt: Integer): Integer;
1557+var
1558+ i:Integer;
1559+ lcnt:Integer;
1560+begin
1561+ if cnt<0 then
1562+ exit;
1563+ if (X<0)or(X>=ColCount) then
1564+ X:=ColCount;
1565+ ColCount:=ColCount+cnt;
1566+ lcnt:=ColCount;
1567+
1568+ for i:=lcnt-1 downto X+cnt do begin
1569+ Cols[i]:=Cols[i-cnt];
1570+ ColWidths[i]:=ColWidths[i-cnt];
1571+ end;
1572+ for i:=0 to cnt-1 do
1573+ Cols[X+i].clear();
1574+ Result:=0;
1575+end;
1576+
1577+
12791578 function TGrid.RowDelete(Y,cnt:Integer):Integer;
12801579 var
12811580 i:Integer;
@@ -1448,8 +1747,9 @@
14481747 G.Rows[Y].clear;
14491748 end);
14501749 G.RowCount:=1;
1750+ G.ColCount:=1;
14511751 for Y:=0 to MAXLIST do begin
1452- for X:=0 to G.ColCount-1 do begin
1752+ for X:=0 to 10 do begin
14531753 s:=inttostr(Y)+','+inttostr(X);
14541754 if not ValueExists(sc,s) then
14551755 break;
@@ -1462,8 +1762,9 @@
14621762 end;
14631763 if G.RowCount<2 then
14641764 G.RowCount:=2;
1465- G.FixedRows:=1;
1466- G.Rows[0].setstrings(CHEAD);
1765+
1766+ // G.Rows[0].setstrings(CHEAD);
1767+ G.setfixed;
14671768 G.ColExpand(10);
14681769 end;
14691770