diff --git a/src/ce_dfmt.pas b/src/ce_dfmt.pas index fcf2fcef..f4c7799a 100644 --- a/src/ce_dfmt.pas +++ b/src/ce_dfmt.pas @@ -96,7 +96,7 @@ begin fBackup := TStringList.Create; // fname := getCoeditDocPath + optFname; - if fileExists(fname) then + if fname.fileExists then fDmtWrapper.loadFromFile(fname); // btnCancel.OnClick := @doCancel; diff --git a/src/ce_dubproject.pas b/src/ce_dubproject.pas index 579ceb09..ae9dbf4c 100644 --- a/src/ce_dubproject.pas +++ b/src/ce_dubproject.pas @@ -169,7 +169,7 @@ var begin loader := TMemoryStream.Create; try - fBasePath := extractFilePath(aFilename); + fBasePath := aFilename.extractFilePath; fFilename := aFilename; loader.LoadFromFile(fFilename); fSaveAsUtf8 := false; diff --git a/src/ce_gdb.pas b/src/ce_gdb.pas index b939f506..d74c5279 100644 --- a/src/ce_gdb.pas +++ b/src/ce_gdb.pas @@ -228,7 +228,7 @@ begin if not doc.isDSource then continue; nme := doc.fileName; - if not FileExists(nme) then + if not nme.fileExists then continue; {$WARNINGS OFF} for j := 0 to doc.breakPointsCount-1 do @@ -250,7 +250,7 @@ begin if fGdb = nil then exit; if not fGdb.Running then exit; nme := sender.fileName; - if not FileExists(nme) then exit; + if not nme.fileExists then exit; // str := cmd[modification] + nme + ':' + intToStr(line); fGdb.Suspend; @@ -267,7 +267,7 @@ begin if fProj = nil then exit; if fProj.binaryKind <> executable then exit; str := fProj.outputFilename; - if not FileExists(str) then exit; + if not str.fileExists then exit; // gdb process killGdb; fGdb := TCEProcess.create(nil); diff --git a/src/ce_lcldragdrop.pas b/src/ce_lcldragdrop.pas index b1d9767f..7bd14a19 100644 --- a/src/ce_lcldragdrop.pas +++ b/src/ce_lcldragdrop.pas @@ -92,7 +92,7 @@ begin if trv.Selected.isNotNil then begin result := trv.Selected.Text; - if (not result.fileExists) and assigned(fProj) then + if not result.fileExists and assigned(fProj) then result := fProj.filename.extractFilePath + result; end; end; @@ -104,7 +104,7 @@ var fname: string; begin fname := getFilename(Source); - Accept := fname.fileExists and (not fname.dirExists); + Accept := fname.fileExists and not fname.dirExists; end; procedure TDDHandler.DragDrop(Sender, Source: TObject; X, Y: Integer); diff --git a/src/ce_libman.pas b/src/ce_libman.pas index 5b3dd687..a4a904c4 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -64,13 +64,13 @@ begin inherited; fCol := TCollection.Create(TLibraryItem); fname := getCoeditDocPath + libFname; - if fileExists(fname) then + if fname.fileExists then loadFromFile(fname); if fCol.Count = 0 then begin {$IFDEF WINDOWS} fDmdPath := ExeSearch('dmd.exe'); - if FileExists(fDmdPath) then + if fDmdPath.fileExists then begin // add phobos fname := ExtractFileDir(fDmdPath); diff --git a/src/ce_libmaneditor.pas b/src/ce_libmaneditor.pas index c8665742..9da7858a 100644 --- a/src/ce_libmaneditor.pas +++ b/src/ce_libmaneditor.pas @@ -91,9 +91,9 @@ end; procedure TCELibManEditorWidget.updateButtonsState; begin btnReg.Enabled := (fProj <> nil) and (fProj.binaryKind = staticlib) and - FileExists(fProj.Filename); - btnOpenProj.Enabled := (List.Selected.isNotNil) and - (fileExists(List.Selected.SubItems[2])); + fProj.Filename.fileExists; + btnOpenProj.Enabled := List.Selected.isNotNil and + List.Selected.SubItems[2].fileExists; end; procedure TCELibManEditorWidget.projNew(aProject: ICECommonProject); @@ -310,7 +310,7 @@ var begin if List.Selected.isNil then exit; fname := List.Selected.SubItems[2]; - if not FileExists(fname) then exit; + if not fname.fileExists then exit; // if isValidNativeProject(fname) then begin @@ -384,7 +384,7 @@ begin SubItems.add(fname); SubItems.add(root); SubItems.add(fProj.filename); - if not FileExists(SubItems[0]) then + if not SubItems[0].fileExists then dlgOkInfo('the library file does not exist, maybe the project not been already compiled ?'); Selected:= true; end; diff --git a/src/ce_main.pas b/src/ce_main.pas index 3e3c0cb6..21097ae2 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -780,7 +780,7 @@ begin end; end; value := application.GetOptionValue('p', 'project'); - if value.isNotEmpty and fileExists(value) then + if value.isNotEmpty and value.fileExists then openProj(value); value := application.GetOptionValue('f', 'files'); if value.isNotEmpty then @@ -790,7 +790,7 @@ begin lst.DelimitedText := value; for value in lst do begin - if fileExists(value) then + if value.fileExists then openFile(value); end; finally @@ -949,7 +949,7 @@ var begin // project and files MRU fname := getCoeditDocPath + 'mostrecent.txt'; - if fileExists(fname) then with TCEPersistentMainMrus.create(nil) do + if fname.fileExists then with TCEPersistentMainMrus.create(nil) do try setTargets(fFileMru, fProjMru); loadFromFile(fname); @@ -958,7 +958,7 @@ begin end; // shortcuts for the actions standing in the main action list fname := getCoeditDocPath + 'mainshortcuts.txt'; - if fileExists(fname) then with TCEPersistentMainShortcuts.create(nil) do + if fname.fileExists then with TCEPersistentMainShortcuts.create(nil) do try loadFromFile(fname); assignTo(self); @@ -968,7 +968,7 @@ begin // globals opts fAppliOpts := TCEApplicationOptions.Create(self); fname := getCoeditDocPath + 'application.txt'; - if fileExists(fname) then + if fname.fileExists then begin fAppliOpts.loadFromFile(fname); fAppliOpts.assignTo(self); @@ -1524,7 +1524,7 @@ procedure TCEMainForm.saveFile(aDocument: TCESynMemo); begin if (aDocument.Highlighter = LfmSyn) or (aDocument.Highlighter = JsSyn) then saveProjSource(aDocument) - else if fileExists(aDocument.fileName) then + else if aDocument.fileName.fileExists then aDocument.save; end; @@ -1548,7 +1548,7 @@ end; procedure TCEMainForm.actProjOpenContFoldExecute(Sender: TObject); begin if fProjectInterface = nil then exit; - if not fileExists(fProjectInterface.filename) then exit; + if not fProjectInterface.filename.fileExists then exit; // DockMaster.GetAnchorSite(fExplWidg).Show; fExplWidg.expandPath(fProjectInterface.filename.extractFilePath); @@ -1598,7 +1598,7 @@ begin if fDoc.isNil then exit; // str := fDoc.fileName; - if (str <> fDoc.tempFilename) and (fileExists(str)) then + if (str <> fDoc.tempFilename) and str.fileExists then saveFile(fDoc) else actFileSaveAs.Execute; @@ -1612,7 +1612,7 @@ begin // if fProjectInterface.getFormat = pfNative then begin - if fileExists(fDoc.fileName) and (not fDoc.isTemporary) then + if fDoc.fileName.fileExists and not fDoc.isTemporary then fNativeProject.addSource(fDoc.fileName) else dlgOkInfo('the file has not been added to the project because it does not exist'); end else @@ -1889,7 +1889,7 @@ begin fMsgs.message('compiling ' + shortenPath(fDoc.fileName, 25), fDoc, amcEdit, amkInf); - if fileExists(fDoc.fileName) then fDoc.save + if fDoc.fileName.fileExists then fDoc.save else fDoc.saveTempFile; fname := stripFileExt(fDoc.fileName); @@ -1978,7 +1978,7 @@ end; procedure TCEMainForm.actFileOpenContFoldExecute(Sender: TObject); begin if fDoc.isNil then exit; - if not fileExists(fDoc.fileName) then exit; + if not fDoc.fileName.fileExists then exit; // DockMaster.GetAnchorSite(fExplWidg).Show; fExplWidg.expandPath(fDoc.fileName.extractFilePath); @@ -2015,7 +2015,7 @@ begin if (not fProjectInterface.targetUpToDate) then if dlgOkCancel('The project output is not up-to-date, rebuild ?') = mrOK then fProjectInterface.compile; - if fileExists(fProjectInterface.outputFilename) + if fProjectInterface.outputFilename.fileExists or (fProjectInterface.getFormat = pfDub) then fProjectInterface.run; end; @@ -2065,7 +2065,7 @@ procedure TCEMainForm.layoutLoadFromFile(const aFilename: string); var xcfg: TXMLConfigStorage; begin - if not fileExists(aFilename) then + if not aFilename.fileExists then exit; // xcfg := TXMLConfigStorage.Create(aFilename, true); @@ -2186,7 +2186,7 @@ end; {$REGION project ---------------------------------------------------------------} procedure TCEMainForm.showProjTitle; begin - if (fProjectInterface <> nil) and fileExists(fProjectInterface.filename) then + if (fProjectInterface <> nil) and fProjectInterface.filename.fileExists then caption := format('Coedit - %s', [shortenPath(fProjectInterface.filename, 30)]) else caption := 'Coedit'; @@ -2331,7 +2331,7 @@ end; procedure TCEMainForm.actProjSourceExecute(Sender: TObject); begin if fProjectInterface = nil then exit; - if not fileExists(fProjectInterface.filename) then exit; + if not fProjectInterface.filename.fileExists then exit; // openFile(fProjectInterface.filename); if fProjectInterface.getFormat = pfNative then diff --git a/src/ce_messages.pas b/src/ce_messages.pas index f8831d39..c687292a 100644 --- a/src/ce_messages.pas +++ b/src/ce_messages.pas @@ -312,7 +312,7 @@ begin AssignPng(btnClearCat, 'clean'); // fname := getCoeditDocPath + optname; - if fileExists(fname) then + if fname.fileExists then begin fOptions.loadFromFile(fname); fOptions.AssignTo(self); @@ -1031,27 +1031,27 @@ begin and (aMessage[i..i+5] = '-mixin'))) then begin // absolute fname - if fileExists(ident) then + if ident.fileExists then begin getMultiDocHandler.openDocument(ident); exit(true); end; // relative fname if project file is the base path to a rel. fname absName := ExpandFileName(ident); - if fileExists(absName) then + if absName.fileExists then begin getMultiDocHandler.openDocument(absName); exit(true); end; // if fname relative to native project path or project filed 'root' absName := expandFilenameEx(symbolExpander.get('') + DirectorySeparator, ident); - if fileExists(absName) then + if absName.fileExists then begin getMultiDocHandler.openDocument(absName); exit(true); end; absName := expandFilenameEx(symbolExpander.get('') + DirectorySeparator, ident); - if fileExists(absName) then + if absName.fileExists then begin getMultiDocHandler.openDocument(absName); exit(true); diff --git a/src/ce_miniexplorer.pas b/src/ce_miniexplorer.pas index 9e8a1c62..aa348319 100644 --- a/src/ce_miniexplorer.pas +++ b/src/ce_miniexplorer.pas @@ -268,7 +268,7 @@ begin treeSetRoots; // fname := getCoeditDocPath + OptsFname; - if fileExists(fname) then with TCEMiniExplorerOptions.create(nil) do + if fname.fileExists then with TCEMiniExplorerOptions.create(nil) do try loadFromFile(fname); assignTo(self); @@ -459,7 +459,7 @@ begin if lstFiles.Selected.isNil then exit; if lstFiles.Selected.Data.isNil then exit; fname := PString(lstFiles.Selected.Data)^; - if not fileExists(fname) then exit; + if not fname.fileExists then exit; {$IFNDEF WINDOWS} fname := fname[2..length(fname)]; {$ENDIF} @@ -531,7 +531,7 @@ begin if lstFav.Selected.Data.isNil then exit; fname := PString(lstFav.Selected.Data)^; end; - if fileExists(fname) then if not shellOpen(fname) then + if fname.fileExists then if not shellOpen(fname) then getMessageDisplay.message((format('the shell failed to open "%s"', [shortenPath(fname, 25)])), nil, amcMisc, amkErr); end; diff --git a/src/ce_mru.pas b/src/ce_mru.pas index cc82a00a..970beaf7 100644 --- a/src/ce_mru.pas +++ b/src/ce_mru.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, ce_interfaces, ce_observer, - ce_nativeproject, ce_synmemo; + ce_nativeproject, ce_synmemo, ce_common; type @@ -141,13 +141,13 @@ var begin inherited; for i := Count-1 downto 0 do - if not fileExists(Strings[i]) then + if not Strings[i].fileExists then Delete(i); end; function TCEMRUFileList.checkItem(const S: string): boolean; begin - exit( inherited checkItem(S) and fileExists(S)); + exit( inherited checkItem(S) and S.fileExists); end; constructor TCEMRUDocumentList.create; @@ -176,7 +176,7 @@ end; procedure TCEMRUDocumentList.docClosing(aDoc: TCESynMemo); begin - if FileExists(aDoc.fileName) and (aDoc.fileName <> aDoc.tempFilename) then + if aDoc.fileName.fileExists and not aDoc.isTemporary then Insert(0, aDoc.fileName); end; @@ -215,7 +215,8 @@ begin if aProject = nil then exit; // fname := aProject.filename; - if FileExists(fname) then Insert(0, fname); + if fname.fileExists then + Insert(0, fname); end; initialization diff --git a/src/ce_procinput.pas b/src/ce_procinput.pas index 2e181bff..394d68d2 100644 --- a/src/ce_procinput.pas +++ b/src/ce_procinput.pas @@ -54,7 +54,7 @@ begin fMru.maxCount := 25; EntitiesConnector.addSingleService(self); fname := getCoeditDocPath + OptsFname; - if fileExists(OptsFname) then + if OptsFname.fileExists then fMru.LoadFromFile(fname); if fMru.Count = 0 then fMru.Insert(0, '(your input here)'); diff --git a/src/ce_projinspect.pas b/src/ce_projinspect.pas index d5a665f8..7286313c 100644 --- a/src/ce_projinspect.pas +++ b/src/ce_projinspect.pas @@ -357,7 +357,7 @@ begin lst := TStringList.Create; fProject.beginUpdate; try for fname in Filenames do - if FileExists(fname) then + if fname.fileExists then addFile(fname) else if fname.dirExists then begin diff --git a/src/ce_search.pas b/src/ce_search.pas index 8c63ccce..d9e365c9 100644 --- a/src/ce_search.pas +++ b/src/ce_search.pas @@ -216,7 +216,7 @@ begin fReplaceMru:= TCEMruList.Create; // fname := getCoeditDocPath + OptsFname; - if FileExists(fname) then with TCESearchOptions.create(nil) do + if fname.fileExists then with TCESearchOptions.create(nil) do try loadFromFile(fname); AssignTo(self); diff --git a/src/ce_staticmacro.pas b/src/ce_staticmacro.pas index 31435417..065c9906 100644 --- a/src/ce_staticmacro.pas +++ b/src/ce_staticmacro.pas @@ -208,7 +208,7 @@ begin fOptions := TStaticMacrosOptions.create(self); fOptionBackup := TStaticMacrosOptions.create(self); fname := getCoeditDocPath + OptFname; - if fileExists(fname) then + if fname.fileExists then begin fOptions.loadFromFile(fname); // old option file will create a streaming error. diff --git a/src/ce_symlist.pas b/src/ce_symlist.pas index c6bf76b6..65eb0652 100644 --- a/src/ce_symlist.pas +++ b/src/ce_symlist.pas @@ -353,7 +353,7 @@ begin fOptions := TCESymbolListOptions.Create(self); fOptions.Name:= 'symbolListOptions'; fname := getCoeditDocPath + OptsFname; - if FileExists(fname) then + if fname.fileExists then fOptions.loadFromFile(fname); fOptions.AssignTo(self); // @@ -650,7 +650,7 @@ end; procedure TCESymbolListWidget.checkIfHasToolExe; begin fToolExeName := exeFullName(toolExeName); - fHasToolExe := FileExists(fToolExeName); + fHasToolExe := fToolExeName.fileExists; end; procedure TCESymbolListWidget.callToolProc; diff --git a/src/ce_symstring.pas b/src/ce_symstring.pas index 32fd0f3a..7c96dfef 100644 --- a/src/ce_symstring.pas +++ b/src/ce_symstring.pas @@ -171,7 +171,7 @@ begin // document if hasDoc then begin - if not fileExists(fDoc.fileName) then + if not fDoc.fileName.fileExists then fDoc.saveTempFile; fSymbols[CFF] := fDoc.fileName; fSymbols[CFP] := fDoc.fileName.extractFilePath; @@ -209,7 +209,7 @@ begin end; if hasNativeProj then begin - if fileExists(fProj.fileName) then + if fProj.fileName.fileExists then begin fSymbols[CPR] := expandFilenameEx(fProj.basePath, fProj.RootFolder); if fSymbols[CPR].isEmpty then diff --git a/src/ce_synmemo.pas b/src/ce_synmemo.pas index 5a559de4..7259b121 100644 --- a/src/ce_synmemo.pas +++ b/src/ce_synmemo.pas @@ -362,7 +362,7 @@ var begin tempn := fMemo.fileName; if tempn = fMemo.tempFilename then exit; - if not fileExists(tempn) then exit; + if not tempn.fileExists then exit; // fname := getCoeditDocPath + 'editorcache' + DirectorySeparator; ForceDirectories(fname); @@ -379,14 +379,14 @@ var chksm: Cardinal; begin tempn := fMemo.fileName; - if not fileExists(tempn) then exit; + if not tempn.fileExists then exit; // fname := getCoeditDocPath + 'editorcache' + DirectorySeparator; chksm := crc32(0, nil, 0); chksm := crc32(chksm, @tempn[1], length(tempn)); fname := fname + format('%.8X.txt', [chksm]); // - if not fileExists(fname) then exit; + if not fname.fileExists then exit; loadFromFile(fname); end; {$IFDEF DEBUG}{$R+}{$ENDIF} @@ -548,7 +548,7 @@ begin fBreakPoints.Free; fCallTipStrings.Free; // - if fileExists(fTempFileName) then + if fTempFileName.fileExists then sysutils.DeleteFile(fTempFileName); // inherited; diff --git a/src/ce_todolist.pas b/src/ce_todolist.pas index 5bb005f3..f1b64292 100644 --- a/src/ce_todolist.pas +++ b/src/ce_todolist.pas @@ -225,7 +225,7 @@ begin AssignPng(btnGo, 'arrow_pen'); // fname := getCoeditDocPath + OptFname; - if FileExists(fname) then + if fname.fileExists then fOptions.loadFromFile(fname); fOptions.AssignTo(self); // diff --git a/src/ce_tools.pas b/src/ce_tools.pas index 6c48512d..8b139b04 100644 --- a/src/ce_tools.pas +++ b/src/ce_tools.pas @@ -267,7 +267,7 @@ begin inherited; fTools := TCEToolItems.Create(TCEToolItem); fname := getCoeditDocPath + toolsFname; - if fileExists(fname) then loadFromFile(fname); + if fname.fileExists then loadFromFile(fname); // EntitiesConnector.addObserver(self); end; diff --git a/wiki/wiki.txt b/wiki/wiki.txt index a86658c7..6fe9ab34 100644 --- a/wiki/wiki.txt +++ b/wiki/wiki.txt @@ -212,7 +212,7 @@ General questions and discussions (Q, BLA) about the use are also allowed since - **"Save project as"**: saves the current project from a dialog. - **"Project configuration"**: displays the project configuration widget. - **"Edit project file"**: opens the project file in a new editor. When saved from a source editor, a project file is directly reloaded. It means that a particular care must be taken during the edition. Coedit will skip any error in the project file, without warnings. -- **"View project command line"**: displays the list of the switches and their arguments, as passed to DMD before the compilation. Note that under Windows, the content can be copied using the Ctrl+C shortcut on the dialog. +- **"View project command line"**: displays the list of the switches and their arguments, as passed to DMD before the compilation. Note that under Windows, the content can be copied using the Ctrl + C shortcut on the dialog. - **"View in mini explorer"**: expands the [mini-explorer][lnk_widg_miniexpl] tree on the folder containing the project file. - **"Compile project"**: compiles the project using the current configuration. - **"Compile and run project"**: compiles the project using the current configuration and execute the output if the option _binaryKind_ is set to _executable_. @@ -422,10 +422,10 @@ The _source editor widget_ is a standard code editor, specialized for highlighti - folding: curly brackets blocks, multi-line strings, block comments, nested block comments, DDoc comments blocks. - colorization of the following categories: keywords, special keywords, numbers, symbols, comments, assembler instructions and identifiers, DDoc comments. - current identifier markup, selection markup. -- standard keyboard navigation shortcuts CTRL + (SHIFT +) LEFT/RIGHT, CTRL + HOME, CTRL + END etc. -- macro recording and playback using CTRL+SHIFT+R (start/stop recording) or CTRL+SHIFT+P (play). -- synchro-edit (activated when clicking the pen icon located in the gutter, or with the shortcut CTRL+E and CTRL+SHIFT+E). -- zoom: (CTRL+WHEEL, CTRL+MIDDLE MB, CTRL++, CTRL+-, CTRL+.). +- standard keyboard navigation shortcuts CTRL + [SHIFT +] LEFT | RIGHT, CTRL + HOME, CTRL + END etc. +- macro recording and playback using CTRL + SHIFT + R (start or stop recording) or CTRL + SHIFT + P (play). +- synchro-edit (activated when clicking the pen icon located in the gutter, or with the shortcut CTRL + E and CTRL + SHIFT + E). +- zoom: CTRL + WHEEL, CTRL + MIDDLE MB, CTRL + + | - | .. - display cache: for each document, the zoom ratio, the folding state and the caret position are saved between two sessions. A cache file has a fixed life-time of three months from its last modification. - drag & drop editing. - external modification tracking. Each time the focus is put on a document (switch document, show & hide application), Coedit verifies if its time stamp has changed. @@ -507,22 +507,23 @@ The _find and replace_ widget allows to find and replace text patterns in the fo ![](https://raw.githubusercontent.com/BBasile/CoeditWikiData/master/search1.png) -- top field: the pattern to find. -- second field: the expression used as replacement. Only active when **"replace with"** is checked. -- whole word: only search for the whole expression. -- backward: search from the bottom to the top. +- first field: the pattern to find. +- second field: the pattern used as replacement, only active when **"replace with"** is checked. +- whole word: only search for the whole pattern. +- backward: search from the current position to the top. - from cursor: when unchecked, the operation always starts from the top of the document. -- case sensitive: when unchecked, character case is ignored. -- prompt: a confirmation is required to replace an expression. +- case sensitive: when unchecked, the case is ignored. +- prompt: a confirmation is required to replace a match. - allow regex: when checked, the search is performed by a regex engine. -By default CTRL + F is used to pass the current source code editor selection to the top field -and F3 to execute a search. Unless _Find all_ is used, the results are directly visible in the editor. +By default CTRL + F is used to pass the current identifier to the first field and F3 to execute a search. +Unless _Find all_ is used, the results are directly visible in the editor. _Find all_ results are displayed in the [messages widget][lnk_widg_msg] and are clickable. +The scope of _Find all_ can be set, either to the current editor or to the whole project, by clicking the icon at the right. The most recent searches and replacements are saved between each session. -Note that to find a symbol, Ctrl+MB Left or the [symbol list][lnk_widg_symlist] are faster. +Note that to find a symbol, Ctrl + MB Left or the [symbol list][lnk_widg_symlist] are faster. ## Library manager widget @@ -1180,7 +1181,7 @@ as well as the additional source (the _libdparse.lib_). ### Completion and runnable In the **File** menu click **New runnable module**. -type import **std.d** and hit CTRL+SCPACE to invoke the completion. +type import **std.d** and hit CTRL + SCPACE to invoke the completion. [DCD][lnk_dcd], automatically aware of _libdparse_, will propose the item **lexer**, which matches to one of the module of the library (the D language lexer).