Skip to content

Commit

Permalink
Implemented: Feature Request: Global theme preview
Browse files Browse the repository at this point in the history
    fixes: eranif#762
  • Loading branch information
eranif committed Nov 24, 2015
1 parent 81fbd98 commit 8080e38
Show file tree
Hide file tree
Showing 6 changed files with 813 additions and 80 deletions.
207 changes: 201 additions & 6 deletions LiteEditor/SyntaxHighlightBaseDlg.wxcp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"metadata": {
"m_generatedFilesDir": ".",
"m_objCounter": 161,
"m_objCounter": 165,
"m_includeFiles": [],
"m_bitmapFunction": "wxCrafterqEa5vvInitBitmapResources",
"m_bitmapsFile": "syntaxhighlightbasedlg_liteeditor_bitmaps.cpp",
"m_GenerateCodeTypes": 4984201,
"m_outputFileName": "syntaxhighlightbasedlg",
"m_firstWindowId": 1000,
"m_useEnum": true,
"m_useUnderscoreMacro": true,
"m_templateClasses": []
},
"windows": [{
Expand All @@ -26,7 +27,7 @@
}, {
"type": "string",
"m_label": "Minimum Size:",
"m_value": ""
"m_value": "-1,500"
}, {
"type": "string",
"m_label": "Name:",
Expand Down Expand Up @@ -214,7 +215,7 @@
}, {
"type": "bitmapPicker",
"m_label": "Bitmap File:",
"m_path": "wxART_NEW,wxART_TOOLBAR,16"
"m_path": "../bitmaps/16-file_new.png"
}, {
"type": "filePicker",
"m_label": "Disabled-Bitmap File",
Expand Down Expand Up @@ -269,7 +270,7 @@
}, {
"type": "bitmapPicker",
"m_label": "Bitmap File:",
"m_path": "wxART_FILE_SAVE,wxART_TOOLBAR,16"
"m_path": "../bitmaps/16-file_save.png"
}, {
"type": "filePicker",
"m_label": "Disabled-Bitmap File",
Expand Down Expand Up @@ -445,7 +446,7 @@
}, {
"type": "bitmapPicker",
"m_label": "Bitmap File:",
"m_path": "wxART_FILE_OPEN,wxART_TOOLBAR,16"
"m_path": "../bitmaps/16-file_open.png"
}, {
"type": "filePicker",
"m_label": "Disabled-Bitmap File",
Expand Down Expand Up @@ -500,7 +501,7 @@
}, {
"type": "bitmapPicker",
"m_label": "Bitmap File:",
"m_path": "../codelite-icons/toolbars/16/standard/document-revert.png"
"m_path": "../bitmaps/16-file_reload.png"
}, {
"type": "filePicker",
"m_label": "Disabled-Bitmap File",
Expand Down Expand Up @@ -1484,6 +1485,200 @@
}],
"m_children": []
}]
}, {
"m_type": 4405,
"proportion": 0,
"border": 5,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxALIGN_CENTER_HORIZONTAL"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
"m_winid": "wxID_ANY"
}, {
"type": "string",
"m_label": "Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Minimum Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Name:",
"m_value": "m_staticText165"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
"m_value": ""
}, {
"type": "colour",
"m_label": "Bg Colour:",
"colour": "<Default>"
}, {
"type": "colour",
"m_label": "Fg Colour:",
"colour": "<Default>"
}, {
"type": "font",
"m_label": "Font:",
"m_value": ""
}, {
"type": "bool",
"m_label": "Hidden",
"m_value": false
}, {
"type": "bool",
"m_label": "Disabled",
"m_value": false
}, {
"type": "bool",
"m_label": "Focused",
"m_value": false
}, {
"type": "string",
"m_label": "Class Name:",
"m_value": ""
}, {
"type": "string",
"m_label": "Include File:",
"m_value": ""
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "multi-string",
"m_label": "Label:",
"m_value": "Preview:"
}, {
"type": "string",
"m_label": "Wrap:",
"m_value": "-1"
}],
"m_events": [],
"m_children": []
}, {
"m_type": 4466,
"proportion": 1,
"border": 5,
"gbSpan": "1,1",
"gbPosition": "0,0",
"m_styles": [],
"m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"],
"m_properties": [{
"type": "winid",
"m_label": "ID:",
"m_winid": "wxID_ANY"
}, {
"type": "string",
"m_label": "Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Minimum Size:",
"m_value": "-1,-1"
}, {
"type": "string",
"m_label": "Name:",
"m_value": "m_stcPreview"
}, {
"type": "multi-string",
"m_label": "Tooltip:",
"m_value": ""
}, {
"type": "bool",
"m_label": "Hidden",
"m_value": false
}, {
"type": "bool",
"m_label": "Disabled",
"m_value": false
}, {
"type": "bool",
"m_label": "Focused",
"m_value": false
}, {
"type": "string",
"m_label": "Class Name:",
"m_value": ""
}, {
"type": "string",
"m_label": "Include File:",
"m_value": ""
}, {
"type": "string",
"m_label": "Style:",
"m_value": ""
}, {
"type": "bool",
"m_label": "Fold Margin",
"m_value": false
}, {
"type": "bool",
"m_label": "Line Number Margin",
"m_value": false
}, {
"type": "bool",
"m_label": "Separator Margin",
"m_value": false
}, {
"type": "bool",
"m_label": "Symbol Margin",
"m_value": false
}, {
"type": "choice",
"m_label": "Wrap Text",
"m_selection": 0,
"m_options": ["None", "Word", "Char"]
}, {
"type": "choice",
"m_label": "Indentation Guides",
"m_selection": 0,
"m_options": ["None", "Real", "Look Forward", "Look Both"]
}, {
"type": "choice",
"m_label": "EOL Mode",
"m_selection": 3,
"m_options": ["CRLF", "CR", "LF", "Default"]
}, {
"type": "bool",
"m_label": "Display EOL Markers",
"m_value": false
}, {
"type": "choice",
"m_label": "Lexer",
"m_selection": 58,
"m_options": ["wxSTC_LEX_ABAQUS", "wxSTC_LEX_ADA", "wxSTC_LEX_APDL", "wxSTC_LEX_ASM", "wxSTC_LEX_ASN1", "wxSTC_LEX_ASYMPTOTE", "wxSTC_LEX_AUTOMATIC", "wxSTC_LEX_AVE", "wxSTC_LEX_BAAN", "wxSTC_LEX_BASH", "wxSTC_LEX_BATCH", "wxSTC_LEX_BLITZBASIC", "wxSTC_LEX_BULLANT", "wxSTC_LEX_CAML", "wxSTC_LEX_CLW", "wxSTC_LEX_CLWNOCASE", "wxSTC_LEX_CMAKE", "wxSTC_LEX_COBOL", "wxSTC_LEX_CONF", "wxSTC_LEX_CONTAINER", "wxSTC_LEX_CPP", "wxSTC_LEX_CPPNOCASE", "wxSTC_LEX_CSOUND", "wxSTC_LEX_CSS", "wxSTC_LEX_D", "wxSTC_LEX_DIFF", "wxSTC_LEX_EIFFEL", "wxSTC_LEX_EIFFELKW", "wxSTC_LEX_ERLANG", "wxSTC_LEX_ERRORLIST", "wxSTC_LEX_ESCRIPT", "wxSTC_LEX_F77", "wxSTC_LEX_FLAGSHIP", "wxSTC_LEX_FORTH", "wxSTC_LEX_FORTRAN", "wxSTC_LEX_FREEBASIC", "wxSTC_LEX_GAP", "wxSTC_LEX_GUI4CLI", "wxSTC_LEX_HASKELL", "wxSTC_LEX_HTML", "wxSTC_LEX_INNOSETUP", "wxSTC_LEX_KIX", "wxSTC_LEX_LATEX", "wxSTC_LEX_LISP", "wxSTC_LEX_LOT", "wxSTC_LEX_LOUT", "wxSTC_LEX_LUA", "wxSTC_LEX_MAGIK", "wxSTC_LEX_MAKEFILE", "wxSTC_LEX_MARKDOWN", "wxSTC_LEX_MATLAB", "wxSTC_LEX_METAPOST", "wxSTC_LEX_MMIXAL", "wxSTC_LEX_MSSQL", "wxSTC_LEX_MYSQL", "wxSTC_LEX_NIMROD", "wxSTC_LEX_NNCRONTAB", "wxSTC_LEX_NSIS", "wxSTC_LEX_NULL", "wxSTC_LEX_OCTAVE", "wxSTC_LEX_OPAL", "wxSTC_LEX_PASCAL", "wxSTC_LEX_PERL", "wxSTC_LEX_PHPSCRIPT", "wxSTC_LEX_PLM", "wxSTC_LEX_PO", "wxSTC_LEX_POV", "wxSTC_LEX_POWERBASIC", "wxSTC_LEX_POWERPRO", "wxSTC_LEX_POWERSHELL", "wxSTC_LEX_PROGRESS", "wxSTC_LEX_PROPERTIES", "wxSTC_LEX_PS", "wxSTC_LEX_PUREBASIC", "wxSTC_LEX_PYTHON", "wxSTC_LEX_R", "wxSTC_LEX_REBOL", "wxSTC_LEX_RUBY", "wxSTC_LEX_SCRIPTOL", "wxSTC_LEX_SMALLTALK", "wxSTC_LEX_SML", "wxSTC_LEX_SORCUS", "wxSTC_LEX_SPECMAN", "wxSTC_LEX_SPICE", "wxSTC_LEX_SQL", "wxSTC_LEX_TACL", "wxSTC_LEX_TADS3", "wxSTC_LEX_TAL", "wxSTC_LEX_TCL", "wxSTC_LEX_TEX", "wxSTC_LEX_VB", "wxSTC_LEX_VBSCRIPT", "wxSTC_LEX_VERILOG", "wxSTC_LEX_VHDL", "wxSTC_LEX_XCODE", "wxSTC_LEX_XML", "wxSTC_LEX_YAML"]
}, {
"type": "font",
"m_label": "Font:",
"m_value": ""
}, {
"type": "multi-string",
"m_label": "Keywords Set 1",
"m_value": ""
}, {
"type": "multi-string",
"m_label": "Keywords Set 2",
"m_value": ""
}, {
"type": "multi-string",
"m_label": "Keywords Set 3",
"m_value": ""
}, {
"type": "multi-string",
"m_label": "Keywords Set 4",
"m_value": ""
}, {
"type": "multi-string",
"m_label": "Keywords Set 5",
"m_value": ""
}],
"m_events": [],
"m_children": []
}]
}]
}, {
Expand Down
71 changes: 61 additions & 10 deletions LiteEditor/syntaxhighlightbasedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ SyntaxHighlightBaseDlg::SyntaxHighlightBaseDlg(wxWindow* parent, wxWindowID id,

bSizer1->Add(m_auibar, 0, wxEXPAND, 5);

m_auibar->AddTool(wxID_NEW, _("New Theme..."), wxArtProvider::GetBitmap(wxART_NEW, wxART_TOOLBAR, wxSize(16, 16)), wxNullBitmap, wxITEM_NORMAL, _("New Theme..."), _("New Theme..."), NULL);
m_auibar->AddTool(wxID_NEW, _("New Theme..."), wxXmlResource::Get()->LoadBitmap(wxT("16-file_new")), wxNullBitmap, wxITEM_NORMAL, _("New Theme..."), _("New Theme..."), NULL);

m_auibar->AddTool(wxID_SAVE, _("Export"), wxArtProvider::GetBitmap(wxART_FILE_SAVE, wxART_TOOLBAR, wxSize(16, 16)), wxNullBitmap, wxITEM_NORMAL, _("Export syntax highlight settings to zip file"), _("Export syntax highlight settings to zip file"), NULL);
m_auibar->AddTool(wxID_SAVE, _("Export"), wxXmlResource::Get()->LoadBitmap(wxT("16-file_save")), wxNullBitmap, wxITEM_NORMAL, _("Export syntax highlight settings to zip file"), _("Export syntax highlight settings to zip file"), NULL);
wxAuiToolBarItem* m_toolbarItemSave = m_auibar->FindToolByIndex(m_auibar->GetToolCount()-1);
if (m_toolbarItemSave) {
m_toolbarItemSave->SetHasDropDown(true);
Expand All @@ -56,9 +56,9 @@ SyntaxHighlightBaseDlg::SyntaxHighlightBaseDlg(wxWindow* parent, wxWindowID id,
m_dropdownMenus.insert(std::make_pair( m_toolbarItemSave->GetId(), m_menu142) );
}

m_auibar->AddTool(wxID_OPEN, _("Import settings from a zip archive"), wxArtProvider::GetBitmap(wxART_FILE_OPEN, wxART_TOOLBAR, wxSize(16, 16)), wxNullBitmap, wxITEM_NORMAL, _("Import settings from a zip archive"), _("Import settings from a zip archive"), NULL);
m_auibar->AddTool(wxID_OPEN, _("Import settings from a zip archive"), wxXmlResource::Get()->LoadBitmap(wxT("16-file_open")), wxNullBitmap, wxITEM_NORMAL, _("Import settings from a zip archive"), _("Import settings from a zip archive"), NULL);

m_auibar->AddTool(wxID_REVERT, _("Revert to default settings"), wxXmlResource::Get()->LoadBitmap(wxT("document-revert")), wxNullBitmap, wxITEM_NORMAL, _("Revert to default settings"), _("Revert to default settings"), NULL);
m_auibar->AddTool(wxID_REVERT, _("Revert to default settings"), wxXmlResource::Get()->LoadBitmap(wxT("16-file_reload")), wxNullBitmap, wxITEM_NORMAL, _("Revert to default settings"), _("Revert to default settings"), NULL);

m_auibar->AddTool(ID_TOOL_IMPORT_ECLIPSE_THEME, _("Import Eclipse Theme"), wxXmlResource::Get()->LoadBitmap(wxT("eclipse")), wxNullBitmap, wxITEM_NORMAL, _("Import Eclipse Theme"), _("Import Eclipse Theme"), NULL);
wxAuiToolBarItem* m_toolbarItem150 = m_auibar->FindToolByIndex(m_auibar->GetToolCount()-1);
Expand Down Expand Up @@ -128,6 +128,48 @@ SyntaxHighlightBaseDlg::SyntaxHighlightBaseDlg(wxWindow* parent, wxWindowID id,

fgSizer4->Add(m_colourPickerOutputPanesBgColour, 0, wxALL|wxEXPAND, 5);

m_staticText165 = new wxStaticText(m_panelGlobalColours, wxID_ANY, _("Preview:"), wxDefaultPosition, wxSize(-1,-1), 0);

boxSizer82->Add(m_staticText165, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5);

m_stcPreview = new wxStyledTextCtrl(m_panelGlobalColours, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), 0);
// Configure the fold margin
m_stcPreview->SetMarginType (4, wxSTC_MARGIN_SYMBOL);
m_stcPreview->SetMarginMask (4, wxSTC_MASK_FOLDERS);
m_stcPreview->SetMarginSensitive(4, true);
m_stcPreview->SetMarginWidth (4, 0);

// Configure the tracker margin
m_stcPreview->SetMarginWidth(1, 0);

// Configure the symbol margin
m_stcPreview->SetMarginType (2, wxSTC_MARGIN_SYMBOL);
m_stcPreview->SetMarginMask (2, ~(wxSTC_MASK_FOLDERS));
m_stcPreview->SetMarginWidth(2, 0);
m_stcPreview->SetMarginSensitive(2, true);

// Configure the line numbers margin
m_stcPreview->SetMarginType(0, wxSTC_MARGIN_NUMBER);
m_stcPreview->SetMarginWidth(0,0);

// Configure the line symbol margin
m_stcPreview->SetMarginType(3, wxSTC_MARGIN_FORE);
m_stcPreview->SetMarginMask(3, 0);
m_stcPreview->SetMarginWidth(3,0);
// Select the lexer
m_stcPreview->SetLexer(wxSTC_LEX_NULL);
// Set default font / styles
m_stcPreview->StyleClearAll();
m_stcPreview->SetWrapMode(0);
m_stcPreview->SetIndentationGuides(0);
m_stcPreview->SetKeyWords(0, wxT(""));
m_stcPreview->SetKeyWords(1, wxT(""));
m_stcPreview->SetKeyWords(2, wxT(""));
m_stcPreview->SetKeyWords(3, wxT(""));
m_stcPreview->SetKeyWords(4, wxT(""));

boxSizer82->Add(m_stcPreview, 1, wxALL|wxEXPAND, 5);

m_panelSyntaxHighlight = new wxPanel(m_notebook76, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), wxTAB_TRAVERSAL);
m_panelSyntaxHighlight->SetToolTip(_("Customize your colours and font per language"));
m_notebook76->AddPage(m_panelSyntaxHighlight, _("Customize"), false);
Expand Down Expand Up @@ -384,11 +426,16 @@ SyntaxHighlightBaseDlg::SyntaxHighlightBaseDlg(wxWindow* parent, wxWindowID id,
#endif

SetName(wxT("SyntaxHighlightBaseDlg"));
SetSizeHints(-1,-1);
if ( GetSizer() ) {
SetMinClientSize(wxSize(-1,500));
SetSize(-1,-1);
if (GetSizer()) {
GetSizer()->Fit(this);
}
CentreOnParent(wxBOTH);
if(GetParent()) {
CentreOnParent(wxBOTH);
} else {
CentreOnScreen(wxBOTH);
}
#if wxVERSION_NUMBER >= 2900
if(!wxPersistenceManager::Get().Find(this)) {
wxPersistenceManager::Get().RegisterAndRestore(this);
Expand Down Expand Up @@ -575,11 +622,15 @@ NewThemeDialogBase::NewThemeDialogBase(wxWindow* parent, wxWindowID id, const wx
m_stdBtnSizer117->Realize();

SetName(wxT("NewThemeDialogBase"));
SetSizeHints(-1,-1);
if ( GetSizer() ) {
SetSize(-1,-1);
if (GetSizer()) {
GetSizer()->Fit(this);
}
CentreOnParent(wxBOTH);
if(GetParent()) {
CentreOnParent(wxBOTH);
} else {
CentreOnScreen(wxBOTH);
}
#if wxVERSION_NUMBER >= 2900
if(!wxPersistenceManager::Get().Find(this)) {
wxPersistenceManager::Get().RegisterAndRestore(this);
Expand Down
Loading

0 comments on commit 8080e38

Please sign in to comment.