Ugly progress commit
This commit is contained in:
parent
37faa83103
commit
68624456f1
@ -61,7 +61,7 @@ include_directories(${INCLUDE_DIRS})
|
|||||||
|
|
||||||
# set some platform-specific flags
|
# set some platform-specific flags
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
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++")
|
#set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
add_definitions(-D__WXMAC__)
|
add_definitions(-D__WXMAC__)
|
||||||
else()
|
else()
|
||||||
|
@ -19,8 +19,6 @@ MainFrame *Glob_main_frame = nullptr;
|
|||||||
TyroMenu *Glob_menu_bar = nullptr;
|
TyroMenu *Glob_menu_bar = nullptr;
|
||||||
wxStatusBar *Glob_status_bar = nullptr;
|
wxStatusBar *Glob_status_bar = nullptr;
|
||||||
|
|
||||||
StringConstMap Glob_lexer_map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class with main method
|
* Class with main method
|
||||||
*/
|
*/
|
||||||
@ -39,7 +37,6 @@ public:
|
|||||||
this->SetVendorName(APP_VENDOR);
|
this->SetVendorName(APP_VENDOR);
|
||||||
|
|
||||||
// Initialize globals
|
// Initialize globals
|
||||||
TyroApp::InitLexerMap();
|
|
||||||
Glob_config = wxConfigBase::Get();
|
Glob_config = wxConfigBase::Get();
|
||||||
Glob_lang_config = new LangConfig();
|
Glob_lang_config = new LangConfig();
|
||||||
Glob_theme_config = new ThemeConfig();
|
Glob_theme_config = new ThemeConfig();
|
||||||
@ -116,43 +113,6 @@ private:
|
|||||||
// app loading variables
|
// app loading variables
|
||||||
wxArrayString files;
|
wxArrayString files;
|
||||||
size_t param_count = 0;
|
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
|
* Toolkit-specific settings
|
||||||
|
@ -34,7 +34,7 @@ const wxCmdLineEntryDesc Glob_cmdLineDesc[] = {
|
|||||||
nullptr,
|
nullptr,
|
||||||
"input file(s)",
|
"input file(s)",
|
||||||
wxCMD_LINE_VAL_STRING,
|
wxCMD_LINE_VAL_STRING,
|
||||||
wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE
|
wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE
|
||||||
},
|
},
|
||||||
{wxCMD_LINE_NONE}
|
{wxCMD_LINE_NONE}
|
||||||
};
|
};
|
||||||
@ -56,7 +56,7 @@ const int TYRO_DEFAULT_FONT_SIZE = 10;
|
|||||||
enum myMargins
|
enum myMargins
|
||||||
{
|
{
|
||||||
MARGIN_FOLD,
|
MARGIN_FOLD,
|
||||||
MARGIN_LINE_NUMBERS
|
MARGIN_LINE_NUMBERS,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Status bar sections
|
// Status bar sections
|
||||||
@ -66,7 +66,7 @@ enum myStatusBarSections {
|
|||||||
STATUS_CURRENT_LANGUAGE,
|
STATUS_CURRENT_LANGUAGE,
|
||||||
STATUS_LINE_ENDINGS,
|
STATUS_LINE_ENDINGS,
|
||||||
STATUS_CODE_PAGE,
|
STATUS_CODE_PAGE,
|
||||||
STATUS_INDENT
|
STATUS_INDENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Top level menus
|
// Top level menus
|
||||||
@ -75,7 +75,7 @@ enum myMenuIds {
|
|||||||
myEDIT_MENU,
|
myEDIT_MENU,
|
||||||
myVIEW_MENU,
|
myVIEW_MENU,
|
||||||
myLANG_MENU,
|
myLANG_MENU,
|
||||||
myHELP_MENU
|
myHELP_MENU,
|
||||||
};
|
};
|
||||||
|
|
||||||
// General Menu ids
|
// General Menu ids
|
||||||
@ -89,12 +89,12 @@ enum myMenuItemIds {
|
|||||||
myID_CLOSE_ALL,
|
myID_CLOSE_ALL,
|
||||||
myID_CLOSE_ALL_BUT_THIS,
|
myID_CLOSE_ALL_BUT_THIS,
|
||||||
myID_LINE_WRAP,
|
myID_LINE_WRAP,
|
||||||
|
|
||||||
// Preferences, to apply to all files
|
// Preferences, to apply to all files
|
||||||
myID_PREFS_LINE_NUMBERS,
|
myID_PREFS_LINE_NUMBERS,
|
||||||
myID_PREFS_CODE_FOLDING,
|
myID_PREFS_CODE_FOLDING,
|
||||||
myID_PREFS_IDENT_GUIDES,
|
myID_PREFS_IDENT_GUIDES,
|
||||||
myID_PREFS_FONT
|
myID_PREFS_FONT,
|
||||||
};
|
};
|
||||||
|
|
||||||
const wxString TYRO_FILE_OPEN_WILDCARDS =
|
const wxString TYRO_FILE_OPEN_WILDCARDS =
|
||||||
|
@ -5,11 +5,45 @@
|
|||||||
#include "src/widgets/EditorPane.h"
|
#include "src/widgets/EditorPane.h"
|
||||||
#include "src/widgets/TabContainer.h"
|
#include "src/widgets/TabContainer.h"
|
||||||
|
|
||||||
extern StringConstMap Glob_lexer_map;
|
|
||||||
extern LangConfig *Glob_lang_config;
|
extern LangConfig *Glob_lang_config;
|
||||||
extern ThemeConfig *Glob_theme_config;
|
extern ThemeConfig *Glob_theme_config;
|
||||||
extern wxConfigBase *Glob_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
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -85,9 +119,9 @@ void EditorPane::ApplyTheme(const string &lang, const string &theme)
|
|||||||
{
|
{
|
||||||
this->StyleClearAll();
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "src/settings/LangConfig.h"
|
#include "src/settings/LangConfig.h"
|
||||||
#include "src/settings/ThemeConfig.h"
|
#include "src/settings/ThemeConfig.h"
|
||||||
|
|
||||||
|
|
||||||
class EditorPane: public wxStyledTextCtrl
|
class EditorPane: public wxStyledTextCtrl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -20,7 +20,9 @@ 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
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
this->fileTreePane = new FileTreePane(this);
|
this->fileTreePane = new FileTreePane(this);
|
||||||
|
#endif
|
||||||
this->prefFrame = new PrefFrame();
|
this->prefFrame = new PrefFrame();
|
||||||
|
|
||||||
// Set the frame icon
|
// Set the frame icon
|
||||||
@ -52,7 +54,9 @@ MainFrame::~MainFrame()
|
|||||||
wxDELETE(this->findReplaceData);
|
wxDELETE(this->findReplaceData);
|
||||||
wxDELETE(this->toolBar);
|
wxDELETE(this->toolBar);
|
||||||
wxDELETE(this->prefFrame);
|
wxDELETE(this->prefFrame);
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
wxDELETE(this->fileTreePane);
|
wxDELETE(this->fileTreePane);
|
||||||
|
#endif
|
||||||
this->manager->UnInit();
|
this->manager->UnInit();
|
||||||
|
|
||||||
wxDELETE(this->notebook);
|
wxDELETE(this->notebook);
|
||||||
@ -80,6 +84,7 @@ void MainFrame::MainLayout()
|
|||||||
.Resizable(true);
|
.Resizable(true);
|
||||||
this->manager->AddPane(this->toolBar, toolBarPaneInfo);
|
this->manager->AddPane(this->toolBar, toolBarPaneInfo);
|
||||||
|
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
wxAuiPaneInfo filePaneInfo;
|
wxAuiPaneInfo filePaneInfo;
|
||||||
filePaneInfo.Left()
|
filePaneInfo.Left()
|
||||||
.MinSize(225, 550)
|
.MinSize(225, 550)
|
||||||
@ -87,6 +92,7 @@ void MainFrame::MainLayout()
|
|||||||
.LeftDockable(true)
|
.LeftDockable(true)
|
||||||
.Resizable(true);
|
.Resizable(true);
|
||||||
this->manager->AddPane(this->fileTreePane, filePaneInfo);
|
this->manager->AddPane(this->fileTreePane, filePaneInfo);
|
||||||
|
#endif
|
||||||
|
|
||||||
wxAuiPaneInfo notebookPaneInfo;
|
wxAuiPaneInfo notebookPaneInfo;
|
||||||
notebookPaneInfo.CenterPane();
|
notebookPaneInfo.CenterPane();
|
||||||
@ -142,7 +148,9 @@ wxAuiToolBar* MainFrame::SetupToolbar()
|
|||||||
toolBar->AddTool(wxID_NEW, "New", new_file_icon, "New file");
|
toolBar->AddTool(wxID_NEW, "New", new_file_icon, "New file");
|
||||||
toolBar->AddTool(wxID_OPEN, "Open", open_file_icon, "Open file");
|
toolBar->AddTool(wxID_OPEN, "Open", open_file_icon, "Open file");
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
toolBar->AddTool(myID_OPEN_DIR, "Open Dir", open_folder_icon, "Open folder");
|
toolBar->AddTool(myID_OPEN_DIR, "Open Dir", open_folder_icon, "Open folder");
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
toolBar->AddTool(wxID_SAVE, "Save", save_file_icon, "Save file");
|
toolBar->AddTool(wxID_SAVE, "Save", save_file_icon, "Save file");
|
||||||
|
|
||||||
@ -168,7 +176,9 @@ void MainFrame::BindEvents()
|
|||||||
// File Menu Events
|
// File Menu Events
|
||||||
this->Bind(wxEVT_MENU, &MainFrame::OnNew, this, wxID_NEW);
|
this->Bind(wxEVT_MENU, &MainFrame::OnNew, this, wxID_NEW);
|
||||||
this->Bind(wxEVT_MENU, &MainFrame::OnOpen, this, wxID_OPEN);
|
this->Bind(wxEVT_MENU, &MainFrame::OnOpen, this, wxID_OPEN);
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
this->Bind(wxEVT_MENU, &MainFrame::OnOpenFolder, this, myID_OPEN_DIR);
|
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::OnSave, this, wxID_SAVE);
|
||||||
this->Bind(wxEVT_MENU, &MainFrame::OnSaveAs, this, wxID_SAVEAS);
|
this->Bind(wxEVT_MENU, &MainFrame::OnSaveAs, this, wxID_SAVEAS);
|
||||||
this->Bind(wxEVT_MENU, &MainFrame::OnCloseTab, this, wxID_CLOSE);
|
this->Bind(wxEVT_MENU, &MainFrame::OnCloseTab, this, wxID_CLOSE);
|
||||||
@ -279,6 +289,7 @@ void MainFrame::OnOpen(wxCommandEvent &WXUNUSED(event))
|
|||||||
this->OpenFiles(filelist);
|
this->OpenFiles(filelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
void MainFrame::OnOpenFolder(wxCommandEvent &event)
|
void MainFrame::OnOpenFolder(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
wxDirDialog dlg(this, "Select Project Dir", wxEmptyString, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST | wxDD_CHANGE_DIR);
|
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);
|
this->fileTreePane->CreateTree(path);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open tabs containing the files passed
|
* Open tabs containing the files passed
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
#include "src/widgets/EditorPane.h"
|
#include "src/widgets/EditorPane.h"
|
||||||
#include "src/widgets/TabContainer.h"
|
#include "src/widgets/TabContainer.h"
|
||||||
#include "src/widgets/PrefFrame.h"
|
#include "src/widgets/PrefFrame.h"
|
||||||
|
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
#include "src/widgets/FileTreePane.h"
|
#include "src/widgets/FileTreePane.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class MainFrame: public wxFrame
|
class MainFrame: public wxFrame
|
||||||
{
|
{
|
||||||
@ -19,7 +22,9 @@ class MainFrame: public wxFrame
|
|||||||
void OnPrefsChanged();
|
void OnPrefsChanged();
|
||||||
private:
|
private:
|
||||||
PrefFrame *prefFrame = nullptr;
|
PrefFrame *prefFrame = nullptr;
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
FileTreePane *fileTreePane = nullptr;
|
FileTreePane *fileTreePane = nullptr;
|
||||||
|
#endif
|
||||||
TabContainer *notebook = nullptr;
|
TabContainer *notebook = nullptr;
|
||||||
wxAuiManager *manager = nullptr;
|
wxAuiManager *manager = nullptr;
|
||||||
wxAuiToolBar *toolBar = nullptr;
|
wxAuiToolBar *toolBar = nullptr;
|
||||||
@ -30,25 +35,27 @@ class MainFrame: public wxFrame
|
|||||||
wxAuiToolBar* SetupToolbar();
|
wxAuiToolBar* SetupToolbar();
|
||||||
void BindEvents();
|
void BindEvents();
|
||||||
void MainLayout();
|
void MainLayout();
|
||||||
|
|
||||||
// Main Menu Event handlers
|
// Main Menu Event handlers
|
||||||
void OnNew(wxCommandEvent &event);
|
void OnNew(wxCommandEvent &event);
|
||||||
void OnOpen(wxCommandEvent &event);
|
void OnOpen(wxCommandEvent &event);
|
||||||
|
#ifdef TYRO_FILETREE
|
||||||
void OnOpenFolder(wxCommandEvent &event);
|
void OnOpenFolder(wxCommandEvent &event);
|
||||||
|
#endif
|
||||||
void OnCloseAll(wxCommandEvent &event);
|
void OnCloseAll(wxCommandEvent &event);
|
||||||
void OnSave(wxCommandEvent &event);
|
void OnSave(wxCommandEvent &event);
|
||||||
void OnSaveAs(wxCommandEvent &event);
|
void OnSaveAs(wxCommandEvent &event);
|
||||||
|
|
||||||
void OnEditFind(wxCommandEvent &event);
|
void OnEditFind(wxCommandEvent &event);
|
||||||
void OnEditReplace(wxCommandEvent &event);
|
void OnEditReplace(wxCommandEvent &event);
|
||||||
void OnFindDialog(wxFindDialogEvent &event);
|
void OnFindDialog(wxFindDialogEvent &event);
|
||||||
|
|
||||||
void OnToggleWhitespace(wxCommandEvent &event);
|
void OnToggleWhitespace(wxCommandEvent &event);
|
||||||
void OnToggleLineWrap(wxCommandEvent &event);
|
void OnToggleLineWrap(wxCommandEvent &event);
|
||||||
void OnToggleLineEndings(wxCommandEvent &event);
|
void OnToggleLineEndings(wxCommandEvent &event);
|
||||||
|
|
||||||
void OnLangSelect(wxCommandEvent &event);
|
void OnLangSelect(wxCommandEvent &event);
|
||||||
|
|
||||||
void OnCloseTab(wxCommandEvent &event);
|
void OnCloseTab(wxCommandEvent &event);
|
||||||
void OnQuit(wxCommandEvent &event);
|
void OnQuit(wxCommandEvent &event);
|
||||||
void OnAbout(wxCommandEvent &event);
|
void OnAbout(wxCommandEvent &event);
|
||||||
|
@ -4,7 +4,7 @@ extern LangConfig *Glob_lang_config;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
TyroMenu::TyroMenu()
|
TyroMenu::TyroMenu()
|
||||||
{
|
{
|
||||||
this->fileMenu = new wxMenu();
|
this->fileMenu = new wxMenu();
|
||||||
@ -15,7 +15,7 @@ TyroMenu::TyroMenu()
|
|||||||
|
|
||||||
this->SetupMainMenus();
|
this->SetupMainMenus();
|
||||||
this->SetupLangMenu();
|
this->SetupLangMenu();
|
||||||
|
|
||||||
// Add the menus to the menubar
|
// Add the menus to the menubar
|
||||||
this->Insert(myFILE_MENU, fileMenu, "&File");
|
this->Insert(myFILE_MENU, fileMenu, "&File");
|
||||||
this->Insert(myEDIT_MENU, editMenu, "&Edit");
|
this->Insert(myEDIT_MENU, editMenu, "&Edit");
|
||||||
@ -26,7 +26,7 @@ TyroMenu::TyroMenu()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
TyroMenu::~TyroMenu()
|
TyroMenu::~TyroMenu()
|
||||||
{
|
{
|
||||||
wxLogDebug("TyroMenu Destructor Called.");
|
wxLogDebug("TyroMenu Destructor Called.");
|
||||||
@ -34,16 +34,18 @@ TyroMenu::~TyroMenu()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup basic menu items
|
* Setup basic menu items
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void TyroMenu::SetupMainMenus()
|
void TyroMenu::SetupMainMenus()
|
||||||
{
|
{
|
||||||
// Add items to top-level menus
|
// Add items to top-level menus
|
||||||
this->fileMenu->Append(wxID_NEW, "&New\tCtrl+N", "Create a new file");
|
this->fileMenu->Append(wxID_NEW, "&New\tCtrl+N", "Create a new file");
|
||||||
this->fileMenu->AppendSeparator();
|
this->fileMenu->AppendSeparator();
|
||||||
this->fileMenu->Append(wxID_OPEN, "&Open\tCtrl+O", "Opens an existing file");
|
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");
|
this->fileMenu->Append(myID_OPEN_DIR, "&Open Dir\tShift+Ctrl+O", "Opens the selected folder in the sidebar");
|
||||||
|
#endif
|
||||||
this->fileMenu->AppendSeparator();
|
this->fileMenu->AppendSeparator();
|
||||||
this->fileMenu->Append(wxID_SAVE, "&Save\tCtrl+S", "Save the content");
|
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...");
|
this->fileMenu->Append(wxID_SAVEAS, "Save &As...\tShift+Ctrl+S", "Save current file as...");
|
||||||
@ -51,7 +53,7 @@ void TyroMenu::SetupMainMenus()
|
|||||||
this->fileMenu->Append(wxID_CLOSE, "&Close\tCtrl+W", "Close the current document");
|
this->fileMenu->Append(wxID_CLOSE, "&Close\tCtrl+W", "Close the current document");
|
||||||
this->fileMenu->Append(myID_CLOSE_ALL, "C&lose All\tShift+Ctrl+W", "Close all open documents.");
|
this->fileMenu->Append(myID_CLOSE_ALL, "C&lose All\tShift+Ctrl+W", "Close all open documents.");
|
||||||
this->fileMenu->Append(wxID_EXIT, "&Quit\tCtrl+Q", "Quit the application");
|
this->fileMenu->Append(wxID_EXIT, "&Quit\tCtrl+Q", "Quit the application");
|
||||||
|
|
||||||
this->editMenu->Append(wxID_UNDO, "&Undo\tCtrl+Z", "Undo last action");
|
this->editMenu->Append(wxID_UNDO, "&Undo\tCtrl+Z", "Undo last action");
|
||||||
this->editMenu->Append(wxID_REDO, "&Redo\tCtrl+Y", "Redo last action");
|
this->editMenu->Append(wxID_REDO, "&Redo\tCtrl+Y", "Redo last action");
|
||||||
this->editMenu->AppendSeparator();
|
this->editMenu->AppendSeparator();
|
||||||
@ -70,7 +72,7 @@ void TyroMenu::SetupMainMenus()
|
|||||||
this->viewMenu->AppendCheckItem(myID_VIEW_WHITESPACE, "Show Invisible Characters\tCtrl+Shift+I", "Toggle visibility of white space characters");
|
this->viewMenu->AppendCheckItem(myID_VIEW_WHITESPACE, "Show Invisible Characters\tCtrl+Shift+I", "Toggle visibility of white space characters");
|
||||||
this->viewMenu->AppendCheckItem(myID_VIEW_LINE_ENDINGS, "Show line endings", "Toggle visibility of line ending characters");
|
this->viewMenu->AppendCheckItem(myID_VIEW_LINE_ENDINGS, "Show line endings", "Toggle visibility of line ending characters");
|
||||||
this->viewMenu->AppendCheckItem(myID_LINE_WRAP, "Word Wrap", "Toggle wrapping of long lines");
|
this->viewMenu->AppendCheckItem(myID_LINE_WRAP, "Word Wrap", "Toggle wrapping of long lines");
|
||||||
|
|
||||||
this->helpMenu->Append(wxID_ABOUT, "About Tyro", "Show info about this application");
|
this->helpMenu->Append(wxID_ABOUT, "About Tyro", "Show info about this application");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,11 +80,11 @@ void TyroMenu::SetupMainMenus()
|
|||||||
* Create the language selection menu
|
* Create the language selection menu
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void TyroMenu::SetupLangMenu()
|
void TyroMenu::SetupLangMenu()
|
||||||
{
|
{
|
||||||
StringMap languages = Glob_lang_config->GetLangList();
|
StringMap languages = Glob_lang_config->GetLangList();
|
||||||
|
|
||||||
for (const auto lang: languages)
|
for (const auto lang: languages)
|
||||||
{
|
{
|
||||||
langMenu->Append(wxID_ANY, lang.second, "Highlight file as " + lang.second, wxITEM_RADIO);
|
langMenu->Append(wxID_ANY, lang.second, "Highlight file as " + lang.second, wxITEM_RADIO);
|
||||||
@ -92,16 +94,16 @@ void TyroMenu::SetupLangMenu()
|
|||||||
/**
|
/**
|
||||||
* Enable/disable controls that require a file to be open
|
* Enable/disable controls that require a file to be open
|
||||||
*
|
*
|
||||||
* @param bool enable
|
* @param bool enable
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void TyroMenu::EnableEditControls(bool enable)
|
void TyroMenu::EnableEditControls(bool enable)
|
||||||
{
|
{
|
||||||
this->fileMenu->Enable(wxID_SAVE, enable);
|
this->fileMenu->Enable(wxID_SAVE, enable);
|
||||||
this->fileMenu->Enable(wxID_SAVEAS, enable);
|
this->fileMenu->Enable(wxID_SAVEAS, enable);
|
||||||
this->fileMenu->Enable(wxID_CLOSE, enable);
|
this->fileMenu->Enable(wxID_CLOSE, enable);
|
||||||
this->fileMenu->Enable(myID_CLOSE_ALL, enable);
|
this->fileMenu->Enable(myID_CLOSE_ALL, enable);
|
||||||
|
|
||||||
this->editMenu->Enable(wxID_UNDO, enable);
|
this->editMenu->Enable(wxID_UNDO, enable);
|
||||||
this->editMenu->Enable(wxID_REDO, enable);
|
this->editMenu->Enable(wxID_REDO, enable);
|
||||||
this->editMenu->Enable(wxID_CUT, enable);
|
this->editMenu->Enable(wxID_CUT, enable);
|
||||||
@ -110,7 +112,7 @@ void TyroMenu::EnableEditControls(bool enable)
|
|||||||
this->editMenu->Enable(wxID_SELECTALL, enable);
|
this->editMenu->Enable(wxID_SELECTALL, enable);
|
||||||
this->editMenu->Enable(wxID_FIND, enable);
|
this->editMenu->Enable(wxID_FIND, enable);
|
||||||
this->editMenu->Enable(wxID_REPLACE, enable);
|
this->editMenu->Enable(wxID_REPLACE, enable);
|
||||||
|
|
||||||
// Enable/disable top level menus
|
// Enable/disable top level menus
|
||||||
this->EnableEntireMenu(myVIEW_MENU, this->viewMenu, enable);
|
this->EnableEntireMenu(myVIEW_MENU, this->viewMenu, enable);
|
||||||
this->EnableEntireMenu(myLANG_MENU, this->langMenu, enable);
|
this->EnableEntireMenu(myLANG_MENU, this->langMenu, enable);
|
||||||
@ -118,7 +120,7 @@ void TyroMenu::EnableEditControls(bool enable)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the menu item associated with the specified id
|
* Check the menu item associated with the specified id
|
||||||
*
|
*
|
||||||
* @param int id
|
* @param int id
|
||||||
* @param bool checked
|
* @param bool checked
|
||||||
* @return void
|
* @return void
|
||||||
@ -136,7 +138,7 @@ void TyroMenu::SetIdChecked(int id, bool checked)
|
|||||||
* @param wxMenu* menu
|
* @param wxMenu* menu
|
||||||
* @param bool enable
|
* @param bool enable
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void TyroMenu::EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable)
|
void TyroMenu::EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable)
|
||||||
{
|
{
|
||||||
// Toggle the top of the menu
|
// Toggle the top of the menu
|
||||||
@ -148,7 +150,7 @@ void TyroMenu::EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable)
|
|||||||
for(auto item: list)
|
for(auto item: list)
|
||||||
{
|
{
|
||||||
item->Enable(enable);
|
item->Enable(enable);
|
||||||
|
|
||||||
// Uncheck all the items
|
// Uncheck all the items
|
||||||
if (item->IsCheckable())
|
if (item->IsCheckable())
|
||||||
{
|
{
|
||||||
@ -159,7 +161,7 @@ void TyroMenu::EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the language used for highlighting
|
* Change the language used for highlighting
|
||||||
*
|
*
|
||||||
* @param string lang
|
* @param string lang
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -169,6 +171,6 @@ void TyroMenu::SetCurrentLanguage(string lang)
|
|||||||
{
|
{
|
||||||
lang = "Plain Text";
|
lang = "Plain Text";
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Check(this->FindMenuItem("&Language", lang), true);
|
this->Check(this->FindMenuItem("&Language", lang), true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user