add a main memnu item for the options categories, close #101

This commit is contained in:
Basile Burg 2016-11-13 13:52:10 +01:00
parent a3624bf2dc
commit 81e69e8d28
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
2 changed files with 51 additions and 47 deletions

View File

@ -2873,47 +2873,6 @@ object CEMainForm: TCEMainForm
object MenuItem76: TMenuItem
Caption = '-'
end
object MenuItem77: TMenuItem
Caption = 'Options...'
Bitmap.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF000000
0023000000330000003300000022000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00A979
19C0C18B26FFBF8A23FFA87918BD000000210000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C28E
2AFFEEBB68FFE8AF4FFFD1972EFFAA7812B90000002100000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C18E
2AFFFFF2D2FFEAB55FFFE7AD4CFFD6992EFFAA7812B900000021000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00B782
17ACCF9F42FFFFEFCDFFE9B45DFFE7AD4BFFD59830FFA77716B9000000220000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF000000
0000B68115A7DBAC58FFFFEECBFFE8B45DFFE6AC4BFFD6992EFFAF790FBB0000
00010000000000000000000000000000000000000000FFFFFF00FFFFFF000000
000000000000B68014A7E0B569FFFFEECBFFEFC476FFEBAD45FFA17E35FF1111
11330000000000000000000000000000000000000000FFFFFF00FFFFFF000000
00000000000000000000B68014A7DCAC56FFFFF0C7FFE0BD83FFB5B8BEFF7574
75E50000003300000033000000330000002600000000FFFFFF00FFFFFF000000
0000000000000000000000000000B98212AAA27E37FFE4E8EFFFCBCACCFFA8A7
A5FF757370FF8E8C8AFF7F7D7BFF737170CC0000002FFFFFFF00FFFFFF000000
000000000000000000000000000000000000000000007C7B7CEED2D0D1FFC9C7
C6FFD4D2D1FFECEBEBFFEFEFEFFFDCDCDCFF807E7CF0FFFFFF00FFFFFF000000
0000000000000000000000000000000000000000000081807FF3DBD9D8FFCECC
CCFFCDCBC9FFCBC9CAFF898684FF878582FF8A8886FFFFFFFF00FFFFFF000000
000000000000000000000000000000000000000000008B8988FFE1E1E0FFCAC8
C7FFCCCAC9FF8E8C89FF000000000000000000000000FFFFFF00FFFFFF000000
0000000000000000000000000000000000000000000092908DFFE2E2E1FFBBB9
B8FFBCBABAFF94928FFF000000330000003300000033FFFFFF00FFFFFF000000
00000000000000000000000000000000000000000000999794FAD4D3D3FFDDDB
DBFFB4B1AFFFA9A6A4FF9D9B98FF9E9C98FF9C9B97FFFFFFFF00FFFFFF000000
00000000000000000000000000000000000000000000A19F9C48AEACAAFFDADA
D9FFF0EEEFFFECEBEAFFE2E0E0FFBFBCBCFFA3A19EFFFFFFFF00FFFFFF000000
0000000000000000000000000000000000000000000000000000A6A4A133A5A3
9FE5AEACA9FFB9B6B5FFABA9A5FFA7A5A2D2A8A6A323FFFFFF00
}
ImageIndex = 23
OnClick = MenuItem77Click
end
end
object MenuItem14: TMenuItem
Caption = 'Project'
@ -4754,6 +4713,9 @@ object CEMainForm: TCEMainForm
}
end
end
object mnuOpts: TMenuItem
Caption = 'Options'
end
object mnuItemWin: TMenuItem
Caption = 'Windows'
object mnuLayout: TMenuItem

View File

@ -149,6 +149,7 @@ type
MenuItem103: TMenuItem;
MenuItem104: TMenuItem;
MenuItem105: TMenuItem;
mnuOpts: TMenuItem;
mnuItemMruGroup: TMenuItem;
MenuItem11: TMenuItem;
MenuItem12: TMenuItem;
@ -218,7 +219,6 @@ type
MenuItem74: TMenuItem;
MenuItem75: TMenuItem;
MenuItem76: TMenuItem;
MenuItem77: TMenuItem;
MenuItem78: TMenuItem;
MenuItem79: TMenuItem;
MenuItem80: TMenuItem;
@ -327,6 +327,7 @@ type
private
fOptionCategories: TCEEditableOptionsSubject;
fRunnablesOptions: TCEEditableRunnableOptions;
fSymStringExpander: ICESymStringExpander;
fProjectGroup: ICEProjectGroup;
@ -382,6 +383,7 @@ type
procedure updateMainMenuProviders;
procedure updateFloatingWidgetOnTop(onTop: boolean);
procedure widgetDockingChanged(sender: TCEWidget; newState: TWidgetDockingState);
procedure mnuOptsItemClick(sender: TObject);
// action provider handling;
procedure clearActProviderEntries;
@ -412,6 +414,7 @@ type
procedure InitMRUs;
procedure InitWidgets;
procedure InitDocking;
procedure InitOptionsMenu;
procedure LoadSettings;
procedure SaveSettings;
procedure LoadDocking;
@ -1122,6 +1125,7 @@ begin
inherited create(aOwner);
fMainMenuSubj := TCEMainMenuSubject.create;
fActionHandler := TCEActionProviderSubject.create;
fOptionCategories := TCEEditableOptionsSubject.create;
EntitiesConnector.addObserver(self);
@ -1143,6 +1147,8 @@ begin
getCMdParams;
fAppliOpts.assignTo(self);
InitOptionsMenu;
fInitialized := true;
end;
@ -1197,6 +1203,46 @@ begin
end;
end;
procedure TCEMainForm.InitOptionsMenu;
var
l: TStringList;
i: integer;
s: string;
t: TMenuItem;
e: ICEEditableOptions;
begin
l := TStringList.Create;
try
for i := 0 to fOptionCategories.observersCount-1 do
begin
e := fOptionCategories.observers[i] as ICEEditableOptions;
s := e.optionedWantCategory;
{$PUSH} {$WARNINGS OFF}
l.AddObject(s, TObject(e));
{$POP}
end;
l.Sort;
for i := 0 to l.Count-1 do
begin
t := TMenuItem.Create(self);
t.Caption := l[i];
t.Tag:= PtrInt(l.Objects[i]);
t.onClick := @mnuOptsItemClick;
mnuOpts.Add(t);
end;
finally
l.free;
end;
end;
procedure TCEMainForm.mnuOptsItemClick(sender: TObject);
var
c: ICEEditableOptions;
begin
c := ICEEditableOptions(TMenuItem(sender).Tag);
getOptionsEditor.showOptionEditor(c);
end;
procedure TCEMainForm.InitMRUs;
begin
fProjMru := TCEMRUProjectList.Create;
@ -1751,11 +1797,6 @@ begin
SaveDocking;
end;
procedure TCEMainForm.MenuItem77Click(Sender: TObject);
begin
fOptEdWidg.showWidget;
end;
destructor TCEMainForm.destroy;
begin
SaveSettings;
@ -1768,6 +1809,7 @@ begin
//
fMainMenuSubj.Free;
fActionHandler.Free;
fOptionCategories.Free;
EntitiesConnector.removeObserver(self);
inherited;
end;