XournalView::XournalView(GtkWidget* parent, Control* control) { XOJ_INIT_TYPE(XournalView); this->control = control; this->cache = new PdfCache(control->getSettings()->getPdfPageCacheSize()); registerListener(control); this->widget = gtk_xournal_new(this); // we need to refer widget here, because wo unref it somwere twice!? g_object_ref(this->widget); gtk_table_attach_defaults(GTK_TABLE(parent), this->widget, 1, 2, 0, 1); gtk_widget_show(this->widget); this->repaintHandler = new RepaintHandler(this); this->pagePosition = new PagePositionHandler(); this->viewPages = NULL; this->viewPagesLen = 0; this->margin = 75; this->currentPage = 0; this->lastSelectedPage = -1; control->getZoomControl()->addZoomListener(this); gtk_widget_set_can_default(this->widget, true); gtk_widget_grab_default(this->widget); gtk_widget_grab_focus(this->widget); this->cleanupTimeout = g_timeout_add_seconds(5, (GSourceFunc) clearMemoryTimer, this); }
XournalView::XournalView(GtkWidget* parent, Control* control, ScrollHandling* scrollHandling, ZoomGesture* zoomGesture) : scrollHandling(scrollHandling), control(control), zoomGesture(zoomGesture) { XOJ_INIT_TYPE(XournalView); this->cache = new PdfCache(control->getSettings()->getPdfPageCacheSize()); registerListener(control); InputContext* inputContext = nullptr; if (this->control->getSettings()->getExperimentalInputSystemEnabled()) { inputContext = new InputContext(this, scrollHandling); this->widget = gtk_xournal_new(this, inputContext); } else { this->widget = gtk_xournal_new_deprecated(this, scrollHandling); } // we need to refer widget here, because we unref it somewhere twice!? g_object_ref(this->widget); gtk_container_add(GTK_CONTAINER(parent), this->widget); gtk_widget_show(this->widget); g_signal_connect(getWidget(), "realize", G_CALLBACK(onRealized), this); this->repaintHandler = new RepaintHandler(this); this->handRecognition = new HandRecognition(this->widget, inputContext, control->getSettings()); control->getZoomControl()->addZoomListener(this); gtk_widget_set_can_default(this->widget, true); gtk_widget_grab_default(this->widget); gtk_widget_grab_focus(this->widget); this->cleanupTimeout = g_timeout_add_seconds(5, (GSourceFunc) clearMemoryTimer, this); }