Merge branch 'dev' into psgtk3

This commit is contained in:
heckflosse 2017-03-22 14:15:23 +01:00
commit fbf5185b20
4 changed files with 78 additions and 47 deletions

View File

@ -418,6 +418,10 @@ bool FileBrowserEntry::pressNotify (int button, int type, int bstate, int x, i
int ix = x - startx - ofsX; int ix = x - startx - ofsX;
int iy = y - starty - ofsY; int iy = y - starty - ofsY;
if (tm == TMNone) {
return b;
}
if (!b && selected && inside (x, y)) { if (!b && selected && inside (x, y)) {
if (button == 1 && type == GDK_BUTTON_PRESS && state == SNormal) { if (button == 1 && type == GDK_BUTTON_PRESS && state == SNormal) {
if (onArea (CropTopLeft, ix, iy)) { if (onArea (CropTopLeft, ix, iy)) {

View File

@ -82,6 +82,7 @@ ToolBar::ToolBar () : showColPickers(true), listener (nullptr)
handTool->set_active (true); handTool->set_active (true);
current = TMHand; current = TMHand;
allowNoTool = false;
handConn = handTool->signal_toggled().connect( sigc::mem_fun(*this, &ToolBar::hand_pressed)); handConn = handTool->signal_toggled().connect( sigc::mem_fun(*this, &ToolBar::hand_pressed));
wbConn = wbTool->signal_toggled().connect( sigc::mem_fun(*this, &ToolBar::wb_pressed)); wbConn = wbTool->signal_toggled().connect( sigc::mem_fun(*this, &ToolBar::wb_pressed));
@ -221,25 +222,29 @@ void ToolBar::hand_pressed ()
listener->editModeSwitchedOff (); listener->editModeSwitchedOff ();
} }
} }
if (current != TMHand) {
if (colPickerTool) {
colPickerTool->set_active(false);
}
if (wbTool) {
wbTool->set_active (false);
}
cropTool->set_active (false); if (colPickerTool) {
straTool->set_active (false); colPickerTool->set_active(false);
current = TMHand; }
if (wbTool) {
wbTool->set_active (false);
} }
cropTool->set_active (false);
straTool->set_active (false);
handTool->set_active (true); handTool->set_active (true);
if (current != TMHand) {
current = TMHand;
} else if (allowNoTool) {
current = TMNone;
handTool->set_active(false);
}
} }
if (listener) { if (listener) {
listener->toolSelected (TMHand); listener->toolSelected (current);
} }
} }
@ -366,32 +371,35 @@ void ToolBar::crop_pressed ()
ConnectionBlocker cropBlocker(cropConn); ConnectionBlocker cropBlocker(cropConn);
ConnectionBlocker wbWasBlocked(wbTool, wbConn), cpWasBlocked(colPickerTool, cpConn); ConnectionBlocker wbWasBlocked(wbTool, wbConn), cpWasBlocked(colPickerTool, cpConn);
if (current != TMCropSelect) { if (editingMode) {
if (editingMode) { stopEditMode();
stopEditMode(); if (listener) {
if (listener) { listener->editModeSwitchedOff ();
listener->editModeSwitchedOff ();
}
} }
handTool->set_active (false); }
if (colPickerTool) { handTool->set_active (false);
colPickerTool->set_active(false); if (colPickerTool) {
} colPickerTool->set_active(false);
if (wbTool) { }
wbTool->set_active (false); if (wbTool) {
} wbTool->set_active (false);
straTool->set_active (false);
current = TMCropSelect;
} }
straTool->set_active (false);
cropTool->set_active (true); cropTool->set_active (true);
cropTool->grab_focus ();
if (current != TMCropSelect) {
current = TMCropSelect;
cropTool->grab_focus ();
} else if (allowNoTool) {
current = TMNone;
cropTool->set_active(false);
}
} }
if (listener) { if (listener) {
listener->toolSelected (TMCropSelect); listener->toolSelected (current);
} }
} }
@ -403,31 +411,34 @@ void ToolBar::stra_pressed ()
ConnectionBlocker cropBlocker(cropConn); ConnectionBlocker cropBlocker(cropConn);
ConnectionBlocker wbWasBlocked(wbTool, wbConn), cpWasBlocked(colPickerTool, cpConn); ConnectionBlocker wbWasBlocked(wbTool, wbConn), cpWasBlocked(colPickerTool, cpConn);
if (current != TMStraighten) { if (editingMode) {
if (editingMode) { stopEditMode();
stopEditMode(); if (listener) {
if (listener) { listener->editModeSwitchedOff ();
listener->editModeSwitchedOff ();
}
} }
handTool->set_active (false); }
if (colPickerTool) { handTool->set_active (false);
colPickerTool->set_active(false); if (colPickerTool) {
} colPickerTool->set_active(false);
if (wbTool) { }
wbTool->set_active (false); if (wbTool) {
} wbTool->set_active (false);
cropTool->set_active (false);
current = TMStraighten;
} }
cropTool->set_active (false);
straTool->set_active (true); straTool->set_active (true);
if (current != TMStraighten) {
current = TMStraighten;
} else if (allowNoTool) {
current = TMNone;
straTool->set_active(false);
}
} }
if (listener) { if (listener) {
listener->toolSelected (TMStraighten); listener->toolSelected (current);
} }
} }
@ -484,5 +495,20 @@ void ToolBar::setBatchMode()
removeIfThere(this, colPickerTool, false); removeIfThere(this, colPickerTool, false);
colPickerTool = nullptr; colPickerTool = nullptr;
} }
allowNoTool = true;
switch (current) {
case TMHand:
hand_pressed();
break;
case TMCropSelect:
crop_pressed();
break;
case TMStraighten:
stra_pressed();
break;
default:
break;
}
} }

View File

@ -62,6 +62,7 @@ protected:
ToolBarListener* listener; ToolBarListener* listener;
LockablePickerToolListener* pickerListener; LockablePickerToolListener* pickerListener;
ToolMode current; ToolMode current;
bool allowNoTool;
bool editingMode; // true if the cursor is being used to remotely edit tool's values bool editingMode; // true if the cursor is being used to remotely edit tool's values
sigc::connection handConn; sigc::connection handConn;
sigc::connection wbConn; sigc::connection wbConn;

View File

@ -19,6 +19,6 @@
#ifndef _TOOLENUM_ #ifndef _TOOLENUM_
#define _TOOLENUM_ #define _TOOLENUM_
enum ToolMode {TMHand = 0, TMSpotWB = 1, TMCropSelect = 2, TMStraighten = 3, TMColorPicker = 4}; enum ToolMode {TMNone = -1, TMHand = 0, TMSpotWB = 1, TMCropSelect = 2, TMStraighten = 3, TMColorPicker = 4};
#endif #endif