lpe-fillet-chamfer-properties.cpp revision afe3b94c9da473ea1e7632e7853dd7dee528d194
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh/**
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh * From the code of Liam P.White from his Power Stroke Knot dialog
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh *
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh * Released under GNU GPL. Read the file 'COPYING' for more information
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh */
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
9dc68827cbd515262ecb8d5ae8547d9e82c72e00Jon A. Cruz#ifdef HAVE_CONFIG_H
9dc68827cbd515262ecb8d5ae8547d9e82c72e00Jon A. Cruz#include <config.h>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#endif
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib#if GLIBMM_DISABLE_DEPRECATED &&HAVE_GLIBMM_THREADS_H
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include <glibmm/threads.h>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#endif
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include <gtkmm.h>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "lpe-fillet-chamfer-properties.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include <boost/lexical_cast.hpp>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include <glibmm/main.h>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include <glibmm/i18n.h>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "inkscape.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "desktop.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "document.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "document-undo.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "layer-manager.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "message-stack.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "desktop-handles.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "sp-object.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "sp-item.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "verbs.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh#include "selection.h"
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould#include "selection-chemistry.h"
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński#include "ui/icon-names.h"
54e660c4de9d37185e3953165d053526632ef4f0johanengelen#include "ui/widget/imagetoggler.h"
54e660c4de9d37185e3953165d053526632ef4f0johanengelen#include "util/units.h"
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib#include <cmath>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh//#include "event-context.h"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
d1bde559850436556ebee2e70e10f1cfc8aff636Krzysztof Kosińskinamespace Inkscape {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshnamespace UI {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshnamespace Dialogs {
e141c94157efa47e3af32fecda00153812986ac2Krzysztof Kosiński
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshFilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh : _desktop(NULL), _knotpoint(NULL), _position_visible(false)
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh{
dd69425007680aafc47fdd994e1985625571d252bryce Gtk::Box *mainVBox = get_vbox();
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh mainVBox->set_homogeneous(false);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _layout_table.set_spacings(4);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _layout_table.resize(3, 3);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh // Layer name widgets
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_position_numeric.set_digits(4);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_position_numeric.set_increments(1,1);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh //todo: get tha max aloable infinity freeze the widget
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_position_numeric.set_range(0., 999999999999999999.);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_position_label.set_label(_("Radius (pixels):"));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_position_label.set_alignment(1.0, 0.5);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _layout_table.attach(_fillet_chamfer_position_label, 0, 1, 0, 1, Gtk::FILL,
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib Gtk::FILL);
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib _layout_table.attach(_fillet_chamfer_position_numeric, 1, 2, 0, 1,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_chamfer_subdivisions.set_digits(0);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_chamfer_subdivisions.set_increments(1,1);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh //todo: get tha max aloable infinity freeze the widget
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_chamfer_subdivisions.set_range(0, 999999999999999999.0);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:"));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _layout_table.attach(_fillet_chamfer_chamfer_subdivisions_label, 0, 1, 1, 2, Gtk::FILL,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Gtk::FILL);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _layout_table.attach(_fillet_chamfer_chamfer_subdivisions, 1, 2, 1, 2,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_type_fillet.set_label(_("Fillet"));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_type_fillet.set_group(_fillet_chamfer_type_group);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_type_inverse_fillet.set_label(_("Inverse fillet"));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_type_inverse_fillet.set_group(_fillet_chamfer_type_group);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _fillet_chamfer_type_chamfer.set_label(_("Chamfer"));
d444ed610362dab3c3e727d1b110312318b84cb8miklosh _fillet_chamfer_type_chamfer.set_group(_fillet_chamfer_type_group);
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould _fillet_chamfer_type_inverse_chamfer.set_label(_("Inverse chamfer"));
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould _fillet_chamfer_type_inverse_chamfer.set_group(_fillet_chamfer_type_group);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh mainVBox->pack_start(_layout_table, true, true, 4);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh mainVBox->pack_start(_fillet_chamfer_type_fillet, true, true, 4);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh mainVBox->pack_start(_fillet_chamfer_type_inverse_fillet, true, true, 4);
d1bde559850436556ebee2e70e10f1cfc8aff636Krzysztof Kosiński mainVBox->pack_start(_fillet_chamfer_type_chamfer, true, true, 4);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh mainVBox->pack_start(_fillet_chamfer_type_inverse_chamfer, true, true, 4);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh // Buttons
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _close_button.set_use_stock(true);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _close_button.set_label(Gtk::Stock::CANCEL.id);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _close_button.set_can_default();
d1bde559850436556ebee2e70e10f1cfc8aff636Krzysztof Kosiński
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _apply_button.set_use_underline(true);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _apply_button.set_can_default();
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _close_button.signal_clicked()
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _apply_button.signal_clicked()
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_apply));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
e66a49aa774c6770e99591a19873105bfeb5ce74Johan Engelen signal_delete_event().connect(sigc::bind_return(
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh sigc::hide(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)),
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh true));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _apply_button.grab_default();
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh show_all_children();
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh set_focus(_fillet_chamfer_position_numeric);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh}
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshFilletChamferPropertiesDialog::~FilletChamferPropertiesDialog()
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh{
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _set_desktop(NULL);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh}
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshvoid FilletChamferPropertiesDialog::showDialog(
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh SPDesktop *desktop, Geom::Point knotpoint,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh const Inkscape::LivePathEffect::
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh FilletChamferPointArrayParamKnotHolderEntity *pt,
17d87f5698f5c2958d38c6a6207c7b322a7adaf9johanengelen const gchar *unit,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh bool use_distance,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh bool aprox_radius,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Glib::ustring const * documentUnit)
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh{
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog();
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->_set_desktop(desktop);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->_set_unit(unit);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->_set_use_distance(use_distance);
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib dialog->_set_aprox(aprox_radius);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->_set_document_unit(documentUnit);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->_set_knot_point(knotpoint);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->_set_pt(pt);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->set_title(_("Modify Fillet-Chamfer"));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->_apply_button.set_label(_("_Modify"));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->set_modal(true);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh desktop->setWindowTransient(dialog->gobj());
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->property_destroy_with_parent() = true;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->show();
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh dialog->present();
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh}
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshvoid FilletChamferPropertiesDialog::_apply()
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh{
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib double d_width;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh double d_pos = _fillet_chamfer_position_numeric.get_value();
d37634d73670180f99a3e0ea583621373d90ec4fJohan Engelen if (d_pos) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen if (_fillet_chamfer_type_fillet.get_active() == true) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen d_width = 1;
05a66d0771cb563225b8690de04e9490b35453f2johanengelen } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen d_width = 2;
05a66d0771cb563225b8690de04e9490b35453f2johanengelen } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 4000;
05a66d0771cb563225b8690de04e9490b35453f2johanengelen } else {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 3000;
05a66d0771cb563225b8690de04e9490b35453f2johanengelen }
05a66d0771cb563225b8690de04e9490b35453f2johanengelen if (_flexible) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen if (d_pos > 99.99999 || d_pos < 0) {
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruz d_pos = 0;
4b883d02d308812fcf976f6292838c52a6230137Johan Engelen }
4b883d02d308812fcf976f6292838c52a6230137Johan Engelen d_pos = _index + (d_pos / 100);
4b883d02d308812fcf976f6292838c52a6230137Johan Engelen } else {
4b883d02d308812fcf976f6292838c52a6230137Johan Engelen d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit);
4b883d02d308812fcf976f6292838c52a6230137Johan Engelen d_pos = d_pos * -1;
4b883d02d308812fcf976f6292838c52a6230137Johan Engelen }
4b883d02d308812fcf976f6292838c52a6230137Johan Engelen _knotpoint->knot_set_offset(Geom::Point(d_pos, d_width));
05a66d0771cb563225b8690de04e9490b35453f2johanengelen }
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _close();
05a66d0771cb563225b8690de04e9490b35453f2johanengelen}
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshvoid FilletChamferPropertiesDialog::_close()
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh{
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh _set_desktop(NULL);
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruz destroy_();
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruz Glib::signal_idle().connect(
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruz sigc::bind_return(
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh sigc::bind(sigc::ptr_fun(&::operator delete), this),
36bb2154f1627a17c3591eb4d7f89335e8b5daddKrzysztof Kosinski false
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh )
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruz );
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh}
7cc06cc17ffc875601993118f9533dfe36bd2dd5johanengelen
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruzbool FilletChamferPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/)
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruz{
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruz return false;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh}
36bb2154f1627a17c3591eb4d7f89335e8b5daddKrzysztof Kosinski
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshvoid FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event)
68b9e386db1a231abaddbfed4d05f7539bdac786scislac{
68b9e386db1a231abaddbfed4d05f7539bdac786scislac if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1)) {
68b9e386db1a231abaddbfed4d05f7539bdac786scislac _apply();
68b9e386db1a231abaddbfed4d05f7539bdac786scislac }
d37634d73670180f99a3e0ea583621373d90ec4fJohan Engelen}
68b9e386db1a231abaddbfed4d05f7539bdac786scislac
68b9e386db1a231abaddbfed4d05f7539bdac786scislacvoid FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint)
68b9e386db1a231abaddbfed4d05f7539bdac786scislac{
68b9e386db1a231abaddbfed4d05f7539bdac786scislac double position;
68b9e386db1a231abaddbfed4d05f7539bdac786scislac std::string distance_or_radius = std::string(_("Radius "));
68b9e386db1a231abaddbfed4d05f7539bdac786scislac if(aprox){
68b9e386db1a231abaddbfed4d05f7539bdac786scislac distance_or_radius = std::string(_("Radius approximated "));
68b9e386db1a231abaddbfed4d05f7539bdac786scislac }
68b9e386db1a231abaddbfed4d05f7539bdac786scislac if(use_distance){
68b9e386db1a231abaddbfed4d05f7539bdac786scislac distance_or_radius = std::string(_("Knot distance "));
68b9e386db1a231abaddbfed4d05f7539bdac786scislac }
68b9e386db1a231abaddbfed4d05f7539bdac786scislac if (knotpoint.x() > 0) {
68b9e386db1a231abaddbfed4d05f7539bdac786scislac double intpart;
68b9e386db1a231abaddbfed4d05f7539bdac786scislac position = modf(knotpoint[Geom::X], &intpart) * 100;
68b9e386db1a231abaddbfed4d05f7539bdac786scislac _flexible = true;
68b9e386db1a231abaddbfed4d05f7539bdac786scislac _index = intpart;
68b9e386db1a231abaddbfed4d05f7539bdac786scislac _fillet_chamfer_position_label.set_label(_("Position (%):"));
d37634d73670180f99a3e0ea583621373d90ec4fJohan Engelen } else {
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould _flexible = false;
05a66d0771cb563225b8690de04e9490b35453f2johanengelen std::string posConcat = distance_or_radius +
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould std::string(_("(")) + std::string(unit) + std::string(")");
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _fillet_chamfer_position_label.set_label(_(posConcat.c_str()));
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould position = knotpoint[Geom::X] * -1;
05a66d0771cb563225b8690de04e9490b35453f2johanengelen
05a66d0771cb563225b8690de04e9490b35453f2johanengelen position = Inkscape::Util::Quantity::convert(position, *document_unit, unit);
68b9e386db1a231abaddbfed4d05f7539bdac786scislac }
68b9e386db1a231abaddbfed4d05f7539bdac786scislac _fillet_chamfer_position_numeric.set_value(position);
05a66d0771cb563225b8690de04e9490b35453f2johanengelen if (knotpoint.y() == 1) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _fillet_chamfer_type_fillet.set_active(true);
05a66d0771cb563225b8690de04e9490b35453f2johanengelen } else if (knotpoint.y() == 2) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _fillet_chamfer_type_inverse_fillet.set_active(true);
05a66d0771cb563225b8690de04e9490b35453f2johanengelen } else if (knotpoint.y() >= 3000 && knotpoint.y() < 4000) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 3000);
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _fillet_chamfer_type_chamfer.set_active(true);
d37634d73670180f99a3e0ea583621373d90ec4fJohan Engelen } else if (knotpoint.y() >= 4000 && knotpoint.y() < 5000) {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 4000);
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _fillet_chamfer_type_inverse_chamfer.set_active(true);
7079a43aa387066c2f67402d77dbe3db981b1054Ted Gould }
05a66d0771cb563225b8690de04e9490b35453f2johanengelen}
7079a43aa387066c2f67402d77dbe3db981b1054Ted Gould
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshvoid FilletChamferPropertiesDialog::_set_pt(
05a66d0771cb563225b8690de04e9490b35453f2johanengelen const Inkscape::LivePathEffect::
54e660c4de9d37185e3953165d053526632ef4f0johanengelen FilletChamferPointArrayParamKnotHolderEntity *pt)
05a66d0771cb563225b8690de04e9490b35453f2johanengelen{
05a66d0771cb563225b8690de04e9490b35453f2johanengelen _knotpoint = const_cast<
05a66d0771cb563225b8690de04e9490b35453f2johanengelen Inkscape::LivePathEffect::FilletChamferPointArrayParamKnotHolderEntity *>(
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh pt);
68b9e386db1a231abaddbfed4d05f7539bdac786scislac}
68b9e386db1a231abaddbfed4d05f7539bdac786scislac
68b9e386db1a231abaddbfed4d05f7539bdac786scislacvoid FilletChamferPropertiesDialog::_set_unit(const gchar *abbr)
d37634d73670180f99a3e0ea583621373d90ec4fJohan Engelen{
05a66d0771cb563225b8690de04e9490b35453f2johanengelen unit = abbr;
05a66d0771cb563225b8690de04e9490b35453f2johanengelen}
7079a43aa387066c2f67402d77dbe3db981b1054Ted Gould
05a66d0771cb563225b8690de04e9490b35453f2johanengelenvoid FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring const *abbr)
7079a43aa387066c2f67402d77dbe3db981b1054Ted Gould{
05a66d0771cb563225b8690de04e9490b35453f2johanengelen document_unit = abbr;
7079a43aa387066c2f67402d77dbe3db981b1054Ted Gould}
54e660c4de9d37185e3953165d053526632ef4f0johanengelen
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshvoid FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance)
68b9e386db1a231abaddbfed4d05f7539bdac786scislac{
68b9e386db1a231abaddbfed4d05f7539bdac786scislac use_distance = use_knot_distance;
68b9e386db1a231abaddbfed4d05f7539bdac786scislac}
68b9e386db1a231abaddbfed4d05f7539bdac786scislac
68b9e386db1a231abaddbfed4d05f7539bdac786scislacvoid FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius)
68b9e386db1a231abaddbfed4d05f7539bdac786scislac{
68b9e386db1a231abaddbfed4d05f7539bdac786scislac aprox = aprox_radius;
68b9e386db1a231abaddbfed4d05f7539bdac786scislac}
68b9e386db1a231abaddbfed4d05f7539bdac786scislac
68b9e386db1a231abaddbfed4d05f7539bdac786scislacvoid FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop)
68b9e386db1a231abaddbfed4d05f7539bdac786scislac{
68b9e386db1a231abaddbfed4d05f7539bdac786scislac if (desktop) {
68b9e386db1a231abaddbfed4d05f7539bdac786scislac Inkscape::GC::anchor(desktop);
68b9e386db1a231abaddbfed4d05f7539bdac786scislac }
d37634d73670180f99a3e0ea583621373d90ec4fJohan Engelen if (_desktop) {
68b9e386db1a231abaddbfed4d05f7539bdac786scislac Inkscape::GC::release(_desktop);
68b9e386db1a231abaddbfed4d05f7539bdac786scislac }
68b9e386db1a231abaddbfed4d05f7539bdac786scislac _desktop = desktop;
68b9e386db1a231abaddbfed4d05f7539bdac786scislac}
68b9e386db1a231abaddbfed4d05f7539bdac786scislac
68b9e386db1a231abaddbfed4d05f7539bdac786scislac} // namespace
68b9e386db1a231abaddbfed4d05f7539bdac786scislac} // namespace
68b9e386db1a231abaddbfed4d05f7539bdac786scislac} // namespace
68b9e386db1a231abaddbfed4d05f7539bdac786scislac
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh/*
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Local Variables:
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh mode:c++
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh c-file-style:"stroustrup"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh indent-tabs-mode:nil
ca4d1d8972d64c1d1bfdd4b09d31f7b372074940Jon A. Cruz fill-column:99
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib End:
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh*/
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh// vim:
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh// :
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh