Miscellaneous
This commit is contained in:
parent
e812f5e5b8
commit
a6c99dfba1
File diff suppressed because one or more lines are too long
@ -51,6 +51,7 @@
|
|||||||
"value": [7, 54, 66],
|
"value": [7, 54, 66],
|
||||||
"preprocessor": [181, 137, 0],
|
"preprocessor": [181, 137, 0],
|
||||||
"script": [88, 110, 117],
|
"script": [88, 110, 117],
|
||||||
|
"variable": [203, 75, 22],
|
||||||
"error": [220, 50, 47]
|
"error": [220, 50, 47]
|
||||||
},
|
},
|
||||||
"bold": {
|
"bold": {
|
||||||
@ -64,57 +65,6 @@
|
|||||||
},
|
},
|
||||||
"underline": {
|
"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": {
|
"line_numbers": {
|
||||||
"foreground": [147, 161, 161],
|
"foreground": [147, 161, 161],
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
#ifndef DEFINITIONS_H
|
#ifndef DEFINITIONS_H
|
||||||
#define DEFINITIONS_H
|
#define DEFINITIONS_H
|
||||||
|
|
||||||
|
// Top level menus
|
||||||
enum {
|
enum {
|
||||||
myFILE_MENU,
|
myFILE_MENU,
|
||||||
myEDIT_MENU,
|
myEDIT_MENU,
|
||||||
myVIEW_MENU,
|
myVIEW_MENU,
|
||||||
|
myLANG_MENU,
|
||||||
myHELP_MENU
|
myHELP_MENU
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -28,41 +30,57 @@ typedef map<string, int> StringConstMap;
|
|||||||
|
|
||||||
const wxString TYRO_FILE_OPEN_WILDCARDS =
|
const wxString TYRO_FILE_OPEN_WILDCARDS =
|
||||||
"All files (*.*)|*|"
|
"All files (*.*)|*|"
|
||||||
"Bash (*.sh, *.bsh) |*.sh;*.bsh|"
|
|
||||||
"Batch (*.bat, *.cmd, *.nt)|*.bat;*.cmd,*.nt|"
|
"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|"
|
"CSS (*.css)|*.css|"
|
||||||
"Fortran (*.f9*, *.f, *.for)|*.f9*;*.f,*.for|"
|
"Fortran (*.f9*, *.f, *.for)|*.f9*;*.f,*.for|"
|
||||||
|
"Haskell (*.hs,*.lhs,*.las)|*.hs;*.lhs;*.las|"
|
||||||
"HTML/XHTML (*.html, *.htm)|*.htm*|"
|
"HTML/XHTML (*.html, *.htm)|*.htm*|"
|
||||||
"Java (*.java)|*.java|"
|
"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|"
|
"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|"
|
"Perl (*.pl, *.cgi)|*.pl;*.pm;*.cgi;*.pod|"
|
||||||
"PHP (*.php)|*.php|"
|
"PHP (*.php)|*.php|"
|
||||||
|
"Python (*.py,*.pyw)|*.py;*.pyw|"
|
||||||
"Ruby (*.rb)|*.rb|"
|
"Ruby (*.rb)|*.rb|"
|
||||||
|
"Rust (*.rs)|*.rs|"
|
||||||
|
"Shell (*.sh, *.bsh)|*.sh;*.bsh|"
|
||||||
"SQL (*.sql)|*.sql|"
|
"SQL (*.sql)|*.sql|"
|
||||||
"TCL (*.tcl)|*.tcl|"
|
"Text (*.txt)|*.txt|"
|
||||||
"Text (*.txt)|*.txt";
|
"Yaml (.yml,*.yaml)| *.yml;*.yaml";
|
||||||
|
|
||||||
const wxString TYRO_FILE_SAVE_WILDCARDS =
|
const wxString TYRO_FILE_SAVE_WILDCARDS =
|
||||||
"All files (*.*)|*.*|"
|
"All files (*.*)|*|"
|
||||||
"Bash (*.sh, *.bsh) |*.sh;*.bsh|"
|
|
||||||
"Batch (*.bat, *.cmd, *.nt)|*.bat;*.cmd,*.nt|"
|
"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|"
|
"CSS (*.css)|*.css|"
|
||||||
"Fortran (*.f9*, *.f, *.for)|*.f9*;*.f,*.for|"
|
"Fortran (*.f9*, *.f, *.for)|*.f9*;*.f,*.for|"
|
||||||
|
"Haskell (*.hs,*.lhs,*.las)|*.hs;*.lhs;*.las|"
|
||||||
"HTML/XHTML (*.html, *.htm)|*.htm*|"
|
"HTML/XHTML (*.html, *.htm)|*.htm*|"
|
||||||
"Java (*.java)|*.java|"
|
"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|"
|
"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|"
|
"Perl (*.pl, *.cgi)|*.pl;*.pm;*.cgi;*.pod|"
|
||||||
"PHP (*.php)|*.php|"
|
"PHP (*.php)|*.php|"
|
||||||
|
"Python (*.py,*.pyw)|*.py;*.pyw|"
|
||||||
"Ruby (*.rb)|*.rb|"
|
"Ruby (*.rb)|*.rb|"
|
||||||
|
"Rust (*.rs)|*.rs|"
|
||||||
|
"Shell (*.sh, *.bsh)|*.sh;*.bsh|"
|
||||||
"SQL (*.sql)|*.sql|"
|
"SQL (*.sql)|*.sql|"
|
||||||
"TCL (*.tcl)|*.tcl|"
|
"Text (*.txt)|*.txt|"
|
||||||
"Text (*.txt)|*.txt";
|
"Yaml (.yml,*.yaml)| *.yml;*.yaml";
|
||||||
|
|
||||||
#endif /* DEFINITIONS_H */
|
#endif /* DEFINITIONS_H */
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ EditPane::EditPane(
|
|||||||
lexerMap["perl"] = wxSTC_LEX_PERL;
|
lexerMap["perl"] = wxSTC_LEX_PERL;
|
||||||
lexerMap["python"] = wxSTC_LEX_PYTHON;
|
lexerMap["python"] = wxSTC_LEX_PYTHON;
|
||||||
lexerMap["ruby"] = wxSTC_LEX_RUBY;
|
lexerMap["ruby"] = wxSTC_LEX_RUBY;
|
||||||
|
lexerMap["rust"] = wxSTC_LEX_CPP;
|
||||||
lexerMap["shell"] = wxSTC_LEX_BASH;
|
lexerMap["shell"] = wxSTC_LEX_BASH;
|
||||||
lexerMap["sql"] = wxSTC_LEX_SQL;
|
lexerMap["sql"] = wxSTC_LEX_SQL;
|
||||||
lexerMap["xml"] = wxSTC_LEX_XML;
|
lexerMap["xml"] = wxSTC_LEX_XML;
|
||||||
@ -63,6 +64,8 @@ void EditPane::Highlight(wxString filePath)
|
|||||||
// Get the configuration name for the selected language
|
// Get the configuration name for the selected language
|
||||||
string lang = this->GetLangByFile();
|
string lang = this->GetLangByFile();
|
||||||
|
|
||||||
|
wxLogDebug("Language selected: %s", lang);
|
||||||
|
|
||||||
this->StyleClearAll();
|
this->StyleClearAll();
|
||||||
|
|
||||||
if (lexerMap.count(lang) > 0)
|
if (lexerMap.count(lang) > 0)
|
||||||
@ -148,8 +151,10 @@ void EditPane::ApplyTheme(string lang, string theme)
|
|||||||
wxLogDebug(output.str().c_str());
|
wxLogDebug(output.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int offset_count = 0;//(lang == "php") ? 104 : 0;
|
||||||
|
|
||||||
// Do the appropriate mappings to load the selected theme
|
// 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;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the configured color for the specified theme
|
||||||
|
* @param type
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
wxColor EditPane::GetThemeColor(string type, string key)
|
wxColor EditPane::GetThemeColor(string type, string key)
|
||||||
{
|
{
|
||||||
JsonValue color_value = this->GetThemeValue(type, 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
|
* Iterate through the theme settings and apply them
|
||||||
*
|
*
|
||||||
* @param JsonValue lexer_map - Maps token types to theme colors
|
* @param JsonValue lexer_map - Maps token types to theme colors
|
||||||
|
* @param int addtoi - Offset for some languages
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void EditPane::_ApplyTheme(JsonValue lexer_map)
|
void EditPane::_ApplyTheme(JsonValue lexer_map, int addtoi)
|
||||||
{
|
{
|
||||||
// Font setup
|
// Font setup
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
@ -437,20 +449,29 @@ void EditPane::_ApplyTheme(JsonValue lexer_map)
|
|||||||
this->StyleSetBackground (wxSTC_STYLE_LINENUMBER, line_number_background);
|
this->StyleSetBackground (wxSTC_STYLE_LINENUMBER, line_number_background);
|
||||||
this->SetMarginType (MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER);
|
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
|
// Set the foreground color, if it exists
|
||||||
if ( ! this->GetThemeValue("foreground", key).isNull())
|
if ( ! this->GetThemeValue("foreground", key).isNull())
|
||||||
{
|
{
|
||||||
this->StyleSetForeground(i, this->GetThemeColor("foreground", key));
|
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
|
// Set the background color, if it exists
|
||||||
if ( ! this->GetThemeValue("background", key).isNull())
|
if ( ! this->GetThemeValue("background", key).isNull())
|
||||||
{
|
{
|
||||||
this->StyleSetBackground(i, this->GetThemeColor("background", key));
|
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
|
// Set bold, if it applies
|
||||||
|
@ -48,7 +48,7 @@ private:
|
|||||||
JsonValue GetThemeValue(string type, string key);
|
JsonValue GetThemeValue(string type, string key);
|
||||||
wxColor GetThemeColor(string type, string key);
|
wxColor GetThemeColor(string type, string key);
|
||||||
JsonValue GetKeywordList(string lang);
|
JsonValue GetKeywordList(string lang);
|
||||||
void _ApplyTheme(JsonValue lexer_map);
|
void _ApplyTheme(JsonValue lexer_map, int addtoi=0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TYRODOC_FRAME_H
|
#endif // TYRODOC_FRAME_H
|
||||||
|
Loading…
Reference in New Issue
Block a user