Keyboard shortcut should reveal tool's current tab (original or favorites), fixes #5333

This commit is contained in:
heckflosse 2019-05-21 16:24:14 +02:00
parent cd6f45f700
commit b2936d185d

View File

@ -955,22 +955,38 @@ 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
auto checkFavorite = [this](FoldableToolPanel* tool) {
for (auto fav : favorites) {
if (fav == tool) {
return true;
}
}
return false;
};
switch (tool) { switch (tool) {
case TMCropSelect: case TMCropSelect: {
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));
break; break;
}
case TMSpotWB: case TMSpotWB: {
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));
break; break;
}
case TMStraighten: case TMStraighten: {
lensgeom->setExpanded (true); rotate->setExpanded(true);
rotate->setExpanded (true); bool isFavorite = checkFavorite(rotate);
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num (*transformPanelSW)); if (!isFavorite) {
isFavorite = checkFavorite(lensgeom);
lensgeom->setExpanded(true);
}
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(isFavorite ? *favoritePanelSW : *transformPanelSW));
break; break;
}
default: default:
break; break;