Commit 1d3d0e52 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Parse scollbars and spinners

2003-07-19  Jody Goldberg <jody@gnome.org>

	* ms-obj.c (ms_obj_read_pre_biff8_obj) : Parse scollbars and spinners

	* ms-excel-read.c (ms_sheet_realize_obj) : apparently spinners use
	  scrollbar records.  Pass the current value too.

	* ms-excel-write.c (excel_write_SST) : simplify a bit to avoid a
	potential corner case that would generate an empty CONTINUE.

2003-07-18  Jody Goldberg <jody@gnome.org>

	* src/sheet-object-widget.c (sheet_widget_slider_create_widget) : Mark
	  the object as being in the process of an update when a new widget is
	  created.  Otherwise the assignment of the new adjustment will look
	  like an update and dirt the workbook.
	(sheet_widget_spinbutton_create_widget) : ditto.
	(sheet_widget_scrollbar_create_widget) : ditto.

2003-07-18  Jody Goldberg <jody@gnome.org>

	For Joseph Pingenot <trelane@digitasaru.net>
	* src/sheet-object-widget.c : Add Spinner and Slider.
parent 51118266
2003-07-18 Jody Goldberg <jody@gnome.org>
* src/sheet-object-widget.c (sheet_widget_slider_create_widget) : Mark
the object as being in the process of an update when a new widget is
created. Otherwise the assignment of the new adjustment will look
like an update and dirt the workbook.
(sheet_widget_spinbutton_create_widget) : ditto.
(sheet_widget_scrollbar_create_widget) : ditto.
2003-07-18 Jody Goldberg <jody@gnome.org>
For Joseph Pingenot <trelane@digitasaru.net>
* src/sheet-object-widget.c : Add Spinner and Slider.
2003-07-18 Jody Goldberg <jody@gnome.org>
* src/mstyle.c (mstyle_hash_internal) : renamed from mstyle_hash,
......
......@@ -61,7 +61,10 @@ Jody:
* Fix glitch in xls hyperlink import.
* Undocumented flag on cell comments in xls
* Import cell comments from >= xl97.
* Object text labels from >= xl97
* Object text labels from >= xl97.
* Fix export of strings > 8224 characters in xl97.
* Fix style export in the presence of validation and hyperlinks.
* Spinner/Scrollbar import for xl 95 & 97.
John Gill:
* More More XLish heuristics for autofill range selection.
......@@ -78,6 +81,10 @@ Jon K
* Import incomplete html fragments, as produced by
* e.g. Mozilla, from clipboard.
Joseph Pingenot:
* Spin buttons
* Slider objects
Morten:
* Hopefully fix NAN issues on Alphas.
* Plug autoformat leak.
......
2003-07-18 Jody Goldberg <jody@gnome.org>
* src/sheet-object-widget.c (sheet_widget_slider_create_widget) : Mark
the object as being in the process of an update when a new widget is
created. Otherwise the assignment of the new adjustment will look
like an update and dirt the workbook.
(sheet_widget_spinbutton_create_widget) : ditto.
(sheet_widget_scrollbar_create_widget) : ditto.
2003-07-18 Jody Goldberg <jody@gnome.org>
For Joseph Pingenot <trelane@digitasaru.net>
* src/sheet-object-widget.c : Add Spinner and Slider.
2003-07-18 Jody Goldberg <jody@gnome.org>
* src/mstyle.c (mstyle_hash_internal) : renamed from mstyle_hash,
......
2003-07-18 Jody Goldberg <jody@gnome.org>
* src/sheet-object-widget.c (sheet_widget_slider_create_widget) : Mark
the object as being in the process of an update when a new widget is
created. Otherwise the assignment of the new adjustment will look
like an update and dirt the workbook.
(sheet_widget_spinbutton_create_widget) : ditto.
(sheet_widget_scrollbar_create_widget) : ditto.
2003-07-18 Jody Goldberg <jody@gnome.org>
For Joseph Pingenot <trelane@digitasaru.net>
* src/sheet-object-widget.c : Add Spinner and Slider.
2003-07-18 Jody Goldberg <jody@gnome.org>
* src/mstyle.c (mstyle_hash_internal) : renamed from mstyle_hash,
......
2003-07-19 Jody Goldberg <jody@gnome.org>
* ms-obj.c (ms_obj_read_pre_biff8_obj) : Parse scollbars and spinners
* ms-excel-read.c (ms_sheet_realize_obj) : apparently spinners use
scrollbar records. Pass the current value too.
* ms-excel-write.c (excel_write_SST) : simplify a bit to avoid a
potential corner case that would generate an empty CONTINUE.
2003-07-18 Jody Goldberg <jody@gnome.org>
* ms-excel-write.c (excel_write_SST) : handle strings > 8224 bytes.
......
......@@ -366,12 +366,12 @@ ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
if (obj->excel_type == 0x0B) {
sheet_widget_checkbox_set_link (obj->gnum_obj,
ms_obj_attr_get_expr (obj, MS_OBJ_ATTR_CHECKBOX_LINK, NULL));
} else if (obj->excel_type == 0x11) {
sheet_widget_scrollbar_set_details (obj->gnum_obj,
} else if (obj->excel_type == 0x10 || obj->excel_type == 0x11) {
sheet_widget_adjustment_set_details (obj->gnum_obj,
ms_obj_attr_get_expr (obj, MS_OBJ_ATTR_SCROLLBAR_LINK, NULL),
0,
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_VALUE, 0),
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_MIN, 0),
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_MAX, 100),
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_MAX, 100) - 1,
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_INC, 1),
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_PAGE, 10));
} else if (obj->excel_type == 0x19 &&
......@@ -514,7 +514,8 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
break;
case 0x0C: so = g_object_new (sheet_widget_radio_button_get_type (), NULL);
break;
case 0x10: so = sheet_object_box_new (FALSE); break; /* Spinner */
case 0x10: so = g_object_new (sheet_widget_spinbutton_get_type (), NULL);
break;
case 0x11: so = g_object_new (sheet_widget_scrollbar_get_type (), NULL);
break;
case 0x12: so = g_object_new (sheet_widget_list_get_type (), NULL);
......
......@@ -3868,7 +3868,7 @@ excel_write_SST (ExcelWriteState *ewb)
ptr += 2;
if (char_len == byte_len) {
while ((ptr + 1 + char_len) >= last) {
while ((ptr + 1 + char_len) > last) {
*ptr++ = 0; /* unicode header == 0 */
strncpy (ptr, str, last - ptr);
str += (last - ptr);
......@@ -3880,11 +3880,9 @@ excel_write_SST (ExcelWriteState *ewb)
ms_biff_put_var_next (bp, BIFF_CONTINUE);
}
if (char_len > 0) {
*ptr = 0; /* unicode header == 0 */
strncpy (ptr + 1, str, char_len);
ptr += char_len + 1;
}
*ptr = 0; /* unicode header == 0 */
strncpy (ptr + 1, str, char_len);
ptr += char_len + 1;
} else {
unicode_loop :
*ptr++ = 1; /* unicode header == 1 */
......
......@@ -522,9 +522,44 @@ ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
break;
case 0xF : /* dialog frame */
break;
case 0x10 : /* spinner */
break;
case 0x11 : /* scrollbar */
case 0x10 : /* spinner & scrollbar (layout is the same) */
case 0x11 :
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_VALUE,
GSF_LE_GET_GUINT16 (q->data+48)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MIN,
GSF_LE_GET_GUINT16 (q->data+50)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MAX,
GSF_LE_GET_GUINT16 (q->data+52)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_INC,
GSF_LE_GET_GUINT16 (q->data+54)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_PAGE,
GSF_LE_GET_GUINT16 (q->data+56)));
{
GnmExpr const *ref;
guint16 len;
guint8 const *last = q->data + q->length;
guint8 const *ptr = q->data + 64;
ptr += 1 + *ptr; /* object name */
if ((ptr - q->data) & 1) ptr++; /* align on word */
if (ptr >= last) break;
ptr += 2 + GSF_LE_GET_GUINT16 (ptr); /* the macro */
if ((ptr - q->data) & 1) ptr++; /* align on word */
if (ptr >= last) break;
len = GSF_LE_GET_GUINT16 (ptr+2); /* the assigned macro */
ref = ms_container_parse_expr (container, ptr + 8, len);
if (ref != NULL)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_expr (MS_OBJ_ATTR_SCROLLBAR_LINK, ref));
}
break;
case 0x12 : /* list box */
break;
......@@ -631,7 +666,7 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
ms_obj_dump (data, len, data_len_left, "RadioButton");
break;
case GR_SCROLLBAR : {
case GR_SCROLLBAR :
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_VALUE,
GSF_LE_GET_GUINT16 (data+8)));
......@@ -649,7 +684,6 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
GSF_LE_GET_GUINT16 (data+16)));
ms_obj_dump (data, len, data_len_left, "ScrollBar");
break;
}
case GR_NOTE_STRUCTURE :
ms_obj_dump (data, len, data_len_left, "Note");
......
......@@ -966,16 +966,6 @@
_label="Button"
_tip="Create a button" verb="CreateButton"/>
-->
<toolitem name="Scrollbar"
pixtype="stock" pixname="Gnumeric_ObjectScrollbar"
_label="Scrollbar"
_tip="Create a scrollbar" verb="CreateScrollbar"/>
<toolitem name="Checkbox"
pixtype="stock" pixname="Gnumeric_ObjectCheckbox"
_label="Checkbox"
_tip="Create a checkbox" verb="CreateCheckbox"/>
<!-- think about how to handle groups
<toolitem name="RadioButton"
pixtype="stock" pixname="Gnumeric_ObjectRadioButton"
......@@ -983,6 +973,24 @@
_tip="Create a radio button" verb="CreateRadioButton"/>
-->
<toolitem name="Checkbox"
pixtype="stock" pixname="Gnumeric_ObjectCheckbox"
_label="Checkbox"
_tip="Create a checkbox" verb="CreateCheckbox"/>
<toolitem name="Scrollbar"
pixtype="stock" pixname="Gnumeric_ObjectScrollbar"
_label="Scrollbar"
_tip="Create a scrollbar" verb="CreateScrollbar"/>
<toolitem name="SpinButton"
pixtype="stock" pixname="Gnumeric_ObjectSpinButton"
_label="Spin Button"
_tip="Create a spin button" verb="CreateSpinButton"/>
<toolitem name="Slider"
pixtype="stock" pixname="Gnumeric_ObjectSlider"
_label="Slider"
_tip="Create a slider" verb="CreateSlider"/>
<toolitem name="List"
pixtype="stock" pixname="Gnumeric_ObjectList"
_label="List"
......
......@@ -638,15 +638,16 @@ gnumeric_application_setup_icons (void)
{ gnm_object_line_24, NULL, "Gnumeric_ObjectLine" },
{ gnm_object_rectangle_24, NULL, "Gnumeric_ObjectRectangle" },
{ gnm_object_button_24, NULL, "Gnumeric_ObjectButton" },
{ gnm_object_checkbox_24, NULL, "Gnumeric_ObjectCheckbox" },
{ gnm_object_combo_24, NULL, "Gnumeric_ObjectCombo" },
{ gnm_object_frame_24, NULL, "Gnumeric_ObjectFrame" },
{ gnm_object_label_24, NULL, "Gnumeric_ObjectLabel" },
{ gnm_object_list_24, NULL, "Gnumeric_ObjectList" },
{ gnm_object_button_24, NULL, "Gnumeric_ObjectButton" },
{ gnm_object_checkbox_24, NULL, "Gnumeric_ObjectCheckbox" },
{ gnm_object_radiobutton_24, NULL, "Gnumeric_ObjectRadioButton" },
{ gnm_object_scrollbar_24, NULL, "Gnumeric_ObjectScrollbar" },
{ gnm_object_spinbutton_24, NULL, "Gnumeric_ObjectSpinButton" },
{ gnm_object_slider_24, NULL, "Gnumeric_ObjectSlider" },
{ gnm_object_combo_24, NULL, "Gnumeric_ObjectCombo" },
{ gnm_object_list_24, NULL, "Gnumeric_ObjectList" },
{ gnm_pivottable_24, gnm_pivottable_16, "Gnumeric_PivotTable" },
{ gnm_protection_yes, NULL, "Gnumeric_Protection_Yes" },
......
......@@ -306,7 +306,7 @@ gog_chart_axis_set_is_valid (GogChart const *chart, GogAxisSet type)
gboolean
gog_chart_axis_set_assign (GogChart *chart, GogAxisSet axis_set)
{
GogAxis *axis[GOG_AXIS_TYPES];
gboolean has_axis[GOG_AXIS_TYPES];
GSList *ptr;
int type;
......@@ -318,6 +318,7 @@ gog_chart_axis_set_assign (GogChart *chart, GogAxisSet axis_set)
chart->axis_set = axis_set;
/* remove any existing axis that do not fit this scheme */
memset (has_axis, 0, sizeof (gboolean) * sizeof (has_axis));
for (ptr = GOG_OBJECT (chart)->children ; ptr != NULL ; ptr = ptr->next)
if (IS_GOG_AXIS (ptr->data)) {
type = -1;
......@@ -328,10 +329,15 @@ gog_chart_axis_set_assign (GogChart *chart, GogAxisSet axis_set)
}
if (0 == (axis_set & (1 << type))) {
}
} else
has_axis [type] = TRUE;
}
/* Add at least 1 instance of any required axis */
for (type = 0 ; type < (int)GOG_AXIS_TYPE ; type++)
if ((axis_set & (1 << type)) && ! has_axis [type]) {
}
return TRUE;
}
......
......@@ -57,6 +57,7 @@ IMAGES = @STRIP_BEGIN@ \
object_radiobutton_24.png \
object_scrollbar_24.png \
object_spinbutton_24.png \
object_slider_24.png \
\
bottom_border.xpm \
diag_border.xpm \
......@@ -212,15 +213,16 @@ VARIABLES = @STRIP_BEGIN@ \
gnm_object_line_24 $(srcdir)/object_line_24.png \
gnm_object_rectangle_24 $(srcdir)/object_rectangle_24.png \
\
gnm_object_button_24 $(srcdir)/object_button_24.png \
gnm_object_checkbox_24 $(srcdir)/object_checkbox_24.png \
gnm_object_combo_24 $(srcdir)/object_combo_24.png \
gnm_object_frame_24 $(srcdir)/object_frame_24.png \
gnm_object_label_24 $(srcdir)/object_label_24.png \
gnm_object_list_24 $(srcdir)/object_list_24.png \
gnm_object_button_24 $(srcdir)/object_button_24.png \
gnm_object_checkbox_24 $(srcdir)/object_checkbox_24.png \
gnm_object_radiobutton_24 $(srcdir)/object_radiobutton_24.png \
gnm_object_scrollbar_24 $(srcdir)/object_scrollbar_24.png \
gnm_object_spinbutton_24 $(srcdir)/object_spinbutton_24.png \
gnm_object_slider_24 $(srcdir)/object_slider_24.png \
gnm_object_combo_24 $(srcdir)/object_combo_24.png \
gnm_object_list_24 $(srcdir)/object_list_24.png \
\
bottom_border $(srcdir)/bottom_border.xpm \
diag_border $(srcdir)/diag_border.xpm \
......
src/pixmaps/object_spinbutton_24.png

117 Bytes | W: | H:

src/pixmaps/object_spinbutton_24.png

211 Bytes | W: | H:

src/pixmaps/object_spinbutton_24.png
src/pixmaps/object_spinbutton_24.png
src/pixmaps/object_spinbutton_24.png
src/pixmaps/object_spinbutton_24.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
......@@ -5,19 +5,24 @@
void sheet_object_widget_register (void);
GType sheet_widget_frame_get_type (void); /* convert to non-widget item */
GType sheet_widget_button_get_type (void);
GType sheet_widget_scrollbar_get_type (void);
GType sheet_widget_checkbox_get_type (void);
GType sheet_widget_radio_button_get_type(void);
GType sheet_widget_list_get_type (void);
GType sheet_widget_combo_get_type (void);
GType sheet_widget_frame_get_type (void); /* convert to non-widget item */
GType sheet_widget_button_get_type (void);
GType sheet_widget_checkbox_get_type (void);
GType sheet_widget_radio_button_get_type (void);
GType sheet_widget_list_get_type (void);
GType sheet_widget_combo_get_type (void);
void sheet_widget_scrollbar_set_details (SheetObject *so, GnmExpr const *link,
int value, int min, int max, int inc, int page);
void sheet_widget_checkbox_set_link (SheetObject *so, GnmExpr const *expr);
void sheet_widget_checkbox_set_label (SheetObject *so, char const *str);
void sheet_widget_button_set_label (SheetObject *so, char const *str);
void sheet_widget_radio_button_set_label(SheetObject *so, char const *str);
/*Descendents of the adjustment sheet widget object*/
GType sheet_widget_adjustment_get_type (void);
GType sheet_widget_scrollbar_get_type (void);
GType sheet_widget_slider_get_type (void);
GType sheet_widget_spinbutton_get_type (void);
void sheet_widget_adjustment_set_details (SheetObject *so, GnmExpr const *link,
int value, int min, int max, int inc, int page);
void sheet_widget_checkbox_set_link (SheetObject *so, GnmExpr const *expr);
void sheet_widget_checkbox_set_label (SheetObject *so, char const *str);
void sheet_widget_button_set_label (SheetObject *so, char const *str);
void sheet_widget_radio_button_set_label (SheetObject *so, char const *str);
#endif /* GNUMERIC_SHEET_OBJECT_WIDGET_H */
......@@ -79,6 +79,20 @@ cmd_create_scrollbar (GtkWidget *widget, WorkbookControlGUI *wbcg)
create_object_command (wbcg,
g_object_new (sheet_widget_scrollbar_get_type(), NULL));
}
static void
cmd_create_slider (GtkWidget *widget, WorkbookControlGUI *wbcg)
{
create_object_command (wbcg,
g_object_new (sheet_widget_slider_get_type(), NULL));
}
static void
cmd_create_spinbutton (GtkWidget *widget, WorkbookControlGUI *wbcg)
{
create_object_command (wbcg,
g_object_new (sheet_widget_spinbutton_get_type(), NULL));
}
static void
cmd_create_checkbox (GtkWidget *widget, WorkbookControlGUI *wbcg)
{
......@@ -141,9 +155,6 @@ static GnomeUIInfo workbook_object_toolbar [] = {
N_("Button"), N_("Create a button"),
&cmd_create_button, "Gnumeric_ObjectButton"),
#endif
GNOMEUIINFO_ITEM_STOCK (
N_("Scrollbar"), N_("Create a scrollbar"),
&cmd_create_scrollbar, "Gnumeric_ObjectScrollbar"),
GNOMEUIINFO_ITEM_STOCK (
N_("Checkbox"), N_("Create a checkbox"),
&cmd_create_checkbox, "Gnumeric_ObjectCheckbox"),
......@@ -172,6 +183,16 @@ static GnomeUIInfo workbook_object_toolbar [] = {
N_("Ellipse"), N_("Create an ellipse object"),
cmd_create_ellipse, "Gnumeric_ObjectEllipse"),
GNOMEUIINFO_ITEM_STOCK (
N_("Scrollbar"), N_("Create a scrollbar"),
&cmd_create_scrollbar, "Gnumeric_ObjectScrollbar"),
GNOMEUIINFO_ITEM_STOCK (
N_("SpinButton"), N_("Create a spin button"),
&cmd_create_spinbutton, "Gnumeric_ObjectSpinButton"),
GNOMEUIINFO_ITEM_STOCK (
N_("Slider"), N_("Create a slider"),
&cmd_create_slider, "Gnumeric_ObjectSlider"),
GNOMEUIINFO_END
};
......@@ -186,10 +207,14 @@ workbook_create_object_toolbar (WorkbookControlGUI *wbcg)
static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("CreateLabel", cmd_create_label),
BONOBO_UI_UNSAFE_VERB ("CreateFrame", cmd_create_frame),
/* BONOBO_UI_UNSAFE_VERB ("CreateButton", cmd_create_button), */
BONOBO_UI_UNSAFE_VERB ("CreateScrollbar", cmd_create_scrollbar),
BONOBO_UI_UNSAFE_VERB ("CreateCheckbox", cmd_create_checkbox),
/* BONOBO_UI_UNSAFE_VERB ("CreateRadioButton", cmd_create_radiobutton), */
BONOBO_UI_UNSAFE_VERB ("CreateCheckbox", cmd_create_checkbox),
BONOBO_UI_UNSAFE_VERB ("CreateScrollbar", cmd_create_scrollbar),
BONOBO_UI_UNSAFE_VERB ("CreateSlider", cmd_create_slider),
BONOBO_UI_UNSAFE_VERB ("CreateSpinButton", cmd_create_spinbutton),
BONOBO_UI_UNSAFE_VERB ("CreateList", cmd_create_list),
BONOBO_UI_UNSAFE_VERB ("CreateCombo", cmd_create_combo),
BONOBO_UI_UNSAFE_VERB ("CreateLine", cmd_create_line),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment