todolist, added options to show hide a particular columns, + added column for source filename

This commit is contained in:
Basile Burg 2015-10-23 20:10:34 +02:00
parent db8c89da93
commit aa14a6d689
2 changed files with 42 additions and 5 deletions

View File

@ -77,27 +77,32 @@ inherited CETodoListWidget: TCETodoListWidget
item item
AutoSize = True AutoSize = True
Caption = 'text' Caption = 'text'
Width = 29 Width = 36
end end
item item
AutoSize = True AutoSize = True
Caption = 'category' Caption = 'category'
Width = 57 Width = 65
end end
item item
AutoSize = True AutoSize = True
Caption = 'assignee' Caption = 'assignee'
Width = 58 Width = 64
end end
item item
AutoSize = True AutoSize = True
Caption = 'status' Caption = 'status'
Width = 42 Width = 49
end end
item item
AutoSize = True AutoSize = True
Caption = 'priority' Caption = 'priority'
Width = 374 Width = 55
end
item
AutoSize = True
Caption = 'file'
Width = 286
end> end>
ReadOnly = True ReadOnly = True
SortType = stText SortType = stText

View File

@ -12,13 +12,18 @@ uses
type type
TTodoColumn = (filename, line, text, priority, assignee, category, status);
TTodoColumns = set of TTodoColumn;
TCETodoOptions = class(TWritableLfmTextComponent) TCETodoOptions = class(TWritableLfmTextComponent)
private private
fAutoRefresh: boolean; fAutoRefresh: boolean;
fSingleClick: boolean; fSingleClick: boolean;
fColumns: TTodoColumns;
published published
property autoRefresh: boolean read fAutoRefresh write fAutoRefresh; property autoRefresh: boolean read fAutoRefresh write fAutoRefresh;
property singleClickSelect: boolean read fSingleClick write fSingleClick; property singleClickSelect: boolean read fSingleClick write fSingleClick;
property columns: TTodoColumns read fColumns write fColumns;
public public
procedure AssignTo(Dest: TPersistent); override; procedure AssignTo(Dest: TPersistent); override;
procedure Assign(Src: TPersistent); override; procedure Assign(Src: TPersistent); override;
@ -81,6 +86,7 @@ type
private private
fAutoRefresh: Boolean; fAutoRefresh: Boolean;
fSingleClick: Boolean; fSingleClick: Boolean;
fColumns: TTodoColumns;
fProj: ICECommonProject; fProj: ICECommonProject;
fDoc: TCESynMemo; fDoc: TCESynMemo;
fToolProc: TCEProcess; fToolProc: TCEProcess;
@ -118,6 +124,8 @@ type
procedure filterItems(Sender: TObject); procedure filterItems(Sender: TObject);
procedure setSingleClick(aValue: boolean); procedure setSingleClick(aValue: boolean);
procedure setAutoRefresh(aValue: boolean); procedure setAutoRefresh(aValue: boolean);
procedure setColumns(aValue: TTodoColumns);
procedure refreshVisibleColumns;
protected protected
procedure SetVisible(Value: boolean); override; procedure SetVisible(Value: boolean); override;
public public
@ -126,6 +134,7 @@ type
// //
property singleClickSelect: boolean read fSingleClick write setSingleClick; property singleClickSelect: boolean read fSingleClick write setSingleClick;
property autoRefresh: boolean read fAutoRefresh write setAutoRefresh; property autoRefresh: boolean read fAutoRefresh write setAutoRefresh;
property columns: TTodoColumns read fColumns write setColumns;
end; end;
implementation implementation
@ -196,6 +205,7 @@ var
begin begin
inherited; inherited;
// //
columns:= [TTodoColumn.filename .. TTodoColumn.line];
fOptions := TCETodoOptions.Create(self); fOptions := TCETodoOptions.Create(self);
fOptions.autoRefresh := True; fOptions.autoRefresh := True;
fOptions.Name := 'todolistOptions'; fOptions.Name := 'todolistOptions';
@ -234,6 +244,7 @@ begin
inherited; inherited;
if Value and fAutoRefresh then if Value and fAutoRefresh then
callToolProcess; callToolProcess;
refreshVisibleColumns;
end; end;
{$ENDREGION} {$ENDREGION}
@ -248,6 +259,7 @@ begin
widg := TCETodoListWidget(Dest); widg := TCETodoListWidget(Dest);
widg.singleClickSelect := fSingleClick; widg.singleClickSelect := fSingleClick;
widg.autoRefresh := fAutoRefresh; widg.autoRefresh := fAutoRefresh;
widg.columns := fColumns;
end end
else else
inherited; inherited;
@ -262,6 +274,7 @@ begin
widg := TCETodoListWidget(Src); widg := TCETodoListWidget(Src);
fSingleClick := widg.singleClickSelect; fSingleClick := widg.singleClickSelect;
fAutoRefresh := widg.autoRefresh; fAutoRefresh := widg.autoRefresh;
fColumns:=widg.columns;
end end
else else
inherited; inherited;
@ -478,6 +491,7 @@ begin
trg.SubItems.Add(src.assignee); trg.SubItems.Add(src.assignee);
trg.SubItems.Add(src.status); trg.SubItems.Add(src.status);
trg.SubItems.Add(src.priority); trg.SubItems.Add(src.priority);
trg.SubItems.Add(shortenPath(src.filename, 25));
// //
if flt <> '' then if flt <> '' then
if flt <> '(filter)' then if flt <> '(filter)' then
@ -606,6 +620,24 @@ begin
callToolProcess; callToolProcess;
end; end;
procedure TCETodoListWidget.setColumns(aValue: TTodoColumns);
begin
fColumns := aValue;
refreshVisibleColumns;
end;
procedure TCETodoListWidget.refreshVisibleColumns;
begin
if lstItems = nil then exit;
if lstItems.Columns = nil then exit;
if lstItems.ColumnCount <> 6 then exit;
//
lstItems.Column[1].Visible := TTodoColumn.category in fColumns ;
lstItems.Column[2].Visible := TTodoColumn.assignee in fColumns ;
lstItems.Column[3].Visible := TTodoColumn.status in fColumns ;
lstItems.Column[4].Visible := TTodoColumn.priority in fColumns ;
lstItems.Column[5].Visible := TTodoColumn.filename in fColumns ;
end;
{$ENDREGION} {$ENDREGION}
end. end.