📄 wxscintilla.cpp
字号:
int wxScintilla::GetEndStyled() {
return SendMsg (SCI_GETENDSTYLED, 0, 0);
}
// Convert all line endings in the document to one mode.
void wxScintilla::ConvertEOLs (int eolMode) {
SendMsg (SCI_CONVERTEOLS, eolMode, 0);
}
// Retrieve the current end of line mode - one of CRLF, CR, or LF.
int wxScintilla::GetEOLMode() {
return SendMsg (SCI_GETEOLMODE, 0, 0);
}
// Set the current end of line mode.
void wxScintilla::SetEOLMode (int eolMode) {
SendMsg (SCI_SETEOLMODE, eolMode, 0);
}
// Set the current styling position to pos and the styling mask to mask.
// The styling mask can be used to protect some bits in each styling byte from modification.
void wxScintilla::StartStyling (int pos, int mask) {
SendMsg (SCI_STARTSTYLING, pos, mask);
}
// Change style from current styling position for length characters to a style
// and move the current styling position to after this newly styled segment.
void wxScintilla::SetStyling (int length, int style) {
SendMsg (SCI_SETSTYLING, length, style);
}
// Is drawing done first into a buffer or direct to the screen?
bool wxScintilla::GetBufferedDraw() {
return SendMsg (SCI_GETBUFFEREDDRAW, 0, 0) != 0;
}
// If drawing is buffered then each line of text is drawn into a bitmap buffer
// before drawing it to the screen to avoid flicker.
void wxScintilla::SetBufferedDraw (bool buffered) {
SendMsg (SCI_SETBUFFEREDDRAW, buffered, 0);
}
// Change the visible size of a tab to be a multiple of the width of a space character.
void wxScintilla::SetTabWidth (int tabWidth) {
SendMsg (SCI_SETTABWIDTH, tabWidth, 0);
}
// Retrieve the visible size of a tab.
int wxScintilla::GetTabWidth() {
return SendMsg (SCI_GETTABWIDTH, 0, 0);
}
// Set the code page used to interpret the bytes of the document as characters.
void wxScintilla::SetCodePage (int codePage) {
#if wxUSE_UNICODE
wxASSERT_MSG (codePage == wxSCI_CP_UTF8,
_T("Only wxSCI_CP_UTF8 may be used when wxUSE_UNICODE is on."));
#else
wxASSERT_MSG (codePage != wxSCI_CP_UTF8,
_T("wxSCI_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
#endif
SendMsg(SCI_SETCODEPAGE, codePage);
}
// Set use palette (SCI_SETUSEPALETTE) not supported
// Set the symbol used for a particular marker number,
// and optionally the fore and background colours.
void wxScintilla::MarkerDefine (int markerNumber, int markerSymbol) {
SendMsg (SCI_MARKERDEFINE, markerNumber, markerSymbol);
}
// Set the foreground colour used for a particular marker number.
void wxScintilla::MarkerSetForeground (int markerNumber, const wxColour& fore) {
SendMsg (SCI_MARKERSETFORE, markerNumber, wxColourAsLong(fore));
}
// Set the background colour used for a particular marker number.
void wxScintilla::MarkerSetBackground (int markerNumber, const wxColour& back) {
SendMsg (SCI_MARKERSETBACK, markerNumber, wxColourAsLong(back));
}
// Add a marker to a line, returning an ID which can be used to find or delete the marker.
int wxScintilla::MarkerAdd (int line, int markerNumber) {
return SendMsg (SCI_MARKERADD, line, markerNumber);
}
// Delete a marker from a line.
void wxScintilla::MarkerDelete (int line, int markerNumber) {
SendMsg (SCI_MARKERDELETE, line, markerNumber);
}
// Delete all markers with a particular number from all lines.
void wxScintilla::MarkerDeleteAll (int markerNumber) {
SendMsg (SCI_MARKERDELETEALL, markerNumber, 0);
}
// Get a bit mask of all the markers set on a line.
int wxScintilla::MarkerGet (int line) {
return SendMsg (SCI_MARKERGET, line, 0);
}
// Find the next line after lineStart that includes a marker in mask.
int wxScintilla::MarkerNext (int lineStart, int markerMask) {
return SendMsg (SCI_MARKERNEXT, lineStart, markerMask);
}
// Find the previous line before lineStart that includes a marker in mask.
int wxScintilla::MarkerPrevious (int lineStart, int markerMask) {
return SendMsg (SCI_MARKERPREVIOUS, lineStart, markerMask);
}
// Define a marker from a bitmap
void wxScintilla::MarkerDefineBitmap (int markerNumber, const wxBitmap& bmp) {
// convert bmp to a xpm in a string
wxMemoryOutputStream strm;
wxImage img = bmp.ConvertToImage();
#if wxCHECK_VERSION(2, 5, 0)
if (img.HasAlpha()) img.ConvertAlphaToMask();
#endif
img.SaveFile(strm, wxBITMAP_TYPE_XPM);
size_t len = strm.GetSize();
char* buff = new char[len+1];
strm.CopyTo(buff, len);
buff[len] = 0;
SendMsg (SCI_MARKERDEFINEPIXMAP, markerNumber, (long)buff);
delete [] buff;
}
// Set a margin to be either numeric or symbolic.
void wxScintilla::SetMarginType (int margin, int marginType) {
SendMsg (SCI_SETMARGINTYPEN, margin, marginType);
}
// Retrieve the type of a margin.
int wxScintilla::GetMarginType (int margin) {
return SendMsg (SCI_GETMARGINTYPEN, margin, 0);
}
// Set the width of a margin to a width expressed in pixels.
void wxScintilla::SetMarginWidth (int margin, int pixels) {
SendMsg (SCI_SETMARGINWIDTHN, margin, pixels);
}
// Retrieve the width of a margin in pixels.
int wxScintilla::GetMarginWidth (int margin) {
return SendMsg (SCI_GETMARGINWIDTHN, margin, 0);
}
// Set a mask that determines which markers are displayed in a margin.
void wxScintilla::SetMarginMask (int margin, int mask) {
SendMsg (SCI_SETMARGINMASKN, margin, mask);
}
// Retrieve the marker mask of a margin.
int wxScintilla::GetMarginMask (int margin) {
return SendMsg (SCI_GETMARGINMASKN, margin, 0);
}
// Make a margin sensitive or insensitive to mouse clicks.
void wxScintilla::SetMarginSensitive (int margin, bool sensitive) {
SendMsg (SCI_SETMARGINSENSITIVEN, margin, sensitive);
}
// Retrieve the mouse click sensitivity of a margin.
bool wxScintilla::GetMarginSensitive (int margin) {
return SendMsg (SCI_GETMARGINSENSITIVEN, margin, 0) != 0;
}
// Clear all the styles and make equivalent to the global default style.
void wxScintilla::StyleClearAll() {
SendMsg (SCI_STYLECLEARALL, 0, 0);
}
// Set the foreground colour of a style.
void wxScintilla::StyleSetForeground (int style, const wxColour& fore) {
SendMsg (SCI_STYLESETFORE, style, wxColourAsLong(fore));
}
// Set the background colour of a style.
void wxScintilla::StyleSetBackground (int style, const wxColour& back) {
SendMsg (SCI_STYLESETBACK, style, wxColourAsLong(back));
}
// Set a style to be bold or not.
void wxScintilla::StyleSetBold (int style, bool bold) {
SendMsg (SCI_STYLESETBOLD, style, bold);
}
// Set a style to be italic or not.
void wxScintilla::StyleSetItalic (int style, bool italic) {
SendMsg (SCI_STYLESETITALIC, style, italic);
}
// Set the size of characters of a style.
void wxScintilla::StyleSetSize (int style, int sizePoints) {
SendMsg (SCI_STYLESETSIZE, style, sizePoints);
}
// Set the font of a style.
void wxScintilla::StyleSetFaceName (int style, const wxString& fontName) {
SendMsg (SCI_STYLESETFONT, style, (long)(const char*)wx2sci(fontName));
}
// Set a style to have its end of line filled or not.
void wxScintilla::StyleSetEOLFilled (int style, bool filled) {
SendMsg (SCI_STYLESETEOLFILLED, style, filled);
}
// Reset the default style to its state at startup
void wxScintilla::StyleResetDefault() {
SendMsg (SCI_STYLERESETDEFAULT, 0, 0);
}
// Set a style to be underlined or not.
void wxScintilla::StyleSetUnderline (int style, bool underline) {
SendMsg (SCI_STYLESETUNDERLINE, style, underline);
}
// Set a style to be mixed case, or to force upper or lower case.
void wxScintilla::StyleSetCase (int style, int caseMode) {
SendMsg (SCI_STYLESETCASE, style, caseMode);
}
// Set a style to be a hotspot or not.
void wxScintilla::StyleSetHotSpot (int style, bool hotspot) {
SendMsg (SCI_STYLESETHOTSPOT, style, hotspot);
}
// Set the foreground colour of the selection and whether to use this setting.
void wxScintilla::SetSelForeground (bool useSetting, const wxColour& fore) {
SendMsg (SCI_SETSELFORE, useSetting, wxColourAsLong(fore));
}
// Set the background colour of the selection and whether to use this setting.
void wxScintilla::SetSelBackground (bool useSetting, const wxColour& back) {
SendMsg (SCI_SETSELBACK, useSetting, wxColourAsLong(back));
}
// Set the foreground colour of the caret.
void wxScintilla::SetCaretForeground (const wxColour& fore) {
SendMsg (SCI_SETCARETFORE, wxColourAsLong(fore), 0);
}
// When key+modifier combination km is pressed perform msg.
void wxScintilla::CmdKeyAssign (int key, int modifiers, int cmd) {
SendMsg (SCI_ASSIGNCMDKEY, MAKELONG(key, modifiers), cmd);
}
// When key+modifier combination km is pressed do nothing.
void wxScintilla::CmdKeyClear (int key, int modifiers) {
SendMsg (SCI_CLEARCMDKEY, MAKELONG(key, modifiers));
}
// Drop all key mappings.
void wxScintilla::CmdKeyClearAll() {
SendMsg (SCI_CLEARALLCMDKEYS, 0, 0);
}
// Set the styles for a segment of the document.
void wxScintilla::SetStyleBytes (int length, char* styleBytes) {
SendMsg (SCI_SETSTYLINGEX, length, (long)styleBytes);
}
// Set a style to be visible or not.
void wxScintilla::StyleSetVisible (int style, bool visible) {
SendMsg (SCI_STYLESETVISIBLE, style, visible);
}
// Get the time in milliseconds that the caret is on and off.
int wxScintilla::GetCaretPeriod() {
return SendMsg (SCI_GETCARETPERIOD, 0, 0);
}
// Get the time in milliseconds that the caret is on and off. 0 = steady on.
void wxScintilla::SetCaretPeriod (int milliseconds) {
SendMsg (SCI_SETCARETPERIOD, milliseconds, 0);
}
// Set the set of characters making up words for when moving or selecting by word.
// First sets deaults like SetCharsDefault.
void wxScintilla::SetWordChars (const wxString& characters) {
SendMsg (SCI_SETWORDCHARS, 0, (long)(const char*)wx2sci(characters));
}
// Start a sequence of actions that is undone and redone as a unit.
// May be nested.
void wxScintilla::BeginUndoAction() {
SendMsg (SCI_BEGINUNDOACTION, 0, 0);
}
// End a sequence of actions that is undone and redone as a unit.
void wxScintilla::EndUndoAction() {
SendMsg (SCI_ENDUNDOACTION, 0, 0);
}
// Set an indicator to plain, squiggle or TT.
void wxScintilla::IndicatorSetStyle (int indic, int style) {
SendMsg (SCI_INDICSETSTYLE, indic, style);
}
// Retrieve the style of an indicator.
int wxScintilla::IndicatorGetStyle (int indic) {
return SendMsg (SCI_INDICGETSTYLE, indic, 0);
}
// Set the foreground colour of an indicator.
void wxScintilla::IndicatorSetForeground (int indic, const wxColour& fore) {
SendMsg (SCI_INDICSETFORE, indic, wxColourAsLong(fore));
}
// Retrieve the foreground colour of an indicator.
wxColour wxScintilla::IndicatorGetForeground (int indic) {
long colour = SendMsg (SCI_INDICGETFORE, indic, 0);
return wxColourFromLong(colour);
}
// Set the foreground colour of all whitespace and whether to use this setting.
void wxScintilla::SetWhitespaceForeground (bool useSetting, const wxColour& fore) {
SendMsg (SCI_SETWHITESPACEFORE, useSetting, wxColourAsLong(fore));
}
// Set the background colour of all whitespace and whether to use this setting.
void wxScintilla::SetWhitespaceBackground (bool useSetting, const wxColour& back) {
SendMsg (SCI_SETWHITESPACEBACK, useSetting, wxColourAsLong(back));
}
// Divide each styling byte into lexical class bits (default: 5) and indicator
// bits (default: 3). If a lexer requires more than 32 lexical states, then this
// is used to expand the possible states.
void wxScintilla::SetStyleBits (int bits) {
SendMsg (SCI_SETSTYLEBITS, bits, 0);
}
// Retrieve number of bits in style bytes used to hold the lexical state.
int wxScintilla::GetStyleBits() {
return SendMsg (SCI_GETSTYLEBITS, 0, 0);
}
// Used to hold extra styling information for each line.
void wxScintilla::SetLineState (int line, int state) {
SendMsg (SCI_SETLINESTATE, line, state);
}
// Retrieve the extra styling information for a line.
int wxScintilla::GetLineState (int line) {
return SendMsg (SCI_GETLINESTATE, line, 0);
}
// Retrieve the last line number that has line state.
int wxScintilla::GetMaxLineState() {
return SendMsg (SCI_GETMAXLINESTATE, 0, 0);
}
// Is the background of the line containing the caret in a different colour?
bool wxScintilla::GetCaretLineVisible() {
return SendMsg (SCI_GETCARETLINEVISIBLE, 0, 0) != 0;
}
// Display the background of the line containing the caret in a different colour.
void wxScintilla::SetCaretLineVisible (bool show) {
SendMsg (SCI_SETCARETLINEVISIBLE, show, 0);
}
// Get the colour of the background of the line containing the caret.
wxColour wxScintilla::GetCaretLineBackground() {
long colour = SendMsg (SCI_GETCARETLINEBACK, 0, 0);
return wxColourFromLong (colour);
}
// Set the colour of the background of the line containing the caret.
void wxScintilla::SetCaretLineBackground (const wxColour& back) {
SendMsg (SCI_SETCARETLINEBACK, wxColourAsLong(back), 0);
}
// Set a style to be changeable or not (read only).
// Experimental feature, currently buggy.
void wxScintilla::StyleSetChangeable (int style, bool changeable) {
SendMsg (SCI_STYLESETCHANGEABLE, style, changeable);
}
// Display a auto-completion list.
// The lenEntered parameter indicates how many characters before
// the caret should be used to provide context.
void wxScintilla::AutoCompShow (int lenEntered, const wxString& itemList) {
SendMsg (SCI_AUTOCSHOW, lenEntered, (long)(const char*)wx2sci(itemList));
}
// Remove the auto-completion list from the screen.
void wxScintilla::AutoCompCancel() {
SendMsg (SCI_AUTOCCANCEL, 0, 0);
}
// Is there an auto-completion list visible?
bool wxScintilla::AutoCompActive() {
return SendMsg (SCI_AUTOCACTIVE, 0, 0) != 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -