]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gtk/GLyXKeySym.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / gtk / GLyXKeySym.C
index bf50a7ab6f55713f7831df3d399375db4167ae26..73e87c9d2dd1b05cc6462e6ed835c003d5870eac 100644 (file)
@@ -9,10 +9,19 @@
  */
 
 #include <config.h>
-#include <gtkmm.h>
 
-#include <gdk/gdkkeysyms.h>
+// Too hard to make concept checks work with this file
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+#undef _GLIBCPP_CONCEPT_CHECKS
+#endif
+
 #include "GLyXKeySym.h"
+#include "kbmap.h"
+
+#include "support/lstrings.h"
+
+#include <gtkmm.h>
+#include <gdk/gdkkeysyms.h>
 
 using std::string;
 
@@ -92,6 +101,30 @@ char GLyXKeySym::getISOEncoded(string const & /*encoding*/) const
 }
 
 
+// Produce a human readable version (eg "Ctrl+N")
+string const GLyXKeySym::print(key_modifier::state mod) const
+{
+       string buf;
+
+       if (mod & key_modifier::ctrl)
+               buf += "Ctrl+";
+       if (mod & key_modifier::shift)
+               buf += "Shift+";
+       if (mod & key_modifier::alt)
+               buf += "Alt+";
+
+       // Uppercase the first letter, for Ctrl+N rather than Ctrl+n,
+       // and for Ctrl+Greater rather than Ctrl+GREATER
+       string symname = getSymbolName();
+       if (!symname.empty()) {
+         symname[0] = lyx::support::uppercase(symname[0]);
+         buf += symname;
+       }
+
+       return buf;
+}
+
+
 bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
 {
        return static_cast<GLyXKeySym const &>(k1).getKeyval()