Skip to content

Commit 858164b

Browse files
committed
New Menus
Interface, form.fpb + new menu with submenus containing shortcut keys for the different button actions interface_derived + ReloadData method ~ refactored startup code out of constructor into ReloadData + calls to clear vectors in ReloadData open_with_dlg.cpp ~ fixed bug where internal vector and list view were in opposite orders
1 parent 2e7fd33 commit 858164b

File tree

11 files changed

+193
-68
lines changed

11 files changed

+193
-68
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<array/>
5+
</plist>

mac.xcodeproj/xcshareddata/xcschemes/AppDynamic.xcscheme

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1100"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -27,8 +27,6 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30-
<Testables>
31-
</Testables>
3230
<MacroExpansion>
3331
<BuildableReference
3432
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
3836
ReferencedContainer = "container:mac.xcodeproj">
3937
</BuildableReference>
4038
</MacroExpansion>
41-
<AdditionalOptions>
42-
</AdditionalOptions>
39+
<Testables>
40+
</Testables>
4341
</TestAction>
4442
<LaunchAction
4543
buildConfiguration = "Debug"
@@ -61,8 +59,6 @@
6159
ReferencedContainer = "container:mac.xcodeproj">
6260
</BuildableReference>
6361
</BuildableProductRunnable>
64-
<AdditionalOptions>
65-
</AdditionalOptions>
6662
</LaunchAction>
6763
<ProfileAction
6864
buildConfiguration = "Release"

mac.xcodeproj/xcshareddata/xcschemes/AppStatic.xcscheme

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1100"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -27,8 +27,6 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30-
<Testables>
31-
</Testables>
3230
<MacroExpansion>
3331
<BuildableReference
3432
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
3836
ReferencedContainer = "container:mac.xcodeproj">
3937
</BuildableReference>
4038
</MacroExpansion>
41-
<AdditionalOptions>
42-
</AdditionalOptions>
39+
<Testables>
40+
</Testables>
4341
</TestAction>
4442
<LaunchAction
4543
buildConfiguration = "Debug"
@@ -61,8 +59,6 @@
6159
ReferencedContainer = "container:mac.xcodeproj">
6260
</BuildableReference>
6361
</BuildableProductRunnable>
64-
<AdditionalOptions>
65-
</AdditionalOptions>
6662
</LaunchAction>
6763
<ProfileAction
6864
buildConfiguration = "Release"

source/form.fbp

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,89 @@
12921292
<property name="window_extra_style"></property>
12931293
<property name="window_name"></property>
12941294
<property name="window_style"></property>
1295+
<object class="wxMenu" expanded="1">
1296+
<property name="label">Project</property>
1297+
<property name="name">menuProject</property>
1298+
<property name="permission">protected</property>
1299+
<object class="wxMenuItem" expanded="1">
1300+
<property name="bitmap"></property>
1301+
<property name="checked">0</property>
1302+
<property name="enabled">1</property>
1303+
<property name="help"></property>
1304+
<property name="id">wxID_NEW</property>
1305+
<property name="kind">wxITEM_NORMAL</property>
1306+
<property name="label">Create New Project</property>
1307+
<property name="name">menuCreate</property>
1308+
<property name="permission">none</property>
1309+
<property name="shortcut">Ctrl-N</property>
1310+
<property name="unchecked_bitmap"></property>
1311+
</object>
1312+
<object class="wxMenuItem" expanded="1">
1313+
<property name="bitmap"></property>
1314+
<property name="checked">0</property>
1315+
<property name="enabled">1</property>
1316+
<property name="help"></property>
1317+
<property name="id">wxID_ADD</property>
1318+
<property name="kind">wxITEM_NORMAL</property>
1319+
<property name="label">Add Existing Project</property>
1320+
<property name="name">menuAdd</property>
1321+
<property name="permission">none</property>
1322+
<property name="shortcut">Ctrl-Shift-N</property>
1323+
<property name="unchecked_bitmap"></property>
1324+
</object>
1325+
<object class="wxMenuItem" expanded="1">
1326+
<property name="bitmap"></property>
1327+
<property name="checked">0</property>
1328+
<property name="enabled">1</property>
1329+
<property name="help"></property>
1330+
<property name="id">wxID_DELETE</property>
1331+
<property name="kind">wxITEM_NORMAL</property>
1332+
<property name="label">Remove Project From List</property>
1333+
<property name="name">menuRemove</property>
1334+
<property name="permission">none</property>
1335+
<property name="shortcut">Ctrl--</property>
1336+
<property name="unchecked_bitmap"></property>
1337+
</object>
1338+
<object class="wxMenuItem" expanded="1">
1339+
<property name="bitmap"></property>
1340+
<property name="checked">0</property>
1341+
<property name="enabled">1</property>
1342+
<property name="help"></property>
1343+
<property name="id">wxID_FIND</property>
1344+
<property name="kind">wxITEM_NORMAL</property>
1345+
<property name="label">Reveal</property>
1346+
<property name="name">menuReveal</property>
1347+
<property name="permission">none</property>
1348+
<property name="shortcut">Ctrl-F</property>
1349+
<property name="unchecked_bitmap"></property>
1350+
</object>
1351+
<object class="wxMenuItem" expanded="1">
1352+
<property name="bitmap"></property>
1353+
<property name="checked">0</property>
1354+
<property name="enabled">1</property>
1355+
<property name="help"></property>
1356+
<property name="id">wxID_PROPERTIES</property>
1357+
<property name="kind">wxITEM_NORMAL</property>
1358+
<property name="label">Open In Different Version</property>
1359+
<property name="name">menuOpenWith</property>
1360+
<property name="permission">none</property>
1361+
<property name="shortcut">Ctrl-O</property>
1362+
<property name="unchecked_bitmap"></property>
1363+
</object>
1364+
<object class="wxMenuItem" expanded="1">
1365+
<property name="bitmap"></property>
1366+
<property name="checked">0</property>
1367+
<property name="enabled">1</property>
1368+
<property name="help"></property>
1369+
<property name="id">wxID_REFRESH</property>
1370+
<property name="kind">wxITEM_NORMAL</property>
1371+
<property name="label">Reload Data</property>
1372+
<property name="name">menuReload</property>
1373+
<property name="permission">none</property>
1374+
<property name="shortcut">Ctrl-R</property>
1375+
<property name="unchecked_bitmap"></property>
1376+
</object>
1377+
</object>
12951378
<object class="wxMenu" expanded="1">
12961379
<property name="label">Window</property>
12971380
<property name="name">menuWindow</property>

source/interface.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,33 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co
119119
this->SetSizer( main_sizer );
120120
this->Layout();
121121
menubar = new wxMenuBar( 0 );
122+
menuProject = new wxMenu();
123+
wxMenuItem* menuCreate;
124+
menuCreate = new wxMenuItem( menuProject, wxID_NEW, wxString( wxT("Create New Project") ) + wxT('\t') + wxT("Ctrl-N"), wxEmptyString, wxITEM_NORMAL );
125+
menuProject->Append( menuCreate );
126+
127+
wxMenuItem* menuAdd;
128+
menuAdd = new wxMenuItem( menuProject, wxID_ADD, wxString( wxT("Add Existing Project") ) + wxT('\t') + wxT("Ctrl-Shift-N"), wxEmptyString, wxITEM_NORMAL );
129+
menuProject->Append( menuAdd );
130+
131+
wxMenuItem* menuRemove;
132+
menuRemove = new wxMenuItem( menuProject, wxID_DELETE, wxString( wxT("Remove Project From List") ) + wxT('\t') + wxT("Ctrl--"), wxEmptyString, wxITEM_NORMAL );
133+
menuProject->Append( menuRemove );
134+
135+
wxMenuItem* menuReveal;
136+
menuReveal = new wxMenuItem( menuProject, wxID_FIND, wxString( wxT("Reveal") ) + wxT('\t') + wxT("Ctrl-F"), wxEmptyString, wxITEM_NORMAL );
137+
menuProject->Append( menuReveal );
138+
139+
wxMenuItem* menuOpenWith;
140+
menuOpenWith = new wxMenuItem( menuProject, wxID_PROPERTIES, wxString( wxT("Open In Different Version") ) + wxT('\t') + wxT("Ctrl-O"), wxEmptyString, wxITEM_NORMAL );
141+
menuProject->Append( menuOpenWith );
142+
143+
wxMenuItem* menuReload;
144+
menuReload = new wxMenuItem( menuProject, wxID_REFRESH, wxString( wxT("Reload Data") ) + wxT('\t') + wxT("Ctrl-R"), wxEmptyString, wxITEM_NORMAL );
145+
menuProject->Append( menuReload );
146+
147+
menubar->Append( menuProject, wxT("Project") );
148+
122149
menuWindow = new wxMenu();
123150
wxMenuItem* quit_menu;
124151
quit_menu = new wxMenuItem( menuWindow, wxID_EXIT, wxString( wxT("Close") ) + wxT('\t') + wxT("Ctrl-W"), wxEmptyString, wxITEM_NORMAL );

source/interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class MainFrame : public wxFrame
6565
wxButton* launchHubBtn;
6666
wxButton* reloadInstalls;
6767
wxMenuBar* menubar;
68+
wxMenu* menuProject;
6869
wxMenu* menuWindow;
6970

7071
public:

source/interface_derived.cpp

Lines changed: 62 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
//Declare events here
2121
wxBEGIN_EVENT_TABLE(MainFrameDerived, wxFrame)
2222
EVT_MENU(wxID_ABOUT, MainFrameDerived::OnAbout)
23+
EVT_MENU(wxID_NEW, MainFrameDerived::OnCreateProject)
24+
EVT_MENU(wxID_ADD, MainFrameDerived::OnAddProject)
25+
EVT_MENU(wxID_DELETE, MainFrameDerived::OnRemoveProject)
26+
EVT_MENU(wxID_FIND, MainFrameDerived::OnRevealProject)
27+
EVT_MENU(wxID_PROPERTIES, MainFrameDerived::OnOpenWith)
28+
EVT_MENU(wxID_REFRESH, MainFrameDerived::OnReloadData)
2329
EVT_BUTTON(wxID_ADD,MainFrameDerived::OnAddProject)
2430
EVT_BUTTON(wxID_NEW,MainFrameDerived::OnCreateProject)
2531
EVT_BUTTON(wxID_FIND,MainFrameDerived::OnLocateInstall)
@@ -54,55 +60,69 @@ MainFrameDerived::MainFrameDerived() : MainFrame(NULL){
5460
dpi_scale(this);
5561
#endif
5662
if (status != 0){
57-
//check that projects file exists in folder
58-
string p = string(datapath + dirsep + projectsFile);
59-
if (file_exists(p)){
60-
ifstream in;
61-
in.open(p);
62-
string line;
63-
//if one cannot be loaded
64-
vector<string> erroredProjects;
65-
//load each project (each path is on its own line)
66-
while (getline(in, line)){
67-
try{
68-
project pr = LoadProject(line);
69-
AddProject(pr);
70-
}
71-
catch(runtime_error& e){
72-
//remove project
73-
erroredProjects.push_back(line);
74-
}
63+
ReloadData();
64+
}
65+
//if no projects to load, the interface will be blank
66+
}
67+
68+
/**
69+
Loads the data in the main view. If anything is currently loaded, it will be cleared and re-loaded
70+
*/
71+
void MainFrameDerived::ReloadData(){
72+
//clear any existing items
73+
projectsList->DeleteAllItems();
74+
installsPathsList->DeleteAllItems();
75+
projects.clear();
76+
installPaths.clear();
77+
editors.clear();
78+
79+
//check that projects file exists in folder
80+
string p = string(datapath + dirsep + projectsFile);
81+
if (file_exists(p)){
82+
ifstream in;
83+
in.open(p);
84+
string line;
85+
//if one cannot be loaded
86+
vector<string> erroredProjects;
87+
//load each project (each path is on its own line)
88+
while (getline(in, line)){
89+
try{
90+
project pr = LoadProject(line);
91+
AddProject(pr);
7592
}
76-
//alert user if projects could not be loaded
77-
if (erroredProjects.size() > 0){
78-
//build string
79-
string str;
80-
for (string s : erroredProjects){
81-
str += s + "\n";
82-
}
83-
//message box
84-
wxMessageBox("The following projects could not be loaded. They have been removed from the list.\n\n"+str, "Loading error", wxOK | wxICON_WARNING );
85-
86-
//save to remove the broken projects
87-
SaveProjects();
93+
catch(runtime_error& e){
94+
//remove project
95+
erroredProjects.push_back(line);
8896
}
8997
}
90-
91-
//check that the installs path file exists in the folder
92-
p = string(datapath + dirsep + editorPathsFile);
93-
if (file_exists(p)){
94-
//load the editors
95-
ifstream in; in.open(p); string line;
96-
while (getline(in, line)){
97-
LoadEditorPath(line);
98+
//alert user if projects could not be loaded
99+
if (erroredProjects.size() > 0){
100+
//build string
101+
string str;
102+
for (string s : erroredProjects){
103+
str += s + "\n";
98104
}
105+
//message box
106+
wxMessageBox("The following projects could not be loaded. They have been removed from the list.\n\n"+str, "Loading error", wxOK | wxICON_WARNING );
107+
108+
//save to remove the broken projects
109+
SaveProjects();
99110
}
100-
else{
101-
//add default data
102-
LoadEditorPath(defaultInstall);
111+
}
112+
113+
//check that the installs path file exists in the folder
114+
p = string(datapath + dirsep + editorPathsFile);
115+
if (file_exists(p)){
116+
//load the editors
117+
ifstream in; in.open(p); string line;
118+
while (getline(in, line)){
119+
LoadEditorPath(line);
103120
}
104121
}
105-
//if no projects to load, the interface will be blank
122+
else{
123+
//add default data
124+
LoadEditorPath(defaultInstall);
125+
}
106126
}
107127

108128
//definitions for the events

source/interface_derived.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class MainFrameDerived : public MainFrame{
3030
void SaveEditorVersions();
3131
void LoadEditorPath(const string& path);
3232
void LoadEditorVersions();
33+
void ReloadData();
3334

3435
//will store the list of projects
3536
vector<project> projects;
@@ -43,6 +44,9 @@ class MainFrameDerived : public MainFrame{
4344
void OnRemoveInstallPath(wxCommandEvent& event);
4445
void OnRevealProject(wxCommandEvent& event);
4546
void OnOpenWith(wxCommandEvent& event);
47+
void OnReloadData(wxCommandEvent& event){
48+
ReloadData();
49+
}
4650
void OnRemoveProject(wxCommandEvent& event){
4751
long itemIndex = wxListCtrl_get_selected(projectsList);
4852
if (itemIndex > -1){

source/open_with_dlg.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ OpenWithDlg::OpenWithDlg(wxWindow* parent, const project& project, const vector<
1818
//fix window size
1919
fitWindowMinSize(this);
2020

21-
//populate list ctrl
22-
for (const editor& e : versions){
21+
//populate list ctrl in reverse so ids match
22+
for (unsigned long x = versions.size()-1; x >= 0; x--){
23+
editor e = versions[x];
2324
wxListItem i;
2425
i.SetId(0);
2526
string label = e.name + " - " + e.path;

wxWidgets/build/osx/wxcocoa.xcodeproj/xcshareddata/xcschemes/dynamic.xcscheme

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0460"
3+
LastUpgradeVersion = "1100"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
</Testables>
32-
<AdditionalOptions>
33-
</AdditionalOptions>
3432
</TestAction>
3533
<LaunchAction
3634
buildConfiguration = "Debug"
@@ -51,8 +49,6 @@
5149
ReferencedContainer = "container:wxcocoa.xcodeproj">
5250
</BuildableReference>
5351
</MacroExpansion>
54-
<AdditionalOptions>
55-
</AdditionalOptions>
5652
</LaunchAction>
5753
<ProfileAction
5854
buildConfiguration = "Release"

0 commit comments

Comments
 (0)