Merge branch 'master' of gitee.com:cxasm/notepad-- into kameys

Tried to resolve conflicts, don't know chinese well to understand what the editor was saying, this is my best effort, if this turns out to be wrong, I will just remake this on github instead as I'm familiar with github.

Signed-off-by: Kamey03 <viktor@milivojevic.in.rs>
This commit is contained in:
Kamey03 2023-02-08 06:29:37 +00:00 committed by Gitee
commit 23542e7b82
23 changed files with 559 additions and 62 deletions

81
.gitignore vendored
View File

@ -9,7 +9,7 @@
*.user
*.userosscache
*.sln.docstates
build
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
@ -396,3 +396,82 @@ FodyWeavers.xsd
# JetBrains Rider
*.sln.iml
# Created by https://www.toptal.com/developers/gitignore/api/cmake
# Edit at https://www.toptal.com/developers/gitignore?templates=cmake
### CMake ###
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
### CMake Patch ###
# External projects
*-prefix/
# End of https://www.toptal.com/developers/gitignore/api/cmake
!/Makefile
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
[Bb]uild/
.vscode/
.vs/

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(notepad--)
project(NotePad-- VERSION 1.22.0)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
@ -7,42 +7,59 @@ set(CMAKE_AUTORCC ON)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns)
# TODO: use system provided libraries to build
# current status: some header can not be found,for example: Scintilla.h
find_library(QSCINTILLA_LIB_PATH qscintilla2_qt5)
find_path(QSCINTILLA_INC_PATH qsciscintilla.h PATHS /usr/include/)
find_path(SCINTILLA_INC_PATH Scintilla.h PATHS /usr/include/)
if((${QSCINTILLA_LIB_PATH} STREQUAL "QSCINTILLA_LIB_PATH-NOTFOUND") OR
(${QSCINTILLA_INC_PATH} STREQUAL "QSCINTILLA_INC_PATH-NOTFOUND") OR
(${SCINTILLA_INC_PATH} STREQUAL "SCINTILLA_INC_PATH-NOTFOUND") )
set(NOTEPAD_USE_SYS_LIB OFF)
message("system libraries or header not found,build from local")
# qscint
add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint)
else()
set(NOTEPAD_USE_SYS_LIB ON)
message("use system libraries")
message("QSCINTILLA_LIB_PATH:" ${QSCINTILLA_LIB_PATH})
message("QSCINTILLA_INC_PATH:" ${QSCINTILLA_INC_PATH})
message("SCINTILLA_INC_PATH:" ${SCINTILLA_INC_PATH})
#
# helloworld
add_subdirectory(${PROJECT_SOURCE_DIR}/src/plugin/helloworld)
# winUNICODETCHAR
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
)
if(NOTEPAD_USE_SYS_LIB)
target_include_directories(${PROJECT_NAME} PRIVATE ${QSCINTILLA_INC_PATH} ${SCINTILLA_INC_PATH})
endif()
target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
target_link_libraries(${PROJECT_NAME} qscintilla2_qt5 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"
@ -51,5 +68,23 @@ install(
install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/linux/usr
DESTINATION "/")
include(${PROJECT_SOURCE_DIR}/cmake/package_config.cmake)
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()

17
Makefile Normal file
View File

@ -0,0 +1,17 @@
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

21
README.md Executable file → Normal file
View File

@ -1,5 +1,7 @@
# notepad--
[中文 ](README.md) | [English](README_EN.md)
## 项目简介
这是一个使用C++编写的文本编辑器Notepad--,可以支持Win/Linux/Mac平台。
@ -39,11 +41,21 @@ NDD已初步推出插件编写功能希望广大的CPP/QT开发者加入我
- ArchLinux
1. 安装编译环境 `sudo pacman -S gcc cmake make `
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. 打包:使用aur
1. 打包使用 OBS (Open Build Service)
**Qt工程编译说明**
@ -59,6 +71,11 @@ NDD已初步推出插件编写功能希望广大的CPP/QT开发者加入我
```
yay -S notepad---git
```
## 联络方式
QQ群959439826 用户群做NDD的问题反馈、功能建议等。
QQ群 616606091 开发群建议懂CPP/QT、愿意参与NDD项目代码贡献的开发人士加入。
## 效果预览

69
README_EN.md Normal file
View File

@ -0,0 +1,69 @@
# Notepad--
[中文 ](README.md) | [English](README_EN.md)
## Project Introduction
Introducing Notepad-- a text editor written in C++ that works seamlessly across Windows, Linux, and Mac platforms. Our aim is to eventually surpass Notepad++, with a particular focus on the Chinese UOS operating system. Unlike Notepad++, our advantage lies in our cross-platform compatibility and support for various OSes.
**The purpose of Notepad-- is to counteract some of the misguided remarks made by the author of Notepad++ and to promote a more humble and grounded perspective.**
If you come across any bugs or have any feedback, feel free to share it with us.
You can download the latest version at https://gitee.com/cxasm/notepad--/releases/tag/v1.21.
The latest development version can be found at https://gitee.com/cxasm/notepad--/releases/tag/v1.22.
We have recently added the plugin writing feature to Notepad-- and we hope that many CPP/QT developers will join us in this endeavor. If you develop a plugin, you can include your name and a donation channel.
Creating a free text editor requires support from users like you. If you'd like to contribute, please consider donating through WeChat.
![Input description picture](6688.png)
## Compilation
**CMake Toolchain Compilation Instructions:**
- Ubuntu/Debian
1. Install compilation environment `sudo apt-get install g++ make cmake`
1. Install qt tools and libraries `sudo apt-get install qtbase5-dev qt5-qmake qtbase5-dev-tools libqt5printsupport5 libqt5xmlpatterns5-dev `
1. Configure `cmake -B build -DCMAKE_BUILD_TYPE=Release`
1. Compile `cd build && make -j`
1. Package `cpack`
- ArchLinux
1. Install compilation environment `sudo pacman -S gcc cmake make ninja`
1. Install qt tools and libraries `sudo pacman -S qt5-tools qt5-base qt5-xmlpatterns `
1. Configure `cmake -S . -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -W no-dev`
1. Compile `ninja -C build && ninja -C build install`
1. Package: use [AUR/notepad---git](https://aur.archlinux.org/packages/notepad---git) `yay -S notepad---git`
1. Installation:
- Pre-compiled package add [ArchLinuxCN/notepad---git](https://github.com/archlinuxcn/repo) mirror `yay -S archlinuxcn/notepad---git`
- Pre-compiled package [Debuginfod/notepad---git-debug](https://wiki.archlinux.org/title/Debuginfod) package `yay -S archlinuxcn/notepad---git-debug`
**Qt Project Compilation Instructions:**
1) Start by opening qscint/src/qscintilla.pro in either Qt Creator or Visual Studio and compile the qscintilla dependency library.
2) Next, open RealCompare.pro and compile it after loading.
3) Due to the multi-platform compilation, involving Windows/Linux/MacOS, if there are any compilations or problems, please join qq group 959439826. We welcome contributions and code submissions from everyone.
Recently, the code was made available online. However, the commercial comparison function and registration function have been removed for commercial reasons. All other functions have been retained.
4) For Arch Linux and its derivatives, you can install Notepad-- through the AUR using the following command: [notepad---git](https://aur.archlinux.org/packages/notepad---git)
```
yay -S notepad---git
```
## Preview
![Input description picture](png/20221107_160824.png)
![Input description picture](png/6.png)
![Input description picture](png/3.png)
![Input description picture](png/7.png)

View File

@ -0,0 +1,59 @@
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}\\\"
")

42
linux.mk Normal file
View File

@ -0,0 +1,42 @@
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)"

Binary file not shown.

38
src/RealCompareToMinGw.rc Normal file
View File

@ -0,0 +1,38 @@
#include <windows.h>
IDI_ICON1 ICON DISCARDABLE ".\\Resources\\edit\\global\\ndd.ico"
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,22,0,0
PRODUCTVERSION 1,22,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080404b0"
BEGIN
VALUE "FileDescription", "notepad-- v1.22.0\0"
VALUE "FileVersion", "1.22.0.0\0"
VALUE "LegalCopyright", "Copyright (C) 2020-2023\0"
VALUE "OriginalFilename", "Notepad--.exe\0"
VALUE "ProductName", "notepad-- \0"
VALUE "ProductVersion", "1.22.0.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0804, 1200
END
END
/* End of Version info */

View File

@ -1,4 +1,4 @@
#include <memory>
#include <memory>
#include "ccnotepad.h"
#include "filemanager.h"
#include "Encode.h"
@ -7317,14 +7317,19 @@ void CCNotePad::slot_hexGotoFile(qint64 addr)
void CCNotePad::slot_about()
{
QMessageBox msgBox(this);
QString msg = tr(R"(
<a href="https://github.com/cxasm/notepad--">Github repo: cxasm/notepad--</a>
<br/>
<a href="https://gitee.com/cxasm/notepad--">China Gitee: cxasm/notepad--</a>
)");
#if defined (Q_OS_MAC)
msgBox.setText(tr("bugfix: https://github.com/cxasm/notepad-- \nchina: https://gitee.com/cxasm/notepad--"));
msgBox.setText(msg);
msgBox.setDetailedText(QString("Notepad-- %1").arg(VersionStr));
#else
msgBox.setWindowTitle(QString("Notepad-- %1").arg(VersionStr));
msgBox.setText(tr("bugfix: https://github.com/cxasm/notepad-- \nchina: https://gitee.com/cxasm/notepad--"));
msgBox.setText(msg);
#endif
msgBox.setTextInteractionFlags(Qt::TextSelectableByMouse);
msgBox.exec();
}

View File

@ -1575,6 +1575,11 @@
<string>Chinese</string>
</property>
</action>
<action name="actionLanguage_Format">
<property name="text">
<string>Theme Style</string>
@ -2691,6 +2696,22 @@
</hints>
</connection>
<connection>
<sender>actionLanguage_Format</sender>
<signal>triggered()</signal>
<receiver>CCNotePad</receiver>
@ -3476,6 +3497,7 @@
<slot>slot_toMistyRose()</slot>
<slot>slot_changeEnglish()</slot>
<slot>slot_changeChinese()</slot>
<slot>slot_langFormat()</slot>
<slot>slot_reOpenTextMode()</slot>
<slot>slot_reOpenHexMode()</slot>

View File

@ -216,13 +216,13 @@ void ColumnEdit::slot_ok()
{
QByteArray s_space(cursorCol - lineEndCol, ' ');
lineData.append(s_space);
lineData.append(text);
lineData.append(text.toUtf8());
}
else
{
int posAbs2Start = pEdit->execute(SCI_FINDCOLUMN, i, cursorCol);
int posRelative2Start = posAbs2Start - lineBegin;
lineData.insert(posRelative2Start, text);
lineData.insert(posRelative2Start, text.toUtf8());
}
pEdit->SendScintilla(SCI_SETTARGETRANGE, lineBegin, lineEnd);

View File

@ -9,7 +9,7 @@ CTipWin::CTipWin(QWidget *parent)
this->setWindowFlags(Qt::ToolTip);
QPalette palette(this->palette());
palette.setColor(QPalette::Background, QColor(0xfff29d));
palette.setColor(QPalette::Window, QColor(0xfff29d));
this->setPalette(palette);
}

View File

@ -9,6 +9,8 @@
#else
#define NDD_EXPORT __declspec(dllimport)
#endif
#else
#define NDD_EXPORT __attribute__((visibility("default")))
#endif
struct ndd_proc_data

View File

@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.16)
project(helloworld)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns)
add_definitions(-D_UNICODE -DUNICODE)
file(GLOB UI_SRC ${PROJECT_SOURCE_DIR}/*.ui)
file(GLOB SRC ${PROJECT_SOURCE_DIR}/*.cpp)
file(GLOB MOC_HEADER ${PROJECT_SOURCE_DIR}/*.h)
# add_executable(${PROJECT_NAME} ${IS_WIN} ${SRC} ${UI_SRC} ${PROJECT_SOURCE_DIR}/src/RealCompare.qrc)
add_library(${PROJECT_NAME} SHARED ${SRC} ${UI_SRC} ${MOC_HEADER})
target_include_directories(${PROJECT_NAME} PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/../../include
${PROJECT_SOURCE_DIR}/../../qscint/src
${PROJECT_SOURCE_DIR}/../../qscint/src/Qsci
${PROJECT_SOURCE_DIR}/../../qscint/scintilla/src
${PROJECT_SOURCE_DIR}/../../qscint/scintilla/include
${PROJECT_SOURCE_DIR}/../../qscint/scintilla/lexlib
${PROJECT_SOURCE_DIR}/../../qscint/scintilla/boostregex
)
target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
# if(NOT DEFINED ${notepad--_BINARY_DIR})
# set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
# set(LIBRARY_OUTPUT_PATH ${notepad--_BINARY_DIR}/bin/plugin)
# set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
# endif()

View File

@ -1,7 +1,7 @@
TEMPLATE = lib
LANGUAGE = C++
CONFIG += qt warn_on Debug
CONFIG += qt warn_on
QT += core gui widgets
HEADERS += *.h

View File

@ -13,6 +13,8 @@
#else
#define NDD_EXPORT __declspec(dllimport)
#endif
#else
#define NDD_EXPORT __attribute__((visibility("default")))
#endif
#ifdef __cplusplus

View File

@ -12,6 +12,8 @@
#else
#define NDD_EXPORT __declspec(dllimport)
#endif
#else
#define NDD_EXPORT __attribute__((visibility("default")))
#endif
#ifdef __cplusplus

View File

@ -1,7 +1,7 @@
TEMPLATE = lib
LANGUAGE = C++
CONFIG += qt warn_on Debug
CONFIG += qt warn_on
QT += core gui widgets
HEADERS += *.h

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(qscintilla2_qt5 CXX)
project(qscint CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
@ -19,6 +19,9 @@ file(GLOB MOC_HEADER ${PROJECT_SOURCE_DIR}/src/Qsci/*.h)
add_library(${PROJECT_NAME} STATIC ${SRC} ${MOC_HEADER})
# add_definitions(-DQSCINTILLA_MAKE_DLL)
# add_library(${PROJECT_NAME} SHARED ${SRC} ${MOC_HEADER})
target_compile_definitions(${PROJECT_NAME} PRIVATE SCINTILLA_QT SCI_LEXER INCLUDE_DEPRECATED_FEATURES)
target_include_directories(${PROJECT_NAME} PRIVATE
@ -33,3 +36,19 @@ ${PROJECT_SOURCE_DIR}/scintilla/src
${PROJECT_SOURCE_DIR}/scintilla/include)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport)
if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "qmyedit_qt5")
else()
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "qmyedit_qt5d")
endif()
# if(NOT DEFINED ${notepad--_BINARY_DIR})
# set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
# set(LIBRARY_OUTPUT_PATH ${notepad--_BINARY_DIR}/bin/plugin)
# set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
# endif()

5
win.bat Normal file
View File

@ -0,0 +1,5 @@
cd build/bin
windeployqt notepad--.exe
@REM copy .\src\qscint\libqscint.a .\%1\plugin
@REM copy .\src\plugin\^*\^*.dll .\%1\plugin

42
win.mk Normal file
View File

@ -0,0 +1,42 @@
# 基于 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