📄 wxscintilla.cpp
字号:
mbuf.UngetWriteBuf(len); mbuf.AppendByte(0); return sci2wx(buf);}// Draw the selection in normal style or with selection highlighted.void wxScintilla::HideSelection (bool hide) { SendMsg (SCI_HIDESELECTION, hide, 0);}// Retrieve the point in the window where a position is displayed.wxPoint wxScintilla::PointFromPosition (int pos) { int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos); int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos); return wxPoint (x, y);}// Retrieve the line containing a position.int wxScintilla::LineFromPosition (int pos) { return SendMsg (SCI_LINEFROMPOSITION, pos, 0);}// Retrieve the position at the start of a line.int wxScintilla::PositionFromLine (int line) { return SendMsg (SCI_POSITIONFROMLINE, line, 0);}// Scroll horizontally and vertically.void wxScintilla::LineScroll (int columns, int lines) { SendMsg (SCI_LINESCROLL, columns, lines);}// Ensure the caret is visible.void wxScintilla::EnsureCaretVisible() { SendMsg (SCI_SCROLLCARET, 0, 0);}// Replace the selected text with the argument text.void wxScintilla::ReplaceSelection (const wxString& text) { SendMsg (SCI_REPLACESEL, 0, (long)(const char*)wx2sci(text));}// Set to read only or read write.void wxScintilla::SetReadOnly (bool readOnly) { SendMsg (SCI_SETREADONLY, readOnly, 0);}// Will a paste succeed?bool wxScintilla::CanPaste() { return SendMsg (SCI_CANPASTE, 0, 0) != 0;}// Are there any undoable actions in the undo history?bool wxScintilla::CanUndo() { return SendMsg (SCI_CANUNDO, 0, 0) != 0;}// Delete the undo history.void wxScintilla::EmptyUndoBuffer() { SendMsg (SCI_EMPTYUNDOBUFFER, 0, 0);}// Undo one action in the undo history.void wxScintilla::Undo() { SendMsg (SCI_UNDO, 0, 0);}// Cut the selection to the clipboard.void wxScintilla::Cut() { SendMsg (SCI_CUT, 0, 0);}// Copy the selection to the clipboard.void wxScintilla::Copy() { SendMsg (SCI_COPY, 0, 0);}// Paste the contents of the clipboard into the document replacing the selection.void wxScintilla::Paste() { SendMsg (SCI_PASTE, 0, 0);}// Clear the selection.void wxScintilla::Clear() { SendMsg (SCI_CLEAR, 0, 0);}// Replace the contents of the document with the argument text.void wxScintilla::SetText (const wxString& text) { SendMsg(SCI_SETTEXT, 0, (long)(const char*)wx2sci(text));}// Retrieve all the text in the document.wxString wxScintilla::GetText() { int len = GetTextLength(); wxMemoryBuffer mbuf(len+1); // leave room for the null... char* buf = (char*)mbuf.GetWriteBuf(len+1); SendMsg (SCI_GETTEXT, len+1, (long)buf); mbuf.UngetWriteBuf(len); mbuf.AppendByte(0); return sci2wx(buf);}// Retrieve the number of characters in the document.int wxScintilla::GetTextLength() { return SendMsg (SCI_GETTEXTLENGTH, 0, 0);}// Set to overtype (true) or insert mode.void wxScintilla::SetOvertype (bool overtype) { SendMsg (SCI_SETOVERTYPE, overtype, 0);}// Returns true if overtype mode is active otherwise false is returned.bool wxScintilla::GetOvertype() { return SendMsg (SCI_GETOVERTYPE, 0, 0) != 0;}// Set the width of the insert mode caret.void wxScintilla::SetCaretWidth (int pixels) { SendMsg (SCI_SETCARETWIDTH, pixels, 0);}// Returns the width of the insert mode caret.int wxScintilla::GetCaretWidth() { return SendMsg (SCI_GETCARETWIDTH, 0, 0);}// Sets the position that starts the target which is used for updating the// document without affecting the scroll position.void wxScintilla::SetTargetStart (int pos) { SendMsg (SCI_SETTARGETSTART, pos, 0);}// Get the position that starts the target.int wxScintilla::GetTargetStart() { return SendMsg (SCI_GETTARGETSTART, 0, 0);}// Sets the position that ends the target which is used for updating the// document without affecting the scroll position.void wxScintilla::SetTargetEnd (int pos) { SendMsg (SCI_SETTARGETEND, pos, 0);}// Get the position that ends the target.int wxScintilla::GetTargetEnd() { return SendMsg (SCI_GETTARGETEND, 0, 0);}// Replace the target text with the argument text.// Text is counted so it can contain NULs.// Returns the length of the replacement text.int wxScintilla::ReplaceTarget (const wxString& text) { wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text); return SendMsg (SCI_REPLACETARGET, strlen(buf), (long)(const char*)buf);}// Replace the target text with the argument text after \d processing.// Text is counted so it can contain NULs.// Looks for \d where d is between 1 and 9 and replaces these with the strings// matched in the last search operation which were surrounded by \( and \).// Returns the length of the replacement text including any change// caused by processing the \d patterns.int wxScintilla::ReplaceTargetRE (const wxString& text) { wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text); return SendMsg (SCI_REPLACETARGETRE, strlen(buf), (long)(const char*)buf);}// Search for a counted string in the target and set the target to the found// range. Text is counted so it can contain NULs.// Returns length of range or -1 for failure in which case target is not moved.int wxScintilla::SearchInTarget (const wxString& text) { wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text); return SendMsg (SCI_SEARCHINTARGET, strlen(buf), (long)(const char*)buf);}// Set the search flags used by SearchInTarget.void wxScintilla::SetSearchFlags (int flags) { SendMsg (SCI_SETSEARCHFLAGS, flags, 0);}// Get the search flags used by SearchInTarget.int wxScintilla::GetSearchFlags() { return SendMsg (SCI_GETSEARCHFLAGS, 0, 0);}// Show a call tip containing a definition near position pos.void wxScintilla::CallTipShow (int pos, const wxString& definition) { SendMsg (SCI_CALLTIPSHOW, pos, (long)(const char*)wx2sci(definition));}// Remove the call tip from the screen.void wxScintilla::CallTipCancel() { SendMsg (SCI_CALLTIPCANCEL, 0, 0);}// Is there an active call tip?bool wxScintilla::CallTipActive() { return SendMsg (SCI_CALLTIPACTIVE, 0, 0) != 0;}// Retrieve the position where the caret was before displaying the call tip.int wxScintilla::CallTipPosAtStart() { return SendMsg (SCI_CALLTIPPOSSTART, 0, 0);}// Highlight a segment of the definition.void wxScintilla::CallTipSetHighlight (int startPos, int endPos) { SendMsg (SCI_CALLTIPSETHLT, startPos, endPos);}// Set the background colour for the call tip.void wxScintilla::CallTipSetBackground (const wxColour& back) { SendMsg (SCI_CALLTIPSETBACK, wxColourAsLong(back), 0);}// Set the foreground colour for the call tip.void wxScintilla::CallTipSetForeground (const wxColour& fore) { SendMsg (SCI_CALLTIPSETFORE, wxColourAsLong(fore), 0);}// Set the foreground colour for the highlighted part of the call tip.void wxScintilla::CallTipSetForegroundHighlight (const wxColour& fore) { SendMsg (SCI_CALLTIPSETFOREHLT, wxColourAsLong(fore), 0);}// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.void wxScintilla::CallTipUseStyle (int tabSize) { SendMsg (SCI_CALLTIPUSESTYLE, tabSize, 0);}// Find the display line of a document line taking hidden lines into account.int wxScintilla::VisibleFromDocLine (int line) { return SendMsg (SCI_VISIBLEFROMDOCLINE, line, 0);}// Find the document line of a display line taking hidden lines into account.int wxScintilla::DocLineFromVisible (int lineDisplay) { return SendMsg (SCI_DOCLINEFROMVISIBLE, lineDisplay, 0);}// The number of display lines needed to wrap a document lineint wxScintilla::WrapCount (int line) { return SendMsg (SCI_WRAPCOUNT, line, 0);}// Set the fold level of a line.// This encodes an integer level along with flags indicating whether the// line is a header and whether it is effectively white space.void wxScintilla::SetFoldLevel (int line, int level) { SendMsg (SCI_SETFOLDLEVEL, line, level);}// Retrieve the fold level of a line.int wxScintilla::GetFoldLevel (int line) { return SendMsg (SCI_GETFOLDLEVEL, line, 0);}// Find the last child line of a header line.int wxScintilla::GetLastChild (int line, int level) { return SendMsg (SCI_GETLASTCHILD, line, level);}// Find the parent line of a child line.int wxScintilla::GetFoldParent (int line) { return SendMsg (SCI_GETFOLDPARENT, line, 0);}// Make a range of lines visible.void wxScintilla::ShowLines (int lineStart, int lineEnd) { SendMsg (SCI_SHOWLINES, lineStart, lineEnd);}// Make a range of lines invisible.void wxScintilla::HideLines (int lineStart, int lineEnd) { SendMsg (SCI_HIDELINES, lineStart, lineEnd);}// Is a line visible?bool wxScintilla::GetLineVisible (int line) { return SendMsg (SCI_GETLINEVISIBLE, line, 0) != 0;}// Show the children of a header line.void wxScintilla::SetFoldExpanded (int line, bool expanded) { SendMsg (SCI_SETFOLDEXPANDED, line, expanded);}// Is a header line expanded?bool wxScintilla::GetFoldExpanded (int line) { return SendMsg (SCI_GETFOLDEXPANDED, line, 0) != 0;}// Switch a header line between expanded and contracted.void wxScintilla::ToggleFold (int line) { SendMsg (SCI_TOGGLEFOLD, line, 0);}// Ensure a particular line is visible by expanding any header line hiding it.void wxScintilla::EnsureVisible (int line) { SendMsg (SCI_ENSUREVISIBLE, line, 0);}// Set some style options for folding.void wxScintilla::SetFoldFlags (int flags) { SendMsg(SCI_SETFOLDFLAGS, flags, 0);}// Ensure a particular line is visible by expanding any header line hiding it.// Use the currently set visibility policy to determine which range to display.void wxScintilla::EnsureVisibleEnforcePolicy (int line) { SendMsg (SCI_ENSUREVISIBLEENFORCEPOLICY, line, 0);}// Sets whether a tab pressed when caret is within indentation indents.void wxScintilla::SetTabIndents (bool tabIndents) { SendMsg (SCI_SETTABINDENTS, tabIndents, 0);}// Does a tab pressed when caret is within indentation indent?bool wxScintilla::GetTabIndents() { return SendMsg (SCI_GETTABINDENTS, 0, 0) != 0;}// Sets whether a backspace pressed when caret is within indentation unindents.void wxScintilla::SetBackSpaceUnIndents (bool bsUnIndents) { SendMsg (SCI_SETBACKSPACEUNINDENTS, bsUnIndents, 0);}// Does a backspace pressed when caret is within indentation unindent?bool wxScintilla::GetBackSpaceUnIndents() { return SendMsg (SCI_GETBACKSPACEUNINDENTS, 0, 0) != 0;}// Sets the time the mouse must sit still to generate a mouse dwell event.void wxScintilla::SetMouseDwellTime (int periodMilliseconds) { SendMsg (SCI_SETMOUSEDWELLTIME, periodMilliseconds, 0);}// Retrieve the time the mouse must sit still to generate a mouse dwell event.int wxScintilla::GetMouseDwellTime() { return SendMsg (SCI_GETMOUSEDWELLTIME, 0, 0);}// Get position of start of word.int wxScintilla::WordStartPosition (int pos, bool onlyWordCharacters) { return SendMsg (SCI_WORDSTARTPOSITION, pos, onlyWordCharacters);}// Get position of end of word.int wxScintilla::WordEndPosition (int pos, bool onlyWordCharacters) { return SendMsg (SCI_WORDENDPOSITION, pos, onlyWordCharacters);}// Sets whether text is word wrapped.void wxScintilla::SetWrapMode (int mode) { SendMsg (SCI_SETWRAPMODE, mode, 0);}// Retrieve whether text is word wrapped.int wxScintilla::GetWrapMode() { return SendMsg (SCI_GETWRAPMODE, 0, 0);}// Set the display mode of visual flags for wrapped lines.void wxScintilla::SetWrapVisualFlags (int wrapVisualFlags) { SendMsg (SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0);}// Retrive the display mode of visual flags for wrapped lines.int wxScintilla::GetWrapVisualFlags() { return SendMsg (SCI_GETWRAPVISUALFLAGS, 0, 0);}// Set the location of visual flags for wrapped lines.void wxScintilla::SetWrapVisualFlagsLocation (int wrapVisualFlagsLocation) { SendMsg (SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0);}// Retrive the location of visual flags for wrapped lines.int wxScintilla::GetWrapVisualFlagsLocation() { return SendMsg (SCI_GETWRAPVISUALFLAGSLOCATION, 0, 0);}// Set the start indent for wrapped lines.void wxScintilla::SetWrapStartIndent (int indent) { SendMsg (SCI_SETWRAPSTARTINDENT, indent, 0);}// Retrive the start indent for wrapped lines.int wxScintilla::GetWrapStartIndent() { return SendMsg (SCI_GETWRAPSTARTINDENT, 0, 0);}// Sets the degree of caching of layout information.void wxScintilla::SetLayoutCache (int mode) { SendMsg (SCI_SETLAYOUTCACHE, mode, 0);}// Retrieve the degree of caching of layout information.int wxScintilla::GetLayoutCache() { return SendMsg (SCI_GETLAYOUTCACHE, 0, 0);}// Sets the document width assumed for scrolling.void wxScintilla::SetScrollWidth (int pixels) { SendMsg (SCI_SETSCROLLWIDTH, pixels, 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -