/[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 3180 by schoenebeck, Sun May 14 13:17:03 2017 UTC revision 3258 by schoenebeck, Tue May 30 20:17:12 2017 UTC
# Line 62  Line 62 
62  #include "gfx/builtinpix.h"  #include "gfx/builtinpix.h"
63  #include "MacroEditor.h"  #include "MacroEditor.h"
64  #include "MacrosSetup.h"  #include "MacrosSetup.h"
65    #if defined(__APPLE__)
66    # include "MacHelper.h"
67    #endif
68    
69  MainWindow::MainWindow() :  MainWindow::MainWindow() :
70      m_DimRegionChooser(*this),      m_DimRegionChooser(*this),
# Line 78  MainWindow::MainWindow() : Line 81  MainWindow::MainWindow() :
81      loadBuiltInPix();      loadBuiltInPix();
82    
83  //    set_border_width(5);  //    set_border_width(5);
84  //    set_default_size(400, 200);  
85        if (!Settings::singleton()->autoRestoreWindowDimension) {
86            set_default_size(800, 600);
87            set_position(Gtk::WIN_POS_CENTER);
88        }
89    
90      add(m_VBox);      add(m_VBox);
91    
# Line 654  MainWindow::MainWindow() : Line 661  MainWindow::MainWindow() :
661      // Add the TreeView's view columns:      // Add the TreeView's view columns:
662      m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr);      m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr);
663      m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name);      m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name);
664        m_TreeView.append_column(_("Scripts"), m_Columns.m_col_scripts);
665      m_TreeView.set_headers_visible(true);      m_TreeView.set_headers_visible(true);
666            
667      // establish drag&drop within the instrument tree view, allowing to reorder      // establish drag&drop within the instrument tree view, allowing to reorder
# Line 870  MainWindow::MainWindow() : Line 878  MainWindow::MainWindow() :
878    
879          updateMacroMenu();          updateMacroMenu();
880      }      }
881    
882        Glib::signal_idle().connect_once(
883            sigc::mem_fun(*this, &MainWindow::bringToFront),
884            200
885        );
886  }  }
887    
888  MainWindow::~MainWindow()  MainWindow::~MainWindow()
889  {  {
890  }  }
891    
892    void MainWindow::bringToFront() {
893        #if defined(__APPLE__)
894        macRaiseAppWindow();
895        #endif
896        raise();
897        present();
898    }
899    
900  void MainWindow::updateMacroMenu() {  void MainWindow::updateMacroMenu() {
901      Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>(      Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>(
902          uiManager->get_widget("/MenuBar/MenuMacro")          uiManager->get_widget("/MenuBar/MenuMacro")
# Line 1815  void MainWindow::on_action_help_about() Line 1836  void MainWindow::on_action_help_about()
1836      dialog.set_comments(sComment.c_str());      dialog.set_comments(sComment.c_str());
1837      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
1838      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
1839        dialog.set_position(Gtk::WIN_POS_CENTER);
1840      dialog.run();      dialog.run();
1841  }  }
1842    
# Line 1840  PropDialog::PropDialog() Line 1862  PropDialog::PropDialog()
1862        table(2, 1),        table(2, 1),
1863        m_file(NULL)        m_file(NULL)
1864  {  {
1865        if (!Settings::singleton()->autoRestoreWindowDimension) {
1866            set_default_size(470, 390);
1867            set_position(Gtk::WIN_POS_MOUSE);
1868        }
1869    
1870      set_title(_("File Properties"));      set_title(_("File Properties"));
1871      eName.set_width_chars(50);      eName.set_width_chars(50);
1872    
# Line 1974  InstrumentProps::InstrumentProps() : Line 2001  InstrumentProps::InstrumentProps() :
2001      eDimensionKeyRangeLow(_("Keyswitching range low")),      eDimensionKeyRangeLow(_("Keyswitching range low")),
2002      eDimensionKeyRangeHigh(_("Keyswitching range high"))      eDimensionKeyRangeHigh(_("Keyswitching range high"))
2003  {  {
2004        if (!Settings::singleton()->autoRestoreWindowDimension) {
2005            //set_default_size(470, 390);
2006            set_position(Gtk::WIN_POS_MOUSE);
2007        }
2008    
2009      set_title(_("Instrument Properties"));      set_title(_("Instrument Properties"));
2010    
2011      eDimensionKeyRangeLow.set_tip(      eDimensionKeyRangeLow.set_tip(
# Line 2098  void MainWindow::load_gig(gig::File* gig Line 2130  void MainWindow::load_gig(gig::File* gig
2130      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;
2131           instrument = gig->GetNextInstrument(), ++index) {           instrument = gig->GetNextInstrument(), ++index) {
2132          Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));          Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
2133            const int iScriptSlots = instrument->ScriptSlotCount();
2134    
2135          Gtk::TreeModel::iterator iter = m_refTreeModel->append();          Gtk::TreeModel::iterator iter = m_refTreeModel->append();
2136          Gtk::TreeModel::Row row = *iter;          Gtk::TreeModel::Row row = *iter;
2137          row[m_Columns.m_col_nr] = index;          row[m_Columns.m_col_nr] = index;
2138          row[m_Columns.m_col_name] = name;          row[m_Columns.m_col_name] = name;
2139          row[m_Columns.m_col_instr] = instrument;          row[m_Columns.m_col_instr] = instrument;
2140            row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
2141    
2142          add_instrument_to_menu(name);          add_instrument_to_menu(name);
2143      }      }
# Line 2242  void MainWindow::show_script_slots() { Line 2276  void MainWindow::show_script_slots() {
2276    
2277      ScriptSlots* window = new ScriptSlots;      ScriptSlots* window = new ScriptSlots;
2278      window->setInstrument(instrument);      window->setInstrument(instrument);
2279        window->signal_script_slots_changed().connect(
2280            sigc::mem_fun(*this, &MainWindow::onScriptSlotsModified)
2281        );
2282      //window->reparent(*this);      //window->reparent(*this);
2283      window->show();      window->show();
2284  }  }
2285    
2286    void MainWindow::onScriptSlotsModified(gig::Instrument* pInstrument) {
2287        if (!pInstrument) return;
2288        const int iScriptSlots = pInstrument->ScriptSlotCount();
2289    
2290        Glib::RefPtr<Gtk::TreeModel> model = m_TreeView.get_model();
2291        for (int i = 0; i < model->children().size(); ++i) {
2292            Gtk::TreeModel::Row row = model->children()[i];
2293            if (row[m_Columns.m_col_instr] != pInstrument) continue;
2294            row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
2295            break;
2296        }
2297    }
2298    
2299  void MainWindow::on_action_refresh_all() {  void MainWindow::on_action_refresh_all() {
2300      __refreshEntireGUI();      __refreshEntireGUI();
2301  }  }
# Line 2560  void MainWindow::add_instrument(gig::Ins Line 2610  void MainWindow::add_instrument(gig::Ins
2610      rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1;      rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1;
2611      rowInstr[m_Columns.m_col_name] = name;      rowInstr[m_Columns.m_col_name] = name;
2612      rowInstr[m_Columns.m_col_instr] = instrument;      rowInstr[m_Columns.m_col_instr] = instrument;
2613        rowInstr[m_Columns.m_col_scripts] = "";
2614      instrument_name_connection.unblock();      instrument_name_connection.unblock();
2615    
2616      add_instrument_to_menu(name);      add_instrument_to_menu(name);
# Line 3538  void MainWindow::instrument_name_changed Line 3589  void MainWindow::instrument_name_changed
3589  void MainWindow::on_action_combine_instruments() {  void MainWindow::on_action_combine_instruments() {
3590      CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);      CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);
3591      d->show_all();      d->show_all();
     d->resize(500, 400);  
3592      d->run();      d->run();
3593      if (d->fileWasChanged()) {      if (d->fileWasChanged()) {
3594          // update GUI with new instrument just created          // update GUI with new instrument just created

Legend:
Removed from v.3180  
changed lines
  Added in v.3258

  ViewVC Help
Powered by ViewVC