Merge pull request #5814 from Lawrence37/perspective-lines
GUI improvements for perspective correction
This commit is contained in:
@@ -282,6 +282,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit
|
||||
lensgeom->setLensGeomListener(this);
|
||||
rotate->setLensGeomListener(this);
|
||||
perspective->setLensGeomListener(this);
|
||||
perspective->setPerspCorrectionPanelListener(this);
|
||||
distortion->setLensGeomListener(this);
|
||||
crop->setCropPanelListener(this);
|
||||
icm->setICMPanelListener(this);
|
||||
@@ -986,7 +987,7 @@ void ToolPanelCoordinator::straightenRequested()
|
||||
toolBar->setTool(TMStraighten);
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::autoPerspRequested (bool corr_pitch, bool corr_yaw, double& rot, double& pitch, double& yaw)
|
||||
void ToolPanelCoordinator::autoPerspRequested (bool corr_pitch, bool corr_yaw, double& rot, double& pitch, double& yaw, const std::vector<rtengine::ControlLine> *lines)
|
||||
{
|
||||
if (!(ipc && (corr_pitch || corr_yaw))) {
|
||||
return;
|
||||
@@ -1000,7 +1001,7 @@ void ToolPanelCoordinator::autoPerspRequested (bool corr_pitch, bool corr_yaw, d
|
||||
rtengine::procparams::ProcParams params;
|
||||
ipc->getParams(¶ms);
|
||||
|
||||
auto res = rtengine::PerspectiveCorrection::autocompute(src, corr_pitch, corr_yaw, ¶ms, src->getMetaData());
|
||||
auto res = rtengine::PerspectiveCorrection::autocompute(src, corr_pitch, corr_yaw, ¶ms, src->getMetaData(), lines);
|
||||
rot = res.angle;
|
||||
pitch = res.pitch;
|
||||
yaw = res.yaw;
|
||||
@@ -1015,6 +1016,16 @@ double ToolPanelCoordinator::autoDistorRequested()
|
||||
return rtengine::ImProcFunctions::getAutoDistor(ipc->getInitialImage()->getFileName(), 400);
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::updateTransformPreviewRequested(rtengine::ProcEvent event, bool render_perspective)
|
||||
{
|
||||
if (!ipc) {
|
||||
return;
|
||||
}
|
||||
|
||||
ipc->beginUpdateParams()->perspective.render = render_perspective;
|
||||
ipc->endUpdateParams(event);
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::spotWBRequested(int size)
|
||||
{
|
||||
|
||||
@@ -1035,6 +1046,17 @@ void ToolPanelCoordinator::cropSelectRequested()
|
||||
toolBar->setTool(TMCropSelect);
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::controlLineEditModeChanged(bool active)
|
||||
{
|
||||
if (!ipc) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (active) {
|
||||
toolBar->setTool(TMPerspective);
|
||||
}
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::saveInputICCReference(const Glib::ustring& fname, bool apply_wb)
|
||||
{
|
||||
if (ipc) {
|
||||
@@ -1162,6 +1184,13 @@ void ToolPanelCoordinator::updateTPVScrollbar(bool hide)
|
||||
updateVScrollbars(hide);
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::toolDeselected(ToolMode tool)
|
||||
{
|
||||
if (tool == TMPerspective) {
|
||||
perspective->requestApplyControlLines();
|
||||
}
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::toolSelected(ToolMode tool)
|
||||
{
|
||||
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
|
||||
@@ -1206,6 +1235,20 @@ void ToolPanelCoordinator::toolSelected(ToolMode tool)
|
||||
break;
|
||||
}
|
||||
|
||||
case TMPerspective: {
|
||||
toolBar->blockEditDeactivation(false); // To allow deactivating Locallab when switching to another tool using toolbar
|
||||
perspective->setControlLineEditMode(true);
|
||||
perspective->setExpanded(true);
|
||||
bool isFavorite = checkFavorite(perspective);
|
||||
if (!isFavorite) {
|
||||
isFavorite = checkFavorite(lensgeom);
|
||||
lensgeom->setExpanded(true);
|
||||
}
|
||||
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(isFavorite ? *favoritePanelSW : *transformPanelSW));
|
||||
prevPage = toolPanelNotebook->get_nth_page(toolPanelNotebook->get_current_page()); // Updating prevPage as "signal_switch_page" event
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user