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

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

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

revision 2579 by persson, Sat May 24 06:44:39 2014 UTC revision 2894 by schoenebeck, Sat Apr 30 14:42:14 2016 UTC
# Line 1  Line 1 
1  /*  /*
2      Copyright (c) 2014 Christian Schoenebeck      Copyright (c) 2014-2016 Christian Schoenebeck
3            
4      This file is part of "gigedit" and released under the terms of the      This file is part of "gigedit" and released under the terms of the
5      GNU General Public License version 2.      GNU General Public License version 2.
# Line 20  Line 20 
20  #include <string.h>  #include <string.h>
21    
22  #include <glibmm/ustring.h>  #include <glibmm/ustring.h>
 #include <gtkmm/stock.h>  
23  #include <gtkmm/messagedialog.h>  #include <gtkmm/messagedialog.h>
24  #include <gtkmm/label.h>  #include <gtkmm/label.h>
25    
# Line 97  inline int smallestOverlapPoint(const DL Line 96  inline int smallestOverlapPoint(const DL
96   *          found with a range member point >= iStart   *          found with a range member point >= iStart
97   */   */
98  static int findLowestRegionPoint(std::vector<gig::Instrument*>& instruments, int iStart) {  static int findLowestRegionPoint(std::vector<gig::Instrument*>& instruments, int iStart) {
99      DLS::range_t searchRange = { iStart, 127 };      DLS::range_t searchRange = { uint16_t(iStart), 127 };
100      int result = -1;      int result = -1;
101      for (uint i = 0; i < instruments.size(); ++i) {      for (uint i = 0; i < instruments.size(); ++i) {
102          gig::Instrument* instr = instruments[i];          gig::Instrument* instr = instruments[i];
# Line 119  static int findLowestRegionPoint(std::ve Line 118  static int findLowestRegionPoint(std::ve
118   *          with a range end >= iStart   *          with a range end >= iStart
119   */   */
120  static int findFirstRegionEnd(std::vector<gig::Instrument*>& instruments, int iStart) {  static int findFirstRegionEnd(std::vector<gig::Instrument*>& instruments, int iStart) {
121      DLS::range_t searchRange = { iStart, 127 };      DLS::range_t searchRange = { uint16_t(iStart), 127 };
122      int result = -1;      int result = -1;
123      for (uint i = 0; i < instruments.size(); ++i) {      for (uint i = 0; i < instruments.size(); ++i) {
124          gig::Instrument* instr = instruments[i];          gig::Instrument* instr = instruments[i];
# Line 195  static RegionGroups groupByRegionInterse Line 194  static RegionGroups groupByRegionInterse
194          iStart = findLowestRegionPoint(instruments, iStart);          iStart = findLowestRegionPoint(instruments, iStart);
195          if (iStart < 0) break;          if (iStart < 0) break;
196          const int iEnd = findFirstRegionEnd(instruments, iStart);          const int iEnd = findFirstRegionEnd(instruments, iStart);
197          DLS::range_t range = { iStart, iEnd };          DLS::range_t range = { uint16_t(iStart), uint16_t(iEnd) };
198          intersections.push_back(range);          intersections.push_back(range);
199          iStart = iEnd + 1;          iStart = iEnd + 1;
200      }      }
# Line 266  static Dimensions getDimensionsForRegion Line 265  static Dimensions getDimensionsForRegion
265               itNums != it->second.end(); ++itNums)               itNums != it->second.end(); ++itNums)
266          {          {
267              const int iUpperLimit = *itNums;              const int iUpperLimit = *itNums;
268              DLS::range_t range = { iLow, iUpperLimit };              DLS::range_t range = { uint16_t(iLow), uint16_t(iUpperLimit) };
269              dims[type].push_back(range);              dims[type].push_back(range);
270              iLow = iUpperLimit + 1;              iLow = iUpperLimit + 1;
271          }          }
# Line 383  static DimensionZones preciseDimensionZo Line 382  static DimensionZones preciseDimensionZo
382          gig::DimensionRegion* dimRgn2 =          gig::DimensionRegion* dimRgn2 =
383              rgn->pDimensionRegions[ (iDimRgn & mask) | ( z << iBaseBits) ];              rgn->pDimensionRegions[ (iDimRgn & mask) | ( z << iBaseBits) ];
384          int iHigh = dimRgn2->DimensionUpperLimits[iDimension];          int iHigh = dimRgn2->DimensionUpperLimits[iDimension];
385          DLS::range_t range = { iLow, iHigh};          DLS::range_t range = { uint16_t(iLow), uint16_t(iHigh) };
386          #if DEBUG_COMBINE_INSTRUMENTS          #if DEBUG_COMBINE_INSTRUMENTS
387          printf("%d..%d, ", iLow, iHigh);          printf("%d..%d, ", iLow, iHigh);
388          fflush(stdout);          fflush(stdout);
# Line 469  static void scheduleCopyDimensionRegions Line 468  static void scheduleCopyDimensionRegions
468          #if DEBUG_COMBINE_INSTRUMENTS          #if DEBUG_COMBINE_INSTRUMENTS
469          printf("dst "); fflush(stdout);          printf("dst "); fflush(stdout);
470          #endif          #endif
471          fillDimValues(dstDimValues, dstDimCase, outRgn, true);          fillDimValues(dstDimValues, dstDimCase, outRgn, false);
472          gig::DimensionRegion* srcDimRgn = inRgn->GetDimensionRegionByValue(srcDimValues);          gig::DimensionRegion* srcDimRgn = inRgn->GetDimensionRegionByValue(srcDimValues);
473          gig::DimensionRegion* dstDimRgn = outRgn->GetDimensionRegionByValue(dstDimValues);          gig::DimensionRegion* dstDimRgn = outRgn->GetDimensionRegionByValue(dstDimValues);
474          #if DEBUG_COMBINE_INSTRUMENTS          #if DEBUG_COMBINE_INSTRUMENTS
# Line 505  static void scheduleCopyDimensionRegions Line 504  static void scheduleCopyDimensionRegions
504              printf("dst velocity value = %d\n", dstDimCase[gig::dimension_velocity]);              printf("dst velocity value = %d\n", dstDimCase[gig::dimension_velocity]);
505              printf("dst refilled "); fflush(stdout);              printf("dst refilled "); fflush(stdout);
506              #endif              #endif
507              fillDimValues(dstDimValues, dstDimCase, outRgn, true);              fillDimValues(dstDimValues, dstDimCase, outRgn, false);
508              dstDimRgn = outRgn->GetDimensionRegionByValue(dstDimValues);              dstDimRgn = outRgn->GetDimensionRegionByValue(dstDimValues);
509              #if DEBUG_COMBINE_INSTRUMENTS              #if DEBUG_COMBINE_INSTRUMENTS
510              printf("reselected dstDimRgn=%lx\n", (uint64_t)dstDimRgn);              printf("reselected dstDimRgn=%lx\n", (uint64_t)dstDimRgn);
# Line 660  static void combineInstruments(std::vect Line 659  static void combineInstruments(std::vect
659              iTotalZones += (def) ? def->zones : 1;              iTotalZones += (def) ? def->zones : 1;
660          }          }
661          #if DEBUG_COMBINE_INSTRUMENTS          #if DEBUG_COMBINE_INSTRUMENTS
662          printf("Required total zones: %d\n", iTotalZones);          printf("Required total zones: %d, vertical regions: %d\n", iTotalZones, itGroup->second.size());
663          #endif          #endif
664    
665          // create all required dimensions for this output region          // create all required dimensions for this output region
# Line 722  static void combineInstruments(std::vect Line 721  static void combineInstruments(std::vect
721              #if DEBUG_COMBINE_INSTRUMENTS              #if DEBUG_COMBINE_INSTRUMENTS
722              std::cout << "OK" << std::endl << std::flush;              std::cout << "OK" << std::endl << std::flush;
723              #endif              #endif
724            } else {
725                dims.erase(mainDimension);
726          }          }
727    
728          // for the next task we need to have the current RegionGroup to be          // for the next task we need to have the current RegionGroup to be
# Line 803  static void combineInstruments(std::vect Line 804  static void combineInstruments(std::vect
804  // class 'CombineInstrumentsDialog'  // class 'CombineInstrumentsDialog'
805    
806  CombineInstrumentsDialog::CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig)  CombineInstrumentsDialog::CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig)
807      : Gtk::Dialog(_("Combine Instruments"), parent, true),      : ManagedDialog(_("Combine Instruments"), parent, true),
808        m_gig(gig), m_fileWasChanged(false), m_newCombinedInstrument(NULL),        m_gig(gig), m_fileWasChanged(false), m_newCombinedInstrument(NULL),
809        m_cancelButton(Gtk::Stock::CANCEL), m_OKButton(Gtk::Stock::OK),        m_cancelButton(_("_Cancel"), true), m_OKButton(_("_OK"), true),
810        m_descriptionLabel(), m_tableDimCombo(2, 2), m_comboDimType(),        m_descriptionLabel(), m_tableDimCombo(2, 2), m_comboDimType(),
811        m_labelDimType(Glib::ustring(_("Combine by Dimension:")) + "  ", Gtk::ALIGN_END)        m_labelDimType(Glib::ustring(_("Combine by Dimension:")) + "  ", Gtk::ALIGN_END)
812  {  {
813        m_scrolledWindow.add(m_treeView);
814        m_scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
815    
816      get_vbox()->pack_start(m_descriptionLabel, Gtk::PACK_SHRINK);      get_vbox()->pack_start(m_descriptionLabel, Gtk::PACK_SHRINK);
817      get_vbox()->pack_start(m_tableDimCombo, Gtk::PACK_SHRINK);      get_vbox()->pack_start(m_tableDimCombo, Gtk::PACK_SHRINK);
818      get_vbox()->pack_start(m_treeView);      get_vbox()->pack_start(m_scrolledWindow);
819      get_vbox()->pack_start(m_buttonBox, Gtk::PACK_SHRINK);      get_vbox()->pack_start(m_buttonBox, Gtk::PACK_SHRINK);
820    
821  #if GTKMM_MAJOR_VERSION >= 3  #if GTKMM_MAJOR_VERSION >= 3

Legend:
Removed from v.2579  
changed lines
  Added in v.2894

  ViewVC Help
Powered by ViewVC