Clean up rtgui perspective.* and controllines.*

Change size_t to std::size_t, remove void from function parameters, use
constants to represent the minimum required number of control lines, and
change const auto & to const auto.
This commit is contained in:
Lawrence Lee
2021-05-31 11:20:01 -07:00
parent 2c1e6a8ca1
commit e7e6dd1cb5
4 changed files with 22 additions and 23 deletions

View File

@@ -519,22 +519,16 @@ void PerspCorrection::applyControlLines(void)
}
std::vector<rtengine::ControlLine> control_lines;
int h_count = 0, v_count = 0;
double rot = camera_roll->getValue();
double pitch = camera_pitch->getValue();
double yaw = camera_yaw->getValue();
lines->toControlLines(control_lines);
for (unsigned int i = 0; i < lines->size(); i++) {
if (control_lines[i].type == rtengine::ControlLine::HORIZONTAL) {
h_count++;
} else if (control_lines[i].type == rtengine::ControlLine::VERTICAL) {
v_count++;
}
}
lens_geom_listener->autoPerspRequested(v_count > 1, h_count > 1, rot, pitch,
yaw, &control_lines);
lens_geom_listener->autoPerspRequested(
lines->getVerticalCount() >= MIN_VERT_LINES,
lines->getHorizontalCount() >= MIN_HORIZ_LINES,
rot, pitch, yaw, &control_lines);
disableListener();
camera_pitch->setValue(pitch);
@@ -748,15 +742,15 @@ void PerspCorrection::lineChanged(void)
}
}
void PerspCorrection::updateApplyDeleteButtons(void)
void PerspCorrection::updateApplyDeleteButtons()
{
if (batchMode) {
return;
}
bool edit_mode = lines_button_edit->get_active();
bool enough_lines = lines->getHorizontalCount() >= 2 || lines->getVerticalCount() >= 2;
const auto &tooltip = M("GENERAL_APPLY")
bool enough_lines = lines->getHorizontalCount() >= MIN_HORIZ_LINES || lines->getVerticalCount() >= MIN_VERT_LINES;
const auto tooltip = M("GENERAL_APPLY")
+ ((edit_mode && !enough_lines) ? "\n\n" + M("TP_PERSPECTIVE_CONTROL_LINE_APPLY_INVALID_TOOLTIP") : "");
lines_button_apply->set_sensitive(edit_mode && enough_lines);