From 048b095b6031adf91a6dc2fb300270f78ca44cbf Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Fri, 14 Aug 2009 03:52:51 +0000 Subject: a quick workaround in order to avoid some invalid names for icc profiles. A complete sanitizer should be implemented later. (bzr r8050.1.10) --- src/ui/dialog/document-properties.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index bb9ab4d02..c21f64629 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -381,6 +381,17 @@ DocumentProperties::populate_available_profiles(){ _menu.show_all(); } +//this is a quick workaround: +static gchar* sanitize_name(gchar* name){ + gchar* c=name; + while (*c != '\0'){ + if (*c == ' ') *c = '-'; + if (*c == '_') *c = '-'; + c++; + } + return name; +} + void DocumentProperties::linkSelectedProfile() { @@ -396,7 +407,8 @@ DocumentProperties::linkSelectedProfile() } Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); Inkscape::XML::Node *cprofRepr = xml_doc->createElement("svg:color-profile"); - cprofRepr->setAttribute("name", (gchar*) _menu.get_active()->get_data("name")); +// cprofRepr->setAttribute("inkscape:name", (gchar*) _menu.get_active()->get_data("name")); + cprofRepr->setAttribute("name", sanitize_name((gchar*) _menu.get_active()->get_data("name"))); cprofRepr->setAttribute("xlink:href", (gchar*) _menu.get_active()->get_data("filepath")); // Checks whether there is a defs element. Creates it when needed -- cgit v1.2.3 From ce44c8bbdf0be872a572078874880af6540d3f4d Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 30 Nov 2009 21:05:43 +0100 Subject: Align and distribute tooltip string fix (Bug #442214 Fixed bugs: - https://launchpad.net/bugs/442214 (bzr r8849) --- src/ui/dialog/align-and-distribute.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index a54f83758..024d4b2f1 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -807,7 +807,7 @@ AlignAndDistribute::AlignAndDistribute() _("Align left edges"), 0, 1); addAlignButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_CENTER, - _("Center objects horizontally"), + _("Center on vertical axis"), 0, 2); addAlignButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_RIGHT, _("Align right sides"), -- cgit v1.2.3 From c8e6bae8d1b9945a60bfba261ad3a299b0b93e42 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 30 Nov 2009 12:53:48 -0800 Subject: Spray Tool by the students at Ecole Centrale de Lyon, Lyon, France (bzr r8851) --- src/ui/dialog/Makefile_insert | 2 + src/ui/dialog/dialog-manager.cpp | 6 +- src/ui/dialog/inkscape-preferences.cpp | 6 + src/ui/dialog/inkscape-preferences.h | 3 +- src/ui/dialog/spray-option.cpp | 381 +++++++++++++++++++++++++++++++++ src/ui/dialog/spray-option.h | 130 +++++++++++ src/ui/icon-names.h | 10 + src/ui/view/edit-widget.cpp | 6 + src/ui/view/edit-widget.h | 1 + 9 files changed, 542 insertions(+), 3 deletions(-) create mode 100644 src/ui/dialog/spray-option.cpp create mode 100644 src/ui/dialog/spray-option.h (limited to 'src/ui') diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert index 565a24ecc..fd1b07394 100644 --- a/src/ui/dialog/Makefile_insert +++ b/src/ui/dialog/Makefile_insert @@ -73,6 +73,8 @@ ink_common_sources += \ ui/dialog/print.h \ ui/dialog/scriptdialog.cpp \ ui/dialog/scriptdialog.h \ + ui/dialog/spray-option.cpp \ + ui/dialog/spray-option.h \ ui/dialog/svg-fonts-dialog.cpp \ ui/dialog/svg-fonts-dialog.h \ ui/dialog/swatches.cpp \ diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index d1b818d23..7f853bedc 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -40,6 +40,7 @@ #include "ui/dialog/icon-preview.h" #include "ui/dialog/floating-behavior.h" #include "ui/dialog/dock-behavior.h" +#include "ui/dialog/spray-option.h" #include "preferences.h" #ifdef ENABLE_SVG_FONTS @@ -88,7 +89,6 @@ DialogManager::DialogManager() { int dialogs_type = prefs->getIntLimited("/options/dialogtype/value", DOCK, 0, 1); if (dialogs_type == FLOATING) { - registerFactory("AlignAndDistribute", &create); registerFactory("DocumentMetadata", &create); registerFactory("DocumentProperties", &create); @@ -111,7 +111,8 @@ DialogManager::DialogManager() { registerFactory("Trace", &create); registerFactory("Transformation", &create); registerFactory("UndoHistory", &create); - registerFactory("InputDevices", &create); + registerFactory("InputDevices", &create); + registerFactory("SprayOptionClass", &create); } else { @@ -138,6 +139,7 @@ DialogManager::DialogManager() { registerFactory("Transformation", &create); registerFactory("UndoHistory", &create); registerFactory("InputDevices", &create); + registerFactory("SprayOptionClass", &create); } } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index c7dc789ca..6e30ef61a 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -449,6 +449,12 @@ void InkscapePreferences::initPageTools() AddSelcueCheckbox(_page_tweak, "/tools/tweak", true); AddGradientCheckbox(_page_tweak, "/tools/tweak", false); + //Spray + this->AddPage(_page_spray, _("Spray"), iter_tools, PREFS_PAGE_TOOLS_SPRAY); + this->AddNewObjectsStyle(_page_spray, "/tools/spray", _("Paint objects with:")); + AddSelcueCheckbox(_page_spray, "/tools/spray", true); + AddGradientCheckbox(_page_spray, "/tools/spray", false); + //Zoom this->AddPage(_page_zoom, _("Zoom"), iter_tools, PREFS_PAGE_TOOLS_ZOOM); AddSelcueCheckbox(_page_zoom, "/tools/zoom", true); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 364b0eb1d..705e7a352 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -43,6 +43,7 @@ enum { PREFS_PAGE_TOOLS_SELECTOR, PREFS_PAGE_TOOLS_NODE, PREFS_PAGE_TOOLS_TWEAK, + PREFS_PAGE_TOOLS_SPRAY, PREFS_PAGE_TOOLS_ZOOM, PREFS_PAGE_TOOLS_SHAPES, PREFS_PAGE_TOOLS_SHAPES_RECT, @@ -118,7 +119,7 @@ protected: _page_clones, _page_mask, _page_transforms, _page_filters, _page_select, _page_importexport, _page_cms, _page_grids, _page_svgoutput, _page_misc, _page_ui, _page_save, _page_bitmaps, _page_spellcheck; - DialogPage _page_selector, _page_node, _page_tweak, _page_zoom, _page_shapes, _page_pencil, _page_pen, + DialogPage _page_selector, _page_node, _page_tweak, _page_spray, _page_zoom, _page_shapes, _page_pencil, _page_pen, _page_calligraphy, _page_text, _page_gradient, _page_connector, _page_dropper, _page_lpetool; DialogPage _page_rectangle, _page_3dbox, _page_ellipse, _page_star, _page_spiral, _page_paintbucket, _page_eraser; diff --git a/src/ui/dialog/spray-option.cpp b/src/ui/dialog/spray-option.cpp new file mode 100644 index 000000000..8bfe455fa --- /dev/null +++ b/src/ui/dialog/spray-option.cpp @@ -0,0 +1,381 @@ +/*Julien LERAY (julien.leray@ecl2010.ec-lyon.fr), interface for the spray tool*/ + + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "desktop-handles.h" +#include "unclump.h" +#include "document.h" +#include "enums.h" +#include "graphlayout/graphlayout.h" +#include "inkscape.h" +#include "macros.h" +#include "node-context.h" +#include "preferences.h" +#include "removeoverlap/removeoverlap.h" +#include "selection.h" +#include "shape-editor.h" +#include "sp-flowtext.h" +#include "sp-item-transform.h" +#include "sp-text.h" +#include "text-editing.h" +#include "tools-switch.h" +#include "ui/icon-names.h" +#include "util/glib-list-iterators.h" +#include "verbs.h" +#include "widgets/icon.h" + +#include "spray-option.h" + +namespace Inkscape { +namespace UI { +namespace Dialog { + + +//Classes qui permettent de créer les environnements Gaussienne, Witdh... + + + +class Action { +public: + Action(const Glib::ustring &id, + const Glib::ustring &tiptext, + guint row, guint column, + Gtk::Table &parent, + Gtk::Tooltips &tooltips, + SprayOptionClass &dialog): + _dialog(dialog), + _id(id), + _parent(parent) {} + + virtual ~Action(){} + virtual void on_button_click(){} + SprayOptionClass &_dialog; + +private : + + Glib::ustring _id; + Gtk::Table &_parent; +}; + +class ActionE : public Action { +private: + Gtk::Label _Label; + Gtk::SpinButton _Gap; + guint _min, _max; + Glib::ustring _pref_path; + +public: + ActionE(const Glib::ustring &id, + const Glib::ustring &tiptext, + guint row, guint column, + SprayOptionClass &dialog, + guint min, guint max, + Glib::ustring const &pref_path ): + Action(id, tiptext, row, column, + dialog._Table(), dialog.tooltips(), dialog), + _min(min), + _max(max), + _pref_path(pref_path) + { + dialog._Table().set_col_spacings(3); + + double increm = ((double)_max - (double)_min)/10; + double val_ini = ((double)_max + (double)_min)/2; + _Gap.set_digits(1); + _Gap.set_size_request(60, -1); + _Gap.set_increments(increm , 0); + _Gap.set_range(_min, _max); + _Gap.set_value(val_ini); + dialog.tooltips().set_tip(_Gap, + tiptext); + _Gap.signal_changed().connect(sigc::mem_fun(*this, &ActionE::on_button_click)); //rajout douteux + _Label.set_label(id); + + dialog._Table().attach(_Label, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); + dialog._Table().attach(_Gap, column+1, column+2, row, row+1, Gtk::EXPAND, Gtk::EXPAND); + } + + virtual void on_button_click(){ + if (!_dialog.getDesktop()) return; + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + prefs->setDouble(_pref_path, SP_VERB_CONTEXT_SPRAY); + + double const Gap = _Gap.get_value(); + + + prefs->setDouble(_pref_path, Gap); + + sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_CONTEXT_SPRAY, + _("Remove overlaps")); + } + + +}; + +class ActionF : public Action { +private: + Gtk::Label _Label; + Gtk::Label _Label1; + Gtk::Label _Label2; + Gtk::SpinButton _Gap1; + Gtk::SpinButton _Gap2; + Glib::ustring _pref1_path; + Glib::ustring _pref2_path; + +public: + ActionF(const Glib::ustring &id, + const Glib::ustring &tiptext, + guint row, guint column, + SprayOptionClass &dialog, + Glib::ustring const &pref1_path, + Glib::ustring const &pref2_path ): + Action(id, tiptext, row, column, + dialog._Table(), dialog.tooltips(), dialog), + _pref1_path(pref1_path), + _pref2_path(pref2_path) + { + dialog.F_Table().set_col_spacings(3); + + _Label.set_label(id); + + _Gap1.set_digits(1); + _Gap1.set_size_request(60, -1); + _Gap1.set_increments(0.1, 0); + _Gap1.set_range(0, 10); + _Gap1.set_value(1); + dialog.tooltips().set_tip(_Gap1, + _("Minimum")); + + _Label1.set_label(Q_("Min")); + + _Gap2.set_digits(1); + _Gap2.set_size_request(60, -1); + _Gap2.set_increments(0.1, 0); + _Gap2.set_range(0, 10); + _Gap2.set_value(1); + dialog.tooltips().set_tip(_Gap2, + _("Maximum")); + + _Label2.set_label(_("Max:")); + + _Gap1.signal_changed().connect(sigc::mem_fun(*this, &ActionF::on_button_click)); + _Gap2.signal_changed().connect(sigc::mem_fun(*this, &ActionF::on_button_click)); + + dialog.F_Table().attach(_Label, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); + dialog.F_Table().attach(_Label1, column+1, column+2, row, row+1, Gtk::FILL, Gtk::FILL); + dialog.F_Table().attach(_Gap1, column+2, column+3, row, row+1, Gtk::EXPAND, Gtk::EXPAND); + dialog.F_Table().attach(_Label2, column+3, column+4, row, row+1, Gtk::FILL, Gtk::FILL); + dialog.F_Table().attach(_Gap2, column+4, column+5, row, row+1, Gtk::EXPAND, Gtk::EXPAND); + + } + + virtual void on_button_click(){ + if (!_dialog.getDesktop()) return; + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + prefs->setDouble(_pref1_path, SP_VERB_CONTEXT_SPRAY); + prefs->setDouble(_pref2_path, SP_VERB_CONTEXT_SPRAY); + + double const Gap1 = _Gap1.get_value(); + double const Gap2 = _Gap2.get_value(); + + prefs->setDouble(_pref1_path, Gap1); + prefs->setDouble(_pref2_path, Gap2); + + sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_CONTEXT_SPRAY, + _("Remove overlaps")); + } + + +}; + + + +void SprayOptionClass::combo_action() { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + cout<<"combo.get_active_row_number = "<<_combo.get_active_row_number()<setInt("/tools/spray/distribution", distrib); + + + sp_document_done(sp_desktop_document(this->getDesktop()), SP_VERB_CONTEXT_SPRAY, + _("Remove overlaps")); + +} + + + + +void SprayOptionClass::action() { + int r=1; + for (list::iterator it = _actionList.begin(); + it != _actionList.end(); + it ++) + (*it)->on_button_click(); + combo_action(); +} + + + + + + +void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, SprayOptionClass *daad) +{ + daad->randomize_bbox = Geom::OptRect(); +} + +///////////////////////////////////////////////////////// +//Construction de l'interface +///////////////////////////////////////////////////////// + + +SprayOptionClass::SprayOptionClass() + : UI::Widget::Panel ("", "/dialogs/spray", SP_VERB_DIALOG_SPRAY_OPTION), + _distributionFrame(_("Distribution")), + _Frame(_("Cursor Options")), + _FFrame(_("Random Options")), + _gaussianTable(1, 5, false), + _ETable(3,2,false), + _FTable(2,5,false), + _unifLabel(_("Uniform")), + _gaussLabel(_("Gaussian ")), + _anchorLabel(_("Distribution : ")) + +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + //ComboBoxText + + _combo.append_text(_("Uniforme")); + _combo.append_text(_("Gaussienne")); + + _combo.set_active(prefs->getInt("/tools/spray/distribution", 1)); + _combo.signal_changed().connect(sigc::mem_fun(*this, &SprayOptionClass::combo_action)); + + _anchorBox.pack_start(_anchorLabel); + _anchorBox.pack_start(_combo); + + _gaussianBox.pack_start(_anchorBox); + + + _distributionBox.pack_start(_gaussianBox); + _distributionFrame.add(_distributionBox); + + + //Hbox Random + addFButton(_("Scale : ") ,_("Applique un facteur d'échelle"), 0, 0, "/tools/spray/scale_min","/tools/spray/scale_max"); + addFButton(_("Rotation : ") ,_("Fait tourner"), 1, 0, "/tools/spray/rot_min","/tools/spray/rot_max"); + _FHBox.pack_start(_FLabel); + _FHBox.pack_start(_FTable); + + //Implementation dans la Vbox Cursor + _FVBox.pack_start(_FHBox); + _FFrame.add(_FVBox); + + //Hbox Cursor + addEButton(_("Ratio : ") ,_("Excentricité de l'ellipse"), 0, 0, 0, 1,"/tools/spray/ratio"); + addEButton(_("Angle : ") ,_("Angle de l'ellipse"), 1, 0, 0, 5,"/tools/spray/tilt"); + addEButton(_("Width : ") ,_("Taille de l'ellipse"), 2, 0, 0, 1,"/tools/spray/width"); + _HBox.pack_start(_Label); + _HBox.pack_start(_ETable); + + //Implementation dans la Vbox Cursor + _VBox.pack_start(_HBox); + _Frame.add(_VBox); + + Gtk::Box *contents = _getContents(); + contents->set_spacing(4); + + + + + + + // Crée dans l'ordre suivant les différentes Frames (cadres de réglages) + + contents->pack_start(_distributionFrame, true, true); + contents->pack_start(_FFrame, true, true); + contents->pack_start(_Frame, true, true); + + + + // Connect to the global selection change, to invalidate cached randomize_bbox + g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this); + randomize_bbox = Geom::OptRect(); + + show_all_children(); + + + +} + +SprayOptionClass::~SprayOptionClass() +{ + sp_signal_disconnect_by_data (G_OBJECT (INKSCAPE), this); + + for (std::list::iterator it = _actionList.begin(); + it != _actionList.end(); + it ++) + delete *it; +} + + + + + + + +//Fonctions qui lient la demande d'ajout d'une interface graphique à l'action correspondante + +void SprayOptionClass::addEButton(const Glib::ustring &id, + const Glib::ustring &tiptext, + guint row, guint column, + guint min, guint max, + Glib::ustring const &pref_path) +{ + _actionList.push_back( new ActionE(id, tiptext,row, column,*this,min ,max, pref_path )); +} + +void SprayOptionClass::addFButton(const Glib::ustring &id, + const Glib::ustring &tiptext, + guint row, guint column, + Glib::ustring const &pref1_path, + Glib::ustring const &pref2_path) +{ + _actionList.push_back( new ActionF(id, tiptext,row, column,*this,pref1_path, pref2_path )); +} + + + + + +SprayOptionClass &SprayOptionClass::get_SprayOptionClass() +{ + return *this; +} + +} // namespace Dialog +} // 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:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/spray-option.h b/src/ui/dialog/spray-option.h new file mode 100644 index 000000000..75dfe1e35 --- /dev/null +++ b/src/ui/dialog/spray-option.h @@ -0,0 +1,130 @@ + +/*Julien LERAY (julien.leray@ecl2010.ec-lyon.fr), interface for the spray tool*/ + +#ifndef INKSCAPE_UI_DIALOG_SPRAY_OPTION_H +#define INKSCAPE_UI_DIALOG_SPRAY_OPTION_H + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include "libnr/nr-dim2.h" +#include "libnr/nr-rect.h" + + +#include "ui/widget/panel.h" +#include "ui/widget/notebook-page.h" + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "desktop-handles.h" +#include "unclump.h" +#include "document.h" +#include "enums.h" +#include "graphlayout/graphlayout.h" +#include "inkscape.h" +#include "macros.h" +#include "node-context.h" +#include "preferences.h" +#include "removeoverlap/removeoverlap.h" +#include "selection.h" +#include "shape-editor.h" +#include "sp-flowtext.h" +#include "sp-item-transform.h" +#include "sp-text.h" +#include "text-editing.h" +#include "tools-switch.h" +#include "ui/icon-names.h" +#include "util/glib-list-iterators.h" +#include "verbs.h" +#include "widgets/icon.h" + +#include "spray-context.h" +#include "verbs.h" + +#include +using namespace std; + +using namespace Inkscape::UI::Widget; + +class SPItem; + + +namespace Inkscape { +namespace UI { +namespace Dialog { + +class Action; + +class SprayOptionClass : public Widget::Panel { + +private: + + SprayOptionClass(SprayOptionClass const &d); + SprayOptionClass& operator=(SprayOptionClass const &d); + +public: + SprayOptionClass(); + virtual ~SprayOptionClass(); + void test() { cout<<"appel de test !!"< _actionList; + Gtk::Frame _distributionFrame, _Frame, _FFrame ; + Gtk::Table _distributionTable, _gaussianTable, _ETable, _FTable; + Gtk::HBox _anchorBox; + Gtk::HBox _unifBox, _gaussianBox, _HBox, _FHBox, _BoutonBox; + Gtk::VBox _distributionBox, _VBox, _FVBox, _ActionBox; + Gtk::Label _anchorLabel; + Gtk::Label _unifLabel, _gaussLabel, _Label, _FLabel; + Gtk::CheckButton _unif, _gauss; + Gtk::ComboBoxText _combo; + Gtk::Tooltips _tooltips; + +}; + + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape + +#endif // INKSCAPE_UI_DIALOG_ALIGN_AND_DISTRIBUTE_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:encoding=utf-8:textwidth=99 : + diff --git a/src/ui/icon-names.h b/src/ui/icon-names.h index f9a6f2a7d..0388b200f 100644 --- a/src/ui/icon-names.h +++ b/src/ui/icon-names.h @@ -456,6 +456,14 @@ "snap-nodes-smooth" #define INKSCAPE_ICON_SNAP_PAGE \ "snap-page" +#define INKSCAPE_ICON_SPRAY_COPY_MODE \ + "spray-copy-mode" +#define INKSCAPE_ICON_SPRAY_CLONE_MODE \ + "spray-clone-mode" +#define INKSCAPE_ICON_SPRAY_UNION_MODE \ + "spray-union-mode" +#define INKSCAPE_ICON_DIALOG_SPRAY_OPTIONS \ + "dialog-spray-options" #define INKSCAPE_ICON_STROKE_CAP_BUTT \ "stroke-cap-butt" #define INKSCAPE_ICON_STROKE_CAP_ROUND \ @@ -488,6 +496,8 @@ "tool-pointer" #define INKSCAPE_ICON_TOOL_TWEAK \ "tool-tweak" +#define INKSCAPE_ICON_TOOL_SPRAY \ + "tool-spray" #define INKSCAPE_ICON_TRANSFORM_AFFECT_GRADIENT \ "transform-affect-gradient" #define INKSCAPE_ICON_TRANSFORM_AFFECT_PATTERN \ diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index 770a9bf87..d34b18771 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -227,6 +227,12 @@ EditWidget::onDialogAlignAndDistribute() _dlg_mgr.showDialog("AlignAndDistribute"); } +void +EditWidget::onDialogSprayOptionClass() +{ + _dlg_mgr.showDialog("SprayOptionClass"); +} + void EditWidget::onDialogDocumentProperties() { diff --git a/src/ui/view/edit-widget.h b/src/ui/view/edit-widget.h index 2bb708305..452641e80 100644 --- a/src/ui/view/edit-widget.h +++ b/src/ui/view/edit-widget.h @@ -70,6 +70,7 @@ public: void onDialogAbout(); void onDialogAlignAndDistribute(); + void onDialogSprayOptionClass(); void onDialogInkscapePreferences(); void onDialogDialog(); void onDialogDocumentProperties(); -- cgit v1.2.3 From 0cf189f9ab1ac334b55e9059ad3905bed9edffc6 Mon Sep 17 00:00:00 2001 From: "Arcadie M. Cracan" Date: Wed, 2 Dec 2009 22:26:44 +0200 Subject: Merge GSoC2009 Connectors into trunk (bzr r8855) --- src/ui/icon-names.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/ui') diff --git a/src/ui/icon-names.h b/src/ui/icon-names.h index 0388b200f..76e76ea34 100644 --- a/src/ui/icon-names.h +++ b/src/ui/icon-names.h @@ -56,10 +56,18 @@ "color-picker" #define INKSCAPE_ICON_COLOR_REMOVE \ "color-remove" +#define INKSCAPE_ICON_CONNECTOR_EDIT \ + "connector-edit" #define INKSCAPE_ICON_CONNECTOR_AVOID \ "connector-avoid" #define INKSCAPE_ICON_CONNECTOR_IGNORE \ "connector-ignore" +#define INKSCAPE_ICON_CONNECTOR_ORTHOGONAL \ + "connector-orthogonal" +#define INKSCAPE_ICON_CONNECTOR_NEW_CONNPOINT \ + "connector-new-connpoint" +#define INKSCAPE_ICON_CONNECTOR_REMOVE_CONNPOINT \ + "connector-remove-connpoint" #define INKSCAPE_ICON_DIALOG_ALIGN_AND_DISTRIBUTE \ "dialog-align-and-distribute" #define INKSCAPE_ICON_DIALOG_FILL_AND_STROKE \ -- cgit v1.2.3 From 10c0e8f5733f0cde622d259ffd70877ec35577c1 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 6 Dec 2009 14:19:59 -0800 Subject: Added UI for threading pref in Filter Preferences for Gaussian Blur, default 1 for sanity (bzr r8874) --- src/ui/dialog/inkscape-preferences.cpp | 5 +++++ src/ui/dialog/inkscape-preferences.h | 1 + 2 files changed, 6 insertions(+) (limited to 'src/ui') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index b217f8695..90516063c 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -741,6 +741,11 @@ void InkscapePreferences::initPageFilters() _page_filters.add_line(true, "", _show_filters_info_box, "", _("Show icons and descriptions for the filter primitives available at the filter effects dialog.")); + /* threaded blur */ //related comments/widgets/functions should be renamed and option should be moved elsewhere when inkscape is fully multi-threaded + _filter_multi_threaded.init("/options/threading/numthreads", 1.0, 8.0, 1.0, 2.0, 4.0, true, false); + _page_filters.add_line( false, _("Number of Threads:"), _filter_multi_threaded, _("(requires restart)"), + _("Configure number of processors/threads to use with rendering of gaussian blur."), false); + this->AddPage(_page_filters, _("Filters"), PREFS_PAGE_FILTERS); } diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 705e7a352..16e62df59 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -171,6 +171,7 @@ protected: PrefRadioButton _blur_quality_best, _blur_quality_better, _blur_quality_normal, _blur_quality_worse, _blur_quality_worst; PrefRadioButton _filter_quality_best, _filter_quality_better, _filter_quality_normal, _filter_quality_worse, _filter_quality_worst; PrefCheckButton _show_filters_info_box; + PrefSpinButton _filter_multi_threaded; PrefCheckButton _trans_scale_stroke, _trans_scale_corner, _trans_gradient,_trans_pattern; PrefRadioButton _trans_optimized, _trans_preserved; -- cgit v1.2.3 From 77b13a8faf051fc4083b8f6e2efc57efe74d012f Mon Sep 17 00:00:00 2001 From: Ivan Mas??r Date: Tue, 8 Dec 2009 00:34:08 +0100 Subject: Spray Tool: translated forgotten strings from French to English (bzr r8877) --- src/ui/dialog/spray-option.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/spray-option.cpp b/src/ui/dialog/spray-option.cpp index 8bfe455fa..33e9f2033 100644 --- a/src/ui/dialog/spray-option.cpp +++ b/src/ui/dialog/spray-option.cpp @@ -249,7 +249,7 @@ SprayOptionClass::SprayOptionClass() _ETable(3,2,false), _FTable(2,5,false), _unifLabel(_("Uniform")), - _gaussLabel(_("Gaussian ")), + _gaussLabel(_("Gaussian")), _anchorLabel(_("Distribution : ")) { @@ -257,8 +257,8 @@ SprayOptionClass::SprayOptionClass() //ComboBoxText - _combo.append_text(_("Uniforme")); - _combo.append_text(_("Gaussienne")); + _combo.append_text(_("Uniform")); + _combo.append_text(_("Gaussian")); _combo.set_active(prefs->getInt("/tools/spray/distribution", 1)); _combo.signal_changed().connect(sigc::mem_fun(*this, &SprayOptionClass::combo_action)); @@ -274,8 +274,8 @@ SprayOptionClass::SprayOptionClass() //Hbox Random - addFButton(_("Scale : ") ,_("Applique un facteur d'échelle"), 0, 0, "/tools/spray/scale_min","/tools/spray/scale_max"); - addFButton(_("Rotation : ") ,_("Fait tourner"), 1, 0, "/tools/spray/rot_min","/tools/spray/rot_max"); + addFButton(_("Scale : ") ,_("Apply a scale factor"), 0, 0, "/tools/spray/scale_min","/tools/spray/scale_max"); + addFButton(_("Rotation : ") ,_("Apply rotation"), 1, 0, "/tools/spray/rot_min","/tools/spray/rot_max"); _FHBox.pack_start(_FLabel); _FHBox.pack_start(_FTable); @@ -284,9 +284,9 @@ SprayOptionClass::SprayOptionClass() _FFrame.add(_FVBox); //Hbox Cursor - addEButton(_("Ratio : ") ,_("Excentricité de l'ellipse"), 0, 0, 0, 1,"/tools/spray/ratio"); - addEButton(_("Angle : ") ,_("Angle de l'ellipse"), 1, 0, 0, 5,"/tools/spray/tilt"); - addEButton(_("Width : ") ,_("Taille de l'ellipse"), 2, 0, 0, 1,"/tools/spray/width"); + addEButton(_("Ratio : ") ,_("Eccentricity of the ellipse"), 0, 0, 0, 1,"/tools/spray/ratio"); + addEButton(_("Angle : ") ,_("Angle of the ellipse"), 1, 0, 0, 5,"/tools/spray/tilt"); + addEButton(_("Width : ") ,_("Size of the ellipse"), 2, 0, 0, 1,"/tools/spray/width"); _HBox.pack_start(_Label); _HBox.pack_start(_ETable); -- cgit v1.2.3 From e9b65e09d897f4238eae8ea16021470e06da7076 Mon Sep 17 00:00:00 2001 From: Ivan Mas??r Date: Tue, 8 Dec 2009 00:35:12 +0100 Subject: Spray Tool: add context to strings (bzr r8878) --- src/ui/dialog/spray-option.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/spray-option.cpp b/src/ui/dialog/spray-option.cpp index 33e9f2033..ec83b07cd 100644 --- a/src/ui/dialog/spray-option.cpp +++ b/src/ui/dialog/spray-option.cpp @@ -242,23 +242,23 @@ void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selecti SprayOptionClass::SprayOptionClass() : UI::Widget::Panel ("", "/dialogs/spray", SP_VERB_DIALOG_SPRAY_OPTION), - _distributionFrame(_("Distribution")), - _Frame(_("Cursor Options")), - _FFrame(_("Random Options")), + _distributionFrame(Q_("sprayOptions|Distribution")), + _Frame(Q_("sprayOptions|Cursor Options")), + _FFrame(Q_("sprayOptions|Random Options")), _gaussianTable(1, 5, false), _ETable(3,2,false), _FTable(2,5,false), - _unifLabel(_("Uniform")), - _gaussLabel(_("Gaussian")), - _anchorLabel(_("Distribution : ")) + _unifLabel(Q_("sprayOptions|Uniform")), + _gaussLabel(Q_("sprayOptions|Gaussian")), + _anchorLabel(Q_("sprayOptions|Distribution:")) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); //ComboBoxText - _combo.append_text(_("Uniform")); - _combo.append_text(_("Gaussian")); + _combo.append_text(Q_("sprayOptions|Uniform")); + _combo.append_text(Q_("sprayOptions|Gaussian")); _combo.set_active(prefs->getInt("/tools/spray/distribution", 1)); _combo.signal_changed().connect(sigc::mem_fun(*this, &SprayOptionClass::combo_action)); @@ -274,8 +274,8 @@ SprayOptionClass::SprayOptionClass() //Hbox Random - addFButton(_("Scale : ") ,_("Apply a scale factor"), 0, 0, "/tools/spray/scale_min","/tools/spray/scale_max"); - addFButton(_("Rotation : ") ,_("Apply rotation"), 1, 0, "/tools/spray/rot_min","/tools/spray/rot_max"); + addFButton(Q_("sprayOptions|Scale:") ,_("Apply a scale factor"), 0, 0, "/tools/spray/scale_min","/tools/spray/scale_max"); + addFButton(Q_("sprayOptions|Rotation:") ,_("Apply rotation"), 1, 0, "/tools/spray/rot_min","/tools/spray/rot_max"); _FHBox.pack_start(_FLabel); _FHBox.pack_start(_FTable); @@ -284,9 +284,9 @@ SprayOptionClass::SprayOptionClass() _FFrame.add(_FVBox); //Hbox Cursor - addEButton(_("Ratio : ") ,_("Eccentricity of the ellipse"), 0, 0, 0, 1,"/tools/spray/ratio"); - addEButton(_("Angle : ") ,_("Angle of the ellipse"), 1, 0, 0, 5,"/tools/spray/tilt"); - addEButton(_("Width : ") ,_("Size of the ellipse"), 2, 0, 0, 1,"/tools/spray/width"); + addEButton(Q_("sprayOptions|Ratio:") ,_("Eccentricity of the ellipse"), 0, 0, 0, 1,"/tools/spray/ratio"); + addEButton(Q_("sprayOptions|Angle:") ,_("Angle of the ellipse"), 1, 0, 0, 5,"/tools/spray/tilt"); + addEButton(Q_("sprayOptions|Width:") ,_("Size of the ellipse"), 2, 0, 0, 1,"/tools/spray/width"); _HBox.pack_start(_Label); _HBox.pack_start(_ETable); -- cgit v1.2.3 From b13df173f8e6471ce720d45370447b9e52cd3925 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Fri, 11 Dec 2009 06:37:11 -0200 Subject: - new: Print Colors Preview Dialog and rendermode - works with shapes. I still need to make it work with gradients and imported images (bzr r8881) --- src/ui/dialog/Makefile_insert | 2 + src/ui/dialog/dialog-manager.cpp | 3 + src/ui/dialog/print-colors-preview-dialog.cpp | 100 ++++++++++++++++++++++++++ src/ui/dialog/print-colors-preview-dialog.h | 48 +++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 src/ui/dialog/print-colors-preview-dialog.cpp create mode 100644 src/ui/dialog/print-colors-preview-dialog.h (limited to 'src/ui') diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert index fd1b07394..fac5bad80 100644 --- a/src/ui/dialog/Makefile_insert +++ b/src/ui/dialog/Makefile_insert @@ -71,6 +71,8 @@ ink_common_sources += \ ui/dialog/panel-dialog.h \ ui/dialog/print.cpp \ ui/dialog/print.h \ + ui/dialog/print-colors-preview-dialog.cpp \ + ui/dialog/print-colors-preview-dialog.h \ ui/dialog/scriptdialog.cpp \ ui/dialog/scriptdialog.h \ ui/dialog/spray-option.cpp \ diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 7f853bedc..2116d46c3 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -41,6 +41,7 @@ #include "ui/dialog/floating-behavior.h" #include "ui/dialog/dock-behavior.h" #include "ui/dialog/spray-option.h" +#include "ui/dialog/print-colors-preview-dialog.h" #include "preferences.h" #ifdef ENABLE_SVG_FONTS @@ -102,6 +103,7 @@ DialogManager::DialogManager() { registerFactory("LivePathEffect", &create); registerFactory("Memory", &create); registerFactory("Messages", &create); + registerFactory("PrintColorsPreviewDialog", &create); registerFactory("Script", &create); #ifdef ENABLE_SVG_FONTS registerFactory("SvgFontsDialog", &create); @@ -129,6 +131,7 @@ DialogManager::DialogManager() { registerFactory("LivePathEffect", &create); registerFactory("Memory", &create); registerFactory("Messages", &create); + registerFactory("PrintColorsPreviewDialog", &create); registerFactory("Script", &create); #ifdef ENABLE_SVG_FONTS registerFactory("SvgFontsDialog", &create); diff --git a/src/ui/dialog/print-colors-preview-dialog.cpp b/src/ui/dialog/print-colors-preview-dialog.cpp new file mode 100644 index 000000000..f4d83c271 --- /dev/null +++ b/src/ui/dialog/print-colors-preview-dialog.cpp @@ -0,0 +1,100 @@ +/** @file + * @brief Print Colors Preview dialog - implementation + */ +/* Authors: + * Felipe C. da S. Sanches + * + * Copyright (C) 2009 Authors + * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information. + */ + +#include "desktop.h" +#include "print-colors-preview-dialog.h" +#include "preferences.h" +#include + +namespace Inkscape { +namespace UI { +namespace Dialog { + +//Yes, I know we shouldn't hardcode CMYK. This class needs to be refactored +// in order to accomodate spot colors and color components defined using +// ICC colors. --Juca + +void PrintColorsPreviewDialog::toggle_cyan(){ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/options/printcolorspreview/cyan", cyan->get_active()); + + SPDesktop *desktop = getDesktop(); + desktop->setDisplayModePrintColorsPreview(); +} + +void PrintColorsPreviewDialog::toggle_magenta(){ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/options/printcolorspreview/magenta", magenta->get_active()); + + SPDesktop *desktop = getDesktop(); + desktop->setDisplayModePrintColorsPreview(); +} + +void PrintColorsPreviewDialog::toggle_yellow(){ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/options/printcolorspreview/yellow", yellow->get_active()); + + SPDesktop *desktop = getDesktop(); + desktop->setDisplayModePrintColorsPreview(); +} + +void PrintColorsPreviewDialog::toggle_black(){ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/options/printcolorspreview/black", black->get_active()); + + SPDesktop *desktop = getDesktop(); + desktop->setDisplayModePrintColorsPreview(); +} + +PrintColorsPreviewDialog::PrintColorsPreviewDialog() + : UI::Widget::Panel("", "/dialogs/printcolorspreview", SP_VERB_DIALOG_PRINT_COLORS_PREVIEW) +{ + Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox()); + + cyan = new Gtk::ToggleButton(_("Cyan")); + vbox->pack_start( *cyan, false, false ); +// tips.set_tip((*cyan), _("Render cyan separation")); + cyan->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_cyan) ); + + magenta = new Gtk::ToggleButton(_("Magenta")); + vbox->pack_start( *magenta, false, false ); +// tips.set_tip((*magenta), _("Render magenta separation")); + magenta->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_magenta) ); + + yellow = new Gtk::ToggleButton(_("Yellow")); + vbox->pack_start( *yellow, false, false ); +// tips.set_tip((*yellow), _("Render yellow separation")); + yellow->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_yellow) ); + + black = new Gtk::ToggleButton(_("Black")); + vbox->pack_start( *black, false, false ); +// tips.set_tip((*black), _("Render black separation")); + black->signal_clicked().connect( sigc::mem_fun(*this, &PrintColorsPreviewDialog::toggle_black) ); + + gint val; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + val = prefs->getBool("/options/printcolorspreview/cyan"); + cyan->set_active( val != 0 ); + val = prefs->getBool("/options/printcolorspreview/magenta"); + magenta->set_active( val != 0 ); + val = prefs->getBool("/options/printcolorspreview/yellow"); + yellow->set_active( val != 0 ); + val = prefs->getBool("/options/printcolorspreview/black"); + black->set_active( val != 0 ); + + _getContents()->add(*vbox); + _getContents()->show_all(); +} + +PrintColorsPreviewDialog::~PrintColorsPreviewDialog(){} + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape diff --git a/src/ui/dialog/print-colors-preview-dialog.h b/src/ui/dialog/print-colors-preview-dialog.h new file mode 100644 index 000000000..246908556 --- /dev/null +++ b/src/ui/dialog/print-colors-preview-dialog.h @@ -0,0 +1,48 @@ +/** @file + * @brief Print Colors Preview dialog + */ +/* Authors: + * Felipe Corrêa da Silva Sanches + * + * Copyright (C) 2009 Authors + * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information. + */ + +#ifndef INKSCAPE_UI_DIALOG_PRINT_COLORS_PREVIEW_H +#define INKSCAPE_UI_DIALOG_PRINT_COLORS_PREVIEW_H + +#include "ui/widget/panel.h" +#include "verbs.h" + +#include +#include + +namespace Inkscape { +namespace UI { +namespace Dialog { + +class PrintColorsPreviewDialog : public UI::Widget::Panel { +public: + PrintColorsPreviewDialog(); + ~PrintColorsPreviewDialog(); + + static PrintColorsPreviewDialog &getInstance() + { return *new PrintColorsPreviewDialog(); } + +private: + void toggle_cyan(); + void toggle_magenta(); + void toggle_yellow(); + void toggle_black(); + + Gtk::ToggleButton* cyan; + Gtk::ToggleButton* magenta; + Gtk::ToggleButton* yellow; + Gtk::ToggleButton* black; +}; + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape + +#endif //#ifndef INKSCAPE_UI_PRINT_COLORS_PREVIEW_H -- cgit v1.2.3 From 0daeeb2e989701416cbd6c33cf7e81c73f4944d3 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 12 Dec 2009 16:01:30 -0800 Subject: reenable per-document palette to allow for continuing development. (bzr r8885) --- src/ui/dialog/swatches.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 1f708e3de..450d4202d 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -47,7 +47,7 @@ #include "display/nr-plain-stuff.h" #include "sp-gradient-reference.h" -//#define USE_DOCUMENT_PALETTE 1 +#define USE_DOCUMENT_PALETTE 1 namespace Inkscape { namespace UI { -- cgit v1.2.3 From 79250d25cc035d894158eaf7ea15cf31df62025c Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Sun, 13 Dec 2009 21:55:34 -0200 Subject: updating my email address in file headers (bzr r8889) --- src/ui/dialog/filter-effects-dialog.cpp | 2 +- src/ui/dialog/svg-fonts-dialog.cpp | 2 +- src/ui/dialog/svg-fonts-dialog.h | 2 +- src/ui/widget/spin-slider.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index c7f505046..1345ffe55 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -4,7 +4,7 @@ /* Authors: * Nicholas Bishop * Rodrigo Kumpera - * Felipe C. da S. Sanches + * Felipe C. da S. Sanches * * Copyright (C) 2007 Authors * diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 5f86196b1..cb22e029b 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -2,7 +2,7 @@ * @brief SVG Fonts dialog - implementation */ /* Authors: - * Felipe C. da S. Sanches + * Felipe C. da S. Sanches * * Copyright (C) 2008 Authors * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information. diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index e6042ed42..e819187a1 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -2,7 +2,7 @@ * @brief SVG Fonts dialog */ /* Authors: - * Felipe Corrêa da Silva Sanches + * Felipe Corrêa da Silva Sanches * * Copyright (C) 2008 Authors * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information. diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index b610c1ee6..e3e73a51f 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -3,7 +3,7 @@ * * Author: * Nicholas Bishop - * Felipe C. da S. Sanches + * Felipe C. da S. Sanches * * Copyright (C) 2007 Author * -- cgit v1.2.3 From e29cecc01b6fa0a8984ef780819e8e812b5505fc Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 20 Dec 2009 01:40:55 -0800 Subject: Warning cleanup (bzr r8895) --- src/ui/dialog/print.cpp | 14 ++++-- src/ui/dialog/spray-option.cpp | 110 +++++++++++++++++++++++------------------ src/ui/dialog/spray-option.h | 41 ++++++++++----- 3 files changed, 100 insertions(+), 65 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index f9db265d6..60cab06a2 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -31,11 +31,15 @@ -static void -draw_page (GtkPrintOperation *operation, - GtkPrintContext *context, - gint /*page_nr*/, - gpointer user_data) +static void draw_page( +#ifdef WIN32 + GtkPrintOperation *operation, +#else + GtkPrintOperation *, +#endif + GtkPrintContext *context, + gint /*page_nr*/, + gpointer user_data) { struct workaround_gtkmm *junk = (struct workaround_gtkmm*)user_data; //printf("%s %d\n",__FUNCTION__, page_nr); diff --git a/src/ui/dialog/spray-option.cpp b/src/ui/dialog/spray-option.cpp index ec83b07cd..a9e037381 100644 --- a/src/ui/dialog/spray-option.cpp +++ b/src/ui/dialog/spray-option.cpp @@ -14,11 +14,11 @@ #include "graphlayout/graphlayout.h" #include "inkscape.h" #include "macros.h" -#include "node-context.h" +#include "node-context.h" #include "preferences.h" #include "removeoverlap/removeoverlap.h" #include "selection.h" -#include "shape-editor.h" +#include "shape-editor.h" #include "sp-flowtext.h" #include "sp-item-transform.h" #include "sp-text.h" @@ -43,21 +43,22 @@ namespace Dialog { class Action { public: Action(const Glib::ustring &id, - const Glib::ustring &tiptext, - guint row, guint column, + const Glib::ustring &/*tiptext*/, + guint /*row*/, + guint /*column*/, Gtk::Table &parent, - Gtk::Tooltips &tooltips, + Gtk::Tooltips &/*tooltips*/, SprayOptionClass &dialog): _dialog(dialog), _id(id), _parent(parent) {} - + virtual ~Action(){} virtual void on_button_click(){} SprayOptionClass &_dialog; - + private : - + Glib::ustring _id; Gtk::Table &_parent; }; @@ -85,7 +86,7 @@ public: dialog._Table().set_col_spacings(3); double increm = ((double)_max - (double)_min)/10; - double val_ini = ((double)_max + (double)_min)/2; + double val_ini = ((double)_max + (double)_min)/2; _Gap.set_digits(1); _Gap.set_size_request(60, -1); _Gap.set_increments(increm , 0); @@ -102,14 +103,14 @@ public: virtual void on_button_click(){ if (!_dialog.getDesktop()) return; - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - + prefs->setDouble(_pref_path, SP_VERB_CONTEXT_SPRAY); - + double const Gap = _Gap.get_value(); - - + + prefs->setDouble(_pref_path, Gap); sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_CONTEXT_SPRAY, @@ -117,7 +118,7 @@ public: } -}; +}; class ActionF : public Action { private: @@ -143,7 +144,7 @@ public: { dialog.F_Table().set_col_spacings(3); - _Label.set_label(id); + _Label.set_label(id); _Gap1.set_digits(1); _Gap1.set_size_request(60, -1); @@ -152,7 +153,7 @@ public: _Gap1.set_value(1); dialog.tooltips().set_tip(_Gap1, _("Minimum")); - + _Label1.set_label(Q_("Min")); _Gap2.set_digits(1); @@ -162,11 +163,11 @@ public: _Gap2.set_value(1); dialog.tooltips().set_tip(_Gap2, _("Maximum")); - + _Label2.set_label(_("Max:")); - + _Gap1.signal_changed().connect(sigc::mem_fun(*this, &ActionF::on_button_click)); - _Gap2.signal_changed().connect(sigc::mem_fun(*this, &ActionF::on_button_click)); + _Gap2.signal_changed().connect(sigc::mem_fun(*this, &ActionF::on_button_click)); dialog.F_Table().attach(_Label, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); dialog.F_Table().attach(_Label1, column+1, column+2, row, row+1, Gtk::FILL, Gtk::FILL); @@ -178,15 +179,15 @@ public: virtual void on_button_click(){ if (!_dialog.getDesktop()) return; - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - + prefs->setDouble(_pref1_path, SP_VERB_CONTEXT_SPRAY); prefs->setDouble(_pref2_path, SP_VERB_CONTEXT_SPRAY); - + double const Gap1 = _Gap1.get_value(); double const Gap2 = _Gap2.get_value(); - + prefs->setDouble(_pref1_path, Gap1); prefs->setDouble(_pref2_path, Gap2); @@ -195,21 +196,21 @@ public: } -}; +}; void SprayOptionClass::combo_action() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); cout<<"combo.get_active_row_number = "<<_combo.get_active_row_number()<setInt("/tools/spray/distribution", distrib); - + sp_document_done(sp_desktop_document(this->getDesktop()), SP_VERB_CONTEXT_SPRAY, - _("Remove overlaps")); + _("Remove overlaps")); } @@ -217,11 +218,9 @@ void SprayOptionClass::combo_action() { void SprayOptionClass::action() { - int r=1; - for (list::iterator it = _actionList.begin(); - it != _actionList.end(); - it ++) + for (list::iterator it = _actionList.begin(); it != _actionList.end(); ++it) { (*it)->on_button_click(); + } combo_action(); } @@ -242,16 +241,33 @@ void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selecti SprayOptionClass::SprayOptionClass() : UI::Widget::Panel ("", "/dialogs/spray", SP_VERB_DIALOG_SPRAY_OPTION), + _actionList(), _distributionFrame(Q_("sprayOptions|Distribution")), _Frame(Q_("sprayOptions|Cursor Options")), _FFrame(Q_("sprayOptions|Random Options")), + _distributionTable(), _gaussianTable(1, 5, false), _ETable(3,2,false), _FTable(2,5,false), + _anchorBox(), + _unifBox(), + _gaussianBox(), + _HBox(), + _FHBox(), + _BoutonBox(), + _distributionBox(), + _VBox(), + _FVBox(), + _ActionBox(), + _anchorLabel(Q_("sprayOptions|Distribution:")), _unifLabel(Q_("sprayOptions|Uniform")), _gaussLabel(Q_("sprayOptions|Gaussian")), - _anchorLabel(Q_("sprayOptions|Distribution:")) - + _Label(), + _FLabel(), + _unif(), + _gauss(), + _combo(), + _tooltips() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -259,7 +275,7 @@ SprayOptionClass::SprayOptionClass() _combo.append_text(Q_("sprayOptions|Uniform")); _combo.append_text(Q_("sprayOptions|Gaussian")); - + _combo.set_active(prefs->getInt("/tools/spray/distribution", 1)); _combo.signal_changed().connect(sigc::mem_fun(*this, &SprayOptionClass::combo_action)); @@ -281,7 +297,7 @@ SprayOptionClass::SprayOptionClass() //Implementation dans la Vbox Cursor _FVBox.pack_start(_FHBox); - _FFrame.add(_FVBox); + _FFrame.add(_FVBox); //Hbox Cursor addEButton(Q_("sprayOptions|Ratio:") ,_("Eccentricity of the ellipse"), 0, 0, 0, 1,"/tools/spray/ratio"); @@ -297,26 +313,26 @@ SprayOptionClass::SprayOptionClass() Gtk::Box *contents = _getContents(); contents->set_spacing(4); - - - + + + // Crée dans l'ordre suivant les différentes Frames (cadres de réglages) contents->pack_start(_distributionFrame, true, true); - contents->pack_start(_FFrame, true, true); + contents->pack_start(_FFrame, true, true); contents->pack_start(_Frame, true, true); - - + + // Connect to the global selection change, to invalidate cached randomize_bbox g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this); randomize_bbox = Geom::OptRect(); show_all_children(); - - + + } @@ -342,7 +358,7 @@ void SprayOptionClass::addEButton(const Glib::ustring &id, const Glib::ustring &tiptext, guint row, guint column, guint min, guint max, - Glib::ustring const &pref_path) + Glib::ustring const &pref_path) { _actionList.push_back( new ActionE(id, tiptext,row, column,*this,min ,max, pref_path )); } @@ -351,7 +367,7 @@ void SprayOptionClass::addFButton(const Glib::ustring &id, const Glib::ustring &tiptext, guint row, guint column, Glib::ustring const &pref1_path, - Glib::ustring const &pref2_path) + Glib::ustring const &pref2_path) { _actionList.push_back( new ActionF(id, tiptext,row, column,*this,pref1_path, pref2_path )); } diff --git a/src/ui/dialog/spray-option.h b/src/ui/dialog/spray-option.h index 75dfe1e35..42090a120 100644 --- a/src/ui/dialog/spray-option.h +++ b/src/ui/dialog/spray-option.h @@ -33,11 +33,11 @@ #include "graphlayout/graphlayout.h" #include "inkscape.h" #include "macros.h" -#include "node-context.h" +#include "node-context.h" #include "preferences.h" #include "removeoverlap/removeoverlap.h" #include "selection.h" -#include "shape-editor.h" +#include "shape-editor.h" #include "sp-flowtext.h" #include "sp-item-transform.h" #include "sp-text.h" @@ -71,19 +71,19 @@ private: SprayOptionClass(SprayOptionClass const &d); SprayOptionClass& operator=(SprayOptionClass const &d); - + public: SprayOptionClass(); - virtual ~SprayOptionClass(); + virtual ~SprayOptionClass(); void test() { cout<<"appel de test !!"< _actionList; - Gtk::Frame _distributionFrame, _Frame, _FFrame ; - Gtk::Table _distributionTable, _gaussianTable, _ETable, _FTable; + Gtk::Frame _distributionFrame; + Gtk::Frame _Frame; + Gtk::Frame _FFrame; + Gtk::Table _distributionTable; + Gtk::Table _gaussianTable; + Gtk::Table _ETable; + Gtk::Table _FTable; Gtk::HBox _anchorBox; - Gtk::HBox _unifBox, _gaussianBox, _HBox, _FHBox, _BoutonBox; - Gtk::VBox _distributionBox, _VBox, _FVBox, _ActionBox; + Gtk::HBox _unifBox; + Gtk::HBox _gaussianBox; + Gtk::HBox _HBox; + Gtk::HBox _FHBox; + Gtk::HBox _BoutonBox; + Gtk::VBox _distributionBox; + Gtk::VBox _VBox; + Gtk::VBox _FVBox; + Gtk::VBox _ActionBox; Gtk::Label _anchorLabel; - Gtk::Label _unifLabel, _gaussLabel, _Label, _FLabel; - Gtk::CheckButton _unif, _gauss; + Gtk::Label _unifLabel; + Gtk::Label _gaussLabel; + Gtk::Label _Label; + Gtk::Label _FLabel; + Gtk::CheckButton _unif; + Gtk::CheckButton _gauss; Gtk::ComboBoxText _combo; Gtk::Tooltips _tooltips; - }; -- cgit v1.2.3 From 95aae7353480cc5090afd4fefd27db1843e97d91 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Mon, 28 Dec 2009 13:31:56 +0100 Subject: Use correct text anchor for vertical text and when aligning or distributing (bzr r8922) --- src/ui/dialog/align-and-distribute.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 024d4b2f1..2bba0a0f8 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -705,14 +705,16 @@ private : { if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) { Inkscape::Text::Layout const *layout = te_get_layout(*it); - Geom::Point base = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(*it); - if (base[Geom::X] < b_min[Geom::X]) b_min[Geom::X] = base[Geom::X]; - if (base[Geom::Y] < b_min[Geom::Y]) b_min[Geom::Y] = base[Geom::Y]; - if (base[Geom::X] > b_max[Geom::X]) b_max[Geom::X] = base[Geom::X]; - if (base[Geom::Y] > b_max[Geom::Y]) b_max[Geom::Y] = base[Geom::Y]; - - Baselines b (*it, base, _orientation); - sorted.push_back(b); + boost::optional pt = layout->baselineAnchorPoint(); + if (pt) { + Geom::Point base = *pt * sp_item_i2d_affine(*it); + if (base[Geom::X] < b_min[Geom::X]) b_min[Geom::X] = base[Geom::X]; + if (base[Geom::Y] < b_min[Geom::Y]) b_min[Geom::Y] = base[Geom::Y]; + if (base[Geom::X] > b_max[Geom::X]) b_max[Geom::X] = base[Geom::X]; + if (base[Geom::Y] > b_max[Geom::Y]) b_max[Geom::Y] = base[Geom::Y]; + Baselines b (*it, base, _orientation); + sorted.push_back(b); + } } } @@ -746,11 +748,14 @@ private : { if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) { Inkscape::Text::Layout const *layout = te_get_layout(*it); - Geom::Point base = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(*it); - Geom::Point t(0.0, 0.0); - t[_orientation] = b_min[_orientation] - base[_orientation]; - sp_item_move_rel(*it, Geom::Translate(t)); - changed = true; + boost::optional pt = layout->baselineAnchorPoint(); + if (pt) { + Geom::Point base = *pt * sp_item_i2d_affine(*it); + Geom::Point t(0.0, 0.0); + t[_orientation] = b_min[_orientation] - base[_orientation]; + sp_item_move_rel(*it, Geom::Translate(t)); + changed = true; + } } } -- cgit v1.2.3 From 73cd5b89883ba845125ae0a022ac8e50a6f7ebce Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 31 Dec 2009 02:04:42 -0800 Subject: Document properties now treats lcms file load failures as non-fatal. Fixes bug #501782 Fixed bugs: - https://launchpad.net/bugs/501782 (bzr r8930) --- src/ui/dialog/document-properties.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 982fb3415..a7241ea40 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -353,6 +353,7 @@ DocumentProperties::populate_available_profiles(){ while ((filename = (gchar *)g_dir_read_name(directory)) != NULL) { gchar* full = g_build_filename(it->c_str(), filename, NULL); if ( !Inkscape::IO::file_test( full, G_FILE_TEST_IS_DIR ) ) { + cmsErrorAction( LCMS_ERROR_SHOW ); cmsHPROFILE hProfile = cmsOpenProfileFromFile(full, "r"); if (hProfile != NULL){ const gchar* name; -- cgit v1.2.3 From 2866152c8917b26ea2d82d789dd43941294fdb9f Mon Sep 17 00:00:00 2001 From: Steren Giannini Date: Sun, 3 Jan 2010 21:39:52 +0100 Subject: Spray cleanup ------------ This line and the following will be ignored -------------- removed: src/ui/dialog/spray-option.cpp src/ui/dialog/spray-option.h modified: src/spray-context.cpp src/ui/dialog/Makefile_insert src/ui/dialog/dialog-manager.cpp src/ui/view/edit-widget.cpp src/ui/view/edit-widget.h src/widgets/toolbox.cpp unknown: backup.bzr/ description-pak doc-pak/ po/.intltool-merge-cache (bzr r8938.1.1) --- src/ui/dialog/Makefile_insert | 2 - src/ui/dialog/dialog-manager.cpp | 3 - src/ui/dialog/spray-option.cpp | 397 --------------------------------------- src/ui/dialog/spray-option.h | 145 -------------- src/ui/view/edit-widget.cpp | 6 - src/ui/view/edit-widget.h | 1 - 6 files changed, 554 deletions(-) delete mode 100644 src/ui/dialog/spray-option.cpp delete mode 100644 src/ui/dialog/spray-option.h (limited to 'src/ui') diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert index fac5bad80..76cdd3517 100644 --- a/src/ui/dialog/Makefile_insert +++ b/src/ui/dialog/Makefile_insert @@ -75,8 +75,6 @@ ink_common_sources += \ ui/dialog/print-colors-preview-dialog.h \ ui/dialog/scriptdialog.cpp \ ui/dialog/scriptdialog.h \ - ui/dialog/spray-option.cpp \ - ui/dialog/spray-option.h \ ui/dialog/svg-fonts-dialog.cpp \ ui/dialog/svg-fonts-dialog.h \ ui/dialog/swatches.cpp \ diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 2116d46c3..30cbed649 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -40,7 +40,6 @@ #include "ui/dialog/icon-preview.h" #include "ui/dialog/floating-behavior.h" #include "ui/dialog/dock-behavior.h" -#include "ui/dialog/spray-option.h" #include "ui/dialog/print-colors-preview-dialog.h" #include "preferences.h" @@ -114,7 +113,6 @@ DialogManager::DialogManager() { registerFactory("Transformation", &create); registerFactory("UndoHistory", &create); registerFactory("InputDevices", &create); - registerFactory("SprayOptionClass", &create); } else { @@ -142,7 +140,6 @@ DialogManager::DialogManager() { registerFactory("Transformation", &create); registerFactory("UndoHistory", &create); registerFactory("InputDevices", &create); - registerFactory("SprayOptionClass", &create); } } diff --git a/src/ui/dialog/spray-option.cpp b/src/ui/dialog/spray-option.cpp deleted file mode 100644 index a9e037381..000000000 --- a/src/ui/dialog/spray-option.cpp +++ /dev/null @@ -1,397 +0,0 @@ -/*Julien LERAY (julien.leray@ecl2010.ec-lyon.fr), interface for the spray tool*/ - - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "desktop-handles.h" -#include "unclump.h" -#include "document.h" -#include "enums.h" -#include "graphlayout/graphlayout.h" -#include "inkscape.h" -#include "macros.h" -#include "node-context.h" -#include "preferences.h" -#include "removeoverlap/removeoverlap.h" -#include "selection.h" -#include "shape-editor.h" -#include "sp-flowtext.h" -#include "sp-item-transform.h" -#include "sp-text.h" -#include "text-editing.h" -#include "tools-switch.h" -#include "ui/icon-names.h" -#include "util/glib-list-iterators.h" -#include "verbs.h" -#include "widgets/icon.h" - -#include "spray-option.h" - -namespace Inkscape { -namespace UI { -namespace Dialog { - - -//Classes qui permettent de créer les environnements Gaussienne, Witdh... - - - -class Action { -public: - Action(const Glib::ustring &id, - const Glib::ustring &/*tiptext*/, - guint /*row*/, - guint /*column*/, - Gtk::Table &parent, - Gtk::Tooltips &/*tooltips*/, - SprayOptionClass &dialog): - _dialog(dialog), - _id(id), - _parent(parent) {} - - virtual ~Action(){} - virtual void on_button_click(){} - SprayOptionClass &_dialog; - -private : - - Glib::ustring _id; - Gtk::Table &_parent; -}; - -class ActionE : public Action { -private: - Gtk::Label _Label; - Gtk::SpinButton _Gap; - guint _min, _max; - Glib::ustring _pref_path; - -public: - ActionE(const Glib::ustring &id, - const Glib::ustring &tiptext, - guint row, guint column, - SprayOptionClass &dialog, - guint min, guint max, - Glib::ustring const &pref_path ): - Action(id, tiptext, row, column, - dialog._Table(), dialog.tooltips(), dialog), - _min(min), - _max(max), - _pref_path(pref_path) - { - dialog._Table().set_col_spacings(3); - - double increm = ((double)_max - (double)_min)/10; - double val_ini = ((double)_max + (double)_min)/2; - _Gap.set_digits(1); - _Gap.set_size_request(60, -1); - _Gap.set_increments(increm , 0); - _Gap.set_range(_min, _max); - _Gap.set_value(val_ini); - dialog.tooltips().set_tip(_Gap, - tiptext); - _Gap.signal_changed().connect(sigc::mem_fun(*this, &ActionE::on_button_click)); //rajout douteux - _Label.set_label(id); - - dialog._Table().attach(_Label, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); - dialog._Table().attach(_Gap, column+1, column+2, row, row+1, Gtk::EXPAND, Gtk::EXPAND); - } - - virtual void on_button_click(){ - if (!_dialog.getDesktop()) return; - - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - - prefs->setDouble(_pref_path, SP_VERB_CONTEXT_SPRAY); - - double const Gap = _Gap.get_value(); - - - prefs->setDouble(_pref_path, Gap); - - sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_CONTEXT_SPRAY, - _("Remove overlaps")); - } - - -}; - -class ActionF : public Action { -private: - Gtk::Label _Label; - Gtk::Label _Label1; - Gtk::Label _Label2; - Gtk::SpinButton _Gap1; - Gtk::SpinButton _Gap2; - Glib::ustring _pref1_path; - Glib::ustring _pref2_path; - -public: - ActionF(const Glib::ustring &id, - const Glib::ustring &tiptext, - guint row, guint column, - SprayOptionClass &dialog, - Glib::ustring const &pref1_path, - Glib::ustring const &pref2_path ): - Action(id, tiptext, row, column, - dialog._Table(), dialog.tooltips(), dialog), - _pref1_path(pref1_path), - _pref2_path(pref2_path) - { - dialog.F_Table().set_col_spacings(3); - - _Label.set_label(id); - - _Gap1.set_digits(1); - _Gap1.set_size_request(60, -1); - _Gap1.set_increments(0.1, 0); - _Gap1.set_range(0, 10); - _Gap1.set_value(1); - dialog.tooltips().set_tip(_Gap1, - _("Minimum")); - - _Label1.set_label(Q_("Min")); - - _Gap2.set_digits(1); - _Gap2.set_size_request(60, -1); - _Gap2.set_increments(0.1, 0); - _Gap2.set_range(0, 10); - _Gap2.set_value(1); - dialog.tooltips().set_tip(_Gap2, - _("Maximum")); - - _Label2.set_label(_("Max:")); - - _Gap1.signal_changed().connect(sigc::mem_fun(*this, &ActionF::on_button_click)); - _Gap2.signal_changed().connect(sigc::mem_fun(*this, &ActionF::on_button_click)); - - dialog.F_Table().attach(_Label, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.F_Table().attach(_Label1, column+1, column+2, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.F_Table().attach(_Gap1, column+2, column+3, row, row+1, Gtk::EXPAND, Gtk::EXPAND); - dialog.F_Table().attach(_Label2, column+3, column+4, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.F_Table().attach(_Gap2, column+4, column+5, row, row+1, Gtk::EXPAND, Gtk::EXPAND); - - } - - virtual void on_button_click(){ - if (!_dialog.getDesktop()) return; - - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - - prefs->setDouble(_pref1_path, SP_VERB_CONTEXT_SPRAY); - prefs->setDouble(_pref2_path, SP_VERB_CONTEXT_SPRAY); - - double const Gap1 = _Gap1.get_value(); - double const Gap2 = _Gap2.get_value(); - - prefs->setDouble(_pref1_path, Gap1); - prefs->setDouble(_pref2_path, Gap2); - - sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_CONTEXT_SPRAY, - _("Remove overlaps")); - } - - -}; - - - -void SprayOptionClass::combo_action() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - cout<<"combo.get_active_row_number = "<<_combo.get_active_row_number()<setInt("/tools/spray/distribution", distrib); - - - sp_document_done(sp_desktop_document(this->getDesktop()), SP_VERB_CONTEXT_SPRAY, - _("Remove overlaps")); - -} - - - - -void SprayOptionClass::action() { - for (list::iterator it = _actionList.begin(); it != _actionList.end(); ++it) { - (*it)->on_button_click(); - } - combo_action(); -} - - - - - - -void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, SprayOptionClass *daad) -{ - daad->randomize_bbox = Geom::OptRect(); -} - -///////////////////////////////////////////////////////// -//Construction de l'interface -///////////////////////////////////////////////////////// - - -SprayOptionClass::SprayOptionClass() - : UI::Widget::Panel ("", "/dialogs/spray", SP_VERB_DIALOG_SPRAY_OPTION), - _actionList(), - _distributionFrame(Q_("sprayOptions|Distribution")), - _Frame(Q_("sprayOptions|Cursor Options")), - _FFrame(Q_("sprayOptions|Random Options")), - _distributionTable(), - _gaussianTable(1, 5, false), - _ETable(3,2,false), - _FTable(2,5,false), - _anchorBox(), - _unifBox(), - _gaussianBox(), - _HBox(), - _FHBox(), - _BoutonBox(), - _distributionBox(), - _VBox(), - _FVBox(), - _ActionBox(), - _anchorLabel(Q_("sprayOptions|Distribution:")), - _unifLabel(Q_("sprayOptions|Uniform")), - _gaussLabel(Q_("sprayOptions|Gaussian")), - _Label(), - _FLabel(), - _unif(), - _gauss(), - _combo(), - _tooltips() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - - //ComboBoxText - - _combo.append_text(Q_("sprayOptions|Uniform")); - _combo.append_text(Q_("sprayOptions|Gaussian")); - - _combo.set_active(prefs->getInt("/tools/spray/distribution", 1)); - _combo.signal_changed().connect(sigc::mem_fun(*this, &SprayOptionClass::combo_action)); - - _anchorBox.pack_start(_anchorLabel); - _anchorBox.pack_start(_combo); - - _gaussianBox.pack_start(_anchorBox); - - - _distributionBox.pack_start(_gaussianBox); - _distributionFrame.add(_distributionBox); - - - //Hbox Random - addFButton(Q_("sprayOptions|Scale:") ,_("Apply a scale factor"), 0, 0, "/tools/spray/scale_min","/tools/spray/scale_max"); - addFButton(Q_("sprayOptions|Rotation:") ,_("Apply rotation"), 1, 0, "/tools/spray/rot_min","/tools/spray/rot_max"); - _FHBox.pack_start(_FLabel); - _FHBox.pack_start(_FTable); - - //Implementation dans la Vbox Cursor - _FVBox.pack_start(_FHBox); - _FFrame.add(_FVBox); - - //Hbox Cursor - addEButton(Q_("sprayOptions|Ratio:") ,_("Eccentricity of the ellipse"), 0, 0, 0, 1,"/tools/spray/ratio"); - addEButton(Q_("sprayOptions|Angle:") ,_("Angle of the ellipse"), 1, 0, 0, 5,"/tools/spray/tilt"); - addEButton(Q_("sprayOptions|Width:") ,_("Size of the ellipse"), 2, 0, 0, 1,"/tools/spray/width"); - _HBox.pack_start(_Label); - _HBox.pack_start(_ETable); - - //Implementation dans la Vbox Cursor - _VBox.pack_start(_HBox); - _Frame.add(_VBox); - - Gtk::Box *contents = _getContents(); - contents->set_spacing(4); - - - - - - - // Crée dans l'ordre suivant les différentes Frames (cadres de réglages) - - contents->pack_start(_distributionFrame, true, true); - contents->pack_start(_FFrame, true, true); - contents->pack_start(_Frame, true, true); - - - - // Connect to the global selection change, to invalidate cached randomize_bbox - g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this); - randomize_bbox = Geom::OptRect(); - - show_all_children(); - - - -} - -SprayOptionClass::~SprayOptionClass() -{ - sp_signal_disconnect_by_data (G_OBJECT (INKSCAPE), this); - - for (std::list::iterator it = _actionList.begin(); - it != _actionList.end(); - it ++) - delete *it; -} - - - - - - - -//Fonctions qui lient la demande d'ajout d'une interface graphique à l'action correspondante - -void SprayOptionClass::addEButton(const Glib::ustring &id, - const Glib::ustring &tiptext, - guint row, guint column, - guint min, guint max, - Glib::ustring const &pref_path) -{ - _actionList.push_back( new ActionE(id, tiptext,row, column,*this,min ,max, pref_path )); -} - -void SprayOptionClass::addFButton(const Glib::ustring &id, - const Glib::ustring &tiptext, - guint row, guint column, - Glib::ustring const &pref1_path, - Glib::ustring const &pref2_path) -{ - _actionList.push_back( new ActionF(id, tiptext,row, column,*this,pref1_path, pref2_path )); -} - - - - - -SprayOptionClass &SprayOptionClass::get_SprayOptionClass() -{ - return *this; -} - -} // namespace Dialog -} // 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:encoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/spray-option.h b/src/ui/dialog/spray-option.h deleted file mode 100644 index 42090a120..000000000 --- a/src/ui/dialog/spray-option.h +++ /dev/null @@ -1,145 +0,0 @@ - -/*Julien LERAY (julien.leray@ecl2010.ec-lyon.fr), interface for the spray tool*/ - -#ifndef INKSCAPE_UI_DIALOG_SPRAY_OPTION_H -#define INKSCAPE_UI_DIALOG_SPRAY_OPTION_H - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include "libnr/nr-dim2.h" -#include "libnr/nr-rect.h" - - -#include "ui/widget/panel.h" -#include "ui/widget/notebook-page.h" - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "desktop-handles.h" -#include "unclump.h" -#include "document.h" -#include "enums.h" -#include "graphlayout/graphlayout.h" -#include "inkscape.h" -#include "macros.h" -#include "node-context.h" -#include "preferences.h" -#include "removeoverlap/removeoverlap.h" -#include "selection.h" -#include "shape-editor.h" -#include "sp-flowtext.h" -#include "sp-item-transform.h" -#include "sp-text.h" -#include "text-editing.h" -#include "tools-switch.h" -#include "ui/icon-names.h" -#include "util/glib-list-iterators.h" -#include "verbs.h" -#include "widgets/icon.h" - -#include "spray-context.h" -#include "verbs.h" - -#include -using namespace std; - -using namespace Inkscape::UI::Widget; - -class SPItem; - - -namespace Inkscape { -namespace UI { -namespace Dialog { - -class Action; - -class SprayOptionClass : public Widget::Panel { - -private: - - SprayOptionClass(SprayOptionClass const &d); - SprayOptionClass& operator=(SprayOptionClass const &d); - -public: - SprayOptionClass(); - virtual ~SprayOptionClass(); - void test() { cout<<"appel de test !!"< _actionList; - Gtk::Frame _distributionFrame; - Gtk::Frame _Frame; - Gtk::Frame _FFrame; - Gtk::Table _distributionTable; - Gtk::Table _gaussianTable; - Gtk::Table _ETable; - Gtk::Table _FTable; - Gtk::HBox _anchorBox; - Gtk::HBox _unifBox; - Gtk::HBox _gaussianBox; - Gtk::HBox _HBox; - Gtk::HBox _FHBox; - Gtk::HBox _BoutonBox; - Gtk::VBox _distributionBox; - Gtk::VBox _VBox; - Gtk::VBox _FVBox; - Gtk::VBox _ActionBox; - Gtk::Label _anchorLabel; - Gtk::Label _unifLabel; - Gtk::Label _gaussLabel; - Gtk::Label _Label; - Gtk::Label _FLabel; - Gtk::CheckButton _unif; - Gtk::CheckButton _gauss; - Gtk::ComboBoxText _combo; - Gtk::Tooltips _tooltips; -}; - - -} // namespace Dialog -} // namespace UI -} // namespace Inkscape - -#endif // INKSCAPE_UI_DIALOG_ALIGN_AND_DISTRIBUTE_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:encoding=utf-8:textwidth=99 : - diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index d34b18771..770a9bf87 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -227,12 +227,6 @@ EditWidget::onDialogAlignAndDistribute() _dlg_mgr.showDialog("AlignAndDistribute"); } -void -EditWidget::onDialogSprayOptionClass() -{ - _dlg_mgr.showDialog("SprayOptionClass"); -} - void EditWidget::onDialogDocumentProperties() { diff --git a/src/ui/view/edit-widget.h b/src/ui/view/edit-widget.h index 452641e80..2bb708305 100644 --- a/src/ui/view/edit-widget.h +++ b/src/ui/view/edit-widget.h @@ -70,7 +70,6 @@ public: void onDialogAbout(); void onDialogAlignAndDistribute(); - void onDialogSprayOptionClass(); void onDialogInkscapePreferences(); void onDialogDialog(); void onDialogDocumentProperties(); -- cgit v1.2.3 From 568dab6fba413360b1ca2cbf5205bdde8eb9a13b Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 7 Jan 2010 01:19:48 -0800 Subject: Added UXManager. Cleaning up toolbox creation. (bzr r8951) --- src/ui/Makefile_insert | 4 ++- src/ui/uxmanager.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/ui/uxmanager.h | 47 ++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 src/ui/uxmanager.cpp create mode 100644 src/ui/uxmanager.h (limited to 'src/ui') diff --git a/src/ui/Makefile_insert b/src/ui/Makefile_insert index 3eb6c6b13..eb8966d11 100644 --- a/src/ui/Makefile_insert +++ b/src/ui/Makefile_insert @@ -9,4 +9,6 @@ ink_common_sources += \ ui/previewable.h \ ui/previewfillable.h \ ui/previewholder.cpp \ - ui/previewholder.h + ui/previewholder.h \ + ui/uxmanager.cpp \ + ui/uxmanager.h diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp new file mode 100644 index 000000000..5f0021ef6 --- /dev/null +++ b/src/ui/uxmanager.cpp @@ -0,0 +1,68 @@ +/** \file + * Desktop widget implementation + */ +/* Authors: + * Jon A. Cruz + * + * Copyright (C) 2010 Jon A. Cruz + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "uxmanager.h" +#include "util/ege-tags.h" +#include "widgets/toolbox.h" + +namespace Inkscape { +namespace UI { + +UXManager* instance = 0; + +UXManager* UXManager::getInstance() +{ + if (!instance) { + instance = new UXManager(); + } + return instance; +} + + +UXManager::UXManager() +{ + ege::TagSet tags; + tags.setLang("en"); + + tags.addTag(ege::Tag("General")); + tags.addTag(ege::Tag("Icons")); +} + +UXManager::~UXManager() +{ +} + + +void UXManager::connectToDesktop( std::vector const & toolboxes, SPDesktop *desktop ) +{ + for (std::vector::const_iterator it = toolboxes.begin(); it != toolboxes.end(); ++it ) { + sp_toolbox_set_desktop( *it, desktop ); + } +} + + +} // 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 : diff --git a/src/ui/uxmanager.h b/src/ui/uxmanager.h new file mode 100644 index 000000000..c8b077a57 --- /dev/null +++ b/src/ui/uxmanager.h @@ -0,0 +1,47 @@ +#ifndef SEEN_UI_UXMANAGER_H +#define SEEN_UI_UXMANAGER_H +/* + * A simple interface for previewing representations. + * + * Authors: + * Jon A. Cruz + * + * Copyright (C) 2010 Jon A. Cruz + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include + +typedef struct _GtkWidget GtkWidget; +class SPDesktop; + +namespace Inkscape { +namespace UI { + +class UXManager +{ +public: + static UXManager* getInstance(); + virtual ~UXManager(); + + void connectToDesktop( std::vector const & toolboxes, SPDesktop *desktop ); + +private: + UXManager(); +}; + +} // namespace UI +} // namespace Inkscape + +#endif // SEEN_UI_UXMANAGER_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 : -- cgit v1.2.3 From 59ac8467a1a2655b42c04e92d10d3283bab17205 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Thu, 7 Jan 2010 21:43:33 -0800 Subject: Patch by Alex Leone to add margins to resize page options in Document Properties (bzr r8952) --- src/ui/dialog/document-properties.cpp | 2 +- src/ui/widget/page-sizer.cpp | 69 +++++++++++++++++++++++++---------- src/ui/widget/page-sizer.h | 26 ++++++++++--- 3 files changed, 70 insertions(+), 27 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index a7241ea40..86baa85cd 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -222,7 +222,7 @@ DocumentProperties::build_page() Gtk::Label* label_bor = manage (new Gtk::Label); label_bor->set_markup (_("Border")); Gtk::Label *label_for = manage (new Gtk::Label); - label_for->set_markup (_("Format")); + label_for->set_markup (_("Page Size")); _page_sizer.init(); Gtk::Widget *const widget_array[] = diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 68f26792a..e604a24ec 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -229,6 +229,11 @@ PageSizer::PageSizer(Registry & _wr) _dimensionUnits( _("U_nits:"), "units", _wr ), _dimensionWidth( _("_Width:"), _("Width of paper"), "width", _dimensionUnits, _wr ), _dimensionHeight( _("_Height:"), _("Height of paper"), "height", _dimensionUnits, _wr ), + _marginTop( _("T_op margin:"), _("Top margin"), "fit-margin-top", _wr ), + _marginLeft( _("L_eft:"), _("Left margin"), "fit-margin-left", _wr), + _marginRight( _("Ri_ght:"), _("Right margin"), "fit-margin-right", _wr), + _marginBottom( _("Botto_m:"), _("Bottom margin"), "fit-margin-bottom", _wr), + _widgetRegistry(&_wr) { //# Set up the Paper Size combo box @@ -273,16 +278,11 @@ PageSizer::PageSizer(Registry & _wr) // _paperSizeListSelection->select(iter); - pack_start (_paperSizeListBox, true, true, 0); - _paperSizeListLabel.set_label(_("P_age size:")); - _paperSizeListLabel.set_use_underline(); - _paperSizeListBox.pack_start (_paperSizeListLabel, false, false, 0); - _paperSizeListLabel.set_mnemonic_widget (_paperSizeList); - _paperSizeListBox.pack_start (_paperSizeListScroller, true, true, 0); + pack_start (_paperSizeListScroller, true, true, 0); //## Set up orientation radio buttons pack_start (_orientationBox, false, false, 0); - _orientationLabel.set_label(_("Page orientation:")); + _orientationLabel.set_label(_("Orientation:")); _orientationBox.pack_start(_orientationLabel, false, false, 0); _landscapeButton.set_use_underline(); _landscapeButton.set_label(_("_Landscape")); @@ -299,19 +299,48 @@ PageSizer::PageSizer(Registry & _wr) //## Set up custom size frame _customFrame.set_label(_("Custom size")); pack_start (_customFrame, false, false, 0); - _customTable.resize(2, 2); - _customTable.set_border_width (4); - _customTable.set_row_spacings (4); - _customTable.set_col_spacings (4); - _customTable.attach(_dimensionWidth, 0,1,0,1); - _customTable.attach(_dimensionUnits, 1,2,0,1); - _customTable.attach(_dimensionHeight, 0,1,1,2); - _customTable.attach(_fitPageButton, 1,2,1,2); - _customFrame.add(_customTable); - + _customFrame.add(_customDimTable); + + _customDimTable.resize(3, 2); + _customDimTable.set_border_width(4); + _customDimTable.set_row_spacings(4); + _customDimTable.set_col_spacings(4); + _customDimTable.attach(_dimensionWidth, 0,1, 0,1); + _customDimTable.attach(_dimensionUnits, 1,2, 0,1); + _customDimTable.attach(_dimensionHeight, 0,1, 1,2); + _customDimTable.attach(_fitPageMarginExpander, 0,2, 2,3); + + //## Set up fit page expander + _fitPageMarginExpander.set_label(_("Resi_ze page to content...")); + _fitPageMarginExpander.set_use_underline(); + _fitPageMarginExpander.add(_marginTable); + + //## Set up margin settings + _marginTable.resize(4, 2); + _marginTable.set_border_width(4); + _marginTable.set_row_spacings(4); + _marginTable.set_col_spacings(4); + _marginTable.attach(_fitPageButtonAlign, 0,2, 0,1); + _marginTable.attach(_marginTopAlign, 0,2, 1,2); + _marginTable.attach(_marginLeftAlign, 0,1, 2,3); + _marginTable.attach(_marginRightAlign, 1,2, 2,3); + _marginTable.attach(_marginBottomAlign, 0,2, 3,4); + + _marginTopAlign.set(0.5, 0.5, 0.0, 1.0); + _marginTopAlign.add(_marginTop); + _marginLeftAlign.set(0.0, 0.5, 0.0, 1.0); + _marginLeftAlign.add(_marginLeft); + _marginRightAlign.set(1.0, 0.5, 0.0, 1.0); + _marginRightAlign.add(_marginRight); + _marginBottomAlign.set(0.5, 0.5, 0.0, 1.0); + _marginBottomAlign.add(_marginBottom); + + _fitPageButtonAlign.set(0.5, 0.5, 0.0, 1.0); + _fitPageButtonAlign.add(_fitPageButton); _fitPageButton.set_use_underline(); - _fitPageButton.set_label(_("_Fit page to selection")); + _fitPageButton.set_label(_("_Resize page to drawing or selection")); _tips.set_tip(_fitPageButton, _("Resize the page to fit the current selection, or the entire drawing if there is no selection")); + } @@ -343,7 +372,7 @@ PageSizer::init () /** * Set document dimensions (if not called by Doc prop's update()) and * set the PageSizer's widgets and text entries accordingly. If - * 'chageList' is true, then adjust the paperSizeList to show the closest + * 'changeList' is true, then adjust the paperSizeList to show the closest * standard page size. * * \param w, h given in px @@ -454,7 +483,7 @@ PageSizer::find_paper_size (double w, double h) const /** - * Tell the desktop to change the page size + * Tell the desktop to fit the page size to the selection or drawing. */ void PageSizer::fire_fit_canvas_to_selection_or_drawing() diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index f970afe44..718eb95b5 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -183,24 +183,38 @@ protected: Gtk::HBox _orientationBox; Gtk::Label _orientationLabel; Gtk::RadioButton _portraitButton; - Gtk::RadioButton _landscapeButton; + Gtk::RadioButton _landscapeButton; //callbacks void on_portrait(); void on_landscape(); sigc::connection _portrait_connection; - sigc::connection _landscape_connection; + sigc::connection _landscape_connection; //### Custom size frame Gtk::Frame _customFrame; - Gtk::Table _customTable; + Gtk::Table _customDimTable; RegisteredUnitMenu _dimensionUnits; RegisteredScalarUnit _dimensionWidth; - RegisteredScalarUnit _dimensionHeight; - Gtk::Button _fitPageButton; + RegisteredScalarUnit _dimensionHeight; + + //### Fit Page options + Gtk::Expander _fitPageMarginExpander; + Gtk::Table _marginTable; + Gtk::Alignment _marginTopAlign; + Gtk::Alignment _marginLeftAlign; + Gtk::Alignment _marginRightAlign; + Gtk::Alignment _marginBottomAlign; + RegisteredScalar _marginTop; + RegisteredScalar _marginLeft; + RegisteredScalar _marginRight; + RegisteredScalar _marginBottom; + Gtk::Alignment _fitPageButtonAlign; + Gtk::Button _fitPageButton; + //callback void on_value_changed(); sigc::connection _changedw_connection; - sigc::connection _changedh_connection; + sigc::connection _changedh_connection; Registry *_widgetRegistry; -- cgit v1.2.3 From c4170261f04e1d37439f71c92fb3ac442da40c7f Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 9 Jan 2010 01:37:23 -0800 Subject: Initial c++-ification of toolbox creation. (bzr r8955) --- src/ui/uxmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index 5f0021ef6..d152e473e 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -48,7 +48,7 @@ UXManager::~UXManager() void UXManager::connectToDesktop( std::vector const & toolboxes, SPDesktop *desktop ) { for (std::vector::const_iterator it = toolboxes.begin(); it != toolboxes.end(); ++it ) { - sp_toolbox_set_desktop( *it, desktop ); + ToolboxFactory::setToolboxDesktop( *it, desktop ); } } -- cgit v1.2.3 From 7d549f19e53f6bb1b157f04a1cffb69d8f910ec5 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 10 Jan 2010 03:22:05 -0800 Subject: Completed base code to flip toolbox orientation. Basic integration of task switching control. (bzr r8963) --- src/ui/uxmanager.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++--- src/ui/uxmanager.h | 16 +++++++++++++- 2 files changed, 74 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index d152e473e..48ff9dca0 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -13,9 +13,21 @@ # include "config.h" #endif +#include + #include "uxmanager.h" #include "util/ege-tags.h" #include "widgets/toolbox.h" +#include "widgets/desktop-widget.h" + +using std::map; +using std::vector; + +static vector desktops; +static vector dtws; +static map > trackedBoxes; + + namespace Inkscape { namespace UI { @@ -44,11 +56,55 @@ UXManager::~UXManager() { } +void UXManager::setTask(SPDesktop* dt, gint val) +{ + GtkOrientation orientation = (val == 0)? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; + for (vector::iterator it = dtws.begin(); it != dtws.end(); ++it) { + if ((*it)->desktop == dt) { + vector& boxes = trackedBoxes[dt]; + for (vector::iterator it2 = boxes.begin(); it2 != boxes.end(); ++it2) { + gint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(*it2), "BarIdValue")); + if (id != 1) { + //ToolboxFactory::setOrientation(*it2, orientation); + } + } + break; + } + } +} + -void UXManager::connectToDesktop( std::vector const & toolboxes, SPDesktop *desktop ) +void UXManager::addTrack( SPDesktopWidget* dtw ) { - for (std::vector::const_iterator it = toolboxes.begin(); it != toolboxes.end(); ++it ) { - ToolboxFactory::setToolboxDesktop( *it, desktop ); + if (std::find(dtws.begin(), dtws.end(), dtw) == dtws.end()) { + dtws.push_back(dtw); + } +} + +void UXManager::delTrack( SPDesktopWidget* dtw ) +{ + vector::iterator iter = std::find(dtws.begin(), dtws.end(), dtw); + if (iter != dtws.end()) { + dtws.erase(iter); + } +} + +void UXManager::connectToDesktop( vector const & toolboxes, SPDesktop *desktop ) +{ +//static map > trackedBoxes; + + for (vector::const_iterator it = toolboxes.begin(); it != toolboxes.end(); ++it ) { + GtkWidget* toolbox = *it; + ToolboxFactory::setToolboxDesktop( toolbox, desktop ); + + vector& tracked = trackedBoxes[desktop]; + if (find(tracked.begin(), tracked.end(), toolbox) == tracked.end()) { + tracked.push_back(toolbox); + } + } + + if (std::find(desktops.begin(), desktops.end(), desktop) == desktops.end()) { + desktops.push_back(desktop); } } diff --git a/src/ui/uxmanager.h b/src/ui/uxmanager.h index c8b077a57..862c675d0 100644 --- a/src/ui/uxmanager.h +++ b/src/ui/uxmanager.h @@ -11,11 +11,20 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include #include -typedef struct _GtkWidget GtkWidget; +extern "C" +{ + typedef struct _GObject GObject; + typedef struct _GtkWidget GtkWidget; +} + class SPDesktop; +struct SPDesktopWidget; + + namespace Inkscape { namespace UI { @@ -25,8 +34,13 @@ public: static UXManager* getInstance(); virtual ~UXManager(); + void addTrack( SPDesktopWidget* dtw ); + void delTrack( SPDesktopWidget* dtw ); + void connectToDesktop( std::vector const & toolboxes, SPDesktop *desktop ); + void setTask(SPDesktop* dt, gint val); + private: UXManager(); }; -- cgit v1.2.3 From 6b0bd0122093b8ea4a3a91bf25d1606ac429cb56 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 11 Jan 2010 01:09:52 -0800 Subject: Implemented dynamic repositioning of toolboxes. (bzr r8968) --- src/ui/uxmanager.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/ui') diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index 48ff9dca0..2153606c1 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -58,15 +58,19 @@ UXManager::~UXManager() void UXManager::setTask(SPDesktop* dt, gint val) { - GtkOrientation orientation = (val == 0)? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; for (vector::iterator it = dtws.begin(); it != dtws.end(); ++it) { - if ((*it)->desktop == dt) { - vector& boxes = trackedBoxes[dt]; - for (vector::iterator it2 = boxes.begin(); it2 != boxes.end(); ++it2) { - gint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(*it2), "BarIdValue")); - if (id != 1) { - //ToolboxFactory::setOrientation(*it2, orientation); - } + SPDesktopWidget* dtw = *it; + if (dtw->desktop == dt) { + if (val == 0) { + dtw->setToolboxPosition("ToolToolbar", GTK_POS_LEFT); + dtw->setToolboxPosition("CommandsToolbar", GTK_POS_TOP); + dtw->setToolboxPosition("SnapToolbar", GTK_POS_TOP); + // for now skip "AuxToolbar"; + } else { + dtw->setToolboxPosition("ToolToolbar", GTK_POS_TOP); + dtw->setToolboxPosition("CommandsToolbar", GTK_POS_LEFT); + dtw->setToolboxPosition("SnapToolbar", GTK_POS_RIGHT); + // for now skip "AuxToolbar"; } break; } @@ -95,8 +99,8 @@ void UXManager::connectToDesktop( vector const & toolboxes, SPDeskt for (vector::const_iterator it = toolboxes.begin(); it != toolboxes.end(); ++it ) { GtkWidget* toolbox = *it; - ToolboxFactory::setToolboxDesktop( toolbox, desktop ); + ToolboxFactory::setToolboxDesktop( toolbox, desktop ); vector& tracked = trackedBoxes[desktop]; if (find(tracked.begin(), tracked.end(), toolbox) == tracked.end()) { tracked.push_back(toolbox); -- cgit v1.2.3 From 36c2b2febc6c0c11991849232c907d5573600935 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 12 Jan 2010 01:59:58 -0800 Subject: Initial cut of disabling floating windows on window managers with problems. (bzr r8971) --- src/ui/uxmanager.cpp | 30 +++++++++++++++++++++++++++++- src/ui/uxmanager.h | 4 ++++ 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index 2153606c1..ddc28a858 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -20,9 +20,18 @@ #include "widgets/toolbox.h" #include "widgets/desktop-widget.h" +#ifdef GDK_WINDOWING_X11 +#include +#endif // GDK_WINDOWING_X11 + using std::map; using std::vector; + +gchar const* KDE_WINDOW_MANAGER_NAME = "KWin"; +gchar const* UNKOWN_WINDOW_MANAGER_NAME = "unknown"; + + static vector desktops; static vector dtws; static map > trackedBoxes; @@ -43,19 +52,38 @@ UXManager* UXManager::getInstance() } -UXManager::UXManager() +UXManager::UXManager() : + floatwindowIssues(false) { ege::TagSet tags; tags.setLang("en"); tags.addTag(ege::Tag("General")); tags.addTag(ege::Tag("Icons")); + +#ifdef GDK_WINDOWING_X11 + char const* wmName = gdk_x11_screen_get_window_manager_name( gdk_screen_get_default() ); + //g_message("Window manager is [%s]", wmName); + + //if (g_ascii_strcasecmp( wmName, UNKOWN_WINDOW_MANAGER_NAME ) == 0) { + if (g_ascii_strcasecmp( wmName, KDE_WINDOW_MANAGER_NAME ) == 0) { + floatwindowIssues = true; + } +#elif GDK_WINDOWING_WIN32 + floatwindowIssues = true; +#endif // GDK_WINDOWING_WIN32 } UXManager::~UXManager() { } + +bool UXManager::isFloatWindowProblem() const +{ + return floatwindowIssues; +} + void UXManager::setTask(SPDesktop* dt, gint val) { for (vector::iterator it = dtws.begin(); it != dtws.end(); ++it) { diff --git a/src/ui/uxmanager.h b/src/ui/uxmanager.h index 862c675d0..aecda2b5e 100644 --- a/src/ui/uxmanager.h +++ b/src/ui/uxmanager.h @@ -41,8 +41,12 @@ public: void setTask(SPDesktop* dt, gint val); + bool isFloatWindowProblem() const; + private: UXManager(); + + bool floatwindowIssues; }; } // namespace UI -- cgit v1.2.3