Miscellaneous

This commit is contained in:
Tim Warren 2015-04-22 16:57:10 -04:00
parent e812f5e5b8
commit a6c99dfba1
5 changed files with 77 additions and 75 deletions

File diff suppressed because one or more lines are too long

View File

@ -51,6 +51,7 @@
"value": [7, 54, 66],
"preprocessor": [181, 137, 0],
"script": [88, 110, 117],
"variable": [203, 75, 22],
"error": [220, 50, 47]
},
"bold": {
@ -64,57 +65,6 @@
},
"underline": {
},
"line_numbers": {
"foreground": [147, 161, 161],
"background": [238, 232, 213]
}
},
"Solarized Dark" : {
"background": {
"default": [0, 43, 54]
},
"foreground": {
"default": [131, 148, 150],
"keyword1": [220, 50, 47],
"keyword2": [203, 76, 22],
"keyword3": [181, 137, 0],
"keyword4": [181, 137, 0],
"keyword5": [181, 137, 0],
"keyword6": [181, 137, 0],
"comment": [147, 161, 161],
"comment_line": [147, 161, 161],
"comment_doc": [131, 148, 150],
"comment_special": [101, 123, 131],
"character": [108, 113, 196],
"character_eol": [108, 113, 196],
"string": [108, 113, 196],
"string_eol": [108, 113, 196],
"delimeter": [38, 139, 210],
"punctuation": [101, 123, 131],
"operator": [101, 123, 131],
"brace": [101, 123, 131],
"command": [101, 123, 131],
"identifier": [38, 139, 210],
"label": [38, 139, 210],
"number": [211, 54, 130],
"parameter": [0, 43, 54],
"regex": [7, 54, 66],
"uuid": [0, 43, 54],
"value": [7, 54, 66],
"preprocessor": [181, 137, 0],
"script": [88, 110, 117],
"error": []
},
"bold": {
"keyword2": true,
"operator": true
},
"italic": {
},
"underline": {
},
"line_numbers": {
"foreground": [147, 161, 161],

View File

@ -5,10 +5,12 @@
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
// Top level menus
enum {
myFILE_MENU,
myEDIT_MENU,
myVIEW_MENU,
myLANG_MENU,
myHELP_MENU
};
@ -28,41 +30,57 @@ typedef map<string, int> StringConstMap;
const wxString TYRO_FILE_OPEN_WILDCARDS =
"All files (*.*)|*|"
"Bash (*.sh, *.bsh) |*.sh;*.bsh|"
"Batch (*.bat, *.cmd, *.nt)|*.bat;*.cmd,*.nt|"
"C/C++ (*.c,*.cpp,*.h)| *.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hpp;*.hxx;*.sma;*.cp |"
"Caml (*.ml,*.mli,*.sml,*.thy)|*.ml;*.mli;*.sml;*.thy|"
"Cmake (*.cmake) |*.cmake|"
"C/C++ (*.c,*.cpp,*.h)|*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hpp;*.hxx;*.sma;*.cp|"
"Coffeescript (*.coffee)|*.coffee;*.litcoffee|"
"CSS (*.css)|*.css|"
"Fortran (*.f9*, *.f, *.for)|*.f9*;*.f,*.for|"
"Haskell (*.hs,*.lhs,*.las)|*.hs;*.lhs;*.las|"
"HTML/XHTML (*.html, *.htm)|*.htm*|"
"Java (*.java)|*.java|"
"JavaScript(*.js)|*.js|"
"JavaScript (*.js,*.json,*.ts)|*.js;*.json;*.ts|"
"Lisp (*.lsp,*.lisp)|*.lsp;*.lisp|"
"Lua (*.lua)|*.lua|"
"Makefile |Makefile;makefile.*;MAKEFILE;configure.*;*.mak|"
"Pascal (*.pas, *.inc, *.pp)|*.pas;*.inc;*.pp|"
"Markdown (*.md,*.markdown)|*.md;*.markdown|"
"Perl (*.pl, *.cgi)|*.pl;*.pm;*.cgi;*.pod|"
"PHP (*.php)|*.php|"
"Python (*.py,*.pyw)|*.py;*.pyw|"
"Ruby (*.rb)|*.rb|"
"Rust (*.rs)|*.rs|"
"Shell (*.sh, *.bsh)|*.sh;*.bsh|"
"SQL (*.sql)|*.sql|"
"TCL (*.tcl)|*.tcl|"
"Text (*.txt)|*.txt";
"Text (*.txt)|*.txt|"
"Yaml (.yml,*.yaml)| *.yml;*.yaml";
const wxString TYRO_FILE_SAVE_WILDCARDS =
"All files (*.*)|*.*|"
"Bash (*.sh, *.bsh) |*.sh;*.bsh|"
"All files (*.*)|*|"
"Batch (*.bat, *.cmd, *.nt)|*.bat;*.cmd,*.nt|"
"C/C++ (*.c,*.cpp,*.h)| *.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hpp;*.hxx;*.sma;*.cp |"
"Caml (*.ml,*.mli,*.sml,*.thy)|*.ml;*.mli;*.sml;*.thy|"
"Cmake (*.cmake) |*.cmake|"
"C/C++ (*.c,*.cpp,*.h)|*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hpp;*.hxx;*.sma;*.cp|"
"Coffeescript (*.coffee)|*.coffee;*.litcoffee|"
"CSS (*.css)|*.css|"
"Fortran (*.f9*, *.f, *.for)|*.f9*;*.f,*.for|"
"Haskell (*.hs,*.lhs,*.las)|*.hs;*.lhs;*.las|"
"HTML/XHTML (*.html, *.htm)|*.htm*|"
"Java (*.java)|*.java|"
"JavaScript(*.js)|*.js|"
"JavaScript (*.js,*.json,*.ts)|*.js;*.json;*.ts|"
"Lisp (*.lsp,*.lisp)|*.lsp;*.lisp|"
"Lua (*.lua)|*.lua|"
"Makefile |Makefile;makefile.*;MAKEFILE;configure.*;*.mak|"
"Pascal (*.pas, *.inc, *.pp)|*.pas;*.inc;*.pp|"
"Markdown (*.md,*.markdown)|*.md;*.markdown|"
"Perl (*.pl, *.cgi)|*.pl;*.pm;*.cgi;*.pod|"
"PHP (*.php)|*.php|"
"Python (*.py,*.pyw)|*.py;*.pyw|"
"Ruby (*.rb)|*.rb|"
"Rust (*.rs)|*.rs|"
"Shell (*.sh, *.bsh)|*.sh;*.bsh|"
"SQL (*.sql)|*.sql|"
"TCL (*.tcl)|*.tcl|"
"Text (*.txt)|*.txt";
"Text (*.txt)|*.txt|"
"Yaml (.yml,*.yaml)| *.yml;*.yaml";
#endif /* DEFINITIONS_H */

View File

@ -33,6 +33,7 @@ EditPane::EditPane(
lexerMap["perl"] = wxSTC_LEX_PERL;
lexerMap["python"] = wxSTC_LEX_PYTHON;
lexerMap["ruby"] = wxSTC_LEX_RUBY;
lexerMap["rust"] = wxSTC_LEX_CPP;
lexerMap["shell"] = wxSTC_LEX_BASH;
lexerMap["sql"] = wxSTC_LEX_SQL;
lexerMap["xml"] = wxSTC_LEX_XML;
@ -62,6 +63,8 @@ void EditPane::Highlight(wxString filePath)
// Get the configuration name for the selected language
string lang = this->GetLangByFile();
wxLogDebug("Language selected: %s", lang);
this->StyleClearAll();
@ -147,9 +150,11 @@ void EditPane::ApplyTheme(string lang, string theme)
wxLogDebug(output.str().c_str());
}
int offset_count = 0;//(lang == "php") ? 104 : 0;
// Do the appropriate mappings to load the selected theme
this->_ApplyTheme(lexer_map);
this->_ApplyTheme(lexer_map, offset_count);
}
/**
@ -370,6 +375,12 @@ JsonValue EditPane::GetThemeValue(string type, string key)
return value;
}
/**
* Retrieve the configured color for the specified theme
* @param type
* @param key
* @return
*/
wxColor EditPane::GetThemeColor(string type, string key)
{
JsonValue color_value = this->GetThemeValue(type, key);
@ -392,9 +403,10 @@ wxColor EditPane::GetThemeColor(string type, string key)
* Iterate through the theme settings and apply them
*
* @param JsonValue lexer_map - Maps token types to theme colors
* @param int addtoi - Offset for some languages
* @return void
*/
void EditPane::_ApplyTheme(JsonValue lexer_map)
void EditPane::_ApplyTheme(JsonValue lexer_map, int addtoi)
{
// Font setup
#ifdef __WXMAC__
@ -437,20 +449,29 @@ void EditPane::_ApplyTheme(JsonValue lexer_map)
this->StyleSetBackground (wxSTC_STYLE_LINENUMBER, line_number_background);
this->SetMarginType (MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER);
for (int i = 0; i < lexer_map.size(); i++)
int min = 0 + addtoi;
int max = lexer_map.size() + addtoi;
for (int i = min; i < max; i++)
{
string key = lexer_map[i].asString();
int n = i - addtoi;
string key = lexer_map[n].asString();
//wxLogDebug("Token type: %s", key);
//wxLogDebug("Lexer constant: %i", i);
// Set the foreground color, if it exists
if ( ! this->GetThemeValue("foreground", key).isNull())
{
this->StyleSetForeground(i, this->GetThemeColor("foreground", key));
wxLogDebug("Set foreground color for %s token type, on value: %i", key, i);
}
// Set the background color, if it exists
if ( ! this->GetThemeValue("background", key).isNull())
{
this->StyleSetBackground(i, this->GetThemeColor("background", key));
wxLogDebug("Set background color for %s token type, on value: %i", key, i);
}
// Set bold, if it applies

View File

@ -48,7 +48,7 @@ private:
JsonValue GetThemeValue(string type, string key);
wxColor GetThemeColor(string type, string key);
JsonValue GetKeywordList(string lang);
void _ApplyTheme(JsonValue lexer_map);
void _ApplyTheme(JsonValue lexer_map, int addtoi=0);
};
#endif // TYRODOC_FRAME_H