mirror of https://gitlab.com/basile.b/dexed.git
set visible and persistent the page control options
This commit is contained in:
parent
48a8ea5bb9
commit
23176f8bfd
|
@ -26,8 +26,8 @@ type
|
||||||
property index: integer read getIndex;
|
property index: integer read getIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCEPagesOption = (poPageHistory, poBottomHeader);
|
TCEPageControlOption = (poPageHistory, poBottomHeader);
|
||||||
TCEPagesOptions = set of TCEPagesOption;
|
TCEPageControlOptions = set of TCEPageControlOption;
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ type
|
||||||
fOnChanging: TTabChangingEvent;
|
fOnChanging: TTabChangingEvent;
|
||||||
fSplitter: TSplitter;
|
fSplitter: TSplitter;
|
||||||
fOldSplitPos: integer;
|
fOldSplitPos: integer;
|
||||||
fOptions: TCEPagesOptions;
|
fOptions: TCEPageControlOptions;
|
||||||
fOnDragDrop: TDragDropEvent;
|
fOnDragDrop: TDragDropEvent;
|
||||||
fOnDragOver: TDragOverEvent;
|
fOnDragOver: TDragOverEvent;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ type
|
||||||
|
|
||||||
procedure setOnDragOver(value: TDragOverEvent);
|
procedure setOnDragOver(value: TDragOverEvent);
|
||||||
procedure setOnDragDrop(value: TDragDropEvent);
|
procedure setOnDragDrop(value: TDragDropEvent);
|
||||||
procedure setPagesOptions(value: TCEPagesOptions);
|
procedure setPagesOptions(value: TCEPageControlOptions);
|
||||||
procedure setHeaderPosition(bottom: boolean);
|
procedure setHeaderPosition(bottom: boolean);
|
||||||
|
|
||||||
public
|
public
|
||||||
|
@ -118,7 +118,7 @@ type
|
||||||
property onChanged: TNotifyEvent read fOnChanged write fOnChanged;
|
property onChanged: TNotifyEvent read fOnChanged write fOnChanged;
|
||||||
property onChanging: TTabChangingEvent read fOnChanging write fOnChanging;
|
property onChanging: TTabChangingEvent read fOnChanging write fOnChanging;
|
||||||
|
|
||||||
property options: TCEPagesOptions read fOptions write setPagesOptions default defPagesOpt;
|
property options: TCEPageControlOptions read fOptions write setPagesOptions default defPagesOpt;
|
||||||
|
|
||||||
property OnDragOver read fOnDragOver write setOnDragOver;
|
property OnDragOver read fOnDragOver write setOnDragOver;
|
||||||
property OnDragDrop read fOnDragDrop write setOnDragDrop;
|
property OnDragDrop read fOnDragDrop write setOnDragDrop;
|
||||||
|
@ -263,7 +263,7 @@ begin
|
||||||
fTabs.OnDragDrop:=value;
|
fTabs.OnDragDrop:=value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEPageControl.setPagesOptions(value: TCEPagesOptions);
|
procedure TCEPageControl.setPagesOptions(value: TCEPageControlOptions);
|
||||||
begin
|
begin
|
||||||
if fOptions = value then
|
if fOptions = value then
|
||||||
exit;
|
exit;
|
||||||
|
@ -560,12 +560,12 @@ end;
|
||||||
procedure TCEPageControl.updateButtonsState;
|
procedure TCEPageControl.updateButtonsState;
|
||||||
begin
|
begin
|
||||||
fHeader.DisableAlign;
|
fHeader.DisableAlign;
|
||||||
fCloseBtn.Visible:= pbClose in fButtons;
|
fMoveLeftBtn.Visible := pbMoveLeft in fButtons;
|
||||||
fMoveLeftBtn.Visible:= pbMoveLeft in fButtons;
|
fMoveRightBtn.Visible := pbMoveRight in fButtons;
|
||||||
fCloseBtn.Visible:= pbMoveRight in fButtons;
|
fAddBtn.Visible := pbAdd in fButtons;
|
||||||
fAddBtn.Visible:= pbAdd in fButtons;
|
fCloseBtn.Visible := pbClose in fButtons;
|
||||||
fSplitBtn.Visible:= pbSplit in fButtons;
|
fSplitBtn.Visible := pbSplit in fButtons;
|
||||||
fSplitBtn.Enabled:= fPages.Count > 0;
|
fSplitBtn.Enabled := fPages.Count > 0;
|
||||||
fHeader.EnableAlign;
|
fHeader.EnableAlign;
|
||||||
fCloseBtn.Enabled := fPageIndex <> -1;
|
fCloseBtn.Enabled := fPageIndex <> -1;
|
||||||
fMoveLeftBtn.Enabled := fPageIndex > 0;
|
fMoveLeftBtn.Enabled := fPageIndex > 0;
|
||||||
|
|
|
@ -9,11 +9,31 @@ uses
|
||||||
ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs,
|
ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs,
|
||||||
SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, ce_dialogs,
|
SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, ce_dialogs,
|
||||||
ce_widget, ce_interfaces, ce_synmemo, ce_dlang, ce_common, ce_dcd, ce_observer,
|
ce_widget, ce_interfaces, ce_synmemo, ce_dlang, ce_common, ce_dcd, ce_observer,
|
||||||
ce_sharedres, ce_controls;
|
ce_sharedres, ce_controls, ce_writableComponent;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCEEditorWidget }
|
TCEEditorWidget = class;
|
||||||
|
|
||||||
|
TCEPagesOptions = class(TWritableLfmTextComponent, ICEEditableOptions)
|
||||||
|
private
|
||||||
|
fEditorWidget: TCEEditorWidget;
|
||||||
|
fPageButtons: TCEPageControlButtons;
|
||||||
|
fPageOptions: TCEPageControlOptions;
|
||||||
|
function optionedWantCategory(): string;
|
||||||
|
function optionedWantEditorKind: TOptionEditorKind;
|
||||||
|
function optionedWantContainer: TPersistent;
|
||||||
|
procedure optionedEvent(anEvent: TOptionEditorEvent);
|
||||||
|
function optionedOptionsModified: boolean;
|
||||||
|
published
|
||||||
|
property pageButtons: TCEPageControlButtons read fPageButtons write fPageButtons;
|
||||||
|
property pageOptions: TCEPageControlOptions read fPageOptions write fPageOptions;
|
||||||
|
public
|
||||||
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
procedure AssignTo(Target: TPersistent); override;
|
||||||
|
constructor construct(editorWidg: TCEEditorWidget);
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
TCEEditorWidget = class(TCEWidget, ICEMultiDocObserver, ICEMultiDocHandler, ICEProjectObserver)
|
TCEEditorWidget = class(TCEWidget, ICEMultiDocObserver, ICEMultiDocHandler, ICEProjectObserver)
|
||||||
MenuItem1: TMenuItem;
|
MenuItem1: TMenuItem;
|
||||||
|
@ -59,6 +79,7 @@ type
|
||||||
procedure updateDelayed; override;
|
procedure updateDelayed; override;
|
||||||
procedure updateImperative; override;
|
procedure updateImperative; override;
|
||||||
private
|
private
|
||||||
|
fOptions: TCEPagesOptions;
|
||||||
pageControl: TCEPageControl;
|
pageControl: TCEPageControl;
|
||||||
fKeyChanged: boolean;
|
fKeyChanged: boolean;
|
||||||
fDoc: TCESynMemo;
|
fDoc: TCESynMemo;
|
||||||
|
@ -111,6 +132,82 @@ implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
ce_lcldragdrop;
|
ce_lcldragdrop;
|
||||||
|
const
|
||||||
|
optname = 'editorpages.txt';
|
||||||
|
|
||||||
|
{$REGION TCEPagesOptions -------------------------------------------------------}
|
||||||
|
constructor TCEPagesOptions.construct(editorWidg: TCEEditorWidget);
|
||||||
|
var
|
||||||
|
fname: string;
|
||||||
|
begin
|
||||||
|
fEditorWidget := editorWidg;
|
||||||
|
inherited create(editorWidg);
|
||||||
|
EntitiesConnector.addObserver(self);
|
||||||
|
//
|
||||||
|
fname := getCoeditDocPath + optname;
|
||||||
|
if fname.fileExists then
|
||||||
|
begin
|
||||||
|
loadFromFile(fname);
|
||||||
|
assignTo(fEditorWidget);
|
||||||
|
end
|
||||||
|
else Assign(fEditorWidget);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TCEPagesOptions.Destroy;
|
||||||
|
begin
|
||||||
|
saveToFile(getCoeditDocPath + optname);
|
||||||
|
EntitiesConnector.removeObserver(self);
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEPagesOptions.Assign(Source: TPersistent);
|
||||||
|
begin
|
||||||
|
if Source = fEditorWidget then
|
||||||
|
begin
|
||||||
|
fPageButtons := fEditorWidget.pageControl.buttons;
|
||||||
|
fPageOptions := fEditorWidget.pageControl.options;
|
||||||
|
end
|
||||||
|
else inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEPagesOptions.AssignTo(Target: TPersistent);
|
||||||
|
begin
|
||||||
|
if Target = fEditorWidget then
|
||||||
|
begin
|
||||||
|
fEditorWidget.pageControl.buttons := fPageButtons;
|
||||||
|
fEditorWidget.pageControl.options := fPageOptions;
|
||||||
|
end
|
||||||
|
else inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEPagesOptions.optionedWantCategory(): string;
|
||||||
|
begin
|
||||||
|
exit('Editor pages')
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEPagesOptions.optionedWantEditorKind: TOptionEditorKind;
|
||||||
|
begin
|
||||||
|
exit(oekGeneric);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEPagesOptions.optionedWantContainer: TPersistent;
|
||||||
|
begin
|
||||||
|
exit(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEPagesOptions.optionedEvent(anEvent: TOptionEditorEvent);
|
||||||
|
begin
|
||||||
|
case anEvent of
|
||||||
|
oeeAccept: assignTo(fEditorWidget);
|
||||||
|
oeeCancel: Assign(fEditorWidget);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEPagesOptions.optionedOptionsModified: boolean;
|
||||||
|
begin
|
||||||
|
exit(false);
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION Standard Comp/Obj------------------------------------------------------}
|
{$REGION Standard Comp/Obj------------------------------------------------------}
|
||||||
constructor TCEEditorWidget.create(aOwner: TComponent);
|
constructor TCEEditorWidget.create(aOwner: TComponent);
|
||||||
|
@ -147,6 +244,8 @@ begin
|
||||||
//
|
//
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
EntitiesConnector.addSingleService(self);
|
EntitiesConnector.addSingleService(self);
|
||||||
|
//
|
||||||
|
fOptions:= TCEPagesOptions.construct(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCEEditorWidget.destroy;
|
destructor TCEEditorWidget.destroy;
|
||||||
|
@ -159,6 +258,7 @@ begin
|
||||||
if (PageControl.Pages[i].Controls[0] is TCESynMemo) then
|
if (PageControl.Pages[i].Controls[0] is TCESynMemo) then
|
||||||
PageControl.Pages[i].Controls[0].Free;
|
PageControl.Pages[i].Controls[0].Free;
|
||||||
fTokList.Free;
|
fTokList.Free;
|
||||||
|
fOptions.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue