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

View File

@ -8,7 +8,7 @@ uses
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, Forms, lazcontrols, runtimetypeinfocontrols, ce_observer, ce_libman, Interfaces, Forms, lazcontrols, runtimetypeinfocontrols, ce_observer, ce_libman,
ce_tools, ce_dcd, ce_main, ce_writableComponent, ce_options, ce_symstring, 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} {$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 inherited CEOptionEditorWidget: TCEOptionEditorWidget
Left = 594 Left = 594
Height = 377 Height = 493
Top = 257 Top = 257
Width = 548 Width = 559
BorderIcons = [biSystemMenu, biMinimize, biMaximize] BorderIcons = [biSystemMenu, biMinimize, biMaximize]
Caption = 'Options editor' Caption = 'Options editor'
ClientHeight = 377 ClientHeight = 493
ClientWidth = 548 ClientWidth = 559
FormStyle = fsSystemStayOnTop FormStyle = fsStayOnTop
inherited Back: TPanel inherited Back: TPanel
Height = 377 Height = 493
Width = 548 Width = 559
ClientHeight = 377 ClientHeight = 493
ClientWidth = 548 ClientWidth = 559
inherited Content: TPanel inherited Content: TPanel
Height = 377 Height = 493
Width = 548 Width = 559
ClientHeight = 377 ClientHeight = 493
ClientWidth = 548 ClientWidth = 559
object pnlBody: TPanel[0] object pnlBody: TPanel[0]
Left = 4 Left = 4
Height = 335 Height = 451
Top = 4 Top = 4
Width = 540 Width = 551
Align = alClient Align = alClient
BorderSpacing.Around = 4 BorderSpacing.Around = 4
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 335 ClientHeight = 451
ClientWidth = 540 ClientWidth = 551
TabOrder = 0 TabOrder = 0
object selCat: TTreeView object selCat: TTreeView
Left = 0 Left = 0
Height = 335 Height = 451
Top = 0 Top = 0
Width = 140 Width = 140
Align = alLeft Align = alLeft
@ -43,19 +43,19 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
end end
object pnlEd: TPanel object pnlEd: TPanel
Left = 146 Left = 146
Height = 335 Height = 451
Top = 0 Top = 0
Width = 394 Width = 405
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 335 ClientHeight = 451
ClientWidth = 394 ClientWidth = 405
TabOrder = 1 TabOrder = 1
object inspector: TTIPropertyGrid object inspector: TTIPropertyGrid
Left = 0 Left = 0
Height = 335 Height = 451
Top = 0 Top = 0
Width = 394 Width = 405
Align = alClient Align = alClient
DefaultValueFont.Color = clWindowText 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] 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 end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 140 Left = 140
Height = 335 Height = 451
Top = 0 Top = 0
Width = 6 Width = 6
end end
@ -77,16 +77,16 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
object pnlFooter: TPanel[1] object pnlFooter: TPanel[1]
Left = 4 Left = 4
Height = 30 Height = 30
Top = 343 Top = 459
Width = 540 Width = 551
Align = alBottom Align = alBottom
BorderSpacing.Around = 4 BorderSpacing.Around = 4
BevelOuter = bvLowered BevelOuter = bvLowered
ClientHeight = 30 ClientHeight = 30
ClientWidth = 540 ClientWidth = 551
TabOrder = 1 TabOrder = 1
object btnCancel: TSpeedButton object btnCancel: TSpeedButton
Left = 473 Left = 484
Height = 24 Height = 24
Hint = 'cancel and revert modifications' Hint = 'cancel and revert modifications'
Top = 3 Top = 3
@ -97,7 +97,7 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
OnClick = btnCancelClick OnClick = btnCancelClick
end end
object btnAccept: TSpeedButton object btnAccept: TSpeedButton
Left = 507 Left = 518
Height = 24 Height = 24
Hint = 'accept modifications' Hint = 'accept modifications'
Top = 3 Top = 3

View File

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