20 |
#include <string.h> |
#include <string.h> |
21 |
|
|
22 |
#include <glibmm/ustring.h> |
#include <glibmm/ustring.h> |
23 |
#include <gtkmm/stock.h> |
#if HAS_GTKMM_STOCK |
24 |
|
# include <gtkmm/stock.h> |
25 |
|
#endif |
26 |
#include <gtkmm/messagedialog.h> |
#include <gtkmm/messagedialog.h> |
27 |
#include <gtkmm/label.h> |
#include <gtkmm/label.h> |
28 |
#include <gtk/gtkwidget.h> // for gtk_widget_modify_*() |
#include <gtk/gtkwidget.h> // for gtk_widget_modify_*() |
784 |
CombineInstrumentsDialog::CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig) |
CombineInstrumentsDialog::CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig) |
785 |
: ManagedDialog(_("Combine Instruments"), parent, true), |
: ManagedDialog(_("Combine Instruments"), parent, true), |
786 |
m_gig(gig), m_fileWasChanged(false), m_newCombinedInstrument(NULL), |
m_gig(gig), m_fileWasChanged(false), m_newCombinedInstrument(NULL), |
787 |
|
#if HAS_GTKMM_STOCK |
788 |
m_cancelButton(Gtk::Stock::CANCEL), m_OKButton(Gtk::Stock::OK), |
m_cancelButton(Gtk::Stock::CANCEL), m_OKButton(Gtk::Stock::OK), |
789 |
m_descriptionLabel(), m_tableDimCombo(2, 2), m_comboDimType(), |
#else |
790 |
|
m_cancelButton(_("_Cancel"), true), m_OKButton(_("_OK"), true), |
791 |
|
#endif |
792 |
|
m_descriptionLabel(), |
793 |
|
#if USE_GTKMM_GRID |
794 |
|
m_tableDimCombo(), |
795 |
|
#else |
796 |
|
m_tableDimCombo(2, 2), |
797 |
|
#endif |
798 |
|
m_comboDimType(), |
799 |
m_labelDimType(Glib::ustring(_("Combine by Dimension:")) + " ", Gtk::ALIGN_END) |
m_labelDimType(Glib::ustring(_("Combine by Dimension:")) + " ", Gtk::ALIGN_END) |
800 |
{ |
{ |
801 |
if (!Settings::singleton()->autoRestoreWindowDimension) { |
if (!Settings::singleton()->autoRestoreWindowDimension) { |
806 |
m_scrolledWindow.add(m_treeView); |
m_scrolledWindow.add(m_treeView); |
807 |
m_scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
m_scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
808 |
|
|
809 |
|
#if USE_GTKMM_BOX |
810 |
|
get_content_area()->pack_start(m_descriptionLabel, Gtk::PACK_SHRINK); |
811 |
|
get_content_area()->pack_start(m_tableDimCombo, Gtk::PACK_SHRINK); |
812 |
|
get_content_area()->pack_start(m_scrolledWindow); |
813 |
|
get_content_area()->pack_start(m_labelOrder, Gtk::PACK_SHRINK); |
814 |
|
get_content_area()->pack_start(m_iconView, Gtk::PACK_SHRINK); |
815 |
|
get_content_area()->pack_start(m_buttonBox, Gtk::PACK_SHRINK); |
816 |
|
#else |
817 |
get_vbox()->pack_start(m_descriptionLabel, Gtk::PACK_SHRINK); |
get_vbox()->pack_start(m_descriptionLabel, Gtk::PACK_SHRINK); |
818 |
get_vbox()->pack_start(m_tableDimCombo, Gtk::PACK_SHRINK); |
get_vbox()->pack_start(m_tableDimCombo, Gtk::PACK_SHRINK); |
819 |
get_vbox()->pack_start(m_scrolledWindow); |
get_vbox()->pack_start(m_scrolledWindow); |
820 |
get_vbox()->pack_start(m_labelOrder, Gtk::PACK_SHRINK); |
get_vbox()->pack_start(m_labelOrder, Gtk::PACK_SHRINK); |
821 |
get_vbox()->pack_start(m_iconView, Gtk::PACK_SHRINK); |
get_vbox()->pack_start(m_iconView, Gtk::PACK_SHRINK); |
822 |
get_vbox()->pack_start(m_buttonBox, Gtk::PACK_SHRINK); |
get_vbox()->pack_start(m_buttonBox, Gtk::PACK_SHRINK); |
823 |
|
#endif |
824 |
|
|
825 |
#if GTKMM_MAJOR_VERSION >= 3 |
#if GTKMM_MAJOR_VERSION >= 3 |
826 |
m_descriptionLabel.set_line_wrap(); |
m_descriptionLabel.set_line_wrap(); |
905 |
// (this also fixes a bug with GTK 2 which often causes visibility issue |
// (this also fixes a bug with GTK 2 which often causes visibility issue |
906 |
// with the text of the selected item) |
// with the text of the selected item) |
907 |
{ |
{ |
908 |
|
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
909 |
Gdk::Color white; |
Gdk::Color white; |
910 |
|
#else |
911 |
|
Gdk::RGBA white; |
912 |
|
#endif |
913 |
white.set("#ffffff"); |
white.set("#ffffff"); |
914 |
GtkWidget* widget = (GtkWidget*) m_iconView.gobj(); |
GtkWidget* widget = (GtkWidget*) m_iconView.gobj(); |
915 |
|
#if GTK_MAJOR_VERSION < 3 |
916 |
gtk_widget_modify_base(widget, GTK_STATE_SELECTED, white.gobj()); |
gtk_widget_modify_base(widget, GTK_STATE_SELECTED, white.gobj()); |
917 |
gtk_widget_modify_base(widget, GTK_STATE_ACTIVE, white.gobj()); |
gtk_widget_modify_base(widget, GTK_STATE_ACTIVE, white.gobj()); |
918 |
gtk_widget_modify_bg(widget, GTK_STATE_SELECTED, white.gobj()); |
gtk_widget_modify_bg(widget, GTK_STATE_SELECTED, white.gobj()); |
919 |
gtk_widget_modify_bg(widget, GTK_STATE_ACTIVE, white.gobj()); |
gtk_widget_modify_bg(widget, GTK_STATE_ACTIVE, white.gobj()); |
920 |
|
#endif |
921 |
} |
} |
922 |
|
|
923 |
m_labelOrder.set_text(_("Order of the instruments to be combined:")); |
m_labelOrder.set_text(_("Order of the instruments to be combined:")); |
941 |
} |
} |
942 |
|
|
943 |
m_buttonBox.set_layout(Gtk::BUTTONBOX_END); |
m_buttonBox.set_layout(Gtk::BUTTONBOX_END); |
944 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22) |
945 |
|
m_buttonBox.set_margin(5); |
946 |
|
#else |
947 |
m_buttonBox.set_border_width(5); |
m_buttonBox.set_border_width(5); |
948 |
|
#endif |
949 |
m_buttonBox.pack_start(m_cancelButton, Gtk::PACK_SHRINK); |
m_buttonBox.pack_start(m_cancelButton, Gtk::PACK_SHRINK); |
950 |
m_buttonBox.pack_start(m_OKButton, Gtk::PACK_SHRINK); |
m_buttonBox.pack_start(m_OKButton, Gtk::PACK_SHRINK); |
951 |
m_buttonBox.show(); |
m_buttonBox.show(); |
962 |
sigc::mem_fun(*this, &CombineInstrumentsDialog::combineSelectedInstruments) |
sigc::mem_fun(*this, &CombineInstrumentsDialog::combineSelectedInstruments) |
963 |
); |
); |
964 |
|
|
965 |
|
#if HAS_GTKMM_SHOW_ALL_CHILDREN |
966 |
show_all_children(); |
show_all_children(); |
967 |
|
#endif |
968 |
|
|
969 |
// show a warning to user if he uses a .gig in v2 format |
// show a warning to user if he uses a .gig in v2 format |
970 |
if (gig->pVersion->major < 3) { |
if (gig->pVersion->major < 3) { |