Solving issue 1762: "Auto Levels does not work with 8-bit images" and issue 1148: "Auto White Balance doesn't work in a File Browser tab"

This commit is contained in:
natureh 510
2013-03-29 11:28:08 +01:00
parent 148c0cbca4
commit 5bd68ce99a
13 changed files with 187 additions and 202 deletions

View File

@@ -324,6 +324,9 @@ bool FileBrowserEntry::pressNotify (int button, int type, int bstate, int x, i
bool b = ThumbBrowserEntryBase::pressNotify (button, type, bstate, x, y);
if (!iatlistener || !iatlistener->getToolBar())
return true;
ToolMode tm = iatlistener->getToolBar()->getTool ();
int ix = x - startx - ofsX;
int iy = y - starty - ofsY;
@@ -407,13 +410,13 @@ bool FileBrowserEntry::releaseNotify (int button, int type, int bstate, int x, i
if (!b) {
if (state==SRotateSelecting) {
iatlistener->rotateSelectionReady (rot_deg, thumbnail);
iatlistener->getToolBar()->setTool (TMHand);
if (iatlistener->getToolBar()) iatlistener->getToolBar()->setTool (TMHand);
}
else if (cropgl && (state==SCropSelecting || state==SResizeH1 || state==SResizeH2 || state==SResizeW1 || state==SResizeW2 || state==SCropMove)) {
cropgl->cropManipReady ();
cropgl = NULL;
iatlistener->cropSelectionReady ();
iatlistener->getToolBar()->setTool (TMHand);
if (iatlistener->getToolBar()) iatlistener->getToolBar()->setTool (TMHand);
}
state = SNormal;
if (parent)
@@ -472,7 +475,7 @@ bool FileBrowserEntry::onArea (CursorArea a, int x, int y) {
void FileBrowserEntry::updateCursor (int x, int y) {
if (!iatlistener)
if (!iatlistener || !iatlistener->getToolBar())
return;
ToolMode tm = iatlistener->getToolBar()->getTool ();

View File

@@ -49,6 +49,7 @@ FilePanel::FilePanel () : parent(NULL) {
dirpaned->pack1 (*placespaned, false, true);
tpc = new BatchToolPanelCoordinator (this);
tpc->removeWbTool();
fileCatalog = Gtk::manage ( new FileCatalog (tpc->coarse, tpc->getToolBar(),this) );
ribbonPane = Gtk::manage ( new Gtk::Paned() );
ribbonPane->add(*fileCatalog);
@@ -247,7 +248,7 @@ bool FilePanel::handleShortcutKey (GdkEventKey* event) {
}
}
if(tpc->getToolBar()->handleShortcutKey(event))
if(tpc->getToolBar() && tpc->getToolBar()->handleShortcutKey(event))
return true;
if(tpc->handleShortcutKey(event))

View File

@@ -455,7 +455,7 @@ void ImageArea::setPointerMotionHListener (PointerMotionListener* pml) {
ToolMode ImageArea::getToolMode () {
if (listener)
if (listener && listener->getToolBar())
return listener->getToolBar()->getTool ();
else
return TMHand;
@@ -463,7 +463,7 @@ ToolMode ImageArea::getToolMode () {
void ImageArea::setToolHand () {
if (listener)
if (listener && listener->getToolBar())
listener->getToolBar()->setTool (TMHand);
}

View File

@@ -31,6 +31,7 @@ class ImageAreaToolListener {
virtual void cropSelectionReady () {}
virtual void rotateSelectionReady (double rotate_deg, Thumbnail* thm=NULL) {}
virtual ToolBar* getToolBar () { return NULL; }
virtual void removeWbTool() =0;
virtual CropGUIListener* startCropEditing (Thumbnail* thm=NULL) { return NULL; }
};

View File

@@ -108,9 +108,9 @@ class Thumbnail {
const Glib::ustring& getExifString ();
const Glib::ustring& getDateTimeString ();
void getCamWB (double& temp, double& green) { if (tpp) tpp->getCamWB (temp, green); }
void getAutoWB (double& temp, double& green) { if (tpp) tpp->getAutoWB (temp, green); }
void getSpotWB (int x, int y, int rect, double& temp, double& green) { if (tpp) tpp->getSpotWB (getProcParams(), x, y, rect, temp, green); }
void getCamWB (double& temp, double& green) { if (tpp) tpp->getCamWB (temp, green); else temp = green = -1.0; }
void getAutoWB (double& temp, double& green) { if (tpp) tpp->getAutoWB (temp, green); else temp = green = -1.0; }
void getSpotWB (int x, int y, int rect, double& temp, double& green) { if (tpp) tpp->getSpotWB (getProcParams(), x, y, rect, temp, green); else temp = green = -1.0; }
void applyAutoExp (rtengine::procparams::ProcParams& pparams) { if (tpp) tpp->applyAutoExp (pparams); }
ThFileType getType ();

View File

@@ -19,8 +19,7 @@
#include "toolbar.h"
#include "multilangmgr.h"
#include "rtimage.h"
extern Glib::ustring argv0;
#include "guiutils.h"
ToolBar::ToolBar () : listener (NULL) {
@@ -82,11 +81,11 @@ void ToolBar::setTool (ToolMode tool) {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
handTool->set_active (false);
wbTool->set_active (false);
if (wbTool) wbTool->set_active (false);
cropTool->set_active (false);
straTool->set_active (false);
@@ -95,7 +94,7 @@ void ToolBar::setTool (ToolMode tool) {
handTool->grab_focus();; // switch focus to the handTool button
}
else if (tool==TMSpotWB)
wbTool->set_active (true);
if (wbTool) wbTool->set_active (true);
else if (tool==TMCropSelect)
cropTool->set_active (true);
else if (tool==TMStraighten)
@@ -105,7 +104,7 @@ void ToolBar::setTool (ToolMode tool) {
handConn.block (false);
cropConn.block (false);
wbConn.block (false);
if (wbTool) wbConn.block (false);
straConn.block (false);
}
@@ -113,10 +112,10 @@ void ToolBar::hand_pressed () {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
if (current!=TMHand) {
wbTool->set_active (false);
if (wbTool) wbTool->set_active (false);
cropTool->set_active (false);
straTool->set_active (false);
current = TMHand;
@@ -124,7 +123,7 @@ void ToolBar::hand_pressed () {
handTool->set_active (true);
handConn.block (false);
cropConn.block (false);
wbConn.block (false);
if (wbTool) wbConn.block (false);
straConn.block (false);
if (listener)
@@ -135,7 +134,7 @@ void ToolBar::wb_pressed () {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
if (current!=TMSpotWB) {
handTool->set_active (false);
@@ -143,10 +142,10 @@ void ToolBar::wb_pressed () {
straTool->set_active (false);
current = TMSpotWB;
}
wbTool->set_active (true);
if (wbTool) wbTool->set_active (true);
handConn.block (false);
cropConn.block (false);
wbConn.block (false);
if (wbTool) wbConn.block (false);
straConn.block (false);
if (listener)
@@ -157,11 +156,11 @@ void ToolBar::crop_pressed () {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
if (current!=TMCropSelect) {
handTool->set_active (false);
wbTool->set_active (false);
if (wbTool) wbTool->set_active (false);
straTool->set_active (false);
current = TMCropSelect;
}
@@ -179,18 +178,18 @@ void ToolBar::stra_pressed () {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
if (current!=TMStraighten) {
handTool->set_active (false);
wbTool->set_active (false);
if (wbTool) wbTool->set_active (false);
cropTool->set_active (false);
current = TMStraighten;
}
straTool->set_active (true);
handConn.block (false);
cropConn.block (false);
wbConn.block (false);
if (wbTool) wbConn.block (false);
straConn.block (false);
if (listener)
@@ -231,3 +230,11 @@ bool ToolBar::handleShortcutKey (GdkEventKey* event) {
return false;
}
void ToolBar::removeWbTool() {
if (wbTool) {
wbConn.disconnect();
removeIfThere(this, wbTool, false);
wbTool = NULL;
}
}

View File

@@ -57,6 +57,7 @@ class ToolBar : public Gtk::HBox {
void stra_pressed ();
bool handleShortcutKey (GdkEventKey* event);
void removeWbTool();
};
#endif

View File

@@ -232,6 +232,7 @@ class ToolPanelCoordinator : public ToolPanelListener,
void cropSelectionReady ();
void rotateSelectionReady (double rotate_deg, Thumbnail* thm=NULL);
ToolBar* getToolBar () { return toolBar; }
void removeWbTool() { if (toolBar) toolBar->removeWbTool(); }
int getSpotWBRectSize ();
CropGUIListener* startCropEditing (Thumbnail* thm=NULL) { return crop; }