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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user