Commit ab0feead authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Use the right buffer

2004-05-26  Jody Goldberg <jody@gnome.org>

	* ms-excel-write.c (excel_write_AUTOFILTERINFO) : Use the right buffer

2004-05-27  Jody Goldberg <jody@gnome.org>

	* src/workbook.c (workbook_sheet_hide_controls) : split out from.
	(workbook_sheet_detach) : here.

	* src/dependent.c (dependent_queue_recalc_list) : fix dynamic depends.

	* src/workbook-control-gui.c (cb_wbcg_drag_data_received) : handle
	  dragging from nautilus -> gnumeric too.

	* src/main-application.c (main) : Use the new virtuals

	* src/io-context.c (gnm_io_context_set_num_files) : new
	(gnm_io_context_processing_file) : new.

	* src/io-context-gtk.c (icg_processing_file) : renamed from
	  icg_inc_files_done.
	(icg_set_num_files) : renamed from icg_set_files_total.
	(icg_class_init) : hook up the file handlers to the new virtual.

	* src/expr.c (gnm_expr_extract_ref) : return a RangeRef
	(gnm_expr_range_op) : new to handle intersection and union properly
	(gnm_expr_eval) : split the common code out of here.

2004-05-24  Jody Goldberg <jody@gnome.org>

	* graph/go-data-simple.c (go_data_vector_str_get_str) : enable the
	  translation mechanism
parent e768cd71
......@@ -8,12 +8,10 @@ release, and longer term bugs.
Release Critical
----------------
http://bugzilla.gnome.org/show_bug.cgi?id=136546
: about box i18n (use go_data_vector_str_translation_domain)
http://bugzilla.gnome.org/show_bug.cgi?id=140820
: undo of tab colour change
http://bugzilla.gnome.org/show_bug.cgi?id=142699
: we don't re-render on zoom changes
http://bugzilla.gnome.org/show_bug.cgi?id=127203 [x axis child pos]
: X axis label seperation
: X axis label seperation {Jody has started work on this}
: Delete grid then edit chart and see a new grid
http://bugzilla.gnome.org/show_bug.cgi?id=Bug 142700
: Zoom box shows the value of the zoom in the preceeding page
......@@ -212,12 +210,12 @@ Short Term Goals
1.3.15) position
1.3.16) image data
1.4) Decide on model vs view structure (DONE)
1.5) Graph Guru
1.5) Graph Guru (DONE)
1.5.1) update when someone else changes the model (DONE)
1.5.2) remove prop pages for deleted items (DONE)
1.5.3) Keep state::chart,plot safe for typeselector (DONE)
in case they get deleted
1.5.4) Allow going backwards if there is only chart
1.5.4) Allow going backwards if there is only chart (DONE)
1.6) data allocator in gnumeric (DONE)
1.6.1) initial interface (DONE)
1.6.2) generalize container to be a DataSet (DONE)
......@@ -226,36 +224,38 @@ Short Term Goals
1.7.1) check overlap percentage for bars (DONE)
1.7.2) Add gog_object_set_position (DONE)
1.7.3) Handle 'use_one_style' (DONE)
1.7.4) override auto series indexing for xls
1.7.5) styles (DONE)
1.7.5.1) Area (DONE)
1.7.5.2) Line (DONE)
1.7.5.3) Marker (DONE)
1.7.5.4) Grid (DONE)
1.7.5.5) Chart (DONE)
1.7.5.6) Legend (DONE)
1.7.6) Avoid leaking GODatas when faced with an unknown (DONE)
1.7.4) styles (DONE)
1.7.4.1) Area (DONE)
1.7.4.2) Line (DONE)
1.7.4.3) Marker (DONE)
1.7.4.4) Grid (DONE)
1.7.4.5) Chart (DONE)
1.7.4.6) Legend (DONE)
1.7.5) Avoid leaking GODatas when faced with an unknown (DONE)
plot type.
1.7.7) double axis import on simple_bar2
1.7.8) Titles (DONE)
1.7.9) check marker none
1.7.10) Axis
1.7.10.1) value format (DONE)
1.7.10.2) Axis bounds and ticks size (DONE)
1.7.10.3) log scale (DONE)
1.7.10.4) deleted axis should not appear
1.7.11) Gradients
1.7.11.1) Horizontal x4 (DONE)
1.7.11.2) Vertical x4 (DONE)
1.7.11.3) Diag Up x4 (DONE)
1.7.11.4) Diag Down x4 (DONE)
1.7.11.5) From center
1.7.11.6) From corner
1.7.11.7) Two colour (DONE)
1.7.11.8) Two colour alpha (is this possible)
1.7.11.9) One colour (DONE)
1.7.11.10) One colour alpha (is this possible)
1.7.11.11) presets
1.7.6) Titles (DONE)
1.7.7) check marker none
1.7.8) Axis
1.7.8.1) value format (DONE)
1.7.8.2) Axis bounds and ticks size (DONE)
1.7.8.3) log scale (DONE)
1.7.8.4) deleted axis should not appear (DONE)
1.7.8.5) double axis import on simple_bar2
1.7.8.6) high/low flag is for partner not self
1.7.9) Gradients
1.7.9.1) Horizontal x4 (DONE)
1.7.9.2) Vertical x4 (DONE)
1.7.9.3) Diag Up x4 (DONE)
1.7.9.4) Diag Down x4 (DONE)
1.7.9.5) From center
1.7.9.6) From corner
1.7.9.7) Two colour (DONE)
1.7.9.8) Two colour alpha (is this possible)
1.7.9.9) One colour (DONE)
1.7.9.10) One colour alpha (is this possible)
1.7.9.11) presets
1.7.10) override auto series indexing for xls
1.7.11) error bars
1.8) data sources (DONE)
1.8.1) vector and scalar data sources from gnumeric (DONE)
1.8.2) Add min/max elements to vector (DONE)
......@@ -283,7 +283,7 @@ Short Term Goals
1.11.3) Percentage (DONE)
1.11.4) sub type with no-marker by default (DONE)
1.11.5) center points on X index values for Line (DONE)
1.11.6) handle missing points in unstacked lines
1.11.6) handle missing points in unstacked lines (DONE)
1.12) X/Y (Scatter) Plot
1.12.1) Add simple implementation (DONE)
1.12.2) Take marker sizes into account at bounds
......@@ -335,7 +335,7 @@ Short Term Goals
1.16.9) Add anchor flags to draw_text (DONE)
1.16.10) Clip text to keep it in bounds (DONE)
1.17) SheetObject editing (DONE)
1.17.1) Connect SheetObejct::user_config handler (DONE)
1.17.1) Connect SheetObject::user_config handler (DONE)
1.17.2) Create a gog_object_dup to avoid live updating (DONE)
1.17.3) Add undo/redo of full GogGraph assignment (DONE)
1.18) Extend sheet object anchor assignment to call object (DONE)
......@@ -505,6 +505,7 @@ Short Term Goals
6.13.1) Excel95
6.13.1) Excel97
6.14) chart export
6.14.1) Initial
6.15) Store and round trip macros (functional, but could be prettier)
6.15.1) blob CompObj stream (DONE)
6.15.2) blob property streams to get the flags (DONE)
......
2004-05-27 Jody Goldberg <jody@gnome.org>
* src/workbook.c (workbook_sheet_hide_controls) : split out from.
(workbook_sheet_detach) : here.
* src/dependent.c (dependent_queue_recalc_list) : fix dynamic depends.
* src/workbook-control-gui.c (cb_wbcg_drag_data_received) : handle
dragging from nautilus -> gnumeric too.
* src/main-application.c (main) : Use the new virtuals
* src/io-context.c (gnm_io_context_set_num_files) : new
(gnm_io_context_processing_file) : new.
* src/io-context-gtk.c (icg_processing_file) : renamed from
icg_inc_files_done.
(icg_set_num_files) : renamed from icg_set_files_total.
(icg_class_init) : hook up the file handlers to the new virtual.
* src/expr.c (gnm_expr_extract_ref) : return a RangeRef
(gnm_expr_range_op) : new to handle intersection and union properly
(gnm_expr_eval) : split the common code out of here.
2004-05-26 Morten Welinder <terra@gnome.org>
* src/parser.y (yylex): Ignore spaces in lots of places, notably
......
......@@ -49,6 +49,8 @@ Jody:
* Make the unary operators XL compatible
* start work on xls export for charts
* start work on OOo export
* Skip ticks/labels for discrete axes
* Drag files from nautilus -> gnumeric
Morten:
* Fix crash related to database functions (#138600). [backported]
......
2004-05-27 Jody Goldberg <jody@gnome.org>
* src/workbook.c (workbook_sheet_hide_controls) : split out from.
(workbook_sheet_detach) : here.
* src/dependent.c (dependent_queue_recalc_list) : fix dynamic depends.
* src/workbook-control-gui.c (cb_wbcg_drag_data_received) : handle
dragging from nautilus -> gnumeric too.
* src/main-application.c (main) : Use the new virtuals
* src/io-context.c (gnm_io_context_set_num_files) : new
(gnm_io_context_processing_file) : new.
* src/io-context-gtk.c (icg_processing_file) : renamed from
icg_inc_files_done.
(icg_set_num_files) : renamed from icg_set_files_total.
(icg_class_init) : hook up the file handlers to the new virtual.
* src/expr.c (gnm_expr_extract_ref) : return a RangeRef
(gnm_expr_range_op) : new to handle intersection and union properly
(gnm_expr_eval) : split the common code out of here.
2004-05-26 Morten Welinder <terra@gnome.org>
* src/parser.y (yylex): Ignore spaces in lots of places, notably
......
2004-05-26 Jody Goldberg <jody@gnome.org>
* ms-excel-write.c (excel_write_AUTOFILTERINFO) : Use the right buffer
2004-05-24 Jody Goldberg <jody@gnome.org>
* ms-chart.c : more work towards chart export
......
......@@ -3042,7 +3042,7 @@ excel_write_AUTOFILTERINFO (BiffPut *bp, ExcelWriteSheet *esheet)
{
GnmFilterCondition const *cond;
GnmFilter const *filter;
guint8 *data, buf [24];
guint8 buf[24];
unsigned count, i;
char const *str0 = NULL, *str1 = NULL;
......@@ -3071,7 +3071,7 @@ excel_write_AUTOFILTERINFO (BiffPut *bp, ExcelWriteSheet *esheet)
switch (cond->op[0]) {
case GNM_FILTER_OP_BLANKS:
case GNM_FILTER_OP_NON_BLANKS:
data[5] = (cond->op[0] == GNM_FILTER_OP_BLANKS) ? 0xC : 0xE;
buf[5] = (cond->op[0] == GNM_FILTER_OP_BLANKS) ? 0xC : 0xE;
break;
case GNM_FILTER_OP_TOP_N:
......
2004-05-24 Jody Goldberg <jody@gnome.org>
* graph/go-data-simple.c (go_data_vector_str_get_str) : enable the
translation mechanism
2004-05-26 Jean Brefort <jean.brefort@ac-dijon.fr>
* gui-utils/Makefile.am: added go-combo-text.h
......
......@@ -431,7 +431,10 @@ static char *
go_data_vector_str_get_str (GODataVector *vec, unsigned i)
{
GODataVectorStr *strs = (GODataVectorStr *)vec;
return g_strdup (strs->str[i]);
if (strs->translate_func == NULL)
return g_strdup (strs->str[i]);
return g_strdup ((strs->translate_func) (strs->str[i],
strs->translate_data));
}
static void
......
......@@ -474,8 +474,15 @@ gog_axis_update (GogObject *obj)
mant = frexpgnum (maxima/step, &expon);
axis->auto_bound [AXIS_ELEM_MAX] = step *
ceil (ldexpgnum (mant + GNUM_EPSILON, expon));
axis->auto_bound [AXIS_ELEM_MAJOR_TICK] = step;
axis->auto_bound [AXIS_ELEM_MINOR_TICK] = step / 5.;
if (axis->is_discrete) {
/* label and tick for every category */
axis->auto_bound [AXIS_ELEM_MAJOR_TICK] = 1.;
axis->auto_bound [AXIS_ELEM_MINOR_TICK] = 1.;
axis->auto_bound [AXIS_ELEM_CROSS_POINT] = 1.;
} else {
axis->auto_bound [AXIS_ELEM_MAJOR_TICK] = step;
axis->auto_bound [AXIS_ELEM_MINOR_TICK] = step / 5.;
}
/* pull to zero if its nearby (do not pull both directions to 0) */
if (axis->auto_bound [AXIS_ELEM_MIN] > 0 &&
......@@ -563,15 +570,8 @@ cb_axis_bound_changed (GogObject *axis, gboolean resize, ElemToggleData *closure
static void
make_dim_editor (GogDataset *set, GtkTable *table, unsigned dim,
GogDataAllocator *dalloc)
GogDataAllocator *dalloc, char const * const *dim_name)
{
static char const *dim_name[] = {
N_("M_in"),
N_("M_ax"),
N_("Ma_jor Ticks"),
N_("Mi_nor Ticks"),
N_("_Cross")
};
ElemToggleData *info;
GClosure *closure;
GtkWidget *editor = gog_data_allocator_editor (dalloc, set, dim, TRUE);
......@@ -669,15 +669,36 @@ gog_axis_editor (GogObject *gobj, GogDataAllocator *dalloc, GnmCmdContext *cc)
G_CALLBACK (cb_axis_toggle_changed), axis, 0);
}
if (!axis->is_discrete) {
/* Bounds Page */
w = gtk_table_new (1, 2, FALSE);
table = GTK_TABLE (w);
w = gtk_label_new (_("Automatic"));
gtk_misc_set_alignment (GTK_MISC (w), 0., .5);
gtk_table_attach (table, w, 0, 1, 0, 1, GTK_FILL, 0, 5, 3);
/* Bounds Page */
w = gtk_table_new (1, 2, FALSE);
table = GTK_TABLE (w);
w = gtk_label_new (_("Automatic"));
gtk_misc_set_alignment (GTK_MISC (w), 0., .5);
gtk_table_attach (table, w, 0, 1, 0, 1, GTK_FILL, 0, 5, 3);
if (axis->is_discrete) {
static char const * const dim_names[] = {
NULL,
NULL,
N_("Categories between _ticks"),
N_("Categories between _labels"),
N_("_Cross at category #")
};
for (i = AXIS_ELEM_MAJOR_TICK; i < AXIS_ELEM_MAX_ENTRY ; i++)
make_dim_editor (set, table, i, dalloc, dim_names);
gtk_widget_show_all (GTK_WIDGET (table));
gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), GTK_WIDGET (table),
gtk_label_new (_("Bounds")));
} else {
static char const * const dim_names[] = {
N_("M_in"),
N_("M_ax"),
N_("Ma_jor Ticks"),
N_("Mi_nor Ticks"),
N_("_Cross")
};
for (i = AXIS_ELEM_MIN; i < AXIS_ELEM_MAX_ENTRY ; i++)
make_dim_editor (set, table, i, dalloc);
make_dim_editor (set, table, i, dalloc, dim_names);
gtk_widget_show_all (GTK_WIDGET (table));
gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), GTK_WIDGET (table),
gtk_label_new (_("Bounds")));
......@@ -701,7 +722,7 @@ gog_axis_editor (GogObject *gobj, GogDataAllocator *dalloc, GnmCmdContext *cc)
G_CALLBACK (cb_axis_fmt_assignment_toggled), notebook);
gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), w, cbox);
#else
gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), w,
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), w,
gtk_label_new (_("Format")));
#endif
......@@ -905,6 +926,8 @@ gboolean
gog_axis_get_bounds (GogAxis const *axis, double *minima, double *maxima)
{
g_return_val_if_fail (GOG_AXIS (axis) != NULL, FALSE);
g_return_val_if_fail (minima != NULL, FALSE);
g_return_val_if_fail (maxima != NULL, FALSE);
*minima = axis_get_entry (axis, AXIS_ELEM_MIN, NULL);
*maxima = axis_get_entry (axis, AXIS_ELEM_MAX, NULL);
......@@ -1118,7 +1141,7 @@ gog_axis_view_size_request (GogView *v, GogViewRequisition *req)
GogViewRequisition txt_size, available;
gboolean const is_horiz = axis->type == GOG_AXIS_X;
char *label;
int i;
int i, n, step;
double total = 0., txt_max = 0., tick_major = 0., tick_minor = 0.;
double line_width = gog_renderer_line_size (
v->renderer, axis->base.style->line.width);
......@@ -1130,7 +1153,9 @@ gog_axis_view_size_request (GogView *v, GogViewRequisition *req)
* things are too big */
if (axis->major_tick_labeled) {
gog_renderer_push_style (v->renderer, axis->base.style);
for (i = gog_axis_num_markers (axis, NULL, NULL) ; i-- > 0 ; ) {
n = gog_axis_num_markers (axis, NULL, NULL);
step = 1;
for (i = 0 ; i < n ; i += step) {
label = gog_axis_get_marker (axis, i);
gog_renderer_measure_text (v->renderer, label,
&txt_size);
......
......@@ -236,6 +236,7 @@ barcol_draw_rect (GogRenderer *rend, gboolean flip,
if (h < 1.)
h = 1.;
#warning TODO this has no business being done at this level. Move it into GogRendererPixbuf
/* tweak to make libart happier. for the common case of hairline
* libart wants to draw 1/2 a pixel above and 1/2 below producing a
* fuzzy outline when antialiased. */
......
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="GOffice_plot_barcol">
<information>
<_name>1.5d Charts</_name>
<_description>Line, Area, Bar and Column charts</_description>
<_name>Charting : Bar/Col/Line/Area</_name>
<_description>Line, Area, Bar and Column plots</_description>
</information>
<loader type="Gnumeric_Builtin:module">
<attribute name="module_file" value="barcol.la"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="GOffice_plot_pie">
<information>
<_name>Pie Charts</_name>
<_description>Pie charts</_description>
<_name>Charting : Pie/Ring</_name>
<_description>Pie and Ring plots</_description>
</information>
<loader type="Gnumeric_Builtin:module">
<attribute name="module_file" value="pie.la"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="GOffice_plot_radar">
<information>
<_name>Radar Charts</_name>
<_description>Radar charts</_description>
<_name>Charting : Radial plots</_name>
<_description>Radial/Radar plots</_description>
</information>
<loader type="Gnumeric_Builtin:module">
<attribute name="module_file" value="radar.la"/>
......
<plugin id="GOffice_plot_xy">
<information>
<_name>XY Charts</_name>
<_description>2D Scatter charts</_description>
<_name>Charting : XY/Scatter/Bubble</_name>
<_description>2D plots</_description>
</information>
<loader type="Gnumeric_Builtin:module">
<attribute name="module_file" value="xy.la"/>
......
......@@ -282,7 +282,7 @@ dependent_queue_recalc_list (GSList *list)
g_slist_free (waste);
} else if (t == DEPENDENT_DYNAMIC_DEP) {
DynamicDep const *dyn = (DynamicDep *)dep;
if (dependent_needs_recalc (dyn->container)) {
if (!dependent_needs_recalc (dyn->container)) {
dependent_flag_recalc (dyn->container);
work = g_slist_prepend (work, dyn->container);
}
......
2004-05-24 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=136546
* dialog-about.c : Use the translation mechanism
2004-05-26 Jean Brefort <jean.brefort@ac-dijon.fr>
* cell-format.glade: changed gnm_combo_text_glade_new to
......
......@@ -273,6 +273,7 @@ dialog_about (WorkbookControlGUI *wbcg)
gog_object_add_by_name (chart, "Plot", GOG_OBJECT (plot));
series = gog_plot_new_series (plot);
labels = go_data_vector_str_new ( about_types, G_N_ELEMENTS (about_types));
go_data_vector_str_set_translation_domain (GO_DATA_VECTOR_STR (labels), NULL);
g_object_ref (labels); /* set_dim absorbs the ref, add an extra for next plot */
gog_series_set_dim (series, 0, labels, NULL);
state->individual_data = go_data_vector_val_new (
......
......@@ -502,7 +502,7 @@ expr_array_corner (GnmExpr const *expr,
}
static gboolean
gnm_expr_extract_ref (GnmCellRef *res, GnmExpr const *expr,
gnm_expr_extract_ref (GnmRangeRef *res, GnmExpr const *expr,
GnmEvalPos const *pos, GnmExprEvalFlags flags)
{
switch (expr->any.oper) {
......@@ -515,9 +515,8 @@ gnm_expr_extract_ref (GnmCellRef *res, GnmExpr const *expr,
v = function_call_with_list (&ei, expr->func.arg_list, flags);
if (v != NULL) {
if (v->type == VALUE_CELLRANGE &&
cellref_equal (&v->v_range.cell.a, &v->v_range.cell.b)) {
*res = v->v_range.cell.a;
if (v->type == VALUE_CELLRANGE) {
*res = v->v_range.cell;
failed = FALSE;
}
value_release (v);
......@@ -526,14 +525,14 @@ gnm_expr_extract_ref (GnmCellRef *res, GnmExpr const *expr,
}
case GNM_EXPR_OP_CELLREF :
*res = expr->cellref.ref;
res->a = expr->cellref.ref;
res->b = expr->cellref.ref;
return FALSE;
case GNM_EXPR_OP_CONSTANT: {
GnmValue const *v = expr->constant.value;
if (v->type == VALUE_CELLRANGE &&
cellref_equal (&v->v_range.cell.a, &v->v_range.cell.b)) {
*res = v->v_range.cell.a;
if (v->type == VALUE_CELLRANGE) {
*res = v->v_range.cell;
return FALSE;
}
return TRUE;
......@@ -994,6 +993,38 @@ cb_iter_percentage (GnmValue const *v, GnmEvalPos const *ep,
return NULL;
}
static GnmValue *
gnm_expr_range_op (GnmExpr const *expr, GnmEvalPos const *ep,
GnmExprEvalFlags flags)
{
GnmRangeRef a_ref, b_ref;
GnmRange a_range, b_range, res_range;
Sheet *a_start, *a_end, *b_start, *b_end;
GnmValue *res = NULL;
if (gnm_expr_extract_ref (&a_ref, expr->binary.value_a, ep, flags) ||
gnm_expr_extract_ref (&b_ref, expr->binary.value_b, ep, flags))
return value_new_error_REF (ep);
rangeref_normalize (&a_ref, ep, &a_start, &a_end, &a_range);
rangeref_normalize (&b_ref, ep, &b_start, &b_end, &b_range);
if (expr->any.oper != GNM_EXPR_OP_INTERSECT)
res_range = range_union (&a_range, &b_range);
else if (!range_intersection (&res_range, &a_range, &b_range))
return value_new_error_NULL (ep);
res = value_new_cellrange_r (a_start, &res_range);
dependent_add_dynamic_dep (ep->dep, &res->v_range);
if (!(flags & GNM_EXPR_EVAL_PERMIT_NON_SCALAR)) {
res = value_intersection (res, ep);
return (res != NULL)
? handle_empty (res, flags)
: value_new_error_VALUE (ep);
}
return res;
}
/**
* gnm_expr_eval :
* @expr :
......@@ -1019,7 +1050,7 @@ gnm_expr_eval (GnmExpr const *expr, GnmEvalPos const *pos,
case GNM_EXPR_OP_GTE:
case GNM_EXPR_OP_LT:
case GNM_EXPR_OP_LTE:
flags = (flags | GNM_EXPR_EVAL_PERMIT_EMPTY);
flags |= GNM_EXPR_EVAL_PERMIT_EMPTY;
a = gnm_expr_eval (expr->binary.value_a, pos, flags);
if (a != NULL) {
......@@ -1121,10 +1152,13 @@ gnm_expr_eval (GnmExpr const *expr, GnmEvalPos const *pos,
return bin_array_op (pos, b, a, b,
(BinOpImplicitIteratorFunc) cb_bin_arith,
(gpointer) expr);
else if (!VALUE_IS_NUMBER (b))
res = value_new_error_VALUE (pos);
else
res = bin_arith (expr, pos, a, b);
else if (!VALUE_IS_NUMBER (b)) {
value_release (a);
value_release (b);
return value_new_error_VALUE (pos);
}
res = bin_arith (expr, pos, a, b);
value_release (a);
value_release (b);
return res;
......@@ -1133,7 +1167,7 @@ gnm_expr_eval (GnmExpr const *expr, GnmEvalPos const *pos,
case GNM_EXPR_OP_UNARY_NEG:
case GNM_EXPR_OP_UNARY_PLUS:
/* Guarantees value != NULL */
flags &= ~(GNM_EXPR_EVAL_PERMIT_EMPTY);
flags &= ~GNM_EXPR_EVAL_PERMIT_EMPTY;
a = gnm_expr_eval (expr->unary.value, pos, flags);
if (a->type == VALUE_ERROR)
......@@ -1328,33 +1362,10 @@ gnm_expr_eval (GnmExpr const *expr, GnmEvalPos const *pos,
case GNM_EXPR_OP_SET:
return value_new_error_VALUE (pos);
case GNM_EXPR_OP_RANGE_CTOR: {
GnmCellRef a, b;
if (gnm_expr_extract_ref (&a, expr->binary.value_a, pos, flags) ||
gnm_expr_extract_ref (&b, expr->binary.value_b, pos, flags))
return value_new_error_REF (pos);
res = value_new_cellrange (&a, &b, pos->eval.col, pos->eval.row);
dependent_add_dynamic_dep (pos->dep, &res->v_range);
if (!(flags & GNM_EXPR_EVAL_PERMIT_NON_SCALAR)) {
res = value_intersection (res, pos);
return (res != NULL)
? handle_empty (res, flags)
: value_new_error_VALUE (pos);
}
return res;
}
case GNM_EXPR_OP_INTERSECT: {
GnmCellRef a, b;
if (gnm_expr_extract_ref (&a, expr->binary.value_a, pos, flags) ||
gnm_expr_extract_ref (&b, expr->binary.value_b, pos, flags))
return value_new_error_REF (pos);
if (eval_sheet (a.sheet, pos->sheet) == eval_sheet (b.sheet, pos->sheet))
return value_new_cellrange (&a, &b, pos->eval.col, pos->eval.row);
case GNM_EXPR_OP_RANGE_CTOR:
case GNM_EXPR_OP_INTERSECT:
return gnm_expr_range_op (expr, pos, flags);
}
};
return value_new_error (pos, _("Unknown evaluation error"));
}
......
......@@ -250,6 +250,33 @@ icg_error_error_info (G_GNUC_UNUSED GnmCmdContext *cc,
gtk_widget_destroy (dialog);
}
static void
icg_set_num_files (IOContext *icg, guint files_total)
{
IO_CONTEXT_GTK (icg)->files_total = files_total;
}
static void
icg_processing_file (IOContext *ioc, char const *file)
{
IOContextGtk *icg = IO_CONTEXT_GTK (ioc);
g_return_if_fail (icg->files_done < icg->files_total);
icg->files_done++;
if (icg->window != NULL && icg->file_bar != NULL) {
/* If not iconified raise to the top */
if (GTK_WIDGET_VISIBLE (icg->window))
gtk_window_present (icg->window);
if (icg->files_total > 0)
gtk_progress_bar_set_fraction (icg->file_bar,
(float) icg->files_done / (float) icg->files_total);
gtk_progress_bar_set_text (icg->file_bar, file);
gtk_progress_bar_set_fraction (icg->work_bar, 0.0);
}
}
static void
icg_finalize (GObject *obj)
{
......@@ -288,9 +315,12 @@ icg_gnm_cmd_context_init (GnmCmdContextClass *cc_class)
}
static void
icg_class_init (GObjectClass *klass)
icg_class_init (GObjectClass *gobj_klass)
{
klass->finalize = icg_finalize;
IOContextClass *ioc_klass = (IOContextClass *)gobj_klass;
gobj_klass->finalize = icg_finalize;
ioc_klass->set_num_files = icg_set_num_files;
ioc_klass->processing_file = icg_processing_file;
}
static void
......@@ -314,32 +344,6 @@ GSF_CLASS_FULL (IOContextGtk, io_context_gtk,
TYPE_IO_CONTEXT, 0,
GSF_INTERFACE (icg_gnm_cmd_context_init, GNM_CMD_CONTEXT_TYPE))
/* Show the additional "files" progress bar if needed */
void
icg_set_files_total (IOContextGtk *icg, guint files_total)
{
g_return_if_fail (IS_IO_CONTEXT_GTK (icg));
icg->files_total = files_total;
}
void
icg_inc_files_done (IOContextGtk *icg)
{
g_return_if_fail (IS_IO_CONTEXT_GTK (icg));
g_return_if_fail (icg->files_done < icg->files_total);
icg->files_done++;
if (icg->window != NULL && icg->file_bar != NULL) {
/* If not iconified raise to the top */
if (GTK_WIDGET_VISIBLE (icg->window))
gtk_window_present (icg->window);
gtk_progress_bar_set_fraction (icg->file_bar,
(float) icg->files_done / (float) icg->files_total);
gtk_progress_bar_set_fraction (icg->work_bar, 0.0);
}
}
void
icg_set_transient_for (IOContextGtk *icg, GtkWindow *parent_window)
{
......
......@@ -16,8 +16,6 @@ typedef struct _IOContextGtkClass IOContextGtkClass;
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IO_CONTEXT_GTK))
GType io_context_gtk_get_type (void);
void icg_set_files_total (IOContextGtk *icg, guint files_total);
void icg_inc_files_done (IOContextGtk *icg);
void icg_set_transient_for (IOContextGtk *icg, GtkWindow *parent_window);
gboolean icg_get_interrupted (IOContextGtk *icg);
......
......@@ -7,7 +7,7 @@
#include "command-context-priv.h"
#include <stdio.h>
#define IO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IO_CONTEXT, IOContext))
#define IO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IO_CONTEXT, IOContextClass))
#define IS_IO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IO_CONTEXT))
typedef enum {
......@@ -63,6 +63,8 @@ struct _IOContext {
struct _IOContextClass {
GObjectClass base;
void (*set_num_files) (IOContext *ioc, guint count);
void (*processing_file) (IOContext *ioc, char const *name);
};
#endif /* GNUMERIC_IO_CONTEXT_PRIV_H */
......@@ -31,35 +31,37 @@
#define PROGRESS_UPDATE_STEP_END (1.0 / 400)
#define PROGRESS_UPDATE_PERIOD_SEC 0.20
#define IOC_CLASS(ioc) IO_CONTEXT_CLASS(G_OBJECT_GET_CLASS(ioc))
static void
io_context_init (IOContext *io_context)
io_context_init (IOContext *ioc)
{
io_context->impl = NULL;
io_context->info = NULL;
io_context->error_occurred = FALSE;
io_context->warning_occurred = FALSE;
ioc->impl = NULL;
ioc->info = NULL;
ioc->error_occurred = FALSE;
ioc->warning_occurred = FALSE;
io_context->progress_ranges = NULL;
io_context->progress_min = 0.0;
io_context->progress_max = 1.0;
io_context->last_progress = -1.0;
io_context->last_time = 0.0;
io_context->helper.helper_type = GNM_PROGRESS_HELPER_NONE;
ioc->progress_ranges = NULL;
ioc->progress_min = 0.0;
ioc->progress_max = 1.0;
ioc->last_progress = -1.0;
ioc->last_time = 0.0;
ioc->helper.helper_type = GNM_PROGRESS_HELPER_NONE;
}
static void
ioc_finalize (GObject *obj)