Ugly progress commit

This commit is contained in:
Timothy Warren 2020-07-16 10:09:19 -04:00
parent 37faa83103
commit 68624456f1
8 changed files with 88 additions and 74 deletions

View File

@ -61,7 +61,7 @@ include_directories(${INCLUDE_DIRS})
# set some platform-specific flags
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
#set(MACOSX_DEPLOYMENT_TARGET 10.9)
#set(MACOSX_DEPLOYMENT_TARGET 10.4)
#set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++")
add_definitions(-D__WXMAC__)
else()

View File

@ -19,8 +19,6 @@ MainFrame *Glob_main_frame = nullptr;
TyroMenu *Glob_menu_bar = nullptr;
wxStatusBar *Glob_status_bar = nullptr;
StringConstMap Glob_lexer_map;
/**
* Class with main method
*/
@ -39,7 +37,6 @@ public:
this->SetVendorName(APP_VENDOR);
// Initialize globals
TyroApp::InitLexerMap();
Glob_config = wxConfigBase::Get();
Glob_lang_config = new LangConfig();
Glob_theme_config = new ThemeConfig();
@ -117,43 +114,6 @@ private:
wxArrayString files;
size_t param_count = 0;
/**
* Set up mapping for lexers
*/
void const static InitLexerMap()
{
Glob_lexer_map[""] = wxSTC_LEX_NULL;
Glob_lexer_map["batch"] = wxSTC_LEX_BATCH;
Glob_lexer_map["caml"] = wxSTC_LEX_CAML;
Glob_lexer_map["cmake"] = wxSTC_LEX_CMAKE;
Glob_lexer_map["cpp"] = wxSTC_LEX_CPP;
Glob_lexer_map["css"] = wxSTC_LEX_CSS;
Glob_lexer_map["fortran"] = wxSTC_LEX_FORTRAN;
Glob_lexer_map["haskell"] = wxSTC_LEX_HASKELL;
Glob_lexer_map["java"] = wxSTC_LEX_CPP;
Glob_lexer_map["js"] = wxSTC_LEX_CPP;
Glob_lexer_map["lisp"] = wxSTC_LEX_LISP;
Glob_lexer_map["lua"] = wxSTC_LEX_LUA;
Glob_lexer_map["makefile"] = wxSTC_LEX_MAKEFILE;
Glob_lexer_map["markdown"] = wxSTC_LEX_MARKDOWN;
Glob_lexer_map["php"] = wxSTC_LEX_HTML;
Glob_lexer_map["perl"] = wxSTC_LEX_PERL;
Glob_lexer_map["properties"] = wxSTC_LEX_PROPERTIES;
Glob_lexer_map["python"] = wxSTC_LEX_PYTHON;
Glob_lexer_map["ruby"] = wxSTC_LEX_RUBY;
#ifdef wxSTC_LEX_RUST
Glob_lexer_map["rust"] = wxSTC_LEX_RUST;
#endif
#ifndef wxSTC_LEX_RUST
Glob_lexer_map["rust"] = wxSTC_LEX_CPP;
#endif
Glob_lexer_map["scheme"] = wxSTC_LEX_LISP;
Glob_lexer_map["shell"] = wxSTC_LEX_BASH;
Glob_lexer_map["sql"] = wxSTC_LEX_SQL;
Glob_lexer_map["xml"] = wxSTC_LEX_XML;
Glob_lexer_map["yaml"] = wxSTC_LEX_YAML;
}
/**
* Toolkit-specific settings
*/

View File

@ -56,7 +56,7 @@ const int TYRO_DEFAULT_FONT_SIZE = 10;
enum myMargins
{
MARGIN_FOLD,
MARGIN_LINE_NUMBERS
MARGIN_LINE_NUMBERS,
};
// Status bar sections
@ -66,7 +66,7 @@ enum myStatusBarSections {
STATUS_CURRENT_LANGUAGE,
STATUS_LINE_ENDINGS,
STATUS_CODE_PAGE,
STATUS_INDENT
STATUS_INDENT,
};
// Top level menus
@ -75,7 +75,7 @@ enum myMenuIds {
myEDIT_MENU,
myVIEW_MENU,
myLANG_MENU,
myHELP_MENU
myHELP_MENU,
};
// General Menu ids
@ -94,7 +94,7 @@ enum myMenuItemIds {
myID_PREFS_LINE_NUMBERS,
myID_PREFS_CODE_FOLDING,
myID_PREFS_IDENT_GUIDES,
myID_PREFS_FONT
myID_PREFS_FONT,
};
const wxString TYRO_FILE_OPEN_WILDCARDS =

View File

@ -5,11 +5,45 @@
#include "src/widgets/EditorPane.h"
#include "src/widgets/TabContainer.h"
extern StringConstMap Glob_lexer_map;
extern LangConfig *Glob_lang_config;
extern ThemeConfig *Glob_theme_config;
extern wxConfigBase *Glob_config;
/**
* Map language names to their appropriate lexers
*/
static StringConstMap LexerMap = {
{"", wxSTC_LEX_NULL},
{"batch", wxSTC_LEX_BATCH},
{"caml", wxSTC_LEX_CAML},
{"cmake", wxSTC_LEX_CMAKE},
{"cpp", wxSTC_LEX_CPP},
{"css", wxSTC_LEX_CSS},
{"fortran", wxSTC_LEX_FORTRAN},
{"haskell", wxSTC_LEX_HASKELL},
{"java", wxSTC_LEX_CPP},
{"js", wxSTC_LEX_CPP},
{"lisp", wxSTC_LEX_LISP},
{"lua", wxSTC_LEX_LUA},
{"makefile", wxSTC_LEX_MAKEFILE},
{"markdown", wxSTC_LEX_MARKDOWN},
{"php", wxSTC_LEX_HTML},
{"perl", wxSTC_LEX_PERL},
{"properties", wxSTC_LEX_PROPERTIES},
{"python", wxSTC_LEX_PYTHON},
{"ruby", wxSTC_LEX_RUBY},
#ifdef wxSTC_LEX_RUST
{"rust", wxSTC_LEX_RUST},
#else
{"rust", wxSTC_LEX_CPP},
#endif
{"scheme", wxSTC_LEX_LISP},
{"shell", wxSTC_LEX_BASH},
{"sql", wxSTC_LEX_SQL},
{"xml", wxSTC_LEX_XML},
{"yaml", wxSTC_LEX_YAML},
};
/**
* Constructor
*
@ -85,9 +119,9 @@ void EditorPane::ApplyTheme(const string &lang, const string &theme)
{
this->StyleClearAll();
if (Glob_lexer_map.count(lang) > 0)
if (LexerMap.count(lang) > 0)
{
this->SetLexer(Glob_lexer_map[lang]);
this->SetLexer(LexerMap[lang]);
}
else
{

View File

@ -3,7 +3,6 @@
#include "src/settings/LangConfig.h"
#include "src/settings/ThemeConfig.h"
class EditorPane: public wxStyledTextCtrl
{
public:

View File

@ -20,7 +20,9 @@ MainFrame::MainFrame(wxFrame *frame, const wxString &title, const wxSize &size)
this->notebook = new TabContainer(this);
// Initialize other widgets
#ifdef TYRO_FILETREE
this->fileTreePane = new FileTreePane(this);
#endif
this->prefFrame = new PrefFrame();
// Set the frame icon
@ -52,7 +54,9 @@ MainFrame::~MainFrame()
wxDELETE(this->findReplaceData);
wxDELETE(this->toolBar);
wxDELETE(this->prefFrame);
#ifdef TYRO_FILETREE
wxDELETE(this->fileTreePane);
#endif
this->manager->UnInit();
wxDELETE(this->notebook);
@ -80,6 +84,7 @@ void MainFrame::MainLayout()
.Resizable(true);
this->manager->AddPane(this->toolBar, toolBarPaneInfo);
#ifdef TYRO_FILETREE
wxAuiPaneInfo filePaneInfo;
filePaneInfo.Left()
.MinSize(225, 550)
@ -87,6 +92,7 @@ void MainFrame::MainLayout()
.LeftDockable(true)
.Resizable(true);
this->manager->AddPane(this->fileTreePane, filePaneInfo);
#endif
wxAuiPaneInfo notebookPaneInfo;
notebookPaneInfo.CenterPane();
@ -142,7 +148,9 @@ wxAuiToolBar* MainFrame::SetupToolbar()
toolBar->AddTool(wxID_NEW, "New", new_file_icon, "New file");
toolBar->AddTool(wxID_OPEN, "Open", open_file_icon, "Open file");
#ifdef __WXGTK__
#ifdef TYRO_FILETREE
toolBar->AddTool(myID_OPEN_DIR, "Open Dir", open_folder_icon, "Open folder");
#endif
#endif
toolBar->AddTool(wxID_SAVE, "Save", save_file_icon, "Save file");
@ -168,7 +176,9 @@ void MainFrame::BindEvents()
// File Menu Events
this->Bind(wxEVT_MENU, &MainFrame::OnNew, this, wxID_NEW);
this->Bind(wxEVT_MENU, &MainFrame::OnOpen, this, wxID_OPEN);
#ifdef TYRO_FILETREE
this->Bind(wxEVT_MENU, &MainFrame::OnOpenFolder, this, myID_OPEN_DIR);
#endif
this->Bind(wxEVT_MENU, &MainFrame::OnSave, this, wxID_SAVE);
this->Bind(wxEVT_MENU, &MainFrame::OnSaveAs, this, wxID_SAVEAS);
this->Bind(wxEVT_MENU, &MainFrame::OnCloseTab, this, wxID_CLOSE);
@ -279,6 +289,7 @@ void MainFrame::OnOpen(wxCommandEvent &WXUNUSED(event))
this->OpenFiles(filelist);
}
#ifdef TYRO_FILETREE
void MainFrame::OnOpenFolder(wxCommandEvent &event)
{
wxDirDialog dlg(this, "Select Project Dir", wxEmptyString, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST | wxDD_CHANGE_DIR);
@ -289,6 +300,7 @@ void MainFrame::OnOpenFolder(wxCommandEvent &event)
this->fileTreePane->CreateTree(path);
}
#endif
/**
* Open tabs containing the files passed

View File

@ -7,7 +7,10 @@
#include "src/widgets/EditorPane.h"
#include "src/widgets/TabContainer.h"
#include "src/widgets/PrefFrame.h"
#ifdef TYRO_FILETREE
#include "src/widgets/FileTreePane.h"
#endif
class MainFrame: public wxFrame
{
@ -19,7 +22,9 @@ class MainFrame: public wxFrame
void OnPrefsChanged();
private:
PrefFrame *prefFrame = nullptr;
#ifdef TYRO_FILETREE
FileTreePane *fileTreePane = nullptr;
#endif
TabContainer *notebook = nullptr;
wxAuiManager *manager = nullptr;
wxAuiToolBar *toolBar = nullptr;
@ -34,7 +39,9 @@ class MainFrame: public wxFrame
// Main Menu Event handlers
void OnNew(wxCommandEvent &event);
void OnOpen(wxCommandEvent &event);
#ifdef TYRO_FILETREE
void OnOpenFolder(wxCommandEvent &event);
#endif
void OnCloseAll(wxCommandEvent &event);
void OnSave(wxCommandEvent &event);
void OnSaveAs(wxCommandEvent &event);

View File

@ -43,7 +43,9 @@ void TyroMenu::SetupMainMenus()
this->fileMenu->Append(wxID_NEW, "&New\tCtrl+N", "Create a new file");
this->fileMenu->AppendSeparator();
this->fileMenu->Append(wxID_OPEN, "&Open\tCtrl+O", "Opens an existing file");
#ifdef TYRO_FILETREE
this->fileMenu->Append(myID_OPEN_DIR, "&Open Dir\tShift+Ctrl+O", "Opens the selected folder in the sidebar");
#endif
this->fileMenu->AppendSeparator();
this->fileMenu->Append(wxID_SAVE, "&Save\tCtrl+S", "Save the content");
this->fileMenu->Append(wxID_SAVEAS, "Save &As...\tShift+Ctrl+S", "Save current file as...");