work save
This commit is contained in:
parent
a727929e88
commit
6f4b24c753
|
@ -82,10 +82,6 @@ SOURCES += \
|
||||||
project.cpp \
|
project.cpp \
|
||||||
projectoptions.cpp \
|
projectoptions.cpp \
|
||||||
projecttemplate.cpp \
|
projecttemplate.cpp \
|
||||||
qsynedit/Search.cpp \
|
|
||||||
qsynedit/SearchBase.cpp \
|
|
||||||
qsynedit/SearchRegex.cpp \
|
|
||||||
qsynedit/Types.cpp \
|
|
||||||
settingsdialog/compilerautolinkwidget.cpp \
|
settingsdialog/compilerautolinkwidget.cpp \
|
||||||
settingsdialog/debuggeneralwidget.cpp \
|
settingsdialog/debuggeneralwidget.cpp \
|
||||||
settingsdialog/editorautosavewidget.cpp \
|
settingsdialog/editorautosavewidget.cpp \
|
||||||
|
@ -139,22 +135,6 @@ SOURCES += \
|
||||||
iconsmanager.cpp \
|
iconsmanager.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.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/compilersetdirectorieswidget.cpp \
|
||||||
settingsdialog/compilersetoptionwidget.cpp \
|
settingsdialog/compilersetoptionwidget.cpp \
|
||||||
settings.cpp \
|
settings.cpp \
|
||||||
|
@ -233,9 +213,6 @@ HEADERS += \
|
||||||
project.h \
|
project.h \
|
||||||
projectoptions.h \
|
projectoptions.h \
|
||||||
projecttemplate.h \
|
projecttemplate.h \
|
||||||
qsynedit/Search.h \
|
|
||||||
qsynedit/SearchBase.h \
|
|
||||||
qsynedit/SearchRegex.h \
|
|
||||||
settingsdialog/compilerautolinkwidget.h \
|
settingsdialog/compilerautolinkwidget.h \
|
||||||
settingsdialog/debuggeneralwidget.h \
|
settingsdialog/debuggeneralwidget.h \
|
||||||
settingsdialog/editorautosavewidget.h \
|
settingsdialog/editorautosavewidget.h \
|
||||||
|
@ -288,23 +265,6 @@ HEADERS += \
|
||||||
editorlist.h \
|
editorlist.h \
|
||||||
iconsmanager.h \
|
iconsmanager.h \
|
||||||
mainwindow.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/compilersetdirectorieswidget.h \
|
||||||
settingsdialog/compilersetoptionwidget.h \
|
settingsdialog/compilersetoptionwidget.h \
|
||||||
settings.h \
|
settings.h \
|
||||||
|
@ -515,9 +475,9 @@ RESOURCES += colorscheme_files
|
||||||
macos: {
|
macos: {
|
||||||
# Add needed executables into the main app bundle
|
# Add needed executables into the main app bundle
|
||||||
bundled_executable.files = \
|
bundled_executable.files = \
|
||||||
$$OUT_PWD/../astyle/astyle \
|
$$OUT_PWD/../tools/astyle/astyle \
|
||||||
$$OUT_PWD/../consolepauser/consolepauser \
|
$$OUT_PWD/../tools/consolepauser/consolepauser \
|
||||||
$$OUT_PWD/../redpanda-git-askpass/redpanda-git-askpass.app/Contents/MacOS/redpanda-git-askpass
|
$$OUT_PWD/../tools/redpanda-git-askpass/redpanda-git-askpass.app/Contents/MacOS/redpanda-git-askpass
|
||||||
bundled_executable.path = Contents/MacOS
|
bundled_executable.path = Contents/MacOS
|
||||||
|
|
||||||
# Also bundled templates
|
# Also bundled templates
|
||||||
|
|
|
@ -2,23 +2,24 @@ TEMPLATE = subdirs
|
||||||
|
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
RedPandaIDE \
|
RedPandaIDE \
|
||||||
tools\astyle \
|
tools/astyle \
|
||||||
tools\consolepauser
|
tools/consolepauser
|
||||||
|
libs/qsynedit
|
||||||
|
|
||||||
# Add the dependencies so that the RedPandaIDE project can add the depended programs
|
# Add the dependencies so that the RedPandaIDE project can add the depended programs
|
||||||
# into the main app bundle
|
# into the main app bundle
|
||||||
RedPandaIDE.depends = tools\astyle tools\consolepauser
|
RedPandaIDE.depends = tools/astyle tools/consolepauser libs/qsynedit
|
||||||
|
|
||||||
win32: {
|
win32: {
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
tools\redpanda-win-git-askpass
|
tools/redpanda-win-git-askpass
|
||||||
RedPandaIDE.depends += tools\redpanda-win-git-askpass
|
RedPandaIDE.depends += tools/redpanda-win-git-askpass
|
||||||
}
|
}
|
||||||
|
|
||||||
unix: {
|
unix: {
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
tools\redpanda-git-askpass
|
tools/redpanda-git-askpass
|
||||||
RedPandaIDE.depends += tools\redpanda-git-askpass
|
RedPandaIDE.depends += tools/redpanda-git-askpass
|
||||||
}
|
}
|
||||||
|
|
||||||
APP_NAME = RedPandaCPP
|
APP_NAME = RedPandaCPP
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "KeyStrokes.h"
|
#include "KeyStrokes.h"
|
||||||
|
#include "MiscProcs.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
SynEditKeyStroke::SynEditKeyStroke()
|
SynEditKeyStroke::SynEditKeyStroke()
|
|
@ -17,10 +17,10 @@
|
||||||
#ifndef SYNEDITKEYSTROKE_H
|
#ifndef SYNEDITKEYSTROKE_H
|
||||||
#define SYNEDITKEYSTROKE_H
|
#define SYNEDITKEYSTROKE_H
|
||||||
|
|
||||||
#include "../utils.h"
|
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "MiscClasses.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
//****************************************************************************
|
//****************************************************************************
|
|
@ -16,7 +16,9 @@
|
||||||
*/
|
*/
|
||||||
#include "MiscClasses.h"
|
#include "MiscClasses.h"
|
||||||
#include "algorithm"
|
#include "algorithm"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
SynGutter::SynGutter(QObject *parent):
|
SynGutter::SynGutter(QObject *parent):
|
||||||
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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,6 +24,25 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
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 {
|
enum class SynGutterBorderStyle {
|
||||||
None,
|
None,
|
||||||
Middle,
|
Middle,
|
|
@ -19,6 +19,8 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
int minMax(int x, int mi, int ma)
|
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 );
|
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)
|
int getEOL(const QString &Line, int start)
|
||||||
{
|
{
|
||||||
if (start<0 || start>=Line.size()) {
|
if (start<0 || start>=Line.size()) {
|
||||||
|
@ -69,7 +42,7 @@ int getEOL(const QString &Line, int start)
|
||||||
return Line.size();
|
return Line.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InternalEnumHighlighterAttris(PSynHighlighter Highlighter,
|
bool internalEnumHighlighterAttris(PSynHighlighter Highlighter,
|
||||||
bool SkipDuplicates,
|
bool SkipDuplicates,
|
||||||
HighlighterAttriProc highlighterAttriProc,
|
HighlighterAttriProc highlighterAttriProc,
|
||||||
std::initializer_list<void *>& Params,
|
std::initializer_list<void *>& Params,
|
||||||
|
@ -106,7 +79,7 @@ bool enumHighlighterAttributes(PSynHighlighter Highlighter, bool SkipDuplicates,
|
||||||
}
|
}
|
||||||
|
|
||||||
SynHighlighterList HighlighterList;
|
SynHighlighterList HighlighterList;
|
||||||
return InternalEnumHighlighterAttris(Highlighter, SkipDuplicates,
|
return internalEnumHighlighterAttris(Highlighter, SkipDuplicates,
|
||||||
highlighterAttriProc, Params, HighlighterList);
|
highlighterAttriProc, Params, HighlighterList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,4 +201,68 @@ int calSpanLines(const BufferCoord &startPos, const BufferCoord &endPos)
|
||||||
return std::abs(endPos.line - startPos.line+1);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -91,6 +91,58 @@ void ensureNotAfter(BufferCoord& cord1, BufferCoord& cord2);
|
||||||
|
|
||||||
bool isWordChar(const QChar& ch);
|
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 F>
|
||||||
|
class final_action
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static_assert(!std::is_reference<F>::value && !std::is_const<F>::value &&
|
||||||
|
!std::is_volatile<F>::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 <class F> final_action<typename std::remove_cv<typename std::remove_reference<F>::type>::type>
|
||||||
|
finally(F&& f) noexcept
|
||||||
|
{
|
||||||
|
return final_action<typename std::remove_cv<typename std::remove_reference<F>::type>::type>(
|
||||||
|
std::forward<F>(f));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MISCPROCS_H
|
#endif // MISCPROCS_H
|
|
@ -22,8 +22,6 @@
|
||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "SynEdit.h"
|
#include "SynEdit.h"
|
||||||
#include "../utils.h"
|
|
||||||
#include "../platform.h"
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
@ -605,7 +603,7 @@ void SynDocument::loadFromFile(const QString& filename, const QByteArray& encodi
|
||||||
realEncoding = ENCODING_ASCII;
|
realEncoding = ENCODING_ASCII;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
realEncoding = pCharsetInfoManager->getDefaultSystemEncoding();
|
realEncoding = pCharsetInfoManager->getDefaultSystemEncoding();
|
||||||
QList<PCharsetInfo> charsets = pCharsetInfoManager->findCharsetByLocale(pCharsetInfoManager->localeName());
|
QList<PCharsetInfo> charsets = pCharsetInfoManager->findCharsetByLocale(pCharsetInfoManager->localeName());
|
||||||
if (!charsets.isEmpty()) {
|
if (!charsets.isEmpty()) {
|
||||||
if (tryLoadFileByEncoding(realEncoding,file)) {
|
if (tryLoadFileByEncoding(realEncoding,file)) {
|
|
@ -25,7 +25,6 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include "MiscProcs.h"
|
#include "MiscProcs.h"
|
||||||
#include "../utils.h"
|
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
|
@ -22,7 +22,6 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
#include "highlighter/base.h"
|
#include "highlighter/base.h"
|
||||||
#include "../utils.h"
|
|
||||||
#include "MiscClasses.h"
|
#include "MiscClasses.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
|
@ -24,6 +24,19 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
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};
|
enum class SynSelectionMode {Normal, Line, Column};
|
||||||
|
|
||||||
struct BufferCoord {
|
struct BufferCoord {
|
|
@ -21,11 +21,10 @@
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include "../../platform.h"
|
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
SynExporter::SynExporter()
|
SynExporter::SynExporter(const QByteArray charset):mCharset(charset)
|
||||||
{
|
{
|
||||||
mClipboardFormat = "text/plain";
|
mClipboardFormat = "text/plain";
|
||||||
mFont = QGuiApplication::font();
|
mFont = QGuiApplication::font();
|
||||||
|
@ -33,7 +32,6 @@ SynExporter::SynExporter()
|
||||||
mForegroundColor = QGuiApplication::palette().color(QPalette::Text);
|
mForegroundColor = QGuiApplication::palette().color(QPalette::Text);
|
||||||
mUseBackground = false;
|
mUseBackground = false;
|
||||||
mExportAsText = false;
|
mExportAsText = false;
|
||||||
mCharset = pCharsetInfoManager->getDefaultSystemEncoding();
|
|
||||||
mFileEndingType = FileEndingType::Windows;
|
mFileEndingType = FileEndingType::Windows;
|
||||||
clear();
|
clear();
|
||||||
setTitle("");
|
setTitle("");
|
|
@ -27,7 +27,7 @@ class SynExporter
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SynExporter();
|
explicit SynExporter(const QByteArray charset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Clears the output buffer and any internal data that relates to the last
|
* @brief Clears the output buffer and any internal data that relates to the last
|
|
@ -20,7 +20,8 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
SynHTMLExporter::SynHTMLExporter(int tabSize)
|
SynHTMLExporter::SynHTMLExporter(int tabSize,const QByteArray charset):
|
||||||
|
SynExporter(charset)
|
||||||
{
|
{
|
||||||
mClipboardFormat = "text/html";
|
mClipboardFormat = "text/html";
|
||||||
mDefaultFilter = "HTML Documents (*.htm;*.html)|*.htm;*.html";
|
mDefaultFilter = "HTML Documents (*.htm;*.html)|*.htm;*.html";
|
|
@ -23,7 +23,7 @@ namespace QSynedit {
|
||||||
class SynHTMLExporter : public SynExporter
|
class SynHTMLExporter : public SynExporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SynHTMLExporter(int tabSize);
|
SynHTMLExporter(int tabSize,const QByteArray charset);
|
||||||
bool createHTMLFragment() const;
|
bool createHTMLFragment() const;
|
||||||
void setCreateHTMLFragment(bool createHTMLFragment);
|
void setCreateHTMLFragment(bool createHTMLFragment);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "synrtfexporter.h"
|
#include "synrtfexporter.h"
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
SynRTFExporter::SynRTFExporter():SynExporter()
|
SynRTFExporter::SynRTFExporter(const QByteArray charset):SynExporter(charset)
|
||||||
{
|
{
|
||||||
mDefaultFilter = "Rich Text Format Documents (*.rtf)|*.rtf";
|
mDefaultFilter = "Rich Text Format Documents (*.rtf)|*.rtf";
|
||||||
mClipboardFormat = "application/x-qt-windows-mime;value=\"Rich Format Text\"";
|
mClipboardFormat = "application/x-qt-windows-mime;value=\"Rich Format Text\"";
|
|
@ -24,7 +24,7 @@ namespace QSynedit {
|
||||||
class SynRTFExporter : public SynExporter
|
class SynRTFExporter : public SynExporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SynRTFExporter();
|
explicit SynRTFExporter(const QByteArray charset);
|
||||||
private:
|
private:
|
||||||
bool mAttributesChanged;
|
bool mAttributesChanged;
|
||||||
QList<QColor> mListColors;
|
QList<QColor> mListColors;
|
|
@ -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 \
|
|
@ -14,8 +14,8 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifndef PLATFORM_H
|
#ifndef QT_UTILS_CHARSETINFO_H
|
||||||
#define PLATFORM_H
|
#define QT_UTILS_CHARSETINFO_H
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <memory>
|
#include <memory>
|
|
@ -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
|
|
@ -14,8 +14,8 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifndef UTILS_H
|
#ifndef QT_UTILS_UTILS_H
|
||||||
#define UTILS_H
|
#define QT_UTILS_UTILS_H
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
@ -27,13 +27,13 @@
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
#include "SimpleIni.h"
|
#include "SimpleIni.h"
|
||||||
|
|
||||||
using SimpleIni = CSimpleIniA;
|
|
||||||
using PSimpleIni = std::shared_ptr<SimpleIni>;
|
|
||||||
|
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
class QTextStream;
|
class QTextStream;
|
||||||
class QTextCodec;
|
class QTextCodec;
|
||||||
|
|
||||||
|
using SimpleIni = CSimpleIniA;
|
||||||
|
using PSimpleIni = std::shared_ptr<SimpleIni>;
|
||||||
|
|
||||||
#define ENCODING_AUTO_DETECT "AUTO"
|
#define ENCODING_AUTO_DETECT "AUTO"
|
||||||
#define ENCODING_UTF8 "UTF-8"
|
#define ENCODING_UTF8 "UTF-8"
|
||||||
#define ENCODING_UTF8_BOM "UTF-8 BOM"
|
#define ENCODING_UTF8_BOM "UTF-8 BOM"
|
Loading…
Reference in New Issue