]> 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 17f80bd8706b03f876b61650faa0710162f53ffc..73e87c9d2dd1b05cc6462e6ed835c003d5870eac 100644 (file)
@@ -5,14 +5,25 @@
  *
  * \author Huang Ying
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #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;
 
 
 GLyXKeySym::GLyXKeySym() : keyval_(GDK_VoidSymbol)
@@ -90,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()