]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gtk/GWorkArea.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / gtk / GWorkArea.C
index e997d535fd89ac0e9f28c074b8d0a9bebe3810d9..4442e4b0c8ec6ec35246d89faa34996026291604 100644 (file)
 
 #include <config.h>
 
+// Too hard to make concept checks work with this file
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+#undef _GLIBCPP_CONCEPT_CHECKS
+#endif
+
 #include "GWorkArea.h"
 #include "GView.h"
 #include "GtkmmX.h"
@@ -26,8 +31,32 @@ using std::string;
 namespace lyx {
 namespace frontend {
 
-ColorCache colorCache;
+namespace {
+
+mouse_button::state gButtonToLyx(guint gdkbutton)
+{
+       // GDK uses int 1,2,3 but lyx uses enums (1,2,4)
+       switch (gdkbutton) {
+       case 1:
+               return mouse_button::button1;
+       case 2:
+               return mouse_button::button2;
+       case 3:
+               return mouse_button::button3;
+       case 4:
+               return mouse_button::button4;
+       case 5:
+               return mouse_button::button5;
+       }
 
+       // This shouldn't happen, according to gdk docs
+       lyxerr << "gButtonToLyx: unhandled button index\n";
+       return mouse_button::button1;
+}
+
+} // namespace anon
+
+ColorCache colorCache;
 
 Gdk::Color * ColorCache::getColor(LColor_color clr)
 {
@@ -315,7 +344,7 @@ void GWorkArea::setScrollbarParams(int height, int pos, int line_height)
                adjustment->changed();
                return;
        }
-       adjustment->set_step_increment(line_height);
+       adjustment->set_step_increment(line_height * 3);
        adjustment->set_page_increment(workAreaHeight - line_height);
        // Allow the user half a screen of blank at the end
        // to make scrollbar consistant with centering the cursor
@@ -377,7 +406,7 @@ bool GWorkArea::onButtonPress(GdkEventButton * event)
        dispatch(FuncRequest(ka,
                             static_cast<int>(event->x),
                             static_cast<int>(event->y),
-                            static_cast<mouse_button::state>(event->button)));
+                            gButtonToLyx(event->button)));
        workArea_.grab_focus();
        return true;
 }
@@ -388,7 +417,7 @@ bool GWorkArea::onButtonRelease(GdkEventButton * event)
        dispatch(FuncRequest(LFUN_MOUSE_RELEASE,
                             static_cast<int>(event->x),
                             static_cast<int>(event->y),
-                            static_cast<mouse_button::state>(event->button)));
+                            gButtonToLyx(event->button)));
        return true;
 }