1 |
schoenebeck |
2610 |
/* |
2 |
schoenebeck |
3068 |
Copyright (c) 2014 - 2017 Christian Schoenebeck |
3 |
schoenebeck |
2610 |
|
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_SCRIPTSLOTS_H |
9 |
|
|
#define GIGEDIT_SCRIPTSLOTS_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 |
2610 |
#include "compat.h" |
23 |
|
|
#include <vector> |
24 |
schoenebeck |
2894 |
#include "Settings.h" |
25 |
|
|
#include "ManagedWindow.h" |
26 |
schoenebeck |
2610 |
|
27 |
schoenebeck |
2894 |
class ScriptSlots : public ManagedWindow { |
28 |
schoenebeck |
2610 |
public: |
29 |
|
|
ScriptSlots(); |
30 |
|
|
~ScriptSlots(); |
31 |
|
|
void setInstrument(gig::Instrument* instrument); |
32 |
schoenebeck |
2894 |
|
33 |
schoenebeck |
3197 |
sigc::signal<void, gig::Instrument*>& signal_script_slots_changed(); |
34 |
|
|
|
35 |
schoenebeck |
2894 |
// implementation for abstract methods of interface class "ManagedWindow" |
36 |
|
|
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->scriptSlotsWindowX; } |
37 |
|
|
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->scriptSlotsWindowY; } |
38 |
|
|
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->scriptSlotsWindowW; } |
39 |
|
|
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->scriptSlotsWindowH; } |
40 |
|
|
|
41 |
schoenebeck |
2610 |
protected: |
42 |
|
|
struct Row { |
43 |
|
|
int id; |
44 |
schoenebeck |
3364 |
HBox* hbox; |
45 |
schoenebeck |
2610 |
Gtk::Label* label; |
46 |
|
|
Gtk::Button* upButton; |
47 |
|
|
Gtk::Button* downButton; |
48 |
|
|
Gtk::Button* deleteButton; |
49 |
|
|
gig::Script* script; |
50 |
|
|
}; |
51 |
|
|
|
52 |
schoenebeck |
3197 |
sigc::signal<void, gig::Instrument*> script_slots_changed_signal; |
53 |
|
|
|
54 |
schoenebeck |
3364 |
VBox m_vbox; |
55 |
schoenebeck |
2610 |
Gtk::Label m_generalInfoLabel; |
56 |
schoenebeck |
3364 |
HButtonBox m_buttonBox; |
57 |
schoenebeck |
2610 |
Gtk::ScrolledWindow m_scrolledWindow; |
58 |
schoenebeck |
3364 |
VBox m_vboxSlots; |
59 |
schoenebeck |
2610 |
Gtk::Label m_dragHintLabel; |
60 |
|
|
Gtk::Button m_closeButton; |
61 |
|
|
|
62 |
|
|
gig::Instrument* m_instrument; |
63 |
|
|
std::vector<Row> m_slots; |
64 |
|
|
|
65 |
|
|
void onScriptDragNDropDataReceived( |
66 |
|
|
const Glib::RefPtr<Gdk::DragContext>& context, int, int, |
67 |
|
|
const Gtk::SelectionData& selection_data, guint, guint time); |
68 |
|
|
void appendNewSlot(gig::Script* script); |
69 |
|
|
void moveSlotUp(int slotID); |
70 |
|
|
void moveSlotDown(int slotID); |
71 |
|
|
void deleteSlot(int slotID); |
72 |
|
|
void refreshSlots(); |
73 |
|
|
void onButtonClose(); |
74 |
|
|
void onWindowHide(); |
75 |
|
|
void clearSlots(); |
76 |
|
|
}; |
77 |
|
|
|
78 |
|
|
#endif // GIGEDIT_SCRIPTSLOTS_H |