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

Signed-off-by: Joker2770 <1214220480@qq.com>
This commit is contained in:
Joker2770 2023-02-07 13:01:29 +00:00 committed by Gitee
commit 8c93f5a7e6
22 changed files with 386 additions and 70 deletions

2
.gitignore vendored
View File

@ -9,7 +9,7 @@
*.user *.user
*.userosscache *.userosscache
*.sln.docstates *.sln.docstates
build
# User-specific files (MonoDevelop/Xamarin Studio) # User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs *.userprefs

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(notepad--) project(NotePad-- VERSION 1.22.0)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
@ -7,49 +7,84 @@ set(CMAKE_AUTORCC ON)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns) find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns)
# TODO: use system provided libraries to build # qscint
# 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")
add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint) add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint)
else()
set(NOTEPAD_USE_SYS_LIB ON) #
message("use system libraries") # helloworld
message("QSCINTILLA_LIB_PATH:" ${QSCINTILLA_LIB_PATH}) add_subdirectory(${PROJECT_SOURCE_DIR}/src/plugin/helloworld)
message("QSCINTILLA_INC_PATH:" ${QSCINTILLA_INC_PATH})
message("SCINTILLA_INC_PATH:" ${SCINTILLA_INC_PATH}) # winUNICODETCHAR
if(CMAKE_HOST_WIN32)
add_definitions(-D_UNICODE -DUNICODE)
endif() 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) file(GLOB UI_SRC ${PROJECT_SOURCE_DIR}/src/*.ui)
set(UI_SRC ${UI_SRC} ${PROJECT_SOURCE_DIR}/src/cceditor/ccnotepad.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 SRC)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/cceditor SRC) aux_source_directory(${PROJECT_SOURCE_DIR}/src/cceditor SRC)
add_executable(${PROJECT_NAME} ${SRC} ${UI_SRC} ${PROJECT_SOURCE_DIR}/src/RealCompare.qrc)
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 target_include_directories(${PROJECT_NAME} PRIVATE
${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/cceditor ${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_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
target_include_directories(${PROJECT_NAME} PRIVATE ${QSCINTILLA_INC_PATH} ${SCINTILLA_INC_PATH})
endif()
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)
install( if(CMAKE_HOST_UNIX)
install(
TARGETS ${PROJECT_NAME} TARGETS ${PROJECT_NAME}
DESTINATION "bin" DESTINATION "bin"
) )
install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/linux/usr install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/linux/usr
DESTINATION "/") DESTINATION "/")
include(${PROJECT_SOURCE_DIR}/cmake/package_config.cmake) include(${PROJECT_SOURCE_DIR}/cmake/deb_package_config.cmake)
include(CPack) 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

18
README.md Executable file → Normal file
View File

@ -41,11 +41,14 @@ NDD已初步推出插件编写功能希望广大的CPP/QT开发者加入我
- ArchLinux - 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. 安装 qt 工具和库 `sudo pacman -S qt5-tools qt5-base qt5-xmlpatterns`
1. 配置 `cmake -B build -DCMAKE_BUILD_TYPE=Release` 1. 配置 `cmake -S . -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -W no-dev`
1. 编译 `cd build && make -j` 1. 编译 `ninja -C build && ninja -C build install`
1. 打包:使用aur 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 - openSUSE Tumbleweed
@ -68,6 +71,11 @@ NDD已初步推出插件编写功能希望广大的CPP/QT开发者加入我
``` ```
yay -S notepad---git yay -S notepad---git
``` ```
## 联络方式
QQ群959439826 用户群做NDD的问题反馈、功能建议等。
QQ群 616606091 开发群建议懂CPP/QT、愿意参与NDD项目代码贡献的开发人士加入。
## 效果预览 ## 效果预览

View File

@ -34,11 +34,14 @@ Creating a free text editor requires support from users like you. If you'd like
- ArchLinux - ArchLinux
1. Install compilation environment `sudo pacman -S gcc cmake make ` 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. Install qt tools and libraries `sudo pacman -S qt5-tools qt5-base qt5-xmlpatterns `
1. Configure `cmake -B build -DCMAKE_BUILD_TYPE=Release` 1. Configure `cmake -S . -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -W no-dev`
1. Compile `cd build && make -j` 1. Compile `ninja -C build && ninja -C build install`
1. Package: use aur 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:** **Qt Project Compilation Instructions:**

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

@ -87,7 +87,7 @@
<enum>Qt::LeftToRight</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
<property name="title"> <property name="title">
<string>File(&amp;F)</string> <string>&amp;File</string>
</property> </property>
<addaction name="actionNewFile"/> <addaction name="actionNewFile"/>
<addaction name="actionOpenFile"/> <addaction name="actionOpenFile"/>
@ -103,7 +103,7 @@
<enum>Qt::LeftToRight</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
<property name="title"> <property name="title">
<string>Edit(&amp;E)</string> <string>&amp;Edit</string>
</property> </property>
<widget class="QMenu" name="menuformat_conversion"> <widget class="QMenu" name="menuformat_conversion">
<property name="title"> <property name="title">
@ -180,7 +180,7 @@
</widget> </widget>
<widget class="QMenu" name="menuSearch"> <widget class="QMenu" name="menuSearch">
<property name="title"> <property name="title">
<string>Search(&amp;S)</string> <string>&amp;Search</string>
</property> </property>
<widget class="QMenu" name="menuBook_Mark"> <widget class="QMenu" name="menuBook_Mark">
<property name="title"> <property name="title">
@ -204,7 +204,7 @@
</widget> </widget>
<widget class="QMenu" name="menuView"> <widget class="QMenu" name="menuView">
<property name="title"> <property name="title">
<string>View(&amp;V)</string> <string>&amp;View</string>
</property> </property>
<widget class="QMenu" name="menudisplay_symbols"> <widget class="QMenu" name="menudisplay_symbols">
<property name="title"> <property name="title">
@ -232,7 +232,7 @@
</widget> </widget>
<widget class="QMenu" name="menuCode"> <widget class="QMenu" name="menuCode">
<property name="title"> <property name="title">
<string>Encoding(&amp;N)</string> <string>E&amp;ncoding</string>
</property> </property>
<widget class="QMenu" name="menuASNI"> <widget class="QMenu" name="menuASNI">
<property name="title"> <property name="title">
@ -263,7 +263,7 @@
</widget> </widget>
<widget class="QMenu" name="menuLanguage"> <widget class="QMenu" name="menuLanguage">
<property name="title"> <property name="title">
<string>Language(&amp;L)</string> <string>&amp;Language</string>
</property> </property>
<widget class="QMenu" name="menuP"> <widget class="QMenu" name="menuP">
<property name="title"> <property name="title">
@ -466,7 +466,7 @@
</widget> </widget>
<widget class="QMenu" name="menuSet"> <widget class="QMenu" name="menuSet">
<property name="title"> <property name="title">
<string>Set(&amp;T)</string> <string>Se&amp;t</string>
</property> </property>
<widget class="QMenu" name="menuLanguage_2"> <widget class="QMenu" name="menuLanguage_2">
<property name="title"> <property name="title">
@ -495,7 +495,7 @@
</widget> </widget>
<widget class="QMenu" name="menuTools"> <widget class="QMenu" name="menuTools">
<property name="title"> <property name="title">
<string>Tools(&amp;O)</string> <string>T&amp;ools</string>
</property> </property>
</widget> </widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>

View File

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

View File

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

View File

@ -4,11 +4,13 @@
#define NDD_EXPORTDLL #define NDD_EXPORTDLL
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#if defined(NDD_EXPORTDLL) #if defined(NDD_EXPORTDLL)
#define NDD_EXPORT __declspec(dllexport) #define NDD_EXPORT __declspec(dllexport)
#else
#define NDD_EXPORT __declspec(dllimport)
#endif
#else #else
#define NDD_EXPORT __declspec(dllimport) #define NDD_EXPORT __attribute__((visibility("default")))
#endif
#endif #endif
struct ndd_proc_data 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 TEMPLATE = lib
LANGUAGE = C++ LANGUAGE = C++
CONFIG += qt warn_on Debug CONFIG += qt warn_on
QT += core gui widgets QT += core gui widgets
HEADERS += *.h HEADERS += *.h

View File

@ -8,11 +8,13 @@
#define NDD_EXPORTDLL #define NDD_EXPORTDLL
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#if defined(NDD_EXPORTDLL) #if defined(NDD_EXPORTDLL)
#define NDD_EXPORT __declspec(dllexport) #define NDD_EXPORT __declspec(dllexport)
#else
#define NDD_EXPORT __declspec(dllimport)
#endif
#else #else
#define NDD_EXPORT __declspec(dllimport) #define NDD_EXPORT __attribute__((visibility("default")))
#endif
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -7,11 +7,13 @@
#define NDD_EXPORTDLL #define NDD_EXPORTDLL
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#if defined(NDD_EXPORTDLL) #if defined(NDD_EXPORTDLL)
#define NDD_EXPORT __declspec(dllexport) #define NDD_EXPORT __declspec(dllexport)
#else
#define NDD_EXPORT __declspec(dllimport)
#endif
#else #else
#define NDD_EXPORT __declspec(dllimport) #define NDD_EXPORT __attribute__((visibility("default")))
#endif
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

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

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(qscintilla2_qt5 CXX) project(qscint CXX)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC 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_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_compile_definitions(${PROJECT_NAME} PRIVATE SCINTILLA_QT SCI_LEXER INCLUDE_DEPRECATED_FEATURES)
target_include_directories(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE
@ -33,3 +36,19 @@ ${PROJECT_SOURCE_DIR}/scintilla/src
${PROJECT_SOURCE_DIR}/scintilla/include) ${PROJECT_SOURCE_DIR}/scintilla/include)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport) 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