📄 vtexted.h
字号:
int lineGoto(long cnt); // move cursor to line cnt int lineOpen(long cnt); // open new blank line int formatC(long count); // misc int autoIndent(); int BalMatch(long val); // find matching paren void CenterScreen(); int wordRight(long cnt); void scrollDown(long delta); int getSelection(char* sel, int max); void setSelection(int howmuch); int EditCut(); int EditCopy(); int EditPaste(); int Find(char* pat, int caseSensitive = 0, int Down = 1, int Wrap = 0); int FindNext(int caseSensitive = 0, int Down = 1, int Wrap = 0); int Replace(const char* pat, const char* repl, int caseSensitive = 0, int Down = 1, int Wrap = 0, int Confirm = 0, int replaceAll = 0); int undoEdit(void); void bufferBottom(void); // move to bottom of file void newscr(void); void ClearMarkRange(void); int RemoveMarkRange(bool doUndo = true); int insertToRange(char* atFront, char* atEnd); void addToRange(long rows, long cols); // add to mark range void highLightCurLine(); virtual int defaultKeyIn(vKey key, unsigned int shift); virtual void TextMouseDown(int row, int col, int button); virtual void TextMouseUp(int row, int col, int button); virtual void TextMouseMove(int row, int col, int button); int mint(int v1, int v2); int maxt(int v1, int v2); long minl(long v1,long v2); long maxl(long v1, long v2); int clower(int ch); int cupper(int ch); protected: //--------------------------------------- protected virtual void initBuff(); // create buffers virtual BUFFPTR GLine(long lineNum); virtual int GCh(BUFFPTR charNum) VCONST { return *(charNum); } virtual BUFFPTR deleteCharBF(BUFFPTR charNum, long lineNum); virtual long deleteLinesBF(long start, long end); virtual int insertCharBF(int chr, BUFFPTR& curchr, long& curlin); virtual int lineLenBF(long lineNum); virtual long lastLineBF() VCONST { return _nextLine - 1; } // last line in buff // Scrolling virtual void HPage(int, int); virtual void VPage(int, int); virtual void HScroll(int); virtual void VScroll(int); // Events virtual void FontChanged(VCONST vFont& newFont); virtual void ResizeText(const int rows, const int cols); virtual void Redraw(int x, int y, int width , int height); // utilities for formatC int has_key(char *buff_ptr, char *key); int is_key_word(char *bf, int case_def); long get_prev(char *prev_buff, long start); // misc methods int SelectionLen(); // get len of marked range void AddToRangeRow(long cnt); // add to mark range void AddToRangeCol(int col); // add to mark range int CopySelection(char* buff, int max, int unmark); void setHighlight(ChrAttr hl) {_highlighter = hl;} ChrAttr getHighlight() {return _highlighter;} virtual void paintLine(char* linout, int lineStart, int hiStart, int hiLast, long lineNum); vCmdWindow* _parent; edState state; // state stuff for outside static globalState gState; static int findCaseSensitive; static char theFindPat[MAX_LINE + 2]; // one static find pattern static char theReplPat[MAX_LINE + 2]; // one static repl pattern static int findDown; static int findWrap; static int replaceConfirm; static int replaceAll; private: //--------------------------------------- private int IsEndLine(int chr) VCONST { return (chr == '\n' || chr == '\r'); } void tvhdln(void); void setScrollBar(); void checkIfScrolled(); void FindDispLine(long& ibeg, int& cnt); int CombineLines(void); int findX(void); int line_can_fit(long l); int Fill1(int dir, int val); void range(long cnt,long *lbeg, long *lend); void updateScroll(long change); void updateNoScroll(long change); void getCurLineFront(char* buff, long start); bool isSpecial(char* curline); BUFFPTR lastBX(long line); void newScrollScreen(long ibeg); bool SaveKillLine(long cnt, bool partialLine = false); void tvtyln(long lineNum,BUFFPTR chrptr, int whole_line); int IsWordChar(int chr); void update(long change); void MouseMoveTo(int row, int col); int reallocLines(); void retypeCurlin(int eraseLine=0); void undoOn(const char* msg); void undoOff(const char* msg); // Screen manip void tvxy(int ix, int iy); void tvplin(long lineNum, BUFFPTR chrptr, int whole_line, int hibeg, int hiend); void type_lines(long ibeg, int icnt, int wholeLine = 0); void tvbotb(int n); void tvclr(void); void tvelin(void); void tvescr(void); void tvtopb(int n); // Utils int col_pos(BUFFPTR chr_pos, int do_shift = 0 ); BUFFPTR appendToBuff(char* line); // Operating state - type of scrolling, etc. // variables ------------------------------------------- int ddline, // default display line dsplin, // the default display line last_col_out, // last column output leftmg, // left margin of display linptr, // used to build output lines mouseCol, // where mouse is (on down) mouseRow, mouseMoveCol, mouseMoveRow, oldcol, // beginning column for dwncol oldlen, // length for '=' command setCursor, // if need to reset cursor after resize tvdlin, // the "active" display line tvx, // current x cursor position tvy, // current y cursor position use_wild, // use wild cards in match wasColCmd, // if last command was a column xoutcm; // used for 240 col virtual screen long b_lastln, // last line for JUMP curlin, // pointer to current line noteloc[26], // note locations 0-25 (or a-z) lastLine, // last line in file scroll_lin; // for scrolling commands BUFFPTR curchr, // pointer to current character scroll_chr; // for scroll commands MARK_RANGE mark; // marked portion of this BUFFPTR* _lines; long _nextLine; // index into line array long _curLineBF; // current line for getXLine long _maxLines; // size of line array ChrAttr _highlighter; // UnDo stuff char* undoBuff; // one line of unkill int undoCurcol; // column of current character long undoCurlin; bool undoPartialLine; // if a partial line saved bool undoKillLast; // objects used by editor vTextEdCmdInterp* _teCInt; vTEConfirm* myConfirm; }; class V_EXPORT vTextEdCmdInterp // easy class to override { public: vTextEdCmdInterp(VCONST vTextEditor* textEd, VCONST vCmdWindow* cw); virtual ~vTextEdCmdInterp(); virtual int ProcessKey(vKey key, unsigned int shift); virtual vTextEditor* te() VCONST { return _textEd; } virtual vCmdWindow* cmdWin() VCONST { return _myCmdWindow; } virtual void InitCmdInterp(); virtual void CmdInterpHelp(); virtual void MouseJump(int row, int col) { /* no-op by default */ } protected: long cmdCount; // how many times to repeat command int countWait, // if building a count metaChar, // the meta char for commands metaWait; // if waiting on a meta command private: vTextEditor* _textEd; vCmdWindow* _myCmdWindow; };#endif/* ************************************************************************ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -