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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2893 - (show annotations) (download) (as text)
Fri Apr 29 14:19:53 2016 UTC (7 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 2769 byte(s)
* Automatically save & restore window size and position
  (yet limited to main window and script editor window).
* Bumped version (1.0.0.svn6).

1 /*
2 Copyright (c) 2014-2016 Christian Schoenebeck
3
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 #include <gig.h>
12 #include <gtkmm.h>
13 #include <config.h>
14 #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 namespace LinuxSampler {
26 class ScriptVM;
27 }
28 #endif
29
30 class ScriptEditor : public ManagedWindow {
31 public:
32 ScriptEditor();
33 ~ScriptEditor();
34 void setScript(gig::Script* script);
35
36 // implementation for abstract methods of interface class "ManagedWindow"
37 virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->scriptEditorWindowX; }
38 virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->scriptEditorWindowY; }
39 virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->scriptEditorWindowW; }
40 virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->scriptEditorWindowH; }
41
42 protected:
43 Gtk::VBox m_vbox;
44 Gtk::HButtonBox m_buttonBox;
45 Gtk::ScrolledWindow m_scrolledWindow;
46 Glib::RefPtr<Gtk::TextBuffer> m_textBuffer;
47 Glib::RefPtr<Gtk::TextBuffer::TagTable> m_tagTable;
48 Glib::RefPtr<Gtk::TextBuffer::Tag> m_keywordTag;
49 Glib::RefPtr<Gtk::TextBuffer::Tag> m_eventTag;
50 Glib::RefPtr<Gtk::TextBuffer::Tag> m_variableTag;
51 Glib::RefPtr<Gtk::TextBuffer::Tag> m_functionTag;
52 Glib::RefPtr<Gtk::TextBuffer::Tag> m_numberTag;
53 Glib::RefPtr<Gtk::TextBuffer::Tag> m_stringTag;
54 Glib::RefPtr<Gtk::TextBuffer::Tag> m_commentTag;
55 Glib::RefPtr<Gtk::TextBuffer::Tag> m_preprocTag;
56 Glib::RefPtr<Gtk::TextBuffer::Tag> m_errorTag;
57 Glib::RefPtr<Gtk::TextBuffer::Tag> m_warningTag;
58 Gtk::TextView m_textView;
59 Gtk::Button m_applyButton;
60 Gtk::Button m_cancelButton;
61
62 gig::Script* m_script;
63 #if USE_LS_SCRIPTVM
64 LinuxSampler::ScriptVM* m_vm;
65 #endif
66
67 void onButtonCancel();
68 void onButtonApply();
69 void onWindowHide();
70 void onTextInserted(const Gtk::TextBuffer::iterator& it, const Glib::ustring& txt, int length);
71 void onTextErased(const Gtk::TextBuffer::iterator& itStart, const Gtk::TextBuffer::iterator& itEnd);
72 void onModifiedChanged();
73 #if USE_LS_SCRIPTVM
74 void updateSyntaxHighlightingByVM();
75 void updateParserIssuesByVM();
76 LinuxSampler::ScriptVM* GetScriptVM();
77 #endif
78 };
79
80 #endif // GIGEDIT_SCRIPTEDITOR_H

  ViewVC Help
Powered by ViewVC