⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qsteeditor.h

📁 porting scintilla to qt
💻 H
字号:
/* this file is the entry of scintilla of Qt4 Porting  * QSteEditor == QTextEditor * each QSteEditor have a QSteGlobalProper  * and one QSteLexProper and one QSteKeyBind QSteAbbrev * accept(QSteGlobalProper) * accept(QSteLexProper) * accept(QSteKeyBind) * accept(QSteAbbrev) * version 0.1 */#ifndef _qsteditor_h_#define _qsteditor_h_#include <qobject.h>#include <qstringlist.h>#include <QByteArray>#include <QPointer>#include <QString>#include <qprinter.h>#include <qpainter.h>#include <qstack.h>#include "Platform.h"#include "constants.h"#include "qstescintillabase.h"#include "qsteproper.h"class _QSTE_DLL_ QSteEditor : public QSteScintillaBase{	Q_OBJECTpublic:	//construct	QSteEditor(QWidget *parent = 0);	//destructor	virtual ~QSteEditor();	// with QSteGlobalProper QSteLexProper QSteAbbrevProper	void accept(QSteGlobalProper *proper);	void accept(QSteLexProper *proper);	void accept(QSteAbbrevProper *abb_);	QSteLexProper *getLexerProper(){return m_lexer;}	QSteGlobalProper *getGlobalProper(){return m_global;}	void setGlobalProper();	void setLexProper();	void setIndentSetting();	//normal routines	SString wordCharacters;	int getTextLength();	QString convertTextToQString(char *str);	int getLineLength(int line);	bool isModified();	int getCurrLineNum();	virtual void clear();	virtual void deleteText();	virtual void selectAll();	SString getRange(int start,int end);	void getRange(int start,int end,char *text);	inline char getCharacter(int pos,char def = ' '){		if (pos <= 0)			return def;		char ch = sendMsgToSci(SCI_GETCHARAT, pos);		if(pos > sendMsgToSci(SCI_GETTEXTLENGTH))				return def;	    // Don't go past the end of the previous line.    	if (ch == '\n' || ch == '\r'){	        ++pos;    	    return def;		}		return ch;	};	CharacterRange getSelection();	void setSelection(int anchor, int currentpos);	StyleAndWords getStyleAndWords(const char *base);	unsigned int getLinePartsInStyle(int line, int style1, int style2, SString sv[], int len);	bool rangeIsAllWhitespace(int start, int end);	void ensureRangeVisible(int posStart,int posEnd,bool enforcePolicy = true);	void fowardProperties();	bool isUtf8();	void setUtf8(bool cp);	//save & load	virtual void setText(const QString &text);	virtual bool loadFile(const QString &filename);	void setFileName(QString filename);	const QString getFileName() const;	virtual bool saveFile(const QString filename);	QString getText();	QString getText(int linenum);	void getText(char *text,int sizeText,int line = -1);	int getCurrentLinenum();	int getCaretInLine();	//undo redo	void beginUndo();	void endUndo(); 	virtual void undo();	virtual void redo();	bool canUndo();	bool canRedo();	//copy & paste & cut & dup	virtual void copy();	virtual void cut();	virtual void paste();	//insert/remove tab	virtual void insertTab();	virtual void removeTab();	//match brace	bool m_bracesCheck;	bool m_bracesSloppy;	int m_bracesStyle;	int m_braceCount;	void braceMatch();	bool findMatchingBracePosition(int &braceAtCaret,int &braceOpposite,bool sloppy);	bool gotoBraceMatch();	void selectBraceMatch();	//calltip 	//auto complete	enum autoCompleteType{		acFromNone = 1 << 0,		acFromCurrentDoc = 1 << 1,		acFromKeyWords = 1 << 2,		acFromProject = 1 << 3,		acFromAPI = 1 << 4,		acFromOpened = 1 << 5,	};	int m_acType;	bool m_acIgnoreCase;	bool m_acOnlyOne;	void setIgnoreCase(bool case_){m_acIgnoreCase = case_;}	bool getIgnoreCase(){return m_acIgnoreCase;}	int getAutocompleteType(){return m_acType;}	void setAutoCompleteTypeZero(){m_acType = acFromNone;}	void setAutoCompleteType(autoCompleteType type){ m_acType |= type;}	void startAutoComplete(); 	//indent	int m_statementLookBack;	bool m_indentMaintain;	bool m_autoIndent;	bool m_indentOpening;	bool m_indentClosing;	StyleAndWords m_statementIndent;	StyleAndWords m_statementEnd;	StyleAndWords m_blockStart;	StyleAndWords m_blockEnd;	void setAutoIndent(bool indent){m_autoIndent = indent;}	bool getAutoIndent(){return m_autoIndent;}	void maintainIndent(char ch);	void automaticIndentation(char ch);	int getLineIndentation(int line);	int getLineIndentPosition(int line);	void setLineIndentation(int line, int indent);	int indentOfBlock(int line);	IndentationStatus getIndentState(int line);	//color	bool m_allowAlpha;	//comment	void boxComment();	void blockComment();	void streamComment();	//folding	int m_foldMarginWidth;	void makeFoldSymbol();	void foldAll();	void ensureAllChildrenVisible(int line,int level);	void toggleFoldRecursive(int line,int level);	void showFoldMargin(bool show);	void defineMarker(int marker, int markerType, ColourDesired fore, ColourDesired back);	void expand(int &line, bool doExpand, bool force = false,int visLevels = 0, int level = -1);	//margin & linenum	bool m_foldMargin;	int m_lineNumWidth;	int m_marginWidth;	void showLineNum(bool show);	void showMargin(bool show);	//find & search & replace	int doFind(const char *str,int len = -1,int startpos = -1 ,int endpos = -1);	int doReplace(const char *str);	//bookmark	//whitespace & eol	void setEolMod(int mode = SC_EOL_CRLF);	//advanced search	//encoding	//printing	void filePrint(QPrinter *printer);	void filePrintPreview(QPrinter *printer);	void filePrintPdf(const char *filename);	void selectionPrint();	//setting	//globalproper	//lexproper	//abbrev	void insertAbbreviation();	void expandAbbreviation();	//keybind	//wrap mode	int m_warpmode;	void setWrapMode(int mode = SC_WRAP_NONE);public slots:	void handleAddChar(char ch);	void handleUpdateUi();	void handleMarginClick(int position,int modifiers,int margin); private:	QString m_filename;	QSteGlobalProper *m_global;	int m_globalShowDegree;	QSteLexProper *m_lexer;	int m_lexerShowDegree;	QSteAbbrevProper *m_abbrev;	int m_abbrevShowDegree;	void setOneStyle(int style,const QSteStyleDefinition &sd);	void setStyleFor(const char *lang);	QWidget *m_parent;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -