24 |
#include <gdkmm/cursor.h> |
#include <gdkmm/cursor.h> |
25 |
#include <gdkmm/general.h> |
#include <gdkmm/general.h> |
26 |
#include <glibmm/stringutils.h> |
#include <glibmm/stringutils.h> |
27 |
|
#include <gtkmm/stock.h> |
28 |
#include <glibmm/ustring.h> |
#include <glibmm/ustring.h> |
29 |
#include <gtkmm/messagedialog.h> |
#include <gtkmm/messagedialog.h> |
30 |
#include <assert.h> |
#include <assert.h> |
110 |
this->blueHatchedSurfacePattern->set_extend(Cairo::EXTEND_REPEAT); |
this->blueHatchedSurfacePattern->set_extend(Cairo::EXTEND_REPEAT); |
111 |
} |
} |
112 |
|
|
113 |
|
// create gray blue hatched pattern |
114 |
|
{ |
115 |
|
const int width = grayBlueHatchedPattern->get_width(); |
116 |
|
const int height = grayBlueHatchedPattern->get_height(); |
117 |
|
const int stride = grayBlueHatchedPattern->get_rowstride(); |
118 |
|
|
119 |
|
// manually convert from RGBA to ARGB |
120 |
|
this->grayBlueHatchedPatternARGB = grayBlueHatchedPattern->copy(); |
121 |
|
const int pixelSize = stride / width; |
122 |
|
const int totalPixels = width * height; |
123 |
|
assert(pixelSize == 4); |
124 |
|
unsigned char* ptr = this->grayBlueHatchedPatternARGB->get_pixels(); |
125 |
|
for (int iPixel = 0; iPixel < totalPixels; ++iPixel, ptr += pixelSize) { |
126 |
|
const unsigned char r = ptr[0]; |
127 |
|
const unsigned char g = ptr[1]; |
128 |
|
const unsigned char b = ptr[2]; |
129 |
|
const unsigned char a = ptr[3]; |
130 |
|
ptr[0] = b; |
131 |
|
ptr[1] = g; |
132 |
|
ptr[2] = r; |
133 |
|
ptr[3] = a; |
134 |
|
} |
135 |
|
|
136 |
|
Cairo::RefPtr<Cairo::ImageSurface> imageSurface = Cairo::ImageSurface::create( |
137 |
|
this->grayBlueHatchedPatternARGB->get_pixels(), Cairo::FORMAT_ARGB32, width, height, stride |
138 |
|
); |
139 |
|
this->grayBlueHatchedSurfacePattern = Cairo::SurfacePattern::create(imageSurface); |
140 |
|
this->grayBlueHatchedSurfacePattern->set_extend(Cairo::EXTEND_REPEAT); |
141 |
|
} |
142 |
|
|
143 |
instrument = 0; |
instrument = 0; |
144 |
region = 0; |
region = 0; |
145 |
maindimregno = -1; |
maindimregno = -1; |
214 |
|
|
215 |
void DimRegionChooser::setModifyBothChannels(bool b) { |
void DimRegionChooser::setModifyBothChannels(bool b) { |
216 |
modifybothchannels = b; |
modifybothchannels = b; |
217 |
|
// redraw required parts |
218 |
|
queue_draw(); |
219 |
} |
} |
220 |
|
|
221 |
void DimRegionChooser::setModifyAllDimensionRegions(bool b) { |
void DimRegionChooser::setModifyAllDimensionRegions(bool b) { |
222 |
modifyalldimregs = b; |
modifyalldimregs = b; |
223 |
|
// redraw required parts |
224 |
|
queue_draw(); |
225 |
} |
} |
226 |
|
|
227 |
void DimRegionChooser::setModifyAllRegions(bool b) { |
void DimRegionChooser::setModifyAllRegions(bool b) { |
229 |
|
|
230 |
actionDeleteDimZone->set_label(b ? _("Delete Dimension Zone [ALL REGIONS]") : _("Delete Dimension Zone")); |
actionDeleteDimZone->set_label(b ? _("Delete Dimension Zone [ALL REGIONS]") : _("Delete Dimension Zone")); |
231 |
actionSplitDimZone->set_label(b ? _("Split Dimensions Zone [ALL REGIONS]") : _("Split Dimensions Zone")); |
actionSplitDimZone->set_label(b ? _("Split Dimensions Zone [ALL REGIONS]") : _("Split Dimensions Zone")); |
232 |
|
|
233 |
|
// redraw required parts |
234 |
|
queue_draw(); |
235 |
} |
} |
236 |
|
|
237 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
444 |
bool isMainSelection = |
bool isMainSelection = |
445 |
this->maindimcase.find(dimension) != this->maindimcase.end() && |
this->maindimcase.find(dimension) != this->maindimcase.end() && |
446 |
this->maindimcase[dimension] == j; |
this->maindimcase[dimension] == j; |
447 |
|
bool isCheckBoxSelected = |
448 |
|
modifyalldimregs || |
449 |
|
(modifybothchannels && |
450 |
|
dimension == gig::dimension_samplechannel); |
451 |
if (isMainSelection) |
if (isMainSelection) |
452 |
Gdk::Cairo::set_source_rgba(cr, blue); |
Gdk::Cairo::set_source_rgba(cr, blue); |
453 |
else if (isSelectedZone) |
else if (isSelectedZone) |
454 |
cr->set_source(blueHatchedSurfacePattern); |
cr->set_source(blueHatchedSurfacePattern); |
455 |
|
else if (isCheckBoxSelected) |
456 |
|
cr->set_source(grayBlueHatchedSurfacePattern); |
457 |
else |
else |
458 |
Gdk::Cairo::set_source_rgba(cr, white); |
Gdk::Cairo::set_source_rgba(cr, white); |
459 |
|
|
517 |
bool isMainSelection = |
bool isMainSelection = |
518 |
this->maindimcase.find(dimension) != this->maindimcase.end() && |
this->maindimcase.find(dimension) != this->maindimcase.end() && |
519 |
this->maindimcase[dimension] == (j-1); |
this->maindimcase[dimension] == (j-1); |
520 |
|
bool isCheckBoxSelected = |
521 |
|
modifyalldimregs || |
522 |
|
(modifybothchannels && |
523 |
|
dimension == gig::dimension_samplechannel); |
524 |
if (isMainSelection) |
if (isMainSelection) |
525 |
Gdk::Cairo::set_source_rgba(cr, blue); |
Gdk::Cairo::set_source_rgba(cr, blue); |
526 |
else if (isSelectedZone) |
else if (isSelectedZone) |
527 |
cr->set_source(blueHatchedSurfacePattern); |
cr->set_source(blueHatchedSurfacePattern); |
528 |
|
else if (isCheckBoxSelected) |
529 |
|
cr->set_source(grayBlueHatchedSurfacePattern); |
530 |
else |
else |
531 |
Gdk::Cairo::set_source_rgba(cr, white); |
Gdk::Cairo::set_source_rgba(cr, white); |
532 |
cr->rectangle(prevX + 1, y + 1, x - prevX - 1, h - 1); |
cr->rectangle(prevX + 1, y + 1, x - prevX - 1, h - 1); |
1296 |
// (which is supposed to switch between regions) |
// (which is supposed to switch between regions) |
1297 |
if (primaryKeyDown) return false; |
if (primaryKeyDown) return false; |
1298 |
|
|
1299 |
|
// avoid conflict with Alt+Shift+Left and Alt+Shift+Right accelerators on |
1300 |
|
// mainwindow |
1301 |
|
if (shiftKeyDown) return false; |
1302 |
|
|
1303 |
if (key->keyval == GDK_KEY_Left) |
if (key->keyval == GDK_KEY_Left) |
1304 |
select_prev_dimzone(); |
select_prev_dimzone(); |
1305 |
if (key->keyval == GDK_KEY_Right) |
if (key->keyval == GDK_KEY_Right) |
1360 |
return false; //.selection failed |
return false; //.selection failed |
1361 |
} |
} |
1362 |
|
|
1363 |
void DimRegionChooser::select_next_dimzone() { |
void DimRegionChooser::select_next_dimzone(bool add) { |
1364 |
select_dimzone_by_dir(+1); |
select_dimzone_by_dir(+1, add); |
1365 |
} |
} |
1366 |
|
|
1367 |
void DimRegionChooser::select_prev_dimzone() { |
void DimRegionChooser::select_prev_dimzone(bool add) { |
1368 |
select_dimzone_by_dir(-1); |
select_dimzone_by_dir(-1, add); |
1369 |
} |
} |
1370 |
|
|
1371 |
void DimRegionChooser::select_dimzone_by_dir(int dir) { |
void DimRegionChooser::select_dimzone_by_dir(int dir, bool add) { |
1372 |
if (!region) return; |
if (!region) return; |
1373 |
if (!region->Dimensions) return; |
if (!region->Dimensions) return; |
1374 |
if (focus_line < 0) focus_line = 0; |
if (focus_line < 0) focus_line = 0; |
1403 |
|
|
1404 |
maindimregno = getDimensionRegionIndex(dr); |
maindimregno = getDimensionRegionIndex(dr); |
1405 |
|
|
1406 |
// reset selected dimregion zones |
if (!add) { |
1407 |
dimzones.clear(); |
// reset selected dimregion zones |
1408 |
|
dimzones.clear(); |
1409 |
|
} |
1410 |
for (DimensionCase::const_iterator it = maindimcase.begin(); |
for (DimensionCase::const_iterator it = maindimcase.begin(); |
1411 |
it != maindimcase.end(); ++it) |
it != maindimcase.end(); ++it) |
1412 |
{ |
{ |