--- gigedit/trunk/src/gigedit/scripteditor.h 2016/04/25 17:35:21 2890 +++ gigedit/trunk/src/gigedit/scripteditor.h 2017/07/15 12:02:21 3310 @@ -1,5 +1,5 @@ /* - Copyright (c) 2014-2016 Christian Schoenebeck + Copyright (c) 2014-2017 Christian Schoenebeck This file is part of "gigedit" and released under the terms of the GNU General Public License version 2. @@ -8,34 +8,61 @@ #ifndef GIGEDIT_SCRIPTEDITOR_H #define GIGEDIT_SCRIPTEDITOR_H -#include -#include -#include +#ifdef LIBGIG_HEADER_FILE +# include LIBGIG_HEADER_FILE(gig.h) +#else +# include +#endif +#include +#if HAVE_CONFIG_H +# include +#endif #include "compat.h" +#include +#include +#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 +// we rather use the full featured 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; -} +# ifdef LIBLINUXSAMPLER_HEADER_FILE +# include LIBLINUXSAMPLER_HEADER_FILE(scriptvm/ScriptVM.h) +# include LIBLINUXSAMPLER_HEADER_FILE(scriptvm/ScriptVMFactory.h) +# else +# include +# include +# endif #endif -class ScriptEditor : public Gtk::Window { +class ScriptEditor : public ManagedWindow { public: ScriptEditor(); ~ScriptEditor(); void setScript(gig::Script* script); + + sigc::signal signal_script_to_be_changed; + sigc::signal signal_script_changed; + + // 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::HBox m_footerHBox; + Gtk::HBox m_statusHBox; Gtk::HButtonBox m_buttonBox; Gtk::ScrolledWindow m_scrolledWindow; + Gtk::HBox m_textViewHBox; + Glib::RefPtr m_lineNrBuffer; Glib::RefPtr m_textBuffer; Glib::RefPtr m_tagTable; Glib::RefPtr m_keywordTag; @@ -48,15 +75,33 @@ Glib::RefPtr m_preprocTag; Glib::RefPtr m_errorTag; Glib::RefPtr m_warningTag; + Glib::RefPtr m_preprocCommentTag; + Glib::RefPtr m_lineNrTag; + Gtk::TextView m_lineNrView; + Gtk::TextView m_lineNrTextViewSpacer; Gtk::TextView m_textView; + Gtk::Image m_statusImage; + Gtk::Label m_statusLabel; Gtk::Button m_applyButton; Gtk::Button m_cancelButton; + Glib::RefPtr m_warningIcon; + Glib::RefPtr m_errorIcon; + Glib::RefPtr m_successIcon; + + Glib::RefPtr m_actionGroup; + Glib::RefPtr m_uiManager; + gig::Script* m_script; #if USE_LS_SCRIPTVM LinuxSampler::ScriptVM* m_vm; + std::vector m_issues; + std::vector m_errors; + std::vector m_warnings; + std::vector m_preprocComments; #endif + bool isModified() const; void onButtonCancel(); void onButtonApply(); void onWindowHide(); @@ -67,7 +112,15 @@ void updateSyntaxHighlightingByVM(); void updateParserIssuesByVM(); LinuxSampler::ScriptVM* GetScriptVM(); + void updateIssueTooltip(GdkEventMotion* e); + void updateStatusBar(); #endif + bool on_motion_notify_event(GdkEventMotion* e); + bool onWindowDelete(GdkEventAny* e); + void onMenuChangeFontSize(); + int currentFontSize() const; + void setFontSize(int size, bool save); + void updateLineNumbers(); }; #endif // GIGEDIT_SCRIPTEDITOR_H