summaryrefslogtreecommitdiffstats
path: root/src/ui
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/ui
parentsimple fix in french translation (diff)
downloadinkscape-77f8d590d64320f587907322eb2aa9f88457e8c6.tar.gz
inkscape-77f8d590d64320f587907322eb2aa9f88457e8c6.zip
C++ify SVGViewWidget. Remove unused code.
Diffstat (limited to 'src/ui')
-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.cpp238
-rw-r--r--src/ui/view/svg-view.h100
-rw-r--r--src/ui/view/view-widget.h2
11 files changed, 652 insertions, 253 deletions
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/ui/view/svg-view.cpp b/src/ui/view/svg-view.cpp
new file mode 100644
index 000000000..6b90e8ccd
--- /dev/null
+++ b/src/ui/view/svg-view.cpp
@@ -0,0 +1,238 @@
+/*
+ * Functions and callbacks for generic SVG view and widget.
+ *
+ * Authors:
+ * Lauris Kaplinski <lauris@kaplinski.com>
+ * Ralf Stephan <ralf@ark.in-berlin.de>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
+ *
+ * Copyright (C) 2001-2002 Lauris Kaplinski
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <2geom/transforms.h>
+
+#include "ui/view/svg-view.h"
+
+#include "document.h"
+
+#include "display/canvas-arena.h"
+#include "display/drawing-group.h"
+
+#include "object/sp-item.h"
+#include "object/sp-root.h"
+
+#include "util/units.h"
+
+namespace Inkscape {
+namespace UI {
+namespace View {
+
+SVGView::SVGView(SPCanvasGroup *parent)
+{
+ _hscale = 1.0;
+ _vscale = 1.0;
+ _rescale = FALSE;
+ _keepaspect = FALSE;
+ _width = 0.0;
+ _height = 0.0;
+
+ _dkey = 0;
+ _drawing = nullptr;
+ _parent = parent;
+}
+
+SVGView::~SVGView()
+{
+ if (doc() && _drawing)
+ {
+ doc()->getRoot()->invoke_hide(_dkey);
+ _drawing = nullptr;
+ }
+}
+
+void SVGView::setScale(gdouble hscale, gdouble vscale)
+{
+ if (!_rescale && ((hscale != _hscale) || (vscale != _vscale))) {
+ _hscale = hscale;
+ _vscale = vscale;
+ doRescale (true);
+ }
+}
+
+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));
+
+ _rescale = rescale;
+ _keepaspect = keepaspect;
+ _width = width;
+ _height = height;
+
+ doRescale (true);
+}
+
+void SVGView::doRescale(bool event)
+{
+ if (!doc()) {
+ return;
+ }
+ if (doc()->getWidth().value("px") < 1e-9) {
+ return;
+ }
+ if (doc()->getHeight().value("px") < 1e-9) {
+ 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;
+ 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) * Geom::Translate(x_offset, y_offset));
+ }
+
+ if (event) {
+ emitResized (doc()->getWidth().value("px") * _hscale,
+ doc()->getHeight().value("px") * _vscale);
+ }
+}
+
+void SVGView::mouseover()
+{
+ GdkDisplay *display = gdk_display_get_default();
+ GdkCursor *cursor = gdk_cursor_new_for_display(display, GDK_HAND2);
+ GdkWindow *window = gtk_widget_get_window (GTK_WIDGET(SP_CANVAS_ITEM(_drawing)->canvas));
+ gdk_window_set_cursor(window, cursor);
+ g_object_unref(cursor);
+}
+
+void SVGView::mouseout()
+{
+ GdkWindow *window = gtk_widget_get_window (GTK_WIDGET(SP_CANVAS_ITEM(_drawing)->canvas));
+ gdk_window_set_cursor(window, nullptr);
+}
+
+//----------------------------------------------------------------
+/**
+ * Callback connected with arena_event.
+ */
+/// \todo fixme.
+static gint arena_handler(SPCanvasArena */*arena*/, Inkscape::DrawingItem *ai, GdkEvent *event, SVGView *svgview)
+{
+ static gdouble x, y;
+ static gboolean active = FALSE;
+ SPEvent spev;
+
+ SPItem *spitem = (ai) ? (static_cast<SPItem*>(ai->data())) : nullptr;
+
+ switch (event->type) {
+ case GDK_BUTTON_PRESS:
+ if (event->button.button == 1) {
+ active = TRUE;
+ x = event->button.x;
+ y = event->button.y;
+ }
+ break;
+ case GDK_BUTTON_RELEASE:
+ if (event->button.button == 1) {
+ if (active && (event->button.x == x) &&
+ (event->button.y == y)) {
+ spev.type = SP_EVENT_ACTIVATE;
+ if ( spitem != nullptr )
+ {
+ spitem->emitEvent (spev);
+ }
+ }
+ }
+ active = FALSE;
+ break;
+ case GDK_MOTION_NOTIFY:
+ active = FALSE;
+ break;
+ case GDK_ENTER_NOTIFY:
+ spev.type = SP_EVENT_MOUSEOVER;
+ spev.data = svgview;
+ if ( spitem != nullptr )
+ {
+ spitem->emitEvent (spev);
+ }
+ break;
+ case GDK_LEAVE_NOTIFY:
+ spev.type = SP_EVENT_MOUSEOUT;
+ spev.data = svgview;
+ if ( spitem != nullptr )
+ {
+ spitem->emitEvent (spev);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return TRUE;
+}
+
+void SVGView::setDocument(SPDocument *document)
+{
+ if (doc()) {
+ doc()->getRoot()->invoke_hide(_dkey);
+ }
+
+ if (!_drawing) {
+ _drawing = sp_canvas_item_new (_parent, SP_TYPE_CANVAS_ARENA, nullptr);
+ g_signal_connect (G_OBJECT (_drawing), "arena_event", G_CALLBACK (arena_handler), this);
+ }
+
+ View::setDocument (document);
+
+ if (document) {
+ Inkscape::DrawingItem *ai = document->getRoot()->invoke_show(
+ SP_CANVAS_ARENA (_drawing)->drawing,
+ _dkey,
+ SP_ITEM_SHOW_DISPLAY);
+
+ if (ai) {
+ SP_CANVAS_ARENA (_drawing)->drawing.root()->prependChild(ai);
+ }
+
+ doRescale (!_rescale);
+ }
+}
+
+void SVGView::onDocumentResized(gdouble width, gdouble height)
+{
+ setScale (width, height);
+ doRescale (!_rescale);
+}
+
+}
+}
+}
+
+/*
+ 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/ui/view/svg-view.h b/src/ui/view/svg-view.h
new file mode 100644
index 000000000..23698eb36
--- /dev/null
+++ b/src/ui/view/svg-view.h
@@ -0,0 +1,100 @@
+#ifndef SEEN_SVG_VIEW_H
+#define SEEN_SVG_VIEW_H
+/*
+ * Authors:
+ * Lauris Kaplinski <lauris@kaplinski.com>
+ * Ralf Stephan <ralf@ark.in-berlin.de>
+ *
+ * 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.h"
+
+struct SPCanvasGroup;
+struct SPCanvasItem;
+
+namespace Inkscape {
+namespace UI {
+namespace View {
+
+/**
+ * Generic SVG view.
+ */
+class SVGView : public View {
+public:
+ unsigned int _dkey;
+ SPCanvasGroup *_parent;
+ SPCanvasItem *_drawing;
+ double _hscale; ///< horizontal scale
+ double _vscale; ///< vertical scale
+ bool _rescale; ///< whether to rescale automatically
+ bool _keepaspect;
+ double _width;
+ double _height;
+
+
+ /**
+ * Constructs new SPSVGView object and returns pointer to it.
+ */
+ SVGView(SPCanvasGroup* parent);
+
+ ~SVGView() override;
+
+ /**
+ * Rescales SPSVGView to given proportions.
+ */
+ void setScale(double hscale, double vscale);
+
+ /**
+ * Rescales SPSVGView and keeps aspect ratio.
+ */
+ void setRescale(bool rescale, bool keepaspect, double width, double height);
+
+ /**
+ * Helper function that sets rescale ratio and emits resize event.
+ */
+ void doRescale(bool event);
+
+ /**
+ * Callback connected with set_document signal.
+ */
+ void setDocument(SPDocument *document) override;
+
+ void mouseover() override;
+
+ void mouseout() override;
+
+ bool shutdown() override { return true; }
+
+private:
+ virtual void onPositionSet(double, double) {}
+ void onResized(double, double) override {}
+ void onRedrawRequested() override {}
+ void onStatusMessage(Inkscape::MessageType /*type*/, gchar const */*message*/) override {}
+ void onDocumentURISet(gchar const* /*uri*/) override {}
+
+ /**
+ * Callback connected with document_resized signal.
+ */
+ void onDocumentResized(double, double) override;
+};
+
+}
+}
+}
+
+#endif // SEEN_SVG_VIEW_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 :
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;