From f4ab745a2deea8393eea28220acc073a973f225d Mon Sep 17 00:00:00 2001 From: johanengelen Date: Wed, 16 Jan 2008 19:27:52 +0000 Subject: [PATCH] fix initialization of grid document properties --- src/display/canvas-axonomgrid.cpp | 23 ++++++++++++++++++++++- src/display/canvas-grid.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 51aa43783..22141faf8 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -439,7 +439,28 @@ _wr.setUpdating (false); attach_all (*table, widget_array, sizeof(widget_array)); if (repr) readRepr(); - updateWidgets(); + + // set widget values + _rumg->setUnit (gridunit); + + gdouble val; + val = origin[NR::X]; + val = sp_pixels_get_units (val, *(gridunit)); + _rsu_ox->setValue (val); + val = origin[NR::Y]; + val = sp_pixels_get_units (val, *(gridunit)); + _rsu_oy->setValue (val); + val = lengthy; + double gridy = sp_pixels_get_units (val, *(gridunit)); + _rsu_sy->setValue (gridy); + + _rsu_ax->setValue(angle_deg[X]); + _rsu_az->setValue(angle_deg[Z]); + + _rcp_gcol->setRgba32 (color); + _rcp_gmcol->setRgba32 (empcolor); + _rsi->setValue (empspacing); + return table; } diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index a15fdf243..f36d8dc5a 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -334,6 +334,12 @@ CanvasGrid::newWidget() vbox->pack_start(*_rcb_visible, true, true); vbox->pack_start(*newSpecificWidget(), true, true); + // set widget values + _rcb_visible->setActive(visible); + if (snapper != NULL) { + _rcb_enabled->setActive(snapper->getEnabled()); + } + return dynamic_cast (vbox); } @@ -703,7 +709,29 @@ _wr.setUpdating (false); attach_all (*table, widget_array, sizeof(widget_array)); if (repr) readRepr(); - updateWidgets(); + + // set widget values + _rumg->setUnit (gridunit); + + gdouble val; + val = origin[NR::X]; + val = sp_pixels_get_units (val, *(gridunit)); + _rsu_ox->setValue (val); + val = origin[NR::Y]; + val = sp_pixels_get_units (val, *(gridunit)); + _rsu_oy->setValue (val); + val = spacing[NR::X]; + double gridx = sp_pixels_get_units (val, *(gridunit)); + _rsu_sx->setValue (gridx); + val = spacing[NR::Y]; + double gridy = sp_pixels_get_units (val, *(gridunit)); + _rsu_sy->setValue (gridy); + + _rcp_gcol->setRgba32 (color); + _rcp_gmcol->setRgba32 (empcolor); + _rsi->setValue (empspacing); + + _rcb_dotted->setActive(render_dotted); return table; } -- 2.30.2