From 045b4fea7abc7a93cdb00e44005c5a27cbb3ee40 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 20 Apr 2015 21:59:46 +0000 Subject: [PATCH] IDE Options: allow to set colors for messages in message window by urgency. git-svn-id: trunk@48789 - --- ide/environmentopts.pp | 31 ++++ ide/etmessageframe.pas | 45 +++-- ide/frames/msgwnd_options.lfm | 333 +++++++++++++++++++++------------- ide/frames/msgwnd_options.pas | 87 ++++++++- ide/lazarusidestrconsts.pas | 16 ++ 5 files changed, 370 insertions(+), 142 deletions(-) diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index ea370c5f52..89b64fe7d2 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -347,6 +347,7 @@ type FMsgViewAlwaysDrawFocused: boolean; FMsgViewFilenameStyle: TMsgWndFileNameStyle; fMsgViewColors: array[TMsgWndColor] of TColor; + fMsgColors: array[TMessageLineUrgency] of TColor; FShowCompileDialog: Boolean; // show dialog during compile FAutoCloseCompileDialog: Boolean; // auto close dialog after succesed compile FMsgViewFilters: TLMsgViewFilters; @@ -429,6 +430,7 @@ type function GetFPDocPaths: string; function GetLazarusDirectory: string; function GetMakeFilename: string; + function GetMsgColors(u: TMessageLineUrgency): TColor; function GetMsgViewColors(c: TMsgWndColor): TColor; function GetTestBuildDirectory: string; procedure SetCompilerFilename(const AValue: string); @@ -441,6 +443,7 @@ type procedure SetDebuggerFilename(AValue: string); procedure SetFPCSourceDirectory(const AValue: string); procedure SetLazarusDirectory(const AValue: string); + procedure SetMsgColors(u: TMessageLineUrgency; AValue: TColor); procedure SetMsgViewColors(c: TMsgWndColor; AValue: TColor); procedure SetParseValue(o: TEnvOptParseType; const NewValue: string); @@ -717,6 +720,7 @@ type write FMsgViewFilenameStyle; property MsgViewColors[c: TMsgWndColor]: TColor read GetMsgViewColors write SetMsgViewColors; property MsgViewFilters: TLMsgViewFilters read FMsgViewFilters; + property MsgColors[u: TMessageLineUrgency]: TColor read GetMsgColors write SetMsgColors; // glyphs property ShowButtonGlyphs: TApplicationShowGlyphs read FShowButtonGlyphs write FShowButtonGlyphs; @@ -759,6 +763,7 @@ const ); function dbgs(o: TEnvOptParseType): string; overload; +function dbgs(u: TMessageLineUrgency): string; overload; implementation @@ -833,12 +838,18 @@ begin Result:=EnvOptParseTypeNames[o]; end; +function dbgs(u: TMessageLineUrgency): string; +begin + WriteStr(Result, u); +end; + { TEnvironmentOptions } constructor TEnvironmentOptions.Create; var o: TEnvOptParseType; c: TMsgWndColor; + u: TMessageLineUrgency; begin inherited Create; for o:=low(FParseValues) to high(FParseValues) do @@ -930,6 +941,8 @@ begin FMsgViewFilenameStyle:=mwfsShort; for c:=low(TMsgWndColor) to high(TMsgWndColor) do fMsgViewColors[c]:=MsgWndDefaultColors[c]; + for u:=low(TMessageLineUrgency) to high(TMessageLineUrgency) do + fMsgColors[u] := clDefault; FMsgViewFilters:=TLMsgViewFilters.Create(nil); // glyphs @@ -1134,6 +1147,7 @@ var EventType: TDBGEventType; NodeName: String; mwc: TMsgWndColor; + u: TMessageLineUrgency; begin Cfg:=nil; try @@ -1389,6 +1403,9 @@ begin for mwc:=low(TMsgWndColor) to high(TMsgWndColor) do fMsgViewColors[mwc]:=XMLConfig.GetValue( Path+'MsgView/Colors/'+MsgWndColorNames[mwc],MsgWndDefaultColors[mwc]); + for u:=low(TMessageLineUrgency) to high(TMessageLineUrgency) do + fMsgColors[u] := XMLConfig.GetValue( + Path+'MsgView/MsgColors/'+dbgs(u),clDefault); MsgViewFilters.LoadFromXMLConfig(XMLConfig,'MsgView/Filters/'); // glyphs @@ -1532,6 +1549,7 @@ var CurLazDir: String; BaseDir: String; mwc: TMsgWndColor; + u: TMessageLineUrgency; begin Cfg:=nil; try @@ -1774,6 +1792,9 @@ begin for mwc:=low(TMsgWndColor) to high(TMsgWndColor) do XMLConfig.SetDeleteValue(Path+'MsgView/Colors/'+MsgWndColorNames[mwc], fMsgViewColors[mwc],MsgWndDefaultColors[mwc]); + for u:=low(TMessageLineUrgency) to high(TMessageLineUrgency) do + XMLConfig.SetDeleteValue(Path+'MsgView/MsgColors/'+dbgs(u), + fMsgColors[u],clDefault); MsgViewFilters.SaveToXMLConfig(XMLConfig,'MsgView/Filters/'); // glyphs @@ -2236,6 +2257,11 @@ begin SetParseValue(eopLazarusDirectory,NewValue); end; +procedure TEnvironmentOptions.SetMsgColors(u: TMessageLineUrgency; AValue: TColor); +begin + fMsgColors[u] := AValue; +end; + procedure TEnvironmentOptions.SetMsgViewColors(c: TMsgWndColor; AValue: TColor); begin fMsgViewColors[c]:=AValue; @@ -2312,6 +2338,11 @@ begin Result:=FParseValues[eopMakeFilename].UnparsedValue; end; +function TEnvironmentOptions.GetMsgColors(u: TMessageLineUrgency): TColor; +begin + Result:=fMsgColors[u]; +end; + function TEnvironmentOptions.GetMsgViewColors(c: TMsgWndColor): TColor; begin Result:=fMsgViewColors[c]; diff --git a/ide/etmessageframe.pas b/ide/etmessageframe.pas index 308a3ca77b..aa192f238f 100644 --- a/ide/etmessageframe.pas +++ b/ide/etmessageframe.pas @@ -1598,9 +1598,9 @@ begin inc(NodeRect.Left,Images.Width+2); end; // message text - col:=TextColor; + col:=UrgencyStyles[Line.Urgency].Color; if col=clDefault then - col:=UrgencyStyles[Line.Urgency].Color; + col:=TextColor; DrawText(NodeRect,GetLineText(Line),IsSelected,col); inc(y,ItemHeight); inc(j); @@ -1629,9 +1629,9 @@ begin if (y+ItemHeight>0) and (y