|
|
|
@ -38,20 +38,20 @@ bool CSVWorld::ScriptEdit::event (QEvent *event)
|
|
|
|
|
return QPlainTextEdit::event (event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSVWorld::ScriptEdit::ScriptEdit (const CSMDoc::Document& document, ScriptHighlighter::Mode mode,
|
|
|
|
|
QWidget* parent)
|
|
|
|
|
: QPlainTextEdit (parent),
|
|
|
|
|
mChangeLocked (0),
|
|
|
|
|
CSVWorld::ScriptEdit::ScriptEdit(
|
|
|
|
|
const CSMDoc::Document& document,
|
|
|
|
|
ScriptHighlighter::Mode mode,
|
|
|
|
|
QWidget* parent
|
|
|
|
|
) : QPlainTextEdit(parent),
|
|
|
|
|
mChangeLocked(0),
|
|
|
|
|
mShowLineNum(false),
|
|
|
|
|
mLineNumberArea(0),
|
|
|
|
|
mDefaultFont(font()),
|
|
|
|
|
mMonoFont(QFont("Monospace")),
|
|
|
|
|
mDocument (document),
|
|
|
|
|
mDocument(document),
|
|
|
|
|
mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// setAcceptRichText (false);
|
|
|
|
|
setLineWrapMode (QPlainTextEdit::NoWrap);
|
|
|
|
|
wrapLines(false);
|
|
|
|
|
setTabStopWidth (4);
|
|
|
|
|
setUndoRedoEnabled (false); // we use OpenCS-wide undo/redo instead
|
|
|
|
|
|
|
|
|
@ -194,14 +194,37 @@ bool CSVWorld::ScriptEdit::stringNeedsQuote (const std::string& id) const
|
|
|
|
|
return !(string.contains(mWhiteListQoutes));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::ScriptEdit::settingChanged (const CSMPrefs::Setting *setting)
|
|
|
|
|
void CSVWorld::ScriptEdit::wrapLines(bool wrap)
|
|
|
|
|
{
|
|
|
|
|
if (wrap)
|
|
|
|
|
{
|
|
|
|
|
setLineWrapMode(QPlainTextEdit::WidgetWidth);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
setLineWrapMode(QPlainTextEdit::NoWrap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::ScriptEdit::settingChanged(const CSMPrefs::Setting *setting)
|
|
|
|
|
{
|
|
|
|
|
if (mHighlighter->settingChanged (setting))
|
|
|
|
|
// Determine which setting was changed.
|
|
|
|
|
if (mHighlighter->settingChanged(setting))
|
|
|
|
|
{
|
|
|
|
|
updateHighlighting();
|
|
|
|
|
else if (*setting=="Scripts/mono-font")
|
|
|
|
|
setFont (setting->isTrue() ? mMonoFont : mDefaultFont);
|
|
|
|
|
else if (*setting=="Scripts/show-linenum")
|
|
|
|
|
showLineNum (setting->isTrue());
|
|
|
|
|
}
|
|
|
|
|
else if (*setting == "Scripts/mono-font")
|
|
|
|
|
{
|
|
|
|
|
setFont(setting->isTrue() ? mMonoFont : mDefaultFont);
|
|
|
|
|
}
|
|
|
|
|
else if (*setting == "Scripts/show-linenum")
|
|
|
|
|
{
|
|
|
|
|
showLineNum(setting->isTrue());
|
|
|
|
|
}
|
|
|
|
|
else if (*setting == "Scripts/wrap-lines")
|
|
|
|
|
{
|
|
|
|
|
wrapLines(setting->isTrue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::ScriptEdit::idListChanged()
|
|
|
|
|