From f5cfb89d5ea6f24ae9b344bb4907eb24af7321cd Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sat, 12 Dec 2015 20:53:14 +0100 Subject: [PATCH] disabled gdc in CE proj compiler selection --- cegdcldc/cegdcldc.coedit | 24 ------- cegdcldc/main.d | 72 -------------------- cegdcldc/readme.md | 4 -- src/ce_editoroptions.pas | 2 +- src/ce_inspectors.pas | 140 ++++++++++++++++++++++++++++++++++++++- src/ce_main.pas | 8 +++ src/ce_synmemo.pas | 3 - wiki/wiki.txt | 12 +++- 8 files changed, 157 insertions(+), 108 deletions(-) delete mode 100644 cegdcldc/cegdcldc.coedit delete mode 100644 cegdcldc/main.d delete mode 100644 cegdcldc/readme.md diff --git a/cegdcldc/cegdcldc.coedit b/cegdcldc/cegdcldc.coedit deleted file mode 100644 index 828099aa..00000000 --- a/cegdcldc/cegdcldc.coedit +++ /dev/null @@ -1,24 +0,0 @@ -object CurrentProject: TCENativeProject - OptionsCollection = < - item - name = 'default' - outputOptions.boundsCheck = onAlways - pathsOptions.outputFilename = '../bin/cegdcldc' - runOptions.options = [poUsePipes, poStderrToOutPut] - runOptions.parameters.Strings = ( - '-main' - '-gdc' - ) - end - item - name = 'release' - outputOptions.inlining = True - outputOptions.boundsCheck = offAlways - outputOptions.optimizations = True - outputOptions.release = True - end> - Sources.Strings = ( - 'main.d' - ) - ConfigurationIndex = 0 -end diff --git a/cegdcldc/main.d b/cegdcldc/main.d deleted file mode 100644 index 31b64b06..00000000 --- a/cegdcldc/main.d +++ /dev/null @@ -1,72 +0,0 @@ -module cegdcldc; - -import - core.thread, std.stdio, std.process, std.file; - -void convertToGdc(string option, ref string[] options) -{ - // files - if (option.exists) - options ~= option; - // switches - else switch(option) - { - default: break; - case "w": break; - case "wi": break; - } -} - -void convertToLdc2(string option, ref string[] options) -{ - // files - if (option.exists) - options ~= option; - // switches - switch(option) - { - default: break; - case "w": break; - case "wi": break; - } -} - -int main(string[] args) -{ - string[] commandLine = [readln]; - - if (args.length == 1) - return 1; - - if (commandLine[0] != "gdc" && commandLine[0] != "ldc2") - return 2; - - switch(commandLine[0]) - { - case "gdc": - foreach(option; args[1..$]) - convertToGdc(option, commandLine); - break; - case "ldc2": - foreach(option; args[1..$]) - convertToLdc2(option, commandLine); - break; - default: break; - } - - ProcessPipes ppid = pipeProcess(commandLine); - while(true) - { - Thread.sleep(dur!"msecs"(250)); - auto result = tryWait(ppid.pid); - - foreach(line; ppid.stdout.byLine) - stdout.writeln(line); - foreach(line; ppid.stderr.byLine) - stderr.writeln(line); - - if (result.terminated) - return result.status; - } -} - diff --git a/cegdcldc/readme.md b/cegdcldc/readme.md deleted file mode 100644 index f5e87878..00000000 --- a/cegdcldc/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -Coedit Gdc - Ldc -================ - -This small program converts the options of a Coedit project (aka _native project_) to [LDC]() or [GDC]() options. \ No newline at end of file diff --git a/src/ce_editoroptions.pas b/src/ce_editoroptions.pas index 43730942..400de6bc 100644 --- a/src/ce_editoroptions.pas +++ b/src/ce_editoroptions.pas @@ -165,7 +165,7 @@ begin fTxtSyn.Assign(TxtSyn); // fDDocDelay:=200; - fAutoDotDelay:=200; + fAutoDotDelay:=20; fCurrLineAttribs := TSynSelectedColor.Create; fSelAttribs := TSynSelectedColor.Create; fFoldedColor := TSynSelectedColor.Create; diff --git a/src/ce_inspectors.pas b/src/ce_inspectors.pas index c52f4279..8d5e61d2 100644 --- a/src/ce_inspectors.pas +++ b/src/ce_inspectors.pas @@ -5,7 +5,8 @@ unit ce_inspectors; interface uses - Classes, SysUtils, Dialogs, PropEdits, ce_common; + Classes, SysUtils, Dialogs, PropEdits, GraphPropEdits, Graphics, typinfo, + LCLType, ce_common; type @@ -38,8 +39,144 @@ type procedure Edit; override; end; + + TListDrawValueProc = procedure(const CurValue: ansistring; Index: integer; + ACanvas: TCanvas; const ARect:TRect; AState: TPropEditDrawState) of object; + + TCEColorEditor = class(TColorPropertyEditor) + procedure ListDrawValue(const CurValue: ansistring; Index: integer; + ACanvas: TCanvas; const ARect:TRect; AState: TPropEditDrawState); override; + end; + implementation +procedure TCEColorEditor.ListDrawValue(const CurValue: ansistring; Index: integer; + ACanvas: TCanvas; const ARect:TRect; AState: TPropEditDrawState); + + function ColorToBorderColor(AColor: TColorRef): TColor; + type + TColorQuad = record + Red, + Green, + Blue, + Alpha: Byte; + end; + begin + if (TColorQuad(AColor).Red > 192) or + (TColorQuad(AColor).Green > 192) or + (TColorQuad(AColor).Blue > 192) then + Result := clBlack + else + if pedsInEdit in AState then + begin + if pedsSelected in AState then + Result := clWindow + else + Result := TColor(AColor); + end else + begin + if pedsSelected in AState then + Result := clHighlight + else + Result := clWindow; + end; + end; +var + vRight, vBottom: Integer; + vOldPenColor, vOldBrushColor: TColor; + vOldPenStyle: TPenStyle; + noFill: Boolean; + proc: TListDrawValueProc; + Style : TTextStyle; + OldColor : TColor; + rc: TRect; +begin + vRight := (ARect.Bottom - ARect.Top) + ARect.Left - 2; + vBottom:=ARect.Bottom-2; + with ACanvas do + begin + // save off things + vOldPenStyle := Pen.Style; + vOldPenColor := Pen.Color; + vOldBrushColor := Brush.Color; + + // frame things + if pedsInEdit in AState then + begin + if pedsSelected in AState then + Brush.Color := clWindow + else + Brush.Color := ACanvas.Brush.Color; + end + else + begin + if pedsSelected in AState then + Brush.Color := clHighlightText + else + Brush.Color := clWindow; + end; + Pen.Color := Brush.Color; + Pen.Style := psSolid; + FillRect(ARect); + Rectangle(ARect.Left, ARect.Top, vRight, vBottom); + + // set things up and do the work + noFill := CurValue = 'clNone'; + if noFill then + Brush.Color := clWindow + else + Brush.Color := StringToColorDef(CurValue,clNone); + Pen.Color := ColorToBorderColor(ColorToRGB(Brush.Color)); + Rectangle(ARect.Left + 1, ARect.Top + 1, vRight - 1, vBottom - 1); + if noFill then + begin + Line(ARect.Left + 1, ARect.Top + 1, vRight - 2, vBottom - 2); + Line(ARect.Left + 1, vBottom - 2, vRight - 2, ARect.Top + 1); + end; + + // restore the things we twiddled with + Brush.Color := vOldBrushColor; + Pen.Color := vOldPenColor; + Pen.Style := vOldPenStyle; + end; + + //TMethod(proc).Code:= @TPropertyEditor.ListDrawValue; + //TMethod(proc).Data:= self; + //proc(CurValue, Index, ACanvas, Rect(vRight, ARect.Top, ARect.Right, ARect.Bottom),AState); + + rc := Rect(vRight, ARect.Top, ARect.Right, ARect.Bottom); + + FillChar(Style{%H-},SizeOf(Style),0); + With Style do begin + Alignment := taLeftJustify; + Layout := tlCenter; + Opaque := false; + Clipping := True; + ShowPrefix := True; + WordBreak := False; + SingleLine := True; + SystemFont := true; + end; + If (pedsInComboList in AState) and not (pedsInEdit in AState) + then begin + OldColor := ACanvas.Brush.Color; + If pedsSelected in AState then begin + ACanvas.Brush.Color := clHighlight; + ACanvas.Font.Color := clHighlightText; + end + else begin + ACanvas.Brush.Color := clwhite{clWindow}; + ACanvas.Font.Color := clWindowText; + end; + ACanvas.FillRect(rc); + ACanvas.Brush.Color := OldColor; + end; + + ACanvas.TextRect(rc, rc.Left+2, rc.Top, CurValue, Style); + + +end; + function TCECustomPathEditor.GetAttributes: TPropertyAttributes; begin exit( inherited GetAttributes() + [paDialog]); @@ -106,5 +243,6 @@ initialization RegisterPropertyEditor(TypeInfo(TCEPathname), nil, '', TCEPathnameEditor); RegisterPropertyEditor(TypeInfo(TCEFilename), nil, '', TCEfilenameEditor); RegisterPropertyEditor(TypeInfo(TCEEditEvent), nil, '', TCEActionInEditor); + //RegisterPropertyEditor(TypeInfo(TColor), nil, '', TCEColorEditor); end. diff --git a/src/ce_main.pas b/src/ce_main.pas index 20182290..45a1f85b 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -367,6 +367,7 @@ type TCEApplicationOptionsBase = class(TWritableLfmTextComponent) private + fNoGdcWarn: boolean; fFloatingWidgetOnTop: boolean; fReloadLastDocuments: boolean; fMaxRecentProjs: integer; @@ -434,6 +435,13 @@ end; procedure TCEApplicationOptionsBase.setNativeProjecCompiler(value: TCECompiler); begin + if value = gdc then + begin + value := dmd; + if not fNoGdcWarn then + dlgOkInfo('Coedit native projects can not be compiled with GDC'); + fNoGdcWarn := true; + end; ce_nativeproject.setNativeProjectCompiler(value); end; diff --git a/src/ce_synmemo.pas b/src/ce_synmemo.pas index e7a5755d..28002928 100644 --- a/src/ce_synmemo.pas +++ b/src/ce_synmemo.pas @@ -427,9 +427,6 @@ end; {$REGION Standard Obj and Comp -------------------------------------------------} constructor TCESynMemo.Create(aOwner: TComponent); -var - i: integer; - mgr: TSynEditMarkupManager; begin inherited; // diff --git a/wiki/wiki.txt b/wiki/wiki.txt index 72642546..9e9fd8a8 100644 --- a/wiki/wiki.txt +++ b/wiki/wiki.txt @@ -284,6 +284,8 @@ Here are some more or less complex examples which illustrates the project format - the [metad][lnk_metad] meta repository. - the tools written for Coedit: [cesyms][lnk_cesyms] and [cetodo][lnk_cetodo]. +Even if designed upon _DMD_ options, it's also possible to compile a CE project using [LDC][https://github.com/ldc-developers/ldc]. To do so, the application option _Native project compiler_ must be set accordingly. + # DUB projects. Since the version 2 alpha 1, Coedit also handles DUB projects (JSON descriptions only). @@ -468,16 +470,19 @@ 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 expression to find. Note that it can be a regular expression. +- 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. - 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. +- 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. +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 most recent searches and replacements are saved between each session. Note that to find a symbol, Ctrl+MB Right or the [symbol list][lnk_widg_symlist] are faster. @@ -700,7 +705,8 @@ The DUB project editor is widget is divided in two panels: ![](https://raw.githubusercontent.com/BBasile/CoeditWikiData/master/dub_inspect.png) -The first panel displays the sources list and the combination of _each build type_ with each _build configuration_. Sources can be opened in a new editor by double cliking. To select a configuration defines which type and which configuration will be build by DUB when clicking _compile_ in the _project_ menu. +The first panel displays the sources list and the combination of _each build type_ with each _build configuration_. Sources can be opened in a new editor by double clicking. To select a configuration defines which type and which configuration will be build by DUB when clicking _compile_ in the _project_ menu. +Note that it's possible to specify which compiler DUB uses in the application options _dubCompiler_. ### Editor