Explorar o código

more editor stuff

Zoadian %!s(int64=10) %!d(string=hai) anos
pai
achega
50a3732950
Modificáronse 4 ficheiros con 10 adicións e 9 borrados
  1. 3 3
      ccsim.h
  2. 3 3
      debugwidget.h
  3. 2 0
      syntaxhighlighter.cpp
  4. 2 3
      wgtcodeeditor.cpp

+ 3 - 3
ccsim.h

@@ -11,13 +11,13 @@ class CCSim : public QMainWindow
 {
 {
     Q_OBJECT
     Q_OBJECT
 
 
+private:
+    Ui::CCSim *ui;
+
 public:
 public:
     explicit CCSim(QWidget *parent = 0);
     explicit CCSim(QWidget *parent = 0);
     ~CCSim();
     ~CCSim();
 
 
-private:
-    Ui::CCSim *ui;
-
 public slots:
 public slots:
     void updateUiElements();
     void updateUiElements();
 };
 };

+ 3 - 3
debugwidget.h

@@ -11,12 +11,12 @@ class DebugWidget : public QWidget
 {
 {
     Q_OBJECT
     Q_OBJECT
 
 
+private:
+    Ui::DebugWidget *ui;
+
 public:
 public:
     explicit DebugWidget(QWidget *parent = 0);
     explicit DebugWidget(QWidget *parent = 0);
     ~DebugWidget();
     ~DebugWidget();
-
-private:
-    Ui::DebugWidget *ui;
 };
 };
 
 
 #endif // DEBUGWIDGET_H
 #endif // DEBUGWIDGET_H

+ 2 - 0
syntaxhighlighter.cpp

@@ -47,11 +47,13 @@ SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent)
     bankFormat.setForeground(Qt::white);
     bankFormat.setForeground(Qt::white);
     bankFormat.setBackground(Qt::darkGray);
     bankFormat.setBackground(Qt::darkGray);
     rule.pattern = QRegExp("\\s*BANK.*");
     rule.pattern = QRegExp("\\s*BANK.*");
+    rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
     rule.format = bankFormat;
     rule.format = bankFormat;
     highlightingRules.append(rule);
     highlightingRules.append(rule);
 
 
     singleLineCommentFormat.setForeground(Qt::darkGreen);
     singleLineCommentFormat.setForeground(Qt::darkGreen);
     rule.pattern = QRegExp("//[^\n]*");
     rule.pattern = QRegExp("//[^\n]*");
+    rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
     rule.format = singleLineCommentFormat;
     rule.format = singleLineCommentFormat;
     highlightingRules.append(rule);
     highlightingRules.append(rule);
 
 

+ 2 - 3
wgtcodeeditor.cpp

@@ -76,9 +76,8 @@ void WgtCodeEditor::highlightCurrentLine()
     if (!isReadOnly()) {
     if (!isReadOnly()) {
         QTextEdit::ExtraSelection selection;
         QTextEdit::ExtraSelection selection;
 
 
-        QColor lineColor = QColor(Qt::yellow).lighter(160);
 
 
-        selection.format.setBackground(lineColor);
+        selection.format.setBackground(palette().alternateBase());
         selection.format.setProperty(QTextFormat::FullWidthSelection, true);
         selection.format.setProperty(QTextFormat::FullWidthSelection, true);
         selection.cursor = textCursor();
         selection.cursor = textCursor();
         selection.cursor.clearSelection();
         selection.cursor.clearSelection();
@@ -91,7 +90,7 @@ void WgtCodeEditor::highlightCurrentLine()
 void WgtCodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
 void WgtCodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
 {
 {
     QPainter painter(lineNumberArea);
     QPainter painter(lineNumberArea);
-    painter.fillRect(event->rect(), Qt::lightGray);
+    painter.fillRect(event->rect(), palette().alternateBase());
     QTextBlock block = firstVisibleBlock();
     QTextBlock block = firstVisibleBlock();
     int blockNumber = block.blockNumber();
     int blockNumber = block.blockNumber();
     int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();
     int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();