10660
by Jon A. Cruz
Doxygen cleanup. |
1 |
/**
|
2 |
* @file
|
|
3 |
* Document metadata dialog, Gtkmm-style.
|
|
6885
by Ted Gould
From trunk |
4 |
*/
|
5 |
/* Authors:
|
|
1
by mental
moving trunk for module inkscape |
6 |
* bulia byak <buliabyak@users.sf.net>
|
7 |
* Bryce W. Harrington <bryce@bryceharrington.org>
|
|
8 |
* Lauris Kaplinski <lauris@kaplinski.com>
|
|
9 |
* Jon Phillips <jon@rejon.org>
|
|
10 |
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
|
|
11 |
*
|
|
12 |
* Copyright (C) 2000 - 2006 Authors
|
|
13 |
*
|
|
14 |
* Released under GNU GPL. Read the file 'COPYING' for more information
|
|
15 |
*/
|
|
16 |
||
17 |
#ifdef HAVE_CONFIG_H
|
|
15034
by Adrian Boguszewski
Removed unused includes, decreased compilation time. Once again |
18 |
#include "config.h" |
1
by mental
moving trunk for module inkscape |
19 |
#endif
|
20 |
||
11018
by Alex Valavanis
Clean up all remaining false warnings from Gtkmm |
21 |
#include "document-metadata.h" |
7337
by tweenk
Move files from the src/dialogs/ directory to the places where they |
22 |
#include "desktop.h" |
13820
by Liam P. White
Remove sp_desktop_document and finish cleanup of desktop-handles.h |
23 |
|
7337
by tweenk
Move files from the src/dialogs/ directory to the places where they |
24 |
#include "rdf.h" |
25 |
#include "sp-namedview.h" |
|
1
by mental
moving trunk for module inkscape |
26 |
#include "ui/widget/entity-entry.h" |
7337
by tweenk
Move files from the src/dialogs/ directory to the places where they |
27 |
#include "verbs.h" |
1
by mental
moving trunk for module inkscape |
28 |
#include "xml/node-event-vector.h" |
29 |
||
30 |
||
31 |
namespace Inkscape { |
|
32 |
namespace UI { |
|
33 |
namespace Dialog { |
|
34 |
||
35 |
#define SPACE_SIZE_X 15
|
|
36 |
#define SPACE_SIZE_Y 15
|
|
37 |
||
38 |
//===================================================
|
|
39 |
||
40 |
//---------------------------------------------------
|
|
41 |
||
42 |
static void on_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar const *, bool, gpointer); |
|
43 |
||
44 |
static Inkscape::XML::NodeEventVector const _repr_events = { |
|
45 |
NULL, /* child_added */ |
|
46 |
NULL, /* child_removed */ |
|
47 |
on_repr_attr_changed, |
|
48 |
NULL, /* content_changed */ |
|
49 |
NULL /* order_changed */ |
|
50 |
};
|
|
51 |
||
52 |
||
4126
by gustav_b
The dialog to panel refactoring: |
53 |
DocumentMetadata & |
54 |
DocumentMetadata::getInstance() |
|
1
by mental
moving trunk for module inkscape |
55 |
{
|
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
56 |
DocumentMetadata &instance = *new DocumentMetadata(); |
57 |
instance.init(); |
|
58 |
return instance; |
|
1
by mental
moving trunk for module inkscape |
59 |
}
|
60 |
||
61 |
||
4126
by gustav_b
The dialog to panel refactoring: |
62 |
DocumentMetadata::DocumentMetadata() |
11952
by Alex Valavanis
Migrate document metadata from NotbookPage to Gtk::Grid and drop dead code |
63 |
: UI::Widget::Panel ("", "/dialogs/documentmetadata", SP_VERB_DIALOG_METADATA) |
1
by mental
moving trunk for module inkscape |
64 |
{
|
65 |
hide(); |
|
4126
by gustav_b
The dialog to panel refactoring: |
66 |
_getContents()->set_spacing (4); |
67 |
_getContents()->pack_start(_notebook, true, true); |
|
1
by mental
moving trunk for module inkscape |
68 |
|
11952
by Alex Valavanis
Migrate document metadata from NotbookPage to Gtk::Grid and drop dead code |
69 |
_page_metadata1.set_border_width(2); |
70 |
_page_metadata2.set_border_width(2); |
|
71 |
||
72 |
_page_metadata1.set_column_spacing(2); |
|
73 |
_page_metadata2.set_column_spacing(2); |
|
74 |
_page_metadata1.set_row_spacing(2); |
|
75 |
_page_metadata2.set_row_spacing(2); |
|
76 |
||
1
by mental
moving trunk for module inkscape |
77 |
_notebook.append_page(_page_metadata1, _("Metadata")); |
78 |
_notebook.append_page(_page_metadata2, _("License")); |
|
79 |
||
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
80 |
signalDocumentReplaced().connect(sigc::mem_fun(*this, &DocumentMetadata::_handleDocumentReplaced)); |
81 |
signalActivateDesktop().connect(sigc::mem_fun(*this, &DocumentMetadata::_handleActivateDesktop)); |
|
82 |
signalDeactiveDesktop().connect(sigc::mem_fun(*this, &DocumentMetadata::_handleDeactivateDesktop)); |
|
83 |
||
1
by mental
moving trunk for module inkscape |
84 |
build_metadata(); |
85 |
}
|
|
86 |
||
87 |
void
|
|
88 |
DocumentMetadata::init() |
|
89 |
{
|
|
90 |
update(); |
|
91 |
||
13810
by Liam P. White
Purge sp_desktop_namedview in favor of SPDesktop::getNamedView |
92 |
Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); |
1
by mental
moving trunk for module inkscape |
93 |
repr->addListener (&_repr_events, this); |
94 |
||
95 |
show_all_children(); |
|
96 |
}
|
|
97 |
||
4043
by joncruz
warning cleanup |
98 |
DocumentMetadata::~DocumentMetadata() |
1
by mental
moving trunk for module inkscape |
99 |
{
|
13810
by Liam P. White
Purge sp_desktop_namedview in favor of SPDesktop::getNamedView |
100 |
Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); |
1
by mental
moving trunk for module inkscape |
101 |
repr->removeListenerByData (this); |
102 |
||
10681
by Kris
cppcheck |
103 |
for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) |
1
by mental
moving trunk for module inkscape |
104 |
delete (*it); |
105 |
}
|
|
106 |
||
107 |
void
|
|
108 |
DocumentMetadata::build_metadata() |
|
109 |
{
|
|
9273
by Jon A. Cruz
Corrected "using namespace" contamination from ui/dialog header files. |
110 |
using Inkscape::UI::Widget::EntityEntry; |
111 |
||
1
by mental
moving trunk for module inkscape |
112 |
_page_metadata1.show(); |
113 |
||
13236
by Markus Engel
Added "Gtk::" scope to "manage" function calls. |
114 |
Gtk::Label *label = Gtk::manage (new Gtk::Label); |
1
by mental
moving trunk for module inkscape |
115 |
label->set_markup (_("<b>Dublin Core Entities</b>")); |
116 |
label->set_alignment (0.0); |
|
11952
by Alex Valavanis
Migrate document metadata from NotbookPage to Gtk::Grid and drop dead code |
117 |
|
118 |
label->set_valign(Gtk::ALIGN_CENTER); |
|
119 |
_page_metadata1.attach(*label, 0, 0, 3, 1); |
|
120 |
||
1
by mental
moving trunk for module inkscape |
121 |
/* add generic metadata entry areas */
|
122 |
struct rdf_work_entity_t * entity; |
|
123 |
int row = 1; |
|
124 |
for (entity = rdf_work_entities; entity && entity->name; entity++, row++) { |
|
125 |
if ( entity->editable == RDF_EDIT_GENERIC ) { |
|
10827
by Alex Valavanis
More deprecated GtkTooltips |
126 |
EntityEntry *w = EntityEntry::create (entity, _wr); |
1
by mental
moving trunk for module inkscape |
127 |
_rdflist.push_back (w); |
13236
by Markus Engel
Added "Gtk::" scope to "manage" function calls. |
128 |
Gtk::HBox *space = Gtk::manage (new Gtk::HBox); |
1
by mental
moving trunk for module inkscape |
129 |
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); |
11952
by Alex Valavanis
Migrate document metadata from NotbookPage to Gtk::Grid and drop dead code |
130 |
|
131 |
space->set_valign(Gtk::ALIGN_CENTER); |
|
132 |
_page_metadata1.attach(*space, 0, row, 1, 1); |
|
133 |
||
134 |
w->_label.set_valign(Gtk::ALIGN_CENTER); |
|
135 |
_page_metadata1.attach(w->_label, 1, row, 1, 1); |
|
136 |
||
137 |
w->_packable->set_hexpand(); |
|
138 |
w->_packable->set_valign(Gtk::ALIGN_CENTER); |
|
139 |
_page_metadata1.attach(*w->_packable, 2, row, 1, 1); |
|
1
by mental
moving trunk for module inkscape |
140 |
}
|
141 |
}
|
|
142 |
||
143 |
_page_metadata2.show(); |
|
144 |
||
145 |
row = 0; |
|
13236
by Markus Engel
Added "Gtk::" scope to "manage" function calls. |
146 |
Gtk::Label *llabel = Gtk::manage (new Gtk::Label); |
1
by mental
moving trunk for module inkscape |
147 |
llabel->set_markup (_("<b>License</b>")); |
148 |
llabel->set_alignment (0.0); |
|
11952
by Alex Valavanis
Migrate document metadata from NotbookPage to Gtk::Grid and drop dead code |
149 |
llabel->set_valign(Gtk::ALIGN_CENTER); |
150 |
_page_metadata2.attach(*llabel, 0, row, 3, 1); |
|
151 |
||
1
by mental
moving trunk for module inkscape |
152 |
/* add license selector pull-down and URI */
|
153 |
++row; |
|
10827
by Alex Valavanis
More deprecated GtkTooltips |
154 |
_licensor.init (_wr); |
13236
by Markus Engel
Added "Gtk::" scope to "manage" function calls. |
155 |
Gtk::HBox *space = Gtk::manage (new Gtk::HBox); |
1
by mental
moving trunk for module inkscape |
156 |
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); |
11952
by Alex Valavanis
Migrate document metadata from NotbookPage to Gtk::Grid and drop dead code |
157 |
space->set_valign(Gtk::ALIGN_CENTER); |
158 |
_page_metadata2.attach(*space, 0, row, 1, 1); |
|
159 |
||
160 |
_licensor.set_hexpand(); |
|
161 |
_licensor.set_valign(Gtk::ALIGN_CENTER); |
|
162 |
_page_metadata2.attach(_licensor, 1, row, 2, 1); |
|
1
by mental
moving trunk for module inkscape |
163 |
}
|
164 |
||
165 |
/**
|
|
166 |
* Update dialog widgets from desktop.
|
|
167 |
*/
|
|
10660
by Jon A. Cruz
Doxygen cleanup. |
168 |
void DocumentMetadata::update() |
1
by mental
moving trunk for module inkscape |
169 |
{
|
170 |
if (_wr.isUpdating()) return; |
|
4043
by joncruz
warning cleanup |
171 |
|
1
by mental
moving trunk for module inkscape |
172 |
_wr.setUpdating (true); |
173 |
set_sensitive (true); |
|
174 |
||
175 |
//-----------------------------------------------------------meta pages
|
|
176 |
/* update the RDF entities */
|
|
10681
by Kris
cppcheck |
177 |
for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); ++it) |
1
by mental
moving trunk for module inkscape |
178 |
(*it)->update (SP_ACTIVE_DOCUMENT); |
4043
by joncruz
warning cleanup |
179 |
|
1
by mental
moving trunk for module inkscape |
180 |
_licensor.update (SP_ACTIVE_DOCUMENT); |
181 |
||
182 |
_wr.setUpdating (false); |
|
183 |
}
|
|
184 |
||
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
185 |
void
|
8422
by cilix42
Revert recent refactoring changes by johnce because they break the build, which cannot be fixed easily. |
186 |
DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *) |
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
187 |
{
|
13810
by Liam P. White
Purge sp_desktop_namedview in favor of SPDesktop::getNamedView |
188 |
Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); |
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
189 |
repr->addListener (&_repr_events, this); |
190 |
update(); |
|
191 |
}
|
|
192 |
||
193 |
void
|
|
13341.5.9
by Liam P. White
5. Refactoring of Application class: make copy/assignment operators private, disallow pointers to Application |
194 |
DocumentMetadata::_handleActivateDesktop(SPDesktop *desktop) |
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
195 |
{
|
13810
by Liam P. White
Purge sp_desktop_namedview in favor of SPDesktop::getNamedView |
196 |
Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); |
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
197 |
repr->addListener(&_repr_events, this); |
198 |
update(); |
|
199 |
}
|
|
200 |
||
201 |
void
|
|
13341.5.9
by Liam P. White
5. Refactoring of Application class: make copy/assignment operators private, disallow pointers to Application |
202 |
DocumentMetadata::_handleDeactivateDesktop(SPDesktop *desktop) |
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
203 |
{
|
13810
by Liam P. White
Purge sp_desktop_namedview in favor of SPDesktop::getNamedView |
204 |
Inkscape::XML::Node *repr = desktop->getNamedView()->getRepr(); |
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
205 |
repr->removeListenerByData(this); |
206 |
}
|
|
207 |
||
1
by mental
moving trunk for module inkscape |
208 |
//--------------------------------------------------------------------
|
209 |
||
210 |
/**
|
|
211 |
* Called when XML node attribute changed; updates dialog widgets.
|
|
212 |
*/
|
|
10660
by Jon A. Cruz
Doxygen cleanup. |
213 |
static void on_repr_attr_changed(Inkscape::XML::Node *, gchar const *, gchar const *, gchar const *, bool, gpointer data) |
4188
by gustav_b
Rework dialog management. Use singleton behavior for dialogs when |
214 |
{
|
215 |
if (DocumentMetadata *dialog = static_cast<DocumentMetadata *>(data)) |
|
216 |
dialog->update(); |
|
217 |
}
|
|
1
by mental
moving trunk for module inkscape |
218 |
|
219 |
} // namespace Dialog |
|
220 |
} // namespace UI |
|
221 |
} // namespace Inkscape |
|
222 |
||
223 |
/*
|
|
224 |
Local Variables:
|
|
225 |
mode:c++
|
|
226 |
c-file-style:"stroustrup"
|
|
6885
by Ted Gould
From trunk |
227 |
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
|
1
by mental
moving trunk for module inkscape |
228 |
indent-tabs-mode:nil
|
229 |
fill-column:99
|
|
230 |
End:
|
|
231 |
*/
|
|
9900
by Chris Morgan
Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in all 1074 Vim modelines. |
232 |
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
|