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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
// SPDX-License-Identifier: GPL-2.0-or-later
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
* Anshudhar Kumar Singh <anshudhar2001@gmail.com>
*
* Copyright (C) 1999-2007, 2021 Authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
#ifndef SP_EXPORT_BATCH_H
#define SP_EXPORT_BATCH_H
#include <gtkmm.h>
#include "ui/widget/scrollprotected.h"
class InkscapeApplication;
class SPDocument;
class SPDesktop;
namespace Inkscape {
class Preferences;
class Selection;
namespace UI {
namespace Dialog {
class ExportList;
class BatchItem;
class ExportProgressDialog;
class BatchExport : public Gtk::Box
{
public:
BatchExport() {};
BatchExport(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &refGlade)
: Gtk::Box(cobject){};
~BatchExport() override = default;
private:
InkscapeApplication *_app;
SPDesktop *_desktop = nullptr;
SPDocument *_document = nullptr;
private:
bool setupDone = false; // To prevent setup() call add connections again.
public:
void setApp(InkscapeApplication *app) { _app = app; }
void setDocument(SPDocument *document);
void setDesktop(SPDesktop *desktop);
void selectionChanged(Inkscape::Selection *selection);
void selectionModified(Inkscape::Selection *selection, guint flags);
void pagesChanged();
private:
enum selection_mode
{
SELECTION_LAYER = 0, // Default is alaways placed first
SELECTION_SELECTION,
SELECTION_PAGE,
};
private:
typedef Inkscape::UI::Widget::ScrollProtected<Gtk::SpinButton> SpinButton;
std::map<selection_mode, Gtk::RadioButton *> selection_buttons;
Gtk::FlowBox *preview_container = nullptr;
Gtk::CheckButton *show_preview = nullptr;
Gtk::Label *num_elements = nullptr;
Gtk::CheckButton *hide_all = nullptr;
Gtk::Entry *filename_entry = nullptr;
Gtk::Button *export_btn = nullptr;
Gtk::ProgressBar *_prog = nullptr;
ExportList *export_list = nullptr;
// Store all items to be displayed in flowbox
std::map<std::string, BatchItem *> current_items;
bool filename_modified;
Glib::ustring original_name;
Glib::ustring doc_export_name;
Inkscape::Preferences *prefs = nullptr;
std::map<selection_mode, Glib::ustring> selection_names;
selection_mode current_key;
public:
// initialise variables from builder
void initialise(const Glib::RefPtr<Gtk::Builder> &builder);
void setup();
private:
void setDefaultSelectionMode();
void onFilenameModified();
void onAreaTypeToggle(selection_mode key);
void onExport();
void onBrowse(Gtk::EntryIconPosition pos, const GdkEventButton *ev);
void refreshPreview();
void refreshItems();
void loadExportHints();
public:
void refresh()
{
refreshItems();
loadExportHints();
};
private:
void setExporting(bool exporting, Glib::ustring const &text = "");
ExportProgressDialog *create_progress_dialog(Glib::ustring progress_text);
/**
* Callback to be used in for loop to update the progress bar.
*
* @param value number between 0 and 1 indicating the fraction of progress (0.17 = 17 % progress)
* @param dlg void pointer to the Gtk::Dialog progress dialog
*/
static unsigned int onProgressCallback(float value, void *dlg);
/**
* Callback for pressing the cancel button.
*/
void onProgressCancel();
/**
* Callback invoked on closing the progress dialog.
*/
bool onProgressDelete(GdkEventAny *event);
private:
ExportProgressDialog *prog_dlg = nullptr;
bool interrupted;
// Gtk Signals
sigc::connection filenameConn;
sigc::connection exportConn;
sigc::connection browseConn;
sigc::connection selectionModifiedConn;
sigc::connection selectionChangedConn;
// SVG Signals
sigc::connection _pages_changed_connection;
};
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
#endif
/*
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 :
|