Skip to content

Commit

Permalink
v0.4.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dail8859 committed Dec 31, 2021
2 parents c566b35 + 04c98cc commit 97f50b3
Show file tree
Hide file tree
Showing 305 changed files with 7,851 additions and 5,151 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ on: [push, pull_request]

jobs:
build:
strategy:
matrix:
config:
-
qt_version: "5.15.2"
modules: ""
-
qt_version: "6.2.2"
modules: "qt5compat"

runs-on: windows-latest

steps:
Expand All @@ -13,6 +23,9 @@ jobs:

- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ matrix.config.qt_version }}
modules: ${{ matrix.config.modules }}

- name: Setup VS tools
uses: egor-tensin/vs-shell@v2
Expand Down Expand Up @@ -41,5 +54,5 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: NotepadNext
name: NotepadNext-Qt${{ matrix.config.qt_version }}
path: ${{ github.workspace }}/build/package/
9 changes: 5 additions & 4 deletions doc/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ This document specifically describes how to build Notepad Next using Microsoft's
1. Download the [Qt installer](https://www.qt.io/download-qt-installer)
1. Run the installer.
1. Select 'custom installation'
1. Install (at a minimum):
* Qt 5.15.2 > MSVC 2019 64-bit
* Developer and Design Tools > Qt Creator CDB Debugger Support
* Developer and Design Tools > Debugging Tools for Windows
1. Install any version of Qt >= 5.15:
* `MSVC 2019 64-bit` located under the desired version of Qt
* If Qt 6+ is being used, you must also install `Qt 5 Compatibility Module`
* `Developer and Design Tools` > `Qt Creator CDB Debugger Support`
* `Developer and Design Tools` > `Debugging Tools for Windows`

# Cloning the Notepad Next Repository

Expand Down
3 changes: 1 addition & 2 deletions doc/Update Scintilla.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
1. Delete all files in `src\scintilla`
1. Copy new release of Scintilla into `src\scintilla`
1. Run `python src\scintilla\qt\ScintillaEdit\WidgetGen.py`
1. Update `src\scintilla.pri` as needed
1. Diff `ScintillaDocument.cpp/h` and address any changes that need kept
1. Update `src\scintilla.pri` as needed
9 changes: 7 additions & 2 deletions src/NotepadNext.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ win32 {
package.commands = \
xcopy $$shell_path($${OUT_PWD}/NotepadNext/NotepadNext.exe) $$shell_path($${OUT_PWD}/package/) /Y && \
xcopy $$shell_path($${OUT_PWD}/NotepadNext/*.dll) $$shell_path($${OUT_PWD}/package/) /Y && \
xcopy $$shell_path($${OUT_PWD}/NotepadNext/LICENSE) $$shell_path($${OUT_PWD}/package/) /Y && \
windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-angle --no-opengl-sw $$shell_path($${OUT_PWD}/package/NotepadNext.exe)
xcopy $$shell_path($${OUT_PWD}/NotepadNext/LICENSE) $$shell_path($${OUT_PWD}/package/) /Y &&

equals(QT_MAJOR_VERSION, 6) {
package.commands += windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-opengl-sw $$shell_path($${OUT_PWD}/package/NotepadNext.exe)
} else {
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)
}

zip.target = zip
zip.depends = package
Expand Down
4 changes: 2 additions & 2 deletions src/NotepadNext/ComboBoxDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewI

QComboBox *comboBox = new QComboBox(parent);

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

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

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

height = rect.height(); // Heights *should* all be the same
Expand Down
16 changes: 7 additions & 9 deletions src/NotepadNext/DockedEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

#include "ScintillaNext.h"

#include <QDir>


class DockedEditorComponentsFactory : public ads::CDockComponentsFactory
{
Expand Down Expand Up @@ -96,7 +94,7 @@ int DockedEditor::count() const
QVector<ScintillaNext *> DockedEditor::editors() const
{
QVector<ScintillaNext *> editors;
foreach (ads::CDockWidget* dockWidget, m_DockManager->dockWidgetsMap()) {
for (const ads::CDockWidget* dockWidget : m_DockManager->dockWidgetsMap()) {
editors.append(qobject_cast<ScintillaNext *>(dockWidget->widget()));
}

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

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

if (editor == dockedEditor) {
Expand Down Expand Up @@ -136,7 +134,7 @@ ads::CDockAreaWidget *DockedEditor::currentDockArea()
}

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

// Set the tooltip based on the buffer
if (editor->isFile()) {
dw->tabWidget()->setToolTip(QDir::toNativeSeparators(editor->canonicalFilePath()));
dw->tabWidget()->setToolTip(editor->getFilePath());
}
else {
dw->tabWidget()->setToolTip(editor->getName());
Expand All @@ -199,7 +197,7 @@ void DockedEditor::addEditor(ScintillaNext *editor)

void DockedEditor::removeEditor(ScintillaNext *editor)
{
foreach (ads::CDockWidget* dockWidget, m_DockManager->dockWidgetsMap()) {
for (ads::CDockWidget* dockWidget : m_DockManager->dockWidgetsMap()) {
ScintillaNext *editorToCheck = qobject_cast<ScintillaNext *>(dockWidget->widget());

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

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

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

if (editor->isFile()) {
dockWidget->tabWidget()->setToolTip(QDir::toNativeSeparators(editor->canonicalFilePath()));
dockWidget->tabWidget()->setToolTip(editor->getFilePath());
}
else {
dockWidget->tabWidget()->setToolTip(editor->getName());
Expand Down
1 change: 0 additions & 1 deletion src/NotepadNext/DockedEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <QObject>

#include "DockManager.h"
#include "ScintillaBuffer.h"
#include "ScintillaNext.h"

class DockedEditor : public QObject
Expand Down
87 changes: 45 additions & 42 deletions src/NotepadNext/EditorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "EditorManager.h"
#include "ScintillaNext.h"
#include "Scintilla.h"
#include "ScintillaTypes.h"

// Editor decorators
#include "BraceMatch.h"
Expand All @@ -38,15 +39,15 @@ const int MARK_HIDELINESUNDERLINE = 21;
EditorManager::EditorManager(QObject *parent) : QObject(parent)
{
connect(this, &EditorManager::editorCreated, [=](ScintillaNext *editor) {
connect(editor, &ScintillaNext::destroyed, [=]() {
connect(editor, &ScintillaNext::closed, [=]() {
emit editorClosed(editor);
});
});
}

ScintillaNext *EditorManager::createEmptyEditor(const QString &name)
{
ScintillaNext *editor = new ScintillaNext(new ScintillaBuffer(name));
ScintillaNext *editor = new ScintillaNext(name);
QPointer<ScintillaNext> pointer = QPointer<ScintillaNext>(editor);
editors.append(pointer);

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

ScintillaNext *EditorManager::createEditorFromFile(const QString &filePath)
{
ScintillaNext *editor = new ScintillaNext(ScintillaBuffer::fromFile(filePath));
ScintillaNext *editor = ScintillaNext::fromFile(filePath);
QPointer<ScintillaNext> pointer = QPointer<ScintillaNext>(editor);
editors.append(pointer);

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

ScintillaNext *EditorManager::cloneEditor(ScintillaNext *editor)
{
ScintillaNext *clonedEditor = new ScintillaNext("Clone");
QPointer<ScintillaNext> pointer = QPointer<ScintillaNext>(clonedEditor);
editors.append(pointer);

setupEditor(clonedEditor);

emit editorCreated(clonedEditor);

return clonedEditor;
}

ScintillaNext *EditorManager::getEditorByFilePath(const QString &filePath)
{
QFileInfo newInfo(filePath);
newInfo.makeAbsolute();

purgeOldEditorPointers();

foreach (ScintillaNext *editor, editors) {
if (editor->isFile() && editor->fileInfo() == newInfo) {
for (ScintillaNext *editor : editors) {
if (editor->isFile() && editor->getFileInfo() == newInfo) {
return editor;
}
}
Expand All @@ -90,6 +104,8 @@ void EditorManager::setupEditor(ScintillaNext *editor)
{
qInfo(Q_FUNC_INFO);

editor->clearCmdKey(SCK_INSERT);

setFoldMarkers(editor, "box");
editor->setIdleStyling(SC_IDLESTYLING_TOVISIBLE);
editor->setEndAtLastLine(false);
Expand All @@ -102,16 +118,20 @@ void EditorManager::setupEditor(ScintillaNext *editor)
editor->setVirtualSpaceOptions(SCVS_RECTANGULARSELECTION);

editor->setMarginLeft(2);

editor->setMarginWidthN(0, 30);
editor->setMarginMaskN(1, (1<<MARK_BOOKMARK) | (1<<MARK_HIDELINESBEGIN) | (1<<MARK_HIDELINESEND) | (1<<MARK_HIDELINESUNDERLINE));
editor->setMarginMaskN(2, SC_MASK_FOLDERS);
editor->setMarginWidthN(2, 14);

editor->markerSetAlpha(MARK_BOOKMARK, 70);
editor->markerDefine(MARK_BOOKMARK, SC_MARK_BOOKMARK);
editor->markerSetFore(MARK_BOOKMARK, 0xFF2020);
editor->markerSetBack(MARK_BOOKMARK, 0xFF2020);

editor->markerDefine(MARK_HIDELINESUNDERLINE, SC_MARK_UNDERLINE);
editor->markerSetBack(MARK_HIDELINESUNDERLINE, 0x77CC77);

editor->markerDefine(MARK_BOOKMARK, SC_MARK_BOOKMARK);
editor->markerDefine(MARK_HIDELINESBEGIN, SC_MARK_ARROW);
editor->markerDefine(MARK_HIDELINESEND, SC_MARK_ARROWDOWN);

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

editor->assignCmdKey(SCK_RETURN, SCI_NEWLINE);

editor->setCaretLineBack(0xFFE8E8);
editor->setCaretLineVisible(true);
editor->setCaretLineVisibleAlways(true);
editor->setCaretFore(0xFF0080);
editor->setCaretWidth(2);
editor->setSelBack(true, 0xC0C0C0);

editor->setEdgeColour(0x80FFFF);

editor->setWhitespaceFore(true, 0x6AB5FF);
// https://www.scintilla.org/ScintillaDoc.html#ElementColours
// SC_ELEMENT_SELECTION_TEXT
// SC_ELEMENT_SELECTION_BACK
// SC_ELEMENT_SELECTION_ADDITIONAL_TEXT
// SC_ELEMENT_SELECTION_ADDITIONAL_BACK
// SC_ELEMENT_SELECTION_SECONDARY_TEXT
// SC_ELEMENT_SELECTION_SECONDARY_BACK
// SC_ELEMENT_SELECTION_INACTIVE_TEXT
editor->setElementColour(SC_ELEMENT_SELECTION_INACTIVE_BACK, 0xFFE0E0E0);
// SC_ELEMENT_CARET
// SC_ELEMENT_CARET_ADDITIONAL
editor->setElementColour(SC_ELEMENT_CARET_LINE_BACK, 0xFFFFE8E8);
editor->setElementColour(SC_ELEMENT_WHITE_SPACE, 0xFFD0D0D0);
// SC_ELEMENT_WHITE_SPACE_BACK
// SC_ELEMENT_HOT_SPOT_ACTIVE
// SC_ELEMENT_HOT_SPOT_ACTIVE_BACK
editor->setElementColour(SC_ELEMENT_FOLD_LINE, 0xFFA0A0A0);
// SC_ELEMENT_HIDDEN_LINE

editor->setWhitespaceSize(2);

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

// Indicators
// Find Mark Style
// editor->indicSetFore(31, 0x0000FF);
// Smart HighLighting
// editor->indicSetFore(29, 0x00FF00);
// Incremental highlight all
// editor->indicSetFore(28, 0xFF8000);
// Tags match highlighting
// editor->indicSetFore(27, 0xFF0080);
// Tags attribute
// editor->indicSetFore(26, 0x00FFFF);

/*
-- Mark Style 1
editor.IndicFore[25] = rgb(0x00FFFF)
-- Mark Style 2
editor.IndicFore[24] = rgb(0xFF8000)
-- Mark Style 3
editor.IndicFore[23] = rgb(0xFFFF00)
-- Mark Style 4
editor.IndicFore[22] = rgb(0x8000FF)
-- Mark Style 5
editor.IndicFore[21] = rgb(0x008000)
SetFolderMarkers("box")
*/

// -- reset everything
editor->clearDocumentStyle();
editor->styleResetDefault();

editor->styleSetFore(STYLE_DEFAULT, 0x000000);
editor->styleSetBack(STYLE_DEFAULT, 0xFFFFFF);
Expand Down
1 change: 1 addition & 0 deletions src/NotepadNext/EditorManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class EditorManager : public QObject

ScintillaNext *createEmptyEditor(const QString &name);
ScintillaNext *createEditorFromFile(const QString &filePath);
ScintillaNext *cloneEditor(ScintillaNext *editor);

ScintillaNext *getEditorByFilePath(const QString &filePath);

Expand Down
2 changes: 1 addition & 1 deletion src/NotepadNext/LanguageStylesModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ QList<ComboBoxItem> caseItems{
};

QString val_to_case_str(int val) {
foreach(const ComboBoxItem &item, caseItems) {
for (const ComboBoxItem &item : caseItems) {
if (item.second == val) {
return item.first;
}
Expand Down
4 changes: 2 additions & 2 deletions src/NotepadNext/MacroRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void Macro::addMacroStep(Message message, uptr_t wParam, sptr_t lParam)
}

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

while (n > 0) {
foreach (const MacroAction *ma, actions) {
for (const MacroAction *ma : actions) {
if (MessageHasString(ma->message)) {
editor->sends(static_cast<int>(ma->message), ma->wParam, ma->str->constBegin());
}
Expand Down
2 changes: 0 additions & 2 deletions src/NotepadNext/NotepadNext.pro
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ SOURCES += \
QuickFindWidget.cpp \
RecentFilesListManager.cpp \
SciIFaceTable.cpp \
ScintillaBuffer.cpp \
ScintillaNext.cpp \
Settings.cpp \
SpinBoxDelegate.cpp \
Expand Down Expand Up @@ -123,7 +122,6 @@ HEADERS += \
QuickFindWidget.h \
RecentFilesListManager.h \
SciIFaceTable.h \
ScintillaBuffer.h \
ScintillaNext.h \
Settings.h \
SpinBoxDelegate.h \
Expand Down
Loading

0 comments on commit 97f50b3

Please sign in to comment.