| Revision | 10 (tree) |
|---|---|
| Time | 2018-12-24 22:10:23 |
| Author | kentamaken |
検索オプション
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | <FrameworkType>VCL</FrameworkType> |
| 6 | 6 | <MainSource>textdefind.dpr</MainSource> |
| 7 | 7 | <Base>True</Base> |
| 8 | - <Config Condition="'$(Config)'==''">Debug</Config> | |
| 8 | + <Config Condition="'$(Config)'==''">Release</Config> | |
| 9 | 9 | <Platform Condition="'$(Platform)'==''">Win32</Platform> |
| 10 | 10 | <TargetedPlatforms>1</TargetedPlatforms> |
| 11 | 11 | <AppType>Application</AppType> |
| @@ -3,10 +3,11 @@ | ||
| 3 | 3 | interface |
| 4 | 4 | |
| 5 | 5 | uses |
| 6 | - Winapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,System.Classes,Vcl.Graphics, | |
| 6 | + Winapi.Windows,Winapi.Messages,System.SysUtils,System.Variants, | |
| 7 | + System.Classes,Vcl.Graphics, | |
| 7 | 8 | Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.StdCtrls,Vcl.ExtCtrls,Vcl.Grids, |
| 8 | 9 | types,inifiles, |
| 9 | - Vcl.ComCtrls,ShlObj,ActiveX,Vcl.Menus; | |
| 10 | + Vcl.ComCtrls,ShlObj,ActiveX,Vcl.Menus,Vcl.CheckLst; | |
| 10 | 11 | |
| 11 | 12 | type |
| 12 | 13 | TStringSelf=class(TStringList) |
| @@ -15,7 +16,6 @@ | ||
| 15 | 16 | function this:TStringList; |
| 16 | 17 | end; |
| 17 | 18 | |
| 18 | - | |
| 19 | 19 | TStringsHelper=class helper for TStrings |
| 20 | 20 | function setstrings(sa:TStringDynArray):Integer; |
| 21 | 21 | end; |
| @@ -47,7 +47,7 @@ | ||
| 47 | 47 | procedure MouseDown(Button:TMouseButton;Shift:TShiftState;X,Y:Integer);override; |
| 48 | 48 | procedure MouseMove(Shift:TShiftState;X,Y:Integer);override; |
| 49 | 49 | |
| 50 | - procedure SetEditText(ACol, ARow: Integer; const Value: string);override; | |
| 50 | + procedure SetEditText(ACol,ARow:Integer;const Value:string);override; | |
| 51 | 51 | |
| 52 | 52 | function DoMouseWheelDown(Shift:TShiftState;MousePos:TPoint):boolean;override; |
| 53 | 53 | function DoMouseWheelUp(Shift:TShiftState;MousePos:TPoint):boolean;override; |
| @@ -58,8 +58,8 @@ | ||
| 58 | 58 | |
| 59 | 59 | public |
| 60 | 60 | downinselection:boolean; |
| 61 | - saverect :TGridRect; | |
| 62 | - buf :TGrid; | |
| 61 | + saverect:TGridRect; | |
| 62 | + buf:TGrid; | |
| 63 | 63 | |
| 64 | 64 | procedure cutcopy(modecut:boolean); |
| 65 | 65 | function paste:TGridRect; |
| @@ -91,7 +91,7 @@ | ||
| 91 | 91 | Panel1:TPanel; |
| 92 | 92 | Path:TComboBox; |
| 93 | 93 | Find:TButton; |
| 94 | - GridFiles: TStringGrid; | |
| 94 | + GridFiles:TStringGrid; | |
| 95 | 95 | PopupMenu2:TPopupMenu; |
| 96 | 96 | PFileCut:TMenuItem; |
| 97 | 97 | PFileCopy:TMenuItem; |
| @@ -108,27 +108,35 @@ | ||
| 108 | 108 | TMP:TComboBox; |
| 109 | 109 | SaveDialog:TSaveDialog; |
| 110 | 110 | OpenDialog:TOpenDialog; |
| 111 | - LeftPanel: TPanel; | |
| 112 | - Name: TComboBox; | |
| 113 | - Text: TRichEdit; | |
| 114 | - Tree: TTreeView; | |
| 115 | - Button1: TButton; | |
| 116 | - Splitter1: TSplitter; | |
| 117 | - PFileExec: TMenuItem; | |
| 118 | - PFileFolder: TMenuItem; | |
| 119 | - Panel3: TPanel; | |
| 120 | - Url: TComboBox; | |
| 121 | - FindUrlButton: TButton; | |
| 122 | - UrlEditButton: TButton; | |
| 123 | - PathEditButton: TButton; | |
| 124 | - PTextFind: TMenuItem; | |
| 125 | - PTextFindUrl: TMenuItem; | |
| 126 | - N1: TMenuItem; | |
| 127 | - PathSelButton: TButton; | |
| 111 | + LeftPanel:TPanel; | |
| 112 | + Name:TComboBox; | |
| 113 | + Text:TRichEdit; | |
| 114 | + Tree:TTreeView; | |
| 115 | + Button1:TButton; | |
| 116 | + Splitter1:TSplitter; | |
| 117 | + PFileExec:TMenuItem; | |
| 118 | + PFileFolder:TMenuItem; | |
| 119 | + Panel3:TPanel; | |
| 120 | + Url:TComboBox; | |
| 121 | + FindUrlButton:TButton; | |
| 122 | + UrlEditButton:TButton; | |
| 123 | + PathEditButton:TButton; | |
| 124 | + PTextFind:TMenuItem; | |
| 125 | + PTextFindUrl:TMenuItem; | |
| 126 | + N1:TMenuItem; | |
| 127 | + PathSelButton:TButton; | |
| 128 | + OpURLPanel:TPanel; | |
| 129 | + OpURLEscape:TCheckBox; | |
| 130 | + OpUrlSpace:TCheckBox; | |
| 131 | + OpURLZenkaku:TCheckBox; | |
| 132 | + OpURLEscapeEdit:TEdit; | |
| 133 | + OpURLSpaceEdit:TEdit; | |
| 134 | + OptionUrlDQuote:TCheckBox; | |
| 135 | + OpURLComment:TCheckBox; | |
| 136 | + OpURLButton:TButton; | |
| 128 | 137 | procedure FindClick(Sender:TObject); |
| 129 | 138 | procedure FormCreate(Sender:TObject); |
| 130 | - procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton; | |
| 131 | - Shift:TShiftState;X,Y:Integer); | |
| 139 | + procedure GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer); | |
| 132 | 140 | procedure PFileCutClick(Sender:TObject); |
| 133 | 141 | procedure PFileCopyClick(Sender:TObject); |
| 134 | 142 | procedure PFilePasteClick(Sender:TObject); |
| @@ -140,22 +148,21 @@ | ||
| 140 | 148 | procedure PTextSaveAsClick(Sender:TObject); |
| 141 | 149 | procedure PTextOpenClick(Sender:TObject); |
| 142 | 150 | procedure FormDestroy(Sender:TObject); |
| 143 | - procedure NameChange(Sender: TObject); | |
| 144 | - procedure TreeClick(Sender: TObject); | |
| 145 | - procedure Button1Click(Sender: TObject); | |
| 146 | - procedure PFileFolderClick(Sender: TObject); | |
| 147 | - procedure PFileExecClick(Sender: TObject); | |
| 148 | - procedure FindUrlButtonClick(Sender: TObject); | |
| 149 | - procedure TextMouseUp(Sender: TObject; Button: TMouseButton; | |
| 150 | - Shift: TShiftState; X, Y: Integer); | |
| 151 | - procedure UrlEditButtonClick(Sender: TObject); | |
| 152 | - procedure PathEditButtonClick(Sender: TObject); | |
| 153 | - procedure PTextFindClick(Sender: TObject); | |
| 154 | - procedure PTextFindUrlClick(Sender: TObject); | |
| 155 | - procedure PathSelButtonClick(Sender: TObject); | |
| 156 | - procedure GridFilesSetEditText(Sender: TObject; ACol, ARow: Integer; | |
| 157 | - const Value: string); | |
| 158 | - procedure FormClose(Sender: TObject; var Action: TCloseAction); | |
| 151 | + procedure NameChange(Sender:TObject); | |
| 152 | + procedure TreeClick(Sender:TObject); | |
| 153 | + procedure Button1Click(Sender:TObject); | |
| 154 | + procedure PFileFolderClick(Sender:TObject); | |
| 155 | + procedure PFileExecClick(Sender:TObject); | |
| 156 | + procedure FindUrlButtonClick(Sender:TObject); | |
| 157 | + procedure TextMouseUp(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer); | |
| 158 | + procedure UrlEditButtonClick(Sender:TObject); | |
| 159 | + procedure PathEditButtonClick(Sender:TObject); | |
| 160 | + procedure PTextFindClick(Sender:TObject); | |
| 161 | + procedure PTextFindUrlClick(Sender:TObject); | |
| 162 | + procedure PathSelButtonClick(Sender:TObject); | |
| 163 | + procedure GridFilesSetEditText(Sender:TObject;ACol,ARow:Integer;const Value:string); | |
| 164 | + procedure FormClose(Sender:TObject;var Action:TCloseAction); | |
| 165 | + procedure OpURLButtonClick(Sender:TObject); | |
| 159 | 166 | private |
| 160 | 167 | { Private 宣言 } |
| 161 | 168 | public |
| @@ -176,27 +183,28 @@ | ||
| 176 | 183 | uses strutils,IOUtils,masks,clipbrd,SHELLAPI,Vcl.FileCtrl,IdGlobal,IdURI; |
| 177 | 184 | |
| 178 | 185 | var |
| 179 | - Malloc :IMalloc; | |
| 186 | + Malloc:IMalloc; | |
| 180 | 187 | FMouseDownPt:TPoint; |
| 181 | - SL :TStringDynArray; | |
| 182 | - Ini :TMemIniFile; | |
| 183 | - Inifile :TMemIniFile; | |
| 184 | - inidir :string; | |
| 185 | - pname :string; | |
| 188 | + sl:TStringDynArray; | |
| 189 | + Ini:TMemInifile; | |
| 190 | + Inifile:TMemInifile; | |
| 191 | + inidir:string; | |
| 192 | + pname:string; | |
| 186 | 193 | |
| 187 | 194 | const |
| 188 | - MAXLIST =4096; | |
| 195 | + MAXLIST=4096; | |
| 189 | 196 | TKNMAXLEN=1024; |
| 190 | - NULLNULL =#0#0; | |
| 191 | - CR =#13; | |
| 192 | - LF =#10; | |
| 193 | - CRLF =#13#10; | |
| 194 | - TAB =#9; | |
| 195 | - CTEXT =1; | |
| 196 | - CFILE =2; | |
| 197 | - CPATH =3; | |
| 197 | + NULLNULL=#0#0; | |
| 198 | + CR=#13; | |
| 199 | + LF=#10; | |
| 200 | + CRLF=#13#10; | |
| 201 | + TAB=#9; | |
| 202 | + CTEXT=1; | |
| 203 | + CFILE=2; | |
| 204 | + CPATH=3; | |
| 205 | + | |
| 198 | 206 | var |
| 199 | - CHEAD:TStringDynArray =['','検索文字','ファイル','パス']; | |
| 207 | + CHEAD:TStringDynArray=['','検索文字','ファイル','パス']; | |
| 200 | 208 | |
| 201 | 209 | {$R *.dfm} |
| 202 | 210 |
| @@ -203,46 +211,55 @@ | ||
| 203 | 211 | function INCBS(const s:string):string; |
| 204 | 212 | begin |
| 205 | 213 | Result:=s; |
| 206 | - if not IsPathDelimiter(Result,Length(Result)) then Result:=Result+'\'; | |
| 214 | + if not IsPathDelimiter(Result,Length(Result)) then | |
| 215 | + Result:=Result+'\'; | |
| 207 | 216 | end; |
| 208 | 217 | |
| 209 | 218 | function EXCBS(const s:string):string; |
| 210 | 219 | begin |
| 211 | 220 | Result:=s; |
| 212 | - if IsPathDelimiter(Result,Length(Result)) then SetLength(Result,Length(Result)-1); | |
| 221 | + if IsPathDelimiter(Result,Length(Result)) then | |
| 222 | + SetLength(Result,Length(Result)-1); | |
| 213 | 223 | end; |
| 214 | 224 | |
| 215 | -function zenkaku(Str : String) : String;//半角全角 | |
| 225 | +function zenkaku(Str:String):String; // 半角全角 | |
| 216 | 226 | var |
| 217 | - Buf:array [0 .. 1023] of Char; | |
| 227 | + buf: array [0..1023] of Char; | |
| 218 | 228 | begin |
| 219 | - LCMapString(GetUserDefaultLCID, LCMAP_FULLWIDTH, PChar(Str), Length(Str)+1, Buf, 1024); | |
| 220 | - Result:=String(Buf); | |
| 229 | + LCMapString(GetUserDefaultLCID,LCMAP_FULLWIDTH,PChar(Str),Length(Str)+1,buf,1024); | |
| 230 | + Result:=String(buf); | |
| 221 | 231 | end; |
| 222 | 232 | |
| 223 | -function hankaku(Str : String) : String;//全角半角 | |
| 233 | +function hankaku(Str:String):String; // 全角半角 | |
| 224 | 234 | var |
| 225 | - Buf:array [0 .. 1023] of Char; | |
| 235 | + buf: array [0..1023] of Char; | |
| 226 | 236 | begin |
| 227 | - LCMapString(GetUserDefaultLCID, LCMAP_HALFWIDTH, PChar(Str), Length(Str)+1, Buf, 1024); | |
| 228 | - Result:=String(Buf); | |
| 237 | + LCMapString(GetUserDefaultLCID,LCMAP_HALFWIDTH,PChar(Str),Length(Str)+1,buf,1024); | |
| 238 | + Result:=String(buf); | |
| 229 | 239 | end; |
| 230 | -function hira(Str : String) : String; //カタカナひらがな | |
| 240 | + | |
| 241 | +function hira(Str:String):String; // カタカナひらがな | |
| 231 | 242 | var |
| 232 | - Buf:array [0 .. 1023] of Char; | |
| 243 | + buf: array [0..1023] of Char; | |
| 233 | 244 | begin |
| 234 | - LCMapString(GetUserDefaultLCID, LCMAP_FULLWIDTH, PChar(Str), Length(Str)+1, Buf, 1024); | |
| 235 | - Str:=String(Buf); | |
| 236 | - LCMapString(GetUserDefaultLCID, LCMAP_HIRAGANA, PChar(Str), Length(Str)+1, Buf, 1024); | |
| 237 | - Result:=String(Buf); | |
| 245 | + LCMapString(GetUserDefaultLCID,LCMAP_FULLWIDTH,PChar(Str),Length(Str)+1,buf,1024); | |
| 246 | + Str:=String(buf); | |
| 247 | + LCMapString(GetUserDefaultLCID,LCMAP_HIRAGANA,PChar(Str),Length(Str)+1,buf,1024); | |
| 248 | + Result:=String(buf); | |
| 238 | 249 | end; |
| 239 | 250 | |
| 251 | +procedure TTextDeFindForm.FormCreate(Sender:TObject); | |
| 252 | + procedure LoadChecked(C:TComponent); | |
| 253 | + begin | |
| 254 | + if C.ClassType=TMenuItem then | |
| 255 | + TMenuItem(C).Checked:=Ini.ReadBool('',C.Name,TMenuItem(C).Checked); | |
| 256 | + if C.ClassType=TCheckBox then | |
| 257 | + TCheckBox(C).Checked:=Ini.ReadBool('',C.Name,TCheckBox(C).Checked); | |
| 258 | + end; | |
| 240 | 259 | |
| 241 | - | |
| 242 | -procedure TTextDeFindForm.FormCreate(Sender:TObject); | |
| 243 | 260 | begin |
| 244 | - Ini:=TMemIniFile.Create(ChangeFileExt(Application.ExeName,'.ini')); | |
| 245 | - Inifile:=TMemIniFile.Create(ChangeFileExt(Application.ExeName,'.txt')); | |
| 261 | + Ini:=TMemInifile.Create(ChangeFileExt(Application.ExeName,'.ini')); | |
| 262 | + Inifile:=TMemInifile.Create(ChangeFileExt(Application.ExeName,'.txt')); | |
| 246 | 263 | inidir:=Ini.ReadString('','inidir',inidir); |
| 247 | 264 | OpenDialog.InitialDir:=ExtractFileDir(Application.ExeName); |
| 248 | 265 | SaveDialog.InitialDir:=ExtractFileDir(Application.ExeName); |
| @@ -252,16 +269,24 @@ | ||
| 252 | 269 | LeftPanel.Width:=Ini.ReadInteger('','LeftPanel.Width',LeftPanel.Width); |
| 253 | 270 | Font.Size:=Ini.ReadInteger('','Font.Size',Font.Size); |
| 254 | 271 | |
| 272 | + LoadChecked(OpURLComment); | |
| 273 | + LoadChecked(OpUrlSpace); | |
| 274 | + OpURLSpaceEdit.Text:=Ini.ReadString('','OpURLSpaceEdit',OpURLSpaceEdit.Text); | |
| 275 | + LoadChecked(OpURLEscape); | |
| 276 | + OpURLEscapeEdit.Text:=Ini.ReadString('','OpURLEscape',OpURLEscapeEdit.Text); | |
| 277 | + LoadChecked(OpURLZenkaku); | |
| 278 | + LoadChecked(OptionUrlDQuote); | |
| 279 | + | |
| 255 | 280 | Path.Text:=Ini.ReadString('','Path.Text',''); |
| 256 | 281 | Url.Text:=Ini.ReadString('','Url.Text',''); |
| 257 | 282 | Ini.readstrings('Url.Items',Url.Items); |
| 258 | 283 | Inifile.readtreeview('Tree',Tree); |
| 259 | 284 | |
| 260 | -// Files:=GridFiles; | |
| 285 | + // Files:=GridFiles; | |
| 261 | 286 | Files:=TGrid.CreateEX(GridFiles); |
| 262 | 287 | |
| 263 | 288 | try |
| 264 | -// Tree.LoadFromFile(ChangeFileExt(Application.ExeName,'.txt')); | |
| 289 | + // Tree.LoadFromFile(ChangeFileExt(Application.ExeName,'.txt')); | |
| 265 | 290 | NameChange(Sender); |
| 266 | 291 | pname:=Name.Text; |
| 267 | 292 | TreeClick(Sender); |
| @@ -271,9 +296,19 @@ | ||
| 271 | 296 | end; |
| 272 | 297 | end; |
| 273 | 298 | |
| 274 | -procedure TTextDeFindForm.FormClose(Sender: TObject; var Action: TCloseAction); | |
| 299 | +procedure TTextDeFindForm.FormClose(Sender:TObject;var Action:TCloseAction); | |
| 300 | + | |
| 301 | + procedure SaveChecked(C:TComponent); | |
| 302 | + begin | |
| 303 | + if C.ClassType=TMenuItem then | |
| 304 | + Ini.WriteBool('',C.Name,TMenuItem(C).Checked); | |
| 305 | + if C.ClassType=TCheckBox then | |
| 306 | + Ini.WriteBool('',C.Name,TCheckBox(C).Checked); | |
| 307 | + end; | |
| 308 | + | |
| 275 | 309 | begin |
| 276 | - if Application.Terminated then exit; | |
| 310 | + if Application.Terminated then | |
| 311 | + exit; | |
| 277 | 312 | |
| 278 | 313 | Ini.WriteInteger('','Width',Width); |
| 279 | 314 | Ini.WriteInteger('','Height',Height); |
| @@ -283,9 +318,17 @@ | ||
| 283 | 318 | Ini.WriteString('','Url.Text',Url.Text); |
| 284 | 319 | Ini.writestrings('Url.Items',Url.Items); |
| 285 | 320 | |
| 321 | + SaveChecked(OpURLComment); | |
| 322 | + SaveChecked(OpUrlSpace); | |
| 323 | + Ini.WriteString('','OpURLSpaceEdit',OpURLSpaceEdit.Text); | |
| 324 | + SaveChecked(OpURLEscape); | |
| 325 | + Ini.WriteString('','OpURLEscape',OpURLEscapeEdit.Text); | |
| 326 | + SaveChecked(OpURLZenkaku); | |
| 327 | + SaveChecked(OptionUrlDQuote); | |
| 328 | + | |
| 286 | 329 | NameChange(Sender); |
| 287 | 330 | Inifile.writetreeview('Tree',Tree); |
| 288 | -// Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt')); | |
| 331 | + // Tree.SaveToFile(ChangeFileExt(Application.ExeName,'.txt')); | |
| 289 | 332 | |
| 290 | 333 | Ini.UpdateFile; |
| 291 | 334 | Inifile.UpdateFile; |
| @@ -299,73 +342,94 @@ | ||
| 299 | 342 | |
| 300 | 343 | end; |
| 301 | 344 | |
| 302 | - | |
| 303 | - | |
| 304 | -function TTextDeFindForm.QueryContinueDrag(fEscapePressed:BOOL; | |
| 305 | - grfKeyState:Longint):HResult; | |
| 345 | +function TTextDeFindForm.QueryContinueDrag(fEscapePressed:BOOL;grfKeyState:Longint):HResult; | |
| 306 | 346 | begin |
| 307 | - //ESC が押されたか、両方のボタンが押されている場合は中止する | |
| 308 | - if fEscapePressed or((MK_LBUTTON or MK_RBUTTON)=(grfKeyState and(MK_LBUTTON or MK_RBUTTON))) then Result:=DRAGDROP_S_CANCEL | |
| 347 | + // ESC が押されたか、両方のボタンが押されている場合は中止する | |
| 348 | + if fEscapePressed or((MK_LBUTTON or MK_RBUTTON)=(grfKeyState and(MK_LBUTTON or MK_RBUTTON))) then | |
| 349 | + Result:=DRAGDROP_S_CANCEL | |
| 309 | 350 | |
| 310 | - //マウスの左ボタンが離された場合はドロップ処理へ | |
| 311 | - else if grfKeyState and MK_LBUTTON=0 then Result:=DRAGDROP_S_DROP | |
| 351 | + // マウスの左ボタンが離された場合はドロップ処理へ | |
| 352 | + else if grfKeyState and MK_LBUTTON=0 then | |
| 353 | + Result:=DRAGDROP_S_DROP | |
| 312 | 354 | |
| 313 | - //それ以外はD&D継続 | |
| 314 | - else Result:=S_OK; | |
| 355 | + // それ以外はD&D継続 | |
| 356 | + else | |
| 357 | + Result:=S_OK; | |
| 315 | 358 | end; |
| 316 | 359 | |
| 317 | - | |
| 318 | 360 | function TTextDeFindForm.GiveFeedback(dwEffect:Longint):HResult; |
| 319 | 361 | begin |
| 320 | - //デフォルトのカーソルを使う | |
| 362 | + // デフォルトのカーソルを使う | |
| 321 | 363 | Result:=DRAGDROP_S_USEDEFAULTCURSORS; |
| 322 | 364 | end; |
| 323 | 365 | |
| 324 | - | |
| 325 | 366 | procedure TTextDeFindForm.PFileCopyClick(Sender:TObject); |
| 326 | 367 | begin |
| 327 | - files.cutcopy(false); | |
| 368 | + Files.cutcopy(false); | |
| 328 | 369 | end; |
| 329 | 370 | |
| 330 | 371 | procedure TTextDeFindForm.PFileCutClick(Sender:TObject); |
| 331 | 372 | begin |
| 332 | - files.cutcopy(true); | |
| 373 | + Files.cutcopy(true); | |
| 333 | 374 | end; |
| 334 | 375 | |
| 335 | - | |
| 336 | - | |
| 337 | -procedure TTextDeFindForm.FindUrlButtonClick(Sender: TObject); | |
| 376 | +procedure TTextDeFindForm.FindUrlButtonClick(Sender:TObject); | |
| 338 | 377 | var |
| 339 | 378 | s,ss:string; |
| 340 | - ls,le,i,count:integer; | |
| 341 | - function escape(url: String): String; | |
| 342 | - var | |
| 343 | - c,cc:Char; | |
| 344 | - begin | |
| 345 | - for c in ':/?#[]@!$&''()*+,;=' do begin | |
| 346 | - url:=url.Replace(c,format('%%%x',[(Ord(c))])); | |
| 347 | - end; | |
| 348 | - result:=url; | |
| 349 | - end; | |
| 379 | + ls,le,i,count:Integer; | |
| 350 | 380 | |
| 381 | + function option(Url:String):String; | |
| 382 | + var | |
| 383 | + C,cc:Char; | |
| 384 | + begin | |
| 385 | + | |
| 386 | + if OpURLComment.Checked then begin | |
| 387 | + if Url.IndexOf('//')>=0 then | |
| 388 | + Url:=Url.Substring(0,Url.IndexOf('//')); | |
| 389 | + end; | |
| 390 | + | |
| 391 | + if OpUrlSpace.Checked then begin | |
| 392 | + for C in OpURLSpaceEdit.Text do begin | |
| 393 | + Url:=Url.Replace(C,' '); | |
| 394 | + end; | |
| 395 | + end; | |
| 396 | + | |
| 397 | + if OpURLEscape.Checked then begin | |
| 398 | + for C in OpURLEscapeEdit.Text do begin | |
| 399 | + Url:=Url.Replace(C,format('%%%x',[(Ord(C))])); | |
| 400 | + end; | |
| 401 | + end; | |
| 402 | + | |
| 403 | + if OpURLZenkaku.Checked then begin | |
| 404 | + Url:=zenkaku(Url); | |
| 405 | + end; | |
| 406 | + if OptionUrlDQuote.Checked then begin | |
| 407 | + Url:='\"'+Url+'\"'; | |
| 408 | + end; | |
| 409 | + | |
| 410 | + Result:=Url; | |
| 411 | + end; | |
| 412 | + | |
| 351 | 413 | begin |
| 352 | 414 | urlrun:=not urlrun; |
| 353 | -// with GridFiles do begin | |
| 354 | -// for i:=selection.top to selection.Bottom do begin | |
| 355 | -// end; | |
| 415 | + // with GridFiles do begin | |
| 416 | + // for i:=selection.top to selection.Bottom do begin | |
| 417 | + // end; | |
| 356 | 418 | Screen.Cursor:=crHourGlass; |
| 357 | - ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart, 0); | |
| 358 | - le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*integer(Text.SelLength>0),0); | |
| 419 | + ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0); | |
| 420 | + le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*Integer(Text.SelLength>0),0); | |
| 359 | 421 | for i:=ls to le do begin |
| 360 | 422 | FindUrlButton.Caption:='中止'; |
| 361 | 423 | ss:=Text.lines[i]; |
| 362 | - if not urlrun then break; | |
| 424 | + if not urlrun then | |
| 425 | + break; | |
| 363 | 426 | Application.ProcessMessages; |
| 364 | - s:=Url.text; | |
| 365 | - if s='' then continue; | |
| 366 | - s:=s.Replace('%リスト名%',zenkaku(Name.text)); | |
| 367 | - s:=s.Replace('%検索文字%',zenkaku(ss)); | |
| 368 | - ShellExecute(Handle,'open',Pchar(s),'','',1); | |
| 427 | + s:=Url.Text; | |
| 428 | + if s='' then | |
| 429 | + continue; | |
| 430 | + s:=s.Replace('%リスト名%',option(Name.Text)); | |
| 431 | + s:=s.Replace('%検索文字%',option(ss)); | |
| 432 | + ShellExecute(Handle,'open',PChar(s),'','',1); | |
| 369 | 433 | sleep(3000); |
| 370 | 434 | end; |
| 371 | 435 | FindUrlButton.Caption:='URL検索'; |
| @@ -373,16 +437,16 @@ | ||
| 373 | 437 | Screen.Cursor:=crDefault; |
| 374 | 438 | end; |
| 375 | 439 | |
| 376 | -procedure TTextDeFindForm.PFileExecClick(Sender: TObject); | |
| 440 | +procedure TTextDeFindForm.PFileExecClick(Sender:TObject); | |
| 377 | 441 | begin |
| 378 | 442 | with GridFiles do |
| 379 | - ShellExecute(Handle,'open',Pchar(INCBS(cells[CPATH,row])+cells[CFILE,row]),'','',1); | |
| 443 | + ShellExecute(Handle,'open',PChar(INCBS(cells[CPATH,row])+cells[CFILE,row]),'','',1); | |
| 380 | 444 | end; |
| 381 | 445 | |
| 382 | -procedure TTextDeFindForm.PFileFolderClick(Sender: TObject); | |
| 446 | +procedure TTextDeFindForm.PFileFolderClick(Sender:TObject); | |
| 383 | 447 | begin |
| 384 | 448 | with GridFiles do |
| 385 | - ShellExecute(Handle,'open',Pchar(INCBS(cells[CPATH,row])),'','',1); | |
| 449 | + ShellExecute(Handle,'open',PChar(INCBS(cells[CPATH,row])),'','',1); | |
| 386 | 450 | |
| 387 | 451 | end; |
| 388 | 452 |
| @@ -390,12 +454,13 @@ | ||
| 390 | 454 | begin |
| 391 | 455 | OpenDialog.DefaultExt:='csv'; |
| 392 | 456 | OpenDialog.Filter:='csv|csv|*|*'; |
| 393 | - if OpenDialog.Execute then files.save(OpenDialog.FileName); | |
| 457 | + if OpenDialog.Execute then | |
| 458 | + Files.save(OpenDialog.FileName); | |
| 394 | 459 | end; |
| 395 | 460 | |
| 396 | 461 | procedure TTextDeFindForm.PFilePasteClick(Sender:TObject); |
| 397 | 462 | begin |
| 398 | - files.paste; | |
| 463 | + Files.paste; | |
| 399 | 464 | end; |
| 400 | 465 | |
| 401 | 466 | procedure TTextDeFindForm.PFileSaveAsClick(Sender:TObject); |
| @@ -402,7 +467,8 @@ | ||
| 402 | 467 | begin |
| 403 | 468 | SaveDialog.DefaultExt:='csv'; |
| 404 | 469 | SaveDialog.Filter:='csv|csv|*|*'; |
| 405 | - if SaveDialog.Execute then files.save(SaveDialog.FileName); | |
| 470 | + if SaveDialog.Execute then | |
| 471 | + Files.save(SaveDialog.FileName); | |
| 406 | 472 | end; |
| 407 | 473 | |
| 408 | 474 | procedure TTextDeFindForm.PTextCopyClick(Sender:TObject); |
| @@ -415,12 +481,12 @@ | ||
| 415 | 481 | Text.CutToClipboard; |
| 416 | 482 | end; |
| 417 | 483 | |
| 418 | -procedure TTextDeFindForm.PTextFindClick(Sender: TObject); | |
| 484 | +procedure TTextDeFindForm.PTextFindClick(Sender:TObject); | |
| 419 | 485 | begin |
| 420 | 486 | FindClick(Sender); |
| 421 | 487 | end; |
| 422 | 488 | |
| 423 | -procedure TTextDeFindForm.PTextFindUrlClick(Sender: TObject); | |
| 489 | +procedure TTextDeFindForm.PTextFindUrlClick(Sender:TObject); | |
| 424 | 490 | begin |
| 425 | 491 | FindUrlButtonClick(Sender); |
| 426 | 492 | end; |
| @@ -429,7 +495,8 @@ | ||
| 429 | 495 | begin |
| 430 | 496 | OpenDialog.DefaultExt:='txt'; |
| 431 | 497 | OpenDialog.Filter:='txt|txt|*|*'; |
| 432 | - if OpenDialog.Execute then Text.lines.LoadFromFile(OpenDialog.FileName); | |
| 498 | + if OpenDialog.Execute then | |
| 499 | + Text.lines.LoadFromFile(OpenDialog.FileName); | |
| 433 | 500 | end; |
| 434 | 501 | |
| 435 | 502 | procedure TTextDeFindForm.PTextPasteClick(Sender:TObject); |
| @@ -441,176 +508,169 @@ | ||
| 441 | 508 | begin |
| 442 | 509 | SaveDialog.DefaultExt:='txt'; |
| 443 | 510 | SaveDialog.Filter:='txt|txt|*|*'; |
| 444 | - if SaveDialog.Execute then Text.lines.SaveToFile(SaveDialog.FileName); | |
| 511 | + if SaveDialog.Execute then | |
| 512 | + Text.lines.SaveToFile(SaveDialog.FileName); | |
| 445 | 513 | |
| 446 | 514 | end; |
| 447 | 515 | |
| 448 | - | |
| 449 | - | |
| 450 | - | |
| 451 | 516 | function gridInRect(X,Y:Integer;const r:TGridRect):boolean; |
| 452 | 517 | begin |
| 453 | 518 | Result:=true; |
| 454 | - if ((X<r.left)or(X>r.right)or(Y<r.top)or(Y>r.Bottom)) then Result:=false; | |
| 519 | + if ((X<r.left)or(X>r.right)or(Y<r.top)or(Y>r.Bottom)) then | |
| 520 | + Result:=false; | |
| 455 | 521 | end; |
| 456 | 522 | |
| 457 | -procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton; | |
| 458 | - Shift:TShiftState;X,Y:Integer); | |
| 523 | +procedure TTextDeFindForm.GridFilesMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer); | |
| 459 | 524 | var |
| 460 | 525 | ACol,ARow:Longint; |
| 461 | 526 | |
| 462 | 527 | begin |
| 463 | 528 | Files.MouseToCell(X,Y,ACol,ARow); |
| 464 | - if gridInRect(ACol,ARow,Files.selection) then exit; | |
| 529 | + if gridInRect(ACol,ARow,Files.selection) then | |
| 530 | + exit; | |
| 465 | 531 | Files.MouseToCell(X,Y,ACol,ARow); |
| 466 | 532 | |
| 467 | 533 | end; |
| 468 | 534 | |
| 469 | - | |
| 470 | -procedure TTextDeFindForm.GridFilesSetEditText(Sender: TObject; ACol, | |
| 471 | - ARow: Integer; const Value: string); | |
| 535 | +procedure TTextDeFindForm.GridFilesSetEditText(Sender:TObject;ACol,ARow:Integer;const Value:string); | |
| 472 | 536 | begin |
| 473 | -// ShowMessage(Value); | |
| 474 | -// GridFiles.Options:=GridFiles.Options-[goEditing]+[goRangeSelect]; | |
| 537 | + // ShowMessage(Value); | |
| 538 | + // GridFiles.Options:=GridFiles.Options-[goEditing]+[goRangeSelect]; | |
| 475 | 539 | |
| 476 | 540 | end; |
| 477 | 541 | |
| 478 | -procedure TTextDeFindForm.TextMouseUp(Sender: TObject; Button: TMouseButton; | |
| 479 | - Shift: TShiftState; X, Y: Integer); | |
| 480 | -var l:integer; | |
| 542 | +procedure TTextDeFindForm.TextMouseUp(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer); | |
| 543 | +var | |
| 544 | + l:Integer; | |
| 481 | 545 | begin |
| 482 | 546 | if Text.SelLength=0 then begin |
| 483 | - l:=Text.Perform(EM_LINEFROMCHAR, System.NativeUInt(-1), 0); | |
| 547 | + l:=Text.Perform(EM_LINEFROMCHAR,System.NativeUInt(-1),0); | |
| 484 | 548 | Text.SelStart:=Text.Perform(EM_LINEINDEX,System.NativeUInt(l),0); |
| 485 | 549 | Text.SelLength:=Text.Perform(EM_LINEINDEX,System.NativeUInt(l+1),0)-Text.SelStart; |
| 486 | 550 | end; |
| 487 | 551 | end; |
| 488 | 552 | |
| 489 | -procedure TTextDeFindForm.TreeClick(Sender: TObject); | |
| 490 | -var N:TTreeNode; | |
| 491 | -ppname:string; | |
| 492 | -i:integer; | |
| 553 | +procedure TTextDeFindForm.TreeClick(Sender:TObject); | |
| 554 | +var | |
| 555 | + N:TTreeNode; | |
| 556 | + ppname:string; | |
| 557 | + i:Integer; | |
| 493 | 558 | |
| 494 | - | |
| 495 | 559 | begin |
| 496 | 560 | |
| 497 | 561 | ppname:=Name.Text; |
| 498 | 562 | |
| 499 | 563 | |
| 500 | -// for i:=Name.Items.Count-1 downto 1 do | |
| 501 | -// Name.Items.Delete(i); | |
| 564 | + // for i:=Name.Items.Count-1 downto 1 do | |
| 565 | + // Name.Items.Delete(i); | |
| 502 | 566 | |
| 503 | - Tmp.Clear; | |
| 567 | + TMP.clear; | |
| 504 | 568 | N:=Tree.Items.GetFirstNode; |
| 505 | 569 | while N<>nil do begin |
| 506 | - Tmp.Items.add(N.Text); | |
| 570 | + TMP.Items.add(N.Text); | |
| 507 | 571 | N:=N.getNextSibling; |
| 508 | 572 | end; |
| 509 | 573 | Name.Enabled:=false; |
| 510 | - Name.Items.Text:=Tmp.Items.text; | |
| 511 | -// Name.ItemIndex:=-1; | |
| 512 | -// Name.Text:=ppname; | |
| 574 | + Name.Items.Text:=TMP.Items.Text; | |
| 575 | + // Name.ItemIndex:=-1; | |
| 576 | + // Name.Text:=ppname; | |
| 513 | 577 | Name.ItemIndex:=Name.Items.IndexOf(ppname); |
| 514 | -// Application.ProcessMessages; | |
| 578 | + // Application.ProcessMessages; | |
| 515 | 579 | Name.Enabled:=true; |
| 516 | 580 | end; |
| 517 | 581 | |
| 518 | - | |
| 519 | -function inputtextbox(P:TForm;C:TWinControl;text:string):string; | |
| 582 | +function inputtextbox(P:TForm;C:TWinControl;Text:string):string; | |
| 520 | 583 | var |
| 521 | - F:Tform; | |
| 522 | - M:TMemo; | |
| 523 | - R:TRect; | |
| 584 | + f:TForm; | |
| 585 | + M:TMemo; | |
| 586 | + r:TRect; | |
| 524 | 587 | begin |
| 525 | - F:=TForm.Create(P); | |
| 526 | - M:=TMemo.Create(F); | |
| 588 | + f:=TForm.Create(P); | |
| 589 | + M:=TMemo.Create(f); | |
| 527 | 590 | try |
| 528 | - F.Font:=P.Font; | |
| 529 | -// F.BorderStyle:=bsSingle; | |
| 530 | - R:=P.BoundsRect; | |
| 531 | - R.Top:=C.ClientToScreen(C.BoundsRect.BottomRight).Y; | |
| 532 | - R.Height:=200; | |
| 533 | -// R.Inflate(0,0,0,100); | |
| 534 | - F.BoundsRect:=R; | |
| 535 | - M.Parent:=F; | |
| 591 | + f.Font:=P.Font; | |
| 592 | + // F.BorderStyle:=bsSingle; | |
| 593 | + r:=P.BoundsRect; | |
| 594 | + r.top:=C.ClientToScreen(C.BoundsRect.BottomRight).Y; | |
| 595 | + r.Height:=200; | |
| 596 | + // R.Inflate(0,0,0,100); | |
| 597 | + f.BoundsRect:=r; | |
| 598 | + M.Parent:=f; | |
| 536 | 599 | M.Align:=alClient; |
| 537 | - M.Text:=text; | |
| 538 | - F.Position:=poDesigned; | |
| 539 | - F.ShowModal; | |
| 540 | - result:=M.text; | |
| 600 | + M.Text:=Text; | |
| 601 | + f.Position:=poDesigned; | |
| 602 | + f.ShowModal; | |
| 603 | + Result:=M.Text; | |
| 541 | 604 | finally |
| 542 | - F.Free; | |
| 605 | + f.Free; | |
| 543 | 606 | end; |
| 544 | 607 | end; |
| 545 | 608 | |
| 546 | - | |
| 547 | -procedure TTextDeFindForm.PathEditButtonClick(Sender: TObject); | |
| 609 | +procedure TTextDeFindForm.PathEditButtonClick(Sender:TObject); | |
| 548 | 610 | begin |
| 549 | 611 | Path.Items.Text:=inputtextbox(self,Path,Path.Items.Text); |
| 550 | 612 | end; |
| 551 | 613 | |
| 552 | - | |
| 553 | -procedure TTextDeFindForm.PathSelButtonClick(Sender: TObject); | |
| 614 | +procedure TTextDeFindForm.PathSelButtonClick(Sender:TObject); | |
| 554 | 615 | var |
| 555 | - SelectFolder : String; | |
| 616 | + SelectFolder:String; | |
| 556 | 617 | begin |
| 557 | - SelectFolder := Path.text; | |
| 558 | - if SelectDirectory(Path.text,'',SelectFolder,[sdNewUI, sdNewFolder, sdShowEdit],Self) then begin | |
| 559 | - Path.text:=SelectFolder; | |
| 560 | - end; | |
| 618 | + SelectFolder:=Path.Text; | |
| 619 | + if SelectDirectory(Path.Text,'',SelectFolder,[sdNewUI,sdNewFolder,sdShowEdit],self) then begin | |
| 620 | + Path.Text:=SelectFolder; | |
| 621 | + end; | |
| 561 | 622 | end; |
| 562 | 623 | |
| 563 | -procedure TTextDeFindForm.UrlEditButtonClick(Sender: TObject); | |
| 624 | +procedure TTextDeFindForm.UrlEditButtonClick(Sender:TObject); | |
| 564 | 625 | begin |
| 565 | 626 | Url.Items.Text:=inputtextbox(self,Url,Url.Items.Text); |
| 566 | 627 | end; |
| 567 | 628 | |
| 568 | -procedure TTextDeFindForm.Button1Click(Sender: TObject); | |
| 629 | +procedure TTextDeFindForm.Button1Click(Sender:TObject); | |
| 569 | 630 | begin |
| 570 | 631 | TreeClick(Sender); |
| 571 | 632 | end; |
| 572 | 633 | |
| 634 | +procedure TTextDeFindForm.NameChange(Sender:TObject); | |
| 635 | +var | |
| 636 | + N,NN:TTreeNode; | |
| 637 | + s:string; | |
| 638 | + function childtext(N:TTreeNode):string; | |
| 639 | + begin | |
| 640 | + N:=N.getFirstChild; | |
| 641 | + while N<>nil do begin | |
| 642 | + Text.lines.add(N.Text); | |
| 643 | + N:=N.getNextSibling; | |
| 644 | + end; | |
| 573 | 645 | |
| 574 | -procedure TTextDeFindForm.NameChange(Sender: TObject); | |
| 575 | -var N,NN:TTreeNode; | |
| 576 | -s:string; | |
| 577 | - function childtext(N:TTreeNode):string; | |
| 578 | - begin | |
| 579 | - N:=N.getFirstChild; | |
| 580 | - while N<>nil do begin | |
| 581 | - Text.Lines.add(N.Text); | |
| 582 | - N:=N.getNextSibling; | |
| 583 | 646 | end; |
| 584 | 647 | |
| 585 | - end; | |
| 586 | - | |
| 587 | - | |
| 588 | 648 | begin |
| 589 | 649 | if Trim(pname)<>'' then begin |
| 590 | 650 | N:=Tree.Items.GetFirstNode; |
| 591 | 651 | NN:=nil; |
| 592 | 652 | while N<>nil do begin |
| 593 | - if N.text=pname then begin | |
| 653 | + if N.Text=pname then begin | |
| 594 | 654 | NN:=N; |
| 595 | 655 | break; |
| 596 | 656 | end; |
| 597 | 657 | N:=N.getNextSibling; |
| 598 | 658 | end; |
| 599 | - if Trim(Text.lines.Text)='' then begin //空ならリストから消す | |
| 659 | + if Trim(Text.lines.Text)='' then begin // 空ならリストから消す | |
| 600 | 660 | if NN<>nil then begin |
| 601 | 661 | NN.Delete; |
| 602 | 662 | TreeClick(Sender); |
| 603 | 663 | end; |
| 604 | 664 | |
| 605 | - end else begin //空以外ならリストへ | |
| 665 | + end | |
| 666 | + else begin // 空以外ならリストへ | |
| 606 | 667 | if NN=nil then begin |
| 607 | - NN:=Tree.Items.Add(nil,pname); | |
| 668 | + NN:=Tree.Items.add(nil,pname); | |
| 608 | 669 | TreeClick(Sender); |
| 609 | 670 | end; |
| 610 | 671 | |
| 611 | - NN.DeleteChildren; | |
| 612 | - for s in Text.lines do | |
| 613 | - Tree.Items.AddChild(NN,Trim(s)); | |
| 672 | + NN.DeleteChildren; | |
| 673 | + for s in Text.lines do Tree.Items.AddChild(NN,Trim(s)); | |
| 614 | 674 | |
| 615 | 675 | Inifile.writegrid('grid\'+pname,TGrid(GridFiles)); |
| 616 | 676 | end; |
| @@ -620,9 +680,9 @@ | ||
| 620 | 680 | Text.Text:=''; |
| 621 | 681 | N:=Tree.Items.GetFirstNode; |
| 622 | 682 | while N<>nil do begin |
| 623 | - if N.text=Name.text then begin | |
| 683 | + if N.Text=Name.Text then begin | |
| 624 | 684 | childtext(N); |
| 625 | - Inifile.readgrid('grid\'+Name.text,TGrid(GridFiles)); | |
| 685 | + Inifile.readgrid('grid\'+Name.Text,TGrid(GridFiles)); | |
| 626 | 686 | end; |
| 627 | 687 | N:=N.getNextSibling; |
| 628 | 688 | end; |
| @@ -631,33 +691,37 @@ | ||
| 631 | 691 | |
| 632 | 692 | |
| 633 | 693 | |
| 634 | -// if Trim(Text.lines.Text)<>'' then begin | |
| 635 | -// Ini.EraseSection(Name.Text); | |
| 636 | -// | |
| 637 | -// Tmp.Items.LoadFromFile(Ini.FileName); | |
| 638 | -// Tmp.Items.Add('['+Name.Text+']'); | |
| 639 | -// Tmp.Items.AddStrings(Text.Lines); | |
| 640 | -// Tmp.Items.SaveToFile(Ini.FileName); | |
| 641 | -// | |
| 642 | -// end; | |
| 643 | -// Ini.ReadSection(Name.Text,Tmp.Items); | |
| 644 | -// Text.lines.Text:=Tmp.Items.Text; | |
| 645 | -// Text.lines.Text:= | |
| 646 | -// Ini.ReadSectionValues(Name.Text,Text.lines); | |
| 694 | + // if Trim(Text.lines.Text)<>'' then begin | |
| 695 | + // Ini.EraseSection(Name.Text); | |
| 696 | + // | |
| 697 | + // Tmp.Items.LoadFromFile(Ini.FileName); | |
| 698 | + // Tmp.Items.Add('['+Name.Text+']'); | |
| 699 | + // Tmp.Items.AddStrings(Text.Lines); | |
| 700 | + // Tmp.Items.SaveToFile(Ini.FileName); | |
| 701 | + // | |
| 702 | + // end; | |
| 703 | + // Ini.ReadSection(Name.Text,Tmp.Items); | |
| 704 | + // Text.lines.Text:=Tmp.Items.Text; | |
| 705 | + // Text.lines.Text:= | |
| 706 | + // Ini.ReadSectionValues(Name.Text,Text.lines); | |
| 647 | 707 | |
| 648 | 708 | pname:=Name.Text; |
| 649 | 709 | end; |
| 650 | 710 | |
| 711 | +procedure TTextDeFindForm.OpURLButtonClick(Sender:TObject); | |
| 712 | +begin | |
| 713 | + OpURLPanel.Visible:=not OpURLPanel.Visible; | |
| 714 | +end; | |
| 651 | 715 | |
| 652 | 716 | procedure TTextDeFindForm.FindClick(Sender:TObject); |
| 653 | 717 | var |
| 654 | - op :TSearchOption; | |
| 655 | - SA :TStringDynArray; | |
| 656 | - s,ss :string; | |
| 718 | + op:TSearchOption; | |
| 719 | + sa:TStringDynArray; | |
| 720 | + s,ss:string; | |
| 657 | 721 | snm,nm:string; |
| 658 | - sub :boolean; | |
| 659 | - hit :boolean; | |
| 660 | - ls,le,i,j,count:integer; | |
| 722 | + sub:boolean; | |
| 723 | + hit:boolean; | |
| 724 | + ls,le,i,j,count:Integer; | |
| 661 | 725 | pathtext:string; |
| 662 | 726 | |
| 663 | 727 | function findr(s:string):string; |
| @@ -664,34 +728,32 @@ | ||
| 664 | 728 | begin |
| 665 | 729 | s:=s.ToUpper; |
| 666 | 730 | s:=zenkaku(s); |
| 667 | -// s:=s.Replace(' ',''); | |
| 668 | -// s:=s.Replace('・',''); | |
| 669 | - result:=s; | |
| 731 | + // s:=s.Replace(' ',''); | |
| 732 | + // s:=s.Replace('・',''); | |
| 733 | + Result:=s; | |
| 670 | 734 | end; |
| 671 | 735 | |
| 672 | 736 | function procfind(ssss:string):string; |
| 673 | - var s,ss,sss:string; | |
| 674 | - i,j,si:integer; | |
| 737 | + var | |
| 738 | + s,ss,sss:string; | |
| 739 | + i,j,si:Integer; | |
| 675 | 740 | begin |
| 676 | 741 | sss:=findr(ssss); |
| 677 | 742 | si:=pos(' ',sss); |
| 678 | - if si=0 then | |
| 679 | - si:=pos('・',sss); | |
| 680 | - if si=0 then | |
| 681 | - si:=4; | |
| 743 | + if si=0 then si:=pos('・',sss); | |
| 744 | + if si=0 then si:=4; | |
| 682 | 745 | si:=si-1; |
| 683 | 746 | |
| 747 | + for j:=Length(sss) downto si do begin | |
| 684 | 748 | |
| 685 | - for j:=length(sss) downto si do begin | |
| 686 | - | |
| 687 | 749 | ss:=sss.Substring(0,j); |
| 688 | - for s in SA do begin | |
| 750 | + for s in sa do begin | |
| 689 | 751 | nm:=Trim((ss)); |
| 690 | - if nm='' then continue; | |
| 752 | + if nm='' then | |
| 753 | + continue; | |
| 691 | 754 | |
| 692 | - if Pos('*',nm)=0 then | |
| 693 | - if Pos('?',nm)=0 then | |
| 694 | - nm:='*'+nm+'*'; | |
| 755 | + if pos('*',nm)=0 then | |
| 756 | + if pos('?',nm)=0 then nm:='*'+nm+'*'; | |
| 695 | 757 | snm:=findr(ExtractFileName(s)); |
| 696 | 758 | if MatchesMask(snm,nm) then begin |
| 697 | 759 | Files.RowCount:=Files.RowCount+1; |
| @@ -701,41 +763,42 @@ | ||
| 701 | 763 | hit:=true; |
| 702 | 764 | end; |
| 703 | 765 | end; |
| 704 | - if hit then break; | |
| 766 | + if hit then | |
| 767 | + break; | |
| 705 | 768 | end; |
| 706 | 769 | end; |
| 707 | 770 | |
| 708 | - | |
| 709 | 771 | begin |
| 710 | 772 | try |
| 711 | 773 | Screen.Cursor:=crHourGlass; |
| 712 | 774 | Application.ProcessMessages; |
| 713 | 775 | |
| 714 | - ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart, 0); | |
| 776 | + ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0); | |
| 715 | 777 | pathtext:=Path.Text; |
| 716 | - pathtext:=pathtext.Replace('%リスト名%',Name.text); | |
| 778 | + pathtext:=pathtext.Replace('%リスト名%',Name.Text); | |
| 717 | 779 | pathtext:=pathtext.Replace('%検索文字%',Text.lines[ls]); |
| 718 | - pathtext:=incbs(pathtext); | |
| 719 | -// snm:=ExtractFileName(Path.Text); | |
| 720 | -// if snm='' then | |
| 780 | + pathtext:=INCBS(pathtext); | |
| 781 | + // snm:=ExtractFileName(Path.Text); | |
| 782 | + // if snm='' then | |
| 721 | 783 | snm:='*'; |
| 722 | 784 | |
| 723 | - // if sub then | |
| 785 | + // if sub then | |
| 724 | 786 | op:=TSearchOption.soAllDirectories; |
| 725 | - // else | |
| 726 | - // op := TSearchOption.soTopDirectoryOnly; | |
| 727 | - SA:=TDirectory.GetFiles(PathText,snm,op); | |
| 787 | + // else | |
| 788 | + // op := TSearchOption.soTopDirectoryOnly; | |
| 789 | + sa:=TDirectory.GetFiles(pathtext,snm,op); | |
| 728 | 790 | Files.RowCount:=1; |
| 729 | 791 | Files.ColCount:=4; |
| 730 | 792 | Files.Rows[0].setstrings(['','検索文字','ファイル','パス']); |
| 731 | 793 | |
| 732 | - if sender=Find then begin | |
| 794 | + if Sender=Find then begin | |
| 733 | 795 | ls:=0; |
| 734 | - le:=Text.Lines.Count-1; | |
| 796 | + le:=Text.lines.count-1; | |
| 735 | 797 | |
| 736 | - end else begin | |
| 737 | - ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart, 0); | |
| 738 | - le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*integer(Text.SelLength>0),0); | |
| 798 | + end | |
| 799 | + else begin | |
| 800 | + ls:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart,0); | |
| 801 | + le:=Text.Perform(EM_LINEFROMCHAR,Text.SelStart+Text.SelLength-1*Integer(Text.SelLength>0),0); | |
| 739 | 802 | end; |
| 740 | 803 | for i:=ls to le do begin |
| 741 | 804 | ss:=Text.lines[i]; |
| @@ -752,39 +815,43 @@ | ||
| 752 | 815 | Files.ColExpand(10); |
| 753 | 816 | Files.FixedRows:=1; |
| 754 | 817 | |
| 755 | - finally Screen.Cursor:=crDefault; | |
| 818 | + finally | |
| 819 | + Screen.Cursor:=crDefault; | |
| 756 | 820 | end; |
| 757 | 821 | end; |
| 758 | 822 | |
| 759 | - | |
| 760 | - | |
| 761 | 823 | function TTextDeFindForm.GetFilePathDataObject(G:TStringGrid):IDataObject; |
| 762 | 824 | var |
| 763 | 825 | ISFD,ISF:IShellFolder; |
| 764 | - PItems :packed array of PItemIDList; | |
| 765 | - PItem :PItemIDList; | |
| 766 | - pchEaten,dwAttributes :Cardinal; | |
| 767 | - fn,fnpath :Widestring; | |
| 768 | - i,count :Integer; | |
| 826 | + PItems:packed array of PItemIDList; | |
| 827 | + PItem:PItemIDList; | |
| 828 | + pchEaten,dwAttributes:Cardinal; | |
| 829 | + fn,fnpath:Widestring; | |
| 830 | + i,count:Integer; | |
| 769 | 831 | begin |
| 770 | 832 | Result:=nil; |
| 771 | 833 | count:=0; |
| 772 | 834 | |
| 773 | 835 | SHGetDesktopFolder(ISFD); |
| 774 | - if Failed(ISFD.ParseDisplayName(0,nil,PWideChar(Path.text),pchEaten,PItem,dwAttributes)) then exit; | |
| 775 | - if Failed(ISFD.BindToObject(PItem,nil,IID_IShellFolder,ISF)) then exit; | |
| 836 | + if Failed(ISFD.ParseDisplayName(0,nil,PWideChar(Path.Text),pchEaten,PItem,dwAttributes)) then | |
| 837 | + exit; | |
| 838 | + if Failed(ISFD.BindToObject(PItem,nil,IID_IShellFolder,ISF)) then | |
| 839 | + exit; | |
| 776 | 840 | |
| 777 | 841 | for i:=G.selection.top to G.selection.Bottom do begin |
| 778 | 842 | fn:=INCBS(G.cells[CPATH,i])+G.cells[CFILE,i]; |
| 779 | 843 | |
| 780 | - if not FileExists(fn) then continue; | |
| 844 | + if not FileExists(fn) then | |
| 845 | + continue; | |
| 781 | 846 | inc(count); |
| 782 | 847 | SetLength(PItems,count); |
| 783 | - fnpath:=ExtractRelativePath(INCBS(Path.text),fn); | |
| 848 | + fnpath:=ExtractRelativePath(INCBS(Path.Text),fn); | |
| 784 | 849 | |
| 785 | - if Failed(ISF.ParseDisplayName(0,nil,PWideChar(fnpath),pchEaten,PItems[count-1],dwAttributes)) then exit; | |
| 850 | + if Failed(ISF.ParseDisplayName(0,nil,PWideChar(fnpath),pchEaten,PItems[count-1],dwAttributes)) then | |
| 851 | + exit; | |
| 786 | 852 | end; |
| 787 | - if count<1 then exit; | |
| 853 | + if count<1 then | |
| 854 | + exit; | |
| 788 | 855 | |
| 789 | 856 | ISF.GetUIObjectOf(0,count,PItems[0],IDataObject,nil,Pointer(Result)); |
| 790 | 857 | end; |
| @@ -791,12 +858,8 @@ | ||
| 791 | 858 | |
| 792 | 859 | |
| 793 | 860 | |
| 794 | -//-------------------------------------------------------------------------------- | |
| 861 | +// -------------------------------------------------------------------------------- | |
| 795 | 862 | |
| 796 | - | |
| 797 | - | |
| 798 | - | |
| 799 | - | |
| 800 | 863 | procedure TGrid.copy(G:TGrid); |
| 801 | 864 | var |
| 802 | 865 | r:TGridRect; |
| @@ -805,7 +868,8 @@ | ||
| 805 | 868 | RowCount:=G.RowCount; |
| 806 | 869 | r:=G.selection; |
| 807 | 870 | G.selection:=TGridRect(rect(1,1,G.ColCount-1,G.RowCount-1)); |
| 808 | - G.selrowdo(procedure(X,Y:Integer) | |
| 871 | + G.selrowdo( | |
| 872 | + procedure(X,Y:Integer) | |
| 809 | 873 | begin |
| 810 | 874 | Rows[Y]:=G.Rows[Y]; |
| 811 | 875 | end); |
| @@ -818,12 +882,12 @@ | ||
| 818 | 882 | MS:TMemoryStream; |
| 819 | 883 | begin |
| 820 | 884 | Create(Origin.Owner); |
| 821 | - Self.Parent:=Origin.Parent; | |
| 822 | - Self.Options:=Origin.Options; | |
| 823 | - Self.OnSetEditText:=Origin.OnSetEditText; | |
| 824 | - Self.OnMouseDown:=Origin.OnMouseDown; | |
| 825 | - Self.OnMouseMove:=Origin.OnMouseMove; | |
| 826 | - buf:=TGrid.Create(Self); | |
| 885 | + self.Parent:=Origin.Parent; | |
| 886 | + self.Options:=Origin.Options; | |
| 887 | + self.OnSetEditText:=Origin.OnSetEditText; | |
| 888 | + self.OnMouseDown:=Origin.OnMouseDown; | |
| 889 | + self.OnMouseMove:=Origin.OnMouseMove; | |
| 890 | + buf:=TGrid.Create(self); | |
| 827 | 891 | |
| 828 | 892 | MS:=TMemoryStream.Create; |
| 829 | 893 | try |
| @@ -830,54 +894,61 @@ | ||
| 830 | 894 | MS.WriteComponent(Origin); |
| 831 | 895 | Origin.Free; |
| 832 | 896 | MS.Position:=0; |
| 833 | - MS.ReadComponent(Self); | |
| 834 | - finally MS.Free; | |
| 897 | + MS.ReadComponent(self); | |
| 898 | + finally | |
| 899 | + MS.Free; | |
| 835 | 900 | end; |
| 836 | 901 | end; |
| 837 | 902 | |
| 838 | 903 | procedure TGrid.WMChar(var Msg:TWMChar); |
| 839 | 904 | begin |
| 840 | - // if (EnableEdit) and (AnsiChar(Msg.CharCode) in [^H, #32..#255]) then begin | |
| 905 | + // if (EnableEdit) and (AnsiChar(Msg.CharCode) in [^H, #32..#255]) then begin | |
| 841 | 906 | if ((CharInSet(Char(Msg.CharCode),[^H])or(Char(Msg.CharCode)>=#32))) then begin |
| 842 | 907 | Options:=Options+[goEditing]; |
| 843 | 908 | EditorMode:=true; |
| 844 | 909 | |
| 845 | - // ShowObject(Word(Msg.CharCode)); | |
| 846 | - // if Edit.Visible then | |
| 847 | - // PostMessage(Edit.Handle, WM_CHAR, Word(Msg.CharCode), 0); | |
| 848 | - // if Combo.Visible then | |
| 849 | - // PostMessage(Combo.Handle, WM_CHAR, Word(Msg.CharCode), 0); | |
| 910 | + // ShowObject(Word(Msg.CharCode)); | |
| 911 | + // if Edit.Visible then | |
| 912 | + // PostMessage(Edit.Handle, WM_CHAR, Word(Msg.CharCode), 0); | |
| 913 | + // if Combo.Visible then | |
| 914 | + // PostMessage(Combo.Handle, WM_CHAR, Word(Msg.CharCode), 0); | |
| 850 | 915 | |
| 851 | 916 | end |
| 852 | - else inherited; | |
| 917 | + else | |
| 918 | + inherited; | |
| 853 | 919 | end; |
| 854 | 920 | |
| 855 | 921 | procedure TGrid.cutcopy(modecut:boolean); |
| 856 | 922 | var |
| 857 | - i,j :Integer; | |
| 923 | + i,j:Integer; | |
| 858 | 924 | xs,ys,xw,yw:Integer; |
| 859 | - Txt :TStringList; | |
| 860 | - s,ss :String; | |
| 861 | - r :TGridRect; | |
| 925 | + Txt:TStringList; | |
| 926 | + s,ss:String; | |
| 927 | + r:TGridRect; | |
| 862 | 928 | |
| 863 | 929 | function d_dquotedstr(const s,d:string):string; |
| 864 | 930 | var |
| 865 | - c:Char; | |
| 931 | + C:Char; | |
| 866 | 932 | b:boolean; |
| 867 | 933 | begin |
| 868 | 934 | Result:=s; |
| 869 | 935 | b:=false; |
| 870 | - if d='' then b:=true; | |
| 871 | - for c in s do | |
| 872 | - if Pos(c,d)>0 then b:=true; | |
| 936 | + if d='' then | |
| 937 | + b:=true; | |
| 938 | + for C in s do | |
| 939 | + if pos(C,d)>0 then | |
| 940 | + b:=true; | |
| 873 | 941 | |
| 874 | - if not b then exit; | |
| 942 | + if not b then | |
| 943 | + exit; | |
| 875 | 944 | Result:='"'+s+'"'; |
| 876 | 945 | end; |
| 877 | 946 | |
| 878 | 947 | begin |
| 879 | - if not Focused then exit; | |
| 880 | - if modecut then buf.copy(Self); | |
| 948 | + if not Focused then | |
| 949 | + exit; | |
| 950 | + if modecut then | |
| 951 | + buf.copy(self); | |
| 881 | 952 | |
| 882 | 953 | ys:=selection.top; |
| 883 | 954 | xs:=selection.left; |
| @@ -888,12 +959,15 @@ | ||
| 888 | 959 | for i:=0 to yw do begin |
| 889 | 960 | s:=''; |
| 890 | 961 | for j:=0 to xw do begin |
| 891 | - if j>0 then s:=s+#9; | |
| 892 | - ss:=StringReplace(cells[xs+j,ys+i],#9,'',[rfReplaceAll]);//タブは削除 | |
| 893 | - //if Pos(ss,CRLF)>0 then | |
| 962 | + if j>0 then | |
| 963 | + s:=s+#9; | |
| 964 | + ss:=StringReplace(cells[xs+j,ys+i],#9,'',[rfReplaceAll]); | |
| 965 | + // タブは削除 | |
| 966 | + // if Pos(ss,CRLF)>0 then | |
| 894 | 967 | ss:=d_dquotedstr(ss,CRLF); |
| 895 | 968 | s:=s+ss; |
| 896 | - if modecut then cells[xs+j,ys+i]:=''; | |
| 969 | + if modecut then | |
| 970 | + cells[xs+j,ys+i]:=''; | |
| 897 | 971 | end; |
| 898 | 972 | Txt.add(s); |
| 899 | 973 | end; |
| @@ -905,20 +979,22 @@ | ||
| 905 | 979 | |
| 906 | 980 | function TGrid.paste:TGridRect; |
| 907 | 981 | var |
| 908 | - i,j,si,colcnt :Integer; | |
| 909 | - s :String; | |
| 910 | - Txt :TStringList; | |
| 911 | - ltxt :string; | |
| 982 | + i,j,si,colcnt:Integer; | |
| 983 | + s:String; | |
| 984 | + Txt:TStringList; | |
| 985 | + ltxt:string; | |
| 912 | 986 | xs,ys,xw,yw,cnt:Integer; |
| 913 | - cols :TStringDynArray; | |
| 987 | + cols:TStringDynArray; | |
| 914 | 988 | |
| 915 | 989 | begin |
| 916 | - if not Focused then exit; | |
| 917 | - buf.copy(Self); | |
| 990 | + if not Focused then | |
| 991 | + exit; | |
| 992 | + buf.copy(self); | |
| 918 | 993 | |
| 919 | 994 | Txt:=TStringList.Create; |
| 920 | 995 | s:=StringReplace(Clipboard.AsText,CRLF,CR,[rfReplaceAll]); |
| 921 | - for ltxt in SplitString(s,CR) do Txt.add(ltxt); | |
| 996 | + for ltxt in SplitString(s,CR) do | |
| 997 | + Txt.add(ltxt); | |
| 922 | 998 | |
| 923 | 999 | ys:=selection.top; |
| 924 | 1000 | xs:=selection.left; |
| @@ -927,7 +1003,8 @@ | ||
| 927 | 1003 | for i:=0 to yw do begin |
| 928 | 1004 | s:=Txt[i]; |
| 929 | 1005 | colcnt:=SplitString(s,#9).count; |
| 930 | - if xw<colcnt then xw:=colcnt; | |
| 1006 | + if xw<colcnt then | |
| 1007 | + xw:=colcnt; | |
| 931 | 1008 | end; |
| 932 | 1009 | dec(xw); |
| 933 | 1010 |
| @@ -946,7 +1023,7 @@ | ||
| 946 | 1023 | procedure TGrid.savebuf; |
| 947 | 1024 | begin |
| 948 | 1025 | saverect:=selection; |
| 949 | - buf.copy(Self); | |
| 1026 | + buf.copy(self); | |
| 950 | 1027 | end; |
| 951 | 1028 | |
| 952 | 1029 | function TGrid.save(fn:string):boolean; |
| @@ -954,14 +1031,14 @@ | ||
| 954 | 1031 | i:Integer; |
| 955 | 1032 | begin |
| 956 | 1033 | try |
| 957 | - SL.clear; | |
| 1034 | + sl.clear; | |
| 958 | 1035 | for i:=0 to RowCount-1 do begin |
| 959 | 1036 | Rows[i].StrictDelimiter:=true; |
| 960 | 1037 | Rows[i].Delimiter:=','; |
| 961 | 1038 | Rows[i].QuoteChar:='"'; |
| 962 | - SL.add(Rows[i].DelimitedText); | |
| 1039 | + sl.add(Rows[i].DelimitedText); | |
| 963 | 1040 | end; |
| 964 | - SL.save(fn); | |
| 1041 | + sl.save(fn); | |
| 965 | 1042 | except |
| 966 | 1043 | |
| 967 | 1044 | end; |
| @@ -969,13 +1046,15 @@ | ||
| 969 | 1046 | |
| 970 | 1047 | procedure TGrid.setfixed; |
| 971 | 1048 | begin |
| 972 | - if colcount>1 then FixedCols:=1; | |
| 973 | - if rowcount>1 then FixedRows:=1; | |
| 1049 | + if ColCount>1 then | |
| 1050 | + FixedCols:=1; | |
| 1051 | + if RowCount>1 then | |
| 1052 | + FixedRows:=1; | |
| 974 | 1053 | end; |
| 975 | 1054 | |
| 976 | 1055 | function TGrid.load(fn:string):boolean; |
| 977 | 1056 | var |
| 978 | - i :Integer; | |
| 1057 | + i:Integer; | |
| 979 | 1058 | TMP:TStringList; |
| 980 | 1059 | begin |
| 981 | 1060 | try |
| @@ -983,13 +1062,13 @@ | ||
| 983 | 1062 | RowCount:=1; |
| 984 | 1063 | DrawingStyle:=gdsClassic; |
| 985 | 1064 | DefaultRowHeight:=round(-Font.Height*1.5); |
| 986 | - SL.load(fn); | |
| 987 | - RowCount:=SL.count; | |
| 988 | - for i:=0 to SL.hi do begin | |
| 1065 | + sl.load(fn); | |
| 1066 | + RowCount:=sl.count; | |
| 1067 | + for i:=0 to sl.hi do begin | |
| 989 | 1068 | TMP.Delimiter:=','; |
| 990 | 1069 | TMP.QuoteChar:='"'; |
| 991 | 1070 | TMP.StrictDelimiter:=true; |
| 992 | - TMP.DelimitedText:=SL[i]; | |
| 1071 | + TMP.DelimitedText:=sl[i]; | |
| 993 | 1072 | Rows[i]:=TMP; |
| 994 | 1073 | end; |
| 995 | 1074 |
| @@ -999,7 +1078,8 @@ | ||
| 999 | 1078 | |
| 1000 | 1079 | savebuf; |
| 1001 | 1080 | ColExpand(10); |
| 1002 | - finally TMP.Free; | |
| 1081 | + finally | |
| 1082 | + TMP.Free; | |
| 1003 | 1083 | end; |
| 1004 | 1084 | end; |
| 1005 | 1085 |
| @@ -1006,7 +1086,8 @@ | ||
| 1006 | 1086 | procedure TGrid.seldel; |
| 1007 | 1087 | begin |
| 1008 | 1088 | savebuf; |
| 1009 | - seldo(procedure(X,Y:Integer) | |
| 1089 | + seldo( | |
| 1090 | + procedure(X,Y:Integer) | |
| 1010 | 1091 | begin |
| 1011 | 1092 | cells[X,Y]:=''; |
| 1012 | 1093 | end); |
| @@ -1017,7 +1098,8 @@ | ||
| 1017 | 1098 | i,j:Integer; |
| 1018 | 1099 | begin |
| 1019 | 1100 | for i:=selection.top to selection.Bottom do |
| 1020 | - for j:=selection.left to selection.right do func(j,i); | |
| 1101 | + for j:=selection.left to selection.right do | |
| 1102 | + func(j,i); | |
| 1021 | 1103 | end; |
| 1022 | 1104 | |
| 1023 | 1105 | function TGrid.alldo(func:TFuncXY):Integer; |
| @@ -1024,8 +1106,9 @@ | ||
| 1024 | 1106 | var |
| 1025 | 1107 | i,j:Integer; |
| 1026 | 1108 | begin |
| 1027 | - for i:=0 to rowcount-1 do | |
| 1028 | - for j:=0 to colcount-1 do func(j,i); | |
| 1109 | + for i:=0 to RowCount-1 do | |
| 1110 | + for j:=0 to ColCount-1 do | |
| 1111 | + func(j,i); | |
| 1029 | 1112 | end; |
| 1030 | 1113 | |
| 1031 | 1114 | function TGrid.selrowdo(func:TFuncXY):Integer; |
| @@ -1032,21 +1115,22 @@ | ||
| 1032 | 1115 | var |
| 1033 | 1116 | i:Integer; |
| 1034 | 1117 | begin |
| 1035 | - for i:=selection.top to selection.Bottom do func(0,i); | |
| 1118 | + for i:=selection.top to selection.Bottom do | |
| 1119 | + func(0,i); | |
| 1036 | 1120 | end; |
| 1037 | 1121 | |
| 1038 | -procedure TGrid.SetEditText(ACol, ARow: Integer; | |
| 1039 | - const Value: string); | |
| 1122 | +procedure TGrid.SetEditText(ACol,ARow:Integer;const Value:string); | |
| 1040 | 1123 | begin |
| 1041 | - inherited; | |
| 1124 | + inherited; | |
| 1042 | 1125 | Options:=Options-[goEditing]+[goRangeSelect]; |
| 1043 | 1126 | end; |
| 1044 | 1127 | |
| 1045 | -function TGrid.rowdo(func: TFuncXY): Integer; | |
| 1128 | +function TGrid.rowdo(func:TFuncXY):Integer; | |
| 1046 | 1129 | var |
| 1047 | 1130 | i:Integer; |
| 1048 | 1131 | begin |
| 1049 | - for i:=0 to rowcount-1 do func(0,i); | |
| 1132 | + for i:=0 to RowCount-1 do | |
| 1133 | + func(0,i); | |
| 1050 | 1134 | |
| 1051 | 1135 | end; |
| 1052 | 1136 |
| @@ -1055,16 +1139,18 @@ | ||
| 1055 | 1139 | w:Word; |
| 1056 | 1140 | begin |
| 1057 | 1141 | if ssCtrl in Shift then begin |
| 1058 | - if Key=17 then exit; | |
| 1142 | + if Key=17 then | |
| 1143 | + exit; | |
| 1059 | 1144 | case Key of |
| 1060 | - Word('X'):cutcopy(true); | |
| 1061 | - Word('C'):cutcopy(false); | |
| 1062 | - Word('V'):paste; | |
| 1063 | - Word('Z'):copy(buf); | |
| 1145 | + Word('X'):cutcopy(true); | |
| 1146 | + Word('C'):cutcopy(false); | |
| 1147 | + Word('V'):paste; | |
| 1148 | + Word('Z'):copy(buf); | |
| 1064 | 1149 | end; |
| 1065 | - end else begin | |
| 1150 | + end | |
| 1151 | + else begin | |
| 1066 | 1152 | case Key of |
| 1067 | - VK_DELETE:seldel; | |
| 1153 | + VK_DELETE:seldel; | |
| 1068 | 1154 | end; |
| 1069 | 1155 | end; |
| 1070 | 1156 |
| @@ -1081,38 +1167,35 @@ | ||
| 1081 | 1167 | if ssDouble in Shift then begin |
| 1082 | 1168 | Options:=Options+[goEditing]-[goRangeSelect]; |
| 1083 | 1169 | Col:=ACol; |
| 1084 | - Row:=ARow; | |
| 1170 | + row:=ARow; | |
| 1085 | 1171 | EditorMode:=true; |
| 1086 | - end; | |
| 1087 | - if downinselection then exit; | |
| 1172 | + end; | |
| 1173 | + if downinselection then | |
| 1174 | + exit; | |
| 1088 | 1175 | |
| 1089 | - // Options:=Options-[goEditing]+[goRangeSelect]; | |
| 1176 | + // Options:=Options-[goEditing]+[goRangeSelect]; | |
| 1090 | 1177 | // |
| 1091 | - // if(Button=mbLeft)then begin | |
| 1092 | - // if(FixedRows>0) and (ARow=0) and (ACol>0) and not Sizing(X,Y) then begin | |
| 1093 | - // end else if (FixedCols>0) and (ACol=0) and (ARow>0) and not Sizing(X,Y) then begin | |
| 1094 | - // end else if((Col=ACol) and (Row=ARow))then begin | |
| 1095 | - // Options:=Options+[goEditing]-[goRangeSelect]; | |
| 1096 | - // EditorMode:=true; | |
| 1097 | - // end else begin | |
| 1098 | - // EditorMode:=false; | |
| 1099 | - // end; | |
| 1100 | - // end; | |
| 1178 | + // if(Button=mbLeft)then begin | |
| 1179 | + // if(FixedRows>0) and (ARow=0) and (ACol>0) and not Sizing(X,Y) then begin | |
| 1180 | + // end else if (FixedCols>0) and (ACol=0) and (ARow>0) and not Sizing(X,Y) then begin | |
| 1181 | + // end else if((Col=ACol) and (Row=ARow))then begin | |
| 1182 | + // Options:=Options+[goEditing]-[goRangeSelect]; | |
| 1183 | + // EditorMode:=true; | |
| 1184 | + // end else begin | |
| 1185 | + // EditorMode:=false; | |
| 1186 | + // end; | |
| 1187 | + // end; | |
| 1101 | 1188 | inherited; |
| 1102 | 1189 | end; |
| 1103 | 1190 | |
| 1104 | - | |
| 1105 | - | |
| 1106 | 1191 | procedure TGrid.MouseMove(Shift:TShiftState;X,Y:Integer); |
| 1107 | 1192 | var |
| 1108 | 1193 | DataObject:IDataObject; |
| 1109 | - s :string; | |
| 1110 | - dwEffect :Integer; | |
| 1111 | - ACol,ARow :Longint; | |
| 1112 | - savesel :TGridRect; | |
| 1194 | + s:string; | |
| 1195 | + dwEffect:Integer; | |
| 1196 | + ACol,ARow:Longint; | |
| 1197 | + savesel:TGridRect; | |
| 1113 | 1198 | |
| 1114 | - | |
| 1115 | - | |
| 1116 | 1199 | begin |
| 1117 | 1200 | MouseToCell(X,Y,ACol,ARow); |
| 1118 | 1201 | if not downinselection then begin |
| @@ -1120,23 +1203,24 @@ | ||
| 1120 | 1203 | exit; |
| 1121 | 1204 | |
| 1122 | 1205 | end; |
| 1123 | - if not(csLButtonDown in ControlState) then exit; | |
| 1206 | + if not(csLButtonDown in ControlState) then | |
| 1207 | + exit; | |
| 1124 | 1208 | |
| 1125 | 1209 | s:=Application.ExeName; |
| 1126 | - //左ボタンが押された状態で、マウスの位置が閾値を超えたらドラッグ開始 | |
| 1210 | + // 左ボタンが押された状態で、マウスの位置が閾値を超えたらドラッグ開始 | |
| 1127 | 1211 | |
| 1128 | 1212 | if (csLButtonDown in ControlState)and((Abs(X-FMouseDownPt.X)>=Mouse.DragThreshold)or(Abs(Y-FMouseDownPt.Y)>=Mouse.DragThreshold)) then begin |
| 1129 | 1213 | |
| 1130 | 1214 | savesel:=selection; |
| 1131 | - //コントロールにMouseupのメッセージを送っておく | |
| 1215 | + // コントロールにMouseupのメッセージを送っておく | |
| 1132 | 1216 | Perform(WM_LBUTTONUP,0,MakeLong(X,Y)); |
| 1133 | - // Files.Enabled:=false; | |
| 1217 | + // Files.Enabled:=false; | |
| 1134 | 1218 | selection:=savesel; |
| 1135 | - //BeginDrag(true); | |
| 1219 | + // BeginDrag(true); | |
| 1136 | 1220 | |
| 1137 | - //ファイル名からIDataObjectを取得 | |
| 1138 | - DataObject:=TextDeFindForm.GetFilePathDataObject(Self); | |
| 1139 | - //OLEドラッグ&ドロップ開始 | |
| 1221 | + // ファイル名からIDataObjectを取得 | |
| 1222 | + DataObject:=TextDeFindForm.GetFilePathDataObject(self); | |
| 1223 | + // OLEドラッグ&ドロップ開始 | |
| 1140 | 1224 | dwEffect:=DROPEFFECT_NONE; |
| 1141 | 1225 | DoDragDrop(DataObject,TextDeFindForm,DROPEFFECT_COPY,dwEffect); |
| 1142 | 1226 | end; |
| @@ -1151,7 +1235,8 @@ | ||
| 1151 | 1235 | var |
| 1152 | 1236 | i:Integer; |
| 1153 | 1237 | begin |
| 1154 | - for i:=1 to GetNumScrollLines do SendMessage(Handle,WM_VSCROLL,SB_LINEDOWN,0); | |
| 1238 | + for i:=1 to GetNumScrollLines do | |
| 1239 | + SendMessage(Handle,WM_VSCROLL,SB_LINEDOWN,0); | |
| 1155 | 1240 | Result:=true; |
| 1156 | 1241 | end; |
| 1157 | 1242 |
| @@ -1159,13 +1244,14 @@ | ||
| 1159 | 1244 | var |
| 1160 | 1245 | i:Integer; |
| 1161 | 1246 | begin |
| 1162 | - for i:=1 to GetNumScrollLines do SendMessage(Handle,WM_VSCROLL,SB_LINEUP,0); | |
| 1247 | + for i:=1 to GetNumScrollLines do | |
| 1248 | + SendMessage(Handle,WM_VSCROLL,SB_LINEUP,0); | |
| 1163 | 1249 | Result:=true; |
| 1164 | 1250 | end; |
| 1165 | 1251 | |
| 1166 | 1252 | function TGrid.ColExpand(min:Integer):Integer; |
| 1167 | 1253 | var |
| 1168 | - i,j :Integer; | |
| 1254 | + i,j:Integer; | |
| 1169 | 1255 | w1,w2,w3:Integer; |
| 1170 | 1256 | begin |
| 1171 | 1257 | w3:=0; |
| @@ -1174,14 +1260,17 @@ | ||
| 1174 | 1260 | w1:=0; |
| 1175 | 1261 | for i:=0 to RowCount-1 do begin |
| 1176 | 1262 | w2:=Canvas.TextWidth('['+cells[j,i]); |
| 1177 | - if (w1<w2) then w1:=w2; | |
| 1263 | + if (w1<w2) then | |
| 1264 | + w1:=w2; | |
| 1178 | 1265 | end; |
| 1179 | - if w1<min then w1:=min; | |
| 1266 | + if w1<min then | |
| 1267 | + w1:=min; | |
| 1180 | 1268 | ColWidths[j]:=w1; |
| 1181 | 1269 | w3:=w3+(w1)+GridLineWidth; |
| 1182 | 1270 | end; |
| 1183 | 1271 | for j:=0 to ColCount-1 do |
| 1184 | - if ColWidths[j]>gridWidth then ColWidths[j]:=trunc(gridWidth/2); | |
| 1272 | + if ColWidths[j]>gridWidth then | |
| 1273 | + ColWidths[j]:=trunc(gridWidth/2); | |
| 1185 | 1274 | |
| 1186 | 1275 | DefaultRowHeight:=Canvas.TextHeight('あ')+2; |
| 1187 | 1276 | Result:=w3+4; |
| @@ -1193,9 +1282,12 @@ | ||
| 1193 | 1282 | w:Integer; |
| 1194 | 1283 | begin |
| 1195 | 1284 | Result:=0; |
| 1196 | - if cnt<0 then exit; | |
| 1197 | - if Y<0 then exit; | |
| 1198 | - if Y>=RowCount then exit; | |
| 1285 | + if cnt<0 then | |
| 1286 | + exit; | |
| 1287 | + if Y<0 then | |
| 1288 | + exit; | |
| 1289 | + if Y>=RowCount then | |
| 1290 | + exit; | |
| 1199 | 1291 | w:=RowCount-cnt; |
| 1200 | 1292 | for i:=Y to w-1 do begin |
| 1201 | 1293 | Rows[i]:=Rows[i+cnt]; |
| @@ -1205,14 +1297,15 @@ | ||
| 1205 | 1297 | RowCount:=w; |
| 1206 | 1298 | end; |
| 1207 | 1299 | |
| 1208 | - | |
| 1209 | 1300 | function TGrid.RowInsert(Y,cnt:Integer):Integer; |
| 1210 | 1301 | var |
| 1211 | - i :Integer; | |
| 1302 | + i:Integer; | |
| 1212 | 1303 | lcnt:Integer; |
| 1213 | 1304 | begin |
| 1214 | - if cnt<0 then exit; | |
| 1215 | - if (Y<0)or(Y>=RowCount) then Y:=RowCount; | |
| 1305 | + if cnt<0 then | |
| 1306 | + exit; | |
| 1307 | + if (Y<0)or(Y>=RowCount) then | |
| 1308 | + Y:=RowCount; | |
| 1216 | 1309 | RowCount:=RowCount+cnt; |
| 1217 | 1310 | lcnt:=RowCount; |
| 1218 | 1311 |
| @@ -1220,7 +1313,8 @@ | ||
| 1220 | 1313 | Rows[i]:=Rows[i-cnt]; |
| 1221 | 1314 | RowHeights[i]:=RowHeights[i-cnt]; |
| 1222 | 1315 | end; |
| 1223 | - for i:=0 to cnt-1 do Rows[Y+i].clear(); | |
| 1316 | + for i:=0 to cnt-1 do | |
| 1317 | + Rows[Y+i].clear(); | |
| 1224 | 1318 | Result:=0; |
| 1225 | 1319 | end; |
| 1226 | 1320 |
| @@ -1228,33 +1322,36 @@ | ||
| 1228 | 1322 | var |
| 1229 | 1323 | i:Integer; |
| 1230 | 1324 | begin |
| 1231 | - if (Y<0) then Y:=0; | |
| 1232 | - if Y>=RowCount then Y:=RowCount; | |
| 1233 | - for i:=0 to cnt-1 do Rows[Y+i].clear(); | |
| 1325 | + if (Y<0) then | |
| 1326 | + Y:=0; | |
| 1327 | + if Y>=RowCount then | |
| 1328 | + Y:=RowCount; | |
| 1329 | + for i:=0 to cnt-1 do | |
| 1330 | + Rows[Y+i].clear(); | |
| 1234 | 1331 | Result:=0 |
| 1235 | 1332 | end; |
| 1236 | 1333 | |
| 1237 | 1334 | function TStringDynArrayHelper.add(s:string):Integer; |
| 1238 | 1335 | begin |
| 1239 | - SetLength(Self,Length(Self)+1); | |
| 1240 | - Self[Length(Self)-1]:=s; | |
| 1241 | - Result:=Length(Self); | |
| 1336 | + SetLength(self,Length(self)+1); | |
| 1337 | + self[Length(self)-1]:=s; | |
| 1338 | + Result:=Length(self); | |
| 1242 | 1339 | |
| 1243 | 1340 | end; |
| 1244 | 1341 | |
| 1245 | 1342 | function TStringDynArrayHelper.getcount:Integer; |
| 1246 | 1343 | begin |
| 1247 | - Result:=Length(Self); | |
| 1344 | + Result:=Length(self); | |
| 1248 | 1345 | end; |
| 1249 | 1346 | |
| 1250 | 1347 | procedure TStringDynArrayHelper.setcount(const i:Integer); |
| 1251 | 1348 | begin |
| 1252 | - SetLength(Self,i); | |
| 1349 | + SetLength(self,i); | |
| 1253 | 1350 | end; |
| 1254 | 1351 | |
| 1255 | 1352 | function TStringDynArrayHelper.hi:Integer; |
| 1256 | 1353 | begin |
| 1257 | - Result:=High(Self); | |
| 1354 | + Result:=High(self); | |
| 1258 | 1355 | |
| 1259 | 1356 | end; |
| 1260 | 1357 |
| @@ -1261,16 +1358,20 @@ | ||
| 1261 | 1358 | function TStringDynArrayHelper.item(i:Integer):String; |
| 1262 | 1359 | begin |
| 1263 | 1360 | Result:=''; |
| 1264 | - if i<0 then exit; | |
| 1265 | - if i>High(Self) then exit; | |
| 1266 | - Result:=Self[i]; | |
| 1361 | + if i<0 then | |
| 1362 | + exit; | |
| 1363 | + if i>High(self) then | |
| 1364 | + exit; | |
| 1365 | + Result:=self[i]; | |
| 1267 | 1366 | end; |
| 1268 | 1367 | |
| 1269 | 1368 | function TStringDynArrayHelper.save(f:string):boolean; |
| 1270 | 1369 | begin |
| 1271 | 1370 | with stringselfcreate do |
| 1272 | - try SaveToFile(f,TEncoding.UTF8); | |
| 1273 | - except Free; | |
| 1371 | + try | |
| 1372 | + SaveToFile(f,TEncoding.UTF8); | |
| 1373 | + except | |
| 1374 | + Free; | |
| 1274 | 1375 | end; |
| 1275 | 1376 | end; |
| 1276 | 1377 |
| @@ -1279,8 +1380,9 @@ | ||
| 1279 | 1380 | with TStringList.Create do |
| 1280 | 1381 | try |
| 1281 | 1382 | LoadFromFile(f); |
| 1282 | - Self:=TStringDynArray(ToStringArray); | |
| 1283 | - except Free; | |
| 1383 | + self:=TStringDynArray(ToStringArray); | |
| 1384 | + except | |
| 1385 | + Free; | |
| 1284 | 1386 | end; |
| 1285 | 1387 | end; |
| 1286 | 1388 |
| @@ -1289,7 +1391,8 @@ | ||
| 1289 | 1391 | s:string; |
| 1290 | 1392 | begin |
| 1291 | 1393 | Result:=TStringSelf.Create; |
| 1292 | - for s in Self do Result.add(s); | |
| 1394 | + for s in self do | |
| 1395 | + Result.add(s); | |
| 1293 | 1396 | end; |
| 1294 | 1397 | |
| 1295 | 1398 | function TStringDynArrayHelper.adduni(s:string):Integer; |
| @@ -1297,7 +1400,8 @@ | ||
| 1297 | 1400 | i:Integer; |
| 1298 | 1401 | begin |
| 1299 | 1402 | for i:=0 to hi do |
| 1300 | - if Self[i]=s then exit(-1); | |
| 1403 | + if self[i]=s then | |
| 1404 | + exit(-1); | |
| 1301 | 1405 | add(s); |
| 1302 | 1406 | Result:=count; |
| 1303 | 1407 | end; |
| @@ -1304,134 +1408,152 @@ | ||
| 1304 | 1408 | |
| 1305 | 1409 | function TStringDynArrayHelper.cat(s,e:string):String; |
| 1306 | 1410 | var |
| 1307 | - t:string; | |
| 1411 | + T:string; | |
| 1308 | 1412 | begin |
| 1309 | - for t in Self do Result:=Result+s+t+e; | |
| 1413 | + for T in self do | |
| 1414 | + Result:=Result+s+T+e; | |
| 1310 | 1415 | end; |
| 1311 | 1416 | |
| 1312 | 1417 | procedure TStringDynArrayHelper.clear; |
| 1313 | 1418 | begin |
| 1314 | - SetLength(Self,0); | |
| 1419 | + SetLength(self,0); | |
| 1315 | 1420 | end; |
| 1316 | 1421 | |
| 1317 | 1422 | function TStringSelf.this:TStringList; |
| 1318 | 1423 | begin |
| 1319 | - exit(Self); | |
| 1424 | + exit(self); | |
| 1320 | 1425 | end; |
| 1321 | 1426 | |
| 1322 | -//初期化処理 | |
| 1427 | +// 初期化処理 | |
| 1323 | 1428 | { TStringsHelper } |
| 1324 | 1429 | |
| 1325 | -function TStringsHelper.setstrings(sa: TStringDynArray): Integer; | |
| 1326 | -var i:integer; | |
| 1430 | +function TStringsHelper.setstrings(sa:TStringDynArray):Integer; | |
| 1431 | +var | |
| 1432 | + i:Integer; | |
| 1327 | 1433 | begin |
| 1328 | - for i:=0 to sa.Count-1 do | |
| 1329 | - if i<Count then | |
| 1330 | - Self[i]:=sa[i]; | |
| 1434 | + for i:=0 to sa.count-1 do | |
| 1435 | + if i<count then self[i]:=sa[i]; | |
| 1331 | 1436 | end; |
| 1332 | 1437 | |
| 1333 | 1438 | { TIniFileHelper } |
| 1334 | 1439 | |
| 1335 | -procedure TMemIniFileHelper.readgrid(sc: string; G: TGrid); | |
| 1336 | -var x,y:integer; | |
| 1440 | +procedure TMemIniFileHelper.readgrid(sc:string;G:TGrid); | |
| 1441 | +var | |
| 1442 | + X,Y:Integer; | |
| 1337 | 1443 | s:string; |
| 1338 | 1444 | begin |
| 1339 | - G.rowdo(procedure(X,Y:Integer)begin | |
| 1340 | - G.rows[y].clear; | |
| 1341 | - end); | |
| 1342 | - G.rowcount:=1; | |
| 1343 | - for y:=0 to MAXLIST do begin | |
| 1344 | - for x:=0 to G.ColCount-1 do begin | |
| 1345 | - s:=inttostr(y)+','+inttostr(x); | |
| 1346 | - if not ValueExists(sc,s) then break; | |
| 1347 | - if x>=G.colcount then G.colcount:=x+1; | |
| 1348 | - if y>=G.rowcount then G.rowcount:=y+1; | |
| 1349 | - G.cells[x,y]:=ReadString(sc,inttostr(y)+','+inttostr(x),''); | |
| 1445 | + G.rowdo( | |
| 1446 | + procedure(X,Y:Integer) | |
| 1447 | + begin | |
| 1448 | + G.Rows[Y].clear; | |
| 1449 | + end); | |
| 1450 | + G.RowCount:=1; | |
| 1451 | + for Y:=0 to MAXLIST do begin | |
| 1452 | + for X:=0 to G.ColCount-1 do begin | |
| 1453 | + s:=inttostr(Y)+','+inttostr(X); | |
| 1454 | + if not ValueExists(sc,s) then | |
| 1455 | + break; | |
| 1456 | + if X>=G.ColCount then | |
| 1457 | + G.ColCount:=X+1; | |
| 1458 | + if Y>=G.RowCount then | |
| 1459 | + G.RowCount:=Y+1; | |
| 1460 | + G.cells[X,Y]:=ReadString(sc,inttostr(Y)+','+inttostr(X),''); | |
| 1350 | 1461 | end; |
| 1351 | 1462 | end; |
| 1352 | - if G.rowcount<2 then G.rowcount:=2; | |
| 1353 | - G.fixedrows:=1; | |
| 1463 | + if G.RowCount<2 then | |
| 1464 | + G.RowCount:=2; | |
| 1465 | + G.FixedRows:=1; | |
| 1354 | 1466 | G.Rows[0].setstrings(CHEAD); |
| 1355 | 1467 | G.ColExpand(10); |
| 1356 | 1468 | end; |
| 1357 | 1469 | |
| 1358 | -procedure TMemIniFileHelper.writegrid(sc: string; G: TGrid); | |
| 1470 | +procedure TMemIniFileHelper.writegrid(sc:string;G:TGrid); | |
| 1359 | 1471 | begin |
| 1360 | 1472 | EraseSection(sc); |
| 1361 | - G.alldo(procedure(X,Y:Integer)begin | |
| 1362 | - WriteString(sc,inttostr(y)+','+inttostr(x),G.cells[x,y]); | |
| 1363 | - end); | |
| 1473 | + G.alldo( | |
| 1474 | + procedure(X,Y:Integer) | |
| 1475 | + begin | |
| 1476 | + WriteString(sc,inttostr(Y)+','+inttostr(X),G.cells[X,Y]); | |
| 1477 | + end); | |
| 1364 | 1478 | |
| 1365 | 1479 | end; |
| 1366 | 1480 | |
| 1367 | -procedure TMemIniFileHelper.readstrings(sc: string; sl:TStrings); | |
| 1368 | -var i:integer; | |
| 1481 | +procedure TMemIniFileHelper.readstrings(sc:string;sl:TStrings); | |
| 1482 | +var | |
| 1483 | + i:Integer; | |
| 1369 | 1484 | s:string; |
| 1370 | 1485 | begin |
| 1371 | - if SectionExists(sc) then sl.clear; | |
| 1486 | + if SectionExists(sc) then | |
| 1487 | + sl.clear; | |
| 1372 | 1488 | for i:=0 to MAXLIST do begin |
| 1373 | - if not ValueExists(sc,inttostr(i)) then break; | |
| 1489 | + if not ValueExists(sc,inttostr(i)) then | |
| 1490 | + break; | |
| 1374 | 1491 | sl.add(ReadString(sc,inttostr(i),'')); |
| 1375 | 1492 | end; |
| 1376 | 1493 | end; |
| 1377 | 1494 | |
| 1378 | - | |
| 1379 | - | |
| 1380 | -procedure TMemIniFileHelper.writestrings(sc: string; sl: TStrings); | |
| 1381 | -var i:integer; | |
| 1495 | +procedure TMemIniFileHelper.writestrings(sc:string;sl:TStrings); | |
| 1496 | +var | |
| 1497 | + i:Integer; | |
| 1382 | 1498 | begin |
| 1383 | 1499 | EraseSection(sc); |
| 1384 | - for i:=0 to sl.Count-1 do | |
| 1385 | - WriteString(sc,inttostr(i),sl[i]); | |
| 1500 | + for i:=0 to sl.count-1 do WriteString(sc,inttostr(i),sl[i]); | |
| 1386 | 1501 | end; |
| 1387 | 1502 | |
| 1388 | -procedure TMemIniFileHelper.readtreeview(sc: string; T: TTreeView); | |
| 1503 | +procedure TMemIniFileHelper.readtreeview(sc:string;T:TTreeView); | |
| 1389 | 1504 | var |
| 1390 | 1505 | N:TTreeNode; |
| 1391 | - i:integer; | |
| 1392 | - procedure sub(key:string;N:TTreeNode); | |
| 1393 | - var i:integer; | |
| 1506 | + i:Integer; | |
| 1507 | + procedure sub(Key:string;N:TTreeNode); | |
| 1508 | + var | |
| 1509 | + i:Integer; | |
| 1394 | 1510 | k:string; |
| 1395 | 1511 | begin |
| 1396 | 1512 | for i:=0 to MAXLIST do begin |
| 1397 | - k:=key+','+inttostr(i); | |
| 1398 | - if not ValueExists(sc,k) then break; | |
| 1513 | + k:=Key+','+inttostr(i); | |
| 1514 | + if not ValueExists(sc,k) then | |
| 1515 | + break; | |
| 1399 | 1516 | T.Items.AddChild(N,ReadString(sc,k,'')); |
| 1400 | 1517 | sub(k,N); |
| 1401 | 1518 | end; |
| 1402 | 1519 | end; |
| 1520 | + | |
| 1403 | 1521 | begin |
| 1404 | - if SectionExists(sc) then T.Items.clear; | |
| 1522 | + if SectionExists(sc) then | |
| 1523 | + T.Items.clear; | |
| 1405 | 1524 | for i:=0 to MAXLIST do begin |
| 1406 | - if not ValueExists(sc,inttostr(i)) then break; | |
| 1407 | - N:=T.Items.Add(nil,ReadString(sc,inttostr(i),'')); | |
| 1525 | + if not ValueExists(sc,inttostr(i)) then | |
| 1526 | + break; | |
| 1527 | + N:=T.Items.add(nil,ReadString(sc,inttostr(i),'')); | |
| 1408 | 1528 | sub(inttostr(i),N); |
| 1409 | 1529 | end; |
| 1410 | 1530 | |
| 1411 | 1531 | end; |
| 1412 | 1532 | |
| 1413 | -procedure TMemIniFileHelper.writetreeview(sc: string; T: TTreeView); | |
| 1533 | +procedure TMemIniFileHelper.writetreeview(sc:string;T:TTreeView); | |
| 1414 | 1534 | var |
| 1415 | 1535 | N:TTreeNode; |
| 1416 | - i:integer; | |
| 1417 | - procedure sub(key: string;N:TTreeNode); | |
| 1418 | - var i:integer; | |
| 1536 | + i:Integer; | |
| 1537 | + procedure sub(Key:string;N:TTreeNode); | |
| 1538 | + var | |
| 1539 | + i:Integer; | |
| 1419 | 1540 | begin |
| 1420 | 1541 | N:=N.getFirstChild; |
| 1421 | 1542 | i:=0; |
| 1422 | 1543 | while N<>nil do begin |
| 1423 | - WriteString(sc,key+','+inttostr(N.index),N.text); | |
| 1544 | + WriteString(sc,Key+','+inttostr(N.index),N.Text); | |
| 1424 | 1545 | sub(sc,N); |
| 1425 | 1546 | N:=N.getNextSibling; |
| 1426 | 1547 | inc(i); |
| 1427 | 1548 | end; |
| 1428 | 1549 | end; |
| 1550 | + | |
| 1429 | 1551 | begin |
| 1430 | 1552 | EraseSection(sc); |
| 1431 | 1553 | i:=0; |
| 1432 | 1554 | N:=T.Items.GetFirstNode; |
| 1433 | 1555 | while N<>nil do begin |
| 1434 | - WriteString(sc,inttostr(N.index),N.text); | |
| 1556 | + WriteString(sc,inttostr(N.index),N.Text); | |
| 1435 | 1557 | sub(inttostr(N.index),N); |
| 1436 | 1558 | N:=N.getNextSibling; |
| 1437 | 1559 | inc(i); |
| @@ -1443,7 +1565,7 @@ | ||
| 1443 | 1565 | SHGetMalloc(Malloc); |
| 1444 | 1566 | OleInitialize(nil); |
| 1445 | 1567 | |
| 1446 | -//終了処理 | |
| 1568 | +// 終了処理 | |
| 1447 | 1569 | finalization |
| 1448 | 1570 | |
| 1449 | 1571 | OleUninitialize; |