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); |