Fixing issue #3497: "Lockable color picker interacts with info text on
image area"
This commit is contained in:
@@ -149,16 +149,43 @@ void ImageArea::setInfoText (Glib::ustring text)
|
||||
infotext = text;
|
||||
|
||||
Glib::RefPtr<Pango::Context> context = get_pango_context () ;
|
||||
Pango::FontDescription fontd = context->get_font_description ();
|
||||
Pango::FontDescription fontd(get_default_style()->get_font());
|
||||
|
||||
// update font
|
||||
fontd.set_weight (Pango::WEIGHT_BOLD);
|
||||
fontd.set_size (9 * Pango::SCALE);
|
||||
context->set_font_description (fontd);
|
||||
ilayout = create_pango_layout("");
|
||||
|
||||
// create text layout
|
||||
Glib::RefPtr<Pango::Layout> ilayout = create_pango_layout("");
|
||||
ilayout->set_markup(text);
|
||||
|
||||
// get size of the text block
|
||||
int iw, ih;
|
||||
ilayout->get_pixel_size (iw, ih);
|
||||
ipixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, true, 8, iw + 8, ih + 8);
|
||||
ipixbuf->fill (128);
|
||||
|
||||
// create BackBuffer
|
||||
iBackBuffer.setDrawRectangle(Cairo::FORMAT_ARGB32, 0, 0, iw + 16, ih + 16, true);
|
||||
iBackBuffer.setDestPosition(8, 8);
|
||||
|
||||
Cairo::RefPtr<Cairo::Context> cr = iBackBuffer.getContext();
|
||||
|
||||
// cleaning the back buffer (make it full transparent)
|
||||
cr->set_source_rgba (0., 0., 0., 0.);
|
||||
cr->set_operator (Cairo::OPERATOR_CLEAR);
|
||||
cr->paint ();
|
||||
cr->set_operator (Cairo::OPERATOR_OVER);
|
||||
|
||||
// paint transparent black background
|
||||
cr->set_source_rgba (0., 0., 0., 0.5);
|
||||
cr->paint ();
|
||||
|
||||
// paint text
|
||||
cr->set_source_rgb (1.0, 1.0, 1.0);
|
||||
cr->move_to (8, 8);
|
||||
ilayout->add_to_cairo_context (cr);
|
||||
cr->fill ();
|
||||
|
||||
}
|
||||
|
||||
void ImageArea::infoEnabled (bool e)
|
||||
@@ -206,7 +233,6 @@ bool ImageArea::on_expose_event(GdkEventExpose* event)
|
||||
return true;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gdk::Window> window = get_window();
|
||||
Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
|
||||
|
||||
if (mainCropWindow) {
|
||||
@@ -214,13 +240,7 @@ bool ImageArea::on_expose_event(GdkEventExpose* event)
|
||||
}
|
||||
|
||||
if (options.showInfo && infotext != "") {
|
||||
int fnw, fnh;
|
||||
ilayout->get_pixel_size (fnw, fnh);
|
||||
window->draw_pixbuf (get_style()->get_base_gc (Gtk::STATE_NORMAL), ipixbuf, 0, 0, 4, 4, fnw + 8, fnh + 8, Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
cr->set_source_rgb (1.0, 1.0, 1.0);
|
||||
cr->move_to (8, 8);
|
||||
ilayout->add_to_cairo_context (cr);
|
||||
cr->fill ();
|
||||
iBackBuffer.copySurface(cr);
|
||||
}
|
||||
|
||||
for (std::list<CropWindow*>::reverse_iterator i = cropWins.rbegin(); i != cropWins.rend(); ++i) {
|
||||
|
Reference in New Issue
Block a user