From f07dc8148d07fb3e0735b5937dd9f42248ba6617 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 21 Jun 2019 13:34:12 -0400 Subject: [PATCH] Rename some components for better clarity --- src/TyroApp.cpp | 11 ++- src/widgets/{EditPane.cpp => EditorPane.cpp} | 94 +++++++++---------- src/widgets/{EditPane.h => EditorPane.h} | 8 +- .../{FilePane.cpp => FileTreePane.cpp} | 26 ++--- src/widgets/{FilePane.h => FileTreePane.h} | 6 +- src/widgets/MainFrame.cpp | 26 ++--- src/widgets/MainFrame.h | 10 +- src/widgets/{PrefPane.cpp => PrefFrame.cpp} | 12 +-- src/widgets/{PrefPane.h => PrefFrame.h} | 6 +- src/widgets/TabContainer.cpp | 18 ++-- src/widgets/TabContainer.h | 8 +- src/wx_common.h | 2 +- 12 files changed, 112 insertions(+), 115 deletions(-) rename src/widgets/{EditPane.cpp => EditorPane.cpp} (76%) rename src/widgets/{EditPane.h => EditorPane.h} (83%) rename src/widgets/{FilePane.cpp => FileTreePane.cpp} (88%) rename src/widgets/{FilePane.h => FileTreePane.h} (89%) rename src/widgets/{PrefPane.cpp => PrefFrame.cpp} (96%) rename src/widgets/{PrefPane.h => PrefFrame.h} (78%) diff --git a/src/TyroApp.cpp b/src/TyroApp.cpp index 0996896..523e012 100644 --- a/src/TyroApp.cpp +++ b/src/TyroApp.cpp @@ -16,6 +16,8 @@ wxConfigBase *Glob_config = nullptr; TyroMenu *Glob_menu_bar = nullptr; wxStatusBar *Glob_status_bar = nullptr; MainFrame *Glob_main_frame = nullptr; +ThemeConfig *Glob_theme_config = nullptr; +LangConfig *Glob_lang_config = nullptr; StringConstMap Glob_lexer_map; /** @@ -29,9 +31,9 @@ public: * * @return bool */ - bool OnInit() override + bool OnInit() final { - if ( ! wxApp::OnInit()) return false; + // if ( ! wxApp::OnInit()) return false; TyroApp::SetSystemOptions(); this->SetAppName(APP_NAME); @@ -40,6 +42,8 @@ public: // Initialize globals TyroApp::InitLexerMap(); Glob_config = wxConfigBase::Get(); + Glob_lang_config = new LangConfig(); + Glob_theme_config = new ThemeConfig(); Glob_menu_bar = new TyroMenu(); Glob_main_frame = new MainFrame(nullptr, APP_NAME, CalculateWindowSize()); @@ -98,12 +102,11 @@ public: bool OnCmdLineParsed(wxCmdLineParser &parser) override { // Get un-named parameters - size_t i = 0; this->param_count = parser.GetParamCount(); wxLogDebug("%i Parameters", this->param_count); - for (; i < this->param_count; i++) + for (auto i = 0; i < this->param_count; i++) { this->files.Add(parser.GetParam(i)); } diff --git a/src/widgets/EditPane.cpp b/src/widgets/EditorPane.cpp similarity index 76% rename from src/widgets/EditPane.cpp rename to src/widgets/EditorPane.cpp index fbb4f5f..eda0d10 100644 --- a/src/widgets/EditPane.cpp +++ b/src/widgets/EditorPane.cpp @@ -2,11 +2,13 @@ * The editor widget */ -#include "src/widgets/EditPane.h" +#include "src/widgets/EditorPane.h" #include "src/widgets/TabContainer.h" extern StringConstMap Glob_lexer_map; -static wxConfig *Glob_config = nullptr; +extern LangConfig *Glob_lang_config; +extern ThemeConfig *Glob_theme_config; +extern wxConfigBase *Glob_config; /** * Constructor @@ -16,14 +18,10 @@ static wxConfig *Glob_config = nullptr; * @param const wxPoint& pos * @param const wxSize& size */ -EditPane::EditPane( +EditorPane::EditorPane( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size ) : wxStyledTextCtrl (parent, id, pos, size, wxBORDER_NONE) { - Glob_config = (wxConfig *) wxConfigBase::Get(); - this->lang_config = new LangConfig(); - this->theme_config = new ThemeConfig(); - this->BindEvents(); // Some basic properties to set @@ -35,7 +33,7 @@ EditPane::EditPane( this->SetProperty("lexer.cpp.track.preprocessor", "1"); this->SetProperty("font.quality", "3"); // LCD Optimized - //this->SetLayoutCache (wxSTC_CACHE_DOCUMENT); + // this->SetLayoutCache (wxSTC_CACHE_DOCUMENT); // set spaces and indention this->SetTabWidth(4); @@ -47,11 +45,9 @@ EditPane::EditPane( /** * Destructor */ -EditPane::~EditPane() +EditorPane::~EditorPane() { - wxLogDebug("EditPane Destructor Called."); - delete this->lang_config; - delete this->theme_config; + wxLogDebug("EditorPane Destructor Called."); } /** @@ -61,12 +57,12 @@ EditPane::~EditPane() * @param wxString filePath * @return void */ -void EditPane::Highlight(const wxString &filePath) +void EditorPane::Highlight(const wxString &filePath) { this->fileName.Assign(filePath); // Get the configuration name for the selected language - string lang = this->lang_config->GetLangByFile(this->fileName); + string lang = Glob_lang_config->GetLangByFile(this->fileName); // Apply the theme this->ApplyTheme(lang); @@ -85,7 +81,7 @@ void EditPane::Highlight(const wxString &filePath) * @param string theme * @return void */ -void EditPane::ApplyTheme(const string &lang, const string &theme) +void EditorPane::ApplyTheme(const string &lang, const string &theme) { this->StyleClearAll(); @@ -100,12 +96,12 @@ void EditPane::ApplyTheme(const string &lang, const string &theme) if ( ! theme.empty()) { - this->theme_config->SetTheme(theme); + Glob_theme_config->SetTheme(theme); } // Get the keywords and mapping for the selected language - JsonValue lexer_map = this->lang_config->GetLexerMap(lang); - JsonValue keywords_array = this->lang_config->GetKeywordList(lang); + JsonValue lexer_map = Glob_lang_config->GetLexerMap(lang); + JsonValue keywords_array = Glob_lang_config->GetKeywordList(lang); if (keywords_array.isArray()) { @@ -139,9 +135,9 @@ void EditPane::ApplyTheme(const string &lang, const string &theme) * @param string [theme] * @return void */ -void EditPane::ReApplyTheme(const string &theme) +void EditorPane::ReApplyTheme(const string &theme) { - this->ApplyTheme(this->lang_config->GetLangByName(this->GetCurrentLang()), theme); + this->ApplyTheme(Glob_lang_config->GetLangByName(this->GetCurrentLang()), theme); } /** @@ -150,7 +146,7 @@ void EditPane::ReApplyTheme(const string &theme) * @param wxString filePath * @return bool */ -bool EditPane::Load(const wxString &filePath) +bool EditorPane::Load(const wxString &filePath) { this->fileName.Assign(filePath); @@ -172,7 +168,7 @@ bool EditPane::Load(const wxString &filePath) * * @return bool */ -bool EditPane::SaveFile() +bool EditorPane::SaveFile() { wxString fname = this->fileName.GetFullPath(); @@ -185,7 +181,7 @@ bool EditPane::SaveFile() * @param const wxString filename * @return bool */ -bool EditPane::SaveFile(const wxString &filename) +bool EditorPane::SaveFile(const wxString &filename) { if ( ! this->IsModified()) return true; @@ -219,7 +215,7 @@ bool EditPane::SaveFile(const wxString &filename) * * @return bool */ -bool EditPane::FileReadable() +bool EditorPane::FileReadable() { if ( this->fileName.IsOk() && @@ -244,7 +240,7 @@ bool EditPane::FileReadable() * * @return bool */ -bool EditPane::FileWritable() +bool EditorPane::FileWritable() { // Lets see...can we write somewhere? if ( @@ -270,7 +266,7 @@ bool EditPane::FileWritable() * * @return void */ -void EditPane::BindEvents() +void EditorPane::BindEvents() { // Code folding event handler this->Bind(wxEVT_STC_MARGINCLICK, [=](wxStyledTextEvent& event) { @@ -316,7 +312,7 @@ void EditPane::BindEvents() } }, wxID_ANY); - // this->Bind(wxEVT_STC_CHARADDED, &EditPane::OnCharAdded, this, wxID_ANY); + // this->Bind(wxEVT_STC_CHARADDED, &EditorPane::OnCharAdded, this, wxID_ANY); } /** @@ -325,19 +321,19 @@ void EditPane::BindEvents() * @param JsonValue lexer_map - Maps token types to theme colors * @return void */ -void EditPane::_ApplyTheme(JsonValue &lexer_map) +void EditorPane::_ApplyTheme(JsonValue &lexer_map) { // Make sure to have a default font, especially for Linux wxFont globalFont = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT); - static const wxColor default_background = this->theme_config->GetThemeColor("background", "default"); - static const wxColor default_foreground = this->theme_config->GetThemeColor("foreground", "default"); - wxColor line_number_background = ( ! this->theme_config->GetThemeValue("line_numbers", "background").isNull()) - ? (this->theme_config->GetThemeColor("line_numbers", "background")) + static const wxColor default_background = Glob_theme_config->GetThemeColor("background", "default"); + static const wxColor default_foreground = Glob_theme_config->GetThemeColor("foreground", "default"); + wxColor line_number_background = ( ! Glob_theme_config->GetThemeValue("line_numbers", "background").isNull()) + ? (Glob_theme_config->GetThemeColor("line_numbers", "background")) : default_background; - wxColor line_number_foreground = ( ! this->theme_config->GetThemeValue("line_numbers", "foreground").isNull()) - ? (this->theme_config->GetThemeColor("line_numbers", "foreground")) + wxColor line_number_foreground = ( ! Glob_theme_config->GetThemeValue("line_numbers", "foreground").isNull()) + ? (Glob_theme_config->GetThemeColor("line_numbers", "foreground")) : default_foreground; // Attempt to set the font according to config @@ -414,33 +410,33 @@ void EditPane::_ApplyTheme(JsonValue &lexer_map) string key = lexer_map[i].asString(); // Set the foreground color, if it exists - if ( ! this->theme_config->GetThemeValue("foreground", key).isNull()) + if ( ! Glob_theme_config->GetThemeValue("foreground", key).isNull()) { - this->StyleSetForeground(i, this->theme_config->GetThemeColor("foreground", key)); + this->StyleSetForeground(i, Glob_theme_config->GetThemeColor("foreground", key)); } // Set the background color, if it exists - if ( ! this->theme_config->GetThemeValue("background", key).isNull()) + if ( ! Glob_theme_config->GetThemeValue("background", key).isNull()) { - this->StyleSetBackground(i, this->theme_config->GetThemeColor("background", key)); + this->StyleSetBackground(i, Glob_theme_config->GetThemeColor("background", key)); } // Set bold, if it applies - if (this->theme_config->GetThemeValue("bold", key).isBool()) + if (Glob_theme_config->GetThemeValue("bold", key).isBool()) { - this->StyleSetBold(i, this->theme_config->GetThemeValue("bold", key).asBool()); + this->StyleSetBold(i, Glob_theme_config->GetThemeValue("bold", key).asBool()); } // Italic - if (this->theme_config->GetThemeValue("italic", key).isBool()) + if (Glob_theme_config->GetThemeValue("italic", key).isBool()) { - this->StyleSetItalic(i, this->theme_config->GetThemeValue("italic", key).asBool()); + this->StyleSetItalic(i, Glob_theme_config->GetThemeValue("italic", key).asBool()); } // Underline - if (this->theme_config->GetThemeValue("underline", key).isBool()) + if (Glob_theme_config->GetThemeValue("underline", key).isBool()) { - this->StyleSetUnderline(i, this->theme_config->GetThemeValue("underline", key).asBool()); + this->StyleSetUnderline(i, Glob_theme_config->GetThemeValue("underline", key).asBool()); } } } @@ -451,9 +447,9 @@ void EditPane::_ApplyTheme(JsonValue &lexer_map) * * @return string */ -string EditPane::GetCurrentLang() +string EditorPane::GetCurrentLang() { - return this->lang_config->GetCurrentLangName(); + return Glob_lang_config->GetCurrentLangName(); } /** @@ -462,11 +458,11 @@ string EditPane::GetCurrentLang() * @param string name * @return void */ -void EditPane::SetCurrentLang(const string &name) +void EditorPane::SetCurrentLang(const string &name) { // Update the current lang in the config - string langKey = this->lang_config->GetLangByName(name); - this->lang_config->SetLang(langKey); + string langKey = Glob_lang_config->GetLangByName(name); + Glob_lang_config->SetLang(langKey); // Re-highlight the page with the new langauge this->ApplyTheme(langKey); diff --git a/src/widgets/EditPane.h b/src/widgets/EditorPane.h similarity index 83% rename from src/widgets/EditPane.h rename to src/widgets/EditorPane.h index 86122d9..aa3170c 100644 --- a/src/widgets/EditPane.h +++ b/src/widgets/EditorPane.h @@ -4,16 +4,16 @@ #include "src/settings/ThemeConfig.h" -class EditPane: public wxStyledTextCtrl +class EditorPane: public wxStyledTextCtrl { public: - explicit EditPane( + explicit EditorPane( wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &post = wxDefaultPosition, const wxSize &size = wxDefaultSize ); - ~EditPane(); + ~EditorPane(); wxFileName fileName; bool Load(const wxString &filePath); void Highlight(const wxString &filePath); @@ -25,8 +25,6 @@ public: void SetCurrentLang(const string &name); protected: StringConstMap::iterator lexerMapIt; - LangConfig *lang_config = nullptr; - ThemeConfig *theme_config = nullptr; bool FileReadable(); bool FileWritable(); void BindEvents(); diff --git a/src/widgets/FilePane.cpp b/src/widgets/FileTreePane.cpp similarity index 88% rename from src/widgets/FilePane.cpp rename to src/widgets/FileTreePane.cpp index 3281548..e2ea84c 100644 --- a/src/widgets/FilePane.cpp +++ b/src/widgets/FileTreePane.cpp @@ -1,6 +1,6 @@ #include -#include "src/widgets/FilePane.h" +#include "src/widgets/FileTreePane.h" #include "src/widgets/MainFrame.h" auto DIR_SEP = wxFileName::GetPathSeparator(); @@ -12,7 +12,7 @@ enum Icon_FolderOpened }; -FilePane::FilePane( +FileTreePane::FileTreePane( wxWindow* parent, wxWindowID id, const wxPoint& pos, @@ -39,19 +39,19 @@ FilePane::FilePane( this->SetSortColumn(0); } -FilePane::~FilePane() +FileTreePane::~FileTreePane() { - wxLogDebug("FilePane Destructor Called."); + wxLogDebug("FileTreePane Destructor Called."); delete this->img_list; } -void FilePane::BindEvents() +void FileTreePane::BindEvents() { - this->Bind(wxEVT_TREELIST_ITEM_EXPANDING, &FilePane::OpenFolder, this, wxID_ANY); - this->Bind(wxEVT_TREELIST_ITEM_ACTIVATED, &FilePane::OpenFileInEditor, this, wxID_ANY); + this->Bind(wxEVT_TREELIST_ITEM_EXPANDING, &FileTreePane::OpenFolder, this, wxID_ANY); + this->Bind(wxEVT_TREELIST_ITEM_ACTIVATED, &FileTreePane::OpenFileInEditor, this, wxID_ANY); } -void FilePane::OpenFolder(wxTreeListEvent& event) +void FileTreePane::OpenFolder(wxTreeListEvent& event) { wxTreeListItem item = event.GetItem(); @@ -63,7 +63,7 @@ void FilePane::OpenFolder(wxTreeListEvent& event) /** * Iterates through the specified folder and creates the tree view */ -void FilePane::CreateTree(const wxString &path) +void FileTreePane::CreateTree(const wxString &path) { // Clear the tree! this->DeleteAllItems(); @@ -112,7 +112,7 @@ void FilePane::CreateTree(const wxString &path) * * @access private */ -void FilePane::AddDirToTree(wxTreeListItem &root, const wxString &path, const wxString &parent, bool recurse) +void FileTreePane::AddDirToTree(wxTreeListItem &root, const wxString &path, const wxString &parent, bool recurse) { wxLogInfo("AddDirToTree path: %s, parent: %s", path, parent); auto fullPath = this->base_path; @@ -211,7 +211,7 @@ void FilePane::AddDirToTree(wxTreeListItem &root, const wxString &path, const wx * @param wxString &path - The filesystem path * @param wxArrayString *files - The list of files */ -void FilePane::AddDirFiles(wxTreeListItem &root, const wxString &path, wxArrayString *files) +void FileTreePane::AddDirFiles(wxTreeListItem &root, const wxString &path, wxArrayString *files) { wxLogInfo("Adding files for dir: %s", path); @@ -242,7 +242,7 @@ void FilePane::AddDirFiles(wxTreeListItem &root, const wxString &path, wxArraySt /** * Open a file you double-click on the file list */ -void FilePane::OpenFileInEditor(wxTreeListEvent& event) +void FileTreePane::OpenFileInEditor(wxTreeListEvent& event) { wxTreeListItem item = event.GetItem(); auto data = (wxStringClientData*)this->GetItemData(item); @@ -261,7 +261,7 @@ void FilePane::OpenFileInEditor(wxTreeListEvent& event) /** * Create the image list object for the file pane widget */ -void FilePane::InitImageList() +void FileTreePane::InitImageList() { wxSize iconSize = wxArtProvider::GetSizeHint(wxART_LIST); diff --git a/src/widgets/FilePane.h b/src/widgets/FileTreePane.h similarity index 89% rename from src/widgets/FilePane.h rename to src/widgets/FileTreePane.h index d8219a9..d5d1808 100644 --- a/src/widgets/FilePane.h +++ b/src/widgets/FileTreePane.h @@ -3,9 +3,9 @@ #include #include "src/widgets/widget.h" -class FilePane : public wxTreeListCtrl { +class FileTreePane : public wxTreeListCtrl { public: - explicit FilePane( + explicit FileTreePane( wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, @@ -13,7 +13,7 @@ public: long style=wxTL_DEFAULT_STYLE, const wxString &name=wxTreeListCtrlNameStr ); - ~FilePane() override; + ~FileTreePane() override; void CreateTree(const wxString &path); private: wxString base_path = ""; diff --git a/src/widgets/MainFrame.cpp b/src/widgets/MainFrame.cpp index 2cff200..2196ed1 100644 --- a/src/widgets/MainFrame.cpp +++ b/src/widgets/MainFrame.cpp @@ -20,8 +20,8 @@ MainFrame::MainFrame(wxFrame *frame, const wxString &title, const wxSize &size) this->notebook = new TabContainer(this); // Initialize other widgets - this->filePane = new FilePane(this); - this->prefPane = new PrefPane(); + this->fileTreePane = new FileTreePane(this); + this->prefFrame = new PrefFrame(); // Set the frame icon wxIcon app_icon(tyro_icon); @@ -51,8 +51,8 @@ MainFrame::~MainFrame() wxDELETE(this->replaceDlg); wxDELETE(this->findReplaceData); wxDELETE(this->toolBar); - wxDELETE(this->prefPane); - wxDELETE(this->filePane); + wxDELETE(this->prefFrame); + wxDELETE(this->fileTreePane); this->manager->UnInit(); wxDELETE(this->notebook); @@ -86,7 +86,7 @@ void MainFrame::MainLayout() .RightDockable(true) .LeftDockable(true) .Resizable(true); - this->manager->AddPane(this->filePane, filePaneInfo); + this->manager->AddPane(this->fileTreePane, filePaneInfo); wxAuiPaneInfo notebookPaneInfo; notebookPaneInfo.CenterPane(); @@ -178,7 +178,7 @@ void MainFrame::BindEvents() // Edit Menu Events this->Bind(wxEVT_MENU, [=](wxCommandEvent& event) { - EditPane *editor = this->notebook->GetCurrentEditor(); + EditorPane *editor = this->notebook->GetCurrentEditor(); switch(event.GetId()) { @@ -207,7 +207,7 @@ void MainFrame::BindEvents() break; case wxID_PREFERENCES: - this->prefPane->Show(this); + this->prefFrame->Show(this); break; case wxID_FIND: @@ -287,7 +287,7 @@ void MainFrame::OnOpenFolder(wxCommandEvent &event) auto path = dlg.GetPath(); - this->filePane->CreateTree(path); + this->fileTreePane->CreateTree(path); } /** @@ -356,7 +356,7 @@ void MainFrame::OnCloseAll(wxCommandEvent &WXUNUSED(event)) */ void MainFrame::OnSave(wxCommandEvent &event) { - EditPane *editor = this->notebook->GetCurrentEditor(); + EditorPane *editor = this->notebook->GetCurrentEditor(); // Check if the filename is set for the current file if ( ! editor->fileName.IsOk()) @@ -375,7 +375,7 @@ void MainFrame::OnSave(wxCommandEvent &event) */ void MainFrame::OnSaveAs(wxCommandEvent &WXUNUSED(event)) { - EditPane *editor = this->notebook->GetCurrentEditor(); + EditorPane *editor = this->notebook->GetCurrentEditor(); // If the file hasn't been changed, just return if ( ! editor->IsModified()) return; @@ -495,7 +495,7 @@ void MainFrame::OnAbout(wxCommandEvent &WXUNUSED(event)) */ void MainFrame::OnToggleWhitespace(wxCommandEvent& event) { - EditPane *editor = this->notebook->GetCurrentEditor(); + EditorPane *editor = this->notebook->GetCurrentEditor(); int flag = (event.IsChecked()) ? wxSTC_WS_VISIBLEALWAYS : wxSTC_WS_INVISIBLE; @@ -545,7 +545,7 @@ void MainFrame::OnEditReplace(wxCommandEvent &WXUNUSED(event)) void MainFrame::OnFindDialog(wxFindDialogEvent &event) { wxEventType type = event.GetEventType(); - EditPane *editor = this->notebook->GetCurrentEditor(); + EditorPane *editor = this->notebook->GetCurrentEditor(); // Parse flags uint stc_flags = 0; @@ -644,7 +644,7 @@ void MainFrame::OnFindDialog(wxFindDialogEvent &event) */ void MainFrame::OnToggleLineWrap(wxCommandEvent &event) { - EditPane *editor = this->notebook->GetCurrentEditor(); + EditorPane *editor = this->notebook->GetCurrentEditor(); int flag = (event.IsChecked()) ? wxSTC_WRAP_WORD : wxSTC_WRAP_NONE; diff --git a/src/widgets/MainFrame.h b/src/widgets/MainFrame.h index 248bd24..ba93d57 100644 --- a/src/widgets/MainFrame.h +++ b/src/widgets/MainFrame.h @@ -4,10 +4,10 @@ #pragma once #include "src/widgets/TyroMenu.h" -#include "src/widgets/EditPane.h" +#include "src/widgets/EditorPane.h" #include "src/widgets/TabContainer.h" -#include "src/widgets/PrefPane.h" -#include "src/widgets/FilePane.h" +#include "src/widgets/PrefFrame.h" +#include "src/widgets/FileTreePane.h" class MainFrame: public wxFrame { @@ -18,8 +18,8 @@ class MainFrame: public wxFrame void OpenFiles(wxArrayString filelist); void OnPrefsChanged(wxCommandEvent &event); private: - PrefPane *prefPane = nullptr; - FilePane *filePane = nullptr; + PrefFrame *prefFrame = nullptr; + FileTreePane *fileTreePane = nullptr; TabContainer *notebook = nullptr; wxAuiManager *manager = nullptr; wxAuiToolBar *toolBar = nullptr; diff --git a/src/widgets/PrefPane.cpp b/src/widgets/PrefFrame.cpp similarity index 96% rename from src/widgets/PrefPane.cpp rename to src/widgets/PrefFrame.cpp index 52e5aa6..c00805d 100644 --- a/src/widgets/PrefPane.cpp +++ b/src/widgets/PrefFrame.cpp @@ -1,4 +1,4 @@ -#include "src/widgets/PrefPane.h" +#include "src/widgets/PrefFrame.h" #include "src/widgets/MainFrame.h" extern wxConfigBase *Glob_config; @@ -150,22 +150,22 @@ public: }; // ----------------------------------------------------------------------------- -// ! Implementation of PrefPane Class +// ! Implementation of PrefFrame Class // ----------------------------------------------------------------------------- -PrefPane::PrefPane() +PrefFrame::PrefFrame() { this->pref_window = new wxPreferencesEditor(); this->pref_window->AddPage(new GeneralPrefPane()); } -PrefPane::~PrefPane() +PrefFrame::~PrefFrame() { - wxLogDebug("PrefPane Destructor Called."); + wxLogDebug("PrefFrame Destructor Called."); delete this->pref_window; } -void PrefPane::Show(wxWindow *parent) +void PrefFrame::Show(wxWindow *parent) { this->pref_window->Show(parent); } diff --git a/src/widgets/PrefPane.h b/src/widgets/PrefFrame.h similarity index 78% rename from src/widgets/PrefPane.h rename to src/widgets/PrefFrame.h index 0179d7f..4379faf 100644 --- a/src/widgets/PrefPane.h +++ b/src/widgets/PrefFrame.h @@ -5,10 +5,10 @@ #include "src/widgets/widget.h" -class PrefPane { +class PrefFrame { public: - PrefPane(); - ~PrefPane(); + PrefFrame(); + ~PrefFrame(); void Show(wxWindow *parent); protected: diff --git a/src/widgets/TabContainer.cpp b/src/widgets/TabContainer.cpp index 8934fd8..ae0534c 100644 --- a/src/widgets/TabContainer.cpp +++ b/src/widgets/TabContainer.cpp @@ -44,9 +44,9 @@ TabContainer::~TabContainer() * * @return EditPane* */ -EditPane* TabContainer::NewEditor() +EditorPane* TabContainer::NewEditor() { - return new EditPane(this); + return new EditorPane(this); } /** @@ -82,7 +82,7 @@ void TabContainer::AddTab(const wxString &filePath) } wxString caption = fileName.GetFullName(); - EditPane *editor = this->NewEditor(); + EditorPane *editor = this->NewEditor(); if (editor->Load(filePath)) { @@ -104,9 +104,9 @@ void TabContainer::AddTab(const wxString &filePath) * * @return *EditPane */ -EditPane* TabContainer::GetCurrentEditor() +EditorPane* TabContainer::GetCurrentEditor() { - return (EditPane *) this->GetCurrentPage(); + return (EditorPane *) this->GetCurrentPage(); } /** @@ -115,9 +115,9 @@ EditPane* TabContainer::GetCurrentEditor() * @param size_t page_idx * @return *EditPane */ -EditPane* TabContainer::GetEditor(size_t page_idx) +EditorPane* TabContainer::GetEditor(size_t page_idx) { - return (EditPane *) this->GetPage(page_idx); + return (EditorPane *) this->GetPage(page_idx); } /** @@ -129,7 +129,7 @@ EditPane* TabContainer::GetEditor(size_t page_idx) void TabContainer::OnClose(wxAuiNotebookEvent &event) { int current_tab = this->GetSelection(); - EditPane *editor = this->GetCurrentEditor(); + EditorPane *editor = this->GetCurrentEditor(); // Sanity check if (current_tab == -1) return; @@ -246,7 +246,7 @@ void TabContainer::OnCloseAllButThis(wxCommandEvent &WXUNUSED(event)) */ void TabContainer::OnTabSwitch(wxAuiNotebookEvent &event) { - EditPane *editor = this->GetEditor(event.GetSelection()); + EditorPane *editor = this->GetEditor(event.GetSelection()); // Update view menu options Glob_menu_bar->SetIdChecked(myID_VIEW_WHITESPACE, (editor->GetViewWhiteSpace() == wxSTC_WS_VISIBLEALWAYS)); diff --git a/src/widgets/TabContainer.h b/src/widgets/TabContainer.h index 78c5f08..74b9185 100644 --- a/src/widgets/TabContainer.h +++ b/src/widgets/TabContainer.h @@ -4,7 +4,7 @@ #pragma once #include "src/widgets/TyroMenu.h" -#include "src/widgets/EditPane.h" +#include "src/widgets/EditorPane.h" static long tab_style = wxBORDER_NONE | wxAUI_NB_TAB_SPLIT |wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON @@ -23,13 +23,13 @@ public: ~TabContainer() override; void AddTab(); void AddTab(const wxString &filePath); - EditPane *GetCurrentEditor(); - EditPane *GetEditor(size_t page_idx); + EditorPane *GetCurrentEditor(); + EditorPane *GetEditor(size_t page_idx); void OnCloseAll(wxCommandEvent &event); void OnCloseAllButThis(wxCommandEvent &event); private: unsigned long untitled_document_count = 0; - EditPane *NewEditor(); + EditorPane *NewEditor(); void OnTabSwitch(wxAuiNotebookEvent &event); void OnClose(wxAuiNotebookEvent &event); void OnClosed(wxAuiNotebookEvent &event); diff --git a/src/wx_common.h b/src/wx_common.h index 10c59d3..a7b35fe 100644 --- a/src/wx_common.h +++ b/src/wx_common.h @@ -52,7 +52,7 @@ wxSize static CalculateWindowSize() return base; } -wxString static BaseName(wxString path) +wxString static BaseName(const wxString &path) { auto fullPath = path.char_str(); auto base = basename(fullPath);