/[svn]/gigedit/trunk/src/gigedit/mainwindow.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/mainwindow.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2625 by schoenebeck, Wed Jun 11 21:22:24 2014 UTC revision 2664 by schoenebeck, Sat Jul 5 19:43:14 2014 UTC
# Line 53  Line 53 
53    
54    
55  MainWindow::MainWindow() :  MainWindow::MainWindow() :
56        m_DimRegionChooser(*this),
57      dimreg_label(_("Changes apply to:")),      dimreg_label(_("Changes apply to:")),
58      dimreg_all_regions(_("all regions")),      dimreg_all_regions(_("all regions")),
59      dimreg_all_dimregs(_("all dimension splits")),      dimreg_all_dimregs(_("all dimension splits")),
# Line 452  MainWindow::MainWindow() : Line 453  MainWindow::MainWindow() :
453      {      {
454          Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(0);          Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(0);
455          Gtk::CellRendererText* cellrenderer =          Gtk::CellRendererText* cellrenderer =
456              dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell_renderer());              dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell());
457          column->add_attribute(          column->add_attribute(
458              cellrenderer->property_foreground(), m_SamplesModel.m_color              cellrenderer->property_foreground(), m_SamplesModel.m_color
459          );          );
# Line 460  MainWindow::MainWindow() : Line 461  MainWindow::MainWindow() :
461      {      {
462          Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(1);          Gtk::TreeViewColumn* column = m_TreeViewSamples.get_column(1);
463          Gtk::CellRendererText* cellrenderer =          Gtk::CellRendererText* cellrenderer =
464              dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell_renderer());              dynamic_cast<Gtk::CellRendererText*>(column->get_first_cell());
465          column->add_attribute(          column->add_attribute(
466              cellrenderer->property_foreground(), m_SamplesModel.m_color              cellrenderer->property_foreground(), m_SamplesModel.m_color
467          );          );
# Line 477  MainWindow::MainWindow() : Line 478  MainWindow::MainWindow() :
478      m_refScriptsTreeModel = ScriptsTreeStore::create(m_ScriptsModel);      m_refScriptsTreeModel = ScriptsTreeStore::create(m_ScriptsModel);
479      m_TreeViewScripts.set_model(m_refScriptsTreeModel);      m_TreeViewScripts.set_model(m_refScriptsTreeModel);
480      m_TreeViewScripts.set_tooltip_text(_(      m_TreeViewScripts.set_tooltip_text(_(
481            "Use CTRL + double click for editing a script."
482            "\n\n"
483          "Note: instrument scripts are a LinuxSampler extension of the gig "          "Note: instrument scripts are a LinuxSampler extension of the gig "
484          "format. This feature will not work with the GigaStudio software!"          "format. This feature will not work with the GigaStudio software!"
485      ));      ));
# Line 486  MainWindow::MainWindow() : Line 489  MainWindow::MainWindow() :
489      m_TreeViewScripts.signal_button_press_event().connect_notify(      m_TreeViewScripts.signal_button_press_event().connect_notify(
490          sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release)          sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release)
491      );      );
492        //FIXME: why the heck does this double click signal_row_activated() only fired while CTRL key is pressed ?
493        m_TreeViewScripts.signal_row_activated().connect(
494            sigc::mem_fun(*this, &MainWindow::script_double_clicked)
495        );
496      m_refScriptsTreeModel->signal_row_changed().connect(      m_refScriptsTreeModel->signal_row_changed().connect(
497          sigc::mem_fun(*this, &MainWindow::script_name_changed)          sigc::mem_fun(*this, &MainWindow::script_name_changed)
498      );      );
# Line 665  void MainWindow::dimreg_all_dimregs_togg Line 672  void MainWindow::dimreg_all_dimregs_togg
672  void MainWindow::dimreg_changed()  void MainWindow::dimreg_changed()
673  {  {
674      update_dimregs();      update_dimregs();
675      dimreg_edit.set_dim_region(m_DimRegionChooser.get_dimregion());      dimreg_edit.set_dim_region(m_DimRegionChooser.get_main_dimregion());
676  }  }
677    
678  void MainWindow::on_sel_change()  void MainWindow::on_sel_change()
# Line 895  void MainWindow::load_instrument(gig::In Line 902  void MainWindow::load_instrument(gig::In
902      // load the instrument      // load the instrument
903      gig::File* pFile = (gig::File*) instr->GetParent();      gig::File* pFile = (gig::File*) instr->GetParent();
904      load_gig(pFile, 0 /*file name*/, true /*shared instrument*/);      load_gig(pFile, 0 /*file name*/, true /*shared instrument*/);
905      //TODO: automatically select the given instrument      // automatically select the given instrument
906        int i = 0;
907        for (gig::Instrument* instrument = pFile->GetFirstInstrument(); instrument;
908             instrument = pFile->GetNextInstrument(), ++i)
909        {
910            if (instrument == instr) {
911                // select item in "instruments" tree view
912                m_TreeView.get_selection()->select(Gtk::TreePath(ToString(i)));
913                // make sure the selected item in the "instruments" tree view is
914                // visible (scroll to it)
915                m_TreeView.scroll_to_row(Gtk::TreePath(ToString(i)));
916                // select item in instrument menu
917                {
918                    const std::vector<Gtk::Widget*> children =
919                        instrument_menu->get_children();
920                    static_cast<Gtk::RadioMenuItem*>(children[i])->set_active();
921                }
922                // update region chooser and dimension region chooser
923                m_RegionChooser.set_instrument(instr);
924                break;
925            }
926        }
927  }  }
928    
929  void MainWindow::on_loader_progress()  void MainWindow::on_loader_progress()
# Line 1176  void MainWindow::on_action_help_about() Line 1204  void MainWindow::on_action_help_about()
1204          _(          _(
1205              "Gigedit is released under the GNU General Public License.\n"              "Gigedit is released under the GNU General Public License.\n"
1206              "\n"              "\n"
1207              "Please notice that this is still a very young instrument editor. "              "This program is distributed WITHOUT ANY WARRANTY; So better "
1208              "So better backup your Gigasampler files before editing them with "              "backup your Gigasampler/GigaStudio files before editing them with "
1209              "this application.\n"              "this application.\n"
1210              "\n"              "\n"
1211              "Please report bugs to: http://bugs.linuxsampler.org"              "Please report bugs to: http://bugs.linuxsampler.org"
# Line 2563  void MainWindow::script_name_changed(con Line 2591  void MainWindow::script_name_changed(con
2591      }      }
2592  }  }
2593    
2594    void MainWindow::script_double_clicked(const Gtk::TreeModel::Path& path,
2595                                           Gtk::TreeViewColumn* column)
2596    {
2597        Gtk::TreeModel::iterator iter = m_refScriptsTreeModel->get_iter(path);
2598        if (!iter) return;
2599        Gtk::TreeModel::Row row = *iter;
2600        gig::Script* script = row[m_ScriptsModel.m_col_script];
2601        if (!script) return;
2602    
2603        ScriptEditor* editor = new ScriptEditor;
2604        editor->setScript(script);
2605        //editor->reparent(*this);
2606        editor->show();
2607    }
2608    
2609  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,
2610                                           const Gtk::TreeModel::iterator& iter) {                                           const Gtk::TreeModel::iterator& iter) {
2611      if (!iter) return;      if (!iter) return;

Legend:
Removed from v.2625  
changed lines
  Added in v.2664

  ViewVC Help
Powered by ViewVC