diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index ec442ce..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-cmake_minimum_required(VERSION 3.16)
-project(NotePad-- VERSION 1.22.0)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-set(CMAKE_AUTORCC ON)
-
-find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns)
-
-# qscint 关键依赖库
-add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint)
-
-# 插件库包含
-# helloworld 动态插件库
-add_subdirectory(${PROJECT_SOURCE_DIR}/src/plugin/helloworld)
-
-# win下需要开启UNICODE进行支持TCHAR
-if(CMAKE_HOST_WIN32)
- add_definitions(-D_UNICODE -DUNICODE)
-endif()
-
-
-if(${PLUGIN_EN})
- if(${PLUGIN_EN} STREQUAL on)
- add_definitions(-DNO_PLUGIN=1)
- endif(${PLUGIN_EN})
-endif()
-
-
-
-file(GLOB UI_SRC ${PROJECT_SOURCE_DIR}/src/*.ui)
-set(UI_SRC ${UI_SRC} ${PROJECT_SOURCE_DIR}/src/cceditor/ccnotepad.ui)
-aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)
-aux_source_directory(${PROJECT_SOURCE_DIR}/src/cceditor SRC)
-
-
-if(CMAKE_HOST_WIN32)
-# 添加 WIN32 保证主程序启动没有命令行
- list(APPEND WIN_RCS ${PROJECT_SOURCE_DIR}/src/RealCompareToMinGw.rc)
- add_executable(${PROJECT_NAME} WIN32 ${WIN_RCS} ${SRC} ${UI_SRC} ${PROJECT_SOURCE_DIR}/src/RealCompare.qrc)
-else()
- add_executable(${PROJECT_NAME} ${SRC} ${UI_SRC} ${PROJECT_SOURCE_DIR}/src/RealCompare.qrc)
-endif()
-
-target_include_directories(${PROJECT_NAME} PRIVATE
-${PROJECT_SOURCE_DIR}/src
-${PROJECT_SOURCE_DIR}/src/cceditor
-
-${PROJECT_SOURCE_DIR}/src/qscint/src
-${PROJECT_SOURCE_DIR}/src/qscint/src/Qsci
-${PROJECT_SOURCE_DIR}/src/qscint/scintilla/src
-${PROJECT_SOURCE_DIR}/src/qscint/scintilla/include
-${PROJECT_SOURCE_DIR}/src/qscint/scintilla/lexlib
-${PROJECT_SOURCE_DIR}/src/qscint/scintilla/boostregex
-)
-
-target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
-
-# set(PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/bin")
-# set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-
-if(CMAKE_HOST_UNIX)
- install(
- TARGETS ${PROJECT_NAME}
- DESTINATION "bin"
- )
-
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/linux/usr
- DESTINATION "/")
-
- include(${PROJECT_SOURCE_DIR}/cmake/deb_package_config.cmake)
- include(CPack)
-elseif(CMAKE_HOST_WIN32)
- install(TARGETS ${PROJECT_NAME}
- DESTINATION "/")
-
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/build/bin/
- DESTINATION "/")
- # 设置软件版本
- set(CPACK_PACKAGE_NAME "NotePad--")
- set(CPACK_PACKAGE_DESCRIPTION "NotePad--")
- set(CPACK_PACKAGE_COPYRIGHT "Copyright (c) 2023")
- set(CPACK_PACKAGE_VERSION "1.22.0")
- set(CPACK_PACKAGE_VERSION_MAJOR "1")
- set(CPACK_PACKAGE_VERSION_MINOR "22")
- set(CPACK_PACKAGE_VERSION_PATCH "0")
-
- include(${PROJECT_SOURCE_DIR}/cmake/nsis_package_config.cmake)
- include(CPack)
-endif()
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 2db5182..0000000
--- a/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-UNAME:=WIN32
-UNAME:=$(shell uname)
-
-# Win下使用Git Bash运行make
-
-ifeq ($(UNAME), Linux)
-all:linux
-linux:
- make -f linux.mk package
-else
-all:
- make -f win.mk all
-msvc:
- make -f win.mk msvc
-mingw:
- make -f win.mk mingw
-endif
diff --git a/README.md b/README.md
index 82a227c..979bdbd 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
这是一个使用C++编写的文本编辑器Notepad--,可以支持Win/Linux/Mac平台。
-我们的目标是要进行文本编辑类软件的国产可替代,重点在国产Uos系统、Mac 系统上发展。
+我们的目标是要进行文本编辑类软件的国产可替代,重点在国产Uos/Linux系统、Mac 系统上发展。
一个支持windows/linux/mac的文本编辑器,目标是要国产替换同类软件,来自中国。
@@ -30,49 +30,8 @@ NDD已初步推出插件编写功能,希望广大的CPP/QT开发者加入我
![输入图片说明](6688.png)
## 编译
+见build目录下文档 linux开源编译及下载说明.txt
-**CMake工具链编译说明:**
-
-- Ubuntu/Debian
-
-1. 安装编译环境 `sudo apt-get install g++ make cmake`
-1. 安装qt工具和库 `sudo apt-get install qtbase5-dev qt5-qmake qtbase5-dev-tools libqt5printsupport5 libqt5xmlpatterns5-dev `
-1. 配置 `cmake -B build -DCMAKE_BUILD_TYPE=Release`
-1. 编译 `cd build && make -j`
-1. 打包 `cpack`
-
-- ArchLinux
-
-1. 安装编译环境 `sudo pacman -S gcc cmake make ninja`
-1. 安装 qt 工具和库 `sudo pacman -S qt5-tools qt5-base qt5-xmlpatterns`
-1. 配置 `cmake -S . -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -W no-dev`
-1. 编译 `ninja -C build && ninja -C build install`
-1. 打包: 使用 [AUR/notepad---git](https://aur.archlinux.org/packages/notepad---git) `yay -S notepad---git`
-1. 安装:
- - 预编译包添加 [ArchLinuxCN/notepad---git](https://github.com/archlinuxcn/repo) 镜像 `yay -S archlinuxcn/notepad---git`
- - 预编译包 [Debuginfod/notepad---git-debug](https://wiki.archlinux.org/title/Debuginfod) 包 `yay -S archlinuxcn/notepad---git-debug`
-
-- openSUSE Tumbleweed
-
-1. 安装编译环境和Qt工具库 `sudo zypper in -t pattern devel_C_C++ devel_basis devel_qt5 `
-1. 配置 `cmake -B build -DCMAKE_BUILD_TYPE=Release `
-1. 编译 `cd build && make -j `
-1. 打包使用 OBS (Open Build Service)
-
-**Qt工程编译说明:**
-
-1)使用qtcreator 或 vs 先打开qscint/src/qscintilla.pro 。先编译出这个qscintlla的依赖库。
-
-2)再打开RealCompare.pro 加载后编译。
-
-3)由于编译的平台较多,涉及windows/linux/mac,有任何编译问题,还请加qq群 959439826 。欢迎广大网友实现新功能后提交代码给我们。
-
-代码上线不久,删除了商业的对比功能和注册功能(这部分有商业原因,请理解),除此以外,所有功能全部保留。
-
-4)Arch Linux 及其衍生版可以通过 AUR 仓库安装:[notepad---git](https://aur.archlinux.org/packages/notepad---git)
-```
-yay -S notepad---git
-```
## 联络方式
QQ群:959439826 用户群,做NDD的问题反馈、功能建议等。
@@ -85,6 +44,6 @@ QQ群 616606091 开发群,建议懂CPP/QT、愿意参与NDD项目代码贡献
![输入图片说明](png/6.png)
-![输入图片说明](png/%E6%88%AA%E5%B1%8F2023-02-26%2011.41.20.png)
+![Mac系统运行图](png/%E6%88%AA%E5%B1%8F2023-02-26%2011.41.20.png)
-![输入图片说明](png/%E6%88%AA%E5%B1%8F2023-02-26%2011.45.48.png)
\ No newline at end of file
+![Mac系统文件对比图](png/%E6%88%AA%E5%B1%8F2023-02-26%2011.45.48.png)
\ No newline at end of file
diff --git a/THIRDPARTY.md b/THIRDPARTY.md
deleted file mode 100644
index cca4e3a..0000000
--- a/THIRDPARTY.md
+++ /dev/null
@@ -1,15 +0,0 @@
-## 第三方依赖
-
-## 源码依赖
-
-- [[GPL v3](src/qscint/LICENSE)] [QScintilla](https://riverbankcomputing.com/software/qscintilla/intro)
-- [GPL v3]
- - [boostregex](src/qscint/scintilla/boostregex)
- - [rgba_icons.h](src/rgba_icons.h)
- - [xmlMatchedTagsHighlighter.cpp](src/qscint/src/xmlMatchedTagsHighlighter.cpp)
- - [xmlMatchedTagsHighlighter.h](src/qscint/src/xmlMatchedTagsHighlighter.h)
-
-## 开发、打包时依赖
-
-- [[zlib/libpng](https://nsis.sourceforge.io/License)] [NSIS](https://nsis.sourceforge.io)
- 打包工具
diff --git a/changelog.txt b/changelog.txt
index 8a713b8..5ff7b6d 100755
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,34 @@
+Ndd V1.23 发布 20230226
+功能:
+1 希望可以支持xml按照层次折叠和展开操作
+2 能否增加自动刷新和滚动文本功能,以及手动重新打开文件。提供tailf方式。
+3 建议 查找与替换 添加ESC键响应,ESC键退出查找替换窗体
+4 查找替换没有默认选中
+5 新窗口打开的文件,不能再拖放回去
+6 无法计算选中内容的行数
+7 json 格式化,提供json格式化插件,命令行插件等
+8 高清屏幕适配一些列问题
+9 能否支持在软件内设置文件关联。安装包支持
+10 希望记录一下关闭软件时的标签页
+11 增加md5/sha计算
+
+改进:
+1 新建文件缩进参考线会消失
+2 XML 文件 注释部分文字偏小看不清
+3 关闭编辑器之后,编辑器的设置窗口还在,如果多次就会有下图的样子
+4 Ctrl+F时,建议文本框内的内容默认选中
+5 建议程序打开时tab页为最后关闭时tab页
+6 选中多个文件右键打开时会启动多个窗口,而非多个标签,
+7 双击英文句点全部文本都会高亮
+8 command只能-缩小,+没用 不能放大
+9 CTRL+F搜索框丢失焦点后,再用快捷键CTRL+F不能自动聚焦
+10 已设置的快捷键可以取消
+11 希望显示总字数
+12 Ctrl+S时,并不能删除.swp临时文件,建议隐藏.swp文件
+13 建议 增加 打开当前文件目录下 命令提示符的功能
+14 显示空格的问题
+15 鼠标选择文本后高亮
+
Ndd V1.22 预发布 20230202
1 提供大文本、超大文本打开两种方式;并尽量显示行号。
2 增加ASM语言的语法高亮;增加shell语法高亮。
diff --git a/cmake/deb_package_config.cmake b/cmake/deb_package_config.cmake
deleted file mode 100644
index a0488aa..0000000
--- a/cmake/deb_package_config.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-set(CPACK_GENERATOR "DEB")
-set(CPACK_PACKAGE_NAME "notepad--")
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "a text editor like notepad++")
-set(CPACK_PACKAGE_CONTACT "coconil")
-
-set(CPACK_PACKAGE_VERSION "1.22.0")
-set(CPACK_PACKAGE_VERSION_MAJOR "1")
-set(CPACK_PACKAGE_VERSION_MINOR "22")
-set(CPACK_PACKAGE_VERSION_PATCH "0")
-
-set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
-set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
-set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5concurrent5,libqt5core5a,libqt5gui5,libqt5network5,libqt5printsupport5,libqt5xmlpatterns5")
\ No newline at end of file
diff --git a/cmake/nsis_package_config.cmake b/cmake/nsis_package_config.cmake
deleted file mode 100644
index 0098d39..0000000
--- a/cmake/nsis_package_config.cmake
+++ /dev/null
@@ -1,59 +0,0 @@
-set(CPACK_GENERATOR NSIS)
-
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}")
-# 维护人员
-set(CPACK_PACKAGE_CONTACT "XiaoPb")
-
-set(P4_VERSION_INFO_CL_HIGH "0")
-set(P4_VERSION_INFO_CL_LOW "0")
-# set(CPACK_PACKAGE_VERSION_PATCH "0")
-
-set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
-
-set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_NAME}V${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME}V${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-
-set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
-
-set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/ico/txt (9).ico")
-set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/ico/txt (9).ico")
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License")
-
-set (CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}" )
-
-# 设置 安装包属性信息
-set (CPACK_NSIS_DEFINES "
- ${CPACK_NSIS_DEFINES}
- VIProductVersion ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${P4_VERSION_INFO_CL_HIGH}.${P4_VERSION_INFO_CL_LOW}
- VIFileVersion ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${P4_VERSION_INFO_CL_HIGH}.${P4_VERSION_INFO_CL_LOW}
- VIAddVersionKey /LANG=0 \\\"ProductName\\\" \\\"${CPACK_PACKAGE_NAME}\\\"
- VIAddVersionKey /LANG=0 \\\"ProductVersion\\\" \\\"v${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_PACKAGE_BUILD_TYPE_REVISION}\\\"
- VIAddVersionKey /LANG=0 \\\"Comments\\\" \\\"${CPACK_PACKAGE_DESCRIPTION}\\\"
- VIAddVersionKey /LANG=0 \\\"CompanyName\\\" \\\"${CPACK_PACKAGE_VENDOR}\\\"
- VIAddVersionKey /LANG=0 \\\"LegalCopyright\\\" \\\"${CPACK_PACKAGE_COPYRIGHT}\\\"
- VIAddVersionKey /LANG=0 \\\"FileDescription\\\" \\\"${CPACK_PACKAGE_NAME} Installer\\\"
- VIAddVersionKey /LANG=0 \\\"FileVersion\\\" \\\"v${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_PACKAGE_BUILD_TYPE_REVISION}\\\"
- "
-)
-
-# 设置 安装时需要的环境变量
-set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
- WriteRegStr SHCTX \\\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\App Paths\\\\${PROJECT_NAME}\\\" \\\"\\\" \\\"$INSTDIR\\\\bin\\\\${PROJECT_NAME}.exe\\\"
- WriteRegStr SHCTX \\\"Software\\\\Classes\\\\${PROJECT_NAME}\\\\shell\\\" \\\"\\\" \\\"open\\\"
- WriteRegStr SHCTX \\\"Software\\\\Classes\\\\${PROJECT_NAME}\\\\shell\\\\open\\\\command\\\" \\\"\\\" \\\"$\\\\\\\"$INSTDIR\\\\bin\\\\${PROJECT_NAME}.exe$\\\\\\\" $\\\\\\\"%1$\\\\\\\"\\\"
- WriteRegStr SHCTX \\\"Software\\\\Classes\\\\.txt\\\\OpenWithProgids\\\" \\\"${PROJECT_NAME}\\\" \\\"\\\"
- WriteRegStr SHCTX \\\"Software\\\\Classes\\\\*\\\\shell\\\\${PROJECT_NAME}\\\" \\\"\\\" \\\"Edit with ${PROJECT_NAME}\\\"
- WriteRegStr SHCTX \\\"Software\\\\Classes\\\\*\\\\shell\\\\${PROJECT_NAME}\\\" \\\"Icon\\\" \\\"$INSTDIR\\\\bin\\\\${PROJECT_NAME}.exe\\\"
- WriteRegStr SHCTX \\\"Software\\\\Classes\\\\*\\\\shell\\\\${PROJECT_NAME}\\\\command\\\" \\\"\\\" \\\"$\\\\\\\"$INSTDIR\\\\bin\\\\${PROJECT_NAME}.exe$\\\\\\\" $\\\\\\\"%1$\\\\\\\"\\\"
- ")
-
-# 设置 卸载时需要的环境变量
-set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
- Delete \\\"$DESKTOP\\\\${PROJECT_NAME}.lnk\\\"
- Delete \\\"$SMPROGRAMS\\\\${PROJECT_NAME}.lnk\\\"
- DeleteRegKey SHCTX \\\"Software\\\\Classes\\\\*\\\\shell\\\\${PROJECT_NAME}\\\"
- DeleteRegKey SHCTX \\\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\App Paths\\\\bin\\\\${PROJECT_NAME}.exe\\\" \\\"\\\" \\\"$INSTDIR\\\\bin\\\\${PROJECT_NAME}.exe\\\"
- DeleteRegKey SHCTX \\\"Software\\\\${PROJECT_NAME}\\\"
- DeleteRegValue SHCTX \\\"Software\\\\Classes\\\\.txt\\\\OpenWithProgids\\\" \\\"${PROJECT_NAME}\\\"
- DeleteRegKey SHCTX \\\"Software\\\\Classes\\\\${PROJECT_NAME}\\\"
- ")
diff --git a/linux.mk b/linux.mk
deleted file mode 100644
index 43f4a79..0000000
--- a/linux.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-CPUS=$(shell nproc)
-CALENDAR=$(shell date '+%Y%m%d')
-OSID=$(shell lsb_release -si)
-OSRELEASE=$(shell lsb_release -sr)
-SUFFIX=
-ifneq ("$(OSID)", "")
-SUFFIX=_$(OSID)$(OSRELEASE)
-endif
-
-PROJECT_NAME=notepad--
-PACKAGE_NAME=com.hmja.notepad
-
-all:
- mkdir -p build
- cd build && cmake ..
- cd build && make -j$(CPUS)
-
-run: all
- exec $(shell find build/ -maxdepth 1 -type f -executable | grep $(PROJECT_NAME))
-
-debug:
- mkdir -p build
- cd build && cmake -DCMAKE_BUILD_TYPE=Debug ..
- cd build && make -j$(CPUS)
-
-release:
- mkdir -p build
- cd build && cmake -DCMAKE_BUILD_TYPE=Release -DPLUGIN_EN=off -DPACKAGE_SUFFIX="$(SUFFIX)" ..
- cd build && make -j$(CPUS)
-
-package: release
- cd build && make package
- tree build/_CPack_Packages/Linux/DEB/$(PROJECT_NAME)-*
-# dpkg-deb --contents build/$(PROJECT_NAME)$(SUFFIX).deb
-
-builddeps:
- cd build && make builddeps
-
-cpus:
- @echo "CPU数量: $(CPUS)"
-
-
diff --git a/src/CmpareMode.cpp b/src/CmpareMode.cpp
index f0618bd..98351e0 100755
--- a/src/CmpareMode.cpp
+++ b/src/CmpareMode.cpp
@@ -132,7 +132,6 @@ CODE_ID CmpareMode::getTextFileEncodeType(uchar* fileFpr, int fileLength, QStrin
//是否跳过前面的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
diff --git a/src/RealCompare.qrc b/src/RealCompare.qrc
index eb1a277..bfc9ab1 100755
--- a/src/RealCompare.qrc
+++ b/src/RealCompare.qrc
@@ -145,5 +145,7 @@
Resources/img/expand.png
Resources/img/fold.png
qss/common.qss
+ notepad/tailf.png
+ Resources/edit/styledeepblue/tailf.png
diff --git a/src/RealCompare.rc b/src/RealCompare.rc
index e5433f3..b16c23b 100755
Binary files a/src/RealCompare.rc and b/src/RealCompare.rc differ
diff --git a/src/batchfindreplace.cpp b/src/batchfindreplace.cpp
index 9dabbfc..e305b9f 100755
--- a/src/batchfindreplace.cpp
+++ b/src/batchfindreplace.cpp
@@ -1,8 +1,9 @@
-#include "batchfindreplace.h"
+#include "batchfindreplace.h"
#include "scintillaeditview.h"
#include "ccnotepad.h"
#include "progresswin.h"
#include "nddsetting.h"
+#include "ctipwin.h"
#include
#include
@@ -31,7 +32,7 @@ void BatchFindReplace::setTabWidget(QTabWidget* editTabWidget)
m_editTabWidget = editTabWidget;
}
-//自动调整当前窗口的状态,如果发生了变化,则需要认定为是首次查找
+//Զǰڵ״̬˱仯Ҫ϶Ϊ״β
QWidget* BatchFindReplace::autoAdjustCurrentEditWin()
{
QWidget* pw = m_editTabWidget->currentWidget();
@@ -53,7 +54,7 @@ void BatchFindReplace::appendToFindTable(QString findKeyword)
ui.findReplaceTable->setItem(rNum, 1, new QTableWidgetItem());
}
-//这里不能追加,而是插入,即对应的Item必须已经存在。否则不插入
+//ﲻӣDz룬ӦItemѾڡ
void BatchFindReplace::insertToReplaceTable(int row, QString replaceKeyword)
{
QTableWidgetItem* item = ui.findReplaceTable->item(row, 1);
@@ -97,11 +98,11 @@ void BatchFindReplace::appendToFindReplaceTable(QStringList& findKeyword)
bool BatchFindReplace::tranInputKeyword(QString& findKeyWord, QStringList& outputKeyWordList)
{
- //把空白字符,空格或者\t \r\n 等字符进行替换为空格
+ //ѿհַո\t \r\n ַ滻Ϊո
QRegExp re("\\s");
findKeyWord.replace(re, QString(" "));
- //再进行空格分隔处理
+ //ٽпոָ
outputKeyWordList = findKeyWord.split(" ");
if (outputKeyWordList.size() > 20000)
@@ -110,7 +111,7 @@ bool BatchFindReplace::tranInputKeyword(QString& findKeyWord, QStringList& outpu
return false;
}
- //删除每一个空的元素
+ //ɾÿһյԪ
for (int i = outputKeyWordList.size() - 1; i >= 0; --i)
{
if (outputKeyWordList[i].trimmed().isEmpty())
@@ -166,61 +167,48 @@ void BatchFindReplace::on_freshBtClick()
}
}
-//进行批量查找工作
+//ҹ
void BatchFindReplace::on_findBtClick()
{
if (m_mainNotepad != nullptr && m_mainNotepad)
{
int rowNums = ui.findReplaceTable->rowCount();
-
if (rowNums == 0)
{
+ CTipWin::showTips(this, tr("Please fresh first !"), 1200);
return;
}
- ProgressWin* loadFileProcessWin = new ProgressWin(this);
-
- loadFileProcessWin->setWindowModality(Qt::WindowModal);
-
- loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(rowNums));
-
- loadFileProcessWin->setTotalSteps(rowNums);
-
- loadFileProcessWin->show();
-
int foundTimes = 0;
+ QStringList findKeyList;
+
for (int i = 0; i < rowNums; ++i)
{
QTableWidgetItem* item = ui.findReplaceTable->item(i, 0);
if (item != nullptr && !item->text().isEmpty())
{
- if (loadFileProcessWin->isCancel())
- {
- break;
- }
-
- foundTimes += m_mainNotepad->findAtBack(item->text());
-
- loadFileProcessWin->moveStep();
-
- QCoreApplication::processEvents();
+ findKeyList.append(item->text());
}
}
- delete loadFileProcessWin;
+ foundTimes = m_mainNotepad->findAtBack(findKeyList);
ui.statusBar->showMessage(tr("Batch Find Finished! total %1 found.").arg(foundTimes),10000);
}
}
-//进行批量替换工作
+//滻
void BatchFindReplace::on_replaceBtClick()
{
- if (m_mainNotepad != nullptr && m_mainNotepad)
+ if (m_mainNotepad != nullptr)
{
int rowNums = ui.findReplaceTable->rowCount();
+ if (rowNums == 0)
+ {
+ CTipWin::showTips(this, tr("Please fresh first !"), 1200);
+ return;
+ }
- int replaceTimes = 0;
QStringList findKeyList;
QStringList replaceKeyList;
@@ -241,9 +229,9 @@ void BatchFindReplace::on_replaceBtClick()
}
}
}
- replaceTimes = m_mainNotepad->replaceAtBack(findKeyList, replaceKeyList);
+ m_mainNotepad->replaceAtBack(findKeyList, replaceKeyList);
- ui.statusBar->showMessage(tr("Batch Replace Finished, total Replace %1 times !").arg(replaceTimes), 10000);
+ ui.statusBar->showMessage(tr("Batch Replace Finished, total Replace %1 times !").arg(findKeyList.size()), 10000);
}
}
@@ -306,9 +294,9 @@ void BatchFindReplace::on_import()
QFileDialog fd(this, QString(), CCNotePad::s_lastOpenDirPath);
fd.setFileMode(QFileDialog::ExistingFile);
- if (fd.exec() == QDialog::Accepted) //如果成功的执行
+ if (fd.exec() == QDialog::Accepted) //ɹִ
{
- QStringList fileNameList = fd.selectedFiles(); //返回文件列表的名称
+ QStringList fileNameList = fd.selectedFiles(); //ļб
QFileInfo fi(fileNameList[0]);
QSettings setting(fi.filePath(), QSettings::IniFormat);
@@ -332,40 +320,24 @@ void BatchFindReplace::on_mark()
int rowNums = ui.findReplaceTable->rowCount();
if (rowNums == 0)
{
+ CTipWin::showTips(this, tr("Please fresh first !"), 1200);
return;
}
-
int markTimes = 0;
- ProgressWin* loadFileProcessWin = new ProgressWin(this);
-
- loadFileProcessWin->setWindowModality(Qt::WindowModal);
-
- loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(rowNums));
-
- loadFileProcessWin->setTotalSteps(rowNums);
-
- loadFileProcessWin->show();
+ QStringList findKeyList;
for (int i = 0; i < rowNums; ++i)
{
QTableWidgetItem* item = ui.findReplaceTable->item(i, 0);
if (item != nullptr && !item->text().isEmpty())
{
- if (loadFileProcessWin->isCancel())
- {
- break;
- }
-
- markTimes += m_mainNotepad->markAtBack(item->text());
-
- loadFileProcessWin->moveStep();
-
- QCoreApplication::processEvents();
+ findKeyList.append(item->text());
}
}
- delete loadFileProcessWin;
+ markTimes = m_mainNotepad->markAtBack(findKeyList);
+
ui.statusBar->showMessage(tr("Batch Mark Finished, total Mark %1 times !").arg(markTimes), 10000);
}
}
diff --git a/src/bigfilemessage.cpp b/src/bigfilemessage.cpp
index c3c699b..9eac27c 100755
--- a/src/bigfilemessage.cpp
+++ b/src/bigfilemessage.cpp
@@ -1,4 +1,5 @@
-#include "bigfilemessage.h"
+#include "bigfilemessage.h"
+#include "nddsetting.h"
BigFileMessage::BigFileMessage(QWidget *parent)
: QDialog(parent), m_result(-1)
@@ -41,19 +42,19 @@ void BigFileMessage::slot_okBt()
{
if (ui.textMode->isChecked())
{
- m_result = TXT_TYPE;//普通文本
+ m_result = TXT_TYPE;//ͨı
}
else if(ui.bigTextMode->isChecked())
{
- m_result = BIG_TEXT_RO_TYPE; //小于8G的大文本
+ m_result = BIG_TEXT_RO_TYPE; //С8GĴı
}
else if (ui.superBigTextMode->isChecked())
{
- m_result = SUPER_BIG_TEXT_RO_TYPE;//8G以上的大文本
+ m_result = SUPER_BIG_TEXT_RO_TYPE;//8GϵĴı
}
else if (ui.hexMode->isChecked())
{
- m_result = HEX_TYPE;//二进制
+ m_result = HEX_TYPE;//
}
done(m_result);
}
@@ -62,4 +63,4 @@ void BigFileMessage::slot_cancelBt()
{
m_result = -1;
done(m_result);
-}
+}
\ No newline at end of file
diff --git a/src/cceditor/ccnotepad.cpp b/src/cceditor/ccnotepad.cpp
index 18d491f..23bafc6 100755
--- a/src/cceditor/ccnotepad.cpp
+++ b/src/cceditor/ccnotepad.cpp
@@ -25,6 +25,7 @@
#include "batchfindreplace.h"
#include "langextset.h"
#include "shortcutkeymgr.h"
+#include "md5hash.h"
#include "CmpareMode.h"
#ifdef NO_PLUGIN
@@ -33,6 +34,9 @@
#include "pluginGl.h"
#endif
+#ifdef Q_OS_WIN
+#include "dectfilechanges.h"
+#endif
#include
#include
@@ -72,7 +76,6 @@
#endif
#include
-
#ifdef Q_OS_WIN
extern bool s_isAdminAuth;
@@ -99,34 +102,30 @@ int CCNotePad::s_zoomValue = 0;
QString CCNotePad::s_lastOpenDirPath = "";
-
-//QFont CCNotePad::s_txtFont;
-//QFont CCNotePad::s_proLangFont;
-
-
QList *CCNotePad::s_padInstances = nullptr;
//文件保存的路径,qstring
-const char* Edit_View_FilePath = "filePath";
+static const char* Edit_View_FilePath = "filePath";
//int 新文件的id序号。非新建文件为-1
-const char* Edit_File_New = "newfile";
+static const char* Edit_File_New = "newfile";
//是否修改 true false
-const char* Edit_Text_Change = "change";
-
-//编码类型,int
-const char* Edit_Text_Code = "code";
+static const char* Edit_Text_Change = "change";
//line行尾符号
-const char* Edit_Text_End = "lineend";
+static const char* Edit_Text_End = "lineend";
//外部修改
-const char* Modify_Outside = "modify";
+static const char* Modify_Outside = "modify";
//文档类型 1:text 2 hex
-const char* Doc_Type = "type";
+static const char* Doc_Type = "type";
+//tail状态 0 关闭 1开启
+static const char* Tail_Status = "tail";
+
+static const int MSG_EXIST_TIME = 8000;
void setFileOpenAttrProperty(QWidget* pwidget, OpenAttr attr)
{
@@ -187,6 +186,7 @@ void setFileNewIndexProperty(QWidget* pwidget, int index)
pwidget->setProperty(Edit_File_New, v);
}
+//新文件的id,非新文件为-1
int getFileNewIndexProperty(QWidget* pwidget)
{
return pwidget->property(Edit_File_New).toInt();
@@ -225,6 +225,17 @@ int getEndTypeProperty(QWidget* pwidget)
return pwidget->property(Edit_Text_End).toInt();
}
+void setFileTailProperty(QWidget* pwidget, int type)
+{
+ QVariant v(type);
+ pwidget->setProperty(Tail_Status, v);
+}
+
+int getFileTailProperty(QWidget* pwidget)
+{
+ return pwidget->property(Tail_Status).toInt();
+}
+
//根据当前路径,得到交互文件的名称
QString getSwapFilePath(QString filePath)
{
@@ -341,6 +352,7 @@ const char *ZoomoutIcon32 = ":/Resources/edit/styledeepblue/zoomout.png";
const char *CrlfIcon32 = ":/Resources/edit/styledeepblue/crlf.png";
const char *WhiteIcon32 = ":/Resources/edit/styledeepblue/white.png";
const char *IndentIcon32 = ":/Resources/edit/styledeepblue/indentGuide.png";
+const char* TailfIcon32 = ":/Resources/edit/styledeepblue/tailf.png";
const char *FileCompareIcon32 = ":/Resources/edit/styledeepblue/filecompare.png";
const char *DirCompareIcon32 = ":/Resources/edit/styledeepblue/dircompare.png";
const char *BinCmpIcon32 = ":/Resources/edit/styledeepblue/bincmp.png";
@@ -418,6 +430,7 @@ const char* ZoomoutIcon = ":/notepad/zoomOut.png";
const char* CrlfIcon = ":/notepad/wrap.png";
const char* WhiteIcon = ":/notepad/invisibleChar.png";
const char* IndentIcon = ":/notepad/indentGuide.png";
+const char* TailfIcon = ":/notepad/tailf.png";
const char* FileCompareIcon = ":/notepad/cmpfile.png";
const char* DirCompareIcon = ":/notepad/cmpdir.png";
const char* BinCmpIcon = ":/notepad/cmpbin.png";
@@ -482,6 +495,8 @@ FileExtLexer s_fileExtMapLexerId[FileExtMapLexerIdLen] = {
{QString("lua"), L_LUA},
{QString("sql"), L_SQL},
{QString("yml"), L_YAML},
+{QString("m"), L_MATLAB},
+{QString("md"), L_MARKDOWN},
{QString("nsi"), L_NSIS},
{QString("nsh"), L_NSIS},
{QString("v"), L_VERILOG},
@@ -556,8 +571,8 @@ void initFileTypeLangMap()
{
ExtLexerManager::getInstance()->addNewExtType(ext, lexerId, tagName);
- }
-}
+ }
+ }
}
//最后加载用户自定义的文件后缀名和语法关联文件
@@ -585,7 +600,7 @@ void CCNotePad::initLexerNameToIndex()
data.setValue(int(L_ASM));
ui.actionAssembly->setData(data);
m_lexerNameToIndex.insert("asm", pNodes[i]);
- ++i;
+ ++i;
pNodes[i].pAct = ui.actionbash;
pNodes[i].index = L_BASH;
@@ -1076,7 +1091,8 @@ LexerInfo CCNotePad::getLangLexerIdByFileExt(QString filePath)
CCNotePad::CCNotePad(bool isMainWindows, QWidget *parent)
: QMainWindow(parent), m_cutFile(nullptr),m_copyFile(nullptr), m_dockSelectTreeWin(nullptr), \
m_pResultWin(nullptr),m_isQuitCancel(false), m_tabRightClickMenu(nullptr), m_shareMem(nullptr),m_isMainWindows(isMainWindows),\
- m_openInNewWinAct(nullptr), m_showFileDirAct(nullptr), m_timerAutoSave(nullptr), m_curColorIndex(-1), m_fileListView(nullptr), m_isInReloadFile(false), m_isToolMenuLoaded(false)
+ m_openInNewWinAct(nullptr), m_showFileDirAct(nullptr), m_showCmdAct(nullptr), m_timerAutoSave(nullptr), m_curColorIndex(-1), \
+ m_fileListView(nullptr), m_isInReloadFile(false), m_isToolMenuLoaded(false), m_isRecentFileLoaded(false)
{
ui.setupUi(this);
@@ -1227,6 +1243,7 @@ void CCNotePad::quickshow()
//启用拖动
setAcceptDrops(true);
+
initFileTypeLangMap();
initLexerNameToIndex();
@@ -1277,15 +1294,24 @@ void CCNotePad::quickshow()
m_saveFile->setEnabled(false);
m_saveAllFile->setEnabled(false);
- initReceneOpenFileMenu();
+ //initReceneOpenFileMenu();
+ //延迟加载最近菜单列表
+ connect(ui.menuRecene_File, &QMenu::aboutToShow, this, &CCNotePad::on_loadReceneFile);
//最后加入退出菜单
ui.menuFile->addSeparator();
+
+#if 0
m_quitAction = ui.menuFile->addAction(tr("Quit"), this, &CCNotePad::slot_quit);
m_quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
+#endif
connect(ui.editTabWidget, &QTabWidget::currentChanged, this, &CCNotePad::slot_tabCurrentChanged, Qt::UniqueConnection);
connect(ui.editTabWidget, &QTabWidget::tabBarClicked, this, &CCNotePad::slot_tabBarClicked, Qt::QueuedConnection);
+
+ //双击在新窗口中打开
+ connect(ui.editTabWidget, &QTabWidget::tabBarDoubleClicked, this, &CCNotePad::on_tabBarDoubleClicked, Qt::QueuedConnection);
+
ui.editTabWidget->installEventFilter(this);
m_fileWatch = new QFileSystemWatcher(this);
@@ -1503,13 +1529,136 @@ void CCNotePad::setUserDefShortcutKey(int shortcutId)
case Format_Json_ID:
keySeq = ShortcutKeyMgr::getUserDefShortcutKey(Format_Json);
m_formatJson->setShortcut(keySeq);
-
+ break;
+
+ case ADD_DEL_LINE_COM:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(ADD_DELETE_LINE_COMMENT);
+ registerCommentShortKey(ADD_DEL_LINE_COM, keySeq);
+ break;
+
+ case ADD_BK_COM:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(ADD_BLOCK_COMMENT);
+ registerCommentShortKey(ADD_BK_COM, keySeq);
+ break;
+
+ case DEL_BK_COM:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(CANCEL_BLOCK_COMMENT);
+ registerCommentShortKey(DEL_BK_COM, keySeq);
+ break;
+
+ case S_K_FOLD_1:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(FOLD_1);
+ registerFoldShortKey(S_K_FOLD_1, keySeq, false);
+ break;
+ case S_K_FOLD_2:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(FOLD_2);
+ registerFoldShortKey(S_K_FOLD_2, keySeq, false);
+ break;
+ case S_K_FOLD_3:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(FOLD_3);
+ registerFoldShortKey(S_K_FOLD_3, keySeq, false);
+ break;
+ case S_K_FOLD_4:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(FOLD_4);
+ registerFoldShortKey(S_K_FOLD_4, keySeq, false);
+ break;
+ case S_K_FOLD_5:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(FOLD_5);
+ registerFoldShortKey(S_K_FOLD_5, keySeq, false);
+ break;
+ case S_K_FOLD_6:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(FOLD_6);
+ registerFoldShortKey(S_K_FOLD_6, keySeq, false);
+ break;
+ case S_K_FOLD_7:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(FOLD_7);
+ registerFoldShortKey(S_K_FOLD_7, keySeq, false);
+ break;
+ case S_K_FOLD_8:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(FOLD_8);
+ registerFoldShortKey(S_K_FOLD_8, keySeq, false);
+ break;
+ case S_K_UNFOLD_1:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(UNFOLD_1);
+ registerFoldShortKey(S_K_UNFOLD_1, keySeq, true);
+ break;
+ case S_K_UNFOLD_2:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(UNFOLD_2);
+ registerFoldShortKey(S_K_UNFOLD_2, keySeq, true);
+ break;
+ case S_K_UNFOLD_3:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(UNFOLD_3);
+ registerFoldShortKey(S_K_UNFOLD_3, keySeq, true);
+ break;
+ case S_K_UNFOLD_4:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(UNFOLD_4);
+ registerFoldShortKey(S_K_UNFOLD_4, keySeq, true);
+ break;
+ case S_K_UNFOLD_5:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(UNFOLD_5);
+ registerFoldShortKey(S_K_UNFOLD_5, keySeq, true);
+ break;
+ case S_K_UNFOLD_6:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(UNFOLD_6);
+ registerFoldShortKey(S_K_UNFOLD_6, keySeq, true);
+ break;
+ case S_K_UNFOLD_7:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(UNFOLD_7);
+ registerFoldShortKey(S_K_UNFOLD_7, keySeq, true);
+ break;
+ case S_K_UNFOLD_8:
+ keySeq = ShortcutKeyMgr::getUserDefShortcutKey(UNFOLD_8);
+ registerFoldShortKey(S_K_UNFOLD_8, keySeq, true);
break;
default:
break;
}
}
+
+void CCNotePad::registerFoldShortKey(int type, QKeySequence& keySeq, bool isFold)
+{
+ QShortcut* pStc = new QShortcut(this);
+ pStc->setKey(keySeq);
+ pStc->setContext(Qt::WidgetWithChildrenShortcut);
+ connect(pStc, &QShortcut::activated, this, [=]() {
+ doFold(type, isFold);
+ });
+}
+
+//注册注释快捷键
+void CCNotePad::registerCommentShortKey(int type, QKeySequence& keySeq)
+{
+ QShortcut* pStc = new QShortcut(this);
+ pStc->setKey(keySeq);
+ pStc->setContext(Qt::WidgetWithChildrenShortcut);
+ connect(pStc, &QShortcut::activated, this, [=]() {
+ doComment(type);
+ });
+}
+
+//注释问题。
+void CCNotePad::doComment(int type)
+{
+ QWidget* pw = ui.editTabWidget->currentWidget();
+ ScintillaEditView* pEdit = dynamic_cast(pw);
+ if (pEdit != nullptr && !pEdit->isReadOnly())
+ {
+ pEdit->comment(type);
+ }
+}
+
+void CCNotePad::doFold(int type, bool mode)
+{
+ QWidget* pw = ui.editTabWidget->currentWidget();
+ ScintillaEditView* pEdit = dynamic_cast(pw);
+ if (pEdit != nullptr)
+ {
+ pEdit->collapse((mode?(type - S_K_UNFOLD_1): (type - S_K_FOLD_1)), mode);
+ }
+}
+
+
//设置用户自定义快捷键
void CCNotePad::setUserDefShortcutKey()
{
@@ -1537,9 +1686,7 @@ void CCNotePad::slot_dynamicLoadToolMenu()
{
m_isToolMenuLoaded = true;
-#ifdef NO_PLUGIN
- connect(ui.actionPlugin_Manager, &QAction::triggered, this, &CCNotePad::slot_pluginMgr);
-#endif
+ connect(ui.actionPlugin_Manager, &QAction::triggered, this, &CCNotePad::slot_pluginMgr, Qt::UniqueConnection);
QMenu* formatMenu = new QMenu(tr("Format Language"), this);
m_formatXml = formatMenu->addAction(tr("Format Xml"), this, &CCNotePad::slot_formatXml);
@@ -1552,20 +1699,25 @@ void CCNotePad::slot_dynamicLoadToolMenu()
#ifdef NO_PLUGIN
//动态加载插件
+ m_pluginList.clear();
loadPluginLib();
#endif
}
}
-#ifdef NO_PLUGIN
+
void CCNotePad::slot_pluginMgr()
{
+#ifdef NO_PLUGIN
PluginMgr* pWin = new PluginMgr(this, m_pluginList);
pWin->setAttribute(Qt::WA_DeleteOnClose);
pWin->show();
+#else
+ QMessageBox::warning(this, "info", u8"便携版本不支持插件,请下载插件版!");
+#endif
}
-
+#ifdef NO_PLUGIN
void CCNotePad::loadPluginLib()
{
QString strDir = qApp->applicationDirPath();
@@ -1610,9 +1762,6 @@ void CCNotePad::onPlugFound(NDD_PROC_DATA& procData, QMenu* pUserData)
{
return;
}
-
-
-
m_pluginList.append(procData);
}
@@ -1915,7 +2064,12 @@ void CCNotePad::slot_changeChinese()
//如果已经加载了,则冲加载,否则中英文切换不生效
if (m_isToolMenuLoaded)
{
+#ifdef NO_PLUGIN
+ ui.menuPlugin->clear();
+ ui.menuPlugin->addAction(ui.actionPlugin_Manager);
+#endif
ui.menuTools->clear();
+
m_isToolMenuLoaded = false;
slot_dynamicLoadToolMenu();
}
@@ -1947,6 +2101,10 @@ void CCNotePad::slot_changeEnglish()
//如果已经加载了,则冲加载,否则中英文切换不生效
if (m_isToolMenuLoaded)
{
+#ifdef NO_PLUGIN
+ ui.menuPlugin->clear();
+ ui.menuPlugin->addAction(ui.actionPlugin_Manager);
+#endif
ui.menuTools->clear();
m_isToolMenuLoaded = false;
slot_dynamicLoadToolMenu();
@@ -2088,9 +2246,60 @@ void CCNotePad::slot_tabBarDoubleClicked(int index)
}
}
-void CCNotePad::slot_tabBarClicked(int index)
+//tab的双击行为
+void CCNotePad::on_tabBarDoubleClicked(int index)
+{
+ //如果是主窗口,则分出去;反之则回到主窗口
+ QWidget* pw = ui.editTabWidget->widget(index);
+ if (pw == nullptr || (-1 != getFileNewIndexProperty(pw)))
+ {
+ return;
+ }
+
+ if (m_isMainWindows)
+ {
+ openFileInNewWin(index);
+ }
+ else
+ {
+ //一个窗口时,分出去后,当前直接关闭
+ bool isQuit = (ui.editTabWidget->count() == 1);
+
+ if (pw != nullptr)
+ {
+ QString filePath = getFilePathProperty(pw);
+
+ tabClose(index, true);
+
+ if (s_padInstances != nullptr)
+ {
+ for (int i = 0; i < s_padInstances->size(); ++i)
+ {
+ CCNotePad* c = s_padInstances->at(i);
+ if (c->m_isMainWindows)
+ {
+ c->openFile(filePath);
+ }
+ }
+ }
+
+ if(isQuit)
+ {
+ close();
+ }
+ }
+
+ }
+}
+
+void CCNotePad::slot_tabBarClicked(int index)
{
QWidget* pw = ui.editTabWidget->widget(index);
+ if (pw == nullptr)
+ {
+ return;
+ }
+
int docType = getDocTypeProperty(pw);
if (TXT_TYPE == docType)
{
@@ -2118,6 +2327,11 @@ void CCNotePad::slot_tabBarClicked(int index)
m_tabRightClickMenu->addAction(tr("Current Document Sava as..."), this, &CCNotePad::slot_actionSaveAsFile_toggle);
m_openInNewWinAct = m_tabRightClickMenu->addAction(tr("Open in New Window"),this, &CCNotePad::slot_openFileInNewWin);
m_showFileDirAct = m_tabRightClickMenu->addAction(tr("Show File in Explorer..."), this, &CCNotePad::slot_showFileInExplorer);
+
+#ifdef Q_OS_WIN
+ //每种linux mac系统的打开cmd终端方式均不一样,暂时只支持windows
+ m_showCmdAct = m_tabRightClickMenu->addAction(tr("Cmd in Explorer..."), this, &CCNotePad::slot_showCmdInExplorer);
+#endif
m_tabRightClickMenu->addSeparator();
m_openWithText = m_tabRightClickMenu->addAction(tr("Reload With Text Mode"), this, &CCNotePad::slot_reOpenTextMode);
@@ -2134,11 +2348,17 @@ void CCNotePad::slot_tabBarClicked(int index)
{
m_openInNewWinAct->setEnabled(true);
m_showFileDirAct->setEnabled(true);
+#ifdef Q_OS_WIN
+ m_showCmdAct->setEnabled(true);
+#endif
}
else
{
m_openInNewWinAct->setEnabled(false);
m_showFileDirAct->setEnabled(false);
+#ifdef Q_OS_WIN
+ m_showCmdAct->setEnabled(false);
+#endif
}
@@ -2275,28 +2495,86 @@ void CCNotePad::slot_showFileInExplorer()
showFileInExplorer(path);
}
+//打开cmd窗口
-void CCNotePad::slot_openFileInNewWin()
+#ifdef Q_OS_WIN
+void CCNotePad::slot_showCmdInExplorer()
{
QString path;
QWidget* pw = ui.editTabWidget->currentWidget();
if (pw != nullptr)
{
path = pw->property(Edit_View_FilePath).toString();
- slot_actionClose(true);
+ }
- CCNotePad* pNewWin = new CCNotePad(false,nullptr);
+ QFileInfo fi(path);
+ QString dirEment = fi.absolutePath();
+
+
+ HWND hWnd = (HWND)this->effectiveWinId();
+ HINSTANCE res = ::ShellExecute(hWnd, TEXT("open"), TEXT("cmd"), TEXT(""), dirEment.toStdWString().data(), SW_SHOW);
+
+ //参考 https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx
+ int retResult = static_cast(reinterpret_cast(res));
+ if (retResult <= 32)
+ {
+ ui.statusBar->showMessage(tr("open cmd in file dir %1 failed.").arg(dirEment));
+ }
+#if 0
+ //下面方法不能分离式,主界面关闭后,cmd也消失了
+ QStringList arguments;
+ arguments << "/K";
+ arguments << "title";
+ arguments << "child process";
+
+ QProcess* myProcess = new QProcess(this);
+ QString program = "C:/Windows/System32/cmd.exe";
+ myProcess->setCreateProcessArgumentsModifier([](QProcess::CreateProcessArguments* args)
+ {
+ //args->startupInfo->wShowWindow = SW_SHOWMAXIMIZED;//此成员变量设置此有效,QT5.12
+ args->flags |= CREATE_NEW_CONSOLE;
+ args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES;
+ args->startupInfo->dwFlags |= STARTF_USEFILLATTRIBUTE;
+ args->startupInfo->dwFillAttribute = FOREGROUND_INTENSITY;
+ //args->startupInfo->dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
+ });
+ myProcess->start(program, arguments);
+#endif
+}
+#endif
+
+//把文件在新窗口中打开。如果是新文件,则不行
+void CCNotePad::openFileInNewWin(int index)
+{
+ QString path;
+ QWidget* pw = ui.editTabWidget->widget(index);
+ if (pw != nullptr)
+ {
+ if (-1 != getFileNewIndexProperty(pw))
+ {
+ return;
+ }
+
+ path = getFilePathProperty(pw);
+ slot_tabClose(index);
+
+ CCNotePad* pNewWin = new CCNotePad(false, nullptr);
pNewWin->quickshow();
pNewWin->setShareMem(this->getShareMem());
pNewWin->setAttribute(Qt::WA_DeleteOnClose);
pNewWin->openFile(path);
-
+
#ifdef uos
adjustWInPos(pNewWin);
#endif
s_padInstances->append(pNewWin);
}
}
+void CCNotePad::slot_openFileInNewWin()
+{
+ int curIndex = ui.editTabWidget->currentIndex();
+ openFileInNewWin(curIndex);
+}
//int defLexerId:如果失败,则按照该语法类型的id赋值;如果-1则不给与默认值。
//因为发现如果是新建的文件,而且手动设置了语法,其文件名还是*.txt,此时如果根据
@@ -2362,7 +2640,6 @@ void CCNotePad::slot_tabCurrentChanged(int index)
int docType = getDocTypeProperty(pw);
if (HEX_TYPE == docType)
{
-
setWindowTitleMode(filePath, OpenAttr::HexReadOnly);
fileListSetCurItem(filePath);
return;
@@ -2385,9 +2662,9 @@ void CCNotePad::slot_tabCurrentChanged(int index)
m_saveFile->setEnabled(false);
}
+
if (TXT_TYPE == docType)
{
- //setWindowTitle(pw->property(Edit_View_FilePath).toString());
setWindowTitleMode(filePath, (OpenAttr)pw->property(Open_Attr).toInt());
}
else if (BIG_TEXT_RO_TYPE == docType)
@@ -2403,6 +2680,7 @@ void CCNotePad::slot_tabCurrentChanged(int index)
syncCurDocEncodeToMenu(pw);
syncCurDocLineEndStatusToMenu(pw);
syncCurDocLexerToMenu(pw);
+ syncCurDocTailfToMenu(pw);
ScintillaEditView* pEdit = dynamic_cast(pw);
@@ -2563,6 +2841,7 @@ void CCNotePad::setShoctIcon(int iconSize)
m_wordwrap->setIcon(QIcon(CrlfIcon));
m_allWhite->setIcon(QIcon(WhiteIcon));
m_indentGuide->setIcon(QIcon(IndentIcon));
+ m_tailf->setIcon(QIcon(TailfIcon));
m_preHexPage->setIcon(QIcon(PreHexIcon));
m_nextHexPage->setIcon(QIcon(NextHexIcon));
m_gotoHexPage->setIcon(QIcon(GotoHexIcon));
@@ -2593,6 +2872,7 @@ void CCNotePad::setShoctIcon(int iconSize)
m_wordwrap->setIcon(QIcon(CrlfIcon32));
m_allWhite->setIcon(QIcon(WhiteIcon32));
m_indentGuide->setIcon(QIcon(IndentIcon32));
+ m_tailf->setIcon(QIcon(TailfIcon32));
m_preHexPage->setIcon(QIcon(PreHexIcon32));
m_nextHexPage->setIcon(QIcon(NextHexIcon32));
m_gotoHexPage->setIcon(QIcon(GotoHexIcon32));
@@ -2776,7 +3056,6 @@ void CCNotePad::initToolBar()
m_wordwrap->setFixedSize(ICON_SIZE, ICON_SIZE);
m_wordwrap->setToolTip(tr("Word Wrap"));
ui.mainToolBar->addWidget(m_wordwrap);
-
ui.actionWrap->setChecked((s_autoWarp != QsciScintilla::WrapNone));
m_allWhite = new QToolButton(ui.mainToolBar);
@@ -2801,6 +3080,14 @@ void CCNotePad::initToolBar()
m_indentGuide->setToolTip(tr("Indent Guide"));
ui.mainToolBar->addWidget(m_indentGuide);
+ m_tailf = new QToolButton(ui.mainToolBar);
+ m_tailf->setCheckable(true);
+ m_tailf->setChecked(false);
+ connect(m_tailf, &QAbstractButton::clicked, this, &CCNotePad::on_tailfile);
+ m_tailf->setFixedSize(ICON_SIZE, ICON_SIZE);
+ m_tailf->setToolTip(tr("tailf file"));
+ ui.mainToolBar->addWidget(m_tailf);
+
ui.mainToolBar->addSeparator();
m_preHexPage = new QToolButton(ui.mainToolBar);
@@ -2974,45 +3261,6 @@ void CCNotePad::initToolBar()
syncBlankShowStatus();
}
-
-//void CCNotePad::slot_skinStyleGroup(QAction* /*action*/)
-//{
-// //切换图标
-// setShoctIcon(m_curIconSize);
-//
-// if (s_curStyleId != StyleSet::m_curStyleId)
-// {
-// //if (DEEP_BLACK == StyleSet::m_curStyleId)
-// //{
-// // //如果不存在暗黑配置,则需要修正一次。后续如果存在了,则不需要再修正颜色
-// // if (!QtLangSet::isExistDarkLangSetings())
-// // {
-// // QtLangSet::setAllLangFontFgColorToDarkStyle();
-// //}
-// //}
-// s_curStyleId = StyleSet::m_curStyleId;
-// }
-//
-// for (int i = ui.editTabWidget->count() - 1; i >= 0; --i)
-// {
-// QWidget* pw = ui.editTabWidget->widget(i);
-// ScintillaEditView *pEdit = dynamic_cast(pw);
-// if (pEdit != nullptr)
-// {
-// pEdit->adjuctSkinStyle();
-// autoSetDocLexer(pEdit);
-// }
-// else
-// {
-// ScintillaHexEditView* pEdit = dynamic_cast(pw);
-// if (pEdit != nullptr)
-// {
-// pEdit->adjuctSkinStyle();
-// }
-// }
-// }
-//}
-
void CCNotePad::setZoomLabelValue(int zoomValue)
{
m_zoomLabel->setText(tr("Zoom: %1%").arg(zoomValue));
@@ -3128,7 +3376,7 @@ void CCNotePad::slot_lexerActTrig(QAction *action)
//保存最近打开文件到数据库。文件只有在关闭时,才写入最近列表。不关闭的下次自动恢复打开
void CCNotePad::saveReceneOpenFile()
{
- QString rFile("recentopenfile");
+ QString rFile(RECENT_OPEN_FILE);
const int maxRecord = 15;
@@ -3152,23 +3400,31 @@ void CCNotePad::saveReceneOpenFile()
if (!fileText.isEmpty())
{
QString fileSaveText = fileText.join('|');
- NddSetting::updataKeyValueFromSets(rFile, fileSaveText);
+ NddSetting::updataKeyValueFromDelaySets(rFile, fileSaveText);
}
- else
- {
- NddSetting::updataKeyValueFromSets(rFile, "");
}
}
+
+
+//从最近列表中加载最近打开历史文件,到菜单中
+void CCNotePad::on_loadReceneFile()
+{
+ if (!m_isRecentFileLoaded)
+ {
+ m_isRecentFileLoaded = true;
+
+ initReceneOpenFileMenu();
+}
}
//从数据库读取最近对比的文件列表
void CCNotePad::initReceneOpenFileMenu()
{
- QString rFile("recentopenfile");
+ QString rFile(RECENT_OPEN_FILE);
if (NddSetting::isDbExist())
{
- QString fileStr = NddSetting::getKeyValueFromSets(rFile);
+ QString fileStr = NddSetting::getKeyValueFromDelaySets(rFile);
QStringList fileList = fileStr.split('|');
@@ -3279,16 +3535,56 @@ void CCNotePad::setLangsDescLable(QString &langDesc)
m_langDescLabel->setText(tr("Language: %1").arg(langDesc));
}
-void CCNotePad::reloadEditFile(ScintillaEditView* pEidt)
+//重新加载文件。这里有个问题,文件的序号会跳动,要解决跳动问题。
+//这里不能销毁当前pedit,加载编码也要保持不变。而且加载的文件一定是普通文本模式
+//目前只在文本文件被修改后,外部自动加载的场景
+void CCNotePad::reloadEditFile(ScintillaEditView* pEdit, bool isTailfOn)
{
- QString filePath = pEidt->property(Edit_View_FilePath).toString();
+ QString filePath = pEdit->property(Edit_View_FilePath).toString();
- //设置为非脏,直接关闭,关闭后再打开
- pEidt->setProperty(Edit_Text_Change, QVariant(false));
- tabClose(pEidt);
- openFile(filePath);
+ CODE_ID code = (CODE_ID)getCodeTypeProperty(pEdit);
+ RC_LINE_FORM lineEnd;
+ int lineNum = 0;
+
+ if (!isTailfOn)
+ {
+ lineNum = pEdit->getCurrentLineNumber();
}
+ //下面这个clear会触发文本修改,要避免不必要的消息循环。先屏蔽一些信号
+ disEnableEditTextChangeSign(pEdit);
+ pEdit->clear();
+ pEdit->setProperty(Edit_Text_Change, QVariant(false));
+ setSaveButtonStatus(false);
+
+ int errCode = FileManager::getInstance().loadFileDataInText(pEdit, filePath, code, lineEnd, nullptr, false, this);
+
+ enableEditTextChangeSign(pEdit);
+
+ if (errCode == 5)
+ {
+ }
+ else if (errCode != 0)
+ {
+ ui.statusBar->showMessage(tr("reload file %1 failed").arg(filePath));
+ return;
+ }
+
+ if (isTailfOn)
+ {
+ lineNum = pEdit->lines();
+ }
+ pEdit->execute(SCI_GOTOLINE, lineNum - 1);
+}
+
+#ifdef Q_OS_WIN
+void CCNotePad::on_roladFile(ScintillaEditView* pEdit)
+{
+ pEdit->setProperty(Modify_Outside, QVariant(true));
+ checkRoladFile(pEdit);
+}
+#endif
+
bool CCNotePad::checkRoladFile(ScintillaEditView* pEdit)
{
if (pEdit != nullptr && pEdit->property(Modify_Outside).toBool())
@@ -3303,19 +3599,47 @@ bool CCNotePad::checkRoladFile(ScintillaEditView* pEdit)
QString filePath = pEdit->property(Edit_View_FilePath).toString();
- QApplication::beep();
+ int tailStatus = getFileTailProperty(pEdit);
- if (QMessageBox::Yes == QMessageBox::question(this, tr("Reload"), tr("\"%1\" This file has been modified by another program. Do you want to reload it?").arg(filePath)))
+ if (tailStatus != 1)
{
+ QApplication::beep();
+ }
+
+ auto doReload = [this](ScintillaEditView* pEdit, bool isOnTail) {
//reloadEditFile 里面会关闭和新增tab,触发一系列的currentChanged
disconnect(ui.editTabWidget, &QTabWidget::currentChanged, this, &CCNotePad::slot_tabCurrentChanged);
- reloadEditFile(pEdit);
+ reloadEditFile(pEdit, isOnTail);
+ pEdit->setProperty(Modify_Outside, QVariant(false));
connect(ui.editTabWidget, &QTabWidget::currentChanged, this, &CCNotePad::slot_tabCurrentChanged, Qt::UniqueConnection);
+ };
+
+ //如果是开启了taif,则不提示,直接重新加载文件
+ if (tailStatus == 1)
+ {
+ doReload(pEdit,true);
}
else
{
+ int ret = QMessageBox::question(this, tr("Reload"), tr("\"%1\" This file has been modified by another program. Do you want to reload it?").arg(filePath), tr("Yes[Reload]"), tr("No[Drop]"), tr("On Tailf"));
+ if(ret == 0)
+ {
+ doReload(pEdit, false);
+ }
+ else if (ret == 1)
+ {
+ //放弃
pEdit->setProperty(Modify_Outside, QVariant(false));
}
+ else if (ret == 2)
+ {
+ m_tailf->setChecked(true);
+ doReload(pEdit, true);
+
+ //开启监控
+ tailfile(true,pEdit);
+ }
+ }
m_isInReloadFile = false;
@@ -3421,12 +3745,10 @@ void CCNotePad::updateCurTabSaveStatus()
{
if (pw->property(Edit_Text_Change).toBool())
{
- //m_saveFile->setIcon(QIcon(NeedSaveBarIcon));
m_saveFile->setEnabled(true);
}
else
{
- //m_saveFile->setIcon(QIcon(NoNeedSaveBarIcon));
m_saveFile->setEnabled(false);
}
}
@@ -3436,14 +3758,6 @@ void CCNotePad::updateCurTabSaveStatus()
void CCNotePad::setSaveButtonStatus(bool needSave)
{
m_saveFile->setEnabled(needSave);
- //if (needSave)
- //{
- // //m_saveFile->setIcon(QIcon(NeedSaveBarIcon));
- //}
- //else
- //{
- // //m_saveFile->setIcon(QIcon(NoNeedSaveBarIcon));
- //}
}
void CCNotePad::setSaveAllButtonStatus(bool needSave)
@@ -3467,8 +3781,13 @@ QAction* findItemInMenuByName(QMenu* menu, QString name)
void CCNotePad::dealRecentFileMenuWhenColseFile(QString closeFilePath)
{
+ //无条件加载一次,避免没有初始化
+ on_loadReceneFile();
+
QAction* act = nullptr;
+ getRegularFilePath(closeFilePath);
+
//如果关闭的文件,已经在最近列表中,则移动到最前面即可
int index = m_receneOpenFileList.indexOf(closeFilePath);
if (-1 != index)
@@ -3484,9 +3803,8 @@ void CCNotePad::dealRecentFileMenuWhenColseFile(QString closeFilePath)
}
else
{
- act = new QAction(closeFilePath, ui.menuFile);
+ act = new QAction(closeFilePath, ui.menuRecene_File);
act->setObjectName(closeFilePath);
-
connect(act, &QAction::triggered, this, &CCNotePad::slot_openReceneFile);
}
@@ -3502,11 +3820,8 @@ void CCNotePad::dealRecentFileMenuWhenColseFile(QString closeFilePath)
QString curTopActionPath = m_receneOpenFileList.first();
QAction* topAct = findItemInMenuByName(ui.menuRecene_File, curTopActionPath);
- if (topAct != nullptr)
- {
ui.menuRecene_File->insertAction(topAct, act);
}
- }
m_receneOpenFileList.push_front(closeFilePath);
@@ -3517,7 +3832,7 @@ void CCNotePad::dealRecentFileMenuWhenColseFile(QString closeFilePath)
QAction* lastAct = findItemInMenuByName(ui.menuRecene_File, k);
if (lastAct != nullptr)
{
- ui.menuRecene_File->removeAction(act);
+ ui.menuRecene_File->removeAction(lastAct);
lastAct->deleteLater();
}
@@ -3577,6 +3892,15 @@ void CCNotePad::tabClose(int index, bool isInQuit)
//关闭之前,检查是否要保存。如果文档为脏,则询问是否要保存
ScintillaEditView* pEdit = dynamic_cast(pw);
+
+ //关闭之前先检测是否在tailf模式,否则要回收tailf线程,不然可能崩溃
+#ifdef Q_OS_WIN
+ if (pEdit != nullptr)
+ {
+ pEdit->deleteTailFileThread();
+ }
+#endif
+
if ((pEdit != nullptr) && (pEdit->property(Edit_Text_Change).toBool()))
{
QApplication::beep();
@@ -3601,7 +3925,6 @@ void CCNotePad::tabClose(int index, bool isInQuit)
}
}
-
ui.editTabWidget->removeTab(index);
QVariant v = pw->property(Edit_File_New);
@@ -3720,6 +4043,7 @@ ScintillaEditView* CCNotePad::newTxtFile(QString name, int index, QString conten
QVariant editTextCode((int)code);
pEdit->setProperty(Edit_Text_Code, editTextCode);
syncCurDocEncodeToMenu(pEdit);
+ syncCurDocTailfToMenu(pEdit);
setDocTypeProperty(pEdit, TXT_TYPE);
@@ -3759,9 +4083,15 @@ ScintillaEditView* CCNotePad::newTxtFile(QString name, int index, QString conten
autoSetDocLexer(pEdit);
int zoomValue = 100 + 10 * s_zoomValue;
- ui.statusBar->showMessage(tr("New File Finished [Text Mode] Zoom %1%").arg(zoomValue), 8000);
+ ui.statusBar->showMessage(tr("New File Finished [Text Mode] Zoom %1%").arg(zoomValue), MSG_EXIST_TIME);
setZoomLabelValue(zoomValue);
+ //缩进线要在autoSetDocLexer之后,发现lexer会修改缩进参考线
+ if (s_indent == 1)
+ {
+ pEdit->setIndentGuide(true);
+ }
+
addFileListView(name, pEdit);
pEdit->viewport()->setFocus();
@@ -3953,6 +4283,7 @@ bool CCNotePad::openBigTextRoFile(QString filePath)
setDocEolMode(pEdit, lineEnd);
syncCurDocEncodeToMenu(pEdit);
+ syncCurDocTailfToMenu(pEdit);
setFileOpenAttrProperty(pEdit, OpenAttr::BigTextReadOnly);
setWindowTitleMode(filePath, OpenAttr::BigTextReadOnly);
@@ -4039,6 +4370,7 @@ bool CCNotePad::openSuperBigTextFile(QString filePath)
setDocEolMode(pEdit, lineEnd);
syncCurDocEncodeToMenu(pEdit);
+ syncCurDocTailfToMenu(pEdit);
setFileOpenAttrProperty(pEdit, OpenAttr::SuperBigTextReadOnly);
setWindowTitleMode(filePath, OpenAttr::SuperBigTextReadOnly);
@@ -4276,12 +4608,17 @@ void CCNotePad::setNormalTextEditInitPro(ScintillaEditView* pEdit, QString fileP
setTextChangeProperty(pEdit, isModifyed);
//如果是脏,还需要设置保存等按钮
+ m_saveFile->setEnabled(isModifyed);
+
if (isModifyed)
{
- m_saveFile->setEnabled(true);
m_saveAllFile->setEnabled(true);
ui.editTabWidget->setTabIcon(curIndex, QIcon(TabNeedSave));
}
+ else
+ {
+ ui.editTabWidget->setTabIcon(curIndex, QIcon(TabNoNeedSave));
+ }
QVariant editTextCode((int)code);
pEdit->setProperty(Edit_Text_Code, editTextCode);
@@ -4309,14 +4646,14 @@ void CCNotePad::setNormalTextEditInitPro(ScintillaEditView* pEdit, QString fileP
setFileOpenAttrProperty(pEdit, OpenAttr::Text);
setWindowTitleMode(filePath, OpenAttr::Text);
int zoomValue = 100 + 10 * s_zoomValue;
- ui.statusBar->showMessage(tr("File %1 Open Finished [Text Mode] Zoom %2%").arg(filePath).arg(zoomValue), 8000);
+ ui.statusBar->showMessage(tr("File %1 Open Finished [Text Mode] Zoom %2%").arg(filePath).arg(zoomValue), MSG_EXIST_TIME);
setZoomLabelValue(zoomValue);
}
else
{
setFileOpenAttrProperty(pEdit, OpenAttr::TextReadOnly);
setWindowTitleMode(filePath, OpenAttr::TextReadOnly);
- ui.statusBar->showMessage(tr("File %1 Open Finished [Text ReadOnly Mode] (Note: display up to 50K bytes ...)").arg(fi.fileName()), 8000);
+ ui.statusBar->showMessage(tr("File %1 Open Finished [Text ReadOnly Mode] (Note: display up to 50K bytes ...)").arg(fi.fileName()), MSG_EXIST_TIME);
}
if (pEdit->lexer() == nullptr)
@@ -4623,10 +4960,12 @@ bool CCNotePad::openHexFile(QString filePath)
syncCurDocEncodeToMenu(pEdit);
+ syncCurDocTailfToMenu(pEdit);
+
setFileOpenAttrProperty(pEdit, OpenAttr::HexReadOnly);
setWindowTitleMode(filePath, OpenAttr::HexReadOnly);
- ui.statusBar->showMessage(tr("File %1 Open Finished [Hex ReayOnly Mode]").arg(filePath),8000);
+ ui.statusBar->showMessage(tr("File %1 Open Finished [Hex ReayOnly Mode]").arg(filePath),MSG_EXIST_TIME);
addFileListView(filePath, pEdit);
@@ -4815,8 +5154,7 @@ bool CCNotePad::openFile(QString filePath, int lineNum)
getRegularFilePath(filePath);
QFileInfo fi(filePath);
- QString fileLabel(fi.fileName());
-
+
if (!fi.exists())
{
QApplication::beep();
@@ -4846,7 +5184,7 @@ bool CCNotePad::openFile(QString filePath, int lineNum)
}
}
- ui.statusBar->showMessage(tr("file %1 already open at tab %2").arg(filePath).arg(retIndex),8000);
+ ui.statusBar->showMessage(tr("file %1 already open at tab %2").arg(filePath).arg(retIndex),MSG_EXIST_TIME);
return true;
}
@@ -5003,7 +5341,7 @@ bool CCNotePad::saveFile(QString fileName, ScintillaEditView* pEdit, bool isBak
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
//自动转换不会带UTF-8 BOM,所以自己要在前面写个BOM头。这是一个例外。需要手动写入头
- //其他必然BL LE则不需要。
+ //其他编码BL LE则不需要。
QByteArray codeFlag = Encode::getEncodeStartFlagByte(dstCode);
if (!codeFlag.isEmpty())
@@ -5470,24 +5808,12 @@ void CCNotePad::initTabNewOne()
}
}
-//退出所有
+//退出所有。暂时不要了,默认alt+f4.
void CCNotePad::slot_quit(bool)
{
close();
-#if 0
- slot_closeAllFile(true);
-
- //中途取消了关闭,则不退出
- if (m_isQuitCancel)
- {
- m_isQuitCancel = false;
- return;
}
- exit(0);
-#endif
-}
-
void CCNotePad::slot_saveAllFile()
{
int index = ui.editTabWidget->currentIndex();
@@ -5783,6 +6109,13 @@ void CCNotePad::closeAllFileStatic()
qs.clear();
+ int curIndexWhenQuit = ui.editTabWidget->currentIndex();
+
+ NddSetting::updataKeyValueFromNumSets(LAST_ACTION_TAB_INDEX, curIndexWhenQuit);
+
+ //这里是静默退出,反正要退出了,把槽函数取消一下,避免下面setCurrentIndex再触发做无用功
+ disconnect(ui.editTabWidget, &QTabWidget::currentChanged, this, &CCNotePad::slot_tabCurrentChanged);
+
//从尾部开始依次调用保存所有文件。没修改的不需要保存
for (int i = ui.editTabWidget->count() - 1; i >= 0; --i)
{
@@ -6222,6 +6555,141 @@ void CCNotePad::slot_indentGuide(bool willBeShowed)
NddSetting::updataKeyValueFromNumSets(INDENT_KEY, s_indent);
}
+#ifdef Q_OS_WIN
+TCHAR* CharToWchar(const QString& str)
+{
+ QByteArray ba = str.toUtf8();
+ char* data = ba.data(); //以上两步不能直接简化为“char *data = str.toUtf8().data();”
+ int charLen = strlen(data);
+ int len = MultiByteToWideChar(CP_ACP, 0, data, charLen, NULL, 0);
+ TCHAR* buf = new TCHAR[len + 1];
+ MultiByteToWideChar(CP_ACP, 0, data, charLen, buf, len);
+ buf[len] = '\0';
+ return buf;
+}
+#endif
+
+void CCNotePad::tailfile(bool isOn, ScintillaEditView* pEdit)
+{
+ if (pEdit == nullptr || (TXT_TYPE != getDocTypeProperty(pEdit) || (-1 != getFileNewIndexProperty(pEdit))))
+ {
+ m_tailf->setChecked(false);
+ ui.statusBar->showMessage(tr("Only Text File Can Use it !"), MSG_EXIST_TIME);
+ return;
+ }
+
+ if (isOn)
+ {
+ if (1 == getFileTailProperty(pEdit))
+ {
+ return;
+ }
+
+ pEdit->setReadOnly(true);
+ setFileTailProperty(pEdit, 1);
+ ui.statusBar->showMessage(tr("File %1 into tailf mode, readonly !").arg(getFilePathProperty(pEdit)), MSG_EXIST_TIME);
+
+#ifdef Q_OS_WIN
+
+ auto checkFileChange = [this](ScintillaEditView* pEdit) {
+
+ QString filePath = getFilePathProperty(pEdit);
+
+ TCHAR* fullFileName = CharToWchar(filePath);
+
+ DectFileChanges fileChanges;
+ fileChanges.AddFile(fullFileName, FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE);
+
+ //单独开启一个线程,去监控文件大小的变化
+ HANDLE eventHandle = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
+
+ HANDLE changeHandles[] = { eventHandle };
+
+ bool toBeGoon = true;
+
+ while (toBeGoon)
+ {
+ DWORD waitStatus = ::WaitForMultipleObjects(_countof(changeHandles), changeHandles, FALSE, 1000);
+ switch (waitStatus)
+ {
+ case WAIT_OBJECT_0 + 0:
+ // User removes this folder or file browser is closed
+ {
+ toBeGoon = false;
+ }
+ break;
+
+ case WAIT_TIMEOUT:
+ {
+ if (fileChanges.DetectChanges())
+ {
+ //这里不能直接更新,而是要发生信号出去。否则跨线程访问,可能发生错误或告警
+ //pEdit->setProperty(Modify_Outside, QVariant(true));
+ //checkRoladFile(pEdit);
+ emit this->tailFileChange(pEdit);
+ }
+ //如果退出监控。这里要注意,一定要是volidate的,否则多线程获取不到该变化
+ //使用了原子变量,效果是一样的,多个线程均可见
+ if (!(pEdit->m_isInTailStatus))
+ {
+ toBeGoon = false;
+ }
+ }
+ break;
+
+ case WAIT_IO_COMPLETION:
+ // Nothing to do.
+ break;
+ }
+ }
+
+ qDebug() << "listen file quit ...";
+ fileChanges.Terminate();
+ };
+
+ connect(this, &CCNotePad::tailFileChange, this, &CCNotePad::on_roladFile, Qt::QueuedConnection);
+
+ pEdit->m_isInTailStatus = true;
+
+ std::thread* pListenThread = new std::thread(checkFileChange, pEdit);
+
+ QVariant t((qlonglong)pListenThread);
+ pEdit->setProperty(Tail_Thread, t);
+
+#endif // Q_OS_WIN
+
+ }
+ else
+ {
+#ifdef Q_OS_WIN
+ if (!pEdit->m_isInTailStatus)
+ {
+ return;
+ }
+#endif
+ setFileTailProperty(pEdit, 0);
+
+#ifdef Q_OS_WIN
+ pEdit->deleteTailFileThread();
+#endif
+
+ pEdit->setReadOnly(false);
+
+#ifdef Q_OS_WIN
+ disconnect(this, &CCNotePad::tailFileChange, this, &CCNotePad::on_roladFile);
+#endif
+ }
+}
+
+//实时开启文件变化tailf。20230218发现一个问题。
+//文件没有关闭,只是flush时,无法实时刷新。所有要在windows上单独监控文件大小改变
+void CCNotePad::on_tailfile(bool isOn)
+{
+ QWidget* pw = ui.editTabWidget->currentWidget();
+ ScintillaEditView* pEdit = dynamic_cast(pw);
+ tailfile(isOn, pEdit);
+}
+
void CCNotePad::find(FindTabIndex findType)
{
initFindWindow(findType);
@@ -6247,20 +6715,16 @@ void CCNotePad::slot_find()
{
initFindWindow(FIND_TAB);
FindWin* pFind = dynamic_cast(m_pFindWin.data());
-#ifdef uos
+ //必须要激活一下,所谓激活就是让当前这个查找窗口,获取焦点,是所有窗口中的当前活动窗口
pFind->activateWindow();
-#endif
pFind->showNormal();
#ifdef uos
adjustWInPos(pFind);
#endif
-
- pFind->setFocus();
- pFind->setCurrentTab(FIND_TAB);
}
//在后台查找关键字
-int CCNotePad::findAtBack(QString keyword)
+int CCNotePad::findAtBack(QStringList& keyword)
{
initFindWindow();
FindWin* pFind = dynamic_cast(m_pFindWin.data());
@@ -6269,7 +6733,7 @@ int CCNotePad::findAtBack(QString keyword)
}
//在后台替换关键字
-//在后台替换关键字
+//在后台批量替换关键字
int CCNotePad::replaceAtBack(QStringList& keyword, QStringList& replace)
{
initFindWindow();
@@ -6278,11 +6742,11 @@ int CCNotePad::replaceAtBack(QStringList& keyword, QStringList& replace)
}
//在后台高亮关键字
-int CCNotePad::markAtBack(QString keyword)
+int CCNotePad::markAtBack(QStringList& keyword)
{
initFindWindow();
FindWin* pFind = dynamic_cast(m_pFindWin.data());
- return pFind->markAllWord(keyword);
+ return pFind->markAtBack(keyword);
}
//返回值:0 正常 1 选择自动为空
@@ -6349,6 +6813,7 @@ int CCNotePad::initFindWindow(FindTabIndex type)
pFind = dynamic_cast(m_pFindWin.data());
}
+ pFind->setCurrentTab(type);
if ((TXT_TYPE == docType) || (BIG_TEXT_RO_TYPE == docType) || (SUPER_BIG_TEXT_RO_TYPE == docType))
{
@@ -6359,6 +6824,8 @@ int CCNotePad::initFindWindow(FindTabIndex type)
if (FIND_TAB == type)
{
pFind->setFindText(text);
+ pFind->keywordWinGetFouse(FIND_TAB);
+
//如果字段比较短,则字段填充到替换中
if (text.size() <= 60)
{
@@ -6368,6 +6835,7 @@ int CCNotePad::initFindWindow(FindTabIndex type)
else if (REPLACE_TAB == type)
{
pFind->setReplaceFindText(text);
+ pFind->keywordWinGetFouse(REPLACE_TAB);
//如果字段比较短,则字段填充到替换中
if (text.size() <= 60)
{
@@ -6377,7 +6845,13 @@ int CCNotePad::initFindWindow(FindTabIndex type)
else if (DIR_FIND_TAB == type)
{
pFind->setDirFindText(text);
+ pFind->keywordWinGetFouse(DIR_FIND_TAB);
}
+ else if (MARK_TAB == type)
+ {
+ pFind->setMarkFindText(text);
+ pFind->keywordWinGetFouse(MARK_TAB);
+ }
}
else
{
@@ -6426,7 +6900,6 @@ void CCNotePad::slot_replace()
{
initFindWindow(REPLACE_TAB);
FindWin* pFind = dynamic_cast(m_pFindWin.data());
- pFind->setCurrentTab(REPLACE_TAB);
pFind->activateWindow();
pFind->showNormal();
#ifdef uos
@@ -6854,7 +7327,7 @@ bool CCNotePad::convertDocLineEnd(RC_LINE_FORM endStatus)
ScintillaEditView* pEdit = dynamic_cast(pw);
if (pEdit != nullptr && pEdit->isReadOnly())
{
- ui.statusBar->showMessage(tr("The ReadOnly document does not allow this operation."), 8000);
+ ui.statusBar->showMessage(tr("The ReadOnly document does not allow this operation."), MSG_EXIST_TIME);
QApplication::beep();
return false;
}
@@ -7095,6 +7568,11 @@ void CCNotePad::syncCurDocEncodeToMenu(QWidget* curEdit)
}
}
+//同步当前的tailf状态
+void CCNotePad::syncCurDocTailfToMenu(QWidget* curEdit)
+{
+ m_tailf->setChecked(1 == getFileTailProperty(curEdit));
+}
//同步当前文档的编码状态到菜单的Encode中。即每次切换当前编辑后,菜单上面的编码状态要同步
void CCNotePad::syncCurDocLineEndStatusToMenu(QWidget* curEdit)
@@ -7164,17 +7642,17 @@ void CCNotePad::cmpSelectFile()
void CCNotePad::slot_compareFile()
{
- //此部分是对比软件的商业代码,开源版本不包含对比功能。
+ //此部分是对比软件的商业插件代码,开源版本不包含对比功能。
}
void CCNotePad::slot_compareDir()
{
- //此部分是对比软件的商业代码,开源版本不包含对比功能。
+ //此部分是对比软件的商业插件代码,开源版本不包含对比功能。
}
void CCNotePad::slot_binCompare()
{
- //此部分是对比软件的商业代码,开源版本不包含对比功能。
+ //此部分是对比软件的商业插件代码,开源版本不包含对比功能。
}
@@ -7300,7 +7778,8 @@ void CCNotePad::slot_gotoHexPage()
{
if (m_pHexGotoWin.isNull())
{
- m_pHexGotoWin = new HexFileGoto();
+ m_pHexGotoWin = new HexFileGoto(this);
+ m_pHexGotoWin->setWindowFlag(Qt::Window);
HexFileGoto* pHexGoto = dynamic_cast(m_pHexGotoWin.data());
@@ -7354,7 +7833,7 @@ void CCNotePad::slot_hexGotoFile(qint64 addr)
if (addr < 0)
{
- ui.statusBar->showMessage(tr("Error file offset addr , please check !"), 8000);
+ ui.statusBar->showMessage(tr("Error file offset addr , please check !"), MSG_EXIST_TIME);
QApplication::beep();
return;
}
@@ -7379,7 +7858,7 @@ void CCNotePad::slot_hexGotoFile(qint64 addr)
if (addr < 0)
{
- ui.statusBar->showMessage(tr("Error file offset addr , please check !"), 8000);
+ ui.statusBar->showMessage(tr("Error file offset addr , please check !"), MSG_EXIST_TIME);
QApplication::beep();
return;
}
@@ -7426,7 +7905,8 @@ void CCNotePad::slot_about()
void CCNotePad::slot_aboutNdd()
{
- AboutNdd* pWin = new AboutNdd();
+ AboutNdd* pWin = new AboutNdd(this);
+ pWin->setWindowFlag(Qt::Window);
pWin->setAttribute(Qt::WA_DeleteOnClose);
QString title = tr("Notepad-- Version %1").arg(VersionStr);
pWin->setWindowTitle(title);
@@ -7513,15 +7993,21 @@ void CCNotePad::dropEvent(QDropEvent* e)
//目前只有一个Tabwidget的双击事件。
bool CCNotePad::eventFilter(QObject * watched, QEvent * event)
{
- if (watched == ui.editTabWidget && event->type() == QEvent::MouseButtonDblClick)
+ switch (event->type())
{
+ case QEvent::MouseButtonDblClick:
+ if (watched == ui.editTabWidget)
+ {
slot_actionNewFile_toggle(true);
m_saveFile->setEnabled(false);
return true; // 注意这里一定要返回true,表示你要过滤该事件原本的实现
}
- return false;
+ break;
+ default:
+ break;
+}
+ return QObject::eventFilter(watched, event);;
}
-
#ifdef Q_OS_WIN
static const ULONG_PTR CUSTOM_TYPE = 10000;
@@ -7642,12 +8128,21 @@ void CCNotePad::slot_batch_rename()
void CCNotePad::slot_options()
{
- OptionsView* p = new OptionsView(this,nullptr);
- p->setAttribute(Qt::WA_DeleteOnClose);
- //p->setWindowModality(Qt::ApplicationModal);
+ OptionsView* p = nullptr;
+
+ if (m_optionsView.isNull())
+ {
+ m_optionsView = new OptionsView(this, this);
+ m_optionsView->setWindowFlag(Qt::Window);
+ m_optionsView->setAttribute(Qt::WA_DeleteOnClose);
+
+ p = dynamic_cast(m_optionsView.data());
connect(p, &OptionsView::sendTabFormatChange, this, &CCNotePad::slot_tabFormatChange);
- //connect(p, &OptionsView::signTxtFontChange, this, &CCNotePad::slot_txtFontChange);
- //connect(p, &OptionsView::signProLangFontChange, this, &CCNotePad::slot_proLangFontChange);
+ }
+ else
+ {
+ p = dynamic_cast(m_optionsView.data());
+ }
p->show();
registerEscKeyShort(p);
@@ -7758,7 +8253,8 @@ void CCNotePad::slot_tabFormatChange(bool tabLenChange, bool useTabChange)
void CCNotePad::slot_donate()
{
- Donate* pWin = new Donate();
+ Donate* pWin = new Donate(this);
+ pWin->setWindowFlag(Qt::Window);
pWin->setAttribute(Qt::WA_DeleteOnClose);
pWin->show();
registerEscKeyShort(pWin);
@@ -7807,6 +8303,11 @@ void CCNotePad::getCurUseLexerTags(QVector& tags)
}
}
+QtLangSet* CCNotePad::getLangSet()
+{
+ slot_langFormat();
+ return dynamic_cast(m_langSetWin.data());
+}
void CCNotePad::slot_langFormat()
{
@@ -7818,11 +8319,21 @@ void CCNotePad::slot_langFormat()
{
initTag = pEdit->lexer()->lexerTag();
}
+ QtLangSet* pWin = nullptr;
+
+ if (m_langSetWin.isNull())
+ {
+ m_langSetWin = new QtLangSet(initTag, this);
+ pWin = dynamic_cast(m_langSetWin.data());
- QtLangSet* pWin = new QtLangSet(initTag,this);
pWin->setAttribute(Qt::WA_DeleteOnClose);
connect(pWin, &QtLangSet::viewStyleChange, this, &CCNotePad::slot_viewStyleChange);
connect(pWin, &QtLangSet::viewLexerChange, this, &CCNotePad::slot_viewLexerChange);
+ }
+ else
+ {
+ pWin = dynamic_cast(m_langSetWin.data());
+ }
pWin->show();
registerEscKeyShort(pWin);
#ifdef uos
@@ -8191,6 +8702,10 @@ int CCNotePad::restoreLastFiles()
}
}
}
+ //恢复完毕后,恢复上次的标签页
+ int curIndexWhenQuit = NddSetting::getKeyValueFromNumSets(LAST_ACTION_TAB_INDEX);
+ ui.editTabWidget->setCurrentIndex(curIndexWhenQuit);
+
return fileList.size();
}
@@ -8227,7 +8742,8 @@ void CCNotePad::slot_columnBlockEdit()
{
if (m_columnEditWin.isNull())
{
- m_columnEditWin = new ColumnEdit();
+ m_columnEditWin = new ColumnEdit(this);
+ m_columnEditWin->setWindowFlag(Qt::Window);
m_columnEditWin->setAttribute(Qt::WA_DeleteOnClose);
ColumnEdit* pWin = dynamic_cast(m_columnEditWin.data());
pWin->setTabWidget(ui.editTabWidget);
@@ -8258,7 +8774,7 @@ void CCNotePad::transCurUpperOrLower(TextCaseType type)
{
if (pEdit->isReadOnly())
{
- ui.statusBar->showMessage(tr("The ReadOnly document does not allow this operation."), 8000);
+ ui.statusBar->showMessage(tr("The ReadOnly document does not allow this operation."), MSG_EXIST_TIME);
QApplication::beep();
return;
}
@@ -8346,7 +8862,7 @@ ScintillaEditView* CCNotePad::getCurEditView()
{
if (_pEditView->isReadOnly())
{
- ui.statusBar->showMessage(tr("The ReadOnly document does not allow this operation."), 8000);
+ ui.statusBar->showMessage(tr("The ReadOnly document does not allow this operation."), MSG_EXIST_TIME);
QApplication::beep();
return nullptr;
}
@@ -8365,7 +8881,7 @@ void CCNotePad::spaceTabConvert(SpaceTab type)
{
if (_pEditView->isReadOnly())
{
- ui.statusBar->showMessage(tr("The ReadOnly document does not allow this operation."), 8000);
+ ui.statusBar->showMessage(tr("The ReadOnly document does not allow this operation."), MSG_EXIST_TIME);
QApplication::beep();
return;
}
@@ -8822,7 +9338,7 @@ void CCNotePad::slot_findNext()
}
else
{
- ui.statusBar->showMessage(tr("what find is null !"), 8000);
+ ui.statusBar->showMessage(tr("what find is null !"), MSG_EXIST_TIME);
}
}
@@ -8847,7 +9363,7 @@ void CCNotePad::slot_findPrev()
}
else
{
- ui.statusBar->showMessage(tr("what find is null !"), 8000);
+ ui.statusBar->showMessage(tr("what find is null !"), MSG_EXIST_TIME);
}
}
@@ -8911,7 +9427,7 @@ void CCNotePad::slot_formatXml()
if (reader.hasError())
{
- ui.statusBar->showMessage(tr("XML format error, please check!"), 8000);
+ ui.statusBar->showMessage(tr("XML format error, please check!"), MSG_EXIST_TIME);
QApplication::beep();
return;
}
@@ -8941,7 +9457,7 @@ void CCNotePad::slot_formatJson()
if (QJsonParseError::NoError != parseError.error)
{
- ui.statusBar->showMessage(tr("JSON format error, please check!"),8000);
+ ui.statusBar->showMessage(tr("JSON format error, please check!"),MSG_EXIST_TIME);
QApplication::beep();
return;
}
@@ -8953,10 +9469,10 @@ void CCNotePad::slot_formatJson()
//清空历史打开记录
void CCNotePad::slot_clearHistoryOpenList()
{
-
ui.menuRecene_File->clear();
m_receneOpenFileList.clear();
+ NddSetting::updataKeyValueFromDelaySets(RECENT_OPEN_FILE, "");
}
void CCNotePad::slot_showToolBar(bool check)
@@ -9068,3 +9584,32 @@ void CCNotePad::slot_shortcutManager()
#endif
pWin->show();
}
+
+//处理当前按下ESC后,需要处理退出的事件
+void CCNotePad::on_quitActiveWindow()
+{
+ if (!m_pFindWin.isNull()&& m_pFindWin->isVisible())
+ {
+ m_pFindWin->close();
+ }
+ if (!m_columnEditWin.isNull() && m_columnEditWin->isVisible())
+ {
+ m_columnEditWin->close();
+ }
+ if (!m_langSetWin.isNull() && m_langSetWin->isVisible())
+ {
+ m_langSetWin->close();
+ }
+ if (!m_optionsView.isNull() && m_optionsView->isVisible())
+ {
+ m_optionsView->close();
+ }
+}
+
+void CCNotePad::on_md5hash()
+{
+ Md5hash* pWin = new Md5hash(this);
+ pWin->setWindowFlag(Qt::Window);
+ pWin->setAttribute(Qt::WA_DeleteOnClose);
+ pWin->show();
+}
diff --git a/src/cceditor/ccnotepad.h b/src/cceditor/ccnotepad.h
index 84ab6e6..b697c75 100755
--- a/src/cceditor/ccnotepad.h
+++ b/src/cceditor/ccnotepad.h
@@ -35,6 +35,10 @@ struct HexFileMgr;
struct TextFileMgr;
struct BigTextEditFileMgr;
+static const char* Tail_Thread = "tailthread";
+
+//编码类型,int
+static const char* Edit_Text_Code = "code";
enum OpenAttr {
Text = 1,
@@ -100,18 +104,7 @@ public:
void initLexerNameToIndex();
static LexerInfo getLangLexerIdByFileExt(QString filePath);
-#if 0
- static QFont & getTxtFont()
- {
- return s_txtFont;
- }
- static QFont & getProLangFont()
- {
- return s_proLangFont;
- }
-#endif
-
bool openFile(QString filePath, int lineNum=-1);
bool tryRestoreFile(QString filePath);
@@ -143,8 +136,8 @@ public:
void clearHighlightWord(QString signWord, ScintillaEditView* pEdit = nullptr);
bool closeFileByEditWidget(QWidget* pEdit);
void showChangePageTips(QWidget* pEdit);
- int markAtBack(QString keyword);
- int findAtBack(QString keyword);
+ int markAtBack(QStringList& keyword);
+ int findAtBack(QStringList& keyword);
int replaceAtBack(QStringList& keyword, QStringList& replace);
void updateThemes();
@@ -154,10 +147,15 @@ public:
void changeMarkColor(int sytleId);
void setUserDefShortcutKey(int shortcutId);
+
+ QtLangSet* getLangSet();
signals:
void signSendRegisterKey(QString key);
void signRegisterReplay(int code);
void signLinkNetServer();
+#ifdef Q_OS_WIN
+ void tailFileChange(ScintillaEditView*);
+#endif
public slots:
void slot_changeChinese();
void slot_changeEnglish();
@@ -171,8 +169,10 @@ public slots:
void slot_actionCloseNonCurDoc();
void slot_actionCloseLeftAll();
void slot_actionCloseRightAll();
+
void slot_quit(bool);
+
void slot_closeAllFile(bool);
void slot_batch_convert();
void slot_batch_rename();
@@ -183,12 +183,15 @@ public slots:
void slot_viewLexerChange(QString tag);
void slot_findInDir();
void slot_showFileInExplorer();
+#ifdef Q_OS_WIN
+ void slot_showCmdInExplorer();
+#endif
void slot_wordHighlight();
void slot_clearWordHighlight();
void slot_clearMark();
void slot_zoomValueChange();
-
+ void on_quitActiveWindow();
protected:
void closeEvent(QCloseEvent *event) override;
@@ -260,6 +263,7 @@ private slots:
void slot_compareDir();
void slot_binCompare();
void slot_tabBarClicked(int index);
+ void on_tabBarDoubleClicked(int index);
void slot_reOpenTextMode();
void slot_reOpenHexMode();
void slot_selectLeftFile();
@@ -338,8 +342,9 @@ private slots:
void slot_showToolBar(bool);
void slot_dynamicLoadToolMenu();
void slot_batchFind();
-#ifdef NO_PLUGIN
+ void on_loadReceneFile();
void slot_pluginMgr();
+#ifdef NO_PLUGIN
void onPlugWork(bool check);
void sendParaToPlugin(NDD_PROC_DATA& procData);
#endif
@@ -347,6 +352,11 @@ private slots:
void slot_langFileSuffix();
void slot_shortcutManager();
void on_lineEndChange(int index);
+ void on_tailfile(bool isOn);
+#ifdef Q_OS_WIN
+ void on_roladFile(ScintillaEditView* pEdit);
+#endif
+ void on_md5hash();
private:
void initFindResultDockWin();
@@ -376,6 +386,7 @@ private:
void syncCurDocEncodeToMenu(QWidget * curEdit);
void syncCurDocLineEndStatusToMenu(QWidget * curEdit);
void syncCurDocLexerToMenu(QWidget* pEdit);
+ void syncCurDocTailfToMenu(QWidget* curEdit);
void cmpSelectFile();
@@ -386,7 +397,7 @@ private:
void removeWatchFilePath(QString filePath);
bool checkRoladFile(ScintillaEditView * pEdit);
- void reloadEditFile(ScintillaEditView * pEidt);
+ void reloadEditFile(ScintillaEditView * pEidt, bool isTailfOn = false);
int initFindWindow(FindTabIndex type= FIND_TAB);
void setToFileRightMenu();
@@ -445,6 +456,7 @@ private:
void init_toolsMenu();
void changeBlankShowStatus(int showBlank);
void syncBlankShowStatus();
+ void openFileInNewWin(int index);
#ifdef NO_PLUGIN
void loadPluginLib();
void loadPluginProcs(QString strLibDir, QMenu* pMenu);
@@ -453,7 +465,12 @@ private:
void setUserDefShortcutKey();
void setNormalTextEditInitPro(ScintillaEditView* pEdit, QString filePath, CODE_ID code, RC_LINE_FORM lineEnd, bool isReadOnly, bool isModifyed);
+ void registerCommentShortKey(int type, QKeySequence& keySeq);
void dealRecentFileMenuWhenColseFile(QString closeFilePath);
+ void registerFoldShortKey(int type, QKeySequence& keySeq, bool isFold);
+ void doFold(int type, bool mode);
+ void doComment(int type);
+ void tailfile(bool isOn, ScintillaEditView* pEdit);
private:
Ui::CCNotePad ui;
@@ -478,11 +495,15 @@ private:
QActionGroup *m_pLexerActGroup;
QActionGroup *m_pIconSize;
+#if 0
QAction* m_quitAction;
+#endif
//关闭时,询问保存文件,用户点击了取消,此时不能走关闭程序
//设置一个标志记录该状态,确定最终是否要退出
bool m_isQuitCancel;
+ //是否主窗口。可以打开多个,但是只有第一个是主窗口
+ bool m_isMainWindows;
QMap m_lexerNameToIndex;
@@ -493,12 +514,13 @@ private:
QString m_cmpRightFilePath;
QPointer m_pFindWin;
- QPointer m_columnEditWin;
+ QPointer m_columnEditWin;
+ QPointer m_langSetWin;
+ QPointer m_optionsView;
+
QSharedMemory* m_shareMem;
- //是否主窗口。可以打开多个,但是只有第一个是主窗口
- bool m_isMainWindows;
//最近打开的对比文件和目录列表。做一个环形区
//保存在数据库中
@@ -511,6 +533,7 @@ private:
QAction* m_openInNewWinAct;
QAction* m_showFileDirAct;
+ QAction* m_showCmdAct;
QAction* m_openWithText;
QAction* m_openWithHex;
@@ -563,6 +586,7 @@ private:
QToolButton* m_wordwrap;
QToolButton* m_allWhite;
QToolButton* m_indentGuide;
+ QToolButton* m_tailf;
QToolButton* m_preHexPage;
QToolButton* m_nextHexPage;
QToolButton* m_gotoHexPage;
@@ -585,6 +609,8 @@ private:
bool m_isInitBookMarkAct;
+ bool m_isRecentFileLoaded;
+
QListm_styleMarkActList;
QList m_pluginList;
diff --git a/src/cceditor/ccnotepad.ui b/src/cceditor/ccnotepad.ui
index fe1a604..7864870 100755
--- a/src/cceditor/ccnotepad.ui
+++ b/src/cceditor/ccnotepad.ui
@@ -57,9 +57,6 @@
22
-
- Qt::ElideNone
-
true
@@ -69,6 +66,9 @@
true
+
+ false
+
@@ -506,6 +506,7 @@
T&ools
+
@@ -3474,6 +3480,22 @@
+
+ actionMd5_Sha
+ triggered()
+ CCNotePad
+ on_md5hash()
+
+
+ -1
+ -1
+
+
+ 728
+ 394
+
+
+
slot_actionNewFile_toggle(bool)
@@ -3577,5 +3599,6 @@
slot_showWebAddr(bool)
slot_langFileSuffix()
slot_shortcutManager()
+ on_md5hash()
diff --git a/src/cceditor/filemanager.cpp b/src/cceditor/filemanager.cpp
index cd0b0e0..623f1dd 100755
--- a/src/cceditor/filemanager.cpp
+++ b/src/cceditor/filemanager.cpp
@@ -456,7 +456,10 @@ int FileManager::loadFileForSearch(ScintillaEditView* editView, QString filePath
CODE_ID fileTextCode = CODE_ID::UNKOWN;
- CmpareMode::scanFileOutPut(fileTextCode, filePath, outputLineInfoVec, maxLineSize, charsNums, isHexFile);
+ fileTextCode = CmpareMode::scanFileOutPut(fileTextCode, filePath, outputLineInfoVec, maxLineSize, charsNums, isHexFile);
+
+ //20230218 这里必须指明一下编码,否则后续会导致编码被修改
+ editView->setProperty(Edit_Text_Code, fileTextCode);
if (isHexFile)
{
diff --git a/src/ctipwin.cpp b/src/ctipwin.cpp
index d972901..58b1297 100755
--- a/src/ctipwin.cpp
+++ b/src/ctipwin.cpp
@@ -1,4 +1,4 @@
-#include "ctipwin.h"
+#include "ctipwin.h"
#include
@@ -34,3 +34,20 @@ void CTipWin::slot_delayClose()
close();
}
+
+void CTipWin::showTips(QWidget* parent, QString text, int sec)
+{
+ if (parent != nullptr)
+ {
+ CTipWin* pWin = new CTipWin();
+ pWin->setTipText(text);
+ pWin->setAttribute(Qt::WA_DeleteOnClose);
+ pWin->showMsg(sec);
+
+ QPoint pos = parent->pos();
+ QSize size = parent->size();
+
+ QPoint newPos(pos.x() + 10, pos.y() + size.height() - 20);
+ pWin->move(newPos);
+ }
+}
diff --git a/src/ctipwin.h b/src/ctipwin.h
index db85e10..bba247f 100755
--- a/src/ctipwin.h
+++ b/src/ctipwin.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include
#include "ui_ctipwin.h"
@@ -12,6 +12,7 @@ public:
~CTipWin();
void setTipText(QString text);
void showMsg(int sec = 2000);
+ static void showTips(QWidget* parent, QString text, int sec);
private slots:
void slot_delayClose();
diff --git a/src/ctipwin.ui b/src/ctipwin.ui
index a00e6f9..e0d00b4 100755
--- a/src/ctipwin.ui
+++ b/src/ctipwin.ui
@@ -7,7 +7,7 @@
0
0
295
- 69
+ 35
diff --git a/src/dectfilechanges.cpp b/src/dectfilechanges.cpp
new file mode 100755
index 0000000..e443062
--- /dev/null
+++ b/src/dectfilechanges.cpp
@@ -0,0 +1,48 @@
+#include "dectfilechanges.h"
+
+#ifdef WIN32
+
+DectFileChanges::DectFileChanges()
+{
+ _szFile = NULL;
+ _dwNotifyFilter = 0;
+}
+
+
+DectFileChanges::~DectFileChanges()
+{
+}
+
+
+BOOL DectFileChanges::DetectChanges() {
+
+ WIN32_FILE_ATTRIBUTE_DATA fInfo;
+ BOOL rValue = FALSE;
+ ::GetFileAttributesEx(_szFile, GetFileExInfoStandard, &fInfo);
+
+ if ((_dwNotifyFilter & FILE_NOTIFY_CHANGE_SIZE) && (fInfo.nFileSizeHigh != _lastFileInfo.nFileSizeHigh || fInfo.nFileSizeLow != _lastFileInfo.nFileSizeLow)) {
+ rValue = TRUE;
+ }
+
+ if ((_dwNotifyFilter & FILE_NOTIFY_CHANGE_LAST_WRITE) && (fInfo.ftLastWriteTime.dwHighDateTime != _lastFileInfo.ftLastWriteTime.dwHighDateTime || fInfo.ftLastWriteTime.dwLowDateTime != _lastFileInfo.ftLastWriteTime.dwLowDateTime)) {
+ rValue = TRUE;
+ }
+
+ _lastFileInfo = fInfo;
+ return rValue;
+}
+
+void DectFileChanges::AddFile(LPCTSTR szFile, DWORD dwNotifyFilter)
+{
+ _szFile = szFile;
+ _dwNotifyFilter = dwNotifyFilter;
+ ::GetFileAttributesEx(szFile, GetFileExInfoStandard, &_lastFileInfo);
+}
+
+
+void DectFileChanges::Terminate()
+{
+ _szFile = NULL;
+ _dwNotifyFilter = 0;
+}
+#endif
\ No newline at end of file
diff --git a/src/dectfilechanges.h b/src/dectfilechanges.h
new file mode 100755
index 0000000..7d43b6b
--- /dev/null
+++ b/src/dectfilechanges.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#ifdef WIN32
+
+#include
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN
+#endif
+
+//NOMINMAX֤std::minظ
+#define NOMINMAX
+
+#include
+
+class DectFileChanges
+{
+public:
+ DectFileChanges();
+ ~DectFileChanges();
+ void AddFile(LPCTSTR szDirectory, DWORD dwNotifyFilter);
+ BOOL DetectChanges();
+ void Terminate();
+
+private:
+ LPCTSTR _szFile = nullptr;
+ DWORD _dwNotifyFilter = 0;
+ WIN32_FILE_ATTRIBUTE_DATA _lastFileInfo = {};
+
+};
+
+#endif
diff --git a/src/findresultwin.cpp b/src/findresultwin.cpp
index 0954ae6..07f7451 100755
--- a/src/findresultwin.cpp
+++ b/src/findresultwin.cpp
@@ -600,6 +600,9 @@ void FindResultWin::appendResultsToShow(FindRecords* record)
QStandardItem* childItem = new QStandardItem(text);
childItem->setData(QVariant(v.pos), ResultItemPos);
childItem->setData(QVariant(v.end - v.pos), ResultItemLen);
+#if defined(Q_OS_MAC)
+ childItem->setTextAlignment(Qt::AlignVCenter);
+#endif
descItem->appendRow(childItem);
}
if (!record->records.isEmpty())
@@ -695,6 +698,9 @@ void FindResultWin::appendResultsToShow(QVector* record, int hits,
text = tr("Line %1 : %2").arg(v.lineNum + 1).arg(richText);
}
QStandardItem* childItem = new QStandardItem(text);
+#if defined(Q_OS_MAC)
+ childItem->setTextAlignment(Qt::AlignVCenter);
+#endif
childItem->setData(QVariant(v.pos), ResultItemPos);
childItem->setData(QVariant(v.end - v.pos), ResultItemLen);
descItem->appendRow(childItem);
diff --git a/src/findwin.cpp b/src/findwin.cpp
index 55d97f6..e4c1cd7 100755
--- a/src/findwin.cpp
+++ b/src/findwin.cpp
@@ -1,4 +1,4 @@
-#include "findwin.h"
+#include "findwin.h"
#include "scintillaeditview.h"
#include "ccnotepad.h"
#include "progresswin.h"
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
#include
enum TAB_TYPES {
@@ -87,6 +88,7 @@ void FindWin::slot_tabIndexChange(int index)
if (RELPACE_TYPE == type)
{
ui.replaceTextBox->setFocus();
+ ui.replaceTextBox->lineEdit()->selectAll();
if (ui.replaceTextBox->currentText().isEmpty() && !ui.findComboBox->currentText().isEmpty())
{
@@ -99,6 +101,7 @@ void FindWin::slot_tabIndexChange(int index)
else if(FIND_TYPE == type)
{
ui.findComboBox->setFocus();
+ ui.findComboBox->lineEdit()->selectAll();
if (ui.findComboBox->currentText().isEmpty() && !ui.replaceTextBox->currentText().isEmpty())
{
@@ -111,10 +114,12 @@ void FindWin::slot_tabIndexChange(int index)
else if (DIR_FIND_TYPE == type)
{
ui.dirFindWhat->setFocus();
+ ui.dirFindWhat->lineEdit()->selectAll();
}
else if (MARK_TYPE == type)
{
ui.markTextBox->setFocus();
+ ui.markTextBox->lineEdit()->selectAll();
}
m_isFindFirst = true;
@@ -123,13 +128,20 @@ void FindWin::slot_tabIndexChange(int index)
{
return;
}
-}
+ }
void FindWin::slot_dealFileTypeChange(int state)
{
if (state == Qt::Checked)
{
ui.fileType->setEnabled(true);
+
+ if (ui.fileType->text().isEmpty())
+ {
+ ui.fileType->setText(ui.fileType->placeholderText());
+ }
+ ui.fileType->setFocus();
+ ui.fileType->selectAll();
}
else
{
@@ -142,6 +154,13 @@ void FindWin::slot_skipDirChange(int state)
if (state == Qt::Checked)
{
ui.skipDirNames->setEnabled(true);
+
+ if (ui.skipDirNames->text().isEmpty())
+ {
+ ui.skipDirNames->setText(ui.skipDirNames->placeholderText());
+ }
+ ui.skipDirNames->setFocus();
+ ui.skipDirNames->selectAll();
}
else
{
@@ -169,10 +188,12 @@ void FindWin::setCurrentTab(FindTabIndex index)
if (FIND_TAB == index)
{
ui.findComboBox->setFocus();
+ ui.findComboBox->lineEdit()->selectAll();
}
else if(REPLACE_TAB == index)
{
ui.replaceTextBox->setFocus();
+ ui.replaceTextBox->lineEdit()->selectAll();
}
raise();
@@ -189,6 +210,32 @@ void FindWin::setFindText(QString &text)
addFindHistory(text);
}
+void FindWin::keywordWinGetFouse(FindTabIndex tabIndex)
+{
+ switch (tabIndex)
+ {
+ case FIND_TAB:
+ this->setFocus();
+ ui.findComboBox->setFocus();
+ ui.findComboBox->lineEdit()->selectAll();
+ break;
+ case REPLACE_TAB:
+ ui.replaceTextBox->setFocus();
+ ui.replaceTextBox->lineEdit()->selectAll();
+ break;
+ case DIR_FIND_TAB:
+ ui.dirFindWhat->setFocus();
+ ui.dirFindWhat->lineEdit()->selectAll();
+ break;
+ case MARK_TAB:
+ ui.markTextBox->setFocus();
+ ui.markTextBox->lineEdit()->selectAll();
+ break;
+ default:
+ break;
+ }
+}
+
void FindWin::setReplaceFindText(QString& text)
{
ui.replaceTextBox->setEditText(text);
@@ -201,6 +248,13 @@ void FindWin::setDirFindText(QString& text)
addFindHistory(text);
}
+void FindWin::setMarkFindText(QString& text)
+{
+ ui.markTextBox->setEditText(text);
+ addFindHistory(text);
+}
+
+
void FindWin::disableReplace()
{
ui.tab_replace->setEnabled(false);
@@ -575,8 +629,20 @@ void FindWin::updateParameterFromUI()
if (ui.findinfilesTab->currentIndex() == 0)
{
m_forward = (m_isReverseFind ? !m_forward : m_forward);
+ }
}
+
+#if 0
+//开始做了历史记录重复删除的,后面发现时序有问题,暂时不做
+void findItemAndRemove(QComboBox* pCombox, QString& text)
+{
+ int index = pCombox->findText(text);
+ if (index != -1)
+ {
+ pCombox->removeItem(index);
+ }
}
+#endif
void FindWin::addFindHistory(QString &text)
{
@@ -585,19 +651,55 @@ void FindWin::addFindHistory(QString &text)
{
return;
}
- if ((m_findHistory != nullptr) && (-1 == m_findHistory->indexOf(text)))
+
+ if (m_findHistory != nullptr)
{
- m_findHistory->push_front(text);
+ int index = m_findHistory->indexOf(text,0);
+ //已经是最上面一个了,直接返回
+ if (0 == index)
+ {
+ return;
+ }
+ //没有直接添加到最前面。不做查找删除重复,一是慢,而是删除会引起信号逻辑时许有误
+ if (-1 == index)
+ {
+ m_findHistory->push_front(text);
+ ui.findComboBox->insertItem(0, text);
+ ui.replaceTextBox->insertItem(0, text);
+ ui.dirFindWhat->insertItem(0, text);
+ ui.markTextBox->insertItem(0, text);
+ }
+ else
+ {
+ //有了怎么办,删除旧的,加新的
+ m_findHistory->removeAt(index);
+ m_findHistory->push_front(text);
+
+ //发现不能只删除旧的,有bug,一旦删除后,查找框乱了,被切换到下一个。
+ ui.findComboBox->removeItem(index);
+ ui.replaceTextBox->removeItem(index);
+ ui.dirFindWhat->removeItem(index);
+ ui.markTextBox->removeItem(index);
+
+ ui.findComboBox->insertItem(0, text);
+ ui.replaceTextBox->insertItem(0, text);
+ ui.dirFindWhat->insertItem(0, text);
+ ui.markTextBox->insertItem(0, text);
+
+ //发现不能只删除旧的,有bug,一旦删除后,查找框乱了,被切换到下一个。
+ //必须重新设置一下,否则查找框里面字段乱跳到下一个去了
+ ui.findComboBox->setCurrentIndex(0);
+ ui.replaceTextBox->setCurrentIndex(0);
+ ui.dirFindWhat->setCurrentIndex(0);
+ ui.markTextBox->setCurrentIndex(0);
+ }
+
+
if (m_findHistory->size() >= 15)
{
m_findHistory->takeLast();
}
-
- ui.findComboBox->insertItem(0, text);
- ui.replaceTextBox->insertItem(0, text);
- ui.dirFindWhat->insertItem(0,text);
- ui.markTextBox->insertItem(0, text);
}
}
@@ -1048,10 +1150,11 @@ static QString trimmedEnd(QString lineText)
return lineText;
}
-void FindWin::addCurFindRecord(ScintillaEditView* pEdit, FindRecords& recordRet,bool isMark)
+//getResult:是否提取结果目标字符串。在正则查找时,还是有用的
+QString FindWin::addCurFindRecord(ScintillaEditView* pEdit, FindRecords& recordRet,bool isMark, bool getResult)
{
FindRecord aRecord;
-
+ QString ret;
//看了源码,当前查找到的结果,是会被选中的。所以可通过选中范围,来记录当前被查找中的结果
//光标在选择词的尾部下一个位置
#if 0
@@ -1066,54 +1169,54 @@ void FindWin::addCurFindRecord(ScintillaEditView* pEdit, FindRecords& recordRet,
//mark模式不需要这么多信息,可直接返回
if (!isMark)
{
- aRecord.lineNum = pEdit->execute(SCI_LINEFROMPOSITION, aRecord.pos);
- aRecord.lineStartPos = pEdit->execute(SCI_POSITIONFROMLINE, aRecord.lineNum);
- int lineLens = pEdit->execute(SCI_LINELENGTH, aRecord.lineNum);
+ aRecord.lineNum = pEdit->execute(SCI_LINEFROMPOSITION, aRecord.pos);
+ aRecord.lineStartPos = pEdit->execute(SCI_POSITIONFROMLINE, aRecord.lineNum);
+ int lineLens = pEdit->execute(SCI_LINELENGTH, aRecord.lineNum);
- if (lineLens <= 0)
- {
- return;
- }
+ if (lineLens <= 0)
+ {
+ return ret;
+ }
- char* lineText = new char[lineLens + 1];
- memset(lineText, 0, lineLens + 1);
+ char* lineText = new char[lineLens + 1];
+ memset(lineText, 0, lineLens + 1);
- //这里有个bug,是qscint的,查找最后一行,会漏掉最后一个字符
- pEdit->execute(SCI_GETLINE, aRecord.lineNum, reinterpret_cast(lineText));
+ //这里有个bug,是qscint的,查找最后一行,会漏掉最后一个字符
+ pEdit->execute(SCI_GETLINE, aRecord.lineNum, reinterpret_cast(lineText));
- //务必要去掉行位的换行,否则显示结果列表会显示换行
- aRecord.lineContents = trimmedEnd(QString(lineText));
+ //务必要去掉行位的换行,否则显示结果列表会显示换行
+ aRecord.lineContents = trimmedEnd(QString(lineText));
+ delete[]lineText;
- delete[]lineText;
+ //如果需要结果,再把结果提取一下
+ if (getResult && (state.targend - state.targstart > 0))
+ {
+ Sci_TextRange lineText;
+ lineText.chrg.cpMin = static_cast(state.targstart);
+ lineText.chrg.cpMax = static_cast(state.targend);
+
+ QByteArray result;
+ result.resize(state.targend - state.targstart);
+ lineText.lpstrText = result.data();
+ //获取原始行的内容
+ pEdit->SendScintilla(SCI_GETTEXTRANGE, 0, &lineText);
+
+ ret = QString(result);
+ }
}
recordRet.records.append(aRecord);
+
+ return ret;
}
-//在后台查找
-int FindWin::findAtBack(QString keyword)
+//在后台批量查找
+int FindWin::findAtBack(QStringList& keyword)
{
- this->setCurrentTab(FIND_TAB);
- ui.findComboBox->setCurrentText(keyword);
- ui.findBackwardBox->setChecked(false);
- ui.findMatchCaseBox->setChecked(true);
- ui.findWrapBox->setChecked(false);
- ui.findMatchWholeBox->setChecked(false);
- ui.findModeNormalBt->setChecked(true);
-
- m_isStatic = true;
- int times = findAllInCurDoc();
- m_isStatic = false;
-
- return times;
-}
-
-//在后台替换
-int FindWin::replaceAtBack(QStringList& keyword, QStringList& replace)
-{
- assert(keyword.size() == replace.size());
-
- this->setCurrentTab(REPLACE_TAB);
+ if (keyword.isEmpty())
+ {
+ return 0;
+ }
QWidget* pw = autoAdjustCurrentEditWin();
ScintillaEditView* pEdit = dynamic_cast(pw);
@@ -1127,49 +1230,148 @@ int FindWin::replaceAtBack(QStringList& keyword, QStringList& replace)
}
}
- ui.replaceBackwardBox->setChecked(false);
- ui.replaceMatchWholeBox->setChecked(false);
- ui.replaceMatchCaseBox->setChecked(true);
- ui.replaceWrapBox->setChecked(false);
- ui.replaceModeNormalBox->setChecked(true);
+ m_isStatic = true;
+ int times = 0;
+
+ ProgressWin* loadFileProcessWin = nullptr;
+
+ if (keyword.size() > 1000)
+ {
+ loadFileProcessWin = new ProgressWin(this);
+
+ loadFileProcessWin->setWindowModality(Qt::WindowModal);
+
+ loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(keyword.size()));
+
+ loadFileProcessWin->setTotalSteps(keyword.size() / 100);
+
+ loadFileProcessWin->show();
+ }
+
+ QString text = pEdit->text();
+
+ QByteArray bytes = text.toUtf8();
+
+ QByteArray findBytes;
+ int keyLens = 0;
+
+ int index = 0;
+
+ for (int i = 0; i < keyword.size(); ++i)
+ {
+ if ((loadFileProcessWin != nullptr) && loadFileProcessWin->isCancel())
+ {
+ break;
+ }
+ index = 0;
+
+ //20230223 不走老的逻辑了,批量替换太慢。直接把文件读取处理,在内存中一次性处理完毕。
+ //但是这样就不知道到底有多少字符串被替换了
+ findBytes = keyword.at(i).toUtf8();
+ keyLens = findBytes.size();
+
+ while (true)
+ {
+ index = bytes.indexOf(findBytes,index);
+
+ if (index == -1)
+ {
+ break;
+ }
+ ++times;
+ index += keyLens;
+ }
+
+ if ((loadFileProcessWin != nullptr)&& ((i % 100) == 0))
+ {
+ loadFileProcessWin->moveStep();
+ QCoreApplication::processEvents();
+ }
+ }
+
+ if (loadFileProcessWin != nullptr)
+ {
+ delete loadFileProcessWin;
+ }
+
+ return times;
+}
+
+//在后台批量替换
+int FindWin::replaceAtBack(QStringList& keyword, QStringList& replace)
+{
+ assert(keyword.size() == replace.size());
+
+ //this->setCurrentTab(REPLACE_TAB);
+ if (keyword.isEmpty())
+ {
+ return 0;
+ }
+
+ QWidget* pw = autoAdjustCurrentEditWin();
+ ScintillaEditView* pEdit = dynamic_cast(pw);
+ if (pEdit != nullptr)
+ {
+ if (pEdit->isReadOnly())
+ {
+ ui.statusbar->showMessage(tr("The ReadOnly document does not allow replacement."), 8000);
+ QApplication::beep();
+ return 0;
+ }
+ }
m_isStatic = true;
int times = 0;
pEdit->execute(SCI_BEGINUNDOACTION);
- ProgressWin* loadFileProcessWin = new ProgressWin(this);
+ ProgressWin* loadFileProcessWin = nullptr;
- loadFileProcessWin->setWindowModality(Qt::WindowModal);
+ if (keyword.size() > 1000)
+ {
+ loadFileProcessWin = new ProgressWin(this);
- loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(keyword.size()));
+ loadFileProcessWin->setWindowModality(Qt::WindowModal);
- loadFileProcessWin->setTotalSteps(keyword.size());
+ loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(keyword.size()));
- loadFileProcessWin->show();
+ loadFileProcessWin->setTotalSteps(keyword.size() / 10);
+
+ loadFileProcessWin->show();
+ }
+
+ QString text = pEdit->text();
for (int i = 0; i < keyword.size(); ++i)
{
- if (loadFileProcessWin->isCancel())
+ if ((loadFileProcessWin!=nullptr) && loadFileProcessWin->isCancel())
{
break;
}
+ //20230223 不走老的逻辑了,批量替换太慢。直接把文件读取处理,在内存中一次性处理完毕。
+ //但是这样就不知道到底有多少字符串被替换了
+ text.replace(keyword.at(i), replace.at(i));
- ui.replaceTextBox->setCurrentText(keyword.at(i));
- ui.replaceWithBox->setText(replace.at(i));
-
- updateParameterFromUI();
-
- QString whatFind = ui.replaceTextBox->currentText();
- QString replaceText = ui.replaceWithBox->text();
-
- times += doReplaceAll(pEdit, whatFind, replaceText, false);
-
- loadFileProcessWin->moveStep();
-
- QCoreApplication::processEvents();
+ if ((loadFileProcessWin != nullptr) && ((i % 10) == 0))
+ {
+ loadFileProcessWin->moveStep();
+ QCoreApplication::processEvents();
+ }
+ }
+ //替换外部后,一次性整体替换
+
+ int selectionEnd = pEdit->length();
+
+ pEdit->execute(SCI_SETTARGETRANGE, 0, selectionEnd);
+
+ QByteArray bytes = text.toUtf8();
+
+ pEdit->execute(SCI_REPLACETARGET, bytes.size(), reinterpret_cast(bytes.data()));
+
+ if (loadFileProcessWin != nullptr)
+ {
+ delete loadFileProcessWin;
}
- delete loadFileProcessWin;
pEdit->execute(SCI_ENDUNDOACTION);
@@ -1178,7 +1380,121 @@ int FindWin::replaceAtBack(QStringList& keyword, QStringList& replace)
return times;
}
-int FindWin::findAllInCurDoc()
+//在后台批量高亮
+int FindWin::markAtBack(QStringList& keyword)
+{
+ if (keyword.isEmpty())
+ {
+ return 0;
+ }
+
+ QWidget* pw = autoAdjustCurrentEditWin();
+ ScintillaEditView* pEdit = dynamic_cast(pw);
+ if (pEdit != nullptr)
+ {
+ if (pEdit->isReadOnly())
+ {
+ ui.statusbar->showMessage(tr("The ReadOnly document does not allow replacement."), 8000);
+ QApplication::beep();
+ return 0;
+ }
+ }
+
+ m_isStatic = true;
+ int times = 0;
+
+ ProgressWin* loadFileProcessWin = nullptr;
+
+ if (keyword.size() > 1000)
+ {
+ loadFileProcessWin = new ProgressWin(this);
+
+ loadFileProcessWin->setWindowModality(Qt::WindowModal);
+
+ loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(keyword.size()));
+
+ loadFileProcessWin->setTotalSteps(keyword.size() / 100);
+
+ loadFileProcessWin->show();
+ }
+
+ QString text = pEdit->text();
+
+ QByteArray bytes = text.toUtf8();
+
+ QByteArray findBytes;
+ int keyLens = 0;
+
+ int index = 0;
+
+ QMap* > keyPos;
+
+ for (int i = 0; i < keyword.size(); ++i)
+ {
+ if ((loadFileProcessWin != nullptr) && loadFileProcessWin->isCancel())
+ {
+ break;
+ }
+ index = 0;
+
+ //20230223 不走老的逻辑了,批量替换太慢。直接把文件读取处理,在内存中一次性处理完毕。
+ //但是这样就不知道到底有多少字符串被替换了
+ findBytes = keyword.at(i).toUtf8();
+ keyLens = findBytes.size();
+
+ if (keyLens == 0)
+ {
+ continue;
+ }
+
+ QVector* vec = new QVector();
+ vec->reserve(128);
+ keyPos.insert(findBytes, vec);
+
+ while (true)
+ {
+ index = bytes.indexOf(findBytes, index);
+
+ if (index == -1)
+ {
+ break;
+ }
+ ++times;
+ vec->append(index);
+
+ index += keyLens;
+ }
+
+ if ((loadFileProcessWin != nullptr) && ((i % 100) == 0))
+ {
+ loadFileProcessWin->moveStep();
+ QCoreApplication::processEvents();
+ }
+ }
+
+ //把结果高亮起来。
+ for (QMap* >::iterator it = keyPos.begin(); it != keyPos.end(); ++it)
+ {
+ int foundTextLen = it.key().size();
+ QVector* pVect = (*it);
+ for (int i = 0, s = pVect->size(); i < s; ++i)
+ {
+ pEdit->execute(SCI_SETINDICATORCURRENT, CCNotePad::s_curMarkColorId);
+ pEdit->execute(SCI_INDICATORFILLRANGE, pVect->at(i), foundTextLen);
+
+ }
+ delete pVect;
+ }
+
+ if (loadFileProcessWin != nullptr)
+ {
+ delete loadFileProcessWin;
+ }
+
+ return times;
+}
+
+int FindWin::findAllInCurDoc(QStringList* reResult)
{
if (ui.findComboBox->currentText().isEmpty())
{
@@ -1201,6 +1517,8 @@ int FindWin::findAllInCurDoc()
return 0;
}
+ QString resultDestStr;
+ int askAbortTimes = 0;
FindRecords results;
results.pEdit = pEdit;
@@ -1208,10 +1526,13 @@ int FindWin::findAllInCurDoc()
updateParameterFromUI();
+ //正则模式下面,拷贝所有结果到剪切板
+ bool isNeedResult(m_re && (reResult != nullptr));
+
int srcPostion = pEdit->execute(SCI_GETCURRENTPOS);
int firstDisLineNum = pEdit->execute(SCI_GETFIRSTVISIBLELINE);
- int replaceNums = 0;
+ int findNums = 0;
//无条件进行第一次查找,从0行0列开始查找,而且不回环。如果没有找到,则替换完毕
QString whatFind = ui.findComboBox->currentText();
@@ -1232,8 +1553,8 @@ int FindWin::findAllInCurDoc()
if (!m_isStatic)
{
- QApplication::beep();
- emit sign_findAllInCurDoc(&results);
+ QApplication::beep();
+ emit sign_findAllInCurDoc(&results);
}
m_isFindFirst = true;
@@ -1245,17 +1566,40 @@ int FindWin::findAllInCurDoc()
dealWithZeroFound(pEdit);
}
- addCurFindRecord(pEdit, results);
+ resultDestStr = addCurFindRecord(pEdit, results, false, isNeedResult);
- ++replaceNums;
+ //正则模式下面,拷贝所有结果到剪切板
+ if (isNeedResult)
+ {
+ reResult->append(resultDestStr);
+ }
+
+ ++findNums;
//找到了,把结果收集起来
while (pEdit->findNext())
{
- addCurFindRecord(pEdit, results);
- ++replaceNums;
+ resultDestStr = addCurFindRecord(pEdit, results, false, isNeedResult);
+ ++findNums;
+
+ //正则模式下面,拷贝所有结果到剪切板
+ if (isNeedResult)
+ {
+ reResult->append(resultDestStr);
+ }
dealWithZeroFound(pEdit);
+
+ //2000 和 4000时各询问一次,避免查询结果过大
+ if (((askAbortTimes == 0) && findNums > 2000) || ((askAbortTimes == 1) && findNums > 4000))
+ {
+ int ret = QMessageBox::question(this, tr("Continue Find ?"), tr("The search results have been greater than %1 times in %2 files, and more may be slow. Continue to search?").arg(findNums).arg(1), tr("Yes"), tr("Abort"));
+ if (ret == 1)
+ {
+ break;
+ }
+ ++askAbortTimes;
+ }
}
pEdit->execute(SCI_GOTOPOS, srcPostion);
@@ -1264,11 +1608,21 @@ int FindWin::findAllInCurDoc()
//全部替换后,下次查找,必须算第一次查找
m_isFindFirst = true;
- ui.statusbar->showMessage(tr("find finished, total %1 found!").arg(replaceNums), 10000);
+
+ if (!isNeedResult)
+ {
+ ui.statusbar->showMessage(tr("find finished, total %1 found!").arg(findNums), 10000);
+ }
+ else
+ {
+ ui.statusbar->showMessage(tr("find finished, total %1 found! Result in clipboard.").arg(findNums), 10000);
+ }
emit sign_findAllInCurDoc(&results);
- return replaceNums;
+
+
+ return findNums;
}
else
{
@@ -2365,7 +2719,7 @@ int FindWin::walkDirfile(QString path, int &foundTimes, bool isSkipBinary, bool
{
loadFileProcessWin->setCancel();
break;
- }
+ }
else
{
if (canAbort && (hitFileNums > 100 || foundTimes > 1000))
@@ -2627,3 +2981,22 @@ void FindWin::slot_dirReplaceAll()
ui.statusbar->showMessage(tr("replace finished, total %1 replace in %2 file!").arg(replaceNums).arg(filesNum), 10000);
}
+
+//把正则查找的结果,拷贝到剪切板
+void FindWin::on_copyReFindResult()
+{
+ if (!ui.findModeRegularBt->isChecked())
+ {
+ ui.statusbar->showMessage(tr("Only regular lookup mode can be used!"),10000);
+ return;
+ }
+ QStringList reResult;
+
+ findAllInCurDoc(&reResult);
+
+ if (!reResult.isEmpty())
+ {
+ QClipboard* clipboard = QApplication::clipboard();
+ clipboard->setText(reResult.join("\n"));
+ }
+}
\ No newline at end of file
diff --git a/src/findwin.h b/src/findwin.h
index 7bb76ea..d41597d 100755
--- a/src/findwin.h
+++ b/src/findwin.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include
#include
@@ -63,8 +63,10 @@ public:
void setCurrentTab(FindTabIndex index);
void setTabWidget(QTabWidget * editTabWidget);
void setFindText(QString & text);
+ void keywordWinGetFouse(FindTabIndex tabIndex);
void setReplaceFindText(QString& text);
void setDirFindText(QString& text);
+ void setMarkFindText(QString& text);
void disableReplace();
void setFindHistory(QList* findHistory);
int markAllWord(QString& word);
@@ -74,11 +76,10 @@ public:
void findNext();
void findPrev();
void setFindBackward(bool isBackward);
- int findAtBack(QString keyword);
+
+ int findAtBack(QStringList& keyword);
+ int markAtBack(QStringList& keyword);
int replaceAtBack(QStringList& keyword, QStringList& replace);
-
-
-
protected:
virtual void focusInEvent(QFocusEvent *ev);
@@ -97,7 +98,8 @@ private:
void updateParameterFromUI();
void addFindHistory(QString & text);
bool isFirstFind();
- void addCurFindRecord(ScintillaEditView * pEdit, FindRecords & recordRet, bool isMark=false);
+
+ QString addCurFindRecord(ScintillaEditView * pEdit, FindRecords & recordRet, bool isMark=false, bool getResult=false);
bool findTextInFile(QString & filePath, int & findNums, QVector* allfileInDirRecord);
@@ -125,7 +127,7 @@ private:
int markAll();
- int findAllInCurDoc();
+ int findAllInCurDoc(QStringList * reResult=nullptr);
private slots:
@@ -169,6 +171,8 @@ private slots:
void slot_tabIndexChange(int index);
+ void on_copyReFindResult();
+
private:
Ui::FindWin ui;
diff --git a/src/findwin.ui b/src/findwin.ui
index 28b310f..cb65339 100755
--- a/src/findwin.ui
+++ b/src/findwin.ui
@@ -286,6 +286,13 @@
+ -
+
+
+ Copy Regular Result
+
+
+
-
@@ -1476,8 +1483,8 @@
close()
- 572
- 251
+ 672
+ 291
169
@@ -1524,8 +1531,8 @@
slot_replaceFindNext()
- 94
- 60
+ 458
+ 61
588
@@ -1540,8 +1547,8 @@
close()
- 94
- 45
+ 458
+ 198
588
@@ -1556,8 +1563,8 @@
slot_replace()
- 94
- 64
+ 458
+ 95
588
@@ -1572,8 +1579,8 @@
slot_replaceAll()
- 94
- 67
+ 458
+ 129
588
@@ -1588,8 +1595,8 @@
slot_replaceAllInOpenDoc()
- 94
- 76
+ 458
+ 169
588
@@ -1757,6 +1764,22 @@
+
+ copyReResultBt
+ clicked()
+ FindWin
+ on_copyReFindResult()
+
+
+ 534
+ 222
+
+
+ 344
+ 191
+
+
+
slot_findNext()
@@ -1775,5 +1798,6 @@
sign_clearResult()
slot_findPrev()
slot_clearAllMark()
+ on_copyReFindResult()
diff --git a/src/installer/newinstall_dync.iss b/src/installer/newinstall_dync.iss
index 0d5bcf4..4f2f608 100755
--- a/src/installer/newinstall_dync.iss
+++ b/src/installer/newinstall_dync.iss
@@ -2,7 +2,8 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Notepad--"
-#define MyAppVersion "1.22.0"
+#define MyAppVersion "1.23.2"
+#define MyAppDesc MyAppName + MyAppVersion + "(Ndd)"
#define MyAppPublisher "nddԴ֯"
#define MyAppURL "https://gitee.com/cxasm/notepad--"
#define MyAppExeName "Notepad--.exe"
@@ -10,6 +11,20 @@
#define MyAppAssocExt ".txt"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
+#define MyAppAssocExt1 ".ini"
+#define MyAppAssocExt2 ".log"
+#define MyAppAssocExt3 ".sh"
+#define MyAppAssocExt4 ".h"
+#define MyAppAssocExt5 ".c"
+#define MyAppAssocExt6 ".cpp"
+#define MyAppAssocExt7 ".py"
+#define MyAppAssocExt8 ".xml"
+#define MyAppAssocExt9 ".def"
+#define MyAppAssocExt10 ".json"
+#define MyAppAssocExt11 ".pro"
+#define MyAppAssocExt12 ".csv"
+
+
[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.)
@@ -35,6 +50,7 @@ Compression=lzma
SolidCompression=yes
WizardStyle=modern
+
[Languages]
Name: "ChineseSimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
@@ -47,14 +63,35 @@ Source: "D:\CCNotePad\x64\Release\*"; DestDir: "{app}"; Flags: ignoreversion rec
; 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""" ;
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: main
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt1}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue ; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt2}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt3}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt4}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt5}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt6}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt7}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt8}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt9}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt10}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt11}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
+
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey; Components: main
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"; Components: main
+Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Components: main
+
+Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}"; ValueType: string; ValueName: ""; ValueData: ""; Flags: uninsdeletekey; Components: main
+Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""; Flags: uninsdeletekey; Components: main
+;Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey; Components: main
+Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--"; ValueType: string; ValueName: ""; ValueData: "Edit with Notepad--"; Flags: uninsdeletekey; Components: main
+Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\{#MyAppExeName}""" ; Components: main
+Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" ; Components: main
+
+
+
+[Components]
+Name: "main"; Description: "{#MyAppDesc}"; Types: full compact custom; Flags: fixed
+Name: "ass"; Description: "ı"; Types: full
[Icons]
diff --git a/src/main.cpp b/src/main.cpp
index 5d94509..b930779 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -40,7 +40,7 @@ const QString c_strTitle = "Ndd";
#ifdef Q_OS_UNIX
#if defined(Q_OS_MAC)
-QSharedMemory shared("CCNotebook122");;//mac下面后面带一个版本号,避免新的打不开
+QSharedMemory shared("CCNotebook123");;//mac下面后面带一个版本号,避免新的打不开
#else
QSharedMemory shared("CCNotebook");
#endif
diff --git a/src/md5hash.cpp b/src/md5hash.cpp
new file mode 100755
index 0000000..ee00dfb
--- /dev/null
+++ b/src/md5hash.cpp
@@ -0,0 +1,153 @@
+#include "md5hash.h"
+#include "ccnotepad.h"
+#include "ctipwin.h"
+
+#include
+#include
+#include
+#include
+
+Md5hash::Md5hash(QWidget *parent)
+ : QWidget(parent), m_isFile(false)
+{
+ ui.setupUi(this);
+
+
+ m_btGroup.addButton(ui.md4RadioBt, 0);
+ m_btGroup.addButton(ui.md5RadioBt, 1);
+ m_btGroup.addButton(ui.sha1RadioBt, 2);
+ m_btGroup.addButton(ui.sha256RadioBt, 4);
+ m_btGroup.addButton(ui.sha3RadioBt, 12);
+ m_btGroup.addButton(ui.kec256RadioBt, 8);
+
+#if (QT_VERSION <= QT_VERSION_CHECK(5,15,0))
+ connect(&m_btGroup, QOverload::of(&QButtonGroup::buttonClicked), this, &Md5hash::on_methodIdChange);
+#else
+ connect(&m_btGroup, &QButtonGroup::idClicked, this, &Md5hash::on_methodIdChange);
+#endif
+
+ connect(ui.srcTextEdit,&QPlainTextEdit::textChanged,this,&Md5hash::on_hash);
+}
+
+Md5hash::~Md5hash()
+{}
+
+void Md5hash::slot_select()
+{
+ QFileDialog fd(this, QString(), CCNotePad::s_lastOpenDirPath);
+ fd.setFileMode(QFileDialog::ExistingFile);
+ m_fileList.clear();
+
+ if (fd.exec() == QDialog::Accepted) //ɹִ
+ {
+ m_fileList = fd.selectedFiles(); //ļб
+
+ if (!m_fileList.isEmpty())
+ {
+ m_isFile = true;
+ ui.srcTextEdit->setPlainText(m_fileList.join("\n"));
+ }
+
+ }
+ else
+ {
+ fd.close();
+ }
+}
+
+void Md5hash::on_methodIdChange(int id)
+{
+ on_hash();
+}
+
+void Md5hash::on_hash()
+{
+ QCryptographicHash::Algorithm method = QCryptographicHash::Md5;
+
+ if (ui.md5RadioBt->isChecked())
+ {
+ method = QCryptographicHash::Md5;
+ }
+ else if (ui.md4RadioBt->isChecked())
+ {
+ method = QCryptographicHash::Md4;
+ }
+ else if (ui.sha1RadioBt->isChecked())
+ {
+ method = QCryptographicHash::Sha1;
+ }
+ else if (ui.sha256RadioBt->isChecked())
+ {
+ method = QCryptographicHash::Sha256;
+ }
+ else if (ui.sha3RadioBt->isChecked())
+ {
+ method = QCryptographicHash::Sha3_256;
+ }
+ else if (ui.kec256RadioBt->isChecked())
+ {
+ method = QCryptographicHash::Keccak_256;
+ }
+
+ //ı
+ if (!m_isFile)
+ {
+ QString text = ui.srcTextEdit->toPlainText();
+
+ QByteArray data = text.toUtf8();
+
+ if (!text.isEmpty())
+ {
+ QByteArray result = QCryptographicHash::hash(data, method);
+ ui.hashTextEdit->setPlainText(result.toHex());
+ }
+ }
+ else
+ {
+ QCryptographicHash fileHash(method);
+ QByteArray rs;
+
+ QList result;
+
+ for (int i = 0; i < m_fileList.size(); ++i)
+ {
+ rs.clear();
+ QFile file(m_fileList.at(i));
+ if (file.open(QIODevice::ReadOnly))
+ {
+ if (fileHash.addData(&file))
+ {
+ rs = fileHash.result();
+ result.append(rs.toHex());
+ }
+ else
+ {
+ result.append("Error Null");
+ }
+ file.close();
+ }
+ else
+ {
+ result.append("Error Null");
+ }
+
+ }
+ for (int i = 0; i < result.size(); ++i)
+ {
+ QString info = QString("File %1 cyp hash is \n%2").arg(m_fileList.at(i)).arg(QString(result.at(i)));
+ ui.hashTextEdit->appendPlainText(info);
+ }
+ m_isFile = false;
+ }
+}
+
+void Md5hash::on_copyClipboard()
+{
+ if (!ui.hashTextEdit->toPlainText().isEmpty())
+ {
+ QClipboard* clipboard = QApplication::clipboard();
+ clipboard->setText(ui.hashTextEdit->toPlainText());
+
+ CTipWin::showTips(this, tr("Copy to clipboard Finished!"), 1200);
+ }
+}
\ No newline at end of file
diff --git a/src/md5hash.h b/src/md5hash.h
new file mode 100755
index 0000000..be12f80
--- /dev/null
+++ b/src/md5hash.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include
+#include
+#include "ui_md5hash.h"
+
+class Md5hash : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Md5hash(QWidget *parent = nullptr);
+ ~Md5hash();
+
+private slots:
+ void slot_select();
+ void on_hash();
+ void on_methodIdChange(int id);
+ void on_copyClipboard();
+
+private:
+ Ui::Md5hashClass ui;
+ QButtonGroup m_btGroup;
+ QStringList m_fileList;
+ bool m_isFile;
+};
diff --git a/src/md5hash.ui b/src/md5hash.ui
new file mode 100755
index 0000000..a004d64
--- /dev/null
+++ b/src/md5hash.ui
@@ -0,0 +1,203 @@
+
+
+ Md5hashClass
+
+
+
+ 0
+ 0
+ 560
+ 436
+
+
+
+ Md5hash
+
+
+
+ 3
+
+
+ 3
+
+
-
+
+
-
+
+
+ Copy Text Or Select File
+
+
+
+ -
+
+
+ select
+
+
+
+
+
+ -
+
+
+ -
+
+
+ Algorithm
+
+
+
-
+
+
+ Md4
+
+
+
+ -
+
+
+ Sha1
+
+
+
+ -
+
+
+ Sha3_256
+
+
+
+ -
+
+
+ Md5
+
+
+ true
+
+
+
+ -
+
+
+ Sha256
+
+
+
+ -
+
+
+ Keccak_256
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 80
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Copy to Clipboard
+
+
+
+ -
+
+
+ Close
+
+
+
+
+
+
+
+
+
+
+
+ toolButton
+ clicked()
+ Md5hashClass
+ slot_select()
+
+
+ 534
+ 19
+
+
+ 552
+ 239
+
+
+
+
+ cancelBt
+ clicked()
+ Md5hashClass
+ close()
+
+
+ 503
+ 412
+
+
+ 338
+ 430
+
+
+
+
+ pushButton
+ clicked()
+ Md5hashClass
+ on_copyClipboard()
+
+
+ 393
+ 415
+
+
+ 539
+ 430
+
+
+
+
+
+ slot_select()
+ on_copyClipboard()
+
+
diff --git a/src/nddsetting.cpp b/src/nddsetting.cpp
index 9fdc03d..1b32823 100755
--- a/src/nddsetting.cpp
+++ b/src/nddsetting.cpp
@@ -15,7 +15,7 @@ bool NddSetting::s_isContentChanged = false;
QSettings* NddSetting::s_nddSet = nullptr;
-QSettings* NddSetting::s_winPosSet = nullptr;
+QSettings* NddSetting::s_nddDelaySet = nullptr;
//如果key不存在,则新增key-value。存在:返回true
bool NddSetting::checkNoExistAdd(QString key, QVariant& value)
@@ -96,7 +96,7 @@ void NddSetting::init()
addKeyValueToSets(SOFT_KEY, "0");
- addKeyValueToSets(RESTORE_CLOSE_FILE, "1");
+ addKeyValueToNumSets(RESTORE_CLOSE_FILE, 1);
//0 24 1 36 2 48
addKeyValueToNumSets(ICON_SIZE, 1);
@@ -227,6 +227,10 @@ void NddSetting::init()
QVariant v(14);
checkNoExistAdd(FIND_RESULT_FONT_SIZE, v);
}
+ {
+ QVariant v(0);
+ checkNoExistAdd(LAST_ACTION_TAB_INDEX, v);
+ }
} while (false);
}
@@ -310,10 +314,10 @@ void NddSetting::close()
}
//在这里保存一下子窗口的位置。不排除有可能子窗口还在,主窗口已经退出的情况,不过问题不大。
- if (s_winPosSet != nullptr)
+ if (s_nddDelaySet != nullptr)
{
- s_winPosSet->sync();
- s_winPosSet = nullptr;
+ s_nddDelaySet->sync();
+ s_nddDelaySet = nullptr;
}
}
}
@@ -322,25 +326,41 @@ void NddSetting::close()
//子窗口的位置,单独放在一个winpos.ini文件中,而且启动程序时,不需要读取,可避免启动时拖慢速度
QByteArray NddSetting::getWinPos(QString key)
{
- winPosInit();
- return s_winPosSet->value(key, "").toByteArray();
+ nddDelaySetInit();
+ return s_nddDelaySet->value(key, "").toByteArray();
}
void NddSetting::updataWinPos(QString key, QByteArray& value)
{
- winPosInit();
- s_winPosSet->setValue(key, QVariant(value));
+ nddDelaySetInit();
+ s_nddDelaySet->setValue(key, QVariant(value));
}
-void NddSetting::winPosInit()
+void NddSetting::nddDelaySetInit()
{
- if (s_winPosSet == nullptr)
+ if (s_nddDelaySet == 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");
+ s_nddDelaySet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
+ s_nddDelaySet->setIniCodec("UTF-8");
}
}
+
+
+//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
+QString NddSetting::getKeyValueFromDelaySets(QString key)
+{
+ nddDelaySetInit();
+ return s_nddDelaySet->value(key, "").toString();
+}
+
+bool NddSetting::updataKeyValueFromDelaySets(QString key, QString value)
+{
+ nddDelaySetInit();
+ s_nddDelaySet->setValue(key, value);
+ s_isContentChanged = true;
+ return true;
+}
diff --git a/src/nddsetting.h b/src/nddsetting.h
index 28ec0ff..4cc9aaa 100755
--- a/src/nddsetting.h
+++ b/src/nddsetting.h
@@ -24,6 +24,9 @@ static QString TOOLBARSHOW = "showbar"; //是否显示工具栏
static QString FINDWINSIZE = "findwinsize";//保存查找框的大小。150%放大时界面永久。保留避免每次手动调整
static QString SHOWWEBADDR = "showweb";//高亮web地址,双击网页打开
static QString FIND_RESULT_FONT_SIZE = "frfs";//查找结果的默认字体大小,默认为14
+static QString LAST_ACTION_TAB_INDEX = "lati";//上次关闭时,当前激活的tab标签页序号
+
+static QString RECENT_OPEN_FILE = "recentopenfile";
//下面这个是winpos.ini中的key,避免单个文件太大,拖慢启动速度
@@ -58,14 +61,16 @@ public:
static void updataWinPos(QString key, QByteArray& value);
-
+ static QString getKeyValueFromDelaySets(QString key);
+
+ static bool updataKeyValueFromDelaySets(QString key, QString value);
static bool isDbExist()
{
return s_isExistDb;
}
private:
- static void winPosInit();
+ static void nddDelaySetInit();
private:
static bool s_isExistDb;
@@ -74,5 +79,7 @@ private:
static QSettings* s_nddSet;
- static QSettings* s_winPosSet;
+ //基本和s_nddSet一样,不过在启动的时候,不需要读取该文件。加快启动速度
+ //启动完毕后,其他操作触发加载该文件
+ static QSettings* s_nddDelaySet;
};
diff --git a/src/pluginmgr.cpp b/src/pluginmgr.cpp
index 3944c6c..7cbd786 100755
--- a/src/pluginmgr.cpp
+++ b/src/pluginmgr.cpp
@@ -7,6 +7,10 @@ PluginMgr::PluginMgr(QWidget *parent, QList& pluginList)
{
ui.setupUi(this);
+ ui.pluginTable->horizontalHeader()->setStretchLastSection(true);
+ ui.pluginTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
+ ui.pluginTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
+ //ui.pluginTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
init(pluginList);
}
diff --git a/src/qscint/src/Qsci/qsciglobal.h b/src/qscint/src/Qsci/qsciglobal.h
index 89e404b..e08a02b 100755
--- a/src/qscint/src/Qsci/qsciglobal.h
+++ b/src/qscint/src/Qsci/qsciglobal.h
@@ -37,7 +37,10 @@
// Define QSCINTILLA_MAKE_DLL to create a QScintilla shared library, or
// define QSCINTILLA_DLL to link against a QScintilla shared library, or define
// neither to either build or link against a static QScintilla library.
-#define QSCINTILLA_DLL
+#ifdef QSCINTILLA_DLL
+#undef QSCINTILLA_DLL
+#endif
+//#define QSCINTILLA_DLL
#if defined(QSCINTILLA_DLL)
#define QSCINTILLA_EXPORT Q_DECL_IMPORT
diff --git a/src/qscint/src/qscicommandset.cpp b/src/qscint/src/qscicommandset.cpp
index 1945a56..527dc08 100755
--- a/src/qscint/src/qscicommandset.cpp
+++ b/src/qscint/src/qscicommandset.cpp
@@ -47,7 +47,9 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
const char *desc;
};
+ //20230216 屏蔽一些生僻的命令,加宽速度,让出快捷键
static struct sci_cmd cmd_table[] = {
+
{
QsciCommand::LineDown,
Qt::Key_Down,
@@ -58,6 +60,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Move down one line")
},
+
{
QsciCommand::LineDownExtend,
Qt::Key_Down | Qt::SHIFT,
@@ -127,7 +130,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
#if defined(USING_OSX_KEYS)
Qt::Key_Home,
#else
- 0,
+ Qt::Key_Home | Qt::CTRL,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Scroll to start of document")
@@ -137,11 +140,12 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
#if defined(USING_OSX_KEYS)
Qt::Key_End,
#else
- 0,
+ Qt::Key_End | Qt::CTRL,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Scroll to end of document")
},
+#if 0
{
QsciCommand::VerticalCentreCaret,
#if defined(USING_OSX_KEYS)
@@ -159,6 +163,10 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move down one paragraph")
},
+#endif
+
+#if 0
+ //测试无效
{
QsciCommand::ParaDownExtend,
Qt::Key_BracketRight | Qt::CTRL | Qt::SHIFT,
@@ -166,12 +174,15 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection down one paragraph")
},
+#endif
{
QsciCommand::ParaUp,
Qt::Key_BracketLeft | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move up one paragraph")
},
+
+#if 0
{
QsciCommand::ParaUpExtend,
Qt::Key_BracketLeft | Qt::CTRL | Qt::SHIFT,
@@ -179,6 +190,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection up one paragraph")
},
+#endif
{
QsciCommand::CharLeft,
Qt::Key_Left,
@@ -189,6 +201,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Move left one character")
},
+
+
{
QsciCommand::CharLeftExtend,
Qt::Key_Left | Qt::SHIFT,
@@ -200,6 +214,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection left one character")
},
+
{
QsciCommand::CharLeftRectExtend,
Qt::Key_Left | Qt::ALT | Qt::SHIFT,
@@ -243,6 +258,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection right one character")
},
+
+#if 0
{
QsciCommand::WordLeft,
#if defined(USING_OSX_KEYS)
@@ -253,6 +270,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move left one word")
},
+#endif
{
QsciCommand::WordLeftExtend,
#if defined(USING_OSX_KEYS)
@@ -263,6 +281,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Extend selection left one word")
},
+#if 0
{
QsciCommand::WordRight,
#if defined(USING_OSX_KEYS)
@@ -273,12 +292,16 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move right one word")
},
+#endif
+#if 0
{
QsciCommand::WordRightExtend,
Qt::Key_Right | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Extend selection right one word")
},
+#endif
+#if 0
{
QsciCommand::WordLeftEnd,
0,
@@ -313,6 +336,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of next word")
},
+#endif
+#if 0
{
QsciCommand::WordPartLeft,
Qt::Key_Slash | Qt::CTRL,
@@ -339,6 +364,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection right one word part")
},
+#endif
+#if 0
{
QsciCommand::Home,
#if defined(USING_OSX_KEYS)
@@ -371,6 +398,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection to start of document line")
},
+#endif
+#if 0
{
QsciCommand::HomeDisplay,
#if defined(USING_OSX_KEYS)
@@ -406,6 +435,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to start of display or document line")
},
+#endif
+
{
QsciCommand::VCHome,
#if defined(USING_OSX_KEYS)
@@ -417,6 +448,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Move to first visible character in document line")
},
+
{
QsciCommand::VCHomeExtend,
#if defined(USING_OSX_KEYS)
@@ -428,6 +460,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to first visible character in document line")
},
+#if 0
{
QsciCommand::VCHomeRectExtend,
#if defined(USING_OSX_KEYS)
@@ -453,6 +486,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to first visible character in display or document line")
},
+#endif
{
QsciCommand::LineEnd,
#if defined(USING_OSX_KEYS)
@@ -463,6 +497,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to end of document line")
},
+
{
QsciCommand::LineEndExtend,
#if defined(USING_OSX_KEYS)
@@ -474,6 +509,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of document line")
},
+#if 0
{
QsciCommand::LineEndRectExtend,
#if defined(USING_OSX_KEYS)
@@ -485,6 +521,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection to end of document line")
},
+#endif
+#if 0
{
QsciCommand::LineEndDisplay,
#if defined(USING_OSX_KEYS)
@@ -495,6 +533,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to end of display line")
},
+#endif
+#if 0
{
QsciCommand::LineEndDisplayExtend,
#if defined(USING_OSX_KEYS)
@@ -520,6 +560,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of display or document line")
},
+#endif
{
QsciCommand::DocumentStart,
#if defined(USING_OSX_KEYS)
@@ -568,7 +609,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move up one page")
},
- {
+ /* {
QsciCommand::PageUpExtend,
Qt::Key_PageUp | Qt::SHIFT,
0,
@@ -580,7 +621,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection up one page")
- },
+ },*/
{
QsciCommand::PageDown,
Qt::Key_PageDown,
@@ -591,7 +632,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Move down one page")
},
- {
+ /*{
QsciCommand::PageDownExtend,
Qt::Key_PageDown | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
@@ -611,7 +652,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
#endif
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection down one page")
- },
+ },*/
+#if 0
{
QsciCommand::StutteredPageUp,
0,
@@ -638,6 +680,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Stuttered extend selection down one page")
},
+#endif
{
QsciCommand::Delete,
Qt::Key_Delete,
@@ -658,6 +701,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Delete previous character")
},
+#if 0
{
QsciCommand::DeleteBackNotLine,
0,
@@ -677,6 +721,8 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Delete word to right")
},
+#endif
+#if 0
{
QsciCommand::DeleteWordRightEnd,
#if defined(USING_OSX_KEYS)
@@ -688,6 +734,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Delete right to end of next word")
},
+#endif
{
QsciCommand::DeleteLineLeft,
Qt::Key_Backspace | Qt::CTRL | Qt::SHIFT,
@@ -729,18 +776,21 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Transpose current and previous lines")
},*/
+#if 0
{
QsciCommand::LineDuplicate,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Duplicate the current line")
},
+#endif
{
QsciCommand::SelectAll,
Qt::Key_A | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Select all")
},
+#if 0
{
QsciCommand::MoveSelectedLinesUp,
0,
@@ -754,12 +804,15 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
QT_TRANSLATE_NOOP("QsciCommand",
"Move selected lines down one line")
},
+#endif
+#if 0
{
QsciCommand::SelectionDuplicate,
Qt::Key_D | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Duplicate selection")
},
+#endif
{
QsciCommand::SelectionLowerCase,
Qt::Key_U | Qt::CTRL,
@@ -802,18 +855,21 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
Qt::Key_Return | Qt::SHIFT,
QT_TRANSLATE_NOOP("QsciCommand", "Insert newline")
},
+#if 0
{
QsciCommand::Formfeed,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Formfeed")
},
+#endif
{
QsciCommand::Tab,
Qt::Key_Tab,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Indent one level")
},
+#if 0
{
QsciCommand::Backtab,
Qt::Key_Tab | Qt::SHIFT,
@@ -826,6 +882,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Cancel")
},
+#endif
{
QsciCommand::Undo,
Qt::Key_Z | Qt::CTRL,
@@ -842,9 +899,10 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Redo last command")
},
+#if 1
{
QsciCommand::ZoomIn,
- Qt::Key_Plus | Qt::CTRL,
+ Qt::Key_Equal | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Zoom in")
},
@@ -853,7 +911,9 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
Qt::Key_Minus | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Zoom out")
- },
+ },
+#endif
+#if 0
{
QsciCommand::MoveLineUp,
Qt::Key_Up | Qt::CTRL | Qt::SHIFT,
@@ -867,6 +927,7 @@ QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move Line down")
},
+#endif
};
// Clear the default map.
diff --git a/src/qscint/src/qscilexerglobal.cpp b/src/qscint/src/qscilexerglobal.cpp
index 1c5d92b..6adadc0 100755
--- a/src/qscint/src/qscilexerglobal.cpp
+++ b/src/qscint/src/qscilexerglobal.cpp
@@ -163,7 +163,7 @@ QColor QsciLexerGlobal::defaultColor(int style) const
switch (style)
{
case GLOBAL_OVERRIDE:
- return QColor(0xFFFF80);
+ return QColor(Qt::black);
case DEFAULT_STYLE:
return QColor(Qt::black);
@@ -328,7 +328,7 @@ QColor QsciLexerGlobal::defaultPaper(int style) const
switch (style)
{
case GLOBAL_OVERRIDE:
- return QColor(0xFF8000);
+ return QColor(0xFFFFFF);
case DEFAULT_STYLE:
return QColor(0xFFFFFF);
diff --git a/src/qscint/src/qscilexerhtml.cpp b/src/qscint/src/qscilexerhtml.cpp
index da7b6fa..b464d29 100755
--- a/src/qscint/src/qscilexerhtml.cpp
+++ b/src/qscint/src/qscilexerhtml.cpp
@@ -312,21 +312,21 @@ QFont QsciLexerHTML::defaultFont(int style) const
case Default:
case Entity:
#if defined(Q_OS_WIN)
- f = QFont("Courier New",13);
+ f = QFont("Courier New", QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
- f = QFont("Courier New", 13);
+ f = QFont("Courier New", QsciLexer::s_defaultFontSize);
#else
- f = QFont("Bitstream Charter",10);
+ f = QFont("Bitstream Charter", QsciLexer::s_defaultFontSize);
#endif
break;
case HTMLComment:
#if defined(Q_OS_WIN)
- f = QFont("Courier New",9);
+ f = QFont("Courier New", QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
- f = QFont("Verdana", 12);
+ f = QFont("Verdana", QsciLexer::s_defaultFontSize);
#else
- f = QFont("Bitstream Vera Sans",8);
+ f = QFont("Bitstream Vera Sans", QsciLexer::s_defaultFontSize);
#endif
break;
@@ -354,9 +354,9 @@ QFont QsciLexerHTML::defaultFont(int style) const
#if defined(Q_OS_WIN)
f = QFont("Courier New",QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
- f = QFont("Comic Sans MS", 12);
+ f = QFont("Comic Sans MS", QsciLexer::s_defaultFontSize);
#else
- f = QFont("Bitstream Vera Serif",9);
+ f = QFont("Bitstream Vera Serif", QsciLexer::s_defaultFontSize);
#endif
f.setBold(true);
break;
@@ -381,9 +381,9 @@ QFont QsciLexerHTML::defaultFont(int style) const
#if defined(Q_OS_WIN)
f = QFont("Courier New",QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
- f = QFont("Comic Sans MS", 12);
+ f = QFont("Comic Sans MS", QsciLexer::s_defaultFontSize);
#else
- f = QFont("Bitstream Vera Serif",9);
+ f = QFont("Bitstream Vera Serif", QsciLexer::s_defaultFontSize);
#endif
break;
@@ -400,9 +400,9 @@ QFont QsciLexerHTML::defaultFont(int style) const
#if defined(Q_OS_WIN)
f = QFont("Courier New",QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
- f = QFont("Lucida Grande", 12);
+ f = QFont("Lucida Grande", QsciLexer::s_defaultFontSize);
#else
- f = QFont("Bitstream Vera Serif",9);
+ f = QFont("Bitstream Vera Serif", QsciLexer::s_defaultFontSize);
#endif
break;
@@ -411,9 +411,9 @@ QFont QsciLexerHTML::defaultFont(int style) const
#if defined(Q_OS_WIN)
f = QFont("Courier New",QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
- f = QFont("Lucida Grande", 12);
+ f = QFont("Lucida Grande", QsciLexer::s_defaultFontSize);
#else
- f = QFont("Bitstream Vera Serif",9);
+ f = QFont("Bitstream Vera Serif", QsciLexer::s_defaultFontSize);
#endif
f.setBold(false);
break;
@@ -425,9 +425,9 @@ QFont QsciLexerHTML::defaultFont(int style) const
#if defined(Q_OS_WIN)
f = QFont("Courier New",QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
- f = QFont("Courier New", 12);
+ f = QFont("Courier New", QsciLexer::s_defaultFontSize);
#else
- f = QFont("Bitstream Vera Sans Mono",9);
+ f = QFont("Bitstream Vera Sans Mono", QsciLexer::s_defaultFontSize);
#endif
break;
@@ -442,9 +442,9 @@ QFont QsciLexerHTML::defaultFont(int style) const
#if defined(Q_OS_WIN)
f = QFont("Courier New",QsciLexer::s_defaultFontSize);
#elif defined(Q_OS_MAC)
- f = QFont("Comic Sans MS", 12);
+ f = QFont("Comic Sans MS", QsciLexer::s_defaultFontSize);
#else
- f = QFont("Bitstream Vera Serif",9);
+ f = QFont("Bitstream Vera Serif", QsciLexer::s_defaultFontSize);
#endif
f.setItalic(true);
break;
diff --git a/src/qscint/src/qscilexermarkdown.cpp b/src/qscint/src/qscilexermarkdown.cpp
index 269f8df..49d758d 100755
--- a/src/qscint/src/qscilexermarkdown.cpp
+++ b/src/qscint/src/qscilexermarkdown.cpp
@@ -189,8 +189,8 @@ QColor QsciLexerMarkdown::defaultPaper(int style) const
case UnorderedListItem:
return QColor(0xde, 0xd8, 0xc3);
- case OrderedListItem:
- return QColor(0xb8, 0xc3, 0xe1);
+ /*case OrderedListItem:
+ return QColor(0xb8, 0xc3, 0xe1);*/
case BlockQuote:
return QColor(0xcb, 0xdc, 0xcb);
diff --git a/src/qscint/src/qscilexertext.cpp b/src/qscint/src/qscilexertext.cpp
index 87dfa92..0fa4c49 100755
--- a/src/qscint/src/qscilexertext.cpp
+++ b/src/qscint/src/qscilexertext.cpp
@@ -72,23 +72,10 @@ QFont QsciLexerText::defaultFont(int style) const
switch (style)
{
case Default:
-#if defined(Q_OS_WIN)
return s_defaultTxtFont;
-#elif defined(Q_OS_MAC)
- //return QFont("Courier", 12);
- return s_defaultTxtFont;
-#else
- return s_defaultTxtFont;//sQFont("Bitstream Vera Sans Mono", 9);
-#endif
break;
case Ascii:
-#if defined(Q_OS_WIN)
- return QFont("Courier New", 12);
-#elif defined(Q_OS_MAC)
- return QFont("Courier New", 14);
-#else
return s_defaultTxtFont;
-#endif
break;
case Keyword:
#if defined(Q_OS_WIN)
diff --git a/src/qscint/src/qsciscintilla.cpp b/src/qscint/src/qsciscintilla.cpp
index 0a00e64..f7df5c3 100755
--- a/src/qscint/src/qsciscintilla.cpp
+++ b/src/qscint/src/qsciscintilla.cpp
@@ -2370,7 +2370,9 @@ QString QsciScintilla::selectedText() const
if (!selText)
return QString();
- char *buf = new char[SendScintilla(SCI_GETSELECTIONEND) - SendScintilla(SCI_GETSELECTIONSTART) + 1];
+ //char *buf = new char[SendScintilla(SCI_GETSELECTIONEND) - SendScintilla(SCI_GETSELECTIONSTART) + 1];
+ int size = SendScintilla(SCI_GETSELTEXT, 0);
+ char* buf = new char[size];
SendScintilla(SCI_GETSELTEXT, buf);
diff --git a/src/qtlangset.cpp b/src/qtlangset.cpp
index 7262853..f830406 100755
--- a/src/qtlangset.cpp
+++ b/src/qtlangset.cpp
@@ -371,9 +371,10 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
{
//GLOBAL本身不保存,因为GLOBAL不是语法样式,而是全局的属性风格
//如果全局修改的是全局字体或字体大小,全局也修改一下。避免括弧等大小和全局字体不一样大。
+ //全局颜色前景和背景时,也要特殊对待,要单独修改全局default的修改;否则编辑界面看起来颜色杂乱
if (index == L_GLOBAL)
{
- if (flag != GLOBAL_FONT_SIZE && flag != GLOBAL_FONT)
+ if (flag != GLOBAL_FONT_SIZE && flag != GLOBAL_FONT && flag != GLOBAL_FG_COLOR && flag != GLOBAL_BK_COLOR)
{
continue;
}
@@ -492,14 +493,37 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
break;
case GLOBAL_FG_COLOR:
{
+ //非全局修改所有的语法对应样式
+ if (index != L_GLOBAL)
+ {
pLexer->setColor(m_curStyleData.color, -1);
+ pLexer->setDefaultColor(m_curStyleData.color);
+ }
+ else
+ {
+ //全局时,只修改default的颜色
+ pLexer->setColor(m_curStyleData.color, GLOBAL_STYLES::GLOBAL_OVERRIDE);
+ pLexer->setColor(m_curStyleData.color, GLOBAL_STYLES::DEFAULT_STYLE);
+ isGlobalChange = true;
+ }
}
break;
case GLOBAL_BK_COLOR:
{
+ //非全局修改所有的语法对应样式
+ if (index != L_GLOBAL)
+ {
pLexer->setPaper(m_curStyleData.paper, -1);
//默认纸背景色会和QPalette保持一致。单独需要单独设置一下
pLexer->setDefaultPaper(m_curStyleData.paper);
+ }
+ else
+ {
+ //全局时,只修改default的颜色
+ pLexer->setPaper(m_curStyleData.paper, GLOBAL_STYLES::GLOBAL_OVERRIDE);
+ pLexer->setPaper(m_curStyleData.paper, GLOBAL_STYLES::DEFAULT_STYLE);
+ isGlobalChange = true;
+ }
}
break;
default:
@@ -515,6 +539,12 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
//还有,还需要把当前打开文档的全局风格设置一下,否则全局不生效
if (isGlobalChange)
{
+ refreshGlobalSet();
+ }
+}
+
+void QtLangSet::refreshGlobalSet()
+{
m_previousSysLangItem = nullptr;
slot_langListCurRowChanged(0);
@@ -524,14 +554,13 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
CCNotePad* pMainNote = dynamic_cast(parent());
if (pMainNote != nullptr)
{
-
+
for (int i = 0; i <= GLOBAL_STYLES::URL_HOVERRED; ++i)
{
pMainNote->setGlobalFont(i);
}
}
}
-}
//恢复所有语言的初始配置。与restoreOriginLangOneStyle类似,但是粒度更大
void QtLangSet::restoreOriginLangAllStyle()
@@ -655,7 +684,6 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag)
{
oldClor = pOriginLexer->color(i);
pLexer->setColor(oldClor, i);
-
}
break;
case GLOBAL_BK_COLOR:
@@ -669,11 +697,30 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag)
}
}
}
+
+ switch (flag)
+ {
+ case GLOBAL_FG_COLOR:
+ //把默认颜色修改一下
+ oldClor = pOriginLexer->defaultColor();
+ pLexer->setDefaultColor(oldClor);
+ break;
+ case GLOBAL_BK_COLOR:
+ //把默认颜色修改一下
+ oldClor = pOriginLexer->defaultPaper();
+ pLexer->setDefaultPaper(oldClor);
+ break;
+
+ }
saveLangeSet(pLexer);
}
delete pLexer;
delete pOriginLexer;
}
+
+ //全局变化了,把当前全局界面刷新一下
+ //还有,还需要把当前打开文档的全局风格设置一下,否则全局不生效
+ refreshGlobalSet();
}
//预览全局修改字体效果。把当前所有的语法,风格字体都修改一遍
@@ -1154,7 +1201,9 @@ void QtLangSet::syncShowStyleItemToUI(QListWidgetItem *item)
QsciLexer::StyleData & sd = m_selectLexer->styleData(styleId);
m_curStyleData = sd;
setStyleShow(sd.font, sd.color, sd.paper);
- m_isStyleChange = false;
+
+ //这里不能直接设置为非修改,如果之前已经修改过,则还是要认定为修改。
+ //m_isStyleChange = false;
//如果是全局,则把不能修改的全局样式灰掉,避免干扰用户的选择
if (m_isGlobelItem)
@@ -1194,7 +1243,7 @@ void QtLangSet::syncShowStyleItemToUI(QListWidgetItem *item)
//点击当前的风格item
void QtLangSet::slot_styleItemSelect(QListWidgetItem *current)
{
- qDebug() << "slot_styleItemSelect";
+ //qDebug() << "slot_styleItemSelect";
syncShowStyleItemToUI(current);
@@ -1220,7 +1269,7 @@ void QtLangSet::slot_styleItemSelect(QListWidgetItem *current)
//使用键盘上下切换
void QtLangSet::slot_styleListCurRowChanged(int row)
{
- qDebug() << "slot_curRowChanged";
+ //qDebug() << "slot_curRowChanged";
QListWidgetItem* current = ui.styleListWidget->item(row);
slot_styleItemSelect(current);
}
@@ -1478,6 +1527,24 @@ void QtLangSet::slot_changeBkColor()
}
}
+ else
+ {
+ //当前背景色是否变化
+ if (m_curStyleData.paper != color)
+ {
+ m_curStyleData.paper = color;
+ fillBackgroundColor(color);
+ m_isStyleChange = true;
+
+ //即时设置风格
+ if (m_selectLexer != nullptr)
+ {
+ m_selectLexer->setPaper(color, m_selectStyleId);
+
+ emit viewStyleChange(m_selectLexer->lexerTag(), m_selectStyleId, m_curStyleData.color, m_curStyleData.paper, m_curStyleData.font, false);
+ }
+ }
+ }
// else if (!ui.modiryAllColor->isChecked())
// {
// //当前前景色是否变化
@@ -1495,26 +1562,9 @@ void QtLangSet::slot_changeBkColor()
// }
// }
//}
- else
- {
- //全部风格颜色修改
- //当前前景色是否变化
- m_curStyleData.paper = color;
- fillBackgroundColor(color);
- m_isStyleChange = true;
-
- //即时设置风格
- if (m_selectLexer != nullptr)
- {
- m_selectLexer->setPaper(color, -1);
- saveCurLangSettings();
- emit viewLexerChange(m_selectLexer->lexerTag());
}
-
}
- }
-}
void QtLangSet::slot_saveClick()
{
diff --git a/src/qtlangset.h b/src/qtlangset.h
index 8e14b2e..b3feaa2 100755
--- a/src/qtlangset.h
+++ b/src/qtlangset.h
@@ -110,12 +110,9 @@ private:
bool isUseGlobalFgColor();
bool isUseGlobalBgColor();
- //void setGlobalFgColor(int style, QColor color);
- //void setGlobalBgColor(int style, QColor color);
- //void setGlobalFont(int style, QFont font);
-
bool isExistThemesSetings(int styleId);
void createUserStyleFormThemes(int styleId);
+ void refreshGlobalSet();
private:
Ui::QtLangSetClass ui;
diff --git a/src/rcglobal.h b/src/rcglobal.h
index 50a4d4c..52f559c 100755
--- a/src/rcglobal.h
+++ b/src/rcglobal.h
@@ -8,10 +8,10 @@
//#define TEST_PRE
#ifdef TEST_PRE
-static const char* VersionStr = u8"(内部测试非稳定) v1.22.1";
+static const char* VersionStr = u8"(内部测试非稳定) v1.23.0";
#else
-static const char* VersionStr = "v1.22.2";
+static const char* VersionStr = "v1.23.2";
#endif // TEST_PRE
diff --git a/src/realcompare_zh.qm b/src/realcompare_zh.qm
index 472ce1b..205ae31 100755
Binary files a/src/realcompare_zh.qm and b/src/realcompare_zh.qm differ
diff --git a/src/realcompare_zh.ts b/src/realcompare_zh.ts
index ee6f9d2..31aece6 100755
--- a/src/realcompare_zh.ts
+++ b/src/realcompare_zh.ts
@@ -3,10 +3,6 @@
AboutNddClass
-
-
- 关于Ndd
-
<html><head/><body><p><a href="https://gitee.com/cxasm/notepad--"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">点击获取最新版的 notepad-- 或开源代码</span></a></p></body></html>
@@ -94,16 +90,12 @@
BatchFindReplace
-
+
%1 没有对应的查找匹配项!
-
- 最多支持10000条关键字!
-
-
-
+
请输入批量查找的关键字!
@@ -112,43 +104,44 @@
批量查找完成!
-
+
最多支持10000条关键字! {20000 ?}
-
-
-
-
+
+
+
+
+ 查找替换表为空,请先刷新!
-
+
-
+ 批量查找完成!一共发现 %1 处。
-
+
批量替换完成,一共替换 %1 处!
-
+
另存为文件 ...
-
+
导出配置文件成功 !
-
+
没有内容以供导出!
-
+
批量标记完成,一共标记 %1 处!
@@ -331,7 +324,7 @@
-
+
换行符转换
@@ -345,7 +338,7 @@
-
+
显示符号
@@ -355,151 +348,143 @@
-
+
语言
-
+
-
+
最近文件
-
-
-
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
-
- 设置
-
-
-
- 皮肤风格
-
-
+
关于
@@ -509,387 +494,379 @@
-
+
最近对比
-
- 目录...
-
-
-
- 文件...
-
-
-
-
+
+
新建
-
-
+
+
打开
-
-
+
+
-
-
+
+
保存
-
-
+
+
-
-
+
+
另存为
-
-
+
+
-
-
-
-
+
+
+
+
关闭
-
-
+
+
-
-
+
+
退出
-
-
+
+
-
-
-
+
+
+
关闭所有
-
-
+
+
-
-
-
+
+
+
撤销
-
-
+
+
-
-
-
+
+
+
重做
-
-
+
+
-
-
-
+
+
+
剪切
-
-
+
+
-
-
-
+
+
+
拷贝
-
-
+
+
-
-
-
+
+
+
粘贴
-
-
+
+
-
-
+
+
全选
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
查找
-
-
+
+
-
-
-
+
+
+
替换
-
-
+
+
跳转
-
-
+
+
-
-
+
+
显示空格
-
-
+
+
显示行尾
-
-
+
+
显示所有
-
-
-
-
- 编码 GBK
-
-
-
- 编码 UTF8
+
+
+ 用编码 ANSI/GBK 打开
-
-
- 编码 UTF8-BOM
+
+
+ 用编码 UTF8 打开
-
-
- 编码 UCS-2 BE BOM
+
+
+ 用编码 UTF8-BOM 打开
-
+
+
+ 用编码 UCS-2 BE BOM 打开
+
+
+
+
- 编码 UCS-2 LE BOM
+ 用编码 UCS-2 LE BOM 打开
-
-
+
+
- 转换为 GBK 编码
+ 转换为 ANSI/GBK 编码
-
-
+
+
转换为 UTF8 编码
-
-
+
+
转换为 UTF8-BOM 编码
-
-
+
+
转换为 UCS-2 BE BOM 编码
-
-
+
+
转换为 UCS-2 LE BOM 编码
-
-
+
+
批量转换编码
-
-
+
+
选项
-
-
+
+
问题反馈
-
-
+
+
捐赠作者
-
-
+
+
默认
-
-
+
+
亮蓝
-
-
+
+
淡蓝
-
-
+
+
纸黄
-
-
-
-
+
+
+
+
黄色
-
-
+
+
银色
-
-
+
+
淡紫红
-
-
+
+
浅玫瑰色
-
-
+
+
英文
-
-
+
+
中文
@@ -898,158 +875,158 @@
捐赠软件
-
-
+
+
-
-
+
+
查找结果
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
go
-
-
+
+
文件对比
-
+
-
+
File(&F)
文件(&F)
-
+
Edit(&E)
编辑(&E)
-
+
空白字符操作
-
+
大小写转换
-
+
行编辑
-
+
Search(&S)
查找(&S)
-
+
Book Mark
书签
-
+
标记颜色...
-
+
View(&V)
视图(&V)
-
+
图标大小
-
+
Encoding(&N)
编码(&N)
-
+
其它编码
-
+
转换为其它编码
-
+
Language(&L)
语言(&L)
-
+
Set(&T)
设置(&T)
-
+
格式化语言
-
+
反馈问题
-
+
Compare(&C)
对比(&C)
@@ -1059,1113 +1036,1128 @@
最近对比(&R)
-
-
+
+
-
-
+
+
-
-
+
+
目录对比
-
-
+
+
-
-
+
+
-
-
+
+
Php
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Virsual Basic
-
-
+
+
-
-
+
+
Css
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Tex
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Nncrontab
-
-
+
+
-
-
+
+
-
-
+
+
LaTex
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
json
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
Spice
-
-
+
+
-
-
+
+
注册版本
-
-
+
+
+
+ 关于 Notepad--
+
+
+
+
语法文件后缀关联
-
-
+
+
快捷键管理
+
+
+
+
+
+
编程语言格式
-
-
+
+
以文本模式打开
-
-
+
+
以二进制模式打开
-
-
+
+
去除行首空白
-
-
+
+
去除行尾空白
-
-
+
+
去除行首尾空白
-
-
+
+
列块编辑
-
-
+
+
自动换行
-
-
+
+
自定义语言
-
-
+
+
转成大写
-
-
+
+
转成小写
-
-
+
+
每词转成仅首字母大写
-
-
+
+
每词的首字母转成大写
-
-
+
+
每句转成仅首字母大写
-
-
+
+
每句的首字母转成大写
-
-
+
+
大小写互换
-
-
+
+
随机大小写
-
-
+
+
移除空行
-
-
+
+
移除空行(包括空白字符)
-
-
+
+
用户自定义
-
-
+
+
列块模式...
-
-
+
+
TAB 转空格
-
-
+
+
空格转 TAB (全部)
-
-
+
+
空格转 TAB (行首)
-
-
+
+
复制当前行
-
-
+
+
-
-
+
+
删除重复行
-
-
+
+
删除连续的重复行
-
-
+
+
- 分隔行
+ 分割行
-
-
+
+
合并行
-
-
+
+
上移当前行
-
-
+
+
-
-
+
+
下移当前行
-
-
+
+
-
-
+
+
在当前行上方插入空行
-
-
+
+
-
-
+
+
在当前行下方插入空行
-
-
+
+
-
-
+
+
反排序行
-
-
+
+
-
-
+
+
升序排列文本行
-
-
+
+
升序排列文本行(不分大小写)
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
降序排列文本行
-
-
+
+
降序排列文本行(不分大小写)
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
在目录查找
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
格式化 Xml
-
-
-
+
+
+
格式化 Json
-
-
+
+
深色
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
清除历史打开记录
-
-
+
+
文件列表窗口
-
-
+
+
显示工具栏
-
-
-
+
+
+
批量查找替换
-
-
+
+
显示网站(不推荐开启)
-
-
+
+
查找下一个
-
+
目录对比记录
-
+
文件对比记录
-
+
Tools(&O)
工具(&O)
-
-
+
+
主题与语法样式
-
-
+
+
-
-
+
+
查找前一个
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
Big5(繁体中文)
-
-
+
+
-
-
+
+
-
-
+
+
-
-
About ndd
- 关于 Ndd
+ 关于 Ndd
信息
-
-
+
+
行 0 列 0
-
-
+
+
退出
-
+
+
+
+
+
+
Edit with Notebook CC
-
+
关闭当前文档
-
+
关闭所有非当前文档
-
+
关闭左边所有文档
-
+
关闭右边所有文档
-
+
当前文件另存为
-
+
定位到文件路径
-
+
在新窗口中打开
-
+
获取管理员权限失败,打开文件 %1 失败。修改系统文件请以管理员权限执行ndd程序。
-
+
请在管理员权限下执行程序
-
+
重命名当前文件
-
+
重新以文本模式打开
-
+
重新以二进制模式打开
-
+
选择为左边对比文件
-
+
选择为右边对比文件
@@ -2174,258 +2166,293 @@
大文本文件只读模式
-
+
新建
-
+
打开
-
-
+
+
保存
-
+
保存所有
-
+
周期自动保存
-
+
标记
-
+
高亮单词(F8)
-
+
取消所有高亮(F7)
-
+
放大
-
+
缩小
-
+
自动换行
-
+
显示空白字符
-
+
缩进参考线
-
+
+
+ 监控文件
+
+
+
上一页/位置
-
+
下一页/位置
-
+
跳转到文件偏移地址
-
+
文件对比
-
+
目录对比
-
+
二进制对比
-
+
转换编码
-
+
批量重命名
-
+
缩放率: %1%
-
+
Big5(繁体中文)
-
+
+
+ 重加载文件 %1 失败
+
+
+
+
+ 是 [重新加载]
+
+
+
+
+ 否 [放弃更新]
+
+
+
+
+ 开启自动监控
+
+
+
Do you want to save changes to « %1 » before closing?
关闭文件之前,是否保存修改?
-
+
如果你不保存在文件 %1 中的修改,变更操作将不会生效。
-
+
创建新文件成功 缩放率 %1%
-
+
Use < (Pre) or > (Next) and Goto Buttons to Change Page Num .
使用工具栏按钮 < (前一页) >(下一页) Go(跳转) 进行翻页。
-
+
文件 %1
文件大小 %2 大于 %3M,请选择打开方式。
-
+
-
+
文件 %1 打开成功 [文本模式] 缩放率 %2%
-
-
+
+
-
-
-
-
+
+
+
+
文件不是文本格式,强制以大文本打开时乱码!
-
-
+
+
当前文件偏移 %1 ,行号 %2-%3 ,分块加载大小 %4 ,文件大小是 %5
-
+
文件列表
-
+
保存交换文件 %1 失败,是否直接保存写入原始文件?
-
-
+
+
当前缩放率 %1%
-
+
+
+
+
+
+
+
+
+
+
+
-
+
注册过的正版软件!(恭喜)
-
+
免费永久试用版本(捐赠可获取注册码)
-
+
%1 不是一个文件,跳过打开它......
-
-
-
-
+
+
+
+
当前只读显示文件不允许该操作!
-
+
列块模式提示
-
+
请使用'ALT+鼠标点选' 或 'Alt+Shif+箭头键'切换列块模式。
-
+
排序错误
-
+
行 %1 不能进行排序操作!
-
-
+
+
查找字段为空
-
+
Xml format error, please check!
Xml 格式化错误,请检查文件格式!
-
+
Json format error, please check!
Json 格式化错误,请检查文件格式!
@@ -2435,65 +2462,65 @@ File Size %2 > %3M, How to Open it ?
已打开的窗口背景颜色,将在文件重新打开后才会生效!
-
+
GB18030(简体中文)
-
+
语法:%1
-
+
重加载
-
+
保存
-
-
+
+
放弃修改
-
+
取消
-
-
+
+
恢复临时文件 %1 失败!
-
+
是否恢复文件?
-
+
文件 %1 上次异常退出并留下未保存存档,是否恢复文件存档?
-
+
恢复文件?
-
-
+
+
文件 %1 打开失败!
-
+
-
+
-
+
文件 %1 打开成功 [文本模式]
-
-
+
+
当前文件偏移 %1 , 加载内容大小是 %2,文件总大小是 %3 (字节)
-
+
文件 %1 打开成功 [二进制只读模式]
@@ -2527,23 +2554,23 @@ File Size %2 > %3M, How to Open it ?
文件 %1 可能是二进制文件,尝试以文本格式打开。
-
+
保存文件 %1 失败! 你可能没有文件写权限,请另存为一个新文件!
-
+
周期性自动保存文件已开启...
-
+
周期性自动保存文件已关闭...
-
+
当前文件周期性自动保存完毕!
@@ -2560,9 +2587,9 @@ Do you want to reload it?
%1\n\n \n文件已在外部被其它程序修改。\n是否重新加载该文件?
-
-
-
+
+
+
行:%1 列:%2
@@ -2579,31 +2606,31 @@ Do you want to reload it?
当前文件偏移 %1 , 文件大小是 %2 (字节)
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
错误
-
+
文件 %1 不存在
-
-
+
+
文件 %1 已经在页面 %2 中打开
-
-
+
+
保存 %1 失败。当前文件没有写权限,请另存为一个新文件
@@ -2612,148 +2639,161 @@ Do you want to reload it?
打开文件 %1 失败
-
-
-
-
+
+
+
+
只有文本模式才能使用该功能,当前文件是二进制文件!
-
+
%1 该文件已在外部被其它程序修改,是否重新加载?
-
+
以管理员模式保存文件失败!请检查文件的权限。
-
+
+
插件管理
-
+
+
-
+
+
插件
-
+
如果界面字体不满意,还请安装windows系统字体 Courier
-
+
设置/取消书签
-
+
下一书签
-
+
上一书签
-
+
清除所有书签
-
+
剪切书签行
-
+
复制书签行
-
+
粘贴(替换)书签行
-
+
删除书签行
-
+
删除未标记行
-
+
反向标记书签
-
+
颜色 %1
-
+
+
+ 在文件目录打开CMD窗口
+
+
+
当前文件 %1 已经是文本模式
-
+
当前文件 %1 已经是二进制模式
-
-
+
+
+
+
+
+
+
文件 %1 打开成功 [文本只读模式] (乱码:二进制文件强行以文本格式显示,最多显示50K字节的内容,后面忽略...)
-
-
+
+
文件 %1 已经存在于页面 %2 中,请选择一个其它名称
-
+
重命名...
-
+
文件 %1 重命名失败!
-
-
+
+
另存为文件 ...
-
+
关闭?
-
+
目前还有子窗口处于打开状态,关闭所有窗口吗?
-
+
查找结果
@@ -2762,50 +2802,50 @@ Do you want to reload it?
文件已关闭
-
-
+
+
查找结果 - %1 命中
-
+
行尾转换中,请等待...
-
+
行尾转换完毕
-
+
跳转到行
-
+
行号
-
+
没有前一个位置了
-
+
没有后一个位置了
-
-
-
+
+
+
最后一页!当前文件偏移是 %1 ,加载内容大小是 %2 ,文件总大小是 %3 (字节)
-
+
只有二进制文件具备该功能。当前文件不是二进制文件!
@@ -2814,24 +2854,24 @@ Do you want to reload it?
最后一页!当前文件偏移是 %1 ,文件大小是 %2 (字节)
-
+
文件 %1 不存在!
-
-
+
+
错误的文件偏移量地址,请检查!
-
-
+
+
文件大小是 %1,当前地址 %2 超过了文件大小。
-
+
Current Text Doc Canp Not Use it !
当前是常规文本文档,不能使用该功能!
@@ -2844,14 +2884,14 @@ china: https://gitee.com/cxasm/notepad--
国内:https://gitee.com/cxasm/notepad--
-
-
+
+
消息
-
-
+
+
文件路径不存在,删除历史记录!
@@ -4612,7 +4652,7 @@ Left Equal ratio %4 Right Equal ratio %5
-
+
加载大文件中,文件大小 %1,请等待...
@@ -4881,282 +4921,288 @@ file size %1, please wait ...
FindWin
-
+
查找与替换
-
+
查找
-
-
-
-
-
+
+
+
+
+
查找目标:
-
-
-
+
+
+
反向查找
-
-
-
-
-
-
-
+
+
+
+
+
+
+
全词匹配
-
-
-
-
-
-
-
+
+
+
+
+
+
+
匹配大小写
-
-
-
+
+
+
循环查找
-
-
-
-
-
-
-
+
+
+
+
+
+
+
查找模式
-
-
-
-
-
-
-
+
+
+
+
+
+
+
正则表达式
-
-
-
-
-
-
-
+
+
+
+
+
+
+
普通
-
-
-
-
-
-
-
+
+
+
+
+
+
+
扩展(\n,\r,\t,\0,\x...)
-
+
查找下一个(F3)
-
+
-
+
查找上一个(F4)
-
+
-
+
计数(T)
-
+
-
-
+
+
+
+ 提取正则结果到剪切板
+
+
+
+
查找下一个
-
-
+
+
文件类型:
-
-
+
+
跳过目录名:
-
-
+
+
清除全部标记
-
+
在当前文件中查找
-
+
查找所有打开文件
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
关闭
-
-
-
-
+
+
+
+
替换
-
-
-
-
+
+
+
+
替换为:
-
-
+
+
在当前文件中替换
-
-
+
+
替换所有打开文件
-
-
+
+
在目录文件中替换
-
-
-
-
+
+
+
+
清空结果
-
-
+
+
标记
-
-
+
+
标记目标:
-
-
+
+
全部标记
-
-
+
+
清除
-
-
+
+
在目录查找
-
-
+
+
目标目录:
-
-
+
+
选择
@@ -5165,8 +5211,8 @@ file size %1, please wait ...
文件类型:
-
-
+
+
@@ -5175,278 +5221,296 @@ file size %1, please wait ...
跳过目录名
-
-
+
+
-
-
+
+
选项
-
-
+
+
跳过子目录
-
-
+
+
跳过隐藏文件
-
-
+
+
跳过二进制文件
-
-
+
+
跳过超过大小的文件
-
-
+
+
-
-
+
+
全部查找
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
查找字段为空
-
-
-
-
-
+
+
+
+
+
找不到字段 '%1'
-
-
+
+
没有更多的字段 '%1'
-
-
-
-
+
+
+
+
当前只读显示文件不允许该操作!
-
-
+
+
查找完成,一共 %1 处发现。
-
-
+
+
当前模式下的文档不允许该操作!
-
-
-
-
+
+
+
+
+
+
当前只读文档不允许执行替换操作!
-
-
+
+
没有更多替换文本 '%1'
-
+
正则查找零长匹配
-
+
目标在行 %1 位置 %2 - %3
-
-
+
+
计数 %1 次匹配 '%2'
-
+
+
+
-
+ 一共 %1 关键字,请等待......
-
-
+
+
+ 查找完成,一共 %1 处发现,目标结果字段已经提取到剪切板。
+
+
+
+
当前模式的文档不允许执行替换操作!
-
-
+
+
在所有打开文件中替换
-
-
+
+
是否确认在当前打开的文档中替换?
-
-
+
+
替换完成,一共 %1 处替换!
-
+
替换所有打开的文档
-
+
是否确认在所有打开的文档中替换?
-
+
在打开的文档中替换:%1 处已经被替换。
-
-
+
+
标记字段为空!
-
+
不能标记文本 ‘%1’
-
+
标记完成,一共 %1 处发现!
-
+
当前模式的文档不允许执行标记操作!
-
+
打开目录
-
+
加载目录文件中,请等待...
-
-
+
+
跳过目录 %1
-
+
发现 %1 个目录 %2
-
+
跳过类型文件 %1
-
+
查找取消...
-
+
+
+ 只在正则查找模式才能使用该功能!
+
+
+
+
是否继续查找?
-
+
+
查找结果已经有 %1 处在 %2 个文件中,结果太多会比较慢,是否继续查找?
-
+
+
继续查找
-
+
+
终止查找
-
-
+
+
请选择目标文件夹!
-
+
目标文件夹 %1 不存在!
-
+
查找完成,一共发现 %1 处在 %2 个文件中!
-
+
目录全部替换
-
+
您确定替换目录文件中所有 "%1" 为 "%2" 吗?
-
+
替换完成,一共替换 %1 处在 %2 个文件中!
@@ -5891,6 +5955,89 @@ Double-click a column item to modify the syntax association file.
对比循环 %1 次,还剩余 %2 次 ...
+
+ Md5hash
+
+
+
+ 拷贝到剪切板完成!
+
+
+
+ Md5hashClass
+
+
+
+
+
+
+
+
+
+
+ 拷贝文本或选择文件
+
+
+
+
+
+ 选择
+
+
+
+
+
+ 算法
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 拷贝到剪切板
+
+
+
+
+
+ 关闭
+
+
NetRegister
@@ -6125,6 +6272,261 @@ Double-click a column item to modify the syntax association file.
文件模式
+
+ QsciCommand
+
+
+ 光标下移一行
+
+
+
+ 继续选中下一行
+
+
+
+ 列编辑:扩展选中下一行
+
+
+
+ 视图滚动到下一行
+
+
+
+ 光标上移一行
+
+
+
+ 继续选中上一行
+
+
+
+ 列编辑:继续选中上一行
+
+
+
+ 视图滚动到上一行
+
+
+
+ 光标移到行首
+
+
+
+ 光标移到行尾
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 继续选中下一段落
+
+
+
+ 光标移到上一段落
+
+
+
+ 继续选中上一段落
+
+
+
+ 光标右移一格
+
+
+
+ 继续选中左边一个字符
+
+
+
+ 列编辑:继续选中左边一个字符
+
+
+
+ 光标右移一格
+
+
+
+ 继续选中右边一个字符
+
+
+
+ 列编辑:继续选中右边一个字符
+
+
+
+ 光标左移一个单词
+
+
+
+ 继续选中左边一个单词
+
+
+
+ 光标右移一个单词
+
+
+
+ 扩展选中光标至行首
+
+
+
+
+ 光标移到行首
+
+
+
+
+ 扩展选中光标至行首
+
+
+
+
+ 光标移到行尾
+
+
+
+
+ 扩展选中光标至行尾
+
+
+
+ 列编辑:继续选中到文件尾部
+
+
+
+ 光标移到文档首
+
+
+
+ 扩展选中光标至文档首部
+
+
+
+ 光标移到文档尾
+
+
+
+ 扩展选中光标至文档尾部
+
+
+
+ 光标移到上一页
+
+
+
+ 继续选中上一页
+
+
+
+ 列编辑:继续选中上一页
+
+
+
+ 光标移到下一页
+
+
+
+ 继续选中下一页
+
+
+
+ 列编辑:扩展选中下一页
+
+
+
+ 删除当前字符
+
+
+
+ 删除上一个字符
+
+
+
+ 删除光标左边的行内容
+
+
+
+ 删除光右边的行内容
+
+
+
+ 删除当前行
+
+
+
+ 剪切当前行
+
+
+
+ 复制当前行
+
+
+
+ 全选
+
+
+
+ 将选中文本转换为小写字母
+
+
+
+ 将选中文本转换为大写字母
+
+
+
+ 剪切选中内容
+
+
+
+ 复制选中内容
+
+
+
+ 粘贴
+
+
+
+ 插入覆盖模式
+
+
+
+ 插入新行
+
+
+
+
+ 键入制表符
+
+
+
+ 取消
+
+
+
+ 撤销一步
+
+
+
+ 重做一步
+
+
+
+ 放大
+
+
+
+ 缩小
+
+
QsciDisplayWindow
@@ -6163,211 +6565,207 @@ Double-click a column item to modify the syntax association file.
QsciLexerGlobal
- 全局样式覆盖所有语言
+ 全局样式覆盖所有语言
- 默认
+ 默认
- 缩进参考线风格
+ 缩进参考线风格
- 括弧高亮风格
+ 括弧高亮风格
- 当前行背景色
+ 当前行背景色
- 选中文本颜色
+ 选中文本颜色
- 光标颜色
+ 光标颜色
- 行号风格
+ 行号风格
- 书签风格
+ 书签风格
- 折叠符号风格
+ 折叠符号风格
- 折叠激活风格(目前无效)
+ 折叠激活风格(目前无效)
- 折叠样式
+ 折叠样式
- 空白字符样式
+ 空白字符样式
- 智能高亮
+ 智能高亮
- 查找结果样式
+ 查找结果样式
- 标记样式1
+ 标记样式1
- 标记样式2
+ 标记样式2
- 标记样式3
+ 标记样式3
- 标记样式4
+ 标记样式4
- 标记样式5
+ 标记样式5
- 网址鼠标悬浮样式
+ 网址鼠标悬浮样式
QsciLexerText
- 中文字符及其它
+ 中文字符及其它
- 英文字符
+ 英文字符
- 关键词
+ 关键词
QsciScintilla
- 剪切
+ 剪切
- 复制
+ 复制
- 粘贴
+ 粘贴
- 删除
+ 删除
- 全选
+ 全选
- 定位到文件目录
+ 定位到文件目录
QtLangSet
-
+
保存修改
-
- 当前语言的格式风格已经被修改,是否保存?
-
-
-
-
+
+
全局格式统一设置
-
+
当前主题:%1,当前语言:%2
-
+
%1 类型的显示风格已经被修改,是否保存?
-
+
读取 %1 语言用户自定义格式失败!
-
+
保存成功!
-
+
没有改变,无需保存!
-
+
风格背景色
风格前景色
-
+
风格背景色
-
+
重置风格
-
+
您确定重置语言 %1 的风格吗?
-
+
重置所有风格
-
+
您确定重置所有语言风格吗?
-
+
主题切换中,请等待 ...
-
+
主题切换完成 ...
@@ -6910,145 +7308,90 @@ Double-click a column item to modify the syntax association file.
请选择目录或目标文件后缀
-
- RealCompareClass
-
-
- 主页
-
-
-
- 目录对比
-
-
-
- 文件对比
-
-
-
- 编码转换
-
-
-
- 关于
-
-
-
- 捐赠软件
-
-
-
- 语言
-
-
-
- 二进制对比
-
-
-
- 最近对比
-
-
-
- 目录...
-
-
-
- 文件...
-
-
-
- 目录
-
-
-
- 文件
-
-
-
- 规则
-
-
-
- 英文
-
-
-
- 中文
-
-
-
- 主页
-
-
ScintillaEditView
-
+
定位到文件目录
-
-
+
+
使用颜色标记
-
-
+
+
颜色 %1
-
-
-
+
+
+
清除选择标记
-
-
-
+
+
+
清除全部标记
-
+
添加/删除当行注释
-
+
区块注释
-
+
清除区块注释
-
+
字数统计
-
-
+
+
字符数量
-
-
- 当前选择的字符数量是 %1 .
+
+
+ 当前选择文本字符数量是 %1
+行数量是 %2
+空格字符 %3,非空格字符数 %4
+
+
+
+
+ 当前文本字符数量是 %1
+行数量是 %2
+空格字符 %3,非空格字符数 %4
+
+
+
+ 当前选择的字符数量是 %1 .
-
- 当前文档的字符数量是 %1 .
+ 当前文档的字符数量是 %1 .
@@ -7106,205 +7449,300 @@ Double-click a column item to modify the syntax association file.
ShortcutKeyMgr
-
+
新建
-
+
打开
-
+
保存
-
+
保存所有
-
+
关闭
-
+
关闭所有
-
+
剪切
-
+
拷贝
-
+
粘贴
-
+
撤销
-
+
重做
-
+
查找
-
+
替换
-
+
在目录查找
-
+
标记
-
+
高亮单词(F8)
-
+
取消所有高亮(F7)
-
+
放大
-
+
缩小
-
+
自动换行
-
+
显示空白字符
-
+
缩进参考线
-
+
上一页/位置
-
+
下一页/位置
-
+
跳转到文件偏移地址
-
+
文件对比
-
+
目录对比
-
+
二进制对比
-
+
转换编码
-
+
批量重命名
-
+
格式化 Xml
-
+
格式化 Json
-
-
+
+
+ 添加/删除当行注释
+
+
+
+
+ 区块注释
+
+
+
+
+ 清除区块注释
+
+
+
+
+ 折叠层次 1
+
+
+
+
+ 折叠层次 2
+
+
+
+
+ 折叠层次 3
+
+
+
+
+ 折叠层次 4
+
+
+
+
+ 折叠层次 5
+
+
+
+
+ 折叠层次 6
+
+
+
+
+ 折叠层次 7
+
+
+
+
+ 折叠层次 8
+
+
+
+
+ 展开层次 1
+
+
+
+
+ 展开层次 2
+
+
+
+
+ 展开层次 3
+
+
+
+
+ 展开层次 4
+
+
+
+
+ 展开层次 5
+
+
+
+
+ 展开层次 6
+
+
+
+
+ 展开层次 7
+
+
+
+
+ 展开层次 8
+
+
+
+
不可修改
-
+
双击修改快捷键
-
+
行 %1 快捷键 ‘%2’不可修改!
-
-
+
+
修改行 %1 快捷键为 %2 成功!
-
-
+
+
错误:修改行 %1 为快捷键 %2 失败!
-
+
冲突错误!'%1' 已经存在行 %2
-
+
冲突错误!'%1' 已经存在于qscint表格行 %2
-
+
修改取消!
@@ -7491,17 +7929,17 @@ Double-click a column item to modify the syntax association file.
选择字体
-
+
-
+
-
+
用户自定义文本字体
@@ -7605,18 +8043,6 @@ You will get the registration code!
注册失败,请稍后再试!
-
-
- 请微信扫码赞赏后,输入转账单号后11位到许可序列码中。
-
-
-
- 请检查许可序列长度,只需要后11位即可。
-
-
-
- 处理成功。我们将在1-3天内处理您的许可注册码。
-
UserRegisterClass
diff --git a/src/scintillaeditview.cpp b/src/scintillaeditview.cpp
index 29fcd7c..0d2a7a9 100755
--- a/src/scintillaeditview.cpp
+++ b/src/scintillaeditview.cpp
@@ -7,12 +7,12 @@
#include "qtlangset.h"
#include "findwin.h"
#include "filemanager.h"
+#include "shortcutkeymgr.h"
#include
#include
#include
#include
-//#include
#include
#include
#include
@@ -198,6 +198,9 @@ LanguageName ScintillaEditView::langNames[L_EXTERNAL + 1] = {
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), m_curBlockLineStartNum(0)
+#ifdef Q_OS_WIN
+ ,m_isInTailStatus(false)
+#endif
{
init();
}
@@ -210,8 +213,44 @@ ScintillaEditView::~ScintillaEditView()
{
delete m_bookmarkPng;
}
+#ifdef Q_OS_WIN
+ deleteTailFileThread();
+#endif
}
+
+//截获ESC键盘,让界面去退出当前的子界面
+void ScintillaEditView::keyPressEvent(QKeyEvent* event)
+{
+ switch (event->key())
+ {
+ case Qt::Key_Escape:
+ if (m_NoteWin != nullptr)
+ {
+ m_NoteWin->on_quitActiveWindow();
+ }
+ break;
+ default:
+ break;
+ }
+ return QsciScintilla::keyPressEvent(event);
+}
+
+
+void ScintillaEditView::mouseReleaseEvent(QMouseEvent* ev)
+{
+ QsciScintilla::mouseReleaseEvent(ev);
+
+ if (ev->button() == Qt::LeftButton)
+ {
+ if (hasSelectedText())
+ {
+ emit delayWork();
+ }
+ }
+}
+
+
void ScintillaEditView::setBigTextMode(bool isBigText)
{
m_isBigText = isBigText;
@@ -432,6 +471,12 @@ QString ScintillaEditView::getTagByLexerId(int lexerId)
case L_FLASH:
return("flash");
+ case L_MATLAB:
+ return ("matlab");
+
+ case L_MARKDOWN:
+ return("markdown");
+
case L_NSIS:
return "nsis";
@@ -475,9 +520,6 @@ QString ScintillaEditView::getTagByLexerId(int lexerId)
case L_VERILOG:
return "verilog";
- case L_MATLAB:
- return "matlab";
-
case L_HASKELL:
break;
case L_INNO:
@@ -692,6 +734,12 @@ QsciLexer* ScintillaEditView::createLexer(int lexerId, QString tag, bool isOrigi
ret = new QsciLexerCPP();
ret->setLexerTag("flash");
break;
+ case L_MATLAB:
+ ret = new QsciLexerMatlab();
+ break;
+ case L_MARKDOWN:
+ ret = new QsciLexerMarkdown();
+ break;
case L_NSIS:
ret = new QsciLexerNsis();
break;
@@ -735,9 +783,6 @@ QsciLexer* ScintillaEditView::createLexer(int lexerId, QString tag, bool isOrigi
case L_VERILOG:
ret = new QsciLexerVerilog();
break;
- case L_MATLAB:
- ret = new QsciLexerMatlab();
- break;
case L_HASKELL:
break;
case L_INNO:
@@ -1720,7 +1765,7 @@ void ScintillaEditView::highlightViewWithWord(QString & word2Hilite)
QByteArray whatMark = word2Hilite.toUtf8();
- SendScintilla(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_MATCHCASE | SCFIND_WHOLEWORD | SCFIND_REGEXP_SKIPCRLFASONE);
+ SendScintilla(SCI_SETSEARCHFLAGS, SCFIND_MATCHCASE /*| SCFIND_WHOLEWORD*/ | SCFIND_REGEXP_SKIPCRLFASONE);
for (; currentLine < lastLine; ++currentLine)
{
@@ -2205,12 +2250,34 @@ void ScintillaEditView::showWordNums()
QString word = selectedText();
if (!word.isEmpty())
{
- QMessageBox::about(this, tr("Word Nums"), tr("Current Select Word Nums is %1 .").arg(word.size()));
+ int lineNum = word.count("\n");
+ if (!word.endsWith("\n"))
+ {
+ ++lineNum;
}
+
+ //\s是包含了换行符的,所有要单独统计\r\n换换行符,排除一下
+ QRegExp warpRe("[\r\n]");
+ int wrapNums = word.count(warpRe);
+ QRegExp bkRe("\\s");
+ int blank = word.count(bkRe);
+ QMessageBox::about(this, tr("Word Nums"), tr("Current Select Word Nums is %1 . \nLine nums is %2 . \nSpace nums is %3, Non-space is %4 .").\
+ arg(word.size()-wrapNums).arg(lineNum).arg(blank-wrapNums).arg(word.size()-blank));
+ }
}
else
{
- QMessageBox::about(this, tr("Word Nums"), tr("Current Doc Word Nums is %1 .").arg(this->text().size()));
+ int lineNum = this->lines();
+ QString text = this->text();
+
+ //\s是包含了换行符的,所有要单独统计\r\n换换行符,排除一下
+ QRegExp warpRe("[\r\n]");
+ int wrapNums = text.count(warpRe);
+ QRegExp bkRe("\\s");
+ int blank = text.count(bkRe);
+
+ QMessageBox::about(this, tr("Word Nums"), tr("Current Doc Word Nums is %1 . \nLine nums is %2 . \nSpace nums is %3, Non-space is %4 .").\
+ arg(text.size() - wrapNums).arg(lineNum).arg(blank - wrapNums).arg(text.size() - blank));
}
}
@@ -2568,12 +2635,22 @@ void ScintillaEditView::mouseDoubleClickEvent(QMouseEvent * e)
} while (0);
}
+ //20230219先双击选中,再按住ctrl,再双击别的地方选中。此时是进入多选状态。
+ //这里必须要直接返回,不能做delayWork。否则因为delaywork里面不能判断多选,而数据越界崩溃
+ if (hasSelectedText())
+ {
+ QsciScintilla::mouseDoubleClickEvent(e);
+ return;
+ }
+
+ //执行下面mouseDoubleClickEvent后,又会选中。此时如果上面已经有选中,则会多选
QsciScintilla::mouseDoubleClickEvent(e);
if (hasSelectedText())
{
emit delayWork();
}
+
}
void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString& strToConvert) const
@@ -4024,3 +4101,172 @@ void ScintillaEditView::setGlobalFont(int style)
break;
}
}
+
+bool ScintillaEditView::isFoldIndentBased() const
+{
+ QsciLexer* lexer = this->lexer();
+
+ if (lexer != nullptr)
+ {
+ int lexerId = lexer->lexerId();
+
+ return lexerId == L_PYTHON
+ || lexerId == L_COFFEESCRIPT
+ || lexerId == L_HASKELL
+ || lexerId == L_VB
+ || lexerId == L_YAML;
+ }
+ return false;
+}
+
+const int MAX_FOLD_COLLAPSE_LEVEL = 8;
+
+struct FoldLevelStack
+{
+ int levelCount = 0;
+ intptr_t levelStack[MAX_FOLD_COLLAPSE_LEVEL]{};
+
+ void push(intptr_t level)
+ {
+ while (levelCount != 0 && level <= levelStack[levelCount - 1])
+ {
+ --levelCount;
+ }
+ levelStack[levelCount++] = level;
+ }
+};
+
+bool ScintillaEditView::isFolded(size_t line)
+{
+ return (0 != execute(SCI_GETFOLDEXPANDED, line));
+};
+
+void ScintillaEditView::fold(size_t line, bool mode)
+{
+ auto endStyled = execute(SCI_GETENDSTYLED);
+ auto len = execute(SCI_GETTEXTLENGTH);
+
+ if (endStyled < len)
+ execute(SCI_COLOURISE, 0, -1);
+
+ intptr_t headerLine;
+ auto level = execute(SCI_GETFOLDLEVEL, line);
+
+ if (level & SC_FOLDLEVELHEADERFLAG)
+ headerLine = line;
+ else
+ {
+ headerLine = execute(SCI_GETFOLDPARENT, line);
+ if (headerLine == -1)
+ return;
+ }
+
+ if (isFolded(headerLine) != mode)
+ {
+ execute(SCI_TOGGLEFOLD, headerLine);
+
+ //SCNotification scnN;
+ //scnN.nmhdr.code = SCN_FOLDINGSTATECHANGED;
+ //scnN.nmhdr.hwndFrom = _hSelf;
+ //scnN.nmhdr.idFrom = 0;
+ //scnN.line = headerLine;
+ //scnN.foldLevelNow = isFolded(headerLine) ? 1 : 0; //folded:1, unfolded:0
+
+ //::SendMessage(_hParent, WM_NOTIFY, 0, reinterpret_cast(&scnN));
+ }
+}
+
+void ScintillaEditView::collapseFoldIndentBased(int level, bool mode)
+{
+ execute(SCI_COLOURISE, 0, -1);
+
+ FoldLevelStack levelStack;
+ ++level;
+
+ const intptr_t maxLine = execute(SCI_GETLINECOUNT);
+ intptr_t line = 0;
+
+ while (line < maxLine)
+ {
+ intptr_t level = execute(SCI_GETFOLDLEVEL, line);
+ if (level & SC_FOLDLEVELHEADERFLAG)
+ {
+ level &= SC_FOLDLEVELNUMBERMASK;
+ levelStack.push(level);
+ if (level == levelStack.levelCount)
+ {
+ if (isFolded(line) != mode)
+ {
+ fold(line, mode);
+ }
+ line = execute(SCI_GETLASTCHILD, line, -1);
+ }
+ }
+ ++line;
+ }
+}
+
+void ScintillaEditView::collapse(int level, bool mode)
+{
+ if (isFoldIndentBased())
+ {
+ return collapseFoldIndentBased(level, mode);
+ }
+
+ execute(SCI_COLOURISE, 0, -1);
+
+ intptr_t maxLine = execute(SCI_GETLINECOUNT);
+
+ for (int line = 0; line < maxLine; ++line)
+ {
+ intptr_t lineLevel = execute(SCI_GETFOLDLEVEL, line);
+ if (lineLevel & SC_FOLDLEVELHEADERFLAG)
+ {
+ lineLevel -= SC_FOLDLEVELBASE;
+ if (level == (lineLevel & SC_FOLDLEVELNUMBERMASK))
+ if (isFolded(line) != mode)
+ {
+ fold(line, mode);
+ }
+ }
+ }
+}
+
+void ScintillaEditView::comment(int type)
+{
+ switch (type)
+ {
+ case ADD_DEL_LINE_COM:
+ doBlockComment(cm_toggle);
+ break;
+ case ADD_BK_COM:
+ doStreamComment();
+ break;
+ case DEL_BK_COM:
+ undoStreamComment();
+ break;
+ default:
+ break;
+ }
+}
+
+#ifdef Q_OS_WIN
+void ScintillaEditView::deleteTailFileThread()
+{
+ if (m_isInTailStatus)
+ {
+ m_isInTailStatus = false;
+
+ qlonglong threadAddr = this->property(Tail_Thread).toLongLong();
+
+ std::thread* pListenThread = (std::thread*)(threadAddr);
+
+ if (pListenThread->joinable())
+ {
+ pListenThread->join();
+ }
+
+ delete pListenThread;
+ }
+}
+#endif
diff --git a/src/scintillaeditview.h b/src/scintillaeditview.h
index 1e6a8a4..5866b50 100755
--- a/src/scintillaeditview.h
+++ b/src/scintillaeditview.h
@@ -139,9 +139,6 @@ public:
bool gotoPrePos();
bool gotoNextPos();
-
- /*virtual void adjuctSkinStyle();*/
-
//设置文档的缩进参考线
void setIndentGuide(bool willBeShowed);
@@ -210,13 +207,20 @@ public:
//获取当前块的开始行号。只在大文件只读模式下有效。其余模式下均返回0
quint32 getBigTextBlockStartLine();
void setBigTextBlockStartLine(quint32 line);
+ void collapse(int level, bool mode);
+ void comment(int type);
+#ifdef Q_OS_WIN
+ void deleteTailFileThread();
+#endif
+
signals:
void delayWork();
protected:
-
virtual void addHotSpot();
void setStylesFont(const QFont& f, int style, int setBitMask = ALL_SET_Bit);
+ void keyPressEvent(QKeyEvent* event) override;
+ virtual void mouseReleaseEvent(QMouseEvent* ev) override;
private:
@@ -237,6 +241,12 @@ private:
void changeStyleColor(int sytleId);
void initStyleColorMenu();
+ bool isFolded(size_t line);
+ void fold(size_t line, bool mode);
+ void collapseFoldIndentBased(int level, bool mode);
+ bool isFoldIndentBased() const;
+
+
public:
static const int _SC_MARGE_LINENUMBER;
static const int _SC_MARGE_SYBOLE;
@@ -319,4 +329,9 @@ public:
static int s_bigTextSize;
bool m_hasHighlight;
+
+
+#ifdef Q_OS_WIN
+ std::atomic m_isInTailStatus;
+#endif
};
diff --git a/src/scintillahexeditview.cpp b/src/scintillahexeditview.cpp
index ca35a0a..c8da9b2 100755
--- a/src/scintillahexeditview.cpp
+++ b/src/scintillahexeditview.cpp
@@ -130,3 +130,4 @@ void ScintillaHexEditView::updateThemes()
setMarginsBackgroundColor(StyleSet::s_global_style->line_number_margin.bgColor);
setPaper(StyleSet::s_global_style->default_style.bgColor);
}
+
diff --git a/src/shortcutkeymgr.cpp b/src/shortcutkeymgr.cpp
index 7432644..88e3969 100755
--- a/src/shortcutkeymgr.cpp
+++ b/src/shortcutkeymgr.cpp
@@ -10,12 +10,9 @@
QMap* ShortcutKeyMgr::s_shortcutKeysMap = nullptr;
-//QMap * qScintShortcutKeyValueMap = nullptr;
-
struct ShortcutKeySt {
QString iniTag;//保存在Ini文件中的名称
QString name;//显示在表格中的名称
- //QString keyDesc;//qkeysequence的描述
QKeySequence key;
bool canModify;//能否修改
@@ -86,12 +83,12 @@ void ShortcutKeyMgr::initShortcutKeysMap()
<< 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("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("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) \
@@ -111,9 +108,27 @@ void ShortcutKeyMgr::initShortcutKeysMap()
<< 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);
+ << ShortcutKeySt(tr("Format Json"), Format_Json) \
+ << ShortcutKeySt(tr("Add/Del Line Comment"), ADD_DELETE_LINE_COMMENT, QString("Ctrl+Q")) \
+ << ShortcutKeySt(tr("Add Block Comment"), ADD_BLOCK_COMMENT, QString("Ctrl+K")) \
+ << ShortcutKeySt(tr("Del Block Comment"), CANCEL_BLOCK_COMMENT, QString("Ctrl+Shift+K")) \
+ << ShortcutKeySt(tr("Fold Level 1"), FOLD_1, QString("Alt+1")) \
+ << ShortcutKeySt(tr("Fold Level 2"), FOLD_2, QString("Alt+2")) \
+ << ShortcutKeySt(tr("Fold Level 3"), FOLD_3, QString("Alt+3")) \
+ << ShortcutKeySt(tr("Fold Level 4"), FOLD_4, QString("Alt+4")) \
+ << ShortcutKeySt(tr("Fold Level 5"), FOLD_5, QString("Alt+5")) \
+ << ShortcutKeySt(tr("Fold Level 6"), FOLD_6, QString("Alt+6")) \
+ << ShortcutKeySt(tr("Fold Level 7"), FOLD_7, QString("Alt+7")) \
+ << ShortcutKeySt(tr("Fold Level 8"), FOLD_8, QString("Alt+8")) \
+ << ShortcutKeySt(tr("UNFold Level 1"), UNFOLD_1, QString("Alt+Shift+1")) \
+ << ShortcutKeySt(tr("UNFold Level 2"), UNFOLD_2, QString("Alt+Shift+2")) \
+ << ShortcutKeySt(tr("UNFold Level 3"), UNFOLD_3, QString("Alt+Shift+3")) \
+ << ShortcutKeySt(tr("UNFold Level 4"), UNFOLD_4, QString("Alt+Shift+4")) \
+ << ShortcutKeySt(tr("UNFold Level 5"), UNFOLD_5, QString("Alt+Shift+5")) \
+ << ShortcutKeySt(tr("UNFold Level 6"), UNFOLD_6, QString("Alt+Shift+6")) \
+ << ShortcutKeySt(tr("UNFold Level 7"), UNFOLD_7, QString("Alt+Shift+7")) \
+ << ShortcutKeySt(tr("UNFold Level 8"), UNFOLD_8, QString("Alt+Shift+8"));
-
for (int i = 0; i < shortCutTable.size(); ++i)
{
s_shortcutKeysMap->insert(shortCutTable.at(i).iniTag, i);
diff --git a/src/shortcutkeymgr.h b/src/shortcutkeymgr.h
index e4bebf3..65bf293 100755
--- a/src/shortcutkeymgr.h
+++ b/src/shortcutkeymgr.h
@@ -36,7 +36,25 @@ enum Shortcut_Key_ID {
Batch_rename_ID,
Format_Xml_ID,
Format_Json_ID,
-
+ ADD_DEL_LINE_COM,
+ ADD_BK_COM,
+ DEL_BK_COM,
+ S_K_FOLD_1,
+ S_K_FOLD_2,
+ S_K_FOLD_3,
+ S_K_FOLD_4,
+ S_K_FOLD_5,
+ S_K_FOLD_6,
+ S_K_FOLD_7,
+ S_K_FOLD_8,
+ S_K_UNFOLD_1,
+ S_K_UNFOLD_2,
+ S_K_UNFOLD_3,
+ S_K_UNFOLD_4,
+ S_K_UNFOLD_5,
+ S_K_UNFOLD_6,
+ S_K_UNFOLD_7,
+ S_K_UNFOLD_8,
Shortcut_End_ID,//总是在最底下
};
@@ -74,6 +92,26 @@ static const char* Batch_rename = "batchrename";
static const char* Format_Xml = "formatxml";
static const char* Format_Json = "formatjson";
+static const char* ADD_DELETE_LINE_COMMENT = "linecom";
+static const char* ADD_BLOCK_COMMENT = "bkcom";
+static const char* CANCEL_BLOCK_COMMENT = "cbkcom";
+
+static const char* FOLD_1 = "fold_1";
+static const char* FOLD_2 = "fold_2";
+static const char* FOLD_3 = "fold_3";
+static const char* FOLD_4 = "fold_4";
+static const char* FOLD_5 = "fold_5";
+static const char* FOLD_6 = "fold_6";
+static const char* FOLD_7 = "fold_7";
+static const char* FOLD_8 = "fold_8";
+static const char* UNFOLD_1 = "unfold_1";
+static const char* UNFOLD_2 = "unfold_2";
+static const char* UNFOLD_3 = "unfold_3";
+static const char* UNFOLD_4 = "unfold_4";
+static const char* UNFOLD_5 = "unfold_5";
+static const char* UNFOLD_6 = "unfold_6";
+static const char* UNFOLD_7 = "unfold_7";
+static const char* UNFOLD_8 = "unfold_8";
class ShortcutKeyMgr : public QMainWindow
{
diff --git a/src/texteditsetwin.cpp b/src/texteditsetwin.cpp
index 78d82bc..73322af 100755
--- a/src/texteditsetwin.cpp
+++ b/src/texteditsetwin.cpp
@@ -97,15 +97,21 @@ void TextEditSetWin::slot_txtFontSet()
//是从对比规则里面弹出来的,不进行文本的设置
return;
}
+ QtLangSet* pWin = pMainWin->getLangSet();
+#if 0
QtLangSet* pWin = new QtLangSet(QString("txt"), this);
pWin->setAttribute(Qt::WA_DeleteOnClose);
connect(pWin, &QtLangSet::viewStyleChange, pMainWin, &CCNotePad::slot_viewStyleChange);
connect(pWin, &QtLangSet::viewLexerChange, pMainWin, &CCNotePad::slot_viewLexerChange);
pWin->show();
+#endif
+ if (pWin != nullptr)
+ {
pWin->selectInitLangTag("txt");
}
+}
#if 0
//app字体颜色设置
diff --git a/win.bat b/win.bat
deleted file mode 100644
index f2d9d63..0000000
--- a/win.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-cd build/bin
-
-windeployqt notepad--.exe
-@REM copy .\src\qscint\libqscint.a .\%1\plugin
-@REM copy .\src\plugin\^*\^*.dll .\%1\plugin
diff --git a/win.mk b/win.mk
deleted file mode 100644
index 7ac2002..0000000
--- a/win.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-
-# 基于 Git Bash 环境编写
-# 设置编译链信息是为了避免环境存在多个Qt环境时编译异常
-
-# 填入Qt的Mingw相关工具安装路径 (不使用MINGW时可不填)
-# 填入Mingw Qt G++程序完整路径
-Qt_MINGW_CXX_COMPILER:=d:/SOFT/Qt/Qt5.14.2/Tools/mingw730_64/bin/g++.exe
-# 填入Mingw Qt GCC程序完整路径
-Qt_MINGW_C_COMPILER:=d:/SOFT/Qt/Qt5.14.2/Tools/mingw730_64/bin/gcc.exe
-# 填入Mingw Qt库查找路径
-Qt_MINGW_PREFIX_PATH:=d:/SOFT/Qt/Qt5.14.2/5.14.2/mingw73_64
-# 指定生成的Makefiles格式
-Qt_MINGW_G:=CodeBlocks - MinGW Makefiles
-
-# 填入Qt的msvc相关工具安装路径 (不使用MSVC时可不填)
-# 填入Msvc Qt库查找路径
-Qt_MSVC_PREFIX_PATH:=d:/CompilationTools/Qt/5.15.2/msvc2019_64
-
-
-all:msvc
-
-
-mingw:
- cmake -G"${Qt_MINGW_G}" -Bbuild -DCMAKE_BUILD_TYPE=Release -DPLUGIN_EN=on -DCMAKE_PREFIX_PATH=${Qt_MINGW_PREFIX_PATH} -DCMAKE_CXX_COMPILER=${Qt_MINGW_CXX_COMPILER} -DCMAKE_C_COMPILER=${Qt_MINGW_C_COMPILER} .
- cmake --build ./build --config=Release -- -j$$(nproc)
- mkdir -p build/bin/plugin
- cp -f build/NotePad--.exe build/bin/
- cd build/bin && windeployqt --qmldir=${Qt_MINGW_PREFIX_PATH}/qml NotePad--.exe
- cp -r -f build/src/*/*/*.dll build/bin/plugin
- cp -r -f build/src/*/*.a build/bin/plugin
- cd build && cpack --config CPackConfig.cmake
-
-msvc:
- cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DPLUGIN_EN=on -DCMAKE_PREFIX_PATH=${Qt_MSVC_PREFIX_PATH} .
- cmake --build ./build --config=Release -j$$(nproc)
- mkdir -p build/bin/plugin
- cp -f build/Release/NotePad--.exe build/bin/
- cd build/bin && windeployqt --qmldir=${Qt_MSVC_PREFIX_PATH}/qml NotePad--.exe
- cp -r -f build/src/*/*/Release/*.dll build/bin/plugin
- cp -r -f build/src/*/Release/*.lib build/bin/plugin
- cd build && cpack --config CPackConfig.cmake
-