Commit MetaInfo

Revision586d5ec2acef577bf289c461a7f301b7729702ec (tree)
Zeit2018-12-27 18:49:59
Autorkentamaken <kentamaken@gmai...>
Commiterkentamaken

Log Message

itunesでアーティスト+タイトルでは何故か出てこないのでタイトルのみで検索してリスト名で絞る
手持ちと比較したくなったのでローカル検索も実行追加

Ändern Zusammenfassung

Diff

--- a/textdefindunit.dfm
+++ b/textdefindunit.dfm
@@ -20,18 +20,18 @@ object TextDeFindForm: TTextDeFindForm
2020 TextHeight = 16
2121 object Splitter1: TSplitter
2222 Left = 185
23- Top = 243
23+ Top = 294
2424 Width = 9
25- Height = 249
25+ Height = 198
2626 ExplicitLeft = 232
2727 ExplicitTop = 200
2828 ExplicitHeight = 65
2929 end
3030 object Web: TWebBrowser
3131 Left = 194
32- Top = 243
32+ Top = 294
3333 Width = 541
34- Height = 249
34+ Height = 198
3535 Align = alClient
3636 TabOrder = 7
3737 ExplicitLeft = 242
@@ -39,7 +39,7 @@ object TextDeFindForm: TTextDeFindForm
3939 ExplicitWidth = 300
4040 ExplicitHeight = 150
4141 ControlData = {
42- 4C000000EA370000BC1900000000000000000000000000000000000000000000
42+ 4C000000EA370000771400000000000000000000000000000000000000000000
4343 000000004C000000000000000000000001000000E0D057007335CF11AE690800
4444 2B2E126208000000000000004C0000000114020000000000C000000000000046
4545 8000000000000000000000000000000000000000000000000000000000000000
@@ -47,26 +47,26 @@ object TextDeFindForm: TTextDeFindForm
4747 end
4848 object Memo1: TMemo
4949 Left = 194
50- Top = 243
50+ Top = 294
5151 Width = 541
52- Height = 249
52+ Height = 198
5353 Align = alClient
5454 Lines.Strings = (
5555 'Memo1')
5656 TabOrder = 8
57- ExplicitTop = 219
58- ExplicitHeight = 273
57+ ExplicitTop = 243
58+ ExplicitHeight = 249
5959 end
6060 object LeftPanel: TPanel
6161 Left = 0
62- Top = 243
62+ Top = 294
6363 Width = 185
64- Height = 249
64+ Height = 198
6565 Align = alLeft
6666 Caption = 'LeftPanel'
6767 TabOrder = 4
68- ExplicitTop = 219
69- ExplicitHeight = 273
68+ ExplicitTop = 243
69+ ExplicitHeight = 249
7070 object ListName: TComboBox
7171 Left = 1
7272 Top = 1
@@ -85,7 +85,7 @@ object TextDeFindForm: TTextDeFindForm
8585 Left = 1
8686 Top = 51
8787 Width = 183
88- Height = 197
88+ Height = 146
8989 Align = alClient
9090 Font.Charset = SHIFTJIS_CHARSET
9191 Font.Color = clWindowText
@@ -100,7 +100,7 @@ object TextDeFindForm: TTextDeFindForm
100100 TabOrder = 1
101101 Zoom = 100
102102 OnMouseUp = TextMouseUp
103- ExplicitHeight = 221
103+ ExplicitHeight = 197
104104 end
105105 object Tree: TTreeView
106106 Left = 1
@@ -178,21 +178,21 @@ object TextDeFindForm: TTextDeFindForm
178178 end
179179 object GridFiles: TStringGrid
180180 Left = 194
181- Top = 243
181+ Top = 294
182182 Width = 541
183- Height = 249
183+ Height = 198
184184 Align = alClient
185185 Ctl3D = False
186186 DrawingStyle = gdsClassic
187- Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goRowSizing, goColSizing, goThumbTracking]
187+ Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goRowSizing, goColSizing, goRowMoving, goColMoving, goThumbTracking]
188188 ParentCtl3D = False
189189 PopupMenu = PopupMenu2
190190 TabOrder = 1
191191 OnMouseDown = GridFilesMouseDown
192192 OnSelectCell = GridFilesSelectCell
193193 OnSetEditText = GridFilesSetEditText
194- ExplicitTop = 219
195- ExplicitHeight = 273
194+ ExplicitTop = 243
195+ ExplicitHeight = 249
196196 ColWidths = (
197197 64
198198 64
@@ -253,25 +253,36 @@ object TextDeFindForm: TTextDeFindForm
253253 DropDownCount = 30
254254 TabOrder = 0
255255 Items.Strings = (
256- 'itmss://itunes.apple.com/search?term=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%&country=jp'
257256
258- 'https://linkmaker.itunes.apple.com/ja-jp?country=jp&mediaType=ap' +
259- 'ple_music&term=%'#12522#12473#12488#21517'%+%'#26908#32034#25991#23383'%'
260- 'https://itunes.apple.com/search?term=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%&country=jp'
257+ '[itunes] itmss://itunes.apple.com/search?country=jp&limit=200&' +
258+ 'term=%'#26908#32034#25991#23383'%'
261259
262- 'https://play.google.com/music/listen?hl=ja&pli=1#/sr/%'#12522#12473#12488#21517'% %'#26908#32034#25991 +
263- #23383'%'
264- ''
265- 'https://music.amazon.co.jp/search/%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%'
266- 'https://www.google.com/search?q=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%'
267- 'https://www.youtube.com/results?search_query=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%'
260+ '[itunes] itmss://itunes.apple.com/search?country=jp&limit=200&' +
261+ 'term=%'#12522#12473#12488#21517'%+%'#26908#32034#25991#23383'%'
268262
269- 'https://www.clubdam.com/app/search/searchKaraokeKeywordArtist.ht' +
270- 'ml?keyword=%'#12522#12473#12488#21517'%'
263+ '[itunes'#12450#12523#12496#12512'] itmss://itunes.apple.com/search?country=jp&entity' +
264+ '=album&attribute=artistTerm&limit=200&term=%'#12522#12473#12488#21517'%'
271265
272- 'https://www.google.com/search?q=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'% site:itunes.apple.' +
273- 'com'
274- 'https://playapplemusic.com/search?q=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'% ')
266+ '[google] https://play.google.com/music/listen?hl=ja&pli=1#/sr/' +
267+ '%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%'
268+ '[amazon] https://music.amazon.co.jp/search/%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%'
269+ '[google] https://www.google.com/search?q=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%'
270+
271+ '[youtube] https://www.youtube.com/results?search_query=%'#12522#12473#12488#21517'% %' +
272+ #26908#32034#25991#23383'%'
273+
274+ '[DAM] https://www.clubdam.com/app/search/searchKaraokeKeywo' +
275+ 'rdArtist.html?keyword=%'#12522#12473#12488#21517'%'
276+
277+ '[google] https://www.google.com/search?q=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'% site:it' +
278+ 'unes.apple.com'
279+ '[apple] https://playapplemusic.com/search?q=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%'
280+
281+ '[apple] https://linkmaker.itunes.apple.com/ja-jp?country=jp&m' +
282+ 'ediaType=apple_music&term=%'#12522#12473#12488#21517'%+%'#26908#32034#25991#23383'%'
283+
284+ '[apple] https://itunes.apple.com/search?term=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%&co' +
285+ 'untry=jp')
275286 end
276287 object FindUrlButton: TButton
277288 Left = 1
@@ -308,7 +319,7 @@ object TextDeFindForm: TTextDeFindForm
308319 Left = 0
309320 Top = 50
310321 Width = 735
311- Height = 193
322+ Height = 244
312323 Align = alTop
313324 AutoSize = True
314325 TabOrder = 6
@@ -323,7 +334,7 @@ object TextDeFindForm: TTextDeFindForm
323334 Checked = True
324335 State = cbChecked
325336 TabOrder = 0
326- ExplicitTop = 129
337+ ExplicitTop = 60
327338 end
328339 object OpUrlSpace: TCheckBox
329340 Left = 1
@@ -335,7 +346,7 @@ object TextDeFindForm: TTextDeFindForm
335346 Checked = True
336347 State = cbChecked
337348 TabOrder = 1
338- ExplicitTop = 88
349+ ExplicitTop = 19
339350 end
340351 object OpURLZenkaku: TCheckBox
341352 Left = 1
@@ -345,8 +356,7 @@ object TextDeFindForm: TTextDeFindForm
345356 Align = alTop
346357 Caption = #20840#35282#21270
347358 TabOrder = 2
348- ExplicitLeft = 49
349- ExplicitTop = 111
359+ ExplicitTop = 101
350360 end
351361 object OpURLEscapeEdit: TEdit
352362 Left = 1
@@ -356,7 +366,7 @@ object TextDeFindForm: TTextDeFindForm
356366 Align = alTop
357367 TabOrder = 3
358368 Text = ':/?#[]@!$&'#39#39'()*+,;='
359- ExplicitTop = 146
369+ ExplicitTop = 77
360370 end
361371 object OpURLSpaceEdit: TEdit
362372 Left = 1
@@ -368,7 +378,7 @@ object TextDeFindForm: TTextDeFindForm
368378 Text =
369379 '!"#$%&'#39'()*+,-./:;<=>?@[\]^_`{|}~'#65295#65340#65374#8741#65372#8230#8229#8216#8217#8220#8221#65288#65289#12308#12309#65339#65341#65371#65373#12296#12297#12298#12299#12300#12301#12302#12303#12304#12305#65291#65293#177 +
370380 #215#247#65309#8800#65308#65310#8806#8807#8734#8756#9794#9792#176#8242#8243#8451#65509#65284#65504#65505#65285#65283#65286#65290#65312#167#9734#9733#9675#9679#9678#9671' '#9670#9633#9632#9651#9650#9661#9660#8251#12306#8594#8592#8593#8595
371- ExplicitTop = 29
381+ ExplicitTop = 36
372382 end
373383 object OptionUrlDQuote: TCheckBox
374384 Left = 1
@@ -378,7 +388,7 @@ object TextDeFindForm: TTextDeFindForm
378388 Align = alTop
379389 Caption = '""'#12391#22258#12416
380390 TabOrder = 5
381- ExplicitTop = 187
391+ ExplicitTop = 118
382392 end
383393 object OpURLComment: TCheckBox
384394 Left = 1
@@ -390,7 +400,7 @@ object TextDeFindForm: TTextDeFindForm
390400 Checked = True
391401 State = cbChecked
392402 TabOrder = 6
393- ExplicitTop = 71
403+ ExplicitTop = 2
394404 end
395405 object OpURLFile: TCheckBox
396406 Left = 1
@@ -400,23 +410,23 @@ object TextDeFindForm: TTextDeFindForm
400410 Align = alTop
401411 Caption = #12501#12449#12452#12523#21015#12395#29983#12487#12540#12479
402412 TabOrder = 7
403- ExplicitTop = 204
413+ ExplicitTop = 135
404414 end
405- object OpURLitune: TCheckBox
415+ object OpURLituneNazo: TCheckBox
406416 Left = 1
407- Top = 151
417+ Top = 168
408418 Width = 733
409419 Height = 17
410420 Align = alTop
411- Caption = 'itmss:'#12399'json'#35299#26512
421+ Caption = #12450#12540#12486#12451#12473#12488'+'#12479#12452#12488#12523#12391#12399#20309#25925#12363#20986#12390#12371#12394#12356#12398#12391#12479#12452#12488#12523#12398#12415#12391#26908#32034#12375#12390#12522#12473#12488#21517#12391#32094#12427
412422 Checked = True
413423 State = cbChecked
414424 TabOrder = 8
415- ExplicitTop = 221
425+ ExplicitTop = 169
416426 end
417427 object OpURLWait: TMaskEdit
418428 Left = 1
419- Top = 168
429+ Top = 202
420430 Width = 733
421431 Height = 24
422432 Align = alTop
@@ -424,7 +434,41 @@ object TextDeFindForm: TTextDeFindForm
424434 MaxLength = 9
425435 TabOrder = 9
426436 Text = #12454#12456#12452#12488'3000 '
427- ExplicitWidth = 732
437+ ExplicitTop = 203
438+ end
439+ object OpURLLocal: TCheckBox
440+ Left = 1
441+ Top = 185
442+ Width = 733
443+ Height = 17
444+ Align = alTop
445+ Caption = #12525#12540#12459#12523#26908#32034#12418#23455#34892
446+ Checked = True
447+ State = cbChecked
448+ TabOrder = 10
449+ ExplicitTop = 186
450+ end
451+ object OpURLitune: TCheckBox
452+ Left = 1
453+ Top = 151
454+ Width = 733
455+ Height = 17
456+ Align = alTop
457+ Caption = 'itmss:'#12399'json'#35299#26512
458+ Checked = True
459+ State = cbChecked
460+ TabOrder = 11
461+ ExplicitTop = 152
462+ end
463+ object OpURLReset: TCheckBox
464+ Left = 1
465+ Top = 226
466+ Width = 733
467+ Height = 17
468+ Align = alTop
469+ Caption = #35373#23450#12434#21021#26399#21270#12375#12390#32066#20102
470+ TabOrder = 12
471+ ExplicitTop = 225
428472 end
429473 end
430474 object PopupMenu2: TPopupMenu
--- a/textdefindunit.pas
+++ b/textdefindunit.pas
@@ -9,7 +9,7 @@ uses
99 types,inifiles,
1010 Vcl.ComCtrls,ShlObj,ActiveX,Vcl.Menus,Vcl.CheckLst,IdBaseComponent,
1111 IdComponent,IdTCPConnection,IdTCPClient,IdGlobal,IdURI,IdHTTP,Vcl.OleCtrls,SHDocVw,
12- IdIOHandler,IdIOHandlerSocket,IdIOHandlerStack,IdSSL,IdSSLOpenSSL, Vcl.Mask;
12+ IdIOHandler,IdIOHandlerSocket,IdIOHandlerStack,IdSSL,IdSSLOpenSSL,Vcl.Mask;
1313
1414 type
1515 TStringSelf=class(TStringList)
@@ -147,7 +147,7 @@ type
147147 IdSSLIOHandlerSocketOpenSSL:TIdSSLIOHandlerSocketOpenSSL;
148148 Memo1:TMemo;
149149 OpURLFile:TCheckBox;
150- OpURLitune:TCheckBox;
150+ OpURLituneNazo:TCheckBox;
151151 PFileUpdate:TMenuItem;
152152 PColAdd:TMenuItem;
153153 PColDel:TMenuItem;
@@ -155,7 +155,10 @@ type
155155 PRowDel:TMenuItem;
156156 N5:TMenuItem;
157157 PClear:TMenuItem;
158- OpURLWait: TMaskEdit;
158+ OpURLWait:TMaskEdit;
159+ OpURLLocal:TCheckBox;
160+ OpURLitune:TCheckBox;
161+ OpURLReset:TCheckBox;
159162 procedure FindClick(Sender:TObject);
160163 procedure FormCreate(Sender:TObject);
161164 procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
@@ -194,7 +197,8 @@ type
194197 procedure PColDelClick(Sender:TObject);
195198 procedure PClearClick(Sender:TObject);
196199 private
197- function getpathtext: string;
200+ function getpathtext:string;
201+ function localfind(var sa:TStringDynArray;ssss:string):boolean;
198202 { Private 宣言 }
199203 public
200204 { Public 宣言 }
@@ -221,6 +225,8 @@ var
221225 Inifile:TMemInifile;
222226 inidir:string;
223227 pname:string;
228+ op:TSearchOption;
229+ sa:TStringDynArray;
224230
225231 const
226232 MAXLIST=4096;
@@ -236,29 +242,44 @@ const
236242 CNAME='アーティスト';
237243 COPEN='開く';
238244 COPEN2='開く2';
245+ CALBAM='アルバム';
239246
240247 var
241248 NTEXT:Integer;
242249 NFILE:Integer;
243250 NPATH:Integer;
244251 NNAME:Integer;
252+ NALBAM:Integer;
245253 NOPEN:Integer;
246254 NOPEN2:Integer;
247255 CHEAD:TStringDynArray=['',CTEXT,CFILE,CPATH];
248- CHEADWEB:TStringDynArray=['',CTEXT,CFILE,COPEN,COPEN2,CPATH,CNAME];
256+ CHEADWEB:TStringDynArray=['',CTEXT,CFILE,COPEN,COPEN2,CPATH,CNAME,CALBAM];
249257
250258 {$R *.dfm}
251259
260+procedure TTextDeFindForm.PFileUpdateClick(Sender:TObject);
261+begin
262+ NTEXT:=Files.Rows[0].IndexOf(CTEXT);
263+ NFILE:=Files.Rows[0].IndexOf(CFILE);
264+ NPATH:=Files.Rows[0].IndexOf(CPATH);
265+ NNAME:=Files.Rows[0].IndexOf(CNAME);
266+ NALBAM:=Files.Rows[0].IndexOf(CALBAM);
267+ NOPEN:=Files.Rows[0].IndexOf(COPEN);
268+ NOPEN2:=Files.Rows[0].IndexOf(COPEN2);
269+end;
270+
252271 function INCBS(const s:string):string;
253272 begin
254273 Result:=s;
255- if not IsPathDelimiter(Result,Length(Result)) then Result:=Result+'\';
274+ if not IsPathDelimiter(Result,Length(Result)) then
275+ Result:=Result+'\';
256276 end;
257277
258278 function EXCBS(const s:string):string;
259279 begin
260280 Result:=s;
261- if IsPathDelimiter(Result,Length(Result)) then SetLength(Result,Length(Result)-1);
281+ if IsPathDelimiter(Result,Length(Result)) then
282+ SetLength(Result,Length(Result)-1);
262283 end;
263284
264285 function zenkaku(Str:String):String; // 半角全角
@@ -294,32 +315,38 @@ var
294315 B:TButton;
295316 procedure save(C:TComponent);
296317 begin
297- if C.ClassType=TMenuItem then Ini.WriteBool('',C.Name,TMenuItem(C).Checked);
298- if C.ClassType=TCheckBox then Ini.WriteBool('',C.Name,TCheckBox(C).Checked);
299- if C.ClassType=TEdit then Ini.WriteString('',C.Name,TEdit(C).Text);
300- if C.ClassType=TMaskEdit then Ini.WriteString('',C.Name,TMaskEdit(C).Text);
318+ if C.ClassType=TMenuItem then
319+ Ini.WriteBool('',C.Name,TMenuItem(C).Checked);
320+ if C.ClassType=TCheckBox then
321+ Ini.WriteBool('',C.Name,TCheckBox(C).Checked);
322+ if C.ClassType=TEdit then
323+ Ini.WriteString('',C.Name,TEdit(C).Text);
324+ if C.ClassType=TMaskEdit then
325+ Ini.WriteString('',C.Name,TMaskEdit(C).Text);
301326 end;
302327
303328 procedure load(C:TComponent);
304329 begin
305- if C.ClassType=TMenuItem then TMenuItem(C).Checked:=Ini.ReadBool('',C.Name,TMenuItem(C).Checked);
306- if C.ClassType=TCheckBox then TCheckBox(C).Checked:=Ini.ReadBool('',C.Name,TCheckBox(C).Checked);
330+ if C.ClassType=TMenuItem then
331+ TMenuItem(C).Checked:=Ini.ReadBool('',C.Name,TMenuItem(C).Checked);
332+ if C.ClassType=TCheckBox then
333+ TCheckBox(C).Checked:=Ini.ReadBool('',C.Name,TCheckBox(C).Checked);
307334 if C.ClassType=TEdit then begin
308335 s:=Ini.ReadString('',C.Name,TEdit(C).Text);
309- if s<>'' then TEdit(C).Text:=s;
336+ if s<>'' then
337+ TEdit(C).Text:=s;
310338 end;
311339 if C.ClassType=TMaskEdit then begin
312340 s:=Ini.ReadString('',C.Name,TMaskEdit(C).Text);
313- if s<>'' then TEdit(C).Text:=s;
341+ if s<>'' then
342+ TEdit(C).Text:=s;
314343 end;
315344 end;
316345
317346 begin
318347 for i:=0 to C.ControlCount-1 do begin
319- if bsave then
320- save(C.Controls[i])
321- else
322- load(C.Controls[i]);
348+ if bsave then save(C.Controls[i])
349+ else load(C.Controls[i]);
323350 end;
324351
325352 end;
@@ -357,12 +384,14 @@ begin
357384 ShowMessage('ツリーテキストを読み込めませんでした');
358385 Application.Terminate;
359386 end;
387+
360388 end;
361389
362390 procedure TTextDeFindForm.FormClose(Sender:TObject;var Action:TCloseAction);
363391
364392 begin
365- if Application.Terminated then exit;
393+ if Application.Terminated then
394+ exit;
366395
367396 Ini.WriteInteger('','Width',Width);
368397 Ini.WriteInteger('','Height',Height);
@@ -378,6 +407,7 @@ begin
378407 Inifile.writetreeview('Tree',Tree);
379408 // Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt'));
380409
410+ if OpURLReset.Checked then Ini.clear;
381411 Ini.UpdateFile;
382412 Inifile.UpdateFile;
383413 end;
@@ -392,9 +422,12 @@ end;
392422
393423 function TTextDeFindForm.QueryContinueDrag(fEscapePressed:BOOL;grfKeyState:Longint):HResult;
394424 begin
395- if fEscapePressed or((MK_LBUTTON or MK_RBUTTON)=(grfKeyState and(MK_LBUTTON or MK_RBUTTON))) then Result:=DRAGDROP_S_CANCEL
396- else if grfKeyState and MK_LBUTTON=0 then Result:=DRAGDROP_S_DROP
397- else Result:=S_OK;
425+ if fEscapePressed or((MK_LBUTTON or MK_RBUTTON)=(grfKeyState and(MK_LBUTTON or MK_RBUTTON))) then
426+ Result:=DRAGDROP_S_CANCEL
427+ else if grfKeyState and MK_LBUTTON=0 then
428+ Result:=DRAGDROP_S_DROP
429+ else
430+ Result:=S_OK;
398431 end;
399432
400433 function TTextDeFindForm.GiveFeedback(dwEffect:Longint):HResult;
@@ -417,13 +450,14 @@ var
417450 urls,s,ss:string;
418451 ls,le,i,count:Integer;
419452
420- function option(Url:String):String;
453+ function getsearchtext(Url:String):String;
421454 var
422455 C,cc:Char;
423456 begin
424457
425458 if OpURLComment.Checked then begin
426- if Url.IndexOf('//')>=0 then Url:=Url.Substring(0,Url.IndexOf('//'));
459+ if Url.IndexOf('//')>=0 then
460+ Url:=Url.Substring(0,Url.IndexOf('//'));
427461 end;
428462
429463 if OpUrlSpace.Checked then begin
@@ -455,7 +489,7 @@ var
455489 IdHTTP.HandleRedirects:=true;
456490 s:=TStringStream.Create('',TEncoding.UTF8);
457491 try
458- Url:=TIdURI.URLEncode(Url,IndyTextEncoding_UTF8);
492+ Url:=TIdURI.ParamsEncode(Url,IndyTextEncoding_UTF8);
459493 IdHTTP.Get(Url,s);
460494 s.Position:=0;
461495 Result:=s.ReadString(s.Size);
@@ -474,7 +508,9 @@ var
474508 vitem:TJSONObject;
475509 pair:TJSONPair;
476510 i,r:Integer;
511+ hit:Integer;
477512 data:string;
513+ artist:string;
478514 function getval(k:string):string;
479515 begin
480516 try
@@ -486,26 +522,36 @@ var
486522
487523 begin
488524 data:=iddownload(Url);
489- // memo1.Lines.LoadFromFile('D:\utilsrad10\textdefind\Win32\Debug\1-10.txt',TEncoding.UTF8);
490- // data:=memo1.Lines.text;
491525 try
492526 obj:=TJSONObject.ParseJSONValue(data) as TJSONObject;
493527 vresults:=obj.GetValue('results') as TJSONArray;
528+ hit:=0;
494529 for i:=0 to vresults.count-1 do begin
495530 vitem:=vresults.Items[i] as TJSONObject;;
496531 r:=Files.RowCount;
532+ artist:=getval('artistName');
533+ if OpURLituneNazo.Checked then
534+ if not MatchesMask(artist,'*'+getsearchtext(ListName.Text)+'*') then continue;
535+
536+ inc(hit);
497537 Files.RowCount:=r+1;
498- Files.cells[NTEXT,r]:=option(ss);
538+ Files.Rows[r].clear;
539+ Files.cells[NTEXT,r]:=getsearchtext(ss);
499540 Files.cells[NFILE,r]:=getval('trackName');
500541 Files.cells[NPATH,r]:=getval('trackViewUrl').Replace('https:','itmss:');
501542 Files.cells[NNAME,r]:=getval('artistName');
543+ Files.cells[NALBAM,r]:=getval('collectionName');
502544 Files.cells[NOPEN,r]:='M';
503545 Files.cells[NOPEN2,r]:='S';
504546 end;
505- if vresults.count=0 then begin
506- r:=Files.RowCount;
507- Files.RowCount:=r+1;
508- Files.cells[NTEXT,r]:=option(ss);
547+
548+ if not localfind(sa,ss) then begin
549+ if hit=0 then begin
550+ r:=Files.RowCount;
551+ Files.RowCount:=r+1;
552+ Files.Rows[r].clear;
553+ Files.cells[NTEXT,r]:=getsearchtext(ss);
554+ end;
509555 end;
510556
511557 except
@@ -520,10 +566,10 @@ var
520566 data:=iddownload(Url);
521567 r:=Files.RowCount;
522568 Files.RowCount:=r+1;
523- Files.cells[NTEXT,r]:=option(ss);
569+ Files.cells[NTEXT,r]:=getsearchtext(ss);
524570 Files.cells[NFILE,r]:=data;
525571 end;
526- function datoi(const S:string;def:integer):integer;
572+ function datoi(const s:string;def:Integer):Integer;
527573 begin
528574 try
529575 Result:=StrToIntDef(TRegEx.Replace(s,'[^0-9\n]|^\n',''),def);
@@ -532,6 +578,24 @@ var
532578 end;
533579 end;
534580
581+ function stringcut(s,Key:string):string;
582+ begin
583+ Result:=s;
584+ if s.IndexOf(Key)>=0 then
585+ Result:=s.Substring(s.IndexOf(Key));
586+
587+ end;
588+
589+ function geturltext(Key:string):string;
590+ begin
591+ Result:=Url.Text;
592+ Result:=stringcut(Result,'itmss:');
593+ Result:=stringcut(Result,'http:');
594+ Result:=stringcut(Result,'https:');
595+ Result:=Result.Replace('%リスト名%',getsearchtext(ListName.Text));
596+ Result:=Result.Replace('%検索文字%',getsearchtext(Key));
597+ end;
598+
535599 begin
536600 urlrun:=not urlrun;
537601 // with GridFiles do begin
@@ -542,53 +606,69 @@ begin
542606 // Files.clear;
543607 // Files.RowCount:=1;
544608 // end;
609+ try
610+ if not urlrun then
611+ exit;
612+ try
613+ if DirectoryExists(getpathtext) then sa:=TDirectory.GetFiles(getpathtext,'*',TSearchOption.soAllDirectories);
614+ except
615+ sa.clear;
616+ // on E: Exception do ShowMessage(E.Message);
617+ end;
545618
546- Files.ColCount:=CHEADWEB.count;
547- Files.Rows[0].setstrings(CHEADWEB);
548- PFileUpdateClick(Sender);
549-
550- Screen.Cursor:=crHourGlass;
551- ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0);
552- le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*Integer(Text.SelLength>0),0);
553- for i:=ls to le do begin
554- FindUrlButton.Caption:='中止';
555- Caption:=Self.Name+format(' %d/%d',[i,le]);
556- ss:=Text.lines[i];
557- if not urlrun then break;
558- Application.ProcessMessages;
559- s:=Url.Text;
560- if s='' then continue;
561- s:=s.Replace('%リスト名%',option(ListName.Text));
562- s:=s.Replace('%検索文字%',option(ss));
563- urls:=s;
564-
565- if OpURLFile.Checked then datatogrid(urls)
566- else if OpURLitune.Checked and(urls.IndexOf('itmss:')=0) then begin
567- urls:=urls.Replace('itmss:','https:');
568- jsontogrid(urls);
569- end
570- else ShellExecute(Handle,'open',PChar(urls),'','',1);
619+ Files.ColCount:=CHEADWEB.count;
620+ Files.Rows[0].setstrings(CHEADWEB);
621+ PFileUpdateClick(Sender);
571622
572- if Files.RowCount>(Files.VisibleRowCount+1) then Files.TopRow:=Files.RowCount-Files.VisibleRowCount;
573- Files.ColExpand(10);
574- Files.setfixed;
623+ Screen.Cursor:=crHourGlass;
624+ ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0);
625+ le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*Integer(Text.SelLength>0),0);
626+ for i:=ls to le do begin
627+ FindUrlButton.Caption:='中止';
628+ Caption:=Self.Name+format(' %d/%d',[i,le]);
629+ ss:=Text.lines[i];
630+ if not urlrun then
631+ break;
632+ Application.ProcessMessages;
633+ urls:=geturltext(ss);
634+ if urls='' then
635+ continue;
636+
637+ if OpURLFile.Checked then
638+ datatogrid(urls)
639+ else if OpURLitune.Checked and(urls.IndexOf('itmss:')=0) then begin
640+ urls:=urls.Replace('itmss:','https:');
641+ jsontogrid(urls);
642+ end
643+ else
644+ ShellExecute(Handle,'open',PChar(urls),'','',1);
645+
646+ if Files.RowCount>(Files.VisibleRowCount+1) then
647+ Files.TopRow:=Files.RowCount-Files.VisibleRowCount;
648+ Files.ColExpand(10);
649+ Files.setfixed;
650+
651+ sleep(Max(datoi(OpURLWait.Text,3000),1000));
652+ end;
653+ finally
654+ FindUrlButton.Caption:='URL検索';
655+ urlrun:=false;
656+ Screen.Cursor:=crDefault;
575657
576- sleep(Max(datoi(OpURLWait.Text,3000),1000));
577658 end;
578659
579- FindUrlButton.Caption:='URL検索';
580- urlrun:=false;
581- Screen.Cursor:=crDefault;
582660 end;
583661
584662 procedure TTextDeFindForm.PFileExecClick(Sender:TObject);
585663 begin
586- with GridFiles do ShellExecute(Handle,'open',PChar(INCBS(cells[NPATH,row])+cells[NFILE,row]),'','',1);
664+ with GridFiles do
665+ ShellExecute(Handle,'open',PChar(INCBS(cells[NPATH,row])+cells[NFILE,row]),'','',1);
587666 end;
588667
589668 procedure TTextDeFindForm.PFileFolderClick(Sender:TObject);
590669 begin
591- with GridFiles do ShellExecute(Handle,'open',PChar(INCBS(cells[NPATH,row])),'','',1);
670+ with GridFiles do
671+ ShellExecute(Handle,'open',PChar(INCBS(cells[NPATH,row])),'','',1);
592672
593673 end;
594674
@@ -596,7 +676,8 @@ procedure TTextDeFindForm.PFileOpenClick(Sender:TObject);
596676 begin
597677 OpenDialog.DefaultExt:='csv';
598678 OpenDialog.Filter:='csv|csv|*|*';
599- if OpenDialog.Execute then Files.save(OpenDialog.FileName);
679+ if OpenDialog.Execute then
680+ Files.save(OpenDialog.FileName);
600681 end;
601682
602683 procedure TTextDeFindForm.PFilePasteClick(Sender:TObject);
@@ -608,17 +689,8 @@ procedure TTextDeFindForm.PFileSaveAsClick(Sender:TObject);
608689 begin
609690 SaveDialog.DefaultExt:='csv';
610691 SaveDialog.Filter:='csv|csv|*|*';
611- if SaveDialog.Execute then Files.save(SaveDialog.FileName);
612-end;
613-
614-procedure TTextDeFindForm.PFileUpdateClick(Sender:TObject);
615-begin
616- NTEXT:=Files.Rows[0].IndexOf(CTEXT);
617- NFILE:=Files.Rows[0].IndexOf(CFILE);
618- NPATH:=Files.Rows[0].IndexOf(CPATH);
619- NNAME:=Files.Rows[0].IndexOf(CNAME);
620- NOPEN:=Files.Rows[0].IndexOf(COPEN);
621- NOPEN2:=Files.Rows[0].IndexOf(COPEN2);
692+ if SaveDialog.Execute then
693+ Files.save(SaveDialog.FileName);
622694 end;
623695
624696 procedure TTextDeFindForm.PRowAddClick(Sender:TObject);
@@ -660,7 +732,8 @@ procedure TTextDeFindForm.PTextOpenClick(Sender:TObject);
660732 begin
661733 OpenDialog.DefaultExt:='txt';
662734 OpenDialog.Filter:='txt|txt|*|*';
663- if OpenDialog.Execute then Text.lines.LoadFromFile(OpenDialog.FileName);
735+ if OpenDialog.Execute then
736+ Text.lines.LoadFromFile(OpenDialog.FileName);
664737 end;
665738
666739 procedure TTextDeFindForm.PTextPasteClick(Sender:TObject);
@@ -672,14 +745,16 @@ procedure TTextDeFindForm.PTextSaveAsClick(Sender:TObject);
672745 begin
673746 SaveDialog.DefaultExt:='txt';
674747 SaveDialog.Filter:='txt|txt|*|*';
675- if SaveDialog.Execute then Text.lines.SaveToFile(SaveDialog.FileName);
748+ if SaveDialog.Execute then
749+ Text.lines.SaveToFile(SaveDialog.FileName);
676750
677751 end;
678752
679753 function gridInRect(X,Y:Integer;const r:TGridRect):boolean;
680754 begin
681755 Result:=true;
682- if ((X<r.left)or(X>r.right)or(Y<r.Top)or(Y>r.Bottom)) then Result:=false;
756+ if ((X<r.left)or(X>r.right)or(Y<r.Top)or(Y>r.Bottom)) then
757+ Result:=false;
683758 end;
684759
685760 procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
@@ -688,7 +763,8 @@ var
688763
689764 begin
690765 Files.MouseToCell(X,Y,ACol,ARow);
691- if gridInRect(ACol,ARow,Files.Selection) then exit;
766+ if gridInRect(ACol,ARow,Files.Selection) then
767+ exit;
692768 Files.MouseToCell(X,Y,ACol,ARow);
693769
694770 end;
@@ -698,11 +774,12 @@ var
698774 s:string;
699775 begin
700776 PFileUpdateClick(Sender);
701- if ACol=NOPEN then s:=Files.cells[NPATH,ARow];
702- if ACol=NOPEN2 then s:=Files.cells[NPATH,ARow]+'&app=itunes';
777+ if ACol=NOPEN then
778+ s:=Files.cells[NPATH,ARow];
779+ if ACol=NOPEN2 then
780+ s:=Files.cells[NPATH,ARow]+'&app=itunes';
703781
704- if s='' then
705- exit;
782+ if s='' then exit;
706783
707784 ShellExecute(Handle,'open',PChar(s),'','',1);
708785
@@ -773,12 +850,13 @@ begin
773850 // F.BorderStyle:=bsSingle;
774851 r:=P.BoundsRect;
775852 r.Top:=C.ClientToScreen(C.BoundsRect.BottomRight).Y;
776- r.Height:=200;
853+ r.Height:=500;
777854 // R.Inflate(0,0,0,100);
778855 f.BoundsRect:=r;
779856 M.Parent:=f;
780857 M.Align:=alClient;
781858 M.Text:=Text;
859+ M.ScrollBars:=ssBoth;
782860 f.Position:=poDesigned;
783861 f.ShowModal;
784862 Result:=M.Text;
@@ -867,8 +945,7 @@ begin
867945 end;
868946
869947 NN.DeleteChildren;
870- for s in Text.lines do
871- Tree.Items.AddChild(NN,trim(s));
948+ for s in Text.lines do Tree.Items.AddChild(NN,trim(s));
872949
873950 Inifile.writegrid('grid\'+pname,TGrid(GridFiles));
874951 end;
@@ -898,23 +975,20 @@ var
898975 ls,le:Integer;
899976 begin
900977 ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0);
901- result:=Path.Text;
902- result:=result.Replace('%リスト名%',ListName.Text);
903- result:=result.Replace('%検索文字%',Text.lines[ls]);
904- result:=INCBS(result);
978+ Result:=Path.Text;
979+ Result:=Result.Replace('%リスト名%',ListName.Text);
980+ Result:=Result.Replace('%検索文字%',Text.lines[ls]);
981+ if Result='' then
982+ exit;
983+ Result:=INCBS(Result);
905984 end;
906985
907-procedure TTextDeFindForm.FindClick(Sender:TObject);
986+function TTextDeFindForm.localfind(var sa:TStringDynArray;ssss:string):boolean;
908987 var
909- op:TSearchOption;
910- sa:TStringDynArray;
911- s,ss:string;
912988 snm,nm:string;
913- sub:boolean;
989+ s,ss,sss:string;
990+ i,j,r,si:Integer;
914991 hit:boolean;
915- ls,le,i,j,count:Integer;
916- pathtext:string;
917-
918992 function findr(s:string):string;
919993 begin
920994 s:=s.ToUpper;
@@ -924,42 +998,47 @@ var
924998 Result:=s;
925999 end;
9261000
927- function procfind(ssss:string):string;
928- var
929- s,ss,sss:string;
930- i,j,si:Integer;
931- begin
932- sss:=findr(ssss);
933- si:=pos(' ',sss);
934- if si=0 then
935- si:=pos('・',sss);
936- if si=0 then
937- si:=4;
938- si:=si-1;
939-
940- for j:=Length(sss) downto si do begin
941-
942- ss:=sss.Substring(0,j);
943- for s in sa do begin
944- nm:=trim((ss));
945- if nm='' then continue;
946-
947- if pos('*',nm)=0 then
948- if pos('?',nm)=0 then
949- nm:='*'+nm+'*';
950- snm:=findr(ExtractFileName(s));
951- if MatchesMask(snm,nm) then begin
952- Files.RowCount:=Files.RowCount+1;
953- Files.cells[NTEXT,Files.RowCount-1]:=trim(ssss);
954- Files.cells[NPATH,Files.RowCount-1]:=ExtractFileDir(s);
955- Files.cells[NFILE,Files.RowCount-1]:=ExtractFileName(s);
956- hit:=true;
957- end;
1001+begin
1002+ sss:=findr(ssss);
1003+ si:=pos(' ',sss);
1004+ if si=0 then si:=pos('・',sss);
1005+ if si=0 then si:=4;
1006+ si:=si-1;
1007+
1008+ for j:=Length(sss) downto si do begin
1009+
1010+ ss:=sss.Substring(0,j);
1011+ for s in sa do begin
1012+ nm:=trim((ss));
1013+ if nm='' then
1014+ continue;
1015+
1016+ if pos('*',nm)=0 then
1017+ if pos('?',nm)=0 then nm:='*'+nm+'*';
1018+ snm:=findr(ExtractFileName(s));
1019+ if MatchesMask(snm,nm) then begin
1020+ r:=Files.RowCount;
1021+ Files.RowCount:=r+1;
1022+ Files.Rows[r].clear;
1023+ Files.cells[NTEXT,r]:=trim(ssss);
1024+ Files.cells[NPATH,r]:=ExtractFileDir(s);
1025+ Files.cells[NFILE,r]:=ExtractFileName(s);
1026+ hit:=true;
9581027 end;
959- if hit then break;
9601028 end;
1029+ if hit then
1030+ break;
9611031 end;
1032+ Result:=hit;
1033+end;
9621034
1035+procedure TTextDeFindForm.FindClick(Sender:TObject);
1036+var
1037+ s,ss:string;
1038+ sub:boolean;
1039+ ls,le,i,j,r,count:Integer;
1040+ pathtext:string;
1041+ snm:string;
9631042 begin
9641043 try
9651044 Screen.Cursor:=crHourGlass;
@@ -974,7 +1053,12 @@ begin
9741053 op:=TSearchOption.soAllDirectories;
9751054 // else
9761055 // op := TSearchOption.soTopDirectoryOnly;
977- sa:=TDirectory.GetFiles(pathtext,snm,op);
1056+ try
1057+ sa:=TDirectory.GetFiles(pathtext,snm,op);
1058+ except
1059+ on e:Exception do
1060+ ShowMessage(e.Message);
1061+ end;
9781062 Files.RowCount:=1;
9791063 Files.ColCount:=CHEAD.count;
9801064 Files.Rows[0].setstrings(CHEAD);
@@ -991,14 +1075,13 @@ begin
9911075 end;
9921076 for i:=ls to le do begin
9931077 ss:=Text.lines[i];
994- hit:=false;
995- procfind(ss);
996-
997- if not hit then begin
998- Files.RowCount:=Files.RowCount+1;
999- Files.cells[NTEXT,Files.RowCount-1]:=trim(ss);
1000- Files.cells[NPATH,Files.RowCount-1]:='';
1001- Files.cells[NFILE,Files.RowCount-1]:='';
1078+
1079+ if not localfind(sa,ss) then begin
1080+ r:=Files.RowCount;
1081+ Files.RowCount:=r+1;
1082+ Files.Rows[r].clear;
1083+ // Files.rowval(r).get(NTEXT);
1084+ Files.cells[NTEXT,r]:=trim(ss);
10021085 end;
10031086 end;
10041087 Files.ColExpand(10);
@@ -1022,20 +1105,25 @@ begin
10221105 count:=0;
10231106
10241107 SHGetDesktopFolder(ISFD);
1025- if Failed(ISFD.ParseDisplayName(0,nil,PWideChar(EXCBS(getpathtext)),pchEaten,PItem,dwAttributes)) then exit;
1026- if Failed(ISFD.BindToObject(PItem,nil,IID_IShellFolder,ISF)) then exit;
1108+ if Failed(ISFD.ParseDisplayName(0,nil,PWideChar(EXCBS(getpathtext)),pchEaten,PItem,dwAttributes)) then
1109+ exit;
1110+ if Failed(ISFD.BindToObject(PItem,nil,IID_IShellFolder,ISF)) then
1111+ exit;
10271112
10281113 for i:=G.Selection.Top to G.Selection.Bottom do begin
10291114 fn:=INCBS(G.cells[NPATH,i])+G.cells[NFILE,i];
10301115
1031- if not FileExists(fn) then continue;
1116+ if not FileExists(fn) then
1117+ continue;
10321118 inc(count);
10331119 SetLength(PItems,count);
10341120 fnpath:=ExtractRelativePath(INCBS(getpathtext),fn);
10351121
1036- if Failed(ISF.ParseDisplayName(0,nil,PWideChar(fnpath),pchEaten,PItems[count-1],dwAttributes)) then exit;
1122+ if Failed(ISF.ParseDisplayName(0,nil,PWideChar(fnpath),pchEaten,PItems[count-1],dwAttributes)) then
1123+ exit;
10371124 end;
1038- if count<1 then exit;
1125+ if count<1 then
1126+ exit;
10391127
10401128 ISF.GetUIObjectOf(0,count,PItems[0],IDataObject,nil,Pointer(Result));
10411129 end;
@@ -1092,7 +1180,8 @@ begin
10921180 EditorMode:=true;
10931181
10941182 end
1095- else inherited;
1183+ else
1184+ inherited;
10961185 end;
10971186
10981187 procedure TGrid.cutcopy(modecut:boolean);
@@ -1110,17 +1199,22 @@ var
11101199 begin
11111200 Result:=s;
11121201 B:=false;
1113- if d='' then B:=true;
1202+ if d='' then
1203+ B:=true;
11141204 for C in s do
1115- if pos(C,d)>0 then B:=true;
1205+ if pos(C,d)>0 then
1206+ B:=true;
11161207
1117- if not B then exit;
1208+ if not B then
1209+ exit;
11181210 Result:='"'+s+'"';
11191211 end;
11201212
11211213 begin
1122- if not Focused then exit;
1123- if modecut then buf.copy(Self);
1214+ if not Focused then
1215+ exit;
1216+ if modecut then
1217+ buf.copy(Self);
11241218
11251219 ys:=Selection.Top;
11261220 xs:=Selection.left;
@@ -1131,13 +1225,15 @@ begin
11311225 for i:=0 to yw do begin
11321226 s:='';
11331227 for j:=0 to xw do begin
1134- if j>0 then s:=s+#9;
1228+ if j>0 then
1229+ s:=s+#9;
11351230 ss:=StringReplace(cells[xs+j,ys+i],#9,'',[rfReplaceAll]);
11361231 // タブは削除
11371232 // if Pos(ss,CRLF)>0 then
11381233 ss:=d_dquotedstr(ss,CRLF);
11391234 s:=s+ss;
1140- if modecut then cells[xs+j,ys+i]:='';
1235+ if modecut then
1236+ cells[xs+j,ys+i]:='';
11411237 end;
11421238 Txt.add(s);
11431239 end;
@@ -1157,12 +1253,14 @@ var
11571253 cols:TStringDynArray;
11581254
11591255 begin
1160- if not Focused then exit;
1256+ if not Focused then
1257+ exit;
11611258 buf.copy(Self);
11621259
11631260 Txt:=TStringList.Create;
11641261 s:=StringReplace(Clipboard.AsText,CRLF,CR,[rfReplaceAll]);
1165- for ltxt in SplitString(s,CR) do Txt.add(ltxt);
1262+ for ltxt in SplitString(s,CR) do
1263+ Txt.add(ltxt);
11661264
11671265 ys:=Selection.Top;
11681266 xs:=Selection.left;
@@ -1171,7 +1269,8 @@ begin
11711269 for i:=0 to yw do begin
11721270 s:=Txt[i];
11731271 colcnt:=SplitString(s,#9).count;
1174- if xw<colcnt then xw:=colcnt;
1272+ if xw<colcnt then
1273+ xw:=colcnt;
11751274 end;
11761275 dec(xw);
11771276
@@ -1213,10 +1312,8 @@ end;
12131312
12141313 procedure TGrid.setfixed;
12151314 begin
1216- if ColCount>1 then
1217- FixedCols:=1;
1218- if RowCount>1 then
1219- FixedRows:=1;
1315+ if ColCount>1 then FixedCols:=1;
1316+ if RowCount>1 then FixedRows:=1;
12201317 end;
12211318
12221319 function TGrid.load(fn:string):boolean;
@@ -1265,7 +1362,8 @@ var
12651362 i,j:Integer;
12661363 begin
12671364 for i:=Selection.Top to Selection.Bottom do
1268- for j:=Selection.left to Selection.right do func(j,i);
1365+ for j:=Selection.left to Selection.right do
1366+ func(j,i);
12691367 end;
12701368
12711369 function TGrid.alldo(func:TFuncXY):Integer;
@@ -1273,14 +1371,16 @@ var
12731371 i,j:Integer;
12741372 begin
12751373 for i:=0 to RowCount-1 do
1276- for j:=0 to ColCount-1 do func(j,i);
1374+ for j:=0 to ColCount-1 do
1375+ func(j,i);
12771376 end;
12781377
12791378 function TGrid.selrowdo(func:TFuncXY):Integer;
12801379 var
12811380 i:Integer;
12821381 begin
1283- for i:=Selection.Top to Selection.Bottom do func(0,i);
1382+ for i:=Selection.Top to Selection.Bottom do
1383+ func(0,i);
12841384 end;
12851385
12861386 function TGrid.seltext:string;
@@ -1298,7 +1398,8 @@ function TGrid.rowdo(func:TFuncXY):Integer;
12981398 var
12991399 i:Integer;
13001400 begin
1301- for i:=0 to RowCount-1 do func(0,i);
1401+ for i:=0 to RowCount-1 do
1402+ func(0,i);
13021403
13031404 end;
13041405
@@ -1307,7 +1408,8 @@ var
13071408 w:Word;
13081409 begin
13091410 if ssCtrl in Shift then begin
1310- if Key=17 then exit;
1411+ if Key=17 then
1412+ exit;
13111413 case Key of
13121414 Word('X'):cutcopy(true);
13131415 Word('C'):cutcopy(false);
@@ -1337,7 +1439,8 @@ begin
13371439 row:=ARow;
13381440 EditorMode:=true;
13391441 end;
1340- if downinselection then exit;
1442+ if downinselection then
1443+ exit;
13411444 inherited;
13421445 end;
13431446
@@ -1356,7 +1459,8 @@ begin
13561459 exit;
13571460
13581461 end;
1359- if not(csLButtonDown in ControlState) then exit;
1462+ if not(csLButtonDown in ControlState) then
1463+ exit;
13601464
13611465 s:=Application.ExeName;
13621466 // 左ボタンが押された状態で、マウスの位置が閾値を超えたらドラッグ開始
@@ -1384,7 +1488,8 @@ function TGrid.DoMouseWheelDown(Shift:TShiftState;MousePos:TPoint):boolean;
13841488 var
13851489 i:Integer;
13861490 begin
1387- for i:=1 to GetNumScrollLines do SendMessage(Handle,WM_VSCROLL,SB_LINEDOWN,0);
1491+ for i:=1 to GetNumScrollLines do
1492+ SendMessage(Handle,WM_VSCROLL,SB_LINEDOWN,0);
13881493 Result:=true;
13891494 end;
13901495
@@ -1392,7 +1497,8 @@ function TGrid.DoMouseWheelUp(Shift:TShiftState;MousePos:TPoint):boolean;
13921497 var
13931498 i:Integer;
13941499 begin
1395- for i:=1 to GetNumScrollLines do SendMessage(Handle,WM_VSCROLL,SB_LINEUP,0);
1500+ for i:=1 to GetNumScrollLines do
1501+ SendMessage(Handle,WM_VSCROLL,SB_LINEUP,0);
13961502 Result:=true;
13971503 end;
13981504
@@ -1407,14 +1513,17 @@ begin
14071513 w1:=0;
14081514 for i:=0 to RowCount-1 do begin
14091515 w2:=Canvas.TextWidth('['+cells[j,i]);
1410- if (w1<w2) then w1:=w2;
1516+ if (w1<w2) then
1517+ w1:=w2;
14111518 end;
1412- if w1<min then w1:=min;
1519+ if w1<min then
1520+ w1:=min;
14131521 ColWidths[j]:=w1;
14141522 w3:=w3+(w1)+GridLineWidth;
14151523 end;
14161524 for j:=0 to ColCount-1 do
1417- if ColWidths[j]>gridWidth then ColWidths[j]:=trunc(gridWidth/2);
1525+ if ColWidths[j]>gridWidth then
1526+ ColWidths[j]:=trunc(gridWidth/2);
14181527
14191528 DefaultRowHeight:=Canvas.TextHeight('あ')+2;
14201529 Result:=w3+4;
@@ -1433,9 +1542,12 @@ function TGrid.ColClear(X,cnt:Integer):Integer;
14331542 var
14341543 i:Integer;
14351544 begin
1436- if (X<0) then X:=0;
1437- if X>=ColCount then X:=ColCount;
1438- for i:=0 to cnt-1 do cols[X+i].clear();
1545+ if (X<0) then
1546+ X:=0;
1547+ if X>=ColCount then
1548+ X:=ColCount;
1549+ for i:=0 to cnt-1 do
1550+ cols[X+i].clear();
14391551 Result:=0
14401552
14411553 end;
@@ -1446,9 +1558,12 @@ var
14461558 w:Integer;
14471559 begin
14481560 Result:=0;
1449- if cnt<0 then exit;
1450- if X<0 then exit;
1451- if X>=ColCount then exit;
1561+ if cnt<0 then
1562+ exit;
1563+ if X<0 then
1564+ exit;
1565+ if X>=ColCount then
1566+ exit;
14521567 w:=ColCount-cnt;
14531568 for i:=X to w-1 do begin
14541569 cols[i]:=cols[i+cnt];
@@ -1463,8 +1578,10 @@ var
14631578 i:Integer;
14641579 lcnt:Integer;
14651580 begin
1466- if cnt<0 then exit;
1467- if (X<0)or(X>=ColCount) then X:=ColCount;
1581+ if cnt<0 then
1582+ exit;
1583+ if (X<0)or(X>=ColCount) then
1584+ X:=ColCount;
14681585 ColCount:=ColCount+cnt;
14691586 lcnt:=ColCount;
14701587
@@ -1472,7 +1589,8 @@ begin
14721589 cols[i]:=cols[i-cnt];
14731590 ColWidths[i]:=ColWidths[i-cnt];
14741591 end;
1475- for i:=0 to cnt-1 do cols[X+i].clear();
1592+ for i:=0 to cnt-1 do
1593+ cols[X+i].clear();
14761594 Result:=0;
14771595 end;
14781596
@@ -1482,9 +1600,12 @@ var
14821600 w:Integer;
14831601 begin
14841602 Result:=0;
1485- if cnt<0 then exit;
1486- if Y<0 then exit;
1487- if Y>=RowCount then exit;
1603+ if cnt<0 then
1604+ exit;
1605+ if Y<0 then
1606+ exit;
1607+ if Y>=RowCount then
1608+ exit;
14881609 w:=RowCount-cnt;
14891610 for i:=Y to w-1 do begin
14901611 Rows[i]:=Rows[i+cnt];
@@ -1499,8 +1620,10 @@ var
14991620 i:Integer;
15001621 lcnt:Integer;
15011622 begin
1502- if cnt<0 then exit;
1503- if (Y<0)or(Y>=RowCount) then Y:=RowCount;
1623+ if cnt<0 then
1624+ exit;
1625+ if (Y<0)or(Y>=RowCount) then
1626+ Y:=RowCount;
15041627 RowCount:=RowCount+cnt;
15051628 lcnt:=RowCount;
15061629
@@ -1508,7 +1631,8 @@ begin
15081631 Rows[i]:=Rows[i-cnt];
15091632 RowHeights[i]:=RowHeights[i-cnt];
15101633 end;
1511- for i:=0 to cnt-1 do Rows[Y+i].clear();
1634+ for i:=0 to cnt-1 do
1635+ Rows[Y+i].clear();
15121636 Result:=0;
15131637 end;
15141638
@@ -1516,9 +1640,12 @@ function TGrid.RowClear(Y,cnt:Integer):Integer;
15161640 var
15171641 i:Integer;
15181642 begin
1519- if (Y<0) then Y:=0;
1520- if Y>=RowCount then Y:=RowCount;
1521- for i:=0 to cnt-1 do Rows[Y+i].clear();
1643+ if (Y<0) then
1644+ Y:=0;
1645+ if Y>=RowCount then
1646+ Y:=RowCount;
1647+ for i:=0 to cnt-1 do
1648+ Rows[Y+i].clear();
15221649 Result:=0
15231650 end;
15241651
@@ -1549,8 +1676,10 @@ end;
15491676 function TStringDynArrayHelper.item(i:Integer):String;
15501677 begin
15511678 Result:='';
1552- if i<0 then exit;
1553- if i>High(Self) then exit;
1679+ if i<0 then
1680+ exit;
1681+ if i>High(Self) then
1682+ exit;
15541683 Result:=Self[i];
15551684 end;
15561685
@@ -1580,7 +1709,8 @@ var
15801709 s:string;
15811710 begin
15821711 Result:=TStringSelf.Create;
1583- for s in Self do Result.add(s);
1712+ for s in Self do
1713+ Result.add(s);
15841714 end;
15851715
15861716 function TStringDynArrayHelper.adduni(s:string):Integer;
@@ -1588,7 +1718,8 @@ var
15881718 i:Integer;
15891719 begin
15901720 for i:=0 to hi do
1591- if Self[i]=s then exit(-1);
1721+ if Self[i]=s then
1722+ exit(-1);
15921723 add(s);
15931724 Result:=count;
15941725 end;
@@ -1597,7 +1728,8 @@ function TStringDynArrayHelper.cat(s,e:string):String;
15971728 var
15981729 T:string;
15991730 begin
1600- for T in Self do Result:=Result+s+T+e;
1731+ for T in Self do
1732+ Result:=Result+s+T+e;
16011733 end;
16021734
16031735 procedure TStringDynArrayHelper.clear;
@@ -1617,8 +1749,7 @@ var
16171749 i:Integer;
16181750 begin
16191751 for i:=0 to sa.count-1 do
1620- if i<count then
1621- Self[i]:=sa[i];
1752+ if i<count then Self[i]:=sa[i];
16221753 end;
16231754
16241755 { TIniFileHelper }
@@ -1638,13 +1769,17 @@ begin
16381769 for Y:=0 to MAXLIST do begin
16391770 for X:=0 to 10 do begin
16401771 s:=inttostr(Y)+','+inttostr(X);
1641- if not ValueExists(sc,s) then break;
1642- if X>=G.ColCount then G.ColCount:=X+1;
1643- if Y>=G.RowCount then G.RowCount:=Y+1;
1772+ if not ValueExists(sc,s) then
1773+ break;
1774+ if X>=G.ColCount then
1775+ G.ColCount:=X+1;
1776+ if Y>=G.RowCount then
1777+ G.RowCount:=Y+1;
16441778 G.cells[X,Y]:=ReadString(sc,inttostr(Y)+','+inttostr(X),'');
16451779 end;
16461780 end;
1647- if G.RowCount<2 then G.RowCount:=2;
1781+ if G.RowCount<2 then
1782+ G.RowCount:=2;
16481783
16491784 // G.Rows[0].setstrings(CHEAD);
16501785 G.setfixed;
@@ -1667,9 +1802,12 @@ var
16671802 i:Integer;
16681803 s:string;
16691804 begin
1670- if SectionExists(sc) then sl.clear;
1805+
1806+ if ValueExists(sc,'0') then
1807+ sl.clear;
16711808 for i:=0 to MAXLIST do begin
1672- if not ValueExists(sc,inttostr(i)) then break;
1809+ if not ValueExists(sc,inttostr(i)) then
1810+ break;
16731811 sl.add(ReadString(sc,inttostr(i),''));
16741812 end;
16751813 end;
@@ -1679,8 +1817,8 @@ var
16791817 i:Integer;
16801818 begin
16811819 EraseSection(sc);
1682- for i:=0 to sl.count-1 do
1683- WriteString(sc,inttostr(i),sl[i]);
1820+ // if sl.text='' then exit;
1821+ for i:=0 to sl.count-1 do WriteString(sc,inttostr(i),sl[i]);
16841822 end;
16851823
16861824 procedure TMemIniFileHelper.readtreeview(sc:string;T:TTreeView);
@@ -1694,16 +1832,19 @@ var
16941832 begin
16951833 for i:=0 to MAXLIST do begin
16961834 k:=Key+','+inttostr(i);
1697- if not ValueExists(sc,k) then break;
1835+ if not ValueExists(sc,k) then
1836+ break;
16981837 T.Items.AddChild(N,ReadString(sc,k,''));
16991838 sub(k,N);
17001839 end;
17011840 end;
17021841
17031842 begin
1704- if SectionExists(sc) then T.Items.clear;
1843+ if SectionExists(sc) then
1844+ T.Items.clear;
17051845 for i:=0 to MAXLIST do begin
1706- if not ValueExists(sc,inttostr(i)) then break;
1846+ if not ValueExists(sc,inttostr(i)) then
1847+ break;
17071848 N:=T.Items.add(nil,ReadString(sc,inttostr(i),''));
17081849 sub(inttostr(i),N);
17091850 end;
Show on old repository browser