Skip to content

Commit

Permalink
v0.4.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dail8859 committed Nov 27, 2021
2 parents 630febb + baa3872 commit 007def7
Show file tree
Hide file tree
Showing 26 changed files with 372 additions and 288 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "src/ads"]
path = src/ads
url = https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
[submodule "src/QSimpleUpdater"]
path = src/QSimpleUpdater
url = https://github.com/alex-spataru/QSimpleUpdater
Binary file added deploy/windows/libcrypto-1_1-x64.dll
Binary file not shown.
Binary file added deploy/windows/libssl-1_1-x64.dll
Binary file not shown.
9 changes: 7 additions & 2 deletions doc/Create Release.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
## Prepare Release

Update version in `src/Version.pri`
- Update version in `src/Version.pri`
- Commit on `dev` branch
- Merge into `master`
- Tag merged commit with new version number
- Follow procedures below
- Attach exe and zip to the Github release

## Build Release
Example bat script to build release

```
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
set PATH=C:\Qt\5.15.2\msvc2019_64\bin\;C:\Qt\Tools\QtCreator\bin\;%PATH%
set PATH=C:\Qt\5.15.2\msvc2019_64\bin\;C:\Qt\Tools\QtCreator\bin\jom\;%PATH%
set PATH=C:\Program Files\7-Zip;%PATH%
set PATH=C:\Program Files (x86)\NSIS\Bin;%PATH%
mkdir build
Expand Down
1 change: 1 addition & 0 deletions src/NotepadNext.pro
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ win32 {
package.target = package
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($${PWD}/../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)

Expand Down
24 changes: 21 additions & 3 deletions src/NotepadNext/DockedEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,30 @@
#include "DockedEditor.h"
#include "DockAreaWidget.h"
#include "DockWidgetTab.h"
#include "DockAreaTitleBar.h"
#include "DockComponentsFactory.h"
#include "DockedEditorTitleBar.h"

#include "ScintillaNext.h"


class DockedEditorComponentsFactory : public ads::CDockComponentsFactory
{
public:
ads::CDockAreaTitleBar* createDockAreaTitleBar(ads::CDockAreaWidget* DockArea) const {
DockedEditorTitleBar *titleBar = new DockedEditorTitleBar(DockArea);

// Disable the built in context menu for the title bar since it has options we don't want
titleBar->setContextMenuPolicy(Qt::NoContextMenu);

return titleBar;
}
};


DockedEditor::DockedEditor(QWidget *parent) : QObject(parent)
{
ads::CDockComponentsFactory::setFactory(new DockedEditorComponentsFactory());

ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton, true);
ads::CDockManager::setConfigFlag(ads::CDockManager::AlwaysShowTabs, true);
ads::CDockManager::setConfigFlag(ads::CDockManager::OpaqueSplitterResize, true);
Expand All @@ -37,6 +54,7 @@ DockedEditor::DockedEditor(QWidget *parent) : QObject(parent)
ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true);
ads::CDockManager::setConfigFlag(ads::CDockManager::FocusHighlighting, true);
ads::CDockManager::setConfigFlag(ads::CDockManager::EqualSplitOnInsertion, true);
ads::CDockManager::setConfigFlag(ads::CDockManager::MiddleMouseButtonClosesTab, true);

m_DockManager = new ads::CDockManager(parent);
m_DockManager->setStyleSheet("");
Expand All @@ -52,8 +70,8 @@ DockedEditor::DockedEditor(QWidget *parent) : QObject(parent)
});

connect(m_DockManager, &ads::CDockManager::dockAreaCreated, [=](ads::CDockAreaWidget* DockArea) {
// Disable the built in context menu for the title bar since it has options we don't want
DockArea->titleBar()->setContextMenuPolicy(Qt::NoContextMenu);
DockedEditorTitleBar *titleBar = qobject_cast<DockedEditorTitleBar *>(DockArea->titleBar());
connect(titleBar, &DockedEditorTitleBar::doubleClicked, this, &DockedEditor::titleBarDoubleClicked);
});
}

Expand Down
1 change: 1 addition & 0 deletions src/NotepadNext/DockedEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public slots:
void editorActivated(ScintillaNext *editor);

void contextMenuRequestedForEditor(ScintillaNext *editor);
void titleBarDoubleClicked();
};

#endif // DOCKEDEDITOR_H
46 changes: 46 additions & 0 deletions src/NotepadNext/DockedEditorTitleBar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of Notepad Next.
* Copyright 2019 Justin Dailey
*
* Notepad Next is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Notepad Next is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Notepad Next. If not, see <https://www.gnu.org/licenses/>.
*/


#ifndef DOCKEDEDITORTITLEBAR_H
#define DOCKEDEDITORTITLEBAR_H


#include <DockAreaTitleBar.h>

class DockedEditorTitleBar : public ads::CDockAreaTitleBar
{
Q_OBJECT

public:
explicit DockedEditorTitleBar(ads::CDockAreaWidget* parent) : ads::CDockAreaTitleBar(parent) {}

signals:
void doubleClicked();

protected:
void mouseDoubleClickEvent(QMouseEvent *event) {
ads::CDockAreaTitleBar::mouseDoubleClickEvent(event);

if (event->button() == Qt::LeftButton) {
emit doubleClicked();
}
}
};

#endif // DOCKEDEDITORTITLEBAR_H
7 changes: 6 additions & 1 deletion src/NotepadNext/EditorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "SurroundSelection.h"
#include "LineNumbers.h"
#include "BetterMultiSelection.h"
#include "AutoIndentation.h"

const int MARK_BOOKMARK = 24;
const int MARK_HIDELINESBEGIN = 23;
Expand Down Expand Up @@ -121,8 +122,9 @@ void EditorManager::setupEditor(ScintillaNext *editor)
editor->setScrollWidthTracking(true);
editor->setScrollWidth(1);

//editor->clearAllCmdKeys();
editor->setTabDrawMode(SCTD_STRIKEOUT);
editor->setTabWidth(4);
editor->setBackSpaceUnIndents(true);

editor->assignCmdKey(SCK_RETURN, SCI_NEWLINE);

Expand Down Expand Up @@ -219,6 +221,9 @@ void EditorManager::setupEditor(ScintillaNext *editor)

BetterMultiSelection *bms = new BetterMultiSelection(editor);
bms->setEnabled(true);

AutoIndentation *ai = new AutoIndentation(editor);
ai->setEnabled(true);
}

// TODO: Move this into the editor eventually?
Expand Down
15 changes: 14 additions & 1 deletion src/NotepadNext/NotepadNext.pro
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ include(../uchardet.pri)
include(../lua.pri)
include(../ads.pri)
include(../editorconfig-core-qt/EditorConfig.pri)
include(../QSimpleUpdater/QSimpleUpdater.pri)

# Set variables for output executable
VERSION = $$APP_VERSION
Expand All @@ -43,6 +44,11 @@ win32 {
QMAKE_TARGET_COPYRIGHT = $$APP_COPYRIGHT
QMAKE_TARGET_PRODUCT = Notepad Next
RC_ICONS = ../../icon/nn.ico

CONFIG += file_copies
COPIES += openssl
openssl.files = $$files(../../deploy/windows/*.dll)
openssl.path = $$OUT_PWD
}


Expand Down Expand Up @@ -71,6 +77,7 @@ SOURCES += \
Settings.cpp \
SpinBoxDelegate.cpp \
decorators/ApplicationDecorator.cpp \
decorators/AutoIndentation.cpp \
decorators/BetterMultiSelection.cpp \
decorators/EditorConfigAppDecorator.cpp \
decorators/SurroundSelection.cpp \
Expand All @@ -93,6 +100,7 @@ HEADERS += \
ColorPickerDelegate.h \
ComboBoxDelegate.h \
DockedEditor.h \
DockedEditorTitleBar.h \
EditorManager.h \
Finder.h \
FocusWatcher.h \
Expand All @@ -115,6 +123,7 @@ HEADERS += \
Settings.h \
SpinBoxDelegate.h \
decorators/ApplicationDecorator.h \
decorators/AutoIndentation.h \
decorators/BetterMultiSelection.h \
decorators/EditorConfigAppDecorator.h \
decorators/SurroundSelection.h \
Expand All @@ -140,7 +149,6 @@ FORMS += \
dialogs/LuaConsoleDock.ui \
dialogs/MacroRunDialog.ui \
dialogs/MacroSaveDialog.ui \
dialogs/WindowListDialog.ui \
dialogs/PreferencesDialog.ui

RESOURCES += \
Expand All @@ -160,3 +168,8 @@ INCLUDEPATH += $$PWD/../lexilla/include

win32-g++:LIBS += libUser32
win32-msvc*:LIBS += User32.lib

OBJECTS_DIR = build/obj
MOC_DIR = build/moc
RCC_DIR = build/qrc
UI_DIR = build/ui
10 changes: 6 additions & 4 deletions src/NotepadNext/NotepadNextApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ NotepadNextApplication::NotepadNextApplication(int &argc, char **argv)
});

// Restore some settings and schedule saving the settings on quit
QSettings settings;
recentFilesListManager->setFileList(settings.value("App/RecentFilesList").toStringList());
QSettings qsettings;

recentFilesListManager->setFileList(qsettings.value("App/RecentFilesList").toStringList());

connect(this, &NotepadNextApplication::aboutToQuit, [=]() {
QSettings settings;
settings.setValue("App/RecentFilesList", recentFilesListManager->fileList());
QSettings qsettings;
qsettings.setValue("App/RecentFilesList", recentFilesListManager->fileList());
});

EditorConfigAppDecorator *ecad = new EditorConfigAppDecorator(this);
Expand Down
47 changes: 47 additions & 0 deletions src/NotepadNext/decorators/AutoIndentation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* This file is part of Notepad Next.
* Copyright 2021 Justin Dailey
*
* Notepad Next is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Notepad Next is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Notepad Next. If not, see <https://www.gnu.org/licenses/>.
*/


#include "AutoIndentation.h"


using namespace Scintilla;

AutoIndentation::AutoIndentation(ScintillaEdit *editor) :
EditorDecorator(editor)
{
}

void AutoIndentation::notify(const NotificationData *pscn)
{
if (pscn->nmhdr.code == Notification::CharAdded) {
const int ch = pscn->ch;
const int eolMode = editor->eOLMode();

if (((eolMode == SC_EOL_CRLF || eolMode == SC_EOL_LF) && ch == '\n') || (eolMode == SC_EOL_CR && ch == '\r')) {
const int currentLine = editor->lineFromPosition(editor->currentPos());
const int previousLine = currentLine - 1;
const int previousIndentation = editor->lineIndentation(previousLine);

if (previousIndentation > 0) {
editor->setLineIndentation(currentLine, previousIndentation);
editor->gotoPos(editor->findColumn(currentLine, previousIndentation));
}
}
}
}
37 changes: 37 additions & 0 deletions src/NotepadNext/decorators/AutoIndentation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of Notepad Next.
* Copyright 2021 Justin Dailey
*
* Notepad Next is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Notepad Next is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Notepad Next. If not, see <https://www.gnu.org/licenses/>.
*/


#ifndef AUTOINDENTATION_H
#define AUTOINDENTATION_H

#include "EditorDecorator.h"


class AutoIndentation : public EditorDecorator
{
Q_OBJECT

public:
AutoIndentation(ScintillaEdit *editor);

public slots:
void notify(const Scintilla::NotificationData *pscn) override;
};

#endif // AUTOINDENTATION_H
Loading

0 comments on commit 007def7

Please sign in to comment.