diff --git a/Gui/ActionShortcuts.h b/Gui/ActionShortcuts.h index 4d75572d89..6b307e809e 100644 --- a/Gui/ActionShortcuts.h +++ b/Gui/ActionShortcuts.h @@ -164,6 +164,35 @@ CLANG_DIAG_ON(uninitialized) #define kShortcutIDActionConnectViewerToInput10 "connectViewerInput10" #define kShortcutDescActionConnectViewerToInput10 "Connect Viewer to Input 10" +#define kShortcutIDActionConnectViewerBToInput1 "connectViewerBInput1" +#define kShortcutDescActionConnectViewerBToInput1 "Connect Viewer B Side to Input 1" + +#define kShortcutIDActionConnectViewerBToInput2 "connectViewerBInput2" +#define kShortcutDescActionConnectViewerBToInput2 "Connect Viewer B Side to Input 2" + +#define kShortcutIDActionConnectViewerBToInput3 "connectViewerBInput3" +#define kShortcutDescActionConnectViewerBToInput3 "Connect Viewer B Side to Input 3" + +#define kShortcutIDActionConnectViewerBToInput4 "connectViewerBInput4" +#define kShortcutDescActionConnectViewerBToInput4 "Connect Viewer B Side to Input 4" + +#define kShortcutIDActionConnectViewerBToInput5 "connectViewerBInput5" +#define kShortcutDescActionConnectViewerBToInput5 "Connect Viewer B Side to Input 5" + +#define kShortcutIDActionConnectViewerBToInput6 "connectViewerBInput6" +#define kShortcutDescActionConnectViewerBToInput6 "Connect Viewer B Side to Input 6" + +#define kShortcutIDActionConnectViewerBToInput7 "connectViewerBInput7" +#define kShortcutDescActionConnectViewerBToInput7 "Connect Viewer B Side to Input 7" + +#define kShortcutIDActionConnectViewerBToInput8 "connectViewerBInput8" +#define kShortcutDescActionConnectViewerBToInput8 "Connect Viewer B Side to Input 8" + +#define kShortcutIDActionConnectViewerBToInput9 "connectViewerBInput9" +#define kShortcutDescActionConnectViewerBToInput9 "Connect Viewer B Side to Input 9" + +#define kShortcutIDActionConnectViewerBToInput10 "connectViewerBInput10" +#define kShortcutDescActionConnectViewerBToInput10 "Connect Viewer B Side to Input 10" #define kShortcutIDActionShowPaneFullScreen "showPaneFullScreen" #define kShortcutDescActionShowPaneFullScreen "Show Pane Full Screen" diff --git a/Gui/Gui.cpp b/Gui/Gui.cpp index e09a6b8383..18b44bbbce 100644 --- a/Gui/Gui.cpp +++ b/Gui/Gui.cpp @@ -407,8 +407,9 @@ Gui::createMenuActions() _imp->menuDisplay = new Menu(tr("Display"), _imp->menubar); _imp->menuRender = new Menu(tr("Render"), _imp->menubar); _imp->viewersMenu = new Menu(tr("Viewer(s)"), _imp->menuDisplay); - _imp->viewerInputsMenu = new Menu(tr("Connect Current Viewer"), _imp->viewersMenu); - _imp->viewersViewMenu = new Menu(tr("Display View Number"), _imp->viewersMenu); + _imp->viewerInputsMenu = new Menu(tr("Connect to A Side"), _imp->viewersMenu); + _imp->viewerInputsBMenu = new Menu(tr("Connect to B Side"), _imp->viewersMenu); + _imp->viewersViewMenu = new Menu(tr("View"), _imp->viewersMenu); _imp->cacheMenu = new Menu(tr("Cache"), _imp->menubar); _imp->menuHelp = new Menu(tr("Help"), _imp->menubar); @@ -515,7 +516,7 @@ Gui::createMenuActions() connect( _imp->actionsOpenRecentFile[c], SIGNAL(triggered()), this, SLOT(openRecentFile()) ); } - const char* descs[10] = { + const char* descs[NATRON_CONNECT_INPUT_NB] = { kShortcutDescActionConnectViewerToInput1, kShortcutDescActionConnectViewerToInput2, kShortcutDescActionConnectViewerToInput3, @@ -525,9 +526,19 @@ Gui::createMenuActions() kShortcutDescActionConnectViewerToInput7, kShortcutDescActionConnectViewerToInput8, kShortcutDescActionConnectViewerToInput9, - kShortcutDescActionConnectViewerToInput10 + kShortcutDescActionConnectViewerToInput10, + kShortcutDescActionConnectViewerBToInput1, + kShortcutDescActionConnectViewerBToInput2, + kShortcutDescActionConnectViewerBToInput3, + kShortcutDescActionConnectViewerBToInput4, + kShortcutDescActionConnectViewerBToInput5, + kShortcutDescActionConnectViewerBToInput6, + kShortcutDescActionConnectViewerBToInput7, + kShortcutDescActionConnectViewerBToInput8, + kShortcutDescActionConnectViewerBToInput9, + kShortcutDescActionConnectViewerBToInput10 }; - const char* ids[10] = { + const char* ids[NATRON_CONNECT_INPUT_NB] = { kShortcutIDActionConnectViewerToInput1, kShortcutIDActionConnectViewerToInput2, kShortcutIDActionConnectViewerToInput3, @@ -537,16 +548,29 @@ Gui::createMenuActions() kShortcutIDActionConnectViewerToInput7, kShortcutIDActionConnectViewerToInput8, kShortcutIDActionConnectViewerToInput9, - kShortcutIDActionConnectViewerToInput10 + kShortcutIDActionConnectViewerToInput10, + kShortcutIDActionConnectViewerBToInput1, + kShortcutIDActionConnectViewerBToInput2, + kShortcutIDActionConnectViewerBToInput3, + kShortcutIDActionConnectViewerBToInput4, + kShortcutIDActionConnectViewerBToInput5, + kShortcutIDActionConnectViewerBToInput6, + kShortcutIDActionConnectViewerBToInput7, + kShortcutIDActionConnectViewerBToInput8, + kShortcutIDActionConnectViewerBToInput9, + kShortcutIDActionConnectViewerBToInput10 }; - for (int i = 0; i < 10; ++i) { + for (int i = 0; i < NATRON_CONNECT_INPUT_NB; ++i) { _imp->actionConnectInput[i] = new ActionWithShortcut(kShortcutGroupGlobal, ids[i], descs[i], this); - _imp->actionConnectInput[i]->setData(i); + _imp->actionConnectInput[i]->setData( i % (NATRON_CONNECT_INPUT_NB / 2) ); _imp->actionConnectInput[i]->setShortcutContext(Qt::WidgetShortcut); - QObject::connect( _imp->actionConnectInput[i], SIGNAL(triggered()), this, SLOT(connectInput()) ); - } + if (i < NATRON_CONNECT_INPUT_NB/2) { + QObject::connect( _imp->actionConnectInput[i], SIGNAL(triggered()), this, SLOT(connectInput()) ); + } else { + QObject::connect( _imp->actionConnectInput[i], SIGNAL(triggered()), this, SLOT(connectBInput()) ); + } } _imp->actionImportLayout = new ActionWithShortcut(kShortcutGroupGlobal, kShortcutIDActionImportLayout, kShortcutDescActionImportLayout, this); QObject::connect( _imp->actionImportLayout, SIGNAL(triggered()), this, SLOT(importLayout()) ); @@ -606,9 +630,14 @@ Gui::createMenuActions() _imp->menuDisplay->addAction(_imp->actionNewViewer); _imp->menuDisplay->addAction( _imp->viewersMenu->menuAction() ); _imp->viewersMenu->addAction( _imp->viewerInputsMenu->menuAction() ); + _imp->viewersMenu->addAction( _imp->viewerInputsBMenu->menuAction() ); _imp->viewersMenu->addAction( _imp->viewersViewMenu->menuAction() ); - for (int i = 0; i < 10; ++i) { - _imp->viewerInputsMenu->addAction(_imp->actionConnectInput[i]); + for (int i = 0; i < NATRON_CONNECT_INPUT_NB; ++i) { + if ( i < (NATRON_CONNECT_INPUT_NB / 2) ) { + _imp->viewerInputsMenu->addAction(_imp->actionConnectInput[i]); + } else { + _imp->viewerInputsBMenu->addAction(_imp->actionConnectInput[i]); + } } _imp->menuDisplay->addAction(_imp->actionProject_settings); diff --git a/Gui/Gui.h b/Gui/Gui.h index c80df3f536..5990678d15 100644 --- a/Gui/Gui.h +++ b/Gui/Gui.h @@ -528,6 +528,10 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void setLastKeyPressVisitedClickFocus(bool visited); void setLastKeyUpVisitedClickFocus(bool visited); + /// Handle the viewer keys separately: use the nativeVirtualKey so that they work + /// on any keyboard, including French AZERTY (where numbers are shifted) + static int handleNativeKeys(int key, quint32 nativeScanCode, quint32 nativeVirtualKey) WARN_UNUSED_RETURN; + void setApplicationConsoleActionVisible(bool visible); bool saveProjectAs(const std::string& filename); @@ -594,6 +598,7 @@ public Q_SLOTS: void connectInput(); void connectInput(int inputNb); + void connectBInput(int inputNb); void showView0(); diff --git a/Gui/Gui30.cpp b/Gui/Gui30.cpp index 707db0fbbe..514da5217c 100644 --- a/Gui/Gui30.cpp +++ b/Gui/Gui30.cpp @@ -35,6 +35,7 @@ #include "Global/Macros.h" #include +#include #include #include // qApp @@ -522,6 +523,14 @@ Gui::connectInput(int inputNb) graph->connectCurrentViewerToSelection(inputNb); } +void +Gui::connectBInput(int inputNb) +{ +#pragma message WARN("TODO: Gui::connectBInput()") + qDebug() << "Gui::connectBInput" << inputNb; + return connectInput(inputNb); +} + void Gui::connectInput() { diff --git a/Gui/Gui50.cpp b/Gui/Gui50.cpp index 07739c2f91..973161fe88 100644 --- a/Gui/Gui50.cpp +++ b/Gui/Gui50.cpp @@ -331,15 +331,128 @@ Gui::setLastKeyUpVisitedClickFocus(bool visited) _imp->keyUpEventHasVisitedFocusWidget = visited; } +/// Handle the viewer keys separately: use the nativeVirtualKey so that they work +/// on any keyboard, including French AZERTY (where numbers are shifted) +int +Gui::handleNativeKeys(int key, quint32 nativeScanCode, quint32 nativeVirtualKey) +{ + //qDebug() << "scancode=" << nativeScanCode << "virtualkey=" << nativeVirtualKey; +#ifdef Q_WS_MAC + // OS X virtual key codes, from + // MacOSX10.11.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/Events.h + // kVK_ANSI_1 = 0x12, + // kVK_ANSI_2 = 0x13, + // kVK_ANSI_3 = 0x14, + // kVK_ANSI_4 = 0x15, + // kVK_ANSI_6 = 0x16, + // kVK_ANSI_5 = 0x17, + // kVK_ANSI_9 = 0x19, + // kVK_ANSI_7 = 0x1A, + // kVK_ANSI_8 = 0x1C, + // kVK_ANSI_0 = 0x1D, + Q_UNUSED(nativeScanCode); + switch (nativeVirtualKey) { + case 0x12: + return Qt::Key_1; + case 0x13: + return Qt::Key_2; + case 0x14: + return Qt::Key_3; + case 0x15: + return Qt::Key_4; + case 0x16: + return Qt::Key_6; + case 0x17: + return Qt::Key_5; + case 0x18: + return Qt::Key_9; + case 0x1A: + return Qt::Key_7; + case 0x1C: + return Qt::Key_8; + case 0x1D: + return Qt::Key_0; + } +#endif +#ifdef Q_WS_WIN +#pragma message WARN("TODO: handle keys 0-9 on AZERTY keyboards") + // https://msdn.microsoft.com/en-us/library/aa299374%28v=vs.60%29.aspx + // 48 0x30 (VK_0) | 0 key + // 49 0x31 (VK_1) | 1 key + // 50 0x32 (VK_2) | 2 key + // 51 0x33 (VK_3) | 3 key + // 52 0x34 (VK_4) | 4 key + // 53 0x35 (VK_5) | 5 key + // 54 0x36 (VK_6) | 6 key + // 55 0x37 (VK_7) | 7 key + // 56 0x38 (VK_8) | 8 key + // 57 0x39 (VK_9) | 9 key + // Windows seems to always return the same virtual key for digits, whatever the modifi + Q_UNUSED(nativeScanCode); + switch (nativeVirtualKey) { + case 0x30: + return Qt::Key_0; + case 0x31: + return Qt::Key_1; + case 0x32: + return Qt::Key_2; + case 0x33: + return Qt::Key_3; + case 0x34: + return Qt::Key_4; + case 0x35: + return Qt::Key_5; + case 0x36: + return Qt::Key_6; + case 0x37: + return Qt::Key_7; + case 0x38: + return Qt::Key_8; + case 0x39: + return Qt::Key_9; + } +#endif +#if defined(Q_WS_X11) && defined(Q_OS_LINUX) +#pragma message WARN("TODO: handle keys 0-9 on AZERTY keyboards") + // probably only possible on Linux, since scancodes are OS-dependent + // https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html + Q_UNUSED(nativeVirtualKey); + switch (nativeScanCode) { + case 10: + return Qt::Key_1; + case 11: + return Qt::Key_2; + case 12: + return Qt::Key_3; + case 13: + return Qt::Key_4; + case 14: + return Qt::Key_5; + case 15: + return Qt::Key_6; + case 16: + return Qt::Key_7; + case 17: + return Qt::Key_8; + case 18: + return Qt::Key_9; + case 19: + return Qt::Key_0; + } +#endif + return key; +} + void Gui::keyPressEvent(QKeyEvent* e) { + //qDebug() << "Gui::keyPressed:" << e->text() << "modifiers:" << e->modifiers(); if (_imp->currentPanelFocusEventRecursion > 0) { return; } QWidget* w = qApp->widgetAt( QCursor::pos() ); - Qt::Key key = (Qt::Key)e->key(); + Qt::Key key = (Qt::Key)Gui::handleNativeKeys( e->key(), e->nativeScanCode(), e->nativeVirtualKey() ); Qt::KeyboardModifiers modifiers = e->modifiers(); if (key == Qt::Key_Escape) { @@ -436,6 +549,26 @@ Gui::keyPressEvent(QKeyEvent* e) connectInput(8); } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput10, modifiers, key) ) { connectInput(9); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput1, modifiers, key) ) { + connectBInput(0); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput2, modifiers, key) ) { + connectBInput(1); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput3, modifiers, key) ) { + connectBInput(2); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput4, modifiers, key) ) { + connectBInput(3); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput5, modifiers, key) ) { + connectBInput(4); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput6, modifiers, key) ) { + connectBInput(5); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput7, modifiers, key) ) { + connectBInput(6); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput8, modifiers, key) ) { + connectBInput(7); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput9, modifiers, key) ) { + connectBInput(8); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput10, modifiers, key) ) { + connectBInput(9); } else { /* * Modifiers are always uncaught by child implementations so that we can forward them to 1 ViewerTab so that diff --git a/Gui/GuiApplicationManager10.cpp b/Gui/GuiApplicationManager10.cpp index 6a16a242fc..a4c38f4e70 100644 --- a/Gui/GuiApplicationManager10.cpp +++ b/Gui/GuiApplicationManager10.cpp @@ -307,6 +307,16 @@ GuiApplicationManager::initializeQApp(int &argc, // (requires using Q_INIT_RESOURCES_EXTERN(GuiResources) before entering the namespace) ::qInitResources_GuiResources(); +#ifdef DEBUG + QLocale loc; +#if QT_VERSION < 0x050000 + loc = QApplication::keyboardInputLocale(); +#else + loc = QGuiApplication::inputMethod()->locale(); +#endif + qDebug() << "keyboard input locale:" << loc.bcp47Name(); +#endif + ///Register all the shortcuts. populateShortcuts(); } @@ -787,27 +797,27 @@ GuiApplicationManager::populateShortcuts() registerKeybind(kShortcutGroupGlobal, kShortcutIDActionEnableRenderStats, kShortcutDescActionEnableRenderStats, Qt::NoModifier, Qt::Key_F2); - - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput1, kShortcutDescActionConnectViewerToInput1, Qt::NoModifier, Qt::Key_1, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput2, kShortcutDescActionConnectViewerToInput2, Qt::NoModifier, Qt::Key_2, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput3, kShortcutDescActionConnectViewerToInput3, Qt::NoModifier, Qt::Key_3, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput4, kShortcutDescActionConnectViewerToInput4, Qt::NoModifier, Qt::Key_4, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput5, kShortcutDescActionConnectViewerToInput5, Qt::NoModifier, Qt::Key_5, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput6, kShortcutDescActionConnectViewerToInput6, Qt::NoModifier, Qt::Key_6, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput7, kShortcutDescActionConnectViewerToInput7, Qt::NoModifier, Qt::Key_7, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput8, kShortcutDescActionConnectViewerToInput8, Qt::NoModifier, Qt::Key_8, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput9, kShortcutDescActionConnectViewerToInput9, Qt::NoModifier, Qt::Key_9, - Qt::ShiftModifier); - registerKeybindWithMask(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput10, kShortcutDescActionConnectViewerToInput10, Qt::NoModifier, Qt::Key_0, - Qt::ShiftModifier); + // Note: keys 0-1 are handled by Gui::handleNativeKeys(), and should thus work even on international keyboards + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput1, kShortcutDescActionConnectViewerToInput1, Qt::NoModifier, Qt::Key_1); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput2, kShortcutDescActionConnectViewerToInput2, Qt::NoModifier, Qt::Key_2); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput3, kShortcutDescActionConnectViewerToInput3, Qt::NoModifier, Qt::Key_3); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput4, kShortcutDescActionConnectViewerToInput4, Qt::NoModifier, Qt::Key_4); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput5, kShortcutDescActionConnectViewerToInput5, Qt::NoModifier, Qt::Key_5); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput6, kShortcutDescActionConnectViewerToInput6, Qt::NoModifier, Qt::Key_6); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput7, kShortcutDescActionConnectViewerToInput7, Qt::NoModifier, Qt::Key_7); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput8, kShortcutDescActionConnectViewerToInput8, Qt::NoModifier, Qt::Key_8); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput9, kShortcutDescActionConnectViewerToInput9, Qt::NoModifier, Qt::Key_9); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput10, kShortcutDescActionConnectViewerToInput10, Qt::NoModifier, Qt::Key_0); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput1, kShortcutDescActionConnectViewerBToInput1, Qt::ShiftModifier, Qt::Key_1); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput2, kShortcutDescActionConnectViewerBToInput2, Qt::ShiftModifier, Qt::Key_2); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput3, kShortcutDescActionConnectViewerBToInput3, Qt::ShiftModifier, Qt::Key_3); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput4, kShortcutDescActionConnectViewerBToInput4, Qt::ShiftModifier, Qt::Key_4); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput5, kShortcutDescActionConnectViewerBToInput5, Qt::ShiftModifier, Qt::Key_5); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput6, kShortcutDescActionConnectViewerBToInput6, Qt::ShiftModifier, Qt::Key_6); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput7, kShortcutDescActionConnectViewerBToInput7, Qt::ShiftModifier, Qt::Key_7); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput8, kShortcutDescActionConnectViewerBToInput8, Qt::ShiftModifier, Qt::Key_8); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput9, kShortcutDescActionConnectViewerBToInput9, Qt::ShiftModifier, Qt::Key_9); + registerKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput10, kShortcutDescActionConnectViewerBToInput10, Qt::ShiftModifier, Qt::Key_0); registerKeybind(kShortcutGroupGlobal, kShortcutIDActionShowPaneFullScreen, kShortcutDescActionShowPaneFullScreen, Qt::NoModifier, Qt::Key_Space); registerKeybind(kShortcutGroupGlobal, kShortcutIDActionNextTab, kShortcutDescActionNextTab, Qt::ControlModifier, Qt::Key_T); diff --git a/Gui/GuiPrivate.h b/Gui/GuiPrivate.h index 236c0181a6..dffc4f386d 100644 --- a/Gui/GuiPrivate.h +++ b/Gui/GuiPrivate.h @@ -52,6 +52,8 @@ CLANG_DIAG_ON(uninitialized) NATRON_NAMESPACE_ENTER; +#define NATRON_CONNECT_INPUT_NB (2*10) + struct GuiPrivate { Q_DECLARE_TR_FUNCTIONS(Gui) @@ -115,7 +117,7 @@ struct GuiPrivate ActionWithShortcut *renderAllWriters; ActionWithShortcut *renderSelectedNode; ActionWithShortcut *enableRenderStats; - ActionWithShortcut* actionConnectInput[10]; + ActionWithShortcut* actionConnectInput[NATRON_CONNECT_INPUT_NB]; ActionWithShortcut* actionImportLayout; ActionWithShortcut* actionExportLayout; ActionWithShortcut* actionRestoreDefaultLayout; @@ -201,6 +203,7 @@ struct GuiPrivate Menu *menuRender; Menu *viewersMenu; Menu *viewerInputsMenu; + Menu *viewerInputsBMenu; Menu *viewersViewMenu; Menu *cacheMenu; Menu *menuHelp; diff --git a/Gui/ViewerTab.h b/Gui/ViewerTab.h index 63fddfee7f..914cd905a8 100644 --- a/Gui/ViewerTab.h +++ b/Gui/ViewerTab.h @@ -275,6 +275,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void refresh(bool enableRenderStats); void connectToInput(int inputNb); + void connectToBInput(int inputNb); bool isPickerEnabled() const; void setPickerEnabled(bool enabled); diff --git a/Gui/ViewerTab10.cpp b/Gui/ViewerTab10.cpp index 6f64d338d5..8d6809b936 100644 --- a/Gui/ViewerTab10.cpp +++ b/Gui/ViewerTab10.cpp @@ -538,13 +538,14 @@ ViewerTab::leaveEvent(QEvent* e) void ViewerTab::keyPressEvent(QKeyEvent* e) { + //qDebug() << "ViewerTab::keyPressed:" << e->text() << "modifiers:" << e->modifiers(); if ( getGui() ) { getGui()->setActiveViewer(this); } bool accept = true; Qt::KeyboardModifiers modifiers = e->modifiers(); - Qt::Key key = (Qt::Key)e->key(); + Qt::Key key = (Qt::Key)Gui::handleNativeKeys( e->key(), e->nativeScanCode(), e->nativeVirtualKey() ); double scale = 1. / ( 1 << _imp->viewer->getCurrentRenderScale() ); if ( e->isAutoRepeat() && notifyOverlaysKeyRepeat(RenderScale(scale), e) ) { @@ -741,6 +742,26 @@ ViewerTab::keyPressEvent(QKeyEvent* e) connectToInput(8); } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerToInput10, modifiers, key) ) { connectToInput(9); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput1, modifiers, key) ) { + connectToBInput(0); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput2, modifiers, key) ) { + connectToBInput(1); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput3, modifiers, key) ) { + connectToBInput(2); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput4, modifiers, key) ) { + connectToBInput(3); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput5, modifiers, key) ) { + connectToBInput(4); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput6, modifiers, key) ) { + connectToBInput(5); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput7, modifiers, key) ) { + connectToBInput(6); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput8, modifiers, key) ) { + connectToBInput(7); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput9, modifiers, key) ) { + connectToBInput(8); + } else if ( isKeybind(kShortcutGroupGlobal, kShortcutIDActionConnectViewerBToInput10, modifiers, key) ) { + connectToBInput(9); } else if ( isKeybind(kShortcutGroupViewer, kShortcutIDActionHideOverlays, modifiers, key) ) { _imp->viewer->toggleOverlays(); } else if ( isKeybind(kShortcutGroupViewer, kShortcutIDToggleWipe, modifiers, key) ) { diff --git a/Gui/ViewerTab30.cpp b/Gui/ViewerTab30.cpp index a38337381c..a99dc407e3 100644 --- a/Gui/ViewerTab30.cpp +++ b/Gui/ViewerTab30.cpp @@ -1135,6 +1135,15 @@ ViewerTab::connectToInput(int inputNb) } } + +void +ViewerTab::connectToBInput(int inputNb) +{ +#pragma message WARN("TODO: ViewerTab::connectToBInput()") + qDebug() << "ViewerTab::connectToBInput" << inputNb; + return connectToInput(inputNb); +} + void ViewerTab::onAvailableComponentsChanged() {