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

Annotation of /gigedit/trunk/src/gigedit/scripteditor.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2899 - (hide annotations) (download) (as text)
Mon May 2 14:36:40 2016 UTC (7 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3428 byte(s)
* Script Editor: Added status bar at the bottom of the script editor
  window showing the amount (if any) of errors and warnings.
* Bumped version (1.0.0.svn11).

1 schoenebeck 2604 /*
2 schoenebeck 2886 Copyright (c) 2014-2016 Christian Schoenebeck
3 schoenebeck 2604
4     This file is part of "gigedit" and released under the terms of the
5     GNU General Public License version 2.
6     */
7    
8     #ifndef GIGEDIT_SCRIPTEDITOR_H
9     #define GIGEDIT_SCRIPTEDITOR_H
10    
11     #include <gig.h>
12     #include <gtkmm.h>
13 schoenebeck 2886 #include <config.h>
14 schoenebeck 2604 #include "compat.h"
15 schoenebeck 2893 #include "ManagedWindow.h"
16 schoenebeck 2604
17 schoenebeck 2886 // Should we use a very simple (and buggy) local NKSP syntax parser, or should
18 schoenebeck 2899 // we rather use the full featured NKSP syntax highlighting backend from
19 schoenebeck 2886 // liblinuxsampler for syntax highlighting of this text editor?
20     #if HAVE_LINUXSAMPLER
21     # define USE_LS_SCRIPTVM 1
22     #endif
23    
24     #if USE_LS_SCRIPTVM
25 schoenebeck 2896 # include <linuxsampler/scriptvm/ScriptVM.h>
26     # include <linuxsampler/scriptvm/ScriptVMFactory.h>
27 schoenebeck 2886 #endif
28    
29 schoenebeck 2893 class ScriptEditor : public ManagedWindow {
30 schoenebeck 2604 public:
31     ScriptEditor();
32     ~ScriptEditor();
33     void setScript(gig::Script* script);
34 schoenebeck 2893
35     // implementation for abstract methods of interface class "ManagedWindow"
36     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->scriptEditorWindowX; }
37     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->scriptEditorWindowY; }
38     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->scriptEditorWindowW; }
39     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->scriptEditorWindowH; }
40    
41 schoenebeck 2604 protected:
42     Gtk::VBox m_vbox;
43 schoenebeck 2899 Gtk::HBox m_footerHBox;
44     Gtk::HBox m_statusHBox;
45 schoenebeck 2604 Gtk::HButtonBox m_buttonBox;
46     Gtk::ScrolledWindow m_scrolledWindow;
47     Glib::RefPtr<Gtk::TextBuffer> m_textBuffer;
48     Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;
49     Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;
50     Glib::RefPtr<Gtk::TextBuffer::Tag> m_eventTag;
51 schoenebeck 2886 Glib::RefPtr<Gtk::TextBuffer::Tag> m_variableTag;
52     Glib::RefPtr<Gtk::TextBuffer::Tag> m_functionTag;
53     Glib::RefPtr<Gtk::TextBuffer::Tag> m_numberTag;
54     Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;
55     Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;
56     Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;
57 schoenebeck 2890 Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag;
58     Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag;
59 schoenebeck 2604 Gtk::TextView m_textView;
60 schoenebeck 2899 Gtk::Image m_statusImage;
61     Gtk::Label m_statusLabel;
62 schoenebeck 2604 Gtk::Button m_applyButton;
63     Gtk::Button m_cancelButton;
64    
65 schoenebeck 2899 Glib::RefPtr<Gdk::Pixbuf> m_warningIcon;
66     Glib::RefPtr<Gdk::Pixbuf> m_errorIcon;
67     Glib::RefPtr<Gdk::Pixbuf> m_successIcon;
68    
69 schoenebeck 2604 gig::Script* m_script;
70 schoenebeck 2886 #if USE_LS_SCRIPTVM
71     LinuxSampler::ScriptVM* m_vm;
72 schoenebeck 2896 std::vector<LinuxSampler::ParserIssue> m_issues;
73 schoenebeck 2899 std::vector<LinuxSampler::ParserIssue> m_errors;
74     std::vector<LinuxSampler::ParserIssue> m_warnings;
75 schoenebeck 2886 #endif
76    
77 schoenebeck 2898 bool isModified() const;
78 schoenebeck 2604 void onButtonCancel();
79     void onButtonApply();
80     void onWindowHide();
81     void onTextInserted(const Gtk::TextBuffer::iterator& it, const Glib::ustring& txt, int length);
82     void onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd);
83     void onModifiedChanged();
84 schoenebeck 2886 #if USE_LS_SCRIPTVM
85     void updateSyntaxHighlightingByVM();
86 schoenebeck 2890 void updateParserIssuesByVM();
87     LinuxSampler::ScriptVM* GetScriptVM();
88 schoenebeck 2897 void updateIssueTooltip(GdkEventMotion* e);
89 schoenebeck 2899 void updateStatusBar();
90 schoenebeck 2886 #endif
91 schoenebeck 2897 bool on_motion_notify_event(GdkEventMotion* e);
92 schoenebeck 2898 bool onWindowDelete(GdkEventAny* e);
93 schoenebeck 2604 };
94    
95     #endif // GIGEDIT_SCRIPTEDITOR_H

  ViewVC Help
Powered by ViewVC