Commit 4e60546c authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

take some eval flags to see if we can support implicit iteration. ditto.


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

	* src/expr.c (gnm_expr_extract_ref) : take some eval flags to see if
	  we can support implicit iteration.
	* src/func.c (function_call_with_list) : ditto.

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

	* src/hlink.c : write url and internal link support.

2002-07-16  Jody Goldberg <jody@gnome.org>

	* src/cellspan.c (cell_calc_span) : center across selection can force
	  a span for something that would wrap.

	* src/workbook-control-gui.c (wbcg_error_error_info) : add 150% as a
	  std zoom level.

2002-07-15  Jody Goldberg <jody@gnome.org>

	* src/func.h : add status info to the func def for easy update
parent c52d4bf8
2002-07-18 Jody Goldberg <jody@gnome.org>
* src/expr.c (gnm_expr_extract_ref) : take some eval flags to see if
we can support implicit iteration.
* src/func.c (function_call_with_list) : ditto.
2002-07-18 Jody Goldberg <jody@gnome.org>
* src/hlink.c : write url and internal link support.
2002-07-16 Jody Goldberg <jody@gnome.org>
* src/cellspan.c (cell_calc_span) : center across selection can force
a span for something that would wrap.
* src/workbook-control-gui.c (wbcg_error_error_info) : add 150% as a
std zoom level.
2002-07-15 Jody Goldberg <jody@gnome.org>
* src/func.h : add status info to the func def for easy update
2002-07-18 Morten Welinder <terra@diku.dk>
* src/search.c (calculate_replacement): Make utf-8 safe at last.
......
......@@ -28,6 +28,10 @@ Jody:
* Move libgsf for XL export
* Remove dependence on libole2 !
* Add a Quattro Pro importer
* Fix Lotus import of relative references, and formulas with strings
* Support url, and in workbook hyper-links, no UI or persistence yet.
* Import url, and in workbook hyper-links from xls
* Take steps towards support implicit iteration for function args.
Jukka:
* More solver enhancements:
......
2002-07-18 Jody Goldberg <jody@gnome.org>
* src/expr.c (gnm_expr_extract_ref) : take some eval flags to see if
we can support implicit iteration.
* src/func.c (function_call_with_list) : ditto.
2002-07-18 Jody Goldberg <jody@gnome.org>
* src/hlink.c : write url and internal link support.
2002-07-16 Jody Goldberg <jody@gnome.org>
* src/cellspan.c (cell_calc_span) : center across selection can force
a span for something that would wrap.
* src/workbook-control-gui.c (wbcg_error_error_info) : add 150% as a
std zoom level.
2002-07-15 Jody Goldberg <jody@gnome.org>
* src/func.h : add status info to the func def for easy update
2002-07-18 Morten Welinder <terra@diku.dk>
* src/search.c (calculate_replacement): Make utf-8 safe at last.
......
2002-07-18 Jody Goldberg <jody@gnome.org>
* src/expr.c (gnm_expr_extract_ref) : take some eval flags to see if
we can support implicit iteration.
* src/func.c (function_call_with_list) : ditto.
2002-07-18 Jody Goldberg <jody@gnome.org>
* src/hlink.c : write url and internal link support.
2002-07-16 Jody Goldberg <jody@gnome.org>
* src/cellspan.c (cell_calc_span) : center across selection can force
a span for something that would wrap.
* src/workbook-control-gui.c (wbcg_error_error_info) : add 150% as a
std zoom level.
2002-07-15 Jody Goldberg <jody@gnome.org>
* src/func.h : add status info to the func def for easy update
2002-07-18 Morten Welinder <terra@diku.dk>
* src/search.c (calculate_replacement): Make utf-8 safe at last.
......
......@@ -59,7 +59,7 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource)
## this should come after `AC_PROG_CC'
GNOME_COMPILE_WARNINGS
ifdef([GNOME_COMPILE_WARNINGS],[GNOME_COMPILE_WARNINGS],)
set_more_warnings=yes
if test "$GCC" = "yes" -a "x$set_more_warnings" != "xno"; then
for option in -Wsign-promo -Wsign-compare -Wpointer-arith -Wnested-externs -Wchar-subscripts -Wwrite-strings; do
......
......@@ -231,6 +231,7 @@
#define BIFF_DV 0x1be /* ONLY 1 */
#define BIFF_XL9FILE 0x1c0 /* ONLY 1 */
#define BIFF_RECALCID 0x1c1 /* ONLY 1 */
#define BIFF_LINK_TIP 0x800 /* ONLY 1, follows an hlink */
#define BIFF_UNKNOWN_1 0x810 /* what this is */
/* Chart Specific */
......
......@@ -38,6 +38,7 @@
#include <expr.h>
#include <expr-name.h>
#include <value.h>
#include <hlink.h>
#include <gutils.h>
#include <application.h>
#include <io-context.h>
......@@ -3783,8 +3784,12 @@ ms_excel_read_hlink (BiffQuery *q, ExcelSheet *esheet)
};
Range r;
guint32 options, len, i;
guint16 next_opcode;
guint8 const *data = q->data;
guint8 *txt;
guchar *description = NULL;
guchar *target = NULL;
guchar *tip = NULL;
GnmHLink *link = NULL;
g_return_if_fail (q->length > 32);
......@@ -3810,8 +3815,7 @@ ms_excel_read_hlink (BiffQuery *q, ExcelSheet *esheet)
for (i = 0 ; i < len ; i++)
uni_text [i] = GSF_LE_GET_GUINT16 (data + i*2);
txt = g_utf16_to_utf8 (uni_text, len, NULL, NULL, NULL);
printf ("desc %d = '%s'\n", len, txt);
description = g_utf16_to_utf8 (uni_text, len, NULL, NULL, NULL);
g_free (uni_text);
data += len*2;
}
......@@ -3829,24 +3833,55 @@ ms_excel_read_hlink (BiffQuery *q, ExcelSheet *esheet)
for (i = 0 ; i < len ; i++)
uni_text [i] = GSF_LE_GET_GUINT16 (data + i*2);
txt = g_utf16_to_utf8 (uni_text, -1, NULL, NULL, NULL);
printf ("frame %d = '%s'\n", len, txt);
target = g_utf16_to_utf8 (uni_text, -1, NULL, NULL, NULL);
g_free (uni_text);
data += len*2;
}
/* file with UNC */
if ((options & 0x1e3) == 0x003 && !memcmp (data, url_guid, sizeof (url_guid))) {
range_dump (&r, " <-- url\n");
gunichar2 *uni_text;
guchar *url;
len = GSF_LE_GET_GUINT32 (data + sizeof (url_guid));
data += 4 + sizeof (url_guid);
g_return_if_fail (data+len-q->data <= (int)q->length);
/* be wary about endianness */
uni_text = g_new (gunichar2, len);
for (i = 0 ; i < len ; i++)
uni_text [i] = GSF_LE_GET_GUINT16 (data + i*2);
url = g_utf16_to_utf8 (uni_text, -1, NULL, NULL, NULL);
link = g_object_new (gnm_hlink_url_get_type (), NULL);
gnm_hlink_url_set_target (link, url);
g_free (uni_text);
g_free (url);
} else if ((options & 0x1e1) == 0x001 && !memcmp (data, file_guid, sizeof (file_guid))) {
range_dump (&r, " <-- local file\n");
} else if ((options & 0x1e3) == 0x103) {
range_dump (&r, " <-- unc file\n");
} else if ((options & 0x1eb) == 0x008) {
range_dump (&r, " <-- current workbook\n");
link = g_object_new (gnm_hlink_cur_wb_get_type (), NULL);
gnm_hlink_cur_wb_set_target (link, target);
} else {
g_warning ("Unknown hlink type");
}
if (ms_biff_query_peek_next (q, &next_opcode) &&
next_opcode == BIFF_LINK_TIP) {
ms_biff_query_next (q);
/* TODO */
}
if (link != NULL) {
MStyle *style = mstyle_new ();
mstyle_set_hlink (style, link);
sheet_style_apply_range (esheet->gnum_sheet, &r, style);
}
g_free (description);
g_free (target);
g_free (tip);
}
static void
......
......@@ -234,11 +234,11 @@ cell_calc_span (Cell const * const cell, int * const col1, int * const col2)
if (cell_has_expr (cell) ||
cell_is_blank (cell) ||
!cell->col_info->visible ||
((indented_w <= COL_INTERNAL_WIDTH (cell->col_info)) &&
align != HALIGN_CENTER_ACROSS_SELECTION) ||
(align != HALIGN_CENTER_ACROSS_SELECTION &&
(mstyle_get_wrap_text (mstyle) ||
indented_w <= COL_INTERNAL_WIDTH (cell->col_info))) ||
align == HALIGN_JUSTIFY ||
align == HALIGN_FILL ||
mstyle_get_wrap_text (mstyle) ||
mstyle_get_align_v (mstyle) == VALIGN_JUSTIFY) {
*col1 = *col2 = cell->pos.col;
return;
......
......@@ -49,8 +49,8 @@ colrow_compute_pts_from_pixels (ColRowInfo *cri,
Sheet const *sheet, gboolean horizontal)
{
double const scale =
sheet->last_zoom_factor_used *
application_display_dpi_get (horizontal) / 72.;
sheet->last_zoom_factor_used *
application_display_dpi_get (horizontal) / 72.;
cri->size_pts = cri->size_pixels / scale;
#if 0
......
......@@ -531,7 +531,8 @@ expr_array_corner (GnmExpr const *expr,
}
static gboolean
gnm_expr_extract_ref (CellRef *res, GnmExpr const *expr, EvalPos const *pos)
gnm_expr_extract_ref (CellRef *res, GnmExpr const *expr,
EvalPos const *pos, GnmExprEvalFlags flags)
{
switch (expr->any.oper) {
case GNM_EXPR_OP_FUNCALL : {
......@@ -541,7 +542,7 @@ gnm_expr_extract_ref (CellRef *res, GnmExpr const *expr, EvalPos const *pos)
ei.pos = pos;
ei.func_call = (GnmExprFunction const *)expr;
v = function_call_with_list (&ei, expr->func.arg_list);
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)) {
......@@ -570,7 +571,7 @@ gnm_expr_extract_ref (CellRef *res, GnmExpr const *expr, EvalPos const *pos)
case GNM_EXPR_OP_NAME:
if (!expr->name.name->active || expr->name.name->builtin)
return TRUE;
return gnm_expr_extract_ref (res, expr->name.name->t.expr_tree, pos);
return gnm_expr_extract_ref (res, expr->name.name->t.expr_tree, pos, flags);
default :
break;
}
......@@ -935,9 +936,7 @@ expr_eval_real (GnmExpr const *expr, EvalPos const *pos,
FunctionEvalInfo ei;
ei.pos = pos;
ei.func_call = (GnmExprFunction const *)expr;
/*if (flags & GNM_EXPR_EVAL_PERMIT_NON_SCALAR)*/
return function_call_with_list (&ei, expr->func.arg_list);
return function_call_with_list (&ei, expr->func.arg_list, flags);
}
case GNM_EXPR_OP_NAME:
......@@ -1090,8 +1089,8 @@ expr_eval_real (GnmExpr const *expr, EvalPos const *pos,
case GNM_EXPR_OP_RANGE_CTOR: {
CellRef a, b;
if (gnm_expr_extract_ref (&a, expr->binary.value_a, pos) ||
gnm_expr_extract_ref (&b, expr->binary.value_b, pos))
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 (pos, gnumeric_err_REF);
return value_new_cellrange (&a, &b, pos->eval.col, pos->eval.row);
}
......
......@@ -92,13 +92,6 @@ struct _GnmExprRewriteInfo {
GnmExpr const *gnm_expr_rewrite (GnmExpr const *expr,
GnmExprRewriteInfo const *rwinfo);
typedef enum
{
GNM_EXPR_EVAL_STRICT = 0x0,
GNM_EXPR_EVAL_PERMIT_NON_SCALAR = 0x1,
GNM_EXPR_EVAL_PERMIT_EMPTY = 0x2
} GnmExprEvalFlags;
Value *gnm_expr_eval (GnmExpr const *expr, EvalPos const *pos,
GnmExprEvalFlags flags);
......
......@@ -857,13 +857,15 @@ free_values (Value **values, int top)
* function_call_with_list:
* @ei: EvalInfo containing valid fn_def!
* @args: GnmExprList of GnmExpr args.
* @flags :
*
* Do the guts of calling a function.
*
* Return value:
* Returns the result.
**/
Value *
function_call_with_list (FunctionEvalInfo *ei, GnmExprList *l)
function_call_with_list (FunctionEvalInfo *ei, GnmExprList *l,
GnmExprEvalFlags flags)
{
FunctionDefinition const *fn_def;
int argc, arg;
......
......@@ -97,6 +97,21 @@ typedef gboolean (*FunctionGetFullInfoCallback) (FunctionDefinition *fn_def,
FuncLinkHandle *link,
FuncUnlinkHandle *unlink);
typedef enum {
FUNC_IMPL_STATUS_UNIMPLEMENTED,
FUNC_IMPL_STATUS_SUBSET,
FUNC_IMPL_STATUS_COMPLETE,
FUNC_IMPL_STATUS_SUPERSET,
FUNC_IMPL_STATUS_SUBSET_WITH_EXTENSIONS,
FUNC_IMPL_STATUS_CLAIMED
} FunctionImplStatus;
typedef enum {
FUNC_TEST_STATUS_UNTESTED,
FUNC_TEST_STATUS_BASIC,
FUNC_TEST_STATUS_EXHAUSTIVE,
FUNC_TEST_STATUS_CLAIMED
} FunctionTestStatus;
struct _FunctionDefinition {
FunctionGetFullInfoCallback get_full_info_callback;
FunctionFlags flags;
......@@ -117,6 +132,8 @@ struct _FunctionDefinition {
FuncUnlinkHandle unlink;
gpointer user_data;
gint ref_count;
FunctionImplStatus impl_status;
FunctionTestStatus test_status;
};
void func_ref (FunctionDefinition *fn_def);
void func_unref (FunctionDefinition *fn_def);
......@@ -164,7 +181,8 @@ void function_set_link_handlers (FunctionDefinition *fn_def,
FuncLinkHandle link,
FuncUnlinkHandle unlink);
Value *function_call_with_list (FunctionEvalInfo *ei, GnmExprList *args);
Value *function_call_with_list (FunctionEvalInfo *ei, GnmExprList *args,
GnmExprEvalFlags flags);
Value *function_call_with_values (EvalPos const *ep, gchar const *name,
gint argc, Value *values []);
Value *function_def_call_with_values (EvalPos const *ep, FunctionDefinition const *fn,
......
......@@ -135,6 +135,13 @@ typedef enum _SpanCalcFlags {
SPANCALC_NO_DRAW = 0x8 /* Do not queue a redraw */
} SpanCalcFlags;
typedef enum
{
GNM_EXPR_EVAL_STRICT = 0x0,
GNM_EXPR_EVAL_PERMIT_NON_SCALAR = 0x1,
GNM_EXPR_EVAL_PERMIT_EMPTY = 0x2
} GnmExprEvalFlags;
typedef struct _SearchReplace SearchReplace;
typedef struct _gnm_mem_chunk gnm_mem_chunk;
......
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef GNUMERIC_HLINK_IMPL_H
#define GNUMERIC_HLINK_IMPL_H
#include "hlink.h"
#define GNM_HLINK_TYPE (command_context_get_type ())
#define GNM_HLINK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_HLINK_TYPE, GnmHLink))
#define GNM_IS_HLINK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_HLINK_TYPE))
struct _GnmHLink {
GObject obj;
guchar *tip;
};
GType command_context_get_type (void);
typedef struct {
GObjectClass obj;
/*
* These are the exceptions that can arise.
* NOTE : The selection is quite limited by IDL's intentional non-support for
* inheritance (single or multiple).
*/
void gnumeric_error_system (CommandContext *cc, char const *msg);
void gnumeric_error_read (CommandContext *cc, char const *msg);
void gnumeric_error_save (CommandContext *cc, char const *msg);
void gnumeric_error_plugin (CommandContext *cc, char const *msg);
void gnumeric_error_invalid (CommandContext *cc, char const *msg,
char const *val);
void gnumeric_error_splits_array (CommandContext *cc, char const *cmd,
Range const *array);
void gnumeric_error_error_info (CommandContext *cc, ErrorInfo *error);
void gnumeric_progress_set (CommandContext *cc, gfloat f);
void gnumeric_progress_message_set (CommandContext *cc, char const *msg);
char *cmd_context_get_password (CommandContext *cc, char const *msg);
gboolean (*Activate) (GnmHLink *link, WorkbookControl *wbc);
} GnmHLinkClass;
/* Push a printf template to the list. The template is used to provide
* context for error messages. E.g.: "Could not read file: %s". */
void command_context_pop_err_template (CommandContext *context);
void command_context_push_err_template (CommandContext *context,
char const *template_str);
#endif /* GNUMERIC_COMMAND_CONTEXT_H */
#endif /* GNUMERIC_HLINK_IMPL_H */
/* vim: set sw=8: */
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* hlink.c: hyperlink support
......@@ -23,33 +23,260 @@
#include "gnumeric.h"
#include "hlink.h"
#include "hlink-impl.h"
#include "command-context.h"
#include "workbook-control.h"
#include "workbook-view.h"
#include "selection.h"
#include "sheet.h"
#include "sheet-style.h"
#include "ranges.h"
#include "position.h"
#include "expr-name.h"
#include "value.h"
#include "mstyle.h"
#include <gsf/gsf-impl-utils.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-url.h>
#define GET_CLASS(instance) G_TYPE_INSTANCE_GET_CLASS (instance, GNM_HLINK_TYPE, GnmHLinkClass)
/**
* gnm_hlink_activate :
* @link :
* @wbv : the view that activated the link
*
* Return TRUE if the link successfully activated.
**/
gboolean
gnm_hlink_activate (GnmHLink *link)
gnm_hlink_activate (GnmHLink *link, WorkbookControl *wbv)
{
g_return_val_if_fail (GNM_IS_HLINK (link), FALSE);
return FALSE;
return GET_CLASS (link)->Activate (link, wbv);
}
GnmHLink *
sheet_hlink_find (Sheet const *sheet, CellPos const *pos)
{
return NULL;
MStyle const *style = sheet_style_get (sheet, pos->col, pos->row);
return mstyle_is_element_set (style, MSTYLE_HLINK)
? mstyle_get_hlink (style) : NULL;
}
/*
GType gnm_hlink_url_type ();
GType gnm_hlink_gnumeric_type ();
GType gnm_hlink_newbook_type ();
GType gnm_hlink_email_type ();
static void
gnm_hlink_finalize (GObject *obj)
{
GObjectClass *parent_class;
GnmHLink *link = (GnmHLink *)obj;
g_free (link->tip);
link->tip = NULL;
parent_class = g_type_class_peek (G_TYPE_OBJECT);
if (parent_class && parent_class->finalize)
parent_class->finalize (obj);
}
static void
gnm_hlink_class_init (GObjectClass *object_class)
{
object_class->finalize = gnm_hlink_finalize;
}
static void
gnm_hlink_init (GObject *obj)
{
GnmHLink *link = (GnmHLink * )obj;
link->tip = NULL;
}
GSF_CLASS_ABSTRACT (GnmHLink, gnm_hlink,
gnm_hlink_class_init, gnm_hlink_init, G_TYPE_OBJECT)
/***************************************************************************/
/* Link to named regions within the current workbook */
typedef struct { GnmHLinkClass hlink; } GnmHLinkCurWBClass;
typedef struct {
GnmHLink hlink;
/* just parse it as necessary, no worries about maintaining link */
char *target;
} GnmHLinkCurWB;
#define GNM_HLINK_CUR_WB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), gnm_hlink_cur_wb_get_type (), GnmHLinkCurWB))
static gboolean
gnm_hlink_cur_wb_activate (GnmHLink *link, WorkbookControl *wbc)
{
GnmHLinkCurWB *cur_wb = (GnmHLinkCurWB *)link;
RangeRef const *r;
CellPos tmp;
Sheet *sheet = wb_control_cur_sheet (wbc);
SheetView *sv = wb_control_cur_sheet_view (wbc);
Value *target = global_range_parse (sheet, cur_wb->target);
/* not an address, is it a name ? */
if (target == NULL) {
ParsePos pp;
GnmNamedExpr *nexpr = expr_name_lookup (
parse_pos_init (&pp, NULL, sheet, 0, 0), cur_wb->target);
if (nexpr != NULL) {
if (!nexpr->builtin)
target = gnm_expr_get_range (nexpr->t.expr_tree);
if (target == NULL) {
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), _("Link target"),
cur_wb->target);
return FALSE;
}
}
}
r = &target->v_range.cell;
tmp.col = r->a.col;
tmp.row = r->a.row;
sv = sheet_get_view (r->a.sheet, wb_control_view (wbc));
sv_selection_set (sv, &tmp, r->a.col, r->a.row, r->b.col, r->b.row);
sv_make_cell_visible (sv, r->a.col, r->a.row, FALSE);
if (sheet != r->a.sheet)
wb_view_sheet_focus (wb_control_view (wbc), sheet);
value_release (target);
return TRUE;
}
static void
gnm_hlink_cur_wb_finalize (GObject *obj)
{
GObjectClass *parent_class;
GnmHLinkCurWB *link = (GnmHLinkCurWB *)obj;
g_free (link->target);
link->target = NULL;
parent_class = g_type_class_peek (GNM_HLINK_TYPE);
if (parent_class && parent_class->finalize)
parent_class->finalize (obj);
}
static void
gnm_hlink_cur_wb_class_init (GObjectClass *object_class)
{
GnmHLinkClass *hlink_class = (GnmHLinkClass *) object_class;
hlink_class->Activate = gnm_hlink_cur_wb_activate;
object_class->finalize = gnm_hlink_cur_wb_finalize;
}
static void
gnm_hlink_cur_wb_init (GObject *obj)
{
GnmHLinkCurWB *link = (GnmHLinkCurWB* )obj;
link->target = NULL;
}
GSF_CLASS (GnmHLinkCurWB, gnm_hlink_cur_wb,
gnm_hlink_cur_wb_class_init, gnm_hlink_cur_wb_init,
GNM_HLINK_TYPE)
guchar const *
gnm_hlink_cur_wb_get_target (GnmHLink const *link)
{
GnmHLinkCurWB const *cur_wb = GNM_HLINK_CUR_WB (link);
g_return_val_if_fail (cur_wb != NULL, NULL);
return cur_wb->target;
}
void
gnm_hlink_cur_wb_set_target (GnmHLink *link, guchar const *target)
{
GnmHLinkCurWB *cur_wb = GNM_HLINK_CUR_WB (link);
guchar *tmp;
g_return_if_fail (cur_wb != NULL);
tmp = g_strdup (target);
g_free (cur_wb->target);
cur_wb->target = tmp;
}
/***************************************************************************/
/* Link to arbitrary urls */
typedef struct { GnmHLinkClass hlink; } GnmHLinkURLClass;
typedef struct {
GnmHLink hlink;
char *url;
} GnmHLinkURL;
#define GNM_HLINK_URL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), gnm_hlink_url_get_type (), GnmHLinkURL))
static gboolean
gnm_hlink_url_activate (GnmHLink *link, WorkbookControl *wbc)
{
GnmHLinkURL *url = (GnmHLinkURL *)link;
GError *err = NULL;
gboolean res;
if (url->url == NULL)
return FALSE;
res = gnome_url_show (url->url, &err);
if (err != NULL) {
char *msg = g_strdup_printf(_("Unable to activate the url '%s'"), url->url);
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), msg, err->message);
g_free (msg);
g_error_free (err);
}
return res;
}
static void
gnm_hlink_url_finalize (GObject *obj)
{
GObjectClass *parent_class;
GnmHLinkURL *link = (GnmHLinkURL *)obj;
g_free (link->url);
link->url = NULL;
parent_class = g_type_class_peek (GNM_HLINK_TYPE);
if (parent_class && parent_class->finalize)
parent_class->finalize (obj);
}
static void
gnm_hlink_url_class_init (GObjectClass *object_class)
{
GnmHLinkClass *hlink_class = (GnmHLinkClass *) object_class;
hlink_class->Activate = gnm_hlink_url_activate;
object_class->finalize = gnm_hlink_url_finalize;
}
static void
gnm_hlink_url_init (GObject *obj)
{
GnmHLinkURL *link = (GnmHLinkURL* )obj;
link->url = NULL;
}
GSF_CLASS (GnmHLinkURL, gnm_hlink_url,
gnm_hlink_url_class_init, gnm_hlink_url_init,
GNM_HLINK_TYPE)
guchar const *
gnm_hlink_url_get_url (GnmHLink const *link)
{
GnmHLinkURL const *url = GNM_HLINK_URL (link);
g_return_val_if_fail (url != NULL, NULL);
return url->url;
}
void
gnm_hlink_url_set_target (GnmHLink *link, guchar const *target)
{
GnmHLinkURL *url = GNM_HLINK_URL (link);
guchar *tmp;
g_return_if_fail (url != NULL);
tmp = g_strdup (target);
g_free (url->url);
url->url = tmp;
}
* Use this for hyperlinks gnome_url_show (url);
*/
......@@ -4,12 +4,23 @@
#include "gnumeric.h"
#include <glib-object.h>
GType gnm_hlink_url_type ();
GType gnm_hlink_gnumeric_type ();
GType gnm_hlink_newbook_type ();
GType gnm_hlink_email_type ();
#define GNM_HLINK_TYPE (gnm_hlink_get_type ())
#define GNM_HLINK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_HLINK_TYPE, GnmHLink))
#define GNM_IS_HLINK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_HLINK_TYPE))
gboolean gnm_hlink_activate (GnmHLink *link);
GnmHLink *sheet_hlink_find (Sheet const *sheet, CellPos const *pos);
GnmHLink *sheet_hlink_find (Sheet const *sheet, CellPos const *pos);
GType gnm_hlink_get_type ();
gboolean gnm_hlink_activate (GnmHLink *l, WorkbookControl *wbc);
guchar const *gnm_hlink_get_tip (GnmHLink const *l);
void gnm_hlink_set_tip (GnmHLink *l, guchar const *tip);
GType gnm_hlink_cur_wb_get_type ();
guchar const *gnm_hlink_cur_wb_get_target (GnmHLink const *link);
void gnm_hlink_cur_wb_set_target (GnmHLink *link, guchar const *target);
GType gnm_hlink_url_get_type ();
guchar const *gnm_hlink_url_get_target (GnmHLink const *link);
void gnm_hlink_url_set_target (GnmHLink *link, guchar const *url);
#endif /* GNUMERIC_HLINK_H */
......@@ -38,7 +38,6 @@
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
#include <gtk/gtkdnd.h>
#include <gsf/gsf-impl-utils.h>
#include <gal/widgets/e-cursors.h>
#include <math.h>
#define GNUMERIC_ITEM "GRID"
#include "item-debug.h"
......@@ -958,30 +957,18 @@ item_grid_event (GnomeCanvasItem *item, GdkEvent *event)
return TRUE;
case GDK_BUTTON_RELEASE: {
gboolean send_finished_signal = FALSE;
ItemGridSelectionType selecting = ig->selecting;