Modified Preview Canvas

- Now the Preview can show free space around the image (the image's
corner will coincide with the center of the preview area)
- Editing objects can now be manipulated in this free space
- The editing mechanism has been split : it was completely handled in
rtengine before, now rtengine still handle the pipette's data provider,
but rtgui now handle the objects data provider.
- Bugfix: when using coarse rotate in the Editor panel, the Gradient
widgets are now correctly displayed
This commit is contained in:
Hombre
2016-01-29 22:09:56 +01:00
parent 8c3e6eab95
commit 4665b88788
22 changed files with 1413 additions and 848 deletions

View File

@@ -269,8 +269,8 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL)
toolPanelNotebook->set_scrollable ();
toolPanelNotebook->show_all ();
for (size_t i = 0; i < toolPanels.size(); i++) {
toolPanels[i]->setListener (this);
for (auto toolPanel : toolPanels) {
toolPanel->setListener (this);
}
whitebalance->setWBProvider (this);
@@ -323,8 +323,8 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
ProcParams* params = ipc->beginUpdateParams ();
for (size_t i = 0; i < toolPanels.size(); i++) {
toolPanels[i]->write (params);
for (auto toolPanel : toolPanels) {
toolPanel->write (params);
}
// Compensate rotation on flip
@@ -336,6 +336,24 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
}
}
int tr = TR_NONE;
if (params->coarse.rotate == 90) {
tr = TR_R90;
} else if (params->coarse.rotate == 180) {
tr = TR_R180;
} else if (params->coarse.rotate == 270) {
tr = TR_R270;
}
// Update "on preview" geometry
if (event == rtengine::EvPhotoLoaded || event == rtengine::EvProfileChanged || event == rtengine::EvHistoryBrowsed || event == rtengine::EvCTRotate) {
// updating the "on preview" geometry
int fw, fh;
rtengine::ImageSource *ii = (rtengine::ImageSource*)ipc->getInitialImage();
ii->getFullSize (fw, fh, tr);
gradient->updateGeometry (params->gradient.centerX, params->gradient.centerY, params->gradient.feather, params->gradient.degree, fw, fh);
}
// some transformations make the crop change for convenience
if (event == rtengine::EvCTHFlip) {
crop->hFlipCrop ();
@@ -357,8 +375,8 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
hasChanged = true;
for (size_t i = 0; i < paramcListeners.size(); i++) {
paramcListeners[i]->procParamsChanged (params, event, descr);
for (auto paramcListener : paramcListeners) {
paramcListener->procParamsChanged (params, event, descr);
}
}
@@ -403,17 +421,12 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi
delete mergedParams;
tr = TR_NONE;
if (params->coarse.rotate == 90) {
tr |= TR_R90;
}
if (params->coarse.rotate == 180) {
tr |= TR_R180;
}
if (params->coarse.rotate == 270) {
tr |= TR_R270;
tr = TR_R90;
} else if (params->coarse.rotate == 180) {
tr = TR_R180;
} else if (params->coarse.rotate == 270) {
tr = TR_R270;
}
// trimming overflowing cropped area
@@ -422,14 +435,19 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi
crop->trim(params, fw, fh);
// updating the GUI with updated values
for (unsigned int i = 0; i < toolPanels.size(); i++) {
toolPanels[i]->read (params);
for (auto toolPanel : toolPanels) {
toolPanel->read (params);
if (event == rtengine::EvPhotoLoaded || event == rtengine::EvProfileChanged) {
toolPanels[i]->autoOpenCurve();
toolPanel->autoOpenCurve();
}
}
if (event == rtengine::EvPhotoLoaded || event == rtengine::EvProfileChanged || event == rtengine::EvHistoryBrowsed || event == rtengine::EvCTRotate) {
// updating the "on preview" geometry
gradient->updateGeometry (params->gradient.centerX, params->gradient.centerY, params->gradient.feather, params->gradient.degree, fw, fh);
}
// start the IPC processing
if (filterRawRefresh) {
ipc->endUpdateParams ( refreshmap[(int)event] & ALLNORAW );
@@ -439,8 +457,8 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi
hasChanged = event != rtengine::EvProfileChangeNotification;
for (size_t i = 0; i < paramcListeners.size(); i++) {
paramcListeners[i]->procParamsChanged (params, event, descr);
for (auto paramcListener : paramcListeners) {
paramcListener->procParamsChanged (params, event, descr);
}
}
@@ -448,8 +466,8 @@ void ToolPanelCoordinator::setDefaults (ProcParams* defparams)
{
if (defparams)
for (size_t i = 0; i < toolPanels.size(); i++) {
toolPanels[i]->setDefaults (defparams);
for (auto toolPanel : toolPanels) {
toolPanel->setDefaults (defparams);
}
}
@@ -746,9 +764,9 @@ void ToolPanelCoordinator::updateCurveBackgroundHistogram (LUTu & histToneCurve,
void ToolPanelCoordinator::foldAllButOne (Gtk::Box* parent, FoldableToolPanel* openedSection)
{
for (size_t i = 0; i < toolPanels.size(); i++) {
if (toolPanels[i]->getParent() != NULL) {
ToolPanel* currentTP = toolPanels[i];
for (auto toolPanel : toolPanels) {
if (toolPanel->getParent() != NULL) {
ToolPanel* currentTP = toolPanel;
if (currentTP->getParent() == parent) {
// Section in the same tab, we unfold it if it's not the one that has been clicked