diff --git a/README.md b/README.md index b92cbfd..aed32ee 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Required packages: * build-essential * cmake * libssh2-1-dev -* libwxgtk3.0-dev +* libwxgtk3.0-dev or libwxgtk3.0-gtk3-dev After these packages are installed, the project should build with a simple `make` command. @@ -35,7 +35,7 @@ Build the app: ### Windows -See the guide for building on Windows: [Windows-Build](./Windows-Build.md) +* Todo ## Make commands Please note that make commands are chainable. For a typical programming loop, `make clean dev run` is very useful. diff --git a/src/TyroApp.cpp b/src/TyroApp.cpp index 3a699f9..dc8f59c 100644 --- a/src/TyroApp.cpp +++ b/src/TyroApp.cpp @@ -68,7 +68,10 @@ public: */ int OnExit() override { + wxLogDebug("Closing App..."); + // Deallocate config object + wxLogDebug("Deleting wxConfigBase"); delete wxConfigBase::Set((wxConfigBase *) nullptr); return close(true); @@ -117,7 +120,7 @@ private: /** * Set up mapping for lexers */ - void static InitLexerMap() + void const static InitLexerMap() { Glob_lexer_map[""] = wxSTC_LEX_NULL; Glob_lexer_map["batch"] = wxSTC_LEX_BATCH; diff --git a/src/settings/Config.cpp b/src/settings/Config.cpp index e2441cf..2ac75f3 100644 --- a/src/settings/Config.cpp +++ b/src/settings/Config.cpp @@ -4,8 +4,8 @@ #include "Config.h" -TyroConfig::TyroConfig() {} -TyroConfig::~TyroConfig() {} +TyroConfig::TyroConfig() = default; +TyroConfig::~TyroConfig() = default; void TyroConfig::LoadJson(const char json[]) { diff --git a/src/settings/LangConfig.cpp b/src/settings/LangConfig.cpp index 3c5546f..b675239 100644 --- a/src/settings/LangConfig.cpp +++ b/src/settings/LangConfig.cpp @@ -26,7 +26,10 @@ LangConfig::LangConfig() /** * Destructor */ -LangConfig::~LangConfig() {} +LangConfig::~LangConfig() +{ + wxLogDebug("LangConfig Destructor Called."); +} /** * Determine the format of the current file by @@ -110,7 +113,7 @@ JsonValue LangConfig::GetLexerMap(string lang) * @param string lang * @return void */ -void LangConfig::SetLang(string lang) +void LangConfig::SetLang(const string &lang) { this->language = lang; } @@ -142,7 +145,7 @@ string LangConfig::GetCurrentLangName() * @param string name * @return string */ -string LangConfig::GetLangByName(string name) +string LangConfig::GetLangByName(const string &name) { int count = this->reverseMap.count(name); return (count > 0) ? this->reverseMap[name] : ""; diff --git a/src/settings/LangConfig.h b/src/settings/LangConfig.h index 82665f6..21e1714 100644 --- a/src/settings/LangConfig.h +++ b/src/settings/LangConfig.h @@ -7,14 +7,14 @@ class LangConfig : TyroConfig { public: LangConfig(); ~LangConfig(); - void SetLang(string lang); + void SetLang(const string &lang); string GetLang(); string GetLangByFile(wxFileName &fileName); JsonValue GetKeywordList(string lang="none"); JsonValue GetLexerMap(string lang="none"); StringMap GetLangList(); string GetCurrentLangName(); - string GetLangByName(string name); + string GetLangByName(const string &name); private: string language; StringMap reverseMap; diff --git a/src/settings/ThemeConfig.cpp b/src/settings/ThemeConfig.cpp index 73cd71b..4afc7b7 100644 --- a/src/settings/ThemeConfig.cpp +++ b/src/settings/ThemeConfig.cpp @@ -17,7 +17,10 @@ ThemeConfig::ThemeConfig() /** * Destructor */ -ThemeConfig::~ThemeConfig() {} +ThemeConfig::~ThemeConfig() +{ + wxLogDebug("ThemeConfig Destructor Called."); +} /** * Set the current theme @@ -58,7 +61,7 @@ JsonValue ThemeConfig::GetTheme() * @param string key * @return JsonValue */ -JsonValue ThemeConfig::GetThemeValue(string type, string key) +JsonValue ThemeConfig::GetThemeValue(const string &type, const string &key) { JsonValue value = this->current_theme .get(type, JsonValue()) @@ -73,7 +76,7 @@ JsonValue ThemeConfig::GetThemeValue(string type, string key) * @param key * @return */ -wxColor ThemeConfig::GetThemeColor(string type, string key) +wxColor ThemeConfig::GetThemeColor(const string &type, const string &key) { JsonValue color_value = this->GetThemeValue(type, key); diff --git a/src/settings/ThemeConfig.h b/src/settings/ThemeConfig.h index 5e09f6d..d535dba 100644 --- a/src/settings/ThemeConfig.h +++ b/src/settings/ThemeConfig.h @@ -12,8 +12,8 @@ public: ~ThemeConfig(); bool SetTheme(const string &theme_name); JsonValue GetTheme(); - JsonValue GetThemeValue(string type, string key); - wxColor GetThemeColor(string type, string key); + JsonValue GetThemeValue(const string &type, const string &key); + wxColor GetThemeColor(const string &type, const string &key); private: JsonValue current_theme; }; diff --git a/src/widgets/EditPane.cpp b/src/widgets/EditPane.cpp index b0f860c..470921e 100644 --- a/src/widgets/EditPane.cpp +++ b/src/widgets/EditPane.cpp @@ -48,7 +48,7 @@ EditPane::EditPane( */ EditPane::~EditPane() { - wxLogDebug("Called EditPane Destructor"); + wxLogDebug("EditPane Destructor Called."); delete this->lang_config; delete this->theme_config; } diff --git a/src/widgets/FilePane.cpp b/src/widgets/FilePane.cpp index 915c679..3281548 100644 --- a/src/widgets/FilePane.cpp +++ b/src/widgets/FilePane.cpp @@ -41,6 +41,7 @@ FilePane::FilePane( FilePane::~FilePane() { + wxLogDebug("FilePane Destructor Called."); delete this->img_list; } diff --git a/src/widgets/MainFrame.cpp b/src/widgets/MainFrame.cpp index c80c171..3bc33e9 100644 --- a/src/widgets/MainFrame.cpp +++ b/src/widgets/MainFrame.cpp @@ -57,7 +57,8 @@ MainFrame::~MainFrame() Glob_status_bar->Destroy(); - manager->UnInit(); + + this->manager->UnInit(); } /** @@ -682,7 +683,8 @@ void MainFrame::OnToggleLineEndings(wxCommandEvent &event) void MainFrame::EnableEditControls(bool enable) { // Update menu items - Glob_menu_bar->EnableEditControls(enable); + auto menu_bar = (TyroMenu *) this->GetMenuBar(); + menu_bar->EnableEditControls(enable); // Toggle toolbar items this->toolBar->EnableTool(wxID_SAVE, enable); diff --git a/src/widgets/PrefPane.cpp b/src/widgets/PrefPane.cpp index bf8d780..66b830a 100644 --- a/src/widgets/PrefPane.cpp +++ b/src/widgets/PrefPane.cpp @@ -5,8 +5,14 @@ extern wxConfigBase *Glob_config; class GeneralPrefPanePage : public wxPanel { public: - GeneralPrefPanePage(wxWindow *parent) - : wxPanel(parent) + explicit GeneralPrefPanePage( + wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL | wxNO_BORDER, + const wxString& name = wxPanelNameStr + ) : wxPanel(parent, winid, pos, size, style, name) { auto BASE_MARGIN = 30; @@ -70,8 +76,9 @@ public: } } - ~GeneralPrefPanePage() + ~GeneralPrefPanePage() override { + wxLogDebug("GeneralPrefPanePage Destructor Called."); wxDELETE(this->showLineNumbers); wxDELETE(this->showIndentGuides); wxDELETE(this->showCodeFolding); @@ -83,7 +90,7 @@ public: * * @return bool */ - virtual bool TransferDataToWindow() + bool TransferDataToWindow() override { this->showLineNumbers->SetValue(Glob_config->ReadBool("show_line_numbers", true)); this->showIndentGuides->SetValue(Glob_config->ReadBool("show_indent_guides", false)); @@ -103,7 +110,7 @@ public: * * @return bool */ - virtual bool TransferDataFromWindow() + bool TransferDataFromWindow() override { Glob_config->Write("show_line_numbers", this->showLineNumbers->IsChecked()); Glob_config->Write("show_indent_guides", this->showIndentGuides->IsChecked()); @@ -132,7 +139,7 @@ private: class GeneralPrefPane: public wxStockPreferencesPage { public: GeneralPrefPane() : wxStockPreferencesPage(Kind_General) {} - virtual wxWindow *CreateWindow(wxWindow *parent) + wxWindow *CreateWindow(wxWindow *parent) override { return new GeneralPrefPanePage(parent); } @@ -150,7 +157,8 @@ PrefPane::PrefPane() PrefPane::~PrefPane() { - //delete this->pref_window; + wxLogDebug("PrefPane Destructor Called."); + delete this->pref_window; } void PrefPane::Show(wxWindow *parent) diff --git a/src/widgets/TabContainer.cpp b/src/widgets/TabContainer.cpp index 75fcbda..ffacae8 100644 --- a/src/widgets/TabContainer.cpp +++ b/src/widgets/TabContainer.cpp @@ -36,7 +36,7 @@ TabContainer::TabContainer( */ TabContainer::~TabContainer() { - wxLogDebug("TabContainer destructor called"); + wxLogDebug("TabContainer Destructor Called."); } /** @@ -71,7 +71,7 @@ void TabContainer::AddTab() * @param wxString filePath * @return void */ -void TabContainer::AddTab(wxString filePath) +void TabContainer::AddTab(const wxString &filePath) { wxFileName fileName(filePath); @@ -104,7 +104,7 @@ void TabContainer::AddTab(wxString filePath) * * @return *EditPane */ -EditPane *TabContainer::GetCurrentEditor() +EditPane* TabContainer::GetCurrentEditor() { return (EditPane *) this->GetCurrentPage(); } @@ -115,7 +115,7 @@ EditPane *TabContainer::GetCurrentEditor() * @param size_t page_idx * @return *EditPane */ -EditPane *TabContainer::GetEditor(size_t page_idx) +EditPane* TabContainer::GetEditor(size_t page_idx) { return (EditPane *) this->GetPage(page_idx); } @@ -184,7 +184,7 @@ void TabContainer::OnClosed(wxAuiNotebookEvent &WXUNUSED(event)) void TabContainer::OnTabContextMenu(wxAuiNotebookEvent &WXUNUSED(event)) { // Create Menu - wxMenu *contextMenu = new wxMenu(); + auto *contextMenu = new wxMenu(); contextMenu->Append(wxID_CLOSE, "&Close\tCtrl+W", "Close the current tab"); contextMenu->Append(myID_CLOSE_ALL, "C&lose All\tShift+Ctrl+W", "Close all open documents."); contextMenu->Append(myID_CLOSE_ALL_BUT_THIS, "Close All but this\tCtrl+Shift+Alt+W", "Close all open documents, except the one selected"); diff --git a/src/widgets/TabContainer.h b/src/widgets/TabContainer.h index ff4b122..78c5f08 100644 --- a/src/widgets/TabContainer.h +++ b/src/widgets/TabContainer.h @@ -13,16 +13,16 @@ static long tab_style = wxBORDER_NONE | wxAUI_NB_TAB_SPLIT |wxAUI_NB_TAB_MOVE class TabContainer: public wxAuiNotebook { public: - TabContainer( + explicit TabContainer( wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=tab_style ); - ~TabContainer(); + ~TabContainer() override; void AddTab(); - void AddTab(wxString filePath); + void AddTab(const wxString &filePath); EditPane *GetCurrentEditor(); EditPane *GetEditor(size_t page_idx); void OnCloseAll(wxCommandEvent &event); diff --git a/src/widgets/TyroMenu.cpp b/src/widgets/TyroMenu.cpp index 3289389..ecdbc43 100644 --- a/src/widgets/TyroMenu.cpp +++ b/src/widgets/TyroMenu.cpp @@ -166,7 +166,7 @@ void TyroMenu::EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable) */ void TyroMenu::SetCurrentLanguage(string lang) { - if (lang == "") + if (lang.empty()) { lang = "Plain Text"; }