/[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 2886 by schoenebeck, Fri Apr 22 15:55:08 2016 UTC revision 3310 by schoenebeck, Sat Jul 15 12:02:21 2017 UTC
# Line 1  Line 1 
1  /*  /*
2      Copyright (c) 2014-2016 Christian Schoenebeck      Copyright (c) 2014-2017 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 8  Line 8 
8  #ifndef GIGEDIT_SCRIPTEDITOR_H  #ifndef GIGEDIT_SCRIPTEDITOR_H
9  #define GIGEDIT_SCRIPTEDITOR_H  #define GIGEDIT_SCRIPTEDITOR_H
10    
11  #include <gig.h>  #ifdef LIBGIG_HEADER_FILE
12  #include <gtkmm.h>  # include LIBGIG_HEADER_FILE(gig.h)
13  #include <config.h>  #else
14    # include <gig.h>
15    #endif
16    
17    #include <gtkmm.h>
18    #if HAVE_CONFIG_H
19    # include <config.h>
20    #endif
21  #include "compat.h"  #include "compat.h"
22    #include <gtkmm/uimanager.h>
23    #include <gtkmm/actiongroup.h>
24    #include "ManagedWindow.h"
25    
26  // 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
27  // we rather use the full features NKSP syntax highlighting backend from  // we rather use the full featured NKSP syntax highlighting backend from
28  // liblinuxsampler for syntax highlighting of this text editor?  // liblinuxsampler for syntax highlighting of this text editor?
29  #if HAVE_LINUXSAMPLER  #if HAVE_LINUXSAMPLER
30  # define USE_LS_SCRIPTVM 1  # define USE_LS_SCRIPTVM 1
31  #endif  #endif
32    
33  #if USE_LS_SCRIPTVM  #if USE_LS_SCRIPTVM
34  namespace LinuxSampler {  # ifdef LIBLINUXSAMPLER_HEADER_FILE
35      class ScriptVM;  #  include LIBLINUXSAMPLER_HEADER_FILE(scriptvm/ScriptVM.h)
36  }  #  include LIBLINUXSAMPLER_HEADER_FILE(scriptvm/ScriptVMFactory.h)
37    # else
38    #  include <linuxsampler/scriptvm/ScriptVM.h>
39    #  include <linuxsampler/scriptvm/ScriptVMFactory.h>
40    # endif
41  #endif  #endif
42    
43  class ScriptEditor : public Gtk::Window {  class ScriptEditor : public ManagedWindow {
44  public:  public:
45      ScriptEditor();      ScriptEditor();
46     ~ScriptEditor();     ~ScriptEditor();
47      void setScript(gig::Script* script);      void setScript(gig::Script* script);
48    
49        sigc::signal<void, gig::Script*> signal_script_to_be_changed;
50        sigc::signal<void, gig::Script*> signal_script_changed;
51    
52        // implementation for abstract methods of interface class "ManagedWindow"
53        virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->scriptEditorWindowX; }
54        virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->scriptEditorWindowY; }
55        virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->scriptEditorWindowW; }
56        virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->scriptEditorWindowH; }
57    
58  protected:  protected:
59      Gtk::VBox m_vbox;      Gtk::VBox m_vbox;
60        Gtk::HBox m_footerHBox;
61        Gtk::HBox m_statusHBox;
62      Gtk::HButtonBox m_buttonBox;      Gtk::HButtonBox m_buttonBox;
63      Gtk::ScrolledWindow m_scrolledWindow;      Gtk::ScrolledWindow m_scrolledWindow;
64        Gtk::HBox m_textViewHBox;
65        Glib::RefPtr<Gtk::TextBuffer> m_lineNrBuffer;
66      Glib::RefPtr<Gtk::TextBuffer> m_textBuffer;      Glib::RefPtr<Gtk::TextBuffer> m_textBuffer;
67      Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;      Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;
68      Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;
# Line 46  protected: Line 73  protected:
73      Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;
74      Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;
75      Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;
76        Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag;
77        Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag;
78        Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocCommentTag;
79        Glib::RefPtr<Gtk::TextBuffer::Tag> m_lineNrTag;
80        Gtk::TextView m_lineNrView;
81        Gtk::TextView m_lineNrTextViewSpacer;
82      Gtk::TextView m_textView;      Gtk::TextView m_textView;
83        Gtk::Image m_statusImage;
84        Gtk::Label m_statusLabel;
85      Gtk::Button m_applyButton;      Gtk::Button m_applyButton;
86      Gtk::Button m_cancelButton;      Gtk::Button m_cancelButton;
87    
88        Glib::RefPtr<Gdk::Pixbuf> m_warningIcon;
89        Glib::RefPtr<Gdk::Pixbuf> m_errorIcon;
90        Glib::RefPtr<Gdk::Pixbuf> m_successIcon;
91    
92        Glib::RefPtr<Gtk::ActionGroup> m_actionGroup;
93        Glib::RefPtr<Gtk::UIManager> m_uiManager;
94    
95      gig::Script* m_script;      gig::Script* m_script;
96  #if USE_LS_SCRIPTVM  #if USE_LS_SCRIPTVM
97      LinuxSampler::ScriptVM* m_vm;      LinuxSampler::ScriptVM* m_vm;
98        std::vector<LinuxSampler::ParserIssue> m_issues;
99        std::vector<LinuxSampler::ParserIssue> m_errors;
100        std::vector<LinuxSampler::ParserIssue> m_warnings;
101        std::vector<LinuxSampler::CodeBlock> m_preprocComments;
102  #endif  #endif
103    
104        bool isModified() const;
105      void onButtonCancel();      void onButtonCancel();
106      void onButtonApply();      void onButtonApply();
107      void onWindowHide();      void onWindowHide();
# Line 63  protected: Line 110  protected:
110      void onModifiedChanged();      void onModifiedChanged();
111  #if USE_LS_SCRIPTVM  #if USE_LS_SCRIPTVM
112      void updateSyntaxHighlightingByVM();      void updateSyntaxHighlightingByVM();
113        void updateParserIssuesByVM();
114        LinuxSampler::ScriptVM* GetScriptVM();
115        void updateIssueTooltip(GdkEventMotion* e);
116        void updateStatusBar();
117  #endif  #endif
118        bool on_motion_notify_event(GdkEventMotion* e);
119        bool onWindowDelete(GdkEventAny* e);
120        void onMenuChangeFontSize();
121        int  currentFontSize() const;
122        void setFontSize(int size, bool save);
123        void updateLineNumbers();
124  };  };
125    
126  #endif // GIGEDIT_SCRIPTEDITOR_H  #endif // GIGEDIT_SCRIPTEDITOR_H

Legend:
Removed from v.2886  
changed lines
  Added in v.3310

  ViewVC Help
Powered by ViewVC