| 1 |
#include "styled_text_ctrl_wrapper.h" |
| 2 |
#include "allocator_mgr.h" |
| 3 |
#include "bool_property.h" |
| 4 |
#include "category_property.h" |
| 5 |
#include "choice_property.h" |
| 6 |
#include "font_property.h" |
| 7 |
#include "multi_strings_property.h" |
| 8 |
#include "wxgui_helpers.h" |
| 9 |
#include <wx/stc/stc.h> |
| 10 |
|
| 11 |
StyledTextCtrlWrapper::LexersMap_t StyledTextCtrlWrapper::m_lexers; |
| 12 |
|
| 13 |
#define ADD_LEXER(lexID) m_lexers.insert(std::make_pair(#lexID, lexID)); |
| 14 |
|
| 15 |
StyledTextCtrlWrapper::StyledTextCtrlWrapper() |
| 16 |
: wxcWidget(ID_WXSTC) |
| 17 |
{ |
| 18 |
// Register the known lexers |
| 19 |
if(m_lexers.empty()) { |
| 20 |
ADD_LEXER(wxSTC_LEX_CONTAINER); |
| 21 |
ADD_LEXER(wxSTC_LEX_NULL); |
| 22 |
ADD_LEXER(wxSTC_LEX_PYTHON); |
| 23 |
ADD_LEXER(wxSTC_LEX_CPP); |
| 24 |
ADD_LEXER(wxSTC_LEX_HTML); |
| 25 |
ADD_LEXER(wxSTC_LEX_XML); |
| 26 |
ADD_LEXER(wxSTC_LEX_PERL); |
| 27 |
ADD_LEXER(wxSTC_LEX_SQL); |
| 28 |
ADD_LEXER(wxSTC_LEX_VB); |
| 29 |
ADD_LEXER(wxSTC_LEX_PROPERTIES); |
| 30 |
ADD_LEXER(wxSTC_LEX_ERRORLIST); |
| 31 |
ADD_LEXER(wxSTC_LEX_MAKEFILE); |
| 32 |
ADD_LEXER(wxSTC_LEX_BATCH); |
| 33 |
ADD_LEXER(wxSTC_LEX_XCODE); |
| 34 |
ADD_LEXER(wxSTC_LEX_LATEX); |
| 35 |
ADD_LEXER(wxSTC_LEX_LUA); |
| 36 |
ADD_LEXER(wxSTC_LEX_DIFF); |
| 37 |
ADD_LEXER(wxSTC_LEX_CONF); |
| 38 |
ADD_LEXER(wxSTC_LEX_PASCAL); |
| 39 |
ADD_LEXER(wxSTC_LEX_AVE); |
| 40 |
ADD_LEXER(wxSTC_LEX_ADA); |
| 41 |
ADD_LEXER(wxSTC_LEX_LISP); |
| 42 |
ADD_LEXER(wxSTC_LEX_RUBY); |
| 43 |
ADD_LEXER(wxSTC_LEX_EIFFEL); |
| 44 |
ADD_LEXER(wxSTC_LEX_EIFFELKW); |
| 45 |
ADD_LEXER(wxSTC_LEX_TCL); |
| 46 |
ADD_LEXER(wxSTC_LEX_NNCRONTAB); |
| 47 |
ADD_LEXER(wxSTC_LEX_BULLANT); |
| 48 |
ADD_LEXER(wxSTC_LEX_VBSCRIPT); |
| 49 |
ADD_LEXER(wxSTC_LEX_BAAN); |
| 50 |
ADD_LEXER(wxSTC_LEX_MATLAB); |
| 51 |
ADD_LEXER(wxSTC_LEX_SCRIPTOL); |
| 52 |
ADD_LEXER(wxSTC_LEX_ASM); |
| 53 |
ADD_LEXER(wxSTC_LEX_CPPNOCASE); |
| 54 |
ADD_LEXER(wxSTC_LEX_FORTRAN); |
| 55 |
ADD_LEXER(wxSTC_LEX_F77); |
| 56 |
ADD_LEXER(wxSTC_LEX_CSS); |
| 57 |
ADD_LEXER(wxSTC_LEX_POV); |
| 58 |
ADD_LEXER(wxSTC_LEX_LOUT); |
| 59 |
ADD_LEXER(wxSTC_LEX_ESCRIPT); |
| 60 |
ADD_LEXER(wxSTC_LEX_PS); |
| 61 |
ADD_LEXER(wxSTC_LEX_NSIS); |
| 62 |
ADD_LEXER(wxSTC_LEX_MMIXAL); |
| 63 |
ADD_LEXER(wxSTC_LEX_CLW); |
| 64 |
ADD_LEXER(wxSTC_LEX_CLWNOCASE); |
| 65 |
ADD_LEXER(wxSTC_LEX_LOT); |
| 66 |
ADD_LEXER(wxSTC_LEX_YAML); |
| 67 |
ADD_LEXER(wxSTC_LEX_TEX); |
| 68 |
ADD_LEXER(wxSTC_LEX_METAPOST); |
| 69 |
ADD_LEXER(wxSTC_LEX_POWERBASIC); |
| 70 |
ADD_LEXER(wxSTC_LEX_FORTH); |
| 71 |
ADD_LEXER(wxSTC_LEX_ERLANG); |
| 72 |
ADD_LEXER(wxSTC_LEX_OCTAVE); |
| 73 |
ADD_LEXER(wxSTC_LEX_MSSQL); |
| 74 |
ADD_LEXER(wxSTC_LEX_VERILOG); |
| 75 |
ADD_LEXER(wxSTC_LEX_KIX); |
| 76 |
ADD_LEXER(wxSTC_LEX_GUI4CLI); |
| 77 |
ADD_LEXER(wxSTC_LEX_SPECMAN); |
| 78 |
ADD_LEXER(wxSTC_LEX_AUTOMATIC); |
| 79 |
ADD_LEXER(wxSTC_LEX_APDL); |
| 80 |
ADD_LEXER(wxSTC_LEX_BASH); |
| 81 |
ADD_LEXER(wxSTC_LEX_ASN1); |
| 82 |
ADD_LEXER(wxSTC_LEX_VHDL); |
| 83 |
ADD_LEXER(wxSTC_LEX_CAML); |
| 84 |
ADD_LEXER(wxSTC_LEX_BLITZBASIC); |
| 85 |
ADD_LEXER(wxSTC_LEX_PUREBASIC); |
| 86 |
ADD_LEXER(wxSTC_LEX_HASKELL); |
| 87 |
ADD_LEXER(wxSTC_LEX_PHPSCRIPT); |
| 88 |
ADD_LEXER(wxSTC_LEX_TADS3); |
| 89 |
ADD_LEXER(wxSTC_LEX_REBOL); |
| 90 |
ADD_LEXER(wxSTC_LEX_SMALLTALK); |
| 91 |
ADD_LEXER(wxSTC_LEX_FLAGSHIP); |
| 92 |
ADD_LEXER(wxSTC_LEX_CSOUND); |
| 93 |
ADD_LEXER(wxSTC_LEX_FREEBASIC); |
| 94 |
ADD_LEXER(wxSTC_LEX_INNOSETUP); |
| 95 |
ADD_LEXER(wxSTC_LEX_OPAL); |
| 96 |
ADD_LEXER(wxSTC_LEX_SPICE); |
| 97 |
ADD_LEXER(wxSTC_LEX_D); |
| 98 |
ADD_LEXER(wxSTC_LEX_CMAKE); |
| 99 |
ADD_LEXER(wxSTC_LEX_GAP); |
| 100 |
ADD_LEXER(wxSTC_LEX_PLM); |
| 101 |
ADD_LEXER(wxSTC_LEX_PROGRESS); |
| 102 |
ADD_LEXER(wxSTC_LEX_ABAQUS); |
| 103 |
ADD_LEXER(wxSTC_LEX_ASYMPTOTE); |
| 104 |
ADD_LEXER(wxSTC_LEX_R); |
| 105 |
ADD_LEXER(wxSTC_LEX_MAGIK); |
| 106 |
ADD_LEXER(wxSTC_LEX_POWERSHELL); |
| 107 |
ADD_LEXER(wxSTC_LEX_MYSQL); |
| 108 |
ADD_LEXER(wxSTC_LEX_PO); |
| 109 |
ADD_LEXER(wxSTC_LEX_TAL); |
| 110 |
ADD_LEXER(wxSTC_LEX_COBOL); |
| 111 |
ADD_LEXER(wxSTC_LEX_TACL); |
| 112 |
ADD_LEXER(wxSTC_LEX_SORCUS); |
| 113 |
ADD_LEXER(wxSTC_LEX_POWERPRO); |
| 114 |
ADD_LEXER(wxSTC_LEX_NIMROD); |
| 115 |
ADD_LEXER(wxSTC_LEX_SML); |
| 116 |
ADD_LEXER(wxSTC_LEX_MARKDOWN); |
| 117 |
} |
| 118 |
|
| 119 |
DelProperty(PROP_FONT); |
| 120 |
DelProperty(PROP_BG); |
| 121 |
DelProperty(PROP_FG); |
| 122 |
|
| 123 |
RegisterEvent("wxEVT_STC_CHANGE", "wxStyledTextEvent", ""); |
| 124 |
RegisterEvent( |
| 125 |
"wxEVT_STC_STYLENEEDED", "wxStyledTextEvent", |
| 126 |
_("If you used SCI_SETLEXER(SCLEX_CONTAINER) to make the container act as the lexer\nyou will receive this " |
| 127 |
"notification when Scintilla is about to display or print text that requires styling")); |
| 128 |
RegisterEvent("wxEVT_STC_CHARADDED", "wxStyledTextEvent", _("A char was added")); |
| 129 |
RegisterEvent("wxEVT_STC_SAVEPOINTREACHED", "wxStyledTextEvent", |
| 130 |
_("Sent to the container when the save point is entered\nallowing the container to display a " |
| 131 |
"\"document saved\" indicator and change its menus")); |
| 132 |
RegisterEvent("wxEVT_STC_SAVEPOINTLEFT", "wxStyledTextEvent", |
| 133 |
_("Sent to the container when the save point is left\nallowing the container to display a \"document " |
| 134 |
"dirty\" indicator and change its menus")); |
| 135 |
RegisterEvent("wxEVT_STC_ROMODIFYATTEMPT", "wxStyledTextEvent", |
| 136 |
_("An attempt to modify a read-only document was made")); |
| 137 |
RegisterEvent("wxEVT_STC_KEY", "wxStyledTextEvent", _("Key was pressed")); |
| 138 |
RegisterEvent("wxEVT_STC_DOUBLECLICK", "wxStyledTextEvent", _("Double-click")); |
| 139 |
RegisterEvent("wxEVT_STC_UPDATEUI", "wxStyledTextEvent", _("Update UI")); |
| 140 |
RegisterEvent("wxEVT_STC_MODIFIED", "wxStyledTextEvent", _("Document modified")); |
| 141 |
RegisterEvent("wxEVT_STC_MACRORECORD", "wxStyledTextEvent", _("Macro record started/stopped")); |
| 142 |
RegisterEvent("wxEVT_STC_MARGINCLICK", "wxStyledTextEvent", _("One of margins was left clicked with the mouse")); |
| 143 |
RegisterEvent( |
| 144 |
"wxEVT_STC_NEEDSHOWN", "wxStyledTextEvent", |
| 145 |
_("Scintilla has determined that a range of lines that is currently invisible should be made visible")); |
| 146 |
RegisterEvent("wxEVT_STC_PAINTED", "wxStyledTextEvent", |
| 147 |
_("Painting has just been done.\nUseful when you want to update some other widgets based on a change " |
| 148 |
"in Scintilla\nbut want to have the paint occur first to appear more responsive")); |
| 149 |
RegisterEvent("wxEVT_STC_USERLISTSELECTION", "wxStyledTextEvent", |
| 150 |
_("The user has selected an item in a user list.")); |
| 151 |
RegisterEvent("wxEVT_STC_URIDROPPED", "wxStyledTextEvent", |
| 152 |
_("Only on the GTK+ version. Indicates that the user has dragged a URI such as a file name or Web " |
| 153 |
"address onto Scintilla")); |
| 154 |
RegisterEvent("wxEVT_STC_DWELLSTART", "wxStyledTextEvent", |
| 155 |
_("Generated when the user keeps the mouse in one position for the dwell period")); |
| 156 |
RegisterEvent("wxEVT_STC_DWELLEND", "wxStyledTextEvent", |
| 157 |
_("Generated after a wxEVT_STC_DWELLSTART and the mouse is moved or other activity such as key press " |
| 158 |
"indicates the dwell is over")); |
| 159 |
RegisterEvent("wxEVT_STC_START_DRAG", "wxStyledTextEvent", _("Drag and Drop start event")); |
| 160 |
RegisterEvent("wxEVT_STC_DRAG_OVER", "wxStyledTextEvent", _("Drag and Drop over event")); |
| 161 |
RegisterEvent("wxEVT_STC_DO_DROP", "wxStyledTextEvent", _("Drag and Drop drop event")); |
| 162 |
RegisterEvent("wxEVT_STC_ZOOM", "wxStyledTextEvent", |
| 163 |
_("This event is generated when the user zooms the display using the keyboard")); |
| 164 |
RegisterEvent("wxEVT_STC_HOTSPOT_CLICK", "wxStyledTextEvent", _("A hotspot was clicked")); |
| 165 |
RegisterEvent("wxEVT_STC_HOTSPOT_DCLICK", "wxStyledTextEvent", _("A hotspot was double clicked")); |
| 166 |
RegisterEvent("wxEVT_STC_CALLTIP_CLICK", "wxStyledTextEvent", _("The calltip window was clicked")); |
| 167 |
RegisterEvent("wxEVT_STC_AUTOCOMP_SELECTION", "wxStyledTextEvent", _("Auto-completion list selection was made")); |
| 168 |
RegisterEvent("wxEVT_STC_INDICATOR_CLICK", "wxStyledTextEvent", |
| 169 |
_("User clicked the mouse on a text that has an indicator")); |
| 170 |
RegisterEvent("wxEVT_STC_INDICATOR_RELEASE", "wxStyledTextEvent", |
| 171 |
_("User released the mouse on a text that has an indicator")); |
| 172 |
RegisterEvent("wxEVT_STC_AUTOCOMP_CANCELLED", "wxStyledTextEvent", _("Auto completion list was cancelled")); |
| 173 |
RegisterEvent("wxEVT_STC_AUTOCOMP_CHAR_DELETED", "wxStyledTextEvent", |
| 174 |
_("The user deleted a character while auto-completion list was active")); |
| 175 |
|
| 176 |
SetPropertyString(_("Common Settings"), "wxStyledTextCtrl"); |
| 177 |
AddProperty(new BoolProperty(PROP_STC_MARGIN_FOLD, true, "")); |
| 178 |
AddProperty(new BoolProperty(PROP_STC_MARGIN_LINE_NUMBERS, true, "")); |
| 179 |
AddProperty(new BoolProperty(PROP_STC_MARGIN_SEPARATOR, false, "")); |
| 180 |
AddProperty(new BoolProperty(PROP_STC_MARGIN_SYMBOL, false, "")); |
| 181 |
|
| 182 |
m_wrapOptions.Add("None"); // 0 |
| 183 |
m_wrapOptions.Add("Word"); // 1 |
| 184 |
m_wrapOptions.Add("Char"); // 2 |
| 185 |
|
| 186 |
AddProperty(new ChoiceProperty(PROP_STC_WRAP, m_wrapOptions, 0, _("Wrap text"))); |
| 187 |
|
| 188 |
m_indentGuides.Add("None"); |
| 189 |
m_indentGuides.Add("Real"); |
| 190 |
m_indentGuides.Add("Look Forward"); |
| 191 |
m_indentGuides.Add("Look Both"); |
| 192 |
|
| 193 |
AddProperty(new ChoiceProperty(PROP_STC_INDENT_GUIDES, m_indentGuides, 0, |
| 194 |
_("Display indentation guides (vertical lines)"))); |
| 195 |
|
| 196 |
m_eolMode.Add("CRLF"); // 0 |
| 197 |
m_eolMode.Add("CR"); // 1 |
| 198 |
m_eolMode.Add("LF"); // 2 |
| 199 |
m_eolMode.Add("Default"); // 3 |
| 200 |
|
| 201 |
AddProperty(new ChoiceProperty(PROP_STC_EOL_MODE, m_eolMode, 3, _("EOL Mode"))); |
| 202 |
AddProperty(new BoolProperty(PROP_STC_VIEW_EOL, false, _("Display the line endings characters"))); |
| 203 |
|
| 204 |
wxArrayString lexersArr = GetLexers(); |
| 205 |
int sel = lexersArr.Index("wxSTC_LEX_NULL"); |
| 206 |
AddProperty( |
| 207 |
new ChoiceProperty(PROP_STC_LEXER, lexersArr, sel, |
| 208 |
_("Set the wxStyledTextCtrl lexer.\nThe lexer affects the syntax highlight of control"))); |
| 209 |
AddProperty(new FontProperty(PROP_FONT, "", _("Set the basic styles font"))); |
| 210 |
|
| 211 |
AddProperty(new CategoryProperty(_("Keywords"))); |
| 212 |
AddProperty(new MultiStringsProperty(PROP_KEYWORDS_SET_1, _("Keywords set 1"), " ")); |
| 213 |
AddProperty(new MultiStringsProperty(PROP_KEYWORDS_SET_2, _("Keywords set 2"), " ")); |
| 214 |
AddProperty(new MultiStringsProperty(PROP_KEYWORDS_SET_3, _("Keywords set 3"), " ")); |
| 215 |
AddProperty(new MultiStringsProperty(PROP_KEYWORDS_SET_4, _("Keywords set 4"), " ")); |
| 216 |
AddProperty(new MultiStringsProperty(PROP_KEYWORDS_SET_5, _("Keywords set 5"), " ")); |
| 217 |
|
| 218 |
m_namePattern = "m_stc"; |
| 219 |
SetName(GenerateName()); |
| 220 |
} |
| 221 |
|
| 222 |
StyledTextCtrlWrapper::~StyledTextCtrlWrapper() {} |
| 223 |
|
| 224 |
wxcWidget* StyledTextCtrlWrapper::Clone() const { return new StyledTextCtrlWrapper(); } |
| 225 |
|
| 226 |
wxString StyledTextCtrlWrapper::CppCtorCode() const |
| 227 |
{ |
| 228 |
wxString cppCode; |
| 229 |
cppCode << CPPStandardWxCtor("0"); |
| 230 |
|
| 231 |
bool foldMargin = PropertyBool(PROP_STC_MARGIN_FOLD) == "true"; |
| 232 |
bool symbolMargin = PropertyBool(PROP_STC_MARGIN_SYMBOL) == "true"; |
| 233 |
bool lineNumber = PropertyBool(PROP_STC_MARGIN_LINE_NUMBERS) == "true"; |
| 234 |
bool separatorMargin = PropertyBool(PROP_STC_MARGIN_SEPARATOR) == "true"; |
| 235 |
|
| 236 |
// Fold margin |
| 237 |
cppCode << "// Configure the fold margin\n"; |
| 238 |
cppCode << GetName() << "->SetMarginType (4, wxSTC_MARGIN_SYMBOL);\n"; |
| 239 |
cppCode << GetName() << "->SetMarginMask (4, wxSTC_MASK_FOLDERS);\n"; |
| 240 |
cppCode << GetName() << "->SetMarginSensitive(4, true);\n"; |
| 241 |
cppCode << GetName() << "->SetMarginWidth (4, " << (foldMargin ? 16 : 0) << ");\n\n"; |
| 242 |
|
| 243 |
if(foldMargin) { |
| 244 |
cppCode << GetName() << "->SetProperty(" << wxCrafter::WXT("fold") << "," << wxCrafter::WXT("1") << ");\n"; |
| 245 |
cppCode << GetName() << "->MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN);\n"; |
| 246 |
cppCode << GetName() << "->MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_ARROW);\n"; |
| 247 |
cppCode << GetName() << "->MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_BACKGROUND);\n"; |
| 248 |
cppCode << GetName() << "->MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_BACKGROUND);\n"; |
| 249 |
cppCode << GetName() << "->MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_ARROW);\n"; |
| 250 |
cppCode << GetName() << "->MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN);\n"; |
| 251 |
cppCode << GetName() << "->MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_BACKGROUND);\n"; |
| 252 |
} |
| 253 |
|
| 254 |
// Make it size 0 |
| 255 |
|
| 256 |
cppCode << "// Configure the tracker margin\n"; |
| 257 |
cppCode << GetName() << "->SetMarginWidth(1, 0);\n\n"; |
| 258 |
|
| 259 |
// Symbol margin |
| 260 |
cppCode << "// Configure the symbol margin\n"; |
| 261 |
cppCode << GetName() << "->SetMarginType (2, wxSTC_MARGIN_SYMBOL);\n"; |
| 262 |
cppCode << GetName() << "->SetMarginMask (2, ~(wxSTC_MASK_FOLDERS));\n"; |
| 263 |
cppCode << GetName() << "->SetMarginWidth(2, " << (symbolMargin ? 16 : 0) << ");\n"; |
| 264 |
cppCode << GetName() << "->SetMarginSensitive(2, true);\n\n"; |
| 265 |
|
| 266 |
// Line numbers |
| 267 |
cppCode << "// Configure the line numbers margin\n"; |
| 268 |
wxString pixelWidth = GetName() + "_PixelWidth"; |
| 269 |
if(lineNumber) { |
| 270 |
cppCode << "int " << pixelWidth << " = 4 + 5 *" << GetName() |
| 271 |
<< "->TextWidth(wxSTC_STYLE_LINENUMBER, wxT(\"9\"));\n"; |
| 272 |
} |
| 273 |
|
| 274 |
cppCode << GetName() << "->SetMarginType(0, wxSTC_MARGIN_NUMBER);\n"; |
| 275 |
cppCode << GetName() << "->SetMarginWidth(0," << (lineNumber ? pixelWidth : "0") << ");\n\n"; |
| 276 |
|
| 277 |
// separator |
| 278 |
cppCode << "// Configure the line symbol margin\n"; |
| 279 |
cppCode << GetName() << "->SetMarginType(3, wxSTC_MARGIN_FORE);\n"; |
| 280 |
cppCode << GetName() << "->SetMarginMask(3, 0);\n"; |
| 281 |
cppCode << GetName() << "->SetMarginWidth(3," << (separatorMargin ? 1 : 0) << ");\n"; |
| 282 |
|
| 283 |
// Lexer |
| 284 |
cppCode << "// Select the lexer\n"; |
| 285 |
cppCode << GetName() << "->SetLexer(" << PropertyString(PROP_STC_LEXER) << ");\n"; |
| 286 |
|
| 287 |
cppCode << "// Set default font / styles\n"; |
| 288 |
cppCode << GetName() << "->StyleClearAll();\n"; |
| 289 |
wxString font_var = GetName() + "Font"; |
| 290 |
wxString fontCode = wxCrafter::FontToCpp(PropertyString(PROP_FONT), font_var); |
| 291 |
if(fontCode != "wxNullFont") { |
| 292 |
cppCode << "for(int i=0; i<wxSTC_STYLE_MAX; ++i) {\n"; |
| 293 |
cppCode << " " << GetName() << "->StyleSetFont(i, " << font_var << ");\n"; |
| 294 |
cppCode << "}\n"; |
| 295 |
} |
| 296 |
|
| 297 |
// Wrap |
| 298 |
int wrapMode = m_wrapOptions.Index(PropertyString(PROP_STC_WRAP)); |
| 299 |
if(wrapMode != -1) { cppCode << GetName() << "->SetWrapMode(" << wrapMode << ");\n"; } |
| 300 |
|
| 301 |
int indentGuides = m_indentGuides.Index(PropertyString(PROP_STC_INDENT_GUIDES)); |
| 302 |
if(indentGuides != -1) { cppCode << GetName() << "->SetIndentationGuides(" << indentGuides << ");\n"; } |
| 303 |
|
| 304 |
if(PropertyBool(PROP_STC_VIEW_EOL) == "true") { cppCode << GetName() << "->SetViewEOL(true);\n"; } |
| 305 |
|
| 306 |
int eolMode = m_eolMode.Index(PropertyString(PROP_STC_EOL_MODE)); |
| 307 |
if(eolMode != 3) { // 3 is invalid |
| 308 |
cppCode << GetName() << "->SetEOLMode(" << eolMode << ");\n"; |
| 309 |
} |
| 310 |
|
| 311 |
cppCode << GetName() << "->SetKeyWords(0, " << wxCrafter::WXT(PropertyString(PROP_KEYWORDS_SET_1)) << ");\n"; |
| 312 |
cppCode << GetName() << "->SetKeyWords(1, " << wxCrafter::WXT(PropertyString(PROP_KEYWORDS_SET_2)) << ");\n"; |
| 313 |
cppCode << GetName() << "->SetKeyWords(2, " << wxCrafter::WXT(PropertyString(PROP_KEYWORDS_SET_3)) << ");\n"; |
| 314 |
cppCode << GetName() << "->SetKeyWords(3, " << wxCrafter::WXT(PropertyString(PROP_KEYWORDS_SET_4)) << ");\n"; |
| 315 |
cppCode << GetName() << "->SetKeyWords(4, " << wxCrafter::WXT(PropertyString(PROP_KEYWORDS_SET_5)) << ");\n"; |
| 316 |
return cppCode; |
| 317 |
} |
| 318 |
|
| 319 |
void StyledTextCtrlWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add("#include <wx/stc/stc.h>"); } |
| 320 |
|
| 321 |
wxString StyledTextCtrlWrapper::GetWxClassName() const { return "wxStyledTextCtrl"; } |
| 322 |
|
| 323 |
void StyledTextCtrlWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 324 |
{ |
| 325 |
if(type == XRC_LIVE) { |
| 326 |
|
| 327 |
// There is no support for STC in XRC |
| 328 |
text << XRCUnknown(); |
| 329 |
|
| 330 |
} else { |
| 331 |
text << XRCPrefix() << XRCSize() << XRCStyle() << XRCCommonAttributes(); |
| 332 |
|
| 333 |
if(PropertyBool(PROP_STC_MARGIN_FOLD) == "true") { text << "<fold_margin>1</fold_margin>"; } |
| 334 |
|
| 335 |
if(PropertyBool(PROP_STC_MARGIN_SYMBOL) == "true") { text << "<symbol_margin>1</symbol_margin>"; } |
| 336 |
if(PropertyBool(PROP_STC_MARGIN_LINE_NUMBERS) == "true") { |
| 337 |
text << "<linenumbers_margin>1</linenumbers_margin>"; |
| 338 |
} |
| 339 |
if(PropertyBool(PROP_STC_MARGIN_SEPARATOR) == "true") { text << "<separator_margin>1</separator_margin>"; } |
| 340 |
|
| 341 |
int wrapMode = m_wrapOptions.Index(PropertyString(PROP_STC_WRAP)); |
| 342 |
text << "<wrap>" << wrapMode << "</wrap>"; |
| 343 |
|
| 344 |
text << "<indentguides>" << m_indentGuides.Index(PropertyString(PROP_STC_INDENT_GUIDES)) << "</indentguides>"; |
| 345 |
|
| 346 |
if(PropertyBool(PROP_STC_VIEW_EOL) == "true") { text << "<vieweol>1</vieweol>"; } |
| 347 |
|
| 348 |
int eolMode = m_eolMode.Index(PropertyString(PROP_STC_EOL_MODE)); |
| 349 |
if(eolMode != 3) { text << "<eolmode>" << eolMode << "</eolmode>"; } |
| 350 |
|
| 351 |
text << "<lexer>" << PropertyString(PROP_STC_LEXER) << "</lexer>"; |
| 352 |
text << XRCSuffix(); |
| 353 |
} |
| 354 |
} |
| 355 |
|
| 356 |
wxArrayString StyledTextCtrlWrapper::GetLexers() const |
| 357 |
{ |
| 358 |
wxArrayString arr; |
| 359 |
LexersMap_t::const_iterator iter = m_lexers.begin(); |
| 360 |
for(; iter != m_lexers.end(); ++iter) { |
| 361 |
arr.Add(iter->first); |
| 362 |
} |
| 363 |
return arr; |
| 364 |
} |