mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 00:28:42 +00:00
R nits / tidy ups
.. highlighter and default script
This commit is contained in:
@@ -287,7 +287,13 @@ RChart::RChart(Context *context) : GcChartWindow(context), context(context)
|
||||
script->setStyleSheet(TabView::ourStyleSheet());
|
||||
|
||||
// syntax highlighter
|
||||
RSyntax syntax(script->document());
|
||||
setScript("## R script will run on selection.\n"
|
||||
"##\n"
|
||||
"## GC.activity()\n"
|
||||
"## GC.metrics()\n"
|
||||
"##\n"
|
||||
"## Get the current ride or date range.\n"
|
||||
"##\n");
|
||||
|
||||
leftsplitter->addWidget(script);
|
||||
console = new RConsole(context, this);
|
||||
@@ -376,6 +382,10 @@ RChart::runScript()
|
||||
canvas->newPage();
|
||||
}
|
||||
|
||||
// if the program expects more we clear it, otherwise
|
||||
// weird things can happen!
|
||||
rtool->R->program.clear();
|
||||
|
||||
// clear context
|
||||
rtool->context = NULL;
|
||||
rtool->canvas = NULL;
|
||||
|
||||
@@ -96,17 +96,19 @@ RSyntax::RSyntax(QTextDocument *parent) : QSyntaxHighlighter(parent)
|
||||
}
|
||||
|
||||
// operators
|
||||
operatorFormat.setForeground(QColor(255,204,000));
|
||||
//operatorFormat.setForeground(Qt::darkCyan);
|
||||
//operatorFormat.setFontWeight(QFont::Bold);
|
||||
//QStringList operatorPatterns;
|
||||
QStringList operatorPatterns;
|
||||
|
||||
//operatorPatterns << "[\\&\\$\\@\\|\\:\\~\\{\\}\\(\\)!]" << "==" << "!=";
|
||||
operatorPatterns << "[\\&\\@\\|\\:\\~!<>=]" << "==" << "!=";
|
||||
|
||||
//foreach (QString pattern, operatorPatterns) {
|
||||
//rule.pattern = QRegExp(pattern);
|
||||
//rule.format = operatorFormat;
|
||||
//highlightingRules.append(rule);
|
||||
//}
|
||||
foreach (QString pattern, operatorPatterns) {
|
||||
rule.pattern = QRegExp(pattern);
|
||||
rule.format = operatorFormat;
|
||||
highlightingRules.append(rule);
|
||||
}
|
||||
|
||||
// namespace: anything followed by ::
|
||||
//namespaceFormat.setForeground(Qt::magenta);
|
||||
|
||||
Reference in New Issue
Block a user