merge with dev

This commit is contained in:
Desmis
2019-05-22 07:01:55 +02:00

View File

@@ -1059,36 +1059,42 @@ void ToolPanelCoordinator::toolSelected(ToolMode tool)
{ {
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
notebookconn.block(true); // "signal_switch_page" event is blocked to avoid unsubscribing Locallab (allows a correct behavior when switching to another tool using toolbar) auto checkFavorite = [this](FoldableToolPanel* tool) {
for (auto fav : favorites) {
if (fav == tool) {
return true;
}
}
return false;
};
switch (tool) { switch (tool) {
case TMCropSelect: case TMCropSelect: {
toolBar->blockEditDeactivation(false); // To allow deactivating Locallab when switching to another tool using toolbar
crop->setExpanded(true); crop->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*transformPanelSW)); toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(checkFavorite(crop) ? *favoritePanelSW : *transformPanelSW));
prevPage = toolPanelNotebook->get_nth_page(toolPanelNotebook->get_current_page()); // Updating prevPage as "signal_switch_page" event
break; break;
}
case TMSpotWB: case TMSpotWB: {
toolBar->blockEditDeactivation(false); // To allow deactivating Locallab when switching to another tool using toolbar
whitebalance->setExpanded(true); whitebalance->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*colorPanelSW)); toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(checkFavorite(whitebalance) ? *favoritePanelSW : *colorPanelSW));
prevPage = toolPanelNotebook->get_nth_page(toolPanelNotebook->get_current_page()); // Updating prevPage as "signal_switch_page" event
break; break;
}
case TMStraighten: case TMStraighten: {
toolBar->blockEditDeactivation(false); // To allow deactivating Locallab when switching to another tool using toolbar
lensgeom->setExpanded(true);
rotate->setExpanded(true); rotate->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*transformPanelSW)); bool isFavorite = checkFavorite(rotate);
prevPage = toolPanelNotebook->get_nth_page(toolPanelNotebook->get_current_page()); // Updating prevPage as "signal_switch_page" event if (!isFavorite) {
isFavorite = checkFavorite(lensgeom);
lensgeom->setExpanded(true);
}
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(isFavorite ? *favoritePanelSW : *transformPanelSW));
break; break;
}
default: default:
break; break;
} }
notebookconn.block(false);
} }
void ToolPanelCoordinator::editModeSwitchedOff() void ToolPanelCoordinator::editModeSwitchedOff()