Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537
、首先,在ScintillaWnd.h頭文件中添加如下代碼
HMODULE m_hSciLexerDll;
如下圖:
2、在ScintillaWnd.cpp源文件的構(gòu)造函數(shù)和析構(gòu)函數(shù)中添加如下代碼
ScintillaWnd::ScintillaWnd() { m_hSciLexerDll=NULL; m_hSciLexerDll=LoadLibrary(_T("SciLexer.dll")); if (NULL==m_hSciLexerDll) { AfxMessageBox(_T("LoadLibrary SciLexer.dll failure...")); } }
這是構(gòu)造函數(shù)
ScintillaWnd::~ScintillaWnd() { if (NULL !=m_hWnd) { DestroyWindow(); } if (m_hSciLexerDll !=NULL) { FreeLibrary(m_hSciLexerDll); } }
這是析構(gòu)函數(shù)
3、為窗口類創(chuàng)建Create函數(shù)
打開類向?qū)Вx擇“ScintillaWnd”類,找到“虛函數(shù)”,找到“Create”函數(shù),點(diǎn)擊“添加函數(shù)”。
Create函數(shù)
添加完“Create”函數(shù),會(huì)自動(dòng)生成一些代碼,這些代碼不需要改動(dòng),保持原樣就好。
4、為窗口類添加Init()函數(shù),先在ScintillaWnd.h中添加下面的代碼
virtual void Init();
點(diǎn)擊圖中“小燈泡”,會(huì)提示你在ScintillaWnd.cpp文件中創(chuàng)建Init()函數(shù),點(diǎn)擊創(chuàng)建。
在創(chuàng)建的Init()函數(shù)中添加如下代碼
void ScintillaWnd::Init() { // clear all text styles SendMessage(SCI_CLEARDOCUMENTSTYLE, 0, 0); // set the number of styling bits to 7 - the asp/html views need a lot of styling - default is 5 // If you leave the default you will see twiggle lines instead of ASP code SendMessage(SCI_SETSTYLEBITS, 7, 0); // set the display for indetation guides to on - this displays virtical dotted lines from the beginning of // a code block to the end of the block SendMessage(SCI_SETINDENTATIONGUIDES, TRUE, 0); // set tabwidth to 4 SendMessage(SCI_SETTABWIDTH, 4, 0); // set indention to 4 SendMessage(SCI_SETINDENT, 4, 0); // set the caret blinking time to 400 milliseconds SendMessage(SCI_SETCARETPERIOD, 400, 0); // display fold margins SetFold(); // hide SelectionMargin SendMessage(SCI_SETMARGINWIDTHN, 1, 0); // set markersymbol for marker type 0 - bookmark SendMessage(SCI_MARKERDEFINE, 0, SC_MARK_CIRCLE); // set the forground color for some styles SendMessage(SCI_STYLESETFORE, 0, RGB(0, 0, 0)); SendMessage(SCI_STYLESETFORE, 2, RGB(0, 64, 0)); SendMessage(SCI_STYLESETFORE, 5, RGB(0, 0, 255)); SendMessage(SCI_STYLESETFORE, 6, RGB(200, 20, 0)); SendMessage(SCI_STYLESETFORE, 9, RGB(0, 0, 255)); SendMessage(SCI_STYLESETFORE, 10, RGB(255, 0, 64)); SendMessage(SCI_STYLESETFORE, 11, RGB(0, 0, 0)); // set the backgroundcolor of brace highlights SendMessage(SCI_STYLESETBACK, STYLE_BRACELIGHT, RGB(0, 255, 0)); // set end of line mode to CRLF SendMessage(SCI_CONVERTEOLS, 2, 0); SendMessage(SCI_SETEOLMODE, 2, 0); // SendMessage(SCI_SETVIEWEOL, TRUE, 0); //顯示當(dāng)前行的淡黃色背景 SendMessage(SCI_SETCARETLINEVISIBLE, TRUE, 0); SendMessage(SCI_SETCARETLINEBACK, RGB(255, 255, 0), 0); SendMessage(SCI_SETCARETLINEBACKALPHA, 100, 0); }
注意:要在ScintillaWnd.h頭文件中包含Scintilla.h和SciLexer.h頭文件
為窗口類添加InitScintillaEdit函數(shù),在ScintillaWnd.h中添加下面的代碼
void InitScintillaEdit(int nSize, const TCHAR* face);
用同樣的方法,在ScintillaWnd.cpp文件中創(chuàng)建InitScintillaEdit函數(shù)
在創(chuàng)建的InitScintillaEdit函數(shù)添加如下代碼
void ScintillaWnd::InitScintillaEdit(int nSize, const TCHAR * face) { setCppSyntax(); Init(); SetDefaultColorFont(nSize, face); UpdateLineNumberWidth(); }
為窗口類添加SetDefaultColorFont函數(shù)
void SetDefaultColorFont(int nSize, const TCHAR* face);
在創(chuàng)建的SetDefaultColorFont函數(shù)添加如下代碼
void ScintillaWnd::SetDefaultColorFont(int nSize, const TCHAR * face) { SendMessage(SCI_SETSELFORE, TRUE, RGB(255, 255, 255)); //選中行的顏色 SendMessage(SCI_SETSELBACK, TRUE, RGB(10, 36, 106)); //默認(rèn)文本顏色 SendMessage(SCI_STYLESETFORE, STYLE_DEFAULT, RGB(0x00, 0x00, 0x00)); SendMessage(SCI_STYLESETBACK, STYLE_DEFAULT, RGB(0xff, 0xff, 0xff)); SendMessage(SCI_STYLESETSIZE, STYLE_DEFAULT, nSize); SendMessage(SCI_STYLESETFONT, STYLE_DEFAULT, reinterpret_cast<LPARAM>(face)); }
為窗口類添加SetFold函數(shù)
void SetFold(BOOL bFold=TRUE);
在創(chuàng)建的SetFold函數(shù)添加如下代碼
void ScintillaWnd::SetFold(BOOL bFold) { if (bFold) { // source folding section // tell the lexer that we want folding information - the lexer supplies "folding levels" SendMessage(SCI_SETPROPERTY, (WPARAM) "fold", (LPARAM)"1"); SendMessage(SCI_SETPROPERTY, (WPARAM) "fold.html", (LPARAM)"1"); SendMessage(SCI_SETPROPERTY, (WPARAM) "fold.html.preprocessor", (LPARAM)"1"); SendMessage(SCI_SETPROPERTY, (WPARAM) "fold.comment", (LPARAM)"1"); SendMessage(SCI_SETPROPERTY, (WPARAM) "fold.at.else", (LPARAM)"1"); SendMessage(SCI_SETPROPERTY, (WPARAM) "fold.flags", (LPARAM)"1"); SendMessage(SCI_SETPROPERTY, (WPARAM) "fold.preprocessor", (LPARAM)"1"); SendMessage(SCI_SETPROPERTY, (WPARAM) "styling.within.preprocessor", (LPARAM)"1"); SetMarginWidthN(2, 16); //SendMessage( SCI_SETMARGINWIDTHN, 2, 16 ); // FoldMargin SendMessage(SCI_SETMARGINTYPEN, 2, SC_MARGIN_SYMBOL);//頁(yè)邊類型 SendMessage(SCI_SETMARGINMASKN, 2, SC_MASK_FOLDERS); //頁(yè)邊掩碼 SendMessage(SCI_SETMARGINWIDTHN, 2, 16); //頁(yè)邊寬度 SendMessage(SCI_SETMARGINSENSITIVEN, 2, TRUE); //響應(yīng)鼠標(biāo)消息 // 折疊標(biāo)簽樣式 SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_CIRCLEPLUSCONNECTED); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_CIRCLEMINUSCONNECTED); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNERCURVE); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); SendMessage(SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNERCURVE); // 折疊標(biāo)簽線顏色 SendMessage(SCI_MARKERSETBACK, SC_MARKNUM_FOLDERSUB, 0xff0000); //藍(lán)色 SendMessage(SCI_MARKERSETBACK, SC_MARKNUM_FOLDERMIDTAIL, 0xff0000); SendMessage(SCI_MARKERSETBACK, SC_MARKNUM_FOLDERTAIL, 0xff0000); SendMessage(SCI_SETFOLDFLAGS, 16 | 4, 0); //如果折疊就在折疊行的上下各畫一條橫線 } else { SetMarginWidthN(2, 0); //SendMessage( SCI_SETMARGINWIDTHN, 2, 0 ); // FoldMargin } }
為窗口類添加ToggleFold函數(shù)
void ToggleFold(long line);
在創(chuàng)建的SetFold函數(shù)添加如下代碼
void ScintillaWnd::ToggleFold(long line) { SendMessage(SCI_TOGGLEFOLD, static_cast<WPARAM>(line), 0); }
為窗口類添加GetMarginWidthN函數(shù)
int GetMarginWidthN(int margin);
在創(chuàng)建的GetMarginWidthN函數(shù)添加如下代碼
int ScintillaWnd::GetMarginWidthN(int margin) { return SendMessage(SCI_GETMARGINWIDTHN, static_cast<WPARAM>(margin), 0); }
為窗口類添加SetMarginWidthN函數(shù)
void SetMarginWidthN(int margin, int mask);
在創(chuàng)建的SetMarginWidthN函數(shù)添加如下代碼
void ScintillaWnd::SetMarginWidthN(int margin, int mask) { SendMessage(SCI_SETMARGINWIDTHN, static_cast<WPARAM>(margin), static_cast<LPARAM>(mask)); }
為窗口類添加UpdateLineNumberWidth函數(shù)
void UpdateLineNumberWidth(void);
在創(chuàng)建的UpdateLineNumberWidth函數(shù)添加如下代碼
void ScintillaWnd::UpdateLineNumberWidth(void) { //start 顯示行號(hào) long iLineMarginWidthNow; long iLineMarginWidthFit; long iLineNum=SendMessage(SCI_GETLINECOUNT, 0, 0); long iLineNumCount=1; while (iLineNum !=0) { ++iLineNumCount; iLineNum /=10; } iLineMarginWidthNow=SendMessage(SCI_GETMARGINWIDTHN, 0, 0); long charWidth=SendMessage(SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)("9")); iLineMarginWidthFit=charWidth * iLineNumCount; if (iLineMarginWidthNow !=iLineMarginWidthFit) { SendMessage(SCI_SETMARGINWIDTHN, 0, iLineMarginWidthFit); } //end of 顯示行號(hào) }
為窗口類添加LineFromPosition函數(shù)
long LineFromPosition(long pos);
在創(chuàng)建的LineFromPosition函數(shù)添加如下代碼
long ScintillaWnd::LineFromPosition(long pos) { return SendMessage(SCI_LINEFROMPOSITION, static_cast<WPARAM>(pos), 0); }
ScintillaWnd窗口類的大部分代碼已經(jīng)添加完成,后續(xù)還要添加一些代碼,下一章會(huì)講在CCppEditorDlg類中添加代碼,給CCppEditorDlg類添加完代碼后,項(xiàng)目就可以編譯運(yùn)行了,但這只是一個(gè)簡(jiǎn)單的版本,我還會(huì)添加功能,到時(shí)候再為大家講解。
(未完待續(xù))
源:https://www.oschina.net/news/117827/jboot-3-3-4-released
Jboot 是一個(gè)基于 JFinal、JFinal-Undertow、Dubbo、Seata、Sentinel、ShardingSphere、Nacos 等開發(fā)的微服務(wù)框架,幫助開發(fā)者降低微服務(wù)開發(fā)門檻。同時(shí)完美支持在 idea、eclipse 下多 maven 模塊,對(duì) java 代碼、html、css、js 等資源文件進(jìn)行熱加載。爽爽開發(fā),快樂生活。
Jboot 3.3.4 主要新增了一個(gè)新的特性,Jboot 新增了 JbootActionReporter 用于代替 JFinal 的 ActionReporter ,這樣更加方便的對(duì) Controller (包括攔截器)方法進(jìn)行定位,如下圖:
當(dāng)有這個(gè)功能以后,我們點(diǎn)擊此 控制臺(tái) 鏈接,可以直接跳轉(zhuǎn)到對(duì)應(yīng)的方法,這樣我們?cè)陂_發(fā)的時(shí)候,更加方便我們對(duì)請(qǐng)求信息進(jìn)行快速定位,更加急速的開發(fā)。
目前已經(jīng)開源超過(guò)了 3 年的時(shí)間,迭代了 100+ 個(gè)版本,已經(jīng)被超過(guò) 1000+ 公司在使用。
Jboot 主要有以下特征:
Jboot v3.3.4 更新內(nèi)容如下:
maven 依賴:
<dependency>
<groupId>io.jboot</groupId>
<artifactId>jboot</artifactId>
<version>3.3.4</version>
</dependency>
Hello World:
關(guān)注本頭條號(hào),每天堅(jiān)持更新原創(chuàng)干貨技術(shù)文章。
如需學(xué)習(xí)視頻,請(qǐng)?jiān)谖⑿潘阉鞴娞?hào)“智傳網(wǎng)優(yōu)”直接開始自助視頻學(xué)習(xí)
在編寫shell腳本或c程序時(shí),如何顯示vi / vim文本編輯器行號(hào)?如何在Linux、Apple OS X/macOS或類unix操作系統(tǒng)上打開或關(guān)閉此功能?如何讓vi文本編輯器顯示或隱藏行號(hào)?如何通過(guò)編輯~/.vimrc配置文件使得vim啟動(dòng)時(shí)啟用行號(hào)。
在vi / vim下顯示行號(hào)對(duì)于調(diào)試程序錯(cuò)誤和提高程序或腳本的整體可讀性非常有用。Vim在軟件開發(fā)人員、系統(tǒng)管理員和Linux/Unix/macOS用戶中非常流行,但是默認(rèn)情況下不顯示行。在本教程中,您將了解如何在基于Linux/Unix的系統(tǒng)上運(yùn)行的Vim / Vi文本編輯器中顯示或隱藏行號(hào)。
如何使vi編輯器顯示或隱藏行號(hào)
要使vi顯示行號(hào),需要設(shè)置數(shù)字標(biāo)志。這樣做:
set?number
或者
set?nu
vim怎么顯示行號(hào)
vi編輯器正在顯示行號(hào),設(shè)置成功
要關(guān)閉行號(hào),請(qǐng)?jiān)俅伟凑涨懊娴恼f(shuō)明進(jìn)行操作,但這次要在:提示符處輸入以下行:
set?nonumber
通常,一旦離開編輯器,vi將忘記所選擇的設(shè)置。但是,您可以在特定帳戶上使用vi時(shí)使其中任何一個(gè)設(shè)置自動(dòng)生效。為此,將適當(dāng)?shù)膕et語(yǔ)句作為行放在名為.exrc的主目錄的文件中。
對(duì)于所有當(dāng)前設(shè)置的列表,在:提示符處,輸入:
set?all
對(duì)于您已經(jīng)設(shè)置的所有內(nèi)容的列表,在:提示符處,輸入:
set
vi行號(hào)顯示設(shè)置方法
通過(guò)本文,您應(yīng)該可以知道如何在vi編輯器中設(shè)置行號(hào)了嗎?
本文已同步至博客站,尊重原創(chuàng),轉(zhuǎn)載時(shí)請(qǐng)?jiān)谡闹懈綆б韵骆溄樱?br>https://www.linuxrumen.com/rmxx/1564.html
點(diǎn)擊了解更多,快速查看更多的技術(shù)文章列表。
*請(qǐng)認(rèn)真填寫需求信息,我們會(huì)在24小時(shí)內(nèi)與您取得聯(lián)系。