GTK3 Compatibility

presentation
Andreas Butti 7 years ago
parent aa7cba78ab
commit e3edd34b23
  1. 9
      src/gui/Layout.cpp
  2. 31
      src/gui/Layout.h
  3. 4
      src/gui/XournalView.cpp
  4. 4
      src/gui/widgets/XournalWidget.h

@ -436,6 +436,15 @@ void Layout::scrollRelativ(int x, int y)
this->scrollVertical->scroll(y);
}
void Layout::scrollAbs(int x, int y)
{
XOJ_CHECK_TYPE(Layout);
// TODO Check if really working
this->scrollHorizontal->setValue(x);
this->scrollVertical->setValue(y);
}
double Layout::getVisiblePageTop(size_t page)
{
XOJ_CHECK_TYPE(Layout);

@ -19,6 +19,12 @@
class PageView;
class XournalView;
/**
* @brief The Layout manager for the XournalWidget
*
* This class manages the layout of the PageView%s contained
* in the XournalWidget
*/
class Layout : public ScrollbarListener
{
public:
@ -26,10 +32,35 @@ public:
virtual ~Layout();
public:
/**
* Adjusts the layout size to the given values
*/
void setSize(int widgetWidth, int widgetHeight);
/**
* Increases the adjustments by the given amounts
*/
void scrollRelativ(int x, int y);
/**
* Changes the adjustments by absolute amounts (for pinch-to-zoom)
*/
void scrollAbs(int x, int y);
/**
* Handle a scroll event
*/
bool scrollEvent(GdkEventScroll* event);
/**
* Changes the adjustments in such a way as to make sure that
* the given Rectangle is visible
*
* @remark If the given Rectangle won't fit into the scrolled window
* then only its top left corner will be visible
*/
void ensureRectIsVisible(int x, int y, int width, int height);
double getVisiblePageTop(size_t page);
double getDisplayHeight();

@ -791,11 +791,7 @@ void XournalView::pageInserted(size_t page)
Layout* layout = gtk_xournal_get_layout(this->widget);
layout->layoutPages();
#if GTK3_ENABLED
layout->updateCurrentPage();
#else
layout->checkSelectedPage();
#endif
}
double XournalView::getZoom()

@ -15,9 +15,9 @@
G_BEGIN_DECLS
#define GTK_XOURNAL(obj) GTK_CHECK_CAST(obj, gtk_xournal_get_type (), GtkXournal)
#define GTK_XOURNAL(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, gtk_xournal_get_type (), GtkXournal)
#define GTK_XOURNAL_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, gtk_xournal_get_type(), GtkXournalClass)
#define GTK_IS_XOURNAL(obj) GTK_CHECK_TYPE(obj, gtk_xournal_get_type())
#define GTK_IS_XOURNAL(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, gtk_xournal_get_type())
class EditSelection;
class Layout;

Loading…
Cancel
Save