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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3299 - (show annotations) (download) (as text)
Sun Jul 9 12:44:59 2017 UTC (6 years, 9 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3234 byte(s)
* Combine Tool: Now it allows to select the instruments to be combined
  already in the main window's instruments list view; then either call
  the combine instrument dialog from the main menu or use the new
  keyboard shortcut Ctrl + j.
* Combine Tool: Show instruments' index number in the list view.
* Bumped version (1.0.0.svn54).

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_COMBINEINSTRUMENTSDIALOG
9 #define GIGEDIT_COMBINEINSTRUMENTSDIALOG
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/buttonbox.h>
18 #include <gtkmm/window.h>
19 #include <gtkmm/dialog.h>
20 #include <gtkmm/treeview.h>
21 #include <gtkmm/liststore.h>
22 #include <gtkmm/table.h>
23 #include <gtkmm/comboboxtext.h>
24 #include <gtkmm/scrolledwindow.h>
25
26 #include "wrapLabel.hh"
27 #include "ManagedWindow.h"
28
29 #include <set>
30
31 /**
32 * @brief Modal dialog which allows to merge instruments.
33 *
34 * This dialog shows a list of all instruments of the currently open .gig file
35 * in gigedit and allows the user to shift select a set of instruments to be
36 * combined.
37 *
38 * If the user successfully combined instruments in this dialog, then
39 * newCombinedInstrument() will return a pointer to that new instrument.
40 */
41 class CombineInstrumentsDialog : public ManagedDialog {
42 public:
43 CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig);
44 bool fileWasChanged() const;
45 gig::Instrument* newCombinedInstrument() const;
46 void setSelectedInstruments(const std::set<int>& instrumentIndeces);
47
48 // implementation for abstract methods of interface class "ManagedDialog"
49 virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->combineInstrumentsWindowX; }
50 virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->combineInstrumentsWindowY; }
51 virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->combineInstrumentsWindowW; }
52 virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->combineInstrumentsWindowH; }
53
54 protected:
55 gig::File* m_gig;
56 bool m_fileWasChanged;
57 gig::Instrument* m_newCombinedInstrument;
58
59 Gtk::HButtonBox m_buttonBox;
60 Gtk::ScrolledWindow m_scrolledWindow;
61 Gtk::TreeView m_treeView;
62 Gtk::Button m_cancelButton;
63 Gtk::Button m_OKButton;
64 #if GTKMM_MAJOR_VERSION < 3
65 view::WrapLabel m_descriptionLabel;
66 #else
67 Gtk::Label m_descriptionLabel;
68 #endif
69 Gtk::Table m_tableDimCombo;
70 Gtk::ComboBox m_comboDimType;
71 Gtk::Label m_labelDimType;
72
73 class ComboDimsModel : public Gtk::TreeModel::ColumnRecord {
74 public:
75 ComboDimsModel() {
76 add(m_type_id);
77 add(m_type_name);
78 }
79
80 Gtk::TreeModelColumn<int> m_type_id;
81 Gtk::TreeModelColumn<Glib::ustring> m_type_name;
82 } m_comboDimsModel;
83
84 class ListModel : public Gtk::TreeModel::ColumnRecord {
85 public:
86 ListModel() {
87 add(m_col_index);
88 add(m_col_name);
89 add(m_col_instr);
90 }
91
92 Gtk::TreeModelColumn<int> m_col_index;
93 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
94 Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;
95 } m_columns;
96
97 Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
98
99 void combineSelectedInstruments();
100 void onSelectionChanged();
101 };
102
103 #endif // GIGEDIT_COMBINEINSTRUMENTSDIALOG

  ViewVC Help
Powered by ViewVC