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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2604 by schoenebeck, Sat Jun 7 22:34:31 2014 UTC revision 2898 by schoenebeck, Sun May 1 21:17:42 2016 UTC
# Line 1  Line 1 
1  /*  /*
2      Copyright (c) 2014 Christian Schoenebeck      Copyright (c) 2014-2016 Christian Schoenebeck
3            
4      This file is part of "gigedit" and released under the terms of the      This file is part of "gigedit" and released under the terms of the
5      GNU General Public License version 2.      GNU General Public License version 2.
# Line 10  Line 10 
10    
11  #include <gig.h>  #include <gig.h>
12  #include <gtkmm.h>  #include <gtkmm.h>
13    #include <config.h>
14  #include "compat.h"  #include "compat.h"
15    #include "ManagedWindow.h"
16    
17    // 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    # include <linuxsampler/scriptvm/ScriptVM.h>
26    # include <linuxsampler/scriptvm/ScriptVMFactory.h>
27    #endif
28    
29  class ScriptEditor : public Gtk::Window {  class ScriptEditor : public ManagedWindow {
30  public:  public:
31      ScriptEditor();      ScriptEditor();
32     ~ScriptEditor();     ~ScriptEditor();
33      void setScript(gig::Script* script);      void setScript(gig::Script* script);
34    
35        // implementation for abstract methods of interface class "ManagedWindow"
36        virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->scriptEditorWindowX; }
37        virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->scriptEditorWindowY; }
38        virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->scriptEditorWindowW; }
39        virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->scriptEditorWindowH; }
40    
41  protected:  protected:
42      Gtk::VBox m_vbox;      Gtk::VBox m_vbox;
43      Gtk::HButtonBox m_buttonBox;      Gtk::HButtonBox m_buttonBox;
# Line 26  protected: Line 46  protected:
46      Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;      Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;
47      Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;
48      Glib::RefPtr<Gtk::TextBuffer::Tag> m_eventTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_eventTag;
49        Glib::RefPtr<Gtk::TextBuffer::Tag> m_variableTag;
50        Glib::RefPtr<Gtk::TextBuffer::Tag> m_functionTag;
51        Glib::RefPtr<Gtk::TextBuffer::Tag> m_numberTag;
52        Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;
53        Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;
54        Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;
55        Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag;
56        Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag;
57      Gtk::TextView m_textView;      Gtk::TextView m_textView;
58      Gtk::Button m_applyButton;      Gtk::Button m_applyButton;
59      Gtk::Button m_cancelButton;      Gtk::Button m_cancelButton;
60    
61      gig::Script* m_script;      gig::Script* m_script;
62        #if USE_LS_SCRIPTVM
63        LinuxSampler::ScriptVM* m_vm;
64        std::vector<LinuxSampler::ParserIssue> m_issues;
65    #endif
66    
67        bool isModified() const;
68      void onButtonCancel();      void onButtonCancel();
69      void onButtonApply();      void onButtonApply();
70      void onWindowHide();      void onWindowHide();
71      void onTextInserted(const Gtk::TextBuffer::iterator& it, const Glib::ustring& txt, int length);      void onTextInserted(const Gtk::TextBuffer::iterator& it, const Glib::ustring& txt, int length);
72      void onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd);      void onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd);
73      void onModifiedChanged();      void onModifiedChanged();
74    #if USE_LS_SCRIPTVM
75        void updateSyntaxHighlightingByVM();
76        void updateParserIssuesByVM();
77        LinuxSampler::ScriptVM* GetScriptVM();
78        void updateIssueTooltip(GdkEventMotion* e);
79    #endif
80        bool on_motion_notify_event(GdkEventMotion* e);
81        bool onWindowDelete(GdkEventAny* e);
82  };  };
83    
84  #endif // GIGEDIT_SCRIPTEDITOR_H  #endif // GIGEDIT_SCRIPTEDITOR_H

Legend:
Removed from v.2604  
changed lines
  Added in v.2898

  ViewVC Help
Powered by ViewVC