diff --git a/src/backend/globals.cpp b/src/backend/globals.cpp index e7d31fda..bb5a1a0e 100644 --- a/src/backend/globals.cpp +++ b/src/backend/globals.cpp @@ -58,4 +58,5 @@ namespace boss { const boost::filesystem::path polyfill_path = boost::filesystem::current_path() / "resources" / "polyfill.js"; const boost::filesystem::path settings_path = local_path / "settings.yaml"; const boost::filesystem::path log_path = local_path / "BOSSDebugLog.txt"; + const boost::filesystem::path l10n_path = "resources/l10n"; } diff --git a/src/backend/globals.h b/src/backend/globals.h index 712ff914..0e6aea32 100644 --- a/src/backend/globals.h +++ b/src/backend/globals.h @@ -59,6 +59,7 @@ namespace boss { extern const boost::filesystem::path polyfill_path; extern const boost::filesystem::path svn_path; extern const boost::filesystem::path log_path; + extern const boost::filesystem::path l10n_path; } #endif diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index 5e5c78ab..370bc5e8 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -27,21 +27,6 @@ #include #include -BEGIN_EVENT_TABLE( Editor, wxFrame ) - EVT_LIST_ITEM_SELECTED( LIST_Plugins, Editor::OnPluginSelect ) - EVT_LIST_ITEM_SELECTED( LIST_Reqs, Editor::OnRowSelect ) - EVT_LIST_ITEM_SELECTED( LIST_Incs, Editor::OnRowSelect ) - EVT_LIST_ITEM_SELECTED( LIST_LoadAfter, Editor::OnRowSelect ) - EVT_LIST_ITEM_SELECTED( LIST_Messages, Editor::OnRowSelect ) - EVT_LIST_ITEM_SELECTED( LIST_BashTags, Editor::OnRowSelect ) - EVT_NOTEBOOK_PAGE_CHANGED( BOOK_Lists, Editor::OnListBookChange ) - EVT_BUTTON ( BUTTON_Apply, Editor::OnQuit ) - EVT_BUTTON ( BUTTON_Cancel, Editor::OnQuit ) - EVT_BUTTON ( BUTTON_AddRow, Editor::OnAddRow ) - EVT_BUTTON ( BUTTON_EditRow, Editor::OnEditRow ) - EVT_BUTTON ( BUTTON_RemoveRow, Editor::OnRemoveRow ) -END_EVENT_TABLE() - using namespace std; wxString Language[2] = { @@ -197,6 +182,20 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli font.SetWeight(wxFONTWEIGHT_BOLD); pluginText->SetFont(font); + //Set up event handling. + Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &Editor::OnPluginSelect, this, LIST_Plugins); + Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &Editor::OnRowSelect, this, LIST_Reqs); + Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &Editor::OnRowSelect, this, LIST_Incs); + Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &Editor::OnRowSelect, this, LIST_LoadAfter); + Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &Editor::OnRowSelect, this, LIST_Messages); + Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &Editor::OnRowSelect, this, LIST_BashTags); + Bind(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, &Editor::OnListBookChange, this, BOOK_Lists); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &Editor::OnQuit, this, BUTTON_Apply); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &Editor::OnQuit, this, BUTTON_Cancel); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &Editor::OnAddRow, this, BUTTON_AddRow); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &Editor::OnEditRow, this, BUTTON_EditRow); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &Editor::OnRemoveRow, this, BUTTON_RemoveRow); + //Set up layout. wxBoxSizer * bigBox = new wxBoxSizer(wxHORIZONTAL); @@ -976,16 +975,28 @@ void MessageEditDialog::OnAdd(wxCommandEvent& event) { } void MessageEditDialog::OnEdit(wxCommandEvent& event) { - if (_content->GetFirstSelected() == -1) + if (_content->GetFirstSelected() == -1) { + wxMessageBox( + FromUTF8("Error: No content row selected."), + translate("BOSS: Error"), + wxOK | wxICON_ERROR, + NULL); return; + } long i = _content->GetFirstSelected(); _content->SetItem(i, 0, Language[_language->GetSelection()]); _content->SetItem(i, 1, _str->GetValue()); } void MessageEditDialog::OnRemove(wxCommandEvent& event) { - if (_content->GetFirstSelected() == -1) + if (_content->GetFirstSelected() == -1) { + wxMessageBox( + FromUTF8("Error: No content row selected."), + translate("BOSS: Error"), + wxOK | wxICON_ERROR, + NULL); return; + } _content->DeleteItem(_content->GetFirstSelected()); } diff --git a/src/gui/editor.h b/src/gui/editor.h index 5c5958b8..49e4959a 100644 --- a/src/gui/editor.h +++ b/src/gui/editor.h @@ -66,7 +66,6 @@ public: void OnRecalc(wxCommandEvent& event); void OnRowSelect(wxListEvent& event); void OnQuit(wxCommandEvent& event); - DECLARE_EVENT_TABLE() private: wxButton * addBtn; diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 9bdb24c0..27605279 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -135,7 +135,7 @@ bool BossGUI::OnInit() { wxLoc = new wxLocale(); if (!wxLoc->Init(lang, wxLOCALE_LOAD_DEFAULT)) throw runtime_error("System GUI text could not be set."); - wxLocale::AddCatalogLookupPathPrefix(".\\l10n"); + wxLocale::AddCatalogLookupPathPrefix(l10n_path.string().c_str()); wxLoc->AddCatalog("wxstd"); } catch(runtime_error &e) { // LOG_ERROR("could not implement translation: %s", e.what()); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index b6158279..809927d8 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -26,14 +26,6 @@ #include #include -BEGIN_EVENT_TABLE ( SettingsFrame, wxDialog ) - EVT_BUTTON ( wxID_OK, SettingsFrame::OnQuit) - EVT_LIST_ITEM_SELECTED( LIST_Games, SettingsFrame::OnGameSelect ) - EVT_BUTTON ( BUTTON_AddGame, SettingsFrame::OnAddGame ) - EVT_BUTTON ( BUTTON_EditGame, SettingsFrame::OnEditGame ) - EVT_BUTTON ( BUTTON_RemoveGame, SettingsFrame::OnRemoveGame ) -END_EVENT_TABLE() - using namespace std; SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings, std::vector& games) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER), _settings(settings), _games(games) { @@ -83,6 +75,13 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node gamesList->AppendColumn(translate("Install Path")); gamesList->AppendColumn(translate("Install Path Registry Key")); + //Set up event handling. + Bind(wxEVT_COMMAND_LIST_ITEM_SELECTED, &SettingsFrame::OnGameSelect, this, LIST_Games); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &SettingsFrame::OnQuit, this, wxID_OK); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &SettingsFrame::OnAddGame, this, BUTTON_AddGame); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &SettingsFrame::OnEditGame, this, BUTTON_EditGame); + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &SettingsFrame::OnRemoveGame, this, BUTTON_RemoveGame); + //Set up layout. wxSizerFlags leftItem(0); leftItem.Left(); @@ -124,7 +123,7 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node bigBox->AddSpacer(10); bigBox->AddStretchSpacer(1); - bigBox->Add(new wxStaticText(this, wxID_ANY, translate("Language changes will be applied after BOSS is restarted.")), wholeItem); + bigBox->Add(new wxStaticText(this, wxID_ANY, translate("Language and game changes will be applied after BOSS is restarted.")), wholeItem); //Need to add 'OK' and 'Cancel' buttons. wxSizer * sizer = CreateSeparatedButtonSizer(wxOK|wxCANCEL); diff --git a/src/gui/settings.h b/src/gui/settings.h index 68d13b94..1aadd672 100644 --- a/src/gui/settings.h +++ b/src/gui/settings.h @@ -41,7 +41,6 @@ public: void OnRemoveGame(wxCommandEvent& event); void SetDefaultValues(); - DECLARE_EVENT_TABLE() private: wxChoice *DebugVerbosityChoice; wxChoice *GameChoice; diff --git a/src/gui/viewer.cpp b/src/gui/viewer.cpp index d76137fe..ebf8663b 100644 --- a/src/gui/viewer.cpp +++ b/src/gui/viewer.cpp @@ -29,9 +29,6 @@ namespace fs = boost::filesystem; Viewer::Viewer(wxWindow *parent, const wxString& title, const std::string& path) : wxFrame(parent, wxID_ANY, title) { - if (!fs::exists(fs::absolute(path))) - throw boss::error(ERROR_PATH_NOT_FOUND, "The path \"" + path + "\" could not be found."); - wxWebView * web = wxWebView::New(this, wxID_ANY, "file://" + fs::absolute(path).string()); wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);