diff options
| author | Ted Gould <ted@gould.cx> | 2008-10-11 15:16:23 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-10-11 15:16:23 +0000 |
| commit | 2f5eb047d9e05be5e68549ef6b75070d2faa7d2f (patch) | |
| tree | ca2e94164b6d7aaebfc17196ca46bfc825a7665a /src/ui/dialog | |
| parent | Merge from trunk. (diff) | |
| download | inkscape-2f5eb047d9e05be5e68549ef6b75070d2faa7d2f.tar.gz inkscape-2f5eb047d9e05be5e68549ef6b75070d2faa7d2f.zip | |
Merging from trunk
(bzr r6884)
Diffstat (limited to 'src/ui/dialog')
| -rw-r--r-- | src/ui/dialog/align-and-distribute.cpp | 34 | ||||
| -rw-r--r-- | src/ui/dialog/filedialogimpl-win32.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 37 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/transformation.cpp | 50 |
5 files changed, 67 insertions, 58 deletions
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 99d3fdda3..b8b59230a 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -160,7 +160,7 @@ private : selected.erase(master); /*}*/ //Compute the anchor point - boost::optional<NR::Rect> b = sp_item_bbox_desktop (thing); + boost::optional<Geom::Rect> b = sp_item_bbox_desktop (thing); if (b) { mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]); @@ -177,7 +177,7 @@ private : case AlignAndDistribute::DRAWING: { - boost::optional<NR::Rect> b = sp_item_bbox_desktop + boost::optional<Geom::Rect> b = sp_item_bbox_desktop ( (SPItem *) sp_document_root (sp_desktop_document (desktop)) ); if (b) { mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], @@ -190,7 +190,7 @@ private : case AlignAndDistribute::SELECTION: { - boost::optional<NR::Rect> b = selection->bounds(); + boost::optional<Geom::Rect> b = selection->bounds(); if (b) { mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]); @@ -215,7 +215,7 @@ private : prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); bool changed = false; - boost::optional<NR::Rect> b; + boost::optional<Geom::Rect> b; if (sel_as_group) b = selection->bounds(); @@ -330,9 +330,9 @@ private : it != selected.end(); ++it) { - boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it); + boost::optional<Geom::Rect> bbox = sp_item_bbox_desktop(*it); if (bbox) { - sorted.push_back(BBoxSort(*it, to_2geom(*bbox), _orientation, _kBegin, _kEnd)); + sorted.push_back(BBoxSort(*it, *bbox, _orientation, _kBegin, _kEnd)); } } //sort bbox by anchors @@ -602,7 +602,7 @@ private : //Check 2 or more selected objects if (selected.size() < 2) return; - boost::optional<NR::Rect> sel_bbox = selection->bounds(); + boost::optional<Geom::Rect> sel_bbox = selection->bounds(); if (!sel_bbox) { return; } @@ -611,7 +611,7 @@ private : // nor drift on sequential randomizations. Discard cache on global (or better active // desktop's) selection_change signal. if (!_dialog.randomize_bbox) { - _dialog.randomize_bbox = to_2geom(*sel_bbox); + _dialog.randomize_bbox = *sel_bbox; } // see comment in ActionAlign above @@ -623,13 +623,13 @@ private : ++it) { sp_document_ensure_up_to_date(sp_desktop_document (desktop)); - boost::optional<NR::Rect> item_box = sp_item_bbox_desktop (*it); + boost::optional<Geom::Rect> item_box = sp_item_bbox_desktop (*it); if (item_box) { // find new center, staying within bbox - double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box).extent(Geom::X)/2 + - g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::X].extent() - (*item_box).extent(Geom::X)); - double y = _dialog.randomize_bbox->min()[Geom::Y] + (*item_box).extent(Geom::Y)/2 + - g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::Y].extent() - (*item_box).extent(Geom::Y)); + double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box)[Geom::X].extent() /2 + + g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::X].extent() - (*item_box)[Geom::X].extent()); + double y = _dialog.randomize_bbox->min()[Geom::Y] + (*item_box)[Geom::Y].extent()/2 + + g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::Y].extent() - (*item_box)[Geom::Y].extent()); // displacement is the new center minus old: NR::Point t = NR::Point (x, y) - 0.5*(item_box->max() + item_box->min()); sp_item_move_rel(*it, Geom::Translate(t)); @@ -1099,9 +1099,9 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem { gdouble max = -1e18; for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) { - boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it); + boost::optional<Geom::Rect> b = sp_item_bbox_desktop (*it); if (b) { - gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y); + gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent(); if (dim > max) { max = dim; master = it; @@ -1116,9 +1116,9 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem { gdouble max = 1e18; for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) { - boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it); + boost::optional<Geom::Rect> b = sp_item_bbox_desktop (*it); if (b) { - gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y); + gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent(); if (dim < max) { max = dim; master = it; diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index e2d044908..e1479d3b4 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -866,7 +866,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() NRRectL bbox = {0, 0, scaledSvgWidth, scaledSvgHeight}; // write object bbox to area - boost::optional<NR::Rect> maybeArea(from_2geom(area)); + boost::optional<Geom::Rect> maybeArea(area); sp_document_ensure_up_to_date (svgDoc); sp_item_invoke_bbox((SPItem *) svgDoc->root, maybeArea, sp_item_i2r_affine((SPItem *)(svgDoc->root)), TRUE); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 44f37083b..73d26b67e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -176,7 +176,7 @@ LivePathEffectEditor::~LivePathEffectEditor() } void -LivePathEffectEditor::showParams(LivePathEffect::Effect* effect) +LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) { if (effectwidget) { effectcontrol_vbox.remove(*effectwidget); @@ -184,8 +184,8 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect* effect) effectwidget = NULL; } - explain_label.set_markup("<b>" + effect->getName() + "</b>"); - effectwidget = effect->newWidget(&tooltips); + explain_label.set_markup("<b>" + effect.getName() + "</b>"); + effectwidget = effect.newWidget(&tooltips); if (effectwidget) { effectcontrol_vbox.pack_start(*effectwidget, true, true); } @@ -200,7 +200,7 @@ LivePathEffectEditor::selectInList(LivePathEffect::Effect* effect) { Gtk::TreeNodeChildren chi = effectlist_view.get_model()->children(); for (Gtk::TreeIter ci = chi.begin() ; ci != chi.end(); ci++) { - if (ci->get_value(columns.lperef)->lpeobject->lpe == effect) + if (ci->get_value(columns.lperef)->lpeobject->get_lpe() == effect) effectlist_view.get_selection()->select(ci); } } @@ -259,7 +259,7 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) if ( sp_lpe_item_has_path_effect(lpeitem) ) { Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(lpeitem); if (lpe) { - showParams(lpe); + showParams(*lpe); lpe_list_locked = true; selectInList(lpe); } else { @@ -295,10 +295,17 @@ LivePathEffectEditor::effect_list_reload(SPLPEItem *lpeitem) PathEffectList::iterator it; for( it = effectlist.begin() ; it!=effectlist.end(); it++ ) { - Gtk::TreeModel::Row row = *(effectlist_store->append()); - row[columns.col_name] = (*it)->lpeobject->lpe->getName(); - row[columns.lperef] = *it; - row[columns.col_visible] = (*it)->lpeobject->lpe->isVisible(); + if ((*it)->lpeobject->get_lpe()) { + Gtk::TreeModel::Row row = *(effectlist_store->append()); + row[columns.col_name] = (*it)->lpeobject->get_lpe()->getName(); + row[columns.lperef] = *it; + row[columns.col_visible] = (*it)->lpeobject->get_lpe()->isVisible(); + } else { + Gtk::TreeModel::Row row = *(effectlist_store->append()); + row[columns.col_name] = "Unknown effect!"; + row[columns.lperef] = *it; + row[columns.col_visible] = false; + } } } @@ -427,9 +434,11 @@ void LivePathEffectEditor::on_effect_selection_changed() LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef]; if (lperef && current_lpeitem) { - lpe_list_locked = true; // prevent reload of the list which would lose selection - sp_lpe_item_set_current_path_effect(current_lpeitem, lperef); - showParams(lperef->lpeobject->lpe); + if (lperef->lpeobject->get_lpe()) { + lpe_list_locked = true; // prevent reload of the list which would lose selection + sp_lpe_item_set_current_path_effect(current_lpeitem, lperef); + showParams(*lperef->lpeobject->get_lpe()); + } } } @@ -440,12 +449,12 @@ void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) LivePathEffect::LPEObjectReference * lpeobjref = row[columns.lperef]; - if ( lpeobjref ) { + if ( lpeobjref && lpeobjref->lpeobject->get_lpe() ) { bool newValue = !row[columns.col_visible]; row[columns.col_visible] = newValue; /* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack. * So one can call: lpe_item->setActive(lpeobjref->lpeobject); */ - lpeobjref->lpeobject->lpe->getRepr()->setAttribute("is_visible", newValue ? "true" : "false"); + lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false"); sp_document_done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, newValue ? _("Activate path effect") : _("Deactivate path effect")); } diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index a924ed6e9..49db74fca 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -53,7 +53,7 @@ private: void set_sensitize_all(bool sensitive); - void showParams(LivePathEffect::Effect* effect); + void showParams(LivePathEffect::Effect& effect); void showText(Glib::ustring const &str); void selectInList(LivePathEffect::Effect* effect); diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 0334b8541..5927dc740 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -457,7 +457,7 @@ Transformation::updatePageMove(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { if (!_check_move_relative.get_active()) { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { double x = bbox->min()[Geom::X]; double y = bbox->min()[Geom::Y]; @@ -478,10 +478,10 @@ void Transformation::updatePageScale(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { - double w = bbox->extent(Geom::X); - double h = bbox->extent(Geom::Y); + double w = bbox->dimensions()[Geom::X]; + double h = bbox->dimensions()[Geom::Y]; _scalar_scale_horizontal.setHundredPercent(w); _scalar_scale_vertical.setHundredPercent(h); onScaleXValueChanged(); // to update x/y proportionality if switch is on @@ -508,10 +508,10 @@ void Transformation::updatePageSkew(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { - double w = bbox->extent(Geom::X); - double h = bbox->extent(Geom::Y); + double w = bbox->dimensions()[Geom::X]; + double h = bbox->dimensions()[Geom::Y]; _scalar_skew_vertical.setHundredPercent(w); _scalar_skew_horizontal.setHundredPercent(h); _page_skew.set_sensitive(true); @@ -604,7 +604,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection) if (_check_move_relative.get_active()) { sp_selection_move_relative(selection, x, y); } else { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { sp_selection_move_relative(selection, x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); @@ -625,9 +625,9 @@ Transformation::applyPageMove(Inkscape::Selection *selection) it != selected.end(); ++it) { - boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it); + boost::optional<Geom::Rect> bbox = sp_item_bbox_desktop(*it); if (bbox) { - sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.)); + sorted.push_back(BBoxSort(*it, *bbox, Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.)); } } //sort bbox by anchors @@ -649,9 +649,9 @@ Transformation::applyPageMove(Inkscape::Selection *selection) it != selected.end(); ++it) { - boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it); + boost::optional<Geom::Rect> bbox = sp_item_bbox_desktop(*it); if (bbox) { - sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.)); + sorted.push_back(BBoxSort(*it, *bbox, Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.)); } } //sort bbox by anchors @@ -668,7 +668,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection) } } } else { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { sp_selection_move_relative(selection, x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); @@ -692,13 +692,13 @@ Transformation::applyPageScale(Inkscape::Selection *selection) Geom::Scale scale (0,0); // the values are increments! if (_units_scale.isAbsolute()) { - boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item)); + boost::optional<Geom::Rect> bbox(sp_item_bbox_desktop(item)); if (bbox) { double new_width = scaleX; if (fabs(new_width) < 1e-6) new_width = 1e-6; // not 0, as this would result in a nasty no-bbox object double new_height = scaleY; if (fabs(new_height) < 1e-6) new_height = 1e-6; - scale = Geom::Scale(new_width / bbox->extent(Geom::X), new_height / bbox->extent(Geom::Y)); + scale = Geom::Scale(new_width / bbox->dimensions()[Geom::X], new_height / bbox->dimensions()[Geom::Y]); } } else { double new_width = scaleX; @@ -710,7 +710,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection) sp_item_scale_rel (item, scale); } } else { - boost::optional<NR::Rect> bbox(selection->bounds()); + boost::optional<Geom::Rect> bbox(selection->bounds()); if (bbox) { Geom::Point center(bbox->midpoint()); // use rotation center? Geom::Scale scale (0,0); @@ -720,7 +720,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection) if (fabs(new_width) < 1e-6) new_width = 1e-6; double new_height = scaleY; if (fabs(new_height) < 1e-6) new_height = 1e-6; - scale = Geom::Scale(new_width / bbox->extent(Geom::X), new_height / bbox->extent(Geom::Y)); + scale = Geom::Scale(new_width / bbox->dimensions()[Geom::X], new_height / bbox->dimensions()[Geom::Y]); } else { double new_width = scaleX; if (fabs(new_width) < 1e-6) new_width = 1e-6; @@ -777,21 +777,21 @@ Transformation::applyPageSkew(Inkscape::Selection *selection) } else { // absolute displacement double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); - boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item)); + boost::optional<Geom::Rect> bbox(sp_item_bbox_desktop(item)); if (bbox) { - double width = bbox->extent(Geom::X); - double height = bbox->extent(Geom::Y); + double width = bbox->dimensions()[Geom::X]; + double height = bbox->dimensions()[Geom::Y]; sp_item_skew_rel (item, skewX/height, skewY/width); } } } } else { // transform whole selection - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); boost::optional<Geom::Point> center = selection->center(); if ( bbox && center ) { - double width = bbox->extent(Geom::X); - double height = bbox->extent(Geom::Y); + double width = bbox->dimensions()[Geom::X]; + double height = bbox->dimensions()[Geom::Y]; if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); @@ -869,7 +869,7 @@ Transformation::onMoveRelativeToggled() //g_message("onMoveRelativeToggled: %f, %f px\n", x, y); - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { if (_check_move_relative.get_active()) { @@ -1009,7 +1009,7 @@ Transformation::onClear() _scalar_move_horizontal.setValue(0); _scalar_move_vertical.setValue(0); } else { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { _scalar_move_horizontal.setValue(bbox->min()[Geom::X], "px"); _scalar_move_vertical.setValue(bbox->min()[Geom::Y], "px"); |
