|
@@ -11,7 +11,9 @@
|
|
#include <QColorDialog>
|
|
#include <QColorDialog>
|
|
#include <QMessageBox>
|
|
#include <QMessageBox>
|
|
#include <QSpinBox>
|
|
#include <QSpinBox>
|
|
-//#include <QDebug>
|
|
|
|
|
|
+#include <Qsci/qscilexerglobal.h>
|
|
|
|
+
|
|
|
|
+#include <QDebug>
|
|
#include <QDir>
|
|
#include <QDir>
|
|
|
|
|
|
#if 0
|
|
#if 0
|
|
@@ -37,43 +39,27 @@ enum LangType {
|
|
};
|
|
};
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-static const QColor blackColor(Qt::black);
|
|
|
|
-static const QColor lightColor(0xdedede);
|
|
|
|
-
|
|
|
|
-static const QColor blackColor1(0x0000ff);
|
|
|
|
-static const QColor lightColor1(0xffaa00);
|
|
|
|
-
|
|
|
|
-//C++注释的默认颜色,不显眼
|
|
|
|
-static const QColor blackColor2(0x007f00);
|
|
|
|
-static const QColor lightColor2(0x009000);
|
|
|
|
-
|
|
|
|
-static const QColor blackColor3(0x7f7f00);
|
|
|
|
-static const QColor lightColor3(0xfca287);
|
|
|
|
-
|
|
|
|
-static const QColor blackColor4(0x8000ff);
|
|
|
|
-static const QColor lightColor4(0xffaa00);
|
|
|
|
-
|
|
|
|
-static const QColor blackColor5(0x007f7f);
|
|
|
|
-static const QColor lightColor5(0xaaff7f);
|
|
|
|
-
|
|
|
|
-static const QColor blackColor6(0x7f007f);
|
|
|
|
-static const QColor lightColor6(0x00ffff);
|
|
|
|
-
|
|
|
|
-QMap<QString, QColor> QtLangSet::s_darkColorMap;
|
|
|
|
-
|
|
|
|
-static void initDarkColorMap()
|
|
|
|
-{
|
|
|
|
- if (QtLangSet::s_darkColorMap.isEmpty())
|
|
|
|
- {
|
|
|
|
- QtLangSet::s_darkColorMap.insert(blackColor.name(), lightColor);
|
|
|
|
- QtLangSet::s_darkColorMap.insert(blackColor1.name(), lightColor1);
|
|
|
|
- QtLangSet::s_darkColorMap.insert(blackColor2.name(), lightColor2);
|
|
|
|
- QtLangSet::s_darkColorMap.insert(blackColor3.name(), lightColor3);
|
|
|
|
- QtLangSet::s_darkColorMap.insert(blackColor4.name(), lightColor4);
|
|
|
|
- QtLangSet::s_darkColorMap.insert(blackColor5.name(), lightColor5);
|
|
|
|
- QtLangSet::s_darkColorMap.insert(blackColor6.name(), lightColor6);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+//static const QColor blackColor(Qt::black);
|
|
|
|
+//static const QColor lightColor(0xdedede);
|
|
|
|
+//
|
|
|
|
+//static const QColor blackColor1(0x0000ff);
|
|
|
|
+//static const QColor lightColor1(0xffaa00);
|
|
|
|
+//
|
|
|
|
+////C++注释的默认颜色,不显眼
|
|
|
|
+//static const QColor blackColor2(0x007f00);
|
|
|
|
+//static const QColor lightColor2(0xaaff7f);
|
|
|
|
+//
|
|
|
|
+//static const QColor blackColor3(0x7f7f00);
|
|
|
|
+//static const QColor lightColor3(0xfca287);
|
|
|
|
+//
|
|
|
|
+//static const QColor blackColor4(0x8000ff);
|
|
|
|
+//static const QColor lightColor4(0xffaa00);
|
|
|
|
+//
|
|
|
|
+//static const QColor blackColor5(0x007f7f);
|
|
|
|
+//static const QColor lightColor5(0xaaff7f);
|
|
|
|
+//
|
|
|
|
+//static const QColor blackColor6(0x7f007f);
|
|
|
|
+//static const QColor lightColor6(0x00ffff);
|
|
|
|
|
|
QtLangSet::QtLangSet(QString initTag, QWidget *parent)
|
|
QtLangSet::QtLangSet(QString initTag, QWidget *parent)
|
|
: QMainWindow(parent), m_selectLexer(nullptr), m_selectStyleId(0), m_isStyleChange(false),m_isStyleChildChange(false), m_initShowLexerTag(initTag), m_previousSysLangItem(nullptr),m_isGlobelItem(false)
|
|
: QMainWindow(parent), m_selectLexer(nullptr), m_selectStyleId(0), m_isStyleChange(false),m_isStyleChildChange(false), m_initShowLexerTag(initTag), m_previousSysLangItem(nullptr),m_isGlobelItem(false)
|
|
@@ -83,7 +69,11 @@ QtLangSet::QtLangSet(QString initTag, QWidget *parent)
|
|
initUserDefineLangList();
|
|
initUserDefineLangList();
|
|
|
|
|
|
startSignSlot();
|
|
startSignSlot();
|
|
- initDarkColorMap();
|
|
|
|
|
|
+ //initDarkColorMap();
|
|
|
|
+
|
|
|
|
+ m_themesId = StyleSet::getCurrentSytleId();
|
|
|
|
+ m_lastThemesId = -1;
|
|
|
|
+ ui.mainThemesCbox->setCurrentIndex(m_themesId);
|
|
}
|
|
}
|
|
|
|
|
|
QtLangSet::~QtLangSet()
|
|
QtLangSet::~QtLangSet()
|
|
@@ -122,8 +112,13 @@ void QtLangSet::startSignSlot()
|
|
//开始本来使用的是QListWidget::currentItemChanged信号,但是发现该信号存在莫名其妙的触发机制。
|
|
//开始本来使用的是QListWidget::currentItemChanged信号,但是发现该信号存在莫名其妙的触发机制。
|
|
//估计是QT5.12的bug。所以换成itemClicked信号
|
|
//估计是QT5.12的bug。所以换成itemClicked信号
|
|
connect(ui.langListWidget, &QListWidget::itemClicked, this, &QtLangSet::slot_itemSelect);
|
|
connect(ui.langListWidget, &QListWidget::itemClicked, this, &QtLangSet::slot_itemSelect);
|
|
|
|
+ connect(ui.langListWidget, &QListWidget::currentRowChanged, this, &QtLangSet::slot_langListCurRowChanged);
|
|
|
|
+
|
|
connect(ui.userLangListWidget, &QListWidget::itemClicked, this, &QtLangSet::slot_userLangItemSelect);
|
|
connect(ui.userLangListWidget, &QListWidget::itemClicked, this, &QtLangSet::slot_userLangItemSelect);
|
|
|
|
+
|
|
|
|
+
|
|
connect(ui.styleListWidget, &QListWidget::itemClicked, this, &QtLangSet::slot_styleItemSelect);
|
|
connect(ui.styleListWidget, &QListWidget::itemClicked, this, &QtLangSet::slot_styleItemSelect);
|
|
|
|
+ connect(ui.styleListWidget, &QListWidget::currentRowChanged, this, &QtLangSet::slot_styleListCurRowChanged);
|
|
|
|
|
|
connect(ui.boldCheckBox, &QCheckBox::stateChanged, this, &QtLangSet::slot_fontBoldChange);
|
|
connect(ui.boldCheckBox, &QCheckBox::stateChanged, this, &QtLangSet::slot_fontBoldChange);
|
|
connect(ui.italicCheckBox, &QCheckBox::stateChanged, this, &QtLangSet::slot_fontItalicChange);
|
|
connect(ui.italicCheckBox, &QCheckBox::stateChanged, this, &QtLangSet::slot_fontItalicChange);
|
|
@@ -181,9 +176,31 @@ void QtLangSet::slot_fontBoldChange(int state)
|
|
|
|
|
|
if (m_isGlobelItem)
|
|
if (m_isGlobelItem)
|
|
{
|
|
{
|
|
- if (ui.useGbFontBold->isChecked())
|
|
|
|
|
|
+ if (ui.useGlobalFont->isVisible() && ui.useGbFontBold->isChecked())
|
|
{
|
|
{
|
|
slot_useAlobalFontBold(true);
|
|
slot_useAlobalFontBold(true);
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+ }
|
|
|
|
+ else if (ui.useGlobalFont->isVisible() && !ui.useGbFontBold->isChecked())
|
|
|
|
+ {
|
|
|
|
+ //保存全局样式第一条样式本身
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+ }
|
|
|
|
+ else if (!ui.useGlobalFont->isVisible())
|
|
|
|
+ {
|
|
|
|
+ //全局非第一个样式,修改当前全局字体大小
|
|
|
|
+ //全局样式的非第一个
|
|
|
|
+ setGlobalFont(m_selectStyleId, m_curStyleData.font);
|
|
|
|
+
|
|
|
|
+ //保存全局样式第一条样式本身
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+
|
|
|
|
+ //这里就是全局的样式。通知当前所有的编辑框,去修改他们本身的全局样式
|
|
|
|
+ CCNotePad* pMainNote = dynamic_cast<CCNotePad*>(parent());
|
|
|
|
+ if (pMainNote != nullptr)
|
|
|
|
+ {
|
|
|
|
+ pMainNote->setGlobalFont(m_selectStyleId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -206,9 +223,29 @@ void QtLangSet::slot_fontItalicChange(int state)
|
|
m_isStyleChange = true;
|
|
m_isStyleChange = true;
|
|
if (m_isGlobelItem)
|
|
if (m_isGlobelItem)
|
|
{
|
|
{
|
|
- if (ui.useGbFontItalic->isChecked())
|
|
|
|
|
|
+ if (ui.useGlobalFont->isVisible() && ui.useGbFontItalic->isChecked())
|
|
{
|
|
{
|
|
slot_useAlobalFontItalic(true);
|
|
slot_useAlobalFontItalic(true);
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+ }
|
|
|
|
+ else if (ui.useGlobalFont->isVisible() && !ui.useGbFontItalic->isChecked())
|
|
|
|
+ {
|
|
|
|
+ //保存全局样式第一条样式本身
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+ }
|
|
|
|
+ else if (!ui.useGlobalFont->isVisible())
|
|
|
|
+ {
|
|
|
|
+ //全局非第一个样式,修改当前全局字体大小
|
|
|
|
+ //全局样式的非第一个
|
|
|
|
+ setGlobalFont(m_selectStyleId, m_curStyleData.font);
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+
|
|
|
|
+ //这里就是全局的样式。通知当前所有的编辑框,去修改他们本身的全局样式
|
|
|
|
+ CCNotePad* pMainNote = dynamic_cast<CCNotePad*>(parent());
|
|
|
|
+ if (pMainNote != nullptr)
|
|
|
|
+ {
|
|
|
|
+ pMainNote->setGlobalFont(m_selectStyleId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -231,9 +268,29 @@ void QtLangSet::slot_fontUnderlineChange(int state)
|
|
m_isStyleChange = true;
|
|
m_isStyleChange = true;
|
|
if (m_isGlobelItem)
|
|
if (m_isGlobelItem)
|
|
{
|
|
{
|
|
- if (ui.useGbFontUnderline->isChecked())
|
|
|
|
|
|
+ if (ui.useGlobalFont->isVisible() && ui.useGbFontUnderline->isChecked())
|
|
{
|
|
{
|
|
slot_useAlobalFontUnderline(true);
|
|
slot_useAlobalFontUnderline(true);
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+ }
|
|
|
|
+ else if (ui.useGlobalFont->isVisible() && !ui.useGbFontUnderline->isChecked())
|
|
|
|
+ {
|
|
|
|
+ //保存全局样式第一条样式本身
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+ }
|
|
|
|
+ else if (!ui.useGlobalFont->isVisible())
|
|
|
|
+ {
|
|
|
|
+ //全局非第一个样式,修改当前全局字体大小
|
|
|
|
+ //全局样式的非第一个
|
|
|
|
+ setGlobalFont(m_selectStyleId, m_curStyleData.font);
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+
|
|
|
|
+ //这里就是全局的样式。通知当前所有的编辑框,去修改他们本身的全局样式
|
|
|
|
+ CCNotePad* pMainNote = dynamic_cast<CCNotePad*>(parent());
|
|
|
|
+ if (pMainNote != nullptr)
|
|
|
|
+ {
|
|
|
|
+ pMainNote->setGlobalFont(m_selectStyleId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -260,13 +317,45 @@ void QtLangSet::slot_fontSizeChange(int v)
|
|
//qDebug() << m_curStyleData.font.family();
|
|
//qDebug() << m_curStyleData.font.family();
|
|
m_isStyleChange = true;
|
|
m_isStyleChange = true;
|
|
m_selectLexer->setFont(m_curStyleData.font, m_selectStyleId);
|
|
m_selectLexer->setFont(m_curStyleData.font, m_selectStyleId);
|
|
- if (ui.useGbFontSize->isChecked())
|
|
|
|
|
|
+
|
|
|
|
+ //全局第一个样式,修改所有语法样式
|
|
|
|
+ if (ui.useGlobalFont->isVisible() && ui.useGbFontSize->isChecked())
|
|
{
|
|
{
|
|
slot_useAlobalFontSize(true);
|
|
slot_useAlobalFontSize(true);
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+ }
|
|
|
|
+ else if (ui.useGlobalFont->isVisible() && !ui.useGbFontSize->isChecked())
|
|
|
|
+ {
|
|
|
|
+ //保存全局样式第一条样式本身
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+ }
|
|
|
|
+ else if (!ui.useGlobalFont->isVisible())
|
|
|
|
+ {
|
|
|
|
+ //全局非第一个样式,修改当前全局字体大小
|
|
|
|
+ //全局样式的非第一个
|
|
|
|
+ setGlobalFont(m_selectStyleId, m_curStyleData.font);
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+
|
|
|
|
+ //这里就是全局的样式。通知当前所有的编辑框,去修改他们本身的全局样式
|
|
|
|
+ CCNotePad* pMainNote = dynamic_cast<CCNotePad*>(parent());
|
|
|
|
+ if (pMainNote != nullptr)
|
|
|
|
+ {
|
|
|
|
+ pMainNote->setGlobalFont(m_selectStyleId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if (!ui.modifyAllFont->isChecked())
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (m_curStyleData.font.pointSize() != v)
|
|
|
|
+ {
|
|
|
|
+ m_curStyleData.font.setPointSize(v);
|
|
|
|
+ m_selectLexer->setFont(m_curStyleData.font, m_selectStyleId);
|
|
|
|
+ m_isStyleChange = true;
|
|
|
|
+ emit viewStyleChange(m_selectLexer->lexerTag(), m_selectStyleId, m_curStyleData.color, m_curStyleData.paper, m_curStyleData.font, true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /*else if (!ui.modifyAllFont->isChecked())
|
|
{
|
|
{
|
|
if (m_curStyleData.font.pointSize() != v)
|
|
if (m_curStyleData.font.pointSize() != v)
|
|
{
|
|
{
|
|
@@ -302,9 +391,9 @@ void QtLangSet::slot_fontSizeChange(int v)
|
|
saveCurLangSettings();
|
|
saveCurLangSettings();
|
|
emit viewLexerChange(m_selectLexer->lexerTag());
|
|
emit viewLexerChange(m_selectLexer->lexerTag());
|
|
}
|
|
}
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
|
|
|
|
|
|
void QtLangSet::getCurUseLexerTags(QVector<QString>& tag)
|
|
void QtLangSet::getCurUseLexerTags(QVector<QString>& tag)
|
|
@@ -323,6 +412,12 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
|
|
|
|
|
|
for (int index = 0; index <= L_TXT; ++index)
|
|
for (int index = 0; index <= L_TXT; ++index)
|
|
{
|
|
{
|
|
|
|
+ //GLOBAL本身不保存,因为GLOBAL不是语法样式,而是全局的属性风格
|
|
|
|
+ if (index == L_GLOBAL)
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
QsciLexer *pLexer = ScintillaEditView::createLexer(index);
|
|
QsciLexer *pLexer = ScintillaEditView::createLexer(index);
|
|
if (nullptr != pLexer)
|
|
if (nullptr != pLexer)
|
|
{
|
|
{
|
|
@@ -451,10 +546,10 @@ void QtLangSet::restoreOriginLangAllStyle()
|
|
//只在restoreOriginLangOneStyle中调用
|
|
//只在restoreOriginLangOneStyle中调用
|
|
static void restoreLangFontFgColorToDarkStyle(QsciLexer *pLexer, int i)
|
|
static void restoreLangFontFgColorToDarkStyle(QsciLexer *pLexer, int i)
|
|
{
|
|
{
|
|
- if (QtLangSet::s_darkColorMap.contains(pLexer->color(i).name()))
|
|
|
|
- {
|
|
|
|
- pLexer->setColor(QtLangSet::s_darkColorMap.value(pLexer->color(i).name()), i);
|
|
|
|
- }
|
|
|
|
|
|
+ //if (QtLangSet::s_darkColorMap.contains(pLexer->color(i).name()))
|
|
|
|
+ //{
|
|
|
|
+ // pLexer->setColor(QtLangSet::s_darkColorMap.value(pLexer->color(i).name()), i);
|
|
|
|
+ //}
|
|
}
|
|
}
|
|
|
|
|
|
//只在restoreOriginLangOneStyle中调用
|
|
//只在restoreOriginLangOneStyle中调用
|
|
@@ -534,10 +629,10 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag)
|
|
oldClor = pOriginLexer->color(i);
|
|
oldClor = pOriginLexer->color(i);
|
|
pLexer->setColor(oldClor, i);
|
|
pLexer->setColor(oldClor, i);
|
|
|
|
|
|
- if (BLACK_SE == StyleSet::getCurrentSytleId())
|
|
|
|
|
|
+ /*if (BLACK_SE == StyleSet::getCurrentSytleId())
|
|
{
|
|
{
|
|
restoreLangFontFgColorToDarkStyle(pLexer, i);
|
|
restoreLangFontFgColorToDarkStyle(pLexer, i);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -546,10 +641,10 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag)
|
|
oldClor = pOriginLexer->paper(i);
|
|
oldClor = pOriginLexer->paper(i);
|
|
pLexer->setPaper(oldClor, i);
|
|
pLexer->setPaper(oldClor, i);
|
|
|
|
|
|
- if (BLACK_SE == StyleSet::getCurrentSytleId())
|
|
|
|
|
|
+ /*if (BLACK_SE == StyleSet::getCurrentSytleId())
|
|
{
|
|
{
|
|
restoreLangPaperColorToDarkStyle(pLexer, i);
|
|
restoreLangPaperColorToDarkStyle(pLexer, i);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
@@ -581,7 +676,8 @@ void QtLangSet::slot_fontChange(const QFont &font)
|
|
//即时设置风格
|
|
//即时设置风格
|
|
if (m_selectLexer != nullptr)
|
|
if (m_selectLexer != nullptr)
|
|
{
|
|
{
|
|
- if (!ui.modifyAllFont->isChecked())
|
|
|
|
|
|
+ //全局修改
|
|
|
|
+ if (m_isGlobelItem)
|
|
{
|
|
{
|
|
if (m_curStyleData.font != font)
|
|
if (m_curStyleData.font != font)
|
|
{
|
|
{
|
|
@@ -589,21 +685,37 @@ void QtLangSet::slot_fontChange(const QFont &font)
|
|
m_selectLexer->setFont(m_curStyleData.font, m_selectStyleId);
|
|
m_selectLexer->setFont(m_curStyleData.font, m_selectStyleId);
|
|
m_isStyleChange = true;
|
|
m_isStyleChange = true;
|
|
|
|
|
|
- if (m_isGlobelItem)
|
|
|
|
|
|
+ //修改所有字体
|
|
|
|
+ if (ui.useGlobalFont->isVisible() && ui.useGbFont->isChecked())
|
|
{
|
|
{
|
|
- if (ui.useGbFont->isChecked())
|
|
|
|
- {
|
|
|
|
slot_useAlobalFont(true);
|
|
slot_useAlobalFont(true);
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
}
|
|
}
|
|
|
|
+ else if (ui.useGlobalFont->isVisible() && !ui.useGbFont->isChecked())
|
|
|
|
+ {
|
|
|
|
+ //保存全局样式第一条样式本身
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else if(!ui.useGlobalFont->isVisible())
|
|
{
|
|
{
|
|
- emit viewStyleChange(m_selectLexer->lexerTag(), m_selectStyleId, m_curStyleData.color, m_curStyleData.paper, m_curStyleData.font, true);
|
|
|
|
|
|
+ //全局样式的非第一个
|
|
|
|
+ setGlobalFont(m_selectStyleId, m_curStyleData.font);
|
|
|
|
+
|
|
|
|
+ //保存全局样式第一条样式本身
|
|
|
|
+ saveLangeSet(m_selectLexer);
|
|
|
|
+
|
|
|
|
+ //这里就是全局的样式。通知当前所有的编辑框,去修改他们本身的全局样式
|
|
|
|
+ CCNotePad* pMainNote = dynamic_cast<CCNotePad*>(parent());
|
|
|
|
+ if (pMainNote != nullptr)
|
|
|
|
+ {
|
|
|
|
+ pMainNote->setGlobalFont(m_selectStyleId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+#if 0
|
|
//统一修改字体,大小和风格保存不变
|
|
//统一修改字体,大小和风格保存不变
|
|
QFont oldf = m_curStyleData.font;
|
|
QFont oldf = m_curStyleData.font;
|
|
m_curStyleData.font = font;
|
|
m_curStyleData.font = font;
|
|
@@ -638,9 +750,19 @@ void QtLangSet::slot_fontChange(const QFont &font)
|
|
saveCurLangSettings();
|
|
saveCurLangSettings();
|
|
emit viewLexerChange(m_selectLexer->lexerTag());
|
|
emit viewLexerChange(m_selectLexer->lexerTag());
|
|
}
|
|
}
|
|
|
|
+#endif
|
|
|
|
+ if (m_curStyleData.font != font)
|
|
|
|
+ {
|
|
|
|
+ m_curStyleData.font.setFamily(font.family());
|
|
|
|
+ m_selectLexer->setFont(m_curStyleData.font, m_selectStyleId);
|
|
|
|
+ m_isStyleChange = true;
|
|
|
|
+
|
|
|
|
+ emit viewStyleChange(m_selectLexer->lexerTag(), m_selectStyleId, m_curStyleData.color, m_curStyleData.paper, m_curStyleData.font, true);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+}
|
|
|
|
|
|
void QtLangSet::initLangList()
|
|
void QtLangSet::initLangList()
|
|
{
|
|
{
|
|
@@ -730,6 +852,14 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item)
|
|
}
|
|
}
|
|
//qDebug() << item->text() << (previous ? previous->text() : 0);
|
|
//qDebug() << item->text() << (previous ? previous->text() : 0);
|
|
|
|
|
|
|
|
+ //如果前后主题发生了变化,则依旧要走更新,防止主题切换后没及时更新
|
|
|
|
+ if (m_previousSysLangItem == item && (m_lastThemesId == m_themesId))
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ui.curThemes->setText(tr("Current themes : %1, language : %2").arg(StyleSet::getCurrentStyle()).arg(item->text()));
|
|
|
|
+
|
|
|
|
|
|
ui.langListWidget->scrollToItem(item);
|
|
ui.langListWidget->scrollToItem(item);
|
|
|
|
|
|
@@ -762,7 +892,6 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item)
|
|
m_selectLexer = nullptr;
|
|
m_selectLexer = nullptr;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
int lexId = item->data(Qt::UserRole).toInt();
|
|
int lexId = item->data(Qt::UserRole).toInt();
|
|
|
|
|
|
//全局的这个要单独对待,暂时没有任何风格。
|
|
//全局的这个要单独对待,暂时没有任何风格。
|
|
@@ -770,27 +899,13 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item)
|
|
{
|
|
{
|
|
m_isGlobelItem = true;
|
|
m_isGlobelItem = true;
|
|
ui.stackedWidget->setCurrentIndex(1);
|
|
ui.stackedWidget->setCurrentIndex(1);
|
|
-
|
|
|
|
- //全部修改模式下,目前暂时不存在修改所有的说法,目前就只能全部修改
|
|
|
|
- ui.modiryAllColor->setChecked(false);
|
|
|
|
- ui.modifyAllFont->setChecked(false);
|
|
|
|
- ui.modiryAllColor->setEnabled(false);
|
|
|
|
- ui.modifyAllFont->setEnabled(false);
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
m_isGlobelItem = false;
|
|
m_isGlobelItem = false;
|
|
ui.stackedWidget->setCurrentIndex(0);
|
|
ui.stackedWidget->setCurrentIndex(0);
|
|
|
|
|
|
- if (!ui.modiryAllColor->isEnabled())
|
|
|
|
- {
|
|
|
|
- ui.modiryAllColor->setEnabled(true);
|
|
|
|
- }
|
|
|
|
- if (!ui.modifyAllFont->isEnabled())
|
|
|
|
- {
|
|
|
|
- ui.modifyAllFont->setEnabled(true);
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
QsciLexer *pLexer = ScintillaEditView::createLexer(lexId);
|
|
QsciLexer *pLexer = ScintillaEditView::createLexer(lexId);
|
|
if (nullptr != pLexer)
|
|
if (nullptr != pLexer)
|
|
@@ -830,6 +945,12 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item)
|
|
ui.motherLangCb->setCurrentIndex(0);
|
|
ui.motherLangCb->setCurrentIndex(0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void QtLangSet::slot_langListCurRowChanged(int row)
|
|
|
|
+{
|
|
|
|
+ QListWidgetItem* current = ui.langListWidget->item(row);
|
|
|
|
+ slot_itemSelect(current);
|
|
|
|
+}
|
|
|
|
+
|
|
//根据母亲模块语言,把属性风格显示出来
|
|
//根据母亲模块语言,把属性风格显示出来
|
|
void QtLangSet::displayUserMotherLangsStyle(QString langTagName, UserLangMother motherLang)
|
|
void QtLangSet::displayUserMotherLangsStyle(QString langTagName, UserLangMother motherLang)
|
|
{
|
|
{
|
|
@@ -902,15 +1023,15 @@ void QtLangSet::slot_userLangItemSelect(QListWidgetItem *item)
|
|
m_isGlobelItem = false;
|
|
m_isGlobelItem = false;
|
|
ui.stackedWidget->setCurrentIndex(0);
|
|
ui.stackedWidget->setCurrentIndex(0);
|
|
|
|
|
|
- if (!ui.modiryAllColor->isEnabled())
|
|
|
|
|
|
+ /*if (!ui.modiryAllColor->isEnabled())
|
|
{
|
|
{
|
|
ui.modiryAllColor->setEnabled(true);
|
|
ui.modiryAllColor->setEnabled(true);
|
|
}
|
|
}
|
|
if (!ui.modifyAllFont->isEnabled())
|
|
if (!ui.modifyAllFont->isEnabled())
|
|
{
|
|
{
|
|
ui.modifyAllFont->setEnabled(true);
|
|
ui.modifyAllFont->setEnabled(true);
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
m_previousSysLangItem = nullptr;
|
|
m_previousSysLangItem = nullptr;
|
|
@@ -959,28 +1080,112 @@ void QtLangSet::syncShowStyleItemToUI(QListWidgetItem *item)
|
|
if (item != nullptr && m_selectLexer != nullptr)
|
|
if (item != nullptr && m_selectLexer != nullptr)
|
|
{
|
|
{
|
|
int styleId = item->data(Qt::UserRole).toInt();
|
|
int styleId = item->data(Qt::UserRole).toInt();
|
|
|
|
+
|
|
|
|
+ if (m_selectStyleId == styleId && (m_lastThemesId == m_themesId))
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!item->isSelected())
|
|
|
|
+ {
|
|
|
|
+ item->setSelected(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!ui.label_fc->isEnabled())
|
|
|
|
+ {
|
|
|
|
+ ui.label_fc->setEnabled(true);
|
|
|
|
+ ui.toolButton->setEnabled(true);
|
|
|
|
+ }
|
|
|
|
+ if (!ui.label_bc->isEnabled())
|
|
|
|
+ {
|
|
|
|
+ ui.label_bc->setEnabled(true);
|
|
|
|
+ ui.toolButton1->setEnabled(true);
|
|
|
|
+ }
|
|
|
|
+ if (!ui.fontComboBox->isEnabled())
|
|
|
|
+ {
|
|
|
|
+ ui.fontComboBox->setEnabled(true);
|
|
|
|
+ ui.boldCheckBox->setEnabled(true);
|
|
|
|
+ ui.italicCheckBox->setEnabled(true);
|
|
|
|
+ ui.underlineCheckBox->setEnabled(true);
|
|
|
|
+ }
|
|
|
|
+ if (!ui.fontSpinBox->isEnabled())
|
|
|
|
+ {
|
|
|
|
+ ui.fontSpinBox->setEnabled(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
m_selectStyleId = styleId;
|
|
m_selectStyleId = styleId;
|
|
QsciLexer::StyleData & sd = m_selectLexer->styleData(styleId);
|
|
QsciLexer::StyleData & sd = m_selectLexer->styleData(styleId);
|
|
m_curStyleData = sd;
|
|
m_curStyleData = sd;
|
|
setStyleShow(sd.font, sd.color, sd.paper);
|
|
setStyleShow(sd.font, sd.color, sd.paper);
|
|
m_isStyleChange = false;
|
|
m_isStyleChange = false;
|
|
|
|
+
|
|
|
|
+ //如果是全局,则把不能修改的全局样式灰掉,避免干扰用户的选择
|
|
|
|
+ if (m_isGlobelItem)
|
|
|
|
+ {
|
|
|
|
+ QsciLexerGlobal* pGlobalLexer = dynamic_cast<QsciLexerGlobal*>(m_selectLexer);
|
|
|
|
+ if (pGlobalLexer != nullptr)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ int enableMask = pGlobalLexer->changeOperBit(styleId);
|
|
|
|
+
|
|
|
|
+ if (!(enableMask & FG_BIT))
|
|
|
|
+ {
|
|
|
|
+ ui.label_fc->setEnabled(false);
|
|
|
|
+ ui.toolButton->setEnabled(false);
|
|
|
|
+ }
|
|
|
|
+ if (!(enableMask & BG_BIT))
|
|
|
|
+ {
|
|
|
|
+ ui.label_bc->setEnabled(false);
|
|
|
|
+ ui.toolButton1->setEnabled(false);
|
|
|
|
+}
|
|
|
|
+ if (!(enableMask & FONT_BIT))
|
|
|
|
+ {
|
|
|
|
+ ui.fontComboBox->setEnabled(false);
|
|
|
|
+ ui.boldCheckBox->setEnabled(false);
|
|
|
|
+ ui.italicCheckBox->setEnabled(false);
|
|
|
|
+ ui.underlineCheckBox->setEnabled(false);
|
|
|
|
+ }
|
|
|
|
+ if (!(enableMask & SIZE_BIT))
|
|
|
|
+ {
|
|
|
|
+ ui.fontSpinBox->setEnabled(false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//点击当前的风格item
|
|
//点击当前的风格item
|
|
void QtLangSet::slot_styleItemSelect(QListWidgetItem *current)
|
|
void QtLangSet::slot_styleItemSelect(QListWidgetItem *current)
|
|
{
|
|
{
|
|
-#if 0
|
|
|
|
- if (current != nullptr && m_selectLexer != nullptr)
|
|
|
|
|
|
+ qDebug() << "slot_styleItemSelect";
|
|
|
|
+
|
|
|
|
+ syncShowStyleItemToUI(current);
|
|
|
|
+
|
|
|
|
+ if (m_isGlobelItem && ui.styleListWidget->item(0) == current)
|
|
{
|
|
{
|
|
- int styleId = current->data(Qt::UserRole).toInt();
|
|
|
|
- m_selectStyleId = styleId;
|
|
|
|
- QsciLexer::StyleData & sd = m_selectLexer->styleData(styleId);
|
|
|
|
- m_curStyleData = sd;
|
|
|
|
- setStyleShow(sd.font, sd.color, sd.paper);
|
|
|
|
- m_isStyleChange = false;
|
|
|
|
|
|
+ ui.useGlobalColor->setVisible(true);
|
|
|
|
+ ui.useGlobalFont->setVisible(true);
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
- syncShowStyleItemToUI(current);
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (ui.useGlobalColor->isVisible())
|
|
|
|
+ {
|
|
|
|
+ ui.useGlobalColor->setVisible(false);
|
|
|
|
+}
|
|
|
|
+ if (ui.useGlobalFont->isVisible())
|
|
|
|
+ {
|
|
|
|
+ ui.useGlobalFont->setVisible(false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//使用键盘上下切换
|
|
|
|
+void QtLangSet::slot_styleListCurRowChanged(int row)
|
|
|
|
+{
|
|
|
|
+ qDebug() << "slot_curRowChanged";
|
|
|
|
+ QListWidgetItem* current = ui.styleListWidget->item(row);
|
|
|
|
+ slot_styleItemSelect(current);
|
|
}
|
|
}
|
|
|
|
|
|
void QtLangSet::fillForegroundColor(QColor& fcColor)
|
|
void QtLangSet::fillForegroundColor(QColor& fcColor)
|
|
@@ -1017,28 +1222,54 @@ void QtLangSet::setStyleShow(QFont& font, QColor& fcColor, QColor &bkColor)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-//读取特定语言的设置
|
|
|
|
-bool QtLangSet::readLangSettings(QsciLexer *lexer, QString tag)
|
|
|
|
|
|
+//读取特定语言的设置;StyleId-1则读取当前主题,否则指定的StyleId主题
|
|
|
|
+bool QtLangSet::readLangSettings(QsciLexer *lexer, QString tag, int StyleId)
|
|
{
|
|
{
|
|
- QString cfgPath = QString("notepad/userstyle/%1/%2").arg(StyleSet::getCurrentStyle()).arg(tag);
|
|
|
|
|
|
+ QString cfgPath = QString("notepad/userstyle/%1/%2").arg((StyleId == -1) ? StyleSet::getCurrentStyle() : StyleSet::getStyleName(StyleId)).arg(tag);
|
|
|
|
|
|
QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
if (QFile::exists(qs.fileName()))
|
|
if (QFile::exists(qs.fileName()))
|
|
{
|
|
{
|
|
return lexer->readSettings(qs);
|
|
return lexer->readSettings(qs);
|
|
}
|
|
}
|
|
|
|
+ else//这里应该加个逻辑完备的保护。如果没有读取到用户配置,则应该从标准目标去读原始配置
|
|
|
|
+ {
|
|
|
|
+ return readLangOriginSettings(lexer, tag, StyleId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//读取特定语言的原始样式设置;StyleId-1则读取当前主题,否则指定的StyleId主题
|
|
|
|
+bool QtLangSet::readLangOriginSettings(QsciLexer* lexer, QString tag, int StyleId)
|
|
|
|
+{
|
|
|
|
+ //默认主题不需要读取,内存中已经存在
|
|
|
|
+ if (StyleId == 0)
|
|
|
|
+ {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //默认皮肤路径放在软件的同级目录下面的themes目录
|
|
|
|
+ QString cfgPath = QString("%1/themes/%2/%3.ini").arg(QCoreApplication::applicationDirPath()).arg((StyleId == -1)?StyleSet::getCurrentStyle(): StyleSet::getStyleName(StyleId)).arg(tag);
|
|
|
|
+ QSettings qs(cfgPath, QSettings::IniFormat);
|
|
|
|
+
|
|
|
|
+ //QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
|
|
+ if (QFile::exists(qs.fileName()))
|
|
|
|
+ {
|
|
|
|
+ return lexer->readSettings(qs);
|
|
|
|
+ }
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//保存一种语言的配置。
|
|
//保存一种语言的配置。
|
|
-void QtLangSet::saveLangeSet(QsciLexer *lexer)
|
|
|
|
|
|
+void QtLangSet::saveLangeSet(QsciLexer *lexer, int StyleId)
|
|
{
|
|
{
|
|
if (lexer != nullptr)
|
|
if (lexer != nullptr)
|
|
{
|
|
{
|
|
QString tag = lexer->lexerTag();
|
|
QString tag = lexer->lexerTag();
|
|
|
|
|
|
- QString cfgPath = QString("notepad/userstyle/%1/%2").arg(StyleSet::getCurrentStyle()).arg(tag);
|
|
|
|
|
|
+ QString cfgPath = QString("notepad/userstyle/%1/%2").arg((StyleId == -1) ? StyleSet::getCurrentStyle() : StyleSet::getStyleName(StyleId)).arg(tag);
|
|
|
|
|
|
QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
lexer->writeSettings(qs);
|
|
lexer->writeSettings(qs);
|
|
@@ -1053,18 +1284,30 @@ bool QtLangSet::saveCurLangSettings()
|
|
{
|
|
{
|
|
saveLangeSet(m_selectLexer);
|
|
saveLangeSet(m_selectLexer);
|
|
m_isStyleChange = false;
|
|
m_isStyleChange = false;
|
|
|
|
+ ui.statusBar->showMessage(tr("Save Finished !"),10000);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+ ui.statusBar->showMessage(tr("Not change, no need save !"),10000);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool QtLangSet::isUseGlobalFgColor()
|
|
|
|
+{
|
|
|
|
+ return ui.useGlobalColor->isVisible() && ui.useGbFc->isChecked();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool QtLangSet::isUseGlobalBgColor()
|
|
|
|
+{
|
|
|
|
+ return ui.useGlobalColor->isVisible() && ui.useGbBc->isChecked();
|
|
|
|
+}
|
|
|
|
+
|
|
//修改前景色
|
|
//修改前景色
|
|
void QtLangSet::slot_changeFgColor()
|
|
void QtLangSet::slot_changeFgColor()
|
|
{
|
|
{
|
|
QColor color = QColorDialog::getColor(m_curStyleData.color, this, tr("Style Foreground Color"));
|
|
QColor color = QColorDialog::getColor(m_curStyleData.color, this, tr("Style Foreground Color"));
|
|
if (color.isValid())
|
|
if (color.isValid())
|
|
{
|
|
{
|
|
- //全局修改,把所有语言的所有风格都设置
|
|
|
|
|
|
+ //全局修改
|
|
if (m_isGlobelItem)
|
|
if (m_isGlobelItem)
|
|
{
|
|
{
|
|
if (m_curStyleData.color != color)
|
|
if (m_curStyleData.color != color)
|
|
@@ -1076,17 +1319,33 @@ void QtLangSet::slot_changeFgColor()
|
|
//即时设置风格
|
|
//即时设置风格
|
|
if (m_selectLexer != nullptr)
|
|
if (m_selectLexer != nullptr)
|
|
{
|
|
{
|
|
|
|
+ //此时一定是QsciLexerGlobal
|
|
m_selectLexer->setColor(color, m_selectStyleId);
|
|
m_selectLexer->setColor(color, m_selectStyleId);
|
|
}
|
|
}
|
|
|
|
|
|
- if (ui.useGbFc->isChecked())
|
|
|
|
|
|
+ //只有在第一个全局样式时,isUseGlobalFgColor下面才为true。把所有语言的所有风格都设置
|
|
|
|
+ if (isUseGlobalFgColor())
|
|
{
|
|
{
|
|
slot_useAlobalFgColor(true);
|
|
slot_useAlobalFgColor(true);
|
|
}
|
|
}
|
|
|
|
+ else if(!ui.useGlobalColor->isVisible())
|
|
|
|
+ {
|
|
|
|
+ //全局样式的非第一个
|
|
|
|
+ setGlobalFgColor(m_selectStyleId, color);
|
|
|
|
+
|
|
|
|
+ //这里就是全局的样式。通知当前所有的编辑框,去修改他们本身的全局样式
|
|
|
|
+ CCNotePad* pMainNote = dynamic_cast<CCNotePad*>(parent());
|
|
|
|
+ if (pMainNote != nullptr)
|
|
|
|
+ {
|
|
|
|
+ pMainNote->setGlobalFgColor(m_selectStyleId);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- else if (!ui.modiryAllColor->isChecked())
|
|
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
{
|
|
{
|
|
//当前前景色是否变化
|
|
//当前前景色是否变化
|
|
if (m_curStyleData.color != color)
|
|
if (m_curStyleData.color != color)
|
|
@@ -1104,34 +1363,42 @@ void QtLangSet::slot_changeFgColor()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ /*else if (!ui.modiryAllColor->isChecked())
|
|
{
|
|
{
|
|
- //全部风格颜色修改
|
|
|
|
- //当前前景色是否变化
|
|
|
|
|
|
+ 当前前景色是否变化
|
|
|
|
+ if (m_curStyleData.color != color)
|
|
|
|
+ {
|
|
m_curStyleData.color = color;
|
|
m_curStyleData.color = color;
|
|
fillForegroundColor(color);
|
|
fillForegroundColor(color);
|
|
m_isStyleChange = true;
|
|
m_isStyleChange = true;
|
|
|
|
|
|
- //即时设置风格
|
|
|
|
|
|
+ 即时设置风格
|
|
if (m_selectLexer != nullptr)
|
|
if (m_selectLexer != nullptr)
|
|
{
|
|
{
|
|
- /*int row = ui.styleListWidget->count();
|
|
|
|
-
|
|
|
|
- QListWidgetItem* item = nullptr;
|
|
|
|
|
|
+ m_selectLexer->setColor(color, m_selectStyleId);
|
|
|
|
|
|
- for (int i = 0; i < row; ++i)
|
|
|
|
|
|
+ emit viewStyleChange(m_selectLexer->lexerTag(), m_selectStyleId, color, m_curStyleData.paper, m_curStyleData.font, false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }*/
|
|
|
|
+ /*else
|
|
{
|
|
{
|
|
- item = ui.styleListWidget->item(i);
|
|
|
|
- int styleId = item->data(Qt::UserRole).toInt();*/
|
|
|
|
- m_selectLexer->setColor(color, -1);
|
|
|
|
- /*}*/
|
|
|
|
|
|
+ 全部风格颜色修改
|
|
|
|
+ 当前前景色是否变化
|
|
|
|
+ m_curStyleData.color = color;
|
|
|
|
+ fillForegroundColor(color);
|
|
|
|
+ m_isStyleChange = true;
|
|
|
|
|
|
|
|
+ 即时设置风格
|
|
|
|
+ if (m_selectLexer != nullptr)
|
|
|
|
+ {
|
|
|
|
+ m_selectLexer->setColor(color, -1);
|
|
saveCurLangSettings();
|
|
saveCurLangSettings();
|
|
emit viewLexerChange(m_selectLexer->lexerTag());
|
|
emit viewLexerChange(m_selectLexer->lexerTag());
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ */
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1156,30 +1423,42 @@ void QtLangSet::slot_changeBkColor()
|
|
m_selectLexer->setPaper(color, m_selectStyleId);
|
|
m_selectLexer->setPaper(color, m_selectStyleId);
|
|
}
|
|
}
|
|
|
|
|
|
- if (ui.useGbBc->isChecked())
|
|
|
|
|
|
+ if (isUseGlobalBgColor())
|
|
{
|
|
{
|
|
slot_useAlobalBkColor(true);
|
|
slot_useAlobalBkColor(true);
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- else if (!ui.modiryAllColor->isChecked())
|
|
|
|
- {
|
|
|
|
- //当前前景色是否变化
|
|
|
|
- if (m_curStyleData.paper != color)
|
|
|
|
|
|
+ else if (!ui.useGlobalColor->isVisible())
|
|
{
|
|
{
|
|
- m_curStyleData.paper = color;
|
|
|
|
- fillBackgroundColor(color);
|
|
|
|
- m_isStyleChange = true;
|
|
|
|
|
|
+ setGlobalBgColor(m_selectStyleId, color);
|
|
|
|
|
|
- //即时设置风格
|
|
|
|
- if (m_selectLexer != nullptr)
|
|
|
|
- {
|
|
|
|
- m_selectLexer->setPaper(color, m_selectStyleId);
|
|
|
|
- emit viewStyleChange(m_selectLexer->lexerTag(), m_selectStyleId, color, m_curStyleData.paper, m_curStyleData.font, false);
|
|
|
|
|
|
+ //这里就是全局的样式。通知当前所有的编辑框,去修改他们本身的全局样式
|
|
|
|
+ CCNotePad* pMainNote = dynamic_cast<CCNotePad*>(parent());
|
|
|
|
+ if (pMainNote != nullptr)
|
|
|
|
+ {
|
|
|
|
+ pMainNote->setGlobalBgColor(m_selectStyleId);
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // else if (!ui.modiryAllColor->isChecked())
|
|
|
|
+ // {
|
|
|
|
+ // //当前前景色是否变化
|
|
|
|
+ // if (m_curStyleData.paper != color)
|
|
|
|
+ // {
|
|
|
|
+ // m_curStyleData.paper = color;
|
|
|
|
+ // fillBackgroundColor(color);
|
|
|
|
+ // m_isStyleChange = true;
|
|
|
|
+
|
|
|
|
+ // //即时设置风格
|
|
|
|
+ // if (m_selectLexer != nullptr)
|
|
|
|
+ // {
|
|
|
|
+ // m_selectLexer->setPaper(color, m_selectStyleId);
|
|
|
|
+ // emit viewStyleChange(m_selectLexer->lexerTag(), m_selectStyleId, color, m_curStyleData.paper, m_curStyleData.font, false);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
//全部风格颜色修改
|
|
//全部风格颜色修改
|
|
@@ -1230,27 +1509,27 @@ void QtLangSet::slot_reset()
|
|
QFile::remove(qs.fileName());
|
|
QFile::remove(qs.fileName());
|
|
}
|
|
}
|
|
|
|
|
|
- //如果是暗色风格,还需要多做一步,替换暗色下不显眼的颜色
|
|
|
|
- if (BLACK_SE == StyleSet::getCurrentSytleId())
|
|
|
|
- {
|
|
|
|
- setLangFontFgColorToDarkStyle((LangType)m_selectLexer->lexerId(), m_selectLexer->lexerTag());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
//一定要先保存,因为selectInitLangTag后可能会变化
|
|
//一定要先保存,因为selectInitLangTag后可能会变化
|
|
-
|
|
|
|
int row = ui.styleListWidget->currentRow();
|
|
int row = ui.styleListWidget->currentRow();
|
|
|
|
|
|
|
|
+ //强行让slot_itemSelect里面的进行切换
|
|
|
|
+ m_previousSysLangItem = nullptr;
|
|
|
|
+
|
|
selectInitLangTag(m_selectLexer->lexerTag());
|
|
selectInitLangTag(m_selectLexer->lexerTag());
|
|
|
|
|
|
//手动刷新UI
|
|
//手动刷新UI
|
|
QListWidgetItem* styleItem = ui.styleListWidget->item(row);
|
|
QListWidgetItem* styleItem = ui.styleListWidget->item(row);
|
|
|
|
|
|
|
|
+ m_selectStyleId = -1;
|
|
|
|
+
|
|
syncShowStyleItemToUI(styleItem);
|
|
syncShowStyleItemToUI(styleItem);
|
|
|
|
|
|
emit viewLexerChange(m_selectLexer->lexerTag());
|
|
emit viewLexerChange(m_selectLexer->lexerTag());
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ if (ui.useGlobalFont->isVisible())
|
|
|
|
+ {
|
|
//如果是全局重置,则把所有语言都重置
|
|
//如果是全局重置,则把所有语言都重置
|
|
if (QMessageBox::Yes != QMessageBox::question(this, tr("Reset All Style"), tr("Are you sure to reset All language sytle")))
|
|
if (QMessageBox::Yes != QMessageBox::question(this, tr("Reset All Style"), tr("Are you sure to reset All language sytle")))
|
|
{
|
|
{
|
|
@@ -1258,12 +1537,6 @@ void QtLangSet::slot_reset()
|
|
}
|
|
}
|
|
restoreOriginLangAllStyle();
|
|
restoreOriginLangAllStyle();
|
|
|
|
|
|
- //如果是暗色风格,还需要多做一步,替换暗色下不显眼的颜色
|
|
|
|
- if (BLACK_SE == StyleSet::getCurrentSytleId())
|
|
|
|
- {
|
|
|
|
- setAllLangFontFgColorToDarkStyle();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
previewAllGoblalChange();
|
|
previewAllGoblalChange();
|
|
|
|
|
|
//手动刷新UI。全局目前只有一行全局设置
|
|
//手动刷新UI。全局目前只有一行全局设置
|
|
@@ -1273,13 +1546,52 @@ void QtLangSet::slot_reset()
|
|
delete m_selectLexer;
|
|
delete m_selectLexer;
|
|
}
|
|
}
|
|
|
|
|
|
- //如果是暗黑风格,则不能读取源分隔;非暗黑则读取源
|
|
|
|
- m_selectLexer = ScintillaEditView::createLexer(L_GLOBAL,"",(BLACK_SE != StyleSet::getCurrentSytleId()));
|
|
|
|
|
|
+ m_selectLexer = ScintillaEditView::createLexer(L_GLOBAL);
|
|
|
|
|
|
QListWidgetItem* styleItem = ui.styleListWidget->item(0);
|
|
QListWidgetItem* styleItem = ui.styleListWidget->item(0);
|
|
|
|
|
|
|
|
+ m_selectStyleId = -1;
|
|
|
|
+
|
|
syncShowStyleItemToUI(styleItem);
|
|
syncShowStyleItemToUI(styleItem);
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //重置所有全局样式
|
|
|
|
+ //一旦重置,当前修改无条件不保存。否则避免当前的刚刚重置,又被保存
|
|
|
|
+ m_isStyleChange = false;
|
|
|
|
+
|
|
|
|
+ //如果存在自定义的配置,也删除掉
|
|
|
|
+ QString cfgPath = QString("notepad/userstyle/%1/%2").arg(StyleSet::getCurrentStyle()).arg(m_selectLexer->lexerTag());
|
|
|
|
+
|
|
|
|
+ QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
|
|
+ if (QFile::exists(qs.fileName()))
|
|
|
|
+ {
|
|
|
|
+ QFile::remove(qs.fileName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //一定要先保存,因为selectInitLangTag后可能会变化
|
|
|
|
+
|
|
|
|
+ int row = ui.styleListWidget->currentRow();
|
|
|
|
+
|
|
|
|
+ //强行让slot_itemSelect里面的进行切换
|
|
|
|
+ m_previousSysLangItem = nullptr;
|
|
|
|
+
|
|
|
|
+ //这里必须写ALLglobal,否则中文查找不到
|
|
|
|
+ selectInitLangTag(tr("AllGlobal"));
|
|
|
|
+
|
|
|
|
+ //手动刷新UI
|
|
|
|
+ QListWidgetItem* styleItem = ui.styleListWidget->item(row);
|
|
|
|
+
|
|
|
|
+ m_selectStyleId = -1;
|
|
|
|
+
|
|
|
|
+ syncShowStyleItemToUI(styleItem);
|
|
|
|
+
|
|
|
|
+ //重新从加载一次纯净的全局样式。因为前面保存的已经删了,所以加载的是纯净的。
|
|
|
|
+ StyleSet::loadGolbalStyle();
|
|
|
|
+
|
|
|
|
+ updateThemes();
|
|
|
|
+}
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1387,128 +1699,214 @@ void QtLangSet::slot_useAlobalFontItalic(bool check)
|
|
|
|
|
|
//把默认语言风格的部分颜色,替换为暗色下显眼的颜色
|
|
//把默认语言风格的部分颜色,替换为暗色下显眼的颜色
|
|
//这个函数是可以处理自定义语言的。
|
|
//这个函数是可以处理自定义语言的。
|
|
-void QtLangSet::setLangFontFgColorToDarkStyle(LangType langId, QString tag)
|
|
|
|
-{
|
|
|
|
- //QColor blackColor(Qt::black);
|
|
|
|
- //QColor lightColor(0xdedede);
|
|
|
|
-
|
|
|
|
- //QColor blackColor1(0x0000ff);
|
|
|
|
- //QColor lightColor1(0xffaa00);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- ////C++注释的默认颜色,不显眼
|
|
|
|
- //QColor blackColor2(0x007f00);
|
|
|
|
- //QColor lightColor2(0x009000);
|
|
|
|
-
|
|
|
|
- //QColor blackColor3(0x7f7f00);
|
|
|
|
- //QColor lightColor3(0xfca287);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //QColor blackColor4(0x8000ff);
|
|
|
|
- //QColor lightColor4(0xffaa00);
|
|
|
|
-
|
|
|
|
- //注意下面这个颜色和void StyleSet::setBlackStyle()中保持一致
|
|
|
|
- //QColor bkPaperColor(0, 0, 0);
|
|
|
|
-
|
|
|
|
- QsciLexer *pLexer = ScintillaEditView::createLexer(langId, tag);
|
|
|
|
- if (nullptr != pLexer)
|
|
|
|
- {
|
|
|
|
- for (int i = 0; i <= 255; ++i)
|
|
|
|
- {
|
|
|
|
- if (!pLexer->description(i).isEmpty())
|
|
|
|
- {
|
|
|
|
- /*if (blackColor == pLexer->color(i))
|
|
|
|
- {
|
|
|
|
- pLexer->setColor(lightColor, i);
|
|
|
|
- }
|
|
|
|
- else if (blackColor1 == pLexer->color(i))
|
|
|
|
- {
|
|
|
|
- pLexer->setColor(lightColor1, i);
|
|
|
|
- }
|
|
|
|
- else if (blackColor2 == pLexer->color(i))
|
|
|
|
- {
|
|
|
|
- pLexer->setColor(lightColor2, i);
|
|
|
|
- }
|
|
|
|
- else if (blackColor3 == pLexer->color(i))
|
|
|
|
- {
|
|
|
|
- pLexer->setColor(lightColor3, i);
|
|
|
|
- }
|
|
|
|
- else if (blackColor4 == pLexer->color(i))
|
|
|
|
- {
|
|
|
|
- pLexer->setColor(lightColor4, i);
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
- if (QtLangSet::s_darkColorMap.contains(pLexer->color(i).name()))
|
|
|
|
- {
|
|
|
|
- pLexer->setColor(QtLangSet::s_darkColorMap.value(pLexer->color(i).name()), i);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //背景也变成暗黑色
|
|
|
|
- if (StyleSet::foldbgColor != pLexer->paper(i))
|
|
|
|
- {
|
|
|
|
- pLexer->setPaper(StyleSet::foldbgColor, i);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //默认纸背景色会和QPalette保持一致。但是因为黑色特色,其背景和QPalette不一样,所有需要单独设置一下
|
|
|
|
- pLexer->setDefaultPaper(StyleSet::foldbgColor);
|
|
|
|
- saveLangeSet(pLexer);
|
|
|
|
- delete pLexer;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-//把暗色系下面不容易看清的颜色给替换一下。默认是有风格的,但是默认风格是亮色系的。
|
|
|
|
-//把凡是0x000000的字体,变成0xdedede
|
|
|
|
-//凡是0x0000ff的颜色,变成0xffff00
|
|
|
|
-//这个函数没有处理自定义语言。
|
|
|
|
-void QtLangSet::setAllLangFontFgColorToDarkStyle()
|
|
|
|
-{
|
|
|
|
- initDarkColorMap();
|
|
|
|
-
|
|
|
|
- for (int index = 0; index <= L_TXT; ++index)
|
|
|
|
- {
|
|
|
|
- setLangFontFgColorToDarkStyle((LangType)index);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-//检查当前是否已经存在暗黑色语言配置
|
|
|
|
-bool QtLangSet::isExistDarkLangSetings()
|
|
|
|
-{
|
|
|
|
- QString cfgPath = QString("notepad/userstyle/black/AllGlobal");
|
|
|
|
- QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
|
|
- return QFile::exists(qs.fileName());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-////把凡是0xdedede的字体,变成0x000000
|
|
|
|
-//void QtLangSet::setAllLangFontFgColorToLightStyle()
|
|
|
|
|
|
+//void QtLangSet::setLangFontFgColorToDarkStyle(LangType langId, QString tag)
|
|
//{
|
|
//{
|
|
// QColor blackColor(Qt::black);
|
|
// QColor blackColor(Qt::black);
|
|
// QColor lightColor(0xdedede);
|
|
// QColor lightColor(0xdedede);
|
|
//
|
|
//
|
|
-// QColor blackColor1(0xffaa00);
|
|
|
|
-// QColor lightColor1(0x0000ff);
|
|
|
|
|
|
+// QColor blackColor1(0x0000ff);
|
|
|
|
+// QColor lightColor1(0xffaa00);
|
|
//
|
|
//
|
|
-// for (int index = 0; index <= L_TXT; ++index)
|
|
|
|
-// {
|
|
|
|
-// QsciLexer *pLexer = ScintillaEditView::createLexer(index);
|
|
|
|
|
|
+//
|
|
|
|
+// //C++注释的默认颜色,不显眼
|
|
|
|
+// QColor blackColor2(0x007f00);
|
|
|
|
+// QColor lightColor2(0x009000);
|
|
|
|
+//
|
|
|
|
+// QColor blackColor3(0x7f7f00);
|
|
|
|
+// QColor lightColor3(0xfca287);
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// QColor blackColor4(0x8000ff);
|
|
|
|
+// QColor lightColor4(0xffaa00);
|
|
|
|
+//
|
|
|
|
+// 注意下面这个颜色和void StyleSet::setBlackStyle()中保持一致
|
|
|
|
+// QColor bkPaperColor(0, 0, 0);
|
|
|
|
+//
|
|
|
|
+// QsciLexer *pLexer = ScintillaEditView::createLexer(langId, tag);
|
|
// if (nullptr != pLexer)
|
|
// if (nullptr != pLexer)
|
|
// {
|
|
// {
|
|
// for (int i = 0; i <= 255; ++i)
|
|
// for (int i = 0; i <= 255; ++i)
|
|
// {
|
|
// {
|
|
// if (!pLexer->description(i).isEmpty())
|
|
// if (!pLexer->description(i).isEmpty())
|
|
// {
|
|
// {
|
|
-// if (lightColor == pLexer->color(i))
|
|
|
|
|
|
+// /*if (blackColor == pLexer->color(i))
|
|
// {
|
|
// {
|
|
-// pLexer->setColor(blackColor, i);
|
|
|
|
|
|
+// pLexer->setColor(lightColor, i);
|
|
// }
|
|
// }
|
|
// else if (blackColor1 == pLexer->color(i))
|
|
// else if (blackColor1 == pLexer->color(i))
|
|
// {
|
|
// {
|
|
// pLexer->setColor(lightColor1, i);
|
|
// pLexer->setColor(lightColor1, i);
|
|
// }
|
|
// }
|
|
|
|
+// else if (blackColor2 == pLexer->color(i))
|
|
|
|
+// {
|
|
|
|
+// pLexer->setColor(lightColor2, i);
|
|
|
|
+// }
|
|
|
|
+// else if (blackColor3 == pLexer->color(i))
|
|
|
|
+// {
|
|
|
|
+// pLexer->setColor(lightColor3, i);
|
|
|
|
+// }
|
|
|
|
+// else if (blackColor4 == pLexer->color(i))
|
|
|
|
+// {
|
|
|
|
+// pLexer->setColor(lightColor4, i);
|
|
|
|
+// }*/
|
|
|
|
+//
|
|
|
|
+// if (QtLangSet::s_darkColorMap.contains(pLexer->color(i).name()))
|
|
|
|
+// {
|
|
|
|
+// pLexer->setColor(QtLangSet::s_darkColorMap.value(pLexer->color(i).name()), i);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// 背景也变成暗黑色
|
|
|
|
+// if (StyleSet::foldbgColor != pLexer->paper(i))
|
|
|
|
+// {
|
|
|
|
+// pLexer->setPaper(StyleSet::foldbgColor, i);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
+// }
|
|
|
|
+// 默认纸背景色会和QPalette保持一致。但是因为黑色特色,其背景和QPalette不一样,所有需要单独设置一下
|
|
|
|
+// pLexer->setDefaultPaper(StyleSet::foldbgColor);
|
|
// saveLangeSet(pLexer);
|
|
// saveLangeSet(pLexer);
|
|
// delete pLexer;
|
|
// delete pLexer;
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
+
|
|
|
|
+//把暗色系下面不容易看清的颜色给替换一下。默认是有风格的,但是默认风格是亮色系的。
|
|
|
|
+//把凡是0x000000的字体,变成0xdedede
|
|
|
|
+//凡是0x0000ff的颜色,变成0xffff00
|
|
|
|
+//这个函数没有处理自定义语言。
|
|
|
|
+//void QtLangSet::setAllLangFontFgColorToDarkStyle()
|
|
|
|
+//{
|
|
|
|
+// initDarkColorMap();
|
|
|
|
+//
|
|
|
|
+// for (int index = 0; index <= L_TXT; ++index)
|
|
|
|
+// {
|
|
|
|
+// setLangFontFgColorToDarkStyle((LangType)index);
|
|
|
|
+// }
|
|
|
|
+//}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+//从默认主题模板创建一份用户的语言风格文件
|
|
|
|
+void QtLangSet::createOneLangStyleFromThemes(int styleId, LangType langId, QString tag)
|
|
|
|
+{
|
|
|
|
+ if (langId == L_GLOBAL)
|
|
|
|
+ {
|
|
|
|
+ qDebug("global call");
|
|
|
|
+ }
|
|
|
|
+ //指定从原始模板的主题中读取一份数据
|
|
|
|
+ QsciLexer* pLexer = ScintillaEditView::createLexer(langId, tag, true, styleId);
|
|
|
|
+ if (nullptr != pLexer)
|
|
|
|
+ {
|
|
|
|
+ saveLangeSet(pLexer, styleId);
|
|
|
|
+ delete pLexer;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//从原始主题模板中,创建一份用户主题文件
|
|
|
|
+void QtLangSet::createUserStyleFormThemes(int styleId)
|
|
|
|
+{
|
|
|
|
+ for (int index = 0; index <= L_TXT; ++index)
|
|
|
|
+ {
|
|
|
|
+ createOneLangStyleFromThemes(styleId, (LangType)index);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//检查当前是否已经存在暗黑色语言配置
|
|
|
|
+//bool QtLangSet::isExistDarkLangSetings()
|
|
|
|
+//{
|
|
|
|
+// QString cfgPath = QString("notepad/userstyle/black/AllGlobal");
|
|
|
|
+// QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
|
|
+// return QFile::exists(qs.fileName());
|
|
//}
|
|
//}
|
|
|
|
+
|
|
|
|
+//检查当前是否已经存在主题配置
|
|
|
|
+bool QtLangSet::isExistThemesSetings(int styleId)
|
|
|
|
+{
|
|
|
|
+ QString cfgPath = QString("notepad/userstyle/%1/AllGlobal").arg(StyleSet::getStyleName(styleId));
|
|
|
|
+ QSettings qs(QSettings::IniFormat, QSettings::UserScope, cfgPath);
|
|
|
|
+ return QFile::exists(qs.fileName());
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//当前主题发生变化
|
|
|
|
+void QtLangSet::on_themesChange(int styleIndex)
|
|
|
|
+{
|
|
|
|
+ //第一次启动时,防止初始情况没有初始化主题,故检测一下isExistThemesSetings
|
|
|
|
+ if (m_themesId == styleIndex && isExistThemesSetings(styleIndex))
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ ui.statusBar->showMessage(tr("themes changing, please waiting ..."), 5000);
|
|
|
|
+
|
|
|
|
+ m_themesId = styleIndex;
|
|
|
|
+
|
|
|
|
+ //这个有个耦合:先要设置QsciLexer的当前主题。只有默认主题才有详细独立的风格。
|
|
|
|
+ //非默认主题,其初始风格全是默认样式。
|
|
|
|
+
|
|
|
|
+ QsciLexer::setCurThemes(m_themesId);
|
|
|
|
+
|
|
|
|
+ //如果不存在主题设置,则从模板里面拷贝一份出来
|
|
|
|
+ if (!isExistThemesSetings(styleIndex))
|
|
|
|
+ {
|
|
|
|
+ createUserStyleFormThemes(styleIndex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StyleSet::setCurrentStyle(styleIndex);
|
|
|
|
+
|
|
|
|
+ NddSetting::updataKeyValueFromNumSets(SKIN_KEY, m_themesId);
|
|
|
|
+
|
|
|
|
+ //这里就要及时切换当前主题,预览颜色
|
|
|
|
+ updateThemes();
|
|
|
|
+
|
|
|
|
+ //下一步就是要更好当前编辑器的语法设置
|
|
|
|
+ previewAllGoblalChange();
|
|
|
|
+
|
|
|
|
+ int row = ui.langListWidget->currentRow();
|
|
|
|
+
|
|
|
|
+ //手动刷新UI
|
|
|
|
+ QListWidgetItem* styleItem = ui.langListWidget->item(row);
|
|
|
|
+
|
|
|
|
+ slot_itemSelect(styleItem);
|
|
|
|
+
|
|
|
|
+ m_lastThemesId = m_themesId;
|
|
|
|
+
|
|
|
|
+ ui.statusBar->showMessage(tr("themes changed finished ..."), 5000);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//更新当前编辑框中主题的样式
|
|
|
|
+void QtLangSet::updateThemes()
|
|
|
|
+{
|
|
|
|
+ CCNotePad* pMainNote = dynamic_cast<CCNotePad*>(parent());
|
|
|
|
+ if (pMainNote != nullptr)
|
|
|
|
+ {
|
|
|
|
+ pMainNote->updateThemes();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//全局的前景背景和一般的不一样。
|
|
|
|
+void QtLangSet::setGlobalFgColor(int style, QColor color)
|
|
|
|
+{
|
|
|
|
+ One_Stype_Info* pStyle = &StyleSet::s_global_style->global_style;
|
|
|
|
+
|
|
|
|
+ if (pStyle[style].fgColor != color)
|
|
|
|
+ {
|
|
|
|
+ pStyle[style].fgColor = color;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void QtLangSet::setGlobalBgColor(int style, QColor color)
|
|
|
|
+{
|
|
|
|
+ One_Stype_Info* pStyle = &StyleSet::s_global_style->global_style;
|
|
|
|
+
|
|
|
|
+ if (pStyle[style].bgColor != color)
|
|
|
|
+ {
|
|
|
|
+ pStyle[style].bgColor = color;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void QtLangSet::setGlobalFont(int style, QFont font)
|
|
|
|
+{
|
|
|
|
+ One_Stype_Info* pStyle = &StyleSet::s_global_style->global_style;
|
|
|
|
+
|
|
|
|
+ if (pStyle[style].font != font)
|
|
|
|
+ {
|
|
|
|
+ pStyle[style].font = font;
|
|
|
|
+ }
|
|
|
|
+}
|