From 35a96bde514a8897f6f0fcc41c5833bf63df2e2a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:29:01 +0200 Subject: Adding upstream version 1.0.2. Signed-off-by: Daniel Baumann --- src/ui/dialog/svg-preview.h | 123 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/ui/dialog/svg-preview.h (limited to 'src/ui/dialog/svg-preview.h') diff --git a/src/ui/dialog/svg-preview.h b/src/ui/dialog/svg-preview.h new file mode 100644 index 0000000..8263e15 --- /dev/null +++ b/src/ui/dialog/svg-preview.h @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** @file + * @brief Implementation of the file dialog interfaces defined in filedialogimpl.h + */ +/* Authors: + * Bob Jamison + * Johan Engelen + * Joel Holdsworth + * Bruno Dilly + * Other dudes from The Inkscape Organization + * + * Copyright (C) 2004-2008 Authors + * Copyright (C) 2004-2007 The Inkscape Organization + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#ifndef __SVG_PREVIEW_H__ +#define __SVG_PREVIEW_H__ + +//Gtk includes +#include + +//General includes +#include +#include +#include + +#include "filedialog.h" + + +namespace Gtk { +class Expander; +} + +namespace Inkscape { + class URI; + +namespace UI { + +namespace View { + class SVGViewWidget; +} + +namespace Dialog { + +/*######################################################################### +### SVG Preview Widget +#########################################################################*/ + +/** + * Simple class for displaying an SVG file in the "preview widget." + * Currently, this is just a wrapper of the sp_svg_view Gtk widget. + * Hopefully we will eventually replace with a pure Gtkmm widget. + */ +class SVGPreview : public Gtk::VBox +{ +public: + + SVGPreview(); + + ~SVGPreview() override; + + bool setDocument(SPDocument *doc); + + bool setFileName(Glib::ustring &fileName); + + bool setFromMem(char const *xmlBuffer); + + bool set(Glib::ustring &fileName, int dialogType); + + bool setURI(URI &uri); + + /** + * Show image embedded in SVG + */ + void showImage(Glib::ustring &fileName); + + /** + * Show the "No preview" image + */ + void showNoPreview(); + + /** + * Show the "Too large" image + */ + void showTooLarge(long fileLength); + +private: + /** + * The svg document we are currently showing + */ + SPDocument *document; + + /** + * The sp_svg_view widget + */ + Inkscape::UI::View::SVGViewWidget *viewer; + + /** + * are we currently showing the "no preview" image? + */ + bool showingNoPreview; + +}; + + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape + +#endif /*__SVG_PREVIEW_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 : -- cgit v1.2.3