Gtk3 by Hombre, issue 2807

This commit is contained in:
Morgan Hardwood
2015-08-12 16:07:19 +02:00
parent 91f67f0cb6
commit 56a0805bc7
133 changed files with 3950 additions and 2626 deletions

View File

@@ -34,24 +34,27 @@ MyCurve::MyCurve () : pipetteR(-1.f), pipetteG(-1.f), pipetteB(-1.f), pipetteVal
leftBar = NULL;
bottomBar = NULL;
colorProvider = NULL;
sized = RS_Pending;
snapToElmt = -100;
curveIsDirty = true;
edited_point = -1;
set_extension_events(Gdk::EXTENSION_EVENTS_ALL);
#if defined (__APPLE__)
//#if defined (__APPLE__)
// Workaround: disabling POINTER_MOTION_HINT_MASK as for gtk 2.24.22 the get_pointer() function is buggy for quartz and modifier mask is not updated correctly.
// This workaround should be removed when bug is fixed in GTK2 or when migrating to GTK3
add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK);
#else
add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK);
#endif
//add_events(Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK);
//#else
add_events(Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK);
//#endif
mcih = new MyCurveIdleHelper;
mcih->myCurve = this;
mcih->destroyed = false;
mcih->pending = 0;
Glib::RefPtr<Gtk::StyleContext> style = get_style_context();
style->add_class(GTK_STYLE_CLASS_BACKGROUND);
style->add_class(GTK_STYLE_CLASS_FLAT);
style->add_class(GTK_STYLE_CLASS_NOTEBOOK);
}
MyCurve::~MyCurve ()
@@ -86,6 +89,51 @@ int MyCurve::calcDimensions ()
return newRequestedH;
}
Gtk::SizeRequestMode MyCurve::get_request_mode_vfunc () const
{
return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH;
}
void MyCurve::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const
{
int minimumWidth = 0;
int naturalWidth = 0;
get_preferred_width_vfunc (minimumWidth, naturalWidth);
get_preferred_height_for_width_vfunc (minimumWidth, minimum_height, natural_height);
}
void MyCurve::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const
{
natural_width = minimum_width = GRAPH_SIZE + 2 * RADIUS;
}
void MyCurve::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const
{
minimum_height = width;
if (leftBar && !bottomBar) {
minimum_height -= getBarWidth() + CBAR_MARGIN - RADIUS;
}
if (!leftBar && bottomBar) {
minimum_height += getBarWidth() + CBAR_MARGIN - RADIUS;
}
/*
graphW = width - RADIUS - (leftBar ? (getBarWidth()+CBAR_MARGIN) : RADIUS);
graphH = minimum_height - RADIUS - (bottomBar ? (getBarWidth()+CBAR_MARGIN) : RADIUS);
graphX = width - RADIUS - graphW;
graphY = RADIUS + graphH;
*/
natural_height = minimum_height;
}
void MyCurve::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const
{
get_preferred_width_vfunc (minimum_width, natural_width);
}
void MyCurve::setColoredBar (ColoredBar *left, ColoredBar *bottom)
{
leftBar = left;
@@ -145,7 +193,7 @@ float MyCurve::getVal(LUTf &curve, int x)
}
}
void MyCurve::on_style_changed (const Glib::RefPtr<Gtk::Style>& style)
void MyCurve::on_style_updated ()
{
setDirty(true);
queue_draw ();