Moved script editor settings to its own section.

pull/558/head
cc9cii 10 years ago
parent 8e49ccc2f4
commit 7b4a9f1ea1

@ -143,10 +143,6 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
minWidth->setDefaultValue (325);
minWidth->setRange (50, 10000);
minWidth->setToolTip ("Minimum width of subviews.");
Setting *monoFont = createSetting (Type_CheckBox, "mono-font", "Use monospace font");
monoFont->setDefaultValue ("true");
monoFont->setToolTip ("Whether to use monospaced fonts on script edit subview.");
}
declareSection ("records", "Records");
@ -230,6 +226,18 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
autoDelete->setDefaultValue ("true");
}
declareSection ("script-editor", "Script Editor");
{
Setting *lineNum = createSetting (Type_CheckBox, "show-linenum", "Show Line Numbers");
lineNum->setDefaultValue ("true");
lineNum->setToolTip ("Show line numbers to the left of the script editor window."
"The current row and column numbers of the text cursor are shown at the bottom.");
Setting *monoFont = createSetting (Type_CheckBox, "mono-font", "Use monospace font");
monoFont->setDefaultValue ("true");
monoFont->setToolTip ("Whether to use monospaced fonts on script edit subview.");
}
{
/******************************************************************
* There are three types of values:

@ -80,7 +80,7 @@ CSVWorld::ScriptEdit::ScriptEdit (const CSMDoc::Document& document, ScriptHighli
// TODO: provide a font selector dialogue
std::string useMonoFont =
CSMSettings::UserSettings::instance().setting("window/mono-font", "true").toStdString();
CSMSettings::UserSettings::instance().setting("script-editor/mono-font", "true").toStdString();
if (useMonoFont == "true")
{
QFont font("Monospace");
@ -95,7 +95,7 @@ CSVWorld::ScriptEdit::ScriptEdit (const CSMDoc::Document& document, ScriptHighli
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
std::string showStatusBar =
CSMSettings::UserSettings::instance().settingValue("window/show-statusbar").toStdString();
CSMSettings::UserSettings::instance().settingValue("script-editor/show-linenum").toStdString();
showLineNum(showStatusBar == "true");
}

@ -12,6 +12,7 @@
#include "../../model/world/columnbase.hpp"
#include "../../model/world/commands.hpp"
#include "../../model/world/idtable.hpp"
#include "../../model/settings/usersettings.hpp"
#include "scriptedit.hpp"
@ -65,10 +66,16 @@ CSVWorld::ScriptSubView::ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc:
connect(mEditor, SIGNAL(cursorPositionChanged()), this, SLOT(updateStatusBar()));
}
void CSVWorld::ScriptSubView::setStatusBar (bool show)
void CSVWorld::ScriptSubView::updateUserSetting (const QString& name, const QStringList& value)
{
mEditor->showLineNum(show);
mBottom->setVisible(show);
if (name != "script-editor/show-linenum")
return;
std::string showLinenum =
CSMSettings::UserSettings::instance().settingValue("script-editor/show-linenum").toStdString();
mEditor->showLineNum(showLinenum == "true");
mBottom->setVisible(showLinenum == "true");
}
void CSVWorld::ScriptSubView::updateStatusBar ()

@ -39,7 +39,7 @@ namespace CSVWorld
virtual void useHint (const std::string& hint);
virtual void setStatusBar (bool show);
virtual void updateUserSetting (const QString& name, const QStringList& value);
public slots:

Loading…
Cancel
Save