Generate language menu
This commit is contained in:
parent
c57664a1ce
commit
12adf9b7a0
@ -16,7 +16,6 @@ Use [this script](http://devernay.free.fr/hacks/xcodelegacy/) to install older S
|
|||||||
## Recommended flags for development/debugging (Assuming OS X > 10.7)
|
## Recommended flags for development/debugging (Assuming OS X > 10.7)
|
||||||
* --enable-debug_gdb
|
* --enable-debug_gdb
|
||||||
* --enable-profile
|
* --enable-profile
|
||||||
* --enable-arttango
|
|
||||||
* --disable-compat28
|
* --disable-compat28
|
||||||
* --disable-shared
|
* --disable-shared
|
||||||
* --without-webviewwebkit
|
* --without-webviewwebkit
|
||||||
|
@ -35,7 +35,7 @@ steps should work fine for a local build.
|
|||||||
|
|
||||||
1. Download the latest wxWidgets source
|
1. Download the latest wxWidgets source
|
||||||
2. Make a new directory in the source tree, like `wxmac`
|
2. Make a new directory in the source tree, like `wxmac`
|
||||||
3. Run `../configure --disable-shared --disable-webviewwebkit` in the new directory
|
3. Run `../configure --disable-shared --disable-webviewwebkit --disable-compat28` in the new directory
|
||||||
4. Run `make && make install`
|
4. Run `make && make install`
|
||||||
|
|
||||||
Install libssh2 (Using homebrew):
|
Install libssh2 (Using homebrew):
|
||||||
|
@ -21,7 +21,7 @@ In order to keep a consistent build system, Tyro is built with MinGW and Msys. T
|
|||||||
1. Download the windows [installer](https://www.wxwidgets.org/downloads/) for version 3
|
1. Download the windows [installer](https://www.wxwidgets.org/downloads/) for version 3
|
||||||
2. Use the MSyS prompt to navigate to the wxWidgets directory
|
2. Use the MSyS prompt to navigate to the wxWidgets directory
|
||||||
3. Make a new folder, eg. msw-debug, and cd into it.
|
3. Make a new folder, eg. msw-debug, and cd into it.
|
||||||
4. Run `../configure --disable-shared --enable-debug` in that new directory.
|
4. Run `../configure --disable-shared --enable-debug --disable-compat28 --enable-arttango` in that new directory.
|
||||||
5. After configure finishes, run `make && make install` in the same folder.
|
5. After configure finishes, run `make && make install` in the same folder.
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "wx_common.h"
|
#include "wx_common.h"
|
||||||
|
#include "widgets/widget.h"
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/config.h>
|
|
||||||
#include <wx/debug.h>
|
#include <wx/debug.h>
|
||||||
|
|
||||||
class TyroApp : public wxApp
|
class TyroApp : public wxApp
|
||||||
@ -17,14 +17,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
wxConfigBase *Config;
|
|
||||||
|
|
||||||
//**************************************************************
|
//**************************************************************
|
||||||
#include "widgets/widget.h"
|
|
||||||
|
|
||||||
IMPLEMENT_APP(TyroApp);
|
IMPLEMENT_APP(TyroApp);
|
||||||
|
|
||||||
// Some global stuff
|
// Some global stuff
|
||||||
|
wxConfigBase *Config;
|
||||||
TyroMenu *mbar;
|
TyroMenu *mbar;
|
||||||
MainFrame *main_frame;
|
MainFrame *main_frame;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ enum myMenuIds {
|
|||||||
myHELP_MENU
|
myHELP_MENU
|
||||||
};
|
};
|
||||||
|
|
||||||
// Menu ids
|
// General Menu ids
|
||||||
enum myMenuItemIds {
|
enum myMenuItemIds {
|
||||||
myID_VIEW_WHITESPACE = wxID_HIGHEST,
|
myID_VIEW_WHITESPACE = wxID_HIGHEST,
|
||||||
myID_VIEW_LINE_ENDINGS,
|
myID_VIEW_LINE_ENDINGS,
|
||||||
|
@ -13,7 +13,10 @@ LangConfig::LangConfig()
|
|||||||
this->lang = "";
|
this->lang = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
LangConfig::~LangConfig() {}
|
LangConfig::~LangConfig()
|
||||||
|
{
|
||||||
|
wxLogDebug("Called LangConfig Destructor");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the format of the current file by
|
* Determine the format of the current file by
|
||||||
@ -99,4 +102,20 @@ void LangConfig::SetLang(string lang)
|
|||||||
string LangConfig::GetLang()
|
string LangConfig::GetLang()
|
||||||
{
|
{
|
||||||
return this->lang;
|
return this->lang;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringMap LangConfig::GetLangList()
|
||||||
|
{
|
||||||
|
JsonValue langList = this->GetRoot();
|
||||||
|
JsonValue::iterator it;
|
||||||
|
|
||||||
|
StringMap outputList;
|
||||||
|
|
||||||
|
for (it = langList.begin(); it != langList.end(); ++it)
|
||||||
|
{
|
||||||
|
JsonValue langObj = *it;
|
||||||
|
outputList[it.key().asString()] = langObj.get("name", JsonValue()).asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return outputList;
|
||||||
}
|
}
|
@ -13,6 +13,7 @@ public:
|
|||||||
string GetLangByFile(wxFileName &fileName);
|
string GetLangByFile(wxFileName &fileName);
|
||||||
JsonValue GetKeywordList(string lang="none");
|
JsonValue GetKeywordList(string lang="none");
|
||||||
JsonValue GetLexerMap(string lang="none");
|
JsonValue GetLexerMap(string lang="none");
|
||||||
|
StringMap GetLangList();
|
||||||
private:
|
private:
|
||||||
string lang;
|
string lang;
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,10 @@ ThemeConfig::ThemeConfig()
|
|||||||
this->SetTheme("Solarized");
|
this->SetTheme("Solarized");
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeConfig::~ThemeConfig() {}
|
ThemeConfig::~ThemeConfig()
|
||||||
|
{
|
||||||
|
wxLogDebug("Called ThemeConfig Destructor");
|
||||||
|
}
|
||||||
|
|
||||||
void ThemeConfig::SetTheme(string theme_name)
|
void ThemeConfig::SetTheme(string theme_name)
|
||||||
{
|
{
|
||||||
|
@ -77,6 +77,7 @@ EditPane::EditPane(
|
|||||||
|
|
||||||
EditPane::~EditPane()
|
EditPane::~EditPane()
|
||||||
{
|
{
|
||||||
|
wxLogDebug("Called EditPane Destructor");
|
||||||
delete lang_config;
|
delete lang_config;
|
||||||
delete theme_config;
|
delete theme_config;
|
||||||
}
|
}
|
||||||
@ -143,14 +144,17 @@ void EditPane::ApplyTheme(string lang, string theme)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string typeMap[] = {"null", "int", "unsigned int", "double", "string", "boolean", "array", "object"};
|
if (lang != "")
|
||||||
stringstream output;
|
{
|
||||||
|
string typeMap[] = {"null", "int", "unsigned int", "double", "string", "boolean", "array", "object"};
|
||||||
|
stringstream output;
|
||||||
|
|
||||||
output << "current lang is:" << lang << endl;
|
output << "current lang is:" << lang << endl;
|
||||||
output << "keywords array is not an array" << endl;
|
output << "keywords array is not an array" << endl;
|
||||||
output << "keyword array is a " << typeMap[keywords_array.type()] << endl;
|
output << "keyword array is a " << typeMap[keywords_array.type()] << endl;
|
||||||
|
|
||||||
wxLogDebug(output.str().c_str());
|
wxLogDebug(output.str().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the appropriate mappings to load the selected theme
|
// Do the appropriate mappings to load the selected theme
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include "../settings/LangConfig.h"
|
#include "../settings/LangConfig.h"
|
||||||
#include "../settings/ThemeConfig.h"
|
#include "../settings/ThemeConfig.h"
|
||||||
|
|
||||||
#include <wx/stc/stc.h>
|
|
||||||
|
|
||||||
class EditPane: public wxStyledTextCtrl
|
class EditPane: public wxStyledTextCtrl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -45,7 +45,7 @@ MainFrame::MainFrame(wxFrame *frame, const wxString &title)
|
|||||||
MainFrame::~MainFrame()
|
MainFrame::~MainFrame()
|
||||||
{
|
{
|
||||||
wxLogDebug("Main Frame Destructor Called.");
|
wxLogDebug("Main Frame Destructor Called.");
|
||||||
//delete notebook;
|
delete notebook;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::SetupStatusBar()
|
void MainFrame::SetupStatusBar()
|
||||||
|
@ -5,10 +5,6 @@
|
|||||||
#ifndef TYROMAIN_H
|
#ifndef TYROMAIN_H
|
||||||
#define TYROMAIN_H
|
#define TYROMAIN_H
|
||||||
|
|
||||||
#include <wx/cmdline.h>
|
|
||||||
#include <wx/config.h>
|
|
||||||
#include <wx/aboutdlg.h>
|
|
||||||
#include <wx/fdrepdlg.h>
|
|
||||||
#include "TabContainer.h"
|
#include "TabContainer.h"
|
||||||
|
|
||||||
class MainFrame: public wxFrame
|
class MainFrame: public wxFrame
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
#include "EditPane.h"
|
#include "EditPane.h"
|
||||||
#include "MainFrame.h"
|
#include "MainFrame.h"
|
||||||
#include <wx/aui/aui.h>
|
|
||||||
#include <wx/filename.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
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
|
#include "../settings/LangConfig.h"
|
||||||
|
|
||||||
|
static LangConfig *lang_config;
|
||||||
|
|
||||||
TyroMenu::TyroMenu()
|
TyroMenu::TyroMenu()
|
||||||
{
|
{
|
||||||
@ -7,8 +10,11 @@ TyroMenu::TyroMenu()
|
|||||||
viewMenu = new wxMenu();
|
viewMenu = new wxMenu();
|
||||||
langMenu = new wxMenu();
|
langMenu = new wxMenu();
|
||||||
helpMenu = new wxMenu();
|
helpMenu = new wxMenu();
|
||||||
|
|
||||||
|
lang_config = new LangConfig();
|
||||||
|
|
||||||
this->SetupMainMenus();
|
this->SetupMainMenus();
|
||||||
|
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");
|
||||||
@ -21,12 +27,6 @@ TyroMenu::TyroMenu()
|
|||||||
TyroMenu::~TyroMenu()
|
TyroMenu::~TyroMenu()
|
||||||
{
|
{
|
||||||
wxLogDebug("TyroMenu Destructor Called.");
|
wxLogDebug("TyroMenu Destructor Called.");
|
||||||
|
|
||||||
//delete fileMenu;
|
|
||||||
//delete editMenu;
|
|
||||||
//delete viewMenu;
|
|
||||||
//delete langMenu;
|
|
||||||
//delete helpMenu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TyroMenu::SetupMainMenus()
|
void TyroMenu::SetupMainMenus()
|
||||||
@ -66,7 +66,15 @@ void TyroMenu::SetupMainMenus()
|
|||||||
|
|
||||||
void TyroMenu::SetupLangMenu()
|
void TyroMenu::SetupLangMenu()
|
||||||
{
|
{
|
||||||
|
StringMap langs = lang_config->GetLangList();
|
||||||
|
StringMap::iterator it;
|
||||||
|
|
||||||
|
StringMap::iterator last = langs.end();
|
||||||
|
|
||||||
|
for (it = langs.begin(); it != last; ++it)
|
||||||
|
{
|
||||||
|
langMenu->Append(wxID_ANY, it->second, "Hightlight file as " + it->second, wxITEM_CHECK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TyroMenu::EnableEditControls(bool enable)
|
void TyroMenu::EnableEditControls(bool enable)
|
||||||
@ -95,11 +103,11 @@ void TyroMenu::EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable)
|
|||||||
{
|
{
|
||||||
// Toggle the top of the menu
|
// Toggle the top of the menu
|
||||||
this->EnableTop(menuId, enable);
|
this->EnableTop(menuId, enable);
|
||||||
|
|
||||||
// Toggle the rest of the items in the menu
|
// Toggle the rest of the items in the menu
|
||||||
wxMenuItemList list = menu->GetMenuItems();
|
wxMenuItemList list = menu->GetMenuItems();
|
||||||
wxMenuItemList::iterator iter;
|
wxMenuItemList::iterator iter;
|
||||||
|
|
||||||
for(iter = list.begin(); iter != list.end(); ++iter)
|
for(iter = list.begin(); iter != list.end(); ++iter)
|
||||||
{
|
{
|
||||||
wxMenuItem *current = *iter;
|
wxMenuItem *current = *iter;
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
/*
|
/**
|
||||||
* File: TyroMenu.h
|
* Main Menu class
|
||||||
* Author: twarren
|
|
||||||
*
|
|
||||||
* Created on May 7, 2015, 3:10 PM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TYRO_MENU_H
|
#ifndef TYRO_MENU_H
|
||||||
#define TYRO_MENU_H
|
#define TYRO_MENU_H
|
||||||
|
|
||||||
|
#include "widget.h"
|
||||||
|
|
||||||
class TyroMenu : public wxMenuBar {
|
class TyroMenu : public wxMenuBar {
|
||||||
public:
|
public:
|
||||||
TyroMenu();
|
TyroMenu();
|
||||||
|
@ -8,7 +8,19 @@
|
|||||||
#ifndef TYRO_WIDGET_H
|
#ifndef TYRO_WIDGET_H
|
||||||
#define TYRO_WIDGET_H
|
#define TYRO_WIDGET_H
|
||||||
|
|
||||||
|
// Common wxWidgets stuff
|
||||||
#include "../wx_common.h"
|
#include "../wx_common.h"
|
||||||
|
|
||||||
|
// Base widgets
|
||||||
|
#include <wx/cmdline.h>
|
||||||
|
#include <wx/config.h>
|
||||||
|
#include <wx/filename.h>
|
||||||
|
#include <wx/aboutdlg.h>
|
||||||
|
#include <wx/fdrepdlg.h>
|
||||||
|
#include <wx/aui/aui.h>
|
||||||
|
#include <wx/stc/stc.h>
|
||||||
|
|
||||||
|
// Tyro includes
|
||||||
#include "TyroMenu.h"
|
#include "TyroMenu.h"
|
||||||
#include "EditPane.h"
|
#include "EditPane.h"
|
||||||
#include "TabContainer.h"
|
#include "TabContainer.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user