summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ac7732e)
raw | patch | inline | side by side (parent: ac7732e)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 16 Dec 2007 18:09:15 +0000 (18:09 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 16 Dec 2007 18:09:15 +0000 (18:09 +0000) |
index 79b83079183468a0616fd37a828975f61f20a327..febab42e4e4c8cefdc0a1e4034df55e89a61a1b3 100644 (file)
@@ -200,7 +200,7 @@ CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_r
color = prefs_get_int_attribute("options.grids.axonom", "color", 0x0000ff20);
empcolor = prefs_get_int_attribute("options.grids.axonom", "empcolor", 0x0000ff40);
empspacing = prefs_get_int_attribute("options.grids.axonom", "empspacing", 5);
- gridunit = &sp_unit_get_by_id(SP_UNIT_MM);
+ gridunit = sp_unit_get_by_abbreviation( prefs_get_string_attribute("options.grids.axonom", "units") );
lengthy = prefs_get_double_attribute ("options.grids.axonom", "spacing_y", 1.0);
angle_deg[X] = prefs_get_double_attribute ("options.grids.axonom", "angle_x", 30.0);
angle_deg[Z] = prefs_get_double_attribute ("options.grids.axonom", "angle_z", 30.0);
@@ -218,13 +218,23 @@ CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_r
table.set_spacings(2);
vbox.pack_start(table, false, false, 0);
+ Inkscape::UI::Widget::ScalarUnit * sutemp;
_rumg.init (_("Grid _units:"), "units", _wr, repr, doc);
_rsu_ox.init (_("_Origin X:"), _("X coordinate of grid origin"),
"originx", _rumg, _wr, repr, doc);
+ sutemp = _rsu_ox.getSU();
+ sutemp->setDigits(4);
+ sutemp->setIncrements(0.1, 1.0);
_rsu_oy.init (_("O_rigin Y:"), _("Y coordinate of grid origin"),
"originy", _rumg, _wr, repr, doc);
+ sutemp = _rsu_oy.getSU();
+ sutemp->setDigits(4);
+ sutemp->setIncrements(0.1, 1.0);
_rsu_sy.init (_("Spacing _Y:"), _("Base length of z-axis"),
"spacingy", _rumg, _wr, repr, doc);
+ sutemp = _rsu_sy.getSU();
+ sutemp->setDigits(4);
+ sutemp->setIncrements(0.1, 1.0);
_rsu_ax.init (_("Angle X:"), _("Angle of x-axis"),
"gridanglex", _rumg, _wr, repr, doc);
_rsu_az.init (_("Angle Z:"), _("Angle of z-axis"),
index da16bb85ee0053c13b07421597477b9c3b61e094..7d9d009f02e1b8c8c8b3a73c4451232eb4386491 100644 (file)
@@ -398,7 +398,7 @@ CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPD
empspacing = prefs_get_int_attribute("options.grids.xy", "empspacing", 5);
spacing[NR::X] = prefs_get_double_attribute ("options.grids.xy", "spacing_x", 0.0);
spacing[NR::Y] = prefs_get_double_attribute ("options.grids.xy", "spacing_y", 0.0);
- gridunit = &sp_unit_get_by_id(SP_UNIT_PX);
+ gridunit = sp_unit_get_by_abbreviation( prefs_get_string_attribute("options.grids.xy", "units") );
render_dotted = prefs_get_int_attribute ("options.grids.xy", "dotted", 0) == 1;
snapper = new CanvasXYGridSnapper(this, namedview, 0);
index cd504fa17b20503c8eef14866e2f51d6a6333a1f..b013d52b623eddde3f379d1b55de49541e9b4407 100644 (file)
" angle_z=\"30.0\"\n"
" color=\"65312\"\n" // 0x0000FF20
" empcolor=\"65344\"\n" // 0x0000FF40
-" empspacing=\"5\"\n"
-" dotted=\"0\"/>\n"
+" empspacing=\"5\"/>\n"
" </group>\n"
" </group>\n"
"\n"
index f7a6072fd0cb8838cf5177cbd9ee568fc15c844e..dfbfdcf58660d2f655e15de57e369c773ff98ffc 100644 (file)
_page_grids.add_line( false, "", _grids_notebook, "", "", false);
_grids_notebook.append_page(_grids_xy, CanvasGrid::getName( GRID_RECTANGULAR ));
_grids_notebook.append_page(_grids_axonom, CanvasGrid::getName( GRID_AXONOMETRIC ));
- //_grids_xy.add_line( false, _("Grid units"), _grids_xy_units, "", "", false);
+ _grids_xy_units.init("options.grids.xy", "units");
+ _grids_xy.add_line( false, _("Grid units"), _grids_xy_units, "", "", false);
_grids_xy_origin_x.init("options.grids.xy", "origin_x", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false);
_grids_xy_origin_y.init("options.grids.xy", "origin_y", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false);
_grids_xy.add_line( false, _("Origin X"), _grids_xy_origin_x, "", _("X coordinate of grid origin"), false);
_grids_xy.add_line( false, "", _grids_xy_dotted, "", _("If set, displays dots at gridpoints instead of gridlines"), false);
// CanvasAxonomGrid properties:
- //_grids_axonom.add_line( false, _("Grid units"), _grids_axonom_units, "", "", false);
+ _grids_axonom_units.init("options.grids.axonom", "units");
+ _grids_axonom.add_line( false, _("Grid units"), _grids_axonom_units, "", "", false);
_grids_axonom_origin_x.init("options.grids.axonom", "origin_x", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false);
_grids_axonom_origin_y.init("options.grids.axonom", "origin_y", -10000.0, 10000.0, 0.1, 1.0, 0.0, false, false);
_grids_axonom.add_line( false, _("Origin X"), _grids_axonom_origin_x, "", _("X coordinate of grid origin"), false);
index 7cca51dd2da4e5991b63a2e3b576e5b942184936..4b62f3947d9edf53cfcf24184cfd4a3e728690f2 100644 (file)
Gtk::Notebook _grids_notebook;
DialogPage _grids_xy, _grids_axonom;
// CanvasXYGrid properties:
- //_grids_xy_units;
+ PrefUnit _grids_xy_units;
PrefSpinButton _grids_xy_origin_x;
PrefSpinButton _grids_xy_origin_y;
PrefSpinButton _grids_xy_spacing_x;
PrefSpinButton _grids_xy_empspacing;
PrefCheckButton _grids_xy_dotted;
// CanvasAxonomGrid properties:
- //_grids_axonom_units;
+ PrefUnit _grids_axonom_units;
PrefSpinButton _grids_axonom_origin_x;
PrefSpinButton _grids_axonom_origin_y;
PrefSpinButton _grids_axonom_spacing_y;
index 29f86745e59ed57d40dca4fc66203ef8b421548e..7b94512cfef7710482d5acd610654616cc63846f 100644 (file)
}
}
+void PrefUnit::init(const std::string& prefs_path, const std::string& attr)
+{
+ _prefs_path = prefs_path;
+ _attr = attr;
+ setUnitType(UNIT_TYPE_LINEAR);
+ gchar const * prefval = prefs_get_string_attribute(_prefs_path.c_str(), _attr.c_str());
+ setUnit(prefval);
+}
+
+void PrefUnit::on_changed()
+{
+ if (this->is_visible()) //only take action if user changed value
+ {
+ prefs_set_string_attribute(_prefs_path.c_str(), _attr.c_str(), getUnitAbbr().c_str());
+ }
+}
+
} // namespace Widget
} // namespace UI
} // namespace Inkscape
index f754cde1b1c491c3181d8595a5fc3f4d6679ebeb..2df0b993727c5ae31adefc0fd04e3203822314a0 100644 (file)
//#include <glibmm/i18n.h>
#include "ui/widget/color-picker.h"
+#include "ui/widget/unit-menu.h"
namespace Inkscape {
namespace UI {
virtual void on_changed (guint32 rgba);
};
+class PrefUnit : public UnitMenu
+{
+public:
+ void init(const std::string& prefs_path, const std::string& attr);
+protected:
+ std::string _prefs_path;
+ std::string _attr;
+ void on_changed();
+};
class DialogPage : public Gtk::Table
{