review, source comment, minor fixes, todo update

This commit is contained in:
Basile Burg 2015-02-22 16:21:44 +01:00
parent 06deabd011
commit e1034fa8a4
12 changed files with 104 additions and 97 deletions

View File

@ -957,7 +957,7 @@ end;
destructor TOtherOpts.destroy; destructor TOtherOpts.destroy;
begin begin
fCustom.Destroy; fCustom.Free;
inherited; inherited;
end; end;

View File

@ -13,13 +13,15 @@ type
(** (**
* The option frame to edit the docking option, displayed in the option form. * The option frame to edit the docking option, displayed in the option form.
*) *)
TEditableAnchorDockOptions = class(TAnchorDockOptionsFrame, ICEEditableOptions) TDockOptionsEditor = class(TAnchorDockOptionsFrame, ICEEditableOptions)
private private
fBackup: TXMLConfigStorage; fBackup: TXMLConfigStorage;
//
function optionedWantCategory(): string; function optionedWantCategory(): string;
function optionedWantEditorKind: TOptionEditorKind; function optionedWantEditorKind: TOptionEditorKind;
function optionedWantContainer: TPersistent; function optionedWantContainer: TPersistent;
procedure optionedEvent(anEvent: TOptionEditorEvent); procedure optionedEvent(anEvent: TOptionEditorEvent);
//
procedure doChanged(Sender: TObject); procedure doChanged(Sender: TObject);
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
@ -29,12 +31,12 @@ type
implementation implementation
var var
DockOptionsEditor: TEditableAnchorDockOptions; DockOptionsEditor: TDockOptionsEditor;
constructor TEditableAnchorDockOptions.Create(TheOwner: TComponent); constructor TDockOptionsEditor.Create(TheOwner: TComponent);
begin begin
inherited; inherited;
fBackup := TXMLConfigStorage.Create('',false); fBackup := TXMLConfigStorage.Create('', false);
Master := AnchorDocking.DockMaster; Master := AnchorDocking.DockMaster;
// //
HeaderAlignLeftTrackBar.OnChange := @doChanged; HeaderAlignLeftTrackBar.OnChange := @doChanged;
@ -54,23 +56,23 @@ begin
EntitiesConnector.addObserver(self); EntitiesConnector.addObserver(self);
end; end;
destructor TEditableAnchorDockOptions.Destroy; destructor TDockOptionsEditor.Destroy;
begin begin
fBackup.Free; fBackup.Free;
inherited; inherited;
end; end;
function TEditableAnchorDockOptions.optionedWantCategory(): string; function TDockOptionsEditor.optionedWantCategory(): string;
begin begin
exit('Docking') exit('Docking')
end; end;
function TEditableAnchorDockOptions.optionedWantEditorKind: TOptionEditorKind; function TDockOptionsEditor.optionedWantEditorKind: TOptionEditorKind;
begin begin
exit(oekControl); exit(oekControl);
end; end;
function TEditableAnchorDockOptions.optionedWantContainer: TPersistent; function TDockOptionsEditor.optionedWantContainer: TPersistent;
begin begin
fBackup.Clear; fBackup.Clear;
DockMaster.SaveSettingsToConfig(fBackup); DockMaster.SaveSettingsToConfig(fBackup);
@ -78,7 +80,7 @@ begin
exit(self); exit(self);
end; end;
procedure TEditableAnchorDockOptions.optionedEvent(anEvent: TOptionEditorEvent); procedure TDockOptionsEditor.optionedEvent(anEvent: TOptionEditorEvent);
begin begin
// restores // restores
if anEvent = oeeCancel then if anEvent = oeeCancel then
@ -97,7 +99,7 @@ begin
end; end;
end; end;
procedure TEditableAnchorDockOptions.doChanged(Sender: TObject); procedure TDockOptionsEditor.doChanged(Sender: TObject);
begin begin
DragThresholdLabel.Caption:=adrsDragThreshold + DragThresholdLabel.Caption:=adrsDragThreshold +
' ('+IntToStr(DragThresholdTrackBar.Position)+')'; ' ('+IntToStr(DragThresholdTrackBar.Position)+')';
@ -113,7 +115,7 @@ begin
end; end;
initialization initialization
DockOptionsEditor := TEditableAnchorDockOptions.create(nil); DockOptionsEditor := TDockOptionsEditor.create(nil);
finalization finalization
DockOptionsEditor.free; DockOptionsEditor.free;
end. end.

View File

@ -11,18 +11,10 @@ uses
type type
TDHighligthOptions = class(TPersistent)
end;
TTxtHighligthOptions = class(TPersistent)
end;
(** (**
* Container for the editor and highlither options. * Container for the editor and highlither options.
* The base class is also used to backup the settings * The base class is also used to backup the settings
* to allow a live preview and to restore them when not accepted. * to allow a to preview and restore the settings when rejected.
* *
* note: when adding a new property, the default value must be set in * note: when adding a new property, the default value must be set in
* the constructor according to the default value of the member binded * the constructor according to the default value of the member binded
@ -30,11 +22,15 @@ type
*) *)
TCEEditorOptionsBase = class(TWritableLfmTextComponent) TCEEditorOptionsBase = class(TWritableLfmTextComponent)
private private
// note this is how a TComponent can be edited in
// a basic TTIGrid: in the ctor create the component
// but expose it as a published TPersistent.
fD2Syn: TPersistent; fD2Syn: TPersistent;
fTxtSyn: TPersistent; fTxtSyn: TPersistent;
//
fSelCol: TSynSelectedColor; fSelCol: TSynSelectedColor;
fFoldCol: TSynSelectedColor; fFoldedColor: TSynSelectedColor;
fLinkCol: TSynSelectedColor; fMouseLinkColor: TSynSelectedColor;
fFont: TFont; fFont: TFont;
// //
fTabWidth: Integer; fTabWidth: Integer;
@ -43,28 +39,28 @@ type
fCharSpacing: Integer; fCharSpacing: Integer;
fRightEdge: Integer; fRightEdge: Integer;
fBackground: TColor; fBackground: TColor;
fRightEdgeCol: TColor; fRightEdgeColor: TColor;
fOptions1: TSynEditorOptions; fOptions1: TSynEditorOptions;
fOptions2: TSynEditorOptions2; fOptions2: TSynEditorOptions2;
fMouseOptions: TSynEditorMouseOptions; fMouseOptions: TSynEditorMouseOptions;
// //
procedure setFont(aValue: TFont); procedure setFont(aValue: TFont);
procedure setSelCol(aValue: TSynSelectedColor); procedure setSelCol(aValue: TSynSelectedColor);
procedure setFoldCol(aValue: TSynSelectedColor); procedure setFoldedColor(aValue: TSynSelectedColor);
procedure setLinkCol(aValue: TSynSelectedColor); procedure setMouseLinkColor(aValue: TSynSelectedColor);
procedure setD2Syn(aValue: TPersistent); procedure setD2Syn(aValue: TPersistent);
procedure setTxtSyn(aValue: TPersistent); procedure setTxtSyn(aValue: TPersistent);
published published
property mouseLinkColor: TSynSelectedColor read fLinkCol write setLinkCol; property mouseLinkColor: TSynSelectedColor read fMouseLinkColor write setMouseLinkColor;
property selectedColor: TSynSelectedColor read fSelCol write setSelCol; property selectedColor: TSynSelectedColor read fSelCol write setSelCol;
property foldedColor: TSynSelectedColor read fFoldCol write setFoldCol; property foldedColor: TSynSelectedColor read fFoldedColor write setFoldedColor;
property background: TColor read fBackground write fBackground default clWhite; property background: TColor read fBackground write fBackground default clWhite;
property tabulationWidth: Integer read fTabWidth write fTabWidth default 4; property tabulationWidth: Integer read fTabWidth write fTabWidth default 4;
property blockIdentation: Integer read fBlockIdent write fBlockIdent default 4; property blockIdentation: Integer read fBlockIdent write fBlockIdent default 4;
property lineSpacing: Integer read fLineSpacing write fLineSpacing default 0; property lineSpacing: Integer read fLineSpacing write fLineSpacing default 0;
property characterSpacing: Integer read fCharSpacing write fCharSpacing default 0; property characterSpacing: Integer read fCharSpacing write fCharSpacing default 0;
property rightEdge: Integer read fRightEdge write fRightEdge default 80; property rightEdge: Integer read fRightEdge write fRightEdge default 80;
property rightEdgeColor: TColor read fRightEdgeCol write fRightEdgeCol default clSilver; property rightEdgeColor: TColor read fRightEdgeColor write fRightEdgeColor default clSilver;
property font: TFont read fFont write setFont; property font: TFont read fFont write setFont;
property options1: TSynEditorOptions read fOptions1 write fOptions1; property options1: TSynEditorOptions read fOptions1 write fOptions1;
property options2: TSynEditorOptions2 read fOptions2 write fOptions2; property options2: TSynEditorOptions2 read fOptions2 write fOptions2;
@ -80,6 +76,7 @@ type
(** (**
* Manages and exposes all the editor and highligther options to an TCEOptionsEditor. * Manages and exposes all the editor and highligther options to an TCEOptionsEditor.
* It's also responsible to give the current options to a new editor.
*) *)
TCEEditorOptions = class(TCEEditorOptionsBase, ICEEditableOptions, ICEMultiDocObserver) TCEEditorOptions = class(TCEEditorOptionsBase, ICEEditableOptions, ICEMultiDocObserver)
private private
@ -129,24 +126,24 @@ begin
fTxtSyn.Assign(TxtSyn); fTxtSyn.Assign(TxtSyn);
// //
fSelCol := TSynSelectedColor.Create; fSelCol := TSynSelectedColor.Create;
fFoldCol := TSynSelectedColor.Create; fFoldedColor := TSynSelectedColor.Create;
fLinkCol := TSynSelectedColor.Create; fMouseLinkColor := TSynSelectedColor.Create;
// //
// note: default values come from TSynEditFoldedView ctor. // note: default values come from TSynEditFoldedView ctor.
fFoldCol.Background := clNone; fFoldedColor.Background := clNone;
fFoldCol.Foreground := clDkGray; fFoldedColor.Foreground := clDkGray;
fFoldCol.FrameColor := clDkGray; fFoldedColor.FrameColor := clDkGray;
// //
fLinkCol.Style := [fsUnderline, fsBold]; fMouseLinkColor.Style := [fsUnderline, fsBold];
fLinkCol.StyleMask := []; fMouseLinkColor.StyleMask := [];
fLinkCol.Foreground := clNone; fMouseLinkColor.Foreground := clNone;
fLinkCol.Background := clNone; fMouseLinkColor.Background := clNone;
// //
rightEdge := 80; rightEdge := 80;
tabulationWidth := 4; tabulationWidth := 4;
blockIdentation := 4; blockIdentation := 4;
fBackground := clWhite; fBackground := clWhite;
fRightEdgeCol := clSilver; fRightEdgeColor := clSilver;
// //
options1 := options1 :=
[eoAutoIndent, eoBracketHighlight, eoGroupUndo, eoTabsToSpaces, [eoAutoIndent, eoBracketHighlight, eoGroupUndo, eoTabsToSpaces,
@ -162,8 +159,8 @@ destructor TCEEditorOptionsBase.Destroy;
begin begin
fFont.Free; fFont.Free;
fSelCol.Free; fSelCol.Free;
fFoldCol.Free; fFoldedColor.Free;
fLinkCol.Free; fMouseLinkColor.Free;
inherited; inherited;
end; end;
@ -177,8 +174,8 @@ begin
// //
fFont.Assign(srcopt.fFont); fFont.Assign(srcopt.fFont);
fSelCol.Assign(srcopt.fSelCol); fSelCol.Assign(srcopt.fSelCol);
fFoldCol.Assign(srcopt.fFoldCol); fFoldedColor.Assign(srcopt.fFoldedColor);
fLinkCol.Assign(srcopt.fLinkCol); fMouseLinkColor.Assign(srcopt.fMouseLinkColor);
fD2Syn.Assign(srcopt.fD2Syn); fD2Syn.Assign(srcopt.fD2Syn);
fTxtSyn.Assign(srcopt.fTxtSyn); fTxtSyn.Assign(srcopt.fTxtSyn);
background := srcopt.background; background := srcopt.background;
@ -205,14 +202,14 @@ begin
fSelCol.Assign(aValue); fSelCol.Assign(aValue);
end; end;
procedure TCEEditorOptionsBase.setFoldCol(aValue: TSynSelectedColor); procedure TCEEditorOptionsBase.setFoldedColor(aValue: TSynSelectedColor);
begin begin
fFoldCol.Assign(aValue); fFoldedColor.Assign(aValue);
end; end;
procedure TCEEditorOptionsBase.setLinkCol(aValue: TSynSelectedColor); procedure TCEEditorOptionsBase.setMouseLinkColor(aValue: TSynSelectedColor);
begin begin
fLinkCol.Assign(aValue); fMouseLinkColor.Assign(aValue);
end; end;
procedure TCEEditorOptionsBase.setD2Syn(aValue: TPersistent); procedure TCEEditorOptionsBase.setD2Syn(aValue: TPersistent);
@ -324,7 +321,6 @@ begin
multied := getMultiDocHandler; multied := getMultiDocHandler;
for i := 0 to multied.documentCount-1 do for i := 0 to multied.documentCount-1 do
applyChangeToEditor(multied.document[i]); applyChangeToEditor(multied.document[i]);
end; end;
procedure TCEEditorOptions.applyChangeToEditor(anEditor: TCESynMemo); procedure TCEEditorOptions.applyChangeToEditor(anEditor: TCESynMemo);
@ -332,8 +328,8 @@ begin
anEditor.defaultFontSize := font.Size; anEditor.defaultFontSize := font.Size;
anEditor.Font.Assign(font); anEditor.Font.Assign(font);
anEditor.SelectedColor.Assign(fSelCol); anEditor.SelectedColor.Assign(fSelCol);
anEditor.FoldedCodeColor.Assign(fFoldCol); anEditor.FoldedCodeColor.Assign(fFoldedColor);
anEditor.MouseLinkColor.Assign(fLinkCol); anEditor.MouseLinkColor.Assign(fMouseLinkColor);
anEditor.TabWidth := tabulationWidth; anEditor.TabWidth := tabulationWidth;
anEditor.BlockIndent := blockIdentation; anEditor.BlockIndent := blockIdentation;
anEditor.ExtraLineSpacing := lineSpacing; anEditor.ExtraLineSpacing := lineSpacing;

View File

@ -14,6 +14,9 @@ type
TCustomPathType = (ptFile, ptFolder); TCustomPathType = (ptFile, ptFolder);
// base class for a property representing a path
// additionaly to the text field, a dialog can be opened
// to select the directory or the file.
TCECustomPathEditor = class(TStringPropertyEditor) TCECustomPathEditor = class(TStringPropertyEditor)
private private
fType: TCustomPathType; fType: TCustomPathType;
@ -30,7 +33,6 @@ type
constructor Create(Hook: TPropertyEditorHook; APropCount: Integer); override; constructor Create(Hook: TPropertyEditorHook; APropCount: Integer); override;
end; end;
implementation implementation
function TCECustomPathEditor.GetAttributes: TPropertyAttributes; function TCECustomPathEditor.GetAttributes: TPropertyAttributes;

View File

@ -88,7 +88,7 @@ type
procedure updateObservers; virtual; procedure updateObservers; virtual;
// //
property observersCount: Integer read getObserversCount; property observersCount: Integer read getObserversCount;
property observers[index: Integer]: TObject read getObserver; property observers[index: Integer]: TObject read getObserver; default;
end; end;
var var

View File

@ -11,6 +11,8 @@ uses
type type
// store the information about the obsever
// exposing some editable options.
PCategoryData = ^TCategoryData; PCategoryData = ^TCategoryData;
TCategoryData = record TCategoryData = record
kind: TOptionEditorKind; kind: TOptionEditorKind;
@ -110,9 +112,12 @@ procedure TCEOptionEditorWidget.selCatSelectionChanged(Sender: TObject);
var var
dt: PCategoryData; dt: PCategoryData;
begin begin
// remove either the control, the form or the inspector
// being used as editor.
inspector.TIObject := nil; inspector.TIObject := nil;
if pnlEd.ControlCount > 0 then if pnlEd.ControlCount > 0 then
pnlEd.Controls[0].Parent := nil; pnlEd.Controls[0].Parent := nil;
//
if selCat.Selected = nil then exit; if selCat.Selected = nil then exit;
if selCat.Selected.Data = nil then exit; if selCat.Selected.Data = nil then exit;
// //
@ -173,7 +178,6 @@ begin
.observer .observer
.optionedEvent(oeeAccept); .optionedEvent(oeeAccept);
end; end;
{$ENDREGION} {$ENDREGION}
end. end.

View File

@ -71,7 +71,7 @@ object CEShortcutEditor: TCEShortcutEditor
BorderStyle = sbsSunken BorderStyle = sbsSunken
TabOrder = 0 TabOrder = 0
end end
object shcCatch: TEdit object shortcutCatcher: TEdit
Left = 310 Left = 310
Height = 22 Height = 22
Top = 2 Top = 2
@ -81,9 +81,9 @@ object CEShortcutEditor: TCEShortcutEditor
BorderSpacing.Bottom = 1 BorderSpacing.Bottom = 1
BorderSpacing.Around = 1 BorderSpacing.Around = 1
Enabled = False Enabled = False
OnExit = shcCatchExit OnExit = shortcutCatcherExit
OnKeyDown = LabeledEdit1KeyDown OnKeyDown = LabeledEdit1KeyDown
OnMouseLeave = shcCatchMouseLeave OnMouseLeave = shortcutCatcherMouseLeave
TabOrder = 1 TabOrder = 1
end end
object btnActivate: TSpeedButton object btnActivate: TSpeedButton

View File

@ -24,12 +24,12 @@ type
TShortCutCollection = class(TWritableLfmTextComponent) TShortCutCollection = class(TWritableLfmTextComponent)
private private
fCollection: TCollection; fItems: TCollection;
procedure setCollection(aValue: TCollection); procedure setItems(aValue: TCollection);
function getCount: Integer; function getCount: Integer;
function getShortcut(index: Integer): TShortcutItem; function getItem(index: Integer): TShortcutItem;
published published
property items: TCollection read fCollection write setCollection; property items: TCollection read fItems write setItems;
public public
constructor create(AOwner: TComponent); override; constructor create(AOwner: TComponent); override;
destructor destroy; override; destructor destroy; override;
@ -38,11 +38,11 @@ type
function findShortcut(aShortcut: Word): boolean; function findShortcut(aShortcut: Word): boolean;
// //
property count: Integer read getCount; property count: Integer read getCount;
property item[index: Integer]: TShortcutItem read getShortcut; default; property item[index: Integer]: TShortcutItem read getItem; default;
end; end;
TCEShortcutEditor = class(TFrame, ICEEditableOptions) TCEShortcutEditor = class(TFrame, ICEEditableOptions)
shcCatch: TEdit; shortcutCatcher: TEdit;
Panel1: TPanel; Panel1: TPanel;
fltItems: TTreeFilterEdit; fltItems: TTreeFilterEdit;
Panel2: TPanel; Panel2: TPanel;
@ -51,8 +51,8 @@ type
tree: TTreeView; tree: TTreeView;
procedure btnActivateClick(Sender: TObject); procedure btnActivateClick(Sender: TObject);
procedure LabeledEdit1KeyDown(Sender: TObject; var Key: Word;Shift: TShiftState); procedure LabeledEdit1KeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);
procedure shcCatchExit(Sender: TObject); procedure shortcutCatcherExit(Sender: TObject);
procedure shcCatchMouseLeave(Sender: TObject); procedure shortcutCatcherMouseLeave(Sender: TObject);
procedure treeSelectionChanged(Sender: TObject); procedure treeSelectionChanged(Sender: TObject);
private private
fObservers: TCEEditableShortCutSubject; fObservers: TCEEditableShortCutSubject;
@ -89,28 +89,28 @@ end;
constructor TShortCutCollection.create(AOwner: TComponent); constructor TShortCutCollection.create(AOwner: TComponent);
begin begin
inherited; inherited;
fCollection := TCollection.Create(TShortcutItem); fItems := TCollection.Create(TShortcutItem);
end; end;
destructor TShortCutCollection.destroy; destructor TShortCutCollection.destroy;
begin begin
fCollection.Free; fItems.Free;
inherited; inherited;
end; end;
procedure TShortCutCollection.setCollection(aValue: TCollection); procedure TShortCutCollection.setItems(aValue: TCollection);
begin begin
fCollection.Assign(aValue); fItems.Assign(aValue);
end; end;
function TShortCutCollection.getCount: Integer; function TShortCutCollection.getCount: Integer;
begin begin
exit(fCollection.Count); exit(fItems.Count);
end; end;
function TShortCutCollection.getShortcut(index: Integer): TShortcutItem; function TShortCutCollection.getItem(index: Integer): TShortcutItem;
begin begin
exit(TShortcutItem(fCollection.Items[index])); exit(TShortcutItem(fItems.Items[index]));
end; end;
function TShortCutCollection.findIdentifier(const identifier: string): boolean; function TShortCutCollection.findIdentifier(const identifier: string): boolean;
@ -187,6 +187,7 @@ end;
procedure TCEShortcutEditor.optionedEvent(anEvent: TOptionEditorEvent); procedure TCEShortcutEditor.optionedEvent(anEvent: TOptionEditorEvent);
begin begin
// TODO-cfeature: pass new shortcut to observer
end; end;
{$ENDREGION} {$ENDREGION}
@ -196,15 +197,15 @@ begin
updateEditCtrls; updateEditCtrls;
end; end;
procedure TCEShortcutEditor.shcCatchExit(Sender: TObject); procedure TCEShortcutEditor.shortcutCatcherExit(Sender: TObject);
begin begin
shcCatch.Enabled := false; shortcutCatcher.Enabled := false;
updateEditCtrls; updateEditCtrls;
end; end;
procedure TCEShortcutEditor.shcCatchMouseLeave(Sender: TObject); procedure TCEShortcutEditor.shortcutCatcherMouseLeave(Sender: TObject);
begin begin
shcCatch.Enabled := false; shortcutCatcher.Enabled := false;
updateEditCtrls; updateEditCtrls;
end; end;
@ -214,17 +215,16 @@ begin
if tree.Selected.Level = 0 then exit; if tree.Selected.Level = 0 then exit;
if tree.Selected.Data = nil then exit; if tree.Selected.Data = nil then exit;
// //
shcCatch.Enabled := not shcCatch.Enabled; shortcutCatcher.Enabled := not shortcutCatcher.Enabled;
end; end;
procedure TCEShortcutEditor.LabeledEdit1KeyDown(Sender: TObject; var Key: Word; procedure TCEShortcutEditor.LabeledEdit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
Shift: TShiftState);
begin begin
if tree.Selected = nil then exit; if tree.Selected = nil then exit;
if tree.Selected.Level = 0 then exit; if tree.Selected.Level = 0 then exit;
if tree.Selected.Data = nil then exit; if tree.Selected.Data = nil then exit;
// //
if Key = VK_RETURN then shcCatch.Enabled := false if Key = VK_RETURN then shortcutCatcher.Enabled := false
else TShortcutItem(tree.Selected.Data).data := Shortcut(Key, Shift); else TShortcutItem(tree.Selected.Data).data := Shortcut(Key, Shift);
// //
updateEditCtrls; updateEditCtrls;
@ -239,7 +239,7 @@ begin
if tree.Selected.Data = nil then exit; if tree.Selected.Data = nil then exit;
// //
schrtText.Caption := TShortcutItem(tree.Selected.Data).combination; schrtText.Caption := TShortcutItem(tree.Selected.Data).combination;
shcCatch.Text:= ''; shortcutCatcher.Text := '';
end; end;
function TCEShortcutEditor.findCategory(const aName: string; aData: Pointer): TTreeNode; function TCEShortcutEditor.findCategory(const aName: string; aData: Pointer): TTreeNode;

View File

@ -14,6 +14,7 @@ type
TCESynMemo = class; TCESynMemo = class;
// SImple THintWindow descendant allowing the font size to be in sync with the editor.
TCEEditorHintWindow = class(THintWindow) TCEEditorHintWindow = class(THintWindow)
public public
class var FontSize: Integer; class var FontSize: Integer;
@ -22,6 +23,7 @@ type
AData: Pointer): TRect; override; AData: Pointer): TRect; override;
end; end;
// Stores the state of a particulat source code folding.
TCEFoldCache = class(TCollectionItem) TCEFoldCache = class(TCollectionItem)
private private
fCollapsed: boolean; fCollapsed: boolean;
@ -33,6 +35,7 @@ type
property nestedIndex: Integer read fNestedIndex write fNestedIndex; property nestedIndex: Integer read fNestedIndex write fNestedIndex;
end; end;
// Stores the state of a document between two cessions.
TCESynMemoCache = class(TWritableLfmTextComponent) TCESynMemoCache = class(TWritableLfmTextComponent)
private private
fMemo: TCESynMemo; fMemo: TCESynMemo;
@ -58,6 +61,7 @@ type
procedure load; procedure load;
end; end;
// buffer of caret positions allowing to jump quickly to the most recent locations.
TCESynMemoPositions = class TCESynMemoPositions = class
private private
fPos: Integer; fPos: Integer;
@ -159,6 +163,7 @@ end;
destructor TCESynMemoCache.destroy; destructor TCESynMemoCache.destroy;
begin begin
fFolds.Free; fFolds.Free;
inherited;
end; end;
procedure TCESynMemoCache.setFolds(someFolds: TCollection); procedure TCESynMemoCache.setFolds(someFolds: TCollection);

View File

@ -49,7 +49,7 @@ type
public public
constructor create(AOwner: TComponent); override; constructor create(AOwner: TComponent); override;
destructor destroy; override; destructor destroy; override;
// str will be set on the tool process output. // str is the output stream of the tool process.
procedure loadFromTxtStream(str: TMemoryStream); procedure loadFromTxtStream(str: TMemoryStream);
property count: integer read getCount; property count: integer read getCount;
property item[index: integer]: TTodoItem read getItem; default; property item[index: integer]: TTodoItem read getItem; default;
@ -177,8 +177,6 @@ begin
lstItems.OnCompare := @lstItemsCompare; lstItems.OnCompare := @lstItemsCompare;
fAutoRefresh := true; fAutoRefresh := true;
mnuAutoRefresh.Checked := true; mnuAutoRefresh.Checked := true;
// TODO-cLCL&LAZ-specific, try the new TListViewFilterEdit here.
// TODO-cLCL&LAZ-specific, the align/anchors of filterxxx must be redefined, previously there was a bug.
lstfilter.OnChange:= @filterItems; lstfilter.OnChange:= @filterItems;
// //
png := TPortableNetworkGraphic.Create; png := TPortableNetworkGraphic.Create;
@ -430,7 +428,7 @@ begin
// //
if src.category <> '' then lstItems.Column[1].Visible := true; if src.category <> '' then lstItems.Column[1].Visible := true;
if src.assignee <> '' then lstItems.Column[2].Visible := true; if src.assignee <> '' then lstItems.Column[2].Visible := true;
if src.status <> '' then lstItems.Column[3].Visible := true; if src.status <> '' then lstItems.Column[3].Visible := true;
if src.priority <> '' then lstItems.Column[4].Visible := true; if src.priority <> '' then lstItems.Column[4].Visible := true;
end; end;
end; end;
@ -514,7 +512,7 @@ procedure TCETodoListWidget.filterItems(sender: TObject);
begin begin
fillTodoList fillTodoList
end; end;
{$ENDREGION} {$ENDREGION}
end. end.

View File

@ -10,6 +10,8 @@ uses
type type
//TODO-cfeature: declare tools shortcuts, set TCETools ICEEditableShortcut
TCEToolItem = class(TCollectionItem) TCEToolItem = class(TCollectionItem)
private private
fProcess: TCheckedAsyncProcess; fProcess: TCheckedAsyncProcess;
@ -22,7 +24,7 @@ type
fQueryParams: boolean; fQueryParams: boolean;
fChainBefore: TStringList; fChainBefore: TStringList;
fChainAfter: TStringList; fChainAfter: TStringList;
//fShortcut: string; //fShortcut: TShortcut;
fMsgs: ICEMessagesDisplay; fMsgs: ICEMessagesDisplay;
procedure setParameters(aValue: TStringList); procedure setParameters(aValue: TStringList);
procedure setChainBefore(aValue: TStringList); procedure setChainBefore(aValue: TStringList);
@ -39,7 +41,7 @@ type
property queryParameters: boolean read fQueryParams write fQueryParams; property queryParameters: boolean read fQueryParams write fQueryParams;
property chainBefore: TStringList read fChainBefore write setchainBefore; property chainBefore: TStringList read fChainBefore write setchainBefore;
property chainAfter: TStringList read fChainAfter write setChainAfter; property chainAfter: TStringList read fChainAfter write setChainAfter;
//property shortcut: string read fShortcut write fShortcut; //property shortcut: TShortcut read fShortcut write fShortcut;
public public
constructor create(ACollection: TCollection); override; constructor create(ACollection: TCollection); override;
destructor destroy; override; destructor destroy; override;
@ -66,10 +68,9 @@ type
property tool[index: integer]: TCEToolItem read getTool; default; property tool[index: integer]: TCEToolItem read getTool; default;
end; end;
const //TODO-crefactor: either set the tools as a service of merge the tools collection& tool editor in a single unit.
toolsFname = 'tools.txt';
Var var
CustomTools: TCETools; CustomTools: TCETools;
implementation implementation
@ -77,6 +78,9 @@ implementation
uses uses
ce_symstring, dialogs; ce_symstring, dialogs;
const
toolsFname = 'tools.txt';
constructor TCEToolItem.create(ACollection: TCollection); constructor TCEToolItem.create(ACollection: TCollection);
begin begin
inherited; inherited;
@ -185,7 +189,6 @@ end;
procedure TCETools.executeToolFromMenu(sender: TObject); procedure TCETools.executeToolFromMenu(sender: TObject);
begin begin
//TCEToolItem(TMenuItem(sender).tag).execute;
executeTool(TCEToolItem(TMenuItem(sender).tag)); executeTool(TCEToolItem(TMenuItem(sender).tag));
end; end;
@ -213,11 +216,8 @@ var
begin begin
if item = nil then exit; if item = nil then exit;
if item.Count <> tools.Count then if item.Count <> tools.Count then
begin menuDeclare(item)
menuDeclare(item); else for i:= 0 to tools.Count-1 do
exit;
end;
for i:= 0 to tools.Count-1 do
begin begin
if ptrInt(tool[i]) <> item.Items[i].Tag then if ptrInt(tool[i]) <> item.Items[i].Tag then
item.Items[i].Tag := ptrInt(tool[i]); item.Items[i].Tag := ptrInt(tool[i]);

View File

@ -109,7 +109,7 @@ uses
{$REGION Standard Comp/Obj------------------------------------------------------} {$REGION Standard Comp/Obj------------------------------------------------------}
constructor TCEWidget.create(aOwner: TComponent); constructor TCEWidget.create(aOwner: TComponent);
var var
i: NativeInt; i: Integer;
itm: TmenuItem; itm: TmenuItem;
begin begin
inherited; inherited;