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 |
|
15 |
|
|
#include "compat.h" |
16 |
|
|
|
17 |
schoenebeck |
2886 |
// Should we use a very simple (and buggy) local NKSP syntax parser, or should |
18 |
|
|
// we rather use the full features NKSP syntax highlighting backend from |
19 |
|
|
// 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 |
|
|
namespace LinuxSampler { |
26 |
|
|
class ScriptVM; |
27 |
|
|
} |
28 |
|
|
#endif |
29 |
|
|
|
30 |
schoenebeck |
2604 |
class ScriptEditor : public Gtk::Window { |
31 |
|
|
public: |
32 |
|
|
ScriptEditor(); |
33 |
|
|
~ScriptEditor(); |
34 |
|
|
void setScript(gig::Script* script); |
35 |
|
|
protected: |
36 |
|
|
Gtk::VBox m_vbox; |
37 |
|
|
Gtk::HButtonBox m_buttonBox; |
38 |
|
|
Gtk::ScrolledWindow m_scrolledWindow; |
39 |
|
|
Glib::RefPtr<Gtk::TextBuffer> m_textBuffer; |
40 |
|
|
Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable; |
41 |
|
|
Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag; |
42 |
|
|
Glib::RefPtr<Gtk::TextBuffer::Tag> m_eventTag; |
43 |
schoenebeck |
2886 |
Glib::RefPtr<Gtk::TextBuffer::Tag> m_variableTag; |
44 |
|
|
Glib::RefPtr<Gtk::TextBuffer::Tag> m_functionTag; |
45 |
|
|
Glib::RefPtr<Gtk::TextBuffer::Tag> m_numberTag; |
46 |
|
|
Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag; |
47 |
|
|
Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag; |
48 |
|
|
Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag; |
49 |
schoenebeck |
2604 |
Gtk::TextView m_textView; |
50 |
|
|
Gtk::Button m_applyButton; |
51 |
|
|
Gtk::Button m_cancelButton; |
52 |
|
|
|
53 |
|
|
gig::Script* m_script; |
54 |
schoenebeck |
2886 |
#if USE_LS_SCRIPTVM |
55 |
|
|
LinuxSampler::ScriptVM* m_vm; |
56 |
|
|
#endif |
57 |
|
|
|
58 |
schoenebeck |
2604 |
void onButtonCancel(); |
59 |
|
|
void onButtonApply(); |
60 |
|
|
void onWindowHide(); |
61 |
|
|
void onTextInserted(const Gtk::TextBuffer::iterator& it, const Glib::ustring& txt, int length); |
62 |
|
|
void onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd); |
63 |
|
|
void onModifiedChanged(); |
64 |
schoenebeck |
2886 |
#if USE_LS_SCRIPTVM |
65 |
|
|
void updateSyntaxHighlightingByVM(); |
66 |
|
|
#endif |
67 |
schoenebeck |
2604 |
}; |
68 |
|
|
|
69 |
|
|
#endif // GIGEDIT_SCRIPTEDITOR_H |