1 |
/* |
/* |
2 |
* Copyright (C) 2006-2011 Andreas Persson |
* Copyright (C) 2006-2013 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
32 |
#include <gtkmm/main.h> |
#include <gtkmm/main.h> |
33 |
#include <gtkmm/radiomenuitem.h> |
#include <gtkmm/radiomenuitem.h> |
34 |
#include <gtkmm/toggleaction.h> |
#include <gtkmm/toggleaction.h> |
35 |
|
#if GTKMM_MAJOR_VERSION < 3 |
36 |
#include "wrapLabel.hh" |
#include "wrapLabel.hh" |
37 |
|
#endif |
38 |
|
|
39 |
#include "global.h" |
#include "global.h" |
40 |
#include "compat.h" |
#include "compat.h" |
179 |
sigc::mem_fun(*this, &MainWindow::on_action_add_instrument) |
sigc::mem_fun(*this, &MainWindow::on_action_add_instrument) |
180 |
); |
); |
181 |
actionGroup->add( |
actionGroup->add( |
182 |
|
Gtk::Action::create("DupInstrument", _("_Duplicate Instrument")), |
183 |
|
sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument) |
184 |
|
); |
185 |
|
actionGroup->add( |
186 |
Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), |
Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE), |
187 |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument) |
188 |
); |
); |
240 |
" <popup name='PopupMenu'>" |
" <popup name='PopupMenu'>" |
241 |
" <menuitem action='InstrProperties'/>" |
" <menuitem action='InstrProperties'/>" |
242 |
" <menuitem action='AddInstrument'/>" |
" <menuitem action='AddInstrument'/>" |
243 |
|
" <menuitem action='DupInstrument'/>" |
244 |
" <separator/>" |
" <separator/>" |
245 |
" <menuitem action='RemoveInstrument'/>" |
" <menuitem action='RemoveInstrument'/>" |
246 |
" </popup>" |
" </popup>" |
500 |
|
|
501 |
void Loader::launch() |
void Loader::launch() |
502 |
{ |
{ |
503 |
thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Loader::thread_function), true); |
#ifdef OLD_THREADS |
504 |
|
thread = Glib::Thread::create(sigc::mem_fun(*this, &Loader::thread_function), true); |
505 |
|
#else |
506 |
|
thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Loader::thread_function)); |
507 |
|
#endif |
508 |
printf("launch thread=%x\n", thread); |
printf("launch thread=%x\n", thread); |
509 |
} |
} |
510 |
|
|
777 |
descriptionArea.set_spacing(15); |
descriptionArea.set_spacing(15); |
778 |
Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG)); |
Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG)); |
779 |
descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK); |
descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK); |
780 |
|
#if GTKMM_MAJOR_VERSION < 3 |
781 |
view::WrapLabel description; |
view::WrapLabel description; |
782 |
|
#else |
783 |
|
Gtk::Label description; |
784 |
|
description.set_line_wrap(); |
785 |
|
#endif |
786 |
description.set_markup( |
description.set_markup( |
787 |
_("\n<b>CAUTION:</b> You <b>MUST</b> use the " |
_("\n<b>CAUTION:</b> You <b>MUST</b> use the " |
788 |
"<span style=\"italic\">\"Save\"</span> dialog instead of " |
"<span style=\"italic\">\"Save\"</span> dialog instead of " |
931 |
dialog.set_name("Gigedit"); |
dialog.set_name("Gigedit"); |
932 |
#endif |
#endif |
933 |
dialog.set_version(VERSION); |
dialog.set_version(VERSION); |
934 |
dialog.set_copyright("Copyright (C) 2006-2011 Andreas Persson"); |
dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson"); |
935 |
dialog.set_comments(_( |
dialog.set_comments(_( |
936 |
"Released under the GNU General Public License.\n" |
"Released under the GNU General Public License.\n" |
937 |
"\n" |
"\n" |
1333 |
file_changed(); |
file_changed(); |
1334 |
} |
} |
1335 |
|
|
1336 |
|
void MainWindow::on_action_duplicate_instrument() { |
1337 |
|
if (!file) return; |
1338 |
|
|
1339 |
|
// retrieve the currently selected instrument |
1340 |
|
// (being the original instrument to be duplicated) |
1341 |
|
Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection(); |
1342 |
|
Gtk::TreeModel::iterator itSelection = sel->get_selected(); |
1343 |
|
if (!itSelection) return; |
1344 |
|
Gtk::TreeModel::Row row = *itSelection; |
1345 |
|
gig::Instrument* instrOrig = row[m_Columns.m_col_instr]; |
1346 |
|
if (!instrOrig) return; |
1347 |
|
|
1348 |
|
// duplicate the orginal instrument |
1349 |
|
gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig); |
1350 |
|
instrNew->pInfo->Name = |
1351 |
|
instrOrig->pInfo->Name + " (" + _("Copy") + ")"; |
1352 |
|
|
1353 |
|
// update instrument tree view |
1354 |
|
Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append(); |
1355 |
|
Gtk::TreeModel::Row rowInstr = *iterInstr; |
1356 |
|
rowInstr[m_Columns.m_col_name] = instrNew->pInfo->Name.c_str(); |
1357 |
|
rowInstr[m_Columns.m_col_instr] = instrNew; |
1358 |
|
file_changed(); |
1359 |
|
} |
1360 |
|
|
1361 |
void MainWindow::on_action_remove_instrument() { |
void MainWindow::on_action_remove_instrument() { |
1362 |
if (!file) return; |
if (!file) return; |
1363 |
if (file_is_shared) { |
if (file_is_shared) { |
1594 |
if (!file) return; |
if (!file) return; |
1595 |
Gtk::FileChooserDialog dialog(*this, _("Select Folder"), |
Gtk::FileChooserDialog dialog(*this, _("Select Folder"), |
1596 |
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); |
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); |
1597 |
view::WrapLabel description( |
const char* str = |
1598 |
_("This is a very specific function. It tries to replace all samples " |
_("This is a very specific function. It tries to replace all samples " |
1599 |
"in the current gig file by samples located in the chosen " |
"in the current gig file by samples located in the chosen " |
1600 |
"directory.\n\n" |
"directory.\n\n" |
1608 |
"the sample in the gig file accordingly. If you don't need an " |
"the sample in the gig file accordingly. If you don't need an " |
1609 |
"extension, blank the field below. Any gig sample where no " |
"extension, blank the field below. Any gig sample where no " |
1610 |
"appropriate sample file could be found will be reported and left " |
"appropriate sample file could be found will be reported and left " |
1611 |
"untouched.\n") |
"untouched.\n"); |
1612 |
); |
#if GTKMM_MAJOR_VERSION < 3 |
1613 |
|
view::WrapLabel description(str); |
1614 |
|
#else |
1615 |
|
Gtk::Label description(str); |
1616 |
|
description.set_line_wrap(); |
1617 |
|
#endif |
1618 |
Gtk::HBox entryArea; |
Gtk::HBox entryArea; |
1619 |
Gtk::Label entryLabel( _("Add filename extension: "), Gtk::ALIGN_START); |
Gtk::Label entryLabel( _("Add filename extension: "), Gtk::ALIGN_START); |
1620 |
Gtk::Entry postfixEntryBox; |
Gtk::Entry postfixEntryBox; |