Merge branch 'a12_2_a13'

This commit is contained in:
Basile Burg 2015-02-23 03:59:50 +01:00
commit f65f666ae9
8 changed files with 99 additions and 33 deletions

View File

@ -143,6 +143,7 @@
<ComponentName Value="CECdbWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_cdbcmd"/>
</Unit1>
<Unit2>
<Filename Value="..\src\ce_common.pas"/>
@ -156,10 +157,12 @@
<Unit4>
<Filename Value="..\src\ce_dcd.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_dcd"/>
</Unit4>
<Unit5>
<Filename Value="..\src\ce_dlang.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_dlang"/>
</Unit5>
<Unit6>
<Filename Value="..\src\ce_dlangutils.pas"/>
@ -168,6 +171,7 @@
<Unit7>
<Filename Value="..\src\ce_dmdwrap.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_dmdwrap"/>
</Unit7>
<Unit8>
<Filename Value="..\src\ce_editor.pas"/>
@ -185,6 +189,7 @@
<Unit10>
<Filename Value="..\src\ce_libman.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_libman"/>
</Unit10>
<Unit11>
<Filename Value="..\src\ce_libmaneditor.pas"/>
@ -207,6 +212,7 @@
<ComponentName Value="CEMessagesWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_messages"/>
</Unit13>
<Unit14>
<Filename Value="..\src\ce_miniexplorer.pas"/>
@ -214,6 +220,7 @@
<ComponentName Value="CEMiniExplorerWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_miniexplorer"/>
</Unit14>
<Unit15>
<Filename Value="..\src\ce_observer.pas"/>
@ -223,6 +230,7 @@
<Unit16>
<Filename Value="..\src\ce_options.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_options"/>
</Unit16>
<Unit17>
<Filename Value="..\src\ce_procinput.pas"/>
@ -230,6 +238,7 @@
<ComponentName Value="CEProcInputWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_procinput"/>
</Unit17>
<Unit18>
<Filename Value="..\src\ce_projconf.pas"/>
@ -237,10 +246,12 @@
<ComponentName Value="CEProjectConfigurationWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_projconf"/>
</Unit18>
<Unit19>
<Filename Value="..\src\ce_project.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_project"/>
</Unit19>
<Unit20>
<Filename Value="..\src\ce_projinspect.pas"/>
@ -256,6 +267,7 @@
<ComponentName Value="CESearchWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_search"/>
</Unit21>
<Unit22>
<Filename Value="..\src\ce_staticexplorer.pas"/>
@ -263,10 +275,12 @@
<ComponentName Value="CEStaticExplorerWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_staticexplorer"/>
</Unit22>
<Unit23>
<Filename Value="..\src\ce_staticmacro.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_staticmacro"/>
</Unit23>
<Unit24>
<Filename Value="..\src\ce_symstring.pas"/>
@ -281,6 +295,7 @@
<Unit26>
<Filename Value="..\src\ce_tools.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_tools"/>
</Unit26>
<Unit27>
<Filename Value="..\src\ce_toolseditor.pas"/>
@ -288,7 +303,6 @@
<ComponentName Value="CEToolsEditorWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_toolseditor"/>
</Unit27>
<Unit28>
<Filename Value="..\src\ce_txtsyn.pas"/>
@ -300,11 +314,11 @@
<ComponentName Value="CEWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_widget"/>
</Unit29>
<Unit30>
<Filename Value="..\src\ce_writablecomponent.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_writableComponent"/>
</Unit30>
<Unit31>
<Filename Value="..\src\ce_todolist.pas"/>
@ -324,6 +338,7 @@
<ComponentName Value="CEOptionEditorWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_optionseditor"/>
</Unit33>
<Unit34>
<Filename Value="..\src\ce_editoroptions.pas"/>
@ -333,6 +348,7 @@
<Unit35>
<Filename Value="..\src\ce_dockoptions.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_dockoptions"/>
</Unit35>
<Unit36>
<Filename Value="..\src\ce_shortcutseditor.pas"/>
@ -340,6 +356,7 @@
<ComponentName Value="CEShortcutEditor"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="ce_shortcutseditor"/>
</Unit36>
</Units>
</ProjectOptions>

View File

@ -256,7 +256,7 @@ begin
end;
{$ENDREGION}
{$REGION ICEEDitableSHortcut ---------------------------------------------------}
{$REGION ICEEDitableShortcut ---------------------------------------------------}
function TCEEditorWidget.scedWantFirst: boolean;
begin
result := fDoc <> nil;
@ -267,16 +267,13 @@ function TCEEditorWidget.scedWantNext(out category, identifier: string; out aSho
var
shrct: TSynEditKeyStroke;
begin
result := false;
if fShortcutCount > fDoc.Keystrokes.Count-1 then exit;
//
shrct := fDoc.Keystrokes.Items[fShortcutCount];
category := 'Editor';
identifier:= shrct.DisplayName;
aShortcut := Shortcut(shrct.Key, shrct.Shift);
//
fShortcutCount += 1;
result := true;
result := fShortcutCount < fDoc.Keystrokes.Count;
end;
procedure TCEEditorWidget.scedSendItem(const category, identifier: string; aShortcut: TShortcut);

View File

@ -916,16 +916,13 @@ function TCEMainForm.scedWantNext(out category, identifier: string; out aShortcu
var
act: TCustomAction;
begin
result := false;
if fScCollectCount > actions.ActionCount -1 then exit;
//
act := TCustomAction(Actions.Actions[fScCollectCount]);
category := act.Category;
identifier := act.Caption;
aShortcut := act.ShortCut;
//
fScCollectCount += 1;
result := true;
result := fScCollectCount < actions.ActionCount;
end;
procedure TCEMainForm.scedSendItem(const category, identifier: string; aShortcut: TShortcut);

View File

@ -40,6 +40,7 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
HideSelection = False
ReadOnly = True
ScrollBars = ssAutoBoth
SortType = stText
TabOrder = 0
OnDeletion = selCatDeletion
OnSelectionChanged = selCatSelectionChanged

View File

@ -41,6 +41,7 @@ type
private
fEdOptsSubj: TCEEditableOptionsSubject;
procedure updateCategories;
function sortCategories(Cat1, Cat2: TTreeNode): integer;
public
constructor create(aOwner: TComponent); override;
destructor destroy; override;
@ -100,6 +101,12 @@ begin
dt^.kind := ed.optionedWantEditorKind;
dt^.observer := ed;
end;
selCat.Items.SortTopLevelNodes(@sortCategories);
end;
function TCEOptionEditorWidget.sortCategories(Cat1, Cat2: TTreeNode): integer;
begin
result := CompareText(Cat1.Text, Cat2.Text);
end;
procedure TCEOptionEditorWidget.selCatDeletion(Sender: TObject; Node: TTreeNode);

View File

@ -44,6 +44,7 @@ object CEShortcutEditor: TCEShortcutEditor
HideSelection = False
ReadOnly = True
ScrollBars = ssAutoBoth
SortType = stText
TabOrder = 1
OnSelectionChanged = treeSelectionChanged
Options = [tvoAutoExpand, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]

View File

@ -65,6 +65,7 @@ type
procedure optionedEvent(anEvent: TOptionEditorEvent);
//
function findCategory(const aName: string; aData: Pointer): TTreeNode;
function sortCategories(Cat1, Cat2: TTreeNode): integer;
procedure updateFromObservers;
procedure updateEditCtrls;
protected
@ -253,31 +254,26 @@ begin
exit(tree.Items[i]);
end;
function TCEShortcutEditor.sortCategories(Cat1, Cat2: TTreeNode): integer;
begin
result := CompareText(Cat1.Text, Cat2.Text);
end;
procedure TCEShortcutEditor.updateFromObservers;
var
i: Integer;
obs: ICEEditableShortCut;
cat: string;
prt: TTreeNode;
sht: word;
idt: string;
itm: TShortcutItem;
begin
tree.Items.Clear;
fShortcuts.items.Clear;
fBackup.items.Clear;
cat := '';
idt := '';
for i:= 0 to fObservers.observersCount-1 do
begin
obs := fObservers.observers[i] as ICEEditableShortCut;
if obs.scedWantFirst then while obs.scedWantNext(cat, idt, sht) do
procedure addItem();
var
prt: TTreeNode;
begin
// root category
if cat = '' then
continue;
if idt = '' then
continue;
if cat = '' then exit;
if idt = '' then exit;
prt := findCategory(cat, obs);
if prt = nil then
prt := tree.Items.AddObject(nil, cat, obs);
@ -289,8 +285,24 @@ begin
cat := '';
idt := '';
end;
begin
tree.Items.Clear;
fShortcuts.items.Clear;
fBackup.items.Clear;
cat := '';
idt := '';
for i:= 0 to fObservers.observersCount-1 do
begin
obs := fObservers.observers[i] as ICEEditableShortCut;
if obs.scedWantFirst then
begin
while obs.scedWantNext(cat, idt, sht) do
addItem();
addItem();
end;
end;
tree.Items.SortTopLevelNodes(@sortCategories);
end;
{$ENDREGION}
initialization

View File

@ -10,8 +10,6 @@ uses
type
//TODO-cfeature: declare tools shortcuts, set TCETools ICEEditableShortcut
TCEToolItem = class(TCollectionItem)
private
fProcess: TCheckedAsyncProcess;
@ -24,7 +22,7 @@ type
fQueryParams: boolean;
fChainBefore: TStringList;
fChainAfter: TStringList;
//fShortcut: TShortcut;
fShortcut: TShortcut;
fMsgs: ICEMessagesDisplay;
procedure setParameters(aValue: TStringList);
procedure setChainBefore(aValue: TStringList);
@ -41,21 +39,26 @@ type
property queryParameters: boolean read fQueryParams write fQueryParams;
property chainBefore: TStringList read fChainBefore write setchainBefore;
property chainAfter: TStringList read fChainAfter write setChainAfter;
//property shortcut: TShortcut read fShortcut write fShortcut;
property shortcut: TShortcut read fShortcut write fShortcut;
public
constructor create(ACollection: TCollection); override;
destructor destroy; override;
end;
TCETools = class(TWritableLfmTextComponent, ICEMainMenuProvider)
TCETools = class(TWritableLfmTextComponent, ICEMainMenuProvider, ICEEditableShortcut)
private
fTools: TCollection;
fShctCount: Integer;
function getTool(index: Integer): TCEToolItem;
procedure setTools(const aValue: TCollection);
//
procedure menuDeclare(item: TMenuItem);
procedure menuUpdate(item: TMenuItem);
procedure executeToolFromMenu(sender: TObject);
//
function scedWantFirst: boolean;
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
published
property tools: TCollection read fTools write setTools;
public
@ -81,6 +84,7 @@ uses
const
toolsFname = 'tools.txt';
{$REGION TCEToolItem -----------------------------------------------------------}
constructor TCEToolItem.create(ACollection: TCollection);
begin
inherited;
@ -164,7 +168,9 @@ begin
lst.Free;
end;
end;
{$ENDREGION --------------------------------------------------------------------}
{$REGION Standard Comp/Obj -----------------------------------------------------}
constructor TCETools.create(aOwner: TComponent);
var
fname: string;
@ -186,7 +192,9 @@ begin
fTools.Free;
inherited;
end;
{$ENDREGION}
{$REGION ICEMainMenuProvider ---------------------------------------------------}
procedure TCETools.executeToolFromMenu(sender: TObject);
begin
executeTool(TCEToolItem(TMenuItem(sender).tag));
@ -225,7 +233,32 @@ begin
item.Items[i].Caption := tool[i].toolAlias;
end;
end;
{$ENDREGION}
{$REGION ICEEditableShortcut ---------------------------------------------------}
function TCETools.scedWantFirst: boolean;
begin
result := fTools.Count > 0;
fShctCount := 0;
end;
function TCETools.scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
begin
category := 'Tools';
identifier:= tool[fShctCount].toolAlias;
aShortcut := tool[fShctCount].shortcut;
//
fShctCount += 1;
result := fShctCount < fTools.Count;
end;
procedure TCETools.scedSendItem(const category, identifier: string; aShortcut: TShortcut);
begin
end;
{$ENDREGION}
{$REGION Tools things ----------------------------------------------------------}
procedure TCETools.setTools(const aValue: TCollection);
begin
fTools.Assign(aValue);
@ -271,6 +304,7 @@ begin
//
executeTool(tool[aToolIndex]);
end;
{$ENDREGION}
initialization
RegisterClasses([TCEToolItem, TCETools]);