added option editor for the docking

This commit is contained in:
Basile Burg 2015-02-21 01:49:16 +01:00
parent c12df7d39e
commit 55ce01af2d
5 changed files with 159 additions and 33 deletions

View File

@ -140,7 +140,7 @@
<PackageName Value="LCL"/>
</Item6>
</RequiredPackages>
<Units Count="35">
<Units Count="36">
<Unit0>
<Filename Value="coedit.lpr"/>
<IsPartOfProject Value="True"/>
@ -361,6 +361,11 @@
<IsPartOfProject Value="True"/>
<UnitName Value="ce_editoroptions"/>
</Unit34>
<Unit35>
<Filename Value="..\src\ce_dockoptions.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_dockoptions"/>
</Unit35>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -8,7 +8,7 @@ uses
{$ENDIF}{$ENDIF}
Interfaces, Forms, lazcontrols, runtimetypeinfocontrols, ce_observer, ce_libman,
ce_tools, ce_dcd, ce_main, ce_writableComponent, ce_options, ce_symstring,
ce_staticmacro, ce_inspectors, LResources, ce_editoroptions;
ce_staticmacro, ce_inspectors, LResources, ce_editoroptions, ce_dockoptions;
{$R *.res}

120
src/ce_dockoptions.pas Normal file
View File

@ -0,0 +1,120 @@
unit ce_dockoptions;
{$I ce_defines.inc}
interface
uses
Classes, SysUtils, AnchorDocking, AnchorDockOptionsDlg, XMLPropStorage, AnchorDockStr,
ce_observer, ce_interfaces;
type
(**
* The option frame to edit the docking option, displayed in the option form.
*)
TEditableAnchorDockOptions = class(TAnchorDockOptionsFrame, ICEEditableOptions)
private
fBackup: TXMLConfigStorage;
function optionedWantCategory(): string;
function optionedWantEditorKind: TOptionEditorKind;
function optionedWantContainer: TPersistent;
procedure optionedEvent(anEvent: TOptionEditorEvent);
procedure doChanged(Sender: TObject);
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
end;
implementation
var
DockOptionsEditor: TEditableAnchorDockOptions;
constructor TEditableAnchorDockOptions.Create(TheOwner: TComponent);
begin
inherited;
fBackup := TXMLConfigStorage.Create('',false);
Master := AnchorDocking.DockMaster;
//
HeaderAlignLeftTrackBar.OnChange := @doChanged;
HeaderAlignTopTrackBar.OnChange := @doChanged;
DragThresholdTrackBar.OnChange := @doChanged;
SplitterWidthTrackBar.OnChange := @doChanged;
//
FlattenHeaders.OnChange := @doChanged;
FilledHeaders.OnChange := @doChanged;
HideHeaderCaptionForFloatingCheckBox.OnChange := @doChanged;
ScaleOnResizeCheckBox.OnChange := @doChanged;
ShowHeaderCaptionCheckBox.OnChange := @doChanged;
ShowHeaderCheckBox.OnChange := @doChanged;
//
HeaderStyleComboBox.OnChange:= @doChanged;
//
EntitiesConnector.addObserver(self);
end;
destructor TEditableAnchorDockOptions.Destroy;
begin
fBackup.Free;
inherited;
end;
function TEditableAnchorDockOptions.optionedWantCategory(): string;
begin
exit('Docking')
end;
function TEditableAnchorDockOptions.optionedWantEditorKind: TOptionEditorKind;
begin
exit(oekForm);
end;
function TEditableAnchorDockOptions.optionedWantContainer: TPersistent;
begin
fBackup.Clear;
DockMaster.SaveSettingsToConfig(fBackup);
LoadFromMaster;
exit(self);
end;
procedure TEditableAnchorDockOptions.optionedEvent(anEvent: TOptionEditorEvent);
begin
// restores
if anEvent = oeeCancel then
begin
DockMaster.LoadSettingsFromConfig(fBackup);
LoadFromMaster;
fBackup.Clear;
DockMaster.SaveSettingsToConfig(fBackup);
end;
// accept and new backup
if anEvent = oeeAccept then
begin
SaveToMaster;
fBackup.Clear;
DockMaster.SaveSettingsToConfig(fBackup);
end;
end;
procedure TEditableAnchorDockOptions.doChanged(Sender: TObject);
begin
DragThresholdLabel.Caption:=adrsDragThreshold +
' ('+IntToStr(DragThresholdTrackBar.Position)+')';
HeaderAlignTopLabel.Caption:=adrsHeaderAlignTop +
' ('+IntToStr(HeaderAlignTopTrackBar.Position) +')';
HeaderAlignLeftLabel.Caption:=adrsHeaderAlignLeft +
' ('+IntToStr(HeaderAlignLeftTrackBar.Position) +')';
SplitterWidthLabel.Caption:=adrsSplitterWidth +
' ('+IntToStr(SplitterWidthTrackBar.Position) +')';
ShowHeaderCheckBox.Visible:=adofShow_ShowHeader in Flags;
//
SaveToMaster;
end;
initialization
DockOptionsEditor := TEditableAnchorDockOptions.create(nil);
finalization
DockOptionsEditor.free;
end.

View File

@ -1,37 +1,37 @@
inherited CEOptionEditorWidget: TCEOptionEditorWidget
Left = 594
Height = 377
Height = 493
Top = 257
Width = 548
Width = 559
BorderIcons = [biSystemMenu, biMinimize, biMaximize]
Caption = 'Options editor'
ClientHeight = 377
ClientWidth = 548
FormStyle = fsSystemStayOnTop
ClientHeight = 493
ClientWidth = 559
FormStyle = fsStayOnTop
inherited Back: TPanel
Height = 377
Width = 548
ClientHeight = 377
ClientWidth = 548
Height = 493
Width = 559
ClientHeight = 493
ClientWidth = 559
inherited Content: TPanel
Height = 377
Width = 548
ClientHeight = 377
ClientWidth = 548
Height = 493
Width = 559
ClientHeight = 493
ClientWidth = 559
object pnlBody: TPanel[0]
Left = 4
Height = 335
Height = 451
Top = 4
Width = 540
Width = 551
Align = alClient
BorderSpacing.Around = 4
BevelOuter = bvNone
ClientHeight = 335
ClientWidth = 540
ClientHeight = 451
ClientWidth = 551
TabOrder = 0
object selCat: TTreeView
Left = 0
Height = 335
Height = 451
Top = 0
Width = 140
Align = alLeft
@ -43,19 +43,19 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
end
object pnlEd: TPanel
Left = 146
Height = 335
Height = 451
Top = 0
Width = 394
Width = 405
Align = alClient
BevelOuter = bvNone
ClientHeight = 335
ClientWidth = 394
ClientHeight = 451
ClientWidth = 405
TabOrder = 1
object inspector: TTIPropertyGrid
Left = 0
Height = 335
Height = 451
Top = 0
Width = 394
Width = 405
Align = alClient
DefaultValueFont.Color = clWindowText
Filter = [tkInteger, tkChar, tkEnumeration, tkFloat, tkSet, tkMethod, tkSString, tkLString, tkAString, tkWString, tkVariant, tkArray, tkRecord, tkInterface, tkClass, tkObject, tkWChar, tkBool, tkInt64, tkQWord, tkDynArray, tkInterfaceRaw, tkProcVar, tkUString, tkUChar, tkHelper]
@ -69,7 +69,7 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
end
object Splitter1: TSplitter
Left = 140
Height = 335
Height = 451
Top = 0
Width = 6
end
@ -77,16 +77,16 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
object pnlFooter: TPanel[1]
Left = 4
Height = 30
Top = 343
Width = 540
Top = 459
Width = 551
Align = alBottom
BorderSpacing.Around = 4
BevelOuter = bvLowered
ClientHeight = 30
ClientWidth = 540
ClientWidth = 551
TabOrder = 1
object btnCancel: TSpeedButton
Left = 473
Left = 484
Height = 24
Hint = 'cancel and revert modifications'
Top = 3
@ -97,7 +97,7 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
OnClick = btnCancelClick
end
object btnAccept: TSpeedButton
Left = 507
Left = 518
Height = 24
Hint = 'accept modifications'
Top = 3

View File

@ -123,7 +123,8 @@ begin
begin
TForm(dt^.container).Parent := pnlEd;
TForm(dt^.container).Align := alClient;
TForm(dt^.container).BorderStyle:= bsNone;
//TForm(dt^.container).BorderIcons:= [];
//TForm(dt^.container).BorderStyle:= bsNone;
end;
oekGeneric:
begin