summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-09-11 03:30:09 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-09-11 03:30:09 +0000
commit39d4d238a04162c559f83011999cc16feb6da88f (patch)
tree0a6cb688607c53d2ae529a8f4a72a04698008060 /src/ui
parentBack out changes in r13514 -- seems to break build (diff)
downloadinkscape-39d4d238a04162c559f83011999cc16feb6da88f.tar.gz
inkscape-39d4d238a04162c559f83011999cc16feb6da88f.zip
add radius support to fillet-chamfer, bugfixes
(bzr r13341.1.203)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.cpp71
-rw-r--r--src/ui/dialog/lpe-fillet-chamfer-properties.h31
2 files changed, 46 insertions, 56 deletions
diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
index eef32d10d..ad8b66b8c 100644
--- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
+++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp
@@ -12,9 +12,9 @@
#include <glibmm/threads.h>
#endif
+#include <gtkmm.h>
#include "lpe-fillet-chamfer-properties.h"
#include <boost/lexical_cast.hpp>
-#include <gtkmm/stock.h>
#include <glibmm/main.h>
#include <glibmm/i18n.h>
#include "inkscape.h"
@@ -31,9 +31,8 @@
#include "selection-chemistry.h"
#include "ui/icon-names.h"
#include "ui/widget/imagetoggler.h"
-#include <cmath>
-#include <gtkmm/radiobutton.h>
#include "util/units.h"
+#include <cmath>
//#include "event-context.h"
@@ -44,38 +43,24 @@ namespace Dialogs {
FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
: _desktop(NULL), _knotpoint(NULL), _position_visible(false)
{
-#if WITH_GTKMM_3_0
- Gtk::Box *mainVBox = get_content_area();
-#else
Gtk::Box *mainVBox = get_vbox();
-#endif
-
mainVBox->set_homogeneous(false);
-
-#if WITH_GTKMM_3_0
- _layout_table.set_row_spacing(4);
- _layout_table.set_column_spacing(4);
-#else
_layout_table.set_spacings(4);
_layout_table.resize(2, 2);
-#endif
// Layer name widgets
- _fillet_chamfer_position_entry.set_activates_default(true);
+ _fillet_chamfer_position_numeric.set_digits(4);
+ _fillet_chamfer_position_numeric.set_increments(1,1);
+ //todo: get tha max aloable infinity freeze the widget
+ _fillet_chamfer_position_numeric.set_range(0., 999999999999999999.);
+
_fillet_chamfer_position_label.set_label(_("Radius (pixels):"));
_fillet_chamfer_position_label.set_alignment(1.0, 0.5);
-#if WITH_GTKMM_3_0
- _layout_table.attach(_fillet_chamfer_position_label, 0, 0, 1, 1);
- _layout_table.attach(_fillet_chamfer_position_entry, 1, 0, 1, 1);
- _fillet_chamfer_position_entry.set_hexpand();
-#else
_layout_table.attach(_fillet_chamfer_position_label, 0, 1, 0, 1, Gtk::FILL,
Gtk::FILL);
- _layout_table.attach(_fillet_chamfer_position_entry, 1, 2, 0, 1,
+ _layout_table.attach(_fillet_chamfer_position_numeric, 1, 2, 0, 1,
Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
-#endif
-
_fillet_chamfer_type_fillet.set_label(_("Fillet"));
_fillet_chamfer_type_fillet.set_group(_fillet_chamfer_type_group);
_fillet_chamfer_type_inverse_fillet.set_label(_("Inverse fillet"));
@@ -115,7 +100,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog()
show_all_children();
- set_focus(_fillet_chamfer_position_entry);
+ set_focus(_fillet_chamfer_position_numeric);
}
FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog()
@@ -128,12 +113,16 @@ void FilletChamferPropertiesDialog::showDialog(
SPDesktop *desktop, Geom::Point knotpoint,
const Inkscape::LivePathEffect::
FilletChamferPointArrayParamKnotHolderEntity *pt,
- const gchar *unit)
+ const gchar *unit,
+ bool use_distance,
+ bool aprox_radius)
{
FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog();
dialog->_setDesktop(desktop);
dialog->_setUnit(unit);
+ dialog->_set_use_distance(use_distance);
+ dialog->_set_aprox(aprox_radius);
dialog->_setKnotPoint(knotpoint);
dialog->_setPt(pt);
@@ -150,9 +139,9 @@ void FilletChamferPropertiesDialog::showDialog(
void FilletChamferPropertiesDialog::_apply()
{
- std::istringstream i_pos(_fillet_chamfer_position_entry.get_text());
- double d_pos, d_width;
- if (i_pos >> d_pos) {
+ double d_width;
+ double d_pos = _fillet_chamfer_position_numeric.get_value();
+ if (d_pos) {
if (_fillet_chamfer_type_fillet.get_active() == true) {
d_width = 1;
} else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) {
@@ -203,6 +192,13 @@ void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event)
void FilletChamferPropertiesDialog::_setKnotPoint(Geom::Point knotpoint)
{
double position;
+ std::string distance_or_radius = std::string(_("Radius "));
+ if(aprox){
+ distance_or_radius = std::string(_("Radius aproximated "));
+ }
+ if(use_distance){
+ distance_or_radius = std::string(_("Knot distance "));
+ }
if (knotpoint.x() > 0) {
double intpart;
position = modf(knotpoint[Geom::X], &intpart) * 100;
@@ -211,16 +207,13 @@ void FilletChamferPropertiesDialog::_setKnotPoint(Geom::Point knotpoint)
_fillet_chamfer_position_label.set_label(_("Position (%):"));
} else {
_flexible = false;
- std::string posConcat =
- std::string(_("Position (")) + std::string(unit) + std::string(")");
+ std::string posConcat = distance_or_radius +
+ std::string(_("(")) + std::string(unit) + std::string(")");
_fillet_chamfer_position_label.set_label(_(posConcat.c_str()));
position = knotpoint[Geom::X] * -1;
position = Inkscape::Util::Quantity::convert(position, "px", unit);
}
- std::ostringstream s;
- s.imbue(std::locale::classic());
- s << position;
- _fillet_chamfer_position_entry.set_text(s.str());
+ _fillet_chamfer_position_numeric.set_value(position);
if (knotpoint.y() == 1) {
_fillet_chamfer_type_fillet.set_active(true);
} else if (knotpoint.y() == 2) {
@@ -246,6 +239,16 @@ void FilletChamferPropertiesDialog::_setUnit(const gchar *abbr)
unit = abbr;
}
+void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance)
+{
+ use_distance = use_knot_distance;
+}
+
+void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius)
+{
+ aprox = aprox_radius;
+}
+
void FilletChamferPropertiesDialog::_setDesktop(SPDesktop *desktop)
{
if (desktop) {
diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h
index 9beca02e1..47ff97b00 100644
--- a/src/ui/dialog/lpe-fillet-chamfer-properties.h
+++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h
@@ -8,24 +8,10 @@
#ifndef INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H
#define INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H
-#if HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <gtkmm/dialog.h>
#include <2geom/point.h>
+#include <gtkmm.h>
#include "live_effects/parameter/filletchamferpointarray.h"
-#include <gtkmm/entry.h>
-#include <gtkmm/label.h>
-#include <gtkmm/radiobutton.h>
-
-#if WITH_GTKMM_3_0
- #include <gtkmm/grid.h>
-#else
- #include <gtkmm/table.h>
-#endif
-
class SPDesktop;
namespace Inkscape {
@@ -44,7 +30,9 @@ public:
static void showDialog(SPDesktop *desktop, Geom::Point knotpoint,
const Inkscape::LivePathEffect::
FilletChamferPointArrayParamKnotHolderEntity *pt,
- const gchar *unit);
+ const gchar *unit,
+ bool use_distance,
+ bool aprox_radius);
protected:
@@ -53,19 +41,14 @@ protected:
_knotpoint;
Gtk::Label _fillet_chamfer_position_label;
- Gtk::Entry _fillet_chamfer_position_entry;
+ Gtk::SpinButton _fillet_chamfer_position_numeric;
Gtk::RadioButton::Group _fillet_chamfer_type_group;
Gtk::RadioButton _fillet_chamfer_type_fillet;
Gtk::RadioButton _fillet_chamfer_type_inverse_fillet;
Gtk::RadioButton _fillet_chamfer_type_chamfer;
Gtk::RadioButton _fillet_chamfer_type_double_chamfer;
-#if WITH_GTKMM_3_0
- Gtk::Grid _layout_table;
-#else
Gtk::Table _layout_table;
-#endif
-
bool _position_visible;
double _index;
@@ -83,10 +66,14 @@ protected:
void _setPt(const Inkscape::LivePathEffect::
FilletChamferPointArrayParamKnotHolderEntity *pt);
void _setUnit(const gchar *abbr);
+ void _set_use_distance(bool use_knot_distance);
+ void _set_aprox(bool aprox_radius);
void _apply();
void _close();
bool _flexible;
const gchar *unit;
+ bool use_distance;
+ bool aprox;
void _setKnotPoint(Geom::Point knotpoint);
void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row);