Commit cdf033b3 authored by Miguel de Icaza's avatar Miguel de Icaza Committed by Arturo Espinosa

New files that keep track of the construction of the graphic process.

1999-04-26  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* graphic-context.[ch]: New files that keep track of the
	construction of the graphic process.

	* graphics.glade: Renamed some widgets I need to manipulate.
1999-04-26  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* src/eval.c (intersects): Typo fix.  Sheet was being assigned
	instead of being tested for equality.  This got Michael to crash
	Gnumeric (as there was no test for can_remove)

1999-04-26  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* ms-excel.c (ms_excel_workbook_detach): Check the return value of
	workbook_detach_sheet.
	(ms_excel_read_sheet): If detaching fails, there is a dependency.
parent d5b6ddd2
1999-04-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c (intersects): Typo fix. Sheet was being assigned
instead of being tested for equality. This got Michael to crash
Gnumeric (as there was no test for can_remove)
1999-04-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-stat.c: Added CHIDIST(), CHIINV(), and GAMMAINV().
......
1999-04-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c (intersects): Typo fix. Sheet was being assigned
instead of being tested for equality. This got Michael to crash
Gnumeric (as there was no test for can_remove)
1999-04-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-stat.c: Added CHIDIST(), CHIINV(), and GAMMAINV().
......
1999-04-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c (intersects): Typo fix. Sheet was being assigned
instead of being tested for equality. This got Michael to crash
Gnumeric (as there was no test for can_remove)
1999-04-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-stat.c: Added CHIDIST(), CHIINV(), and GAMMAINV().
......
1999-04-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c (intersects): Typo fix. Sheet was being assigned
instead of being tested for equality. This got Michael to crash
Gnumeric (as there was no test for can_remove)
1999-04-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-stat.c: Added CHIDIST(), CHIINV(), and GAMMAINV().
......
1999-04-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* ms-excel.c (ms_excel_workbook_detach): Check the return value of
workbook_detach_sheet.
(ms_excel_read_sheet): If detaching fails, there is a dependency.
Tue Apr 20 16:34:38 1999 Morten Welinder <terra@diku.dk>
* ms-obj.c (ms_obj_read_obj): Initialise type.
......
......@@ -1329,7 +1329,7 @@ ms_excel_workbook_attach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
wb->excel_sheets = g_list_append (wb->excel_sheets, ans);
}
static void
static gboolean
ms_excel_workbook_detach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
{
int idx = 0 ;
......@@ -1337,8 +1337,7 @@ ms_excel_workbook_detach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
if (ans->gnum_sheet) {
if (!workbook_detach_sheet (wb->gnum_wb, ans->gnum_sheet))
printf ("Error detaching sheet: '%s'\n",
ans->gnum_sheet->name?ans->gnum_sheet->name:"noname");
return FALSE;
}
while (list)
......@@ -1350,6 +1349,7 @@ ms_excel_workbook_detach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
}
else
list = list->next ;
return TRUE;
}
static MS_EXCEL_SHEET *
......@@ -1885,9 +1885,10 @@ ms_excel_read_sheet (MS_EXCEL_SHEET *sheet, BIFF_QUERY * q, MS_EXCEL_WORKBOOK *
if (q->streamPos == blankSheetPos || sheet->blank)
{
printf ("Blank sheet\n");
ms_excel_workbook_detach (sheet->wb, sheet) ;
ms_excel_sheet_destroy (sheet) ;
sheet = NULL ;
if (ms_excel_workbook_detach (sheet->wb, sheet)){
ms_excel_sheet_destroy (sheet) ;
sheet = NULL ;
}
return;
}
return;
......
......@@ -1329,7 +1329,7 @@ ms_excel_workbook_attach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
wb->excel_sheets = g_list_append (wb->excel_sheets, ans);
}
static void
static gboolean
ms_excel_workbook_detach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
{
int idx = 0 ;
......@@ -1337,8 +1337,7 @@ ms_excel_workbook_detach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
if (ans->gnum_sheet) {
if (!workbook_detach_sheet (wb->gnum_wb, ans->gnum_sheet))
printf ("Error detaching sheet: '%s'\n",
ans->gnum_sheet->name?ans->gnum_sheet->name:"noname");
return FALSE;
}
while (list)
......@@ -1350,6 +1349,7 @@ ms_excel_workbook_detach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
}
else
list = list->next ;
return TRUE;
}
static MS_EXCEL_SHEET *
......@@ -1885,9 +1885,10 @@ ms_excel_read_sheet (MS_EXCEL_SHEET *sheet, BIFF_QUERY * q, MS_EXCEL_WORKBOOK *
if (q->streamPos == blankSheetPos || sheet->blank)
{
printf ("Blank sheet\n");
ms_excel_workbook_detach (sheet->wb, sheet) ;
ms_excel_sheet_destroy (sheet) ;
sheet = NULL ;
if (ms_excel_workbook_detach (sheet->wb, sheet)){
ms_excel_sheet_destroy (sheet) ;
sheet = NULL ;
}
return;
}
return;
......
......@@ -29,6 +29,7 @@ INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DGNUMERIC_VERSION=\""$(VERSION)"\" \
-I$(includedir) \
-I$(top_srcdir)/libglade \
$(GNOME_INCLUDEDIR) \
$(GUILE_INCS)
......@@ -177,6 +178,7 @@ gnumeric_LDFLAGS = -export-dynamic
gnumeric_LDADD = \
../plugins/excel/libexcel.a \
../libglade/glade/libglade.a \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) \
$(GNOME_XML_LIB) \
......@@ -189,6 +191,7 @@ gnumeric_corba_LDADD = \
gnumeric_bonobo_LDADD = \
../plugins/excel/libexcel.a \
../libglade/glade/libglade.a \
$(BONOBO_LIBS) \
$(GNOME_XML_LIB) \
$(GUILE_LIBS) \
......
......@@ -304,7 +304,7 @@ typedef struct {
static gboolean
intersects (Sheet *sheet, int col, int row, DependencyRange *range)
{
if (range_contains (&range->range, col, row) && (sheet = range->sheet))
if (range_contains (&range->range, col, row) && (sheet == range->sheet))
return TRUE;
return FALSE;
......
......@@ -304,7 +304,7 @@ typedef struct {
static gboolean
intersects (Sheet *sheet, int col, int row, DependencyRange *range)
{
if (range_contains (&range->range, col, row) && (sheet = range->sheet))
if (range_contains (&range->range, col, row) && (sheet == range->sheet))
return TRUE;
return FALSE;
......
......@@ -18,6 +18,8 @@
#include "main.h"
#include "../plugins/excel/boot.h"
#include <glade/glade.h>
#include <glade/glade-xml.h>
#ifdef HAVE_GUILE
#include <libguile.h>
......@@ -28,6 +30,7 @@ int gnumeric_debugging = 0;
static char *dump_file_name = NULL;
static char **startup_files = NULL;
static char startup_glade_file = NULL;
poptContext ctx;
......@@ -63,6 +66,11 @@ gnumeric_main (void *closure, int argc, char *argv [])
/* The statically linked in file formats */
xml_init ();
excel_init ();
/* Glade */
glade_init ();
if (startup_glade_file)
glade_xml_new (startup_glade_file, NULL);
if (dump_file_name){
dump_functions (dump_file_name);
......
......@@ -18,6 +18,8 @@
#include "main.h"
#include "../plugins/excel/boot.h"
#include <glade/glade.h>
#include <glade/glade-xml.h>
#ifdef HAVE_GUILE
#include <libguile.h>
......@@ -28,6 +30,7 @@ int gnumeric_debugging = 0;
static char *dump_file_name = NULL;
static char **startup_files = NULL;
static char startup_glade_file = NULL;
poptContext ctx;
......@@ -63,6 +66,11 @@ gnumeric_main (void *closure, int argc, char *argv [])
/* The statically linked in file formats */
xml_init ();
excel_init ();
/* Glade */
glade_init ();
if (startup_glade_file)
glade_xml_new (startup_glade_file, NULL);
if (dump_file_name){
dump_functions (dump_file_name);
......
......@@ -2237,10 +2237,6 @@ sheet_destroy (Sheet *sheet)
g_assert (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
#if 0
/* When destroying a workbook, this condition is not true. */
g_return_if_fail (sheet->workbook == NULL);
#endif
g_warning ("Reminder: need to destroy SheetObjects");
sheet_selections_free (sheet);
......
......@@ -172,13 +172,23 @@ italic_cmd (GtkWidget *widget, Workbook *wb)
change_selection_font (wb, 3, italic_names);
}
/*
* Temporary hack:
*/
void (*graphic_wizard_hook)(Workbook *wb) = 0;
static void
create_graphic_cmd (GtkWidget *widget, Workbook *wb)
{
Sheet *sheet;
sheet = workbook_get_current_sheet (wb);
sheet_set_mode_type (sheet, SHEET_MODE_CREATE_GRAPHIC);
if (graphic_wizard_hook){
printf ("Invoking graphic wizard...\n");
graphic_wizard_hook (wb);
} else {
sheet = workbook_get_current_sheet (wb);
sheet_set_mode_type (sheet, SHEET_MODE_CREATE_GRAPHIC);
}
}
static void
......@@ -221,12 +231,14 @@ static void
cb_sheet_do_destroy (gpointer key, gpointer value, gpointer user_data)
{
Sheet *sheet = value;
sheet_destroy (sheet);
}
static void
workbook_do_destroy (Workbook *wb)
{
g_hash_table_foreach (wb->sheets, cb_sheet_do_destroy, NULL);
g_hash_table_destroy (wb->sheets);
......
Makefile
Makefile.in
*.lo
*.la
*.o
*~
Makefile.in
Makefile
1999-04-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* graphic-context.[ch]: New files that keep track of the
construction of the graphic process.
* graphics.glade: Renamed some widgets I need to manipulate.
......@@ -4,14 +4,26 @@
# Author: Miguel de Icaza (miguel@kernel.org)
#
noinst_PROGRAMS = graphics-wizard
wizarddir = $(libdir)/gnumeric/wizards
graphics_wizard_SOURCES = \
chooser.c
main.c
wizard_LTLIBRARIES = libwizard.la
graphics_wizard_LDADD = \
libwizard_la_SOURCES = \
main.c \
graphic-context.c \
graphic-context.h
libwizard_la_LIBADD = \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) \
$(GNOME_XML_LIB) \
$(BONOBO_LIBS) \
$(INTLLIBS)
INCLUDES = \
-I$(top_srcdir)/libglade \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
-I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR)
/*
* Gnumeric, the GNOME spreadhseet
*
* Graphics Wizard's Graphic Context manager
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
*/
#include <config.h>
#include <gnome.h>
#include "gnumeric.h"
#include <glade/glade.h>
#include "graphic-context.h"
GraphicContext *
graphic_context_new (Workbook *wb, GladeXML *gui)
{
GraphicContext *gc;
g_return_val_if_fail (wb != NULL, NULL);
gc = g_new0 (GraphicContext, 1);
gc->workbook = wb;
gc->signature = GC_SIGNATURE;
gc->current_page = 0;
gc->gui = gui;
gc->dialog_toplevel = glade_xml_get_widget (gui, "graphics-wizard-dialog");
return gc;
}
void
graphic_context_destroy (GraphicContext *gc)
{
GList *l;
g_return_if_fail (gc != NULL);
g_return_if_fail (IS_GRAPHIC_CONTEXT (gc));
gtk_object_unref (GTK_OBJECT (gc->dialog_toplevel));
gtk_object_unref (GTK_OBJECT (gc->gui));
if (gc->data_range)
string_unref (gc->data_range);
if (gc->x_axis_label)
string_unref (gc->x_axis_label);
if (gc->plot_title)
string_unref (gc->plot_title);
if (gc->y_axis_label)
string_unref (gc->y_axis_label);
for (l = gc->data_range_list; l; l = l->next){
DataRange *data_range = l->data;
data_range_destroy (data_range);
}
g_list_free (gc->data_range_list);
g_free (gc);
}
void
graphic_context_data_range_add (GraphicContext *gc, DataRange *data_range)
{
g_return_if_fail (gc != NULL);
g_return_if_fail (IS_GRAPHIC_CONTEXT (gc));
g_return_if_fail (data_range != NULL);
gc->data_range_list = g_list_prepend (gc->data_range_list, data_range);
}
void
graphic_context_data_range_remove (GraphicContext *gc, const char *range_name)
{
GList *l;
g_return_if_fail (gc != NULL);
g_return_if_fail (IS_GRAPHIC_CONTEXT (gc));
g_return_if_fail (range_name != NULL);
for (l = gc->data_range_list; l; l = l->next){
DataRange *data_range = l->data;
if (strcmp (data_range->name->str, range_name) != 0)
continue;
gc->data_range_list = g_list_remove (gc->data_range_list, data_range);
}
}
#ifndef GNUMERIC_WIZARD_GRAPHICS_CONTEXT_H
#define GNUMERIC_WIZARD_GRAPHICS_CONTEXT_H
typedef enum {
SERIES_COLUMNS,
SERIES_ROWS
} SeriesLocation;
typedef struct {
String *name;
ExprTree *tree;
} DataRange;
DataRange *data_range_new (const char *name, const char *expression);
void data_range_destroy (DataRange *data_range);
typedef struct {
guint signature;
GtkWidget *dialog_toplevel;
Workbook *workbook;
GladeXML *gui;
int current_page;
GtkNotebook *steps_notebook;
/* Data for the various pages */
int graphic_type;
String *data_range;
SeriesLocation series_location;
GList *data_range_list;
String *x_axis_label;
String *plot_title;
String *y_axis_label;
} GraphicContext;
#define GC_SIGNATURE ((('G' << 8) | ('C' << 8)) | 'o')
#define IS_GRAPHIC_CONTEXT(gc) (gc->signature == GC_SIGNATURE)
GraphicContext *graphic_context_new (Workbook *wb, GladeXML *gui);
void graphic_context_destroy (GraphicContext *gc);
void graphic_context_data_range_remove (GraphicContext *gc, const char *range_name);
void graphic_context_data_range_add (GraphicContext *gc, DataRange *data_range);
#endif /* GNUMERIC_WIZARD_GRAPHICS_CONTEXT_H */
......@@ -17,7 +17,7 @@
<widget>
<class>GtkDialog</class>
<name>dialog3</name>
<name>graphics-wizard-dialog</name>
<title>dialog3</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
......@@ -34,7 +34,7 @@
<widget>
<class>GtkNotebook</class>
<name>notebook4</name>
<name>main-notebook</name>
<child>
<padding>0</padding>
<expand>True</expand>
......
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