Add button for deleting all control lines
This commit is contained in:
@@ -44,6 +44,7 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, "perspective", M("
|
||||
Gtk::Image* ipers_draw_horiz = Gtk::manage (new RTImage ("draw-horizontal.png"));
|
||||
Gtk::Image* ipers_draw_vert = Gtk::manage (new RTImage ("draw-vertical.png"));
|
||||
Gtk::Image* ipers_draw = new RTImage ("draw.png");
|
||||
Gtk::Image* ipers_trash = new RTImage ("trash-empty.png");
|
||||
|
||||
Gtk::Image* ipersHL = Gtk::manage (new RTImage ("perspective-horizontal-left-small.png"));
|
||||
Gtk::Image* ipersHR = Gtk::manage (new RTImage ("perspective-horizontal-right-small.png"));
|
||||
@@ -129,6 +130,12 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, "perspective", M("
|
||||
lines_button_edit->signal_toggled().connect(sigc::mem_fun(
|
||||
*this, &::PerspCorrection::linesEditButtonPressed));
|
||||
|
||||
lines_button_erase = Gtk::manage (new Gtk::Button());
|
||||
lines_button_erase->set_image(*ipers_trash);
|
||||
lines_button_erase->set_sensitive(false);
|
||||
lines_button_erase->signal_pressed().connect(sigc::mem_fun(
|
||||
*this, &::PerspCorrection::linesEraseButtonPressed));
|
||||
|
||||
lines = new ControlLineManager();
|
||||
lines->callbacks = new LinesCallbacks(this, lines);
|
||||
|
||||
@@ -142,6 +149,7 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, "perspective", M("
|
||||
control_lines_box->pack_start(*lines_button_v);
|
||||
control_lines_box->pack_start(*lines_button_h);
|
||||
control_lines_box->pack_start(*lines_button_edit);
|
||||
control_lines_box->pack_start(*lines_button_erase);
|
||||
// End control lines interface.
|
||||
|
||||
auto_pitch = Gtk::manage (new Gtk::Button ());
|
||||
@@ -688,7 +696,9 @@ void PerspCorrection::linesEditButtonPressed(void)
|
||||
if (lens_geom_listener) {
|
||||
lens_geom_listener->updateTransformPreviewRequested(EvPerspRender, false);
|
||||
}
|
||||
lines_button_erase->set_sensitive(true);
|
||||
} else { // Leave edit mode.
|
||||
lines_button_erase->set_sensitive(false);
|
||||
render = true;
|
||||
lines->setDrawMode(false);
|
||||
lines->setActive(false);
|
||||
@@ -701,6 +711,11 @@ void PerspCorrection::linesEditButtonPressed(void)
|
||||
}
|
||||
}
|
||||
|
||||
void PerspCorrection::linesEraseButtonPressed(void)
|
||||
{
|
||||
lines->removeAll();
|
||||
}
|
||||
|
||||
ControlLineManager::ControlLineManager():
|
||||
EditSubscriber(ET_OBJECTS),
|
||||
cursor(CSCrosshair),
|
||||
@@ -1060,6 +1075,19 @@ void ControlLineManager::addLine(Coord begin, Coord end)
|
||||
EditSubscriber::mouseOverGeometry.push_back(end_c);
|
||||
}
|
||||
|
||||
void ControlLineManager::removeAll(void)
|
||||
{
|
||||
for (unsigned int i = 0; i < control_lines.size(); i++) {
|
||||
delete control_lines[i]->begin;
|
||||
delete control_lines[i]->end;
|
||||
delete control_lines[i]->line;
|
||||
delete control_lines[i];
|
||||
}
|
||||
control_lines.clear();
|
||||
visibleGeometry.clear();
|
||||
mouseOverGeometry.erase(mouseOverGeometry.begin() + 1, mouseOverGeometry.end());
|
||||
}
|
||||
|
||||
void ControlLineManager::removeLine(size_t line_id)
|
||||
{
|
||||
if (line_id >= control_lines.size()) {
|
||||
|
@@ -76,6 +76,7 @@ public:
|
||||
ControlLineManager();
|
||||
~ControlLineManager();
|
||||
|
||||
void removeAll (void);
|
||||
/** Sets whether or not the lines are visible and interact-able. */
|
||||
void setActive (bool active);
|
||||
/** Set whether or not lines can be drawn and deleted. */
|
||||
@@ -129,6 +130,7 @@ protected:
|
||||
Gtk::Image* img_ctrl_lines_apply;
|
||||
ControlLineManager* lines;
|
||||
Gtk::ToggleButton* lines_button_edit;
|
||||
Gtk::Button* lines_button_erase;
|
||||
Gtk::ToggleButton* lines_button_h;
|
||||
Gtk::ToggleButton* lines_button_v;
|
||||
Adjuster* projection_pitch;
|
||||
@@ -164,6 +166,7 @@ public:
|
||||
void autoCorrectionPressed (Gtk::Button* b);
|
||||
void linesButtonPressed (Gtk::ToggleButton* button);
|
||||
void linesEditButtonPressed (void);
|
||||
void linesEraseButtonPressed (void);
|
||||
void methodChanged (void);
|
||||
void setAdjusterBehavior (bool badd, bool camera_focal_length_add, bool camera_shift_add, bool camera_angle_add, bool projection_angle_add, bool projection_shift_add, bool projection_rotate_add);
|
||||
void setEditProvider (EditDataProvider* provider) override;
|
||||
|
Reference in New Issue
Block a user