/[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 3814 by schoenebeck, Fri Aug 14 12:29:01 2020 UTC revision 3831 by schoenebeck, Thu Oct 15 18:08:49 2020 UTC
# Line 1734  void MainWindow::bringToFront() { Line 1734  void MainWindow::bringToFront() {
1734      #endif      #endif
1735      raise();      raise();
1736      present();      present();
1737    
1738        // restore user specified splitter position
1739        if (Settings::singleton()->mainWindowSplitterPosX >= 0 &&
1740            Settings::singleton()->autoRestoreWindowDimension)
1741        {
1742            const int pos = Settings::singleton()->mainWindowSplitterPosX;
1743            printf("Restoring user's preferred splitter position=%d\n", pos);
1744            m_HPaned.set_position(pos);
1745        }
1746        // this signal handler is late-connected after the UI build-up has settled
1747        // to prevent the UI build-up from overwriting user's setting for splitter
1748        // position unintentionally
1749        m_HPaned.property_position().signal_changed().connect([this]{
1750            if (!Settings::singleton()->autoRestoreWindowDimension) return;
1751            const int pos = m_HPaned.get_position();
1752            printf("Saving user's preferred splitter position=%d\n", pos);
1753            Settings::singleton()->mainWindowSplitterPosX = pos;
1754        });
1755  }  }
1756    
1757  void MainWindow::updateMacroMenu() {  void MainWindow::updateMacroMenu() {
# Line 3976  void MainWindow::on_instrument_selection Line 3994  void MainWindow::on_instrument_selection
3994              find(children.begin(), children.end(), item);              find(children.begin(), children.end(), item);
3995          if (it != children.end()) {          if (it != children.end()) {
3996              int index = it - children.begin();              int index = it - children.begin();
3997              m_TreeViewInstruments.get_selection()->select(Gtk::TreePath(ToString(index)));  
3998                // convert index of model to index of visual presentation (i.e. if filtered)
3999                Gtk::TreeModel::Path path = m_refInstrumentsModelFilter->convert_child_path_to_path(Gtk::TreePath(ToString(index)));
4000    
4001                if (path)
4002                    m_TreeViewInstruments.get_selection()->select(path);
4003                else
4004                    m_TreeViewInstruments.get_selection()->unselect_all();
4005    
4006              m_RegionChooser.set_instrument(file->GetInstrument(index));              m_RegionChooser.set_instrument(file->GetInstrument(index));
4007          }          }
# Line 5056  void MainWindow::on_action_remove_unused Line 5081  void MainWindow::on_action_remove_unused
5081      if (!file) return;      if (!file) return;
5082    
5083      // collect all samples that are not referenced by any instrument      // collect all samples that are not referenced by any instrument
5084      std::list<gig::Sample*> lsamples;      std::list<gig::Sample*> lsamples = unusedSamples(file);
     for (int iSample = 0; file->GetSample(iSample); ++iSample) {  
         gig::Sample* sample = file->GetSample(iSample);  
         bool isUsed = false;  
         for (gig::Instrument* instrument = file->GetFirstInstrument(); instrument;  
                               instrument = file->GetNextInstrument())  
         {  
             for (gig::Region* rgn = instrument->GetFirstRegion(); rgn;  
                               rgn = instrument->GetNextRegion())  
             {  
                 for (int i = 0; i < 256; ++i) {  
                     if (!rgn->pDimensionRegions[i]) continue;  
                     if (rgn->pDimensionRegions[i]->pSample != sample) continue;  
                     isUsed = true;  
                     goto endOfRefSearch;  
                 }  
             }  
         }  
         endOfRefSearch:  
         if (!isUsed) lsamples.push_back(sample);  
     }  
   
5085      if (lsamples.empty()) return;      if (lsamples.empty()) return;
5086    
5087      // notify everybody that we're going to remove these samples      // notify everybody that we're going to remove these samples

Legend:
Removed from v.3814  
changed lines
  Added in v.3831

  ViewVC Help
Powered by ViewVC