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

📄 scintillaeditview.h.svn-base

📁 Notepad++ is a generic source code editor (it tries to be anyway) and Notepad replacement written in
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
	void gotoLine(int line){
		if (line < execute(SCI_GETLINECOUNT))
			execute(SCI_GOTOLINE,line);
	};

	long getCurrentColumnNumber() const {
        return long(execute(SCI_GETCOLUMN, execute(SCI_GETCURRENTPOS)));
    };

	long getSelectedByteNumber() const {
		long start = long(execute(SCI_GETSELECTIONSTART));
		long end = long(execute(SCI_GETSELECTIONEND));
		return (start < end)?end-start:start-end;
    };

	long getLineLength(int line) const {
		return long(execute(SCI_GETLINEENDPOSITION, line) - execute(SCI_POSITIONFROMLINE, line));
	};

	long getLineIndent(int line) const {
		return long(execute(SCI_GETLINEINDENTATION, line));
	};

	void setLineIndent(int line, int indent) const;

    void setLineNumberWidth(bool willBeShowed = true) {
        // The 4 here allows for spacing: 1 poxel on left and 3 on right.
        int pixelWidth = int((willBeShowed)?(8 + _maxNbDigit * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)"8")):0);
        execute(SCI_SETMARGINWIDTHN, 0, pixelWidth);
    };

    void setCurrentIndex(int index2Set) {_currentIndex = index2Set;};

	void setCurrentLineHiLiting(bool isHiliting, COLORREF bgColor) const {
		execute(SCI_SETCARETLINEVISIBLE, isHiliting);
		if (!isHiliting)
			return;
		execute(SCI_SETCARETLINEBACK, bgColor);
	};

	bool isCurrentLineHiLiting() const {
		return (execute(SCI_GETCARETLINEVISIBLE) != 0);
	};

	inline void makeStyle(const char *lexerName, const char **keywordArray = NULL);

	void performGlobalStyles();

	void expand(int &line, bool doExpand, bool force = false, int visLevels = 0, int level = -1);
	void removeUserLang(const char *name) {
		for (int i = 0 ; i < int(_buffers.size()) ; i++)
		{
			if ((_buffers[i]._lang == L_USER) && (!strcmp(name, _buffers[i]._userLangExt)))
			{
				_buffers[i]._userLangExt[0] = '\0';
			}
		}
	};
	void renameUserLang(const char *oldName, const char *newName) {
		for (int i = 0 ; i < int(_buffers.size()) ; i++)
		{
			if ((_buffers[i]._lang == L_USER) && (!strcmp(oldName, _buffers[i]._userLangExt)))
			{
				strcpy(_buffers[i]._userLangExt, newName);
			}
		}
	};

	
		
	void currentLineUp() const {
		execute(SCI_BEGINUNDOACTION);

		int currentLine = getCurrentLineNumber();
		if (currentLine == 0)
			return;
		currentLine--;
		execute(SCI_LINETRANSPOSE);
		execute(SCI_GOTOLINE, currentLine);

		execute(SCI_ENDUNDOACTION);
	};

	void currentLineDown() const {
		execute(SCI_BEGINUNDOACTION);

		int currentLine = getCurrentLineNumber();
		if (currentLine == (execute(SCI_GETLINECOUNT) - 1))
			return;
		currentLine++;
		execute(SCI_GOTOLINE, currentLine);
		execute(SCI_LINETRANSPOSE);

		execute(SCI_ENDUNDOACTION);
	};

	void convertSelectedTextTo(bool Case);

    void convertSelectedTextToLowerCase() {
		// if system is w2k or xp
		if ((NppParameters::getInstance())->isTransparentAvailable())
			convertSelectedTextTo(LOWERCASE);
		else
			execute(SCI_LOWERCASE);
	};

    void convertSelectedTextToUpperCase() {
		// if system is w2k or xp
		if ((NppParameters::getInstance())->isTransparentAvailable())
			convertSelectedTextTo(UPPERCASE);
		else
			execute(SCI_UPPERCASE);
		
	};
    
	void collapse(int level2Collapse, bool mode);
	void foldAll(bool mode);
	void foldCurrentPos(bool mode);
	int getCodpage() const {return _codepage;};

	//int getMaxNbDigit const () {return _maxNbDigit;};

	bool increaseMaxNbDigit(int newValue) {
		if (newValue > _maxNbDigit)
		{
			_maxNbDigit = newValue;
			return true;
		}
		return false;
	};

	int getNextPriorityIndex(int & weight, int heavest) {
		weight = 0;
		if (_buffers.size() <= 0)
			return -1;
		if (_buffers[0]._recentTag < heavest)
			weight = _buffers[0]._recentTag;

		int maxIndex = 0;

		for (size_t i = 1 ; i < _buffers.size() ; i++)
		{
			if ((_buffers[i]._recentTag < heavest) && (weight < _buffers[i]._recentTag))
			{
				weight = _buffers[i]._recentTag;
				maxIndex = i;
			}
		}
		return maxIndex;
	};

	NppParameters * getParameter() {
		return _pParameter;
	};
	
	ColumnModeInfo getColumnModeSelectInfo();

	void columnReplace(ColumnModeInfo & cmi, const char *str);
	void columnReplace(const ColumnModeInfo & cmi, const char ch);
	void columnReplace(ColumnModeInfo & cmi, int initial, int incr, unsigned char format);

protected:
	static HINSTANCE _hLib;
	static int _refCount;
	
    static UserDefineDialog _userDefineDlg;

    static const int _markersArray[][NB_FOLDER_STATE];

	static LRESULT CALLBACK scintillaStatic_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
		ScintillaEditView *pScint = (ScintillaEditView *)(::GetWindowLong(hwnd, GWL_USERDATA));
		//
		if (pScint)
			return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam));
		else
			return ::DefWindowProc(hwnd, Message, wParam, lParam);
		//
	};

	LRESULT scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

	SCINTILLA_FUNC _pScintillaFunc;
	SCINTILLA_PTR  _pScintillaPtr;

	// the current active buffer index of _buffers
	int _currentIndex;
	static WNDPROC _scintillaDefaultProc;

	// the list of docs
	buf_vec_t _buffers;

	// For the file nfo
	//int _MSLineDrawFont;

	folderStyle _folderStyle;

    NppParameters *_pParameter;

	int _codepage;
	int _oemCodepage;

	int _maxNbDigit; // For Line Number Marge 

	void setStyle(int styleID, COLORREF fgColor, COLORREF bgColor = -1, const char *fontName = NULL, int fontStyle = -1, int fontSize = 0);
	void setCppLexer(LangType type);
	void setXmlLexer(LangType type);
	void setUserLexer();
	void setUserLexer(const char *userLangName);
	void setEmbeddedJSLexer();
    void setPhpEmbeddedLexer();
    void setEmbeddedAspLexer();
	void setCssLexer() {
		setLexer(SCLEX_CSS, L_CSS, "css", LIST_0 | LIST_1);
	};

	void setLuaLexer() {
		setLexer(SCLEX_LUA, L_LUA, "lua", LIST_0 | LIST_1 | LIST_2 | LIST_3);
	};

	void setMakefileLexer() {
		execute(SCI_SETLEXER, SCLEX_MAKEFILE);
		makeStyle("makefile");
	};

	void setIniLexer() {
		execute(SCI_SETLEXER, SCLEX_PROPERTIES);
		execute(SCI_STYLESETEOLFILLED, SCE_PROPS_SECTION, true);
		makeStyle("ini");
	};

    void setObjCLexer(LangType type);

	void setSqlLexer() {
		setLexer(SCLEX_SQL, L_SQL, "sql", LIST_0);
	};

	void setBashLexer() {
		setLexer(SCLEX_BASH, L_BASH, "bash", LIST_0);
	};

	void setVBLexer() {
		setLexer(SCLEX_VB, L_VB, "vb", LIST_0);
	};

	void setPascalLexer() {
		setLexer(SCLEX_PASCAL, L_PASCAL, "pascal", LIST_0);
	};

	void setPerlLexer() {
		setLexer(SCLEX_PERL, L_PERL, "perl", LIST_0);
	};

	void setPythonLexer() {
		setLexer(SCLEX_PYTHON, L_PYTHON, "python", LIST_0);
	};

	void setBatchLexer() {
		setLexer(SCLEX_BATCH, L_BATCH, "batch", LIST_0);
	};

	void setTeXLexer() {
		setLexer(SCLEX_TEX, L_TEX, "tex", 0);
		//execute(SCI_SETLEXER, SCLEX_TEX);
		//makeStyle("tex");
	};

	void setNsisLexer() {
		setLexer(SCLEX_NSIS, L_NSIS, "nsis", LIST_0 | LIST_1 | LIST_2 | LIST_3);
	};

	void setFortranLexer() {
		setLexer(SCLEX_F77, L_FORTRAN, "fortran", LIST_0 | LIST_1 | LIST_2);
	};

	void setLispLexer(){
		setLexer(SCLEX_LISP, L_LISP, "lisp", LIST_0);
	};
	
	void setShemeLexer(){
		setLexer(SCLEX_LISP, L_SCHEME, "lisp", LIST_0);
	};

	void setAsmLexer(){
		setLexer(SCLEX_ASM, L_ASM, "asm", LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5);
	};
	
	void setDiffLexer(){
		setLexer(SCLEX_DIFF, L_DIFF, "diff", LIST_NONE);
	};
	
	void setPropsLexer(){
		setLexer(SCLEX_PROPERTIES, L_PROPS, "props", LIST_NONE);
	};
	
	void setPostscriptLexer(){
		setLexer(SCLEX_PS, L_PS, "postscript", LIST_0 | LIST_1 | LIST_2 | LIST_3);
	};
	
	void setRubyLexer(){
		setLexer(SCLEX_RUBY, L_RUBY, "ruby", LIST_0);
		execute(SCI_STYLESETEOLFILLED, SCE_RB_POD, true);
	};
	
	void setSmalltalkLexer(){
		setLexer(SCLEX_SMALLTALK, L_SMALLTALK, "smalltalk", LIST_0);
	};
	
	void setVhdlLexer(){
		setLexer(SCLEX_VHDL, L_VHDL, "vhdl", LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5 | LIST_6);
	};
    
	void setKixLexer(){
		setLexer(SCLEX_KIX, L_KIX, "kix", LIST_0 | LIST_1 | LIST_2);
	};
	
	void setAutoItLexer(){
		setLexer(SCLEX_AU3, L_AU3, "autoit", LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5 | LIST_6);
	};
/*
LIST_0 : LANG_INDEX_INSTR
LIST_1 : LANG_INDEX_INSTR2
LIST_2 : LANG_INDEX_TYPE
LIST_3 : LANG_INDEX_TYPE2
LIST_4 : LANG_INDEX_TYPE3
LIST_5 : LANG_INDEX_TYPE4
LIST_6 : LANG_INDEX_TYPE5
*/
	void setCamlLexer(){
		setLexer(SCLEX_CAML, L_CAML, "caml", LIST_0 | LIST_1 | LIST_2);
	};

	void setAdaLexer(){
		setLexer(SCLEX_ADA, L_ADA, "ada", LIST_0);
	};
	
	void setVerilogLexer(){
		setLexer(SCLEX_VERILOG, L_VERILOG, "verilog", LIST_0 | LIST_1);
	};

	void setMatlabLexer(){
		setLexer(SCLEX_MATLAB, L_MATLAB, "matlab", LIST_0);
	};

	void setHaskellLexer(){
		setLexer(SCLEX_HASKELL, L_HASKELL, "haskell", LIST_0);
	};

	void setInnoLexer() {
		setLexer(SCLEX_INNOSETUP, L_INNO, "inno", LIST_0 | LIST_1 | LIST_2 | LIST_3 | LIST_4 | LIST_5);
	};
	
	void setCmakeLexer() {
		setLexer(SCLEX_CMAKE, L_CMAKE, "cmake", LIST_0 | LIST_1 | LIST_2);
	};

	void setSearchResultLexer() {
		//execute(SCI_SETLEXER, SCLEX_SEARCHRESULT);
		execute(SCI_STYLESETEOLFILLED, SCE_SEARCHRESULT_HEARDER, true);
		//makeStyle("searchResult");
		setLexer(SCLEX_SEARCHRESULT, L_SEARCHRESULT, "searchResult", LIST_1 | LIST_2 | LIST_3);
	};

    void defineMarker(int marker, int markerType, COLORREF fore, COLORREF back) {
	    execute(SCI_MARKERDEFINE, marker, markerType);
	    execute(SCI_MARKERSETFORE, marker, fore);
	    execute(SCI_MARKERSETBACK, marker, back);
    };

	bool isNeededFolderMarge(LangType typeDoc) const {
		switch (typeDoc)
		{
			case L_NFO:
			case L_BATCH:
			case L_TXT:
			case L_MAKEFILE:
            case L_SQL:
			case L_ASM:
			//case L_TEX:
			case L_HASKELL:
			case L_PROPS:
			case L_SMALLTALK:
			case L_KIX:
			case L_ADA:
				return false;
			default:
				return true;
		}
	};
	bool isCJK() const {
		return ((_codepage == CP_CHINESE_TRADITIONAL) || (_codepage == CP_CHINESE_SIMPLIFIED) || 
			    (_codepage == CP_JAPANESE) || (_codepage == CP_KOREAN) || (_codepage == CP_GREEK));
	};

	int codepage2CharSet() const {
		switch (_codepage)	
		{
			case CP_CHINESE_TRADITIONAL : return SC_CHARSET_CHINESEBIG5;
			case CP_CHINESE_SIMPLIFIED : return SC_CHARSET_GB2312;
			case CP_KOREAN : return SC_CHARSET_HANGUL;
			case CP_JAPANESE : return SC_CHARSET_SHIFTJIS;
			case CP_GREEK : return SC_CHARSET_GREEK;
			default : return 0;
		}
	};
	
	const char * getCompleteKeywordList(std::string & kwl, LangType langType, int keywordIndex);
	void setKeywords(LangType langType, const char *keywords, int index);
	void setLexer(int lexerID, LangType langType, const char *lexerName, int whichList);

	bool expandWordSelection();
	void arrangeBuffers(UINT nItems, UINT *items);
};

#endif //SCINTILLA_EDIT_VIEW_H

⌨️ 快捷键说明

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