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

Make a happy TigerT.

2000-03-26  Jody Goldberg <jgoldberg@home.com>

	* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
	  default size is 10 points.
	(workbook_create_format_toolbar) : Switch the size selector over to
	  gtk-combo-text too.

2000-03-26  Jody Goldberg <jgoldberg@home.com>

	* gtk-combo-text.c : Add a hash to be used for proper lookup of
	  entries made directly in the edit area.  Yes morten it leaks.
	(gtk_combo_text_construct) : Make scrolling
	  optional.
	(gtk_combo_text_add_item) : Add some brute force mouse over effects.
	  Still need autoscroll, and cancel.
parent bfaed296
......@@ -4,9 +4,9 @@ and longer term bugs.
Release Critical
----------------
- gnumeric depends on unreleased bonobo
- gnumeric depends on unreleased gnome-print
- print-preview is not cleared between pages.
- gnumeric depends on unreleased gnome-print
- gnumeric depends on unreleased bonobo
Long term breakage
------------------
......@@ -21,6 +21,8 @@ Long term breakage
- non string values entered directly are not really editable in that we
may not be able to parse the formated version.
eg value = 90, format = '[$USD] 0.00'
We put the FORMATTED result (USD 90.00) into the edit region.
- Names : sheet vs workbook, addresses not changing with row/col ins/del.
......@@ -28,3 +30,13 @@ Function Breakage
-----------------
- Match : does not support match_type +-1
- Index : does not support 0,0 or reference syntax.
Widget polishing
----------------
- gtk-combo-box
: Escape does not cancel
- gtk-combo-text
: Does not autoscroll when mouse moves outside list (see font list)
: a value entered directly in the edit field does not handle selection in
the list correctly
2000-03-26 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
default size is 10 points.
(workbook_create_format_toolbar) : Switch the size selector over to
gtk-combo-text too.
2000-03-26 Almer. S. Tigelaar. <almer1@dds.nl>
* src/plugin-util.c, src/plugin-util.h: New, ment for reducing
......
2000-03-26 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
default size is 10 points.
(workbook_create_format_toolbar) : Switch the size selector over to
gtk-combo-text too.
2000-03-26 Almer. S. Tigelaar. <almer1@dds.nl>
* src/plugin-util.c, src/plugin-util.h: New, ment for reducing
......
2000-03-26 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
default size is 10 points.
(workbook_create_format_toolbar) : Switch the size selector over to
gtk-combo-text too.
2000-03-26 Almer. S. Tigelaar. <almer1@dds.nl>
* src/plugin-util.c, src/plugin-util.h: New, ment for reducing
......
2000-03-26 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
default size is 10 points.
(workbook_create_format_toolbar) : Switch the size selector over to
gtk-combo-text too.
2000-03-26 Almer. S. Tigelaar. <almer1@dds.nl>
* src/plugin-util.c, src/plugin-util.h: New, ment for reducing
......
2000-03-26 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
default size is 10 points.
(workbook_create_format_toolbar) : Switch the size selector over to
gtk-combo-text too.
2000-03-26 Almer. S. Tigelaar. <almer1@dds.nl>
* src/plugin-util.c, src/plugin-util.h: New, ment for reducing
......
2000-03-26 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
default size is 10 points.
(workbook_create_format_toolbar) : Switch the size selector over to
gtk-combo-text too.
2000-03-26 Almer. S. Tigelaar. <almer1@dds.nl>
* src/plugin-util.c, src/plugin-util.h: New, ment for reducing
......
2000-03-26 Jody Goldberg <jgoldberg@home.com>
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
default size is 10 points.
(workbook_create_format_toolbar) : Switch the size selector over to
gtk-combo-text too.
2000-03-26 Almer. S. Tigelaar. <almer1@dds.nl>
* src/plugin-util.c, src/plugin-util.h: New, ment for reducing
......
......@@ -856,6 +856,12 @@ cmd_format_redo (GnumericCommand *cmd, CommandContext *context)
}
}
#if 0
/* FIXME : finish this. */
if (mstyle_is_element_set (me->new_style, MSTYLE_FONT_SIZE))
sheet_selection_height_update (sheet);
#endif
sheet_set_dirty (me->sheet, TRUE);
sheet_update (me->sheet);
......
......@@ -14,7 +14,7 @@
GList *gnumeric_font_family_list = NULL;
GList *gnumeric_point_size_list = NULL;
int gnumeric_point_sizes [] = {
int const gnumeric_point_sizes [] = {
4, 8, 9, 10, 11, 12, 14, 16, 18,
20, 22, 24, 26, 28, 36, 48, 72,
0
......
......@@ -3,7 +3,7 @@
extern GList *gnumeric_font_family_list;
extern GList *gnumeric_point_size_list;
extern int gnumeric_point_sizes [];
extern int const gnumeric_point_sizes [];
void global_gnome_font_init (void);
void global_gnome_font_shutdown (void);
......
2000-03-26 Jody Goldberg <jgoldberg@home.com>
* gtk-combo-text.c : Add a hash to be used for proper lookup of
entries made directly in the edit area. Yes morten it leaks.
(gtk_combo_text_construct) : Make scrolling
optional.
(gtk_combo_text_add_item) : Add some brute force mouse over effects.
Still need autoscroll, and cancel.
2000-03-25 Jody Goldberg <jgoldberg@home.com>
* widget-color-combo.c (color_table_setup) : Init the new custom_color data.
......
......@@ -50,7 +50,7 @@ list_select_cb (GtkWidget *caller, gpointer data)
(GTK_OBJECT (caller), "value");
g_return_if_fail (entry && value);
gtk_entry_set_text (entry, value);
gtk_signal_emit_by_name (GTK_OBJECT (entry), "activate");
......@@ -58,62 +58,100 @@ list_select_cb (GtkWidget *caller, gpointer data)
}
void
gtk_combo_text_construct (GtkComboText *combo_text)
gtk_combo_text_select_item (GtkComboText *ct, int elem)
{
GtkWidget *entry, *list, *scroll;
entry = combo_text->entry = gtk_entry_new ();
list = combo_text->list = gtk_list_new ();
scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scroll), list);
gtk_widget_set_usize (scroll, 0, 200); /* MAGIC NUMBER */
gtk_widget_show (entry);
gtk_widget_show (scroll);
gtk_combo_box_construct (GTK_COMBO_BOX (combo_text), entry, scroll);
gtk_list_select_item (GTK_LIST(ct->list), elem);
}
GtkWidget*
gtk_combo_text_new ()
/* FIXME : This is over kill. There must be a more elegant way of handling
* this.
*
* TODO : Add autoscroll
* TODO : Cancel the popup when 'Escape' is pressed.
*/
static gboolean
cb_enter (GtkWidget *w, GdkEventCrossing *event,
gpointer user)
{
GtkComboText *combo_text;
combo_text = gtk_type_new (gtk_combo_text_get_type ());
gtk_combo_text_construct (combo_text);
return GTK_WIDGET (combo_text);
gtk_widget_set_state (w, GTK_STATE_ACTIVE);
return TRUE;
}
void
gtk_combo_text_select_item (GtkComboText *combo_text, int elem)
static gboolean
cb_exit (GtkWidget *w, GdkEventCrossing *event,
gpointer user)
{
gtk_list_select_item (GTK_LIST(combo_text->list), elem);
gtk_widget_set_state (w, GTK_STATE_NORMAL);
return TRUE;
}
void
gtk_combo_text_add_item (GtkComboText *combo_text,
gtk_combo_text_add_item (GtkComboText *ct,
const gchar *item,
const gchar *value)
{
GtkWidget *listitem;
gchar *value_copy;
g_return_if_fail (item);
if (!value)
value = item;
value_copy = g_strdup (value);
g_hash_table_insert (ct->elements, (gpointer)value_copy,
GINT_TO_POINTER (g_hash_table_size (ct->elements)));
listitem = gtk_list_item_new_with_label (item);
gtk_widget_show (listitem);
gtk_object_set_data_full (GTK_OBJECT (listitem), "value",
g_strdup (value), g_free);
value_copy, g_free);
gtk_signal_connect (GTK_OBJECT (listitem), "select",
GTK_SIGNAL_FUNC (list_select_cb),
(gpointer) combo_text);
gtk_container_add (GTK_CONTAINER (combo_text->list),
(gpointer) ct);
gtk_signal_connect (GTK_OBJECT (listitem), "enter-notify-event",
GTK_SIGNAL_FUNC (cb_enter),
(gpointer) ct);
gtk_signal_connect (GTK_OBJECT (listitem), "leave-notify-event",
GTK_SIGNAL_FUNC (cb_exit),
(gpointer) ct);
gtk_container_add (GTK_CONTAINER (ct->list),
listitem);
}
static void
gtk_combo_text_construct (GtkComboText *ct, gboolean const is_scrolled)
{
GtkWidget *entry, *list, *scroll, *display_widget;
ct->elements = g_hash_table_new (&g_str_hash,
&g_str_equal);
entry = ct->entry = gtk_entry_new ();
list = ct->list = gtk_list_new ();
if (is_scrolled) {
display_widget = scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scroll), list);
gtk_widget_set_usize (scroll, 0, 200); /* MAGIC NUMBER */
} else
display_widget = list;
gtk_widget_show (display_widget);
gtk_widget_show (entry);
gtk_combo_box_construct (GTK_COMBO_BOX (ct), entry, display_widget);
}
GtkWidget*
gtk_combo_text_new (gboolean const is_scrolled)
{
GtkComboText *ct;
ct = gtk_type_new (gtk_combo_text_get_type ());
gtk_combo_text_construct (ct, is_scrolled);
return GTK_WIDGET (ct);
}
......@@ -17,6 +17,7 @@ struct _GtkComboText {
GtkWidget *entry;
GtkWidget *list;
GtkWidget *scrolled_window;
GHashTable*elements;
};
struct _GtkComboTextClass {
......@@ -25,8 +26,7 @@ struct _GtkComboTextClass {
GtkType gtk_combo_text_get_type (void);
void gtk_combo_text_construct (GtkComboText *combo_text);
GtkWidget *gtk_combo_text_new();
GtkWidget *gtk_combo_text_new(gboolean const is_scrolled);
void gtk_combo_text_select_item (GtkComboText *combo_text,
int elem);
......
......@@ -166,7 +166,7 @@ change_font_size_in_selection_cmd (GtkEntry *entry, Workbook *wb)
size = atof (gtk_entry_get_text (entry));
if (size < 0.0) {
gtk_entry_set_text (entry, "12");
gtk_entry_set_text (entry, "10");
return;
}
......@@ -175,7 +175,10 @@ change_font_size_in_selection_cmd (GtkEntry *entry, Workbook *wb)
cmd_format (workbook_command_context_gui (wb),
sheet, mstyle, NULL);
/* FIXME : This should be part of cmd_format */
sheet_selection_height_update (sheet);
workbook_focus_current_sheet (sheet->workbook);
}
......@@ -389,11 +392,11 @@ workbook_format_toolbar_orient (GtkToolbar *toolbar,
Workbook *wb = closure;
if (dir == GTK_ORIENTATION_HORIZONTAL) {
gtk_widget_show (wb->priv->option_menu);
gtk_widget_show (wb->priv->size_widget);
gtk_widget_show (wb->priv->font_name_selector);
gtk_widget_show (wb->priv->font_size_selector);
} else {
gtk_widget_hide (wb->priv->option_menu);
gtk_widget_hide (wb->priv->size_widget);
gtk_widget_hide (wb->priv->font_name_selector);
gtk_widget_hide (wb->priv->font_size_selector);
}
}
......@@ -519,10 +522,10 @@ cb_border_changed (PixmapCombo *pixmap_combo, int index, Workbook *wb)
GtkWidget *
workbook_create_format_toolbar (Workbook *wb)
{
GtkWidget *menu, *toolbar, *fontsel, *entry;
GtkWidget *toolbar, *fontsel, *fontsize, *entry;
const char *name = "FormatToolbar";
GList *l;
int len;
int i, len;
toolbar = gnumeric_toolbar_new (
workbook_format_toolbar, wb);
......@@ -537,14 +540,13 @@ workbook_create_format_toolbar (Workbook *wb)
/*
* Create a font name selector
*/
fontsel = wb->priv->option_menu = gtk_combo_text_new ();
fontsel = wb->priv->font_name_selector = gtk_combo_text_new (TRUE);
if (!gnome_preferences_get_toolbar_relief_btn ())
gtk_combo_box_set_arrow_relief (GTK_COMBO_BOX (fontsel), GTK_RELIEF_NONE);
entry = GTK_COMBO_TEXT (fontsel)->entry;
gtk_signal_connect (GTK_OBJECT (entry), "activate",
GTK_SIGNAL_FUNC (change_font_in_selection_cmd), wb);
gtk_container_set_border_width (GTK_CONTAINER (wb->priv->option_menu), 0);
menu = gtk_menu_new ();
gtk_container_set_border_width (GTK_CONTAINER (fontsel), 0);
/* An empty item for the case of no font that applies */
gtk_combo_text_add_item(GTK_COMBO_TEXT (fontsel), "", "");
......@@ -561,33 +563,38 @@ workbook_create_format_toolbar (Workbook *wb)
gtk_widget_set_usize (entry, len, 0);
/* Add it to the toolbar */
gtk_widget_show (wb->priv->option_menu);
gtk_toolbar_insert_widget (
GTK_TOOLBAR (toolbar), wb->priv->option_menu,
_("Font selector"), NULL, 0);
gtk_signal_connect (
GTK_OBJECT(toolbar), "orientation-changed",
GTK_SIGNAL_FUNC (&workbook_format_toolbar_orient), wb);
gtk_widget_show (fontsel);
gtk_toolbar_insert_widget ( GTK_TOOLBAR (toolbar), fontsel,
_("Font selector"), NULL, 0);
/*
* Create the font size control
*/
wb->priv->size_widget = gtk_entry_new ();
gtk_widget_show (wb->priv->size_widget);
fontsize = wb->priv->font_size_selector = gtk_combo_text_new (TRUE);
if (!gnome_preferences_get_toolbar_relief_btn ())
gtk_combo_box_set_arrow_relief (GTK_COMBO_BOX (fontsize), GTK_RELIEF_NONE);
entry = GTK_COMBO_TEXT (fontsize)->entry;
gtk_signal_connect (GTK_OBJECT (entry), "activate",
GTK_SIGNAL_FUNC (change_font_size_in_selection_cmd), wb);
for (i = 0; gnumeric_point_sizes [i] != 0; i++) {
char buffer [12];
g_snprintf (buffer, sizeof(buffer),
"%d", gnumeric_point_sizes [i]);
gtk_combo_text_add_item(GTK_COMBO_TEXT (fontsize), buffer, buffer);
}
len = gdk_string_measure (wb->priv->size_widget->style->font, "000000");
gtk_widget_set_usize (GTK_WIDGET (wb->priv->size_widget), len, 0);
gtk_signal_connect (
GTK_OBJECT (wb->priv->size_widget), "activate",
GTK_SIGNAL_FUNC (change_font_size_in_selection_cmd), wb);
gtk_toolbar_insert_widget (
GTK_TOOLBAR (toolbar),
wb->priv->size_widget, _("Size"), NULL, 1);
/* Set a reasonable default width */
gtk_widget_set_usize (entry, gdk_string_measure (entry->style->font, "888"), 0);
/* Add it to the toolbar */
gtk_widget_show (fontsize);
gtk_toolbar_insert_widget (GTK_TOOLBAR (toolbar), fontsize,
_("Font Size"), NULL, 1);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
/*
* Create the combo boxes
* Create the border combo box.
*/
wb->priv->border_combo = pixmap_combo_new (border_combo_info, 3, 4);
/* default to none */
......@@ -597,36 +604,45 @@ workbook_create_format_toolbar (Workbook *wb)
GTK_SIGNAL_FUNC (cb_border_changed), wb);
disable_focus (wb->priv->border_combo, NULL);
/* Draw an outline for the default */
gtk_toolbar_append_widget (
GTK_TOOLBAR (toolbar),
wb->priv->border_combo, _("Borders"), NULL);
/*
* Create the background colour combo box.
*/
wb->priv->back_combo = color_combo_new (bucket_xpm, _("Clear Background"),
/* Draw an outline for the default */
NULL);
gtk_widget_show (wb->priv->back_combo);
gtk_signal_connect (GTK_OBJECT (wb->priv->back_combo), "changed",
GTK_SIGNAL_FUNC (back_color_changed), wb);
disable_focus (wb->priv->back_combo, NULL);
/* Draw black for the default */
gtk_toolbar_append_widget (
GTK_TOOLBAR (toolbar),
wb->priv->back_combo, _("Background"), NULL);
/*
* Create the font colour combo box.
*/
wb->priv->fore_combo = color_combo_new (font_xpm, _("Automatic"),
/* Draw black for the default */
&gs_black);
gtk_widget_show (wb->priv->fore_combo);
gtk_signal_connect (GTK_OBJECT (wb->priv->fore_combo), "changed",
GTK_SIGNAL_FUNC (fore_color_changed), wb);
disable_focus (wb->priv->fore_combo, NULL);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_append_widget (
GTK_TOOLBAR (toolbar),
wb->priv->border_combo, _("Borders"), NULL);
gtk_toolbar_append_widget (
GTK_TOOLBAR (toolbar),
wb->priv->back_combo, _("Background"), NULL);
gtk_toolbar_append_widget (
GTK_TOOLBAR (toolbar),
wb->priv->fore_combo, _("Foreground"), NULL);
/* Handle orientation changes so that we can hide wide widgets */
gtk_signal_connect (
GTK_OBJECT(toolbar), "orientation-changed",
GTK_SIGNAL_FUNC (&workbook_format_toolbar_orient), wb);
return toolbar;
}
......@@ -707,8 +723,8 @@ workbook_feedback_set (Workbook *workbook, MStyle *style)
workbook_format_halign_feedback_set (workbook, mstyle_get_align_h (style));
g_return_if_fail (mstyle_is_element_set (style, MSTYLE_FONT_SIZE));
sprintf (size_str, "%g", mstyle_get_font_size (style));
gtk_entry_set_text (GTK_ENTRY (workbook->priv->size_widget),
g_snprintf (size_str, sizeof(size_str), "%d", (int)mstyle_get_font_size (style));
gtk_entry_set_text (GTK_ENTRY(GTK_COMBO_TEXT (workbook->priv->font_size_selector)->entry),
size_str);
/*
......@@ -750,12 +766,12 @@ workbook_feedback_set (Workbook *workbook, MStyle *style)
* +1 means, skip over the "undefined font" element
*/
gtk_combo_text_select_item (
GTK_COMBO_TEXT (workbook->priv->option_menu),
GTK_COMBO_TEXT (workbook->priv->font_name_selector),
np+1);
font_set = TRUE;
}
if (!font_set)
gtk_combo_text_select_item (
GTK_COMBO_TEXT (workbook->priv->option_menu),
GTK_COMBO_TEXT (workbook->priv->font_name_selector),
0);
}
......@@ -21,15 +21,8 @@ struct _WorkbookPrivate {
GtkWidget *standard_toolbar;
GtkWidget *format_toolbar;
/*
* GtkOptionMenu for the font selector
*/
GtkWidget *option_menu;
/*
* GtkEntry for the size specifier
*/
GtkWidget *size_widget;
GtkWidget *font_name_selector;
GtkWidget *font_size_selector;
/*
* GtkCombo for the zoomer
......
......@@ -2307,7 +2307,7 @@ workbook_create_standard_toobar (Workbook *wb)
GNOME_DOCK_TOP, 1, 0, 0);
/* Zoom combo box */
zoom = wb->priv->zoom_entry = gtk_combo_text_new ();
zoom = wb->priv->zoom_entry = gtk_combo_text_new (FALSE);
if (!gnome_preferences_get_toolbar_relief_btn ())
gtk_combo_box_set_arrow_relief (GTK_COMBO_BOX (zoom), GTK_RELIEF_NONE);
entry = GTK_COMBO_TEXT (zoom)->entry;
......@@ -2319,7 +2319,7 @@ workbook_create_standard_toobar (Workbook *wb)
(GtkSignalFunc) (change_displayed_zoom_cb), wb);
/* Set a reasonable default width */
len = gdk_string_measure (entry->style->font, "000000");
len = gdk_string_measure (entry->style->font, "%10000");
gtk_widget_set_usize (entry, len, 0);
/* Preset values */
......
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