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

@@ -42,60 +42,65 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u
curveBBoxPos = options.curvebboxpos;
// ControlPoints curve
CPointsCurveBox = new Gtk::VBox ();
CPointsCurveBox->set_spacing(4);
Gtk::HBox* CPointsCurveAndButtons = Gtk::manage (new Gtk::HBox ());
CPointsCurveAndButtons->set_spacing(4);
CPointsCurveGrid = new Gtk::Grid ();
CPointsCurveGrid->set_row_spacing(options.slimUI ? 2 : 4);
CPointsCurveGrid->set_column_spacing(options.slimUI ? 2 : 4);
CPointsCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL);
CPointsCurve = Gtk::manage (new MyFlatCurve ());
CPointsCurve->set_size_request (GRAPH_SIZE + 2 * RADIUS + 1, GRAPH_SIZE + 2 * RADIUS + 1);
CPointsCurve->setType (FCT_MinMaxCPoints);
Gtk::Box* CPointsbbox; // curvebboxpos 0=above, 1=right, 2=below, 3=left
Gtk::Grid* CPointsbbox = Gtk::manage (new Gtk::Grid ()); // curvebboxpos 0=above, 1=right, 2=below, 3=left
CPointsbbox->set_orientation(Gtk::ORIENTATION_VERTICAL);
if (options.curvebboxpos == 1 || options.curvebboxpos == 3) {
CPointsbbox = Gtk::manage (new Gtk::VBox ());
if (options.curvebboxpos == 0 || options.curvebboxpos == 2) {
setExpandAlignProperties(CPointsbbox, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
} else {
CPointsbbox = Gtk::manage (new Gtk::HBox ());
setExpandAlignProperties(CPointsbbox, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START);
}
CPointsbbox->set_spacing(4);
pasteCPoints = Gtk::manage (new Gtk::Button ());
pasteCPoints->add (*Gtk::manage (new RTImage ("edit-paste.png")));
copyCPoints = Gtk::manage (new Gtk::Button ());
copyCPoints->add (*Gtk::manage (new RTImage ("edit-copy.png")));
saveCPoints = Gtk::manage (new Gtk::Button ());
saveCPoints->add (*Gtk::manage (new RTImage ("gtk-save-large.png")));
loadCPoints = Gtk::manage (new Gtk::Button ());
loadCPoints->add (*Gtk::manage (new RTImage ("gtk-open.png")));
editCPoints = Gtk::manage (new Gtk::ToggleButton());
editPointCPoints = Gtk::manage (new Gtk::ToggleButton ());
editPointCPoints->add (*Gtk::manage (new RTImage ("gtk-edit.png")));
editPointCPoints->set_tooltip_text(M("CURVEEDITOR_EDITPOINT_HINT"));
editCPoints->add (*Gtk::manage (new RTImage ("editmodehand.png")));
editCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
setExpandAlignProperties(editCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
editCPoints->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP"));
editCPoints->hide();
editPointCPoints = Gtk::manage (new Gtk::ToggleButton ());
editPointCPoints->add (*Gtk::manage (new RTImage ("gtk-edit.png")));
editPointCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
editPointCPoints->set_tooltip_text(M("CURVEEDITOR_EDITPOINT_HINT"));
setExpandAlignProperties(editPointCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
copyCPoints = Gtk::manage (new Gtk::Button ());
copyCPoints->add (*Gtk::manage (new RTImage ("edit-copy.png")));
copyCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
setExpandAlignProperties(copyCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END);
pasteCPoints = Gtk::manage (new Gtk::Button ());
pasteCPoints->add (*Gtk::manage (new RTImage ("edit-paste.png")));
pasteCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
setExpandAlignProperties(pasteCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END);
loadCPoints = Gtk::manage (new Gtk::Button ());
loadCPoints->add (*Gtk::manage (new RTImage ("gtk-open.png")));
loadCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
setExpandAlignProperties(loadCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END);
saveCPoints = Gtk::manage (new Gtk::Button ());
saveCPoints->add (*Gtk::manage (new RTImage ("gtk-save-large.png")));
saveCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
setExpandAlignProperties(saveCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END);
CPointsbbox->pack_end (*pasteCPoints, Gtk::PACK_SHRINK, 0);
CPointsbbox->pack_end (*copyCPoints, Gtk::PACK_SHRINK, 0);
CPointsbbox->pack_end (*saveCPoints, Gtk::PACK_SHRINK, 0);
CPointsbbox->pack_end (*loadCPoints, Gtk::PACK_SHRINK, 0);
CPointsbbox->pack_start(*editPointCPoints, Gtk::PACK_SHRINK, 0);
CPointsbbox->pack_start(*editCPoints, Gtk::PACK_SHRINK, 0);
CPointsCurveAndButtons->pack_start (*CPointsCurve, Gtk::PACK_EXPAND_WIDGET, 0);
CPointsCurveAndButtons->pack_start (*CPointsbbox, Gtk::PACK_SHRINK, 0);
CPointsCurveBox->pack_start (*CPointsCurveAndButtons, Gtk::PACK_EXPAND_WIDGET);
if (options.curvebboxpos == 0) {
removeIfThere (CPointsCurveAndButtons, CPointsbbox, false);
CPointsCurveBox->pack_start (*CPointsbbox);
CPointsCurveBox->reorder_child(*CPointsbbox, 0);
} else if (options.curvebboxpos == 2) {
removeIfThere (CPointsCurveAndButtons, CPointsbbox, false);
CPointsCurveBox->pack_start (*CPointsbbox);
} else if (options.curvebboxpos == 3) {
CPointsCurveAndButtons->reorder_child(*CPointsbbox, 0);
if (options.curvebboxpos == 0 || options.curvebboxpos == 2) {
CPointsbbox->attach(*editCPoints, 0, 0, 1, 1);
CPointsbbox->attach(*editPointCPoints, 1, 0, 1, 1);
CPointsbbox->attach(*copyCPoints, 2, 0, 1, 1);
CPointsbbox->attach(*pasteCPoints, 3, 0, 1, 1);
CPointsbbox->attach(*loadCPoints, 4, 0, 1, 1);
CPointsbbox->attach(*saveCPoints, 5, 0, 1, 1);
} else {
CPointsbbox->attach(*editCPoints, 0, 0, 1, 1);
CPointsbbox->attach(*editPointCPoints, 0, 1, 1, 1);
CPointsbbox->attach(*copyCPoints, 0, 2, 1, 1);
CPointsbbox->attach(*pasteCPoints, 0, 3, 1, 1);
CPointsbbox->attach(*loadCPoints, 0, 4, 1, 1);
CPointsbbox->attach(*saveCPoints, 0, 5, 1, 1);
}
{
@@ -106,16 +111,27 @@ 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));
CPointsCurveBox->pack_start(*CPointsCoordAdjuster, Gtk::PACK_SHRINK, 0);
if (options.curvebboxpos == 2) {
CPointsCurveBox->reorder_child(*CPointsCoordAdjuster, 2);
}
CPointsCoordAdjuster->show_all();
}
CPointsCurveBox->show_all ();
// Button box position: 0=above, 1=right, 2=below, 3=left
CPointsCurveGrid->add(*CPointsCurve);
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);
} 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);
} else if (options.curvebboxpos == 2) {
CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurve, 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(*CPointsCoordAdjuster, *CPointsbbox, Gtk::POS_BOTTOM, 2, 1);
}
CPointsCurveGrid->show_all ();
CPointsCoordAdjuster->hide();
saveCPoints->signal_clicked().connect( sigc::mem_fun(*this, &FlatCurveEditorSubGroup::savePressed) );
@@ -135,7 +151,7 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u
FlatCurveEditorSubGroup::~FlatCurveEditorSubGroup()
{
delete CPointsCurveBox;
delete CPointsCurveGrid;
}
/*
@@ -336,10 +352,10 @@ void FlatCurveEditorSubGroup::switchGUI()
CPointsCurve->setPoints (dCurve->controlPointsCurveEd);
CPointsCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId());
CPointsCurve->setColoredBar(leftBar, bottomBar);
CPointsCurve->forceResize();
CPointsCurve->queue_resize_no_redraw();
updateEditButton(dCurve, editCPoints, editCPointsConn);
parent->pack_start (*CPointsCurveBox);
CPointsCurveBox->check_resize();
parent->pack_start (*CPointsCurveGrid);
CPointsCurveGrid->check_resize();
break;
default: // (DCT_Linear, DCT_Unchanged)
@@ -575,7 +591,7 @@ const std::vector<double> FlatCurveEditorSubGroup::getCurveFromGUI (int type)
*/
void FlatCurveEditorSubGroup::removeEditor ()
{
removeIfThere (parent, CPointsCurveBox, false);
removeIfThere (parent, CPointsCurveGrid, false);
}
bool FlatCurveEditorSubGroup::curveReset(CurveEditor *ce)