Skip to content

Commit

Permalink
gimx-launcher: add "Open macro directory" to the file menu #550
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Laurendeau committed May 2, 2018
1 parent 53e1d1d commit c3c6104
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions launcher/gimx-launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const long launcherFrame::ID_PANEL1 = wxNewId();
const long launcherFrame::ID_MENUITEM1 = wxNewId();
const long launcherFrame::ID_MENUITEM2 = wxNewId();
const long launcherFrame::ID_MENUITEM8 = wxNewId();
const long launcherFrame::ID_MENUITEM11 = wxNewId();
const long launcherFrame::ID_MENUITEM7 = wxNewId();
const long launcherFrame::ID_MENUITEM3 = wxNewId();
const long launcherFrame::ID_MENUITEM9 = wxNewId();
Expand Down Expand Up @@ -1037,6 +1038,8 @@ launcherFrame::launcherFrame(wxWindow* parent,wxWindowID id __attribute__((unuse
Menu1->Append(MenuEditFpsConfig);
MenuItem3 = new wxMenuItem(Menu1, ID_MENUITEM8, _("Open config directory"), wxEmptyString, wxITEM_NORMAL);
Menu1->Append(MenuItem3);
MenuItem6 = new wxMenuItem(Menu1, ID_MENUITEM11, _("Open macro directory"), wxEmptyString, wxITEM_NORMAL);
Menu1->Append(MenuItem6);
MenuAutoBindControls = new wxMenuItem(Menu1, ID_MENUITEM7, _("Auto-bind and convert"), wxEmptyString, wxITEM_NORMAL);
Menu1->Append(MenuAutoBindControls);
MenuRefresh = new wxMenuItem(Menu1, ID_MENUITEM3, _("Refresh\tF5"), wxEmptyString, wxITEM_NORMAL);
Expand Down Expand Up @@ -1075,6 +1078,7 @@ launcherFrame::launcherFrame(wxWindow* parent,wxWindowID id __attribute__((unuse
Connect(ID_MENUITEM1,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&launcherFrame::OnMenuEditConfig);
Connect(ID_MENUITEM2,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&launcherFrame::OnMenuEditFpsConfig);
Connect(ID_MENUITEM8,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&launcherFrame::OnMenuOpenConfigDirectory);
Connect(ID_MENUITEM11,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&launcherFrame::OnMenuOpenMacroDirectory);
Connect(ID_MENUITEM7,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&launcherFrame::OnMenuAutoBindControls);
Connect(ID_MENUITEM3,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&launcherFrame::OnMenuRefresh);
Connect(ID_MENUITEM9,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&launcherFrame::OnMenuSave);
Expand Down Expand Up @@ -2193,6 +2197,16 @@ void launcherFrame::OnMenuOpenConfigDirectory(wxCommandEvent& event __attribute_
#endif
}

void launcherFrame::OnMenuOpenMacroDirectory(wxCommandEvent& event __attribute__((unused)))
{
#ifdef WIN32
gimxMacrosDir.Replace(wxT("/"), wxT("\\"));
wxExecute(wxT("explorer ") + gimxMacrosDir, wxEXEC_ASYNC, NULL);
#else
wxExecute(wxT("xdg-open ") + gimxMacrosDir, wxEXEC_ASYNC, NULL);
#endif
}

void launcherFrame::OnInputSelect(wxCommandEvent& event __attribute__((unused)))
{
if(Input->GetStringSelection() == _("Network"))
Expand Down
3 changes: 3 additions & 0 deletions launcher/gimx-launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class launcherFrame: public wxFrame
void OnOutputNewButtonClick(wxCommandEvent& event);
void OnInputNewButtonClick(wxCommandEvent& event);
void OnMenuUpdateFirmware(wxCommandEvent& event);
void OnMenuOpenMacroDirectory(wxCommandEvent& event);
//*)

void refresh();
Expand Down Expand Up @@ -147,6 +148,7 @@ class launcherFrame: public wxFrame
static const long ID_MENUITEM1;
static const long ID_MENUITEM2;
static const long ID_MENUITEM8;
static const long ID_MENUITEM11;
static const long ID_MENUITEM7;
static const long ID_MENUITEM3;
static const long ID_MENUITEM9;
Expand Down Expand Up @@ -189,6 +191,7 @@ class launcherFrame: public wxFrame
wxStaticText* StaticText2;
wxChoice* MouseGrabChoice;
wxMenuItem* MenuItem4;
wxMenuItem* MenuItem6;
wxButton* ButtonStart;
wxMenuItem* MenuEditConfig;
wxStaticText* OutputText;
Expand Down
4 changes: 4 additions & 0 deletions launcher/wxsmith/launcherframe.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@
<label>Open config directory</label>
<handler function="OnMenuOpenConfigDirectory" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUITEM11" variable="MenuItem6" member="yes">
<label>Open macro directory</label>
<handler function="OnMenuOpenMacroDirectory" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUITEM7" variable="MenuAutoBindControls" member="yes">
<label>Auto-bind and convert</label>
<handler function="OnMenuAutoBindControls" entry="EVT_MENU" />
Expand Down

0 comments on commit c3c6104

Please sign in to comment.