Commit a39167af authored by Arturo Espinosa's avatar Arturo Espinosa

Bononbized Gnumeric compiles.



Bononbized Gnumeric compiles.

Miguel.
parent af64bb7a
......@@ -9,7 +9,4 @@
#undef HAVE_ORBIT
#undef HAVE_GTK_SELECTION_ADD_TARGET
#undef HAVE_GUILE
#ifdef HAVE_BONOBO
# define ENABLE_BONOBO
#endif
#undef ENABLE_BONOBO
......@@ -5,7 +5,6 @@ AM_INIT_AUTOMAKE(gnumeric,0.23)
AM_MAINTAINER_MODE
AM_ACLOCAL_INCLUDE(macros)
GNOME_INIT
AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
......@@ -13,6 +12,8 @@ AC_PROG_YACC
AC_ARG_PROGRAM
AM_PROG_LIBTOOL
GNOME_INIT
## this should come after `AC_PROG_CC'
GNOME_COMPILE_WARNINGS
GNOME_X_CHECKS
......@@ -113,6 +114,11 @@ if $python_val; then
fi
AM_CONDITIONAL(WITH_PYTHON, $python_val)
dnl ******************************
dnl Check for Bonobo
dnl ******************************
AM_PATH_BONOBO(0.1.0, [AC_DEFINE(ENABLE_BONOBO)])
AC_OUTPUT([
gnumeric.spec
Makefile
......
......@@ -22,11 +22,6 @@ SGML_FILES = \
translating.sgml \
worksheet.sgml
#TEXT_FILES = \
# Design \
# Future-Roadmap \
# saving.txt
PERL_FILES = \
make-index.pl \
make-docbook.pl
......@@ -35,8 +30,7 @@ EXTRA_DIST = \
topic.dat \
func.defs \
$(SGML_FILES) \
$(PERL_FILES) \
$(TEXT_FILES)
$(PERL_FILES)
all:
......
......@@ -150,7 +150,8 @@ gnumeric_LDADD = \
$(GUILE_LIBS) \
$(INTLLIBS)
gnumeric_corba_LDADD = $(gnumeric_LDADD) $(GNOMEGNORBA_LIBS)
gnumeric_corba_LDADD = $(gnumeric_LDADD) $(GNOMEGNORBA_LIBS) $(BONOBO_LIBS)
wc:
wc -l $(gnumeric_SOURCES)
......
......@@ -100,7 +100,7 @@ dependency_hash_init (void)
* We compute the location from cell->row->pos and cell->col->pos
*/
static void
add_cell_range_deps (Cell *cell, CellRef *a, CellRef *b)
add_cell_range_deps (Cell *cell, const CellRef *a, const CellRef *b)
{
DependencyRange range, *result;
int col = cell->col->pos;
......
......@@ -101,19 +101,19 @@ order_box_get_text(ORDER_BOX * this, int *asc)
typedef struct {
int col_offset;
int asc;
} CLAUSE_DATA;
} ClauseData;
typedef struct {
Sheet *sheet;
CLAUSE_DATA *clauses;
ClauseData *clauses;
Cell **cells;
int num_clause;
int col;
int row;
} SORT_DATA;
} SortData;
static int
compare_values (const SORT_DATA * ain, const SORT_DATA * bin, int clause)
compare_values (const SortData * ain, const SortData * bin, int clause)
{
Cell *ca, *cb;
Value *a, *b;
......@@ -131,10 +131,10 @@ compare_values (const SORT_DATA * ain, const SORT_DATA * bin, int clause)
else
b = cb->value;
switch (a->type) {
switch (a->type){
case VALUE_FLOAT:
case VALUE_INTEGER:
switch (b->type) {
switch (b->type){
case VALUE_FLOAT:
case VALUE_INTEGER:
{
......@@ -155,7 +155,7 @@ compare_values (const SORT_DATA * ain, const SORT_DATA * bin, int clause)
}
break;
default:{
switch (b->type) {
switch (b->type){
case VALUE_FLOAT:
case VALUE_INTEGER:
ans = 1;
......@@ -193,29 +193,32 @@ compare_values (const SORT_DATA * ain, const SORT_DATA * bin, int clause)
return fans;
}
static int qsort_func(const SORT_DATA * a, const SORT_DATA * b)
static int
qsort_func (const void *a, const void *b)
{
return compare_values(a, b, 0);
return compare_values (a, b, 0);
}
static void sort_cell_range(Sheet * sheet, CLAUSE_DATA * clauses, int num_clause, int start_col, int start_row,
int end_col, int end_row)
static void
sort_cell_range (Sheet * sheet, ClauseData * clauses, int num_clause, int start_col, int start_row,
int end_col, int end_row)
{
SORT_DATA *array;
SortData *array;
int lp, height, width, lp2;
height = end_row - start_row + 1;
width = end_col - start_col + 1;
array = g_new(SORT_DATA, height);
for (lp = 0; lp < height; lp++) {
array[lp].sheet = sheet;
array[lp].clauses = clauses;
array[lp].num_clause = num_clause;
array[lp].col = start_col;
array[lp].row = start_row + lp;
array[lp].cells = g_new(Cell *, width);
for (lp2 = 0; lp2 < width; lp2++) {
array = g_new(SortData, height);
for (lp = 0; lp < height; lp++){
array [lp].sheet = sheet;
array [lp].clauses = clauses;
array [lp].num_clause = num_clause;
array [lp].col = start_col;
array [lp].row = start_row + lp;
array [lp].cells = g_new(Cell *, width);
for (lp2 = 0; lp2 < width; lp2++){
Cell *cell;
cell = sheet_cell_get(sheet,
start_col + lp2, start_row + lp);
......@@ -225,12 +228,12 @@ static void sort_cell_range(Sheet * sheet, CLAUSE_DATA * clauses, int num_clause
}
}
qsort(array, height, sizeof(SORT_DATA), qsort_func);
qsort(array, height, sizeof(SortData), qsort_func);
/* (int *(const void *, const void *))qsort_func); */
{
Cell *cell;
for (lp = 0; lp < height; lp++) {
for (lp2 = 0; lp2 < width; lp2++) {
for (lp = 0; lp < height; lp++){
for (lp2 = 0; lp2 < width; lp2++){
cell = array[lp].cells[lp2];
/* printf ("%s\n", cell?value_string(cell->value):"Null"); */
if (cell)
......@@ -271,7 +274,7 @@ static void add_clause(GtkWidget * widget, SORT_FLOW * sf)
static void del_clause(GtkWidget * widget, SORT_FLOW * sf)
{
if (sf->num_clause > 1) {
if (sf->num_clause > 1){
sf->num_clause--;
order_box_remove(sf->clauses[sf->num_clause]);
order_box_destroy(sf->clauses[sf->num_clause]);
......@@ -300,13 +303,13 @@ void dialog_cell_sort(Workbook * inwb, Sheet * sheet)
if (!sheet_selection_first_range(sheet, &base_col, &base_row,
&start_col, &start_row,
&end_col, &end_row)) {
&end_col, &end_row)){
gnumeric_notice(inwb, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a single range"));
return;
}
if (end_row >= SHEET_MAX_ROWS - 2 ||
end_col >= SHEET_MAX_COLS - 2) {
end_col >= SHEET_MAX_COLS - 2){
gnumeric_notice(inwb, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a finite range"));
return;
......@@ -332,7 +335,7 @@ void dialog_cell_sort(Workbook * inwb, Sheet * sheet)
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(sort_flow.dialog)->vbox),
sort_flow.clause_box, FALSE, TRUE, 0);
for (lp = 0; lp < sort_flow.num_clause; lp++) {
for (lp = 0; lp < sort_flow.num_clause; lp++){
sort_flow.clauses[lp] =
order_box_new(sort_flow.clause_box,
lp ? _("then by") : _("sort by"),
......@@ -361,23 +364,23 @@ void dialog_cell_sort(Workbook * inwb, Sheet * sheet)
do { /* Run the dialog */
sort_flow.retry = 0;
sort_flow.force_redisplay = 0;
if (gnome_dialog_run(GNOME_DIALOG(sort_flow.dialog)) == 0) {
CLAUSE_DATA *array;
if (gnome_dialog_run(GNOME_DIALOG(sort_flow.dialog)) == 0){
ClauseData *array;
array = g_new(CLAUSE_DATA, sort_flow.num_clause);
for (lp = 0; lp < sort_flow.num_clause; lp++) {
array = g_new(ClauseData, sort_flow.num_clause);
for (lp = 0; lp < sort_flow.num_clause; lp++){
int col;
char *txt = order_box_get_text(sort_flow.clauses[lp],
&array[lp].asc);
if (strlen(txt)) {
if (strlen(txt)){
col = col_from_name(txt);
if (col < start_col || col > end_col) {
if (col < start_col || col > end_col){
gnumeric_notice(sort_flow.wb, GNOME_MESSAGE_BOX_ERROR,
_("Column must be within range"));
sort_flow.retry = 1;
}
array[lp].col_offset = col - start_col;
} else if (lp <= 0) {
} else if (lp <= 0){
gnumeric_notice(sort_flow.wb, GNOME_MESSAGE_BOX_ERROR,
_("First column must be valid"));
sort_flow.retry = 1;
......
......@@ -101,19 +101,19 @@ order_box_get_text(ORDER_BOX * this, int *asc)
typedef struct {
int col_offset;
int asc;
} CLAUSE_DATA;
} ClauseData;
typedef struct {
Sheet *sheet;
CLAUSE_DATA *clauses;
ClauseData *clauses;
Cell **cells;
int num_clause;
int col;
int row;
} SORT_DATA;
} SortData;
static int
compare_values (const SORT_DATA * ain, const SORT_DATA * bin, int clause)
compare_values (const SortData * ain, const SortData * bin, int clause)
{
Cell *ca, *cb;
Value *a, *b;
......@@ -131,10 +131,10 @@ compare_values (const SORT_DATA * ain, const SORT_DATA * bin, int clause)
else
b = cb->value;
switch (a->type) {
switch (a->type){
case VALUE_FLOAT:
case VALUE_INTEGER:
switch (b->type) {
switch (b->type){
case VALUE_FLOAT:
case VALUE_INTEGER:
{
......@@ -155,7 +155,7 @@ compare_values (const SORT_DATA * ain, const SORT_DATA * bin, int clause)
}
break;
default:{
switch (b->type) {
switch (b->type){
case VALUE_FLOAT:
case VALUE_INTEGER:
ans = 1;
......@@ -193,29 +193,32 @@ compare_values (const SORT_DATA * ain, const SORT_DATA * bin, int clause)
return fans;
}
static int qsort_func(const SORT_DATA * a, const SORT_DATA * b)
static int
qsort_func (const void *a, const void *b)
{
return compare_values(a, b, 0);
return compare_values (a, b, 0);
}
static void sort_cell_range(Sheet * sheet, CLAUSE_DATA * clauses, int num_clause, int start_col, int start_row,
int end_col, int end_row)
static void
sort_cell_range (Sheet * sheet, ClauseData * clauses, int num_clause, int start_col, int start_row,
int end_col, int end_row)
{
SORT_DATA *array;
SortData *array;
int lp, height, width, lp2;
height = end_row - start_row + 1;
width = end_col - start_col + 1;
array = g_new(SORT_DATA, height);
for (lp = 0; lp < height; lp++) {
array[lp].sheet = sheet;
array[lp].clauses = clauses;
array[lp].num_clause = num_clause;
array[lp].col = start_col;
array[lp].row = start_row + lp;
array[lp].cells = g_new(Cell *, width);
for (lp2 = 0; lp2 < width; lp2++) {
array = g_new(SortData, height);
for (lp = 0; lp < height; lp++){
array [lp].sheet = sheet;
array [lp].clauses = clauses;
array [lp].num_clause = num_clause;
array [lp].col = start_col;
array [lp].row = start_row + lp;
array [lp].cells = g_new(Cell *, width);
for (lp2 = 0; lp2 < width; lp2++){
Cell *cell;
cell = sheet_cell_get(sheet,
start_col + lp2, start_row + lp);
......@@ -225,12 +228,12 @@ static void sort_cell_range(Sheet * sheet, CLAUSE_DATA * clauses, int num_clause
}
}
qsort(array, height, sizeof(SORT_DATA), qsort_func);
qsort(array, height, sizeof(SortData), qsort_func);
/* (int *(const void *, const void *))qsort_func); */
{
Cell *cell;
for (lp = 0; lp < height; lp++) {
for (lp2 = 0; lp2 < width; lp2++) {
for (lp = 0; lp < height; lp++){
for (lp2 = 0; lp2 < width; lp2++){
cell = array[lp].cells[lp2];
/* printf ("%s\n", cell?value_string(cell->value):"Null"); */
if (cell)
......@@ -271,7 +274,7 @@ static void add_clause(GtkWidget * widget, SORT_FLOW * sf)
static void del_clause(GtkWidget * widget, SORT_FLOW * sf)
{
if (sf->num_clause > 1) {
if (sf->num_clause > 1){
sf->num_clause--;
order_box_remove(sf->clauses[sf->num_clause]);
order_box_destroy(sf->clauses[sf->num_clause]);
......@@ -300,13 +303,13 @@ void dialog_cell_sort(Workbook * inwb, Sheet * sheet)
if (!sheet_selection_first_range(sheet, &base_col, &base_row,
&start_col, &start_row,
&end_col, &end_row)) {
&end_col, &end_row)){
gnumeric_notice(inwb, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a single range"));
return;
}
if (end_row >= SHEET_MAX_ROWS - 2 ||
end_col >= SHEET_MAX_COLS - 2) {
end_col >= SHEET_MAX_COLS - 2){
gnumeric_notice(inwb, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a finite range"));
return;
......@@ -332,7 +335,7 @@ void dialog_cell_sort(Workbook * inwb, Sheet * sheet)
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(sort_flow.dialog)->vbox),
sort_flow.clause_box, FALSE, TRUE, 0);
for (lp = 0; lp < sort_flow.num_clause; lp++) {
for (lp = 0; lp < sort_flow.num_clause; lp++){
sort_flow.clauses[lp] =
order_box_new(sort_flow.clause_box,
lp ? _("then by") : _("sort by"),
......@@ -361,23 +364,23 @@ void dialog_cell_sort(Workbook * inwb, Sheet * sheet)
do { /* Run the dialog */
sort_flow.retry = 0;
sort_flow.force_redisplay = 0;
if (gnome_dialog_run(GNOME_DIALOG(sort_flow.dialog)) == 0) {
CLAUSE_DATA *array;
if (gnome_dialog_run(GNOME_DIALOG(sort_flow.dialog)) == 0){
ClauseData *array;
array = g_new(CLAUSE_DATA, sort_flow.num_clause);
for (lp = 0; lp < sort_flow.num_clause; lp++) {
array = g_new(ClauseData, sort_flow.num_clause);
for (lp = 0; lp < sort_flow.num_clause; lp++){
int col;
char *txt = order_box_get_text(sort_flow.clauses[lp],
&array[lp].asc);
if (strlen(txt)) {
if (strlen(txt)){
col = col_from_name(txt);
if (col < start_col || col > end_col) {
if (col < start_col || col > end_col){
gnumeric_notice(sort_flow.wb, GNOME_MESSAGE_BOX_ERROR,
_("Column must be within range"));
sort_flow.retry = 1;
}
array[lp].col_offset = col - start_col;
} else if (lp <= 0) {
} else if (lp <= 0){
gnumeric_notice(sort_flow.wb, GNOME_MESSAGE_BOX_ERROR,
_("First column must be valid"));
sort_flow.retry = 1;
......
......@@ -100,7 +100,7 @@ dependency_hash_init (void)
* We compute the location from cell->row->pos and cell->col->pos
*/
static void
add_cell_range_deps (Cell *cell, CellRef *a, CellRef *b)
add_cell_range_deps (Cell *cell, const CellRef *a, const CellRef *b)
{
DependencyRange range, *result;
int col = cell->col->pos;
......
......@@ -1189,7 +1189,7 @@ eval_expr (void *asheet, ExprTree *tree, int eval_col, int eval_row, char **erro
}
void
cell_get_abs_col_row (CellRef *cell_ref, int eval_col, int eval_row, int *col, int *row)
cell_get_abs_col_row (const CellRef *cell_ref, int eval_col, int eval_row, int *col, int *row)
{
g_return_if_fail (cell_ref != NULL);
......
......@@ -140,7 +140,7 @@ extern ExprTree *parser_result;
extern void *parser_sheet;
extern int parser_col, parser_row;
void cell_get_abs_col_row (CellRef *cell_ref,
void cell_get_abs_col_row (const CellRef *cell_ref,
int eval_col, int eval_row,
int *col, int *row);
......
......@@ -145,7 +145,7 @@ function_iterate_argument_values (Sheet *sheet,
}
GPtrArray *
function_categories_get ()
function_categories_get (void)
{
return categories;
}
......@@ -155,7 +155,7 @@ tokenized_help_new (FunctionDefinition *fd)
{
TokenizedHelp *tok;
g_return_if_fail (fd != NULL);
g_return_val_if_fail (fd != NULL, NULL);
tok = g_new (TokenizedHelp, 1);
......
......@@ -69,7 +69,7 @@ typedef struct {
FunctionDefinition *functions;
} FunctionCategory;
extern GPtrArray *function_categories_get ();
GPtrArray *function_categories_get (void);
typedef struct {
GPtrArray *sections ;
......
......@@ -4,6 +4,10 @@
#include "str.h"
#include "expr.h"
#include "cell.h"
#ifdef ENABLE_BONOBO
# include <bonobo/gnome-container.h>
# include <bonobo/gnome-client-site.h>
#endif
#include "sheet.h"
#include "sheet-view.h"
#include "clipboard.h"
......
......@@ -3437,13 +3437,13 @@ sheet_lookup_by_name (Sheet *base, char *name)
void
sheet_insert_object (Sheet *sheet, char *repoid)
{
GnomeClientSite *client;
GnomeClientSite *client_site;
GnomeObject *object_server;
GList *l;
g_return_val_if_fail (sheet != NULL, NULL);
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (repoid != NULL);
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
g_return_if_fail (repoid != NULL);
object_server = gnome_object_activate_with_repo_id (NULL, repoid, 0, NULL);
if (!object_server){
......@@ -3451,16 +3451,16 @@ sheet_insert_object (Sheet *sheet, char *repoid)
msg = g_strdup_printf (_("I was not able to activate object %s"), repoid);
gnumeric_notice (sheet->wb, GNOME_MESSAGE_BOX_ERROR, msg);
gnumeric_notice (sheet->workbook, GNOME_MESSAGE_BOX_ERROR, msg);
g_free (msg);
return;
}
client_site = gnome_client_site_new (sheet->wb->gnome_container);
gnome_container_add (sheet->wb->container, client_site);
client_site = gnome_client_site_new (sheet->workbook->gnome_container);
gnome_container_add (sheet->workbook->gnome_container, GNOME_OBJECT (client_site));
if (!gnome_client_site_bind_component (client_site, object_server)){
gnumeric_notice (sheet->wb, GNOME_MESSAGE_BOX_ERROR,
gnumeric_notice (sheet->workbook, GNOME_MESSAGE_BOX_ERROR,
_("I was unable to the bind object"));
gtk_object_unref (GTK_OBJECT (object_server));
gtk_object_unref (GTK_OBJECT (client_site));
......@@ -3472,7 +3472,7 @@ sheet_insert_object (Sheet *sheet, char *repoid)
for (l = sheet->sheet_views; l; l = g_list_next (l)){
SheetView *sheet_view = l->data;
sheet_view_object_add (sheet_view, object_server);
sheet_view_insert_object (sheet_view, object_server);
}
}
......
#ifndef GNUMERIC_SHEET_H
#define GNUMERIC_SHEET_H
#ifdef ENABLE_BONOBO
# include <bonobo/gnome-container.h>
#endif
#include "solver.h"
#define SHEET_MAX_ROWS (16 * 1024)
......@@ -72,8 +76,10 @@ typedef struct {
void *toolbar;
#ifdef HAVE_BONOBO
#ifdef ENABLE_BONOBO
/* A GnomeContainer */
GnomeContainer *gnome_container;
#endif
} Workbook;
......@@ -149,7 +155,7 @@ typedef struct {
/* Solver parameters */
SolverParameters solver_parameters;
#ifdef HAVE_BONOBO
#ifdef ENABLE_BONOBO
GListClientSite *client_site_list;
#endif
} Sheet;
......@@ -369,6 +375,11 @@ char *cellref_name (CellRef *cell_ref,
int eval_col,
int eval_row);
/*
* Sheet, Bobobo objects
*/
void sheet_insert_object (Sheet *sheet, char *repoid);
/*
* Workbook
*/
......
#ifndef GNUMERIC_SOLVER_H
#define GNUMERIC_SOLVER_H
#include "sheet.h"
typedef enum {
SolverMinimize, SolverMaximize, SolverEqualTo
} SolverProblemType;
......
......@@ -1428,7 +1428,7 @@ workbook_new (void)
gtk_widget_show_all (wb->table);
#ifdef ENABLE_BONOBO
wb->container = GNOME_CONTAINER (gnome_container_new ());
wb->gnome_container = GNOME_CONTAINER (gnome_container_new ());
#endif
return wb;
}
......
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