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_horiz = Gtk::manage (new RTImage ("draw-horizontal.png"));
|
||||||
Gtk::Image* ipers_draw_vert = Gtk::manage (new RTImage ("draw-vertical.png"));
|
Gtk::Image* ipers_draw_vert = Gtk::manage (new RTImage ("draw-vertical.png"));
|
||||||
Gtk::Image* ipers_draw = new RTImage ("draw.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* ipersHL = Gtk::manage (new RTImage ("perspective-horizontal-left-small.png"));
|
||||||
Gtk::Image* ipersHR = Gtk::manage (new RTImage ("perspective-horizontal-right-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(
|
lines_button_edit->signal_toggled().connect(sigc::mem_fun(
|
||||||
*this, &::PerspCorrection::linesEditButtonPressed));
|
*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 = new ControlLineManager();
|
||||||
lines->callbacks = new LinesCallbacks(this, lines);
|
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_v);
|
||||||
control_lines_box->pack_start(*lines_button_h);
|
control_lines_box->pack_start(*lines_button_h);
|
||||||
control_lines_box->pack_start(*lines_button_edit);
|
control_lines_box->pack_start(*lines_button_edit);
|
||||||
|
control_lines_box->pack_start(*lines_button_erase);
|
||||||
// End control lines interface.
|
// End control lines interface.
|
||||||
|
|
||||||
auto_pitch = Gtk::manage (new Gtk::Button ());
|
auto_pitch = Gtk::manage (new Gtk::Button ());
|
||||||
@@ -688,7 +696,9 @@ void PerspCorrection::linesEditButtonPressed(void)
|
|||||||
if (lens_geom_listener) {
|
if (lens_geom_listener) {
|
||||||
lens_geom_listener->updateTransformPreviewRequested(EvPerspRender, false);
|
lens_geom_listener->updateTransformPreviewRequested(EvPerspRender, false);
|
||||||
}
|
}
|
||||||
|
lines_button_erase->set_sensitive(true);
|
||||||
} else { // Leave edit mode.
|
} else { // Leave edit mode.
|
||||||
|
lines_button_erase->set_sensitive(false);
|
||||||
render = true;
|
render = true;
|
||||||
lines->setDrawMode(false);
|
lines->setDrawMode(false);
|
||||||
lines->setActive(false);
|
lines->setActive(false);
|
||||||
@@ -701,6 +711,11 @@ void PerspCorrection::linesEditButtonPressed(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PerspCorrection::linesEraseButtonPressed(void)
|
||||||
|
{
|
||||||
|
lines->removeAll();
|
||||||
|
}
|
||||||
|
|
||||||
ControlLineManager::ControlLineManager():
|
ControlLineManager::ControlLineManager():
|
||||||
EditSubscriber(ET_OBJECTS),
|
EditSubscriber(ET_OBJECTS),
|
||||||
cursor(CSCrosshair),
|
cursor(CSCrosshair),
|
||||||
@@ -1060,6 +1075,19 @@ void ControlLineManager::addLine(Coord begin, Coord end)
|
|||||||
EditSubscriber::mouseOverGeometry.push_back(end_c);
|
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)
|
void ControlLineManager::removeLine(size_t line_id)
|
||||||
{
|
{
|
||||||
if (line_id >= control_lines.size()) {
|
if (line_id >= control_lines.size()) {
|
||||||
|
@@ -76,6 +76,7 @@ public:
|
|||||||
ControlLineManager();
|
ControlLineManager();
|
||||||
~ControlLineManager();
|
~ControlLineManager();
|
||||||
|
|
||||||
|
void removeAll (void);
|
||||||
/** Sets whether or not the lines are visible and interact-able. */
|
/** Sets whether or not the lines are visible and interact-able. */
|
||||||
void setActive (bool active);
|
void setActive (bool active);
|
||||||
/** Set whether or not lines can be drawn and deleted. */
|
/** Set whether or not lines can be drawn and deleted. */
|
||||||
@@ -129,6 +130,7 @@ protected:
|
|||||||
Gtk::Image* img_ctrl_lines_apply;
|
Gtk::Image* img_ctrl_lines_apply;
|
||||||
ControlLineManager* lines;
|
ControlLineManager* lines;
|
||||||
Gtk::ToggleButton* lines_button_edit;
|
Gtk::ToggleButton* lines_button_edit;
|
||||||
|
Gtk::Button* lines_button_erase;
|
||||||
Gtk::ToggleButton* lines_button_h;
|
Gtk::ToggleButton* lines_button_h;
|
||||||
Gtk::ToggleButton* lines_button_v;
|
Gtk::ToggleButton* lines_button_v;
|
||||||
Adjuster* projection_pitch;
|
Adjuster* projection_pitch;
|
||||||
@@ -164,6 +166,7 @@ public:
|
|||||||
void autoCorrectionPressed (Gtk::Button* b);
|
void autoCorrectionPressed (Gtk::Button* b);
|
||||||
void linesButtonPressed (Gtk::ToggleButton* button);
|
void linesButtonPressed (Gtk::ToggleButton* button);
|
||||||
void linesEditButtonPressed (void);
|
void linesEditButtonPressed (void);
|
||||||
|
void linesEraseButtonPressed (void);
|
||||||
void methodChanged (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 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;
|
void setEditProvider (EditDataProvider* provider) override;
|
||||||
|
Reference in New Issue
Block a user