Commit 3af148aa authored by Michael Meeks's avatar Michael Meeks

Start of define-name dialog.

parent 8fc2b9c9
1999-07-22 Michael Meeks <michael@edenproject.org>
* src/dialog-define-names.c (dialog_define_names): Removed all the
dead code.
Lots of new code ... not there yet though.
* src/workbook.c: Enabled names menu item.
* src/dialog-summary.c: add file header.
* src/Makefile.am (glade_DATA): Added summary.glade and names.glade
seems I didn't do this earlier: odd.
* names.glade: Created.
1999-07-22 Michael Meeks <michael@edenproject.org>
* src/expr-name.c: Stylistic precondition fixes,
......
1999-07-22 Michael Meeks <michael@edenproject.org>
* src/dialog-define-names.c (dialog_define_names): Removed all the
dead code.
Lots of new code ... not there yet though.
* src/workbook.c: Enabled names menu item.
* src/dialog-summary.c: add file header.
* src/Makefile.am (glade_DATA): Added summary.glade and names.glade
seems I didn't do this earlier: odd.
* names.glade: Created.
1999-07-22 Michael Meeks <michael@edenproject.org>
* src/expr-name.c: Stylistic precondition fixes,
......
......@@ -12,13 +12,13 @@ Michael
* Fonts etc.
* Deep freeze workbook re-calcs / dependencies, and implement in
load/save + workbook_do_destroy.
* Hack up GDOUBLE_FROM_IEE, and send it to gtk-devel-list@redhat.com
* Sort out biff padding =>
* Sort out better versioning scheme & helper macros.
* Rationalise Missing Argument stuff ... a new value ?
* Remove silly name record in writing ( after debugging is done )
* Lookup Harvest and see if we can help with doc summary info for
searches.
* Split panes.
* write xml-io support for names.
* Use same XML as Office 2000 for elegance (?)
* Investigate VB streams, and their lengths.
* glib
......
......@@ -258,7 +258,9 @@ glade_DATA = \
font-sel.glade \
hf-config.glade \
import.glade \
print.glade
print.glade \
summary.glade \
names.glade
glade_msgs = \
font-sel.glade.h \
......
/*
* dialog-goto-cell.c: Implements the Define Name dialog box
/**
* dialog-summary.c: Implements the summary info stuff
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
* Michael Meeks <michael@imaginator.com>
*
*/
**/
#include <config.h>
#include <gnome.h>
#include <glade/glade.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h"
typedef struct {
Workbook *wb;
GladeXML *gui;
GtkWidget *dia;
GtkWidget *list;
GtkWidget *name;
GtkWidget *value;
GList *expr_names;
GList *list_items;
gint selected;
} state_t;
static void
select_name (GtkWidget *w, state_t *state)
{
guint i = 0;
GList *p = state->list_items;
while (p) {
if (p->data == w) {
state->selected = i;
return;
}
i++;
p = g_list_next (p);
}
}
static void
fill_list (state_t *state)
{
GList *names;
g_return_if_fail (state);
g_return_if_fail (state->list);
state->list_items = NULL;
state->selected = 0;
state->expr_names = names = expr_name_list (state->wb, FALSE);
while (names) {
ExprName *expr_name = names->data;
GtkWidget *li = gtk_list_item_new_with_label (expr_name->name->str);
gtk_signal_connect (GTK_OBJECT (li), "toggle-focus-row",
GTK_SIGNAL_FUNC (select_name), &state);
state->list_items = g_list_append (state->list_items, li);
names = g_list_next (names);
}
gtk_list_insert_items (GTK_LIST (state->list), state->list_items, 0);
}
static void
remove_name (GtkWidget *widget, state_t *state)
{
}
void
dialog_define_names (Workbook *wb)
{
static GtkWidget *dialog;
GtkWidget *l, *box, *swin;
GtkCList *clist;
GtkEntry *name, *refers;
gint v;
state_t state;
GtkWidget *w;
g_return_if_fail (wb != NULL);
state.wb = wb;
state.gui = glade_xml_new (GNUMERIC_GLADEDIR "/names.glade", NULL);
if (!state.gui) {
printf ("Could not find names.glade\n");
return;
}
state.name = glade_xml_get_widget (state.gui, "name");
state.value = glade_xml_get_widget (state.gui, "value");
state.list = glade_xml_get_widget (state.gui, "name_list");
fill_list (&state);
w = glade_xml_get_widget (state.gui, "delete");
gtk_signal_connect (GTK_OBJECT (w), "clicked",
GTK_SIGNAL_FUNC (remove_name), &state);
if (!dialog){
dialog = gnome_dialog_new (_("Define names"),
GNOME_STOCK_BUTTON_APPLY,
GNOME_STOCK_BUTTON_CLOSE,
_("Add"),
_("Remove"),
NULL);
gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (wb->toplevel));
swin = gtk_scrolled_window_new (NULL, NULL);
clist = (GtkCList *) gtk_clist_new (1);
gtk_container_add (GTK_CONTAINER (swin), GTK_WIDGET (clist));
gtk_clist_column_titles_hide (clist);
name = (GtkEntry *) gtk_entry_new ();
refers = (GtkEntry *) gtk_entry_new ();
box = gtk_vbox_new (0, 2);
l = gtk_label_new (_("Names in the workbook"));
gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (box), l, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (name), TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (swin), TRUE, TRUE, 0);
l = gtk_label_new (_("Refers to"));
gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (box), l, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (refers), TRUE, TRUE, 0);
gtk_box_pack_start_defaults (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
box);
state.dia = glade_xml_get_widget (state.gui, "NamesDialog");
if (!state.dia) {
printf ("Corrupt file names.glade\n");
return;
}
v = gnome_dialog_run (GNOME_DIALOG (state.dia));
if (v == 0) { /* OK */
}
gtk_widget_show_all (dialog);
if (v != -1)
gtk_object_destroy (GTK_OBJECT (state.dia));
gtk_object_unref (GTK_OBJECT (state.gui));
}
/**
* dialog-summary.c: Implements the summary info stuff
*
* Author:
* Michael Meeks <michael@imaginator.com>
*
**/
#include <config.h>
#include <gnome.h>
#include <glade/glade.h>
......
/*
* dialog-goto-cell.c: Implements the Define Name dialog box
/**
* dialog-summary.c: Implements the summary info stuff
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
* Michael Meeks <michael@imaginator.com>
*
*/
**/
#include <config.h>
#include <gnome.h>
#include <glade/glade.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "gnumeric-sheet.h"
#include "dialogs.h"
typedef struct {
Workbook *wb;
GladeXML *gui;
GtkWidget *dia;
GtkWidget *list;
GtkWidget *name;
GtkWidget *value;
GList *expr_names;
GList *list_items;
gint selected;
} state_t;
static void
select_name (GtkWidget *w, state_t *state)
{
guint i = 0;
GList *p = state->list_items;
while (p) {
if (p->data == w) {
state->selected = i;
return;
}
i++;
p = g_list_next (p);
}
}
static void
fill_list (state_t *state)
{
GList *names;
g_return_if_fail (state);
g_return_if_fail (state->list);
state->list_items = NULL;
state->selected = 0;
state->expr_names = names = expr_name_list (state->wb, FALSE);
while (names) {
ExprName *expr_name = names->data;
GtkWidget *li = gtk_list_item_new_with_label (expr_name->name->str);
gtk_signal_connect (GTK_OBJECT (li), "toggle-focus-row",
GTK_SIGNAL_FUNC (select_name), &state);
state->list_items = g_list_append (state->list_items, li);
names = g_list_next (names);
}
gtk_list_insert_items (GTK_LIST (state->list), state->list_items, 0);
}
static void
remove_name (GtkWidget *widget, state_t *state)
{
}
void
dialog_define_names (Workbook *wb)
{
static GtkWidget *dialog;
GtkWidget *l, *box, *swin;
GtkCList *clist;
GtkEntry *name, *refers;
gint v;
state_t state;
GtkWidget *w;
g_return_if_fail (wb != NULL);
state.wb = wb;
state.gui = glade_xml_new (GNUMERIC_GLADEDIR "/names.glade", NULL);
if (!state.gui) {
printf ("Could not find names.glade\n");
return;
}
state.name = glade_xml_get_widget (state.gui, "name");
state.value = glade_xml_get_widget (state.gui, "value");
state.list = glade_xml_get_widget (state.gui, "name_list");
fill_list (&state);
w = glade_xml_get_widget (state.gui, "delete");
gtk_signal_connect (GTK_OBJECT (w), "clicked",
GTK_SIGNAL_FUNC (remove_name), &state);
if (!dialog){
dialog = gnome_dialog_new (_("Define names"),
GNOME_STOCK_BUTTON_APPLY,
GNOME_STOCK_BUTTON_CLOSE,
_("Add"),
_("Remove"),
NULL);
gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (wb->toplevel));
swin = gtk_scrolled_window_new (NULL, NULL);
clist = (GtkCList *) gtk_clist_new (1);
gtk_container_add (GTK_CONTAINER (swin), GTK_WIDGET (clist));
gtk_clist_column_titles_hide (clist);
name = (GtkEntry *) gtk_entry_new ();
refers = (GtkEntry *) gtk_entry_new ();
box = gtk_vbox_new (0, 2);
l = gtk_label_new (_("Names in the workbook"));
gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (box), l, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (name), TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (swin), TRUE, TRUE, 0);
l = gtk_label_new (_("Refers to"));
gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (box), l, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (refers), TRUE, TRUE, 0);
gtk_box_pack_start_defaults (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
box);
state.dia = glade_xml_get_widget (state.gui, "NamesDialog");
if (!state.dia) {
printf ("Corrupt file names.glade\n");
return;
}
v = gnome_dialog_run (GNOME_DIALOG (state.dia));
if (v == 0) { /* OK */
}
gtk_widget_show_all (dialog);
if (v != -1)
gtk_object_destroy (GTK_OBJECT (state.dia));
gtk_object_unref (GTK_OBJECT (state.gui));
}
/**
* dialog-summary.c: Implements the summary info stuff
*
* Author:
* Michael Meeks <michael@imaginator.com>
*
**/
#include <config.h>
#include <gnome.h>
#include <glade/glade.h>
......
<?xml version="1.0"?>
<GTK-Interface>
<project>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>False</use_widget_names>
<output_main_file>True</output_main_file>
<output_support_files>True</output_support_files>
<output_build_files>True</output_build_files>
<backup_source_files>True</backup_source_files>
<main_source_file>interface.c</main_source_file>
<main_header_file>interface.h</main_header_file>
<handler_source_file>callbacks.c</handler_source_file>
<handler_header_file>callbacks.h</handler_header_file>
<support_source_file>support.c</support_source_file>
<support_header_file>support.h</support_header_file>
<translatable_strings_file></translatable_strings_file>
</project>
<widget>
<class>GnomeDialog</class>
<name>NamesDialog</name>
<title>Define Name</title>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox1</name>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<widget>
<class>GtkVBox</class>
<name>vbox2</name>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkHSeparator</class>
<name>hseparator1</name>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<label>Names in workbook:</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>0.01</xalign>
<yalign>1</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkAlignment</class>
<name>alignment2</name>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<xalign>0.56</xalign>
<yalign>0.5</yalign>
<xscale>1</xscale>
<yscale>1</yscale>
<widget>
<class>GtkTable</class>
<name>table2</name>
<rows>6</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<widget>
<class>GtkList</class>
<name>name_list</name>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
</widget>
<widget>
<class>GtkButton</class>
<name>ok</name>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<has_default>True</has_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>add</name>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<height>24</height>
<can_focus>True</can_focus>
<label>Add</label>
</widget>
<widget>
<class>GtkButton</class>
<name>close</name>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
</widget>
<widget>
<class>GtkEntry</class>
<name>name</name>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
<widget>
<class>GtkButton</class>
<name>delete</name>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>3</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<height>24</height>
<can_focus>True</can_focus>
<label>Delete</label>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<name>label4</name>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<label>Refers to:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.01</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkEntry</class>
<name>value</name>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area1</name>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
</widget>
</widget>
</widget>
</GTK-Interface>
<?xml version="1.0"?>
<GTK-Interface>
<project>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>False</use_widget_names>
<output_main_file>True</output_main_file>
<output_support_files>True</output_support_files>
<output_build_files>True</output_build_files>
<backup_source_files>True</backup_source_files>
<main_source_file>interface.c</main_source_file>
<main_header_file>interface.h</main_header_file>
<handler_source_file>callbacks.c</handler_source_file>
<handler_header_file>callbacks.h</handler_header_file>
<support_source_file>support.c</support_source_file>
<support_header_file>support.h</support_header_file>
<translatable_strings_file></translatable_strings_file>
</project>
<widget>
<class>GnomeDialog</class>
<name>NamesDialog</name>
<title>Define Name</title>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox1</name>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<widget>
<class>GtkVBox</class>
<name>vbox2</name>