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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2901 - (show annotations) (download) (as text)
Mon May 2 16:10:56 2016 UTC (7 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3585 byte(s)
* Script Editor: Added menu bar and two initial entries: "Apply" (Ctrl-S)
  and "Close" (Ctrl-X).
* Bumped version (1.0.0.svn12).

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

  ViewVC Help
Powered by ViewVC