| 1 |
/* |
| 2 |
* This file is part of wxSmith plugin for Code::Blocks Studio |
| 3 |
* Copyright (C) 2006-2007 Bartlomiej Swiecki |
| 4 |
* |
| 5 |
* wxSmith is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 3 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* wxSmith is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
* |
| 18 |
*/ |
| 19 |
|
| 20 |
#include "wxsScintilla.h" |
| 21 |
|
| 22 |
// TODO: define markers? |
| 23 |
// TODO: figure out the margins |
| 24 |
// left-edge and right-edge margins |
| 25 |
// gutter type, guttter width, 3 gutters |
| 26 |
// TODO: set edge mode, edge color |
| 27 |
// TODO: set zoom |
| 28 |
// TODO: set selection mode |
| 29 |
// TODO: set caret style |
| 30 |
// TODO: set lexer |
| 31 |
|
| 32 |
//------------------------------------------------------------------------------ |
| 33 |
|
| 34 |
namespace |
| 35 |
{ |
| 36 |
|
| 37 |
// Loading images from xpm files |
| 38 |
|
| 39 |
#include "STC16.xpm" |
| 40 |
#include "STC32.xpm" |
| 41 |
|
| 42 |
wxsRegisterItem<wxsScintilla> Reg( |
| 43 |
_T("wxScintilla"), // Class name |
| 44 |
wxsTWidget, // Item type |
| 45 |
_T("wxWindows"), // License |
| 46 |
_T("Ron Collins"), // Author |
| 47 |
_T("[email protected]"), // Author's email |
| 48 |
_T(""), // Item's homepage |
| 49 |
_T("Styled Text"), // Category in palette |
| 50 |
55, // Priority in palette |
| 51 |
_T("STC"), // Base part of names for new items |
| 52 |
wxsCPP, // List of coding languages supported by this item |
| 53 |
1, 0, // Version |
| 54 |
wxBitmap(STC32_xpm), // 32x32 bitmap |
| 55 |
wxBitmap(STC16_xpm), // 16x16 bitmap |
| 56 |
false); // We do not allow this item inside XRC files |
| 57 |
|
| 58 |
|
| 59 |
WXS_ST_BEGIN(wxsScintillaStyles,_T("wxRE_MULTILINE|wxRAISED_BORDER|wxWANTS_CHARS")) |
| 60 |
WXS_ST_CATEGORY("wxScintilla") |
| 61 |
WXS_ST_DEFAULTS() |
| 62 |
WXS_ST_END() |
| 63 |
|
| 64 |
WXS_EV_BEGIN(wxsScintillaEvents) |
| 65 |
WXS_EVI(EVT_SCI_CHANGE, wxEVT_SCI_CHANGE, wxScintillaEventFunction, EvSciChange) |
| 66 |
WXS_EVI(EVT_SCI_STYLENEEDED, wxEVT_SCI_STYLENEEDED, wxScintillaEventFunction, EvSciStyleNeeded) |
| 67 |
WXS_EVI(EVT_SCI_CHARADDED, wxEVT_SCI_CHARADDED, wxScintillaEventFunction, EvSciCharAdded) |
| 68 |
WXS_EVI(EVT_SCI_SAVEPOINTREACHED, wxEVT_SCI_SAVEPOINTREACHED, wxScintillaEventFunction, EvSciSavePointReached) |
| 69 |
WXS_EVI(EVT_SCI_SAVEPOINTLEFT, wxEVT_SCI_SAVEPOINTLEFT, wxScintillaEventFunction, EvSciSavePointLeft) |
| 70 |
WXS_EVI(EVT_SCI_ROMODIFYATTEMPT, wxEVT_SCI_ROMODIFYATTEMPT, wxScintillaEventFunction, EvSciROModifyAttempt) |
| 71 |
WXS_EVI(EVT_SCI_DOUBLECLICK, wxEVT_SCI_DOUBLECLICK, wxScintillaEventFunction, EvSciDoubleClick) |
| 72 |
WXS_EVI(EVT_SCI_UPDATEUI, wxEVT_SCI_UPDATEUI, wxScintillaEventFunction, EvSciUpdateUI) |
| 73 |
WXS_EVI(EVT_SCI_MODIFIED, wxEVT_SCI_MODIFIED, wxScintillaEventFunction, EvSciModified) |
| 74 |
WXS_EVI(EVT_SCI_MACRORECORD, wxEVT_SCI_MACRORECORD, wxScintillaEventFunction, EvSciMacroRecord) |
| 75 |
WXS_EVI(EVT_SCI_MARGINCLICK, wxEVT_SCI_MARGINCLICK, wxScintillaEventFunction, EvSciMarginClick) |
| 76 |
WXS_EVI(EVT_SCI_NEEDSHOWN, wxEVT_SCI_NEEDSHOWN, wxScintillaEventFunction, EvSciNeedShown) |
| 77 |
WXS_EVI(EVT_SCI_PAINTED, wxEVT_SCI_PAINTED, wxScintillaEventFunction, EvSciPainted) |
| 78 |
WXS_EVI(EVT_SCI_USERLISTSELECTION, wxEVT_SCI_USERLISTSELECTION, wxScintillaEventFunction, EvSciUserListSelection) |
| 79 |
WXS_EVI(EVT_SCI_DWELLSTART, wxEVT_SCI_DWELLSTART, wxScintillaEventFunction, EvSciDwellStart) |
| 80 |
WXS_EVI(EVT_SCI_DWELLEND, wxEVT_SCI_DWELLEND, wxScintillaEventFunction, EvSciDwellEnd) |
| 81 |
WXS_EVI(EVT_SCI_START_DRAG, wxEVT_SCI_START_DRAG, wxScintillaEventFunction, EvSciStartDrag) |
| 82 |
WXS_EVI(EVT_SCI_DRAG_OVER, wxEVT_SCI_DRAG_OVER, wxScintillaEventFunction, EvSciDragOver) |
| 83 |
WXS_EVI(EVT_SCI_DO_DROP, wxEVT_SCI_DO_DROP, wxScintillaEventFunction, EvSciDoDrop) |
| 84 |
WXS_EVI(EVT_SCI_ZOOM, wxEVT_SCI_ZOOM, wxScintillaEventFunction, EvSciZoom) |
| 85 |
WXS_EVI(EVT_SCI_HOTSPOT_CLICK, wxEVT_SCI_HOTSPOT_CLICK, wxScintillaEventFunction, EvSciHotSpotClick) |
| 86 |
WXS_EVI(EVT_SCI_HOTSPOT_DCLICK, wxEVT_SCI_HOTSPOT_DCLICK, wxScintillaEventFunction, EvSciHotSpotDClick) |
| 87 |
WXS_EVI(EVT_SCI_CALLTIP_CLICK, wxEVT_SCI_CALLTIP_CLICK, wxScintillaEventFunction, EvSciCallTipClick) |
| 88 |
WXS_EVI(EVT_SCI_AUTOCOMP_SELECTION, wxEVT_SCI_AUTOCOMP_SELECTION, wxScintillaEventFunction, EvSciAutoCompSelection) |
| 89 |
WXS_EVI(EVT_SCI_INDICATOR_CLICK, wxEVT_SCI_INDICATOR_CLICK, wxScintillaEventFunction, EvSciIndicatorClick) |
| 90 |
WXS_EVI(EVT_SCI_INDICATOR_RELEASE, wxEVT_SCI_INDICATOR_RELEASE, wxScintillaEventFunction, EvSciIndicatorRelease) |
| 91 |
WXS_EVI(EVT_SCI_AUTOCOMP_CANCELLED, wxEVT_SCI_AUTOCOMP_CANCELLED, wxScintillaEventFunction, EvSciAutoCompCancelled) |
| 92 |
WXS_EVI(EVT_SCI_AUTOCOMP_CHARDELETED, wxEVT_SCI_AUTOCOMP_CHARDELETED, wxScintillaEventFunction, EvSciAutoCompCharDeleted) |
| 93 |
WXS_EVI(EVT_SCI_SETFOCUS, wxEVT_SCI_SETFOCUS, wxScintillaEventFunction, EvSciSetFocus) |
| 94 |
WXS_EVI(EVT_SCI_KILLFOCUS, wxEVT_SCI_KILLFOCUS, wxScintillaEventFunction, EvSciKillFocus) |
| 95 |
|
| 96 |
// WXS_EV_DEFAULTS() |
| 97 |
WXS_EV_END() |
| 98 |
} |
| 99 |
|
| 100 |
//------------------------------------------------------------------------------ |
| 101 |
|
| 102 |
wxsScintilla::wxsScintilla(wxsItemResData* Data): |
| 103 |
wxsWidget( |
| 104 |
Data, |
| 105 |
&Reg.Info, |
| 106 |
wxsScintillaEvents, |
| 107 |
wxsScintillaStyles) |
| 108 |
{ |
| 109 |
mSize.Set(32, 32); |
| 110 |
mText.Clear(); |
| 111 |
mViewWS = 0; |
| 112 |
mEOL = 2; |
| 113 |
mBuffered = true; |
| 114 |
mTabWidth = 8; |
| 115 |
mCase = 0; |
| 116 |
mBlinkRate = 500; |
| 117 |
mInsert = true; |
| 118 |
mCaretWidth = 2; |
| 119 |
mIndent = 0; |
| 120 |
mReadOnly = false; |
| 121 |
mBSUndent = true; |
| 122 |
mWrapMode = 0; |
| 123 |
mWrapIndent = 0; |
| 124 |
mMarginLeft = 0; |
| 125 |
mMarginRight = 0; |
| 126 |
mGutterType1 = 0; |
| 127 |
mGutterWidth1 = 0; |
| 128 |
mGutterType2 = 0; |
| 129 |
mGutterWidth2 = 0; |
| 130 |
mGutterType3 = 0; |
| 131 |
mGutterWidth3 = 0; |
| 132 |
mZoom = 0; |
| 133 |
mSelMode = 0; |
| 134 |
mCaretStyle = 1; |
| 135 |
mLexer = 0; |
| 136 |
mVirtualSize.IsDefault = true; |
| 137 |
} |
| 138 |
|
| 139 |
//------------------------------------------------------------------------------ |
| 140 |
|
| 141 |
void wxsScintilla::OnBuildCreatingCode() { |
| 142 |
wxString vname; |
| 143 |
wxString aname; |
| 144 |
wxsBaseProperties *bp; |
| 145 |
wxColour fg, bg; |
| 146 |
wxColour kfg, kbg; |
| 147 |
wxColour sfg, sbg; |
| 148 |
wxColour ffg, fbg; |
| 149 |
wxColour ebg; |
| 150 |
wxFont ff; |
| 151 |
wxString ss,tt; |
| 152 |
|
| 153 |
// valid language? |
| 154 |
|
| 155 |
if (GetLanguage() != wxsCPP) wxsCodeMarks::Unknown(_T("wxsScintilla::OnBuildCreatingCode"),GetLanguage()); |
| 156 |
|
| 157 |
// who we are |
| 158 |
|
| 159 |
vname = GetVarName(); |
| 160 |
|
| 161 |
// include files |
| 162 |
|
| 163 |
AddHeader(_("\"wxscintilla.h\""), GetInfo().ClassName, 0); |
| 164 |
|
| 165 |
// make our own size specifier with our default values |
| 166 |
|
| 167 |
mSize.SetDefaults(wxSize(128, 128)); |
| 168 |
ss.Printf(_T("wxSize(%d, %d)"), mSize.GetWidth(), mSize.GetHeight()); |
| 169 |
|
| 170 |
// create the panel |
| 171 |
|
| 172 |
Codef(_T("%C(%W, %I, %P, %s, %T, %N);\n"), ss.c_str()); |
| 173 |
|
| 174 |
// other declarations |
| 175 |
|
| 176 |
BuildSetupWindowCode(); |
| 177 |
|
| 178 |
// a virtual size |
| 179 |
|
| 180 |
if (! mVirtualSize.IsDefault) { |
| 181 |
ss = mVirtualSize.GetSizeCode(GetCoderContext()); |
| 182 |
Codef(_T("%ASetVirtualSize(%s);\n"), ss.c_str()); |
| 183 |
}; |
| 184 |
|
| 185 |
// see the pretty colors |
| 186 |
|
| 187 |
bp = GetBaseProps(); |
| 188 |
fg = bp->m_Fg.GetColour(); |
| 189 |
bg = bp->m_Bg.GetColour(); |
| 190 |
ff = bp->m_Font.BuildFont(); |
| 191 |
kfg = mCaretFG.GetColour(); |
| 192 |
kbg = mCaretBG.GetColour(); |
| 193 |
sfg = mSelFG.GetColour(); |
| 194 |
sbg = mSelBG.GetColour(); |
| 195 |
ffg = mFoldFG.GetColour(); |
| 196 |
fbg = mFoldBG.GetColour(); |
| 197 |
ebg = mEdgeBG.GetColour(); |
| 198 |
|
| 199 |
// basic font and colors |
| 200 |
|
| 201 |
if (ff.IsOk()) { |
| 202 |
ss = vname + _T("Font"); |
| 203 |
Codef(_T("%AStyleSetFont(wxSCI_STYLE_DEFAULT, %s);\n"), ss.c_str()); |
| 204 |
Codef(_T("%AStyleSetFont(0, %s);\n"), ss.c_str()); |
| 205 |
}; |
| 206 |
|
| 207 |
if (fg.Ok()) { |
| 208 |
Codef(_T("%AStyleSetForeground(wxSCI_STYLE_DEFAULT, wxColour(%d, %d, %d));\n"), fg.Red(), fg.Green(), fg.Blue()); |
| 209 |
Codef(_T("%AStyleSetForeground(0, wxColour(%d, %d, %d));\n"), fg.Red(), fg.Green(), fg.Blue()); |
| 210 |
}; |
| 211 |
|
| 212 |
if (bg.Ok()) { |
| 213 |
Codef(_T("%AStyleSetBackground(wxSCI_STYLE_DEFAULT, wxColour(%d, %d, %d));\n"), bg.Red(), bg.Green(), bg.Blue()); |
| 214 |
Codef(_T("%AStyleSetBackground(0, wxColour(%d, %d, %d));\n"), bg.Red(), bg.Green(), bg.Blue()); |
| 215 |
Codef(_T("%ASetWhitespaceBackground(true, wxColour(%d, %d, %d));\n"), bg.Red(), bg.Green(), bg.Blue()); |
| 216 |
}; |
| 217 |
|
| 218 |
// then user-selected options |
| 219 |
|
| 220 |
Codef(_T("%ASetCaretStyle(%d);\n"), mCaretStyle); |
| 221 |
Codef(_T("%ASetCaretPeriod(%d);\n"), mBlinkRate); |
| 222 |
Codef(_T("%ASetCaretWidth(%d);\n"), mCaretWidth); |
| 223 |
|
| 224 |
if (kfg.Ok()) { |
| 225 |
Codef(_T("%ASetCaretForeground(wxColour(%d, %d, %d));\n"), kfg.Red(), kfg.Green(), kfg.Blue()); |
| 226 |
}; |
| 227 |
|
| 228 |
if (kbg.Ok()) { |
| 229 |
Codef(_T("%ASetCaretLineVisible(true);\n")); |
| 230 |
Codef(_T("%ASetCaretLineBackground(wxColour(%d, %d, %d));\n"), kbg.Red(), kbg.Green(), kbg.Blue()); |
| 231 |
}; |
| 232 |
|
| 233 |
Codef(_T("%ASetSelectionMode(%d);\n"), mSelMode); |
| 234 |
|
| 235 |
if (sfg.Ok()) { |
| 236 |
Codef(_T("%ASetSelForeground(true, wxColour(%d, %d, %d));\n"), sfg.Red(), sfg.Green(), sfg.Blue()); |
| 237 |
}; |
| 238 |
|
| 239 |
if (sbg.Ok()) { |
| 240 |
Codef(_T("%ASetSelBackground(true, wxColour(%d, %d, %d));\n"), sbg.Red(), sbg.Green(), sbg.Blue()); |
| 241 |
}; |
| 242 |
|
| 243 |
|
| 244 |
Codef(_T("%ASetMargins(%d, %d);\n"), mMarginLeft, mMarginRight); |
| 245 |
|
| 246 |
Codef(_T("%ASetMarginWidth(1, %d);\n"), mGutterWidth1); |
| 247 |
Codef(_T("%ASetMarginType(1, %d);\n"), mGutterType1); |
| 248 |
Codef(_T("%ASetMarginWidth(2, %d);\n"), mGutterWidth2); |
| 249 |
Codef(_T("%ASetMarginType(2, %d);\n"), mGutterType2); |
| 250 |
Codef(_T("%ASetMarginWidth(3, %d);\n"), mGutterWidth3); |
| 251 |
Codef(_T("%ASetMarginType(3, %d);\n"), mGutterType3); |
| 252 |
|
| 253 |
Codef(_T("%ASetViewWhiteSpace(%d);\n"), mViewWS); |
| 254 |
Codef(_T("%ASetEOLMode(%d);\n"), mEOL); |
| 255 |
Codef(_T("%ASetTabWidth(%d);\n"), mTabWidth); |
| 256 |
|
| 257 |
Codef(_T("%AStyleSetCase(wxSCI_STYLE_DEFAULT, %d);\n"), mCase); |
| 258 |
Codef(_T("%AStyleSetCase(0, %d);\n"), mCase); |
| 259 |
|
| 260 |
Codef(_T("%ASetIndent(%d);\n"), mIndent); |
| 261 |
Codef(_T("%ASetBackSpaceUnIndents(%b);\n"), mBSUndent); |
| 262 |
Codef(_T("%ASetWrapMode(%d);\n"), mWrapMode); |
| 263 |
Codef(_T("%ASetWrapIndentMode(%d);\n"), mWrapIndent); |
| 264 |
|
| 265 |
Codef(_T("%ASetBufferedDraw(%b);\n"), mBuffered); |
| 266 |
Codef(_T("%ASetZoom(%d);\n"), mZoom); |
| 267 |
|
| 268 |
/** |
| 269 |
if (ffg.Ok()) { |
| 270 |
Codef(_T("%ASetFoldMarginHiColour(true, wxColour(%d, %d, %d));\n"), ffg.Red(), ffg.Green(), ffg.Blue()); |
| 271 |
}; |
| 272 |
|
| 273 |
if (fbg.Ok()) { |
| 274 |
Codef(_T("%ASetFoldMarginColour(true, wxColour(%d, %d, %d));\n"), fbg.Red(), fbg.Green(), fbg.Blue()); |
| 275 |
}; |
| 276 |
**/ |
| 277 |
|
| 278 |
/** |
| 279 |
Codef(_T("%ASetEdgeMode(%d);\n"), mEdgeMode); |
| 280 |
if (ebg.Ok()) { |
| 281 |
Codef(_T("%ASetEdgeColour(wxColour(%d, %d, %d));\n"), ebg.Red(), ebg.Green(), ebg.Blue()); |
| 282 |
}; |
| 283 |
**/ |
| 284 |
|
| 285 |
// initial text |
| 286 |
|
| 287 |
for(size_t i=0; i<mText.GetCount(); i++) { |
| 288 |
ss = mText.Item(i); |
| 289 |
ss += _T("\n"); |
| 290 |
Codef(_T("%AAppendText(%t);\n"), ss.c_str()); |
| 291 |
}; |
| 292 |
|
| 293 |
// finish with insert mode and read-only flag |
| 294 |
|
| 295 |
Codef(_T("%ASetOvertype(%b);\n"), !mInsert); |
| 296 |
Codef(_T("%ASetReadOnly(%b);\n"), mReadOnly); |
| 297 |
} |
| 298 |
|
| 299 |
//------------------------------------------------------------------------------ |
| 300 |
|
| 301 |
wxObject* wxsScintilla::OnBuildPreview(wxWindow* Parent, long Flags) { |
| 302 |
wxScintilla *stc; |
| 303 |
wxsBaseProperties *bp; |
| 304 |
wxColour fg, bg; |
| 305 |
wxColour kfg, kbg; |
| 306 |
wxColour sfg, sbg; |
| 307 |
wxColour ffg, fbg; |
| 308 |
wxColour ebg; |
| 309 |
wxFont ff; |
| 310 |
wxString ss; |
| 311 |
wxSize zz; |
| 312 |
|
| 313 |
// the default size of this widget is microscopic |
| 314 |
// use this to make a reasonable default size |
| 315 |
|
| 316 |
mSize = Size(Parent); |
| 317 |
mSize.SetDefaults(wxSize(128, 128)); |
| 318 |
|
| 319 |
// make the basic widget |
| 320 |
|
| 321 |
stc = new wxScintilla(Parent, GetId(), Pos(Parent), mSize, Style()); |
| 322 |
|
| 323 |
// the rest of the attributtes |
| 324 |
|
| 325 |
SetupWindow(stc, Flags); |
| 326 |
|
| 327 |
// a virtual size |
| 328 |
|
| 329 |
if (! mVirtualSize.IsDefault) { |
| 330 |
zz = mVirtualSize.GetSize(Parent); |
| 331 |
stc->SetVirtualSize(zz); |
| 332 |
}; |
| 333 |
|
| 334 |
// get all the pretty colors |
| 335 |
|
| 336 |
bp = GetBaseProps(); |
| 337 |
fg = bp->m_Fg.GetColour(); |
| 338 |
bg = bp->m_Bg.GetColour(); |
| 339 |
ff = bp->m_Font.BuildFont(); |
| 340 |
kfg = mCaretFG.GetColour(); |
| 341 |
kbg = mCaretBG.GetColour(); |
| 342 |
sfg = mSelFG.GetColour(); |
| 343 |
sbg = mSelBG.GetColour(); |
| 344 |
ffg = mFoldFG.GetColour(); |
| 345 |
fbg = mFoldBG.GetColour(); |
| 346 |
ebg = mEdgeBG.GetColour(); |
| 347 |
|
| 348 |
// basic font, foreground, and background |
| 349 |
|
| 350 |
if (ff.IsOk()) { |
| 351 |
stc->StyleSetFont(wxSCI_STYLE_DEFAULT, ff); |
| 352 |
stc->StyleSetFont(0, ff); |
| 353 |
}; |
| 354 |
|
| 355 |
if (fg.Ok()) { |
| 356 |
stc->StyleSetForeground(wxSCI_STYLE_DEFAULT, fg); |
| 357 |
stc->StyleSetForeground(0, fg); |
| 358 |
}; |
| 359 |
|
| 360 |
if (bg.Ok()) { |
| 361 |
stc->StyleSetBackground(wxSCI_STYLE_DEFAULT, bg); |
| 362 |
stc->StyleSetBackground(0, bg); |
| 363 |
stc->SetWhitespaceBackground(true, bg); |
| 364 |
}; |
| 365 |
|
| 366 |
// fill in the other user-defined attributes |
| 367 |
|
| 368 |
stc->SetCaretStyle(mCaretStyle); |
| 369 |
stc->SetCaretPeriod(mBlinkRate); |
| 370 |
stc->SetCaretWidth(mCaretWidth); |
| 371 |
if (kfg.Ok()) { |
| 372 |
stc->SetCaretForeground(kfg); |
| 373 |
}; |
| 374 |
|
| 375 |
if (kbg.Ok()) { |
| 376 |
stc->SetCaretLineVisible(true); |
| 377 |
stc->SetCaretLineBackground(kbg); |
| 378 |
}; |
| 379 |
|
| 380 |
stc->SetSelectionMode(mSelMode); |
| 381 |
|
| 382 |
|
| 383 |
if (sfg.Ok()) { |
| 384 |
stc->SetSelForeground(true, sfg); |
| 385 |
}; |
| 386 |
|
| 387 |
if (sbg.Ok()) { |
| 388 |
stc->SetSelBackground(true, sbg); |
| 389 |
}; |
| 390 |
|
| 391 |
stc->SetMargins(mMarginLeft, mMarginRight); |
| 392 |
|
| 393 |
stc->SetMarginWidth(1, mGutterWidth1); |
| 394 |
stc->SetMarginType(1, mGutterType1); |
| 395 |
stc->SetMarginWidth(2, mGutterWidth2); |
| 396 |
stc->SetMarginType(2, mGutterType2); |
| 397 |
stc->SetMarginWidth(3, mGutterWidth3); |
| 398 |
stc->SetMarginType(3, mGutterType3); |
| 399 |
|
| 400 |
stc->SetViewWhiteSpace(mViewWS); |
| 401 |
stc->SetEOLMode(mEOL); |
| 402 |
stc->SetTabWidth(mTabWidth); |
| 403 |
|
| 404 |
stc->StyleSetCase(wxSCI_STYLE_DEFAULT, mCase); |
| 405 |
stc->StyleSetCase(0, mCase); |
| 406 |
|
| 407 |
stc->SetIndent(mIndent); |
| 408 |
stc->SetBackSpaceUnIndents(mBSUndent); |
| 409 |
stc->SetWrapMode(mWrapMode); |
| 410 |
stc->SetWrapIndentMode(mWrapIndent); |
| 411 |
|
| 412 |
stc->SetBufferedDraw(mBuffered); |
| 413 |
stc->SetZoom(mZoom); |
| 414 |
|
| 415 |
/** |
| 416 |
if (ffg.Ok()) { |
| 417 |
stc->SetFoldMarginHiColour(true, ffg); |
| 418 |
}; |
| 419 |
|
| 420 |
if (fbg.Ok()) { |
| 421 |
stc->SetFoldMarginColour(true, fbg); |
| 422 |
}; |
| 423 |
**/ |
| 424 |
|
| 425 |
/** |
| 426 |
stc->SetEdgeMode(mEdgeMode); |
| 427 |
if (ebg.Ok()) { |
| 428 |
stc->SetEdgeColour(ebg); |
| 429 |
}; |
| 430 |
**/ |
| 431 |
|
| 432 |
// add in initial text |
| 433 |
|
| 434 |
for(size_t i=0; i<mText.GetCount(); i++) { |
| 435 |
ss = mText.Item(i); |
| 436 |
ss += _T("\n"); |
| 437 |
stc->AppendText(ss); |
| 438 |
}; |
| 439 |
|
| 440 |
// and finally insert or read-only |
| 441 |
|
| 442 |
stc->SetOvertype(!mInsert); |
| 443 |
stc->SetReadOnly(mReadOnly); |
| 444 |
|
| 445 |
// done |
| 446 |
|
| 447 |
return stc; |
| 448 |
} |
| 449 |
|
| 450 |
//------------------------------------------------------------------------------ |
| 451 |
|
| 452 |
void wxsScintilla::OnEnumWidgetProperties(long Flags) { |
| 453 |
static const long ViewWS_Values[] = { 0, 1, 2, 0}; |
| 454 |
static const wxChar* ViewWS_Names[] = {_T("Invisible"), _T("Always Visible"), _T("Visible After Indent"), 0}; |
| 455 |
|
| 456 |
static const long EOL_Values[] = { 0, 1, 2, 0}; |
| 457 |
static const wxChar* EOL_Names[] = {_T("CRLF"), _T("CR"), _T("LF"), 0}; |
| 458 |
|
| 459 |
static const long Case_Values[] = { 0, 1, 2, 0}; |
| 460 |
static const wxChar* Case_Names[] = {_T("Mixed Case"), _T("All Upper Case"), _T("All Lower Case"), 0}; |
| 461 |
|
| 462 |
static const long Wrap_Values[] = { 0, 1, 2, 0}; |
| 463 |
static const wxChar* Wrap_Names[] = {_T("No Wrap"), _T("Word Wrap"), _T("Character Wrap"), 0}; |
| 464 |
|
| 465 |
static const long WrapInd_Values[] = { 0, 1, 2, 0}; |
| 466 |
static const wxChar* WrapInd_Names[] = {_T("Fixed"), _T("Same"), _T("Indent"), 0}; |
| 467 |
|
| 468 |
static const long Gutter_Values[] = { 0, 1, 2, 3, 4, 5, 6, 0}; |
| 469 |
static const wxChar* Gutter_Names[] = {_T("Symbol"), _T("Number"), _T("Back"), _T("Fore"), _T("Text"), _T("RText"), _T("Changed"), 0}; |
| 470 |
|
| 471 |
static const long Edge_Values[] = { 0, 1, 2, 0}; |
| 472 |
static const wxChar* Edge_Names[] = {_T("None"), _T("Line"), _T("Background Colour"), 0}; |
| 473 |
|
| 474 |
static const long Select_Values[] = { 0, 1, 2, 3, 0}; |
| 475 |
static const wxChar* Select_Names[] = {_T("Stream"), _T("Rectangle"), _T("Lines"), _T("Thin"), 0}; |
| 476 |
|
| 477 |
static const long Caret_Values[] = { 0, 1, 2, 0}; |
| 478 |
static const wxChar* Caret_Names[] = {_T("Invisible"), _T("Line"), _T("Block"), 0}; |
| 479 |
|
| 480 |
static const long Lex_Values[] = { |
| 481 |
wxSCI_LEX_CONTAINER, wxSCI_LEX_NULL, wxSCI_LEX_PYTHON, wxSCI_LEX_CPP, wxSCI_LEX_HTML, |
| 482 |
wxSCI_LEX_XML, wxSCI_LEX_PERL, wxSCI_LEX_SQL, wxSCI_LEX_VB, wxSCI_LEX_PROPERTIES, |
| 483 |
wxSCI_LEX_ERRORLIST, wxSCI_LEX_MAKEFILE, wxSCI_LEX_BATCH, wxSCI_LEX_XCODE, wxSCI_LEX_LATEX, |
| 484 |
wxSCI_LEX_LUA, wxSCI_LEX_DIFF, wxSCI_LEX_CONF, wxSCI_LEX_PASCAL, wxSCI_LEX_AVE, |
| 485 |
wxSCI_LEX_ADA, wxSCI_LEX_LISP, wxSCI_LEX_RUBY, wxSCI_LEX_EIFFEL, wxSCI_LEX_EIFFELKW, |
| 486 |
wxSCI_LEX_TCL, wxSCI_LEX_NNCRONTAB, wxSCI_LEX_BULLANT, wxSCI_LEX_VBSCRIPT, wxSCI_LEX_BAAN, |
| 487 |
wxSCI_LEX_MATLAB, wxSCI_LEX_SCRIPTOL, wxSCI_LEX_ASM, wxSCI_LEX_CPPNOCASE, wxSCI_LEX_FORTRAN, |
| 488 |
wxSCI_LEX_F77, wxSCI_LEX_CSS, wxSCI_LEX_POV, wxSCI_LEX_LOUT, wxSCI_LEX_ESCRIPT, |
| 489 |
wxSCI_LEX_PS, wxSCI_LEX_NSIS, wxSCI_LEX_MMIXAL, wxSCI_LEX_CLW, wxSCI_LEX_CLWNOCASE, |
| 490 |
wxSCI_LEX_LOT, wxSCI_LEX_YAML, wxSCI_LEX_TEX, wxSCI_LEX_METAPOST, wxSCI_LEX_POWERBASIC, |
| 491 |
wxSCI_LEX_FORTH, wxSCI_LEX_ERLANG, wxSCI_LEX_OCTAVE, wxSCI_LEX_MSSQL, wxSCI_LEX_VERILOG, |
| 492 |
wxSCI_LEX_KIX, wxSCI_LEX_GUI4CLI, wxSCI_LEX_SPECMAN, wxSCI_LEX_AU3, wxSCI_LEX_APDL, |
| 493 |
wxSCI_LEX_BASH, wxSCI_LEX_ASN1, wxSCI_LEX_VHDL, wxSCI_LEX_CAML, wxSCI_LEX_BLITZBASIC, |
| 494 |
wxSCI_LEX_PUREBASIC, wxSCI_LEX_HASKELL, wxSCI_LEX_PHPSCRIPT, wxSCI_LEX_TADS3, wxSCI_LEX_REBOL, |
| 495 |
wxSCI_LEX_SMALLTALK, wxSCI_LEX_FLAGSHIP, wxSCI_LEX_CSOUND, wxSCI_LEX_FREEBASIC, wxSCI_LEX_INNOSETUP, |
| 496 |
wxSCI_LEX_OPAL, wxSCI_LEX_SPICE, wxSCI_LEX_D, wxSCI_LEX_CMAKE, wxSCI_LEX_GAP, |
| 497 |
wxSCI_LEX_PLM, wxSCI_LEX_PROGRESS, wxSCI_LEX_ABAQUS, wxSCI_LEX_ASYMPTOTE, wxSCI_LEX_R, |
| 498 |
wxSCI_LEX_MAGIK, wxSCI_LEX_POWERSHELL, wxSCI_LEX_MYSQL, wxSCI_LEX_PO, wxSCI_LEX_TAL, |
| 499 |
wxSCI_LEX_COBOL, wxSCI_LEX_TACL, wxSCI_LEX_SORCUS, wxSCI_LEX_POWERPRO, wxSCI_LEX_NIMROD, |
| 500 |
wxSCI_LEX_SML, wxSCI_LEX_MARKDOWN, |
| 501 |
0}; |
| 502 |
|
| 503 |
static const wxChar* Lex_Names[] = { |
| 504 |
_T("CONTAINER"), _T("NULL"), _T("PYTHON"), _T("CPP"), _T("HTML"), |
| 505 |
_T("XML"), _T("PERL"), _T("SQL"), _T("VB"), _T("PROPERTIES"), |
| 506 |
_T("ERRORLIST"), _T("MAKEFILE"), _T("BATCH"), _T("XCODE"), _T("LATEX"), |
| 507 |
_T("LUA"), _T("DIFF"), _T("CONF"), _T("PASCAL"), _T("AVE"), |
| 508 |
_T("ADA"), _T("LISP"), _T("RUBY"), _T("EIFFEL"), _T("EIFFELKW"), |
| 509 |
_T("TCL"), _T("NNCRONTAB"), _T("BULLANT"), _T("VBSCRIPT"), _T("BAAN"), |
| 510 |
_T("MATLAB"), _T("SCRIPTOL"), _T("ASM"), _T("CPPNOCASE"), _T("FORTRAN"), |
| 511 |
_T("F77"), _T("CSS"), _T("POV"), _T("LOUT"), _T("ESCRIPT"), |
| 512 |
_T("PS"), _T("NSIS"), _T("MMIXAL"), _T("CLW"), _T("CLWNOCASE"), |
| 513 |
_T("LOT"), _T("YAML"), _T("TEX"), _T("METAPOST"), _T("POWERBASIC"), |
| 514 |
_T("FORTH"), _T("ERLANG"), _T("OCTAVE"), _T("MSSQL"), _T("VERILOG"), |
| 515 |
_T("KIX"), _T("GUI4CLI"), _T("SPECMAN"), _T("AU3"), _T("APDL"), |
| 516 |
_T("BASH"), _T("ASN1"), _T("VHDL"), _T("CAML"), _T("BLITZBASIC"), |
| 517 |
_T("PUREBASIC"), _T("HASKELL"), _T("PHPSCRIPT"), _T("TADS3"), _T("REBOL"), |
| 518 |
_T("SMALLTALK"), _T("FLAGSHIP"), _T("CSOUND"), _T("FREEBASIC"), _T("INNOSETUP"), |
| 519 |
_T("OPAL"), _T("SPICE"), _T("D"), _T("CMAKE"), _T("GAP"), |
| 520 |
_T("PLM"), _T("PROGRESS"), _T("ABAQUS"), _T("ASYMPTOTE"), _T("R"), |
| 521 |
_T("MAGIK"), _T("POWERSHELL"), _T("MYSQL"), _T("PO"), _T("TAL"), |
| 522 |
_T("COBOL"), _T("TACL"), _T("SORCUS"), _T("POWERPRO"), _T("NIMROD"), |
| 523 |
_T("SML"), _T("MARKDOWN"), |
| 524 |
0}; |
| 525 |
|
| 526 |
// initial text contents |
| 527 |
|
| 528 |
WXS_ARRAYSTRING(wxsScintilla, mText, _T("Text"), _T("mText"), _("text")); |
| 529 |
WXS_BOOL( wxsScintilla, mInsert, _T("Insert Mode"), _T("mInsert"), true); |
| 530 |
WXS_BOOL( wxsScintilla, mReadOnly, _T("Read Only?"), _T("mReadOnly"), false); |
| 531 |
|
| 532 |
WXS_ENUM( wxsScintilla, mCaretStyle, _T("Caret Style"), _T("mCaretStyle"), Caret_Values, Caret_Names, 1); |
| 533 |
WXS_LONG( wxsScintilla, mBlinkRate, _T("Caret Blink Rate"), _T("mBlinkRate"), 500); |
| 534 |
WXS_LONG( wxsScintilla, mCaretWidth, _T("Width of Insert Caret"), _T("mCaretWidth"), 2); |
| 535 |
WXS_COLOUR( wxsScintilla, mCaretFG, _T("Caret Colour"), _T("mCaretFG")); |
| 536 |
WXS_COLOUR( wxsScintilla, mCaretBG, _T("Caret Line Colour"), _T("mCaretBG")); |
| 537 |
WXS_ENUM( wxsScintilla, mSelMode, _T("Selection Mode"), _T("mSelMode"), Select_Values, Select_Names, 0); |
| 538 |
WXS_COLOUR( wxsScintilla, mSelFG, _T("Selection Foreground"), _T("mSelFG")); |
| 539 |
WXS_COLOUR( wxsScintilla, mSelBG, _T("Selection Background"), _T("mSelBG")); |
| 540 |
|
| 541 |
WXS_LONG( wxsScintilla, mMarginLeft, _T("Left Margin Edge"), _T("mMarginLeft"), 0); |
| 542 |
WXS_LONG( wxsScintilla, mMarginRight, _T("Right Margin Edge"), _T("mMarginRight"), 0); |
| 543 |
|
| 544 |
WXS_ENUM( wxsScintilla, mGutterType1, _T("Gutter Type (1)"), _T("mGutterType1"), Gutter_Values, Gutter_Names, 0); |
| 545 |
WXS_LONG( wxsScintilla, mGutterWidth1, _T("Gutter Width (1)"), _T("mGutterWidth1"), 0); |
| 546 |
WXS_ENUM( wxsScintilla, mGutterType2, _T("Gutter Type (2)"), _T("mGutterType2"), Gutter_Values, Gutter_Names, 0); |
| 547 |
WXS_LONG( wxsScintilla, mGutterWidth2, _T("Gutter Width (2)"), _T("mGutterWidth2"), 0); |
| 548 |
WXS_ENUM( wxsScintilla, mGutterType3, _T("Gutter Type (3)"), _T("mGutterType3"), Gutter_Values, Gutter_Names, 0); |
| 549 |
WXS_LONG( wxsScintilla, mGutterWidth3, _T("Gutter Width (3)"), _T("mGutterWidth3"), 0); |
| 550 |
|
| 551 |
WXS_ENUM( wxsScintilla, mViewWS, _T("View WhiteS-Space"), _T("mViewWS"), ViewWS_Values, ViewWS_Names, 0); |
| 552 |
WXS_ENUM( wxsScintilla, mEOL, _T("End-Of-Line Mode"), _T("mEOL"), EOL_Values, EOL_Names, 2); |
| 553 |
WXS_LONG( wxsScintilla, mTabWidth, _T("Tab Width"), _T("mTabWidth"), 8); |
| 554 |
WXS_ENUM( wxsScintilla, mCase, _T("Letter Case"), _T("mCase"), Case_Values, Case_Names, 0); |
| 555 |
WXS_LONG( wxsScintilla, mIndent, _T("Indent Size"), _T("mIndent"), 0); |
| 556 |
WXS_BOOL( wxsScintilla, mBSUndent, _T("Backspace Un-Indents?"), _T("mBSUndent"), true); |
| 557 |
WXS_ENUM( wxsScintilla, mWrapMode, _T("Wrap Mode"), _T("mWrapMode"), Wrap_Values, Wrap_Names, 0); |
| 558 |
WXS_ENUM( wxsScintilla, mWrapIndent, _T("Wrap Indent Mode"), _T("mWrapIndent"), WrapInd_Values, WrapInd_Names, 0); |
| 559 |
|
| 560 |
WXS_BOOL( wxsScintilla, mBuffered, _T("Buffered Drawing?"), _T("mBuffered"), true); |
| 561 |
WXS_LONG( wxsScintilla, mZoom, _T("Zoom Factor"), _T("mZoom"), 0); |
| 562 |
|
| 563 |
WXS_SIZE( wxsScintilla, mVirtualSize, _T("Default Virtual Size?"), _T("Virtual Width"), _T("Virtual Height"), _T("Use Dialog Units?"), _T("mVirtualSize")); |
| 564 |
/** |
| 565 |
WXS_ENUM( wxsScintilla, mEdgeMode, _T("Edge Display Mode"), _T("mEdgeMode"), Edge_Values, Edge_Names, 0); |
| 566 |
WXS_COLOUR( wxsScintilla, mEdgeBG, _T("Edge Display Background"), _T("mEdgeBG")); |
| 567 |
**/ |
| 568 |
/** |
| 569 |
WXS_ENUM( wxsScintilla, mLexer, _T("Lexer"), _T("mLexer"), Lex_Values, Lex_Names, 1); |
| 570 |
WXS_ARRAYSTRING(wxsScintilla, mKeywords1, _T("Keywords Set 1"), _T("mKeywords1"), _("")); |
| 571 |
WXS_ARRAYSTRING(wxsScintilla, mKeywords2, _T("Keywords Set 2"), _T("mKeywords2"), _("")); |
| 572 |
**/ |
| 573 |
/** |
| 574 |
WXS_COLOUR( wxsScintilla, mFoldFG, _T("Fold-Margin Foreground"), _T("mFoldFG")); |
| 575 |
WXS_COLOUR( wxsScintilla, mFoldBG, _T("Fold-Margin Background"), _T("mFoldBG")); |
| 576 |
**/ |
| 577 |
}; |