1 |
/* |
/* |
2 |
Copyright (c) 2014 Christian Schoenebeck |
Copyright (c) 2014-2015 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. |
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 |
|
|
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]; |
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]; |
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 |
} |
} |
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 |
} |
} |
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); |
806 |
CombineInstrumentsDialog::CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig) |
CombineInstrumentsDialog::CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig) |
807 |
: Gtk::Dialog(_("Combine Instruments"), parent, true), |
: Gtk::Dialog(_("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 |
{ |
{ |