/[svn]/gigedit/trunk/src/gigedit/scripteditor.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/scripteditor.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3391 by schoenebeck, Sun Dec 3 16:03:34 2017 UTC revision 3736 by schoenebeck, Sat Feb 1 19:39:06 2020 UTC
# Line 1  Line 1 
1  /*  /*
2      Copyright (c) 2014-2017 Christian Schoenebeck      Copyright (c) 2014-2020 Christian Schoenebeck
3            
4      This file is part of "gigedit" and released under the terms of the      This file is part of "gigedit" and released under the terms of the
5      GNU General Public License version 2.      GNU General Public License version 2.
# Line 139  ScriptEditor::ScriptEditor() : Line 139  ScriptEditor::ScriptEditor() :
139      m_stringTag->property_foreground() = "#c40c0c"; // red      m_stringTag->property_foreground() = "#c40c0c"; // red
140      m_tagTable->add(m_stringTag);      m_tagTable->add(m_stringTag);
141    
142        m_patchTag = Gtk::TextBuffer::Tag::create();
143        m_patchTag->property_foreground() = "#FF4FF3"; // pink
144        m_patchTag->property_weight() = PANGO_WEIGHT_BOLD;
145        m_tagTable->add(m_patchTag);
146    
147      m_commentTag = Gtk::TextBuffer::Tag::create();      m_commentTag = Gtk::TextBuffer::Tag::create();
148      m_commentTag->property_foreground() = "#9c9c9c"; // gray      m_commentTag->property_foreground() = "#9c9c9c"; // gray
149      m_tagTable->add(m_commentTag);      m_tagTable->add(m_commentTag);
# Line 166  ScriptEditor::ScriptEditor() : Line 171  ScriptEditor::ScriptEditor() :
171      m_lineNrTag->property_foreground() = "#CCCCCC";      m_lineNrTag->property_foreground() = "#CCCCCC";
172      m_tagTable->add(m_lineNrTag);      m_tagTable->add(m_lineNrTag);
173    
174        m_metricTag = Gtk::TextBuffer::Tag::create();
175        m_metricTag->property_foreground() = "#000000"; // black
176        m_tagTable->add(m_metricTag);
177    
178        m_stdUnitTag = Gtk::TextBuffer::Tag::create();
179        m_stdUnitTag->property_foreground() = "#50BC00"; // greenish
180        m_tagTable->add(m_stdUnitTag);
181    
182      // create menu      // create menu
183  #if USE_GTKMM_BUILDER  #if USE_GTKMM_BUILDER
184      m_actionGroup = Gio::SimpleActionGroup::create();      m_actionGroup = Gio::SimpleActionGroup::create();
# Line 265  ScriptEditor::ScriptEditor() : Line 278  ScriptEditor::ScriptEditor() :
278  #endif  #endif
279          color.set("#F5F5F5");          color.set("#F5F5F5");
280          GtkWidget* widget = (GtkWidget*) m_lineNrView.gobj();          GtkWidget* widget = (GtkWidget*) m_lineNrView.gobj();
281  #if GTK_MAJOR_VERSION < 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION <= 22)  #if GTK_MAJOR_VERSION < 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION <= 24)
282          gtk_widget_modify_base(widget, GTK_STATE_NORMAL, color.gobj());          gtk_widget_modify_base(widget, GTK_STATE_NORMAL, color.gobj());
283          gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, color.gobj());          gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, color.gobj());
284  #endif  #endif
# Line 278  ScriptEditor::ScriptEditor() : Line 291  ScriptEditor::ScriptEditor() :
291  #endif  #endif
292          color.set("#EEEEEE");          color.set("#EEEEEE");
293          GtkWidget* widget = (GtkWidget*) m_lineNrTextViewSpacer.gobj();          GtkWidget* widget = (GtkWidget*) m_lineNrTextViewSpacer.gobj();
294  #if GTK_MAJOR_VERSION < 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION <= 22)  #if GTK_MAJOR_VERSION < 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION <= 24)
295          gtk_widget_modify_base(widget, GTK_STATE_NORMAL, color.gobj());          gtk_widget_modify_base(widget, GTK_STATE_NORMAL, color.gobj());
296          gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, color.gobj());          gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, color.gobj());
297  #endif  #endif
# Line 369  ScriptEditor::ScriptEditor() : Line 382  ScriptEditor::ScriptEditor() :
382  #if HAS_GTKMM_SHOW_ALL_CHILDREN  #if HAS_GTKMM_SHOW_ALL_CHILDREN
383      show_all_children();      show_all_children();
384  #endif  #endif
385    
386    #if !USE_LS_SCRIPTVM
387        // make user aware about gigedit had been compiled without liblinuxsampler support
388        m_statusLabel.set_markup(_("Limited editor features (since Gigedit was compiled without liblinuxsampler support)!"));
389        m_statusImage.set(m_warningIcon);
390    #endif
391  }  }
392    
393  ScriptEditor::~ScriptEditor() {  ScriptEditor::~ScriptEditor() {
# Line 591  void ScriptEditor::updateSyntaxHighlight Line 610  void ScriptEditor::updateSyntaxHighlight
610          const LinuxSampler::VMSourceToken& token = tokens[i];          const LinuxSampler::VMSourceToken& token = tokens[i];
611    
612          if (token.isKeyword()) {          if (token.isKeyword()) {
613              applyCodeTag(m_textBuffer, token, m_keywordTag);              if (token.text() == "patch")
614                    applyCodeTag(m_textBuffer, token, m_patchTag);
615                else
616                    applyCodeTag(m_textBuffer, token, m_keywordTag);
617          } else if (token.isVariableName()) {          } else if (token.isVariableName()) {
618              applyCodeTag(m_textBuffer, token, m_variableTag);              applyCodeTag(m_textBuffer, token, m_variableTag);
619          } else if (token.isIdentifier()) {          } else if (token.isIdentifier()) {
# Line 608  void ScriptEditor::updateSyntaxHighlight Line 630  void ScriptEditor::updateSyntaxHighlight
630              applyCodeTag(m_textBuffer, token, m_commentTag);              applyCodeTag(m_textBuffer, token, m_commentTag);
631          } else if (token.isPreprocessor()) {          } else if (token.isPreprocessor()) {
632              applyCodeTag(m_textBuffer, token, m_preprocTag);              applyCodeTag(m_textBuffer, token, m_preprocTag);
633            } else if (token.isMetricPrefix()) {
634                applyCodeTag(m_textBuffer, token, m_metricTag);
635            } else if (token.isStdUnit()) {
636                applyCodeTag(m_textBuffer, token, m_stdUnitTag);
637          } else if (token.isNewLine()) {          } else if (token.isNewLine()) {
638          }          }
639      }      }
# Line 759  bool ScriptEditor::on_motion_notify_even Line 785  bool ScriptEditor::on_motion_notify_even
785      //TODO: event throttling would be a good idea here      //TODO: event throttling would be a good idea here
786      updateIssueTooltip(e);      updateIssueTooltip(e);
787  #endif  #endif
788  #if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION <= 22)  #if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION <= 24)
789      return ManagedWindow::on_motion_notify_event(e);      return ManagedWindow::on_motion_notify_event(e);
790  #else  #else
791      Gdk::EventMotion em = Glib::wrap(e, true);      Gdk::EventMotion em = Glib::wrap(e, true);

Legend:
Removed from v.3391  
changed lines
  Added in v.3736

  ViewVC Help
Powered by ViewVC