Add classes to curves for css styling (#4986)

This commit is contained in:
TooWaBoo
2018-11-20 00:12:21 +01:00
committed by Beep6581
parent ab2593cf93
commit 61d8a4f254
3 changed files with 106 additions and 52 deletions

View File

@@ -52,20 +52,34 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
// custom curve
customCurveGrid = new Gtk::Grid ();
customCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL);
customCurveGrid->set_row_spacing(2);
customCurveGrid->set_column_spacing(2);
customCurveGrid->get_style_context()->add_class("curve-mainbox");
customCurve = Gtk::manage (new MyDiagonalCurve ());
customCurve->setType (DCT_Spline);
Gtk::Grid* customCurveBox= Gtk::manage (new Gtk::Grid ());
customCurveBox->get_style_context()->add_class("curve-curvebox");
customCurveBox->add(*customCurve);
Gtk::Grid* custombbox = Gtk::manage (new Gtk::Grid ()); // curvebboxpos 0=above, 1=right, 2=below, 3=left
custombbox->get_style_context()->add_class("curve-buttonbox");
if (options.curvebboxpos == 0 || options.curvebboxpos == 2) {
if (options.curvebboxpos == 0) {
custombbox->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
setExpandAlignProperties(custombbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
} else {
customCurveGrid->get_style_context()->add_class("top");
} else if (options.curvebboxpos == 2) {
custombbox->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
setExpandAlignProperties(custombbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
customCurveGrid->get_style_context()->add_class("bottom");
} else if (options.curvebboxpos == 1) {
custombbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
setExpandAlignProperties(custombbox, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL);
customCurveGrid->get_style_context()->add_class("right");
} else if (options.curvebboxpos == 3){
custombbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
setExpandAlignProperties(custombbox, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL);
customCurveGrid->get_style_context()->add_class("left");
}
editPointCustom = Gtk::manage (new Gtk::ToggleButton ());
@@ -90,22 +104,23 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
custombbox->attach_next_to(*saveCustom, sideEnd, 1, 1);
customCoordAdjuster = Gtk::manage (new CoordinateAdjuster(customCurve, this));
customCoordAdjuster->get_style_context()->add_class("curve-spinbuttonbox");
// Button box position: 0=above, 1=right, 2=below, 3=left
customCurveGrid->add(*customCurve);
customCurveGrid->add(*customCurveBox);
customCurve->set_hexpand(true);
if (options.curvebboxpos == 0) {
customCurveGrid->attach_next_to(*custombbox, *customCurve, Gtk::POS_TOP, 1, 1);
customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurve, Gtk::POS_BOTTOM, 1, 1);
customCurveGrid->attach_next_to(*custombbox, *customCurveBox, Gtk::POS_TOP, 1, 1);
customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurveBox, Gtk::POS_BOTTOM, 1, 1);
} else if (options.curvebboxpos == 1) {
customCurveGrid->attach_next_to(*custombbox, *customCurve, Gtk::POS_RIGHT, 1, 1);
customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurve, Gtk::POS_BOTTOM, 2, 1);
customCurveGrid->attach_next_to(*custombbox, *customCurveBox, Gtk::POS_RIGHT, 1, 1);
customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurveBox, Gtk::POS_BOTTOM, 2, 1);
} else if (options.curvebboxpos == 2) {
customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurve, Gtk::POS_BOTTOM, 1, 1);
customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurveBox, Gtk::POS_BOTTOM, 1, 1);
customCurveGrid->attach_next_to(*custombbox, *customCoordAdjuster, Gtk::POS_BOTTOM, 1, 1);
} else if (options.curvebboxpos == 3) {
customCurveGrid->attach_next_to(*custombbox, *customCurve, Gtk::POS_LEFT, 1, 1);
customCurveGrid->attach_next_to(*custombbox, *customCurveBox, Gtk::POS_LEFT, 1, 1);
customCurveGrid->attach_next_to(*customCoordAdjuster, *custombbox, Gtk::POS_BOTTOM, 2, 1);
}
@@ -128,21 +143,35 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
// NURBS curve
NURBSCurveGrid = new Gtk::Grid ();
NURBSCurveGrid->set_row_spacing(4);
NURBSCurveGrid->set_column_spacing(4);
NURBSCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL);
NURBSCurveGrid->get_style_context()->add_class("curve-mainbox");
NURBSCurve = Gtk::manage (new MyDiagonalCurve ());
NURBSCurve->setType (DCT_NURBS);
Gtk::Grid* NURBSCurveBox= Gtk::manage (new Gtk::Grid ());
NURBSCurveBox->get_style_context()->add_class("curve-curvebox");
NURBSCurveBox->add(*NURBSCurve);
Gtk::Grid* NURBSbbox = Gtk::manage (new Gtk::Grid ());
NURBSbbox->get_style_context()->add_class("curve-buttonbox");
if (options.curvebboxpos == 0 || options.curvebboxpos == 2) {
if (options.curvebboxpos == 0) {
NURBSbbox->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
setExpandAlignProperties(NURBSbbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
} else {
NURBSCurveGrid->get_style_context()->add_class("top");
} else if (options.curvebboxpos == 2) {
NURBSbbox->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
setExpandAlignProperties(NURBSbbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
NURBSCurveGrid->get_style_context()->add_class("bottom");
} else if (options.curvebboxpos == 1) {
NURBSbbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
setExpandAlignProperties(NURBSbbox, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL);
NURBSCurveGrid->get_style_context()->add_class("right");
} else if (options.curvebboxpos == 3){
NURBSbbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
setExpandAlignProperties(NURBSbbox, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL);
NURBSCurveGrid->get_style_context()->add_class("left");
}
editPointNURBS = Gtk::manage (new Gtk::ToggleButton ());
@@ -167,22 +196,23 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
NURBSbbox->attach_next_to(*saveNURBS, sideEnd, 1, 1);
NURBSCoordAdjuster = Gtk::manage (new CoordinateAdjuster(NURBSCurve, this));
NURBSCoordAdjuster->get_style_context()->add_class("curve-spinbuttonbox");
// Button box position: 0=above, 1=right, 2=below, 3=left
NURBSCurveGrid->add(*NURBSCurve);
NURBSCurveGrid->add(*NURBSCurveBox);
NURBSCurve->set_hexpand(true);
if (options.curvebboxpos == 0) {
NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurve, Gtk::POS_TOP, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurve, Gtk::POS_BOTTOM, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurveBox, Gtk::POS_TOP, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurveBox, Gtk::POS_BOTTOM, 1, 1);
} else if (options.curvebboxpos == 1) {
NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurve, Gtk::POS_RIGHT, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurve, Gtk::POS_BOTTOM, 2, 1);
NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurveBox, Gtk::POS_RIGHT, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurveBox, Gtk::POS_BOTTOM, 2, 1);
} else if (options.curvebboxpos == 2) {
NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurve, Gtk::POS_BOTTOM, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurveBox, Gtk::POS_BOTTOM, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCoordAdjuster, Gtk::POS_BOTTOM, 1, 1);
} else if (options.curvebboxpos == 3) {
NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurve, Gtk::POS_LEFT, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurveBox, Gtk::POS_LEFT, 1, 1);
NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSbbox, Gtk::POS_BOTTOM, 2, 1);
}
@@ -205,25 +235,40 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
// parametric curve
paramCurveGrid = new Gtk::Grid ();
paramCurveGrid->set_row_spacing(4);
paramCurveGrid->set_column_spacing(4);
paramCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL);
paramCurveGrid->get_style_context()->add_class("curve-mainbox");
paramCurve = Gtk::manage (new MyDiagonalCurve ());
paramCurve->setType (DCT_Parametric);
Gtk::Grid* paramCurveBox= Gtk::manage (new Gtk::Grid ());
paramCurveBox->get_style_context()->add_class("curve-curvebox");
paramCurveBox->add(*paramCurve);
Gtk::Grid* parambbox = Gtk::manage (new Gtk::Grid ());
parambbox->get_style_context()->add_class("curve-buttonbox");
if (options.curvebboxpos == 0 || options.curvebboxpos == 2) {
if (options.curvebboxpos == 0) {
parambbox->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
setExpandAlignProperties(parambbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
} else {
paramCurveGrid->get_style_context()->add_class("top");
} else if (options.curvebboxpos == 2) {
parambbox->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
setExpandAlignProperties(parambbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
paramCurveGrid->get_style_context()->add_class("bottom");
} else if (options.curvebboxpos == 1) {
parambbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
setExpandAlignProperties(parambbox, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL);
paramCurveGrid->get_style_context()->add_class("right");
} else if (options.curvebboxpos == 3){
parambbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
setExpandAlignProperties(parambbox, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL);
paramCurveGrid->get_style_context()->add_class("left");
}
shcSelector = Gtk::manage (new SHCSelector ());
shcSelector->set_name("CurveSHCSelector"); // To handle the 4px gap between the SHCSelector and the curve through CSS
shcSelector->set_name("CurveSHCSelector");
paramCurveBox->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1);
editParam = Gtk::manage (new Gtk::ToggleButton());
initButton(*editParam, Glib::ustring("crosshair-node-curve.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP");
@@ -272,8 +317,7 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
// paramCurveSliderBox needed to set vspacing(4) between curve+shc and sliders without vspacing between each slider
Gtk::Grid* paramCurveSliderBox = Gtk::manage (new Gtk::Grid());
paramCurveSliderBox->set_orientation(Gtk::ORIENTATION_VERTICAL);
paramCurveSliderBox->set_column_spacing(2);
paramCurveSliderBox->set_row_spacing(2);
paramCurveSliderBox->get_style_context()->add_class("curve-sliderbox");
paramCurveSliderBox->attach_next_to(*evhighlights, Gtk::POS_TOP, 1, 1);
paramCurveSliderBox->attach_next_to(*evlights, Gtk::POS_TOP, 1, 1);
@@ -283,24 +327,20 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
paramCurveGrid->show_all ();
// Button box position: 0=above, 1=right, 2=below, 3=left
paramCurveGrid->add(*paramCurve);
paramCurveGrid->add(*paramCurveBox);
paramCurve->set_hexpand(true);
if (options.curvebboxpos == 0) {
paramCurveGrid->attach_next_to(*parambbox, *paramCurve, Gtk::POS_TOP, 1, 1);
paramCurveGrid->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1);
paramCurveGrid->attach_next_to(*paramCurveSliderBox, *shcSelector, Gtk::POS_BOTTOM, 1, 1);
paramCurveGrid->attach_next_to(*parambbox, *paramCurveBox, Gtk::POS_TOP, 1, 1);
paramCurveGrid->attach_next_to(*paramCurveSliderBox, *paramCurveBox, Gtk::POS_BOTTOM, 1, 1);
} else if (options.curvebboxpos == 1) {
paramCurveGrid->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1);
paramCurveGrid->attach_next_to(*parambbox, *paramCurve, Gtk::POS_RIGHT, 1, 2);
paramCurveGrid->attach_next_to(*paramCurveSliderBox, *shcSelector, Gtk::POS_BOTTOM, 2, 1);
paramCurveGrid->attach_next_to(*parambbox, *paramCurveBox, Gtk::POS_RIGHT, 1, 1);
paramCurveGrid->attach_next_to(*paramCurveSliderBox, *paramCurveBox, Gtk::POS_BOTTOM, 2, 1);
} else if (options.curvebboxpos == 2) {
paramCurveGrid->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1);
paramCurveGrid->attach_next_to(*parambbox, *shcSelector, Gtk::POS_BOTTOM, 1, 1);
paramCurveGrid->attach_next_to(*parambbox, *paramCurveBox, Gtk::POS_BOTTOM, 1, 1);
paramCurveGrid->attach_next_to(*paramCurveSliderBox, *parambbox, Gtk::POS_BOTTOM, 1, 1);
} else if (options.curvebboxpos == 3) {
paramCurveGrid->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1);
paramCurveGrid->attach_next_to(*parambbox, *paramCurve, Gtk::POS_LEFT, 1, 2);
paramCurveGrid->attach_next_to(*parambbox, *paramCurveBox, Gtk::POS_LEFT, 1, 1);
paramCurveGrid->attach_next_to(*paramCurveSliderBox, *parambbox, Gtk::POS_BOTTOM, 2, 1);
}