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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3736 - (hide annotations) (download) (as text)
Sat Feb 1 19:39:06 2020 UTC (4 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5359 byte(s)
* Script Editor: highlight new NKSP 'patch' keyword in pink color.

* Bumped version (1.1.1.svn13).

1 schoenebeck 2604 /*
2 schoenebeck 3736 Copyright (c) 2014-2020 Christian Schoenebeck
3 schoenebeck 2604
4     This file is part of "gigedit" and released under the terms of the
5     GNU General Public License version 2.
6     */
7    
8     #ifndef GIGEDIT_SCRIPTEDITOR_H
9     #define GIGEDIT_SCRIPTEDITOR_H
10    
11 schoenebeck 3068 #ifdef LIBGIG_HEADER_FILE
12     # include LIBGIG_HEADER_FILE(gig.h)
13     #else
14     # include <gig.h>
15     #endif
16    
17 schoenebeck 3364 #ifdef GTKMM_HEADER_FILE
18     # include GTKMM_HEADER_FILE(gtkmm.h)
19     #else
20     # include <gtkmm.h>
21     #endif
22 schoenebeck 3068 #if HAVE_CONFIG_H
23     # include <config.h>
24     #endif
25 schoenebeck 2604 #include "compat.h"
26 schoenebeck 3364
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 schoenebeck 2893 #include "ManagedWindow.h"
40 schoenebeck 2604
41 schoenebeck 2886 // Should we use a very simple (and buggy) local NKSP syntax parser, or should
42 schoenebeck 2899 // we rather use the full featured NKSP syntax highlighting backend from
43 schoenebeck 2886 // liblinuxsampler for syntax highlighting of this text editor?
44     #if HAVE_LINUXSAMPLER
45     # define USE_LS_SCRIPTVM 1
46     #endif
47    
48     #if USE_LS_SCRIPTVM
49 schoenebeck 3068 # ifdef LIBLINUXSAMPLER_HEADER_FILE
50     # 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 schoenebeck 2886 #endif
57    
58 schoenebeck 2893 class ScriptEditor : public ManagedWindow {
59 schoenebeck 2604 public:
60     ScriptEditor();
61     ~ScriptEditor();
62     void setScript(gig::Script* script);
63 schoenebeck 2893
64 schoenebeck 2903 sigc::signal<void, gig::Script*> signal_script_to_be_changed;
65     sigc::signal<void, gig::Script*> signal_script_changed;
66    
67 schoenebeck 2893 // 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 schoenebeck 2604 protected:
74 schoenebeck 3364 VBox m_vbox;
75     HBox m_footerHBox;
76     HBox m_statusHBox;
77     HButtonBox m_buttonBox;
78 schoenebeck 2604 Gtk::ScrolledWindow m_scrolledWindow;
79 schoenebeck 3364 HBox m_textViewHBox;
80 schoenebeck 3310 Glib::RefPtr<Gtk::TextBuffer> m_lineNrBuffer;
81 schoenebeck 2604 Glib::RefPtr<Gtk::TextBuffer> m_textBuffer;
82     Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;
83     Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;
84     Glib::RefPtr<Gtk::TextBuffer::Tag> m_eventTag;
85 schoenebeck 2886 Glib::RefPtr<Gtk::TextBuffer::Tag> m_variableTag;
86     Glib::RefPtr<Gtk::TextBuffer::Tag> m_functionTag;
87     Glib::RefPtr<Gtk::TextBuffer::Tag> m_numberTag;
88     Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;
89 schoenebeck 3736 Glib::RefPtr<Gtk::TextBuffer::Tag> m_patchTag;
90 schoenebeck 2886 Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;
91     Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;
92 schoenebeck 2890 Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag;
93     Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag;
94 schoenebeck 3286 Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocCommentTag;
95 schoenebeck 3310 Glib::RefPtr<Gtk::TextBuffer::Tag> m_lineNrTag;
96 schoenebeck 3566 Glib::RefPtr<Gtk::TextBuffer::Tag> m_metricTag;
97     Glib::RefPtr<Gtk::TextBuffer::Tag> m_stdUnitTag;
98 schoenebeck 3310 Gtk::TextView m_lineNrView;
99     Gtk::TextView m_lineNrTextViewSpacer;
100 schoenebeck 2604 Gtk::TextView m_textView;
101 schoenebeck 2899 Gtk::Image m_statusImage;
102     Gtk::Label m_statusLabel;
103 schoenebeck 2604 Gtk::Button m_applyButton;
104     Gtk::Button m_cancelButton;
105    
106 schoenebeck 3364 #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 20)
107     Glib::RefPtr<Gtk::CssProvider> m_css;
108     #endif
109    
110 schoenebeck 2899 Glib::RefPtr<Gdk::Pixbuf> m_warningIcon;
111     Glib::RefPtr<Gdk::Pixbuf> m_errorIcon;
112     Glib::RefPtr<Gdk::Pixbuf> m_successIcon;
113    
114 schoenebeck 3364 #if USE_GLIB_ACTION
115     Glib::RefPtr<Gio::SimpleActionGroup> m_actionGroup;
116     #else
117 schoenebeck 2901 Glib::RefPtr<Gtk::ActionGroup> m_actionGroup;
118 schoenebeck 3364 #endif
119     #if USE_GTKMM_BUILDER
120     Glib::RefPtr<Gtk::Builder> m_uiManager;
121     #else
122 schoenebeck 2901 Glib::RefPtr<Gtk::UIManager> m_uiManager;
123 schoenebeck 3364 #endif
124 schoenebeck 2901
125 schoenebeck 2604 gig::Script* m_script;
126 schoenebeck 2886 #if USE_LS_SCRIPTVM
127     LinuxSampler::ScriptVM* m_vm;
128 schoenebeck 2896 std::vector<LinuxSampler::ParserIssue> m_issues;
129 schoenebeck 2899 std::vector<LinuxSampler::ParserIssue> m_errors;
130     std::vector<LinuxSampler::ParserIssue> m_warnings;
131 schoenebeck 3286 std::vector<LinuxSampler::CodeBlock> m_preprocComments;
132 schoenebeck 2886 #endif
133    
134 schoenebeck 2898 bool isModified() const;
135 schoenebeck 2604 void onButtonCancel();
136     void onButtonApply();
137     void onWindowHide();
138     void onTextInserted(const Gtk::TextBuffer::iterator& it, const Glib::ustring& txt, int length);
139     void onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd);
140     void onModifiedChanged();
141 schoenebeck 2886 #if USE_LS_SCRIPTVM
142     void updateSyntaxHighlightingByVM();
143 schoenebeck 2890 void updateParserIssuesByVM();
144     LinuxSampler::ScriptVM* GetScriptVM();
145 schoenebeck 2897 void updateIssueTooltip(GdkEventMotion* e);
146 schoenebeck 2899 void updateStatusBar();
147 schoenebeck 2886 #endif
148 schoenebeck 2897 bool on_motion_notify_event(GdkEventMotion* e);
149 schoenebeck 3364 #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
150     bool onWindowDelete(Gdk::Event& e);
151     #endif
152     bool onWindowDeleteP(GdkEventAny* e);
153 schoenebeck 2956 void onMenuChangeFontSize();
154     int currentFontSize() const;
155     void setFontSize(int size, bool save);
156 schoenebeck 3310 void updateLineNumbers();
157 schoenebeck 2604 };
158    
159     #endif // GIGEDIT_SCRIPTEDITOR_H

  ViewVC Help
Powered by ViewVC