]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
Improve support for on screen length calculation
[lyx.git] / src / mathed / InsetMathNest.cpp
index 74ee70d141097a11dafded8494dfcb77e0090733..392e1ff8e8c389f27f0c31ed6495e160dfc2b034 100644 (file)
@@ -54,6 +54,7 @@
 #include "OutputParams.h"
 #include "Text.h"
 
+#include "frontends/Application.h"
 #include "frontends/Clipboard.h"
 #include "frontends/Painter.h"
 #include "frontends/Selection.h"
@@ -1551,7 +1552,7 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd)
                // cur.result().update(): don't overwrite previously set flags.
                cur.screenUpdateFlags(Update::Decoration | Update::FitCursor
                                | cur.result().screenUpdate());
-       } else if (cmd.button() == mouse_button::button2) {
+       } else if (cmd.button() == mouse_button::button2 && lyxrc.mouse_middlebutton_paste) {
                if (cap::selection()) {
                        // See comment in Text::dispatch why we do this
                        cap::copySelectionToStack();
@@ -2112,7 +2113,7 @@ MathCompletionList::MathCompletionList(Cursor const & cur)
 
        // fill in global macros
        macros.clear();
-       MacroTable::globalMacros().getMacroNames(macros);
+       MacroTable::globalMacros().getMacroNames(macros, false);
        //lyxerr << "Globals completion macros: ";
        for (it = macros.begin(); it != macros.end(); ++it) {
                //lyxerr << "\\" + *it << " ";
@@ -2197,7 +2198,7 @@ MathCompletionList::MathCompletionList(Cursor const & cur)
        MathWordList::const_iterator it2;
        //lyxerr << "Globals completion commands: ";
        for (it2 = words.begin(); it2 != words.end(); ++it2) {
-               if (it2->second.inset != "macro") {
+               if (it2->second.inset != "macro" && !it2->second.hidden) {
                        // macros are already read from MacroTable::globalMacros()
                        globals.push_back('\\' + it2->first);
                        //lyxerr << '\\' + it2->first << ' ';
@@ -2240,7 +2241,10 @@ std::string MathCompletionList::icon(size_t idx) const
                cmd = locals[idx];
 
        // get the icon resource name by stripping the backslash
-       return "images/math/" + to_utf8(cmd.substr(1)) + ".png";
+       docstring icon_name = frontend::Application::mathIcon(cmd.substr(1));
+       if (icon_name.empty())
+               return std::string();
+       return "images/math/" + to_utf8(icon_name);
 }
 
 std::vector<docstring> MathCompletionList::globals;