/* Copyright (c) 2014-2016 Christian Schoenebeck This file is part of "gigedit" and released under the terms of the GNU General Public License version 2. */ #ifndef GIGEDIT_SCRIPTEDITOR_H #define GIGEDIT_SCRIPTEDITOR_H #include #include #include #include "compat.h" #include "ManagedWindow.h" // Should we use a very simple (and buggy) local NKSP syntax parser, or should // we rather use the full features NKSP syntax highlighting backend from // liblinuxsampler for syntax highlighting of this text editor? #if HAVE_LINUXSAMPLER # define USE_LS_SCRIPTVM 1 #endif #if USE_LS_SCRIPTVM namespace LinuxSampler { class ScriptVM; } #endif class ScriptEditor : public ManagedWindow { public: ScriptEditor(); ~ScriptEditor(); void setScript(gig::Script* script); // implementation for abstract methods of interface class "ManagedWindow" virtual Settings::Property* windowSettingX() { return &Settings::singleton()->scriptEditorWindowX; } virtual Settings::Property* windowSettingY() { return &Settings::singleton()->scriptEditorWindowY; } virtual Settings::Property* windowSettingWidth() { return &Settings::singleton()->scriptEditorWindowW; } virtual Settings::Property* windowSettingHeight() { return &Settings::singleton()->scriptEditorWindowH; } protected: Gtk::VBox m_vbox; Gtk::HButtonBox m_buttonBox; Gtk::ScrolledWindow m_scrolledWindow; Glib::RefPtr m_textBuffer; Glib::RefPtr m_tagTable; Glib::RefPtr m_keywordTag; Glib::RefPtr m_eventTag; Glib::RefPtr m_variableTag; Glib::RefPtr m_functionTag; Glib::RefPtr m_numberTag; Glib::RefPtr m_stringTag; Glib::RefPtr m_commentTag; Glib::RefPtr m_preprocTag; Glib::RefPtr m_errorTag; Glib::RefPtr m_warningTag; Gtk::TextView m_textView; Gtk::Button m_applyButton; Gtk::Button m_cancelButton; gig::Script* m_script; #if USE_LS_SCRIPTVM LinuxSampler::ScriptVM* m_vm; #endif void onButtonCancel(); void onButtonApply(); void onWindowHide(); void onTextInserted(const Gtk::TextBuffer::iterator& it, const Glib::ustring& txt, int length); void onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd); void onModifiedChanged(); #if USE_LS_SCRIPTVM void updateSyntaxHighlightingByVM(); void updateParserIssuesByVM(); LinuxSampler::ScriptVM* GetScriptVM(); #endif }; #endif // GIGEDIT_SCRIPTEDITOR_H