summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-11-06 18:25:30 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-11-06 18:25:30 +0000
commit77f8d590d64320f587907322eb2aa9f88457e8c6 (patch)
treed67777bb24f895f71528b1ff28971adb788d768f /src
parentsimple fix in french translation (diff)
downloadinkscape-77f8d590d64320f587907322eb2aa9f88457e8c6.tar.gz
inkscape-77f8d590d64320f587907322eb2aa9f88457e8c6.zip
C++ify SVGViewWidget. Remove unused code.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/extension/internal/cdr-input.cpp67
-rw-r--r--src/extension/internal/vsd-input.cpp67
-rw-r--r--src/inkview-window.cpp11
-rw-r--r--src/inkview-window.h11
-rw-r--r--src/svg-view-widget.cpp244
-rw-r--r--src/svg-view-widget.h73
-rw-r--r--src/ui/CMakeLists.txt6
-rw-r--r--src/ui/dialog/aboutbox.cpp14
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp372
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.h17
-rw-r--r--src/ui/interface.cpp14
-rw-r--r--src/ui/interface.h5
-rw-r--r--src/ui/view/svg-view-widget.cpp80
-rw-r--r--src/ui/view/svg-view-widget.h57
-rw-r--r--src/ui/view/svg-view.cpp (renamed from src/svg-view.cpp)41
-rw-r--r--src/ui/view/svg-view.h (renamed from src/svg-view.h)20
-rw-r--r--src/ui/view/view-widget.h2
-rw-r--r--src/verbs.cpp5
-rw-r--r--src/verbs.h1
20 files changed, 448 insertions, 663 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9daea38bb..2700068a7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -86,8 +86,6 @@ set(inkscape_SRC
sp-item-notify-moveto.cpp
style-internal.cpp
style.cpp
- svg-view-widget.cpp
- svg-view.cpp
text-chemistry.cpp
text-editing.cpp
transf_mat_3x4.cpp
@@ -206,8 +204,6 @@ set(inkscape_SRC
style-internal.h
style.h
svg-profile.h
- svg-view-widget.h
- svg-view.h
syseq.h
text-chemistry.h
text-editing.h
diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp
index 25fc4e704..851ca16a6 100644
--- a/src/extension/internal/cdr-input.cpp
+++ b/src/extension/internal/cdr-input.cpp
@@ -55,7 +55,7 @@
#include "ui/dialog-events.h"
#include <glibmm/i18n.h>
-#include "svg-view-widget.h"
+#include "ui/view/svg-view-widget.h"
#include "object/sp-root.h"
@@ -84,7 +84,7 @@ private:
void _onSpinButtonRelease(GdkEventButton* button_event);
class Gtk::VBox * vbox1;
- class Gtk::Widget * _previewArea;
+ class Inkscape::UI::View::SVGViewWidget * _previewArea;
class Gtk::Button * cancelbutton;
class Gtk::Button * okbutton;
@@ -99,7 +99,10 @@ private:
};
CdrImportDialog::CdrImportDialog(const std::vector<RVNGString> &vec)
- : _vec(vec), _current_page(1), _spinning(false)
+ : _previewArea(nullptr)
+ , _vec(vec)
+ , _current_page(1)
+ , _spinning(false)
{
int num_pages = _vec.size();
if ( num_pages <= 1 )
@@ -114,9 +117,7 @@ CdrImportDialog::CdrImportDialog(const std::vector<RVNGString> &vec)
this->property_destroy_with_parent().set_value(false);
// Preview area
- _previewArea = Gtk::manage(new class Gtk::VBox());
vbox1 = Gtk::manage(new class Gtk::VBox());
- vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0);
this->get_content_area()->pack_start(*vbox1);
// CONTROLS
@@ -208,29 +209,39 @@ void CdrImportDialog::_onSpinButtonRelease(GdkEventButton* /*button_event*/)
*/
void CdrImportDialog::_setPreviewPage()
{
- if (_spinning) {
- return;
- }
-
- SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0);
- if(!doc) {
- g_warning("CDR import: Could not create preview for page %d", _current_page);
- gchar const *no_preview_template =
- "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>"
- " <path style='fill:none;stroke:#ff0000;stroke-width:2px;' d='M 82,10 18,74 m 0,-64 64,64' />"
- " <rect style='fill:none;stroke:#000000;stroke-width:1.5px;' width='64' height='64' x='18' y='10' />"
- " <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>"
- "</svg>";
- gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview"));
- doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0);
- g_free(no_preview);
- }
-
- Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc));
- std::swap(_previewArea, tmpPreviewArea);
- delete tmpPreviewArea;
- vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0);
- _previewArea->show_now();
+ if (_spinning) {
+ return;
+ }
+
+ SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0);
+ if(!doc) {
+ g_warning("CDR import: Could not create preview for page %d", _current_page);
+ gchar const *no_preview_template = R"A(
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
+ <path d='M 82,10 18,74 m 0,-64 64,64' style='fill:none;stroke:#ff0000;stroke-width:2px;'/>
+ <rect x='18' y='10' width='64' height='64' style='fill:none;stroke:#000000;stroke-width:1.5px;'/>
+ <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>
+ </svg>
+ )A";
+ gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview"));
+ doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0);
+ g_free(no_preview);
+ }
+
+ if (!doc) {
+ std::cerr << "CdrImportDialog::_setPreviewPage: No document!" << std::endl;
+ return;
+ }
+
+ if (_previewArea) {
+ _previewArea->setDocument(doc);
+ } else {
+ _previewArea = Gtk::manage(new Inkscape::UI::View::SVGViewWidget(doc));
+ vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0);
+ }
+
+ _previewArea->setResize(400, 400);
+ _previewArea->show_all();
}
SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp
index 22012a015..eb3dde3f4 100644
--- a/src/extension/internal/vsd-input.cpp
+++ b/src/extension/internal/vsd-input.cpp
@@ -54,7 +54,7 @@
#include "ui/dialog-events.h"
#include <glibmm/i18n.h>
-#include "svg-view-widget.h"
+#include "ui/view/svg-view-widget.h"
#include "object/sp-root.h"
@@ -83,7 +83,7 @@ private:
void _onSpinButtonRelease(GdkEventButton* button_event);
class Gtk::VBox * vbox1;
- class Gtk::Widget * _previewArea;
+ class Inkscape::UI::View::SVGViewWidget * _previewArea;
class Gtk::Button * cancelbutton;
class Gtk::Button * okbutton;
@@ -98,7 +98,10 @@ private:
};
VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec)
- : _vec(vec), _current_page(1), _spinning(false)
+ : _previewArea(nullptr)
+ , _vec(vec)
+ , _current_page(1)
+ , _spinning(false)
{
int num_pages = _vec.size();
if ( num_pages <= 1 )
@@ -114,9 +117,7 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec)
this->property_destroy_with_parent().set_value(false);
// Preview area
- _previewArea = Gtk::manage(new class Gtk::VBox());
vbox1 = Gtk::manage(new class Gtk::VBox());
- vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0);
this->get_content_area()->pack_start(*vbox1);
// CONTROLS
@@ -208,29 +209,39 @@ void VsdImportDialog::_onSpinButtonRelease(GdkEventButton* /*button_event*/)
*/
void VsdImportDialog::_setPreviewPage()
{
- if (_spinning) {
- return;
- }
-
- SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0);
- if(!doc) {
- g_warning("VSD import: Could not create preview for page %d", _current_page);
- gchar const *no_preview_template =
- "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>"
- " <path style='fill:none;stroke:#ff0000;stroke-width:2px;' d='M 82,10 18,74 m 0,-64 64,64' />"
- " <rect style='fill:none;stroke:#000000;stroke-width:1.5px;' width='64' height='64' x='18' y='10' />"
- " <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>"
- "</svg>";
- gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview"));
- doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0);
- g_free(no_preview);
- }
-
- Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc));
- std::swap(_previewArea, tmpPreviewArea);
- delete tmpPreviewArea;
- vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0);
- _previewArea->show_now();
+ if (_spinning) {
+ return;
+ }
+
+ SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0);
+ if(!doc) {
+ g_warning("VSD import: Could not create preview for page %d", _current_page);
+ gchar const *no_preview_template = R"A(
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
+ <path d='M 82,10 18,74 m 0,-64 64,64' style='fill:none;stroke:#ff0000;stroke-width:2px;'/>
+ <rect x='18' y='10' width='64' height='64' style='fill:none;stroke:#000000;stroke-width:1.5px;'/>
+ <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>
+ </svg>
+ )A";
+ gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview"));
+ doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0);
+ g_free(no_preview);
+ }
+
+ if (!doc) {
+ std::cerr << "VsdImportDialog::_setPreviewPage: No document!" << std::endl;
+ return;
+ }
+
+ if (_previewArea) {
+ _previewArea->setDocument(doc);
+ } else {
+ _previewArea = Gtk::manage(new Inkscape::UI::View::SVGViewWidget(doc));
+ vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0);
+ }
+
+ _previewArea->setResize(400, 400);
+ _previewArea->show_all();
}
SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
diff --git a/src/inkview-window.cpp b/src/inkview-window.cpp
index 2c4578784..d0b8804a5 100644
--- a/src/inkview-window.cpp
+++ b/src/inkview-window.cpp
@@ -13,10 +13,11 @@
#include "document.h"
#include "inkscape.h" // INKSCAPE macro
-#include "svg-view.h"
-#include "svg-view-widget.h"
#include "ui/monitor.h"
+#include "ui/view/svg-view.h"
+#include "ui/view/svg-view-widget.h"
+
#include "util/units.h"
InkviewWindow::InkviewWindow(const Gio::Application::type_vec_files files,
@@ -146,10 +147,10 @@ InkviewWindow::show_document(SPDocument* document)
INKSCAPE.add_document(document);
if (_view) {
- reinterpret_cast<SPSVGView*>(SP_VIEW_WIDGET_VIEW(_view))->setDocument(document);
+ _view->setDocument(document);
} else {
- _view = sp_svg_view_widget_new(document);
- add (*Glib::wrap(_view));
+ _view = Gtk::manage(new Inkscape::UI::View::SVGViewWidget(document));
+ add (*_view);
}
update_title();
diff --git a/src/inkview-window.h b/src/inkview-window.h
index 24b6f8c26..5e76f1741 100644
--- a/src/inkview-window.h
+++ b/src/inkview-window.h
@@ -14,6 +14,15 @@
class SPDocument;
+namespace Inkscape {
+namespace UI {
+namespace View {
+ class SVGViewWidget;
+}
+}
+}
+
+
class InkviewWindow : public Gtk::ApplicationWindow {
public:
@@ -38,7 +47,7 @@ private:
int _index;
std::vector<SPDocument*> _documents;
- GtkWidget* _view;
+ Inkscape::UI::View::SVGViewWidget* _view;
Gtk::Window* _controlwindow;
// Callbacks
diff --git a/src/svg-view-widget.cpp b/src/svg-view-widget.cpp
deleted file mode 100644
index fa2988166..000000000
--- a/src/svg-view-widget.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Functions and callbacks for generic SVG view and widget.
- *
- * Authors:
- * Lauris Kaplinski <lauris@kaplinski.com>
- * Ralf Stephan <ralf@ark.in-berlin.de>
- * Abhishek Sharma
- * Jon A. Cruz <jon@joncruz.org>
- *
- * Copyright (C) 2010 authors
- * Copyright (C) 2001-2002 Lauris Kaplinski
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "display/sp-canvas.h"
-#include "display/sp-canvas-group.h"
-#include "display/canvas-arena.h"
-#include "document.h"
-#include "svg-view.h"
-#include "svg-view-widget.h"
-#include "util/units.h"
-
-static void sp_svg_view_widget_dispose(GObject *object);
-
-static void sp_svg_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static void sp_svg_view_widget_size_request (GtkWidget *widget, GtkRequisition *req);
-
-static void sp_svg_view_widget_get_preferred_width(GtkWidget *widget,
- gint *minimal_width,
- gint *natural_width);
-
-static void sp_svg_view_widget_get_preferred_height(GtkWidget *widget,
- gint *minimal_height,
- gint *natural_height);
-
-static void sp_svg_view_widget_view_resized (SPViewWidget *vw, Inkscape::UI::View::View *view, gdouble width, gdouble height);
-
-G_DEFINE_TYPE(SPSVGSPViewWidget, sp_svg_view_widget, SP_TYPE_VIEW_WIDGET);
-
-/**
- * Callback to initialize SPSVGSPViewWidget vtable.
- */
-static void sp_svg_view_widget_class_init(SPSVGSPViewWidgetClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- SPViewWidgetClass *vw_class = SP_VIEW_WIDGET_CLASS (klass);
-
- object_class->dispose = sp_svg_view_widget_dispose;
-
- widget_class->size_allocate = sp_svg_view_widget_size_allocate;
- widget_class->get_preferred_width = sp_svg_view_widget_get_preferred_width;
- widget_class->get_preferred_height = sp_svg_view_widget_get_preferred_height;
-
- vw_class->view_resized = sp_svg_view_widget_view_resized;
-}
-
-/**
- * Callback to initialize SPSVGSPViewWidget object.
- */
-static void sp_svg_view_widget_init(SPSVGSPViewWidget *vw)
-{
- SPCanvasItem *parent;
-
- /* Settings */
- vw->resize = FALSE;
- vw->maxwidth = 400.0;
- vw->maxheight = 400.0;
-
- /* ScrolledWindow */
- vw->sw = gtk_scrolled_window_new (nullptr, nullptr);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(vw->sw), GTK_SHADOW_NONE);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (vw->sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (vw), vw->sw);
- gtk_widget_show (vw->sw);
-
- /* Canvas */
- vw->canvas = SPCanvas::createAA();
-
- auto css_provider = gtk_css_provider_new();
- auto style_context = gtk_widget_get_style_context(GTK_WIDGET(vw->canvas));
-
- gtk_css_provider_load_from_data(css_provider,
- "SPCanvas {\n"
- " background-color: white;\n"
- "}\n",
- -1, nullptr);
-
- gtk_style_context_add_provider(style_context,
- GTK_STYLE_PROVIDER(css_provider),
- GTK_STYLE_PROVIDER_PRIORITY_USER);
-
- gtk_container_add (GTK_CONTAINER (vw->sw), vw->canvas);
- gtk_widget_show (vw->canvas);
-
- /* View */
- parent = sp_canvas_item_new(SP_CANVAS(vw->canvas)->getRoot(), SP_TYPE_CANVAS_GROUP, nullptr);
- Inkscape::UI::View::View *view = Inkscape::GC::release(new SPSVGView (SP_CANVAS_GROUP (parent)));
- sp_view_widget_set_view (SP_VIEW_WIDGET (vw), view);
-}
-
-/*
- * Destructor callback for SPSVGSPViewWidget objects.
- */
-static void sp_svg_view_widget_dispose(GObject *object)
-{
- SPSVGSPViewWidget *vw = SP_SVG_VIEW_WIDGET (object);
-
- vw->canvas = nullptr;
-
- if (G_OBJECT_CLASS(sp_svg_view_widget_parent_class)->dispose) {
- G_OBJECT_CLASS(sp_svg_view_widget_parent_class)->dispose(object);
- }
-}
-
-/**
- * Callback connected with size_request signal.
- */
-static void sp_svg_view_widget_size_request(GtkWidget *widget, GtkRequisition *req)
-{
- SPSVGSPViewWidget *vw = SP_SVG_VIEW_WIDGET (widget);
- Inkscape::UI::View::View *v = SP_VIEW_WIDGET_VIEW (widget);
-
- if (GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->get_preferred_width &&
- GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->get_preferred_height) {
- gint width_min, height_min, width_nat, height_nat;
-
- GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->get_preferred_width(widget, &width_min, &width_nat);
- GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->get_preferred_height(widget, &height_min, &height_nat);
- req->width=width_min;
- req->height=height_min;
- }
-
- if (v->doc()) {
- SPSVGView *svgv;
- GtkPolicyType hpol, vpol;
- gdouble width, height;
-
- svgv = static_cast<SPSVGView*> (v);
- width = (v->doc())->getWidth().value("px") * svgv->_hscale;
- height = (v->doc())->getHeight().value("px") * svgv->_vscale;
-
- if (width <= vw->maxwidth) {
- hpol = GTK_POLICY_NEVER;
- req->width = (gint) (width + 0.5);
- } else {
- hpol = GTK_POLICY_AUTOMATIC;
- req->width = (gint) (vw->maxwidth + 0.5);
- }
- if (height <= vw->maxheight) {
- vpol = GTK_POLICY_NEVER;
- req->height = (gint) (height + 8.0);
- } else {
- vpol = GTK_POLICY_AUTOMATIC;
- req->height = (gint) (vw->maxheight + 2.0);
- }
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (vw->sw), hpol, vpol);
- }
-}
-
-static void sp_svg_view_widget_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width)
-{
- GtkRequisition requisition;
- sp_svg_view_widget_size_request(widget, &requisition);
- *minimal_width = *natural_width = requisition.width;
-}
-
-static void sp_svg_view_widget_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height)
-{
- GtkRequisition requisition;
- sp_svg_view_widget_size_request(widget, &requisition);
- *minimal_height = *natural_height = requisition.height;
-}
-
-/**
- * Callback connected with size_allocate signal.
- */
-static void sp_svg_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
- SPSVGSPViewWidget *svgvw = SP_SVG_VIEW_WIDGET (widget);
-
- if (GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->size_allocate) {
- GTK_WIDGET_CLASS(sp_svg_view_widget_parent_class)->size_allocate(widget, allocation);
- }
-
- if (!svgvw->resize) {
- static_cast<SPSVGView*>(SP_VIEW_WIDGET_VIEW (svgvw))->setRescale (TRUE, TRUE,
- (gdouble) allocation->width - 1.0, (gdouble) allocation->height - 1.0);
- }
-}
-
-/**
- * Callback connected with view_resized signal.
- */
-static void sp_svg_view_widget_view_resized(SPViewWidget *vw, Inkscape::UI::View::View */*view*/, gdouble width, gdouble height)
-{
- SPSVGSPViewWidget *svgvw = SP_SVG_VIEW_WIDGET (vw);
-
- if (svgvw->resize) {
- gtk_widget_set_size_request (svgvw->canvas, (int)width, (int)height);
- gtk_widget_queue_resize (GTK_WIDGET (vw));
- }
-}
-
-GtkWidget *sp_svg_view_widget_new(SPDocument *doc)
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (doc != nullptr, NULL);
-
- widget = (GtkWidget*)g_object_new (SP_TYPE_SVG_VIEW_WIDGET, nullptr);
-
- reinterpret_cast<SPSVGView*>(SP_VIEW_WIDGET_VIEW (widget))->setDocument (doc);
-
- return widget;
-}
-
-void SPSVGSPViewWidget::setResize(bool resize, gdouble width, gdouble height)
-{
- g_return_if_fail( !resize || (width > 0.0) );
- g_return_if_fail( !resize || (height > 0.0) );
-
- this->resize = resize;
- this->maxwidth = width;
- this->maxheight = height;
-
- if ( resize ) {
- gtk_widget_queue_resize( GTK_WIDGET(this) );
- }
-}
-
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/svg-view-widget.h b/src/svg-view-widget.h
deleted file mode 100644
index 6b187a895..000000000
--- a/src/svg-view-widget.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef SEEN_SP_SVG_VIEW_WIDGET_H
-#define SEEN_SP_SVG_VIEW_WIDGET_H
-/*
- * Authors:
- * Lauris Kaplinski <lauris@kaplinski.com>
- * Jon A. Cruz <jon@joncruz.org>
- *
- * Copyright (C) 2010 Authors
- * Copyright (C) 2001-2002 Lauris Kaplinski
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "ui/view/view-widget.h"
-
-class SPDocument;
-
-#define SP_TYPE_SVG_VIEW_WIDGET (sp_svg_view_widget_get_type ())
-#define SP_SVG_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SVG_VIEW_WIDGET, SPSVGSPViewWidget))
-#define SP_SVG_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SVG_VIEW_WIDGET, SPSVGSPViewWidgetClass))
-#define SP_IS_SVG_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SVG_VIEW_WIDGET))
-#define SP_IS_SVG_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SVG_VIEW_WIDGET))
-
-/**
- * Registers SPSVGSPViewWidget class with Gtk and returns its type number.
- */
-GType sp_svg_view_widget_get_type();
-
-/**
- * Constructs new SPSVGSPViewWidget object and returns pointer to it.
- */
-GtkWidget *sp_svg_view_widget_new(SPDocument *doc);
-
-/**
- * An SPSVGSPViewWidget is an SVG view together with a canvas.
- */
-struct SPSVGSPViewWidget {
-public:
- SPViewWidget widget;
-
- GtkWidget *sw;
- GtkWidget *canvas;
-
- /// Whether to resize automatically
- bool resize;
- double maxwidth, maxheight;
-
- // C++ Wrappers
-
- /**
- * Flags the SPSVGSPViewWidget to have its size renegotiated with Gtk.
- */
- void setResize(bool resize, gdouble width, gdouble height);
-};
-
-/// The SPSVGSPViewWidget vtable.
-struct SPSVGSPViewWidgetClass {
- SPViewWidgetClass parent_class;
-};
-
-
-#endif // SEEN_SP_SVG_VIEW_WIDGET_H
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index e4d2e2576..62bf701e1 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -199,6 +199,8 @@ set(ui_SRC
widget/unit-menu.cpp
widget/unit-tracker.cpp
+ view/svg-view.cpp
+ view/svg-view-widget.cpp
view/view.cpp
view/view-widget.cpp
@@ -422,8 +424,10 @@ set(ui_SRC
widget/unit-tracker.h
view/edit-widget-interface.h
- view/view-widget.h
+ view/svg-view.h
+ view/svg-view-widget.h
view/view.h
+ view/view-widget.h
)
if(WIN32)
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index fd78540d5..b86bc02a4 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -31,12 +31,13 @@
#include "document.h"
#include "inkscape-version.h"
#include "path-prefix.h"
-#include "svg-view-widget.h"
#include "text-editing.h"
#include "object/sp-text.h"
#include "ui/icon-names.h"
+#include "ui/view/svg-view-widget.h"
+
#include "util/units.h"
@@ -122,21 +123,20 @@ void AboutBox::build_splash_widget() {
}
doc->ensureUpToDate();
- GtkWidget *v=sp_svg_view_widget_new(doc);
+ auto viewer = Gtk::manage(new Inkscape::UI::View::SVGViewWidget(doc));
// temporary hack: halve the dimensions so the dialog will fit
- double width=doc->getWidth().value("px") / 2;
- double height=doc->getHeight().value("px") / 2;
+ double width=doc->getWidth().value("px") / 2.0;
+ double height=doc->getHeight().value("px") / 2.0;
+ viewer->setResize(width, height);
doc->doUnref();
- SP_SVG_VIEW_WIDGET(v)->setResize(false, static_cast<int>(width), static_cast<int>(height));
-
_splash_widget = new Gtk::AspectFrame();
_splash_widget->unset_label();
_splash_widget->set_shadow_type(Gtk::SHADOW_NONE);
_splash_widget->property_ratio() = width / height;
- _splash_widget->add(*manage(Glib::wrap(v)));
+ _splash_widget->add(*viewer);
}
}
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 3454f99ea..72036d444 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -19,29 +19,30 @@
#include <iostream>
-#include "filedialogimpl-gtkmm.h"
-#include "ui/dialog-events.h"
-#include "ui/interface.h"
-#include "io/sys.h"
-#include "io/resource.h"
-#include "path-prefix.h"
-#include "preferences.h"
-
-#include <gtkmm/expander.h>
-
#include <glibmm/convert.h>
#include <glibmm/fileutils.h>
#include <glibmm/i18n.h>
#include <glibmm/miscutils.h>
-
#include <glibmm/regex.h>
+#include <gtkmm/expander.h>
+
+#include "filedialogimpl-gtkmm.h"
#include "document.h"
+#include "inkscape.h"
+#include "path-prefix.h"
+#include "preferences.h"
+
+#include "extension/db.h"
#include "extension/input.h"
#include "extension/output.h"
-#include "extension/db.h"
-#include "svg-view-widget.h"
-#include "inkscape.h"
+
+#include "io/resource.h"
+#include "io/sys.h"
+
+#include "ui/dialog-events.h"
+#include "ui/interface.h"
+#include "ui/view/svg-view-widget.h"
// Routines from file.cpp
#undef INK_DUMP_FILENAME_CONV
@@ -117,20 +118,17 @@ void findExpanderWidgets(Gtk::Container *parent, std::vector<Gtk::Expander *> &r
bool SVGPreview::setDocument(SPDocument *doc)
{
- if (document)
- document->doUnref();
-
- doc->doRef();
document = doc;
- // This should remove it from the box, and free resources
- if (viewerGtk)
- Gtk::Container::remove(*viewerGtk);
+ if (viewer) {
+ viewer->setDocument(document);
+ } else {
+ viewer = Gtk::manage(new Inkscape::UI::View::SVGViewWidget(document));
+ pack_start(*viewer, true, true);
+ }
+
+ show_all();
- viewerGtk = Glib::wrap(sp_svg_view_widget_new(doc));
- Gtk::VBox *vbox = Glib::wrap(gobj());
- vbox->pack_start(*viewerGtk, TRUE, TRUE, 0);
- viewerGtk->show();
return true;
}
@@ -153,8 +151,6 @@ bool SVGPreview::setFileName(Glib::ustring &theFileName)
setDocument(doc);
- doc->doUnref();
-
return true;
}
@@ -174,10 +170,6 @@ bool SVGPreview::setFromMem(char const *xmlBuffer)
setDocument(doc);
- doc->doUnref();
-
- Inkscape::GC::request_early_collection();
-
return true;
}
@@ -292,28 +284,16 @@ void SVGPreview::showImage(Glib::ustring &theFileName)
gint rectHeight = scaledImgHeight + 2;
// Our template. Modify to taste
- gchar const *xformat = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<svg\n"
- "xmlns=\"http://www.w3.org/2000/svg\"\n"
- "xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"
- "width=\"%d\" height=\"%d\">\n" //# VALUES HERE
- "<rect\n"
- " style=\"fill:#eeeeee;stroke:none\"\n"
- " x=\"-100\" y=\"-100\" width=\"4000\" height=\"4000\"/>\n"
- "<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\"\n"
- "xlink:href=\"%s\"/>\n"
- "<rect\n"
- " style=\"fill:none;"
- " stroke:#000000;stroke-width:1.0;"
- " stroke-linejoin:miter;stroke-opacity:1.0000000;"
- " stroke-miterlimit:4.0000000;stroke-dasharray:none\"\n"
- " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\"/>\n"
- "<text\n"
- " style=\"font-size:24.000000;font-style:normal;font-weight:normal;"
- " fill:#000000;fill-opacity:1.0000000;stroke:none;"
- " font-family:Sans\"\n"
- " x=\"10\" y=\"26\">%s x %s</text>\n" //# VALUES HERE
- "</svg>\n\n";
+ gchar const *xformat = R"A(
+<svg width="%d" height="%d"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <rect width="100%" height="100%" style="fill:#eeeeee"/>
+ <image x="%d" y="%d" width="%d" height="%d" xlink:href="%s"/>
+ <rect x="%d" y="%d" width="%d" height="%d" style="fill:none;stroke:black"/>
+ <text x="50%" y="55%" style="font-family:sans-serif;font-size:24px;text-anchor:middle">%s x %s</text>
+</svg>
+)A";
// if (!Glib::get_charset()) //If we are not utf8
fileName = Glib::filename_to_utf8(fileName);
@@ -339,88 +319,69 @@ void SVGPreview::showNoPreview()
if (showingNoPreview)
return;
- // Arbitrary size of svg doc -- rather 'portrait' shaped
- gint previewWidth = 300;
- gint previewHeight = 600;
-
// Our template. Modify to taste
- gchar const *xformat =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<svg\n"
- "xmlns=\"http://www.w3.org/2000/svg\"\n"
- "xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"
- "width=\"%d\" height=\"%d\">\n" //# VALUES HERE
- "<g transform=\"translate(-190,24.27184)\" style=\"opacity:0.12\">\n"
- "<path\n"
- "style=\"font-size:12;fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:0.936193pt\"\n"
- "d=\"M 397.64309 320.25301 L 280.39197 282.517 L 250.74227 124.83447 L 345.08225 "
- "29.146783 L 393.59996 46.667064 L 483.89679 135.61619 L 397.64309 320.25301 z \"\n"
- "id=\"whiteSpace\" />\n"
- "<path\n"
- "style=\"font-size:12;fill-rule:evenodd;stroke-width:1pt;fill:#000000;fill-opacity:1\"\n"
- "d=\"M 476.95792 339.17168 C 495.78197 342.93607 499.54842 356.11361 495.78197 359.87802 "
- "C 492.01856 363.6434 482.6065 367.40781 475.07663 361.76014 C 467.54478 "
- "356.11361 467.54478 342.93607 476.95792 339.17168 z \"\n"
- "id=\"droplet01\" />\n"
- "<path\n"
- "style=\"font-size:12;fill-rule:evenodd;stroke-width:1pt;fill:#000000;fill-opacity:1\"\n"
- "d=\"M 286.46194 340.42914 C 284.6277 340.91835 269.30405 327.71337 257.16909 333.8338 "
- "C 245.03722 339.95336 236.89276 353.65666 248.22676 359.27982 C 259.56184 364.90298 "
- "267.66433 358.41867 277.60113 351.44119 C 287.53903 344.46477 "
- "287.18046 343.1206 286.46194 340.42914 z \"\n"
- "id=\"droplet02\" />\n"
- "<path\n"
- "style=\"font-size:12;fill-rule:evenodd;stroke-width:1pt;fill:#000000;fill-opacity:1\"\n"
- "d=\"M 510.35756 306.92856 C 520.59494 304.36879 544.24333 306.92856 540.47688 321.98634 "
- "C 536.71354 337.04806 504.71297 331.39827 484.00371 323.87156 C 482.12141 "
- "308.81083 505.53237 308.13423 510.35756 306.92856 z \"\n"
- "id=\"droplet03\" />\n"
- "<path\n"
- "style=\"font-size:12;fill-rule:evenodd;stroke-width:1pt;fill:#000000;fill-opacity:1\"\n"
- "d=\"M 359.2403 21.362537 C 347.92693 21.362537 336.6347 25.683095 327.96556 34.35223 "
- "L 173.87387 188.41466 C 165.37697 196.9114 161.1116 207.95813 160.94269 219.04577 "
- "L 160.88418 219.04577 C 160.88418 219.08524 160.94076 219.12322 160.94269 219.16279 "
- "C 160.94033 219.34888 160.88418 219.53256 160.88418 219.71865 L 161.14748 219.71865 "
- "C 164.0966 230.93917 240.29699 245.24198 248.79866 253.74346 C 261.63771 266.58263 "
- "199.5652 276.01151 212.4041 288.85074 C 225.24316 301.68979 289.99433 313.6933 302.8346 "
- "326.53254 C 315.67368 339.37161 276.5961 353.04289 289.43532 365.88196 C 302.27439 "
- "378.72118 345.40201 362.67257 337.5908 396.16198 C 354.92909 413.50026 391.10302 "
- "405.2208 415.32417 387.88252 C 428.16323 375.04345 390.6948 376.17577 403.53397 "
- "363.33668 C 416.37304 350.49745 448.78128 350.4282 476.08902 319.71589 C 465.09739 "
- "302.62116 429.10801 295.34136 441.94719 282.50217 C 454.78625 269.66311 479.74708 "
- "276.18423 533.60644 251.72479 C 559.89837 239.78398 557.72636 230.71459 557.62567 "
- "219.71865 C 557.62356 219.48727 557.62567 219.27892 557.62567 219.04577 L 557.56716 "
- "219.04577 C 557.3983 207.95812 553.10345 196.9114 544.60673 188.41466 L 390.54428 "
- "34.35223 C 381.87515 25.683095 370.55366 21.362537 359.2403 21.362537 z M 357.92378 "
- "41.402939 C 362.95327 41.533963 367.01541 45.368018 374.98006 50.530832 L 447.76915 "
- "104.50827 C 448.56596 105.02498 449.32484 105.564 450.02187 106.11735 C 450.7189 106.67062 "
- "451.3556 107.25745 451.95277 107.84347 C 452.54997 108.42842 453.09281 109.01553 453.59111 "
- "109.62808 C 454.08837 110.24052 454.53956 110.86661 454.93688 111.50048 C 455.33532 112.13538 "
- "455.69164 112.78029 455.9901 113.43137 C 456.28877 114.08363 456.52291 114.75639 456.7215 "
- "115.42078 C 456.92126 116.08419 457.08982 116.73973 457.18961 117.41019 C 457.28949 "
- "118.08184 457.33588 118.75535 457.33588 119.42886 L 414.21245 98.598549 L 409.9118 "
- "131.16055 L 386.18512 120.04324 L 349.55654 144.50131 L 335.54288 96.1703 L 317.4919 "
- "138.4453 L 267.08369 143.47735 L 267.63956 121.03795 C 267.63956 115.64823 296.69685 "
- "77.915899 314.39075 68.932902 L 346.77721 45.674327 C 351.55594 42.576634 354.90608 "
- "41.324327 357.92378 41.402939 z M 290.92738 261.61333 C 313.87149 267.56365 339.40299 "
- "275.37038 359.88393 275.50997 L 360.76161 284.72563 C 343.2235 282.91785 306.11346 "
- "274.45012 297.36372 269.98057 L 290.92738 261.61333 z \"\n"
- "id=\"mountainDroplet\" />\n"
- "</g> <g transform=\"translate(-20,0)\">\n"
- "<text xml:space=\"preserve\"\n"
- "style=\"font-size:32.000000;font-style:normal;font-variant:normal;font-weight:bold;"
- "font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;"
- "stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
- "font-family:Sans;text-anchor:middle;writing-mode:lr\"\n"
- "x=\"190\" y=\"240\">%s</text></g>\n" //# VALUE HERE
- "</svg>\n\n";
+ gchar const *xformat = R"B(
+<svg width="400" height="600"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <g transform="translate(-160,90)" style="opacity:0.10">
+ <path style="fill:white"
+ d="M 397.64309 320.25301 L 280.39197 282.517 L 250.74227 124.83447 L 345.08225
+ 29.146783 L 393.59996 46.667064 L 483.89679 135.61619 L 397.64309 320.25301 z"/>
+ <path d="M 476.95792 339.17168 C 495.78197 342.93607 499.54842 356.11361 495.78197 359.87802
+ C 492.01856 363.6434 482.6065 367.40781 475.07663 361.76014 C 467.54478
+ 356.11361 467.54478 342.93607 476.95792 339.17168 z"
+ id="droplet01" />
+ <path d="M 286.46194 340.42914 C 284.6277 340.91835 269.30405 327.71337 257.16909 333.8338
+ C 245.03722 339.95336 236.89276 353.65666 248.22676 359.27982 C 259.56184 364.90298
+ 267.66433 358.41867 277.60113 351.44119 C 287.53903 344.46477
+ 287.18046 343.1206 286.46194 340.42914 z"
+ id= "droplet02"/>
+ <path d="M 510.35756 306.92856 C 520.59494 304.36879 544.24333 306.92856 540.47688 321.98634
+ C 536.71354 337.04806 504.71297 331.39827 484.00371 323.87156 C 482.12141
+ 308.81083 505.53237 308.13423 510.35756 306.92856 z"
+ id="droplet03"/>
+ <path d="M 359.2403 21.362537 C 347.92693 21.362537 336.6347 25.683095 327.96556 34.35223
+ L 173.87387 188.41466 C 165.37697 196.9114 161.1116 207.95813 160.94269 219.04577
+ L 160.88418 219.04577 C 160.88418 219.08524 160.94076 219.12322 160.94269 219.16279
+ C 160.94033 219.34888 160.88418 219.53256 160.88418 219.71865 L 161.14748 219.71865
+ C 164.0966 230.93917 240.29699 245.24198 248.79866 253.74346 C 261.63771 266.58263
+ 199.5652 276.01151 212.4041 288.85074 C 225.24316 301.68979 289.99433 313.6933 302.8346
+ 326.53254 C 315.67368 339.37161 276.5961 353.04289 289.43532 365.88196 C 302.27439
+ 378.72118 345.40201 362.67257 337.5908 396.16198 C 354.92909 413.50026 391.10302
+ 405.2208 415.32417 387.88252 C 428.16323 375.04345 390.6948 376.17577 403.53397
+ 363.33668 C 416.37304 350.49745 448.78128 350.4282 476.08902 319.71589 C 465.09739
+ 302.62116 429.10801 295.34136 441.94719 282.50217 C 454.78625 269.66311 479.74708
+ 276.18423 533.60644 251.72479 C 559.89837 239.78398 557.72636 230.71459 557.62567
+ 219.71865 C 557.62356 219.48727 557.62567 219.27892 557.62567 219.04577 L 557.56716
+ 219.04577 C 557.3983 207.95812 553.10345 196.9114 544.60673 188.41466 L 390.54428
+ 34.35223 C 381.87515 25.683095 370.55366 21.362537 359.2403 21.362537 z M 357.92378
+ 41.402939 C 362.95327 41.533963 367.01541 45.368018 374.98006 50.530832 L 447.76915
+ 104.50827 C 448.56596 105.02498 449.32484 105.564 450.02187 106.11735 C 450.7189 106.67062
+ 451.3556 107.25745 451.95277 107.84347 C 452.54997 108.42842 453.09281 109.01553 453.59111
+ 109.62808 C 454.08837 110.24052 454.53956 110.86661 454.93688 111.50048 C 455.33532 112.13538
+ 455.69164 112.78029 455.9901 113.43137 C 456.28877 114.08363 456.52291 114.75639 456.7215
+ 115.42078 C 456.92126 116.08419 457.08982 116.73973 457.18961 117.41019 C 457.28949
+ 118.08184 457.33588 118.75535 457.33588 119.42886 L 414.21245 98.598549 L 409.9118
+ 131.16055 L 386.18512 120.04324 L 349.55654 144.50131 L 335.54288 96.1703 L 317.4919
+ 138.4453 L 267.08369 143.47735 L 267.63956 121.03795 C 267.63956 115.64823 296.69685
+ 77.915899 314.39075 68.932902 L 346.77721 45.674327 C 351.55594 42.576634 354.90608
+ 41.324327 357.92378 41.402939 z M 290.92738 261.61333 C 313.87149 267.56365 339.40299
+ 275.37038 359.88393 275.50997 L 360.76161 284.72563 C 343.2235 282.91785 306.11346
+ 274.45012 297.36372 269.98057 L 290.92738 261.61333 z"
+ id="mountainDroplet"/>
+ </g>
+ <text xml:space="preserve" x="200" y="320"
+ style="font-size:32px;font-weight:bold;text-anchor:middle">%s</text>
+</svg>
+)B";
// Fill in the template
- gchar *xmlBuffer = g_strdup_printf(xformat, previewWidth, previewHeight, _("No preview"));
+ gchar *xmlBuffer = g_strdup_printf(xformat, _("No preview"));
// g_message("%s\n", xmlBuffer);
- // now show it!
+ // Now show it!
setFromMem(xmlBuffer);
g_free(xmlBuffer);
showingNoPreview = true;
@@ -433,94 +394,72 @@ void SVGPreview::showNoPreview()
*/
void SVGPreview::showTooLarge(long fileLength)
{
-
- // Arbitrary size of svg doc -- rather 'portrait' shaped
- gint previewWidth = 300;
- gint previewHeight = 600;
-
// Our template. Modify to taste
- gchar const *xformat =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<svg\n"
- "xmlns=\"http://www.w3.org/2000/svg\"\n"
- "xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"
- "width=\"%d\" height=\"%d\">\n" //# VALUES HERE
- "<g transform=\"translate(-170,24.27184)\" style=\"opacity:0.12\">\n"
- "<path\n"
- "style=\"font-size:12;fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:0.936193pt\"\n"
- "d=\"M 397.64309 320.25301 L 280.39197 282.517 L 250.74227 124.83447 L 345.08225 "
- "29.146783 L 393.59996 46.667064 L 483.89679 135.61619 L 397.64309 320.25301 z \"\n"
- "id=\"whiteSpace\" />\n"
- "<path\n"
- "style=\"font-size:12;fill-rule:evenodd;stroke-width:1pt;fill:#000000;fill-opacity:1\"\n"
- "d=\"M 476.95792 339.17168 C 495.78197 342.93607 499.54842 356.11361 495.78197 359.87802 "
- "C 492.01856 363.6434 482.6065 367.40781 475.07663 361.76014 C 467.54478 "
- "356.11361 467.54478 342.93607 476.95792 339.17168 z \"\n"
- "id=\"droplet01\" />\n"
- "<path\n"
- "style=\"font-size:12;fill-rule:evenodd;stroke-width:1pt;fill:#000000;fill-opacity:1\"\n"
- "d=\"M 286.46194 340.42914 C 284.6277 340.91835 269.30405 327.71337 257.16909 333.8338 "
- "C 245.03722 339.95336 236.89276 353.65666 248.22676 359.27982 C 259.56184 364.90298 "
- "267.66433 358.41867 277.60113 351.44119 C 287.53903 344.46477 "
- "287.18046 343.1206 286.46194 340.42914 z \"\n"
- "id=\"droplet02\" />\n"
- "<path\n"
- "style=\"font-size:12;fill-rule:evenodd;stroke-width:1pt;fill:#000000;fill-opacity:1\"\n"
- "d=\"M 510.35756 306.92856 C 520.59494 304.36879 544.24333 306.92856 540.47688 321.98634 "
- "C 536.71354 337.04806 504.71297 331.39827 484.00371 323.87156 C 482.12141 "
- "308.81083 505.53237 308.13423 510.35756 306.92856 z \"\n"
- "id=\"droplet03\" />\n"
- "<path\n"
- "style=\"font-size:12;fill-rule:evenodd;stroke-width:1pt;fill:#000000;fill-opacity:1\"\n"
- "d=\"M 359.2403 21.362537 C 347.92693 21.362537 336.6347 25.683095 327.96556 34.35223 "
- "L 173.87387 188.41466 C 165.37697 196.9114 161.1116 207.95813 160.94269 219.04577 "
- "L 160.88418 219.04577 C 160.88418 219.08524 160.94076 219.12322 160.94269 219.16279 "
- "C 160.94033 219.34888 160.88418 219.53256 160.88418 219.71865 L 161.14748 219.71865 "
- "C 164.0966 230.93917 240.29699 245.24198 248.79866 253.74346 C 261.63771 266.58263 "
- "199.5652 276.01151 212.4041 288.85074 C 225.24316 301.68979 289.99433 313.6933 302.8346 "
- "326.53254 C 315.67368 339.37161 276.5961 353.04289 289.43532 365.88196 C 302.27439 "
- "378.72118 345.40201 362.67257 337.5908 396.16198 C 354.92909 413.50026 391.10302 "
- "405.2208 415.32417 387.88252 C 428.16323 375.04345 390.6948 376.17577 403.53397 "
- "363.33668 C 416.37304 350.49745 448.78128 350.4282 476.08902 319.71589 C 465.09739 "
- "302.62116 429.10801 295.34136 441.94719 282.50217 C 454.78625 269.66311 479.74708 "
- "276.18423 533.60644 251.72479 C 559.89837 239.78398 557.72636 230.71459 557.62567 "
- "219.71865 C 557.62356 219.48727 557.62567 219.27892 557.62567 219.04577 L 557.56716 "
- "219.04577 C 557.3983 207.95812 553.10345 196.9114 544.60673 188.41466 L 390.54428 "
- "34.35223 C 381.87515 25.683095 370.55366 21.362537 359.2403 21.362537 z M 357.92378 "
- "41.402939 C 362.95327 41.533963 367.01541 45.368018 374.98006 50.530832 L 447.76915 "
- "104.50827 C 448.56596 105.02498 449.32484 105.564 450.02187 106.11735 C 450.7189 106.67062 "
- "451.3556 107.25745 451.95277 107.84347 C 452.54997 108.42842 453.09281 109.01553 453.59111 "
- "109.62808 C 454.08837 110.24052 454.53956 110.86661 454.93688 111.50048 C 455.33532 112.13538 "
- "455.69164 112.78029 455.9901 113.43137 C 456.28877 114.08363 456.52291 114.75639 456.7215 "
- "115.42078 C 456.92126 116.08419 457.08982 116.73973 457.18961 117.41019 C 457.28949 "
- "118.08184 457.33588 118.75535 457.33588 119.42886 L 414.21245 98.598549 L 409.9118 "
- "131.16055 L 386.18512 120.04324 L 349.55654 144.50131 L 335.54288 96.1703 L 317.4919 "
- "138.4453 L 267.08369 143.47735 L 267.63956 121.03795 C 267.63956 115.64823 296.69685 "
- "77.915899 314.39075 68.932902 L 346.77721 45.674327 C 351.55594 42.576634 354.90608 "
- "41.324327 357.92378 41.402939 z M 290.92738 261.61333 C 313.87149 267.56365 339.40299 "
- "275.37038 359.88393 275.50997 L 360.76161 284.72563 C 343.2235 282.91785 306.11346 "
- "274.45012 297.36372 269.98057 L 290.92738 261.61333 z \"\n"
- "id=\"mountainDroplet\" />\n"
- "</g>\n"
- "<text xml:space=\"preserve\"\n"
- "style=\"font-size:32.000000;font-style:normal;font-variant:normal;font-weight:bold;"
- "font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;"
- "stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
- "font-family:Sans;text-anchor:middle;writing-mode:lr\"\n"
- "x=\"170\" y=\"215\">%5.1f MB</text>\n" //# VALUE HERE
- "<text xml:space=\"preserve\"\n"
- "style=\"font-size:24.000000;font-style:normal;font-variant:normal;font-weight:bold;"
- "font-stretch:normal;fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;"
- "stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
- "font-family:Sans;text-anchor:middle;writing-mode:lr\"\n"
- "x=\"180\" y=\"245\">%s</text>\n" //# VALUE HERE
- "</svg>\n\n";
+ gchar const *xformat = R"C(
+<svg width="400" height="600"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <g transform="translate(-160,90)" style="opacity:0.10">
+ <path style="fill:white"
+ d="M 397.64309 320.25301 L 280.39197 282.517 L 250.74227 124.83447 L 345.08225
+ 29.146783 L 393.59996 46.667064 L 483.89679 135.61619 L 397.64309 320.25301 z"/>
+ <path d="M 476.95792 339.17168 C 495.78197 342.93607 499.54842 356.11361 495.78197 359.87802
+ C 492.01856 363.6434 482.6065 367.40781 475.07663 361.76014 C 467.54478
+ 356.11361 467.54478 342.93607 476.95792 339.17168 z"
+ id="droplet01" />
+ <path d="M 286.46194 340.42914 C 284.6277 340.91835 269.30405 327.71337 257.16909 333.8338
+ C 245.03722 339.95336 236.89276 353.65666 248.22676 359.27982 C 259.56184 364.90298
+ 267.66433 358.41867 277.60113 351.44119 C 287.53903 344.46477
+ 287.18046 343.1206 286.46194 340.42914 z"
+ id= "droplet02"/>
+ <path d="M 510.35756 306.92856 C 520.59494 304.36879 544.24333 306.92856 540.47688 321.98634
+ C 536.71354 337.04806 504.71297 331.39827 484.00371 323.87156 C 482.12141
+ 308.81083 505.53237 308.13423 510.35756 306.92856 z"
+ id="droplet03"/>
+ <path d="M 359.2403 21.362537 C 347.92693 21.362537 336.6347 25.683095 327.96556 34.35223
+ L 173.87387 188.41466 C 165.37697 196.9114 161.1116 207.95813 160.94269 219.04577
+ L 160.88418 219.04577 C 160.88418 219.08524 160.94076 219.12322 160.94269 219.16279
+ C 160.94033 219.34888 160.88418 219.53256 160.88418 219.71865 L 161.14748 219.71865
+ C 164.0966 230.93917 240.29699 245.24198 248.79866 253.74346 C 261.63771 266.58263
+ 199.5652 276.01151 212.4041 288.85074 C 225.24316 301.68979 289.99433 313.6933 302.8346
+ 326.53254 C 315.67368 339.37161 276.5961 353.04289 289.43532 365.88196 C 302.27439
+ 378.72118 345.40201 362.67257 337.5908 396.16198 C 354.92909 413.50026 391.10302
+ 405.2208 415.32417 387.88252 C 428.16323 375.04345 390.6948 376.17577 403.53397
+ 363.33668 C 416.37304 350.49745 448.78128 350.4282 476.08902 319.71589 C 465.09739
+ 302.62116 429.10801 295.34136 441.94719 282.50217 C 454.78625 269.66311 479.74708
+ 276.18423 533.60644 251.72479 C 559.89837 239.78398 557.72636 230.71459 557.62567
+ 219.71865 C 557.62356 219.48727 557.62567 219.27892 557.62567 219.04577 L 557.56716
+ 219.04577 C 557.3983 207.95812 553.10345 196.9114 544.60673 188.41466 L 390.54428
+ 34.35223 C 381.87515 25.683095 370.55366 21.362537 359.2403 21.362537 z M 357.92378
+ 41.402939 C 362.95327 41.533963 367.01541 45.368018 374.98006 50.530832 L 447.76915
+ 104.50827 C 448.56596 105.02498 449.32484 105.564 450.02187 106.11735 C 450.7189 106.67062
+ 451.3556 107.25745 451.95277 107.84347 C 452.54997 108.42842 453.09281 109.01553 453.59111
+ 109.62808 C 454.08837 110.24052 454.53956 110.86661 454.93688 111.50048 C 455.33532 112.13538
+ 455.69164 112.78029 455.9901 113.43137 C 456.28877 114.08363 456.52291 114.75639 456.7215
+ 115.42078 C 456.92126 116.08419 457.08982 116.73973 457.18961 117.41019 C 457.28949
+ 118.08184 457.33588 118.75535 457.33588 119.42886 L 414.21245 98.598549 L 409.9118
+ 131.16055 L 386.18512 120.04324 L 349.55654 144.50131 L 335.54288 96.1703 L 317.4919
+ 138.4453 L 267.08369 143.47735 L 267.63956 121.03795 C 267.63956 115.64823 296.69685
+ 77.915899 314.39075 68.932902 L 346.77721 45.674327 C 351.55594 42.576634 354.90608
+ 41.324327 357.92378 41.402939 z M 290.92738 261.61333 C 313.87149 267.56365 339.40299
+ 275.37038 359.88393 275.50997 L 360.76161 284.72563 C 343.2235 282.91785 306.11346
+ 274.45012 297.36372 269.98057 L 290.92738 261.61333 z"
+ id="mountainDroplet"/>
+ </g>
+ <text xml:space="preserve" x="200" y="280"
+ style="font-size:20px;font-weight:bold;text-anchor:middle">%s</text>
+ <text xml:space="preserve" x="200" y="360"
+ style="font-size:20px;font-weight:bold;text-anchor:middle">%s</text>
+</svg>
+)C";
+
// Fill in the template
double floatFileLength = ((double)fileLength) / 1048576.0;
// printf("%ld %f\n", fileLength, floatFileLength);
+
gchar *xmlBuffer =
- g_strdup_printf(xformat, previewWidth, previewHeight, floatFileLength, _("too large for preview"));
+ g_strdup_printf(xformat, floatFileLength, _("Too large for preview"));
// g_message("%s\n", xmlBuffer);
@@ -580,14 +519,11 @@ bool SVGPreview::set(Glib::ustring &fileName, int dialogType)
SVGPreview::SVGPreview()
+ : document(nullptr)
+ , viewer(nullptr)
+ , showingNoPreview(false)
{
- // \FIXME Why?!!??
- if (!Inkscape::Application::exists())
- Inkscape::Application::create("", false);
- document = nullptr;
- viewerGtk = nullptr;
- set_size_request(150, 150);
- showingNoPreview = false;
+ set_size_request(200, 300);
}
SVGPreview::~SVGPreview()
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h
index 6c5cb38e5..f4625c5f8 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.h
+++ b/src/ui/dialog/filedialogimpl-gtkmm.h
@@ -35,15 +35,16 @@ namespace Gtk {
class Expander;
}
-namespace Inkscape
-{
+namespace Inkscape {
+ class URI;
-class URI;
+namespace UI {
-namespace UI
-{
-namespace Dialog
-{
+namespace View {
+ class SVGViewWidget;
+}
+
+namespace Dialog {
/*#########################################################################
### Utility
@@ -121,7 +122,7 @@ private:
/**
* The sp_svg_view widget
*/
- Gtk::Widget *viewerGtk;
+ Inkscape::UI::View::SVGViewWidget *viewer;
/**
* are we currently showing the "no preview" image?
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 1480f267f..723cd4659 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -36,7 +36,6 @@
#include "preferences.h"
#include "selection-chemistry.h"
#include "shortcuts.h"
-#include "svg-view-widget.h"
#include "display/sp-canvas.h"
@@ -75,6 +74,7 @@
#include "ui/monitor.h"
#include "ui/tools/tool-base.h"
#include "ui/uxmanager.h"
+#include "ui/view/svg-view-widget.h"
#include "widgets/desktop-widget.h"
#include "widgets/ege-paint-def.h"
@@ -311,18 +311,6 @@ void sp_ui_reload()
prefs->setInt("/options/savewindowgeometry/value", window_geometry);
}
-void sp_ui_new_view_preview()
-{
- SPDocument *document = SP_ACTIVE_DOCUMENT;
- if ( document ) {
- SPViewWidget *dtw = reinterpret_cast<SPViewWidget *>(sp_svg_view_widget_new(document));
- g_return_if_fail(dtw != nullptr);
- SP_SVG_VIEW_WIDGET(dtw)->setResize(true, 400.0, 400.0);
-
- sp_create_window(dtw, FALSE);
- }
-}
-
void
sp_ui_close_view(GtkWidget */*widget*/)
{
diff --git a/src/ui/interface.h b/src/ui/interface.h
index fcaa9801a..d509ff82c 100644
--- a/src/ui/interface.h
+++ b/src/ui/interface.h
@@ -48,11 +48,6 @@ void sp_ui_new_view ();
void sp_ui_reload();
/**
- * @todo TODO: not yet working. To be re-enabled (by adding to menu) once it works.
- */
-void sp_ui_new_view_preview ();
-
-/**
* This function is called to exit the program, and iterates through all
* open document view windows, attempting to close each in turn. If the
* view has unsaved information, the user will be prompted to save,
diff --git a/src/ui/view/svg-view-widget.cpp b/src/ui/view/svg-view-widget.cpp
new file mode 100644
index 000000000..81589abb2
--- /dev/null
+++ b/src/ui/view/svg-view-widget.cpp
@@ -0,0 +1,80 @@
+/*
+ * Author:
+ * Tavmjong Bah <tavmjong@free.fr>
+ *
+ * Copyright (C) 2018 Tavmong Bah
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#include "svg-view-widget.h"
+#include "svg-view.h"
+
+#include "document.h"
+
+#include "display/sp-canvas.h"
+#include "display/sp-canvas-group.h"
+#include "display/sp-canvas-item.h"
+
+
+namespace Inkscape {
+namespace UI {
+namespace View {
+
+/**
+ * A light-weight widget containing an SPCanvas with a View for rendering an SVG.
+ * It's derived from a Gtk::ScrolledWindow like the previous C version, but that doesn't seem to be
+ * too useful.
+ */
+SVGViewWidget::SVGViewWidget(SPDocument* document)
+{
+ _canvas = SPCanvas::createAA();
+ add(*Glib::wrap(_canvas));
+
+ SPCanvasItem* parent =
+ sp_canvas_item_new(SP_CANVAS(_canvas)->getRoot(), SP_TYPE_CANVAS_GROUP, nullptr);
+ _view = new SVGView(SP_CANVAS_GROUP(parent));
+ _view->setDocument(document);
+
+ signal_size_allocate().connect(sigc::mem_fun(*this, &SVGViewWidget::size_allocate));
+}
+
+SVGViewWidget::~SVGViewWidget()
+{
+ delete _view;
+ delete _canvas;
+}
+
+void
+SVGViewWidget::setDocument(SPDocument* document)
+{
+ _view->setDocument(document);
+}
+
+void
+SVGViewWidget::setResize(int width, int height)
+{
+ set_size_request(width, height);
+ queue_resize();
+}
+
+void
+SVGViewWidget::size_allocate(Gtk::Allocation& allocation)
+{
+ _view->setRescale(true, true, allocation.get_width(), allocation.get_height());
+}
+
+} // Namespace View
+} // Namespace UI
+} // Namespace Inkscape
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
diff --git a/src/ui/view/svg-view-widget.h b/src/ui/view/svg-view-widget.h
new file mode 100644
index 000000000..11bbba827
--- /dev/null
+++ b/src/ui/view/svg-view-widget.h
@@ -0,0 +1,57 @@
+/*
+ * Author:
+ * Tavmjong Bah <tavmjong@free.fr>
+ *
+ * Copyright (C) 2018 Tavmong Bah
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifndef INKSCAPE_UI_SVG_VIEW_WIDGET_VARIATIONS_H
+#define INKSCAPE_UI_SVG_VIEW_WIDGET_VARIATIONS_H
+
+
+#include <gtkmm.h>
+
+class SPDocument;
+
+namespace Inkscape {
+namespace UI {
+namespace View {
+
+class SVGView;
+
+/**
+ * A light-weight widget containing an SPCanvas with an SVGView for rendering an SVG.
+ */
+class SVGViewWidget : public Gtk::ScrolledWindow {
+
+public:
+ SVGViewWidget(SPDocument* document);
+ ~SVGViewWidget();
+ void setDocument( SPDocument* document);
+ void setResize( int width, int height);
+
+private:
+ void size_allocate(Gtk::Allocation& allocation);
+
+ SVGView* _view;
+ GtkWidget* _canvas;
+};
+
+} // Namespace View
+} // Namespace UI
+} // Namespace Inkscape
+
+#endif // INKSCAPE_UI_SVG_VIEW_WIDGET
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
diff --git a/src/svg-view.cpp b/src/ui/view/svg-view.cpp
index 4632454e7..6b90e8ccd 100644
--- a/src/svg-view.cpp
+++ b/src/ui/view/svg-view.cpp
@@ -15,7 +15,7 @@
#include <2geom/transforms.h>
-#include "svg-view.h"
+#include "ui/view/svg-view.h"
#include "document.h"
@@ -27,7 +27,11 @@
#include "util/units.h"
-SPSVGView::SPSVGView(SPCanvasGroup *parent)
+namespace Inkscape {
+namespace UI {
+namespace View {
+
+SVGView::SVGView(SPCanvasGroup *parent)
{
_hscale = 1.0;
_vscale = 1.0;
@@ -41,7 +45,7 @@ SPSVGView::SPSVGView(SPCanvasGroup *parent)
_parent = parent;
}
-SPSVGView::~SPSVGView()
+SVGView::~SVGView()
{
if (doc() && _drawing)
{
@@ -50,7 +54,7 @@ SPSVGView::~SPSVGView()
}
}
-void SPSVGView::setScale(gdouble hscale, gdouble vscale)
+void SVGView::setScale(gdouble hscale, gdouble vscale)
{
if (!_rescale && ((hscale != _hscale) || (vscale != _vscale))) {
_hscale = hscale;
@@ -59,7 +63,7 @@ void SPSVGView::setScale(gdouble hscale, gdouble vscale)
}
}
-void SPSVGView::setRescale(bool rescale, bool keepaspect, gdouble width, gdouble height)
+void SVGView::setRescale(bool rescale, bool keepaspect, gdouble width, gdouble height)
{
g_return_if_fail (!rescale || (width >= 0.0));
g_return_if_fail (!rescale || (height >= 0.0));
@@ -72,7 +76,7 @@ void SPSVGView::setRescale(bool rescale, bool keepaspect, gdouble width, gdouble
doRescale (true);
}
-void SPSVGView::doRescale(bool event)
+void SVGView::doRescale(bool event)
{
if (!doc()) {
return;
@@ -84,20 +88,24 @@ void SPSVGView::doRescale(bool event)
return;
}
+ double x_offset = 0.0;
+ double y_offset = 0.0;
if (_rescale) {
_hscale = _width / doc()->getWidth().value("px");
_vscale = _height / doc()->getHeight().value("px");
if (_keepaspect) {
if (_hscale > _vscale) {
_hscale = _vscale;
- } else {
- _vscale = _hscale;
- }
+ x_offset = (_width - doc()->getWidth().value("px") * _vscale)/2.0;
+ } else {
+ _vscale = _hscale;
+ y_offset = (_height - doc()->getHeight().value("px") * _hscale)/2.0;
+ }
}
}
if (_drawing) {
- sp_canvas_item_affine_absolute (_drawing, Geom::Scale(_hscale, _vscale));
+ sp_canvas_item_affine_absolute (_drawing, Geom::Scale(_hscale, _vscale) * Geom::Translate(x_offset, y_offset));
}
if (event) {
@@ -106,7 +114,7 @@ void SPSVGView::doRescale(bool event)
}
}
-void SPSVGView::mouseover()
+void SVGView::mouseover()
{
GdkDisplay *display = gdk_display_get_default();
GdkCursor *cursor = gdk_cursor_new_for_display(display, GDK_HAND2);
@@ -115,7 +123,7 @@ void SPSVGView::mouseover()
g_object_unref(cursor);
}
-void SPSVGView::mouseout()
+void SVGView::mouseout()
{
GdkWindow *window = gtk_widget_get_window (GTK_WIDGET(SP_CANVAS_ITEM(_drawing)->canvas));
gdk_window_set_cursor(window, nullptr);
@@ -126,7 +134,7 @@ void SPSVGView::mouseout()
* Callback connected with arena_event.
*/
/// \todo fixme.
-static gint arena_handler(SPCanvasArena */*arena*/, Inkscape::DrawingItem *ai, GdkEvent *event, SPSVGView *svgview)
+static gint arena_handler(SPCanvasArena */*arena*/, Inkscape::DrawingItem *ai, GdkEvent *event, SVGView *svgview)
{
static gdouble x, y;
static gboolean active = FALSE;
@@ -181,7 +189,7 @@ static gint arena_handler(SPCanvasArena */*arena*/, Inkscape::DrawingItem *ai, G
return TRUE;
}
-void SPSVGView::setDocument(SPDocument *document)
+void SVGView::setDocument(SPDocument *document)
{
if (doc()) {
doc()->getRoot()->invoke_hide(_dkey);
@@ -208,12 +216,15 @@ void SPSVGView::setDocument(SPDocument *document)
}
}
-void SPSVGView::onDocumentResized(gdouble width, gdouble height)
+void SVGView::onDocumentResized(gdouble width, gdouble height)
{
setScale (width, height);
doRescale (!_rescale);
}
+}
+}
+}
/*
Local Variables:
diff --git a/src/svg-view.h b/src/ui/view/svg-view.h
index 93f2b7dfd..23698eb36 100644
--- a/src/svg-view.h
+++ b/src/ui/view/svg-view.h
@@ -1,5 +1,5 @@
-#ifndef SEEN_SP_SVG_VIEW_H
-#define SEEN_SP_SVG_VIEW_H
+#ifndef SEEN_SVG_VIEW_H
+#define SEEN_SVG_VIEW_H
/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
@@ -16,10 +16,14 @@
struct SPCanvasGroup;
struct SPCanvasItem;
+namespace Inkscape {
+namespace UI {
+namespace View {
+
/**
* Generic SVG view.
*/
-class SPSVGView : public Inkscape::UI::View::View {
+class SVGView : public View {
public:
unsigned int _dkey;
SPCanvasGroup *_parent;
@@ -35,9 +39,9 @@ public:
/**
* Constructs new SPSVGView object and returns pointer to it.
*/
- SPSVGView(SPCanvasGroup* parent);
+ SVGView(SPCanvasGroup* parent);
- ~SPSVGView() override;
+ ~SVGView() override;
/**
* Rescales SPSVGView to given proportions.
@@ -78,7 +82,11 @@ private:
void onDocumentResized(double, double) override;
};
-#endif // SEEN_SP_SVG_VIEW_H
+}
+}
+}
+
+#endif // SEEN_SVG_VIEW_H
/*
Local Variables:
diff --git a/src/ui/view/view-widget.h b/src/ui/view/view-widget.h
index 661b7b342..7c299972a 100644
--- a/src/ui/view/view-widget.h
+++ b/src/ui/view/view-widget.h
@@ -61,7 +61,7 @@ SPViewWidget *sp_desktop_widget_new(SPNamedView *namedview);
*/
class SPViewWidget {
public:
- GtkEventBox eventbox;
+ GtkEventBox eventbox; // NOT USED!
Inkscape::UI::View::View *view;
diff --git a/src/verbs.cpp b/src/verbs.cpp
index fe617148a..c7698fb4b 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -2120,9 +2120,6 @@ void ZoomVerb::perform(SPAction *action, void *data)
case SP_VERB_VIEW_NEW:
sp_ui_new_view();
break;
- case SP_VERB_VIEW_NEW_PREVIEW:
- sp_ui_new_view_preview();
- break;
case SP_VERB_VIEW_MODE_NORMAL:
dt->setDisplayModeNormal();
break;
@@ -3102,8 +3099,6 @@ Verb *Verb::_base_verbs[] = {
N_("Remove excess toolbars to focus on drawing"), nullptr),
new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
INKSCAPE_ICON("window-new")),
- new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"), N_("New View Preview"),
- nullptr /*"view_new_preview"*/),
new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"), N_("Switch to normal display mode"),
nullptr),
diff --git a/src/verbs.h b/src/verbs.h
index fec42cca2..eb22ae3e9 100644
--- a/src/verbs.h
+++ b/src/verbs.h
@@ -293,7 +293,6 @@ enum {
SP_VERB_FULLSCREENFOCUS,
SP_VERB_FOCUSTOGGLE,
SP_VERB_VIEW_NEW,
- SP_VERB_VIEW_NEW_PREVIEW,
SP_VERB_VIEW_MODE_NORMAL,
SP_VERB_VIEW_MODE_NO_FILTERS,
SP_VERB_VIEW_MODE_OUTLINE,