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;
|
||||
end;
|
||||
|
||||
TCEPagesOption = (poPageHistory, poBottomHeader);
|
||||
TCEPagesOptions = set of TCEPagesOption;
|
||||
TCEPageControlOption = (poPageHistory, poBottomHeader);
|
||||
TCEPageControlOptions = set of TCEPageControlOption;
|
||||
|
||||
const
|
||||
|
||||
|
@ -62,7 +62,7 @@ type
|
|||
fOnChanging: TTabChangingEvent;
|
||||
fSplitter: TSplitter;
|
||||
fOldSplitPos: integer;
|
||||
fOptions: TCEPagesOptions;
|
||||
fOptions: TCEPageControlOptions;
|
||||
fOnDragDrop: TDragDropEvent;
|
||||
fOnDragOver: TDragOverEvent;
|
||||
|
||||
|
@ -89,7 +89,7 @@ type
|
|||
|
||||
procedure setOnDragOver(value: TDragOverEvent);
|
||||
procedure setOnDragDrop(value: TDragDropEvent);
|
||||
procedure setPagesOptions(value: TCEPagesOptions);
|
||||
procedure setPagesOptions(value: TCEPageControlOptions);
|
||||
procedure setHeaderPosition(bottom: boolean);
|
||||
|
||||
public
|
||||
|
@ -118,7 +118,7 @@ type
|
|||
property onChanged: TNotifyEvent read fOnChanged write fOnChanged;
|
||||
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 OnDragDrop read fOnDragDrop write setOnDragDrop;
|
||||
|
@ -263,7 +263,7 @@ begin
|
|||
fTabs.OnDragDrop:=value;
|
||||
end;
|
||||
|
||||
procedure TCEPageControl.setPagesOptions(value: TCEPagesOptions);
|
||||
procedure TCEPageControl.setPagesOptions(value: TCEPageControlOptions);
|
||||
begin
|
||||
if fOptions = value then
|
||||
exit;
|
||||
|
@ -560,12 +560,12 @@ end;
|
|||
procedure TCEPageControl.updateButtonsState;
|
||||
begin
|
||||
fHeader.DisableAlign;
|
||||
fCloseBtn.Visible:= pbClose in fButtons;
|
||||
fMoveLeftBtn.Visible:= pbMoveLeft in fButtons;
|
||||
fCloseBtn.Visible:= pbMoveRight in fButtons;
|
||||
fAddBtn.Visible:= pbAdd in fButtons;
|
||||
fSplitBtn.Visible:= pbSplit in fButtons;
|
||||
fSplitBtn.Enabled:= fPages.Count > 0;
|
||||
fMoveLeftBtn.Visible := pbMoveLeft in fButtons;
|
||||
fMoveRightBtn.Visible := pbMoveRight in fButtons;
|
||||
fAddBtn.Visible := pbAdd in fButtons;
|
||||
fCloseBtn.Visible := pbClose in fButtons;
|
||||
fSplitBtn.Visible := pbSplit in fButtons;
|
||||
fSplitBtn.Enabled := fPages.Count > 0;
|
||||
fHeader.EnableAlign;
|
||||
fCloseBtn.Enabled := fPageIndex <> -1;
|
||||
fMoveLeftBtn.Enabled := fPageIndex > 0;
|
||||
|
|
|
@ -9,11 +9,31 @@ uses
|
|||
ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs,
|
||||
SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, ce_dialogs,
|
||||
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
|
||||
|
||||
{ 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)
|
||||
MenuItem1: TMenuItem;
|
||||
|
@ -59,6 +79,7 @@ type
|
|||
procedure updateDelayed; override;
|
||||
procedure updateImperative; override;
|
||||
private
|
||||
fOptions: TCEPagesOptions;
|
||||
pageControl: TCEPageControl;
|
||||
fKeyChanged: boolean;
|
||||
fDoc: TCESynMemo;
|
||||
|
@ -111,6 +132,82 @@ implementation
|
|||
|
||||
uses
|
||||
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------------------------------------------------------}
|
||||
constructor TCEEditorWidget.create(aOwner: TComponent);
|
||||
|
@ -147,6 +244,8 @@ begin
|
|||
//
|
||||
EntitiesConnector.addObserver(self);
|
||||
EntitiesConnector.addSingleService(self);
|
||||
//
|
||||
fOptions:= TCEPagesOptions.construct(self);
|
||||
end;
|
||||
|
||||
destructor TCEEditorWidget.destroy;
|
||||
|
@ -159,6 +258,7 @@ begin
|
|||
if (PageControl.Pages[i].Controls[0] is TCESynMemo) then
|
||||
PageControl.Pages[i].Controls[0].Free;
|
||||
fTokList.Free;
|
||||
fOptions.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
|
|
Loading…
Reference in New Issue