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

@@ -47,21 +47,35 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u
// ControlPoints curve
CPointsCurveGrid = new Gtk::Grid ();
CPointsCurveGrid->set_row_spacing(2);
CPointsCurveGrid->set_column_spacing(2);
CPointsCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL);
CPointsCurveGrid->get_style_context()->add_class("curve-mainbox");
CPointsCurve = Gtk::manage (new MyFlatCurve ());
CPointsCurve->setType (FCT_MinMaxCPoints);
Gtk::Grid* CPointsCurveBox = Gtk::manage (new Gtk::Grid ());
CPointsCurveBox->get_style_context()->add_class("curve-curvebox");
CPointsCurveBox->add(*CPointsCurve);
Gtk::Grid* CPointsbbox = Gtk::manage (new Gtk::Grid ()); // curvebboxpos 0=above, 1=right, 2=below, 3=left
CPointsbbox->get_style_context()->add_class("curve-buttonbox");
if (options.curvebboxpos == 0 || options.curvebboxpos == 2) {
if (options.curvebboxpos == 0) {
CPointsbbox->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
setExpandAlignProperties(CPointsbbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
} else {
CPointsCurveGrid->get_style_context()->add_class("top");
} else if (options.curvebboxpos == 2) {
CPointsbbox->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
setExpandAlignProperties(CPointsbbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
CPointsCurveGrid->get_style_context()->add_class("bottom");
} else if (options.curvebboxpos == 1) {
CPointsbbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
setExpandAlignProperties(CPointsbbox, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL);
CPointsCurveGrid->get_style_context()->add_class("right");
} else if (options.curvebboxpos == 3){
CPointsbbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
setExpandAlignProperties(CPointsbbox, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL);
CPointsCurveGrid->get_style_context()->add_class("left");
}
editCPoints = Gtk::manage (new Gtk::ToggleButton());
@@ -92,23 +106,24 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u
axis.at(2).setValues(M("CURVEEDITOR_AXIS_LEFT_TAN"), 5, 0.01, 0.1, 0., 1.);
axis.at(3).setValues(M("CURVEEDITOR_AXIS_RIGHT_TAN"), 5, 0.01, 0.1, 0., 1.);
CPointsCoordAdjuster = Gtk::manage (new CoordinateAdjuster(CPointsCurve, this, axis));
CPointsCoordAdjuster->get_style_context()->add_class("curve-spinbuttonbox");
}
// Button box position: 0=above, 1=right, 2=below, 3=left
CPointsCurveGrid->add(*CPointsCurve);
CPointsCurveGrid->add(*CPointsCurveBox);
CPointsCurve->set_hexpand(true);
if (options.curvebboxpos == 0) {
CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurve, Gtk::POS_TOP, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurve, Gtk::POS_BOTTOM, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurveBox, Gtk::POS_TOP, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurveBox, Gtk::POS_BOTTOM, 1, 1);
} else if (options.curvebboxpos == 1) {
CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurve, Gtk::POS_RIGHT, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurve, Gtk::POS_BOTTOM, 2, 1);
CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurveBox, Gtk::POS_RIGHT, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurveBox, Gtk::POS_BOTTOM, 2, 1);
} else if (options.curvebboxpos == 2) {
CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurve, Gtk::POS_BOTTOM, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurveBox, Gtk::POS_BOTTOM, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCoordAdjuster, Gtk::POS_BOTTOM, 1, 1);
} else if (options.curvebboxpos == 3) {
CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurve, Gtk::POS_LEFT, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurveBox, Gtk::POS_LEFT, 1, 1);
CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsbbox, Gtk::POS_BOTTOM, 2, 1);
}