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

View File

@ -122,7 +122,8 @@ type
mcoAutoOpenFirstError, // when all views stopped, open first error
mcoSrcEditPopupSelect, // when user right clicks on gutter mark,
// 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;
const
@ -1158,7 +1159,9 @@ begin
if FOptions=NewOptions then Exit;
ChangedOptions:=(FOptions-NewOptions)+(NewOptions-FOptions);
FOptions:=NewOptions;
if [mcoShowStats,mcoShowTranslated,mcoShowMessageID,mcoShowMsgIcons]*ChangedOptions<>[] then
if [mcoShowStats,mcoShowTranslated,mcoShowMessageID,mcoShowMsgIcons,
mcoAlwaysDrawFocused]*ChangedOptions<>[]
then
Invalidate;
if Assigned(OnOptionsChanged) then
OnOptionsChanged(Self);
@ -1447,7 +1450,7 @@ var
TextRect:=ARect;
TextRect.Right:=TextRect.Left+Canvas.TextWidth(aTxt)+2;
if IsSelected then begin
if mcsFocused in FStates then
if (mcsFocused in FStates) or (mcoAlwaysDrawFocused in Options) then
Details := ThemeServices.GetElementDetails(ttItemSelected)
else
Details := ThemeServices.GetElementDetails(ttItemSelectedNotFocus);
@ -2382,24 +2385,29 @@ begin
end;
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
BackgroundColor:=EnvironmentOptions.MsgViewColors[mwBackground];
AutoHeaderBackground:=EnvironmentOptions.MsgViewColors[mwAutoHeader];
HeaderBackground[lmvtsRunning]:=EnvironmentOptions.MsgViewColors[mwRunning];
HeaderBackground[lmvtsSuccess]:=EnvironmentOptions.MsgViewColors[mwSuccess];
HeaderBackground[lmvtsFailed]:=EnvironmentOptions.MsgViewColors[mwFailed];
if EnvironmentOptions.MsgViewDblClickJumps then
Options:=Options-[mcoSingleClickOpensFile]
else
Options:=Options+[mcoSingleClickOpensFile];
if EnvironmentOptions.HideMessagesIcons then
Options:=Options-[mcoShowMsgIcons]
else
Options:=Options+[mcoShowMsgIcons];
if EnvironmentOptions.MsgViewShowTranslations then
Options:=Options+[mcoShowTranslated]
else
Options:=Options-[mcoShowTranslated];
NewOptions:=Options;
SetOption(mcoSingleClickOpensFile,not EnvironmentOptions.MsgViewDblClickJumps);
SetOption(mcoShowMsgIcons,not EnvironmentOptions.HideMessagesIcons);
SetOption(mcoShowTranslated,EnvironmentOptions.MsgViewShowTranslations);
SetOption(mcoAlwaysDrawFocused,EnvironmentOptions.MsgViewAlwaysDrawFocused);
Options:=NewOptions;
FilenameStyle:=EnvironmentOptions.MsgViewFilenameStyle;
end;

View File

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

View File

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

View File

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

View File

@ -1227,6 +1227,10 @@ resourcestring
+' Linux Window Managers like Cinnamon do not support this and always show'
+' one button per window.';
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';
lisIDETitleStartsWithProjectName = 'IDE title starts with project name';
lisIDETitleShowsProjectDir = 'IDE title shows project directory';