anchordocking: option to hide headers

git-svn-id: trunk@34746 -
This commit is contained in:
mattias 2012-01-15 12:46:17 +00:00
parent fe6abb4c2e
commit ebb5df5e11
12 changed files with 169 additions and 40 deletions

View File

@ -380,6 +380,7 @@ type
HeaderHint: string;
SplitterWidth: integer;
ScaleOnResize: boolean;
ShowHeader: boolean;
ShowHeaderCaption: boolean;
HideHeaderCaptionFloatingControl: boolean;
AllowDragging: boolean;
@ -423,6 +424,7 @@ type
FRestoreLayouts: TAnchorDockRestoreLayouts;
FRestoring: boolean;
FScaleOnResize: boolean;
FShowHeader: boolean;
FShowHeaderCaption: boolean;
FHideHeaderCaptionFloatingControl: boolean;
FSiteClass: TAnchorDockHostSiteClass;
@ -462,6 +464,7 @@ type
procedure SetHeaderAlignLeft(const AValue: integer);
procedure SetHeaderAlignTop(const AValue: integer);
procedure SetHeaderButtonSize(const AValue: integer);
procedure SetShowHeader(AValue: boolean);
procedure SetShowHeaderCaption(const AValue: boolean);
procedure SetHideHeaderCaptionFloatingControl(const AValue: boolean);
procedure SetSplitterWidth(const AValue: integer);
@ -546,7 +549,8 @@ type
property HeaderHint: string read FHeaderHint write FHeaderHint;
property SplitterWidth: integer read FSplitterWidth write SetSplitterWidth default 4;
property ScaleOnResize: boolean read FScaleOnResize write FScaleOnResize default true; // scale children when resizing a site
property ShowHeaderCaption: boolean read FShowHeaderCaption write SetShowHeaderCaption default true; // set to false to disable showing header captions
property ShowHeader: boolean read FShowHeader write SetShowHeader default true; // set to false to hide all headers
property ShowHeaderCaption: boolean read FShowHeaderCaption write SetShowHeaderCaption default true; // set to false to remove the text in the headers
property HideHeaderCaptionFloatingControl: boolean read FHideHeaderCaptionFloatingControl
write SetHideHeaderCaptionFloatingControl default true;
property OnCreateControl: TADCreateControlEvent read FOnCreateControl write FOnCreateControl;
@ -980,6 +984,7 @@ begin
HeaderAlignLeft:=Config.GetValue('HeaderAlignLeft',120);
SplitterWidth:=Config.GetValue('SplitterWidth',4);
ScaleOnResize:=Config.GetValue('ScaleOnResize',true);
ShowHeader:=Config.GetValue('ShowHeader',true);
ShowHeaderCaption:=Config.GetValue('ShowHeaderCaption',true);
HideHeaderCaptionFloatingControl:=Config.GetValue('HideHeaderCaptionFloatingControl',true);
AllowDragging:=Config.GetValue('AllowDragging',true);
@ -998,6 +1003,7 @@ begin
Config.SetDeleteValue('HeaderAlignLeft',HeaderAlignLeft,120);
Config.SetDeleteValue('SplitterWidth',SplitterWidth,4);
Config.SetDeleteValue('ScaleOnResize',ScaleOnResize,true);
Config.SetDeleteValue('ShowHeader',ShowHeader,true);
Config.SetDeleteValue('ShowHeaderCaption',ShowHeaderCaption,true);
Config.SetDeleteValue('HideHeaderCaptionFloatingControl',HideHeaderCaptionFloatingControl,true);
Config.SetDeleteValue('AllowDragging',AllowDragging,true);
@ -1007,7 +1013,6 @@ end;
function TAnchorDockSettings.IsEqual(Settings: TAnchorDockSettings): boolean;
begin
debugln(['TAnchorDockSettings.IsEqual ',DragTreshold,' ',Settings.DragTreshold]);
Result:=(DragTreshold=Settings.DragTreshold)
and (DockOutsideMargin=Settings.DockOutsideMargin)
and (DockParentMargin=Settings.DockParentMargin)
@ -1017,6 +1022,7 @@ begin
and (HeaderHint=Settings.HeaderHint)
and (SplitterWidth=Settings.SplitterWidth)
and (ScaleOnResize=Settings.ScaleOnResize)
and (ShowHeader=Settings.ShowHeader)
and (ShowHeaderCaption=Settings.ShowHeaderCaption)
and (HideHeaderCaptionFloatingControl=Settings.HideHeaderCaptionFloatingControl)
and (AllowDragging=Settings.AllowDragging)
@ -1707,6 +1713,24 @@ begin
AutoSizeAllHeaders(true);
end;
procedure TAnchorDockMaster.SetShowHeader(AValue: boolean);
var
i: Integer;
Site: TAnchorDockHostSite;
begin
if FShowHeader=AValue then exit;
FShowHeader:=AValue;
for i:=0 to ComponentCount-1 do begin
Site:=TAnchorDockHostSite(Components[i]);
if not (Site is TAnchorDockHostSite) then continue;
if (Site.Header<>nil) then begin
DisableControlAutoSizing(Site);
Site.UpdateHeaderShowing;
end;
end;
EnableAllAutoSizing;
end;
procedure TAnchorDockMaster.SetShowHeaderCaption(const AValue: boolean);
var
i: Integer;
@ -1801,6 +1825,7 @@ begin
FHeaderAlignTop:=80;
HeaderAlignLeft:=120;
FHeaderHint:=adrsDragAndDockC;
FShowHeader:=true;
FShowHeaderCaption:=true;
FHideHeaderCaptionFloatingControl:=true;
FSplitterWidth:=4;
@ -2359,6 +2384,7 @@ begin
HeaderAlignLeft := Settings.HeaderAlignLeft;
SplitterWidth := Settings.SplitterWidth;
ScaleOnResize := Settings.ScaleOnResize;
ShowHeader := Settings.ShowHeader;
ShowHeaderCaption := Settings.ShowHeaderCaption;
HideHeaderCaptionFloatingControl := Settings.HideHeaderCaptionFloatingControl;
AllowDragging := Settings.AllowDragging;
@ -2375,6 +2401,7 @@ begin
Settings.HeaderAlignLeft:=HeaderAlignLeft;
Settings.SplitterWidth:=SplitterWidth;
Settings.ScaleOnResize:=ScaleOnResize;
Settings.ShowHeader:=ShowHeader;
Settings.ShowHeaderCaption:=ShowHeaderCaption;
Settings.HideHeaderCaptionFloatingControl:=HideHeaderCaptionFloatingControl;
Settings.AllowDragging:=AllowDragging;
@ -3736,7 +3763,9 @@ end;
function TAnchorDockHostSite.HeaderNeedsShowing: boolean;
begin
Result:=(SiteType<>adhstLayout) and (not (Parent is TAnchorDockPage));
Result:=(SiteType<>adhstLayout)
and (not (Parent is TAnchorDockPage))
and DockMaster.ShowHeader;
end;
procedure TAnchorDockHostSite.DoClose(var CloseAction: TCloseAction);

View File

@ -10,9 +10,9 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
DesignTop = 222
object DragThresholdLabel: TLabel
Left = 10
Height = 18
Height = 15
Top = 10
Width = 131
Width = 112
Caption = 'DragThresholdLabel'
ParentColor = False
end
@ -21,9 +21,9 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Control = HideHeaderCaptionForFloatingCheckBox
AnchorSideTop.Side = asrBottom
Left = 10
Height = 18
Top = 192
Width = 138
Height = 15
Top = 246
Width = 117
BorderSpacing.Top = 10
Caption = 'HeaderAlignTopLabel'
ParentColor = False
@ -33,9 +33,9 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Control = HeaderAlignTopTrackBar
AnchorSideTop.Side = asrBottom
Left = 10
Height = 18
Top = 245
Width = 141
Height = 15
Top = 311
Width = 119
BorderSpacing.Top = 10
Caption = 'HeaderAlignLeftLabel'
ParentColor = False
@ -45,9 +45,9 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Control = DragThresholdTrackBar
AnchorSideTop.Side = asrBottom
Left = 10
Height = 18
Top = 63
Width = 121
Height = 15
Top = 75
Width = 102
BorderSpacing.Top = 10
Caption = 'SplitterWidthLabel'
ParentColor = False
@ -57,9 +57,9 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Control = SplitterWidthTrackBar
AnchorSideTop.Side = asrBottom
Left = 10
Height = 22
Top = 116
Width = 188
Height = 24
Top = 140
Width = 163
BorderSpacing.Top = 10
Caption = 'ScaleOnResizeCheckBox'
ParentShowHint = False
@ -73,8 +73,8 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 10
Height = 25
Top = 28
Height = 40
Top = 25
Width = 332
Max = 20
OnChange = DragThresholdTrackBarChange
@ -92,8 +92,8 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideRight.Control = DragThresholdTrackBar
AnchorSideRight.Side = asrBottom
Left = 10
Height = 25
Top = 210
Height = 40
Top = 261
Width = 332
Frequency = 10
Max = 150
@ -112,8 +112,8 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideRight.Control = DragThresholdTrackBar
AnchorSideRight.Side = asrBottom
Left = 10
Height = 25
Top = 263
Height = 40
Top = 326
Width = 332
Frequency = 10
Max = 200
@ -132,8 +132,8 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideRight.Control = DragThresholdTrackBar
AnchorSideRight.Side = asrBottom
Left = 10
Height = 25
Top = 81
Height = 40
Top = 90
Width = 332
Min = 1
OnChange = SplitterWidthTrackBarChange
@ -145,12 +145,12 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
end
object ShowHeaderCaptionCheckBox: TCheckBox
AnchorSideLeft.Control = ScaleOnResizeCheckBox
AnchorSideTop.Control = ScaleOnResizeCheckBox
AnchorSideTop.Control = ShowHeaderCheckBox
AnchorSideTop.Side = asrBottom
Left = 10
Height = 22
Top = 138
Width = 225
Height = 24
Top = 188
Width = 193
Caption = 'ShowHeaderCaptionCheckBox'
ParentShowHint = False
ShowHint = True
@ -161,12 +161,25 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Control = ShowHeaderCaptionCheckBox
AnchorSideTop.Side = asrBottom
Left = 10
Height = 22
Top = 160
Width = 294
Height = 24
Top = 212
Width = 249
Caption = 'HideHeaderCaptionForFloatingCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 5
end
object ShowHeaderCheckBox: TCheckBox
AnchorSideLeft.Control = ScaleOnResizeCheckBox
AnchorSideTop.Control = ScaleOnResizeCheckBox
AnchorSideTop.Side = asrBottom
Left = 10
Height = 24
Top = 164
Width = 150
Caption = 'ShowHeaderCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 7
end
end

View File

@ -38,6 +38,10 @@ uses
StdCtrls, ComCtrls, LCLProc, AnchorDocking, AnchorDockStr;
type
TAnchorDockOptionsFlag = (
adofShow_ShowHeader
);
TAnchorDockOptionsFlags = set of TAnchorDockOptionsFlag;
{ TAnchorDockOptionsFrame }
@ -51,6 +55,7 @@ type
HideHeaderCaptionForFloatingCheckBox: TCheckBox;
ScaleOnResizeCheckBox: TCheckBox;
ShowHeaderCaptionCheckBox: TCheckBox;
ShowHeaderCheckBox: TCheckBox;
SplitterWidthLabel: TLabel;
SplitterWidthTrackBar: TTrackBar;
procedure OkClick(Sender: TObject);
@ -59,14 +64,17 @@ type
procedure HeaderAlignTopTrackBarChange(Sender: TObject);
procedure SplitterWidthTrackBarChange(Sender: TObject);
private
FFlags: TAnchorDockOptionsFlags;
FMaster: TAnchorDockMaster;
FSettings: TAnchorDockSettings;
procedure SetFlags(AValue: TAnchorDockOptionsFlags);
procedure SetMaster(const AValue: TAnchorDockMaster);
procedure SetSettings(AValue: TAnchorDockSettings);
procedure UpdateDragThresholdLabel;
procedure UpdateHeaderAlignTopLabel;
procedure UpdateHeaderAlignLeftLabel;
procedure UpdateSplitterWidthLabel;
procedure ApplyFlags;
public
procedure SaveToMaster;
procedure LoadFromMaster;
@ -74,6 +82,7 @@ type
procedure LoadFromSettings(TheSettings: TAnchorDockSettings);
property Master: TAnchorDockMaster read FMaster write SetMaster;
property Settings: TAnchorDockSettings read FSettings write SetSettings;
property Flags: TAnchorDockOptionsFlags read FFlags write SetFlags;
end;
function ShowAnchorDockOptions(ADockMaster: TAnchorDockMaster): TModalResult;
@ -149,6 +158,13 @@ begin
LoadFromMaster;
end;
procedure TAnchorDockOptionsFrame.SetFlags(AValue: TAnchorDockOptionsFlags);
begin
if FFlags=AValue then Exit;
FFlags:=AValue;
ApplyFlags;
end;
procedure TAnchorDockOptionsFrame.SetSettings(AValue: TAnchorDockSettings);
begin
if FSettings=AValue then Exit;
@ -181,6 +197,11 @@ begin
+' ('+IntToStr(SplitterWidthTrackBar.Position)+')';
end;
procedure TAnchorDockOptionsFrame.ApplyFlags;
begin
ShowHeaderCheckBox.Visible:=adofShow_ShowHeader in Flags;
end;
procedure TAnchorDockOptionsFrame.SaveToMaster;
var
CurSettings: TAnchorDockSettings;
@ -210,14 +231,14 @@ end;
procedure TAnchorDockOptionsFrame.SaveToSettings(
TheSettings: TAnchorDockSettings);
begin
TheSettings.DragTreshold := DragThresholdTrackBar.Position;
DebugLn(['TAnchorDockOptionsFrame.SaveToSettings ',TheSettings.DragTreshold,' ',DragThresholdTrackBar.Position]);
TheSettings.HeaderAlignTop := HeaderAlignTopTrackBar.Position;
TheSettings.HeaderAlignLeft := HeaderAlignLeftTrackBar.Position;
TheSettings.SplitterWidth := SplitterWidthTrackBar.Position;
TheSettings.ScaleOnResize := ScaleOnResizeCheckBox.Checked;
TheSettings.ShowHeaderCaption := ShowHeaderCaptionCheckBox.Checked;
TheSettings.HideHeaderCaptionFloatingControl := HideHeaderCaptionForFloatingCheckBox.Checked;
TheSettings.DragTreshold:=DragThresholdTrackBar.Position;
TheSettings.HeaderAlignTop:=HeaderAlignTopTrackBar.Position;
TheSettings.HeaderAlignLeft:=HeaderAlignLeftTrackBar.Position;
TheSettings.SplitterWidth:=SplitterWidthTrackBar.Position;
TheSettings.ScaleOnResize:=ScaleOnResizeCheckBox.Checked;
TheSettings.ShowHeader:=ShowHeaderCheckBox.Checked;
TheSettings.ShowHeaderCaption:=ShowHeaderCaptionCheckBox.Checked;
TheSettings.HideHeaderCaptionFloatingControl:=HideHeaderCaptionForFloatingCheckBox.Checked;
end;
procedure TAnchorDockOptionsFrame.LoadFromSettings(
@ -246,6 +267,11 @@ begin
ScaleOnResizeCheckBox.Hint:=adrsScaleSubSitesWhenASiteIsResized;
ScaleOnResizeCheckBox.Checked:=TheSettings.ScaleOnResize;
ShowHeaderCheckBox.Caption:=adrsShowHeaders;
ShowHeaderCheckBox.Hint:=
adrsEachDockedWindowHasAHeaderThatAllowsDraggingHasACo;
ShowHeaderCheckBox.Checked:=TheSettings.ShowHeader;
ShowHeaderCaptionCheckBox.Caption:=adrsShowHeaderCaptions;
ShowHeaderCaptionCheckBox.Hint:=adrsShowCaptionsOfDockedControlsInTheHeader;
ShowHeaderCaptionCheckBox.Checked:=TheSettings.ShowHeaderCaption;

View File

@ -93,6 +93,10 @@ resourcestring
adrsShowHeaderCaptions = 'Show header captions';
adrsShowCaptionsOfDockedControlsInTheHeader = 'Show captions of docked '
+'controls in the header';
adrsShowHeaders = 'Show headers';
adrsEachDockedWindowHasAHeaderThatAllowsDraggingHasACo = 'Each docked window'
+' has a header that allows dragging, has a context menu with extra layout'
+' functions and shows the caption of the docked window';
adrsNoCaptionsForFloatingSites = 'No captions for floating sites';
adrsHideHeaderCaptionsForSitesWithOnlyOneDockedControl = 'Hide header '
+'captions for sites with only one docked control, as that is already '

View File

@ -575,6 +575,7 @@ begin
OptionsFrame:=TAnchorDockOptionsFrame.Create(Self);
with OptionsFrame do begin
Name:='OptionsFrame';
Flags:=[adofShow_ShowHeader];
end;
end;

View File

@ -85,6 +85,10 @@ msgstr ""
msgid "Duplicate name: "
msgstr "Vícenásobné jméno:"
#: anchordockstr.adrseachdockedwindowhasaheaderthatallowsdragginghasaco
msgid "Each docked window has a header that allows dragging, has a context menu with extra layout functions and shows the caption of the docked window"
msgstr ""
#: anchordockstr.adrsemptyname
msgid "Empty name: "
msgstr "Prázdné jméno:"
@ -237,6 +241,10 @@ msgstr ""
msgid "Show header captions"
msgstr ""
#: anchordockstr.adrsshowheaders
msgid "Show headers"
msgstr ""
#: anchordockstr.adrssplitterthickness
msgid "Splitter thickness"
msgstr "Tloušťka rozdělovače"

View File

@ -85,6 +85,10 @@ msgstr ""
msgid "Duplicate name: "
msgstr ""
#: anchordockstr.adrseachdockedwindowhasaheaderthatallowsdragginghasaco
msgid "Each docked window has a header that allows dragging, has a context menu with extra layout functions and shows the caption of the docked window"
msgstr ""
#: anchordockstr.adrsemptyname
msgid "Empty name: "
msgstr ""
@ -237,6 +241,10 @@ msgstr ""
msgid "Show header captions"
msgstr ""
#: anchordockstr.adrsshowheaders
msgid "Show headers"
msgstr ""
#: anchordockstr.adrssplitterthickness
msgid "Splitter thickness"
msgstr ""

View File

@ -87,6 +87,10 @@ msgstr "Soglia di trascinamento"
msgid "Duplicate name: "
msgstr "Nome duplicato: "
#: anchordockstr.adrseachdockedwindowhasaheaderthatallowsdragginghasaco
msgid "Each docked window has a header that allows dragging, has a context menu with extra layout functions and shows the caption of the docked window"
msgstr ""
#: anchordockstr.adrsemptyname
msgid "Empty name: "
msgstr "Nome vuoto: "
@ -239,6 +243,10 @@ msgstr "Mostra il titolo dei controlli ospiti nell'intestazione"
msgid "Show header captions"
msgstr "Mostra titolo delle intestazioni"
#: anchordockstr.adrsshowheaders
msgid "Show headers"
msgstr ""
#: anchordockstr.adrssplitterthickness
msgid "Splitter thickness"
msgstr "Spessore dello splitter"

View File

@ -77,6 +77,10 @@ msgstr ""
msgid "Duplicate name: "
msgstr ""
#: anchordockstr.adrseachdockedwindowhasaheaderthatallowsdragginghasaco
msgid "Each docked window has a header that allows dragging, has a context menu with extra layout functions and shows the caption of the docked window"
msgstr ""
#: anchordockstr.adrsemptyname
msgid "Empty name: "
msgstr ""
@ -229,6 +233,10 @@ msgstr ""
msgid "Show header captions"
msgstr ""
#: anchordockstr.adrsshowheaders
msgid "Show headers"
msgstr ""
#: anchordockstr.adrssplitterthickness
msgid "Splitter thickness"
msgstr ""

View File

@ -87,6 +87,10 @@ msgstr "Limiar do arraste"
msgid "Duplicate name: "
msgstr "Nome duplicado:"
#: anchordockstr.adrseachdockedwindowhasaheaderthatallowsdragginghasaco
msgid "Each docked window has a header that allows dragging, has a context menu with extra layout functions and shows the caption of the docked window"
msgstr ""
#: anchordockstr.adrsemptyname
msgid "Empty name: "
msgstr "Nome vazio:"
@ -239,6 +243,10 @@ msgstr "Exibir títulos de controles ancorados no cabeçalho"
msgid "Show header captions"
msgstr "Exibir títulos de cabeçalho"
#: anchordockstr.adrsshowheaders
msgid "Show headers"
msgstr ""
#: anchordockstr.adrssplitterthickness
msgid "Splitter thickness"
msgstr "Espessura do \"splitter\""

View File

@ -85,6 +85,10 @@ msgstr "Порог перетаскивания"
msgid "Duplicate name: "
msgstr "Имя уже существует: "
#: anchordockstr.adrseachdockedwindowhasaheaderthatallowsdragginghasaco
msgid "Each docked window has a header that allows dragging, has a context menu with extra layout functions and shows the caption of the docked window"
msgstr ""
#: anchordockstr.adrsemptyname
msgid "Empty name: "
msgstr "Имя пусто: "
@ -237,6 +241,10 @@ msgstr "Показывать названия пристыкованных об
msgid "Show header captions"
msgstr "Показывать названия в заголовках"
#: anchordockstr.adrsshowheaders
msgid "Show headers"
msgstr ""
#: anchordockstr.adrssplitterthickness
msgid "Splitter thickness"
msgstr "Толщина разделителя"

View File

@ -85,6 +85,10 @@ msgstr "Поріг перетягування"
msgid "Duplicate name: "
msgstr "Дубльоване ім'я: "
#: anchordockstr.adrseachdockedwindowhasaheaderthatallowsdragginghasaco
msgid "Each docked window has a header that allows dragging, has a context menu with extra layout functions and shows the caption of the docked window"
msgstr ""
#: anchordockstr.adrsemptyname
msgid "Empty name: "
msgstr "Порожнє ім'я: "
@ -237,6 +241,10 @@ msgstr "Показувати назви пристикованих об'єкті
msgid "Show header captions"
msgstr "Показувати назви в заголовках"
#: anchordockstr.adrsshowheaders
msgid "Show headers"
msgstr ""
#: anchordockstr.adrssplitterthickness
msgid "Splitter thickness"
msgstr "Товщина роздільника"