17 |
* 02110-1301 USA. |
* 02110-1301 USA. |
18 |
*/ |
*/ |
19 |
|
|
|
#include <libintl.h> |
|
20 |
#include <iostream> |
#include <iostream> |
21 |
|
|
22 |
#include <gtkmm/filechooserdialog.h> |
#include <gtkmm/filechooserdialog.h> |
24 |
#include <gtkmm/stock.h> |
#include <gtkmm/stock.h> |
25 |
#include <gtkmm/targetentry.h> |
#include <gtkmm/targetentry.h> |
26 |
#include <gtkmm/main.h> |
#include <gtkmm/main.h> |
27 |
|
#include <gtkmm/toggleaction.h> |
28 |
|
|
29 |
|
#include "global.h" |
30 |
|
|
31 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2 |
32 |
#define ABOUT_DIALOG |
#define ABOUT_DIALOG |
50 |
|
|
51 |
#include "mainwindow.h" |
#include "mainwindow.h" |
52 |
|
|
53 |
#define _(String) gettext(String) |
#include "../../gfx/status_attached.xpm" |
54 |
|
#include "../../gfx/status_detached.xpm" |
55 |
|
|
56 |
template<class T> inline std::string ToString(T o) { |
template<class T> inline std::string ToString(T o) { |
57 |
std::stringstream ss; |
std::stringstream ss; |
130 |
*this, &MainWindow::on_action_quit)); |
*this, &MainWindow::on_action_quit)); |
131 |
actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument"))); |
actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument"))); |
132 |
|
|
133 |
|
actionGroup->add(Gtk::Action::create("MenuView", _("_View"))); |
134 |
|
Glib::RefPtr<Gtk::ToggleAction> toggle_action = |
135 |
|
Gtk::ToggleAction::create("Statusbar", _("_Statusbar")); |
136 |
|
toggle_action->set_active(true); |
137 |
|
actionGroup->add(toggle_action, |
138 |
|
sigc::mem_fun( |
139 |
|
*this, &MainWindow::on_action_view_status_bar)); |
140 |
|
|
141 |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP); |
142 |
actionGroup->add(Gtk::Action::create("MenuHelp", |
actionGroup->add(Gtk::Action::create("MenuHelp", |
143 |
action->property_label())); |
action->property_label())); |
193 |
" </menu>" |
" </menu>" |
194 |
" <menu action='MenuInstrument'>" |
" <menu action='MenuInstrument'>" |
195 |
" </menu>" |
" </menu>" |
196 |
|
" <menu action='MenuView'>" |
197 |
|
" <menuitem action='Statusbar'/>" |
198 |
|
" </menu>" |
199 |
#ifdef ABOUT_DIALOG |
#ifdef ABOUT_DIALOG |
200 |
" <menu action='MenuHelp'>" |
" <menu action='MenuHelp'>" |
201 |
" <menuitem action='About'/>" |
" <menuitem action='About'/>" |
225 |
m_VBox.pack_start(m_HPaned); |
m_VBox.pack_start(m_HPaned); |
226 |
m_VBox.pack_start(m_RegionChooser, Gtk::PACK_SHRINK); |
m_VBox.pack_start(m_RegionChooser, Gtk::PACK_SHRINK); |
227 |
m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK); |
m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK); |
228 |
|
m_VBox.pack_start(m_StatusBar, Gtk::PACK_SHRINK); |
229 |
|
|
230 |
|
// Status Bar: |
231 |
|
m_StatusBar.pack_start(m_AttachedStateLabel, Gtk::PACK_SHRINK); |
232 |
|
m_StatusBar.pack_start(m_AttachedStateImage, Gtk::PACK_SHRINK); |
233 |
|
m_StatusBar.show(); |
234 |
|
|
235 |
m_RegionChooser.signal_region_selected().connect( |
m_RegionChooser.signal_region_selected().connect( |
236 |
sigc::mem_fun(*this, &MainWindow::region_changed) ); |
sigc::mem_fun(*this, &MainWindow::region_changed) ); |
315 |
|
|
316 |
file = 0; |
file = 0; |
317 |
file_is_changed = false; |
file_is_changed = false; |
318 |
file_is_shared = false; |
set_file_is_shared(false); |
319 |
|
|
320 |
show_all_children(); |
show_all_children(); |
321 |
|
|
450 |
// free libgig's gig::File instance |
// free libgig's gig::File instance |
451 |
if (file && !file_is_shared) delete file; |
if (file && !file_is_shared) delete file; |
452 |
file = NULL; |
file = NULL; |
453 |
file_is_shared = false; |
set_file_is_shared(false); |
454 |
} |
} |
455 |
|
|
456 |
void MainWindow::on_action_file_new() |
void MainWindow::on_action_file_new() |
979 |
void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument) |
void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument) |
980 |
{ |
{ |
981 |
file = 0; |
file = 0; |
982 |
file_is_shared = isSharedInstrument; |
set_file_is_shared(isSharedInstrument); |
983 |
|
|
984 |
this->filename = filename ? filename : _("Unsaved Gig File"); |
this->filename = filename ? filename : _("Unsaved Gig File"); |
985 |
set_title(Glib::filename_display_basename(this->filename)); |
set_title(Glib::filename_display_basename(this->filename)); |
1056 |
} |
} |
1057 |
} |
} |
1058 |
|
|
1059 |
|
void MainWindow::on_action_view_status_bar() { |
1060 |
|
Gtk::CheckMenuItem* item = |
1061 |
|
dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar")); |
1062 |
|
if (!item) { |
1063 |
|
std::cerr << "/MenuBar/MenuView/Statusbar == NULL\n"; |
1064 |
|
return; |
1065 |
|
} |
1066 |
|
if (item->get_active()) m_StatusBar.show(); |
1067 |
|
else m_StatusBar.hide(); |
1068 |
|
} |
1069 |
|
|
1070 |
void MainWindow::on_button_release(GdkEventButton* button) |
void MainWindow::on_button_release(GdkEventButton* button) |
1071 |
{ |
{ |
1072 |
if (button->type == GDK_2BUTTON_PRESS) { |
if (button->type == GDK_2BUTTON_PRESS) { |
1534 |
} |
} |
1535 |
} |
} |
1536 |
|
|
1537 |
|
void MainWindow::set_file_is_shared(bool b) { |
1538 |
|
this->file_is_shared = b; |
1539 |
|
|
1540 |
|
if (file_is_shared) { |
1541 |
|
m_AttachedStateLabel.set_label(_("live-mode")); |
1542 |
|
m_AttachedStateImage.set( |
1543 |
|
Gdk::Pixbuf::create_from_xpm_data(status_attached_xpm) |
1544 |
|
); |
1545 |
|
} else { |
1546 |
|
m_AttachedStateLabel.set_label(_("stand-alone")); |
1547 |
|
m_AttachedStateImage.set( |
1548 |
|
Gdk::Pixbuf::create_from_xpm_data(status_detached_xpm) |
1549 |
|
); |
1550 |
|
} |
1551 |
|
} |
1552 |
|
|
1553 |
sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() { |
sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() { |
1554 |
return file_structure_to_be_changed_signal; |
return file_structure_to_be_changed_signal; |
1555 |
} |
} |