Avoids Locallab spot to disapear when mouse right-clicking

This commit also avoids Locallab spot to disapear when adding lockable
color picker, pressing toolbar "hand" button, pressing h/H key. However,
if another tool button (ex: resizing tool) is pressed, this action is
considered
This commit is contained in:
Pandagrapher 2019-04-03 21:00:54 +02:00
parent 0225a7f109
commit 690df79ef2
3 changed files with 11 additions and 3 deletions

View File

@ -107,7 +107,7 @@ void ToolBar::setTool (ToolMode tool)
ConnectionBlocker cropBlocker(cropConn); ConnectionBlocker cropBlocker(cropConn);
ConnectionBlocker wbWasBlocked(wbTool, wbConn), cpWasBlocked(colPickerTool, cpConn); ConnectionBlocker wbWasBlocked(wbTool, wbConn), cpWasBlocked(colPickerTool, cpConn);
stopEdit = tool == TMHand && handTool->get_active() && editingMode; stopEdit = tool == TMHand && handTool->get_active() && editingMode && !blockEdit;
handTool->set_active (false); handTool->set_active (false);
@ -204,7 +204,7 @@ void ToolBar::hand_pressed ()
ConnectionBlocker cropBlocker(cropConn); ConnectionBlocker cropBlocker(cropConn);
ConnectionBlocker wbWasBlocked(wbTool, wbConn), cpWasBlocked(colPickerTool, cpConn); ConnectionBlocker wbWasBlocked(wbTool, wbConn), cpWasBlocked(colPickerTool, cpConn);
if (editingMode) { if (editingMode && !blockEdit) {
stopEditMode(); stopEditMode();
if (listener) { if (listener) {
listener->editModeSwitchedOff (); listener->editModeSwitchedOff ();
@ -289,7 +289,7 @@ void ToolBar::colPicker_pressed (GdkEventButton* event)
if (current != TMColorPicker) { if (current != TMColorPicker) {
// Disabling all other tools, enabling the Picker tool and entering the "visible pickers" mode // Disabling all other tools, enabling the Picker tool and entering the "visible pickers" mode
if (editingMode) { if (editingMode && !blockEdit) {
stopEditMode(); stopEditMode();
if (listener) { if (listener) {
listener->editModeSwitchedOff (); listener->editModeSwitchedOff ();

View File

@ -64,6 +64,7 @@ protected:
ToolMode current; ToolMode current;
bool allowNoTool; 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
bool blockEdit; // true if edit tool shoudn't be disabled when pressing hand button or h/H key
sigc::connection handConn; sigc::connection handConn;
sigc::connection wbConn; sigc::connection wbConn;
sigc::connection cpConn; sigc::connection cpConn;
@ -98,6 +99,11 @@ public:
bool handleShortcutKey (GdkEventKey* event); bool handleShortcutKey (GdkEventKey* event);
void setBatchMode(); void setBatchMode();
void blockEditDeactivation(bool cond = true)
{
blockEdit = cond;
}
}; };
#endif #endif

View File

@ -281,8 +281,10 @@ void ToolPanelCoordinator::notebookPageChanged(Gtk::Widget* page, guint page_num
// segfault) and locallab panel is active // segfault) and locallab panel is active
if (photoLoadedOnce) { if (photoLoadedOnce) {
if (page == locallabPanelSW) { if (page == locallabPanelSW) {
toolBar->blockEditDeactivation(); // Avoid edit tool deactivation when Locallab page is active (except if pressing other tools button)
locallab->subscribe(); locallab->subscribe();
} else { } else {
toolBar->blockEditDeactivation(false);
locallab->unsubscribe(); locallab->unsubscribe();
} }
} }