Merge branch 'master' into cmake_support

This commit is contained in:
coconil 2023-02-03 21:01:30 +08:00
commit a17092cbbc
79 changed files with 6097 additions and 5903 deletions

View File

@ -8,16 +8,11 @@
**鉴于Notepad++作者的错误言论Notepad--的意义在于:减少一点错误言论,减少一点自以为是。** **鉴于Notepad++作者的错误言论Notepad--的意义在于:减少一点错误言论,减少一点自以为是。**
**严正声明,台湾是中国的一部分。**
您可以在这个项目提交bug或反馈问题。 您可以在这个项目提交bug或反馈问题。
最新版本下载地址https://gitee.com/cxasm/notepad--/releases/tag/v1.21 最新版本下载地址https://gitee.com/cxasm/notepad--/releases/tag/v1.21
Arch Linux 及其衍生版可以通过 AUR 仓库安装:[notepad---git](https://aur.archlinux.org/packages/notepad---git) 最新开发版本下载地址https://gitee.com/cxasm/notepad--/releases/tag/v1.22
```
yay -S notepad---git
```
NDD已初步推出插件编写功能希望广大的CPP/QT开发者加入我们插件功能均可以留上您的大名和捐赠渠道希望 NDD已初步推出插件编写功能希望广大的CPP/QT开发者加入我们插件功能均可以留上您的大名和捐赠渠道希望
开发者参与插件功能开发。 开发者参与插件功能开发。
@ -54,6 +49,11 @@ NDD已初步推出插件编写功能希望广大的CPP/QT开发者加入我
代码上线不久,删除了商业的对比功能和注册功能(这部分有商业原因,请理解),除此以外,所有功能全部保留。 代码上线不久,删除了商业的对比功能和注册功能(这部分有商业原因,请理解),除此以外,所有功能全部保留。
4Arch Linux 及其衍生版可以通过 AUR 仓库安装:[notepad---git](https://aur.archlinux.org/packages/notepad---git)
```
yay -S notepad---git
```
![输入图片说明](png/20221107_160824.png) ![输入图片说明](png/20221107_160824.png)
![输入图片说明](png/6.png) ![输入图片说明](png/6.png)
@ -61,5 +61,3 @@ NDD已初步推出插件编写功能希望广大的CPP/QT开发者加入我
![输入图片说明](png/3.png) ![输入图片说明](png/3.png)
![输入图片说明](png/7.png) ![输入图片说明](png/7.png)
![输入图片说明](png/8.png)

View File

@ -1,3 +1,18 @@
Ndd V1.22 预发布 20230202
1 提供大文本、超大文本打开两种方式;并尽量显示行号。
2 增加ASM语言的语法高亮;增加shell语法高亮。
3 大文本打开时,显示行号。
4 BUG: 超大文本打开乱码。
5 批量查找窗口大小记住恢复。
6 块注释崩溃。
7 替换ctrl+h 自动填充选中内容,查找替换切换自动带过去关键字。
8 查找结果框,可以放大缩小,避免看不清楚;完善配色。
9 第一次安装后新建NEW文件下次打开无法自动恢复的问题。
10 win10下面管理员授权打开文件后旧文件修改跟随到新打开窗口
11 解决一些列小bug等。
12 提供ARCH LINUX的构建版本等。
Ndd V1.21 预发布 20230107 Ndd V1.21 预发布 20230107
1 支持主题的修改,完善八种新主题 1 支持主题的修改,完善八种新主题
2 初步支持插件开发 2 初步支持插件开发

View File

@ -2,6 +2,7 @@
#include "Encode.h" #include "Encode.h"
#include "rcglobal.h" #include "rcglobal.h"
#include <QFile> #include <QFile>
#include <QFileDevice> #include <QFileDevice>
#include <QVector> #include <QVector>
@ -87,12 +88,22 @@ bool CmpareMode::recognizeTextCode(QByteArray & text, LineFileInfo &lineInfo, QS
return result; return result;
} }
//LE编码要特殊对待。
CODE_ID CmpareMode::getTextFileEncodeType(uchar* fileFpr, int fileLength, QString filePath) bool CmpareMode::isUnicodeLeBomFile(uchar* fileFpr, int fileLength)
{ {
if (fileLength >= 2 && fileFpr[0] == 0xFF && fileFpr[1] == 0xFE) if (fileLength >= 2 && fileFpr[0] == 0xFF && fileFpr[1] == 0xFE)
{ {
return true;
}
return false;
}
//isCheckHead:是否检测头。只有文件开头,才有。如果是分块加载,中间打开的文件,则不需要检测。默认检测
CODE_ID CmpareMode::getTextFileEncodeType(uchar* fileFpr, int fileLength, QString filePath, bool isCheckHead)
{
if (isCheckHead)
{
if (fileLength >= 2 && fileFpr[0] == 0xFF && fileFpr[1] == 0xFE)
{
return CODE_ID::UNICODE_LE; //skip 2 return CODE_ID::UNICODE_LE; //skip 2
} }
else if (fileLength >= 2 && fileFpr[0] == 0xFE && fileFpr[1] == 0xFF) else if (fileLength >= 2 && fileFpr[0] == 0xFE && fileFpr[1] == 0xFF)
@ -103,7 +114,7 @@ CODE_ID CmpareMode::getTextFileEncodeType(uchar* fileFpr, int fileLength, QStrin
{ {
return CODE_ID::UTF8_BOM; //skip 3 with BOM return CODE_ID::UTF8_BOM; //skip 3 with BOM
} }
}
//走到这里说明没有文件头BOM进行全盘文件扫描 //走到这里说明没有文件头BOM进行全盘文件扫描
if (!filePath.isEmpty()) if (!filePath.isEmpty())
{ {
@ -113,6 +124,83 @@ CODE_ID CmpareMode::getTextFileEncodeType(uchar* fileFpr, int fileLength, QStrin
return CODE_ID::UNKOWN; return CODE_ID::UNKOWN;
} }
//20230201新增:把Unicode_LE的字节流转换为QString 发现如果是CODE_ID::UNICODE_LE\r\n变成了\r\0\n\0读取readLine遇到\n就结束了而且toUnicode也会变成乱码失败
//所以UNICODE_LE需要单独处理。该函数只处理Unicode_LE编码文件事先一定要检查文件编码
//返回字符数不是编码类型注意是字符数不是bytes
//这里有个问题,当初读取文件分块是,是无条件读取到\n就结束则可能最后不是\n\0而是\n。这种情况要特殊处理。标记为A。
//是否跳过前面的LE头。默认不跳过。只有文件块开头第一块才需要跳过。
bool CmpareMode::tranUnicodeLeToUtf8Bytes(uchar* fileFpr, const int fileLength, QString &outUtf8Bytes, bool isSkipHead)
{
int lineNums = 0;
CODE_ID code = CODE_ID::UNICODE_LE;
int lineStartPos = (isSkipHead ? 2:0); //uicode_le前面有2个特殊标识故跳过2
//获取一行在文件中
auto getOneLineFromFile = [fileFpr](int& startPos, const int fileLength, QByteArray& ret)->bool {
if (startPos < fileLength)
{
ret.clear();
int lineLens = 0;
bool isFindLine = false;
for (int i = startPos; i < fileLength; ++i, ++lineLens)
{
//遇到换行符号
if (fileFpr[i] == 0x0A)
{
//lineLens需要加2因为当前这个没有加而且后面还有一个\0,这是le格式规定的。
//特殊对待A。如果后续还要一个\0及长度足够则+2否则只能加1
if (startPos + lineLens + 2 < fileLength)
{
ret.append((char*)(fileFpr + startPos), lineLens + 2);
startPos += lineLens + 2;
}
else
{
//这里就是特殊情况,尾部后面没有\0只能前进1个。
ret.append((char*)(fileFpr + startPos), lineLens + 1);
//必须手动补上一个\0。避免格式残缺
ret.append('\0');
startPos += lineLens + 1;
}
isFindLine = true;
break;
}
}
//没有找到一行
if (!isFindLine)
{
//最后一行,可能没有带\r\0直接返回
ret.append((char*)(fileFpr + startPos), fileLength - startPos);
startPos = fileLength;
}
return true;
}
return false;
};
QByteArray line;
QByteArray tempUtf8Bytes;
tempUtf8Bytes.reserve(fileLength+1);
while (getOneLineFromFile(lineStartPos, fileLength, line)) {
tempUtf8Bytes.append(line);
}
return Encode::tranStrToUNICODE(code, tempUtf8Bytes.data(), tempUtf8Bytes.count(), outUtf8Bytes);
}
//20210802发现如果是CODE_ID::UNICODE_LE\r\n变成了\r\0\n\0读取readLine遇到\n就结束了而且toUnicode也会变成乱码失败 //20210802发现如果是CODE_ID::UNICODE_LE\r\n变成了\r\0\n\0读取readLine遇到\n就结束了而且toUnicode也会变成乱码失败
//所以UNICODE_LE需要单独处理。该函数只处理Unicode_LE编码文件事先一定要检查文件编码 //所以UNICODE_LE需要单独处理。该函数只处理Unicode_LE编码文件事先一定要检查文件编码
//返回字符数不是编码类型注意是字符数不是bytes //返回字符数不是编码类型注意是字符数不是bytes
@ -141,9 +229,21 @@ quint32 CmpareMode::readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fi
//遇到换行符号 //遇到换行符号
if (m_fileFpr[i] == 0x0A) if (m_fileFpr[i] == 0x0A)
{ {
if (startPos + lineLens + 2 < fileLength)
{
//lineLens需要加2因为当前这个没有加而且后面还有一个\0,这是le格式规定的 //lineLens需要加2因为当前这个没有加而且后面还有一个\0,这是le格式规定的
ret.append((char*)(m_fileFpr + startPos), lineLens + 2); ret.append((char*)(m_fileFpr + startPos), lineLens + 2);
startPos += lineLens + 2; startPos += lineLens + 2;
}
else
{
//这里就是特殊情况,尾部后面没有\0只能前进1个。
//其实是容错,可能最后一个没有\0
ret.append((char*)(m_fileFpr + startPos), lineLens + 1);
//必须手动补上一个\0。避免格式残缺
ret.append('\0');
startPos += lineLens + 1;
}
isFindLine = true; isFindLine = true;
break; break;
} }
@ -952,7 +1052,8 @@ CODE_ID CmpareMode::scanFileRealCode(QString filePath)
++lineNums; ++lineNums;
if (lineNums >= 1000) //最多扫描200行加块速度。速度与精确性的权衡
if (lineNums >= 200)
{ {
break; break;
} }

View File

@ -73,18 +73,12 @@ public:
static CODE_ID scanFileRealCode(QString filePath); static CODE_ID scanFileRealCode(QString filePath);
static CODE_ID scanFileOutPut(CODE_ID code, QString filePath, QList<LineFileInfo>& outputLineInfoVec, int & maxLineSize, int & charsNums, bool &isHexFile); static CODE_ID scanFileOutPut(CODE_ID code, QString filePath, QList<LineFileInfo>& outputLineInfoVec, int & maxLineSize, int & charsNums, bool &isHexFile);
static CODE_ID getTextFileEncodeType(uchar* fileFpr, int fileLength, QString filePath="", bool isCheckHead = true);
inline QList<LineFileInfo>* getLeftLineInfo(); static bool tranUnicodeLeToUtf8Bytes(uchar* fileFpr, const int fileLength, QString& outUtf8Bytes, bool isSkipHead=false);
inline QList<LineFileInfo>* getRightLineInfo(); static bool isUnicodeLeBomFile(uchar* fileFpr, int fileLength);
void getLines(RC_DIRECTION direction, QList<LineFileInfo>& lines);
void getLinesExternInfo(QList<BlockUserData*>*& leftExternBlockInfo, QList<BlockUserData*>*& rightExternBlockInfo);
private: private:
static bool recognizeTextCode(QByteArray & text, LineFileInfo & lineInfo, QString & outUnicodeText); static bool recognizeTextCode(QByteArray & text, LineFileInfo & lineInfo, QString & outUnicodeText);
static CODE_ID getTextFileEncodeType(uchar* fileFpr, int fileLength, QString filePath);
quint32 static readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fileLength, QList<LineFileInfo>& lineInfoVec, QList<LineFileInfo>& blankLineInfoVec,int mode, int &maxLineSize); quint32 static readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fileLength, QList<LineFileInfo>& lineInfoVec, QList<LineFileInfo>& blankLineInfoVec,int mode, int &maxLineSize);

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2023-01-07T07:01:11.4235283Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2023-01-07T07:01:11.5050188Z</QtLastBackgroundBuild>
</PropertyGroup>
</Project>

View File

@ -2,6 +2,7 @@
#include "scintillaeditview.h" #include "scintillaeditview.h"
#include "ccnotepad.h" #include "ccnotepad.h"
#include "progresswin.h" #include "progresswin.h"
#include "nddsetting.h"
#include <QTableWidgetItem> #include <QTableWidgetItem>
#include <QFileDialog> #include <QFileDialog>
@ -15,7 +16,15 @@ BatchFindReplace::BatchFindReplace(QWidget *parent)
} }
BatchFindReplace::~BatchFindReplace() BatchFindReplace::~BatchFindReplace()
{} {
}
void BatchFindReplace::closeEvent(QCloseEvent* event)
{
QByteArray curGeo = this->saveGeometry();
NddSetting::updataWinPos(BATCH_FIND_REPLACE_POS, curGeo);
}
void BatchFindReplace::setTabWidget(QTabWidget* editTabWidget) void BatchFindReplace::setTabWidget(QTabWidget* editTabWidget)
{ {

View File

@ -2,6 +2,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QTabWidget> #include <QTabWidget>
#include <QCloseEvent>
#include "ui_batchfindreplace.h" #include "ui_batchfindreplace.h"
class CCNotePad; class CCNotePad;
@ -15,6 +16,9 @@ public:
virtual ~BatchFindReplace(); virtual ~BatchFindReplace();
void setTabWidget(QTabWidget* editTabWidget); void setTabWidget(QTabWidget* editTabWidget);
protected:
void closeEvent(QCloseEvent* event);
private slots: private slots:
void on_freshBtClick(); void on_freshBtClick();
void on_findBtClick(); void on_findBtClick();

View File

@ -9,6 +9,28 @@ BigFileMessage::BigFileMessage(QWidget *parent)
BigFileMessage::~BigFileMessage() BigFileMessage::~BigFileMessage()
{} {}
void BigFileMessage::setDefOpenMode(NddDocType defMode)
{
switch (defMode)
{
case TXT_TYPE:
ui.textMode->setChecked(true);
break;
case BIG_TEXT_RO_TYPE:
ui.bigTextMode->setChecked(true);
break;
case BIG_EDIT_RW_TYPE:
break;
case SUPER_BIG_TEXT_RO_TYPE:
ui.superBigTextMode->setChecked(true);
break;
case HEX_TYPE:
ui.hexMode->setChecked(true);
break;
default:
break;
}
}
void BigFileMessage::setTip(QString msg) void BigFileMessage::setTip(QString msg)
{ {
@ -19,15 +41,19 @@ void BigFileMessage::slot_okBt()
{ {
if (ui.textMode->isChecked()) if (ui.textMode->isChecked())
{ {
m_result = 0; m_result = TXT_TYPE;//普通文本
} }
else if(ui.bigTextMode->isChecked()) else if(ui.bigTextMode->isChecked())
{ {
m_result = 1; m_result = BIG_TEXT_RO_TYPE; //小于8G的大文本
}
else if (ui.superBigTextMode->isChecked())
{
m_result = SUPER_BIG_TEXT_RO_TYPE;//8G以上的大文本
} }
else if (ui.hexMode->isChecked()) else if (ui.hexMode->isChecked())
{ {
m_result = 2; m_result = HEX_TYPE;//二进制
} }
done(m_result); done(m_result);
} }
@ -36,4 +62,4 @@ void BigFileMessage::slot_cancelBt()
{ {
m_result = -1; m_result = -1;
done(m_result); done(m_result);
} }

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "ccnotepad.h"
#include <QWidget> #include <QWidget>
#include <QDialog> #include <QDialog>
@ -12,6 +13,7 @@ public:
BigFileMessage(QWidget *parent = nullptr); BigFileMessage(QWidget *parent = nullptr);
~BigFileMessage(); ~BigFileMessage();
void setTip(QString msg); void setTip(QString msg);
void setDefOpenMode(NddDocType defMode);
private slots: private slots:
void slot_okBt(); void slot_okBt();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>509</width> <width>770</width>
<height>203</height> <height>195</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -39,6 +39,34 @@
<string>Open Mode</string> <string>Open Mode</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Big Text File(&lt; 8G) Read only open, load in blocks, and turn pages manually.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="hexMode">
<property name="text">
<string>Hex Bin</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="superBigTextMode">
<property name="text">
<string>Super Big Text Edit</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Binary Open,load in blocks, and turn pages manually.</string>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QRadioButton" name="textMode"> <widget class="QRadioButton" name="textMode">
<property name="text"> <property name="text">
@ -46,7 +74,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="2">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Open directly in text mode.May be slow, Need wait.</string> <string>Open directly in text mode.May be slow, Need wait.</string>
@ -63,24 +91,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="2">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Read only open, load in blocks, and turn pages manually.</string> <string>Super big Text File(&gt; 8G bits) Read only open, load in blocks, and turn pages manually.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="hexMode">
<property name="text">
<string>Hex Bin</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Binary Open,load in blocks, and turn pages manually.</string>
</property> </property>
</widget> </widget>
</item> </item>

File diff suppressed because it is too large Load Diff

View File

@ -33,12 +33,15 @@ class CompareDirs;
class CompareWin; class CompareWin;
struct HexFileMgr; struct HexFileMgr;
struct TextFileMgr; struct TextFileMgr;
struct BigTextEditFileMgr;
enum OpenAttr { enum OpenAttr {
Text = 1, Text = 1,
HexReadOnly, HexReadOnly,
BigTextReadOnly, BigTextReadOnly,
BigTextReadWrite,
SuperBigTextReadOnly,
TextReadOnly TextReadOnly
}; };
@ -58,7 +61,24 @@ enum LINE_SORT_TYPE {
SORTLINES_REVERSE_ORDER, SORTLINES_REVERSE_ORDER,
}; };
struct FileExtLexer
{
QString ext;
LangType id;
};
const int FileExtMapLexerIdLen = L_EXTERNAL;
//1 文本 2 hex
enum NddDocType {
TXT_TYPE = 1,
//BIG_TEXT_RO_TYPE,//大文本,只读模式 BIG_TEXT_RO_TYPE。是只读模式
BIG_TEXT_RO_TYPE,//大文本,只读模式,可以显示行号可以跳转。理论上4G-8G比较合适。再大就属于超大文本
BIG_EDIT_RW_TYPE,//大文本,读写模式。目前还不支持
SUPER_BIG_TEXT_RO_TYPE,//超大文本只读模式理论上任意多大文件都可以。不一定支持行号。4G以上的文件。
HEX_TYPE,
};
//打开模式。1 文本 2 二进制 3 大文本只读 4 文本只读 //打开模式。1 文本 2 二进制 3 大文本只读 4 文本只读
//const char* Open_Attr = "openid"; //const char* Open_Attr = "openid";
@ -93,7 +113,8 @@ public:
#endif #endif
bool openFile(QString filePath); bool openFile(QString filePath);
bool tryRestoreFile(QString filePath);
void initTabNewOne(); void initTabNewOne();
void setShareMem(QSharedMemory* v) void setShareMem(QSharedMemory* v)
@ -132,9 +153,11 @@ public:
void setGlobalFont(int style); void setGlobalFont(int style);
void changeMarkColor(int sytleId); void changeMarkColor(int sytleId);
void setUserDefShortcutKey(int shortcutId);
signals: signals:
void signSendRegisterKey(QString key); void signSendRegisterKey(QString key);
void signRegisterReplay(int code); void signRegisterReplay(int code);
void signLinkNetServer();
public slots: public slots:
void slot_changeChinese(); void slot_changeChinese();
void slot_changeEnglish(); void slot_changeEnglish();
@ -324,10 +347,13 @@ private slots:
void slot_showToolBar(bool); void slot_showToolBar(bool);
void slot_dynamicLoadToolMenu(); void slot_dynamicLoadToolMenu();
void slot_batchFind(); void slot_batchFind();
#ifdef NO_PLUGIN
void slot_pluginMgr(); void slot_pluginMgr();
void slot_showWebAddr(bool check);
void onPlugWork(bool check); void onPlugWork(bool check);
#endif
void slot_showWebAddr(bool check);
void slot_langFileSuffix();
void slot_shortcutManager();
private: private:
void initFindResultDockWin(); void initFindResultDockWin();
@ -345,6 +371,7 @@ private:
void initReceneOpenFileMenu(); void initReceneOpenFileMenu();
int findFileIsOpenAtPad(QString filePath); int findFileIsOpenAtPad(QString filePath);
bool isNewFileNameExist(QString& fileName);
void updateCurTabSaveStatus(); void updateCurTabSaveStatus();
void setSaveButtonStatus(bool needSave); void setSaveButtonStatus(bool needSave);
void setSaveAllButtonStatus(bool needSave); void setSaveAllButtonStatus(bool needSave);
@ -359,7 +386,7 @@ private:
void cmpSelectFile(); void cmpSelectFile();
void autoSetDocLexer(ScintillaEditView * pEdit); void autoSetDocLexer(ScintillaEditView * pEdit, int defLexerId=-1);
void updateTitleToCurDocFilePath(); void updateTitleToCurDocFilePath();
void addWatchFilePath(QString filePath); void addWatchFilePath(QString filePath);
@ -367,7 +394,7 @@ private:
bool checkRoladFile(ScintillaEditView * pEdit); bool checkRoladFile(ScintillaEditView * pEdit);
void reloadEditFile(ScintillaEditView * pEidt); void reloadEditFile(ScintillaEditView * pEidt);
void initFindWindow(); void initFindWindow(FindTabIndex type= FIND_TAB);
void setToFileRightMenu(); void setToFileRightMenu();
@ -375,15 +402,19 @@ private:
bool reloadTextFileWithCode(CODE_ID code); bool reloadTextFileWithCode(CODE_ID code);
bool openBigTextFile(QString filePath); bool openSuperBigTextFile(QString filePath);
bool openBigTextRoFile(QString filePath);
void setWindowTitleMode(QString filePath, OpenAttr attr); void setWindowTitleMode(QString filePath, OpenAttr attr);
bool openTextFile(QString filePath, bool isCheckHex = true, CODE_ID code=CODE_ID::UNKOWN); bool openTextFile(QString filePath, bool isCheckHex = true, CODE_ID code=CODE_ID::UNKOWN);
bool openHexFile(QString filePath); bool openHexFile(QString filePath);
bool showHexFile(ScintillaHexEditView * pEdit, HexFileMgr * hexFile); bool showHexFile(ScintillaHexEditView * pEdit, HexFileMgr * hexFile);
bool showBigTextFile(ScintillaEditView * pEdit, TextFileMgr * hexFile); bool showBigTextFile(ScintillaEditView * pEdit, TextFileMgr * hexFile);
bool showBigTextFile(ScintillaEditView* pEdit, BigTextEditFileMgr* txtFile, int blockIndex);
void initNotePadSqlOptions(); void initNotePadSqlOptions();
void saveNotePadSqlOptions(); void saveNotePadSqlOptions();
@ -419,9 +450,15 @@ private:
void tabClose(QWidget* pEdit); void tabClose(QWidget* pEdit);
void init_toolsMenu(); void init_toolsMenu();
#ifdef NO_PLUGIN
void loadPluginLib(); void loadPluginLib();
void loadPluginProcs(QString strLibDir, QMenu* pMenu); void loadPluginProcs(QString strLibDir, QMenu* pMenu);
void onPlugFound(NDD_PROC_DATA& procData, QMenu* pUserData); void onPlugFound(NDD_PROC_DATA& procData, QMenu* pUserData);
#endif
void setUserDefShortcutKey();
void setNormalTextEditInitPro(ScintillaEditView* pEdit, QString filePath, CODE_ID code, RC_LINE_FORM lineEnd, bool isReadOnly, bool isModifyed);
private: private:
Ui::CCNotePad ui; Ui::CCNotePad ui;
@ -507,6 +544,7 @@ private:
static int s_showblank; //显示空白 static int s_showblank; //显示空白
static int s_zoomValue; static int s_zoomValue;
QTranslator* m_translator; QTranslator* m_translator;
QTimer * m_timerAutoSave; QTimer * m_timerAutoSave;
@ -539,6 +577,9 @@ private:
QToolButton* m_transcode; QToolButton* m_transcode;
QToolButton* m_rename; QToolButton* m_rename;
QAction* m_formatXml;
QAction* m_formatJson;
QPointer<QMainWindow> m_batchFindWin; QPointer<QMainWindow> m_batchFindWin;

View File

@ -363,7 +363,6 @@
<addaction name="actionAutoIt"/> <addaction name="actionAutoIt"/>
<addaction name="actionAviSynth"/> <addaction name="actionAviSynth"/>
<addaction name="actionASN1"/> <addaction name="actionASN1"/>
<addaction name="actionAVS"/>
</widget> </widget>
<widget class="QMenu" name="menuS"> <widget class="QMenu" name="menuS">
<property name="title"> <property name="title">
@ -1583,7 +1582,7 @@
</action> </action>
<action name="actionLanguage_Format"> <action name="actionLanguage_Format">
<property name="text"> <property name="text">
<string>Language Format</string> <string>Theme Style</string>
</property> </property>
</action> </action>
<action name="actionOpen_In_Text"> <action name="actionOpen_In_Text">
@ -2024,6 +2023,16 @@
<string>Show Web Addr(Not recommended)</string> <string>Show Web Addr(Not recommended)</string>
</property> </property>
</action> </action>
<action name="actionLanguage_File_Suffix">
<property name="text">
<string>Language File Suffix</string>
</property>
</action>
<action name="actionShortcut_Key_Manager">
<property name="text">
<string>Shortcut Key Manager</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>
@ -3406,6 +3415,38 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>actionLanguage_File_Suffix</sender>
<signal>triggered()</signal>
<receiver>CCNotePad</receiver>
<slot>slot_langFileSuffix()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>728</x>
<y>394</y>
</hint>
</hints>
</connection>
<connection>
<sender>actionShortcut_Key_Manager</sender>
<signal>triggered()</signal>
<receiver>CCNotePad</receiver>
<slot>slot_shortcutManager()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>728</x>
<y>394</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>slot_actionNewFile_toggle(bool)</slot> <slot>slot_actionNewFile_toggle(bool)</slot>
@ -3507,5 +3548,7 @@
<slot>slot_fileListView(bool)</slot> <slot>slot_fileListView(bool)</slot>
<slot>slot_showToolBar(bool)</slot> <slot>slot_showToolBar(bool)</slot>
<slot>slot_showWebAddr(bool)</slot> <slot>slot_showWebAddr(bool)</slot>
<slot>slot_langFileSuffix()</slot>
<slot>slot_shortcutManager()</slot>
</slots> </slots>
</ui> </ui>

View File

@ -3,6 +3,7 @@
#include "scintillahexeditview.h" #include "scintillahexeditview.h"
#include "CmpareMode.h" #include "CmpareMode.h"
#include "ccnotepad.h" #include "ccnotepad.h"
#include "progresswin.h"
#include <QMessageBox> #include <QMessageBox>
#include <QFile> #include <QFile>
@ -31,7 +32,10 @@ ScintillaHexEditView* FileManager::newEmptyHexDocument()
} }
//从尾部找前面的换行符号。返回的是需要回溯的个数 //从尾部找前面的换行符号。返回的是需要回溯的个数
int findLineEndPos(const char* buf, int size) //注意如果是LE编码字节流是\n\0的格式。从尾部往前回溯找到\n要回退1个\0。\n\0是一个整体不能分割开
//20230201发现一个bug,在LE模式下不能单纯用\n做换行识别。因为发现其它字符也存在\n必须要完整以\n\0才能确定是换行。
//同样发现BE模式下是\0\n的格式也不能单独使用\n做换行识别因为发现其他字符也存在\n必须要完整以\0\n才能确定是换行
int findLineEndPos(const char* buf, int size, CODE_ID code = UNKOWN)
{ {
int ret = 0; int ret = 0;
bool isfound = false; bool isfound = false;
@ -39,6 +43,18 @@ int findLineEndPos(const char* buf, int size)
{ {
if (buf[i] == '\n') if (buf[i] == '\n')
{ {
////如果是LE还要确定\n的下一个是否是\0
if ((code == UNICODE_LE) && ((i != size -1) && (buf[i+1] != '\0')))
{
++ret;
continue;
}
////如果是BE还要确定\n的前一个是否是\0
if ((code == UNICODE_BE) && ((i != 0) && (buf[i - 1] != '\0')))
{
++ret;
continue;
}
isfound = true; isfound = true;
break; break;
} }
@ -52,6 +68,16 @@ int findLineEndPos(const char* buf, int size)
{ {
if (buf[i] == '\r') if (buf[i] == '\r')
{ {
////如果是LE还要确定\n的下一个是否是\0
if ((code == UNICODE_LE) && ((i != size - 1) && (buf[i + 1] != '\0')))
{
continue;
}
////如果是BE还要确定\n的前一个是否是\0
if ((code == UNICODE_BE) && ((i != 0) && (buf[i - 1] != '\0')))
{
continue;
}
isfound = true; isfound = true;
break; break;
} }
@ -61,6 +87,13 @@ int findLineEndPos(const char* buf, int size)
if (isfound) if (isfound)
{ {
//注意好好想想,这里是--ret,而不是++ret。
if (code == UNICODE_LE)
{
--ret;
}
//UNICODE_BE不需要处理
return ret; return ret;
} }
@ -69,7 +102,7 @@ int findLineEndPos(const char* buf, int size)
} }
//从行首找后面的换行符号。返回的是需要前进的个数,即把前面掐掉一节,让返回在一行的行首位置 //从行首找后面的换行符号。返回的是需要前进的个数,即把前面掐掉一节,让返回在一行的行首位置
int findLineStartPos(const char* buf, int size) int findLineStartPos(const char* buf, int size, CODE_ID code = UNKOWN)
{ {
int ret = 0; int ret = 0;
bool isfound = false; bool isfound = false;
@ -78,6 +111,17 @@ int findLineStartPos(const char* buf, int size)
++ret; ++ret;
if (buf[i] == '\n') if (buf[i] == '\n')
{ {
////如果是LE还要确定\n的下一个是否是\0
if ((code == UNICODE_LE) && ((i != size - 1) && (buf[i + 1] != '\0')))
{
continue;
}
////如果是BE还要确定\n的前一个是否是\0
if ((code == UNICODE_BE) && ((i != 0) && (buf[i - 1] != '\0')))
{
continue;
}
isfound = true; isfound = true;
break; break;
} }
@ -91,6 +135,16 @@ int findLineStartPos(const char* buf, int size)
++ret; ++ret;
if (buf[i] == '\r') if (buf[i] == '\r')
{ {
////如果是LE还要确定\n的下一个是否是\0
if ((code == UNICODE_LE) && ((i != size - 1) && (buf[i + 1] != '\0')))
{
continue;
}
////如果是BE还要确定\n的前一个是否是\0
if ((code == UNICODE_BE) && ((i != 0) && (buf[i - 1] != '\0')))
{
continue;
}
isfound = true; isfound = true;
break; break;
} }
@ -99,6 +153,11 @@ int findLineStartPos(const char* buf, int size)
if (isfound) if (isfound)
{ {
//注意好好想想,这里是++ret,而不是--ret。
if (code == UNICODE_LE)
{
++ret;
}
return ret; return ret;
} }
@ -451,6 +510,11 @@ int FileManager::loadFilePreNextPage(int dir, QString& filePath, HexFileMgr* &
{ {
hexFileOut = m_hexFileMgr.value(filePath); hexFileOut = m_hexFileMgr.value(filePath);
//小于LITTLE_FILE_MAX的已经一次性全部在内存没有上下页可以翻到
if (hexFileOut->onetimeRead)
{
return 1;
}
qint64 pos = hexFileOut->fileOffset; qint64 pos = hexFileOut->fileOffset;
if (dir == 1 && (pos >= 0)) if (dir == 1 && (pos >= 0))
@ -468,7 +532,7 @@ int FileManager::loadFilePreNextPage(int dir, QString& filePath, HexFileMgr* &
} }
else else
{ {
return 1; return 1;//没有上下页,已经是最后一页或最前一页
} }
char* buf = new char[ONE_PAGE_BYTES+1]; char* buf = new char[ONE_PAGE_BYTES+1];
@ -497,7 +561,7 @@ int FileManager::loadFilePreNextPage(int dir, QString& filePath, HexFileMgr* &
return -1; return -1;
} }
const int ONE_PAGE_TEXT_SIZE = 200 * 1024; const int ONE_PAGE_TEXT_SIZE = 1000 * 1024;
//加载下一页或者上一页。(文本模式) //加载下一页或者上一页。(文本模式)
//返回值0表示成功 //返回值0表示成功
@ -555,13 +619,14 @@ int FileManager::loadFilePreNextPage(int dir, QString& filePath, TextFileMgr* &
if (dir == 2) if (dir == 2)
{ {
//读取了1M的内容从内容尾部往前查找找到第一个换行符号。如果没有怎么办说明是一个巨长的行不妙 //读取了1M的内容从内容尾部往前查找找到第一个换行符号。如果没有怎么办说明是一个巨长的行不妙
//如果是巨长的行一行超过ONE_PAGE_TEXT_SIZE1M),则可能存在单个字符截断的可能。
buf[ret] = '\0'; buf[ret] = '\0';
int preLineEndPos = 0; int preLineEndPos = 0;
if (textFileOut->file->pos() < textFileOut->fileSize)//反之已经到尾部了,不需要往前找行首了 if (textFileOut->file->pos() < textFileOut->fileSize)//反之已经到尾部了,不需要往前找行首了
{ {
preLineEndPos = findLineEndPos(buf, ret); preLineEndPos = findLineEndPos(buf, ret, (CODE_ID)textFileOut->loadWithCode);
if (preLineEndPos > 0) if (preLineEndPos > 0)
{ {
//给后面的字符填\0让字符串正常结尾\0 //给后面的字符填\0让字符串正常结尾\0
@ -587,14 +652,14 @@ int FileManager::loadFilePreNextPage(int dir, QString& filePath, TextFileMgr* &
else if (dir == 1) else if (dir == 1)
{ {
//如果是往前读取 //如果是往前读取
//读取了1M的内容内容前面往后查找,找到第一个换行符号。如果没有怎么办?说明是一个巨长的行,不妙 //读取了1M的内容内容前面往后查找,找到第一个换行符号。如果没有怎么办?说明是一个巨长的行,不妙
buf[ret] = '\0'; buf[ret] = '\0';
int preLineStartPos = 0; int preLineStartPos = 0;
if (textFileOut->file->pos() > canReadSize)//==canReadSize说明已经在文件最前面了。不在最前面需要 if (textFileOut->file->pos() > canReadSize)//==canReadSize说明已经在文件最前面了。不在最前面需要
{ {
preLineStartPos = findLineStartPos(buf, ret); preLineStartPos = findLineStartPos(buf, ret, (CODE_ID)textFileOut->loadWithCode);
if (preLineStartPos > 0) if (preLineStartPos > 0)
{ {
//把\n前面的内容去掉通过内存move的方式。 //把\n前面的内容去掉通过内存move的方式。
@ -693,7 +758,7 @@ int FileManager::loadFileFromAddr(QString filePath, qint64 addr, TextFileMgr* &
if (textFileOut->file->pos() < textFileOut->fileSize)//反之已经到尾部了,不需要往前找行了 if (textFileOut->file->pos() < textFileOut->fileSize)//反之已经到尾部了,不需要往前找行了
{ {
preLineEndPos = findLineEndPos(buf, ret); preLineEndPos = findLineEndPos(buf, ret, (CODE_ID)textFileOut->loadWithCode);
if (preLineEndPos > 0) if (preLineEndPos > 0)
{ {
//给后面的字符填\0让字符串正常结尾\0 //给后面的字符填\0让字符串正常结尾\0
@ -701,7 +766,16 @@ int FileManager::loadFileFromAddr(QString filePath, qint64 addr, TextFileMgr* &
} }
} }
int preLineStartPos = findLineStartPos(buf, ret); //如果本来就在开头开始则不需要计算findLineStartPos
int preLineStartPos = 0;
if (addr == 0)
{
}
else
{
preLineStartPos = findLineStartPos(buf, ret, (CODE_ID)textFileOut->loadWithCode);
if (preLineStartPos > 0 && preLineStartPos < ret) //preLineStartPos如果大于ret则全部都被跳过了不会显示是个特例 if (preLineStartPos > 0 && preLineStartPos < ret) //preLineStartPos如果大于ret则全部都被跳过了不会显示是个特例
{ {
memmove(buf, buf + preLineStartPos, ret - preLineStartPos); memmove(buf, buf + preLineStartPos, ret - preLineStartPos);
@ -712,7 +786,8 @@ int FileManager::loadFileFromAddr(QString filePath, qint64 addr, TextFileMgr* &
//如果没做调整则后续不需要偏移这里必须preLineStartPos赋0值 //如果没做调整则后续不需要偏移这里必须preLineStartPos赋0值
preLineStartPos = 0; preLineStartPos = 0;
} }
}
//只需要文件调到上一行的行位即可。 //只需要文件调到上一行的行位即可。
textFileOut->fileOffset = textFileOut->file->pos() - preLineEndPos; textFileOut->fileOffset = textFileOut->file->pos() - preLineEndPos;
if (preLineEndPos > 0) if (preLineEndPos > 0)
@ -745,8 +820,7 @@ bool FileManager::loadFileData(QString filePath, HexFileMgr* & hexFileOut)
return false; return false;
} }
//小于10k的文件一次性全部读取完毕
const int LITTLE_FILE_MAX = 10240;
int readBytes = 0; int readBytes = 0;
@ -783,6 +857,7 @@ bool FileManager::loadFileData(QString filePath, HexFileMgr* & hexFileOut)
hexFile->fileSize = file->size(); hexFile->fileSize = file->size();
hexFile->contentBuf = buf; hexFile->contentBuf = buf;
hexFile->contentRealSize = ret; hexFile->contentRealSize = ret;
hexFile->onetimeRead = (file->size() <= LITTLE_FILE_MAX);
m_hexFileMgr.insert(filePath, hexFile); m_hexFileMgr.insert(filePath, hexFile);
} }
else else
@ -792,6 +867,7 @@ bool FileManager::loadFileData(QString filePath, HexFileMgr* & hexFileOut)
hexFile->fileOffset = file->pos(); hexFile->fileOffset = file->pos();
hexFile->contentBuf = buf; hexFile->contentBuf = buf;
hexFile->contentRealSize = ret; hexFile->contentRealSize = ret;
hexFile->onetimeRead = (file->size() <= LITTLE_FILE_MAX);
} }
hexFileOut = hexFile; hexFileOut = hexFile;
@ -830,7 +906,10 @@ bool FileManager::loadFileData(QString filePath, TextFileMgr* & textFileOut, RC_
//读取了1M的内容从尾部往找找到第一个换行符号。如果没有怎么办说明是一个巨长的行不妙 //读取了1M的内容从尾部往找找到第一个换行符号。如果没有怎么办说明是一个巨长的行不妙
buf[ret] = '\0'; buf[ret] = '\0';
int preLineEndPos = findLineEndPos(buf,ret);
CODE_ID code = CmpareMode::getTextFileEncodeType((uchar*)buf, ret, filePath, true);
int preLineEndPos = findLineEndPos(buf,ret, code);
if (preLineEndPos > 0) if (preLineEndPos > 0)
{ {
//给后面的字符填\0让字符串正常结尾\0 //给后面的字符填\0让字符串正常结尾\0
@ -858,6 +937,8 @@ bool FileManager::loadFileData(QString filePath, TextFileMgr* & textFileOut, RC_
if (!m_bigTxtFileMgr.contains(filePath)) if (!m_bigTxtFileMgr.contains(filePath))
{ {
txtFile = new TextFileMgr(); txtFile = new TextFileMgr();
txtFile->loadWithCode = code;
txtFile->filePath = filePath; txtFile->filePath = filePath;
txtFile->file = file; txtFile->file = file;
txtFile->fileOffset = file->pos() - preLineEndPos; txtFile->fileOffset = file->pos() - preLineEndPos;
@ -889,6 +970,227 @@ bool FileManager::loadFileData(QString filePath, TextFileMgr* & textFileOut, RC_
return false; return false;
} }
//返回行的数量
int getLineNumInBuf(char* buf, int size, CODE_ID code = UNKOWN)
{
int lineNums = 0;
for (int i = 0; i < size; ++i)
{
if (buf[i] == '\n')
{
////如果是LE还要确定\n的下一个是否是\0
if ((code == UNICODE_LE) && ((i != size - 1) && (buf[i + 1] != '\0')))
{
continue;
}
//如果是BE,简单\0\n是否连续存在不能单纯检查\n,还有确定\n的前一个是不是\0
if ((code == UNICODE_BE) && ((i != 0) && (buf[i - 1] != '\0')))
{
continue;
}
++lineNums;
}
}
//如果没有找到怀疑是mac格式按照\r结尾解析
if (lineNums == 0)
{
for (int i = 0; i < size; ++i)
{
if (buf[i] == '\r')
{
////如果是LE还要确定\n的前面一个是否是\0
if ((code == UNICODE_LE) && ((i != size - 1) && (buf[i + 1] != '\0')))
{
continue;
}
//如果是BE,简单\0\n是否连续存在不能单纯检查\n,还有确定\n的前一个是不是\0
if ((code == UNICODE_BE) && ((i != 0) && (buf[i - 1] != '\0')))
{
continue;
}
++lineNums;
}
}
}
return lineNums;
}
//创建大文件编辑模式的索引文件。0 成功,-1取消
int FileManager::createBlockIndex(BigTextEditFileMgr* txtFile)
{
//每次filePtr 4M的速度进行建块
qint64 fileSize = txtFile->file->size();
qint64 curOffset = 0;
uchar* curPtr = txtFile->filePtr;
//检测是否为unicode_le编码要特殊对待。
//bool isUnLeCode = CmpareMode::isUnicodeLeBomFile(curPtr, 2);
CODE_ID code = CmpareMode::getTextFileEncodeType(curPtr, fileSize, txtFile->filePath, true);
txtFile->loadWithCode = code;
const int blockBytes = BigTextEditFileMgr::BLOCK_SIZE * 1024 * 1024;
int lineEndPos = 0;
int steps = fileSize / blockBytes;
txtFile->blocks.reserve(steps + 10);
ProgressWin* loadFileProcessWin = nullptr;
if (steps > 200)
{
loadFileProcessWin = new ProgressWin(nullptr);
loadFileProcessWin->setWindowModality(Qt::ApplicationModal);
loadFileProcessWin->info(tr("load bit text file tree in progress\nfile size %1, please wait ...").arg(tranFileSize(fileSize)));
loadFileProcessWin->setTotalSteps(steps);
loadFileProcessWin->show();
}
quint32 lineNumStart = 0;
quint32 lineNum = 0;
while ((curOffset + blockBytes) < fileSize)
{
BlockIndex bi;
bi.fileOffset = curOffset;
curOffset += blockBytes;
lineEndPos = findLineEndPos((char*)curPtr+ bi.fileOffset, blockBytes, code);
bi.fileSize = blockBytes - lineEndPos;
lineNum = getLineNumInBuf((char*)curPtr + bi.fileOffset, bi.fileSize, code);
curOffset -= lineEndPos;
bi.lineNum = lineNum;
bi.lineNumStart = lineNumStart;
lineNumStart += lineNum;
txtFile->blocks.append(bi);
if (loadFileProcessWin != nullptr)
{
if (loadFileProcessWin->isCancel())
{
delete loadFileProcessWin;
txtFile->blocks.clear();
return -1;
}
loadFileProcessWin->moveStep(true);
}
}
//最后一块
int lastBlockBytes = fileSize - curOffset;
BlockIndex bi;
bi.fileOffset = curOffset;
curOffset += lastBlockBytes;
bi.fileSize = lastBlockBytes;
lineNum = getLineNumInBuf((char*)curPtr + bi.fileOffset, bi.fileSize);
bi.lineNum = lineNum;
bi.lineNumStart = lineNumStart;
txtFile->blocks.append(bi);
if (loadFileProcessWin != nullptr)
{
delete loadFileProcessWin;
}
return 0;
}
//加载大文件,以索引的方式打开大文件
bool FileManager::loadFileDataWithIndex(QString filePath, BigTextEditFileMgr*& textFileOut)
{
QFile* file = new QFile(filePath);
file->open(QIODevice::ReadOnly);
uchar* filePtr = file->map(0, file->size());
BigTextEditFileMgr* txtFile = nullptr;
if (!m_bigTxtEditFileMgr.contains(filePath))
{
txtFile = new BigTextEditFileMgr();
txtFile->filePath = filePath;
txtFile->file = file;
txtFile->filePtr = filePtr;
textFileOut = txtFile;
if (-1 == createBlockIndex(txtFile))
{
//取消。
delete txtFile;
txtFile = nullptr;
return false;
}
m_bigTxtEditFileMgr.insert(filePath, txtFile);
}
else
{
//理论上这里永远不走
assert(false);
}
return true;
}
BigTextEditFileMgr* FileManager::getBigFileEditMgr(QString filepath)
{
if (m_bigTxtEditFileMgr.contains(filepath))
{
return m_bigTxtEditFileMgr.value(filepath);
}
return nullptr;
}
TextFileMgr* FileManager::getSuperBigFileMgr(QString filepath)
{
if (m_bigTxtFileMgr.contains(filepath))
{
return m_bigTxtFileMgr.value(filepath);
}
return nullptr;
}
int FileManager::getBigFileBlockId(QString filepath, quint32 lineNum)
{
BigTextEditFileMgr* v = m_bigTxtEditFileMgr.value(filepath);
for (int i = 0, s = v->blocks.size(); i < s; ++i)
{
const BlockIndex& k = v->blocks.at(i);
if (lineNum >= k.lineNumStart && lineNum < (k.lineNumStart + k.lineNum))
{
return i;
}
}
return -1;
}
HexFileMgr * FileManager::getHexFileHand(QString filepath) HexFileMgr * FileManager::getHexFileHand(QString filepath)
{ {
if (m_hexFileMgr.contains(filepath)) if (m_hexFileMgr.contains(filepath))
@ -910,7 +1212,7 @@ void FileManager::closeHexFileHand(QString filepath)
} }
} }
void FileManager::closeBigTextFileHand(QString filepath) void FileManager::closeSuperBigTextFileHand(QString filepath)
{ {
if (m_bigTxtFileMgr.contains(filepath)) if (m_bigTxtFileMgr.contains(filepath))
{ {
@ -921,6 +1223,16 @@ void FileManager::closeBigTextFileHand(QString filepath)
} }
} }
void FileManager::closeBigTextRoFileHand(QString filepath)
{
if (m_bigTxtEditFileMgr.contains(filepath))
{
BigTextEditFileMgr* v = m_bigTxtEditFileMgr.value(filepath);
v->destory();
delete v;
m_bigTxtEditFileMgr.remove(filepath);
}
}
//检查文件的编程语言 //检查文件的编程语言
LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data, size_t dataLen) LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data, size_t dataLen)

View File

@ -11,6 +11,9 @@
class ScintillaEditView; class ScintillaEditView;
class ScintillaHexEditView; class ScintillaHexEditView;
//小于100k的文件一次性全部读取完毕
const int LITTLE_FILE_MAX = 1024000;
enum ERROR_TYPE { enum ERROR_TYPE {
NONE_ERROR=-1, NONE_ERROR=-1,
OPEN_EMPTY_FILE=0, OPEN_EMPTY_FILE=0,
@ -35,7 +38,8 @@ struct HexFileMgr {
qint16 lineSize;//每次读取多少行默认为64行没行16个字符 qint16 lineSize;//每次读取多少行默认为64行没行16个字符
char* contentBuf; char* contentBuf;
int contentRealSize; int contentRealSize;
HexFileMgr() :file(nullptr), fileOffset(0), lineSize(64), fileSize(0), contentBuf(nullptr), contentRealSize(0) bool onetimeRead; //是否一次性全部读取到内存。小于等于LITTLE_FILE_MAX的才会全部读取
HexFileMgr() :file(nullptr), fileOffset(0), lineSize(64), fileSize(0), contentBuf(nullptr), contentRealSize(0),onetimeRead(false)
{ {
} }
@ -67,7 +71,10 @@ struct TextFileMgr {
qint16 lineSize;//每次读取多少行默认每次读取1024行。但是最大不超过1M的内容。 qint16 lineSize;//每次读取多少行默认每次读取1024行。但是最大不超过1M的内容。
char* contentBuf; char* contentBuf;
int contentRealSize; int contentRealSize;
TextFileMgr() :file(nullptr), fileOffset(0), lineSize(64), fileSize(0), contentBuf(nullptr), contentRealSize(0) int loadWithCode;
int lineEndType;//行尾类型win linux mac
TextFileMgr() :file(nullptr), fileOffset(0), lineSize(64), fileSize(0), contentBuf(nullptr), contentRealSize(0), loadWithCode(CODE_ID::UNKOWN),lineEndType(RC_LINE_FORM::UNKNOWN_LINE)
{ {
} }
@ -90,6 +97,47 @@ private:
TextFileMgr(const TextFileMgr&) = delete; TextFileMgr(const TextFileMgr&) = delete;
}; };
struct BlockIndex {
qint64 fileOffset;//块的开始地址
quint32 fileSize;//块的大小
quint32 lineNumStart;//块中行号的开始值
quint32 lineNum;//块中的行数量
};
//管理大文本文件,可以编辑的信息
struct BigTextEditFileMgr {
QString filePath;
QFile* file;
uchar* filePtr;//使用的是文件映射的方式打开
quint32 m_curBlockIndex; //当前展示中的块索引序号
int loadWithCode; //以何种编码来加载解析文件。默认UTF8
int lineEndType;//行尾类型win linux mac
static const qint16 BLOCK_SIZE = 1;//块大小单位M。开始是4M发现块越大行越多那么在一块中定位行的位置越慢
QVector<BlockIndex> blocks;//每一块的索引。打开文件的时候,需要建立该索引
BigTextEditFileMgr():filePtr(nullptr), file(nullptr), m_curBlockIndex(0), loadWithCode(CODE_ID::UNKOWN), lineEndType(RC_LINE_FORM::UNKNOWN_LINE)
{
}
void destory()
{
if (filePtr != nullptr)
{
if (file != nullptr)
{
file->unmap(filePtr);
file->close();
delete file;
file = nullptr;
}
filePtr = nullptr;
}
}
private:
BigTextEditFileMgr& operator=(const TextFileMgr&) = delete;
BigTextEditFileMgr(const TextFileMgr&) = delete;
};
class CCNotePad; class CCNotePad;
class FileManager:public QObject class FileManager:public QObject
@ -124,11 +172,21 @@ public:
bool loadFileData(QString filePath, TextFileMgr *& textFileOut, RC_LINE_FORM & lineEnd); bool loadFileData(QString filePath, TextFileMgr *& textFileOut, RC_LINE_FORM & lineEnd);
bool loadFileDataWithIndex(QString filePath, BigTextEditFileMgr*& textFileOut);
HexFileMgr* getHexFileHand(QString filepath); HexFileMgr* getHexFileHand(QString filepath);
BigTextEditFileMgr* getBigFileEditMgr(QString filepath);
TextFileMgr* getSuperBigFileMgr(QString filepath);
int getBigFileBlockId(QString filepath, quint32 lineNum);
void closeHexFileHand(QString filepath); void closeHexFileHand(QString filepath);
void closeBigTextFileHand(QString filepath); void closeSuperBigTextFileHand(QString filepath);
void closeBigTextRoFileHand(QString filepath);
LangType detectLanguageFromTextBegining(const unsigned char * data, size_t dataLen); LangType detectLanguageFromTextBegining(const unsigned char * data, size_t dataLen);
@ -150,6 +208,7 @@ public:
private: private:
FileManager(); FileManager();
~FileManager(); ~FileManager();
int createBlockIndex(BigTextEditFileMgr* txtFile);
FileManager(const FileManager&) = delete; FileManager(const FileManager&) = delete;
FileManager& operator=(const FileManager&) = delete; FileManager& operator=(const FileManager&) = delete;
@ -160,6 +219,8 @@ private:
QMap<QString, TextFileMgr*> m_bigTxtFileMgr; QMap<QString, TextFileMgr*> m_bigTxtFileMgr;
QMap<QString, BigTextEditFileMgr*> m_bigTxtEditFileMgr;
ERROR_TYPE m_lastErrorCode; ERROR_TYPE m_lastErrorCode;
}; };

View File

@ -19,7 +19,7 @@ QMap<QString, bool>* DocTypeListView::s_binFileExts = nullptr;
QStringList DocTypeListView::s_extBindFileType; QStringList DocTypeListView::s_extBindFileType;
QStringList HEX_FILE_EXTS_LIST = (QStringList() << "exe" << "dll" << "png" << "jpg" << "doc" << "docx" << "ppt" << "pptx" \ QStringList HEX_FILE_EXTS_LIST = (QStringList() << "exe" << "dll" << "png" << "jpg" << "doc" << "docx" << "ppt" << "pptx" \
<< "zip" << "gz" << "rar" << "pdf" << "7z" << "lib" << "so" << "db" << "obj" << "pdb" << "bmp" << "ico" << "qm" << "icns" << "jpeg" << "res" << "exp" << "ilk" << "deb"); << "zip" << "gz" << "rar" << "pdf" << "7z" << "lib" << "so" << "db" << "obj" << "bmp" << "ico" << "qm" << "icns" << "jpeg" << "res" << "exp" << "ilk" << "deb");
QStringList INIT_EXTS_TYPES = (QStringList() << ".txt:.log" << ".ini:.inf" << ".h:.hh:.hpp:.hxx:.c:.cpp:.cxx:.cc:.m:.mm:.vcxproj:.vcproj:.props:vsprops:mainfest:.go:.mod" \ QStringList INIT_EXTS_TYPES = (QStringList() << ".txt:.log" << ".ini:.inf" << ".h:.hh:.hpp:.hxx:.c:.cpp:.cxx:.cc:.m:.mm:.vcxproj:.vcproj:.props:vsprops:mainfest:.go:.mod" \
<< ".java:.cs:.pas:.pp:.inc" << ".html:.htm:.shtml:.shtm:.hta:.asp:.aspx:.css:.js:.json:.jsm:.jsp:.php:.php3:.php4:.php5:.phps:.phpt:.phtml:.xml:.xhtml:.xht:.xul:.kml:.xaml:.xsml" \ << ".java:.cs:.pas:.pp:.inc" << ".html:.htm:.shtml:.shtm:.hta:.asp:.aspx:.css:.js:.json:.jsm:.jsp:.php:.php3:.php4:.php5:.phps:.phpt:.phtml:.xml:.xhtml:.xht:.xul:.kml:.xaml:.xsml" \

View File

@ -60,3 +60,35 @@ bool ExtLexerManager::getLexerTypeByExt(QString ext, LexerInfo& lexer)
} }
return false; return false;
} }
//列出tag语言下面的所有关联的文件后缀列表
void ExtLexerManager::getExtlistByLangTag(QString tag, QStringList& extList)
{
for (QMap<QString, LexerInfo>::iterator it = m_extToLexerIdMap.begin(); it != m_extToLexerIdMap.end(); ++it)
{
LexerInfo& v = it.value();
if (v.tagName == tag)
{
extList.append(it.key());
}
}
}
//列出tag语言下面的所有关联的文件后缀列表
void ExtLexerManager::getExtlistByLangTag(QMap<QString,QStringList>& extLangMap)
{
for (QMap<QString, LexerInfo>::iterator it = m_extToLexerIdMap.begin(); it != m_extToLexerIdMap.end(); ++it)
{
LexerInfo& v = it.value();
if (extLangMap.contains(v.tagName))
{
extLangMap[v.tagName].append(it.key());
}
else
{
extLangMap[v.tagName] = QStringList(it.key());
}
}
}

View File

@ -55,6 +55,13 @@ public:
bool getLexerTypeByExt(QString ext, LexerInfo& lexer); bool getLexerTypeByExt(QString ext, LexerInfo& lexer);
//列出tag语言下面的所有关联的文件后缀列表
void getExtlistByLangTag(QString tag, QStringList& extList);
//列出所有语言下面的所有关联的文件后缀列表
void getExtlistByLangTag(QMap<QString, QStringList>& extLangMap);
private: private:
ExtLexerManager(); ExtLexerManager();

View File

@ -2,6 +2,8 @@
#include "findwin.h" #include "findwin.h"
#include "common.h" #include "common.h"
#include "styleset.h" #include "styleset.h"
#include "nddsetting.h"
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QStyleFactory> #include <QStyleFactory>
#include <QToolButton> #include <QToolButton>
@ -10,6 +12,7 @@
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QClipboard> #include <QClipboard>
#include <QTextEdit> #include <QTextEdit>
#include <qscrollbar.h>
#include "ndstyleditemdelegate.h" #include "ndstyleditemdelegate.h"
@ -17,7 +20,7 @@
//使用Html的转义解决了该问题 //使用Html的转义解决了该问题
FindResultWin::FindResultWin(QWidget *parent) FindResultWin::FindResultWin(QWidget *parent)
: QWidget(parent), m_menu(nullptr), m_parent(parent) : QWidget(parent), m_menu(nullptr), m_parent(parent),m_defaultFontSize(14), m_defFontSizeChange(false)
{ {
ui.setupUi(this); ui.setupUi(this);
@ -47,10 +50,37 @@ FindResultWin::FindResultWin(QWidget *parent)
// ui.resultTreeView->setStyleSheet(qss); // ui.resultTreeView->setStyleSheet(qss);
connect(ui.resultTreeView, &QTreeView::doubleClicked, this, &FindResultWin::itemDoubleClicked); connect(ui.resultTreeView, &QTreeView::doubleClicked, this, &FindResultWin::itemDoubleClicked);
connect(ui.resultTreeView, SIGNAL(pressed(QModelIndex)), this, SLOT(slot_treeView_pressed(QModelIndex)));
connect(ui.resultTreeView, SIGNAL(expanded(QModelIndex)), this, SLOT(slot_treeView_pressed(QModelIndex)));
ui.resultTreeView->verticalScrollBar()->setStyle(QStyleFactory::create("vis"));
ui.resultTreeView->horizontalScrollBar()->setStyle(QStyleFactory::create("vis"));
int defFontSize = NddSetting::getKeyValueFromNumSets(FIND_RESULT_FONT_SIZE);
if (defFontSize >= 8)
{
m_defaultFontSize = defFontSize;
QFont curFt = ui.resultTreeView->font();
curFt.setPointSize(m_defaultFontSize);
ui.resultTreeView->setFont(curFt);
m_delegate->setFontSize(m_defaultFontSize);
}
} }
FindResultWin::~FindResultWin() FindResultWin::~FindResultWin()
{ {
if (m_defFontSizeChange)
{
NddSetting::updataKeyValueFromNumSets(FIND_RESULT_FONT_SIZE, m_defaultFontSize);
}
}
void FindResultWin::slot_treeView_pressed(QModelIndex modeIndex)
{
ui.resultTreeView->resizeColumnToContents(modeIndex.column());
} }
void FindResultWin::contextMenuEvent(QContextMenuEvent *) void FindResultWin::contextMenuEvent(QContextMenuEvent *)
@ -71,6 +101,8 @@ void FindResultWin::contextMenuEvent(QContextMenuEvent *)
m_menu->addAction(tr("copy select Line (Ctrl Muli)"), this, &FindResultWin::slot_copyContents); m_menu->addAction(tr("copy select Line (Ctrl Muli)"), this, &FindResultWin::slot_copyContents);
m_menu->addSeparator(); m_menu->addSeparator();
m_menu->addAction(tr("Zoom In"), this, &FindResultWin::slot_fontZoomIn);
m_menu->addAction(tr("Zoom Out"), this, &FindResultWin::slot_fontZoomOut);
m_menu->addAction(tr("close"), m_parent, &QWidget::close); m_menu->addAction(tr("close"), m_parent, &QWidget::close);
} }
@ -370,7 +402,7 @@ void FindResultWin::highlightFindText(int index, QString &srcText, QString &find
} }
index--; index--;
} }
srcText.replace(pos, lens, QString("<font style='background-color:#ffffbf'>%1</font>").arg(srcText.mid(pos,lens))); srcText.replace(pos, lens, QString("<font style='font-size:14px;background-color:#ffffbf'>%1</font>").arg(srcText.mid(pos,lens)));
} }
const int MAX_HEAD_LENTGH = 20; const int MAX_HEAD_LENTGH = 20;
@ -403,9 +435,9 @@ QString FindResultWin::highlightFindText(FindRecord& record)
{ {
if (!isNeedCut) if (!isNeedCut)
{ {
head = QString(utf8bytes.mid(0, targetStart)).toHtmlEscaped(); head = QString("<font style='font-size:14px;'>%1</font>").arg(QString(utf8bytes.mid(0, targetStart)).toHtmlEscaped());
src = QString("<font style='background-color:#ffffbf'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped()); src = QString("<font style='font-size:14px;background-color:#ffffbf'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
tail = QString(utf8bytes.mid(tailStart)).toHtmlEscaped(); tail = QString("<font style='font-size:14px;'>%1</font>").arg(QString(utf8bytes.mid(tailStart)).toHtmlEscaped());
} }
else else
{ {
@ -418,7 +450,8 @@ QString FindResultWin::highlightFindText(FindRecord& record)
{ {
head = head.toHtmlEscaped(); head = head.toHtmlEscaped();
} }
src = QString("<font style='background-color:#ffffbf'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped()); head = QString("<font style='font-size:14px;'>%1</font>").arg(head);
src = QString("<font style='font-size:14px;background-color:#ffffbf'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
tail = QString(utf8bytes.mid(tailStart)); tail = QString(utf8bytes.mid(tailStart));
if (tail > MAX_TAIL_LENGTH) if (tail > MAX_TAIL_LENGTH)
{ {
@ -428,15 +461,16 @@ QString FindResultWin::highlightFindText(FindRecord& record)
{ {
tail = tail.toHtmlEscaped(); tail = tail.toHtmlEscaped();
} }
tail = QString("<font style='font-size:14px;'>%1</font>").arg(tail);
} }
} }
else else
{ {
if (!isNeedCut) if (!isNeedCut)
{ {
head = QString("<font style='color:#dcdcdc'>%1</font>").arg(QString(utf8bytes.mid(0, targetStart)).toHtmlEscaped()); head = QString("<font style='font-size:14px;color:#dcdcdc'>%1</font>").arg(QString(utf8bytes.mid(0, targetStart)).toHtmlEscaped());
src = QString("<font style='font-weight:bold;color:#ffaa00'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped()); src = QString("<font style='font-size:14px;font-weight:bold;color:#ffaa00'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
tail = QString("<font style='color:#dcdcdc'>%1</font>").arg(QString(utf8bytes.mid(tailStart)).toHtmlEscaped()); tail = QString("<font style='font-size:14px;color:#dcdcdc'>%1</font>").arg(QString(utf8bytes.mid(tailStart)).toHtmlEscaped());
} }
else else
{ {
@ -450,8 +484,8 @@ QString FindResultWin::highlightFindText(FindRecord& record)
headContens = headContens.toHtmlEscaped(); headContens = headContens.toHtmlEscaped();
} }
head = QString("<font style='color:#dcdcdc'>%1</font>").arg(headContens); head = QString("<font style='font-size:14px;color:#dcdcdc'>%1</font>").arg(headContens);
src = QString("<font style='font-weight:bold;color:#ffaa00'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped()); src = QString("<font style='font-size:14px;font-weight:bold;color:#ffaa00'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
QString tailContens = QString(utf8bytes.mid(tailStart)); QString tailContens = QString(utf8bytes.mid(tailStart));
if (tailContens > MAX_TAIL_LENGTH) if (tailContens > MAX_TAIL_LENGTH)
@ -462,7 +496,7 @@ QString FindResultWin::highlightFindText(FindRecord& record)
{ {
tailContens = tailContens.toHtmlEscaped(); tailContens = tailContens.toHtmlEscaped();
} }
tail = QString("<font style='color:#dcdcdc'>%1</font>").arg(tailContens); tail = QString("<font style='font-size:14px;color:#dcdcdc'>%1</font>").arg(tailContens);
} }
} }
@ -476,18 +510,27 @@ void FindResultWin::appendResultsToShow(FindRecords* record)
return; return;
} }
QString findTitle = tr("<font style='font-weight:bold;color:#343497'>Search \"%1\" (%2 hits)</font>").arg(record->findText.toHtmlEscaped()).arg(record->records.size()); QString findTitle;
//if (!StyleSet::isCurrentDeepStyle())
//{
findTitle = tr("<font style='font-size:14px;font-weight:bold;color:#343497'>Search \"%1\" (%2 hits)</font>").arg(record->findText.toHtmlEscaped()).arg(record->records.size());
/*}
else
{
findTitle = tr("<font style='font-size:14px;font-weight:bold;color:#ffffff'>Search \"%1\" (%2 hits)</font>").arg(record->findText.toHtmlEscaped()).arg(record->records.size());
}*/
QStandardItem* titleItem = new QStandardItem(findTitle); QStandardItem* titleItem = new QStandardItem(findTitle);
if (!StyleSet::isCurrentDeepStyle()) //if (!StyleSet::isCurrentDeepStyle())
{ //{
setItemBackground(titleItem, QColor(0xbbbbff)); setItemBackground(titleItem, QColor(0xbbbbff));
} //}
else //else
{ //{
setItemBackground(titleItem, QColor(0xd5ffd5)); // setItemBackground(titleItem, QColor(0x423328));//0xd5ffd5
} //}
m_model->insertRow(0, titleItem); m_model->insertRow(0, titleItem);
titleItem->setData(QVariant(true), ResultItemRoot); titleItem->setData(QVariant(true), ResultItemRoot);
@ -509,11 +552,11 @@ void FindResultWin::appendResultsToShow(FindRecords* record)
QString desc; QString desc;
if (!StyleSet::isCurrentDeepStyle()) if (!StyleSet::isCurrentDeepStyle())
{ {
desc = tr("<font style='font-weight:bold;color:#309730'>%1 (%2 hits)</font>").arg(record->findFilePath.toHtmlEscaped()).arg(record->records.size()); desc = tr("<font style='font-size:14px;font-weight:bold;color:#309730'>%1 (%2 hits)</font>").arg(record->findFilePath.toHtmlEscaped()).arg(record->records.size());
} }
else else
{ {
desc = tr("<font style='color:#99cc99'>%1 (%2 hits)</font>").arg(record->findFilePath.toHtmlEscaped()).arg(record->records.size()); desc = tr("<font style='font-size:14px;color:#99cc99'>%1 (%2 hits)</font>").arg(record->findFilePath.toHtmlEscaped()).arg(record->records.size());
} }
QStandardItem* descItem = new QStandardItem(desc); QStandardItem* descItem = new QStandardItem(desc);
@ -545,8 +588,15 @@ void FindResultWin::appendResultsToShow(FindRecords* record)
QString richText = highlightFindText(v); QString richText = highlightFindText(v);
QString text = tr("<font style='color:#ff8040'>Line %1</font> : %2").arg(v.lineNum + 1).arg(richText); QString text;
if (!StyleSet::isCurrentDeepStyle())
{
text = tr("<font style='font-size:14px;'>Line </font><font style='font-size:14px;color:#ff8040'>%1</font> : %2").arg(v.lineNum + 1).arg(richText);
}
else
{
text = tr("<font style='font-size:14px;color:#ffffff'>Line </font><font style='font-size:14px;color:#ff8040'>%1</font> : %2").arg(v.lineNum + 1).arg(richText);
}
QStandardItem* childItem = new QStandardItem(text); QStandardItem* childItem = new QStandardItem(text);
childItem->setData(QVariant(v.pos), ResultItemPos); childItem->setData(QVariant(v.pos), ResultItemPos);
childItem->setData(QVariant(v.end - v.pos), ResultItemLen); childItem->setData(QVariant(v.end - v.pos), ResultItemLen);
@ -566,7 +616,7 @@ void FindResultWin::appendResultsToShow(QVector<FindRecords*>* record, int hits,
return; return;
} }
QString findTitle = tr("<font style='font-weight:bold;color:#343497'>Search \"%1\" (%2 hits in %3 files)</font>").arg(whatFind.toHtmlEscaped()).arg(hits).arg(record->size()); QString findTitle = tr("<font style='font-size:14px;font-weight:bold;color:#343497'>Search \"%1\" (%2 hits in %3 files)</font>").arg(whatFind.toHtmlEscaped()).arg(hits).arg(record->size());
QStandardItem* titleItem = new QStandardItem(findTitle); QStandardItem* titleItem = new QStandardItem(findTitle);
setItemBackground(titleItem, QColor(0xbbbbff)); setItemBackground(titleItem, QColor(0xbbbbff));
titleItem->setData(QVariant(true), ResultItemRoot); titleItem->setData(QVariant(true), ResultItemRoot);
@ -594,8 +644,16 @@ void FindResultWin::appendResultsToShow(QVector<FindRecords*>* record, int hits,
{ {
FindRecords* pr = record->at(i); FindRecords* pr = record->at(i);
QString desc = tr("<font style='font-weight:bold;color:#309730'>%1 (%2 hits)</font>").arg(pr->findFilePath.toHtmlEscaped()).arg(pr->records.size()); QString desc;
if (!StyleSet::isCurrentDeepStyle())
{
desc = tr("<font style='font-size:14px;font-weight:bold;color:#309730'>%1 (%2 hits)</font>").arg(pr->findFilePath.toHtmlEscaped()).arg(pr->records.size());
}
else
{
desc = tr("<font style='font-size:14px;color:#99cc99'>%1 (%2 hits)</font>").arg(pr->findFilePath.toHtmlEscaped()).arg(pr->records.size());
}
QStandardItem* descItem = new QStandardItem(desc); QStandardItem* descItem = new QStandardItem(desc);
if (!StyleSet::isCurrentDeepStyle()) if (!StyleSet::isCurrentDeepStyle())
@ -627,8 +685,15 @@ void FindResultWin::appendResultsToShow(QVector<FindRecords*>* record, int hits,
FindRecord v = pr->records.at(i); FindRecord v = pr->records.at(i);
QString richText = highlightFindText(v); QString richText = highlightFindText(v);
QString text = QString("<font style='color:#ff8040'>Line %1</font> : %2").arg(v.lineNum + 1).arg(richText); QString text;
if (!StyleSet::isCurrentDeepStyle())
{
text = tr("<font style='font-size:14px;'>Line </font><font style='font-size:14px;color:#ff8040'>%1</font> : %2").arg(v.lineNum + 1).arg(richText);
}
else
{
text = tr("<font style='font-size:14px;color:#ffffff'>Line </font><font style='font-size:14px;color:#ff8040'>%1</font> : %2").arg(v.lineNum + 1).arg(richText);
}
QStandardItem* childItem = new QStandardItem(text); QStandardItem* childItem = new QStandardItem(text);
childItem->setData(QVariant(v.pos), ResultItemPos); childItem->setData(QVariant(v.pos), ResultItemPos);
childItem->setData(QVariant(v.end - v.pos), ResultItemLen); childItem->setData(QVariant(v.end - v.pos), ResultItemLen);
@ -655,3 +720,48 @@ void FindResultWin::setItemForeground(QStandardItem* item, const QColor& color)
QBrush b(color); QBrush b(color);
item->setForeground(b); item->setForeground(b);
} }
//查找结果框的字体变大
void FindResultWin::slot_fontZoomIn()
{
QFont curFt = ui.resultTreeView->font();
int s = curFt.pointSize();
s += 2;
curFt.setPointSize(s);
m_defaultFontSize += 2;
ui.resultTreeView->setFont(curFt);
m_delegate->setFontSize(m_defaultFontSize);
m_defFontSizeChange = true;
}
void FindResultWin::slot_fontZoomOut()
{
QFont curFt = ui.resultTreeView->font();
int s = curFt.pointSize();
s -= 2;
if (s >= 8)
{
m_defFontSizeChange = true;
m_defaultFontSize -= 2;
curFt.setPointSize(s);
ui.resultTreeView->setFont(curFt);
m_delegate->setFontSize(m_defaultFontSize);
}
}
int FindResultWin::getDefaultFontSize()
{
return m_defaultFontSize;
}
void FindResultWin::setDefaultFontSize(int defSize)
{
m_defaultFontSize = defSize;
}

View File

@ -21,7 +21,8 @@ public:
void appendResultsToShow(FindRecords * record); void appendResultsToShow(FindRecords * record);
void appendResultsToShow(QVector<FindRecords*>* record, int hits, QString whatFind); void appendResultsToShow(QVector<FindRecords*>* record, int hits, QString whatFind);
int getDefaultFontSize();
void setDefaultFontSize(int defSize);
signals: signals:
void itemDoubleClicked(const QModelIndex &index); void itemDoubleClicked(const QModelIndex &index);
void showMsg(QString &msg); void showMsg(QString &msg);
@ -32,6 +33,9 @@ private slots:
void slot_copyContents(); void slot_copyContents();
void slot_copyItemContents(); void slot_copyItemContents();
void slot_selectSection(); void slot_selectSection();
void slot_treeView_pressed(QModelIndex modeIndex);
void slot_fontZoomIn();
void slot_fontZoomOut();
public slots: public slots:
void slot_clearAllContents(); void slot_clearAllContents();
@ -53,4 +57,6 @@ private:
NdStyledItemDelegate* m_delegate; NdStyledItemDelegate* m_delegate;
QWidget* m_parent; QWidget* m_parent;
int m_defaultFontSize;
bool m_defFontSizeChange;
}; };

View File

@ -55,9 +55,6 @@
<property name="horizontalScrollBarPolicy"> <property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum> <enum>Qt::ScrollBarAsNeeded</enum>
</property> </property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::DoubleClicked</set> <set>QAbstractItemView::DoubleClicked</set>
</property> </property>

View File

@ -72,13 +72,34 @@ void FindWin::slot_tabIndexChange(int index)
{ {
TAB_TYPES type = (TAB_TYPES)index; TAB_TYPES type = (TAB_TYPES)index;
if (RELPACE_TYPE == type)
{
if (ui.replaceTextBox->currentText().isEmpty() && !ui.findComboBox->currentText().isEmpty())
{
if (ui.findComboBox->currentText().size() < 255)
{
ui.replaceTextBox->setCurrentText(ui.findComboBox->currentText());
}
}
}
else if(FIND_TYPE == type)
{
if (ui.findComboBox->currentText().isEmpty() && !ui.replaceTextBox->currentText().isEmpty())
{
if (ui.replaceTextBox->currentText().size() < 255)
{
ui.findComboBox->setCurrentText(ui.replaceTextBox->currentText());
}
}
}
m_isFindFirst = true; m_isFindFirst = true;
if (m_findHistory->isEmpty()) if (m_findHistory->isEmpty())
{ {
return; return;
} }
} }
void FindWin::slot_dealFileTypeChange(int state) void FindWin::slot_dealFileTypeChange(int state)
{ {
@ -144,6 +165,18 @@ void FindWin::setFindText(QString &text)
addFindHistory(text); addFindHistory(text);
} }
void FindWin::setReplaceFindText(QString& text)
{
ui.replaceTextBox->setEditText(text);
addFindHistory(text);
}
void FindWin::setDirFindText(QString& text)
{
ui.dirFindWhat->setEditText(text);
addFindHistory(text);
}
void FindWin::disableReplace() void FindWin::disableReplace()
{ {
ui.tab_replace->setEnabled(false); ui.tab_replace->setEnabled(false);
@ -201,7 +234,7 @@ void FindWin::removeLineHeadEndBlank(int mode)
{ {
ui.replaceTextBox->setCurrentText("\\s+$"); ui.replaceTextBox->setCurrentText("\\s+$");
} }
ui.replaceWithBox->setCurrentText(""); ui.replaceWithBox->setText("");
ui.replaceModeRegularBt->setChecked(true); ui.replaceModeRegularBt->setChecked(true);
@ -355,9 +388,9 @@ void FindWin::updateParameterFromUI()
m_isFindFirst = true; m_isFindFirst = true;
} }
if (m_replaceWithText != ui.replaceWithBox->currentText()) if (m_replaceWithText != ui.replaceWithBox->text())
{ {
m_replaceWithText = ui.replaceWithBox->currentText(); m_replaceWithText = ui.replaceWithBox->text();
m_isFindFirst = true; m_isFindFirst = true;
} }
@ -417,9 +450,9 @@ void FindWin::updateParameterFromUI()
m_isFindFirst = true; m_isFindFirst = true;
} }
if (m_replaceWithText != ui.dirReplaceWhat->currentText()) if (m_replaceWithText != ui.dirReplaceWhat->text())
{ {
m_replaceWithText = ui.dirReplaceWhat->currentText(); m_replaceWithText = ui.dirReplaceWhat->text();
m_isFindFirst = true; m_isFindFirst = true;
} }
@ -523,6 +556,11 @@ void FindWin::updateParameterFromUI()
void FindWin::addFindHistory(QString &text) void FindWin::addFindHistory(QString &text)
{ {
//太长会导致看起来很杂乱,也不记录
if (text.isEmpty() || text.size() >= 255)
{
return;
}
if ((m_findHistory != nullptr) && (-1 == m_findHistory->indexOf(text))) if ((m_findHistory != nullptr) && (-1 == m_findHistory->indexOf(text)))
{ {
m_findHistory->push_front(text); m_findHistory->push_front(text);
@ -712,7 +750,7 @@ void FindWin::removeEmptyLine(bool isBlankContained)
{ {
ui.replaceTextBox->setCurrentText("^$(\\r\\n|\\r|\\n)"); ui.replaceTextBox->setCurrentText("^$(\\r\\n|\\r|\\n)");
} }
ui.replaceWithBox->setCurrentText(""); ui.replaceWithBox->setText("");
ui.replaceModeRegularBt->setChecked(true); ui.replaceModeRegularBt->setChecked(true);
@ -1080,12 +1118,12 @@ int FindWin::replaceAtBack(QStringList& keyword, QStringList& replace)
} }
ui.replaceTextBox->setCurrentText(keyword.at(i)); ui.replaceTextBox->setCurrentText(keyword.at(i));
ui.replaceWithBox->setCurrentText(replace.at(i)); ui.replaceWithBox->setText(replace.at(i));
updateParameterFromUI(); updateParameterFromUI();
QString whatFind = ui.replaceTextBox->currentText(); QString whatFind = ui.replaceTextBox->currentText();
QString replaceText = ui.replaceWithBox->currentText(); QString replaceText = ui.replaceWithBox->text();
times += doReplaceAll(pEdit, whatFind, replaceText, false); times += doReplaceAll(pEdit, whatFind, replaceText, false);
@ -1384,7 +1422,7 @@ bool FindWin::replace(ScintillaEditView* pEdit)
} }
QString findText = ui.replaceTextBox->currentText(); QString findText = ui.replaceTextBox->currentText();
QString replaceText = ui.replaceWithBox->currentText(); QString replaceText = ui.replaceWithBox->text();
if (m_extend) if (m_extend)
{ {
@ -1750,7 +1788,7 @@ int FindWin::replaceAll()
updateParameterFromUI(); updateParameterFromUI();
QString whatFind = ui.replaceTextBox->currentText(); QString whatFind = ui.replaceTextBox->currentText();
QString replaceText = ui.replaceWithBox->currentText(); QString replaceText = ui.replaceWithBox->text();
if (m_extend) if (m_extend)
{ {
@ -2445,7 +2483,7 @@ void FindWin::slot_dirReplaceAll()
{ {
QString dirPath = ui.destFindDir->text(); QString dirPath = ui.destFindDir->text();
QString whatFind = ui.dirFindWhat->currentText(); QString whatFind = ui.dirFindWhat->currentText();
QString dirReplaceWhat = ui.dirReplaceWhat->currentText(); QString dirReplaceWhat = ui.dirReplaceWhat->text();
if (dirPath.isEmpty()) if (dirPath.isEmpty())
{ {

View File

@ -63,6 +63,8 @@ public:
void setCurrentTab(FindTabIndex index); void setCurrentTab(FindTabIndex index);
void setTabWidget(QTabWidget * editTabWidget); void setTabWidget(QTabWidget * editTabWidget);
void setFindText(QString & text); void setFindText(QString & text);
void setReplaceFindText(QString& text);
void setDirFindText(QString& text);
void disableReplace(); void disableReplace();
void setFindHistory(QList<QString>* findHistory); void setFindHistory(QList<QString>* findHistory);
int markAllWord(QString& word); int markAllWord(QString& word);

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>633</width> <width>689</width>
<height>384</height> <height>384</height>
</rect> </rect>
</property> </property>
@ -396,7 +396,13 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="replaceWithBox"> <widget class="QLineEdit" name="replaceWithBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>300</width> <width>300</width>
@ -409,9 +415,6 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="editable">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -777,25 +780,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QComboBox" name="dirReplaceWhat">
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="dealFileType"> <widget class="QCheckBox" name="dealFileType">
<property name="sizePolicy"> <property name="sizePolicy">
@ -863,6 +847,28 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLineEdit" name="dirReplaceWhat">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -1392,7 +1398,6 @@
<tabstop>findModeNormalBt</tabstop> <tabstop>findModeNormalBt</tabstop>
<tabstop>findModeRegularBt</tabstop> <tabstop>findModeRegularBt</tabstop>
<tabstop>replaceTextBox</tabstop> <tabstop>replaceTextBox</tabstop>
<tabstop>replaceWithBox</tabstop>
<tabstop>replaceBackwardBox</tabstop> <tabstop>replaceBackwardBox</tabstop>
<tabstop>replaceMatchWholeBox</tabstop> <tabstop>replaceMatchWholeBox</tabstop>
<tabstop>replaceMatchCaseBox</tabstop> <tabstop>replaceMatchCaseBox</tabstop>

View File

@ -0,0 +1,66 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Notepad--"
#define MyAppVersion "1.22.0"
#define MyAppPublisher "ndd¿ªÔ´×éÖ¯"
#define MyAppURL "https://gitee.com/cxasm/notepad--"
#define MyAppExeName "Notepad--.exe"
#define MyAppAssocName "nddfile"
#define MyAppAssocExt ".txt"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{FA6189F1-03B8-44A2-BE8E-F6CD8E7857B6}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ArchitecturesInstallIn64BitMode=x64
DefaultDirName={autopf}\{#MyAppName}
ChangesAssociations=yes
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputDir=D:\CCNotePad\installer
OutputBaseFilename=Notepad--v1.22.0-Installer
SetupIconFile=D:\CCNotePad\Resources\edit\global\ndd.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "ChineseSimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "D:\CCNotePad\x64\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\CCNotePad\x64\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Registry]
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--"; ValueType: string; ValueName: ""; ValueData: "Edit with Notepad--"; Flags: uninsdeletekey
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\{#MyAppExeName}"""
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" ;
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

228
src/langextset.cpp Executable file
View File

@ -0,0 +1,228 @@
#include "langextset.h"
#include "scintillaeditview.h"
#include "extlexermanager.h"
#include "ccnotepad.h"
#include <qtablewidget.h>
#include <QHeaderView>
#include <QSettings>
#include <QMessageBox>
int ITEM_CHANGED = Qt::UserRole;
int ITEM_LEX_ID = Qt::UserRole + 1; //对应的语法lexer的 ID
int ITEM_LEX_EXT_OLD_VALUE = Qt::UserRole + 2; //对应的语法关联EXT文件的旧值
LangExtSet::LangExtSet(QWidget *parent)
: QMainWindow(parent), m_isChanged(false)
{
ui.setupUi(this);
ui.langTableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
initLangName();
connect(ui.langTableWidget, &QTableWidget::itemChanged, this, &LangExtSet::slot_itemChanged);
connect(ui.langTableWidget, &QTableWidget::currentItemChanged, this, &LangExtSet::slot_currentItemChanged);
}
LangExtSet::~LangExtSet()
{}
void LangExtSet::initLangName()
{
int langId = 0;
QMap<QString, QStringList> extLangMap;
ExtLexerManager::getInstance()->getExtlistByLangTag(extLangMap);
for (int i = 0; i <= L_TXT; ++i)
{
if (i == L_GLOBAL)
{
continue;
}
QsciLexer* pLexer = ScintillaEditView::createLexer(i);
if (nullptr != pLexer)
{
QString langName = pLexer->lexerTag();
QTableWidgetItem* item = new QTableWidgetItem(langName);
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
item->setData(ITEM_LEX_ID, QVariant(i));
ui.langTableWidget->insertRow(langId);
ui.langTableWidget->setItem(langId, 0, item);
QStringList extList;
if (extLangMap.contains(langName))
{
extList = extLangMap.value(langName);
}
QTableWidgetItem* item1 = new QTableWidgetItem(extList.join(','));
item1->setData(ITEM_CHANGED, QVariant(false));
//把旧值记起来,后面修改后对比实时修改内存中的改动
item1->setData(ITEM_LEX_EXT_OLD_VALUE, QVariant(extList));
ui.langTableWidget->setItem(langId, 1, item1);
delete pLexer;
++langId;
}
}
ui.langTableWidget->sortItems(0, Qt::AscendingOrder);
}
void LangExtSet::slot_itemChanged(QTableWidgetItem* item)
{
item->setData(ITEM_CHANGED, QVariant(true));
slot_currentItemChanged(item, nullptr);
if (!m_isChanged)
{
m_isChanged = true;
}
}
void LangExtSet::slot_currentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous)
{
if (current != nullptr)
{
int row = current->row();
QTableWidgetItem* tagItem = ui.langTableWidget->item(row, 0);
QTableWidgetItem* extItem = ui.langTableWidget->item(row, 1);
if (tagItem != nullptr && extItem != nullptr)
{
ui.plainTextEdit->setPlainText(tr("current lang: %1 \next file suffix is : %2\nDouble-click a column item to modify the syntax association file.").arg(tagItem->text()).arg(extItem->text()));
}
}
}
void LangExtSet::slot_save()
{
if (!m_isChanged)
{
ui.statusBar->showMessage(tr("Not change, no need save !"), 10000);
return;
}
int rowNums = ui.langTableWidget->rowCount();
QString userLangFile = QString("notepad/tag_ext");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
qs.setIniCodec("UTF-8");
for (int i = 0; i < rowNums; ++i)
{
QTableWidgetItem* item = ui.langTableWidget->item(i, 1);
if (item != nullptr && item->data(ITEM_CHANGED).toBool())
{
QTableWidgetItem* langItem = ui.langTableWidget->item(i, 0);
if (langItem != nullptr)
{
QString langTag = langItem->text();
int lexId = langItem->data(ITEM_LEX_ID).toInt();
QStringList extList = item->text().split(',');
for (int i = extList.size() - 1; i >= 0; --i)
{
if (extList.at(i).isEmpty())
{
extList.removeAt(i);
}
}
qs.setValue(langTag, extList);
QString langLexerTag = QString("%1_lexId").arg(langTag);
qs.setValue(langLexerTag, lexId);
//上面是更新文件,下面是更新内存,让实时生效
QStringList oldExtList = item->data(ITEM_LEX_EXT_OLD_VALUE).toStringList();
updataExtLexerManager(langTag, lexId, oldExtList, extList);
//更新新值。因为可能不关闭时再次修改
item->setData(ITEM_LEX_EXT_OLD_VALUE, QVariant(extList));
}
}
}
qs.sync();
m_isChanged = false;
ui.statusBar->showMessage(tr("Save Finished !"), 10000);
}
//更新ExtLexerManager中tag关联的值
void LangExtSet::updataExtLexerManager(QString tag, int lexId, QStringList & oldExtList, QStringList & newExtList)
{
//把旧的直接删除
for (int i = 0; i < oldExtList.size(); ++i)
{
ExtLexerManager::getInstance()->remove(oldExtList.at(i));
}
//把新的重新加入一遍
for (int i = 0; i < newExtList.size(); ++i)
{
FileExtLexer v;
v.ext = newExtList.at(i);
v.id = (LangType)lexId;
ExtLexerManager::getInstance()->addNewExtType(v.ext, v.id, tag);
}
}
//加载文件的关联后缀到语法中
void LangExtSet::loadExtRelevanceToMagr()
{
QString userLangFile = QString("notepad/tag_ext");//自定义语言中不能有.字符,否则可能有错,后续要检查
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
qs.setIniCodec("UTF-8");
if (!QFile::exists(qs.fileName()))
{
return;
}
QStringList keylist = qs.allKeys();
QString langTag;
QStringList extList;
QString key_id;
int lexid = 0;
for (int i = 0; i < keylist.size(); ++i)
{
langTag = keylist.at(i);
if (langTag.endsWith("_lexId"))
{
continue;
}
key_id = QString("%1_lexId").arg(langTag);
extList = qs.value(langTag).toStringList();
lexid = qs.value(key_id).toInt();
for (int j = 0; j < extList.size(); ++j)
{
FileExtLexer v;
v.ext = extList.at(j);
v.id = (LangType)lexid;
ExtLexerManager::getInstance()->addNewExtType(v.ext, v.id, langTag);
}
}
}
void LangExtSet::closeEvent(QCloseEvent* e)
{
if (m_isChanged)
{
if (QMessageBox::Yes == QMessageBox::question(this, tr("Save Change"), tr("Configuration has been modified. Do you want to save it?")))
{
slot_save();
}
}
}

30
src/langextset.h Executable file
View File

@ -0,0 +1,30 @@
#pragma once
#include <QMainWindow>
#include "ui_langextset.h"
class LangExtSet : public QMainWindow
{
Q_OBJECT
public:
LangExtSet(QWidget *parent = nullptr);
~LangExtSet();
static void loadExtRelevanceToMagr();
private:
void initLangName();
void updataExtLexerManager(QString tag, int lexId, QStringList& oldExtList, QStringList& newExtList);
protected:
void closeEvent(QCloseEvent* e);
private slots:
void slot_itemChanged(QTableWidgetItem* item);
void slot_currentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
void slot_save();
private:
Ui::LangExtSetClass ui;
bool m_isChanged;
};

149
src/langextset.ui Executable file
View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LangExtSetClass</class>
<widget class="QMainWindow" name="LangExtSetClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>809</width>
<height>504</height>
</rect>
</property>
<property name="windowTitle">
<string>LangExtSet</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QTableWidget" name="langTableWidget">
<column>
<property name="text">
<string>Language</string>
</property>
</column>
<column>
<property name="text">
<string>File Suffix</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>LangExtSetClass</receiver>
<slot>slot_save()</slot>
<hints>
<hint type="sourcelabel">
<x>374</x>
<y>466</y>
</hint>
<hint type="destinationlabel">
<x>394</x>
<y>509</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>LangExtSetClass</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>467</x>
<y>467</y>
</hint>
<hint type="destinationlabel">
<x>529</x>
<y>479</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>slot_save()</slot>
</slots>
</ui>

View File

@ -31,9 +31,9 @@
#include <qt_windows.h> #include <qt_windows.h>
const ULONG_PTR CUSTOM_TYPE = 10000; const ULONG_PTR CUSTOM_TYPE = 10000;
const ULONG_PTR OPEN_NOTEPAD_TYPE = 10001; const ULONG_PTR OPEN_NOTEPAD_TYPE = 10001;
bool s_isAdminAuth = false;
#endif #endif
bool s_isAdminAuth = false;
const QString c_strTitle = "Ndd"; const QString c_strTitle = "Ndd";
@ -352,8 +352,20 @@ drop_old:
if (arguments.size() == 2) if (arguments.size() == 2)
{ {
#ifdef Q_OS_WIN
if (!s_isAdminAuth)
{
pMainNotepad->openFile(arguments[1]);
}
else
{
//如果是管理员,还不能直接打开文件,需要恢复之前文件的修改内容
//恢复不了,再直接打开
pMainNotepad->tryRestoreFile(arguments[1]);
}
#else
pMainNotepad->openFile(arguments[1]); pMainNotepad->openFile(arguments[1]);
pMainNotepad->showNormal(); #endif
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
pMainNotepad->checkAppFont(); pMainNotepad->checkAppFont();

View File

@ -7,7 +7,7 @@
#include <QStorageInfo> #include <QStorageInfo>
#include <QSettings> #include <QSettings>
static short version_num = 29; //1.22.0 是29
//配置文件是否存在。如果初始化失败,则不存在 //配置文件是否存在。如果初始化失败,则不存在
bool NddSetting::s_isExistDb = false; bool NddSetting::s_isExistDb = false;
int NddSetting::s_reference = 0; int NddSetting::s_reference = 0;
@ -15,7 +15,7 @@ bool NddSetting::s_isContentChanged = false;
QSettings* NddSetting::s_nddSet = nullptr; QSettings* NddSetting::s_nddSet = nullptr;
const int version_num = 25; QSettings* NddSetting::s_winPosSet = nullptr;
//如果key不存在则新增key-value。存在返回true //如果key不存在则新增key-value。存在返回true
bool NddSetting::checkNoExistAdd(QString key, QVariant& value) bool NddSetting::checkNoExistAdd(QString key, QVariant& value)
@ -115,6 +115,9 @@ void NddSetting::init()
//打开网页,默认不勾选,资源耗费多 //打开网页,默认不勾选,资源耗费多
addKeyValueToNumSets(SHOWWEBADDR, 0); addKeyValueToNumSets(SHOWWEBADDR, 0);
//查找结果框的默认字体大小
addKeyValueToNumSets(FIND_RESULT_FONT_SIZE, 14);
}; };
if (!s_nddSet->contains(VERSION)) if (!s_nddSet->contains(VERSION))
@ -220,6 +223,10 @@ void NddSetting::init()
QVariant v(0); QVariant v(0);
checkNoExistAdd(SHOWWEBADDR, v); checkNoExistAdd(SHOWWEBADDR, v);
} }
{
QVariant v(14);
checkNoExistAdd(FIND_RESULT_FONT_SIZE, v);
}
} while (false); } while (false);
} }
@ -301,7 +308,39 @@ void NddSetting::close()
s_nddSet = nullptr; s_nddSet = nullptr;
s_isContentChanged = false; s_isContentChanged = false;
} }
//在这里保存一下子窗口的位置。不排除有可能子窗口还在,主窗口已经退出的情况,不过问题不大。
if (s_winPosSet != nullptr)
{
s_winPosSet->sync();
s_winPosSet = nullptr;
} }
} }
} }
}
//子窗口的位置单独放在一个winpos.ini文件中而且启动程序时不需要读取可避免启动时拖慢速度
QByteArray NddSetting::getWinPos(QString key)
{
winPosInit();
return s_winPosSet->value(key, "").toByteArray();
}
void NddSetting::updataWinPos(QString key, QByteArray& value)
{
winPosInit();
s_winPosSet->setValue(key, QVariant(value));
}
void NddSetting::winPosInit()
{
if (s_winPosSet == nullptr)
{
QString settingDir = QString("notepad/delayset");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, settingDir);
QString qsSetPath = qs.fileName();
s_winPosSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
s_winPosSet->setIniCodec("UTF-8");
}
}

View File

@ -23,6 +23,11 @@ static QString FILELISTSHOW = "showfilelist"; //
static QString TOOLBARSHOW = "showbar"; //是否显示工具栏 static QString TOOLBARSHOW = "showbar"; //是否显示工具栏
static QString FINDWINSIZE = "findwinsize";//保存查找框的大小。150%放大时界面永久。保留避免每次手动调整 static QString FINDWINSIZE = "findwinsize";//保存查找框的大小。150%放大时界面永久。保留避免每次手动调整
static QString SHOWWEBADDR = "showweb";//高亮web地址双击网页打开 static QString SHOWWEBADDR = "showweb";//高亮web地址双击网页打开
static QString FIND_RESULT_FONT_SIZE = "frfs";//查找结果的默认字体大小默认为14
//下面这个是winpos.ini中的key避免单个文件太大拖慢启动速度
static QString BATCH_FIND_REPLACE_POS = "bfpos";//批量查找替换窗口的大小
class NddSetting class NddSetting
{ {
@ -49,11 +54,18 @@ public:
static void close(); static void close();
static QByteArray getWinPos(QString key);
static void updataWinPos(QString key, QByteArray& value);
static bool isDbExist() static bool isDbExist()
{ {
return s_isExistDb; return s_isExistDb;
} }
private:
static void winPosInit();
private: private:
static bool s_isExistDb; static bool s_isExistDb;
@ -61,4 +73,6 @@ private:
static int s_reference; static int s_reference;
static QSettings* s_nddSet; static QSettings* s_nddSet;
static QSettings* s_winPosSet;
}; };

View File

@ -6,7 +6,7 @@
#include <QTextEdit> #include <QTextEdit>
NdStyledItemDelegate::NdStyledItemDelegate(QObject *parent) NdStyledItemDelegate::NdStyledItemDelegate(QObject *parent)
: QStyledItemDelegate(parent) : QStyledItemDelegate(parent), m_defaultFontSize(14)
{ {
} }
@ -14,6 +14,13 @@ NdStyledItemDelegate::~NdStyledItemDelegate()
{ {
} }
void NdStyledItemDelegate::setFontSize(int size)
{
m_defaultFontSize = size;
}
//重载使可以支持富文本格式的文字 //重载使可以支持富文本格式的文字
void NdStyledItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const void NdStyledItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{ {
@ -27,6 +34,13 @@ void NdStyledItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem
QStyle *pStyle = viewOption.widget ? viewOption.widget->style() : QApplication::style(); QStyle *pStyle = viewOption.widget ? viewOption.widget->style() : QApplication::style();
QTextDocument doc; QTextDocument doc;
//外部修改了字体大小后,内部进行富文本的修改绘制。
if (m_defaultFontSize != 14)
{
viewOption.text.replace("font-size:14px",QString("font-size:%1px").arg(m_defaultFontSize));
}
doc.setHtml(viewOption.text); doc.setHtml(viewOption.text);
viewOption.text.clear(); viewOption.text.clear();

View File

@ -9,7 +9,11 @@ class NdStyledItemDelegate : public QStyledItemDelegate
public: public:
NdStyledItemDelegate(QObject *parent); NdStyledItemDelegate(QObject *parent);
virtual ~NdStyledItemDelegate(); virtual ~NdStyledItemDelegate();
void setFontSize(int size);
protected: protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
int m_defaultFontSize;
}; };

View File

@ -2,9 +2,9 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup /> <PropertyGroup />
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2023-01-07T13:40:17.4741087Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-01-06T12:23:11.3148927Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2023-01-07T13:40:17.5339488Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-01-06T12:23:11.4036545Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -25,12 +25,16 @@ void ProgressWin::setTotalSteps(int step)
m_curStep = 0; m_curStep = 0;
} }
void ProgressWin::moveStep() void ProgressWin::moveStep(bool isRest)
{ {
++m_curStep; ++m_curStep;
ui.progressBar->setValue(m_curStep); ui.progressBar->setValue(m_curStep);
ui.progressBar->update(); ui.progressBar->update();
//QCoreApplication::processEvents();
if (isRest)
{
QCoreApplication::processEvents();
}
} }
int ProgressWin::getTotalStep() int ProgressWin::getTotalStep()

View File

@ -15,7 +15,7 @@ public:
void info(QString text); void info(QString text);
void setTotalSteps(int step); void setTotalSteps(int step);
void moveStep(); void moveStep(bool isRest = false);
int getTotalStep(); int getTotalStep();
void setStep(int step); void setStep(int step);

View File

@ -89,32 +89,8 @@ void QsciDisplayWindow::setStyleOptions()
setMarginsForegroundColor(QColor(0x80, 0x80, 0x80)); //默认0x80, 0x80, 0x80 setMarginsForegroundColor(QColor(0x80, 0x80, 0x80)); //默认0x80, 0x80, 0x80
} }
else else
{ setMarginsBackgroundColor(0xf0f0f0);
setMarginsForegroundColor(QColor(0xde, 0xde, 0xde)); //默认0x80, 0x80, 0x80 setFoldMarginColors(0xf0f0f0, 0xf0f0f0);
}
setMarginsBackgroundColor(StyleSet::marginsBackgroundColor);
setFoldMarginColors(StyleSet::marginsBackgroundColor, StyleSet::marginsBackgroundColor);
//如果是黑色主题,则单独做一些风格设置
if (StyleSet::m_curStyleId == BLACK_SE)
{
this->setColor(QColor(0xff, 0xff, 0xff));//有lexer时无效
this->setPaper(QColor(0x282020));//有lexer时无效
setCaretLineBackgroundColor(QColor(0x333333));
setMatchedBraceForegroundColor(QColor(246, 81, 246));
setMatchedBraceBackgroundColor(QColor(18, 90, 36));
setCaretForegroundColor(QColor(255, 255, 255));
setFoldColor(SC_MARKNUM_FOLDEROPEN, QColor(45, 130, 45), QColor(222, 222, 222));
setFoldColor(SC_MARKNUM_FOLDER, QColor(45, 130, 45), QColor(222, 222, 222));
setFoldColor(SC_MARKNUM_FOLDERSUB, QColor(45, 130, 45), QColor(222, 222, 222));
setFoldColor(SC_MARKNUM_FOLDERTAIL, QColor(45, 130, 45), QColor(222, 222, 222));
setFoldColor(SC_MARKNUM_FOLDEREND, QColor(45, 130, 45), QColor(222, 222, 222));
setFoldColor(SC_MARKNUM_FOLDEROPENMID, QColor(45, 130, 45), QColor(222, 222, 222));
setFoldColor(SC_MARKNUM_FOLDERMIDTAIL, QColor(45, 130, 45), QColor(222, 222, 222));
}
else
{ {
//setCaretLineBackgroundColor(QColor(0xe8e8ff)); //setCaretLineBackgroundColor(QColor(0xe8e8ff));
setCaretLineBackgroundColor(QColor(0xFAF9DE)); setCaretLineBackgroundColor(QColor(0xFAF9DE));

View File

@ -1,5 +1,5 @@
// This file is part of Notepad++ project // This file is part of Notepad-- project
// Copyright (C) 2021 Notepad++ authors. // Copyright (C) 2023 Notepad-- authors.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by

View File

@ -6,7 +6,7 @@
* (c) 2012 Dave Brotherstone - Changes for boost::regex * (c) 2012 Dave Brotherstone - Changes for boost::regex
* (c) 2013 Francois-R.Boyer@PolyMtl.ca - Empty match modes and best match backward search * (c) 2013 Francois-R.Boyer@PolyMtl.ca - Empty match modes and best match backward search
* (c) 2019 Don Ho - Adapt for upgrading Scitilla (to version 4.1.4) and boost (to version 1.70) * (c) 2019 Don Ho - Adapt for upgrading Scitilla (to version 4.1.4) and boost (to version 1.70)
* * (c) 2022 zuowei yin - Upgrading QScitilla and boost
*/ */
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,5 +1,5 @@
// This file is part of Notepad++ project // This file is part of Notepad-- project
// Copyright (C) 2021 Notepad++ authors. // Copyright (C) 2023 Notepad-- authors.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
// This file is part of Notepad++ project // This file is part of Notepad-- project
// Copyright (C) 2021 Notepad++ authors. // Copyright (C) 2023 Notepad-- authors.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file LexAVS.cxx /** @file LexAVS.cxx
** Lexer for AviSynth. ** Lexer for AviSynth.
**/ **/
@ -288,4 +288,4 @@ static const char * const avsWordLists[] = {
0, 0,
}; };
LexerModule lmAVS(SCLEX_AVS, ColouriseAvsDoc, "avs", FoldAvsDoc, avsWordLists); //LexerModule lmAVS(SCLEX_AVS, ColouriseAvsDoc, "avs", FoldAvsDoc, avsWordLists);

View File

@ -1,4 +1,4 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file Catalogue.cxx /** @file Catalogue.cxx
** Lexer infrastructure. ** Lexer infrastructure.
** Contains a list of LexerModules which can be searched to find a module appropriate for a ** Contains a list of LexerModules which can be searched to find a module appropriate for a
@ -82,7 +82,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmASY); LINK_LEXER(lmASY);
LINK_LEXER(lmAU3); LINK_LEXER(lmAU3);
LINK_LEXER(lmAVE); LINK_LEXER(lmAVE);
LINK_LEXER(lmAVS); //LINK_LEXER(lmAVS);
LINK_LEXER(lmBaan); LINK_LEXER(lmBaan);
LINK_LEXER(lmBash); LINK_LEXER(lmBash);
LINK_LEXER(lmBatch); LINK_LEXER(lmBatch);

View File

@ -38,11 +38,6 @@
// define QSCINTILLA_DLL to link against a QScintilla shared library, or define // define QSCINTILLA_DLL to link against a QScintilla shared library, or define
// neither to either build or link against a static QScintilla library. // neither to either build or link against a static QScintilla library.
//在编译插件的时候先打开QSCINTILLA_MAKE_DLL宏让qscitilla生成lib dll文件
//#define QSCINTILLA_MAKE_DLL
//编译完成后注释掉QSCINTILLA_MAKE_DLL
#if defined(QSCINTILLA_DLL) #if defined(QSCINTILLA_DLL)
#define QSCINTILLA_EXPORT Q_DECL_IMPORT #define QSCINTILLA_EXPORT Q_DECL_IMPORT
#elif defined(QSCINTILLA_MAKE_DLL) #elif defined(QSCINTILLA_MAKE_DLL)

View File

@ -0,0 +1,127 @@
#pragma once
// This defines the interface to the QsciLexerAsm class.
//
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerAsm class encapsulates the Scintilla Bash lexer.
class QSCINTILLA_EXPORT QsciLexerAsm : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Bash lexer.
enum {
DEFAULT = 0,
COMMENT,
NUMBER,
STRING,
OPERATOR,
IDENTIFIER,
CPUINSTRUCTION,
MATHINSTRUCTION,
REGISTER,
DIRECTIVE,
DIRECTIVEOPERAND,
COMMENTBLOCK,
CHARACTER,
STRINGEOL,
EXTINSTRUCTION,
COMMENTDIRECTIVE,
};
//! Construct a QsciLexerAsm with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerAsm(QObject* parent = 0);
//! Destroys the QsciLexerAsm instance.
virtual ~QsciLexerAsm();
//! Returns the name of the language.
const char* language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char* lexer() const;
//! Returns the string of characters that comprise a word.
const char* wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char* keywords(int set);
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
private:
void setCompactProp();
bool fold_compact;
QsciLexerAsm(const QsciLexerAsm&);
QsciLexerAsm& operator=(const QsciLexerAsm&);
};

View File

@ -29,7 +29,7 @@
#include "Qsci/qsciscintilla.h" #include "Qsci/qsciscintilla.h"
#include "Qsci/qsciscintillabase.h" #include "Qsci/qsciscintillabase.h"
int QsciLexer::s_defaultFontSize = 14; int QsciLexer::s_defaultFontSize = 12;
int QsciLexer::m_themesId = 0; int QsciLexer::m_themesId = 0;
@ -38,7 +38,7 @@ QFont QsciLexer::s_defaultLangFont("Courier New", QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
QFont QsciLexer::s_defaultLangFont("Menlo", s_defaultFontSize); QFont QsciLexer::s_defaultLangFont("Menlo", s_defaultFontSize);
#else #else
QFont QsciLexer::s_defaultLangFont("Courier 10 Pitch", 14); QFont QsciLexer::s_defaultLangFont("Courier 10 Pitch", 12);
#endif #endif
// The ctor. // The ctor.
@ -948,4 +948,4 @@ void QsciLexer::setCommentEnd(QByteArray commentEnd)
void QsciLexer::setCurThemes(int themesId) void QsciLexer::setCurThemes(int themesId)
{ {
m_themesId = themesId; m_themesId = themesId;
} }

283
src/qscint/src/qscilexerasm.cpp Executable file
View File

@ -0,0 +1,283 @@
// This module implements the QsciLexerAsm class.
//
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerasm.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerAsm::QsciLexerAsm(QObject* parent)
: QsciLexer(parent), fold_compact(true)
{
m_commentSymbol = "#";
}
// The dtor.
QsciLexerAsm::~QsciLexerAsm()
{
}
// Returns the language name.
const char* QsciLexerAsm::language() const
{
return "Asm";
}
// Returns the lexer name.
const char* QsciLexerAsm::lexer() const
{
return "asm";
}
// Return the string of characters that comprise a word.
const char* QsciLexerAsm::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$@%&";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerAsm::defaultColor(int style) const
{
switch (style)
{
case DEFAULT:
return QColor(0x80, 0x80, 0x80);
case REGISTER:
return QColor(0x80, 0x80, 0xff);
case COMMENT:
return QColor(0x00, 0x7f, 0x00);
case NUMBER:
return QColor(0x00, 0x7f, 0x7f);
case IDENTIFIER:
return QColor(0x80, 0x00, 0xff);
case STRINGEOL:
return QColor(0x7f, 0x00, 0x7f);
case CPUINSTRUCTION: //key word:
return QColor(0x00, 0x00, 0xff);
}
return QsciLexer::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerAsm::defaultEolFill(int style) const
{
return QsciLexer::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerAsm::defaultFont(int style) const
{
QFont f;
switch (style)
{
case COMMENT:
#if defined(Q_OS_WIN)
f = QFont("Courier New", 11);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif", 9);
#endif
break;
case REGISTER:
f = QsciLexer::defaultFont(style);
f.setBold(false);
break;
case CPUINSTRUCTION:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
case STRINGEOL:
case DEFAULT:
#if defined(Q_OS_WIN)
f = QFont("Courier New", QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
f = QFont("Courier", 12);
#else
f = QFont("Bitstream Vera Sans Mono", 9);
#endif
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char* QsciLexerAsm::keywords(int set)
{
if (set == 1)
{
return "aaa aad aam aas adc add and call cbw cdqe clc cld cli cmc cmp cmps cmpsb cmpsw cwd daa das dec div esc hlt idiv imul "
"in inc int into iret ja jae jb jbe jc jcxz je jg jge jl jle jmp jna jnae jnb jnbe jnc jne jng jnge jnl jnle jno jnp jns "
"jnz jo jp jpe jpo js jz lahf lds lea les lods lodsb lodsw loop loope loopew loopne loopnew loopnz loopnzw loopw loopz "
"loopzw mov movabs movs movsb movsw mul neg nop not or out pop popf push pushf rcl rcr ret retf retn rol ror sahf sal sar "
"sbb scas scasb scasw shl shr stc std sti stos stosb stosw sub test wait xchg xlat xlatb xor bound enter ins insb insw "
"leave outs outsb outsw popa pusha pushw arpl lar lsl sgdt sidt sldt smsw str verr verw clts lgdt lidt lldt lmsw ltr "
"bsf bsr bt btc btr bts cdq cmpsd cwde insd iretd iretdf iretf jecxz lfs lgs lodsd loopd looped loopned loopnzd loopzd "
"lss movsd movsx movsxd movzx outsd popad popfd pushad pushd pushfd scasd seta setae setb setbe setc sete setg setge setl "
"setle setna setnae setnb setnbe setnc setne setng setnge setnl setnle setno setnp setns setnz seto setp setpe setpo sets "
"setz shld shrd stosd bswap cmpxchg invd invlpg wbinvd xadd lock rep repe repne repnz repz cflush cpuid emms femms cmovo "
"cmovno cmovb cmovc cmovnae cmovae cmovnb cmovnc cmove cmovz cmovne cmovnz cmovbe cmovna cmova cmovnbe cmovs cmovns cmovp "
"cmovpe cmovnp cmovpo cmovl cmovnge cmovge cmovnl cmovle cmovng cmovg cmovnle cmpxchg486 cmpxchg8b loadall loadall286 ibts "
"icebp int1 int3 int01 int03 iretw popaw popfw pushaw pushfw rdmsr rdpmc rdshr rdtsc rsdc rsldt rsm rsts salc smi smint smintold "
"svdc svldt svts syscall sysenter sysexit sysret ud0 ud1 ud2 umov xbts wrmsr wrshr";
}
else if (set == 2)
{
return "f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcom fcomp fcompp fdecstp fdisi fdiv fdivp fdivr fdivrp "
"feni ffree fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisub fisubr fld "
"fld1 fldcw fldenv fldenvw fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni "
"fninit fnop fnsave fnsavew fnstcw fnstenv fnstenvw fnstsw fpatan fprem fptan frndint frstor frstorw "
"fsave fsavew fscale fsqrt fst fstcw fstenv fstenvw fstp fstsw fsub fsubp fsubr fsubrp ftst fwait "
"fxam fxch fxtract fyl2x fyl2xp1 fsetpm fcos fldenvd fnsaved fnstenvd fprem1 frstord fsaved fsin "
"fsincos fstenvd fucom fucomp fucompp fcomi fcomip ffreep fcmovb fcmove fcmovbe fcmovu fcmovnb "
"fcmovne fcmovnbe fcmovnu";
}
else if (set == 3)
{
return "ah al ax bh bl bp bx ch cl cr0 cr2 cr3 cr4 cs cx dh di dl dr0 dr1 dr2 dr3 dr6 dr7 ds dx eax ebp ebx ecx edi edx es "
"esi esp fs gs rax rbx rcx rdx rdi rsi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 r8d r9d r10d r11d r12d r13d r14d r15d r8w r9w "
"r10w r11w r12w r13w r14w r15w r8b r9b r10b r11b r12b r13b r14b r15b si sp ss st tr3 tr4 tr5 tr6 tr7 st0 st1 st2 st3 st4 st5 st6 "
"st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15";
}
else if (set == 4)
{
return ".186 .286 .286c .286p .287 .386 .386c .386p .387 .486 .486p .8086 .8087 .alpha .break .code .const .continue .cref .data .data? .dosseg .else .elseif .endif .endw .err .err1 .err2 .errb .errdef .errdif .errdifi .erre .erridn .erridni .errnb .errndef .errnz .exit .fardata .fardata? .if .lall .lfcond .list .listall .listif .listmacro .listmacroall .model .no87 .nocref .nolist .nolistif .nolistmacro .radix .repeat .sall .seq .sfcond .stack .startup .tfcond .type .until .untilcxz .while .xall .xcref .xlist alias align assume catstr comm comment db dd df dosseg dq dt dup dw echo else elseif elseif1 elseif2 elseifb elseifdef elseifdif elseifdifi elseife elseifidn elseifidni elseifnb elseifndef end endif endm endp ends eq equ even exitm extern externdef extrn for forc ge goto group gt high highword if if1 if2 ifb ifdef ifdif ifdifi ife ifidn ifidni ifnb ifndef include includelib instr invoke irp irpc label le length lengthof local low lowword lroffset lt macro mask mod .msfloat name ne offset opattr option org %out page popcontext proc proto ptr public purge pushcontext record repeat rept seg segment short size sizeof sizestr struc struct substr subtitle subttl textequ this title type typedef union while width resb resw resd resq rest incbin times %define %idefine %xdefine %xidefine %undef %assign %iassign %strlen %substr %macro %imacro %endmacro %rotate %if %elif %else %endif %ifdef %ifndef %elifdef %elifndef %ifmacro %ifnmacro %elifmacro %elifnmacro %ifctk %ifnctk %elifctk %elifnctk %ifidn %ifnidn %elifidn %elifnidn %ifidni %ifnidni %elifidni %elifnidni %ifid %ifnid %elifid %elifnid %ifstr %ifnstr %elifstr %elifnstr %ifnum %ifnnum %elifnum %elifnnum %error %rep %endrep %exitrep %include %push %pop %repl endstruc istruc at iend alignb %arg %stacksize %local %line bits use16 use32 section absolute global common cpu import export";
}
else if (set == 5)
{
return "$ ? @b @f addr basic byte c carry? dword far far16 fortran fword near near16 overflow? parity? pascal qword real4 real8 real10 sbyte sdword sign? stdcall sword syscall tbyte vararg word zero? flat near32 far32 abs all assumes at casemap common compact cpu dotname emulator epilogue error export expr16 expr32 farstack forceframe huge language large listing ljmp loadds m510 medium memory nearstack nodotname noemulator nokeyword noljmp nom510 none nonunique nooldmacros nooldstructs noreadonly noscoped nosignextend nothing notpublic oldmacros oldstructs os_dos para private prologue radix readonly req scoped setif2 smallstack tiny use16 use32 uses a16 a32 o16 o32 nosplit $$ seq wrt small .text .data .bss %0 %1 %2 %3 %4 %5 %6 %7 %8 %9";
}
else if (set == 6)
{
return "addpd addps addsd addss andpd andps andnpd andnps cmpeqpd cmpltpd cmplepd cmpunordpd cmpnepd cmpnltpd cmpnlepd cmpordpd cmpeqps cmpltps cmpleps cmpunordps cmpneps cmpnltps cmpnleps cmpordps cmpeqsd cmpltsd cmplesd cmpunordsd cmpnesd cmpnltsd cmpnlesd cmpordsd cmpeqss cmpltss cmpless cmpunordss cmpness cmpnltss cmpnless cmpordss comisd comiss cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd cvtps2pi cvtss2sd cvtss2si cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss cvttpd2dq cvttpd2pi cvttps2dq cvttps2pi cvttsd2si cvttss2si divpd divps divsd divss fxrstor fxsave ldmxscr lfence mfence maskmovdqu maskmovdq maxpd maxps paxsd maxss minpd minps minsd minss movapd movaps movdq2q movdqa movdqu movhlps movhpd movhps movd movq movlhps movlpd movlps movmskpd movmskps movntdq movnti movntpd movntps movntq movq2dq movsd movss movupd movups mulpd mulps mulsd mulss orpd orps packssdw packsswb packuswb paddb paddsb paddw paddsw paddd paddsiw paddq paddusb paddusw pand pandn pause paveb pavgb pavgw pavgusb pdistib pextrw pcmpeqb pcmpeqw pcmpeqd pcmpgtb pcmpgtw pcmpgtd pf2id pf2iw pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pmachriw pmaddwd pmagw pmaxsw pmaxub pminsw pminub pmovmskb pmulhrwc pmulhriw pmulhrwa pmulhuw pmulhw pmullw pmuludq pmvzb pmvnzb pmvlzb pmvgezb pfnacc pfpnacc por prefetch prefetchw prefetchnta prefetcht0 prefetcht1 prefetcht2 pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pinsrw psadbw pshufd pshufhw pshuflw pshufw psllw pslld psllq pslldq psraw psrad psrlw psrld psrlq psrldq psubb psubw psubd psubq psubsb psubsw psubusb psubusw psubsiw pswapd punpckhbw punpckhwd punpckhdq punpckhqdq punpcklbw punpcklwd punpckldq punpcklqdq pxor rcpps rcpss rsqrtps rsqrtss sfence shufpd shufps sqrtpd sqrtps sqrtsd sqrtss stmxcsr subpd subps subsd subss ucomisd ucomiss unpckhpd unpckhps unpcklpd unpcklps xorpd xorps";
}
}
// Returns the user name of a style.
QString QsciLexerAsm::description(int style) const
{
switch (style)
{
case DEFAULT:
return tr("Default");
case COMMENT:
return tr("Comment");
case NUMBER:
return tr("Number");
case STRING:
return tr("String");
case OPERATOR:
return tr("Operator");
case IDENTIFIER:
return tr("Identifier");
case CPUINSTRUCTION: //key word
return tr("Keyword (Cpu instruction)");
case MATHINSTRUCTION:
return tr("Math instruction");
case REGISTER:
return tr("Register");
case DIRECTIVE:
return tr("Directive");
case DIRECTIVEOPERAND:
return tr("Directive Operand");
case COMMENTBLOCK:
return tr("Comment Block");
case CHARACTER:
return tr("Character");
case STRINGEOL:
return tr("String eol");
case EXTINSTRUCTION:
return tr("Extinstruction");
case COMMENTDIRECTIVE:
return tr("Comment Directive");
}
return QString();
}
// Returns the background colour of the text for a style.
QColor QsciLexerAsm::defaultPaper(int style) const
{
return QsciLexer::defaultPaper(style);
}
// Refresh all properties.
void QsciLexerAsm::refreshProperties()
{
setCompactProp();
}
// Set if folds are compact
void QsciLexerAsm::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerAsm::setCompactProp()
{
emit propertyChanged("fold.compact", (fold_compact ? "1" : "0"));
}

View File

@ -100,11 +100,11 @@ QString QsciLexerGlobal::description(int style) const
QFont QsciLexerGlobal::defaultFont(int style) const QFont QsciLexerGlobal::defaultFont(int style) const
{ {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
QFont f("Courier New", 14); QFont f("Courier New", s_defaultFontSize);
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
QFont f("Menlo", s_defaultFontSize); QFont f("Menlo", s_defaultFontSize);
#else #else
QFont f("Courier 10 Pitch", 14); QFont f("Courier 10 Pitch", s_defaultFontSize);
#endif #endif
switch (style) switch (style)

View File

@ -8,9 +8,9 @@
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
QFont QsciLexerText::s_defaultTxtFont(u8"宋体", QsciLexer::s_defaultFontSize); QFont QsciLexerText::s_defaultTxtFont(u8"宋体", QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
QFont QsciLexerText::s_defaultTxtFont("STSong",18); QFont QsciLexerText::s_defaultTxtFont("STSong",14);
#else #else
QFont QsciLexerText::s_defaultTxtFont("Courier 10 Pitch", 14); QFont QsciLexerText::s_defaultTxtFont("Courier 10 Pitch", 12);
#endif #endif
@ -83,9 +83,9 @@ QFont QsciLexerText::defaultFont(int style) const
break; break;
case Ascii: case Ascii:
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
return QFont("Courier New", 14); return QFont("Courier New", 12);
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
return QFont("Courier New", 18); return QFont("Courier New", 14);
#else #else
return s_defaultTxtFont; return s_defaultTxtFont;
#endif #endif

View File

@ -103,7 +103,7 @@ HEADERS = \
./Qsci/qscicommandset.h \ ./Qsci/qscicommandset.h \
./Qsci/qscidocument.h \ ./Qsci/qscidocument.h \
./Qsci/qscilexer.h \ ./Qsci/qscilexer.h \
./Qsci/qscilexeravs.h \ ./Qsci/qscilexerasm.h \
./Qsci/qscilexerbash.h \ ./Qsci/qscilexerbash.h \
./Qsci/qscilexerbatch.h \ ./Qsci/qscilexerbatch.h \
./Qsci/qscilexercmake.h \ ./Qsci/qscilexercmake.h \
@ -234,7 +234,7 @@ SOURCES = \
qscicommandset.cpp \ qscicommandset.cpp \
qscidocument.cpp \ qscidocument.cpp \
qscilexer.cpp \ qscilexer.cpp \
qscilexeravs.cpp \ qscilexerasm.cpp \
qscilexerbash.cpp \ qscilexerbash.cpp \
qscilexerbatch.cpp \ qscilexerbatch.cpp \
qscilexercmake.cpp \ qscilexercmake.cpp \

View File

@ -1,261 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 9.0.0, 2022-12-16T16:09:40. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{ee8a8311-48c9-435d-8d33-c3e67e1c3f3d}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">3</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.2 MSVC2019 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.2 MSVC2019 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5152.win64_msvc2019_64_kit</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\notepad--\qscint\src\..\build-qscintilla-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/notepad--/qscint/build-qscintilla-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\notepad--\qscint\src\..\build-qscintilla-Desktop_Qt_5_15_2_MSVC2019_64bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/notepad--/qscint/build-qscintilla-Desktop_Qt_5_15_2_MSVC2019_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\notepad--\qscint\src\..\build-qscintilla-Desktop_Qt_5_15_2_MSVC2019_64bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/notepad--/qscint/build-qscintilla-Desktop_Qt_5_15_2_MSVC2019_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="qlonglong">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

View File

@ -1,585 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9BC42707-EE25-3B28-9906-F7919E273020}</ProjectGuid>
<RootNamespace>qmyedit_qt5d</RootNamespace>
<Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>..\..\x64\Debug\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<IntermediateDirectory>debug\</IntermediateDirectory>
<PrimaryOutput>qmyedit_qt5d</PrimaryOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>..\..\x64\Debug\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>StaticLibrary</ConfigurationType>
<IntermediateDirectory>release\</IntermediateDirectory>
<PrimaryOutput>qmyedit_qt5d</PrimaryOutput>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>..\..\x64\Debug\</OutDir>
<IntDir>release\</IntDir>
<TargetName>qmyedit_qt5d</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>..\..\x64\Debug\</OutDir>
<IntDir>debug\</IntDir>
<TargetName>qmyedit_qt5d</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtInstall>5.12.10_msvc2017_64</QtInstall>
<QtModules>core;gui;widgets;printsupport</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtInstall>5.12.10_msvc2017_64</QtInstall>
<QtModules>core;gui;widgets;printsupport</QtModules>
</PropertyGroup>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
<Import Project="$(QtMsBuild)\qt.props" />
</ImportGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\scintilla\include;..\scintilla\lexlib;..\scintilla\src;..\scintilla\boostregex;debug;/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>debug\</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>debug\</ObjectFileName>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;SCINTILLA_QT;SCI_LEXER;INCLUDE_DEPRECATED_FEATURES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)\qmyedit_qt5d.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;SCINTILLA_QT;SCI_LEXER;INCLUDE_DEPRECATED_FEATURES;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<QtMoc>
<CompilerFlavor>msvc</CompilerFlavor>
<Include>./$(Configuration)/moc_predefs.h</Include>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<DynamicSource>output</DynamicSource>
<QtMocDir>$(Configuration)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\scintilla\include;..\scintilla\lexlib;..\scintilla\src;..\scintilla\boostregex;release;/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>release\</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>None</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>release\</ObjectFileName>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;SCINTILLA_QT;SCI_LEXER;INCLUDE_DEPRECATED_FEATURES;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<ProgramDataBaseFileName>
</ProgramDataBaseFileName>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)\qmyedit_qt5d.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;SCINTILLA_QT;SCI_LEXER;INCLUDE_DEPRECATED_FEATURES;QT_NO_DEBUG;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<QtMoc>
<CompilerFlavor>msvc</CompilerFlavor>
<Include>./$(Configuration)/moc_predefs.h</Include>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<DynamicSource>output</DynamicSource>
<QtMocDir>$(Configuration)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\scintilla\lexlib\Accessor.cpp" />
<ClCompile Include="..\scintilla\src\AutoComplete.cpp" />
<ClCompile Include="..\scintilla\boostregex\BoostRegExSearch.cpp" />
<ClCompile Include="..\scintilla\src\CallTip.cpp" />
<ClCompile Include="..\scintilla\src\CaseConvert.cpp" />
<ClCompile Include="..\scintilla\src\CaseFolder.cpp" />
<ClCompile Include="..\scintilla\src\Catalogue.cpp" />
<ClCompile Include="..\scintilla\src\CellBuffer.cpp" />
<ClCompile Include="..\scintilla\src\CharClassify.cpp" />
<ClCompile Include="..\scintilla\lexlib\CharacterCategory.cpp" />
<ClCompile Include="..\scintilla\lexlib\CharacterSet.cpp" />
<ClCompile Include="..\scintilla\src\ContractionState.cpp" />
<ClCompile Include="..\scintilla\src\DBCS.cpp" />
<ClCompile Include="..\scintilla\src\Decoration.cpp" />
<ClCompile Include="..\scintilla\lexlib\DefaultLexer.cpp" />
<ClCompile Include="..\scintilla\src\Document.cpp" />
<ClCompile Include="..\scintilla\src\EditModel.cpp" />
<ClCompile Include="..\scintilla\src\EditView.cpp" />
<ClCompile Include="..\scintilla\src\Editor.cpp" />
<ClCompile Include="..\scintilla\src\ExternalLexer.cpp" />
<ClCompile Include="..\scintilla\src\Indicator.cpp" />
<ClCompile Include="InputMethod.cpp" />
<ClCompile Include="..\scintilla\src\KeyMap.cpp" />
<ClCompile Include="..\scintilla\lexers\LexA68k.cpp" />
<ClCompile Include="..\scintilla\lexers\LexAPDL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexASY.cpp" />
<ClCompile Include="..\scintilla\lexers\LexAU3.cpp" />
<ClCompile Include="..\scintilla\lexers\LexAVE.cpp" />
<ClCompile Include="..\scintilla\lexers\LexAVS.cpp" />
<ClCompile Include="..\scintilla\lexers\LexAbaqus.cpp" />
<ClCompile Include="..\scintilla\lexers\LexAda.cpp" />
<ClCompile Include="..\scintilla\lexers\LexAsm.cpp" />
<ClCompile Include="..\scintilla\lexers\LexAsn1.cpp" />
<ClCompile Include="..\scintilla\lexers\LexBaan.cpp" />
<ClCompile Include="..\scintilla\lexers\LexBash.cpp" />
<ClCompile Include="..\scintilla\lexers\LexBasic.cpp" />
<ClCompile Include="..\scintilla\lexers\LexBatch.cpp" />
<ClCompile Include="..\scintilla\lexers\LexBibTeX.cpp" />
<ClCompile Include="..\scintilla\lexers\LexBullant.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCLW.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCOBOL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCPP.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCSS.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCaml.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCmake.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCoffeeScript.cpp" />
<ClCompile Include="..\scintilla\lexers\LexConf.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCrontab.cpp" />
<ClCompile Include="..\scintilla\lexers\LexCsound.cpp" />
<ClCompile Include="..\scintilla\lexers\LexD.cpp" />
<ClCompile Include="..\scintilla\lexers\LexDMAP.cpp" />
<ClCompile Include="..\scintilla\lexers\LexDMIS.cpp" />
<ClCompile Include="..\scintilla\lexers\LexDiff.cpp" />
<ClCompile Include="..\scintilla\lexers\LexECL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexEDIFACT.cpp" />
<ClCompile Include="..\scintilla\lexers\LexEScript.cpp" />
<ClCompile Include="..\scintilla\lexers\LexEiffel.cpp" />
<ClCompile Include="..\scintilla\lexers\LexErlang.cpp" />
<ClCompile Include="..\scintilla\lexers\LexErrorList.cpp" />
<ClCompile Include="..\scintilla\lexers\LexFlagship.cpp" />
<ClCompile Include="..\scintilla\lexers\LexForth.cpp" />
<ClCompile Include="..\scintilla\lexers\LexFortran.cpp" />
<ClCompile Include="..\scintilla\lexers\LexGAP.cpp" />
<ClCompile Include="..\scintilla\lexers\LexGui4Cli.cpp" />
<ClCompile Include="..\scintilla\lexers\LexHTML.cpp" />
<ClCompile Include="..\scintilla\lexers\LexHaskell.cpp" />
<ClCompile Include="..\scintilla\lexers\LexHex.cpp" />
<ClCompile Include="..\scintilla\lexers\LexIndent.cpp" />
<ClCompile Include="..\scintilla\lexers\LexInno.cpp" />
<ClCompile Include="..\scintilla\lexers\LexJSON.cpp" />
<ClCompile Include="..\scintilla\lexers\LexKVIrc.cpp" />
<ClCompile Include="..\scintilla\lexers\LexKix.cpp" />
<ClCompile Include="..\scintilla\lexers\LexLaTeX.cpp" />
<ClCompile Include="..\scintilla\lexers\LexLisp.cpp" />
<ClCompile Include="..\scintilla\lexers\LexLout.cpp" />
<ClCompile Include="..\scintilla\lexers\LexLua.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMMIXAL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMPT.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMSSQL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMagik.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMake.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMarkdown.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMatlab.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMaxima.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMetapost.cpp" />
<ClCompile Include="..\scintilla\lexers\LexModula.cpp" />
<ClCompile Include="..\scintilla\lexers\LexMySQL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexNimrod.cpp" />
<ClCompile Include="..\scintilla\lexers\LexNsis.cpp" />
<ClCompile Include="..\scintilla\lexers\LexNull.cpp" />
<ClCompile Include="..\scintilla\lexers\LexOScript.cpp" />
<ClCompile Include="..\scintilla\lexers\LexOpal.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPB.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPLM.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPO.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPOV.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPS.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPascal.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPerl.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPowerPro.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPowerShell.cpp" />
<ClCompile Include="..\scintilla\lexers\LexProgress.cpp" />
<ClCompile Include="..\scintilla\lexers\LexProps.cpp" />
<ClCompile Include="..\scintilla\lexers\LexPython.cpp" />
<ClCompile Include="..\scintilla\lexers\LexR.cpp" />
<ClCompile Include="..\scintilla\lexers\LexRebol.cpp" />
<ClCompile Include="..\scintilla\lexers\LexRegistry.cpp" />
<ClCompile Include="..\scintilla\lexers\LexRuby.cpp" />
<ClCompile Include="..\scintilla\lexers\LexRust.cpp" />
<ClCompile Include="..\scintilla\lexers\LexSAS.cpp" />
<ClCompile Include="..\scintilla\lexers\LexSML.cpp" />
<ClCompile Include="..\scintilla\lexers\LexSQL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexSTTXT.cpp" />
<ClCompile Include="..\scintilla\lexers\LexScriptol.cpp" />
<ClCompile Include="..\scintilla\lexers\LexSmalltalk.cpp" />
<ClCompile Include="..\scintilla\lexers\LexSorcus.cpp" />
<ClCompile Include="..\scintilla\lexers\LexSpecman.cpp" />
<ClCompile Include="..\scintilla\lexers\LexSpice.cpp" />
<ClCompile Include="..\scintilla\lexers\LexStata.cpp" />
<ClCompile Include="..\scintilla\lexers\LexTACL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexTADS3.cpp" />
<ClCompile Include="..\scintilla\lexers\LexTAL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexTCL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexTCMD.cpp" />
<ClCompile Include="..\scintilla\lexers\LexTXT.cpp" />
<ClCompile Include="..\scintilla\lexers\LexTeX.cpp" />
<ClCompile Include="..\scintilla\lexers\LexTxt2tags.cpp" />
<ClCompile Include="..\scintilla\lexers\LexVB.cpp" />
<ClCompile Include="..\scintilla\lexers\LexVHDL.cpp" />
<ClCompile Include="..\scintilla\lexers\LexVerilog.cpp" />
<ClCompile Include="..\scintilla\lexers\LexVisualProlog.cpp" />
<ClCompile Include="..\scintilla\lexers\LexYAML.cpp" />
<ClCompile Include="..\scintilla\lexlib\LexerBase.cpp" />
<ClCompile Include="..\scintilla\lexlib\LexerModule.cpp" />
<ClCompile Include="..\scintilla\lexlib\LexerNoExceptions.cpp" />
<ClCompile Include="..\scintilla\lexlib\LexerSimple.cpp" />
<ClCompile Include="..\scintilla\src\LineMarker.cpp" />
<ClCompile Include="ListBoxQt.cpp" />
<ClCompile Include="MacPasteboardMime.cpp" />
<ClCompile Include="..\scintilla\src\MarginView.cpp" />
<ClCompile Include="..\scintilla\src\PerLine.cpp" />
<ClCompile Include="PlatQt.cpp" />
<ClCompile Include="..\scintilla\src\PositionCache.cpp" />
<ClCompile Include="..\scintilla\lexlib\PropSetSimple.cpp" />
<ClCompile Include="..\scintilla\src\RESearch.cpp" />
<ClCompile Include="..\scintilla\src\RunStyles.cpp" />
<ClCompile Include="SciAccessibility.cpp" />
<ClCompile Include="SciClasses.cpp" />
<ClCompile Include="..\scintilla\src\ScintillaBase.cpp" />
<ClCompile Include="ScintillaQt.cpp" />
<ClCompile Include="..\scintilla\src\Selection.cpp" />
<ClCompile Include="..\scintilla\src\Style.cpp" />
<ClCompile Include="..\scintilla\lexlib\StyleContext.cpp" />
<ClCompile Include="..\scintilla\boostregex\UTF8DocumentIterator.cpp" />
<ClCompile Include="..\scintilla\src\UniConversion.cpp" />
<ClCompile Include="..\scintilla\src\ViewStyle.cpp" />
<ClCompile Include="..\scintilla\lexlib\WordList.cpp" />
<ClCompile Include="..\scintilla\src\XPM.cpp" />
<ClCompile Include="qsciabstractapis.cpp" />
<ClCompile Include="qsciapis.cpp" />
<ClCompile Include="qscicommand.cpp" />
<ClCompile Include="qscicommandset.cpp" />
<ClCompile Include="qscidocument.cpp" />
<ClCompile Include="qscilexer.cpp" />
<ClCompile Include="qscilexeravs.cpp" />
<ClCompile Include="qscilexerbash.cpp" />
<ClCompile Include="qscilexerbatch.cpp" />
<ClCompile Include="qscilexercmake.cpp" />
<ClCompile Include="qscilexercoffeescript.cpp" />
<ClCompile Include="qscilexercpp.cpp" />
<ClCompile Include="qscilexercsharp.cpp" />
<ClCompile Include="qscilexercss.cpp" />
<ClCompile Include="qscilexercustom.cpp" />
<ClCompile Include="qscilexerd.cpp" />
<ClCompile Include="qscilexerdiff.cpp" />
<ClCompile Include="qscilexeredifact.cpp" />
<ClCompile Include="qscilexerfortran.cpp" />
<ClCompile Include="qscilexerfortran77.cpp" />
<ClCompile Include="qscilexerglobal.cpp" />
<ClCompile Include="qscilexergo.cpp" />
<ClCompile Include="qscilexerhtml.cpp" />
<ClCompile Include="qscilexeridl.cpp" />
<ClCompile Include="qscilexerjava.cpp" />
<ClCompile Include="qscilexerjavascript.cpp" />
<ClCompile Include="qscilexerjson.cpp" />
<ClCompile Include="qscilexerlua.cpp" />
<ClCompile Include="qscilexermakefile.cpp" />
<ClCompile Include="qscilexermarkdown.cpp" />
<ClCompile Include="qscilexermatlab.cpp" />
<ClCompile Include="qscilexernsis.cpp" />
<ClCompile Include="qscilexeroctave.cpp" />
<ClCompile Include="qscilexerpascal.cpp" />
<ClCompile Include="qscilexerperl.cpp" />
<ClCompile Include="qscilexerpo.cpp" />
<ClCompile Include="qscilexerpostscript.cpp" />
<ClCompile Include="qscilexerpov.cpp" />
<ClCompile Include="qscilexerproperties.cpp" />
<ClCompile Include="qscilexerpython.cpp" />
<ClCompile Include="qscilexerruby.cpp" />
<ClCompile Include="qscilexerrust.cpp" />
<ClCompile Include="qscilexerspice.cpp" />
<ClCompile Include="qscilexersql.cpp" />
<ClCompile Include="qscilexertcl.cpp" />
<ClCompile Include="qscilexertex.cpp" />
<ClCompile Include="qscilexertext.cpp" />
<ClCompile Include="qscilexervb.cpp" />
<ClCompile Include="qscilexerverilog.cpp" />
<ClCompile Include="qscilexervhdl.cpp" />
<ClCompile Include="qscilexerxml.cpp" />
<ClCompile Include="qscilexeryaml.cpp" />
<ClCompile Include="qscimacro.cpp" />
<ClCompile Include="qsciprinter.cpp" />
<ClCompile Include="qsciscintilla.cpp" />
<ClCompile Include="qsciscintillabase.cpp" />
<ClCompile Include="qscistyle.cpp" />
<ClCompile Include="qscistyledtext.cpp" />
<ClCompile Include="xmlMatchedTagsHighlighter.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\scintilla\lexlib\Accessor.h" />
<ClInclude Include="..\scintilla\boostregex\AnsiDocumentIterator.h" />
<ClInclude Include="..\scintilla\src\AutoComplete.h" />
<ClInclude Include="..\scintilla\src\CallTip.h" />
<ClInclude Include="..\scintilla\src\CaseConvert.h" />
<ClInclude Include="..\scintilla\src\CaseFolder.h" />
<ClInclude Include="..\scintilla\src\Catalogue.h" />
<ClInclude Include="..\scintilla\src\CellBuffer.h" />
<ClInclude Include="..\scintilla\src\CharClassify.h" />
<ClInclude Include="..\scintilla\lexlib\CharacterCategory.h" />
<ClInclude Include="..\scintilla\lexlib\CharacterSet.h" />
<ClInclude Include="..\scintilla\src\ContractionState.h" />
<ClInclude Include="..\scintilla\src\DBCS.h" />
<ClInclude Include="..\scintilla\src\Decoration.h" />
<ClInclude Include="..\scintilla\lexlib\DefaultLexer.h" />
<ClInclude Include="..\scintilla\src\Document.h" />
<ClInclude Include="..\scintilla\src\EditModel.h" />
<ClInclude Include="..\scintilla\src\EditView.h" />
<ClInclude Include="..\scintilla\src\Editor.h" />
<ClInclude Include="..\scintilla\src\ElapsedPeriod.h" />
<ClInclude Include="..\scintilla\src\ExternalLexer.h" />
<ClInclude Include="..\scintilla\src\FontQuality.h" />
<ClInclude Include="..\scintilla\include\ILexer.h" />
<ClInclude Include="..\scintilla\include\ILoader.h" />
<ClInclude Include="..\scintilla\src\Indicator.h" />
<ClInclude Include="..\scintilla\src\IntegerRectangle.h" />
<ClInclude Include="..\scintilla\src\KeyMap.h" />
<ClInclude Include="..\scintilla\lexlib\LexAccessor.h" />
<ClInclude Include="..\scintilla\lexlib\LexerBase.h" />
<ClInclude Include="..\scintilla\lexlib\LexerModule.h" />
<ClInclude Include="..\scintilla\lexlib\LexerNoExceptions.h" />
<ClInclude Include="..\scintilla\lexlib\LexerSimple.h" />
<ClInclude Include="..\scintilla\src\LineMarker.h" />
<ClInclude Include="ListBoxQt.h" />
<ClInclude Include="..\scintilla\src\MarginView.h" />
<ClInclude Include="..\scintilla\lexlib\OptionSet.h" />
<ClInclude Include="..\scintilla\src\Partitioning.h" />
<ClInclude Include="..\scintilla\src\PerLine.h" />
<ClInclude Include="..\scintilla\include\Platform.h" />
<ClInclude Include="..\scintilla\src\Position.h" />
<ClInclude Include="..\scintilla\src\PositionCache.h" />
<ClInclude Include="..\scintilla\lexlib\PropSetSimple.h" />
<ClInclude Include="..\scintilla\src\RESearch.h" />
<ClInclude Include="..\scintilla\src\RunStyles.h" />
<ClInclude Include="SciAccessibility.h" />
<QtMoc Include="SciClasses.h">
</QtMoc>
<ClInclude Include="..\scintilla\include\SciLexer.h" />
<ClInclude Include="..\scintilla\include\Sci_Position.h" />
<ClInclude Include="..\scintilla\include\Scintilla.h" />
<ClInclude Include="..\scintilla\src\ScintillaBase.h" />
<QtMoc Include="ScintillaQt.h">
</QtMoc>
<ClInclude Include="..\scintilla\include\ScintillaWidget.h" />
<ClInclude Include="..\scintilla\src\Selection.h" />
<ClInclude Include="..\scintilla\lexlib\SparseState.h" />
<ClInclude Include="..\scintilla\src\SparseVector.h" />
<ClInclude Include="..\scintilla\src\SplitVector.h" />
<ClInclude Include="..\scintilla\lexlib\StringCopy.h" />
<ClInclude Include="..\scintilla\src\Style.h" />
<ClInclude Include="..\scintilla\lexlib\StyleContext.h" />
<ClInclude Include="..\scintilla\lexlib\SubStyles.h" />
<ClInclude Include="..\scintilla\boostregex\UTF8DocumentIterator.h" />
<ClInclude Include="..\scintilla\src\UniConversion.h" />
<ClInclude Include="..\scintilla\src\UniqueString.h" />
<ClInclude Include="..\scintilla\src\ViewStyle.h" />
<ClInclude Include="..\scintilla\lexlib\WordList.h" />
<ClInclude Include="..\scintilla\src\XPM.h" />
<QtMoc Include="Qsci\qsciabstractapis.h">
</QtMoc>
<QtMoc Include="Qsci\qsciapis.h">
</QtMoc>
<ClInclude Include="Qsci\qscicommand.h" />
<ClInclude Include="Qsci\qscicommandset.h" />
<ClInclude Include="Qsci\qscidocument.h" />
<ClInclude Include="Qsci\qsciglobal.h" />
<QtMoc Include="Qsci\qscilexer.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexeravs.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerbash.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerbatch.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexercmake.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexercoffeescript.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexercpp.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexercsharp.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexercss.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexercustom.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerd.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerdiff.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexeredifact.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerfortran.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerfortran77.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerglobal.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexergo.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerhtml.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexeridl.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerjava.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerjavascript.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerjson.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerlua.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexermakefile.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexermarkdown.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexermatlab.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexernsis.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexeroctave.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerpascal.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerperl.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerpo.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerpostscript.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerpov.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerproperties.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerpython.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerruby.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerrust.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerspice.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexersql.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexertcl.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexertex.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexertext.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexervb.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerverilog.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexervhdl.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexerxml.h">
</QtMoc>
<QtMoc Include="Qsci\qscilexeryaml.h">
</QtMoc>
<QtMoc Include="Qsci\qscimacro.h">
</QtMoc>
<ClInclude Include="Qsci\qsciprinter.h" />
<QtMoc Include="Qsci\qsciscintilla.h">
</QtMoc>
<QtMoc Include="Qsci\qsciscintillabase.h">
</QtMoc>
<ClInclude Include="Qsci\qscistyle.h" />
<ClInclude Include="Qsci\qscistyledtext.h" />
<ClInclude Include="xmlMatchedTagsHighlighter.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
<FileType>Document</FileType>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -EHsc -W0 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;debug\moc_predefs.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">debug\moc_predefs.h;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</CustomBuild>
<CustomBuild Include="release\moc_predefs.h.cbt">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -EHsc -W0 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;release\moc_predefs.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">release\moc_predefs.h;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<None Include="qscintilla_ch.ts" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets" />
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2023-01-07T13:40:52.0407809Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2023-01-07T13:40:52.1883856Z</QtLastBackgroundBuild>
</PropertyGroup>
</Project>

View File

@ -1,5 +1,5 @@
// This file is part of Notepad++ project // This file is part of Notepad-- project
// Copyright (C)2021 Don HO <don.h@free.fr> // Copyright (C)2023 zuowei.yin <cxasm@qq.com>
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
// This file is part of Notepad++ project // This file is part of Notepad-- project
// Copyright (C)2021 Don HO <don.h@free.fr> // Copyright (C)2023 zuowei.yin <cxasm@qq.com>
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by

View File

@ -4,6 +4,7 @@
#include "rcglobal.h" #include "rcglobal.h"
#include "ccnotepad.h" #include "ccnotepad.h"
#include "styleset.h" #include "styleset.h"
#include "extlexermanager.h"
#include <SciLexer.h> #include <SciLexer.h>
#include <qscilexer.h> #include <qscilexer.h>
@ -917,6 +918,12 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item)
ui.keywordTe->setPlainText(keyword); ui.keywordTe->setPlainText(keyword);
ui.motherLangCb->setCurrentIndex(0); ui.motherLangCb->setCurrentIndex(0);
//设置关联文件项
QString langName = item->text();
QStringList extList;
ExtLexerManager::getInstance()->getExtlistByLangTag(langName, extList);
ui.extFileType->setText(extList.join(','));
for (int i = 0; i <= 255; ++i) for (int i = 0; i <= 255; ++i)
{ {
QString desc = pLexer->description(i); QString desc = pLexer->description(i);
@ -941,7 +948,7 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item)
m_isStyleChange = false; m_isStyleChange = false;
ui.extFileType->clear(); //ui.extFileType->clear();
ui.motherLangCb->setCurrentIndex(0); ui.motherLangCb->setCurrentIndex(0);
} }

View File

@ -454,7 +454,7 @@
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="page_normal"> <widget class="QWidget" name="page_normal">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">

View File

@ -20,6 +20,38 @@ QString getUserLangDirPath()
return s_userLangDirPath; return s_userLangDirPath;
} }
const int M_SIZE = 1024 * 1024;
const int G_SIZE = 1024 * 1024 * 1024;
//把字节大小文件转换为M 或 G 单位
QString tranFileSize(qint64 fileSize)
{
float num = 0.0f;
QString unit;
if (fileSize >= G_SIZE)
{
num = double(fileSize) / G_SIZE;
unit = "GB";
}
else if (fileSize >= M_SIZE)
{
num = double(fileSize) / M_SIZE;
unit = "MB";
}
else if (fileSize > 1024)
{
num = float(fileSize) / 1024;
unit = "KB";
}
else
{
return QString("%1").arg(fileSize);
}
return QString("%1 %2").arg(num, 0, 'f' , 2).arg(unit);
}
void showFileInExplorer(QString path) void showFileInExplorer(QString path)
{ {
QString cmd; QString cmd;

View File

@ -5,7 +5,17 @@
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <qscilexer.h> #include <qscilexer.h>
static const char* VersionStr = "v1.21.0"; //#define TEST_PRE
#ifdef TEST_PRE
static const char* VersionStr = u8"(内部测试非稳定) v1.22.0";
#else
static const char* VersionStr = "v1.22.0";
#endif // TEST_PRE
//#define NO_PLUGIN 1
#define CMP_CODE_NOEQUAL #define CMP_CODE_NOEQUAL
@ -158,3 +168,4 @@ QString getUserLangDirPath();
#endif #endif
void showFileInExplorer(QString path); void showFileInExplorer(QString path);
QString tranFileSize(qint64 fileSize);

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
// This file is part of Notepad++ project // This file is part of Notepad-- project
// Copyright (C)2021 Don HO <don.h@free.fr> // Copyright (C)2023 zuowei.yin <cxasm@qq.com>
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by

View File

@ -6,11 +6,14 @@
#include "styleset.h" #include "styleset.h"
#include "qtlangset.h" #include "qtlangset.h"
#include "findwin.h" #include "findwin.h"
#include "filemanager.h"
#include <Scintilla.h> #include <Scintilla.h>
#include <SciLexer.h> #include <SciLexer.h>
#include <QImage> #include <QImage>
#include <Qsci/qscilexerpython.h> #include <Qsci/qscilexerpython.h>
#include <Qsci/qscilexeravs.h> //#include <Qsci/qscilexeravs.h>
#include <Qsci/qscilexerasm.h>
#include <Qsci/qscilexerbash.h> #include <Qsci/qscilexerbash.h>
#include <Qsci/qscilexerbatch.h> #include <Qsci/qscilexerbatch.h>
#include <Qsci/qscilexercmake.h> #include <Qsci/qscilexercmake.h>
@ -88,6 +91,8 @@ const int SC_BIGTEXT_LINES = 0;
const int MAX_PRE_NEXT_TIMES = 30; const int MAX_PRE_NEXT_TIMES = 30;
const int INIT_BIG_RO_TEXT_LINE_WIDTH = 8;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
LanguageName ScintillaEditView::langNames[L_EXTERNAL + 1] = { LanguageName ScintillaEditView::langNames[L_EXTERNAL + 1] = {
{QString("normal"), QString("Normal QString"), QString("Normal text file"), L_TXT, SCLEX_NULL}, {QString("normal"), QString("Normal QString"), QString("Normal text file"), L_TXT, SCLEX_NULL},
@ -190,7 +195,7 @@ LanguageName ScintillaEditView::langNames[L_EXTERNAL + 1] = {
#endif #endif
ScintillaEditView::ScintillaEditView(QWidget *parent,bool isBigText) ScintillaEditView::ScintillaEditView(QWidget *parent,bool isBigText)
: QsciScintilla(parent), m_NoteWin(nullptr), m_preFirstLineNum(0), m_curPos(0), m_hasHighlight(false), m_bookmarkPng(nullptr), m_styleColorMenu(nullptr), m_isBigText(isBigText) : QsciScintilla(parent), m_NoteWin(nullptr), m_preFirstLineNum(0), m_curPos(0), m_hasHighlight(false), m_bookmarkPng(nullptr), m_styleColorMenu(nullptr), m_isBigText(isBigText), m_curBlockLineStartNum(0)
{ {
init(); init();
} }
@ -232,6 +237,12 @@ void ScintillaEditView::setNoteWidget(QWidget * win)
if (pv != nullptr) if (pv != nullptr)
{ {
m_NoteWin = pv; m_NoteWin = pv;
if (m_styleColorMenu != nullptr)
{
m_styleColorMenu->addAction(tr("Clear Select"), m_NoteWin, &CCNotePad::slot_clearWordHighlight);
m_styleColorMenu->addAction(tr("Clear All"), m_NoteWin, &CCNotePad::slot_clearMark);
}
} }
} }
@ -251,7 +262,7 @@ void ScintillaEditView::updateLineNumbersMargin(bool forcedToHide) {
//根据现有滚动条来决定是否更新屏幕线宽长度。每滚动200个单位必须调整line宽 //根据现有滚动条来决定是否更新屏幕线宽长度。每滚动200个单位必须调整line宽
void ScintillaEditView::autoAdjustLineWidth(int xScrollValue) void ScintillaEditView::autoAdjustLineWidth(int xScrollValue)
{ {
//如果是大文本模式,是没有行号的,直接返回 //如果是大文本模式,行号长度目前是固定不变的,不需要动态调整。
if (m_isBigText) if (m_isBigText)
{ {
return; return;
@ -297,8 +308,7 @@ void ScintillaEditView::updateLineNumberWidth(int lineNumberMarginDynamicWidth)
} }
else else
{ {
int nbDigits = 9; int pixelWidth = 6 + INIT_BIG_RO_TEXT_LINE_WIDTH * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<sptr_t>("8"));
int pixelWidth = 6 + nbDigits * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<sptr_t>("8"));
execute(SCI_SETMARGINWIDTHN, SC_BIGTEXT_LINES, pixelWidth); execute(SCI_SETMARGINWIDTHN, SC_BIGTEXT_LINES, pixelWidth);
} }
@ -335,6 +345,246 @@ sptr_t ScintillaEditView::execute(quint32 Msg, uptr_t wParam, sptr_t lParam) con
} }
}; };
QString ScintillaEditView::getTagByLexerId(int lexerId)
{
switch (lexerId)
{
case L_PHP:
return "php";
case L_HTML:
return ("html");
case L_ASP:
return ("asp");
case L_JSP:
return("jsp");
case L_C:
return("c");
case L_RC:
return("rc");
case L_CPP:
return "cpp";
case L_OBJC:
return ("objc");
case L_CS:
return ("csharp");
case L_JAVA:
return ("java");
case L_XML:
return "xml";
case L_MAKEFILE:
return "makefile";
case L_PASCAL:
return "pascal";
case L_BATCH:
return "batch";
case L_INI:
return("ini");
case L_ASCII:
break;
case L_USER:
break;
case L_SQL:
return "sql";
case L_VB:
return "vb";
case L_CSS:
return "css";
case L_PERL:
return "perl";
case L_PYTHON:
return "python";
case L_LUA:
return "lua";
case L_TEX:
break;
case L_FORTRAN:
return "fortran";
case L_BASH:
return "bash";
case L_FLASH:
return("flash");
case L_NSIS:
return "nsis";
case L_TCL:
return "tcl";
case L_LISP:
break;
case L_SCHEME:
break;
case L_ASM:
break;
case L_DIFF:
return "diff";
case L_PROPS:
return "props";
case L_PS:
break;
case L_RUBY:
return "ruby";
case L_SMALLTALK:
break;
case L_VHDL:
return "vhdl";
case L_KIX:
break;
case L_AU3:
break;
case L_CAML:
break;
case L_ADA:
break;
case L_VERILOG:
return "verilog";
case L_MATLAB:
return "matlab";
case L_HASKELL:
break;
case L_INNO:
break;
case L_SEARCHRESULT:
break;
case L_CMAKE:
return "cmake";
case L_YAML:
return "yaml";
case L_COBOL:
break;
case L_GUI4CLI:
break;
case L_D:
break;
case L_POWERSHELL:
break;
case L_COFFEESCRIPT:
return "coffeescript";
case L_JSON:
return "json";
case L_JAVASCRIPT:
return ("javascript");
case L_FORTRAN_77:
return "fortran77";
case L_BAANC:
break;
case L_SREC:
break;
case L_IHEX:
break;
case L_TEHEX:
break;
case L_SWIFT:
break;
case L_ASN1:
break;
//case L_AVS:
// return "avs";
case L_BLITZBASIC:
break;
case L_PUREBASIC:
break;
case L_FREEBASIC:
break;
case L_CSOUND:
break;
case L_ERLANG:
break;
case L_ESCRIPT:
break;
case L_FORTH:
break;
case L_LATEX:
break;
case L_MMIXAL:
break;
case L_NIM:
break;
case L_NNCRONTAB:
break;
case L_OSCRIPT:
break;
case L_REBOL:
break;
case L_REGISTRY:
break;
case L_RUST:
return "rust";
case L_SPICE:
return "spice";
case L_TXT2TAGS:
break;
case L_VISUALPROLOG:
break;
case L_TYPESCRIPT:
return("typescript");
case L_EXTERNAL:
break;
case L_IDL:
return("idl");
case L_GO:
return("go");
case L_GLOBAL:
return("AllGlobal");
case L_TXT:
return("txt");
case L_USER_TXT:
break;
case L_USER_CPP:
break;
default:
break;
}
return "";
}
//status : true 表示存在, false 表示不存在 //status : true 表示存在, false 表示不存在
//tag只有在用户自定义语法是才需要给出。内部自带的语法不需要给出 //tag只有在用户自定义语法是才需要给出。内部自带的语法不需要给出
//isOrigin:是否原生lexer即不读取用户修改过的配置风格 //isOrigin:是否原生lexer即不读取用户修改过的配置风格
@ -444,6 +694,7 @@ QsciLexer* ScintillaEditView::createLexer(int lexerId, QString tag, bool isOrigi
case L_SCHEME: case L_SCHEME:
break; break;
case L_ASM: case L_ASM:
ret = new QsciLexerAsm();
break; break;
case L_DIFF: case L_DIFF:
ret = new QsciLexerDiff(); ret = new QsciLexerDiff();
@ -522,7 +773,7 @@ QsciLexer* ScintillaEditView::createLexer(int lexerId, QString tag, bool isOrigi
case L_ASN1: case L_ASN1:
break; break;
case L_AVS: case L_AVS:
ret = new QsciLexerAVS(); //ret = new QsciLexerAVS();
break; break;
case L_BLITZBASIC: case L_BLITZBASIC:
break; break;
@ -800,18 +1051,6 @@ void ScintillaEditView::init()
execute(SCI_SETWHITESPACESIZE,3); execute(SCI_SETWHITESPACESIZE,3);
setCaretLineVisible(true); setCaretLineVisible(true);
//execute(SCI_INDICSETHOVERFORE, URL_INDIC, 0x80ffff);
//if (StyleSet::m_curStyleId != BLACK_SE)
//{
// setCaretLineBackgroundColor(QColor(0xe8e8ff));
//}
//else
//{
// setCaretLineBackgroundColor(QColor(0x333333));
//}
//统一设置全局前景、背景、字体大小三个要素 //统一设置全局前景、背景、字体大小三个要素
updateThemes(); updateThemes();
@ -876,7 +1115,7 @@ void ScintillaEditView::showBigTextLineAddr(qint64 fileOffset)
memset(lineString, 0, 17); memset(lineString, 0, 17);
lineLength = this->lineLength(i); lineLength = this->lineLength(i);
if (fileOffset < 0xffffffff) if (fileOffset < 0xffffffff)
{ {
sprintf(lineString, "%08llX ", fileOffset); sprintf(lineString, "%08llX ", fileOffset);
@ -895,6 +1134,196 @@ void ScintillaEditView::showBigTextLineAddr(qint64 fileOffset)
delete[]lineString; delete[]lineString;
} }
void ScintillaEditView::clearSuperBitLineCache()
{
m_addrLineNumMap.clear();
}
//20230116新增尽可能的还是显示行号。如果发生了跳转则没有办法计算前面的行号
//则只能显示地址。如果没跳转,而是动态顺序翻页,则可以显示行号
//20230201发现一个问题。底层qscint是按照utf8字节流来计算字符大小的。如果原始文件的编码
//不是utf8,比如GBK LE等则大小是不能统一的。这是一个显示问题但是不影响什么。
//通过this->lineLength(i);来计算是以utf8计算。
void ScintillaEditView::showBigTextLineAddr(qint64 fileOffset, qint64 fileEndOffset)
{
int nbDigits = 0;
if (fileOffset < 0xffffffff)
{
nbDigits = INIT_BIG_RO_TEXT_LINE_WIDTH;
}
else
{
nbDigits = 12;
}
char* lineString = new char[17];
memset(lineString, 0, 17);
auto pixelWidth = 6 + nbDigits * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<sptr_t>("8"));
this->execute(SCI_SETMARGINWIDTHN, SC_BIGTEXT_LINES, pixelWidth);
int lineNums = this->lines();
int lineLength = 0;
qint64 curLineAddr = fileOffset;
int style = STYLE_LINENUMBER;
quint32 startLineNumOffset = 0;
quint32 endLineNumOffset = 0;
bool isShowLineNum = false; //显示行号还是地址
bool startLineExist = false;
bool endLineExist = false;
if (fileOffset == 0)
{
isShowLineNum = true;
startLineExist = true;
m_addrLineNumMap.insert(0, 1); //0地址对应第1行
m_addrLineNumMap.insert(fileEndOffset, lineNums+1); //fileEndOffset地址对应最后一行
}
if (lineNums >= 1)
{
if (m_addrLineNumMap.contains(fileOffset))
{
isShowLineNum = true;
startLineExist = true;
startLineNumOffset = m_addrLineNumMap.value(fileOffset);
}
else if (m_addrLineNumMap.contains(fileEndOffset))
{
isShowLineNum = true;
endLineExist = true;
endLineNumOffset = m_addrLineNumMap.value(fileEndOffset);
}
}
//不存在行号,只能显示地址
if (!isShowLineNum)
{
for (int i = 0; i < lineNums; ++i)
{
memset(lineString, 0, 17);
lineLength = this->lineLength(i);
if (fileOffset < 0xffffffff)
{
sprintf(lineString, "%08llX ", fileOffset);
}
else
{
sprintf(lineString, "%012llX ", fileOffset);
}
QString num(lineString);
fileOffset += lineLength;
this->setMarginText(i, num, style);
}
}
else
{
//首行地址存在,从头到尾增加行号
if (startLineExist)
{
for (int i = 0; i < lineNums; ++i)
{
if (i == (lineNums - 1))
{
//m_addrLineNumMap.insert(fileOffset, startLineNumOffset + i);
m_addrLineNumMap.insert(fileEndOffset, startLineNumOffset + i);
}
memset(lineString, 0, 17);
//lineLength = this->lineLength(i);
sprintf(lineString, "%08lld ", startLineNumOffset + i);
QString num(lineString);
//fileOffset += lineLength;
this->setMarginText(i, num, style);
}
}
else if (endLineExist)
{
startLineNumOffset = endLineNumOffset - lineNums;
for (int i = 0; i < lineNums; ++i)
{
if (i == 0)
{
//m_addrLineNumMap.insert(fileOffset, startLineNumOffset + i);
m_addrLineNumMap.insert(fileOffset, startLineNumOffset + i);
}
memset(lineString, 0, 17);
//lineLength = this->lineLength(i);
sprintf(lineString, "%08lld ", startLineNumOffset + i);
QString num(lineString);
//fileOffset += lineLength;
this->setMarginText(i, num, style);
}
}
}
delete[]lineString;
}
//大文本只读模式下,显示其文本
void ScintillaEditView::showBigTextRoLineNum(BigTextEditFileMgr* txtFile, int blockIndex)
{
BlockIndex bi = txtFile->blocks.at(blockIndex);
int nbDigits = 0;
if (bi.fileOffset < 0xffffffff)
{
nbDigits = INIT_BIG_RO_TEXT_LINE_WIDTH;
}
else
{
nbDigits = 12;
}
char* lineString = new char[17];
memset(lineString, 0, 17);
auto pixelWidth = 6 + nbDigits * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<sptr_t>("8"));
this->execute(SCI_SETMARGINWIDTHN, SC_BIGTEXT_LINES, pixelWidth);
int lineNums = this->lines();
qint64 curLineNum = bi.lineNumStart + 1;//行号从1开始
int style = STYLE_LINENUMBER;
for (int i = 0; i < lineNums; ++i)
{
memset(lineString, 0, 17);
if (bi.fileOffset < 0xffffffff)
{
sprintf(lineString, "%08lld ", curLineNum+i);
}
else
{
sprintf(lineString, "%012lld ", curLineNum + i);
}
QString num(lineString);
this->setMarginText(i, num, style);
}
delete[]lineString;
}
void ScintillaEditView::bookmarkNext(bool forwardScan) void ScintillaEditView::bookmarkNext(bool forwardScan)
{ {
size_t lineno = this->getCurrentLineNumber(); size_t lineno = this->getCurrentLineNumber();
@ -1395,10 +1824,13 @@ void ScintillaEditView::initStyleColorMenu()
m_styleColorMenu->addSeparator(); m_styleColorMenu->addSeparator();
if (m_NoteWin != nullptr)
{
m_styleColorMenu->addAction(tr("Clear Select"), m_NoteWin, &CCNotePad::slot_clearWordHighlight); m_styleColorMenu->addAction(tr("Clear Select"), m_NoteWin, &CCNotePad::slot_clearWordHighlight);
m_styleColorMenu->addAction(tr("Clear All"), m_NoteWin, &CCNotePad::slot_clearMark); m_styleColorMenu->addAction(tr("Clear All"), m_NoteWin, &CCNotePad::slot_clearMark);
} }
} }
}
void ScintillaEditView::contextUserDefineMenuEvent(QMenu* menu) void ScintillaEditView::contextUserDefineMenuEvent(QMenu* menu)
{ {
@ -1799,7 +2231,7 @@ bool ScintillaEditView::undoStreamComment(bool tryBlockComment)
// BlockToStreamComment: If there is no stream-comment symbol and we came not from doBlockComment, try the block comment: // BlockToStreamComment: If there is no stream-comment symbol and we came not from doBlockComment, try the block comment:
if (commentStart.isEmpty() || commentEnd.isEmpty()) if (commentStart.isEmpty() || commentEnd.isEmpty())
{ {
if (!(commentLineSymbol.isEmpty() && tryBlockComment)) if (!commentLineSymbol.isEmpty() && tryBlockComment)
return doBlockComment(cm_uncomment); return doBlockComment(cm_uncomment);
else else
return false; return false;
@ -3031,6 +3463,16 @@ bool isUrl(QString& text, int textLen, int start, int* segmentLen)
return false; return false;
} }
quint32 ScintillaEditView::getBigTextBlockStartLine()
{
return m_curBlockLineStartNum;
}
void ScintillaEditView::setBigTextBlockStartLine(quint32 line)
{
m_curBlockLineStartNum = line;
}
void ScintillaEditView::addHotSpot() void ScintillaEditView::addHotSpot()
{ {
if (CCNotePad::s_hightWebAddr == 1) if (CCNotePad::s_hightWebAddr == 1)

View File

@ -113,6 +113,7 @@ enum Font_Set_Bit {
class FindRecords; class FindRecords;
class CCNotePad; class CCNotePad;
struct BigTextEditFileMgr;
class ScintillaEditView : public QsciScintilla class ScintillaEditView : public QsciScintilla
{ {
@ -129,7 +130,8 @@ public:
sptr_t execute(quint32 Msg, uptr_t wParam = 0, sptr_t lParam = 0) const; sptr_t execute(quint32 Msg, uptr_t wParam = 0, sptr_t lParam = 0) const;
static QsciLexer * createLexer(int lexerId, QString tag="", bool isOrigin=false, int styleId=-1); static QsciLexer * createLexer(int lexerId, QString tag="", bool isOrigin=false, int styleId=-1);
static QString getTagByLexerId(int lexerId);
void appendMarkRecord(FindRecords *r); void appendMarkRecord(FindRecords *r);
void releaseAllMark(); void releaseAllMark();
QList<FindRecords*>& getCurMarkRecord(); QList<FindRecords*>& getCurMarkRecord();
@ -195,14 +197,19 @@ public:
void setBigTextMode(bool isBigText); void setBigTextMode(bool isBigText);
void showBigTextLineAddr(qint64 fileOffset); void showBigTextLineAddr(qint64 fileOffset);
void showBigTextLineAddr(qint64 fileStartOffset, qint64 fileEndOffset);
void showBigTextRoLineNum(BigTextEditFileMgr* txtFile, int blockIndex);
void updateThemes(); void updateThemes();
void clearSuperBitLineCache();
//下面三个函数,是设置全局样式的接口。全局样式不同于每个语法中的样式 //下面三个函数,是设置全局样式的接口。全局样式不同于每个语法中的样式
void setGlobalFgColor(int style); void setGlobalFgColor(int style);
void setGlobalBgColor(int style); void setGlobalBgColor(int style);
void setGlobalFont(int style); void setGlobalFont(int style);
//void setGlobalFont(int style, const QFont& f,int stylePointSize = -1);
//获取当前块的开始行号。只在大文件只读模式下有效。其余模式下均返回0
quint32 getBigTextBlockStartLine();
void setBigTextBlockStartLine(quint32 line);
signals: signals:
void delayWork(); void delayWork();
@ -300,6 +307,10 @@ private:
QList<QAction*> m_styleMarkActList; QList<QAction*> m_styleMarkActList;
bool m_isBigText;//大文本 bool m_isBigText;//大文本
quint32 m_curBlockLineStartNum;
QMap<qint64, quint32> m_addrLineNumMap;//大文本模式下,地址和行号的对应关系。只需要首尾即可
public: public:
static int s_tabLens; static int s_tabLens;
static bool s_noUseTab; static bool s_noUseTab;

42
src/shortcutkeyeditwin.cpp Executable file
View File

@ -0,0 +1,42 @@
#include "shortcutkeyeditwin.h"
#include <QMessageBox>
ShortcutKeyEditWin::ShortcutKeyEditWin(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
ui.keySequenceEdit->setFocus();
}
ShortcutKeyEditWin::~ShortcutKeyEditWin()
{}
void ShortcutKeyEditWin::setCurKeyDesc(QString desc)
{
ui.curKeylineEdit->setText(desc);
}
void ShortcutKeyEditWin::setTitle(QString title)
{
this->setWindowTitle(title);
}
QKeySequence ShortcutKeyEditWin::getNewKeySeq()
{
return m_newKeys;
}
//确认修改,先检查一下。最多四个键
void ShortcutKeyEditWin::slot_ok()
{
QKeySequence keys = ui.keySequenceEdit->keySequence();
if (keys.isEmpty())
{
QMessageBox::warning(this, tr("Error"), tr("input right key !"));
return;
}
m_newKeys = keys;
done(1);
}

24
src/shortcutkeyeditwin.h Executable file
View File

@ -0,0 +1,24 @@
#pragma once
#include <QDialog>
#include "ui_shortcutkeyeditwin.h"
class ShortcutKeyEditWin : public QDialog
{
Q_OBJECT
public:
ShortcutKeyEditWin(QWidget *parent = nullptr);
~ShortcutKeyEditWin();
void setCurKeyDesc(QString desc);
QKeySequence getNewKeySeq();
void setTitle(QString title);
private slots:
void slot_ok();
private:
Ui::ShortcutKeyEditWinClass ui;
QKeySequence m_newKeys;
};

116
src/shortcutkeyeditwin.ui Executable file
View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ShortcutKeyEditWinClass</class>
<widget class="QDialog" name="ShortcutKeyEditWinClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>459</width>
<height>137</height>
</rect>
</property>
<property name="windowTitle">
<string>ShortcutKeyEditWin</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Current Key Sequence:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="curKeylineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>New Key Sequence:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QKeySequenceEdit" name="keySequenceEdit"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>ShortcutKeyEditWinClass</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>388</x>
<y>103</y>
</hint>
<hint type="destinationlabel">
<x>414</x>
<y>131</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>ShortcutKeyEditWinClass</receiver>
<slot>slot_ok()</slot>
<hints>
<hint type="sourcelabel">
<x>153</x>
<y>95</y>
</hint>
<hint type="destinationlabel">
<x>186</x>
<y>128</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>slot_ok()</slot>
</slots>
</ui>

317
src/shortcutkeymgr.cpp Executable file
View File

@ -0,0 +1,317 @@
#include "shortcutkeymgr.h"
#include "shortcutkeyeditwin.h"
#include "ccnotepad.h"
#include <QTableWidgetItem>
#include <QSettings>
#include <Qsci/qscicommandset.h>
#include <Qsci/qsciscintilla.h>
#include <QDebug>
QMap<QString, int>* ShortcutKeyMgr::s_shortcutKeysMap = nullptr;
//QMap<QString, int> * qScintShortcutKeyValueMap = nullptr;
struct ShortcutKeySt {
QString iniTag;//保存在Ini文件中的名称
QString name;//显示在表格中的名称
//QString keyDesc;//qkeysequence的描述
QKeySequence key;
bool canModify;//能否修改
ShortcutKeySt() = default;
ShortcutKeySt(QString name_, QString iniTag_, bool canMofidy=true) :name(name_), iniTag(iniTag_), canModify(canMofidy)
{
}
ShortcutKeySt(QString name_, QString iniTag_, QString keySeq, bool canMofidy = true) :name(name_), iniTag(iniTag_), canModify(canMofidy)
{
key = QKeySequence(keySeq);
}
};
QVector<ShortcutKeySt> shortCutTable;
ShortcutKeyMgr::ShortcutKeyMgr(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
initShortcutKeysMap();
initNddShortcutTable();
m_pNoteEdit = parent;
initQscintShortcutTable();
connect(ui.tableWidget, &QTableWidget::itemDoubleClicked, this, &ShortcutKeyMgr::slot_edit);
ui.tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
ui.tableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
ui.tableWidget->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
ui.qscintTableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
ui.qscintTableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
ui.qscintTableWidget->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
}
ShortcutKeyMgr::~ShortcutKeyMgr()
{}
void ShortcutKeyMgr::initShortcutKeysMap()
{
if (s_shortcutKeysMap == nullptr)
{
s_shortcutKeysMap = new QMap<QString, int>();
shortCutTable << ShortcutKeySt(tr("New File"), New_File, QString("Ctrl+T")) \
<< ShortcutKeySt(tr("Open File"), Open_File, QString("Ctrl+O")) \
<< ShortcutKeySt(tr("Save File"), Save_File, QString("Ctrl+S"), false) \
<< ShortcutKeySt(tr("Save All File"), Save_All_File) \
<< ShortcutKeySt(tr("Close"), Close, QString("Ctrl+W")) \
<< ShortcutKeySt(tr("Close All"), Close_All, QString("Ctrl+Shift+W")) \
<< ShortcutKeySt(tr("Cut"), Cut, QString("Ctrl+X"),false) \
<< ShortcutKeySt(tr("Copy"), Copy, QString("Ctrl+C"), false) \
<< ShortcutKeySt(tr("Paste"), Paste, QString("Ctrl+V"), false) \
<< ShortcutKeySt(tr("Undo"), Undo, QString("Ctrl+Z"), false) \
<< ShortcutKeySt(tr("Redo"), Redo, QString("Ctrl+Y"), false) \
<< ShortcutKeySt(tr("Find"), Find, QString("Ctrl+F"),false) \
<< ShortcutKeySt(tr("Replace"), Replace, QString("Ctrl+H")) \
<< ShortcutKeySt(tr("Dir Find"), DirFind, QString("Ctrl+Shift+D")) \
<< ShortcutKeySt(tr("Mark"), Mark) \
<< ShortcutKeySt(tr("word highlight(F8)"), Word_highlight, QString("F8"))\
<< ShortcutKeySt(tr("clear all highlight(F7)"), Clear_all_highlight, QString("F7")) \
<< ShortcutKeySt(tr("Zoom In"), Zoom_In) \
<< ShortcutKeySt(tr("Zoom Out"), Zoom_Out) \
<< ShortcutKeySt(tr("Word Wrap"), Word_Wrap) \
<< ShortcutKeySt(tr("Show Blank"), Show_Blank) \
<< ShortcutKeySt(tr("Indent Guide"), Indent_Guide) \
<< ShortcutKeySt(tr("Pre Hex Page"), Pre_Page) \
<< ShortcutKeySt(tr("Next Hex Page"), Next_Page)\
<< ShortcutKeySt(tr("Goto Hex Page"), Goto_Page, QString("Ctrl+G")) \
<< ShortcutKeySt(tr("File Compare"), File_Compare) \
<< ShortcutKeySt(tr("Dir Compare"), Dir_Compare) \
<< ShortcutKeySt(tr("Bin Compare"), Bin_Compare) \
<< ShortcutKeySt(tr("transform encoding"), Trans_code) \
<< ShortcutKeySt(tr("batch rename file"), Batch_rename) \
<< ShortcutKeySt(tr("Format Xml"), Format_Xml) \
<< ShortcutKeySt(tr("Format Json"), Format_Json);
for (int i = 0; i < shortCutTable.size(); ++i)
{
s_shortcutKeysMap->insert(shortCutTable.at(i).iniTag, i);
}
//从文件中读取用户修改过的配置表。
loadUserDefSet();
}
}
//务必先调用initShortcutKeysMap()
QKeySequence ShortcutKeyMgr::getUserDefShortcutKey(QString iniTag)
{
if (s_shortcutKeysMap->contains(iniTag))
{
return shortCutTable.at(s_shortcutKeysMap->value(iniTag)).key;
}
return QKeySequence();
}
//从用户ini配置中加载快捷键配置
void ShortcutKeyMgr::loadUserDefSet()
{
QString userDefFile = QString("notepad/shortcuttab");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userDefFile);
qs.setIniCodec("UTF-8");
QStringList keys = qs.allKeys();
QString keySeqStr;
for (int i = 0; i < keys.size(); ++i)
{
const QString & initTag = keys.at(i);
keySeqStr = qs.value(initTag).toString();
if (s_shortcutKeysMap->contains(initTag))
{
int index = s_shortcutKeysMap->value(initTag);
shortCutTable[index].key = QKeySequence(keySeqStr);
}
}
}
//修改配置文件中的快捷键定义。inittag ini的key, keySeqStr ini的value。内存也修改了
bool ShortcutKeyMgr::ModifyShortCutKey(QString initTag, QString keySeqStr)
{
QString userDefFile = QString("notepad/shortcuttab");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userDefFile);
qs.setIniCodec("UTF-8");
if (s_shortcutKeysMap->contains(initTag))
{
int index = s_shortcutKeysMap->value(initTag);
if (!shortCutTable[index].canModify)
{
return false;
}
shortCutTable[index].key = QKeySequence(keySeqStr);
qs.setValue(initTag, keySeqStr);
qs.sync();
return true;
}
return false;
}
void ShortcutKeyMgr::initNddShortcutTable()
{
for (int i = 0; i < shortCutTable.size(); ++i)
{
ui.tableWidget->insertRow(i);
QTableWidgetItem* item = new QTableWidgetItem(shortCutTable.at(i).name);
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
ui.tableWidget->setItem(i, 0, item);
qDebug() << shortCutTable.at(i).key.toString();
QTableWidgetItem* item1 = new QTableWidgetItem(shortCutTable.at(i).key.toString());
ui.tableWidget->setItem(i, 1, item1);
if (!shortCutTable.at(i).canModify)
{
QTableWidgetItem* item2 = new QTableWidgetItem(tr("Can't Modify"));
ui.tableWidget->setItem(i, 2, item2);
}
else
{
QTableWidgetItem* item2 = new QTableWidgetItem(tr("Double Click To Modify"));
ui.tableWidget->setItem(i, 2, item2);
}
}
}
//初始化qscint内部的快捷键。目前这部分不能修改。
void ShortcutKeyMgr::initQscintShortcutTable()
{
QsciScintilla* pNote = new QsciScintilla(nullptr);
QsciCommandSet* cmdSet = pNote->standardCommands();
QList<QsciCommand*>& cmdList = cmdSet->commands();
int rowNum = 0;
for (int i = 0; i < cmdList.size(); ++i)
{
if (cmdList.at(i)->key() == 0)
{
continue;
}
ui.qscintTableWidget->insertRow(rowNum);
QTableWidgetItem* item = new QTableWidgetItem(cmdList.at(i)->description());
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
ui.qscintTableWidget->setItem(rowNum, 0, item);
QTableWidgetItem* item1 = new QTableWidgetItem(QKeySequence(cmdList.at(i)->key()).toString());
ui.qscintTableWidget->setItem(rowNum, 1, item1);
QTableWidgetItem* item2 = new QTableWidgetItem(tr("Can't Modify"));
ui.qscintTableWidget->setItem(rowNum, 2, item2);
++rowNum;
}
delete pNote;
}
//type 0 ndd 1 qscint
int ShortcutKeyMgr::isKeySeqExist(int row, QString keySeq, int &type)
{
int c = ui.tableWidget->rowCount();
for (int i = 0; i < c; ++i)
{
if (i == row)
{
continue;
}
if (ui.tableWidget->item(i, 1)->text() == keySeq)
{
type = 0;
return i;
}
}
c = ui.qscintTableWidget->rowCount();
for (int i = 0; i < c; ++i)
{
if (ui.qscintTableWidget->item(i, 1)->text() == keySeq)
{
type = 1;
return i;
}
}
return -1;
}
//双击修改槽函数
void ShortcutKeyMgr::slot_edit(QTableWidgetItem* item)
{
int row = item->row();
if (!shortCutTable.at(row).canModify)
{
ui.plainTextEdit->setPlainText(tr("row %1 shortcut key '%2' can't modify !").arg(row + 1).arg(shortCutTable.at(row).key.toString()));
return;
}
ShortcutKeyEditWin* pWin = new ShortcutKeyEditWin(this);
pWin->setTitle(shortCutTable.at(row).name);
pWin->setCurKeyDesc(shortCutTable.at(row).key.toString());
if (1 == pWin->exec())
{
QKeySequence newKeySeq = pWin->getNewKeySeq();
QTableWidgetItem* item = ui.tableWidget->item(row, 1);
if (item != nullptr)
{
//检查是否冲突,如果冲突,则不设置。先预留
int conflictType = 0;
int existId = isKeySeqExist(row, newKeySeq.toString(), conflictType);
if (-1 == existId)
{
if (ModifyShortCutKey(shortCutTable.at(row).iniTag, newKeySeq.toString()))
{
CCNotePad* pNotePad = dynamic_cast<CCNotePad*>(m_pNoteEdit);
if (pNotePad != nullptr)
{
pNotePad->setUserDefShortcutKey(row);
}
item->setText(newKeySeq.toString());
ui.plainTextEdit->setPlainText(tr("modify row %1 to '%2' shortcut key success!").arg(row + 1).arg(newKeySeq.toString()));
}
else
{
ui.plainTextEdit->setPlainText(tr("error:modify row %1 to '%2' shortcut key failed !").arg(row + 1).arg(newKeySeq.toString()));
}
}
else
{
if (conflictType == 0)
{
ui.plainTextEdit->setPlainText(tr("conflict error! '%1' Already exist at row %2").arg(newKeySeq.toString()).arg(existId + 1));
}
else
{
ui.plainTextEdit->setPlainText(tr("conflict error! '%1' Already exist at qscint row %2").arg(newKeySeq.toString()).arg(existId + 1));
}
}
}
}
else
{
ui.plainTextEdit->setPlainText(tr("modify canceled !"));
}
}

104
src/shortcutkeymgr.h Executable file
View File

@ -0,0 +1,104 @@
#pragma once
#include <QMainWindow>
#include "ui_shortcutkeymgr.h"
enum Shortcut_Key_ID {
New_File_ID=0,
Open_File_ID,
Save_File_ID,
Save_All_File_ID,
Close_ID,
Close_All_ID,
Cut_ID,
Copy_ID,
Paste_ID,
Undo_ID,
Redo_ID,
Find_ID,
Replace_ID,
Dir_Find_ID,
Mark_ID,
Word_highlight_ID,
Clear_all_highlight_ID,
Zoom_In_ID,
Zoom_Out_ID,
Word_Wrap_ID,
Show_Blank_ID,
Indent_Guide_ID,
Pre_Page_ID,
Next_Page_ID,
Goto_Page_ID,
File_Compare_ID,
Dir_Compare_ID,
Bin_Compare_ID,
Trans_code_ID,
Batch_rename_ID,
Format_Xml_ID,
Format_Json_ID,
Shortcut_End_ID,//×ÜÊÇÔÚ×îµ×ÏÂ
};
static const char* New_File = "newfile";
static const char* Open_File = "openfile";
static const char* Save_File = "savefile";
static const char* Save_All_File = "saveall";
static const char* Close = "close";
static const char* Close_All = "closeall";
static const char* Cut = "cut";
static const char* Copy = "copy";
static const char* Paste = "paste";
static const char* Undo = "undo";
static const char* Redo = "redo";
static const char* Find = "find";
static const char* Replace = "replace";
static const char* DirFind = "dirfind";
static const char* Mark = "mark";
static const char* Word_highlight = "wordlight";
static const char* Clear_all_highlight = "clearwordlight";
static const char* Zoom_In = "zoomin";
static const char* Zoom_Out ="zoomout";
static const char* Word_Wrap = "wordwrap";
static const char* Show_Blank = "showblank";
static const char* Indent_Guide = "indentguide";
static const char* Pre_Page = "prepage";
static const char* Next_Page = "nextpage";
static const char* Goto_Page = "goto";
static const char* File_Compare = "filecmp";
static const char* Dir_Compare ="dircmp";
static const char* Bin_Compare ="bincmp";
static const char* Trans_code = "transcode";
static const char* Batch_rename = "batchrename";
static const char* Format_Xml = "formatxml";
static const char* Format_Json = "formatjson";
class ShortcutKeyMgr : public QMainWindow
{
Q_OBJECT
public:
ShortcutKeyMgr(QWidget *parent = nullptr);
~ShortcutKeyMgr();
static void initShortcutKeysMap();
static QKeySequence getUserDefShortcutKey(QString iniTag);
private:
void initNddShortcutTable();
void initQscintShortcutTable();
static void loadUserDefSet();
int isKeySeqExist(int row, QString keySeq, int& type);
bool ModifyShortCutKey(QString initTag, QString keySeqStr);
private slots:
void slot_edit(QTableWidgetItem* item);
private:
Ui::ShortcutKeyMgrClass ui;
static QMap<QString, int>* s_shortcutKeysMap;
QWidget* m_pNoteEdit;
};

201
src/shortcutkeymgr.ui Executable file
View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ShortcutKeyMgrClass</class>
<widget class="QMainWindow" name="ShortcutKeyMgrClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>766</width>
<height>508</height>
</rect>
</property>
<property name="windowTitle">
<string>ShortcutKeyMgr</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Ndd Shortcut</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTableWidget" name="tableWidget">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<column>
<property name="text">
<string>Function</string>
</property>
</column>
<column>
<property name="text">
<string>Shortcut Key</string>
</property>
</column>
<column>
<property name="text">
<string>Comment</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Qscint Shortcut</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTableWidget" name="qscintTableWidget">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<column>
<property name="text">
<string>Function</string>
</property>
</column>
<column>
<property name="text">
<string>Shortcut Key</string>
</property>
</column>
<column>
<property name="text">
<string>Comment</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>ShortcutKeyMgrClass</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>432</x>
<y>465</y>
</hint>
<hint type="destinationlabel">
<x>465</x>
<y>481</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -3,6 +3,7 @@
#include "ccnotepad.h" #include "ccnotepad.h"
#include "qtlangset.h" #include "qtlangset.h"
#include <QFontDialog> #include <QFontDialog>
#include <QColorDialog>
TextEditSetWin::TextEditSetWin(QWidget *parent) TextEditSetWin::TextEditSetWin(QWidget *parent)
: QWidget(parent), m_notepadWin(nullptr) : QWidget(parent), m_notepadWin(nullptr)
@ -19,6 +20,10 @@ TextEditSetWin::TextEditSetWin(QWidget *parent)
ui.BigTextSizeLimit->setValue(ScintillaEditView::s_bigTextSize); ui.BigTextSizeLimit->setValue(ScintillaEditView::s_bigTextSize);
ui.restoreFile->setChecked((CCNotePad::s_restoreLastFile == 1)); ui.restoreFile->setChecked((CCNotePad::s_restoreLastFile == 1));
QPalette pal = QApplication::palette();
} }
TextEditSetWin::~TextEditSetWin() TextEditSetWin::~TextEditSetWin()
@ -31,17 +36,7 @@ void TextEditSetWin::setNotePadWin(QWidget *w)
m_notepadWin = w; m_notepadWin = w;
} }
#if 0
//弹出对话框时,默认初始化该值
void TextEditSetWin::setFont(QFont &font)
{
if (m_curFont != font)
{
m_curFont = font;
}
ui.curTextFontEdit->setText(font.toString());
}
#endif
#if 0 #if 0
//弹出对话框时,默认初始化该值 //弹出对话框时,默认初始化该值
void TextEditSetWin::setProgramLangFont(QFont &font) void TextEditSetWin::setProgramLangFont(QFont &font)

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>617</width> <width>617</width>
<height>140</height> <height>300</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -132,18 +132,92 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <widget class="QGroupBox" name="groupBox_2">
<item> <property name="title">
<widget class="QCheckBox" name="restoreFile"> <string>Font Setting</string>
<property name="text">
<string>Remember files opened on close</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Txt File Font:</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string> Set</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>App Font Color:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="appFontColorLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Set</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="restoreFile">
<property name="text"> <property name="text">
<string>Txt File Font Set</string> <string>Restore files opened on close</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -170,7 +244,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>7</height> <height>40</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -181,18 +255,34 @@
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
<sender>pushButton</sender> <sender>toolButton</sender>
<signal>clicked()</signal> <signal>clicked()</signal>
<receiver>TextEditSetWin</receiver> <receiver>TextEditSetWin</receiver>
<slot>slot_txtFontSet()</slot> <slot>slot_txtFontSet()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>295</x> <x>129</x>
<y>105</y> <y>126</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>369</x> <x>567</x>
<y>132</y> <y>292</y>
</hint>
</hints>
</connection>
<connection>
<sender>toolButton1</sender>
<signal>clicked()</signal>
<receiver>TextEditSetWin</receiver>
<slot>slot_appFontColor()</slot>
<hints>
<hint type="sourcelabel">
<x>195</x>
<y>151</y>
</hint>
<hint type="destinationlabel">
<x>193</x>
<y>304</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -201,5 +291,7 @@
<slot>slot_selectFont()</slot> <slot>slot_selectFont()</slot>
<slot>slot_selectProLangFont()</slot> <slot>slot_selectProLangFont()</slot>
<slot>slot_txtFontSet()</slot> <slot>slot_txtFontSet()</slot>
<slot>slot_selectAppFont()</slot>
<slot>slot_appFontColor()</slot>
</slots> </slots>
</ui> </ui>

View File

@ -1,31 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1972
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RealCompare", "..\src\RealCompare.vcxproj", "{26BC87D0-189B-3661-B87D-347CF9E0A47F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qscintilla", "..\src\qscint\src\qscintilla.vcxproj", "{9BC42707-EE25-3B28-9906-F7919E273020}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{26BC87D0-189B-3661-B87D-347CF9E0A47F}.Debug|x64.ActiveCfg = Debug|x64
{26BC87D0-189B-3661-B87D-347CF9E0A47F}.Debug|x64.Build.0 = Debug|x64
{26BC87D0-189B-3661-B87D-347CF9E0A47F}.Release|x64.ActiveCfg = Release|x64
{26BC87D0-189B-3661-B87D-347CF9E0A47F}.Release|x64.Build.0 = Release|x64
{9BC42707-EE25-3B28-9906-F7919E273020}.Debug|x64.ActiveCfg = Debug|x64
{9BC42707-EE25-3B28-9906-F7919E273020}.Debug|x64.Build.0 = Debug|x64
{9BC42707-EE25-3B28-9906-F7919E273020}.Release|x64.ActiveCfg = Release|x64
{9BC42707-EE25-3B28-9906-F7919E273020}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F8D03E96-542B-49CA-8FE2-21F7AF7CDD2E}
EndGlobalSection
EndGlobal

View File

@ -1,31 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1972
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "helloworld", "..\src\plugin\helloworld\helloworld.vcxproj", "{06EED29A-D357-39F4-B1B8-25129EBC2852}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qscintilla", "..\src\qscint\src\qscintilla.vcxproj", "{9BC42707-EE25-3B28-9906-F7919E273020}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{06EED29A-D357-39F4-B1B8-25129EBC2852}.Debug|x64.ActiveCfg = Debug|x64
{06EED29A-D357-39F4-B1B8-25129EBC2852}.Debug|x64.Build.0 = Debug|x64
{06EED29A-D357-39F4-B1B8-25129EBC2852}.Release|x64.ActiveCfg = Release|x64
{06EED29A-D357-39F4-B1B8-25129EBC2852}.Release|x64.Build.0 = Release|x64
{9BC42707-EE25-3B28-9906-F7919E273020}.Debug|x64.ActiveCfg = Debug|x64
{9BC42707-EE25-3B28-9906-F7919E273020}.Debug|x64.Build.0 = Debug|x64
{9BC42707-EE25-3B28-9906-F7919E273020}.Release|x64.ActiveCfg = Release|x64
{9BC42707-EE25-3B28-9906-F7919E273020}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4AF45FF1-9FBE-4C6B-A177-E7BBD96267C5}
EndGlobalSection
EndGlobal

View File

@ -1,31 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1738
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qscintilla", "..\src\qscint\src\qscintilla.vcxproj", "{1A6F5081-AC34-3289-B3D1-C03725833468}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RealCompare", "..\src\RealCompare.vcxproj", "{3842E8A0-CF86-31D6-A247-40F65F8611D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1A6F5081-AC34-3289-B3D1-C03725833468}.Debug|x64.ActiveCfg = Debug|x64
{1A6F5081-AC34-3289-B3D1-C03725833468}.Debug|x64.Build.0 = Debug|x64
{1A6F5081-AC34-3289-B3D1-C03725833468}.Release|x64.ActiveCfg = Release|x64
{1A6F5081-AC34-3289-B3D1-C03725833468}.Release|x64.Build.0 = Release|x64
{3842E8A0-CF86-31D6-A247-40F65F8611D3}.Debug|x64.ActiveCfg = Debug|x64
{3842E8A0-CF86-31D6-A247-40F65F8611D3}.Debug|x64.Build.0 = Debug|x64
{3842E8A0-CF86-31D6-A247-40F65F8611D3}.Release|x64.ActiveCfg = Release|x64
{3842E8A0-CF86-31D6-A247-40F65F8611D3}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B9B2FC3E-0F05-46A6-86A0-BDCE3D56484F}
EndGlobalSection
EndGlobal