42 |
#include <sndfile.h> |
#include <sndfile.h> |
43 |
|
|
44 |
#include "mainwindow.h" |
#include "mainwindow.h" |
45 |
|
#include "Settings.h" |
46 |
|
#include "CombineInstrumentsDialog.h" |
47 |
#include "../../gfx/status_attached.xpm" |
#include "../../gfx/status_attached.xpm" |
48 |
#include "../../gfx/status_detached.xpm" |
#include "../../gfx/status_detached.xpm" |
49 |
|
|
90 |
dimreg_vbox.pack_start(dimreg_hbox, Gtk::PACK_SHRINK); |
dimreg_vbox.pack_start(dimreg_hbox, Gtk::PACK_SHRINK); |
91 |
m_HPaned.add2(dimreg_vbox); |
m_HPaned.add2(dimreg_vbox); |
92 |
|
|
93 |
|
dimreg_label.set_tooltip_text(_("To automatically apply your changes above globally to the entire instrument, check all 3 check boxes on the right.")); |
94 |
|
dimreg_all_regions.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied to all regions of this instrument as well.")); |
95 |
|
dimreg_all_dimregs.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied as well to all dimension splits of the region selected below.")); |
96 |
|
dimreg_stereo.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied to both audio channel splits (only if a \"stereo\" dimension is defined below).")); |
97 |
|
|
98 |
m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples")); |
m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples")); |
99 |
m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments")); |
m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments")); |
141 |
actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit"))); |
actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit"))); |
142 |
|
|
143 |
Glib::RefPtr<Gtk::ToggleAction> toggle_action = |
Glib::RefPtr<Gtk::ToggleAction> toggle_action = |
144 |
Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note"), "ffaga"); |
Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note")); |
145 |
toggle_action->set_active(true); |
toggle_action->set_active(true); |
|
//FIXME: doesn't work, why? |
|
|
toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field.")); |
|
146 |
actionGroup->add(toggle_action); |
actionGroup->add(toggle_action); |
147 |
|
|
148 |
toggle_action = |
toggle_action = |
149 |
Gtk::ToggleAction::create("CopySampleTune", _("Copy Sample's _Fine Tune")); |
Gtk::ToggleAction::create("CopySampleTune", _("Copy Sample's _Fine Tune")); |
150 |
toggle_action->set_active(true); |
toggle_action->set_active(true); |
|
//FIXME: doesn't work, why? |
|
|
toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field.")); |
|
151 |
actionGroup->add(toggle_action); |
actionGroup->add(toggle_action); |
152 |
|
|
153 |
toggle_action = |
toggle_action = |
154 |
Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points")); |
Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points")); |
155 |
toggle_action->set_active(true); |
toggle_action->set_active(true); |
|
//FIXME: doesn't work, why? |
|
|
toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field.")); |
|
156 |
actionGroup->add(toggle_action); |
actionGroup->add(toggle_action); |
157 |
|
|
158 |
|
|
183 |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
184 |
); |
); |
185 |
|
|
186 |
|
|
187 |
|
actionGroup->add(Gtk::Action::create("MenuSettings", _("_Settings"))); |
188 |
|
|
189 |
|
toggle_action = |
190 |
|
Gtk::ToggleAction::create("WarnUserOnExtensions", _("Show warning on format _extensions")); |
191 |
|
toggle_action->set_active(Settings::singleton()->warnUserOnExtensions); |
192 |
|
actionGroup->add( |
193 |
|
toggle_action, |
194 |
|
sigc::mem_fun(*this, &MainWindow::on_action_warn_user_on_extensions) |
195 |
|
); |
196 |
|
|
197 |
|
|
198 |
|
actionGroup->add(Gtk::Action::create("MenuTools", _("_Tools"))); |
199 |
|
|
200 |
|
actionGroup->add( |
201 |
|
Gtk::Action::create("CombineInstruments", _("_Combine Instruments...")), |
202 |
|
sigc::mem_fun(*this, &MainWindow::on_action_combine_instruments) |
203 |
|
); |
204 |
|
|
205 |
|
|
206 |
// sample right-click popup actions |
// sample right-click popup actions |
207 |
actionGroup->add( |
actionGroup->add( |
208 |
Gtk::Action::create("SampleProperties", Gtk::Stock::PROPERTIES), |
Gtk::Action::create("SampleProperties", Gtk::Stock::PROPERTIES), |
254 |
" <menu action='MenuView'>" |
" <menu action='MenuView'>" |
255 |
" <menuitem action='Statusbar'/>" |
" <menuitem action='Statusbar'/>" |
256 |
" </menu>" |
" </menu>" |
257 |
|
" <menu action='MenuTools'>" |
258 |
|
" <menuitem action='CombineInstruments'/>" |
259 |
|
" </menu>" |
260 |
|
" <menu action='MenuSettings'>" |
261 |
|
" <menuitem action='WarnUserOnExtensions'/>" |
262 |
|
" </menu>" |
263 |
" <menu action='MenuHelp'>" |
" <menu action='MenuHelp'>" |
264 |
" <menuitem action='About'/>" |
" <menuitem action='About'/>" |
265 |
" </menu>" |
" </menu>" |
284 |
uiManager->add_ui_from_string(ui_info); |
uiManager->add_ui_from_string(ui_info); |
285 |
|
|
286 |
popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu")); |
popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu")); |
287 |
|
|
288 |
|
// Set tooltips for menu items (for some reason, setting a tooltip on the |
289 |
|
// respective Gtk::Action objects above will simply be ignored, no matter |
290 |
|
// if using Gtk::Action::set_tooltip() or passing the tooltip string on |
291 |
|
// Gtk::Action::create()). |
292 |
|
{ |
293 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
294 |
|
uiManager->get_widget("/MenuBar/MenuEdit/CopySampleUnity")); |
295 |
|
item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current unity note setting will be altered by this action.")); |
296 |
|
} |
297 |
|
{ |
298 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
299 |
|
uiManager->get_widget("/MenuBar/MenuEdit/CopySampleTune")); |
300 |
|
item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current sample playback tuning will be altered by this action.")); |
301 |
|
} |
302 |
|
{ |
303 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
304 |
|
uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop")); |
305 |
|
item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current loop informations to be altered by this action.")); |
306 |
|
} |
307 |
|
{ |
308 |
|
Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>( |
309 |
|
uiManager->get_widget("/MenuBar/MenuSettings/WarnUserOnExtensions")); |
310 |
|
item->set_tooltip_text(_("If checked, a warning will be shown whenever you try to use a feature which is based on a LinuxSampler extension ontop of the original gig format, which would not work with the Gigasampler/GigaStudio application.")); |
311 |
|
} |
312 |
|
|
313 |
instrument_menu = static_cast<Gtk::MenuItem*>( |
instrument_menu = static_cast<Gtk::MenuItem*>( |
314 |
uiManager->get_widget("/MenuBar/MenuInstrument"))->get_submenu(); |
uiManager->get_widget("/MenuBar/MenuInstrument"))->get_submenu(); |
337 |
// Create the Tree model: |
// Create the Tree model: |
338 |
m_refTreeModel = Gtk::ListStore::create(m_Columns); |
m_refTreeModel = Gtk::ListStore::create(m_Columns); |
339 |
m_TreeView.set_model(m_refTreeModel); |
m_TreeView.set_model(m_refTreeModel); |
340 |
|
m_TreeView.set_tooltip_text(_("Right click here for actions on instruments & MIDI Rules.")); |
341 |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
instrument_name_connection = m_refTreeModel->signal_row_changed().connect( |
342 |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
sigc::mem_fun(*this, &MainWindow::instrument_name_changed) |
343 |
); |
); |
349 |
// create samples treeview (including its data model) |
// create samples treeview (including its data model) |
350 |
m_refSamplesTreeModel = SamplesTreeStore::create(m_SamplesModel); |
m_refSamplesTreeModel = SamplesTreeStore::create(m_SamplesModel); |
351 |
m_TreeViewSamples.set_model(m_refSamplesTreeModel); |
m_TreeViewSamples.set_model(m_refSamplesTreeModel); |
352 |
|
m_TreeViewSamples.set_tooltip_text(_("To actually use a sample, drag it from this list view to \"Sample\" -> \"Sample:\" on the region's settings pane on the right.\n\nRight click here for more actions on samples.")); |
353 |
// m_TreeViewSamples.set_reorderable(); |
// m_TreeViewSamples.set_reorderable(); |
354 |
m_TreeViewSamples.append_column_editable("Samples", m_SamplesModel.m_col_name); |
m_TreeViewSamples.append_column_editable("Samples", m_SamplesModel.m_col_name); |
355 |
m_TreeViewSamples.set_headers_visible(false); |
m_TreeViewSamples.set_headers_visible(false); |
986 |
propDialog.deiconify(); |
propDialog.deiconify(); |
987 |
} |
} |
988 |
|
|
989 |
|
void MainWindow::on_action_warn_user_on_extensions() { |
990 |
|
Settings::singleton()->warnUserOnExtensions = |
991 |
|
!Settings::singleton()->warnUserOnExtensions; |
992 |
|
} |
993 |
|
|
994 |
void MainWindow::on_action_help_about() |
void MainWindow::on_action_help_about() |
995 |
{ |
{ |
996 |
Gtk::AboutDialog dialog; |
Gtk::AboutDialog dialog; |
2112 |
} |
} |
2113 |
} |
} |
2114 |
|
|
2115 |
|
void MainWindow::on_action_combine_instruments() { |
2116 |
|
CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file); |
2117 |
|
d->show_all(); |
2118 |
|
d->resize(500, 400); |
2119 |
|
d->run(); |
2120 |
|
if (d->fileWasChanged()) { |
2121 |
|
// update GUI with new instrument just created |
2122 |
|
add_instrument(d->newCombinedInstrument()); |
2123 |
|
} |
2124 |
|
delete d; |
2125 |
|
} |
2126 |
|
|
2127 |
void MainWindow::set_file_is_shared(bool b) { |
void MainWindow::set_file_is_shared(bool b) { |
2128 |
this->file_is_shared = b; |
this->file_is_shared = b; |
2129 |
|
|