Rename some components for better clarity

This commit is contained in:
Timothy Warren 2019-06-21 13:34:12 -04:00
parent 7ce71abc00
commit f07dc8148d
12 changed files with 112 additions and 115 deletions

View File

@ -16,6 +16,8 @@ wxConfigBase *Glob_config = nullptr;
TyroMenu *Glob_menu_bar = nullptr; TyroMenu *Glob_menu_bar = nullptr;
wxStatusBar *Glob_status_bar = nullptr; wxStatusBar *Glob_status_bar = nullptr;
MainFrame *Glob_main_frame = nullptr; MainFrame *Glob_main_frame = nullptr;
ThemeConfig *Glob_theme_config = nullptr;
LangConfig *Glob_lang_config = nullptr;
StringConstMap Glob_lexer_map; StringConstMap Glob_lexer_map;
/** /**
@ -29,9 +31,9 @@ public:
* *
* @return bool * @return bool
*/ */
bool OnInit() override bool OnInit() final
{ {
if ( ! wxApp::OnInit()) return false; // if ( ! wxApp::OnInit()) return false;
TyroApp::SetSystemOptions(); TyroApp::SetSystemOptions();
this->SetAppName(APP_NAME); this->SetAppName(APP_NAME);
@ -40,6 +42,8 @@ public:
// Initialize globals // Initialize globals
TyroApp::InitLexerMap(); TyroApp::InitLexerMap();
Glob_config = wxConfigBase::Get(); Glob_config = wxConfigBase::Get();
Glob_lang_config = new LangConfig();
Glob_theme_config = new ThemeConfig();
Glob_menu_bar = new TyroMenu(); Glob_menu_bar = new TyroMenu();
Glob_main_frame = new MainFrame(nullptr, APP_NAME, CalculateWindowSize()); Glob_main_frame = new MainFrame(nullptr, APP_NAME, CalculateWindowSize());
@ -98,12 +102,11 @@ public:
bool OnCmdLineParsed(wxCmdLineParser &parser) override bool OnCmdLineParsed(wxCmdLineParser &parser) override
{ {
// Get un-named parameters // Get un-named parameters
size_t i = 0;
this->param_count = parser.GetParamCount(); this->param_count = parser.GetParamCount();
wxLogDebug("%i Parameters", this->param_count); 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)); this->files.Add(parser.GetParam(i));
} }

View File

@ -2,11 +2,13 @@
* The editor widget * The editor widget
*/ */
#include "src/widgets/EditPane.h" #include "src/widgets/EditorPane.h"
#include "src/widgets/TabContainer.h" #include "src/widgets/TabContainer.h"
extern StringConstMap Glob_lexer_map; 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 * Constructor
@ -16,14 +18,10 @@ static wxConfig *Glob_config = nullptr;
* @param const wxPoint& pos * @param const wxPoint& pos
* @param const wxSize& size * @param const wxSize& size
*/ */
EditPane::EditPane( EditorPane::EditorPane(
wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size
) : wxStyledTextCtrl (parent, id, pos, size, wxBORDER_NONE) ) : wxStyledTextCtrl (parent, id, pos, size, wxBORDER_NONE)
{ {
Glob_config = (wxConfig *) wxConfigBase::Get();
this->lang_config = new LangConfig();
this->theme_config = new ThemeConfig();
this->BindEvents(); this->BindEvents();
// Some basic properties to set // Some basic properties to set
@ -47,11 +45,9 @@ EditPane::EditPane(
/** /**
* Destructor * Destructor
*/ */
EditPane::~EditPane() EditorPane::~EditorPane()
{ {
wxLogDebug("EditPane Destructor Called."); wxLogDebug("EditorPane Destructor Called.");
delete this->lang_config;
delete this->theme_config;
} }
/** /**
@ -61,12 +57,12 @@ EditPane::~EditPane()
* @param wxString filePath * @param wxString filePath
* @return void * @return void
*/ */
void EditPane::Highlight(const wxString &filePath) void EditorPane::Highlight(const wxString &filePath)
{ {
this->fileName.Assign(filePath); this->fileName.Assign(filePath);
// Get the configuration name for the selected language // 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 // Apply the theme
this->ApplyTheme(lang); this->ApplyTheme(lang);
@ -85,7 +81,7 @@ void EditPane::Highlight(const wxString &filePath)
* @param string theme * @param string theme
* @return void * @return void
*/ */
void EditPane::ApplyTheme(const string &lang, const string &theme) void EditorPane::ApplyTheme(const string &lang, const string &theme)
{ {
this->StyleClearAll(); this->StyleClearAll();
@ -100,12 +96,12 @@ void EditPane::ApplyTheme(const string &lang, const string &theme)
if ( ! theme.empty()) if ( ! theme.empty())
{ {
this->theme_config->SetTheme(theme); Glob_theme_config->SetTheme(theme);
} }
// Get the keywords and mapping for the selected language // Get the keywords and mapping for the selected language
JsonValue lexer_map = this->lang_config->GetLexerMap(lang); JsonValue lexer_map = Glob_lang_config->GetLexerMap(lang);
JsonValue keywords_array = this->lang_config->GetKeywordList(lang); JsonValue keywords_array = Glob_lang_config->GetKeywordList(lang);
if (keywords_array.isArray()) if (keywords_array.isArray())
{ {
@ -139,9 +135,9 @@ void EditPane::ApplyTheme(const string &lang, const string &theme)
* @param string [theme] * @param string [theme]
* @return void * @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 * @param wxString filePath
* @return bool * @return bool
*/ */
bool EditPane::Load(const wxString &filePath) bool EditorPane::Load(const wxString &filePath)
{ {
this->fileName.Assign(filePath); this->fileName.Assign(filePath);
@ -172,7 +168,7 @@ bool EditPane::Load(const wxString &filePath)
* *
* @return bool * @return bool
*/ */
bool EditPane::SaveFile() bool EditorPane::SaveFile()
{ {
wxString fname = this->fileName.GetFullPath(); wxString fname = this->fileName.GetFullPath();
@ -185,7 +181,7 @@ bool EditPane::SaveFile()
* @param const wxString filename * @param const wxString filename
* @return bool * @return bool
*/ */
bool EditPane::SaveFile(const wxString &filename) bool EditorPane::SaveFile(const wxString &filename)
{ {
if ( ! this->IsModified()) return true; if ( ! this->IsModified()) return true;
@ -219,7 +215,7 @@ bool EditPane::SaveFile(const wxString &filename)
* *
* @return bool * @return bool
*/ */
bool EditPane::FileReadable() bool EditorPane::FileReadable()
{ {
if ( if (
this->fileName.IsOk() && this->fileName.IsOk() &&
@ -244,7 +240,7 @@ bool EditPane::FileReadable()
* *
* @return bool * @return bool
*/ */
bool EditPane::FileWritable() bool EditorPane::FileWritable()
{ {
// Lets see...can we write somewhere? // Lets see...can we write somewhere?
if ( if (
@ -270,7 +266,7 @@ bool EditPane::FileWritable()
* *
* @return void * @return void
*/ */
void EditPane::BindEvents() void EditorPane::BindEvents()
{ {
// Code folding event handler // Code folding event handler
this->Bind(wxEVT_STC_MARGINCLICK, [=](wxStyledTextEvent& event) { this->Bind(wxEVT_STC_MARGINCLICK, [=](wxStyledTextEvent& event) {
@ -316,7 +312,7 @@ void EditPane::BindEvents()
} }
}, wxID_ANY); }, 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 * @param JsonValue lexer_map - Maps token types to theme colors
* @return void * @return void
*/ */
void EditPane::_ApplyTheme(JsonValue &lexer_map) void EditorPane::_ApplyTheme(JsonValue &lexer_map)
{ {
// Make sure to have a default font, especially for Linux // Make sure to have a default font, especially for Linux
wxFont globalFont = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT); wxFont globalFont = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT);
static const wxColor default_background = this->theme_config->GetThemeColor("background", "default"); static const wxColor default_background = Glob_theme_config->GetThemeColor("background", "default");
static const wxColor default_foreground = this->theme_config->GetThemeColor("foreground", "default"); static const wxColor default_foreground = Glob_theme_config->GetThemeColor("foreground", "default");
wxColor line_number_background = ( ! this->theme_config->GetThemeValue("line_numbers", "background").isNull()) wxColor line_number_background = ( ! Glob_theme_config->GetThemeValue("line_numbers", "background").isNull())
? (this->theme_config->GetThemeColor("line_numbers", "background")) ? (Glob_theme_config->GetThemeColor("line_numbers", "background"))
: default_background; : default_background;
wxColor line_number_foreground = ( ! this->theme_config->GetThemeValue("line_numbers", "foreground").isNull()) wxColor line_number_foreground = ( ! Glob_theme_config->GetThemeValue("line_numbers", "foreground").isNull())
? (this->theme_config->GetThemeColor("line_numbers", "foreground")) ? (Glob_theme_config->GetThemeColor("line_numbers", "foreground"))
: default_foreground; : default_foreground;
// Attempt to set the font according to config // Attempt to set the font according to config
@ -414,33 +410,33 @@ void EditPane::_ApplyTheme(JsonValue &lexer_map)
string key = lexer_map[i].asString(); string key = lexer_map[i].asString();
// Set the foreground color, if it exists // 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 // 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 // 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 // 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 // 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 * @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 * @param string name
* @return void * @return void
*/ */
void EditPane::SetCurrentLang(const string &name) void EditorPane::SetCurrentLang(const string &name)
{ {
// Update the current lang in the config // Update the current lang in the config
string langKey = this->lang_config->GetLangByName(name); string langKey = Glob_lang_config->GetLangByName(name);
this->lang_config->SetLang(langKey); Glob_lang_config->SetLang(langKey);
// Re-highlight the page with the new langauge // Re-highlight the page with the new langauge
this->ApplyTheme(langKey); this->ApplyTheme(langKey);

View File

@ -4,16 +4,16 @@
#include "src/settings/ThemeConfig.h" #include "src/settings/ThemeConfig.h"
class EditPane: public wxStyledTextCtrl class EditorPane: public wxStyledTextCtrl
{ {
public: public:
explicit EditPane( explicit EditorPane(
wxWindow *parent, wxWindow *parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
const wxPoint &post = wxDefaultPosition, const wxPoint &post = wxDefaultPosition,
const wxSize &size = wxDefaultSize const wxSize &size = wxDefaultSize
); );
~EditPane(); ~EditorPane();
wxFileName fileName; wxFileName fileName;
bool Load(const wxString &filePath); bool Load(const wxString &filePath);
void Highlight(const wxString &filePath); void Highlight(const wxString &filePath);
@ -25,8 +25,6 @@ public:
void SetCurrentLang(const string &name); void SetCurrentLang(const string &name);
protected: protected:
StringConstMap::iterator lexerMapIt; StringConstMap::iterator lexerMapIt;
LangConfig *lang_config = nullptr;
ThemeConfig *theme_config = nullptr;
bool FileReadable(); bool FileReadable();
bool FileWritable(); bool FileWritable();
void BindEvents(); void BindEvents();

View File

@ -1,6 +1,6 @@
#include <unordered_set> #include <unordered_set>
#include "src/widgets/FilePane.h" #include "src/widgets/FileTreePane.h"
#include "src/widgets/MainFrame.h" #include "src/widgets/MainFrame.h"
auto DIR_SEP = wxFileName::GetPathSeparator(); auto DIR_SEP = wxFileName::GetPathSeparator();
@ -12,7 +12,7 @@ enum
Icon_FolderOpened Icon_FolderOpened
}; };
FilePane::FilePane( FileTreePane::FileTreePane(
wxWindow* parent, wxWindow* parent,
wxWindowID id, wxWindowID id,
const wxPoint& pos, const wxPoint& pos,
@ -39,19 +39,19 @@ FilePane::FilePane(
this->SetSortColumn(0); this->SetSortColumn(0);
} }
FilePane::~FilePane() FileTreePane::~FileTreePane()
{ {
wxLogDebug("FilePane Destructor Called."); wxLogDebug("FileTreePane Destructor Called.");
delete this->img_list; 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_EXPANDING, &FileTreePane::OpenFolder, this, wxID_ANY);
this->Bind(wxEVT_TREELIST_ITEM_ACTIVATED, &FilePane::OpenFileInEditor, 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(); wxTreeListItem item = event.GetItem();
@ -63,7 +63,7 @@ void FilePane::OpenFolder(wxTreeListEvent& event)
/** /**
* Iterates through the specified folder and creates the tree view * 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! // Clear the tree!
this->DeleteAllItems(); this->DeleteAllItems();
@ -112,7 +112,7 @@ void FilePane::CreateTree(const wxString &path)
* *
* @access private * @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); wxLogInfo("AddDirToTree path: %s, parent: %s", path, parent);
auto fullPath = this->base_path; 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 wxString &path - The filesystem path
* @param wxArrayString *files - The list of files * @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); 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 * Open a file you double-click on the file list
*/ */
void FilePane::OpenFileInEditor(wxTreeListEvent& event) void FileTreePane::OpenFileInEditor(wxTreeListEvent& event)
{ {
wxTreeListItem item = event.GetItem(); wxTreeListItem item = event.GetItem();
auto data = (wxStringClientData*)this->GetItemData(item); 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 * Create the image list object for the file pane widget
*/ */
void FilePane::InitImageList() void FileTreePane::InitImageList()
{ {
wxSize iconSize = wxArtProvider::GetSizeHint(wxART_LIST); wxSize iconSize = wxArtProvider::GetSizeHint(wxART_LIST);

View File

@ -3,9 +3,9 @@
#include <unordered_set> #include <unordered_set>
#include "src/widgets/widget.h" #include "src/widgets/widget.h"
class FilePane : public wxTreeListCtrl { class FileTreePane : public wxTreeListCtrl {
public: public:
explicit FilePane( explicit FileTreePane(
wxWindow *parent, wxWindow *parent,
wxWindowID id=wxID_ANY, wxWindowID id=wxID_ANY,
const wxPoint &pos=wxDefaultPosition, const wxPoint &pos=wxDefaultPosition,
@ -13,7 +13,7 @@ public:
long style=wxTL_DEFAULT_STYLE, long style=wxTL_DEFAULT_STYLE,
const wxString &name=wxTreeListCtrlNameStr const wxString &name=wxTreeListCtrlNameStr
); );
~FilePane() override; ~FileTreePane() override;
void CreateTree(const wxString &path); void CreateTree(const wxString &path);
private: private:
wxString base_path = ""; wxString base_path = "";

View File

@ -20,8 +20,8 @@ MainFrame::MainFrame(wxFrame *frame, const wxString &title, const wxSize &size)
this->notebook = new TabContainer(this); this->notebook = new TabContainer(this);
// Initialize other widgets // Initialize other widgets
this->filePane = new FilePane(this); this->fileTreePane = new FileTreePane(this);
this->prefPane = new PrefPane(); this->prefFrame = new PrefFrame();
// Set the frame icon // Set the frame icon
wxIcon app_icon(tyro_icon); wxIcon app_icon(tyro_icon);
@ -51,8 +51,8 @@ MainFrame::~MainFrame()
wxDELETE(this->replaceDlg); wxDELETE(this->replaceDlg);
wxDELETE(this->findReplaceData); wxDELETE(this->findReplaceData);
wxDELETE(this->toolBar); wxDELETE(this->toolBar);
wxDELETE(this->prefPane); wxDELETE(this->prefFrame);
wxDELETE(this->filePane); wxDELETE(this->fileTreePane);
this->manager->UnInit(); this->manager->UnInit();
wxDELETE(this->notebook); wxDELETE(this->notebook);
@ -86,7 +86,7 @@ void MainFrame::MainLayout()
.RightDockable(true) .RightDockable(true)
.LeftDockable(true) .LeftDockable(true)
.Resizable(true); .Resizable(true);
this->manager->AddPane(this->filePane, filePaneInfo); this->manager->AddPane(this->fileTreePane, filePaneInfo);
wxAuiPaneInfo notebookPaneInfo; wxAuiPaneInfo notebookPaneInfo;
notebookPaneInfo.CenterPane(); notebookPaneInfo.CenterPane();
@ -178,7 +178,7 @@ void MainFrame::BindEvents()
// Edit Menu Events // Edit Menu Events
this->Bind(wxEVT_MENU, [=](wxCommandEvent& event) { this->Bind(wxEVT_MENU, [=](wxCommandEvent& event) {
EditPane *editor = this->notebook->GetCurrentEditor(); EditorPane *editor = this->notebook->GetCurrentEditor();
switch(event.GetId()) switch(event.GetId())
{ {
@ -207,7 +207,7 @@ void MainFrame::BindEvents()
break; break;
case wxID_PREFERENCES: case wxID_PREFERENCES:
this->prefPane->Show(this); this->prefFrame->Show(this);
break; break;
case wxID_FIND: case wxID_FIND:
@ -287,7 +287,7 @@ void MainFrame::OnOpenFolder(wxCommandEvent &event)
auto path = dlg.GetPath(); 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) 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 // Check if the filename is set for the current file
if ( ! editor->fileName.IsOk()) if ( ! editor->fileName.IsOk())
@ -375,7 +375,7 @@ void MainFrame::OnSave(wxCommandEvent &event)
*/ */
void MainFrame::OnSaveAs(wxCommandEvent &WXUNUSED(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 the file hasn't been changed, just return
if ( ! editor->IsModified()) return; if ( ! editor->IsModified()) return;
@ -495,7 +495,7 @@ void MainFrame::OnAbout(wxCommandEvent &WXUNUSED(event))
*/ */
void MainFrame::OnToggleWhitespace(wxCommandEvent& event) void MainFrame::OnToggleWhitespace(wxCommandEvent& event)
{ {
EditPane *editor = this->notebook->GetCurrentEditor(); EditorPane *editor = this->notebook->GetCurrentEditor();
int flag = (event.IsChecked()) int flag = (event.IsChecked())
? wxSTC_WS_VISIBLEALWAYS ? wxSTC_WS_VISIBLEALWAYS
: wxSTC_WS_INVISIBLE; : wxSTC_WS_INVISIBLE;
@ -545,7 +545,7 @@ void MainFrame::OnEditReplace(wxCommandEvent &WXUNUSED(event))
void MainFrame::OnFindDialog(wxFindDialogEvent &event) void MainFrame::OnFindDialog(wxFindDialogEvent &event)
{ {
wxEventType type = event.GetEventType(); wxEventType type = event.GetEventType();
EditPane *editor = this->notebook->GetCurrentEditor(); EditorPane *editor = this->notebook->GetCurrentEditor();
// Parse flags // Parse flags
uint stc_flags = 0; uint stc_flags = 0;
@ -644,7 +644,7 @@ void MainFrame::OnFindDialog(wxFindDialogEvent &event)
*/ */
void MainFrame::OnToggleLineWrap(wxCommandEvent &event) void MainFrame::OnToggleLineWrap(wxCommandEvent &event)
{ {
EditPane *editor = this->notebook->GetCurrentEditor(); EditorPane *editor = this->notebook->GetCurrentEditor();
int flag = (event.IsChecked()) int flag = (event.IsChecked())
? wxSTC_WRAP_WORD ? wxSTC_WRAP_WORD
: wxSTC_WRAP_NONE; : wxSTC_WRAP_NONE;

View File

@ -4,10 +4,10 @@
#pragma once #pragma once
#include "src/widgets/TyroMenu.h" #include "src/widgets/TyroMenu.h"
#include "src/widgets/EditPane.h" #include "src/widgets/EditorPane.h"
#include "src/widgets/TabContainer.h" #include "src/widgets/TabContainer.h"
#include "src/widgets/PrefPane.h" #include "src/widgets/PrefFrame.h"
#include "src/widgets/FilePane.h" #include "src/widgets/FileTreePane.h"
class MainFrame: public wxFrame class MainFrame: public wxFrame
{ {
@ -18,8 +18,8 @@ class MainFrame: public wxFrame
void OpenFiles(wxArrayString filelist); void OpenFiles(wxArrayString filelist);
void OnPrefsChanged(wxCommandEvent &event); void OnPrefsChanged(wxCommandEvent &event);
private: private:
PrefPane *prefPane = nullptr; PrefFrame *prefFrame = nullptr;
FilePane *filePane = nullptr; FileTreePane *fileTreePane = nullptr;
TabContainer *notebook = nullptr; TabContainer *notebook = nullptr;
wxAuiManager *manager = nullptr; wxAuiManager *manager = nullptr;
wxAuiToolBar *toolBar = nullptr; wxAuiToolBar *toolBar = nullptr;

View File

@ -1,4 +1,4 @@
#include "src/widgets/PrefPane.h" #include "src/widgets/PrefFrame.h"
#include "src/widgets/MainFrame.h" #include "src/widgets/MainFrame.h"
extern wxConfigBase *Glob_config; 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 = new wxPreferencesEditor();
this->pref_window->AddPage(new GeneralPrefPane()); this->pref_window->AddPage(new GeneralPrefPane());
} }
PrefPane::~PrefPane() PrefFrame::~PrefFrame()
{ {
wxLogDebug("PrefPane Destructor Called."); wxLogDebug("PrefFrame Destructor Called.");
delete this->pref_window; delete this->pref_window;
} }
void PrefPane::Show(wxWindow *parent) void PrefFrame::Show(wxWindow *parent)
{ {
this->pref_window->Show(parent); this->pref_window->Show(parent);
} }

View File

@ -5,10 +5,10 @@
#include "src/widgets/widget.h" #include "src/widgets/widget.h"
class PrefPane { class PrefFrame {
public: public:
PrefPane(); PrefFrame();
~PrefPane(); ~PrefFrame();
void Show(wxWindow *parent); void Show(wxWindow *parent);
protected: protected:

View File

@ -44,9 +44,9 @@ TabContainer::~TabContainer()
* *
* @return EditPane* * @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(); wxString caption = fileName.GetFullName();
EditPane *editor = this->NewEditor(); EditorPane *editor = this->NewEditor();
if (editor->Load(filePath)) if (editor->Load(filePath))
{ {
@ -104,9 +104,9 @@ void TabContainer::AddTab(const wxString &filePath)
* *
* @return *EditPane * @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 * @param size_t page_idx
* @return *EditPane * @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) void TabContainer::OnClose(wxAuiNotebookEvent &event)
{ {
int current_tab = this->GetSelection(); int current_tab = this->GetSelection();
EditPane *editor = this->GetCurrentEditor(); EditorPane *editor = this->GetCurrentEditor();
// Sanity check // Sanity check
if (current_tab == -1) return; if (current_tab == -1) return;
@ -246,7 +246,7 @@ void TabContainer::OnCloseAllButThis(wxCommandEvent &WXUNUSED(event))
*/ */
void TabContainer::OnTabSwitch(wxAuiNotebookEvent &event) void TabContainer::OnTabSwitch(wxAuiNotebookEvent &event)
{ {
EditPane *editor = this->GetEditor(event.GetSelection()); EditorPane *editor = this->GetEditor(event.GetSelection());
// Update view menu options // Update view menu options
Glob_menu_bar->SetIdChecked(myID_VIEW_WHITESPACE, (editor->GetViewWhiteSpace() == wxSTC_WS_VISIBLEALWAYS)); Glob_menu_bar->SetIdChecked(myID_VIEW_WHITESPACE, (editor->GetViewWhiteSpace() == wxSTC_WS_VISIBLEALWAYS));

View File

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "src/widgets/TyroMenu.h" #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 static long tab_style = wxBORDER_NONE | wxAUI_NB_TAB_SPLIT |wxAUI_NB_TAB_MOVE
| wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON
@ -23,13 +23,13 @@ public:
~TabContainer() override; ~TabContainer() override;
void AddTab(); void AddTab();
void AddTab(const wxString &filePath); void AddTab(const wxString &filePath);
EditPane *GetCurrentEditor(); EditorPane *GetCurrentEditor();
EditPane *GetEditor(size_t page_idx); EditorPane *GetEditor(size_t page_idx);
void OnCloseAll(wxCommandEvent &event); void OnCloseAll(wxCommandEvent &event);
void OnCloseAllButThis(wxCommandEvent &event); void OnCloseAllButThis(wxCommandEvent &event);
private: private:
unsigned long untitled_document_count = 0; unsigned long untitled_document_count = 0;
EditPane *NewEditor(); EditorPane *NewEditor();
void OnTabSwitch(wxAuiNotebookEvent &event); void OnTabSwitch(wxAuiNotebookEvent &event);
void OnClose(wxAuiNotebookEvent &event); void OnClose(wxAuiNotebookEvent &event);
void OnClosed(wxAuiNotebookEvent &event); void OnClosed(wxAuiNotebookEvent &event);

View File

@ -52,7 +52,7 @@ wxSize static CalculateWindowSize()
return base; return base;
} }
wxString static BaseName(wxString path) wxString static BaseName(const wxString &path)
{ {
auto fullPath = path.char_str(); auto fullPath = path.char_str();
auto base = basename(fullPath); auto base = basename(fullPath);