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