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)
|
||||
* --enable-debug_gdb
|
||||
* --enable-profile
|
||||
* --enable-arttango
|
||||
* --disable-compat28
|
||||
* --disable-shared
|
||||
* --without-webviewwebkit
|
||||
|
@ -35,7 +35,7 @@ steps should work fine for a local build.
|
||||
|
||||
1. Download the latest wxWidgets source
|
||||
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`
|
||||
|
||||
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
|
||||
2. Use the MSyS prompt to navigate to the wxWidgets directory
|
||||
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.
|
||||
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
*/
|
||||
|
||||
#include "wx_common.h"
|
||||
#include "widgets/widget.h"
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/debug.h>
|
||||
|
||||
class TyroApp : public wxApp
|
||||
@ -17,14 +17,12 @@ public:
|
||||
private:
|
||||
};
|
||||
|
||||
wxConfigBase *Config;
|
||||
|
||||
//**************************************************************
|
||||
#include "widgets/widget.h"
|
||||
|
||||
IMPLEMENT_APP(TyroApp);
|
||||
|
||||
// Some global stuff
|
||||
wxConfigBase *Config;
|
||||
TyroMenu *mbar;
|
||||
MainFrame *main_frame;
|
||||
|
||||
|
@ -30,7 +30,7 @@ enum myMenuIds {
|
||||
myHELP_MENU
|
||||
};
|
||||
|
||||
// Menu ids
|
||||
// General Menu ids
|
||||
enum myMenuItemIds {
|
||||
myID_VIEW_WHITESPACE = wxID_HIGHEST,
|
||||
myID_VIEW_LINE_ENDINGS,
|
||||
|
@ -13,7 +13,10 @@ LangConfig::LangConfig()
|
||||
this->lang = "";
|
||||
}
|
||||
|
||||
LangConfig::~LangConfig() {}
|
||||
LangConfig::~LangConfig()
|
||||
{
|
||||
wxLogDebug("Called LangConfig Destructor");
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the format of the current file by
|
||||
@ -100,3 +103,19 @@ string LangConfig::GetLang()
|
||||
{
|
||||
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);
|
||||
JsonValue GetKeywordList(string lang="none");
|
||||
JsonValue GetLexerMap(string lang="none");
|
||||
StringMap GetLangList();
|
||||
private:
|
||||
string lang;
|
||||
};
|
||||
|
@ -11,7 +11,10 @@ ThemeConfig::ThemeConfig()
|
||||
this->SetTheme("Solarized");
|
||||
}
|
||||
|
||||
ThemeConfig::~ThemeConfig() {}
|
||||
ThemeConfig::~ThemeConfig()
|
||||
{
|
||||
wxLogDebug("Called ThemeConfig Destructor");
|
||||
}
|
||||
|
||||
void ThemeConfig::SetTheme(string theme_name)
|
||||
{
|
||||
|
@ -77,6 +77,7 @@ EditPane::EditPane(
|
||||
|
||||
EditPane::~EditPane()
|
||||
{
|
||||
wxLogDebug("Called EditPane Destructor");
|
||||
delete lang_config;
|
||||
delete theme_config;
|
||||
}
|
||||
@ -143,14 +144,17 @@ void EditPane::ApplyTheme(string lang, string theme)
|
||||
}
|
||||
else
|
||||
{
|
||||
string typeMap[] = {"null", "int", "unsigned int", "double", "string", "boolean", "array", "object"};
|
||||
stringstream output;
|
||||
if (lang != "")
|
||||
{
|
||||
string typeMap[] = {"null", "int", "unsigned int", "double", "string", "boolean", "array", "object"};
|
||||
stringstream output;
|
||||
|
||||
output << "current lang is:" << lang << endl;
|
||||
output << "keywords array is not an array" << endl;
|
||||
output << "keyword array is a " << typeMap[keywords_array.type()] << endl;
|
||||
output << "current lang is:" << lang << endl;
|
||||
output << "keywords array is not an array" << 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
|
||||
|
@ -4,8 +4,6 @@
|
||||
#include "../settings/LangConfig.h"
|
||||
#include "../settings/ThemeConfig.h"
|
||||
|
||||
#include <wx/stc/stc.h>
|
||||
|
||||
class EditPane: public wxStyledTextCtrl
|
||||
{
|
||||
public:
|
||||
|
@ -45,7 +45,7 @@ MainFrame::MainFrame(wxFrame *frame, const wxString &title)
|
||||
MainFrame::~MainFrame()
|
||||
{
|
||||
wxLogDebug("Main Frame Destructor Called.");
|
||||
//delete notebook;
|
||||
delete notebook;
|
||||
}
|
||||
|
||||
void MainFrame::SetupStatusBar()
|
||||
|
@ -5,10 +5,6 @@
|
||||
#ifndef TYROMAIN_H
|
||||
#define TYROMAIN_H
|
||||
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/aboutdlg.h>
|
||||
#include <wx/fdrepdlg.h>
|
||||
#include "TabContainer.h"
|
||||
|
||||
class MainFrame: public wxFrame
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include "EditPane.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
|
||||
| wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON
|
||||
|
@ -1,4 +1,7 @@
|
||||
#include "widget.h"
|
||||
#include "../settings/LangConfig.h"
|
||||
|
||||
static LangConfig *lang_config;
|
||||
|
||||
TyroMenu::TyroMenu()
|
||||
{
|
||||
@ -8,7 +11,10 @@ TyroMenu::TyroMenu()
|
||||
langMenu = new wxMenu();
|
||||
helpMenu = new wxMenu();
|
||||
|
||||
lang_config = new LangConfig();
|
||||
|
||||
this->SetupMainMenus();
|
||||
this->SetupLangMenu();
|
||||
|
||||
// Add the menus to the menubar
|
||||
this->Insert(myFILE_MENU, fileMenu, "&File");
|
||||
@ -21,12 +27,6 @@ TyroMenu::TyroMenu()
|
||||
TyroMenu::~TyroMenu()
|
||||
{
|
||||
wxLogDebug("TyroMenu Destructor Called.");
|
||||
|
||||
//delete fileMenu;
|
||||
//delete editMenu;
|
||||
//delete viewMenu;
|
||||
//delete langMenu;
|
||||
//delete helpMenu;
|
||||
}
|
||||
|
||||
void TyroMenu::SetupMainMenus()
|
||||
@ -66,7 +66,15 @@ void TyroMenu::SetupMainMenus()
|
||||
|
||||
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)
|
||||
|
@ -1,13 +1,11 @@
|
||||
/*
|
||||
* File: TyroMenu.h
|
||||
* Author: twarren
|
||||
*
|
||||
* Created on May 7, 2015, 3:10 PM
|
||||
/**
|
||||
* Main Menu class
|
||||
*/
|
||||
|
||||
#ifndef TYRO_MENU_H
|
||||
#define TYRO_MENU_H
|
||||
|
||||
#include "widget.h"
|
||||
|
||||
class TyroMenu : public wxMenuBar {
|
||||
public:
|
||||
TyroMenu();
|
||||
|
@ -8,7 +8,19 @@
|
||||
#ifndef TYRO_WIDGET_H
|
||||
#define TYRO_WIDGET_H
|
||||
|
||||
// Common wxWidgets stuff
|
||||
#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 "EditPane.h"
|
||||
#include "TabContainer.h"
|
||||
|
Loading…
Reference in New Issue
Block a user