[ADDED] Patch: Implement Standard Names

Page 1 of 1
5 posts
[ADDED] Patch: Implement Standard Names

omalleypat
MMEX Developer

Posts: 175
Joined: Tue Jul 28, 2009 4:34 pm
Location: Atchison, KS
Wes, please have a look and approve since you wrote this originally...

A slightly different implementation to use the standard menu names to clean up the code a bit for mac. http://wiki.wxwidgets.org/WxMac-specific_topics#The_Mac_OS_menu_bar.

This will put the Prefs, Help, Exit, and About menu items where they should go automatically. There will be no quit in the file menu, it is moved to the application menu. Other than that, it should behave the same, but because we are using the standard menu item names, we can axe some of the #if statements:

Code: Select all
Index: src/mmex.cpp
===================================================================
--- src/mmex.cpp   (revision 662)
+++ src/mmex.cpp   (working copy)
@@ -164,20 +164,20 @@
     EVT_MENU(MENU_IMPORT_QIF, mmGUIFrame::OnImportQIF)
     EVT_MENU(MENU_IMPORT_QFX, mmGUIFrame::OnImportQFX)
     EVT_MENU(MENU_IMPORT_UNIVCSV, mmGUIFrame::OnImportUniversalCSV)
-    EVT_MENU(MENU_QUIT,  mmGUIFrame::OnQuit)
+    EVT_MENU(wxID_EXIT,  mmGUIFrame::OnQuit)
     EVT_MENU(MENU_NEWACCT,  mmGUIFrame::OnNewAccount)
     EVT_MENU(MENU_ACCTLIST,  mmGUIFrame::OnAccountList)
     EVT_MENU(MENU_ACCTEDIT,  mmGUIFrame::OnEditAccount)
     EVT_MENU(MENU_ACCTDELETE,  mmGUIFrame::OnDeleteAccount)
     EVT_MENU(MENU_ORGCATEGS,  mmGUIFrame::OnOrgCategories)
     EVT_MENU(MENU_ORGPAYEE,  mmGUIFrame::OnOrgPayees)
-    EVT_MENU(MENU_OPTIONS,  mmGUIFrame::OnOptions)
+    EVT_MENU(wxID_PREFERENCES,  mmGUIFrame::OnOptions)
     EVT_MENU(MENU_BUDGETSETUPDIALOG, mmGUIFrame::OnBudgetSetupDialog)
-    EVT_MENU(MENU_HELP,  mmGUIFrame::OnHelp)
+    EVT_MENU(wxID_HELP,  mmGUIFrame::OnHelp)
     EVT_MENU(MENU_CHECKUPDATE,  mmGUIFrame::OnCheckUpdate)
     EVT_MENU(MENU_REPORTISSUES,  mmGUIFrame::OnReportIssues)
     EVT_MENU(MENU_ANNOUNCEMENTMAILING,  mmGUIFrame::OnBeNotified)
-    EVT_MENU(MENU_ABOUT, mmGUIFrame::OnAbout)
+    EVT_MENU(wxID_ABOUT, mmGUIFrame::OnAbout)
     EVT_MENU(MENU_PRINT_PAGE_SETUP, mmGUIFrame::OnPrintPageSetup)
     EVT_MENU(MENU_PRINT_REPORT, mmGUIFrame::OnPrintPageReport)
     EVT_MENU(MENU_PRINT_PREVIEW_REPORT, mmGUIFrame::OnPrintPagePreview)
@@ -302,9 +302,6 @@
 //        mmIniOptions::enableGraphs_ = false;
 //#endif
 #if defined (__WXMAC__) || defined (__WXOSX__)
-   wxApp::s_macAboutMenuItemId = MENU_ABOUT;
-   wxApp::s_macPreferencesMenuItemId = MENU_OPTIONS;
-   wxApp::s_macHelpMenuTitleName = "&Help";
    wxSystemOptions::SetOption(wxMAC_ALWAYS_USE_GENERIC_LISTCTRL,1);
 #endif
 
@@ -638,7 +635,7 @@
     menuBar_->FindItem(MENU_IMPORT)->Enable(enable);
     menuBar_->FindItem(MENU_PRINT_PREVIEW)->Enable(enable);
     menuBar_->FindItem(MENU_PRINT)->Enable(enable);
-    menuBar_->FindItem(MENU_OPTIONS)->Enable(enable);
+    menuBar_->FindItem(wxID_PREFERENCES)->Enable(enable);
     if (mmIniOptions::enableRepeatingTransactions_)
       menuBar_->FindItem(MENU_BILLSDEPOSITS)->Enable(enable);
     if (mmIniOptions::enableStocks_)
@@ -2070,7 +2067,7 @@
 
     menuFile->AppendSeparator();
 
-    wxMenuItem* menuItemQuit = new wxMenuItem(menuFile, MENU_QUIT,
+    wxMenuItem* menuItemQuit = new wxMenuItem(menuFile, wxID_EXIT,
       _("E&xit\tAlt-X"), _("Quit this program"));
    menuItemQuit->SetBitmap(wxBitmap(exit_xpm));
     menuFile->Append(menuItemQuit);
@@ -2173,14 +2170,14 @@
 
     menuTools->AppendSeparator();
 
-    wxMenuItem* menuItemOptions = new wxMenuItem(menuTools, MENU_OPTIONS,
+    wxMenuItem* menuItemOptions = new wxMenuItem(menuTools, wxID_PREFERENCES,
         _("&Options"), _("Show the Options Dialog"));
    menuItemOptions->SetBitmap(wxBitmap(wrench_xpm));
     menuTools->Append(menuItemOptions);
 
     wxMenu *menuHelp = new wxMenu;
 
-    wxMenuItem* menuItemHelp = new wxMenuItem(menuTools, MENU_HELP,
+    wxMenuItem* menuItemHelp = new wxMenuItem(menuTools, wxID_HELP,
        _("&Help\tCtrl-F1"), _("Show the Help file"));
    menuItemHelp->SetBitmap(wxBitmap(help_xpm));
     menuHelp->Append(menuItemHelp);
@@ -2230,7 +2227,7 @@
        menuHelp->Append(menuItemNotify);
     }
         
-    wxMenuItem* menuItemAbout = new wxMenuItem(menuTools, MENU_ABOUT,
+    wxMenuItem* menuItemAbout = new wxMenuItem(menuTools, wxID_ABOUT,
        _("&About..."), _("Show about dialog"));
     menuItemAbout->SetBitmap(wxBitmap(about_xpm));
     menuHelp->Append(menuItemAbout);
@@ -3176,7 +3173,7 @@
     }
     else if (dlg->getReturnCode() == 2)
     {
-       wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, MENU_HELP);
+       wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxID_HELP);
        AddPendingEvent(evt);
     }
     else if (dlg->getReturnCode() == 3)
Re: Patch: Implement Standard Names

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
Sounds good man. I had looked at doing this before, but came to the conclusion that it was easier to put those couple of lines. This is better though. As soon as we no longer need generic wxlist implemented, we con get rid of the #if statement. Plus it removes the extra Quit Menu Item we have.

Thanks of looking at this. Can you commit this one?
Re: Patch: Implement Standard Names

omalleypat
MMEX Developer

Posts: 175
Joined: Tue Jul 28, 2009 4:34 pm
Location: Atchison, KS
I don't think I have commit privileges.
Re: Patch: Implement Standard Names

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
Okay, now that I have all that Xcode stuff out of the way, I've tried out your fixes and must say this is a better way. It shouldn't impact Windows or Linux, so I'll just commit.
Re: [ADDED] Patch: Implement Standard Names

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
Added Rev 678

Took a moment to change the html path to the version file used to track updates so that we can maintain this ourselves. I've added a version file to a new folder VersionKeeper in the MMEX files. Currently set to 0.9.4.2.
Page 1 of 1
Who is online

Users browsing this forum: No registered users and 1 guest