changeset 13666:68c50b393f1d

Improved highlighting and incremented version.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Sat, 10 Sep 2011 09:38:49 +0200
parents ddc3c20d0e2f
children 9b74f97919e1
files gui/src/MainWindow.cpp gui/src/TerminalHighlighter.cpp gui/src/TerminalHighlighter.h gui/src/TerminalView.cpp gui/src/TerminalView.h gui/src/terminal/TerminalEmulation.h
diffstat 6 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gui/src/MainWindow.cpp	Sat Sep 10 09:15:38 2011 +0200
+++ b/gui/src/MainWindow.cpp	Sat Sep 10 09:38:49 2011 +0200
@@ -29,7 +29,7 @@
 #include "SettingsDialog.h"
 #include "cmd-edit.h"
 
-#define VERSION_STRING "Octave GUI (0.8.1)"
+#define VERSION_STRING "Octave GUI (0.8.4)"
 
 MainWindow::MainWindow (QWidget * parent):QMainWindow (parent)
 {
--- a/gui/src/TerminalHighlighter.cpp	Sat Sep 10 09:15:38 2011 +0200
+++ b/gui/src/TerminalHighlighter.cpp	Sat Sep 10 09:38:49 2011 +0200
@@ -27,7 +27,7 @@
   keywordFormat.setForeground(Qt::darkBlue);
   QStringList keywordPatterns
       = QString(ResourceManager::instance ()->octaveKeywords ()).split(" ", QString::SkipEmptyParts);
-  keywordPatterns << "GNU" << "Octave";
+  keywordPatterns << "GNU" << "Octave" << "OctaveGUI";
 
   for (int i = 0; i < keywordPatterns.size (); i++)
     keywordPatterns.replace(i, QString("\\b%1\\b").arg(keywordPatterns.at (i)));
@@ -39,6 +39,11 @@
       highlightingRules.append(rule);
     }
 
+  numberFormat.setForeground(Qt::darkRed);
+  rule.pattern = QRegExp("\\b[0-9\\.\\+\\-\\^]+\\b");
+  rule.format = numberFormat;
+  highlightingRules.append(rule);
+
   doubleQouteFormat.setForeground(Qt::darkGreen);
   rule.pattern = QRegExp("\"[^\"]*\"");
   rule.format = doubleQouteFormat;
@@ -54,6 +59,19 @@
   rule.pattern = QRegExp("((?:https?|ftp)://\\S+)");
   rule.format = urlFormat;
   highlightingRules.append(rule);
+
+  subCaptionFormat.setForeground (Qt::black);
+  subCaptionFormat.setFontItalic (true);
+  rule.pattern = QRegExp("^\\s+\\*.+$");
+  rule.format = subCaptionFormat;
+  highlightingRules.append(rule);
+
+  captionFormat.setForeground(Qt::black);
+  captionFormat.setFontWeight(QFont::Bold);
+  rule.pattern = QRegExp("^\\s+\\*\\*.+$");
+  rule.format = captionFormat;
+  highlightingRules.append(rule);
+
 }
 
 void TerminalHighlighter::highlightBlock(const QString &text)
--- a/gui/src/TerminalHighlighter.h	Sat Sep 10 09:15:38 2011 +0200
+++ b/gui/src/TerminalHighlighter.h	Sat Sep 10 09:38:49 2011 +0200
@@ -48,6 +48,9 @@
     QTextCharFormat doubleQouteFormat;
     QTextCharFormat functionFormat;
     QTextCharFormat urlFormat;
+    QTextCharFormat captionFormat;
+    QTextCharFormat subCaptionFormat;
+    QTextCharFormat numberFormat;
 };
 
 
--- a/gui/src/TerminalView.cpp	Sat Sep 10 09:15:38 2011 +0200
+++ b/gui/src/TerminalView.cpp	Sat Sep 10 09:38:49 2011 +0200
@@ -62,3 +62,10 @@
 {
   m_terminalEmulation->processKeyEvent (keyEvent);
 }
+
+void
+TerminalView::mousePressEvent (QMouseEvent *mouseEvent)
+{
+  // TODO: Pass mouse events to the terminal emulation.
+  mouseEvent->accept();
+}
--- a/gui/src/TerminalView.h	Sat Sep 10 09:15:38 2011 +0200
+++ b/gui/src/TerminalView.h	Sat Sep 10 09:38:49 2011 +0200
@@ -42,6 +42,7 @@
 
 protected:
   void keyPressEvent (QKeyEvent *keyEvent);
+  void mousePressEvent (QMouseEvent *mouseEvent);
 
 private:
   TerminalEmulation *m_terminalEmulation;
--- a/gui/src/terminal/TerminalEmulation.h	Sat Sep 10 09:15:38 2011 +0200
+++ b/gui/src/terminal/TerminalEmulation.h	Sat Sep 10 09:38:49 2011 +0200
@@ -3,6 +3,7 @@
 
 #include <QObject>
 #include <QKeyEvent>
+#include <QMouseEvent>
 #include <QTextCursor>
 
 class Terminal