| Revision | 11 (tree) |
|---|---|
| Time | 2018-12-25 20:09:10 |
| Author | kentamaken |
ituneで開く
| @@ -78,6 +78,7 @@ | ||
| 78 | 78 | <DCC_RemoteDebug>false</DCC_RemoteDebug> |
| 79 | 79 | <BT_BuildType>Debug</BT_BuildType> |
| 80 | 80 | <AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode> |
| 81 | + <DCC_Warnings>false</DCC_Warnings> | |
| 81 | 82 | </PropertyGroup> |
| 82 | 83 | <PropertyGroup Condition="'$(Cfg_2)'!=''"> |
| 83 | 84 | <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> |
| @@ -7,7 +7,9 @@ | ||
| 7 | 7 | System.Classes,Vcl.Graphics, |
| 8 | 8 | Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.StdCtrls,Vcl.ExtCtrls,Vcl.Grids, |
| 9 | 9 | 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; | |
| 11 | 13 | |
| 12 | 14 | type |
| 13 | 15 | TStringSelf=class(TStringList) |
| @@ -51,10 +53,6 @@ | ||
| 51 | 53 | |
| 52 | 54 | function DoMouseWheelDown(Shift:TShiftState;MousePos:TPoint):boolean;override; |
| 53 | 55 | 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; | |
| 58 | 56 | |
| 59 | 57 | public |
| 60 | 58 | downinselection:boolean; |
| @@ -61,6 +59,15 @@ | ||
| 61 | 59 | saverect:TGridRect; |
| 62 | 60 | buf:TGrid; |
| 63 | 61 | |
| 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 | + | |
| 64 | 71 | procedure cutcopy(modecut:boolean); |
| 65 | 72 | function paste:TGridRect; |
| 66 | 73 | function selrowdo(func:TFuncXY):Integer; |
| @@ -70,9 +77,11 @@ | ||
| 70 | 77 | procedure copy(G:TGrid); |
| 71 | 78 | procedure savebuf; |
| 72 | 79 | procedure seldel; |
| 80 | + function seltext:string; | |
| 73 | 81 | procedure setfixed; |
| 74 | 82 | function load(fn:string):boolean; |
| 75 | 83 | function save(fn:string):boolean; |
| 84 | + procedure clear; | |
| 76 | 85 | |
| 77 | 86 | published |
| 78 | 87 | property InplaceEditor; |
| @@ -109,7 +118,7 @@ | ||
| 109 | 118 | SaveDialog:TSaveDialog; |
| 110 | 119 | OpenDialog:TOpenDialog; |
| 111 | 120 | LeftPanel:TPanel; |
| 112 | - Name:TComboBox; | |
| 121 | + ListName: TComboBox; | |
| 113 | 122 | Text:TRichEdit; |
| 114 | 123 | Tree:TTreeView; |
| 115 | 124 | Button1:TButton; |
| @@ -134,6 +143,19 @@ | ||
| 134 | 143 | OptionUrlDQuote:TCheckBox; |
| 135 | 144 | OpURLComment:TCheckBox; |
| 136 | 145 | 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; | |
| 137 | 159 | procedure FindClick(Sender:TObject); |
| 138 | 160 | procedure FormCreate(Sender:TObject); |
| 139 | 161 | procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer); |
| @@ -148,7 +170,7 @@ | ||
| 148 | 170 | procedure PTextSaveAsClick(Sender:TObject); |
| 149 | 171 | procedure PTextOpenClick(Sender:TObject); |
| 150 | 172 | procedure FormDestroy(Sender:TObject); |
| 151 | - procedure NameChange(Sender:TObject); | |
| 173 | + procedure ListNameChange(Sender:TObject); | |
| 152 | 174 | procedure TreeClick(Sender:TObject); |
| 153 | 175 | procedure Button1Click(Sender:TObject); |
| 154 | 176 | procedure PFileFolderClick(Sender:TObject); |
| @@ -163,6 +185,15 @@ | ||
| 163 | 185 | procedure GridFilesSetEditText(Sender:TObject;ACol,ARow:Integer;const Value:string); |
| 164 | 186 | procedure FormClose(Sender:TObject;var Action:TCloseAction); |
| 165 | 187 | 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); | |
| 166 | 197 | private |
| 167 | 198 | { Private 宣言 } |
| 168 | 199 | public |
| @@ -180,7 +211,7 @@ | ||
| 180 | 211 | |
| 181 | 212 | implementation |
| 182 | 213 | |
| 183 | -uses strutils,IOUtils,masks,clipbrd,SHELLAPI,Vcl.FileCtrl,IdGlobal,IdURI; | |
| 214 | +uses strutils,IOUtils,masks,clipbrd,SHELLAPI,Vcl.FileCtrl,ComObj,System.JSON; | |
| 184 | 215 | |
| 185 | 216 | var |
| 186 | 217 | Malloc:IMalloc; |
| @@ -199,12 +230,22 @@ | ||
| 199 | 230 | LF=#10; |
| 200 | 231 | CRLF=#13#10; |
| 201 | 232 | TAB=#9; |
| 202 | - CTEXT=1; | |
| 203 | - CFILE=2; | |
| 204 | - CPATH=3; | |
| 233 | + CTEXT='検索文字'; | |
| 234 | + CFILE='ファイル'; | |
| 235 | + CPATH='パス'; | |
| 236 | + CNAME='アーティスト'; | |
| 237 | + COPEN='開く'; | |
| 238 | + COPEN2='開く2'; | |
| 205 | 239 | |
| 206 | 240 | 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]; | |
| 208 | 249 | |
| 209 | 250 | {$R *.dfm} |
| 210 | 251 |
| @@ -248,15 +289,44 @@ | ||
| 248 | 289 | Result:=String(buf); |
| 249 | 290 | end; |
| 250 | 291 | |
| 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); | |
| 253 | 299 | begin |
| 254 | 300 | 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 | |
| 255 | 311 | TMenuItem(C).Checked:=Ini.ReadBool('',C.Name,TMenuItem(C).Checked); |
| 256 | 312 | if C.ClassType=TCheckBox then |
| 257 | 313 | 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; | |
| 258 | 318 | 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; | |
| 259 | 323 | |
| 324 | +end; | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | +procedure TTextDeFindForm.FormCreate(Sender:TObject); | |
| 329 | + | |
| 260 | 330 | begin |
| 261 | 331 | Ini:=TMemInifile.Create(ChangeFileExt(Application.ExeName,'.ini')); |
| 262 | 332 | Inifile:=TMemInifile.Create(ChangeFileExt(Application.ExeName,'.txt')); |
| @@ -269,13 +339,7 @@ | ||
| 269 | 339 | LeftPanel.Width:=Ini.ReadInteger('','LeftPanel.Width',LeftPanel.Width); |
| 270 | 340 | Font.Size:=Ini.ReadInteger('','Font.Size',Font.Size); |
| 271 | 341 | |
| 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); | |
| 279 | 343 | |
| 280 | 344 | Path.Text:=Ini.ReadString('','Path.Text',''); |
| 281 | 345 | Url.Text:=Ini.ReadString('','Url.Text',''); |
| @@ -287,8 +351,8 @@ | ||
| 287 | 351 | |
| 288 | 352 | try |
| 289 | 353 | // Tree.LoadFromFile(ChangeFileExt(Application.ExeName,'.txt')); |
| 290 | - NameChange(Sender); | |
| 291 | - pname:=Name.Text; | |
| 354 | + ListNameChange(Sender); | |
| 355 | + pname:=ListName.Text; | |
| 292 | 356 | TreeClick(Sender); |
| 293 | 357 | except |
| 294 | 358 | ShowMessage('ツリーテキストを読み込めませんでした'); |
| @@ -298,13 +362,6 @@ | ||
| 298 | 362 | |
| 299 | 363 | procedure TTextDeFindForm.FormClose(Sender:TObject;var Action:TCloseAction); |
| 300 | 364 | |
| 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 | 365 | |
| 309 | 366 | begin |
| 310 | 367 | if Application.Terminated then |
| @@ -318,15 +375,10 @@ | ||
| 318 | 375 | Ini.WriteString('','Url.Text',Url.Text); |
| 319 | 376 | Ini.writestrings('Url.Items',Url.Items); |
| 320 | 377 | |
| 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); | |
| 328 | 379 | |
| 329 | - NameChange(Sender); | |
| 380 | + | |
| 381 | + ListNameChange(Sender); | |
| 330 | 382 | Inifile.writetreeview('Tree',Tree); |
| 331 | 383 | // Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt')); |
| 332 | 384 |
| @@ -375,7 +427,7 @@ | ||
| 375 | 427 | |
| 376 | 428 | procedure TTextDeFindForm.FindUrlButtonClick(Sender:TObject); |
| 377 | 429 | var |
| 378 | - s,ss:string; | |
| 430 | + urls,s,ss:string; | |
| 379 | 431 | ls,le,i,count:Integer; |
| 380 | 432 | |
| 381 | 433 | function option(Url:String):String; |
| @@ -407,19 +459,109 @@ | ||
| 407 | 459 | Url:='\"'+Url+'\"'; |
| 408 | 460 | end; |
| 409 | 461 | |
| 410 | - Result:=Url; | |
| 462 | + Result:=trim(Url); | |
| 411 | 463 | end; |
| 412 | 464 | |
| 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 | + | |
| 413 | 544 | begin |
| 414 | 545 | urlrun:=not urlrun; |
| 415 | 546 | // with GridFiles do begin |
| 416 | 547 | // for i:=selection.top to selection.Bottom do begin |
| 417 | 548 | // 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 | + | |
| 418 | 559 | Screen.Cursor:=crHourGlass; |
| 419 | 560 | ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0); |
| 420 | 561 | le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*Integer(Text.SelLength>0),0); |
| 421 | 562 | for i:=ls to le do begin |
| 422 | 563 | FindUrlButton.Caption:='中止'; |
| 564 | + Caption:=Self.Name+Format(' %d/%d',[i,le]); | |
| 423 | 565 | ss:=Text.lines[i]; |
| 424 | 566 | if not urlrun then |
| 425 | 567 | break; |
| @@ -427,11 +569,26 @@ | ||
| 427 | 569 | s:=Url.Text; |
| 428 | 570 | if s='' then |
| 429 | 571 | continue; |
| 430 | - s:=s.Replace('%リスト名%',option(Name.Text)); | |
| 572 | + s:=s.Replace('%リスト名%',option(ListName.Text)); | |
| 431 | 573 | 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); | |
| 434 | 590 | end; |
| 591 | + | |
| 435 | 592 | FindUrlButton.Caption:='URL検索'; |
| 436 | 593 | urlrun:=false; |
| 437 | 594 | Screen.Cursor:=crDefault; |
| @@ -440,13 +597,13 @@ | ||
| 440 | 597 | procedure TTextDeFindForm.PFileExecClick(Sender:TObject); |
| 441 | 598 | begin |
| 442 | 599 | 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); | |
| 444 | 601 | end; |
| 445 | 602 | |
| 446 | 603 | procedure TTextDeFindForm.PFileFolderClick(Sender:TObject); |
| 447 | 604 | begin |
| 448 | 605 | with GridFiles do |
| 449 | - ShellExecute(Handle,'open',PChar(INCBS(cells[CPATH,row])),'','',1); | |
| 606 | + ShellExecute(Handle,'open',PChar(INCBS(cells[NPATH,row])),'','',1); | |
| 450 | 607 | |
| 451 | 608 | end; |
| 452 | 609 |
| @@ -471,6 +628,26 @@ | ||
| 471 | 628 | Files.save(SaveDialog.FileName); |
| 472 | 629 | end; |
| 473 | 630 | |
| 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 | + | |
| 474 | 651 | procedure TTextDeFindForm.PTextCopyClick(Sender:TObject); |
| 475 | 652 | begin |
| 476 | 653 | Text.CopyToClipboard; |
| @@ -486,6 +663,11 @@ | ||
| 486 | 663 | FindClick(Sender); |
| 487 | 664 | end; |
| 488 | 665 | |
| 666 | +procedure TTextDeFindForm.PTextFindUrlAddClick(Sender: TObject); | |
| 667 | +begin | |
| 668 | + FindUrlButtonClick(Sender); | |
| 669 | +end; | |
| 670 | + | |
| 489 | 671 | procedure TTextDeFindForm.PTextFindUrlClick(Sender:TObject); |
| 490 | 672 | begin |
| 491 | 673 | FindUrlButtonClick(Sender); |
| @@ -520,6 +702,7 @@ | ||
| 520 | 702 | Result:=false; |
| 521 | 703 | end; |
| 522 | 704 | |
| 705 | + | |
| 523 | 706 | procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer); |
| 524 | 707 | var |
| 525 | 708 | ACol,ARow:Longint; |
| @@ -532,6 +715,29 @@ | ||
| 532 | 715 | |
| 533 | 716 | end; |
| 534 | 717 | |
| 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 | + | |
| 535 | 741 | procedure TTextDeFindForm.GridFilesSetEditText(Sender:TObject;ACol,ARow:Integer;const Value:string); |
| 536 | 742 | begin |
| 537 | 743 | // ShowMessage(Value); |
| @@ -558,7 +764,7 @@ | ||
| 558 | 764 | |
| 559 | 765 | begin |
| 560 | 766 | |
| 561 | - ppname:=Name.Text; | |
| 767 | + ppname:=ListName.Text; | |
| 562 | 768 | |
| 563 | 769 | |
| 564 | 770 | // for i:=Name.Items.Count-1 downto 1 do |
| @@ -570,13 +776,13 @@ | ||
| 570 | 776 | TMP.Items.add(N.Text); |
| 571 | 777 | N:=N.getNextSibling; |
| 572 | 778 | end; |
| 573 | - Name.Enabled:=false; | |
| 574 | - Name.Items.Text:=TMP.Items.Text; | |
| 779 | + ListName.Enabled:=false; | |
| 780 | + ListName.Items.Text:=TMP.Items.Text; | |
| 575 | 781 | // Name.ItemIndex:=-1; |
| 576 | 782 | // Name.Text:=ppname; |
| 577 | - Name.ItemIndex:=Name.Items.IndexOf(ppname); | |
| 783 | + ListName.ItemIndex:=ListName.Items.IndexOf(ppname); | |
| 578 | 784 | // Application.ProcessMessages; |
| 579 | - Name.Enabled:=true; | |
| 785 | + ListName.Enabled:=true; | |
| 580 | 786 | end; |
| 581 | 787 | |
| 582 | 788 | function inputtextbox(P:TForm;C:TWinControl;Text:string):string; |
| @@ -621,6 +827,22 @@ | ||
| 621 | 827 | end; |
| 622 | 828 | end; |
| 623 | 829 | |
| 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 | + | |
| 624 | 846 | procedure TTextDeFindForm.UrlEditButtonClick(Sender:TObject); |
| 625 | 847 | begin |
| 626 | 848 | Url.Items.Text:=inputtextbox(self,Url,Url.Items.Text); |
| @@ -631,7 +853,7 @@ | ||
| 631 | 853 | TreeClick(Sender); |
| 632 | 854 | end; |
| 633 | 855 | |
| 634 | -procedure TTextDeFindForm.NameChange(Sender:TObject); | |
| 856 | +procedure TTextDeFindForm.ListNameChange(Sender:TObject); | |
| 635 | 857 | var |
| 636 | 858 | N,NN:TTreeNode; |
| 637 | 859 | s:string; |
| @@ -680,9 +902,9 @@ | ||
| 680 | 902 | Text.Text:=''; |
| 681 | 903 | N:=Tree.Items.GetFirstNode; |
| 682 | 904 | while N<>nil do begin |
| 683 | - if N.Text=Name.Text then begin | |
| 905 | + if N.Text=ListName.Text then begin | |
| 684 | 906 | childtext(N); |
| 685 | - Inifile.readgrid('grid\'+Name.Text,TGrid(GridFiles)); | |
| 907 | + Inifile.readgrid('grid\'+ListName.Text,TGrid(GridFiles)); | |
| 686 | 908 | end; |
| 687 | 909 | N:=N.getNextSibling; |
| 688 | 910 | end; |
| @@ -705,7 +927,7 @@ | ||
| 705 | 927 | // Text.lines.Text:= |
| 706 | 928 | // Ini.ReadSectionValues(Name.Text,Text.lines); |
| 707 | 929 | |
| 708 | - pname:=Name.Text; | |
| 930 | + pname:=ListName.Text; | |
| 709 | 931 | end; |
| 710 | 932 | |
| 711 | 933 | procedure TTextDeFindForm.OpURLButtonClick(Sender:TObject); |
| @@ -757,9 +979,9 @@ | ||
| 757 | 979 | snm:=findr(ExtractFileName(s)); |
| 758 | 980 | if MatchesMask(snm,nm) then begin |
| 759 | 981 | 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); | |
| 763 | 985 | hit:=true; |
| 764 | 986 | end; |
| 765 | 987 | end; |
| @@ -775,7 +997,7 @@ | ||
| 775 | 997 | |
| 776 | 998 | ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0); |
| 777 | 999 | pathtext:=Path.Text; |
| 778 | - pathtext:=pathtext.Replace('%リスト名%',Name.Text); | |
| 1000 | + pathtext:=pathtext.Replace('%リスト名%',ListName.Text); | |
| 779 | 1001 | pathtext:=pathtext.Replace('%検索文字%',Text.lines[ls]); |
| 780 | 1002 | pathtext:=INCBS(pathtext); |
| 781 | 1003 | // snm:=ExtractFileName(Path.Text); |
| @@ -788,8 +1010,9 @@ | ||
| 788 | 1010 | // op := TSearchOption.soTopDirectoryOnly; |
| 789 | 1011 | sa:=TDirectory.GetFiles(pathtext,snm,op); |
| 790 | 1012 | 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); | |
| 793 | 1016 | |
| 794 | 1017 | if Sender=Find then begin |
| 795 | 1018 | ls:=0; |
| @@ -807,9 +1030,9 @@ | ||
| 807 | 1030 | |
| 808 | 1031 | if not hit then begin |
| 809 | 1032 | 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]:=''; | |
| 813 | 1036 | end; |
| 814 | 1037 | end; |
| 815 | 1038 | Files.ColExpand(10); |
| @@ -839,7 +1062,7 @@ | ||
| 839 | 1062 | exit; |
| 840 | 1063 | |
| 841 | 1064 | 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]; | |
| 843 | 1066 | |
| 844 | 1067 | if not FileExists(fn) then |
| 845 | 1068 | continue; |
| @@ -860,6 +1083,7 @@ | ||
| 860 | 1083 | |
| 861 | 1084 | // -------------------------------------------------------------------------------- |
| 862 | 1085 | |
| 1086 | + | |
| 863 | 1087 | procedure TGrid.copy(G:TGrid); |
| 864 | 1088 | var |
| 865 | 1089 | r:TGridRect; |
| @@ -885,6 +1109,7 @@ | ||
| 885 | 1109 | self.Parent:=Origin.Parent; |
| 886 | 1110 | self.Options:=Origin.Options; |
| 887 | 1111 | self.OnSetEditText:=Origin.OnSetEditText; |
| 1112 | + self.OnSelectCell:=Origin.OnSelectCell; | |
| 888 | 1113 | self.OnMouseDown:=Origin.OnMouseDown; |
| 889 | 1114 | self.OnMouseMove:=Origin.OnMouseMove; |
| 890 | 1115 | buf:=TGrid.Create(self); |
| @@ -977,6 +1202,7 @@ | ||
| 977 | 1202 | Txt.Free; |
| 978 | 1203 | end; |
| 979 | 1204 | |
| 1205 | + | |
| 980 | 1206 | function TGrid.paste:TGridRect; |
| 981 | 1207 | var |
| 982 | 1208 | i,j,si,colcnt:Integer; |
| @@ -1020,6 +1246,7 @@ | ||
| 1020 | 1246 | Result:=TGridRect(rect(xs,ys,xs+xw,ys+yw)); |
| 1021 | 1247 | end; |
| 1022 | 1248 | |
| 1249 | + | |
| 1023 | 1250 | procedure TGrid.savebuf; |
| 1024 | 1251 | begin |
| 1025 | 1252 | saverect:=selection; |
| @@ -1046,10 +1273,8 @@ | ||
| 1046 | 1273 | |
| 1047 | 1274 | procedure TGrid.setfixed; |
| 1048 | 1275 | 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; | |
| 1053 | 1278 | end; |
| 1054 | 1279 | |
| 1055 | 1280 | function TGrid.load(fn:string):boolean; |
| @@ -1119,6 +1344,11 @@ | ||
| 1119 | 1344 | func(0,i); |
| 1120 | 1345 | end; |
| 1121 | 1346 | |
| 1347 | +function TGrid.seltext: string; | |
| 1348 | +begin | |
| 1349 | + result:=cells[col,row]; | |
| 1350 | +end; | |
| 1351 | + | |
| 1122 | 1352 | procedure TGrid.SetEditText(ACol,ARow:Integer;const Value:string); |
| 1123 | 1353 | begin |
| 1124 | 1354 | inherited; |
| @@ -1134,6 +1364,7 @@ | ||
| 1134 | 1364 | |
| 1135 | 1365 | end; |
| 1136 | 1366 | |
| 1367 | + | |
| 1137 | 1368 | procedure TGrid.KeyDown(var Key:Word;Shift:TShiftState); |
| 1138 | 1369 | var |
| 1139 | 1370 | w:Word; |
| @@ -1188,6 +1419,7 @@ | ||
| 1188 | 1419 | inherited; |
| 1189 | 1420 | end; |
| 1190 | 1421 | |
| 1422 | + | |
| 1191 | 1423 | procedure TGrid.MouseMove(Shift:TShiftState;X,Y:Integer); |
| 1192 | 1424 | var |
| 1193 | 1425 | DataObject:IDataObject; |
| @@ -1276,6 +1508,73 @@ | ||
| 1276 | 1508 | Result:=w3+4; |
| 1277 | 1509 | end; |
| 1278 | 1510 | |
| 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 | + | |
| 1279 | 1578 | function TGrid.RowDelete(Y,cnt:Integer):Integer; |
| 1280 | 1579 | var |
| 1281 | 1580 | i:Integer; |
| @@ -1448,8 +1747,9 @@ | ||
| 1448 | 1747 | G.Rows[Y].clear; |
| 1449 | 1748 | end); |
| 1450 | 1749 | G.RowCount:=1; |
| 1750 | + G.ColCount:=1; | |
| 1451 | 1751 | 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 | |
| 1453 | 1753 | s:=inttostr(Y)+','+inttostr(X); |
| 1454 | 1754 | if not ValueExists(sc,s) then |
| 1455 | 1755 | break; |
| @@ -1462,8 +1762,9 @@ | ||
| 1462 | 1762 | end; |
| 1463 | 1763 | if G.RowCount<2 then |
| 1464 | 1764 | G.RowCount:=2; |
| 1465 | - G.FixedRows:=1; | |
| 1466 | - G.Rows[0].setstrings(CHEAD); | |
| 1765 | + | |
| 1766 | + // G.Rows[0].setstrings(CHEAD); | |
| 1767 | + G.setfixed; | |
| 1467 | 1768 | G.ColExpand(10); |
| 1468 | 1769 | end; |
| 1469 | 1770 |