11 |
#include <gig.h> |
#include <gig.h> |
12 |
#include <gtkmm.h> |
#include <gtkmm.h> |
13 |
#include <config.h> |
#include <config.h> |
|
|
|
14 |
#include "compat.h" |
#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 |
// Should we use a very simple (and buggy) local NKSP syntax parser, or should |
20 |
// we rather use the full features NKSP syntax highlighting backend from |
// we rather use the full featured NKSP syntax highlighting backend from |
21 |
// liblinuxsampler for syntax highlighting of this text editor? |
// liblinuxsampler for syntax highlighting of this text editor? |
22 |
#if HAVE_LINUXSAMPLER |
#if HAVE_LINUXSAMPLER |
23 |
# define USE_LS_SCRIPTVM 1 |
# define USE_LS_SCRIPTVM 1 |
24 |
#endif |
#endif |
25 |
|
|
26 |
#if USE_LS_SCRIPTVM |
#if USE_LS_SCRIPTVM |
27 |
namespace LinuxSampler { |
# include <linuxsampler/scriptvm/ScriptVM.h> |
28 |
class ScriptVM; |
# include <linuxsampler/scriptvm/ScriptVMFactory.h> |
|
} |
|
29 |
#endif |
#endif |
30 |
|
|
31 |
class ScriptEditor : public Gtk::Window { |
class ScriptEditor : public ManagedWindow { |
32 |
public: |
public: |
33 |
ScriptEditor(); |
ScriptEditor(); |
34 |
~ScriptEditor(); |
~ScriptEditor(); |
35 |
void setScript(gig::Script* script); |
void setScript(gig::Script* script); |
36 |
|
|
37 |
|
sigc::signal<void, gig::Script*> signal_script_to_be_changed; |
38 |
|
sigc::signal<void, gig::Script*> signal_script_changed; |
39 |
|
|
40 |
|
// implementation for abstract methods of interface class "ManagedWindow" |
41 |
|
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->scriptEditorWindowX; } |
42 |
|
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->scriptEditorWindowY; } |
43 |
|
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->scriptEditorWindowW; } |
44 |
|
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->scriptEditorWindowH; } |
45 |
|
|
46 |
protected: |
protected: |
47 |
Gtk::VBox m_vbox; |
Gtk::VBox m_vbox; |
48 |
|
Gtk::HBox m_footerHBox; |
49 |
|
Gtk::HBox m_statusHBox; |
50 |
Gtk::HButtonBox m_buttonBox; |
Gtk::HButtonBox m_buttonBox; |
51 |
Gtk::ScrolledWindow m_scrolledWindow; |
Gtk::ScrolledWindow m_scrolledWindow; |
52 |
Glib::RefPtr<Gtk::TextBuffer> m_textBuffer; |
Glib::RefPtr<Gtk::TextBuffer> m_textBuffer; |
62 |
Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag; |
Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag; |
63 |
Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag; |
Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag; |
64 |
Gtk::TextView m_textView; |
Gtk::TextView m_textView; |
65 |
|
Gtk::Image m_statusImage; |
66 |
|
Gtk::Label m_statusLabel; |
67 |
Gtk::Button m_applyButton; |
Gtk::Button m_applyButton; |
68 |
Gtk::Button m_cancelButton; |
Gtk::Button m_cancelButton; |
69 |
|
|
70 |
|
Glib::RefPtr<Gdk::Pixbuf> m_warningIcon; |
71 |
|
Glib::RefPtr<Gdk::Pixbuf> m_errorIcon; |
72 |
|
Glib::RefPtr<Gdk::Pixbuf> m_successIcon; |
73 |
|
|
74 |
|
Glib::RefPtr<Gtk::ActionGroup> m_actionGroup; |
75 |
|
Glib::RefPtr<Gtk::UIManager> m_uiManager; |
76 |
|
|
77 |
gig::Script* m_script; |
gig::Script* m_script; |
78 |
#if USE_LS_SCRIPTVM |
#if USE_LS_SCRIPTVM |
79 |
LinuxSampler::ScriptVM* m_vm; |
LinuxSampler::ScriptVM* m_vm; |
80 |
|
std::vector<LinuxSampler::ParserIssue> m_issues; |
81 |
|
std::vector<LinuxSampler::ParserIssue> m_errors; |
82 |
|
std::vector<LinuxSampler::ParserIssue> m_warnings; |
83 |
#endif |
#endif |
84 |
|
|
85 |
|
bool isModified() const; |
86 |
void onButtonCancel(); |
void onButtonCancel(); |
87 |
void onButtonApply(); |
void onButtonApply(); |
88 |
void onWindowHide(); |
void onWindowHide(); |
93 |
void updateSyntaxHighlightingByVM(); |
void updateSyntaxHighlightingByVM(); |
94 |
void updateParserIssuesByVM(); |
void updateParserIssuesByVM(); |
95 |
LinuxSampler::ScriptVM* GetScriptVM(); |
LinuxSampler::ScriptVM* GetScriptVM(); |
96 |
|
void updateIssueTooltip(GdkEventMotion* e); |
97 |
|
void updateStatusBar(); |
98 |
#endif |
#endif |
99 |
|
bool on_motion_notify_event(GdkEventMotion* e); |
100 |
|
bool onWindowDelete(GdkEventAny* e); |
101 |
|
void onMenuChangeFontSize(); |
102 |
|
int currentFontSize() const; |
103 |
|
void setFontSize(int size, bool save); |
104 |
}; |
}; |
105 |
|
|
106 |
#endif // GIGEDIT_SCRIPTEDITOR_H |
#endif // GIGEDIT_SCRIPTEDITOR_H |