/[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 3310 - (hide annotations) (download) (as text)
Sat Jul 15 12:02:21 2017 UTC (6 years, 9 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4461 byte(s)
* Script Editor: Show line numbers.
* Bumped version (1.0.0.svn58).

1 schoenebeck 2604 /*
2 schoenebeck 3068 Copyright (c) 2014-2017 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 2604 #include <gtkmm.h>
18 schoenebeck 3068 #if HAVE_CONFIG_H
19     # include <config.h>
20     #endif
21 schoenebeck 2604 #include "compat.h"
22 schoenebeck 2901 #include <gtkmm/uimanager.h>
23     #include <gtkmm/actiongroup.h>
24 schoenebeck 2893 #include "ManagedWindow.h"
25 schoenebeck 2604
26 schoenebeck 2886 // Should we use a very simple (and buggy) local NKSP syntax parser, or should
27 schoenebeck 2899 // we rather use the full featured NKSP syntax highlighting backend from
28 schoenebeck 2886 // liblinuxsampler for syntax highlighting of this text editor?
29     #if HAVE_LINUXSAMPLER
30     # define USE_LS_SCRIPTVM 1
31     #endif
32    
33     #if USE_LS_SCRIPTVM
34 schoenebeck 3068 # ifdef LIBLINUXSAMPLER_HEADER_FILE
35     # 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 schoenebeck 2886 #endif
42    
43 schoenebeck 2893 class ScriptEditor : public ManagedWindow {
44 schoenebeck 2604 public:
45     ScriptEditor();
46     ~ScriptEditor();
47     void setScript(gig::Script* script);
48 schoenebeck 2893
49 schoenebeck 2903 sigc::signal<void, gig::Script*> signal_script_to_be_changed;
50     sigc::signal<void, gig::Script*> signal_script_changed;
51    
52 schoenebeck 2893 // 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 schoenebeck 2604 protected:
59     Gtk::VBox m_vbox;
60 schoenebeck 2899 Gtk::HBox m_footerHBox;
61     Gtk::HBox m_statusHBox;
62 schoenebeck 2604 Gtk::HButtonBox m_buttonBox;
63     Gtk::ScrolledWindow m_scrolledWindow;
64 schoenebeck 3310 Gtk::HBox m_textViewHBox;
65     Glib::RefPtr<Gtk::TextBuffer> m_lineNrBuffer;
66 schoenebeck 2604 Glib::RefPtr<Gtk::TextBuffer> m_textBuffer;
67     Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;
68     Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;
69     Glib::RefPtr<Gtk::TextBuffer::Tag> m_eventTag;
70 schoenebeck 2886 Glib::RefPtr<Gtk::TextBuffer::Tag> m_variableTag;
71     Glib::RefPtr<Gtk::TextBuffer::Tag> m_functionTag;
72     Glib::RefPtr<Gtk::TextBuffer::Tag> m_numberTag;
73     Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;
74     Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;
75     Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;
76 schoenebeck 2890 Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag;
77     Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag;
78 schoenebeck 3286 Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocCommentTag;
79 schoenebeck 3310 Glib::RefPtr<Gtk::TextBuffer::Tag> m_lineNrTag;
80     Gtk::TextView m_lineNrView;
81     Gtk::TextView m_lineNrTextViewSpacer;
82 schoenebeck 2604 Gtk::TextView m_textView;
83 schoenebeck 2899 Gtk::Image m_statusImage;
84     Gtk::Label m_statusLabel;
85 schoenebeck 2604 Gtk::Button m_applyButton;
86     Gtk::Button m_cancelButton;
87    
88 schoenebeck 2899 Glib::RefPtr<Gdk::Pixbuf> m_warningIcon;
89     Glib::RefPtr<Gdk::Pixbuf> m_errorIcon;
90     Glib::RefPtr<Gdk::Pixbuf> m_successIcon;
91    
92 schoenebeck 2901 Glib::RefPtr<Gtk::ActionGroup> m_actionGroup;
93     Glib::RefPtr<Gtk::UIManager> m_uiManager;
94    
95 schoenebeck 2604 gig::Script* m_script;
96 schoenebeck 2886 #if USE_LS_SCRIPTVM
97     LinuxSampler::ScriptVM* m_vm;
98 schoenebeck 2896 std::vector<LinuxSampler::ParserIssue> m_issues;
99 schoenebeck 2899 std::vector<LinuxSampler::ParserIssue> m_errors;
100     std::vector<LinuxSampler::ParserIssue> m_warnings;
101 schoenebeck 3286 std::vector<LinuxSampler::CodeBlock> m_preprocComments;
102 schoenebeck 2886 #endif
103    
104 schoenebeck 2898 bool isModified() const;
105 schoenebeck 2604 void onButtonCancel();
106     void onButtonApply();
107     void onWindowHide();
108     void onTextInserted(const Gtk::TextBuffer::iterator& it, const Glib::ustring& txt, int length);
109     void onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd);
110     void onModifiedChanged();
111 schoenebeck 2886 #if USE_LS_SCRIPTVM
112     void updateSyntaxHighlightingByVM();
113 schoenebeck 2890 void updateParserIssuesByVM();
114     LinuxSampler::ScriptVM* GetScriptVM();
115 schoenebeck 2897 void updateIssueTooltip(GdkEventMotion* e);
116 schoenebeck 2899 void updateStatusBar();
117 schoenebeck 2886 #endif
118 schoenebeck 2897 bool on_motion_notify_event(GdkEventMotion* e);
119 schoenebeck 2898 bool onWindowDelete(GdkEventAny* e);
120 schoenebeck 2956 void onMenuChangeFontSize();
121     int currentFontSize() const;
122     void setFontSize(int size, bool save);
123 schoenebeck 3310 void updateLineNumbers();
124 schoenebeck 2604 };
125    
126     #endif // GIGEDIT_SCRIPTEDITOR_H

  ViewVC Help
Powered by ViewVC