IDE: messages: added option always draw selection focused

git-svn-id: trunk@45402 -
This commit is contained in:
mattias 2014-06-08 14:19:29 +00:00
parent 3c98dd7469
commit 3328deb1f8
6 changed files with 64 additions and 19 deletions

View File

@ -351,6 +351,7 @@ type
FHideMessagesIcons: boolean; FHideMessagesIcons: boolean;
FMsgViewStayOnTop: boolean; FMsgViewStayOnTop: boolean;
FMsgViewShowTranslations: boolean; FMsgViewShowTranslations: boolean;
FMsgViewAlwaysDrawFocused: boolean;
FMsgViewFilenameStyle: TMsgWndFileNameStyle; FMsgViewFilenameStyle: TMsgWndFileNameStyle;
fMsgViewColors: array[TMsgWndColor] of TColor; fMsgViewColors: array[TMsgWndColor] of TColor;
FShowCompileDialog: Boolean; // show dialog during compile FShowCompileDialog: Boolean; // show dialog during compile
@ -738,6 +739,8 @@ type
property MsgViewStayOnTop: boolean read FMsgViewStayOnTop write FMsgViewStayOnTop; property MsgViewStayOnTop: boolean read FMsgViewStayOnTop write FMsgViewStayOnTop;
property MsgViewShowTranslations: boolean read FMsgViewShowTranslations property MsgViewShowTranslations: boolean read FMsgViewShowTranslations
write FMsgViewShowTranslations; write FMsgViewShowTranslations;
property MsgViewAlwaysDrawFocused: boolean read FMsgViewAlwaysDrawFocused
write FMsgViewAlwaysDrawFocused;
property MsgViewFilenameStyle: TMsgWndFileNameStyle read FMsgViewFilenameStyle property MsgViewFilenameStyle: TMsgWndFileNameStyle read FMsgViewFilenameStyle
write FMsgViewFilenameStyle; write FMsgViewFilenameStyle;
property MsgViewColors[c: TMsgWndColor]: TColor read GetMsgViewColors write SetMsgViewColors; property MsgViewColors[c: TMsgWndColor]: TColor read GetMsgViewColors write SetMsgViewColors;
@ -987,6 +990,7 @@ begin
FHideMessagesIcons:=false; FHideMessagesIcons:=false;
FMsgViewStayOnTop:=false; FMsgViewStayOnTop:=false;
FMsgViewShowTranslations:=false; FMsgViewShowTranslations:=false;
FMsgViewAlwaysDrawFocused:=false;
FMsgViewFilenameStyle:=mwfsShort; FMsgViewFilenameStyle:=mwfsShort;
for c:=low(TMsgWndColor) to high(TMsgWndColor) do for c:=low(TMsgWndColor) to high(TMsgWndColor) do
fMsgViewColors[c]:=MsgWndDefaultColors[c]; fMsgViewColors[c]:=MsgWndDefaultColors[c];
@ -1447,6 +1451,8 @@ begin
Path+'MsgView/StayOnTop/Value',false); Path+'MsgView/StayOnTop/Value',false);
FMsgViewShowTranslations:=XMLConfig.GetValue( FMsgViewShowTranslations:=XMLConfig.GetValue(
Path+'MsgView/ShowTranslations/Value',false); Path+'MsgView/ShowTranslations/Value',false);
FMsgViewAlwaysDrawFocused:=XMLConfig.GetValue(
Path+'MsgView/AlwaysDrawFocused/Value',false);
FMsgViewFilenameStyle:=StrToMsgWndFilenameStyle(XMLConfig.GetValue( FMsgViewFilenameStyle:=StrToMsgWndFilenameStyle(XMLConfig.GetValue(
Path+'MsgView/Filename/Style',MsgWndFileNameStyleNames[mwfsShort])); Path+'MsgView/Filename/Style',MsgWndFileNameStyleNames[mwfsShort]));
for mwc:=low(TMsgWndColor) to high(TMsgWndColor) do for mwc:=low(TMsgWndColor) to high(TMsgWndColor) do
@ -1830,6 +1836,8 @@ begin
Path+'MsgView/StayOnTop/Value',FMsgViewStayOnTop,false); Path+'MsgView/StayOnTop/Value',FMsgViewStayOnTop,false);
XMLConfig.SetDeleteValue( XMLConfig.SetDeleteValue(
Path+'MsgView/ShowTranslations/Value',FMsgViewShowTranslations,false); Path+'MsgView/ShowTranslations/Value',FMsgViewShowTranslations,false);
XMLConfig.SetDeleteValue(
Path+'MsgView/AlwaysDrawFocused/Value',FMsgViewAlwaysDrawFocused,false);
XMLConfig.SetDeleteValue(Path+'MsgView/Filename/Style', XMLConfig.SetDeleteValue(Path+'MsgView/Filename/Style',
MsgWndFileNameStyleNames[FMsgViewFilenameStyle], MsgWndFileNameStyleNames[FMsgViewFilenameStyle],
MsgWndFileNameStyleNames[mwfsShort]); MsgWndFileNameStyleNames[mwfsShort]);

View File

@ -122,7 +122,8 @@ type
mcoAutoOpenFirstError, // when all views stopped, open first error mcoAutoOpenFirstError, // when all views stopped, open first error
mcoSrcEditPopupSelect, // when user right clicks on gutter mark, mcoSrcEditPopupSelect, // when user right clicks on gutter mark,
// scroll and select message of the quickfixes // scroll and select message of the quickfixes
mcoWndStayOnTop // use fsStayOnTop mcoWndStayOnTop, // use fsStayOnTop
mcoAlwaysDrawFocused // draw selected item as focused, even if the window is not
); );
TMsgCtrlOptions = set of TMsgCtrlOption; TMsgCtrlOptions = set of TMsgCtrlOption;
const const
@ -1158,7 +1159,9 @@ begin
if FOptions=NewOptions then Exit; if FOptions=NewOptions then Exit;
ChangedOptions:=(FOptions-NewOptions)+(NewOptions-FOptions); ChangedOptions:=(FOptions-NewOptions)+(NewOptions-FOptions);
FOptions:=NewOptions; FOptions:=NewOptions;
if [mcoShowStats,mcoShowTranslated,mcoShowMessageID,mcoShowMsgIcons]*ChangedOptions<>[] then if [mcoShowStats,mcoShowTranslated,mcoShowMessageID,mcoShowMsgIcons,
mcoAlwaysDrawFocused]*ChangedOptions<>[]
then
Invalidate; Invalidate;
if Assigned(OnOptionsChanged) then if Assigned(OnOptionsChanged) then
OnOptionsChanged(Self); OnOptionsChanged(Self);
@ -1447,7 +1450,7 @@ var
TextRect:=ARect; TextRect:=ARect;
TextRect.Right:=TextRect.Left+Canvas.TextWidth(aTxt)+2; TextRect.Right:=TextRect.Left+Canvas.TextWidth(aTxt)+2;
if IsSelected then begin if IsSelected then begin
if mcsFocused in FStates then if (mcsFocused in FStates) or (mcoAlwaysDrawFocused in Options) then
Details := ThemeServices.GetElementDetails(ttItemSelected) Details := ThemeServices.GetElementDetails(ttItemSelected)
else else
Details := ThemeServices.GetElementDetails(ttItemSelectedNotFocus); Details := ThemeServices.GetElementDetails(ttItemSelectedNotFocus);
@ -2382,24 +2385,29 @@ begin
end; end;
procedure TMessagesCtrl.ApplyEnvironmentOptions; procedure TMessagesCtrl.ApplyEnvironmentOptions;
var
NewOptions: TMsgCtrlOptions;
procedure SetOption(Option: TMsgCtrlOption; State: boolean);
begin
if State then
NewOptions:=NewOptions+[Option]
else
NewOptions:=NewOptions-[Option];
end;
begin begin
BackgroundColor:=EnvironmentOptions.MsgViewColors[mwBackground]; BackgroundColor:=EnvironmentOptions.MsgViewColors[mwBackground];
AutoHeaderBackground:=EnvironmentOptions.MsgViewColors[mwAutoHeader]; AutoHeaderBackground:=EnvironmentOptions.MsgViewColors[mwAutoHeader];
HeaderBackground[lmvtsRunning]:=EnvironmentOptions.MsgViewColors[mwRunning]; HeaderBackground[lmvtsRunning]:=EnvironmentOptions.MsgViewColors[mwRunning];
HeaderBackground[lmvtsSuccess]:=EnvironmentOptions.MsgViewColors[mwSuccess]; HeaderBackground[lmvtsSuccess]:=EnvironmentOptions.MsgViewColors[mwSuccess];
HeaderBackground[lmvtsFailed]:=EnvironmentOptions.MsgViewColors[mwFailed]; HeaderBackground[lmvtsFailed]:=EnvironmentOptions.MsgViewColors[mwFailed];
if EnvironmentOptions.MsgViewDblClickJumps then NewOptions:=Options;
Options:=Options-[mcoSingleClickOpensFile] SetOption(mcoSingleClickOpensFile,not EnvironmentOptions.MsgViewDblClickJumps);
else SetOption(mcoShowMsgIcons,not EnvironmentOptions.HideMessagesIcons);
Options:=Options+[mcoSingleClickOpensFile]; SetOption(mcoShowTranslated,EnvironmentOptions.MsgViewShowTranslations);
if EnvironmentOptions.HideMessagesIcons then SetOption(mcoAlwaysDrawFocused,EnvironmentOptions.MsgViewAlwaysDrawFocused);
Options:=Options-[mcoShowMsgIcons] Options:=NewOptions;
else
Options:=Options+[mcoShowMsgIcons];
if EnvironmentOptions.MsgViewShowTranslations then
Options:=Options+[mcoShowTranslated]
else
Options:=Options-[mcoShowTranslated];
FilenameStyle:=EnvironmentOptions.MsgViewFilenameStyle; FilenameStyle:=EnvironmentOptions.MsgViewFilenameStyle;
end; end;

View File

@ -131,7 +131,7 @@ type
procedure Delete(Index: integer); procedure Delete(Index: integer);
procedure Move(CurIndex, NewIndex: integer); procedure Move(CurIndex, NewIndex: integer);
// run // run
function Run(Index: integer; ShowAbort: boolean): TModalResult; function Run(Index: integer; {%H-}ShowAbort: boolean): TModalResult;
// load/save // load/save
function Load(Config: TConfigStorage): TModalResult; function Load(Config: TConfigStorage): TModalResult;
function Load(Config: TConfigStorage; const Path: string): TModalResult; function Load(Config: TConfigStorage; const Path: string): TModalResult;

View File

@ -142,18 +142,22 @@ object MsgWndOptionsFrame: TMsgWndOptionsFrame
Width = 154 Width = 154
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'MWHideIconsCheckBox' Caption = 'MWHideIconsCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 1 TabOrder = 1
end end
object MWDblClickJumpsCheckBox: TCheckBox object MWDblClickJumpsCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = MWHideIconsCheckBox AnchorSideTop.Control = MWAlwaysDrawFocusedCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 24 Height = 24
Top = 223 Top = 247
Width = 180 Width = 180
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'MWDblClickJumpsCheckBox' Caption = 'MWDblClickJumpsCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 2 TabOrder = 2
end end
object MWFocusCheckBox: TCheckBox object MWFocusCheckBox: TCheckBox
@ -162,10 +166,25 @@ object MsgWndOptionsFrame: TMsgWndOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 24 Height = 24
Top = 247 Top = 271
Width = 132 Width = 132
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'MWFocusCheckBox' Caption = 'MWFocusCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 3 TabOrder = 3
end end
object MWAlwaysDrawFocusedCheckBox: TCheckBox
AnchorSideLeft.Control = MWHideIconsCheckBox
AnchorSideTop.Control = MWHideIconsCheckBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 223
Width = 212
Caption = 'MWAlwaysDrawFocusedCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 4
end
end end

View File

@ -39,6 +39,7 @@ type
{ TMsgWndOptionsFrame } { TMsgWndOptionsFrame }
TMsgWndOptionsFrame = class(TAbstractIDEOptionsEditor) TMsgWndOptionsFrame = class(TAbstractIDEOptionsEditor)
MWAlwaysDrawFocusedCheckBox: TCheckBox;
MWDblClickJumpsCheckBox: TCheckBox; MWDblClickJumpsCheckBox: TCheckBox;
MWFocusCheckBox: TCheckBox; MWFocusCheckBox: TCheckBox;
MWHideIconsCheckBox: TCheckBox; MWHideIconsCheckBox: TCheckBox;
@ -149,6 +150,9 @@ begin
MWSetDefaultColorsButton.Caption:=lisLazarusDefault; MWSetDefaultColorsButton.Caption:=lisLazarusDefault;
MWSetEditorColorsButton.Caption:=lisEditorColors; MWSetEditorColorsButton.Caption:=lisEditorColors;
MWHideIconsCheckBox.Caption := dlgHideMessagesIcons; MWHideIconsCheckBox.Caption := dlgHideMessagesIcons;
MWAlwaysDrawFocusedCheckBox.Caption:=lisAlwaysDrawSelectedItemsFocused;
MWAlwaysDrawFocusedCheckBox.Hint:=
lisDrawTheSelectionFocusedEvenIfTheMessagesWindowHasN;
MWDblClickJumpsCheckBox.Caption:=lisEnvJumpFromMessageToSrcOnDblClickOtherwiseSingleClick; MWDblClickJumpsCheckBox.Caption:=lisEnvJumpFromMessageToSrcOnDblClickOtherwiseSingleClick;
MWFocusCheckBox.Caption:=dlgEOFocusMessagesAfterCompilation; MWFocusCheckBox.Caption:=dlgEOFocusMessagesAfterCompilation;
end; end;
@ -178,6 +182,7 @@ begin
for c in TMsgWndColor do for c in TMsgWndColor do
MWColorListBox.Colors[ord(c)] := o.MsgViewColors[c]; MWColorListBox.Colors[ord(c)] := o.MsgViewColors[c];
MWHideIconsCheckBox.Checked := o.HideMessagesIcons; MWHideIconsCheckBox.Checked := o.HideMessagesIcons;
MWAlwaysDrawFocusedCheckBox.Checked := o.MsgViewAlwaysDrawFocused;
MWDblClickJumpsCheckBox.Checked:=o.MsgViewDblClickJumps; MWDblClickJumpsCheckBox.Checked:=o.MsgViewDblClickJumps;
MWFocusCheckBox.Checked:=o.MsgViewFocus; MWFocusCheckBox.Checked:=o.MsgViewFocus;
@ -193,6 +198,7 @@ begin
for c in TMsgWndColor do for c in TMsgWndColor do
o.MsgViewColors[c] := MWColorListBox.Colors[ord(c)]; o.MsgViewColors[c] := MWColorListBox.Colors[ord(c)];
o.HideMessagesIcons := MWHideIconsCheckBox.Checked; o.HideMessagesIcons := MWHideIconsCheckBox.Checked;
o.MsgViewAlwaysDrawFocused := MWAlwaysDrawFocusedCheckBox.Checked;
o.MsgViewDblClickJumps := MWDblClickJumpsCheckBox.Checked; o.MsgViewDblClickJumps := MWDblClickJumpsCheckBox.Checked;
o.MsgViewFocus := MWFocusCheckBox.Checked; o.MsgViewFocus := MWFocusCheckBox.Checked;
end; end;

View File

@ -1227,6 +1227,10 @@ resourcestring
+' Linux Window Managers like Cinnamon do not support this and always show' +' Linux Window Managers like Cinnamon do not support this and always show'
+' one button per window.'; +' one button per window.';
dlgHideMessagesIcons = 'Hide Messages Icons'; dlgHideMessagesIcons = 'Hide Messages Icons';
lisAlwaysDrawSelectedItemsFocused = 'Always draw selected items focused';
lisDrawTheSelectionFocusedEvenIfTheMessagesWindowHasN = 'Draw the selection '
+'focused, even if the Messages window has no focus. Use this if your '
+'theme has a hardly visible unfocused drawing.';
lisEditorColors = 'Editor Colors'; lisEditorColors = 'Editor Colors';
lisIDETitleStartsWithProjectName = 'IDE title starts with project name'; lisIDETitleStartsWithProjectName = 'IDE title starts with project name';
lisIDETitleShowsProjectDir = 'IDE title shows project directory'; lisIDETitleShowsProjectDir = 'IDE title shows project directory';