summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorDenis Declara <declara91@gmail.com>2012-04-26 11:14:34 +0000
committerDenis Declara <declara91@gmail.com>2012-04-26 11:14:34 +0000
commit95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4 (patch)
tree506de5a8437cb39917a66d74b68d78692d10a993 /src/ui
parentAdded first support for elliptical arrangements (diff)
parentpowerstroke: cautious fix. (diff)
downloadinkscape-95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4.tar.gz
inkscape-95a8ad7bfec98f7cede15c4e8856ce547aaf4aa4.zip
Trunk merge
(bzr r11073.1.20)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/CMakeLists.txt2
-rw-r--r--src/ui/dialog/align-and-distribute.h3
-rw-r--r--src/ui/dialog/export.cpp569
-rw-r--r--src/ui/dialog/export.h67
-rw-r--r--src/ui/dialog/find.cpp6
-rw-r--r--src/ui/dialog/find.h73
-rw-r--r--src/ui/dialog/icon-preview.cpp5
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp9
-rw-r--r--src/ui/dialog/input.cpp25
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp1
-rw-r--r--src/ui/dialog/livepatheffect-editor.h4
-rw-r--r--src/ui/dialog/object-properties.cpp3
-rw-r--r--src/ui/dialog/object-properties.h5
-rw-r--r--src/ui/dialog/ocaldialogs.cpp6
-rw-r--r--src/ui/dialog/text-edit.cpp3
-rw-r--r--src/ui/dialog/text-edit.h3
-rw-r--r--src/ui/dialog/tracedialog.cpp13
-rw-r--r--src/ui/previewholder.cpp28
-rw-r--r--src/ui/widget/Makefile_insert2
-rw-r--r--src/ui/widget/frame.cpp83
-rw-r--r--src/ui/widget/frame.h79
-rw-r--r--src/ui/widget/selected-style.cpp2
-rw-r--r--src/ui/widget/toolbox.cpp11
23 files changed, 599 insertions, 403 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index c00590ae1..2c6a68569 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -80,6 +80,7 @@ set(ui_SRC
widget/dock.cpp
widget/entity-entry.cpp
widget/entry.cpp
+ widget/frame.cpp
widget/filter-effect-chooser.cpp
widget/handlebox.cpp
widget/icon-widget.cpp
@@ -211,6 +212,7 @@ set(ui_SRC
widget/dock.h
widget/entity-entry.h
widget/entry.h
+ widget/frame.h
widget/filter-effect-chooser.h
widget/handlebox.h
widget/icon-widget.h
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index 7edf9c30c..59cc0dba4 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -17,6 +17,7 @@
#include <list>
#include "ui/widget/panel.h"
+#include "ui/widget/frame.h"
#include <gtkmm/frame.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/label.h>
@@ -107,7 +108,7 @@ protected:
#endif
std::list<Action *> _actionList;
- Gtk::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame;
+ UI::Widget::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame;
#if WITH_GTKMM_3_0
Gtk::Grid _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable;
#else
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 060a10f63..af5788ac6 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -94,8 +94,8 @@ namespace Dialog {
Export::Export (void) :
UI::Widget::Panel ("", "/dialogs/export/", SP_VERB_DIALOG_EXPORT),
current_key(SELECTION_PAGE),
- original_name(NULL),
- doc_export_name(NULL),
+ original_name(),
+ doc_export_name(),
filename_modified(false),
was_empty(true),
update(false),
@@ -116,6 +116,8 @@ Export::Export (void) :
button_box(Gtk::BUTTONBOX_END),
export_label(_("_Export"), 1),
export_image(Gtk::StockID(Gtk::Stock::APPLY), Gtk::ICON_SIZE_BUTTON),
+ prog_dlg(NULL),
+ interrupted(false),
prefs(NULL),
desktop(NULL),
deskTrack(),
@@ -164,27 +166,27 @@ Export::Export (void) :
t->set_col_spacings (4);
x0_adj = createSpinbutton ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, unit_selector->gobj(),
- GTK_WIDGET(t->gobj()), 0, 0, _("_x0:"), NULL, EXPORT_COORD_PRECISION, 1,
+ t, 0, 0, _("_x0:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaX0Change);
x1_adj = createSpinbutton ( "x1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, unit_selector->gobj(),
- GTK_WIDGET(t->gobj()), 2, 0, _("x_1:"), NULL, EXPORT_COORD_PRECISION, 1,
+ t, 2, 0, _("x_1:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaX1Change);
width_adj = createSpinbutton ( "width", 0.0, 0.0, PNG_UINT_31_MAX, 0.1, 1.0,
- unit_selector->gobj(), GTK_WIDGET(t->gobj()), 4, 0, _("Wid_th:"), NULL, EXPORT_COORD_PRECISION, 1,
+ unit_selector->gobj(), t, 4, 0, _("Wid_th:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaWidthChange);
y0_adj = createSpinbutton ( "y0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, unit_selector->gobj(),
- GTK_WIDGET(t->gobj()), 0, 1, _("_y0:"), NULL, EXPORT_COORD_PRECISION, 1,
+ t, 0, 1, _("_y0:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaY0Change);
y1_adj = createSpinbutton ( "y1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, unit_selector->gobj(),
- GTK_WIDGET(t->gobj()), 2, 1, _("y_1:"), NULL, EXPORT_COORD_PRECISION, 1,
+ t, 2, 1, _("y_1:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaY1Change);
height_adj = createSpinbutton ( "height", 0.0, 0.0, PNG_UINT_31_MAX, 0.1, 1.0,
- unit_selector->gobj(), GTK_WIDGET(t->gobj()), 4, 1, _("Hei_ght:"), NULL, EXPORT_COORD_PRECISION, 1,
+ unit_selector->gobj(), t, 4, 1, _("Hei_ght:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaHeightChange);
area_box.pack_start(togglebox, false, false, 3);
@@ -213,18 +215,18 @@ Export::Export (void) :
size_box.pack_start(*t);
bmwidth_adj = createSpinbutton ( "bmwidth", 16.0, 1.0, 1000000.0, 1.0, 10.0,
- NULL, GTK_WIDGET(t->gobj()), 0, 0,
+ NULL, t, 0, 0,
_("_Width:"), _("pixels at"), 0, 1,
&Export::onBitmapWidthChange);
xdpi_adj = createSpinbutton ( "xdpi",
prefs->getDouble("/dialogs/export/defaultxdpi/value", DPI_BASE),
- 0.01, 100000.0, 0.1, 1.0, NULL, GTK_WIDGET(t->gobj()), 3, 0,
- NULL, _("dp_i"), 2, 1,
+ 0.01, 100000.0, 0.1, 1.0, NULL, t, 3, 0,
+ "", _("dp_i"), 2, 1,
&Export::onExportXdpiChange);
bmheight_adj = createSpinbutton ( "bmheight", 16.0, 1.0, 1000000.0, 1.0, 10.0,
- NULL, GTK_WIDGET(t->gobj()), 0, 1,
+ NULL, t, 0, 1,
_("_Height:"), _("pixels at"), 0, 1,
&Export::onBitmapHeightChange);
@@ -232,8 +234,8 @@ Export::Export (void) :
* There's no way to set ydpi currently, so we use the defaultxdpi value here, too...
*/
ydpi_adj = createSpinbutton ( "ydpi", prefs->getDouble("/dialogs/export/defaultxdpi/value", DPI_BASE),
- 0.01, 100000.0, 0.1, 1.0, NULL, GTK_WIDGET(t->gobj()), 3, 1,
- NULL, _("dpi"), 2, 0, NULL );
+ 0.01, 100000.0, 0.1, 1.0, NULL, t, 3, 1,
+ "", _("dpi"), 2, 0, NULL );
singleexport_box.pack_start(size_box);
}
@@ -262,7 +264,7 @@ Export::Export (void) :
file_box.add(filename_box);
- original_name = g_strdup(filename_entry.get_text().c_str());
+ original_name = filename_entry.get_text();
// focus is in the filename initially:
filename_entry.grab_focus();
@@ -317,10 +319,6 @@ Export::Export (void) :
Export::~Export (void)
{
- g_free(original_name);
- original_name = NULL;
- g_free(doc_export_name);
- doc_export_name = NULL;
was_empty = TRUE;
selectModifiedConn.disconnect();
@@ -353,7 +351,6 @@ void Export::setTargetDesktop(SPDesktop *desktop)
//// Must check flags, so can't call widget_setup() directly.
selectModifiedConn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &Export::onSelectionModified)));
}
- //widget_setup();
}
}
@@ -406,77 +403,49 @@ void Export::set_default_filename () {
g_free(name);
}
- doc_export_name = g_strdup(filename_entry.get_text().c_str());
+ doc_export_name = filename_entry.get_text();
}
}
-/**
- * Creates a new spin button for the export dialog.
- * @param key The name of the spin button
- * @param val A default value for the spin button
- * @param min Minimum value for the spin button
- * @param max Maximum value for the spin button
- * @param step The step size for the spin button
- * @param page Size of the page increment
- * @param us Unit selector that effects this spin button
- * @param t Table to put the spin button in
- * @param x X location in the table \c t to start with
- * @param y Y location in the table \c t to start with
- * @param ll Text to put on the left side of the spin button (optional)
- * @param lr Text to put on the right side of the spin button (optional)
- * @param digits Number of digits to display after the decimal
- * @param sensitive Whether the spin button is sensitive or not
- * @param cb Callback for when this spin button is changed (optional)
- */
Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max,
float step, float page, GtkWidget *us,
- GtkWidget *t, int x, int y,
- const gchar *ll, const gchar *lr,
+ Gtk::Table *t, int x, int y,
+ const Glib::ustring ll, const Glib::ustring lr,
int digits, unsigned int sensitive,
void (Export::*cb)() )
{
Gtk::Adjustment *adj = new Gtk::Adjustment ( val, min, max, step, page, 0 );
-
if (us) {
- sp_unit_selector_add_adjustment ( SP_UNIT_SELECTOR (us),
- GTK_ADJUSTMENT (adj->gobj()) );
+ sp_unit_selector_add_adjustment ( SP_UNIT_SELECTOR (us), GTK_ADJUSTMENT (adj->gobj()) );
}
int pos = 0;
+ Gtk::Label *l = NULL;
- GtkWidget *l = NULL;
-
- if (ll) {
-
- l = gtk_label_new_with_mnemonic ((const gchar *)ll);
- gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5);
- gtk_table_attach ( GTK_TABLE (t), l, x + pos, x + pos + 1, y, y + 1,
- (GtkAttachOptions)0, (GtkAttachOptions)0, 0, 0 );
- gtk_widget_set_sensitive (l, sensitive);
- pos += 1;
-
+ if (!ll.empty()) {
+ l = new Gtk::Label(ll,true);
+ l->set_alignment (1.0, 0.5);
+ t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 );
+ l->set_sensitive(sensitive);
+ pos++;
}
- GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (adj->gobj()), 1.0, digits);
- gtk_table_attach ( GTK_TABLE (t), sb, x + pos, x + pos + 1, y, y + 1,
- (GtkAttachOptions)0, (GtkAttachOptions)0, 0, 0 );
- gtk_widget_set_size_request (sb, 80, -1);
- gtk_widget_set_sensitive (sb, sensitive);
- pos += 1;
+ Gtk::SpinButton *sb = new Gtk::SpinButton(*adj, 1.0, digits);
+ t->attach (*sb, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 );
+ sb->set_size_request (80, -1);
+ sb->set_sensitive (sensitive);
+ pos++;
- if (ll) { gtk_label_set_mnemonic_widget (GTK_LABEL(l), sb); }
+ if (!ll.empty()) { l->set_mnemonic_widget(*sb);}
- if (lr) {
-
- l = gtk_label_new_with_mnemonic ((const gchar *)lr);
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
- gtk_table_attach ( GTK_TABLE (t), l, x + pos, x + pos + 1, y, y + 1,
- (GtkAttachOptions)0, (GtkAttachOptions)0, 0, 0 );
- gtk_widget_set_sensitive (l, sensitive);
- pos += 1;
-
- gtk_label_set_mnemonic_widget (GTK_LABEL(l), sb);
+ if (!lr.empty()) {
+ l = new Gtk::Label(lr,true);
+ l->set_alignment (0.0, 0.5);
+ t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 );
+ l->set_sensitive (sensitive);
+ pos++;
+ l->set_mnemonic_widget (*sb);
}
if (cb) {
@@ -487,40 +456,36 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl
} // end of createSpinbutton()
-gchar* Export::create_filepath_from_id (const gchar *id, const gchar *file_entry_text) {
-
- if (id == NULL) /* This should never happen */
+Glib::ustring Export::create_filepath_from_id (Glib::ustring id, const Glib::ustring &file_entry_text)
+{
+ if (id.empty())
+ { /* This should never happen */
id = "bitmap";
+ }
- gchar *directory = NULL;
+ Glib::ustring directory;
- if (directory == NULL && file_entry_text != NULL && file_entry_text[0] != '\0') {
- // std::cout << "Directory from dialog" << std::endl;
- directory = g_path_get_dirname(file_entry_text);
+ if (!file_entry_text.empty()) {
+ directory = Glib::path_get_dirname(file_entry_text);
}
- if (directory == NULL) {
+ if (directory.empty()) {
/* Grab document directory */
- if ( SP_ACTIVE_DOCUMENT->getURI() ) {
- // std::cout << "Directory from document" << std::endl;
- directory = g_path_get_dirname( SP_ACTIVE_DOCUMENT->getURI() );
+ const gchar* docURI = SP_ACTIVE_DOCUMENT->getURI();
+ if (docURI) {
+ directory = Glib::path_get_dirname(docURI);
}
}
- if (directory == NULL) {
- // std::cout << "Home Directory" << std::endl;
+ if (directory.empty()) {
directory = homedir_path(NULL);
}
- gchar * id_ext = g_strconcat(id, ".png", NULL);
- gchar *filename = g_build_filename(directory, id_ext, NULL);
- g_free(directory);
- g_free(id_ext);
+ Glib::ustring filename = Glib::build_filename(directory, id+".png");
return filename;
}
-void
-Export::onBatchClicked ()
+void Export::onBatchClicked ()
{
if (batch_export.get_active()) {
singleexport_box.set_sensitive(false);
@@ -546,8 +511,7 @@ void Export::updateCheckbuttons ()
}
}
-inline void
-Export::findDefaultSelection()
+inline void Export::findDefaultSelection()
{
selection_type key = SELECTION_NUMBER_OF;
@@ -609,6 +573,7 @@ void Export::onSelectionChanged()
void Export::onSelectionModified ( guint /*flags*/ )
{
+ Inkscape::Selection * Sel;
switch (current_key) {
case SELECTION_DRAWING:
if ( SP_ACTIVE_DESKTOP ) {
@@ -624,12 +589,16 @@ void Export::onSelectionModified ( guint /*flags*/ )
}
break;
case SELECTION_SELECTION:
- if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
- Geom::OptRect bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->visualBounds();
- setArea ( bbox->left(),
+ Sel = sp_desktop_selection(SP_ACTIVE_DESKTOP);
+ if (Sel->isEmpty() == false) {
+ Geom::OptRect bbox = Sel->visualBounds();
+ if (bbox)
+ {
+ setArea ( bbox->left(),
bbox->top(),
bbox->right(),
bbox->bottom());
+ }
}
break;
default:
@@ -717,20 +686,18 @@ void Export::onAreaToggled ()
if (SP_ACTIVE_DESKTOP && !filename_modified) {
- const gchar * filename = NULL;
+ Glib::ustring filename;
float xdpi = 0.0, ydpi = 0.0;
switch (key) {
case SELECTION_PAGE:
case SELECTION_DRAWING: {
SPDocument * doc = SP_ACTIVE_DOCUMENT;
- sp_document_get_export_hints (doc, &filename, &xdpi, &ydpi);
+ sp_document_get_export_hints (doc, filename, &xdpi, &ydpi);
- if (filename == NULL) {
- if (doc_export_name != NULL) {
- filename = g_strdup(doc_export_name);
- } else {
- filename = g_strdup("");
+ if (filename.empty()) {
+ if (!doc_export_name.empty()) {
+ filename = doc_export_name;
}
}
break;
@@ -738,11 +705,11 @@ void Export::onAreaToggled ()
case SELECTION_SELECTION:
if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
- sp_selection_get_export_hints (sp_desktop_selection(SP_ACTIVE_DESKTOP), &filename, &xdpi, &ydpi);
+ sp_selection_get_export_hints (sp_desktop_selection(SP_ACTIVE_DESKTOP), filename, &xdpi, &ydpi);
/* If we still don't have a filename -- let's build
one that's nice */
- if (filename == NULL) {
+ if (filename.empty()) {
const gchar * id = NULL;
const GSList * reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
for(; reprlst != NULL; reprlst = reprlst->next) {
@@ -753,7 +720,7 @@ void Export::onAreaToggled ()
}
}
- filename = create_filepath_from_id (id, filename_entry.get_text().c_str());
+ filename = create_filepath_from_id (id, filename_entry.get_text());
}
}
break;
@@ -762,9 +729,8 @@ void Export::onAreaToggled ()
break;
}
- if (filename != NULL) {
- g_free(original_name);
- original_name = g_strdup(filename);
+ if (!filename.empty()) {
+ original_name = filename;
filename_entry.set_text(filename);
}
@@ -784,75 +750,61 @@ void Export::onAreaToggled ()
} // end of sp_export_area_toggled()
/// Called when dialog is deleted
-
-gint Export::onProgressDelete ( GtkWidget * /*widget*/, GdkEvent * /*event*/, GObject *base )
+bool Export::onProgressDelete (GdkEventAny * /*event*/)
{
- g_object_set_data (base, "cancel", (gpointer) 1);
+ interrupted = true;
return TRUE;
} // end of sp_export_progress_delete()
/// Called when progress is cancelled
-void Export::onProgressCancel ( GtkWidget * /*widget*/, GObject *base )
+void Export::onProgressCancel ()
{
- g_object_set_data (base, "cancel", (gpointer) 1);
+ interrupted = true;
} // end of sp_export_progress_cancel()
/// Called for every progress iteration
-unsigned int Export::onProgressCallback (float value, void *data)
+unsigned int Export::onProgressCallback (float value, void *dlg)
{
- GtkWidget *prg;
- int evtcount;
-
- if (g_object_get_data ((GObject *) data, "cancel"))
+ Gtk::Dialog *dlg2 = reinterpret_cast<Gtk::Dialog*>(dlg);
+ if (dlg2->get_data("cancel")){
return FALSE;
+ }
- prg = (GtkWidget *) g_object_get_data ((GObject *) data, "progress");
- gtk_progress_bar_set_fraction ((GtkProgressBar *) prg, value);
+ Gtk::ProgressBar *prg = (Gtk::ProgressBar *) dlg2->get_data ("progress");
+ prg->set_fraction(value);
- evtcount = 0;
+ int evtcount = 0;
while ((evtcount < 16) && gdk_events_pending ()) {
gtk_main_iteration_do (FALSE);
evtcount += 1;
}
gtk_main_iteration_do (FALSE);
-
return TRUE;
-
} // end of sp_export_progress_callback()
-GtkWidget * Export::create_progress_dialog (Glib::ustring progress_text) {
- GtkWidget *dlg, *prg, *btn; /* progressbar dlg widgets */
-
- dlg = gtk_dialog_new ();
-
- GtkObject *base = GTK_OBJECT(dlg);
-
- gtk_window_set_title (GTK_WINDOW (dlg), _("Export in progress"));
- prg = gtk_progress_bar_new ();
- //sp_transientize (dlg);
- gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
- g_object_set_data ((GObject *) base, "progress", prg);
-
- gtk_progress_bar_set_text ((GtkProgressBar *) prg, progress_text.c_str());
+Gtk::Dialog * Export::create_progress_dialog (Glib::ustring progress_text) {
+ Gtk::Dialog *dlg = new Gtk::Dialog(_("Export in progress"), TRUE);
+
+ Gtk::ProgressBar *prg = new Gtk::ProgressBar ();
+ prg->set_text(progress_text);
+ prg->set_orientation(Gtk::PROGRESS_LEFT_TO_RIGHT);
+ dlg->set_data ("progress", prg);
+#if GTK_CHECK_VERSION(3,0,0)
+ Gtk::Box* CA = dlg->get_content_area();
+#else
+ Gtk::Box* CA = dlg->get_vbox();
+#endif
+ CA->pack_start(*prg, FALSE, FALSE, 4);
- gtk_progress_bar_set_orientation ( (GtkProgressBar *) prg,
- GTK_PROGRESS_LEFT_TO_RIGHT);
- gtk_box_pack_start ((GtkBox *) gtk_dialog_get_content_area((GtkDialog *) dlg),
- prg, FALSE, FALSE, 4 );
- btn = gtk_dialog_add_button ( GTK_DIALOG (dlg),
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL );
+ Gtk::Button* btn = dlg->add_button (Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
- g_signal_connect ( (GObject *) dlg, "delete_event",
- (GCallback) onProgressDelete, base);
- g_signal_connect ( (GObject *) btn, "clicked",
- (GCallback) onProgressCancel, base);
- gtk_window_set_modal ((GtkWindow *) dlg, TRUE);
- gtk_widget_show_all (dlg);
+ btn->signal_clicked().connect( sigc::mem_fun(*this, &Export::onProgressCancel) );
+ dlg->signal_delete_event().connect( sigc::mem_fun(*this, &Export::onProgressDelete) );
+ dlg->show_all ();
return dlg;
}
@@ -879,19 +831,18 @@ Glib::ustring Export::filename_add_extension (Glib::ustring filename, Glib::ustr
}
}
-gchar *Export::absolutize_path_from_document_location (SPDocument *doc, const gchar *filename)
+Glib::ustring Export::absolutize_path_from_document_location (SPDocument *doc, const Glib::ustring &filename)
{
- gchar *path = 0;
+ Glib::ustring path;
//Make relative paths go from the document location, if possible:
- if (!g_path_is_absolute(filename) && doc->getURI()) {
- gchar *dirname = g_path_get_dirname(doc->getURI());
- if (dirname) {
- path = g_build_filename(dirname, filename, NULL);
- g_free(dirname);
+ if (!Glib::path_is_absolute(filename) && doc->getURI()) {
+ Glib::ustring dirname = Glib::path_get_dirname(doc->getURI());
+ if (!dirname.empty()) {
+ path = Glib::build_filename(dirname, filename);
}
}
- if (!path) {
- path = g_strdup(filename);
+ if (path.empty()) {
+ path = filename;
}
return path;
}
@@ -914,18 +865,22 @@ void Export::onExport ()
if (num < 1)
return;
- GtkWidget *prog_dlg = create_progress_dialog (Glib::ustring::compose(_("Exporting %1 files"),num));
+ prog_dlg = create_progress_dialog (Glib::ustring::compose(_("Exporting %1 files"),num));
for (GSList *i = const_cast<GSList *>(sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList());
- i != NULL;
- i = i->next) {
+ i != NULL;
+ i = i->next) {
+ if (interrupted){
+ break;
+ }
SPItem *item = reinterpret_cast<SPItem *>(i->data);
// retrieve export filename hint
const gchar *filename = item->getRepr()->attribute("inkscape:export-filename");
- gchar *path = NULL;
+ Glib::ustring path;
if (!filename) {
- path = create_filepath_from_id(item->getId(), NULL);
+ Glib::ustring tmp;
+ path = create_filepath_from_id(item->getId(), tmp);
} else {
path = absolutize_path_from_document_location(doc, filename);
}
@@ -947,14 +902,14 @@ void Export::onExport ()
if (width > 1 && height > 1) {
/* Do export */
- if (!sp_export_png_file (doc, path,
+ if (!sp_export_png_file (doc, path.c_str(),
*area, width, height, dpi, dpi,
nv->pagecolor,
NULL, NULL, TRUE, // overwrite without asking
hide ? const_cast<GSList *>(sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList()) : NULL
)) {
gchar * error;
- gchar * safeFile = Inkscape::IO::sanitizeString(path);
+ gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str());
error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
sp_ui_error_dialog(error);
g_free(safeFile);
@@ -963,148 +918,96 @@ void Export::onExport ()
}
}
n++;
- g_free(path);
onProgressCallback((float)n/num, prog_dlg);
}
- gtk_widget_destroy (prog_dlg);
- //g_object_set_data (G_OBJECT (base), "cancel", (gpointer) 0);
+ delete prog_dlg;
+ prog_dlg = NULL;
+ interrupted = false;
} else {
+ Glib::ustring filename = filename_entry.get_text();
- Glib::ustring filename = filename_entry.get_text();
+ if (filename.empty()){
+ sp_ui_error_dialog(_("You have to enter a filename"));
+ return;
+ }
+
+ float const x0 = getValuePx(x0_adj);
+ float const y0 = getValuePx(y0_adj);
+ float const x1 = getValuePx(x1_adj);
+ float const y1 = getValuePx(y1_adj);
+ float const xdpi = getValue(xdpi_adj);
+ float const ydpi = getValue(ydpi_adj);
+ unsigned long int const width = int(getValue(bmwidth_adj) + 0.5);
+ unsigned long int const height = int(getValue(bmheight_adj) + 0.5);
+
+ if (!((x1 > x0) && (y1 > y0) && (width > 0) && (height > 0))) {
+ sp_ui_error_dialog (_("The chosen area to be exported is invalid"));
+ return;
+ }
- if (filename.empty()){
- sp_ui_error_dialog(_("You have to enter a filename"));
- return;
- }
-
- float const x0 = getValuePx(x0_adj);
- float const y0 = getValuePx(y0_adj);
- float const x1 = getValuePx(x1_adj);
- float const y1 = getValuePx(y1_adj);
- float const xdpi = getValue(xdpi_adj);
- float const ydpi = getValue(ydpi_adj);
- unsigned long int const width = int(getValue(bmwidth_adj) + 0.5);
- unsigned long int const height = int(getValue(bmheight_adj) + 0.5);
-
- if (!((x1 > x0) && (y1 > y0) && (width > 0) && (height > 0))) {
- sp_ui_error_dialog (_("The chosen area to be exported is invalid"));
- return;
- }
+ // make sure that .png is the extension of the file:
+ Glib::ustring const filename_ext = filename_add_extension(filename, "png");
+ filename_entry.set_text(filename_ext);
+ Glib::ustring path = absolutize_path_from_document_location(doc, filename_ext);
- // make sure that .png is the extension of the file:
- Glib::ustring const filename_ext = filename_add_extension(filename, "png");
- filename_entry.set_text(filename_ext);
- gchar *path = absolutize_path_from_document_location(doc, filename_ext.c_str());
+ Glib::ustring dirname = Glib::path_get_dirname(path);
+ if ( dirname.empty()
+ || !Inkscape::IO::file_test(dirname.c_str(), (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) )
+ {
+ gchar *safeDir = Inkscape::IO::sanitizeString(dirname.c_str());
+ gchar *error = g_strdup_printf(_("Directory %s does not exist or is not a directory.\n"),
+ safeDir);
+ sp_ui_error_dialog(error);
+ g_free(safeDir);
+ g_free(error);
+ return;
+ }
- gchar *dirname = g_path_get_dirname(path);
- if ( dirname == NULL
- || !Inkscape::IO::file_test(dirname, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) )
- {
- gchar *safeDir = Inkscape::IO::sanitizeString(dirname);
- gchar *error = g_strdup_printf(_("Directory %s does not exist or is not a directory.\n"),
- safeDir);
- sp_ui_error_dialog(error);
- g_free(safeDir);
- g_free(error);
- g_free(dirname);
- g_free(path);
- return;
- }
- g_free(dirname);
-
- gchar *fn = g_path_get_basename (path);
- GtkWidget *prog_dlg = create_progress_dialog (Glib::ustring::compose(_("Exporting %1 (%2 x %3)"), fn, width, height));
- g_free (fn);
-
-
- /* Do export */
- if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), path,
- Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, xdpi, ydpi,
- nv->pagecolor,
- onProgressCallback, prog_dlg, FALSE,
- hide ? const_cast<GSList *>(sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList()) : NULL
- )) {
- gchar * error;
- gchar * safeFile = Inkscape::IO::sanitizeString(path);
- error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
- sp_ui_error_dialog(error);
- g_free(safeFile);
- g_free(error);
- }
+ Glib::ustring fn = path_get_basename (path);
+
+ prog_dlg = create_progress_dialog (Glib::ustring::compose(_("Exporting %1 (%2 x %3)"), fn, width, height));
+
+ /* Do export */
+ if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), path.c_str(),
+ Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, xdpi, ydpi,
+ nv->pagecolor,
+ onProgressCallback, (void*)prog_dlg, FALSE,
+ hide ? const_cast<GSList *>(sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList()) : NULL
+ )) {
+ gchar * error;
+ gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str());
+ error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
+ sp_ui_error_dialog(error);
+ g_free(safeFile);
+ g_free(error);
+ }
- /* Reset the filename so that it can be changed again by changing
- selections and all that */
- g_free(original_name);
- original_name = const_cast<gchar*>(filename_ext.c_str());
- filename_modified = false;
+ /* Reset the filename so that it can be changed again by changing
+ selections and all that */
+ original_name = filename_ext;
+ filename_modified = false;
- gtk_widget_destroy (prog_dlg);
- //g_object_set_data (G_OBJECT (base), "cancel", (gpointer) 0);
+ delete prog_dlg;
+ prog_dlg = NULL;
+ interrupted = false;
+ /* Setup the values in the document */
+ switch (current_key) {
+ case SELECTION_PAGE:
+ case SELECTION_DRAWING: {
+ SPDocument * doc = SP_ACTIVE_DOCUMENT;
+ Inkscape::XML::Node * repr = doc->getReprRoot();
+ bool modified = false;
- /* Setup the values in the document */
- switch (current_key) {
- case SELECTION_PAGE:
- case SELECTION_DRAWING: {
- SPDocument * doc = SP_ACTIVE_DOCUMENT;
- Inkscape::XML::Node * repr = doc->getReprRoot();
- bool modified = false;
-
- bool saved = DocumentUndo::getUndoSensitive(doc);
- DocumentUndo::setUndoSensitive(doc, false);
-
- gchar const *temp_string = repr->attribute("inkscape:export-filename");
- if (temp_string == NULL || (filename_ext != temp_string)) {
- repr->setAttribute("inkscape:export-filename", filename_ext.c_str());
- modified = true;
- }
- temp_string = repr->attribute("inkscape:export-xdpi");
- if (temp_string == NULL || xdpi != atof(temp_string)) {
- sp_repr_set_svg_double(repr, "inkscape:export-xdpi", xdpi);
- modified = true;
- }
- temp_string = repr->attribute("inkscape:export-ydpi");
- if (temp_string == NULL || ydpi != atof(temp_string)) {
- sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi);
- modified = true;
- }
- DocumentUndo::setUndoSensitive(doc, saved);
+ bool saved = DocumentUndo::getUndoSensitive(doc);
+ DocumentUndo::setUndoSensitive(doc, false);
- if (modified) {
- doc->setModifiedSinceSave();
- }
- break;
- }
- case SELECTION_SELECTION: {
- const GSList * reprlst;
- SPDocument * doc = SP_ACTIVE_DOCUMENT;
- bool modified = false;
-
- bool saved = DocumentUndo::getUndoSensitive(doc);
- DocumentUndo::setUndoSensitive(doc, false);
- reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
-
- for(; reprlst != NULL; reprlst = reprlst->next) {
- Inkscape::XML::Node * repr = static_cast<Inkscape::XML::Node *>(reprlst->data);
- const gchar * temp_string;
- Glib::ustring dir = Glib::path_get_dirname(filename.c_str());
- const gchar* docURI=SP_ACTIVE_DOCUMENT->getURI();
- Glib::ustring docdir;
- if (docURI)
- {
- docdir = Glib::path_get_dirname(docURI);
- }
- if (repr->attribute("id") == NULL ||
- !(filename_ext.find_last_of(repr->attribute("id")) &&
- ( !docURI ||
- (dir == docdir)))) {
- temp_string = repr->attribute("inkscape:export-filename");
- if (temp_string == NULL || (filename_ext != temp_string)) {
- repr->setAttribute("inkscape:export-filename", filename_ext.c_str());
- modified = true;
- }
+ gchar const *temp_string = repr->attribute("inkscape:export-filename");
+ if (temp_string == NULL || (filename_ext != temp_string)) {
+ repr->setAttribute("inkscape:export-filename", filename_ext.c_str());
+ modified = true;
}
temp_string = repr->attribute("inkscape:export-xdpi");
if (temp_string == NULL || xdpi != atof(temp_string)) {
@@ -1116,18 +1019,63 @@ void Export::onExport ()
sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi);
modified = true;
}
+ DocumentUndo::setUndoSensitive(doc, saved);
+
+ if (modified) {
+ doc->setModifiedSinceSave();
+ }
+ break;
}
- DocumentUndo::setUndoSensitive(doc, saved);
+ case SELECTION_SELECTION: {
+ const GSList * reprlst;
+ SPDocument * doc = SP_ACTIVE_DOCUMENT;
+ bool modified = false;
+
+ bool saved = DocumentUndo::getUndoSensitive(doc);
+ DocumentUndo::setUndoSensitive(doc, false);
+ reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList();
+
+ for(; reprlst != NULL; reprlst = reprlst->next) {
+ Inkscape::XML::Node * repr = static_cast<Inkscape::XML::Node *>(reprlst->data);
+ const gchar * temp_string;
+ Glib::ustring dir = Glib::path_get_dirname(filename.c_str());
+ const gchar* docURI=SP_ACTIVE_DOCUMENT->getURI();
+ Glib::ustring docdir;
+ if (docURI)
+ {
+ docdir = Glib::path_get_dirname(docURI);
+ }
+ if (repr->attribute("id") == NULL ||
+ !(filename_ext.find_last_of(repr->attribute("id")) &&
+ ( !docURI ||
+ (dir == docdir)))) {
+ temp_string = repr->attribute("inkscape:export-filename");
+ if (temp_string == NULL || (filename_ext != temp_string)) {
+ repr->setAttribute("inkscape:export-filename", filename_ext.c_str());
+ modified = true;
+ }
+ }
+ temp_string = repr->attribute("inkscape:export-xdpi");
+ if (temp_string == NULL || xdpi != atof(temp_string)) {
+ sp_repr_set_svg_double(repr, "inkscape:export-xdpi", xdpi);
+ modified = true;
+ }
+ temp_string = repr->attribute("inkscape:export-ydpi");
+ if (temp_string == NULL || ydpi != atof(temp_string)) {
+ sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi);
+ modified = true;
+ }
+ }
+ DocumentUndo::setUndoSensitive(doc, saved);
- if (modified) {
- doc->setModifiedSinceSave();
+ if (modified) {
+ doc->setModifiedSinceSave();
+ }
+ break;
}
- break;
+ default:
+ break;
}
- default:
- break;
- }
- g_free (path);
}
} // end of sp_export_export_clicked()
@@ -1137,7 +1085,7 @@ void Export::onExport ()
void Export::onBrowse ()
{
GtkWidget *fs;
- const gchar *filename;
+ Glib::ustring filename;
fs = gtk_file_chooser_dialog_new (_("Select a filename for exporting"),
(GtkWindow*)desktop->getToplevel(),
@@ -1156,13 +1104,14 @@ void Export::onBrowse ()
gtk_window_set_modal(GTK_WINDOW (fs), true);
- filename = filename_entry.get_text().c_str();
+ filename = filename_entry.get_text();
- if (*filename == '\0') {
- filename = create_filepath_from_id(NULL, NULL);
+ if (filename.empty()) {
+ Glib::ustring tmp;
+ filename = create_filepath_from_id(tmp, tmp);
}
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (fs), filename);
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (fs), filename.c_str());
#ifdef WIN32
// code in this section is borrowed from ui/dialogs/filedialogimpl-win32.cpp
@@ -1177,7 +1126,7 @@ void Export::onBrowse ()
// Copy the selected file name, converting from UTF-8 to UTF-16
WCHAR _filename[_MAX_PATH + 1];
memset(_filename, 0, sizeof(_filename));
- gunichar2* utf16_path_string = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
+ gunichar2* utf16_path_string = g_utf8_to_utf16(filename.c_str(), -1, NULL, NULL, NULL);
wcsncpy(_filename, (wchar_t*)utf16_path_string, _MAX_PATH);
g_free(utf16_path_string);
@@ -1792,7 +1741,7 @@ float Export::getValuePx( Gtk::Adjustment *adj )
*/
void Export::onFilenameModified()
{
- if (strcmp(original_name, filename_entry.get_text().c_str())==0) {
+ if (original_name == filename_entry.get_text()) {
filename_modified = false;
} else {
filename_modified = true;
diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h
index 51b969b5e..eaab04762 100644
--- a/src/ui/dialog/export.h
+++ b/src/ui/dialog/export.h
@@ -96,15 +96,33 @@ private:
*/
void setValue (Gtk::Adjustment *adj, double val);
void setValuePx (Gtk::Adjustment *adj, double val);
- float getValue ( Gtk::Adjustment *adj );
- float getValuePx ( Gtk::Adjustment *adj );
- /*
- * Helper function to create, style and pack spinbuttons
+ float getValue (Gtk::Adjustment *adj);
+ float getValuePx (Gtk::Adjustment *adj);
+
+ /**
+ * Helper function to create, style and pack spinbuttons for the export dialog.
+ *
+ * Creates a new spin button for the export dialog.
+ * @param key The name of the spin button
+ * @param val A default value for the spin button
+ * @param min Minimum value for the spin button
+ * @param max Maximum value for the spin button
+ * @param step The step size for the spin button
+ * @param page Size of the page increment
+ * @param us Unit selector that effects this spin button
+ * @param t Table to put the spin button in
+ * @param x X location in the table \c t to start with
+ * @param y Y location in the table \c t to start with
+ * @param ll Text to put on the left side of the spin button (optional)
+ * @param lr Text to put on the right side of the spin button (optional)
+ * @param digits Number of digits to display after the decimal
+ * @param sensitive Whether the spin button is sensitive or not
+ * @param cb Callback for when this spin button is changed (optional)
*/
Gtk::Adjustment * createSpinbutton( gchar const *key, float val, float min, float max,
float step, float page, GtkWidget *us,
- GtkWidget *t, int x, int y,
- const gchar *ll, const gchar *lr,
+ Gtk::Table *t, int x, int y,
+ const Glib::ustring ll, const Glib::ustring lr,
int digits, unsigned int sensitive,
void (Export::*cb)() );
/**
@@ -188,20 +206,34 @@ private:
void setTargetDesktop(SPDesktop *desktop);
/**
- * Progress dialog callbacks
+ * Creates progress dialog for batch exporting.
+ *
+ * @param progress_text Text to be shown in the progress bar
+ */
+ Gtk::Dialog * 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
*/
- GtkWidget * create_progress_dialog (Glib::ustring progress_text);
- static unsigned int onProgressCallback (float value, void *data);
- static void onProgressCancel ( GtkWidget *widget, GObject *base );
- static gint onProgressDelete ( GtkWidget *widget, GdkEvent *event, GObject *base );
+ 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);
/*
- * Utlitiy filename and path functions
+ * Utility filename and path functions
*/
void set_default_filename ();
- gchar* create_filepath_from_id (const gchar *id, const gchar *file_entry_text);
+ Glib::ustring create_filepath_from_id (Glib::ustring id, const Glib::ustring &file_entry_text);
Glib::ustring filename_add_extension (Glib::ustring filename, Glib::ustring extension);
- gchar *absolutize_path_from_document_location (SPDocument *doc, const gchar *filename);
+ Glib::ustring absolutize_path_from_document_location (SPDocument *doc, const Glib::ustring &filename);
/*
* Currently selected export area type
@@ -210,8 +242,8 @@ private:
/*
* Original name for the export object
*/
- gchar * original_name;
- gchar * doc_export_name;
+ Glib::ustring original_name;
+ Glib::ustring doc_export_name;
/*
* Was the Original name modified
*/
@@ -273,6 +305,9 @@ private:
Gtk::Label export_label;
Gtk::Image export_image;
+ Gtk::Dialog *prog_dlg;
+ bool interrupted; // indicates whether export needs to be interrupted (read: user pressed cancel in the progress dialog)
+
Inkscape::Preferences *prefs;
SPDesktop *desktop;
DesktopTracker deskTrack;
diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp
index 5fd6e18d8..641acd3f3 100644
--- a/src/ui/dialog/find.cpp
+++ b/src/ui/dialog/find.cpp
@@ -72,10 +72,10 @@ Find::Find()
check_scope_selection(_("S_election"), _("Limit search to the current selection")),
check_searchin_text(_("Te_xt"), _("Search in text objects")),
check_searchin_property(_("_Properties"), _("Search in object properties, styles, attributes and IDs")),
+ vbox_searchin(0, false),
frame_searchin(_("Search in")),
frame_scope(_("Scope")),
-
check_case_sensitive(_("Case sensiti_ve"), _("Match upper/lower case"), false),
check_exact_match(_("E_xact match"), _("Match whole objects only"), false),
check_include_hidden(_("Include _hidden"), _("Include hidden objects in search"), false),
@@ -120,8 +120,8 @@ Find::Find()
Gtk::RadioButtonGroup grp_searchin = check_searchin_text.get_group();
check_searchin_property.set_group(grp_searchin);
- vbox_searchin.pack_start(check_searchin_text, true, true);
- vbox_searchin.pack_start(check_searchin_property, true, true);
+ vbox_searchin.pack_start(check_searchin_text, false, false);
+ vbox_searchin.pack_start(check_searchin_property, false, false);
frame_searchin.add(vbox_searchin);
Gtk::RadioButtonGroup grp_scope = check_scope_all.get_group();
diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h
index 62ecd1763..64fb4cc3d 100644
--- a/src/ui/dialog/find.h
+++ b/src/ui/dialog/find.h
@@ -15,6 +15,7 @@
#include "ui/widget/panel.h"
#include "ui/widget/button.h"
#include "ui/widget/entry.h"
+#include "ui/widget/frame.h"
#include <glib.h>
#include <gtkmm.h>
@@ -198,78 +199,78 @@ private:
/*
* Find and replace combo box widgets
*/
- Inkscape::UI::Widget::Entry entry_find;
- Inkscape::UI::Widget::Entry entry_replace;
+ UI::Widget::Entry entry_find;
+ UI::Widget::Entry entry_replace;
/**
* Scope and search in widgets
*/
- Inkscape::UI::Widget::RadioButton check_scope_all;
- Inkscape::UI::Widget::RadioButton check_scope_layer;
- Inkscape::UI::Widget::RadioButton check_scope_selection;
- Inkscape::UI::Widget::RadioButton check_searchin_text;
- Inkscape::UI::Widget::RadioButton check_searchin_property;
+ UI::Widget::RadioButton check_scope_all;
+ UI::Widget::RadioButton check_scope_layer;
+ UI::Widget::RadioButton check_scope_selection;
+ UI::Widget::RadioButton check_searchin_text;
+ UI::Widget::RadioButton check_searchin_property;
Gtk::HBox hbox_searchin;
Gtk::VBox vbox_scope;
Gtk::VBox vbox_searchin;
- Gtk::Frame frame_searchin;
- Gtk::Frame frame_scope;
+ UI::Widget::Frame frame_searchin;
+ UI::Widget::Frame frame_scope;
/**
* General option widgets
*/
- Inkscape::UI::Widget::CheckButton check_case_sensitive;
- Inkscape::UI::Widget::CheckButton check_exact_match;
- Inkscape::UI::Widget::CheckButton check_include_hidden;
- Inkscape::UI::Widget::CheckButton check_include_locked;
+ UI::Widget::CheckButton check_case_sensitive;
+ UI::Widget::CheckButton check_exact_match;
+ UI::Widget::CheckButton check_include_hidden;
+ UI::Widget::CheckButton check_include_locked;
Gtk::VBox vbox_options1;
Gtk::VBox vbox_options2;
Gtk::HBox hbox_options;
Gtk::VBox vbox_expander;
Gtk::Expander expander_options;
- Gtk::Frame frame_options;
+ UI::Widget::Frame frame_options;
/**
* Property type widgets
*/
- Inkscape::UI::Widget::CheckButton check_ids;
- Inkscape::UI::Widget::CheckButton check_attributename;
- Inkscape::UI::Widget::CheckButton check_attributevalue;
- Inkscape::UI::Widget::CheckButton check_style;
- Inkscape::UI::Widget::CheckButton check_font;
+ UI::Widget::CheckButton check_ids;
+ UI::Widget::CheckButton check_attributename;
+ UI::Widget::CheckButton check_attributevalue;
+ UI::Widget::CheckButton check_style;
+ UI::Widget::CheckButton check_font;
Gtk::VBox vbox_properties;
Gtk::HBox hbox_properties1;
Gtk::HBox hbox_properties2;
- Gtk::Frame frame_properties;
+ UI::Widget::Frame frame_properties;
/**
* A vector of all the properties widgets for easy processing
*/
- std::vector<Inkscape::UI::Widget::CheckButton *> checkProperties;
+ std::vector<UI::Widget::CheckButton *> checkProperties;
/**
* Object type widgets
*/
- Inkscape::UI::Widget::CheckButton check_alltypes;
- Inkscape::UI::Widget::CheckButton check_rects;
- Inkscape::UI::Widget::CheckButton check_ellipses;
- Inkscape::UI::Widget::CheckButton check_stars;
- Inkscape::UI::Widget::CheckButton check_spirals;
- Inkscape::UI::Widget::CheckButton check_paths;
- Inkscape::UI::Widget::CheckButton check_texts;
- Inkscape::UI::Widget::CheckButton check_groups;
- Inkscape::UI::Widget::CheckButton check_clones;
- Inkscape::UI::Widget::CheckButton check_images;
- Inkscape::UI::Widget::CheckButton check_offsets;
+ UI::Widget::CheckButton check_alltypes;
+ UI::Widget::CheckButton check_rects;
+ UI::Widget::CheckButton check_ellipses;
+ UI::Widget::CheckButton check_stars;
+ UI::Widget::CheckButton check_spirals;
+ UI::Widget::CheckButton check_paths;
+ UI::Widget::CheckButton check_texts;
+ UI::Widget::CheckButton check_groups;
+ UI::Widget::CheckButton check_clones;
+ UI::Widget::CheckButton check_images;
+ UI::Widget::CheckButton check_offsets;
Gtk::VBox vbox_types1;
Gtk::VBox vbox_types2;
Gtk::HBox hbox_types;
- Gtk::Frame frame_types;
+ UI::Widget::Frame frame_types;
/**
* A vector of all the check option widgets for easy processing
*/
- std::vector<Inkscape::UI::Widget::CheckButton *> checkTypes;
+ std::vector<UI::Widget::CheckButton *> checkTypes;
//Gtk::HBox hbox_text;
@@ -277,8 +278,8 @@ private:
* Action Buttons and status
*/
Gtk::Label status;
- Inkscape::UI::Widget::Button button_find;
- Inkscape::UI::Widget::Button button_replace;
+ UI::Widget::Button button_find;
+ UI::Widget::Button button_replace;
Gtk::HButtonBox box_buttons;
Gtk::HBox hboxbutton_row;
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 19cdea9bc..de213ca85 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -25,6 +25,7 @@
#include <gtkmm/checkbutton.h>
#include <gtkmm/frame.h>
#include <gtkmm/stock.h>
+#include "ui/widget/frame.h"
#include "desktop.h"
#include "desktop-handles.h"
@@ -160,7 +161,7 @@ IconPreviewPanel::IconPreviewPanel() :
Gtk::VBox* magBox = new Gtk::VBox();
- Gtk::Frame *magFrame = Gtk::manage(new Gtk::Frame(_("Magnified:")));
+ UI::Widget::Frame *magFrame = Gtk::manage(new UI::Widget::Frame(_("Magnified:")));
magFrame->add( magnified );
magBox->pack_start( *magFrame, Gtk::PACK_EXPAND_WIDGET );
@@ -229,7 +230,7 @@ IconPreviewPanel::IconPreviewPanel() :
iconBox.pack_start(splitter);
splitter.pack1( *magBox, true, true );
- Gtk::Frame *actuals = Gtk::manage(new Gtk::Frame(_("Actual Size:")));
+ UI::Widget::Frame *actuals = Gtk::manage(new UI::Widget::Frame (_("Actual Size:")));
actuals->add(*verts);
splitter.pack2( *actuals, false, false );
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index b038ae60d..719e42f16 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -851,10 +851,10 @@ void InkscapePreferences::initPageIO()
Glib::ustring intentLabels[numIntents] = {_("Perceptual"), _("Relative Colorimetric"), _("Saturation"), _("Absolute Colorimetric")};
int intentValues[numIntents] = {0, 1, 2, 3};
-#if !defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
+#if !defined(HAVE_LIBLCMS1) && !defined(HAVE_LIBLCMS2)
Gtk::Label* lbl = new Gtk::Label(_("(Note: Color management has been disabled in this build)"));
_page_cms.add_line( false, "", *lbl, "", "", true);
-#endif // !defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
+#endif // !defined(HAVE_LIBLCMS1) && !defined(HAVE_LIBLCMS2)
_page_cms.add_group_header( _("Display adjustment"));
@@ -913,6 +913,8 @@ void InkscapePreferences::initPageIO()
_("Enables black point compensation"), false);
_cms_proof_preserveblack.init( _("Preserve black"), "/options/softproof/preserveblack", false);
+
+#if !defined(HAVE_LIBLCMS2)
_page_cms.add_line( true, "", _cms_proof_preserveblack,
#if defined(cmsFLAGS_PRESERVEBLACK)
"",
@@ -920,6 +922,7 @@ void InkscapePreferences::initPageIO()
_("(LittleCMS 1.15 or later required)"),
#endif // defined(cmsFLAGS_PRESERVEBLACK)
_("Preserve K channel in CMYK -> CMYK transforms"), false);
+#endif // !defined(HAVE_LIBLCMS2)
#if !defined(cmsFLAGS_PRESERVEBLACK)
_cms_proof_preserveblack.set_sensitive( false );
@@ -1495,7 +1498,7 @@ void InkscapePreferences::initPageSystem()
_sys_icon_scroll.add(_sys_icon);
_sys_icon_scroll.set_size_request(0, 80);
_sys_icon_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- _page_system.add_line(true, _("Icon theme: "), _sys_icon_scroll, "", _("Location of icon themes"), true);
+ _page_system.add_line(true, _("Icon theme: "), _sys_icon_scroll, "", _("Locations of icon themes"), true);
this->AddPage(_page_system, _("System"), PREFS_PAGE_SYSTEM);
}
diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp
index 1e60d7f8a..eb2ddb88f 100644
--- a/src/ui/dialog/input.cpp
+++ b/src/ui/dialog/input.cpp
@@ -13,6 +13,8 @@
#include <set>
#include <list>
#include "ui/widget/panel.h"
+#include "ui/widget/frame.h"
+
#include <glib/gprintf.h>
#include <glibmm/i18n.h>
#include <gtkmm/alignment.h>
@@ -426,8 +428,8 @@ private:
Glib::RefPtr<Gtk::TreeStore> store;
Gtk::TreeIter tabletIter;
Gtk::TreeView tree;
- Gtk::Frame frame2;
- Gtk::Frame testFrame;
+ Inkscape::UI::Widget::Frame detailFrame;
+ Inkscape::UI::Widget::Frame testFrame;
Gtk::ScrolledWindow treeScroller;
Gtk::ScrolledWindow detailScroller;
Gtk::HPaned splitter;
@@ -527,7 +529,7 @@ InputDialogImpl::InputDialogImpl() :
store(Gtk::TreeStore::create(getCols())),
tabletIter(),
tree(store),
- frame2(),
+ detailFrame(),
testFrame(_("Test Area")),
treeScroller(),
detailScroller(),
@@ -544,10 +546,11 @@ InputDialogImpl::InputDialogImpl() :
treeScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ treeScroller.set_shadow_type(Gtk::SHADOW_IN);
treeScroller.add(tree);
treeScroller.set_size_request(50, 0);
split2.pack1(testFrame, false, false);
- split2.pack2(frame2, true, true);
+ split2.pack2(detailFrame, true, true);
splitter.pack1(treeScroller);
splitter.pack2(split2);
@@ -591,7 +594,7 @@ InputDialogImpl::InputDialogImpl() :
int rowNum = 0;
- Gtk::Label* lbl = Gtk::manage(new Gtk::Label(_("Name:")));
+/* Gtk::Label* lbl = Gtk::manage(new Gtk::Label(_("Name:")));
devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
::Gtk::FILL,
::Gtk::SHRINK);
@@ -599,9 +602,9 @@ InputDialogImpl::InputDialogImpl() :
::Gtk::SHRINK,
::Gtk::SHRINK);
- rowNum++;
+ rowNum++;*/
- lbl = Gtk::manage(new Gtk::Label(_("Link:")));
+ Gtk::Label *lbl = Gtk::manage(new Gtk::Label(_("Link:")));
devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
::Gtk::FILL,
::Gtk::SHRINK);
@@ -700,9 +703,11 @@ InputDialogImpl::InputDialogImpl() :
devDetails.set_sensitive(false);
detailScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ detailScroller.set_shadow_type(Gtk::SHADOW_NONE);
+ detailScroller.set_border_width (0);
detailScroller.add(devDetails);
- frame2.add(detailScroller);
- frame2.set_size_request(0, 60);
+ detailFrame.add(detailScroller);
+ detailFrame.set_size_request(0, 60);
//- 16x16/devices
// gnome-dev-mouse-optical
@@ -1307,6 +1312,7 @@ void InputDialogImpl::resyncToSelection() {
clear = false;
devName.set_label(row[getCols().description]);
+ detailFrame.set_label(row[getCols().description]);
setupValueAndCombo( dev->getNumAxes(), dev->getNumAxes(), devAxesCount, axesCombo);
setupValueAndCombo( dev->getNumKeys(), dev->getNumKeys(), devKeyCount, buttonCombo);
}
@@ -1314,6 +1320,7 @@ void InputDialogImpl::resyncToSelection() {
devDetails.set_sensitive(!clear);
if (clear) {
+ detailFrame.set_label("");
devName.set_label("");
devAxesCount.set_label("");
devKeyCount.set_label("");
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index 1f252c089..5b9f72453 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -84,7 +84,6 @@ LivePathEffectEditor::LivePathEffectEditor()
effectwidget(NULL),
status_label("", Gtk::ALIGN_CENTER),
effectcontrol_frame(""),
- effectlist_frame(_("Effect list")),
button_add(),
button_remove(),
button_up(),
diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h
index beebbc698..20b0a673d 100644
--- a/src/ui/dialog/livepatheffect-editor.h
+++ b/src/ui/dialog/livepatheffect-editor.h
@@ -16,6 +16,7 @@
#include <gtkmm/label.h>
#include <gtkmm/frame.h>
#include "ui/widget/combo-enums.h"
+#include "ui/widget/frame.h"
#include "live_effects/effect-enum.h"
#include <gtkmm/liststore.h>
#include <gtkmm/treeview.h>
@@ -89,8 +90,7 @@ private:
Gtk::Widget * effectwidget;
Gtk::Label status_label;
- Gtk::Frame effectcontrol_frame;
- Gtk::Frame effectlist_frame;
+ UI::Widget::Frame effectcontrol_frame;
Gtk::HBox effectapplication_hbox;
Gtk::VBox effectcontrol_vbox;
Gtk::VBox effectlist_vbox;
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index 13d80e301..23c0f72ee 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -43,6 +43,7 @@ ObjectProperties::ObjectProperties (void) :
LabelLabel(_("_Label:"), 1),
LabelTitle(_("_Title:"),1),
LabelDescription(_("_Description"),1),
+ FrameDescription("", FALSE),
HBoxCheck(FALSE, 0),
CheckTable(1, 2, TRUE),
CBHide(_("_Hide"), 1),
@@ -145,6 +146,8 @@ void ObjectProperties::MakeWidget(void)
/* Create the frame for the object description */
FrameDescription.set_label_widget (LabelDescription);
+ FrameDescription.set_padding (4,0,0,0);
+
TopTable.attach (FrameDescription, 0, 3, 3, 4,
Gtk::EXPAND | Gtk::FILL,
Gtk::EXPAND | Gtk::FILL, 0, 0 );
diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h
index d8d74cdb3..d9d1a3fdd 100644
--- a/src/ui/dialog/object-properties.h
+++ b/src/ui/dialog/object-properties.h
@@ -14,6 +14,7 @@
#define SEEN_DIALOGS_ITEM_PROPERTIES_H
#include "ui/widget/panel.h"
+#include "ui/widget/frame.h"
#include <gtkmm/entry.h>
#include <gtkmm/expander.h>
#include <gtkmm/frame.h>
@@ -61,8 +62,8 @@ private:
Gtk::Entry EntryTitle; //the entry for the object title
Gtk::Label LabelDescription; //the label for the object description
- Gtk::Frame FrameDescription; //the frame for the object description
- Gtk::Frame FrameTextDescription; //the frame for the text of the object description
+ UI::Widget::Frame FrameDescription; //the frame for the object description
+ Gtk::Frame FrameTextDescription; //the frame for the text of the object description
Gtk::TextView TextViewDescription; //the text view object showing the object description
Gtk::HBox HBoxCheck; // the HBox for the check boxes
diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp
index 4c9245f5c..9dccb9c85 100644
--- a/src/ui/dialog/ocaldialogs.cpp
+++ b/src/ui/dialog/ocaldialogs.cpp
@@ -879,9 +879,11 @@ void SearchResultList::populate_from_xml(xmlNode * a_node)
guint row_num = 0;
for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next) {
+
// Get items information
if (strcmp((const char*)cur_node->name, "rss")) // Avoid the root
- if (cur_node->type == XML_ELEMENT_NODE && !strcmp((const char*)cur_node->parent->name, "item"))
+ if (cur_node->type == XML_ELEMENT_NODE &&
+ (cur_node->parent->name && !strcmp((const char*)cur_node->parent->name, "item")))
{
if (!strcmp((const char*)cur_node->name, "title"))
{
@@ -1055,7 +1057,7 @@ void ImportDialog::on_xml_file_read(const Glib::RefPtr<Gio::AsyncResult>& result
list_results->populate_from_xml(root_element);
// Populate the MARKUP column with the title & description of the clipart
- for (guint i = 0; i <= list_results->size() - 1; i++) {
+ for (guint i = 0; i < list_results->size(); i++) {
Glib::ustring title = list_results->get_text(i, RESULTS_COLUMN_TITLE);
Glib::ustring description = list_results->get_text(i, RESULTS_COLUMN_DESCRIPTION);
char* markup = g_markup_printf_escaped("<b>%s</b>\n<span size=\"small\">%s</span>",
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index b09096e63..791b49af9 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -64,7 +64,7 @@ namespace Dialog {
TextEdit::TextEdit()
: UI::Widget::Panel("", "/dialogs/textandfont", SP_VERB_DIALOG_TEXT),
font_label(_("_Font"), true),
- layout_frame(_("Layout")),
+ layout_frame(),
text_label(_("_Text"), true),
setasdefault_button(_("Set as _default")),
close_button(Gtk::Stock::CLOSE),
@@ -134,6 +134,7 @@ This conditional and its #else block can be deleted in the future.
gtk_widget_set_tooltip_text (px, _("Spacing between lines (percent of font size)"));
gtk_widget_set_tooltip_text (spacing_combo, _("Spacing between lines (percent of font size)"));
layout_hbox.pack_start(*Gtk::manage(Glib::wrap(spacing_combo)), false, false);
+ layout_frame.set_padding(4,4,4,4);
layout_frame.add(layout_hbox);
/* Font preview */
diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h
index e750677c8..9fd9baa30 100644
--- a/src/ui/dialog/text-edit.h
+++ b/src/ui/dialog/text-edit.h
@@ -25,6 +25,7 @@
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/separator.h>
#include "ui/widget/panel.h"
+#include "ui/widget/frame.h"
#include "ui/dialog/desktop-tracker.h"
class SPItem;
@@ -165,7 +166,7 @@ private:
Gtk::HBox fontsel_hbox;
SPFontSelector *fsel;
- Gtk::Frame layout_frame;
+ Gtk::Alignment layout_frame;
Gtk::HBox layout_hbox;
Gtk::RadioButton align_left;
Gtk::RadioButton align_center;
diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp
index 2751a9953..a6495c205 100644
--- a/src/ui/dialog/tracedialog.cpp
+++ b/src/ui/dialog/tracedialog.cpp
@@ -19,6 +19,7 @@
#include <gtkmm/notebook.h>
#include <gtkmm/frame.h>
#include "ui/widget/spinbutton.h"
+#include "ui/widget/frame.h"
#include <gtkmm/stock.h>
#include <gtk/gtk.h> //for GTK_RESPONSE* types
@@ -105,14 +106,14 @@ class TraceDialogImpl : public TraceDialog
//# Single scan mode
//brightness
- Gtk::Frame modeBrightnessFrame;
+ UI::Widget::Frame modeBrightnessFrame;
Gtk::VBox modeBrightnessVBox;
Gtk::HBox modeBrightnessBox;
Gtk::RadioButton modeBrightnessRadioButton;
Gtk::Label modeBrightnessSpinnerLabel;
Inkscape::UI::Widget::SpinButton modeBrightnessSpinner;
//edge detection
- Gtk::Frame modeCannyFrame;
+ UI::Widget::Frame modeCannyFrame;
Gtk::HBox modeCannyBox;
Gtk::VBox modeCannyVBox;
Gtk::RadioButton modeCannyRadioButton;
@@ -122,7 +123,7 @@ class TraceDialogImpl : public TraceDialog
Gtk::Label modeCannyHiSpinnerLabel;
Inkscape::UI::Widget::SpinButton modeCannyHiSpinner;
//quantization
- Gtk::Frame modeQuantFrame;
+ UI::Widget::Frame modeQuantFrame;
Gtk::HBox modeQuantBox;
Gtk::VBox modeQuantVBox;
Gtk::RadioButton modeQuantRadioButton;
@@ -133,7 +134,7 @@ class TraceDialogImpl : public TraceDialog
Gtk::HBox modeInvertBox;
//# Multiple path scanning mode
- Gtk::Frame modeMultiScanFrame;
+ UI::Widget::Frame modeMultiScanFrame;
Gtk::VBox modeMultiScanVBox;
//brightness
Gtk::HBox modeMultiScanHBox1;
@@ -158,7 +159,7 @@ class TraceDialogImpl : public TraceDialog
// potrace parameters
- Gtk::Frame optionsFrame;
+ UI::Widget::Frame optionsFrame;
Gtk::VBox optionsVBox;
Gtk::HBox optionsSpecklesBox;
Gtk::CheckButton optionsSpecklesButton;
@@ -190,7 +191,7 @@ class TraceDialogImpl : public TraceDialog
//#### Preview
- Gtk::Frame previewFrame;
+ UI::Widget::Frame previewFrame;
Gtk::VBox previewVBox;
Gtk::Button previewButton;
Gtk::Image previewImage;
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index d8f1a21a9..cce7da103 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -207,7 +207,12 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation )
Gtk::VBox::on_size_allocate( allocation );
if ( _insides && !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == SP_ANCHOR_NORTH || _anchor == SP_ANCHOR_SOUTH) ) {
- Gtk::Requisition req = _insides->size_request();
+ Gtk::Requisition req;
+#if WITH_GTKMM_3_0
+ _insides->get_preferred_size(&req, NULL);
+#else
+ req = _insides->size_request();
+#endif
gint delta = allocation.get_width() - req.width;
if ( (delta > 4) && req.height < allocation.get_height() ) {
@@ -233,7 +238,12 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int&
height = 1;
if ( _anchor == SP_ANCHOR_SOUTH || _anchor == SP_ANCHOR_NORTH ) {
- Gtk::Requisition req = _scroller->size_request();
+ Gtk::Requisition req;
+#if WITH_GTKMM_3_0
+ _scroller->get_preferred_size(&req, NULL);
+#else
+ req = _scroller->size_request();
+#endif
int currW = _scroller->get_width();
if ( currW > req.width ) {
req.width = currW;
@@ -241,13 +251,23 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int&
Gtk::HScrollbar* hs = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hscrollbar();
if ( hs ) {
- Gtk::Requisition scrollReq = hs->size_request();
+ Gtk::Requisition scrollReq;
+#if WITH_GTKMM_3_0
+ hs->get_preferred_size(&req, NULL);
+#else
+ req = hs->size_request();
+#endif
// the +8 is a temporary hack
req.height -= scrollReq.height + 8;
}
- Gtk::Requisition req2 = const_cast<Gtk::Widget*>(thing)->size_request();
+ Gtk::Requisition req2;
+#if WITH_GTKMM_3_0
+ const_cast<Gtk::Widget*>(thing)->get_preferred_size(&req2, NULL);
+#else
+ req2 = const_cast<Gtk::Widget*>(thing)->size_request();
+#endif
int h2 = ((req2.height > 0) && (req.height > req2.height)) ? (req.height / req2.height) : 1;
int w2 = ((req2.width > 0) && (req.width > req2.width)) ? (req.width / req2.width) : 1;
diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert
index 718d95979..f36ffbf56 100644
--- a/src/ui/widget/Makefile_insert
+++ b/src/ui/widget/Makefile_insert
@@ -21,6 +21,8 @@ ink_common_sources += \
ui/widget/entry.h \
ui/widget/filter-effect-chooser.h \
ui/widget/filter-effect-chooser.cpp \
+ ui/widget/frame.cpp \
+ ui/widget/frame.h \
ui/widget/handlebox.cpp \
ui/widget/handlebox.h \
ui/widget/icon-widget.cpp \
diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp
new file mode 100644
index 000000000..b2968f806
--- /dev/null
+++ b/src/ui/widget/frame.cpp
@@ -0,0 +1,83 @@
+/*
+ * Authors:
+ * Murray C
+ *
+ * Copyright (C) 2012 Authors
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "frame.h"
+
+
+// Inkscape::UI::Widget::Frame
+
+namespace Inkscape {
+namespace UI {
+namespace Widget {
+
+Frame::Frame(Glib::ustring const &label_text /*= ""*/, gboolean label_bold /*= TRUE*/ )
+ : _label(label_text, 1.0, 0.5, TRUE),
+ _alignment()
+{
+ set_shadow_type(Gtk::SHADOW_NONE);
+
+ //Put an indented GtkAlignment inside the frame.
+ //Further children should be children of this GtkAlignment:
+ Gtk::Frame::add(_alignment);
+ set_padding(4, 0, 8, 0);
+
+ set_label_widget(_label);
+ set_label(label_text, label_bold);
+
+ show_all_children();
+}
+
+void
+Frame::add(Widget& widget)
+{
+ _alignment.add(widget);
+}
+
+void
+Frame::set_label(const Glib::ustring &label_text, gboolean label_bold /*= TRUE*/)
+{
+ if (label_bold) {
+ _label.set_markup(Glib::ustring("<b>") + label_text + "</b>");
+ } else {
+ _label.set_text(label_text);
+ }
+}
+
+void
+Frame::set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right)
+{
+#if WITH_GTKMM_2_24
+ _alignment.set_padding(padding_top, padding_bottom, padding_left, padding_right);
+#endif
+}
+
+Gtk::Label const *
+Frame::get_label_widget() const
+{
+ return &_label;
+}
+
+} // namespace Widget
+} // 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:textwidth=99 :
diff --git a/src/ui/widget/frame.h b/src/ui/widget/frame.h
new file mode 100644
index 000000000..cf736d8a1
--- /dev/null
+++ b/src/ui/widget/frame.h
@@ -0,0 +1,79 @@
+/*
+ * Authors:
+ * Murray C
+ *
+ * Copyright (C) 2012 Authors
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information.
+ */
+
+#ifndef INKSCAPE_UI_WIDGET_FRAME_H
+#define INKSCAPE_UI_WIDGET_FRAME_H
+
+#include <gtkmm.h>
+
+namespace Gtk {
+class Frame;
+}
+
+namespace Inkscape {
+namespace UI {
+namespace Widget {
+
+/**
+ * Creates a Gnome HIG style indented frame with bold label
+ * See http://developer.gnome.org/hig-book/stable/controls-frames.html.en
+ */
+class Frame : public Gtk::Frame
+{
+public:
+
+ /**
+ * Construct a Frame Widget.
+ *
+ * @param label The frame text.
+ */
+ Frame(Glib::ustring const &label = "", gboolean label_bold = TRUE);
+
+ /**
+ * Return the label widget
+ */
+ Gtk::Label const *get_label_widget() const;
+
+ /**
+ * Add a widget to this frame
+ */
+ virtual void add(Widget& widget);
+
+ /**
+ * Set the frame label text and if bold or not
+ */
+ void set_label(const Glib::ustring &label, gboolean label_bold = TRUE);
+
+ /**
+ * Set the frame padding
+ */
+ void set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right);
+
+protected:
+ Gtk::Label _label;
+ Gtk::Alignment _alignment;
+
+};
+
+} // namespace Widget
+} // namespace UI
+} // namespace Inkscape
+
+#endif // INKSCAPE_UI_WIDGET_FRAME_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 :
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index c81385dd7..d26005317 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -1157,7 +1157,7 @@ void SelectedStyle::on_opacity_changed () {
_("Change opacity"));
// resume interruptibility
sp_desktop_canvas(_desktop)->endForcedFullRedraws();
- spinbutton_defocus(GTK_OBJECT(_opacity_sb.gobj()));
+ spinbutton_defocus(GTK_WIDGET(_opacity_sb.gobj()));
_opacity_blocked = false;
}
diff --git a/src/ui/widget/toolbox.cpp b/src/ui/widget/toolbox.cpp
index 99891fc44..a11bd2d74 100644
--- a/src/ui/widget/toolbox.cpp
+++ b/src/ui/widget/toolbox.cpp
@@ -12,6 +12,7 @@
#endif
#include <gtkmm/radioaction.h>
+#include <gtkmm/orientable.h>
#include <gtk/gtk.h>
#include "ui/widget/toolbox.h"
#include "path-prefix.h"
@@ -97,7 +98,9 @@ Toolbox::init_actions()
void
Toolbox::init_orientation(Gtk::Orientation const &orientation)
{
- static_cast<Gtk::Toolbar*>(_widget)->set_orientation(orientation);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(static_cast<Gtk::Toolbar*>(_widget)->gobj()),
+ GtkOrientation(orientation));
+
if (orientation == Gtk::ORIENTATION_VERTICAL) {
set_handle_position(Gtk::POS_TOP);
}
@@ -226,7 +229,8 @@ Toolbox::on_change_orient_horiz()
{
Glib::RefPtr<Gtk::RadioAction> action = Glib::RefPtr<Gtk::RadioAction>::cast_static(_detach_grp->get_action("OrientHoriz"));
if (action->get_active()) {
- static_cast<Gtk::Toolbar*>(_widget)->set_orientation(Gtk::ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(static_cast<Gtk::Toolbar*>(_widget)->gobj()),
+ GTK_ORIENTATION_HORIZONTAL);
}
}
@@ -235,7 +239,8 @@ Toolbox::on_change_orient_vert()
{
Glib::RefPtr<Gtk::RadioAction> action = Glib::RefPtr<Gtk::RadioAction>::cast_static(_detach_grp->get_action("OrientVert"));
if (action->get_active()) {
- static_cast<Gtk::Toolbar*>(_widget)->set_orientation(Gtk::ORIENTATION_VERTICAL);
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(static_cast<Gtk::Toolbar*>(_widget)->gobj()),
+ GTK_ORIENTATION_VERTICAL);
}
}