diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro
index e63a7faa..9ba720db 100644
--- a/RedPandaIDE/RedPandaIDE.pro
+++ b/RedPandaIDE/RedPandaIDE.pro
@@ -82,10 +82,6 @@ SOURCES += \
project.cpp \
projectoptions.cpp \
projecttemplate.cpp \
- qsynedit/Search.cpp \
- qsynedit/SearchBase.cpp \
- qsynedit/SearchRegex.cpp \
- qsynedit/Types.cpp \
settingsdialog/compilerautolinkwidget.cpp \
settingsdialog/debuggeneralwidget.cpp \
settingsdialog/editorautosavewidget.cpp \
@@ -139,22 +135,6 @@ SOURCES += \
iconsmanager.cpp \
main.cpp \
mainwindow.cpp \
- qsynedit/CodeFolding.cpp \
- qsynedit/Constants.cpp \
- qsynedit/KeyStrokes.cpp \
- qsynedit/MiscClasses.cpp \
- qsynedit/MiscProcs.cpp \
- qsynedit/SynEdit.cpp \
- qsynedit/TextBuffer.cpp \
- qsynedit/TextPainter.cpp \
- qsynedit/exporter/synexporter.cpp \
- qsynedit/exporter/synhtmlexporter.cpp \
- qsynedit/exporter/synrtfexporter.cpp \
- qsynedit/highlighter/asm.cpp \
- qsynedit/highlighter/base.cpp \
- qsynedit/highlighter/composition.cpp \
- qsynedit/highlighter/cpp.cpp \
- qsynedit/highlighter/glsl.cpp \
settingsdialog/compilersetdirectorieswidget.cpp \
settingsdialog/compilersetoptionwidget.cpp \
settings.cpp \
@@ -233,9 +213,6 @@ HEADERS += \
project.h \
projectoptions.h \
projecttemplate.h \
- qsynedit/Search.h \
- qsynedit/SearchBase.h \
- qsynedit/SearchRegex.h \
settingsdialog/compilerautolinkwidget.h \
settingsdialog/debuggeneralwidget.h \
settingsdialog/editorautosavewidget.h \
@@ -288,23 +265,6 @@ HEADERS += \
editorlist.h \
iconsmanager.h \
mainwindow.h \
- qsynedit/CodeFolding.h \
- qsynedit/Constants.h \
- qsynedit/KeyStrokes.h \
- qsynedit/MiscClasses.h \
- qsynedit/MiscProcs.h \
- qsynedit/SynEdit.h \
- qsynedit/TextBuffer.h \
- qsynedit/TextPainter.h \
- qsynedit/Types.h \
- qsynedit/exporter/synexporter.h \
- qsynedit/exporter/synhtmlexporter.h \
- qsynedit/exporter/synrtfexporter.h \
- qsynedit/highlighter/asm.h \
- qsynedit/highlighter/base.h \
- qsynedit/highlighter/composition.h \
- qsynedit/highlighter/cpp.h \
- qsynedit/highlighter/glsl.h \
settingsdialog/compilersetdirectorieswidget.h \
settingsdialog/compilersetoptionwidget.h \
settings.h \
@@ -515,9 +475,9 @@ RESOURCES += colorscheme_files
macos: {
# Add needed executables into the main app bundle
bundled_executable.files = \
- $$OUT_PWD/../astyle/astyle \
- $$OUT_PWD/../consolepauser/consolepauser \
- $$OUT_PWD/../redpanda-git-askpass/redpanda-git-askpass.app/Contents/MacOS/redpanda-git-askpass
+ $$OUT_PWD/../tools/astyle/astyle \
+ $$OUT_PWD/../tools/consolepauser/consolepauser \
+ $$OUT_PWD/../tools/redpanda-git-askpass/redpanda-git-askpass.app/Contents/MacOS/redpanda-git-askpass
bundled_executable.path = Contents/MacOS
# Also bundled templates
diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro
index 52501a52..ebad45f6 100644
--- a/Red_Panda_CPP.pro
+++ b/Red_Panda_CPP.pro
@@ -2,23 +2,24 @@ TEMPLATE = subdirs
SUBDIRS += \
RedPandaIDE \
- tools\astyle \
- tools\consolepauser
+ tools/astyle \
+ tools/consolepauser
+ libs/qsynedit
# Add the dependencies so that the RedPandaIDE project can add the depended programs
# into the main app bundle
-RedPandaIDE.depends = tools\astyle tools\consolepauser
+RedPandaIDE.depends = tools/astyle tools/consolepauser libs/qsynedit
win32: {
SUBDIRS += \
- tools\redpanda-win-git-askpass
- RedPandaIDE.depends += tools\redpanda-win-git-askpass
+ tools/redpanda-win-git-askpass
+ RedPandaIDE.depends += tools/redpanda-win-git-askpass
}
unix: {
SUBDIRS += \
- tools\redpanda-git-askpass
- RedPandaIDE.depends += tools\redpanda-git-askpass
+ tools/redpanda-git-askpass
+ RedPandaIDE.depends += tools/redpanda-git-askpass
}
APP_NAME = RedPandaCPP
diff --git a/RedPandaIDE/qsynedit/CodeFolding.cpp b/libs/qsynedit/CodeFolding.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/CodeFolding.cpp
rename to libs/qsynedit/CodeFolding.cpp
diff --git a/RedPandaIDE/qsynedit/CodeFolding.h b/libs/qsynedit/CodeFolding.h
similarity index 100%
rename from RedPandaIDE/qsynedit/CodeFolding.h
rename to libs/qsynedit/CodeFolding.h
diff --git a/RedPandaIDE/qsynedit/Constants.cpp b/libs/qsynedit/Constants.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/Constants.cpp
rename to libs/qsynedit/Constants.cpp
diff --git a/RedPandaIDE/qsynedit/Constants.h b/libs/qsynedit/Constants.h
similarity index 100%
rename from RedPandaIDE/qsynedit/Constants.h
rename to libs/qsynedit/Constants.h
diff --git a/RedPandaIDE/qsynedit/KeyStrokes.cpp b/libs/qsynedit/KeyStrokes.cpp
similarity index 99%
rename from RedPandaIDE/qsynedit/KeyStrokes.cpp
rename to libs/qsynedit/KeyStrokes.cpp
index 93ce86a7..b4c18bcc 100644
--- a/RedPandaIDE/qsynedit/KeyStrokes.cpp
+++ b/libs/qsynedit/KeyStrokes.cpp
@@ -15,6 +15,7 @@
* along with this program. If not, see .
*/
#include "KeyStrokes.h"
+#include "MiscProcs.h"
namespace QSynedit {
SynEditKeyStroke::SynEditKeyStroke()
diff --git a/RedPandaIDE/qsynedit/KeyStrokes.h b/libs/qsynedit/KeyStrokes.h
similarity index 99%
rename from RedPandaIDE/qsynedit/KeyStrokes.h
rename to libs/qsynedit/KeyStrokes.h
index 65a9370d..2bcf0de5 100644
--- a/RedPandaIDE/qsynedit/KeyStrokes.h
+++ b/libs/qsynedit/KeyStrokes.h
@@ -17,10 +17,10 @@
#ifndef SYNEDITKEYSTROKE_H
#define SYNEDITKEYSTROKE_H
-#include "../utils.h"
#include
#include
#include
+#include "MiscClasses.h"
namespace QSynedit {
//****************************************************************************
diff --git a/RedPandaIDE/qsynedit/MiscClasses.cpp b/libs/qsynedit/MiscClasses.cpp
similarity index 95%
rename from RedPandaIDE/qsynedit/MiscClasses.cpp
rename to libs/qsynedit/MiscClasses.cpp
index 176b86c6..b4227a27 100644
--- a/RedPandaIDE/qsynedit/MiscClasses.cpp
+++ b/libs/qsynedit/MiscClasses.cpp
@@ -16,7 +16,9 @@
*/
#include "MiscClasses.h"
#include "algorithm"
+
namespace QSynedit {
+
SynGutter::SynGutter(QObject *parent):
QObject(parent)
{
@@ -334,4 +336,26 @@ void SynGutter::setBorderColor(const QColor &value)
}
}
+BaseError::BaseError(const QString &reason):
+mReason(reason)
+{
+
+}
+
+QString BaseError::reason() const
+{
+ return mReason;
+}
+
+IndexOutOfRange::IndexOutOfRange(int Index):
+BaseError(QObject::tr("Index %1 out of range").arg(Index))
+{
+
+}
+
+FileError::FileError(const QString &reason): BaseError(reason)
+{
+}
+
+
}
diff --git a/RedPandaIDE/qsynedit/MiscClasses.h b/libs/qsynedit/MiscClasses.h
similarity index 90%
rename from RedPandaIDE/qsynedit/MiscClasses.h
rename to libs/qsynedit/MiscClasses.h
index cbf3019c..df8b7f51 100644
--- a/RedPandaIDE/qsynedit/MiscClasses.h
+++ b/libs/qsynedit/MiscClasses.h
@@ -24,6 +24,25 @@
namespace QSynedit {
+class BaseError{
+public:
+ explicit BaseError(const QString& reason) ;
+ QString reason() const;
+
+protected:
+ QString mReason;
+};
+
+class IndexOutOfRange:public BaseError {
+public:
+ explicit IndexOutOfRange(int Index);
+};
+
+class FileError: public BaseError {
+public:
+ explicit FileError(const QString& reason);
+};
+
enum class SynGutterBorderStyle {
None,
Middle,
diff --git a/RedPandaIDE/qsynedit/MiscProcs.cpp b/libs/qsynedit/MiscProcs.cpp
similarity index 76%
rename from RedPandaIDE/qsynedit/MiscProcs.cpp
rename to libs/qsynedit/MiscProcs.cpp
index 0d37a50b..180ac419 100644
--- a/RedPandaIDE/qsynedit/MiscProcs.cpp
+++ b/libs/qsynedit/MiscProcs.cpp
@@ -19,6 +19,8 @@
#include
#include
#include
+#include
+#include
namespace QSynedit {
int minMax(int x, int mi, int ma)
@@ -27,35 +29,6 @@ int minMax(int x, int mi, int ma)
return std::max( x, mi );
}
-bool IsPowerOfTwo(int TabWidth) {
- if (TabWidth<2)
- return false;
- int nW = 2;
- do {
- if (nW >= TabWidth)
- break;
- nW <<= 1;
- } while (nW<0x10000);
- return (nW == TabWidth);
-}
-
-
-bool GetHasTabs(const QString &line, int &CharsBefore)
-{
- bool result = false;
- CharsBefore = 0;
- if (!line.isEmpty()) {
- for (const QChar& ch:line) {
- if (ch == '\t') {
- result = true;
- break;
- }
- CharsBefore ++;
- }
- }
- return result;
-}
-
int getEOL(const QString &Line, int start)
{
if (start<0 || start>=Line.size()) {
@@ -69,7 +42,7 @@ int getEOL(const QString &Line, int start)
return Line.size();
}
-bool InternalEnumHighlighterAttris(PSynHighlighter Highlighter,
+bool internalEnumHighlighterAttris(PSynHighlighter Highlighter,
bool SkipDuplicates,
HighlighterAttriProc highlighterAttriProc,
std::initializer_list& Params,
@@ -106,7 +79,7 @@ bool enumHighlighterAttributes(PSynHighlighter Highlighter, bool SkipDuplicates,
}
SynHighlighterList HighlighterList;
- return InternalEnumHighlighterAttris(Highlighter, SkipDuplicates,
+ return internalEnumHighlighterAttris(Highlighter, SkipDuplicates,
highlighterAttriProc, Params, HighlighterList);
}
@@ -228,4 +201,68 @@ int calSpanLines(const BufferCoord &startPos, const BufferCoord &endPos)
return std::abs(endPos.line - startPos.line+1);
}
+void decodeKey(const int combinedKey, int &key, Qt::KeyboardModifiers &modifiers)
+{
+ modifiers = Qt::NoModifier;
+ if (combinedKey & Qt::ShiftModifier) {
+ modifiers|=Qt::ShiftModifier;
+ }
+ if (combinedKey & Qt::ControlModifier) {
+ modifiers|=Qt::ControlModifier;
+ }
+ if (combinedKey & Qt::AltModifier) {
+ modifiers|=Qt::AltModifier;
+ }
+ if (combinedKey & Qt::MetaModifier) {
+ modifiers|=Qt::MetaModifier;
+ }
+ if (combinedKey & Qt::KeypadModifier) {
+ modifiers|= Qt::KeypadModifier;
+ }
+ key = combinedKey & ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier);
+}
+
+float pointToPixel(float point)
+{
+ return point * screenDPI() / 72;
+}
+
+float pixelToPoint(float pixel)
+{
+ return pixel * 72 / screenDPI();
+}
+
+float pointToPixel(float point, float dpi)
+{
+ return point * dpi / 72;
+}
+
+static int defaultScreenDPI = -1;
+
+int screenDPI()
+{
+ if (defaultScreenDPI<1) {
+ defaultScreenDPI = qApp->primaryScreen()->logicalDotsPerInch();
+ }
+ return defaultScreenDPI;
+}
+
+void setScreenDPI(int dpi)
+{
+ defaultScreenDPI = dpi;
+}
+
+void inflateRect(QRect &rect, int delta)
+{
+ inflateRect(rect,delta,delta);
+}
+
+void inflateRect(QRect &rect, int dx, int dy)
+{
+ rect.setLeft(rect.left()-dx);
+ rect.setRight(rect.right()+dx);
+ rect.setTop(rect.top()-dy);
+ rect.setBottom(rect.bottom()+dy);
+}
+
}
diff --git a/RedPandaIDE/qsynedit/MiscProcs.h b/libs/qsynedit/MiscProcs.h
similarity index 69%
rename from RedPandaIDE/qsynedit/MiscProcs.h
rename to libs/qsynedit/MiscProcs.h
index ddd84743..ad4872ba 100644
--- a/RedPandaIDE/qsynedit/MiscProcs.h
+++ b/libs/qsynedit/MiscProcs.h
@@ -91,6 +91,58 @@ void ensureNotAfter(BufferCoord& cord1, BufferCoord& cord2);
bool isWordChar(const QChar& ch);
+void decodeKey(int combinedKey, int& key, Qt::KeyboardModifiers& modifiers);
+
+int screenDPI();
+void setScreenDPI(int dpi);
+float pointToPixel(float point);
+float pointToPixel(float point, float dpi);
+float pixelToPoint(float pixel);
+
+void inflateRect(QRect& rect, int delta);
+void inflateRect(QRect& rect, int dx, int dy);
+
+
+
+/**
+ * from https://github.com/Microsoft/GSL
+ **/
+
+template
+class final_action
+{
+public:
+ static_assert(!std::is_reference::value && !std::is_const::value &&
+ !std::is_volatile::value,
+ "Final_action should store its callable by value");
+
+ explicit final_action(F f) noexcept : f_(std::move(f)) {}
+
+ final_action(final_action&& other) noexcept
+ : f_(std::move(other.f_)), invoke_(std::exchange(other.invoke_, false))
+ {}
+
+ final_action(const final_action&) = delete;
+ final_action& operator=(const final_action&) = delete;
+ final_action& operator=(final_action&&) = delete;
+
+ ~final_action() noexcept
+ {
+ if (invoke_) f_();
+ }
+
+private:
+ F f_;
+ bool invoke_{true};
+};
+
+template final_action::type>::type>
+finally(F&& f) noexcept
+{
+ return final_action::type>::type>(
+ std::forward(f));
+}
+
}
#endif // MISCPROCS_H
diff --git a/RedPandaIDE/qsynedit/Search.cpp b/libs/qsynedit/Search.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/Search.cpp
rename to libs/qsynedit/Search.cpp
diff --git a/RedPandaIDE/qsynedit/Search.h b/libs/qsynedit/Search.h
similarity index 100%
rename from RedPandaIDE/qsynedit/Search.h
rename to libs/qsynedit/Search.h
diff --git a/RedPandaIDE/qsynedit/SearchBase.cpp b/libs/qsynedit/SearchBase.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/SearchBase.cpp
rename to libs/qsynedit/SearchBase.cpp
diff --git a/RedPandaIDE/qsynedit/SearchBase.h b/libs/qsynedit/SearchBase.h
similarity index 100%
rename from RedPandaIDE/qsynedit/SearchBase.h
rename to libs/qsynedit/SearchBase.h
diff --git a/RedPandaIDE/qsynedit/SearchRegex.cpp b/libs/qsynedit/SearchRegex.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/SearchRegex.cpp
rename to libs/qsynedit/SearchRegex.cpp
diff --git a/RedPandaIDE/qsynedit/SearchRegex.h b/libs/qsynedit/SearchRegex.h
similarity index 100%
rename from RedPandaIDE/qsynedit/SearchRegex.h
rename to libs/qsynedit/SearchRegex.h
diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/libs/qsynedit/SynEdit.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/SynEdit.cpp
rename to libs/qsynedit/SynEdit.cpp
diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/libs/qsynedit/SynEdit.h
similarity index 100%
rename from RedPandaIDE/qsynedit/SynEdit.h
rename to libs/qsynedit/SynEdit.h
diff --git a/RedPandaIDE/qsynedit/TextBuffer.cpp b/libs/qsynedit/TextBuffer.cpp
similarity index 99%
rename from RedPandaIDE/qsynedit/TextBuffer.cpp
rename to libs/qsynedit/TextBuffer.cpp
index c68aaad6..98770ca9 100644
--- a/RedPandaIDE/qsynedit/TextBuffer.cpp
+++ b/libs/qsynedit/TextBuffer.cpp
@@ -22,8 +22,6 @@
#include
#include
#include "SynEdit.h"
-#include "../utils.h"
-#include "../platform.h"
#include
#include
@@ -605,7 +603,7 @@ void SynDocument::loadFromFile(const QString& filename, const QByteArray& encodi
realEncoding = ENCODING_ASCII;
return;
}
- realEncoding = pCharsetInfoManager->getDefaultSystemEncoding();
+ realEncoding = pCharsetInfoManager->getDefaultSystemEncoding();
QList charsets = pCharsetInfoManager->findCharsetByLocale(pCharsetInfoManager->localeName());
if (!charsets.isEmpty()) {
if (tryLoadFileByEncoding(realEncoding,file)) {
diff --git a/RedPandaIDE/qsynedit/TextBuffer.h b/libs/qsynedit/TextBuffer.h
similarity index 99%
rename from RedPandaIDE/qsynedit/TextBuffer.h
rename to libs/qsynedit/TextBuffer.h
index b0ff50c2..d96a7a04 100644
--- a/RedPandaIDE/qsynedit/TextBuffer.h
+++ b/libs/qsynedit/TextBuffer.h
@@ -25,7 +25,6 @@
#include
#include
#include "MiscProcs.h"
-#include "../utils.h"
#include "Types.h"
namespace QSynedit {
diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/libs/qsynedit/TextPainter.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/TextPainter.cpp
rename to libs/qsynedit/TextPainter.cpp
diff --git a/RedPandaIDE/qsynedit/TextPainter.h b/libs/qsynedit/TextPainter.h
similarity index 99%
rename from RedPandaIDE/qsynedit/TextPainter.h
rename to libs/qsynedit/TextPainter.h
index 785e4c0e..0ac31b8b 100644
--- a/RedPandaIDE/qsynedit/TextPainter.h
+++ b/libs/qsynedit/TextPainter.h
@@ -22,7 +22,6 @@
#include
#include "Types.h"
#include "highlighter/base.h"
-#include "../utils.h"
#include "MiscClasses.h"
namespace QSynedit {
diff --git a/RedPandaIDE/qsynedit/Types.cpp b/libs/qsynedit/Types.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/Types.cpp
rename to libs/qsynedit/Types.cpp
diff --git a/RedPandaIDE/qsynedit/Types.h b/libs/qsynedit/Types.h
similarity index 87%
rename from RedPandaIDE/qsynedit/Types.h
rename to libs/qsynedit/Types.h
index dace15fa..e95eaaa2 100644
--- a/RedPandaIDE/qsynedit/Types.h
+++ b/libs/qsynedit/Types.h
@@ -24,6 +24,19 @@
namespace QSynedit {
+
+#define ENCODING_AUTO_DETECT "AUTO"
+#define ENCODING_UTF8 "UTF-8"
+#define ENCODING_UTF8_BOM "UTF-8 BOM"
+#define ENCODING_SYSTEM_DEFAULT "SYSTEM"
+#define ENCODING_ASCII "ASCII"
+
+enum class FileEndingType {
+ Windows,
+ Linux,
+ Mac
+};// Windows: CRLF, UNIX: LF, Mac: CR
+
enum class SynSelectionMode {Normal, Line, Column};
struct BufferCoord {
diff --git a/RedPandaIDE/qsynedit/exporter/synexporter.cpp b/libs/qsynedit/exporter/synexporter.cpp
similarity index 98%
rename from RedPandaIDE/qsynedit/exporter/synexporter.cpp
rename to libs/qsynedit/exporter/synexporter.cpp
index 1d9f2fe1..4c48cdb5 100644
--- a/RedPandaIDE/qsynedit/exporter/synexporter.cpp
+++ b/libs/qsynedit/exporter/synexporter.cpp
@@ -21,11 +21,10 @@
#include
#include
#include
-#include "../../platform.h"
namespace QSynedit {
-SynExporter::SynExporter()
+SynExporter::SynExporter(const QByteArray charset):mCharset(charset)
{
mClipboardFormat = "text/plain";
mFont = QGuiApplication::font();
@@ -33,7 +32,6 @@ SynExporter::SynExporter()
mForegroundColor = QGuiApplication::palette().color(QPalette::Text);
mUseBackground = false;
mExportAsText = false;
- mCharset = pCharsetInfoManager->getDefaultSystemEncoding();
mFileEndingType = FileEndingType::Windows;
clear();
setTitle("");
diff --git a/RedPandaIDE/qsynedit/exporter/synexporter.h b/libs/qsynedit/exporter/synexporter.h
similarity index 99%
rename from RedPandaIDE/qsynedit/exporter/synexporter.h
rename to libs/qsynedit/exporter/synexporter.h
index b6df7bc9..07a8e71a 100644
--- a/RedPandaIDE/qsynedit/exporter/synexporter.h
+++ b/libs/qsynedit/exporter/synexporter.h
@@ -27,7 +27,7 @@ class SynExporter
{
public:
- explicit SynExporter();
+ explicit SynExporter(const QByteArray charset);
/**
* @brief Clears the output buffer and any internal data that relates to the last
diff --git a/RedPandaIDE/qsynedit/exporter/synhtmlexporter.cpp b/libs/qsynedit/exporter/synhtmlexporter.cpp
similarity index 98%
rename from RedPandaIDE/qsynedit/exporter/synhtmlexporter.cpp
rename to libs/qsynedit/exporter/synhtmlexporter.cpp
index f7702feb..43fd701f 100644
--- a/RedPandaIDE/qsynedit/exporter/synhtmlexporter.cpp
+++ b/libs/qsynedit/exporter/synhtmlexporter.cpp
@@ -20,7 +20,8 @@
namespace QSynedit {
-SynHTMLExporter::SynHTMLExporter(int tabSize)
+SynHTMLExporter::SynHTMLExporter(int tabSize,const QByteArray charset):
+ SynExporter(charset)
{
mClipboardFormat = "text/html";
mDefaultFilter = "HTML Documents (*.htm;*.html)|*.htm;*.html";
diff --git a/RedPandaIDE/qsynedit/exporter/synhtmlexporter.h b/libs/qsynedit/exporter/synhtmlexporter.h
similarity index 97%
rename from RedPandaIDE/qsynedit/exporter/synhtmlexporter.h
rename to libs/qsynedit/exporter/synhtmlexporter.h
index 1c889cac..8db4754b 100644
--- a/RedPandaIDE/qsynedit/exporter/synhtmlexporter.h
+++ b/libs/qsynedit/exporter/synhtmlexporter.h
@@ -23,7 +23,7 @@ namespace QSynedit {
class SynHTMLExporter : public SynExporter
{
public:
- SynHTMLExporter(int tabSize);
+ SynHTMLExporter(int tabSize,const QByteArray charset);
bool createHTMLFragment() const;
void setCreateHTMLFragment(bool createHTMLFragment);
diff --git a/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp b/libs/qsynedit/exporter/synrtfexporter.cpp
similarity index 98%
rename from RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp
rename to libs/qsynedit/exporter/synrtfexporter.cpp
index c976940b..1e82feb5 100644
--- a/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp
+++ b/libs/qsynedit/exporter/synrtfexporter.cpp
@@ -17,7 +17,7 @@
#include "synrtfexporter.h"
namespace QSynedit {
-SynRTFExporter::SynRTFExporter():SynExporter()
+SynRTFExporter::SynRTFExporter(const QByteArray charset):SynExporter(charset)
{
mDefaultFilter = "Rich Text Format Documents (*.rtf)|*.rtf";
mClipboardFormat = "application/x-qt-windows-mime;value=\"Rich Format Text\"";
diff --git a/RedPandaIDE/qsynedit/exporter/synrtfexporter.h b/libs/qsynedit/exporter/synrtfexporter.h
similarity index 96%
rename from RedPandaIDE/qsynedit/exporter/synrtfexporter.h
rename to libs/qsynedit/exporter/synrtfexporter.h
index a314d60f..7bb644f3 100644
--- a/RedPandaIDE/qsynedit/exporter/synrtfexporter.h
+++ b/libs/qsynedit/exporter/synrtfexporter.h
@@ -24,7 +24,7 @@ namespace QSynedit {
class SynRTFExporter : public SynExporter
{
public:
- explicit SynRTFExporter();
+ explicit SynRTFExporter(const QByteArray charset);
private:
bool mAttributesChanged;
QList mListColors;
diff --git a/RedPandaIDE/qsynedit/highlighter/asm.cpp b/libs/qsynedit/highlighter/asm.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/asm.cpp
rename to libs/qsynedit/highlighter/asm.cpp
diff --git a/RedPandaIDE/qsynedit/highlighter/asm.h b/libs/qsynedit/highlighter/asm.h
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/asm.h
rename to libs/qsynedit/highlighter/asm.h
diff --git a/RedPandaIDE/qsynedit/highlighter/base.cpp b/libs/qsynedit/highlighter/base.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/base.cpp
rename to libs/qsynedit/highlighter/base.cpp
diff --git a/RedPandaIDE/qsynedit/highlighter/base.h b/libs/qsynedit/highlighter/base.h
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/base.h
rename to libs/qsynedit/highlighter/base.h
diff --git a/RedPandaIDE/qsynedit/highlighter/composition.cpp b/libs/qsynedit/highlighter/composition.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/composition.cpp
rename to libs/qsynedit/highlighter/composition.cpp
diff --git a/RedPandaIDE/qsynedit/highlighter/composition.h b/libs/qsynedit/highlighter/composition.h
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/composition.h
rename to libs/qsynedit/highlighter/composition.h
diff --git a/RedPandaIDE/qsynedit/highlighter/cpp.cpp b/libs/qsynedit/highlighter/cpp.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/cpp.cpp
rename to libs/qsynedit/highlighter/cpp.cpp
diff --git a/RedPandaIDE/qsynedit/highlighter/cpp.h b/libs/qsynedit/highlighter/cpp.h
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/cpp.h
rename to libs/qsynedit/highlighter/cpp.h
diff --git a/RedPandaIDE/qsynedit/highlighter/glsl.cpp b/libs/qsynedit/highlighter/glsl.cpp
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/glsl.cpp
rename to libs/qsynedit/highlighter/glsl.cpp
diff --git a/RedPandaIDE/qsynedit/highlighter/glsl.h b/libs/qsynedit/highlighter/glsl.h
similarity index 100%
rename from RedPandaIDE/qsynedit/highlighter/glsl.h
rename to libs/qsynedit/highlighter/glsl.h
diff --git a/libs/qsynedit/qsynedit.pro b/libs/qsynedit/qsynedit.pro
new file mode 100644
index 00000000..14261a4e
--- /dev/null
+++ b/libs/qsynedit/qsynedit.pro
@@ -0,0 +1,61 @@
+TEMPLATE = lib
+QT += core gui
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++17
+CONFIG += nokey
+
+win32: {
+DEFINES += _WIN32_WINNT=0x0601
+}
+
+gcc {
+ QMAKE_CXXFLAGS_RELEASE += -Werror=return-type
+ QMAKE_CXXFLAGS_DEBUG += -Werror=return-type
+}
+
+msvc {
+ DEFINES += NOMINMAX
+}
+
+SOURCES += CodeFolding.cpp \
+ Constants.cpp \
+ KeyStrokes.cpp \
+ MiscClasses.cpp \
+ MiscProcs.cpp \
+ SynEdit.cpp \
+ TextBuffer.cpp \
+ TextPainter.cpp \
+ exporter/synexporter.cpp \
+ exporter/synhtmlexporter.cpp \
+ exporter/synrtfexporter.cpp \
+ highlighter/asm.cpp \
+ highlighter/base.cpp \
+ highlighter/composition.cpp \
+ highlighter/cpp.cpp \
+ highlighter/glsl.cpp \
+ Search.cpp \
+ SearchBase.cpp \
+ SearchRegex.cpp \
+ Types.cpp
+
+HEADERS += Search.h \
+ SearchBase.h \
+ SearchRegex.h \
+ CodeFolding.h \
+ Constants.h \
+ KeyStrokes.h \
+ MiscClasses.h \
+ MiscProcs.h \
+ SynEdit.h \
+ TextBuffer.h \
+ TextPainter.h \
+ Types.h \
+ exporter/synexporter.h \
+ exporter/synhtmlexporter.h \
+ exporter/synrtfexporter.h \
+ highlighter/asm.h \
+ highlighter/base.h \
+ highlighter/composition.h \
+ highlighter/cpp.h \
+ highlighter/glsl.h \
diff --git a/RedPandaIDE/platform.cpp b/libs/redpanda_qt_utils/charsetinfo.cpp
similarity index 100%
rename from RedPandaIDE/platform.cpp
rename to libs/redpanda_qt_utils/charsetinfo.cpp
diff --git a/RedPandaIDE/platform.h b/libs/redpanda_qt_utils/charsetinfo.h
similarity index 96%
rename from RedPandaIDE/platform.h
rename to libs/redpanda_qt_utils/charsetinfo.h
index 63aa2a7a..e7be24bb 100644
--- a/RedPandaIDE/platform.h
+++ b/libs/redpanda_qt_utils/charsetinfo.h
@@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-#ifndef PLATFORM_H
-#define PLATFORM_H
+#ifndef QT_UTILS_CHARSETINFO_H
+#define QT_UTILS_CHARSETINFO_H
#include
#include
#include
diff --git a/libs/redpanda_qt_utils/redpand_qt_utils.pro b/libs/redpanda_qt_utils/redpand_qt_utils.pro
new file mode 100644
index 00000000..2f1a6df1
--- /dev/null
+++ b/libs/redpanda_qt_utils/redpand_qt_utils.pro
@@ -0,0 +1,26 @@
+TEMPLATE = lib
+QT += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++17
+CONFIG += nokey
+
+win32: {
+DEFINES += _WIN32_WINNT=0x0601
+}
+
+gcc {
+ QMAKE_CXXFLAGS_RELEASE += -Werror=return-type
+ QMAKE_CXXFLAGS_DEBUG += -Werror=return-type
+}
+
+msvc {
+ DEFINES += NOMINMAX
+}
+
+SOURCES += redpanda_utils.cpp \
+ charsetinfo.cpp
+
+HEADERS += redpanda_utils.h \
+ charsetinfo.h
\ No newline at end of file
diff --git a/RedPandaIDE/utils.cpp b/libs/redpanda_qt_utils/redpanda_utils.cpp
similarity index 100%
rename from RedPandaIDE/utils.cpp
rename to libs/redpanda_qt_utils/redpanda_utils.cpp
diff --git a/RedPandaIDE/utils.h b/libs/redpanda_qt_utils/redpanda_utils.h
similarity index 99%
rename from RedPandaIDE/utils.h
rename to libs/redpanda_qt_utils/redpanda_utils.h
index dcaa24a1..5baef2ea 100644
--- a/RedPandaIDE/utils.h
+++ b/libs/redpanda_qt_utils/redpanda_utils.h
@@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-#ifndef UTILS_H
-#define UTILS_H
+#ifndef QT_UTILS_UTILS_H
+#define QT_UTILS_UTILS_H
#include
#include
#include
@@ -27,13 +27,13 @@
#include
#include "SimpleIni.h"
-using SimpleIni = CSimpleIniA;
-using PSimpleIni = std::shared_ptr;
-
class QByteArray;
class QTextStream;
class QTextCodec;
+using SimpleIni = CSimpleIniA;
+using PSimpleIni = std::shared_ptr;
+
#define ENCODING_AUTO_DETECT "AUTO"
#define ENCODING_UTF8 "UTF-8"
#define ENCODING_UTF8_BOM "UTF-8 BOM"