summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/print.h
blob: d0152100afcdcffe7c55d6caf79ec53944e49678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
 * @brief Print dialog
 */
/* Authors:
 *   Kees Cook <kees@outflux.net>
 *
 * Copyright (C) 2007 Kees Cook
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#ifndef INKSCAPE_UI_DIALOG_PRINT_H
#define INKSCAPE_UI_DIALOG_PRINT_H

#include "ui/widget/rendering-options.h"
#include <gtkmm/printoperation.h> // GtkMM

class SPItem;
class SPDocument;


/*
 * gtk 2.12.0 has a bug (http://bugzilla.gnome.org/show_bug.cgi?id=482089)
 * where it fails to correctly deal with gtkmm signal management.  As a result
 * we have call gtk directly instead of doing a much cleaner version of
 * this printing dialog, using full gtkmmification.  (The bug was fixed
 * in 2.12.1, so when the Inkscape gtk minimum version is bumped there,
 * we can revert Inkscape commit 16865.
 */
struct workaround_gtkmm
{
    SPDocument *_doc;
    SPItem     *_base;
    Inkscape::UI::Widget::RenderingOptions *_tab;
};

namespace Inkscape {
namespace UI {
namespace Dialog {

struct PrinterSettings {
    Glib::RefPtr<Gtk::PrintSettings> _gtk_print_settings;
};

class Print {
public:
    Print(SPDocument *doc, SPItem *base);
    Gtk::PrintOperationResult run(Gtk::PrintOperationAction, Gtk::Window &parent_window);

protected:

private:
    Glib::RefPtr<Gtk::PrintOperation> _printop;
    SPDocument *_doc;
    SPItem     *_base;
    Inkscape::UI::Widget::RenderingOptions _tab;

    struct workaround_gtkmm _workaround;

    void draw_page(const Glib::RefPtr<Gtk::PrintContext>& context, int /*page_nr*/);
    Gtk::Widget *create_custom_widget();
    void begin_print(const Glib::RefPtr<Gtk::PrintContext>&);
};

} // namespace Dialog
} // namespace UI
} // namespace Inkscape

#endif // INKSCAPE_UI_DIALOG_PRINT_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 :