Revision | 586d5ec2acef577bf289c461a7f301b7729702ec (tree) |
---|---|
Zeit | 2018-12-27 18:49:59 |
Autor | kentamaken <kentamaken@gmai...> |
Commiter | kentamaken |
itunesでアーティスト+タイトルでは何故か出てこないのでタイトルのみで検索してリスト名で絞る
手持ちと比較したくなったのでローカル検索も実行追加
@@ -20,18 +20,18 @@ object TextDeFindForm: TTextDeFindForm | ||
20 | 20 | TextHeight = 16 |
21 | 21 | object Splitter1: TSplitter |
22 | 22 | Left = 185 |
23 | - Top = 243 | |
23 | + Top = 294 | |
24 | 24 | Width = 9 |
25 | - Height = 249 | |
25 | + Height = 198 | |
26 | 26 | ExplicitLeft = 232 |
27 | 27 | ExplicitTop = 200 |
28 | 28 | ExplicitHeight = 65 |
29 | 29 | end |
30 | 30 | object Web: TWebBrowser |
31 | 31 | Left = 194 |
32 | - Top = 243 | |
32 | + Top = 294 | |
33 | 33 | Width = 541 |
34 | - Height = 249 | |
34 | + Height = 198 | |
35 | 35 | Align = alClient |
36 | 36 | TabOrder = 7 |
37 | 37 | ExplicitLeft = 242 |
@@ -39,7 +39,7 @@ object TextDeFindForm: TTextDeFindForm | ||
39 | 39 | ExplicitWidth = 300 |
40 | 40 | ExplicitHeight = 150 |
41 | 41 | ControlData = { |
42 | - 4C000000EA370000BC1900000000000000000000000000000000000000000000 | |
42 | + 4C000000EA370000771400000000000000000000000000000000000000000000 | |
43 | 43 | 000000004C000000000000000000000001000000E0D057007335CF11AE690800 |
44 | 44 | 2B2E126208000000000000004C0000000114020000000000C000000000000046 |
45 | 45 | 8000000000000000000000000000000000000000000000000000000000000000 |
@@ -47,26 +47,26 @@ object TextDeFindForm: TTextDeFindForm | ||
47 | 47 | end |
48 | 48 | object Memo1: TMemo |
49 | 49 | Left = 194 |
50 | - Top = 243 | |
50 | + Top = 294 | |
51 | 51 | Width = 541 |
52 | - Height = 249 | |
52 | + Height = 198 | |
53 | 53 | Align = alClient |
54 | 54 | Lines.Strings = ( |
55 | 55 | 'Memo1') |
56 | 56 | TabOrder = 8 |
57 | - ExplicitTop = 219 | |
58 | - ExplicitHeight = 273 | |
57 | + ExplicitTop = 243 | |
58 | + ExplicitHeight = 249 | |
59 | 59 | end |
60 | 60 | object LeftPanel: TPanel |
61 | 61 | Left = 0 |
62 | - Top = 243 | |
62 | + Top = 294 | |
63 | 63 | Width = 185 |
64 | - Height = 249 | |
64 | + Height = 198 | |
65 | 65 | Align = alLeft |
66 | 66 | Caption = 'LeftPanel' |
67 | 67 | TabOrder = 4 |
68 | - ExplicitTop = 219 | |
69 | - ExplicitHeight = 273 | |
68 | + ExplicitTop = 243 | |
69 | + ExplicitHeight = 249 | |
70 | 70 | object ListName: TComboBox |
71 | 71 | Left = 1 |
72 | 72 | Top = 1 |
@@ -85,7 +85,7 @@ object TextDeFindForm: TTextDeFindForm | ||
85 | 85 | Left = 1 |
86 | 86 | Top = 51 |
87 | 87 | Width = 183 |
88 | - Height = 197 | |
88 | + Height = 146 | |
89 | 89 | Align = alClient |
90 | 90 | Font.Charset = SHIFTJIS_CHARSET |
91 | 91 | Font.Color = clWindowText |
@@ -100,7 +100,7 @@ object TextDeFindForm: TTextDeFindForm | ||
100 | 100 | TabOrder = 1 |
101 | 101 | Zoom = 100 |
102 | 102 | OnMouseUp = TextMouseUp |
103 | - ExplicitHeight = 221 | |
103 | + ExplicitHeight = 197 | |
104 | 104 | end |
105 | 105 | object Tree: TTreeView |
106 | 106 | Left = 1 |
@@ -178,21 +178,21 @@ object TextDeFindForm: TTextDeFindForm | ||
178 | 178 | end |
179 | 179 | object GridFiles: TStringGrid |
180 | 180 | Left = 194 |
181 | - Top = 243 | |
181 | + Top = 294 | |
182 | 182 | Width = 541 |
183 | - Height = 249 | |
183 | + Height = 198 | |
184 | 184 | Align = alClient |
185 | 185 | Ctl3D = False |
186 | 186 | 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] | |
188 | 188 | ParentCtl3D = False |
189 | 189 | PopupMenu = PopupMenu2 |
190 | 190 | TabOrder = 1 |
191 | 191 | OnMouseDown = GridFilesMouseDown |
192 | 192 | OnSelectCell = GridFilesSelectCell |
193 | 193 | OnSetEditText = GridFilesSetEditText |
194 | - ExplicitTop = 219 | |
195 | - ExplicitHeight = 273 | |
194 | + ExplicitTop = 243 | |
195 | + ExplicitHeight = 249 | |
196 | 196 | ColWidths = ( |
197 | 197 | 64 |
198 | 198 | 64 |
@@ -253,25 +253,36 @@ object TextDeFindForm: TTextDeFindForm | ||
253 | 253 | DropDownCount = 30 |
254 | 254 | TabOrder = 0 |
255 | 255 | Items.Strings = ( |
256 | - 'itmss://itunes.apple.com/search?term=%'#12522#12473#12488#21517'% %'#26908#32034#25991#23383'%&country=jp' | |
257 | 256 | |
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'%' | |
261 | 259 | |
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'%' | |
268 | 262 | |
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'%' | |
271 | 265 | |
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') | |
275 | 286 | end |
276 | 287 | object FindUrlButton: TButton |
277 | 288 | Left = 1 |
@@ -308,7 +319,7 @@ object TextDeFindForm: TTextDeFindForm | ||
308 | 319 | Left = 0 |
309 | 320 | Top = 50 |
310 | 321 | Width = 735 |
311 | - Height = 193 | |
322 | + Height = 244 | |
312 | 323 | Align = alTop |
313 | 324 | AutoSize = True |
314 | 325 | TabOrder = 6 |
@@ -323,7 +334,7 @@ object TextDeFindForm: TTextDeFindForm | ||
323 | 334 | Checked = True |
324 | 335 | State = cbChecked |
325 | 336 | TabOrder = 0 |
326 | - ExplicitTop = 129 | |
337 | + ExplicitTop = 60 | |
327 | 338 | end |
328 | 339 | object OpUrlSpace: TCheckBox |
329 | 340 | Left = 1 |
@@ -335,7 +346,7 @@ object TextDeFindForm: TTextDeFindForm | ||
335 | 346 | Checked = True |
336 | 347 | State = cbChecked |
337 | 348 | TabOrder = 1 |
338 | - ExplicitTop = 88 | |
349 | + ExplicitTop = 19 | |
339 | 350 | end |
340 | 351 | object OpURLZenkaku: TCheckBox |
341 | 352 | Left = 1 |
@@ -345,8 +356,7 @@ object TextDeFindForm: TTextDeFindForm | ||
345 | 356 | Align = alTop |
346 | 357 | Caption = #20840#35282#21270 |
347 | 358 | TabOrder = 2 |
348 | - ExplicitLeft = 49 | |
349 | - ExplicitTop = 111 | |
359 | + ExplicitTop = 101 | |
350 | 360 | end |
351 | 361 | object OpURLEscapeEdit: TEdit |
352 | 362 | Left = 1 |
@@ -356,7 +366,7 @@ object TextDeFindForm: TTextDeFindForm | ||
356 | 366 | Align = alTop |
357 | 367 | TabOrder = 3 |
358 | 368 | Text = ':/?#[]@!$&'#39#39'()*+,;=' |
359 | - ExplicitTop = 146 | |
369 | + ExplicitTop = 77 | |
360 | 370 | end |
361 | 371 | object OpURLSpaceEdit: TEdit |
362 | 372 | Left = 1 |
@@ -368,7 +378,7 @@ object TextDeFindForm: TTextDeFindForm | ||
368 | 378 | Text = |
369 | 379 | '!"#$%&'#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 + |
370 | 380 | #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 | |
372 | 382 | end |
373 | 383 | object OptionUrlDQuote: TCheckBox |
374 | 384 | Left = 1 |
@@ -378,7 +388,7 @@ object TextDeFindForm: TTextDeFindForm | ||
378 | 388 | Align = alTop |
379 | 389 | Caption = '""'#12391#22258#12416 |
380 | 390 | TabOrder = 5 |
381 | - ExplicitTop = 187 | |
391 | + ExplicitTop = 118 | |
382 | 392 | end |
383 | 393 | object OpURLComment: TCheckBox |
384 | 394 | Left = 1 |
@@ -390,7 +400,7 @@ object TextDeFindForm: TTextDeFindForm | ||
390 | 400 | Checked = True |
391 | 401 | State = cbChecked |
392 | 402 | TabOrder = 6 |
393 | - ExplicitTop = 71 | |
403 | + ExplicitTop = 2 | |
394 | 404 | end |
395 | 405 | object OpURLFile: TCheckBox |
396 | 406 | Left = 1 |
@@ -400,23 +410,23 @@ object TextDeFindForm: TTextDeFindForm | ||
400 | 410 | Align = alTop |
401 | 411 | Caption = #12501#12449#12452#12523#21015#12395#29983#12487#12540#12479 |
402 | 412 | TabOrder = 7 |
403 | - ExplicitTop = 204 | |
413 | + ExplicitTop = 135 | |
404 | 414 | end |
405 | - object OpURLitune: TCheckBox | |
415 | + object OpURLituneNazo: TCheckBox | |
406 | 416 | Left = 1 |
407 | - Top = 151 | |
417 | + Top = 168 | |
408 | 418 | Width = 733 |
409 | 419 | Height = 17 |
410 | 420 | 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 | |
412 | 422 | Checked = True |
413 | 423 | State = cbChecked |
414 | 424 | TabOrder = 8 |
415 | - ExplicitTop = 221 | |
425 | + ExplicitTop = 169 | |
416 | 426 | end |
417 | 427 | object OpURLWait: TMaskEdit |
418 | 428 | Left = 1 |
419 | - Top = 168 | |
429 | + Top = 202 | |
420 | 430 | Width = 733 |
421 | 431 | Height = 24 |
422 | 432 | Align = alTop |
@@ -424,7 +434,41 @@ object TextDeFindForm: TTextDeFindForm | ||
424 | 434 | MaxLength = 9 |
425 | 435 | TabOrder = 9 |
426 | 436 | 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 | |
428 | 472 | end |
429 | 473 | end |
430 | 474 | object PopupMenu2: TPopupMenu |
@@ -9,7 +9,7 @@ uses | ||
9 | 9 | types,inifiles, |
10 | 10 | Vcl.ComCtrls,ShlObj,ActiveX,Vcl.Menus,Vcl.CheckLst,IdBaseComponent, |
11 | 11 | 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; | |
13 | 13 | |
14 | 14 | type |
15 | 15 | TStringSelf=class(TStringList) |
@@ -147,7 +147,7 @@ type | ||
147 | 147 | IdSSLIOHandlerSocketOpenSSL:TIdSSLIOHandlerSocketOpenSSL; |
148 | 148 | Memo1:TMemo; |
149 | 149 | OpURLFile:TCheckBox; |
150 | - OpURLitune:TCheckBox; | |
150 | + OpURLituneNazo:TCheckBox; | |
151 | 151 | PFileUpdate:TMenuItem; |
152 | 152 | PColAdd:TMenuItem; |
153 | 153 | PColDel:TMenuItem; |
@@ -155,7 +155,10 @@ type | ||
155 | 155 | PRowDel:TMenuItem; |
156 | 156 | N5:TMenuItem; |
157 | 157 | PClear:TMenuItem; |
158 | - OpURLWait: TMaskEdit; | |
158 | + OpURLWait:TMaskEdit; | |
159 | + OpURLLocal:TCheckBox; | |
160 | + OpURLitune:TCheckBox; | |
161 | + OpURLReset:TCheckBox; | |
159 | 162 | procedure FindClick(Sender:TObject); |
160 | 163 | procedure FormCreate(Sender:TObject); |
161 | 164 | procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer); |
@@ -194,7 +197,8 @@ type | ||
194 | 197 | procedure PColDelClick(Sender:TObject); |
195 | 198 | procedure PClearClick(Sender:TObject); |
196 | 199 | private |
197 | - function getpathtext: string; | |
200 | + function getpathtext:string; | |
201 | + function localfind(var sa:TStringDynArray;ssss:string):boolean; | |
198 | 202 | { Private 宣言 } |
199 | 203 | public |
200 | 204 | { Public 宣言 } |
@@ -221,6 +225,8 @@ var | ||
221 | 225 | Inifile:TMemInifile; |
222 | 226 | inidir:string; |
223 | 227 | pname:string; |
228 | + op:TSearchOption; | |
229 | + sa:TStringDynArray; | |
224 | 230 | |
225 | 231 | const |
226 | 232 | MAXLIST=4096; |
@@ -236,29 +242,44 @@ const | ||
236 | 242 | CNAME='アーティスト'; |
237 | 243 | COPEN='開く'; |
238 | 244 | COPEN2='開く2'; |
245 | + CALBAM='アルバム'; | |
239 | 246 | |
240 | 247 | var |
241 | 248 | NTEXT:Integer; |
242 | 249 | NFILE:Integer; |
243 | 250 | NPATH:Integer; |
244 | 251 | NNAME:Integer; |
252 | + NALBAM:Integer; | |
245 | 253 | NOPEN:Integer; |
246 | 254 | NOPEN2:Integer; |
247 | 255 | CHEAD:TStringDynArray=['',CTEXT,CFILE,CPATH]; |
248 | - CHEADWEB:TStringDynArray=['',CTEXT,CFILE,COPEN,COPEN2,CPATH,CNAME]; | |
256 | + CHEADWEB:TStringDynArray=['',CTEXT,CFILE,COPEN,COPEN2,CPATH,CNAME,CALBAM]; | |
249 | 257 | |
250 | 258 | {$R *.dfm} |
251 | 259 | |
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 | + | |
252 | 271 | function INCBS(const s:string):string; |
253 | 272 | begin |
254 | 273 | Result:=s; |
255 | - if not IsPathDelimiter(Result,Length(Result)) then Result:=Result+'\'; | |
274 | + if not IsPathDelimiter(Result,Length(Result)) then | |
275 | + Result:=Result+'\'; | |
256 | 276 | end; |
257 | 277 | |
258 | 278 | function EXCBS(const s:string):string; |
259 | 279 | begin |
260 | 280 | 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); | |
262 | 283 | end; |
263 | 284 | |
264 | 285 | function zenkaku(Str:String):String; // 半角全角 |
@@ -294,32 +315,38 @@ var | ||
294 | 315 | B:TButton; |
295 | 316 | procedure save(C:TComponent); |
296 | 317 | 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); | |
301 | 326 | end; |
302 | 327 | |
303 | 328 | procedure load(C:TComponent); |
304 | 329 | 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); | |
307 | 334 | if C.ClassType=TEdit then begin |
308 | 335 | 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; | |
310 | 338 | end; |
311 | 339 | if C.ClassType=TMaskEdit then begin |
312 | 340 | 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; | |
314 | 343 | end; |
315 | 344 | end; |
316 | 345 | |
317 | 346 | begin |
318 | 347 | 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]); | |
323 | 350 | end; |
324 | 351 | |
325 | 352 | end; |
@@ -357,12 +384,14 @@ begin | ||
357 | 384 | ShowMessage('ツリーテキストを読み込めませんでした'); |
358 | 385 | Application.Terminate; |
359 | 386 | end; |
387 | + | |
360 | 388 | end; |
361 | 389 | |
362 | 390 | procedure TTextDeFindForm.FormClose(Sender:TObject;var Action:TCloseAction); |
363 | 391 | |
364 | 392 | begin |
365 | - if Application.Terminated then exit; | |
393 | + if Application.Terminated then | |
394 | + exit; | |
366 | 395 | |
367 | 396 | Ini.WriteInteger('','Width',Width); |
368 | 397 | Ini.WriteInteger('','Height',Height); |
@@ -378,6 +407,7 @@ begin | ||
378 | 407 | Inifile.writetreeview('Tree',Tree); |
379 | 408 | // Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt')); |
380 | 409 | |
410 | + if OpURLReset.Checked then Ini.clear; | |
381 | 411 | Ini.UpdateFile; |
382 | 412 | Inifile.UpdateFile; |
383 | 413 | end; |
@@ -392,9 +422,12 @@ end; | ||
392 | 422 | |
393 | 423 | function TTextDeFindForm.QueryContinueDrag(fEscapePressed:BOOL;grfKeyState:Longint):HResult; |
394 | 424 | 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; | |
398 | 431 | end; |
399 | 432 | |
400 | 433 | function TTextDeFindForm.GiveFeedback(dwEffect:Longint):HResult; |
@@ -417,13 +450,14 @@ var | ||
417 | 450 | urls,s,ss:string; |
418 | 451 | ls,le,i,count:Integer; |
419 | 452 | |
420 | - function option(Url:String):String; | |
453 | + function getsearchtext(Url:String):String; | |
421 | 454 | var |
422 | 455 | C,cc:Char; |
423 | 456 | begin |
424 | 457 | |
425 | 458 | 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('//')); | |
427 | 461 | end; |
428 | 462 | |
429 | 463 | if OpUrlSpace.Checked then begin |
@@ -455,7 +489,7 @@ var | ||
455 | 489 | IdHTTP.HandleRedirects:=true; |
456 | 490 | s:=TStringStream.Create('',TEncoding.UTF8); |
457 | 491 | try |
458 | - Url:=TIdURI.URLEncode(Url,IndyTextEncoding_UTF8); | |
492 | + Url:=TIdURI.ParamsEncode(Url,IndyTextEncoding_UTF8); | |
459 | 493 | IdHTTP.Get(Url,s); |
460 | 494 | s.Position:=0; |
461 | 495 | Result:=s.ReadString(s.Size); |
@@ -474,7 +508,9 @@ var | ||
474 | 508 | vitem:TJSONObject; |
475 | 509 | pair:TJSONPair; |
476 | 510 | i,r:Integer; |
511 | + hit:Integer; | |
477 | 512 | data:string; |
513 | + artist:string; | |
478 | 514 | function getval(k:string):string; |
479 | 515 | begin |
480 | 516 | try |
@@ -486,26 +522,36 @@ var | ||
486 | 522 | |
487 | 523 | begin |
488 | 524 | data:=iddownload(Url); |
489 | - // memo1.Lines.LoadFromFile('D:\utilsrad10\textdefind\Win32\Debug\1-10.txt',TEncoding.UTF8); | |
490 | - // data:=memo1.Lines.text; | |
491 | 525 | try |
492 | 526 | obj:=TJSONObject.ParseJSONValue(data) as TJSONObject; |
493 | 527 | vresults:=obj.GetValue('results') as TJSONArray; |
528 | + hit:=0; | |
494 | 529 | for i:=0 to vresults.count-1 do begin |
495 | 530 | vitem:=vresults.Items[i] as TJSONObject;; |
496 | 531 | 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); | |
497 | 537 | Files.RowCount:=r+1; |
498 | - Files.cells[NTEXT,r]:=option(ss); | |
538 | + Files.Rows[r].clear; | |
539 | + Files.cells[NTEXT,r]:=getsearchtext(ss); | |
499 | 540 | Files.cells[NFILE,r]:=getval('trackName'); |
500 | 541 | Files.cells[NPATH,r]:=getval('trackViewUrl').Replace('https:','itmss:'); |
501 | 542 | Files.cells[NNAME,r]:=getval('artistName'); |
543 | + Files.cells[NALBAM,r]:=getval('collectionName'); | |
502 | 544 | Files.cells[NOPEN,r]:='M'; |
503 | 545 | Files.cells[NOPEN2,r]:='S'; |
504 | 546 | 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; | |
509 | 555 | end; |
510 | 556 | |
511 | 557 | except |
@@ -520,10 +566,10 @@ var | ||
520 | 566 | data:=iddownload(Url); |
521 | 567 | r:=Files.RowCount; |
522 | 568 | Files.RowCount:=r+1; |
523 | - Files.cells[NTEXT,r]:=option(ss); | |
569 | + Files.cells[NTEXT,r]:=getsearchtext(ss); | |
524 | 570 | Files.cells[NFILE,r]:=data; |
525 | 571 | end; |
526 | - function datoi(const S:string;def:integer):integer; | |
572 | + function datoi(const s:string;def:Integer):Integer; | |
527 | 573 | begin |
528 | 574 | try |
529 | 575 | Result:=StrToIntDef(TRegEx.Replace(s,'[^0-9\n]|^\n',''),def); |
@@ -532,6 +578,24 @@ var | ||
532 | 578 | end; |
533 | 579 | end; |
534 | 580 | |
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 | + | |
535 | 599 | begin |
536 | 600 | urlrun:=not urlrun; |
537 | 601 | // with GridFiles do begin |
@@ -542,53 +606,69 @@ begin | ||
542 | 606 | // Files.clear; |
543 | 607 | // Files.RowCount:=1; |
544 | 608 | // 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; | |
545 | 618 | |
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); | |
571 | 622 | |
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; | |
575 | 657 | |
576 | - sleep(Max(datoi(OpURLWait.Text,3000),1000)); | |
577 | 658 | end; |
578 | 659 | |
579 | - FindUrlButton.Caption:='URL検索'; | |
580 | - urlrun:=false; | |
581 | - Screen.Cursor:=crDefault; | |
582 | 660 | end; |
583 | 661 | |
584 | 662 | procedure TTextDeFindForm.PFileExecClick(Sender:TObject); |
585 | 663 | 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); | |
587 | 666 | end; |
588 | 667 | |
589 | 668 | procedure TTextDeFindForm.PFileFolderClick(Sender:TObject); |
590 | 669 | 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); | |
592 | 672 | |
593 | 673 | end; |
594 | 674 |
@@ -596,7 +676,8 @@ procedure TTextDeFindForm.PFileOpenClick(Sender:TObject); | ||
596 | 676 | begin |
597 | 677 | OpenDialog.DefaultExt:='csv'; |
598 | 678 | OpenDialog.Filter:='csv|csv|*|*'; |
599 | - if OpenDialog.Execute then Files.save(OpenDialog.FileName); | |
679 | + if OpenDialog.Execute then | |
680 | + Files.save(OpenDialog.FileName); | |
600 | 681 | end; |
601 | 682 | |
602 | 683 | procedure TTextDeFindForm.PFilePasteClick(Sender:TObject); |
@@ -608,17 +689,8 @@ procedure TTextDeFindForm.PFileSaveAsClick(Sender:TObject); | ||
608 | 689 | begin |
609 | 690 | SaveDialog.DefaultExt:='csv'; |
610 | 691 | 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); | |
622 | 694 | end; |
623 | 695 | |
624 | 696 | procedure TTextDeFindForm.PRowAddClick(Sender:TObject); |
@@ -660,7 +732,8 @@ procedure TTextDeFindForm.PTextOpenClick(Sender:TObject); | ||
660 | 732 | begin |
661 | 733 | OpenDialog.DefaultExt:='txt'; |
662 | 734 | 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); | |
664 | 737 | end; |
665 | 738 | |
666 | 739 | procedure TTextDeFindForm.PTextPasteClick(Sender:TObject); |
@@ -672,14 +745,16 @@ procedure TTextDeFindForm.PTextSaveAsClick(Sender:TObject); | ||
672 | 745 | begin |
673 | 746 | SaveDialog.DefaultExt:='txt'; |
674 | 747 | 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); | |
676 | 750 | |
677 | 751 | end; |
678 | 752 | |
679 | 753 | function gridInRect(X,Y:Integer;const r:TGridRect):boolean; |
680 | 754 | begin |
681 | 755 | 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; | |
683 | 758 | end; |
684 | 759 | |
685 | 760 | procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer); |
@@ -688,7 +763,8 @@ var | ||
688 | 763 | |
689 | 764 | begin |
690 | 765 | 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; | |
692 | 768 | Files.MouseToCell(X,Y,ACol,ARow); |
693 | 769 | |
694 | 770 | end; |
@@ -698,11 +774,12 @@ var | ||
698 | 774 | s:string; |
699 | 775 | begin |
700 | 776 | 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'; | |
703 | 781 | |
704 | - if s='' then | |
705 | - exit; | |
782 | + if s='' then exit; | |
706 | 783 | |
707 | 784 | ShellExecute(Handle,'open',PChar(s),'','',1); |
708 | 785 |
@@ -773,12 +850,13 @@ begin | ||
773 | 850 | // F.BorderStyle:=bsSingle; |
774 | 851 | r:=P.BoundsRect; |
775 | 852 | r.Top:=C.ClientToScreen(C.BoundsRect.BottomRight).Y; |
776 | - r.Height:=200; | |
853 | + r.Height:=500; | |
777 | 854 | // R.Inflate(0,0,0,100); |
778 | 855 | f.BoundsRect:=r; |
779 | 856 | M.Parent:=f; |
780 | 857 | M.Align:=alClient; |
781 | 858 | M.Text:=Text; |
859 | + M.ScrollBars:=ssBoth; | |
782 | 860 | f.Position:=poDesigned; |
783 | 861 | f.ShowModal; |
784 | 862 | Result:=M.Text; |
@@ -867,8 +945,7 @@ begin | ||
867 | 945 | end; |
868 | 946 | |
869 | 947 | 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)); | |
872 | 949 | |
873 | 950 | Inifile.writegrid('grid\'+pname,TGrid(GridFiles)); |
874 | 951 | end; |
@@ -898,23 +975,20 @@ var | ||
898 | 975 | ls,le:Integer; |
899 | 976 | begin |
900 | 977 | 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); | |
905 | 984 | end; |
906 | 985 | |
907 | -procedure TTextDeFindForm.FindClick(Sender:TObject); | |
986 | +function TTextDeFindForm.localfind(var sa:TStringDynArray;ssss:string):boolean; | |
908 | 987 | var |
909 | - op:TSearchOption; | |
910 | - sa:TStringDynArray; | |
911 | - s,ss:string; | |
912 | 988 | snm,nm:string; |
913 | - sub:boolean; | |
989 | + s,ss,sss:string; | |
990 | + i,j,r,si:Integer; | |
914 | 991 | hit:boolean; |
915 | - ls,le,i,j,count:Integer; | |
916 | - pathtext:string; | |
917 | - | |
918 | 992 | function findr(s:string):string; |
919 | 993 | begin |
920 | 994 | s:=s.ToUpper; |
@@ -924,42 +998,47 @@ var | ||
924 | 998 | Result:=s; |
925 | 999 | end; |
926 | 1000 | |
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; | |
958 | 1027 | end; |
959 | - if hit then break; | |
960 | 1028 | end; |
1029 | + if hit then | |
1030 | + break; | |
961 | 1031 | end; |
1032 | + Result:=hit; | |
1033 | +end; | |
962 | 1034 | |
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; | |
963 | 1042 | begin |
964 | 1043 | try |
965 | 1044 | Screen.Cursor:=crHourGlass; |
@@ -974,7 +1053,12 @@ begin | ||
974 | 1053 | op:=TSearchOption.soAllDirectories; |
975 | 1054 | // else |
976 | 1055 | // 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; | |
978 | 1062 | Files.RowCount:=1; |
979 | 1063 | Files.ColCount:=CHEAD.count; |
980 | 1064 | Files.Rows[0].setstrings(CHEAD); |
@@ -991,14 +1075,13 @@ begin | ||
991 | 1075 | end; |
992 | 1076 | for i:=ls to le do begin |
993 | 1077 | 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); | |
1002 | 1085 | end; |
1003 | 1086 | end; |
1004 | 1087 | Files.ColExpand(10); |
@@ -1022,20 +1105,25 @@ begin | ||
1022 | 1105 | count:=0; |
1023 | 1106 | |
1024 | 1107 | 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; | |
1027 | 1112 | |
1028 | 1113 | for i:=G.Selection.Top to G.Selection.Bottom do begin |
1029 | 1114 | fn:=INCBS(G.cells[NPATH,i])+G.cells[NFILE,i]; |
1030 | 1115 | |
1031 | - if not FileExists(fn) then continue; | |
1116 | + if not FileExists(fn) then | |
1117 | + continue; | |
1032 | 1118 | inc(count); |
1033 | 1119 | SetLength(PItems,count); |
1034 | 1120 | fnpath:=ExtractRelativePath(INCBS(getpathtext),fn); |
1035 | 1121 | |
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; | |
1037 | 1124 | end; |
1038 | - if count<1 then exit; | |
1125 | + if count<1 then | |
1126 | + exit; | |
1039 | 1127 | |
1040 | 1128 | ISF.GetUIObjectOf(0,count,PItems[0],IDataObject,nil,Pointer(Result)); |
1041 | 1129 | end; |
@@ -1092,7 +1180,8 @@ begin | ||
1092 | 1180 | EditorMode:=true; |
1093 | 1181 | |
1094 | 1182 | end |
1095 | - else inherited; | |
1183 | + else | |
1184 | + inherited; | |
1096 | 1185 | end; |
1097 | 1186 | |
1098 | 1187 | procedure TGrid.cutcopy(modecut:boolean); |
@@ -1110,17 +1199,22 @@ var | ||
1110 | 1199 | begin |
1111 | 1200 | Result:=s; |
1112 | 1201 | B:=false; |
1113 | - if d='' then B:=true; | |
1202 | + if d='' then | |
1203 | + B:=true; | |
1114 | 1204 | for C in s do |
1115 | - if pos(C,d)>0 then B:=true; | |
1205 | + if pos(C,d)>0 then | |
1206 | + B:=true; | |
1116 | 1207 | |
1117 | - if not B then exit; | |
1208 | + if not B then | |
1209 | + exit; | |
1118 | 1210 | Result:='"'+s+'"'; |
1119 | 1211 | end; |
1120 | 1212 | |
1121 | 1213 | 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); | |
1124 | 1218 | |
1125 | 1219 | ys:=Selection.Top; |
1126 | 1220 | xs:=Selection.left; |
@@ -1131,13 +1225,15 @@ begin | ||
1131 | 1225 | for i:=0 to yw do begin |
1132 | 1226 | s:=''; |
1133 | 1227 | for j:=0 to xw do begin |
1134 | - if j>0 then s:=s+#9; | |
1228 | + if j>0 then | |
1229 | + s:=s+#9; | |
1135 | 1230 | ss:=StringReplace(cells[xs+j,ys+i],#9,'',[rfReplaceAll]); |
1136 | 1231 | // タブは削除 |
1137 | 1232 | // if Pos(ss,CRLF)>0 then |
1138 | 1233 | ss:=d_dquotedstr(ss,CRLF); |
1139 | 1234 | s:=s+ss; |
1140 | - if modecut then cells[xs+j,ys+i]:=''; | |
1235 | + if modecut then | |
1236 | + cells[xs+j,ys+i]:=''; | |
1141 | 1237 | end; |
1142 | 1238 | Txt.add(s); |
1143 | 1239 | end; |
@@ -1157,12 +1253,14 @@ var | ||
1157 | 1253 | cols:TStringDynArray; |
1158 | 1254 | |
1159 | 1255 | begin |
1160 | - if not Focused then exit; | |
1256 | + if not Focused then | |
1257 | + exit; | |
1161 | 1258 | buf.copy(Self); |
1162 | 1259 | |
1163 | 1260 | Txt:=TStringList.Create; |
1164 | 1261 | 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); | |
1166 | 1264 | |
1167 | 1265 | ys:=Selection.Top; |
1168 | 1266 | xs:=Selection.left; |
@@ -1171,7 +1269,8 @@ begin | ||
1171 | 1269 | for i:=0 to yw do begin |
1172 | 1270 | s:=Txt[i]; |
1173 | 1271 | colcnt:=SplitString(s,#9).count; |
1174 | - if xw<colcnt then xw:=colcnt; | |
1272 | + if xw<colcnt then | |
1273 | + xw:=colcnt; | |
1175 | 1274 | end; |
1176 | 1275 | dec(xw); |
1177 | 1276 |
@@ -1213,10 +1312,8 @@ end; | ||
1213 | 1312 | |
1214 | 1313 | procedure TGrid.setfixed; |
1215 | 1314 | 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; | |
1220 | 1317 | end; |
1221 | 1318 | |
1222 | 1319 | function TGrid.load(fn:string):boolean; |
@@ -1265,7 +1362,8 @@ var | ||
1265 | 1362 | i,j:Integer; |
1266 | 1363 | begin |
1267 | 1364 | 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); | |
1269 | 1367 | end; |
1270 | 1368 | |
1271 | 1369 | function TGrid.alldo(func:TFuncXY):Integer; |
@@ -1273,14 +1371,16 @@ var | ||
1273 | 1371 | i,j:Integer; |
1274 | 1372 | begin |
1275 | 1373 | 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); | |
1277 | 1376 | end; |
1278 | 1377 | |
1279 | 1378 | function TGrid.selrowdo(func:TFuncXY):Integer; |
1280 | 1379 | var |
1281 | 1380 | i:Integer; |
1282 | 1381 | 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); | |
1284 | 1384 | end; |
1285 | 1385 | |
1286 | 1386 | function TGrid.seltext:string; |
@@ -1298,7 +1398,8 @@ function TGrid.rowdo(func:TFuncXY):Integer; | ||
1298 | 1398 | var |
1299 | 1399 | i:Integer; |
1300 | 1400 | begin |
1301 | - for i:=0 to RowCount-1 do func(0,i); | |
1401 | + for i:=0 to RowCount-1 do | |
1402 | + func(0,i); | |
1302 | 1403 | |
1303 | 1404 | end; |
1304 | 1405 |
@@ -1307,7 +1408,8 @@ var | ||
1307 | 1408 | w:Word; |
1308 | 1409 | begin |
1309 | 1410 | if ssCtrl in Shift then begin |
1310 | - if Key=17 then exit; | |
1411 | + if Key=17 then | |
1412 | + exit; | |
1311 | 1413 | case Key of |
1312 | 1414 | Word('X'):cutcopy(true); |
1313 | 1415 | Word('C'):cutcopy(false); |
@@ -1337,7 +1439,8 @@ begin | ||
1337 | 1439 | row:=ARow; |
1338 | 1440 | EditorMode:=true; |
1339 | 1441 | end; |
1340 | - if downinselection then exit; | |
1442 | + if downinselection then | |
1443 | + exit; | |
1341 | 1444 | inherited; |
1342 | 1445 | end; |
1343 | 1446 |
@@ -1356,7 +1459,8 @@ begin | ||
1356 | 1459 | exit; |
1357 | 1460 | |
1358 | 1461 | end; |
1359 | - if not(csLButtonDown in ControlState) then exit; | |
1462 | + if not(csLButtonDown in ControlState) then | |
1463 | + exit; | |
1360 | 1464 | |
1361 | 1465 | s:=Application.ExeName; |
1362 | 1466 | // 左ボタンが押された状態で、マウスの位置が閾値を超えたらドラッグ開始 |
@@ -1384,7 +1488,8 @@ function TGrid.DoMouseWheelDown(Shift:TShiftState;MousePos:TPoint):boolean; | ||
1384 | 1488 | var |
1385 | 1489 | i:Integer; |
1386 | 1490 | 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); | |
1388 | 1493 | Result:=true; |
1389 | 1494 | end; |
1390 | 1495 |
@@ -1392,7 +1497,8 @@ function TGrid.DoMouseWheelUp(Shift:TShiftState;MousePos:TPoint):boolean; | ||
1392 | 1497 | var |
1393 | 1498 | i:Integer; |
1394 | 1499 | 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); | |
1396 | 1502 | Result:=true; |
1397 | 1503 | end; |
1398 | 1504 |
@@ -1407,14 +1513,17 @@ begin | ||
1407 | 1513 | w1:=0; |
1408 | 1514 | for i:=0 to RowCount-1 do begin |
1409 | 1515 | w2:=Canvas.TextWidth('['+cells[j,i]); |
1410 | - if (w1<w2) then w1:=w2; | |
1516 | + if (w1<w2) then | |
1517 | + w1:=w2; | |
1411 | 1518 | end; |
1412 | - if w1<min then w1:=min; | |
1519 | + if w1<min then | |
1520 | + w1:=min; | |
1413 | 1521 | ColWidths[j]:=w1; |
1414 | 1522 | w3:=w3+(w1)+GridLineWidth; |
1415 | 1523 | end; |
1416 | 1524 | 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); | |
1418 | 1527 | |
1419 | 1528 | DefaultRowHeight:=Canvas.TextHeight('あ')+2; |
1420 | 1529 | Result:=w3+4; |
@@ -1433,9 +1542,12 @@ function TGrid.ColClear(X,cnt:Integer):Integer; | ||
1433 | 1542 | var |
1434 | 1543 | i:Integer; |
1435 | 1544 | 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(); | |
1439 | 1551 | Result:=0 |
1440 | 1552 | |
1441 | 1553 | end; |
@@ -1446,9 +1558,12 @@ var | ||
1446 | 1558 | w:Integer; |
1447 | 1559 | begin |
1448 | 1560 | 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; | |
1452 | 1567 | w:=ColCount-cnt; |
1453 | 1568 | for i:=X to w-1 do begin |
1454 | 1569 | cols[i]:=cols[i+cnt]; |
@@ -1463,8 +1578,10 @@ var | ||
1463 | 1578 | i:Integer; |
1464 | 1579 | lcnt:Integer; |
1465 | 1580 | 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; | |
1468 | 1585 | ColCount:=ColCount+cnt; |
1469 | 1586 | lcnt:=ColCount; |
1470 | 1587 |
@@ -1472,7 +1589,8 @@ begin | ||
1472 | 1589 | cols[i]:=cols[i-cnt]; |
1473 | 1590 | ColWidths[i]:=ColWidths[i-cnt]; |
1474 | 1591 | 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(); | |
1476 | 1594 | Result:=0; |
1477 | 1595 | end; |
1478 | 1596 |
@@ -1482,9 +1600,12 @@ var | ||
1482 | 1600 | w:Integer; |
1483 | 1601 | begin |
1484 | 1602 | 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; | |
1488 | 1609 | w:=RowCount-cnt; |
1489 | 1610 | for i:=Y to w-1 do begin |
1490 | 1611 | Rows[i]:=Rows[i+cnt]; |
@@ -1499,8 +1620,10 @@ var | ||
1499 | 1620 | i:Integer; |
1500 | 1621 | lcnt:Integer; |
1501 | 1622 | 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; | |
1504 | 1627 | RowCount:=RowCount+cnt; |
1505 | 1628 | lcnt:=RowCount; |
1506 | 1629 |
@@ -1508,7 +1631,8 @@ begin | ||
1508 | 1631 | Rows[i]:=Rows[i-cnt]; |
1509 | 1632 | RowHeights[i]:=RowHeights[i-cnt]; |
1510 | 1633 | 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(); | |
1512 | 1636 | Result:=0; |
1513 | 1637 | end; |
1514 | 1638 |
@@ -1516,9 +1640,12 @@ function TGrid.RowClear(Y,cnt:Integer):Integer; | ||
1516 | 1640 | var |
1517 | 1641 | i:Integer; |
1518 | 1642 | 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(); | |
1522 | 1649 | Result:=0 |
1523 | 1650 | end; |
1524 | 1651 |
@@ -1549,8 +1676,10 @@ end; | ||
1549 | 1676 | function TStringDynArrayHelper.item(i:Integer):String; |
1550 | 1677 | begin |
1551 | 1678 | 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; | |
1554 | 1683 | Result:=Self[i]; |
1555 | 1684 | end; |
1556 | 1685 |
@@ -1580,7 +1709,8 @@ var | ||
1580 | 1709 | s:string; |
1581 | 1710 | begin |
1582 | 1711 | Result:=TStringSelf.Create; |
1583 | - for s in Self do Result.add(s); | |
1712 | + for s in Self do | |
1713 | + Result.add(s); | |
1584 | 1714 | end; |
1585 | 1715 | |
1586 | 1716 | function TStringDynArrayHelper.adduni(s:string):Integer; |
@@ -1588,7 +1718,8 @@ var | ||
1588 | 1718 | i:Integer; |
1589 | 1719 | begin |
1590 | 1720 | for i:=0 to hi do |
1591 | - if Self[i]=s then exit(-1); | |
1721 | + if Self[i]=s then | |
1722 | + exit(-1); | |
1592 | 1723 | add(s); |
1593 | 1724 | Result:=count; |
1594 | 1725 | end; |
@@ -1597,7 +1728,8 @@ function TStringDynArrayHelper.cat(s,e:string):String; | ||
1597 | 1728 | var |
1598 | 1729 | T:string; |
1599 | 1730 | begin |
1600 | - for T in Self do Result:=Result+s+T+e; | |
1731 | + for T in Self do | |
1732 | + Result:=Result+s+T+e; | |
1601 | 1733 | end; |
1602 | 1734 | |
1603 | 1735 | procedure TStringDynArrayHelper.clear; |
@@ -1617,8 +1749,7 @@ var | ||
1617 | 1749 | i:Integer; |
1618 | 1750 | begin |
1619 | 1751 | 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]; | |
1622 | 1753 | end; |
1623 | 1754 | |
1624 | 1755 | { TIniFileHelper } |
@@ -1638,13 +1769,17 @@ begin | ||
1638 | 1769 | for Y:=0 to MAXLIST do begin |
1639 | 1770 | for X:=0 to 10 do begin |
1640 | 1771 | 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; | |
1644 | 1778 | G.cells[X,Y]:=ReadString(sc,inttostr(Y)+','+inttostr(X),''); |
1645 | 1779 | end; |
1646 | 1780 | end; |
1647 | - if G.RowCount<2 then G.RowCount:=2; | |
1781 | + if G.RowCount<2 then | |
1782 | + G.RowCount:=2; | |
1648 | 1783 | |
1649 | 1784 | // G.Rows[0].setstrings(CHEAD); |
1650 | 1785 | G.setfixed; |
@@ -1667,9 +1802,12 @@ var | ||
1667 | 1802 | i:Integer; |
1668 | 1803 | s:string; |
1669 | 1804 | begin |
1670 | - if SectionExists(sc) then sl.clear; | |
1805 | + | |
1806 | + if ValueExists(sc,'0') then | |
1807 | + sl.clear; | |
1671 | 1808 | 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; | |
1673 | 1811 | sl.add(ReadString(sc,inttostr(i),'')); |
1674 | 1812 | end; |
1675 | 1813 | end; |
@@ -1679,8 +1817,8 @@ var | ||
1679 | 1817 | i:Integer; |
1680 | 1818 | begin |
1681 | 1819 | 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]); | |
1684 | 1822 | end; |
1685 | 1823 | |
1686 | 1824 | procedure TMemIniFileHelper.readtreeview(sc:string;T:TTreeView); |
@@ -1694,16 +1832,19 @@ var | ||
1694 | 1832 | begin |
1695 | 1833 | for i:=0 to MAXLIST do begin |
1696 | 1834 | k:=Key+','+inttostr(i); |
1697 | - if not ValueExists(sc,k) then break; | |
1835 | + if not ValueExists(sc,k) then | |
1836 | + break; | |
1698 | 1837 | T.Items.AddChild(N,ReadString(sc,k,'')); |
1699 | 1838 | sub(k,N); |
1700 | 1839 | end; |
1701 | 1840 | end; |
1702 | 1841 | |
1703 | 1842 | begin |
1704 | - if SectionExists(sc) then T.Items.clear; | |
1843 | + if SectionExists(sc) then | |
1844 | + T.Items.clear; | |
1705 | 1845 | 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; | |
1707 | 1848 | N:=T.Items.add(nil,ReadString(sc,inttostr(i),'')); |
1708 | 1849 | sub(inttostr(i),N); |
1709 | 1850 | end; |