diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2015-05-22 07:02:44 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2015-05-22 07:02:44 +0000 |
| commit | 35d94a8e1c01cd60e4fcf4c15f46fee38c765fca (patch) | |
| tree | d8366acd729a6a9d4bdc1001f050a43f30d8b7ad /src/ui/dialog | |
| parent | Undo changes to CMakeLists.txt in 2geom directory after syncs (diff) | |
| parent | minor tweaks to libUEMF and related code (diff) | |
| download | inkscape-35d94a8e1c01cd60e4fcf4c15f46fee38c765fca.tar.gz inkscape-35d94a8e1c01cd60e4fcf4c15f46fee38c765fca.zip | |
Merge from trunk
(bzr r14059.2.15)
Diffstat (limited to 'src/ui/dialog')
| -rw-r--r-- | src/ui/dialog/layers.cpp | 12 | ||||
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 22 | ||||
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.h | 8 | ||||
| -rw-r--r-- | src/ui/dialog/object-properties.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/objects.cpp | 33 | ||||
| -rw-r--r-- | src/ui/dialog/objects.h | 9 | ||||
| -rw-r--r-- | src/ui/dialog/tags.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.cpp | 29 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.h | 17 |
9 files changed, 83 insertions, 55 deletions
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 65351cb68..c6888386f 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -713,13 +713,21 @@ bool LayersPanel::_handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& /*contex */ void LayersPanel::_doTreeMove( ) { - if (_dnd_source ) { + if (_dnd_source && _dnd_source->getRepr() ) { + if(!_dnd_target){ + _dnd_source->doWriteTransform(_dnd_source->getRepr(), _dnd_source->document->getRoot()->i2doc_affine().inverse() * _dnd_source->i2doc_affine()); + }else{ + SPItem* parent = _dnd_into ? _dnd_target : dynamic_cast<SPItem*>(_dnd_target->parent); + if(parent){ + Geom::Affine move = parent->i2doc_affine().inverse() * _dnd_source->i2doc_affine(); + _dnd_source->doWriteTransform(_dnd_source->getRepr(), move); + } + } _dnd_source->moveTo(_dnd_target, _dnd_into); _selectLayer(_dnd_source); _dnd_source = NULL; DocumentUndo::done( _desktop->doc() , SP_VERB_NONE, _("Moved layer")); - } } diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index f63b19e86..061055feb 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -27,7 +27,6 @@ #include "selection-chemistry.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" -#include "util/units.h" #include <cmath> //#include "event-context.h" @@ -122,18 +121,14 @@ void FilletChamferPropertiesDialog::showDialog( SPDesktop *desktop, Geom::Point knotpoint, const Inkscape::LivePathEffect:: FilletChamferPointArrayParamKnotHolderEntity *pt, - const gchar *unit, bool use_distance, - bool aprox_radius, - Glib::ustring documentUnit) + bool aprox_radius) { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); dialog->_set_desktop(desktop); - dialog->_set_unit(unit); dialog->_set_use_distance(use_distance); dialog->_set_aprox(aprox_radius); - dialog->_set_document_unit(documentUnit); dialog->_set_knot_point(knotpoint); dialog->_set_pt(pt); @@ -168,7 +163,6 @@ void FilletChamferPropertiesDialog::_apply() } d_pos = _index + (d_pos / 100); } else { - d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, document_unit); d_pos = d_pos * -1; } _knotpoint->knot_set_offset(Geom::Point(d_pos, d_width)); @@ -218,11 +212,9 @@ void FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint) _fillet_chamfer_position_label.set_label(_("Position (%):")); } else { _flexible = false; - std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); + std::string posConcat = Glib::ustring::compose (_("%1:"), distance_or_radius); _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); position = knotpoint[Geom::X] * -1; - - position = Inkscape::Util::Quantity::convert(position, document_unit, unit); } _fillet_chamfer_position_numeric.set_value(position); if (knotpoint.y() == 1) { @@ -247,16 +239,6 @@ void FilletChamferPropertiesDialog::_set_pt( pt); } -void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) -{ - unit = abbr; -} - -void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring abbr) -{ - document_unit = abbr; -} - void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance) { use_distance = use_knot_distance; diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 870a1734f..99494bd63 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -30,10 +30,8 @@ public: static void showDialog(SPDesktop *desktop, Geom::Point knotpoint, const Inkscape::LivePathEffect:: FilletChamferPointArrayParamKnotHolderEntity *pt, - const gchar *unit, bool use_distance, - bool aprox_radius, - Glib::ustring documentUnit); + bool aprox_radius); protected: @@ -68,15 +66,11 @@ protected: void _set_desktop(SPDesktop *desktop); void _set_pt(const Inkscape::LivePathEffect:: FilletChamferPointArrayParamKnotHolderEntity *pt); - void _set_unit(const gchar *abbr); - void _set_document_unit(Glib::ustring abbr); void _set_use_distance(bool use_knot_distance); void _set_aprox(bool aprox_radius); void _apply(); void _close(); bool _flexible; - const gchar *unit; - Glib::ustring document_unit; bool use_distance; bool aprox; void _set_knot_point(Geom::Point knotpoint); diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index fc21a30d4..75430ed44 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -529,10 +529,12 @@ void ObjectProperties::_imageRenderingChanged() SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "image-rendering", scale.c_str()); Inkscape::XML::Node *image_node = item->getRepr(); - if( image_node ) { + if (image_node) { sp_repr_css_change(image_node, css, "style"); + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, + _("Set image rendering option")); } - sp_repr_css_attr_unref( css ); + sp_repr_css_attr_unref(css); _blocked = false; } diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 781c6ef93..be04e7149 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -45,6 +45,7 @@ #include "style.h" #include "ui/tools-switch.h" #include "ui/icon-names.h" +#include "ui/selected-color.h" #include "ui/widget/imagetoggler.h" #include "ui/widget/layertypeicon.h" #include "ui/widget/insertordericon.h" @@ -53,7 +54,7 @@ #include "ui/tools/node-tool.h" #include "ui/tools/tool-base.h" #include "verbs.h" -#include "widgets/sp-color-notebook.h" +#include "ui/widget/color-notebook.h" #include "widgets/icon.h" #include "xml/node.h" #include "xml/node-observer.h" @@ -928,12 +929,12 @@ bool ObjectsPanel::_handleButtonEvent(GdkEventButton* event) //If the current item is not selected, store only it in the highlight source _storeHighlightTarget(iter); } - if (_colorSelector) + if (_selectedColor) { //Set up the color selector SPColor color; color.set( row[_model->_colHighlight] ); - _colorSelector->base->setColorAlpha(color, SP_RGBA32_A_F(row[_model->_colHighlight])); + _selectedColor->setColorAlpha(color, SP_RGBA32_A_F(row[_model->_colHighlight])); } //Show the color selector dialog _colorSelectorDialog.show(); @@ -1440,17 +1441,16 @@ void ObjectsPanel::_setExpanded(const Gtk::TreeModel::iterator& iter, const Gtk: * @param csel Color selector * @param cp Objects panel */ -void sp_highlight_picker_color_mod(SPColorSelector *csel, GObject * cp) +void ObjectsPanel::_highlightPickerColorMod() { SPColor color; float alpha = 0; - csel->base->getColorAlpha(color, alpha); + _selectedColor->colorAlpha(color, alpha); + guint32 rgba = color.toRGBA32( alpha ); - - ObjectsPanel *ptr = reinterpret_cast<ObjectsPanel *>(cp); //Set the highlight color for all items in the _highlight_target (all selected items) - for (std::vector<SPItem *>::iterator iter = ptr->_highlight_target.begin(); iter != ptr->_highlight_target.end(); ++iter) + for (std::vector<SPItem *>::iterator iter = _highlight_target.begin(); iter != _highlight_target.end(); ++iter) { SPItem * target = *iter; target->setHighlightColor(rgba); @@ -1922,18 +1922,16 @@ ObjectsPanel::ObjectsPanel() : _colorSelectorDialog.set_title (_("Select Highlight Color")); _colorSelectorDialog.set_border_width (4); _colorSelectorDialog.property_modal() = true; - _colorSelector = SP_COLOR_SELECTOR(sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK)); + _selectedColor.reset(new Inkscape::UI::SelectedColor); + Gtk::Widget *color_selector = Gtk::manage(new Inkscape::UI::Widget::ColorNotebook(*_selectedColor)); _colorSelectorDialog.get_vbox()->pack_start ( - *Glib::wrap(&_colorSelector->vbox), true, true, 0); + *color_selector, true, true, 0); - g_signal_connect(G_OBJECT(_colorSelector), "dragged", - G_CALLBACK(sp_highlight_picker_color_mod), (void *)this); - g_signal_connect(G_OBJECT(_colorSelector), "released", - G_CALLBACK(sp_highlight_picker_color_mod), (void *)this); - g_signal_connect(G_OBJECT(_colorSelector), "changed", - G_CALLBACK(sp_highlight_picker_color_mod), (void *)this); + _selectedColor->signal_dragged.connect(sigc::mem_fun(*this, &ObjectsPanel::_highlightPickerColorMod)); + _selectedColor->signal_released.connect(sigc::mem_fun(*this, &ObjectsPanel::_highlightPickerColorMod)); + _selectedColor->signal_changed.connect(sigc::mem_fun(*this, &ObjectsPanel::_highlightPickerColorMod)); - gtk_widget_show(GTK_WIDGET(_colorSelector)); + color_selector->show(); setDesktop( targetDesktop ); @@ -1951,7 +1949,6 @@ ObjectsPanel::~ObjectsPanel() { //Close the highlight selection dialog _colorSelectorDialog.hide(); - _colorSelector = NULL; //Set the desktop to null, which will disconnect all object watchers setDesktop(NULL); diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index 1842fea11..7a826d02e 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -16,6 +16,7 @@ # include <config.h> #endif +#include <boost/scoped_ptr.hpp> #include <gtkmm/box.h> #include <gtkmm/treeview.h> #include <gtkmm/treestore.h> @@ -36,6 +37,9 @@ struct SPColorSelector; namespace Inkscape { namespace UI { + +class SelectedColor; + namespace Dialog { @@ -166,8 +170,7 @@ private: Gtk::Alignment _blur_alignment; Gtk::Dialog _colorSelectorDialog; - SPColorSelector *_colorSelector; - + boost::scoped_ptr<Inkscape::UI::SelectedColor> _selectedColor; //Methods: @@ -233,7 +236,7 @@ private: void setupDialog(const Glib::ustring &title); - friend void sp_highlight_picker_color_mod(SPColorSelector *csel, GObject *cp); + void _highlightPickerColorMod(); }; diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index ed71c826f..f36e3f18d 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -51,7 +51,7 @@ #include "ui/tools/tool-base.h" //"event-context.h" #include "selection.h" //#include "dialogs/dialog-events.h" -#include "widgets/sp-color-notebook.h" +#include "ui/widget/color-notebook.h" #include "style.h" #include "filter-chemistry.h" #include "filters/blend.h" diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 815aa12ef..1a696c820 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -69,6 +69,7 @@ TextEdit::TextEdit() font_label(_("_Font"), true), layout_frame(), text_label(_("_Text"), true), + vari_label(_("_Variants"), true), setasdefault_button(_("Set as _default")), close_button(Gtk::Stock::CLOSE), apply_button(Gtk::Stock::APPLY), @@ -195,7 +196,8 @@ TextEdit::TextEdit() notebook.append_page(font_vbox, font_label); notebook.append_page(text_vbox, text_label); - + notebook.append_page(vari_vbox, vari_label); + /* Buttons */ setasdefault_button.set_use_underline(true); apply_button.set_can_default(); @@ -216,6 +218,7 @@ TextEdit::TextEdit() setasdefault_button.signal_clicked().connect(sigc::mem_fun(*this, &TextEdit::onSetDefault)); apply_button.signal_clicked().connect(sigc::mem_fun(*this, &TextEdit::onApply)); close_button.signal_clicked().connect(sigc::bind(_signal_response.make_slot(), GTK_RESPONSE_CLOSE)); + fontVariantChangedConn = vari_vbox.connectChanged(sigc::bind(sigc::ptr_fun(&onFontVariantChange), this)); desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &TextEdit::setTargetDesktop) ); deskTrack.connect(GTK_WIDGET(gobj())); @@ -230,6 +233,7 @@ TextEdit::~TextEdit() selectChangedConn.disconnect(); desktopChangeConn.disconnect(); deskTrack.disconnect(); + fontVariantChangedConn.disconnect(); } void TextEdit::styleButton(Gtk::RadioButton *button, gchar const *tooltip, gchar const *icon_name, Gtk::RadioButton *group_button ) @@ -384,6 +388,11 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) gtk_entry_set_text ((GtkEntry *) gtk_bin_get_child ((GtkBin *) spacing_combo), sstr); g_free(sstr); + // Update font variant widget + //int result_variants = + sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTVARIANTS); + vari_vbox.update( &query ); + } blocked = false; } @@ -510,12 +519,15 @@ SPCSSAttr *TextEdit::fillTextStyle () sp_repr_css_set_property (css, "writing-mode", "tb"); } - // Note that CSS 1.1 does not support line-height; we set it for consistency, but also set + // Note that SVG 1.1 does not support line-height; we set it for consistency, but also set // sodipodi:linespacing for backwards compatibility; in 1.2 we use line-height for flowtext const gchar *sstr = gtk_combo_box_text_get_active_text ((GtkComboBoxText *) spacing_combo); sp_repr_css_set_property (css, "line-height", sstr); + // Font variants + vari_vbox.fill_css( css ); + return css; } @@ -646,6 +658,19 @@ void TextEdit::onFontChange(SPFontSelector * /*fontsel*/, gchar* fontspec, TextE } +void TextEdit::onFontVariantChange(TextEdit *self) +{ + if( self->blocked ) + return; + + SPItem *text = self->getSelectedTextItem (); + + if (text) { + self->apply_button.set_sensitive ( true ); + } + self->setasdefault_button.set_sensitive ( true ); +} + void TextEdit::onStartOffsetChange(GtkTextBuffer * /*text_buffer*/, TextEdit *self) { SPItem *text = self->getSelectedTextItem(); diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index 117ad2e28..41f89b3e7 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -32,9 +32,11 @@ #include "ui/widget/panel.h" #include "ui/widget/frame.h" #include "ui/dialog/desktop-tracker.h" +#include "ui/widget/font-variants.h" class SPItem; struct SPFontSelector; +class FontVariants; class font_instance; class SPCSSAttr; @@ -111,6 +113,17 @@ protected: static void onFontChange (SPFontSelector *fontsel, gchar* fontspec, TextEdit *self); /** + * Callback invoked when the user modifies the font variant through the dialog. + * + * onFontChange updates the dialog UI. The subfunction setPreviewText updates the preview label. + * + * @param fontsel pointer to FontVariant (currently not used). + * @param fontspec for the text to be previewed. + * @param self pointer to the current instance of the dialog. + */ + static void onFontVariantChange (TextEdit *self); + + /** * Callback invoked when the user modifies the startOffset of text on a path. * * @param text_buffer pointer to the GtkTextBuffer with the text of the selected text object. @@ -213,6 +226,9 @@ private: GtkWidget *text_view; // TODO - Convert this to a Gtk::TextView, but GtkSpell doesn't seem to work with it GtkTextBuffer *text_buffer; + Inkscape::UI::Widget::FontVariants vari_vbox; + Gtk::Label vari_label; + Gtk::HBox button_row; Gtk::Button setasdefault_button; Gtk::Button close_button; @@ -224,6 +240,7 @@ private: sigc::connection selectChangedConn; sigc::connection subselChangedConn; sigc::connection selectModifiedConn; + sigc::connection fontVariantChangedConn; bool blocked; const Glib::ustring samplephrase; |
