/[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 3364 by schoenebeck, Tue Nov 14 18:07:25 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    #ifdef GTKMM_HEADER_FILE
18    # include GTKMM_HEADER_FILE(gtkmm.h)
19    #else
20    # include <gtkmm.h>
21    #endif
22    #if HAVE_CONFIG_H
23    # include <config.h>
24    #endif
25  #include "compat.h"  #include "compat.h"
26    
27    #if USE_GTKMM_BUILDER
28    # include <gtkmm/builder.h>
29    #else
30    # include <gtkmm/uimanager.h> // deprecated in gtkmm >= 3.21.4
31    #endif
32    
33    #if USE_GLIB_ACTION
34    # include <giomm/simpleactiongroup.h>
35    #else
36    # include <gtkmm/actiongroup.h>
37    #endif
38    
39    #include "ManagedWindow.h"
40    
41  // 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
42  // we rather use the full features NKSP syntax highlighting backend from  // we rather use the full featured NKSP syntax highlighting backend from
43  // liblinuxsampler for syntax highlighting of this text editor?  // liblinuxsampler for syntax highlighting of this text editor?
44  #if HAVE_LINUXSAMPLER  #if HAVE_LINUXSAMPLER
45  # define USE_LS_SCRIPTVM 1  # define USE_LS_SCRIPTVM 1
46  #endif  #endif
47    
48  #if USE_LS_SCRIPTVM  #if USE_LS_SCRIPTVM
49  namespace LinuxSampler {  # ifdef LIBLINUXSAMPLER_HEADER_FILE
50      class ScriptVM;  #  include LIBLINUXSAMPLER_HEADER_FILE(scriptvm/ScriptVM.h)
51  }  #  include LIBLINUXSAMPLER_HEADER_FILE(scriptvm/ScriptVMFactory.h)
52    # else
53    #  include <linuxsampler/scriptvm/ScriptVM.h>
54    #  include <linuxsampler/scriptvm/ScriptVMFactory.h>
55    # endif
56  #endif  #endif
57    
58  class ScriptEditor : public Gtk::Window {  class ScriptEditor : public ManagedWindow {
59  public:  public:
60      ScriptEditor();      ScriptEditor();
61     ~ScriptEditor();     ~ScriptEditor();
62      void setScript(gig::Script* script);      void setScript(gig::Script* script);
63    
64        sigc::signal<void, gig::Script*> signal_script_to_be_changed;
65        sigc::signal<void, gig::Script*> signal_script_changed;
66    
67        // implementation for abstract methods of interface class "ManagedWindow"
68        virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->scriptEditorWindowX; }
69        virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->scriptEditorWindowY; }
70        virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->scriptEditorWindowW; }
71        virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->scriptEditorWindowH; }
72    
73  protected:  protected:
74      Gtk::VBox m_vbox;      VBox m_vbox;
75      Gtk::HButtonBox m_buttonBox;      HBox m_footerHBox;
76        HBox m_statusHBox;
77        HButtonBox m_buttonBox;
78      Gtk::ScrolledWindow m_scrolledWindow;      Gtk::ScrolledWindow m_scrolledWindow;
79        HBox m_textViewHBox;
80        Glib::RefPtr<Gtk::TextBuffer> m_lineNrBuffer;
81      Glib::RefPtr<Gtk::TextBuffer> m_textBuffer;      Glib::RefPtr<Gtk::TextBuffer> m_textBuffer;
82      Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;      Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;
83      Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;
# Line 46  protected: Line 88  protected:
88      Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;
89      Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;
90      Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;      Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;
91        Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag;
92        Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag;
93        Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocCommentTag;
94        Glib::RefPtr<Gtk::TextBuffer::Tag> m_lineNrTag;
95        Gtk::TextView m_lineNrView;
96        Gtk::TextView m_lineNrTextViewSpacer;
97      Gtk::TextView m_textView;      Gtk::TextView m_textView;
98        Gtk::Image m_statusImage;
99        Gtk::Label m_statusLabel;
100      Gtk::Button m_applyButton;      Gtk::Button m_applyButton;
101      Gtk::Button m_cancelButton;      Gtk::Button m_cancelButton;
102    
103    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 20)
104        Glib::RefPtr<Gtk::CssProvider> m_css;
105    #endif
106    
107        Glib::RefPtr<Gdk::Pixbuf> m_warningIcon;
108        Glib::RefPtr<Gdk::Pixbuf> m_errorIcon;
109        Glib::RefPtr<Gdk::Pixbuf> m_successIcon;
110    
111    #if USE_GLIB_ACTION
112        Glib::RefPtr<Gio::SimpleActionGroup> m_actionGroup;
113    #else
114        Glib::RefPtr<Gtk::ActionGroup> m_actionGroup;
115    #endif
116    #if USE_GTKMM_BUILDER
117        Glib::RefPtr<Gtk::Builder> m_uiManager;
118    #else
119        Glib::RefPtr<Gtk::UIManager> m_uiManager;
120    #endif
121    
122      gig::Script* m_script;      gig::Script* m_script;
123  #if USE_LS_SCRIPTVM  #if USE_LS_SCRIPTVM
124      LinuxSampler::ScriptVM* m_vm;      LinuxSampler::ScriptVM* m_vm;
125        std::vector<LinuxSampler::ParserIssue> m_issues;
126        std::vector<LinuxSampler::ParserIssue> m_errors;
127        std::vector<LinuxSampler::ParserIssue> m_warnings;
128        std::vector<LinuxSampler::CodeBlock> m_preprocComments;
129  #endif  #endif
130    
131        bool isModified() const;
132      void onButtonCancel();      void onButtonCancel();
133      void onButtonApply();      void onButtonApply();
134      void onWindowHide();      void onWindowHide();
# Line 63  protected: Line 137  protected:
137      void onModifiedChanged();      void onModifiedChanged();
138  #if USE_LS_SCRIPTVM  #if USE_LS_SCRIPTVM
139      void updateSyntaxHighlightingByVM();      void updateSyntaxHighlightingByVM();
140        void updateParserIssuesByVM();
141        LinuxSampler::ScriptVM* GetScriptVM();
142        void updateIssueTooltip(GdkEventMotion* e);
143        void updateStatusBar();
144    #endif
145        bool on_motion_notify_event(GdkEventMotion* e);
146    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2
147        bool onWindowDelete(Gdk::Event& e);
148  #endif  #endif
149        bool onWindowDeleteP(GdkEventAny* e);
150        void onMenuChangeFontSize();
151        int  currentFontSize() const;
152        void setFontSize(int size, bool save);
153        void updateLineNumbers();
154  };  };
155    
156  #endif // GIGEDIT_SCRIPTEDITOR_H  #endif // GIGEDIT_SCRIPTEDITOR_H

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

  ViewVC Help
Powered by ViewVC