]> git.lyx.org Git - features.git/commitdiff
New LFUN lyx-activate to focus LyX window
authorScott Kostyshak <skostysh@lyx.org>
Thu, 4 Aug 2016 05:20:14 +0000 (01:20 -0400)
committerScott Kostyshak <skostysh@lyx.org>
Thu, 4 Aug 2016 05:46:13 +0000 (01:46 -0400)
On Linux and Mac OS, this action brings the LyX window into focus.
Such behavior is not allowed by Windows OS so instead the color of
the taskbar entry is changed to indicate that the window has changed
in some way.

The action is hidden in the shortcuts menu because it would make
sense to assign a shortcut to it. The only way to execute shortcut
would be if the LyX window is already activated.

lyx-activate will be used (see next commit) to allow the PDF viewer
to switch to LyX after executing a reverse search.

lib/RELEASE-NOTES
lib/doc/LFUNs.lyx
src/FuncCode.h
src/LyXAction.cpp
src/frontends/qt4/GuiView.cpp

index 0b556c799ffc976610c251584b88e06c4366b179..c8ce1ba2a9bdc3b0e6c7cec8ad7eaa9ac7b41329 100644 (file)
@@ -22,6 +22,9 @@ material in different versions easier.
 * branch-invert
   Toggles inversion status of branch inset.
 
+* lyx-activate
+  Activates the LyX window. Useful in combination with reverse search.
+
 
 !!!The following LyX functions have been changed in 2.3:
 
index 7cc1775f6eb69d091a8c193d19a322894fac2e11..856feb366e6c4fc6fa2fef088e2cbef11553c903 100644 (file)
@@ -7025,6 +7025,26 @@ This is probably usable only with connection to lyxserver.
 Syntax command-prefix
 \end_layout
 
+\begin_layout Subsection*
+lyx-activate
+\end_layout
+
+\begin_layout Description
+Action Activates the LyX window.
+\end_layout
+
+\begin_layout Description
+Notion On Linux and Mac OS, this action brings the LyX window into focus. Such behavior is not allowed by Windows OS so instead the color of the taskbar entry is changed to indicate that the window has changed in some way. This action is useful in combination with reverse search.
+\end_layout
+
+\begin_layout Description
+Syntax lyx-activate
+\end_layout
+
+\begin_layout Description
+Origin skostysh, 4 Aug 2016
+\end_layout
+
 \begin_layout Subsection*
 self-insert
 \end_layout
index 04f1671630d747ad464e3dfd619c796f2e1ac213..c84f35238cc0cdd9391e56978467dd50957b3612 100644 (file)
@@ -466,6 +466,7 @@ enum FuncCode
        LFUN_BUFFER_MOVE_PREVIOUS,      // skostysh 20150408
        LFUN_TABULAR_FEATURE,           // gm, 20151210
        LFUN_BRANCH_INVERT,             // rgheck, 20160712
+       LFUN_LYX_ACTIVATE,              // skostysh, 20160804
        LFUN_LASTACTION                 // end of the table
 };
 
index 77864db8c1e6b5695e29eb5976df7f02c4f77137..836f97b7bf9af8e19ed30bad2dc228a303ad18be 100644 (file)
@@ -2715,6 +2715,19 @@ void LyXAction::init()
  * \endvar
  */
                { LFUN_LYX_QUIT, "lyx-quit", NoBuffer, Buffer },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_LYX_ACTIVATE
+ * \li Action: Activates the LyX window.
+ * \li Notion: On Linux and Mac OS, this action brings the LyX window
+               into focus. Such behavior is not allowed by Windows OS
+               so instead the color of the taskbar entry is changed to
+               indicate that the window has changed in some way.
+               This action is useful in combination with reverse search.
+ * \li Syntax: lyx-activate
+ * \li Origin: skostysh, 4 Aug 2016
+ * \endvar
+ */
+               { LFUN_LYX_ACTIVATE, "lyx-activate", ReadOnly | NoBuffer, Hidden },
 /*!
  * \var lyx::FuncCode lyx::LFUN_TOOLBAR_TOGGLE
  * \li Action: Toggles visibility of a given toolbar between on/off/auto.
index 1342eb7998a9d3f755a435d3214a58186d2b055d..d2c835c6463d0c35bbc62f5b836136cb2490cf4d 100644 (file)
@@ -2055,6 +2055,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                break;
 
        case LFUN_SERVER_GOTO_FILE_ROW:
+       case LFUN_LYX_ACTIVATE:
                break;
        case LFUN_FORWARD_SEARCH:
                enable = !(lyxrc.forward_search_dvi.empty() && lyxrc.forward_search_pdf.empty());
@@ -3978,6 +3979,10 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        goToFileRow(to_utf8(cmd.argument()));
                        break;
 
+               case LFUN_LYX_ACTIVATE:
+                       activateWindow();
+                       break;
+
                case LFUN_FORWARD_SEARCH: {
                // it seems safe to assume we have a document buffer, since
                // getStatus wants one.