| Revision | 3 (tree) |
|---|---|
| Time | 2018-12-09 00:45:20 |
| Author | kentamaken |
ドラッグ修正
リストのツリー化
検索文字列も表示
| @@ -72,6 +72,7 @@ | ||
| 72 | 72 | <DCC_RemoteDebug>true</DCC_RemoteDebug> |
| 73 | 73 | </PropertyGroup> |
| 74 | 74 | <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''"> |
| 75 | + <Debugger_RunParams>/IUV3</Debugger_RunParams> | |
| 75 | 76 | <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> |
| 76 | 77 | <DCC_DebugDCUs>false</DCC_DebugDCUs> |
| 77 | 78 | <AppEnableHighDPI>true</AppEnableHighDPI> |
| @@ -16,6 +16,10 @@ | ||
| 16 | 16 | |
| 17 | 17 | end; |
| 18 | 18 | |
| 19 | + TStringsHelper=class helper for TStrings | |
| 20 | + function setstrings(sa:TStringDynArray):Integer; | |
| 21 | + end; | |
| 22 | + | |
| 19 | 23 | TStringDynArrayHelper=record helper for TStringDynArray |
| 20 | 24 | function add(s:string):Integer; |
| 21 | 25 | function adduni(s:string):Integer; |
| @@ -76,7 +80,6 @@ | ||
| 76 | 80 | Panel1:TPanel; |
| 77 | 81 | Path:TComboBox; |
| 78 | 82 | Find:TButton; |
| 79 | - Text:TRichEdit; | |
| 80 | 83 | GridFiles: TStringGrid; |
| 81 | 84 | PopupMenu2:TPopupMenu; |
| 82 | 85 | PFileCut:TMenuItem; |
| @@ -94,6 +97,14 @@ | ||
| 94 | 97 | TMP:TComboBox; |
| 95 | 98 | SaveDialog:TSaveDialog; |
| 96 | 99 | OpenDialog:TOpenDialog; |
| 100 | + Panel2: TPanel; | |
| 101 | + Name: TComboBox; | |
| 102 | + Text: TRichEdit; | |
| 103 | + Tree: TTreeView; | |
| 104 | + Button1: TButton; | |
| 105 | + Splitter1: TSplitter; | |
| 106 | + PFileExec: TMenuItem; | |
| 107 | + PFileFolder: TMenuItem; | |
| 97 | 108 | procedure FindClick(Sender:TObject); |
| 98 | 109 | procedure FormCreate(Sender:TObject); |
| 99 | 110 | procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton; |
| @@ -109,6 +120,11 @@ | ||
| 109 | 120 | procedure PTextSaveAsClick(Sender:TObject); |
| 110 | 121 | procedure PTextOpenClick(Sender:TObject); |
| 111 | 122 | procedure FormDestroy(Sender:TObject); |
| 123 | + procedure NameChange(Sender: TObject); | |
| 124 | + procedure TreeClick(Sender: TObject); | |
| 125 | + procedure Button1Click(Sender: TObject); | |
| 126 | + procedure PFileFolderClick(Sender: TObject); | |
| 127 | + procedure PFileExecClick(Sender: TObject); | |
| 112 | 128 | private |
| 113 | 129 | { Private 宣言 } |
| 114 | 130 | public |
| @@ -117,17 +133,15 @@ | ||
| 117 | 133 | |
| 118 | 134 | function QueryContinueDrag(fEscapePressed:BOOL;grfKeyState:Longint):HResult;stdcall; |
| 119 | 135 | function GiveFeedback(dwEffect:Longint):HResult;stdcall; |
| 136 | + function GetFilePathDataObject(G:TStringGrid):IDataObject; | |
| 120 | 137 | end; |
| 121 | 138 | |
| 122 | - | |
| 123 | - function GetFilePathDataObject(G:TStringGrid):IDataObject; | |
| 124 | - | |
| 125 | 139 | var |
| 126 | 140 | TextDeFindForm:TTextDeFindForm; |
| 127 | 141 | |
| 128 | 142 | implementation |
| 129 | 143 | |
| 130 | -uses strutils,IOUtils,masks,clipbrd,inifiles; | |
| 144 | +uses strutils,IOUtils,masks,clipbrd,inifiles,SHELLAPI; | |
| 131 | 145 | |
| 132 | 146 | var |
| 133 | 147 | Malloc :IMalloc; |
| @@ -135,6 +149,7 @@ | ||
| 135 | 149 | SL :TStringDynArray; |
| 136 | 150 | Ini :TIniFile; |
| 137 | 151 | inidir :string; |
| 152 | + pname :string; | |
| 138 | 153 | |
| 139 | 154 | const |
| 140 | 155 | TKNMAXLEN=1024; |
| @@ -143,9 +158,28 @@ | ||
| 143 | 158 | LF =#10; |
| 144 | 159 | CRLF =#13#10; |
| 145 | 160 | TAB =#9; |
| 161 | + CTEXT =1; | |
| 162 | + CFILE =2; | |
| 163 | + CPATH =3; | |
| 164 | +var | |
| 165 | + CHEAD:TStringDynArray =['','テキスト','ファイル','パス']; | |
| 146 | 166 | |
| 147 | 167 | {$R *.dfm} |
| 148 | 168 | |
| 169 | +function INCBS(const s:string):string; | |
| 170 | +begin | |
| 171 | + Result:=s; | |
| 172 | + if not IsPathDelimiter(Result,Length(Result)) then Result:=Result+'\'; | |
| 173 | +end; | |
| 174 | + | |
| 175 | +function EXCBS(const s:string):string; | |
| 176 | +begin | |
| 177 | + Result:=s; | |
| 178 | + if IsPathDelimiter(Result,Length(Result)) then SetLength(Result,Length(Result)-1); | |
| 179 | +end; | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 149 | 183 | procedure TTextDeFindForm.FormCreate(Sender:TObject); |
| 150 | 184 | begin |
| 151 | 185 | Ini:=TIniFile.Create(ChangeFileExt(Application.ExeName,'.INI')); |
| @@ -158,10 +192,16 @@ | ||
| 158 | 192 | Text.Width:=Ini.ReadInteger('','Text.Width',Text.Width); |
| 159 | 193 | Font.Size:=Ini.ReadInteger('','Font.Size',Font.Size); |
| 160 | 194 | |
| 195 | + Path.Text:=Ini.ReadString('','Path.Text',''); | |
| 196 | + | |
| 161 | 197 | // Files:=GridFiles; |
| 162 | 198 | Files:=TGrid.CreateEX(GridFiles); |
| 163 | - Text.lines.LoadFromFile(ChangeFileExt(Application.ExeName,'.txt')); | |
| 199 | + | |
| 200 | + Tree.LoadFromFile(ChangeFileExt(Application.ExeName,'.txt')); | |
| 164 | 201 | files.Load(ChangeFileExt(Application.ExeName,'.csv')); |
| 202 | + NameChange(Sender); | |
| 203 | + pname:=Name.Text; | |
| 204 | + TreeClick(Sender); | |
| 165 | 205 | end; |
| 166 | 206 | |
| 167 | 207 | procedure TTextDeFindForm.FormDestroy(Sender:TObject); |
| @@ -170,9 +210,11 @@ | ||
| 170 | 210 | Ini.WriteInteger('','Height',Height); |
| 171 | 211 | Ini.WriteInteger('','Text.Width',Text.Width); |
| 172 | 212 | Ini.WriteInteger('','Font.Size',Font.Size); |
| 213 | + Ini.WriteString('','Path.Text',Path.Text); | |
| 173 | 214 | Ini.Free; |
| 174 | 215 | |
| 175 | - Text.lines.SaveToFile(ChangeFileExt(Application.ExeName,'.txt')); | |
| 216 | + NameChange(Sender); | |
| 217 | + Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt')); | |
| 176 | 218 | files.save(ChangeFileExt(Application.ExeName,'.csv')); |
| 177 | 219 | |
| 178 | 220 | end; |
| @@ -192,6 +234,7 @@ | ||
| 192 | 234 | else Result:=S_OK; |
| 193 | 235 | end; |
| 194 | 236 | |
| 237 | + | |
| 195 | 238 | function TTextDeFindForm.GiveFeedback(dwEffect:Longint):HResult; |
| 196 | 239 | begin |
| 197 | 240 | //デフォルトのカーソルを使う |
| @@ -208,6 +251,19 @@ | ||
| 208 | 251 | files.cutcopy(true); |
| 209 | 252 | end; |
| 210 | 253 | |
| 254 | +procedure TTextDeFindForm.PFileExecClick(Sender: TObject); | |
| 255 | +begin | |
| 256 | + with GridFiles do | |
| 257 | + ShellExecute(Handle,'open',Pchar(INCBS(cells[CPATH,row])+cells[CFILE,row]),'','',1); | |
| 258 | +end; | |
| 259 | + | |
| 260 | +procedure TTextDeFindForm.PFileFolderClick(Sender: TObject); | |
| 261 | +begin | |
| 262 | + with GridFiles do | |
| 263 | + ShellExecute(Handle,'open',Pchar(INCBS(cells[CPATH,row])),'','',1); | |
| 264 | + | |
| 265 | +end; | |
| 266 | + | |
| 211 | 267 | procedure TTextDeFindForm.PFileOpenClick(Sender:TObject); |
| 212 | 268 | begin |
| 213 | 269 | OpenDialog.DefaultExt:='csv'; |
| @@ -257,72 +313,138 @@ | ||
| 257 | 313 | |
| 258 | 314 | end; |
| 259 | 315 | |
| 260 | -function INCBS(const s:string):string; | |
| 261 | -begin | |
| 262 | - Result:=s; | |
| 263 | - if not IsPathDelimiter(Result,Length(Result)) then Result:=Result+'\'; | |
| 264 | -end; | |
| 265 | 316 | |
| 266 | -function EXCBS(const s:string):string; | |
| 317 | + | |
| 318 | +function gridInRect(X,Y:Integer;const r:TGridRect):boolean; | |
| 267 | 319 | begin |
| 268 | - Result:=s; | |
| 269 | - if IsPathDelimiter(Result,Length(Result)) then SetLength(Result,Length(Result)-1); | |
| 320 | + Result:=true; | |
| 321 | + if ((X<r.left)or(X>r.right)or(Y<r.top)or(Y>r.Bottom)) then Result:=false; | |
| 270 | 322 | end; |
| 271 | 323 | |
| 272 | -function GetFilePathDataObject(G:TStringGrid):IDataObject; | |
| 324 | +procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton; | |
| 325 | + Shift:TShiftState;X,Y:Integer); | |
| 273 | 326 | var |
| 274 | - fDesktop,fTargetFolder:IShellFolder; | |
| 275 | - Filepidl :packed array of PItemIDList; | |
| 276 | - Dirpidl :PItemIDList; | |
| 277 | - pchEaten,dwAttributes :Cardinal; | |
| 278 | - Dir,FileName :Widestring; | |
| 279 | - i,r,count :Integer; | |
| 280 | - SourceFile :string; | |
| 327 | + ACol,ARow:Longint; | |
| 328 | + | |
| 281 | 329 | begin |
| 282 | - Result:=nil; | |
| 330 | + Files.MouseToCell(X,Y,ACol,ARow); | |
| 331 | + if gridInRect(ACol,ARow,Files.selection) then exit; | |
| 332 | + Files.MouseToCell(X,Y,ACol,ARow); | |
| 283 | 333 | |
| 284 | - count:=G.selection.Bottom-G.selection.top+1; | |
| 285 | - SetLength(Filepidl,count); | |
| 286 | - for i:=0 to count-1 do begin | |
| 287 | - r:=i+G.selection.top; | |
| 334 | +end; | |
| 288 | 335 | |
| 289 | - SourceFile:=INCBS(G.cells[2,r])+G.cells[1,r]; | |
| 290 | - if not FileExists(SourceFile) then exit; | |
| 291 | 336 | |
| 292 | - Dir:=ExtractFileDir(SourceFile); | |
| 293 | - FileName:=ExtractFileName(SourceFile); | |
| 337 | +procedure TTextDeFindForm.TreeClick(Sender: TObject); | |
| 338 | +var N:TTreeNode; | |
| 339 | +ppname:string; | |
| 340 | +i:integer; | |
| 294 | 341 | |
| 295 | - SHGetDesktopFolder(fDesktop); | |
| 296 | 342 | |
| 297 | - if Failed(fDesktop.ParseDisplayName(0,nil,PWideChar(Dir),pchEaten,Dirpidl,dwAttributes)) then exit; | |
| 298 | - if Failed(fDesktop.BindToObject(Dirpidl,nil,IID_IShellFolder,fTargetFolder)) then exit; | |
| 299 | - if Failed(fTargetFolder.ParseDisplayName(0,nil,PWideChar(FileName),pchEaten,Filepidl[i],dwAttributes)) then | |
| 300 | - end; | |
| 343 | +begin | |
| 301 | 344 | |
| 302 | - if count<1 then exit; | |
| 345 | + ppname:=Name.Text; | |
| 303 | 346 | |
| 304 | - fTargetFolder.GetUIObjectOf(0,count,Filepidl[0],IDataObject,nil,Pointer(Result)); | |
| 347 | + | |
| 348 | +// for i:=Name.Items.Count-1 downto 1 do | |
| 349 | +// Name.Items.Delete(i); | |
| 350 | + | |
| 351 | + Tmp.Clear; | |
| 352 | + N:=Tree.Items.GetFirstNode; | |
| 353 | + while N<>nil do begin | |
| 354 | + Tmp.Items.add(N.Text); | |
| 355 | + N:=N.getNextSibling; | |
| 356 | + end; | |
| 357 | + Name.Enabled:=false; | |
| 358 | + Name.Items.Text:=Tmp.Items.text; | |
| 359 | +// Name.ItemIndex:=-1; | |
| 360 | +// Name.Text:=ppname; | |
| 361 | + Name.ItemIndex:=Name.Items.IndexOf(ppname); | |
| 362 | +// Application.ProcessMessages; | |
| 363 | + Name.Enabled:=true; | |
| 305 | 364 | end; |
| 306 | 365 | |
| 307 | - | |
| 308 | -function gridInRect(X,Y:Integer;const r:TGridRect):boolean; | |
| 366 | +procedure TTextDeFindForm.Button1Click(Sender: TObject); | |
| 309 | 367 | begin |
| 310 | - Result:=true; | |
| 311 | - if ((X<r.left)or(X>r.right)or(Y<r.top)or(Y>r.Bottom)) then Result:=false; | |
| 368 | + TreeClick(Sender); | |
| 312 | 369 | end; |
| 313 | 370 | |
| 314 | -procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton; | |
| 315 | - Shift:TShiftState;X,Y:Integer); | |
| 316 | -var | |
| 317 | - ACol,ARow:Longint; | |
| 318 | 371 | |
| 372 | +procedure TTextDeFindForm.NameChange(Sender: TObject); | |
| 373 | +var N,NN:TTreeNode; | |
| 374 | +s:string; | |
| 375 | + function childtext(N:TTreeNode):string; | |
| 376 | + begin | |
| 377 | + N:=N.getFirstChild; | |
| 378 | + while N<>nil do begin | |
| 379 | + Text.Lines.add(N.Text); | |
| 380 | + N:=N.getNextSibling; | |
| 381 | + end; | |
| 382 | + | |
| 383 | + end; | |
| 384 | + | |
| 385 | + | |
| 319 | 386 | begin |
| 320 | - Files.MouseToCell(X,Y,ACol,ARow); | |
| 321 | - if gridInRect(ACol,ARow,Files.selection) then exit; | |
| 322 | - Files.MouseToCell(X,Y,ACol,ARow); | |
| 387 | + if Trim(pname)<>'' then begin | |
| 388 | + N:=Tree.Items.GetFirstNode; | |
| 389 | + NN:=nil; | |
| 390 | + while N<>nil do begin | |
| 391 | + if N.text=pname then begin | |
| 392 | + NN:=N; | |
| 393 | + break; | |
| 394 | + end; | |
| 395 | + N:=N.getNextSibling; | |
| 396 | + end; | |
| 397 | + if Trim(Text.lines.Text)='' then begin //空ならリストから消す | |
| 398 | + if NN<>nil then begin | |
| 399 | + NN.Delete; | |
| 400 | + TreeClick(Sender); | |
| 401 | + end; | |
| 323 | 402 | |
| 403 | + end else begin //空以外ならリストへ | |
| 404 | + if NN=nil then begin | |
| 405 | + NN:=Tree.Items.Add(nil,pname); | |
| 406 | + TreeClick(Sender); | |
| 407 | + end; | |
| 408 | + | |
| 409 | + NN.DeleteChildren; | |
| 410 | + for s in Text.lines do | |
| 411 | + Tree.Items.AddChild(NN,s); | |
| 412 | + | |
| 413 | + end; | |
| 414 | + | |
| 415 | + end; | |
| 416 | + | |
| 417 | + Text.Text:=''; | |
| 418 | + N:=Tree.Items.GetFirstNode; | |
| 419 | + while N<>nil do begin | |
| 420 | + if N.text=Name.text then begin | |
| 421 | + childtext(N); | |
| 422 | + end; | |
| 423 | + N:=N.getNextSibling; | |
| 424 | + end; | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | +// if Trim(Text.lines.Text)<>'' then begin | |
| 431 | +// Ini.EraseSection(Name.Text); | |
| 432 | +// | |
| 433 | +// Tmp.Items.LoadFromFile(Ini.FileName); | |
| 434 | +// Tmp.Items.Add('['+Name.Text+']'); | |
| 435 | +// Tmp.Items.AddStrings(Text.Lines); | |
| 436 | +// Tmp.Items.SaveToFile(Ini.FileName); | |
| 437 | +// | |
| 438 | +// end; | |
| 439 | +// Ini.ReadSection(Name.Text,Tmp.Items); | |
| 440 | +// Text.lines.Text:=Tmp.Items.Text; | |
| 441 | +// Text.lines.Text:= | |
| 442 | +// Ini.ReadSectionValues(Name.Text,Text.lines); | |
| 443 | + | |
| 444 | + pname:=Name.Text; | |
| 324 | 445 | end; |
| 325 | 446 | |
| 447 | + | |
| 326 | 448 | procedure TTextDeFindForm.FindClick(Sender:TObject); |
| 327 | 449 | var |
| 328 | 450 | op :TSearchOption; |
| @@ -330,14 +452,39 @@ | ||
| 330 | 452 | s,ss :string; |
| 331 | 453 | snm,nm:string; |
| 332 | 454 | sub :boolean; |
| 455 | + | |
| 456 | + function hankaku(Str : String) : String;//全角半角 | |
| 457 | + var | |
| 458 | + Buf:array [0 .. 1023] of Char; | |
| 459 | + begin | |
| 460 | + LCMapString(GetUserDefaultLCID, LCMAP_HALFWIDTH, PChar(Str), Length(Str)+1, Buf, 1024); | |
| 461 | + Result:=String(Buf); | |
| 462 | + end; | |
| 463 | + function hira(Str : String) : String; //カタカナひらがな | |
| 464 | + var | |
| 465 | + Buf:array [0 .. 1023] of Char; | |
| 466 | + begin | |
| 467 | + LCMapString(GetUserDefaultLCID, LCMAP_FULLWIDTH, PChar(Str), Length(Str)+1, Buf, 1024); | |
| 468 | + Str:=String(Buf); | |
| 469 | + LCMapString(GetUserDefaultLCID, LCMAP_HIRAGANA, PChar(Str), Length(Str)+1, Buf, 1024); | |
| 470 | + Result:=String(Buf); | |
| 471 | + end; | |
| 472 | + | |
| 473 | + function findr(s:string):string; | |
| 474 | + begin | |
| 475 | + s:=s.ToUpper; | |
| 476 | + s:=hankaku(s); | |
| 477 | + result:=s; | |
| 478 | + end; | |
| 333 | 479 | begin |
| 334 | 480 | try |
| 335 | 481 | Screen.Cursor:=crHourGlass; |
| 336 | 482 | Application.ProcessMessages; |
| 483 | + Path.Text:=incbs(Path.Text); | |
| 484 | +// snm:=ExtractFileName(Path.Text); | |
| 485 | +// if snm='' then | |
| 486 | + snm:='*'; | |
| 337 | 487 | |
| 338 | - snm:=ExtractFileName(Path.Text); | |
| 339 | - if snm='' then snm:='*'; | |
| 340 | - | |
| 341 | 488 | // if sub then |
| 342 | 489 | op:=TSearchOption.soAllDirectories; |
| 343 | 490 | // else |
| @@ -344,20 +491,22 @@ | ||
| 344 | 491 | // op := TSearchOption.soTopDirectoryOnly; |
| 345 | 492 | SA:=TDirectory.GetFiles(Path.Text,snm,op); |
| 346 | 493 | Files.RowCount:=1; |
| 347 | - Files.ColCount:=3; | |
| 494 | + Files.ColCount:=4; | |
| 495 | + Files.Rows[0].setstrings(['','検索文字','ファイル','パス']); | |
| 348 | 496 | |
| 349 | 497 | for s in SA do begin |
| 350 | 498 | for ss in Text.lines do begin |
| 351 | - nm:=Trim(ss); | |
| 499 | + nm:=Trim(findr(ss)); | |
| 352 | 500 | if nm='' then continue; |
| 353 | 501 | |
| 354 | 502 | if Pos('*',nm)=0 then |
| 355 | 503 | if Pos('?',nm)=0 then nm:='*'+nm+'*'; |
| 356 | - snm:=ExtractFileName(s); | |
| 504 | + snm:=findr(ExtractFileName(s)); | |
| 357 | 505 | if MatchesMask(snm,nm) then begin |
| 358 | 506 | Files.RowCount:=Files.RowCount+1; |
| 359 | - Files.cells[2,Files.RowCount-1]:=ExtractFileDir(s); | |
| 360 | - Files.cells[1,Files.RowCount-1]:=ExtractFileName(s); | |
| 507 | + Files.cells[CTEXT,Files.RowCount-1]:=(nm); | |
| 508 | + Files.cells[CPATH,Files.RowCount-1]:=ExtractFileDir(s); | |
| 509 | + Files.cells[CFILE,Files.RowCount-1]:=ExtractFileName(s); | |
| 361 | 510 | break; |
| 362 | 511 | end; |
| 363 | 512 | end; |
| @@ -369,6 +518,52 @@ | ||
| 369 | 518 | end; |
| 370 | 519 | end; |
| 371 | 520 | |
| 521 | + | |
| 522 | +function TTextDeFindForm.GetFilePathDataObject(G:TStringGrid):IDataObject; | |
| 523 | +var | |
| 524 | + fDesktop,fTargetFolder:IShellFolder; | |
| 525 | + Filepidl :packed array of PItemIDList; | |
| 526 | + Dirpidl :PItemIDList; | |
| 527 | + pchEaten,dwAttributes :Cardinal; | |
| 528 | + Dir,FileName :Widestring; | |
| 529 | + i,r,count :Integer; | |
| 530 | + SourceFile :string; | |
| 531 | +begin | |
| 532 | + Result:=nil; | |
| 533 | + | |
| 534 | + count:=G.selection.Bottom-G.selection.top+1; | |
| 535 | + SetLength(Filepidl,count); | |
| 536 | + SHGetDesktopFolder(fDesktop); | |
| 537 | + if Failed(fDesktop.ParseDisplayName(0,nil,PWideChar(Path.text),pchEaten,Dirpidl,dwAttributes)) then exit; | |
| 538 | + if Failed(fDesktop.BindToObject(Dirpidl,nil,IID_IShellFolder,fTargetFolder)) then exit; | |
| 539 | + | |
| 540 | + | |
| 541 | + for i:=0 to count-1 do begin | |
| 542 | + r:=i+G.selection.top; | |
| 543 | + | |
| 544 | + SourceFile:=INCBS(G.cells[CPATH,r])+G.cells[CFILE,r]; | |
| 545 | + if not FileExists(SourceFile) then exit; | |
| 546 | + | |
| 547 | + Dir:=ExtractFileDir(SourceFile); | |
| 548 | + FileName:=ExtractRelativePath(INCBS(Path.text),SourceFile); | |
| 549 | + | |
| 550 | + if Failed(fTargetFolder.ParseDisplayName(0,nil,PWideChar(FileName),pchEaten,Filepidl[i],dwAttributes)) then exit; | |
| 551 | + | |
| 552 | + end; | |
| 553 | + | |
| 554 | + if count<1 then exit; | |
| 555 | + | |
| 556 | + fTargetFolder.GetUIObjectOf(0,count,Filepidl[0],IDataObject,nil,Pointer(Result)); | |
| 557 | +end; | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | +//-------------------------------------------------------------------------------- | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 372 | 567 | procedure TGrid.copy(G:TGrid); |
| 373 | 568 | var |
| 374 | 569 | r:TGridRect; |
| @@ -546,7 +741,6 @@ | ||
| 546 | 741 | end; |
| 547 | 742 | |
| 548 | 743 | function TGrid.load(fn:string):boolean; |
| 549 | -const CHEAD=',ファイル,パス'; | |
| 550 | 744 | var |
| 551 | 745 | i :Integer; |
| 552 | 746 | TMP:TStringList; |
| @@ -566,8 +760,8 @@ | ||
| 566 | 760 | Rows[i]:=TMP; |
| 567 | 761 | end; |
| 568 | 762 | |
| 569 | - ColCount:=SplitString(CHEAD,',').count; | |
| 570 | - Rows[0].CommaText:=CHEAD; | |
| 763 | + ColCount:=CHEAD.count; | |
| 764 | + Rows[0].setstrings(CHEAD); | |
| 571 | 765 | setfixed; |
| 572 | 766 | |
| 573 | 767 | savebuf; |
| @@ -645,6 +839,8 @@ | ||
| 645 | 839 | inherited; |
| 646 | 840 | end; |
| 647 | 841 | |
| 842 | + | |
| 843 | + | |
| 648 | 844 | procedure TGrid.MouseMove(Shift:TShiftState;X,Y:Integer); |
| 649 | 845 | var |
| 650 | 846 | DataObject:IDataObject; |
| @@ -653,6 +849,8 @@ | ||
| 653 | 849 | ACol,ARow :Longint; |
| 654 | 850 | savesel :TGridRect; |
| 655 | 851 | |
| 852 | + | |
| 853 | + | |
| 656 | 854 | begin |
| 657 | 855 | MouseToCell(X,Y,ACol,ARow); |
| 658 | 856 | if not downinselection then begin |
| @@ -675,7 +873,7 @@ | ||
| 675 | 873 | //BeginDrag(true); |
| 676 | 874 | |
| 677 | 875 | //ファイル名からIDataObjectを取得 |
| 678 | - DataObject:=GetFilePathDataObject(Self); | |
| 876 | + DataObject:=TextDeFindForm.GetFilePathDataObject(Self); | |
| 679 | 877 | //OLEドラッグ&ドロップ開始 |
| 680 | 878 | dwEffect:=DROPEFFECT_NONE; |
| 681 | 879 | DoDragDrop(DataObject,TextDeFindForm,DROPEFFECT_COPY,dwEffect); |
| @@ -859,6 +1057,18 @@ | ||
| 859 | 1057 | end; |
| 860 | 1058 | |
| 861 | 1059 | //初期化処理 |
| 1060 | +{ TStringsHelper } | |
| 1061 | + | |
| 1062 | +function TStringsHelper.setstrings(sa: TStringDynArray): Integer; | |
| 1063 | +var i:integer; | |
| 1064 | +begin | |
| 1065 | + for i:=0 to sa.Count-1 do | |
| 1066 | + if i<Count then | |
| 1067 | + Self[i]:=sa[i]; | |
| 1068 | + | |
| 1069 | + | |
| 1070 | +end; | |
| 1071 | + | |
| 862 | 1072 | initialization |
| 863 | 1073 | |
| 864 | 1074 | SHGetMalloc(Malloc); |