Skip to content

Commit 97f50b3

Browse files
committed
v0.4.4 release
2 parents c566b35 + 04c98cc commit 97f50b3

File tree

305 files changed

+7851
-5151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+7851
-5151
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7+
strategy:
8+
matrix:
9+
config:
10+
-
11+
qt_version: "5.15.2"
12+
modules: ""
13+
-
14+
qt_version: "6.2.2"
15+
modules: "qt5compat"
16+
717
runs-on: windows-latest
818

919
steps:
@@ -13,6 +23,9 @@ jobs:
1323

1424
- name: Install Qt
1525
uses: jurplel/install-qt-action@v2
26+
with:
27+
version: ${{ matrix.config.qt_version }}
28+
modules: ${{ matrix.config.modules }}
1629

1730
- name: Setup VS tools
1831
uses: egor-tensin/vs-shell@v2
@@ -41,5 +54,5 @@ jobs:
4154
- name: Upload artifact
4255
uses: actions/upload-artifact@v2
4356
with:
44-
name: NotepadNext
57+
name: NotepadNext-Qt${{ matrix.config.qt_version }}
4558
path: ${{ github.workspace }}/build/package/

doc/Building.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ This document specifically describes how to build Notepad Next using Microsoft's
1616
1. Download the [Qt installer](https://www.qt.io/download-qt-installer)
1717
1. Run the installer.
1818
1. Select 'custom installation'
19-
1. Install (at a minimum):
20-
* Qt 5.15.2 > MSVC 2019 64-bit
21-
* Developer and Design Tools > Qt Creator CDB Debugger Support
22-
* Developer and Design Tools > Debugging Tools for Windows
19+
1. Install any version of Qt >= 5.15:
20+
* `MSVC 2019 64-bit` located under the desired version of Qt
21+
* If Qt 6+ is being used, you must also install `Qt 5 Compatibility Module`
22+
* `Developer and Design Tools` > `Qt Creator CDB Debugger Support`
23+
* `Developer and Design Tools` > `Debugging Tools for Windows`
2324

2425
# Cloning the Notepad Next Repository
2526

doc/Update Scintilla.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
1. Delete all files in `src\scintilla`
22
1. Copy new release of Scintilla into `src\scintilla`
33
1. Run `python src\scintilla\qt\ScintillaEdit\WidgetGen.py`
4-
1. Update `src\scintilla.pri` as needed
5-
1. Diff `ScintillaDocument.cpp/h` and address any changes that need kept
4+
1. Update `src\scintilla.pri` as needed

src/NotepadNext.pro

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ win32 {
3232
package.commands = \
3333
xcopy $$shell_path($${OUT_PWD}/NotepadNext/NotepadNext.exe) $$shell_path($${OUT_PWD}/package/) /Y && \
3434
xcopy $$shell_path($${OUT_PWD}/NotepadNext/*.dll) $$shell_path($${OUT_PWD}/package/) /Y && \
35-
xcopy $$shell_path($${OUT_PWD}/NotepadNext/LICENSE) $$shell_path($${OUT_PWD}/package/) /Y && \
36-
windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-angle --no-opengl-sw $$shell_path($${OUT_PWD}/package/NotepadNext.exe)
35+
xcopy $$shell_path($${OUT_PWD}/NotepadNext/LICENSE) $$shell_path($${OUT_PWD}/package/) /Y &&
36+
37+
equals(QT_MAJOR_VERSION, 6) {
38+
package.commands += windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-opengl-sw $$shell_path($${OUT_PWD}/package/NotepadNext.exe)
39+
} else {
40+
package.commands += windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-angle --no-opengl-sw $$shell_path($${OUT_PWD}/package/NotepadNext.exe)
41+
}
3742

3843
zip.target = zip
3944
zip.depends = package

src/NotepadNext/ComboBoxDelegate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
3535

3636
QComboBox *comboBox = new QComboBox(parent);
3737

38-
foreach(const ComboBoxItem item, comboBoxItems) {
38+
for(const ComboBoxItem &item : comboBoxItems) {
3939
comboBox->addItem(item.first, item.second);
4040
}
4141

@@ -76,7 +76,7 @@ QSize ComboBoxDelegate::sizeHint(const QStyleOptionViewItem &option, const QMode
7676
int &width = maxStringSize.rwidth();
7777
int &height = maxStringSize.rheight();
7878

79-
foreach(const ComboBoxItem item, comboBoxItems) {
79+
for(const ComboBoxItem &item : comboBoxItems) {
8080
QRect rect = fm.boundingRect(item.first);
8181

8282
height = rect.height(); // Heights *should* all be the same

src/NotepadNext/DockedEditor.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
#include "ScintillaNext.h"
2727

28-
#include <QDir>
29-
3028

3129
class DockedEditorComponentsFactory : public ads::CDockComponentsFactory
3230
{
@@ -96,7 +94,7 @@ int DockedEditor::count() const
9694
QVector<ScintillaNext *> DockedEditor::editors() const
9795
{
9896
QVector<ScintillaNext *> editors;
99-
foreach (ads::CDockWidget* dockWidget, m_DockManager->dockWidgetsMap()) {
97+
for (const ads::CDockWidget* dockWidget : m_DockManager->dockWidgetsMap()) {
10098
editors.append(qobject_cast<ScintillaNext *>(dockWidget->widget()));
10199
}
102100

@@ -105,7 +103,7 @@ QVector<ScintillaNext *> DockedEditor::editors() const
105103

106104
void DockedEditor::switchToEditor(const ScintillaNext *editor)
107105
{
108-
foreach (ads::CDockWidget* dockWidget, m_DockManager->dockWidgetsMap()) {
106+
for (ads::CDockWidget* dockWidget : m_DockManager->dockWidgetsMap()) {
109107
auto dockedEditor = qobject_cast<ScintillaNext *>(dockWidget->widget());
110108

111109
if (editor == dockedEditor) {
@@ -136,7 +134,7 @@ ads::CDockAreaWidget *DockedEditor::currentDockArea()
136134
}
137135

138136
// Search the list for the one that has had the focus set
139-
foreach (ads::CDockWidget* dockWidget, dockwidgets) {
137+
for (ads::CDockWidget* dockWidget : dockwidgets) {
140138
if (dockWidget->property("focused").toBool()) {
141139
return dockWidget->dockAreaWidget();
142140
}
@@ -176,7 +174,7 @@ void DockedEditor::addEditor(ScintillaNext *editor)
176174

177175
// Set the tooltip based on the buffer
178176
if (editor->isFile()) {
179-
dw->tabWidget()->setToolTip(QDir::toNativeSeparators(editor->canonicalFilePath()));
177+
dw->tabWidget()->setToolTip(editor->getFilePath());
180178
}
181179
else {
182180
dw->tabWidget()->setToolTip(editor->getName());
@@ -199,7 +197,7 @@ void DockedEditor::addEditor(ScintillaNext *editor)
199197

200198
void DockedEditor::removeEditor(ScintillaNext *editor)
201199
{
202-
foreach (ads::CDockWidget* dockWidget, m_DockManager->dockWidgetsMap()) {
200+
for (ads::CDockWidget* dockWidget : m_DockManager->dockWidgetsMap()) {
203201
ScintillaNext *editorToCheck = qobject_cast<ScintillaNext *>(dockWidget->widget());
204202

205203
if (editor == editorToCheck) {
@@ -212,7 +210,7 @@ void DockedEditor::renameEditor(ScintillaNext *editor)
212210
{
213211
Q_ASSERT(editor != Q_NULLPTR);
214212

215-
foreach (ads::CDockWidget* dockWidget, m_DockManager->dockWidgetsMap()) {
213+
for (ads::CDockWidget* dockWidget : m_DockManager->dockWidgetsMap()) {
216214
ScintillaNext *editorToCheck = qobject_cast<ScintillaNext *>(dockWidget->widget());
217215

218216
if (editor == editorToCheck) {
@@ -221,7 +219,7 @@ void DockedEditor::renameEditor(ScintillaNext *editor)
221219
dockWidget->setWindowTitle(newName);
222220

223221
if (editor->isFile()) {
224-
dockWidget->tabWidget()->setToolTip(QDir::toNativeSeparators(editor->canonicalFilePath()));
222+
dockWidget->tabWidget()->setToolTip(editor->getFilePath());
225223
}
226224
else {
227225
dockWidget->tabWidget()->setToolTip(editor->getName());

src/NotepadNext/DockedEditor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <QObject>
2424

2525
#include "DockManager.h"
26-
#include "ScintillaBuffer.h"
2726
#include "ScintillaNext.h"
2827

2928
class DockedEditor : public QObject

src/NotepadNext/EditorManager.cpp

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "EditorManager.h"
2121
#include "ScintillaNext.h"
2222
#include "Scintilla.h"
23+
#include "ScintillaTypes.h"
2324

2425
// Editor decorators
2526
#include "BraceMatch.h"
@@ -38,15 +39,15 @@ const int MARK_HIDELINESUNDERLINE = 21;
3839
EditorManager::EditorManager(QObject *parent) : QObject(parent)
3940
{
4041
connect(this, &EditorManager::editorCreated, [=](ScintillaNext *editor) {
41-
connect(editor, &ScintillaNext::destroyed, [=]() {
42+
connect(editor, &ScintillaNext::closed, [=]() {
4243
emit editorClosed(editor);
4344
});
4445
});
4546
}
4647

4748
ScintillaNext *EditorManager::createEmptyEditor(const QString &name)
4849
{
49-
ScintillaNext *editor = new ScintillaNext(new ScintillaBuffer(name));
50+
ScintillaNext *editor = new ScintillaNext(name);
5051
QPointer<ScintillaNext> pointer = QPointer<ScintillaNext>(editor);
5152
editors.append(pointer);
5253

@@ -59,7 +60,7 @@ ScintillaNext *EditorManager::createEmptyEditor(const QString &name)
5960

6061
ScintillaNext *EditorManager::createEditorFromFile(const QString &filePath)
6162
{
62-
ScintillaNext *editor = new ScintillaNext(ScintillaBuffer::fromFile(filePath));
63+
ScintillaNext *editor = ScintillaNext::fromFile(filePath);
6364
QPointer<ScintillaNext> pointer = QPointer<ScintillaNext>(editor);
6465
editors.append(pointer);
6566

@@ -70,15 +71,28 @@ ScintillaNext *EditorManager::createEditorFromFile(const QString &filePath)
7071
return editor;
7172
}
7273

74+
ScintillaNext *EditorManager::cloneEditor(ScintillaNext *editor)
75+
{
76+
ScintillaNext *clonedEditor = new ScintillaNext("Clone");
77+
QPointer<ScintillaNext> pointer = QPointer<ScintillaNext>(clonedEditor);
78+
editors.append(pointer);
79+
80+
setupEditor(clonedEditor);
81+
82+
emit editorCreated(clonedEditor);
83+
84+
return clonedEditor;
85+
}
86+
7387
ScintillaNext *EditorManager::getEditorByFilePath(const QString &filePath)
7488
{
7589
QFileInfo newInfo(filePath);
7690
newInfo.makeAbsolute();
7791

7892
purgeOldEditorPointers();
7993

80-
foreach (ScintillaNext *editor, editors) {
81-
if (editor->isFile() && editor->fileInfo() == newInfo) {
94+
for (ScintillaNext *editor : editors) {
95+
if (editor->isFile() && editor->getFileInfo() == newInfo) {
8296
return editor;
8397
}
8498
}
@@ -90,6 +104,8 @@ void EditorManager::setupEditor(ScintillaNext *editor)
90104
{
91105
qInfo(Q_FUNC_INFO);
92106

107+
editor->clearCmdKey(SCK_INSERT);
108+
93109
setFoldMarkers(editor, "box");
94110
editor->setIdleStyling(SC_IDLESTYLING_TOVISIBLE);
95111
editor->setEndAtLastLine(false);
@@ -102,16 +118,20 @@ void EditorManager::setupEditor(ScintillaNext *editor)
102118
editor->setVirtualSpaceOptions(SCVS_RECTANGULARSELECTION);
103119

104120
editor->setMarginLeft(2);
121+
105122
editor->setMarginWidthN(0, 30);
106123
editor->setMarginMaskN(1, (1<<MARK_BOOKMARK) | (1<<MARK_HIDELINESBEGIN) | (1<<MARK_HIDELINESEND) | (1<<MARK_HIDELINESUNDERLINE));
107124
editor->setMarginMaskN(2, SC_MASK_FOLDERS);
108125
editor->setMarginWidthN(2, 14);
109126

110127
editor->markerSetAlpha(MARK_BOOKMARK, 70);
128+
editor->markerDefine(MARK_BOOKMARK, SC_MARK_BOOKMARK);
129+
editor->markerSetFore(MARK_BOOKMARK, 0xFF2020);
130+
editor->markerSetBack(MARK_BOOKMARK, 0xFF2020);
131+
111132
editor->markerDefine(MARK_HIDELINESUNDERLINE, SC_MARK_UNDERLINE);
112133
editor->markerSetBack(MARK_HIDELINESUNDERLINE, 0x77CC77);
113134

114-
editor->markerDefine(MARK_BOOKMARK, SC_MARK_BOOKMARK);
115135
editor->markerDefine(MARK_HIDELINESBEGIN, SC_MARK_ARROW);
116136
editor->markerDefine(MARK_HIDELINESEND, SC_MARK_ARROWDOWN);
117137

@@ -126,18 +146,31 @@ void EditorManager::setupEditor(ScintillaNext *editor)
126146
editor->setTabWidth(4);
127147
editor->setBackSpaceUnIndents(true);
128148

129-
editor->assignCmdKey(SCK_RETURN, SCI_NEWLINE);
130-
131-
editor->setCaretLineBack(0xFFE8E8);
132149
editor->setCaretLineVisible(true);
133150
editor->setCaretLineVisibleAlways(true);
134-
editor->setCaretFore(0xFF0080);
135151
editor->setCaretWidth(2);
136-
editor->setSelBack(true, 0xC0C0C0);
137152

138153
editor->setEdgeColour(0x80FFFF);
139154

140-
editor->setWhitespaceFore(true, 0x6AB5FF);
155+
// https://www.scintilla.org/ScintillaDoc.html#ElementColours
156+
// SC_ELEMENT_SELECTION_TEXT
157+
// SC_ELEMENT_SELECTION_BACK
158+
// SC_ELEMENT_SELECTION_ADDITIONAL_TEXT
159+
// SC_ELEMENT_SELECTION_ADDITIONAL_BACK
160+
// SC_ELEMENT_SELECTION_SECONDARY_TEXT
161+
// SC_ELEMENT_SELECTION_SECONDARY_BACK
162+
// SC_ELEMENT_SELECTION_INACTIVE_TEXT
163+
editor->setElementColour(SC_ELEMENT_SELECTION_INACTIVE_BACK, 0xFFE0E0E0);
164+
// SC_ELEMENT_CARET
165+
// SC_ELEMENT_CARET_ADDITIONAL
166+
editor->setElementColour(SC_ELEMENT_CARET_LINE_BACK, 0xFFFFE8E8);
167+
editor->setElementColour(SC_ELEMENT_WHITE_SPACE, 0xFFD0D0D0);
168+
// SC_ELEMENT_WHITE_SPACE_BACK
169+
// SC_ELEMENT_HOT_SPOT_ACTIVE
170+
// SC_ELEMENT_HOT_SPOT_ACTIVE_BACK
171+
editor->setElementColour(SC_ELEMENT_FOLD_LINE, 0xFFA0A0A0);
172+
// SC_ELEMENT_HIDDEN_LINE
173+
141174
editor->setWhitespaceSize(2);
142175

143176
editor->setFoldMarginColour(true, 0xFFFFFF);
@@ -148,36 +181,6 @@ void EditorManager::setupEditor(ScintillaNext *editor)
148181
editor->setAutomaticFold(SC_AUTOMATICFOLD_SHOW | SC_AUTOMATICFOLD_CLICK | SC_AUTOMATICFOLD_CHANGE);
149182
editor->markerEnableHighlight(true);
150183

151-
// Indicators
152-
// Find Mark Style
153-
// editor->indicSetFore(31, 0x0000FF);
154-
// Smart HighLighting
155-
// editor->indicSetFore(29, 0x00FF00);
156-
// Incremental highlight all
157-
// editor->indicSetFore(28, 0xFF8000);
158-
// Tags match highlighting
159-
// editor->indicSetFore(27, 0xFF0080);
160-
// Tags attribute
161-
// editor->indicSetFore(26, 0x00FFFF);
162-
163-
/*
164-
-- Mark Style 1
165-
editor.IndicFore[25] = rgb(0x00FFFF)
166-
-- Mark Style 2
167-
editor.IndicFore[24] = rgb(0xFF8000)
168-
-- Mark Style 3
169-
editor.IndicFore[23] = rgb(0xFFFF00)
170-
-- Mark Style 4
171-
editor.IndicFore[22] = rgb(0x8000FF)
172-
-- Mark Style 5
173-
editor.IndicFore[21] = rgb(0x008000)
174-
175-
SetFolderMarkers("box")
176-
*/
177-
178-
// -- reset everything
179-
editor->clearDocumentStyle();
180-
editor->styleResetDefault();
181184

182185
editor->styleSetFore(STYLE_DEFAULT, 0x000000);
183186
editor->styleSetBack(STYLE_DEFAULT, 0xFFFFFF);

src/NotepadNext/EditorManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class EditorManager : public QObject
3535

3636
ScintillaNext *createEmptyEditor(const QString &name);
3737
ScintillaNext *createEditorFromFile(const QString &filePath);
38+
ScintillaNext *cloneEditor(ScintillaNext *editor);
3839

3940
ScintillaNext *getEditorByFilePath(const QString &filePath);
4041

src/NotepadNext/LanguageStylesModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ QList<ComboBoxItem> caseItems{
3636
};
3737

3838
QString val_to_case_str(int val) {
39-
foreach(const ComboBoxItem &item, caseItems) {
39+
for (const ComboBoxItem &item : caseItems) {
4040
if (item.second == val) {
4141
return item.first;
4242
}

src/NotepadNext/MacroRecorder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void Macro::addMacroStep(Message message, uptr_t wParam, sptr_t lParam)
113113
}
114114

115115
#ifdef QT_DEBUG
116-
foreach (const MacroAction *ma, actions) {
116+
for (const MacroAction *ma : actions) {
117117
qInfo("%s", qUtf8Printable(ma->toString()));
118118
}
119119
#endif
@@ -126,7 +126,7 @@ void Macro::replay(ScintillaNext *editor, int n) const
126126
editor->beginUndoAction();
127127

128128
while (n > 0) {
129-
foreach (const MacroAction *ma, actions) {
129+
for (const MacroAction *ma : actions) {
130130
if (MessageHasString(ma->message)) {
131131
editor->sends(static_cast<int>(ma->message), ma->wParam, ma->str->constBegin());
132132
}

src/NotepadNext/NotepadNext.pro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ SOURCES += \
7777
QuickFindWidget.cpp \
7878
RecentFilesListManager.cpp \
7979
SciIFaceTable.cpp \
80-
ScintillaBuffer.cpp \
8180
ScintillaNext.cpp \
8281
Settings.cpp \
8382
SpinBoxDelegate.cpp \
@@ -123,7 +122,6 @@ HEADERS += \
123122
QuickFindWidget.h \
124123
RecentFilesListManager.h \
125124
SciIFaceTable.h \
126-
ScintillaBuffer.h \
127125
ScintillaNext.h \
128126
Settings.h \
129127
SpinBoxDelegate.h \

0 commit comments

Comments
 (0)