Commit 255ee961 authored by Jon K Hellan's avatar Jon K Hellan Committed by Jon Kåre Hellan

Use gnumeric_clist_moveto to ensure that selected tool is visible.

2000-05-10  Jon K Hellan  <hellan@acm.org>

	* src/dialogs/dialog-analysis-tools.c (dialog_data_analysis):
	Use gnumeric_clist_moveto to ensure that selected tool is visible.

	* src/dialogs/dialog-function-select.c (category_list_fill):
	s/current sheet/selected category/
	(function_list_fill): s/category/function/

	* src/dialogs/dialog-zoom.c (dialog_zoom_impl):
	s/selected function/current sheet/

	* src/dialogs/dialog-cell-format.c (fmt_dialog_init_format_page):
	Use gnumeric_clist_make_selection_visible to ensure that list rows
	are visible.

	* src/dialogs/dialog-sheet-order.c (dialog_sheet_order_impl):
	s/list rows/current sheet/

	* src/gnumeric-util.c (clist_moveto): New helper function scroll
	list so that row becomes visible.
	(cb_clist_moveto): New callback function:
	Disconnect callback and use clist_moveto to make row visible.

	* src/gnumeric-util.[ch] (gnumeric_clist_moveto): New public
	function: Make given row visible in list - immediately if mapped,
	otherwise by attaching a signal handler.
	(gnumeric_clist_make_selection_visible): New public function: Make
	first selected row visible in list.

2000-05-10  Jon K Hellan  <hellan@acm.org>

	* src/func.c (tokenized_help_find): This segfaulted if no help was
	available. The test for no help failed because of
	signedness. Fixed it.
parent 7ab47fb1
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/dialogs/dialog-analysis-tools.c (dialog_data_analysis):
Use gnumeric_clist_moveto to ensure that selected tool is visible.
* src/dialogs/dialog-function-select.c (category_list_fill):
s/current sheet/selected category/
(function_list_fill): s/category/function/
* src/dialogs/dialog-zoom.c (dialog_zoom_impl):
s/selected function/current sheet/
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_format_page):
Use gnumeric_clist_make_selection_visible to ensure that list rows
are visible.
* src/dialogs/dialog-sheet-order.c (dialog_sheet_order_impl):
s/list rows/current sheet/
* src/gnumeric-util.c (clist_moveto): New helper function scroll
list so that row becomes visible.
(cb_clist_moveto): New callback function:
Disconnect callback and use clist_moveto to make row visible.
* src/gnumeric-util.[ch] (gnumeric_clist_moveto): New public
function: Make given row visible in list - immediately if mapped,
otherwise by attaching a signal handler.
(gnumeric_clist_make_selection_visible): New public function: Make
first selected row visible in list.
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/func.c (tokenized_help_find): This segfaulted if no help was
available. The test for no help failed because of
signedness. Fixed it.
2000-05-10 Michael Meeks <michael@helixcode.com>
* gnumeric.oafinfo: fix borked magic sodding UUID's which suck.
......
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/dialogs/dialog-analysis-tools.c (dialog_data_analysis):
Use gnumeric_clist_moveto to ensure that selected tool is visible.
* src/dialogs/dialog-function-select.c (category_list_fill):
s/current sheet/selected category/
(function_list_fill): s/category/function/
* src/dialogs/dialog-zoom.c (dialog_zoom_impl):
s/selected function/current sheet/
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_format_page):
Use gnumeric_clist_make_selection_visible to ensure that list rows
are visible.
* src/dialogs/dialog-sheet-order.c (dialog_sheet_order_impl):
s/list rows/current sheet/
* src/gnumeric-util.c (clist_moveto): New helper function scroll
list so that row becomes visible.
(cb_clist_moveto): New callback function:
Disconnect callback and use clist_moveto to make row visible.
* src/gnumeric-util.[ch] (gnumeric_clist_moveto): New public
function: Make given row visible in list - immediately if mapped,
otherwise by attaching a signal handler.
(gnumeric_clist_make_selection_visible): New public function: Make
first selected row visible in list.
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/func.c (tokenized_help_find): This segfaulted if no help was
available. The test for no help failed because of
signedness. Fixed it.
2000-05-10 Michael Meeks <michael@helixcode.com>
* gnumeric.oafinfo: fix borked magic sodding UUID's which suck.
......
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/dialogs/dialog-analysis-tools.c (dialog_data_analysis):
Use gnumeric_clist_moveto to ensure that selected tool is visible.
* src/dialogs/dialog-function-select.c (category_list_fill):
s/current sheet/selected category/
(function_list_fill): s/category/function/
* src/dialogs/dialog-zoom.c (dialog_zoom_impl):
s/selected function/current sheet/
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_format_page):
Use gnumeric_clist_make_selection_visible to ensure that list rows
are visible.
* src/dialogs/dialog-sheet-order.c (dialog_sheet_order_impl):
s/list rows/current sheet/
* src/gnumeric-util.c (clist_moveto): New helper function scroll
list so that row becomes visible.
(cb_clist_moveto): New callback function:
Disconnect callback and use clist_moveto to make row visible.
* src/gnumeric-util.[ch] (gnumeric_clist_moveto): New public
function: Make given row visible in list - immediately if mapped,
otherwise by attaching a signal handler.
(gnumeric_clist_make_selection_visible): New public function: Make
first selected row visible in list.
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/func.c (tokenized_help_find): This segfaulted if no help was
available. The test for no help failed because of
signedness. Fixed it.
2000-05-10 Michael Meeks <michael@helixcode.com>
* gnumeric.oafinfo: fix borked magic sodding UUID's which suck.
......
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/dialogs/dialog-analysis-tools.c (dialog_data_analysis):
Use gnumeric_clist_moveto to ensure that selected tool is visible.
* src/dialogs/dialog-function-select.c (category_list_fill):
s/current sheet/selected category/
(function_list_fill): s/category/function/
* src/dialogs/dialog-zoom.c (dialog_zoom_impl):
s/selected function/current sheet/
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_format_page):
Use gnumeric_clist_make_selection_visible to ensure that list rows
are visible.
* src/dialogs/dialog-sheet-order.c (dialog_sheet_order_impl):
s/list rows/current sheet/
* src/gnumeric-util.c (clist_moveto): New helper function scroll
list so that row becomes visible.
(cb_clist_moveto): New callback function:
Disconnect callback and use clist_moveto to make row visible.
* src/gnumeric-util.[ch] (gnumeric_clist_moveto): New public
function: Make given row visible in list - immediately if mapped,
otherwise by attaching a signal handler.
(gnumeric_clist_make_selection_visible): New public function: Make
first selected row visible in list.
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/func.c (tokenized_help_find): This segfaulted if no help was
available. The test for no help failed because of
signedness. Fixed it.
2000-05-10 Michael Meeks <michael@helixcode.com>
* gnumeric.oafinfo: fix borked magic sodding UUID's which suck.
......
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/dialogs/dialog-analysis-tools.c (dialog_data_analysis):
Use gnumeric_clist_moveto to ensure that selected tool is visible.
* src/dialogs/dialog-function-select.c (category_list_fill):
s/current sheet/selected category/
(function_list_fill): s/category/function/
* src/dialogs/dialog-zoom.c (dialog_zoom_impl):
s/selected function/current sheet/
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_format_page):
Use gnumeric_clist_make_selection_visible to ensure that list rows
are visible.
* src/dialogs/dialog-sheet-order.c (dialog_sheet_order_impl):
s/list rows/current sheet/
* src/gnumeric-util.c (clist_moveto): New helper function scroll
list so that row becomes visible.
(cb_clist_moveto): New callback function:
Disconnect callback and use clist_moveto to make row visible.
* src/gnumeric-util.[ch] (gnumeric_clist_moveto): New public
function: Make given row visible in list - immediately if mapped,
otherwise by attaching a signal handler.
(gnumeric_clist_make_selection_visible): New public function: Make
first selected row visible in list.
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/func.c (tokenized_help_find): This segfaulted if no help was
available. The test for no help failed because of
signedness. Fixed it.
2000-05-10 Michael Meeks <michael@helixcode.com>
* gnumeric.oafinfo: fix borked magic sodding UUID's which suck.
......
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/dialogs/dialog-analysis-tools.c (dialog_data_analysis):
Use gnumeric_clist_moveto to ensure that selected tool is visible.
* src/dialogs/dialog-function-select.c (category_list_fill):
s/current sheet/selected category/
(function_list_fill): s/category/function/
* src/dialogs/dialog-zoom.c (dialog_zoom_impl):
s/selected function/current sheet/
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_format_page):
Use gnumeric_clist_make_selection_visible to ensure that list rows
are visible.
* src/dialogs/dialog-sheet-order.c (dialog_sheet_order_impl):
s/list rows/current sheet/
* src/gnumeric-util.c (clist_moveto): New helper function scroll
list so that row becomes visible.
(cb_clist_moveto): New callback function:
Disconnect callback and use clist_moveto to make row visible.
* src/gnumeric-util.[ch] (gnumeric_clist_moveto): New public
function: Make given row visible in list - immediately if mapped,
otherwise by attaching a signal handler.
(gnumeric_clist_make_selection_visible): New public function: Make
first selected row visible in list.
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/func.c (tokenized_help_find): This segfaulted if no help was
available. The test for no help failed because of
signedness. Fixed it.
2000-05-10 Michael Meeks <michael@helixcode.com>
* gnumeric.oafinfo: fix borked magic sodding UUID's which suck.
......
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/dialogs/dialog-analysis-tools.c (dialog_data_analysis):
Use gnumeric_clist_moveto to ensure that selected tool is visible.
* src/dialogs/dialog-function-select.c (category_list_fill):
s/current sheet/selected category/
(function_list_fill): s/category/function/
* src/dialogs/dialog-zoom.c (dialog_zoom_impl):
s/selected function/current sheet/
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_format_page):
Use gnumeric_clist_make_selection_visible to ensure that list rows
are visible.
* src/dialogs/dialog-sheet-order.c (dialog_sheet_order_impl):
s/list rows/current sheet/
* src/gnumeric-util.c (clist_moveto): New helper function scroll
list so that row becomes visible.
(cb_clist_moveto): New callback function:
Disconnect callback and use clist_moveto to make row visible.
* src/gnumeric-util.[ch] (gnumeric_clist_moveto): New public
function: Make given row visible in list - immediately if mapped,
otherwise by attaching a signal handler.
(gnumeric_clist_make_selection_visible): New public function: Make
first selected row visible in list.
2000-05-10 Jon K Hellan <hellan@acm.org>
* src/func.c (tokenized_help_find): This segfaulted if no help was
available. The test for no help failed because of
signedness. Fixed it.
2000-05-10 Michael Meeks <michael@helixcode.com>
* gnumeric.oafinfo: fix borked magic sodding UUID's which suck.
......
......@@ -2573,6 +2573,7 @@ dialog_data_analysis (Workbook *wb, Sheet *sheet)
gtk_clist_append (GTK_CLIST (tool_list),
(char **) &tools[i].name);
gtk_clist_select_row (GTK_CLIST (tool_list), selected_row, 0);
gnumeric_clist_moveto (GTK_CLIST (tool_list), selected_row);
gtk_widget_grab_focus (GTK_WIDGET(tool_list));
......
......@@ -894,6 +894,12 @@ fmt_dialog_init_format_page (FormatState *state)
gtk_clist_column_titles_passive (cl);
}
/* Ensure that list rows are visible */
if ((cl = GTK_CLIST (state->format.widget[F_LIST])) != NULL)
gnumeric_clist_make_selection_visible (cl);
if ((cl = GTK_CLIST (state->format.widget[F_NEGATIVE])) != NULL)
gnumeric_clist_make_selection_visible (cl);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (state->format.widget[F_DECIMAL_SPIN]),
state->format.num_decimals);
......
......@@ -50,8 +50,8 @@ category_list_fill (FunctionSelectState *state)
}
gtk_clist_select_row (list, state->selected_cat, 0);
gtk_clist_moveto (list, state->selected_cat, 0, .5, 0.0);
gtk_clist_thaw (list);
gnumeric_clist_moveto (list, state->selected_cat);
}
static void
......@@ -76,8 +76,8 @@ function_list_fill (FunctionSelectState *state)
}
gtk_clist_select_row (list, state->selected_func, 0);
gtk_clist_moveto (list, state->selected_func, 0, .5, 0.0);
gtk_clist_thaw (list);
gnumeric_clist_moveto (list, state->selected_func);
}
static void
......
......@@ -251,6 +251,7 @@ dialog_sheet_order_impl (Workbook *wb, GladeXML *gui)
GTK_SIGNAL_FUNC (close_clicked_cb), &sm);
populate_sheet_clist (&sm);
gnumeric_clist_make_selection_visible (GTK_CLIST (sm.clist));
if (GTK_CLIST (sm.clist)->rows > 0) {
gtk_widget_grab_focus (sm.clist);
......
......@@ -123,8 +123,8 @@ dialog_zoom_impl (Workbook *wb, Sheet *cur_sheet, GladeXML *gui)
g_list_free (sheets);
gtk_clist_select_row (list, cur_row, 0);
gtk_clist_moveto (list, cur_row, 0, .5, 0.0);
gtk_clist_thaw (list);
gnumeric_clist_moveto (list, cur_row);
dialog = glade_xml_get_widget (gui, "Zoom");
if (dialog == NULL) {
......
......@@ -520,7 +520,7 @@ tokenized_help_find (TokenizedHelp *tok, const char *token)
if (!tok || !tok->sections)
return "Incorrect Function Description.";
for (lp = 0; lp < tok->sections->len-1; lp++) {
for (lp = 0; lp + 1 < tok->sections->len; lp++) {
const char *cmp = g_ptr_array_index (tok->sections, lp);
if (g_strcasecmp (cmp, token) == 0){
......
......@@ -440,6 +440,71 @@ gnumeric_popup_menu (GtkMenu *menu, GdkEventButton *event)
gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button, event->time);
}
/*
* Helper for gnumeric_clist_moveto. Ensures that we move in the same way
* whether direct or from a callback.
*/
static void
clist_moveto (GtkCList *clist, gint row)
{
gtk_clist_moveto (clist, row, 0, 0.1, 0.0);
clist->focus_row = row;
}
/*
* map handler. Disconnects itself and moves the list.
*/
static void
cb_clist_moveto (GtkWidget *clist, gpointer row)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (clist),
GTK_SIGNAL_FUNC (cb_clist_moveto),
row);
clist_moveto (GTK_CLIST (clist), GPOINTER_TO_INT (row));
}
/*
* gnumeric_clist_moveto
* @clist clist
* @row row
*
* Scroll the viewing area of the list to the given row.
* We do it this way because gtk_clist_moveto only works if the list is
* mapped.
*/
void
gnumeric_clist_moveto (GtkCList *clist, gint row)
{
if (GTK_WIDGET_DRAWABLE (clist))
clist_moveto (clist, row);
else
gtk_signal_connect (GTK_OBJECT (clist), "map",
GTK_SIGNAL_FUNC (cb_clist_moveto),
GINT_TO_POINTER (row));
}
/*
* gnumeric_clist_make_selection_visible
* @clist clist
*
* Scroll the viewing area of the list to the first selected row.
*/
void
gnumeric_clist_make_selection_visible (GtkCList *clist)
{
guint selection_length;
g_return_if_fail(GTK_IS_CLIST(clist));
selection_length = g_list_length (clist->selection);
if (selection_length > 0) {
gint row = (gint) clist->selection->data;
gnumeric_clist_moveto (clist, row);
}
}
GtkWidget *
gnumeric_create_tooltip (void)
{
......
......@@ -35,6 +35,12 @@ char *x11_font_change_component (const char *fontname, int idx, const ch
void gnumeric_auto_kill_popup_menu_on_hide (GtkMenu *menu);
void gnumeric_popup_menu (GtkMenu *menu, GdkEventButton *event);
/* Scroll the viewing area of the list to the given row */
void gnumeric_clist_moveto (GtkCList *clist, gint row);
/* Scroll the viewing area of the list to the first selected row */
void gnumeric_clist_make_selection_visible (GtkCList *clist);
/*
* Pseudo-tool-tip support code.
*/
......
......@@ -440,6 +440,71 @@ gnumeric_popup_menu (GtkMenu *menu, GdkEventButton *event)
gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button, event->time);
}
/*
* Helper for gnumeric_clist_moveto. Ensures that we move in the same way
* whether direct or from a callback.
*/
static void
clist_moveto (GtkCList *clist, gint row)
{
gtk_clist_moveto (clist, row, 0, 0.1, 0.0);
clist->focus_row = row;
}
/*
* map handler. Disconnects itself and moves the list.
*/
static void
cb_clist_moveto (GtkWidget *clist, gpointer row)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (clist),
GTK_SIGNAL_FUNC (cb_clist_moveto),
row);
clist_moveto (GTK_CLIST (clist), GPOINTER_TO_INT (row));
}
/*
* gnumeric_clist_moveto
* @clist clist
* @row row
*
* Scroll the viewing area of the list to the given row.
* We do it this way because gtk_clist_moveto only works if the list is
* mapped.
*/
void
gnumeric_clist_moveto (GtkCList *clist, gint row)
{
if (GTK_WIDGET_DRAWABLE (clist))
clist_moveto (clist, row);
else
gtk_signal_connect (GTK_OBJECT (clist), "map",
GTK_SIGNAL_FUNC (cb_clist_moveto),
GINT_TO_POINTER (row));
}
/*
* gnumeric_clist_make_selection_visible
* @clist clist
*
* Scroll the viewing area of the list to the first selected row.
*/
void
gnumeric_clist_make_selection_visible (GtkCList *clist)
{
guint selection_length;
g_return_if_fail(GTK_IS_CLIST(clist));
selection_length = g_list_length (clist->selection);
if (selection_length > 0) {
gint row = (gint) clist->selection->data;
gnumeric_clist_moveto (clist, row);
}
}
GtkWidget *
gnumeric_create_tooltip (void)
{
......
......@@ -35,6 +35,12 @@ char *x11_font_change_component (const char *fontname, int idx, const ch
void gnumeric_auto_kill_popup_menu_on_hide (GtkMenu *menu);
void gnumeric_popup_menu (GtkMenu *menu, GdkEventButton *event);
/* Scroll the viewing area of the list to the given row */
void gnumeric_clist_moveto (GtkCList *clist, gint row);
/* Scroll the viewing area of the list to the first selected row */
void gnumeric_clist_make_selection_visible (GtkCList *clist);
/*
* Pseudo-tool-tip support code.
*/
......
2000-05-10 Jon K Hellan <hellan@acm.org>
* widget-font-selector.c (list_realized): Rename to
list_mapped. List must be mapped before we can move to a list
element. realized is not enough. See gtkclist.c:
vadjustment_value_changed (ca l. 6147).
(fs_fill_font_name_list, fs_fill_font_style_list,
fs_fill_font_size_list): Replace realize signal and list_realized
handler with map and list_mapped.
2000-05-09 Jody Goldberg <jgoldberg@home.com>
* Release 0.53
......
......@@ -79,10 +79,10 @@ reload_preview (FontSelector *fs)
}
/*
* We can not moveto a list element until it is realized.
* We can not moveto a list element until it is mapped.
*/
static void
list_realized (GtkWidget *widget, gpointer user_data)
list_mapped (GtkWidget *widget, gpointer user_data)
{
GtkCList * clist = GTK_CLIST (widget);
int row = 0;
......@@ -121,8 +121,8 @@ fs_fill_font_name_list (FontSelector *fs)
GTK_OBJECT (fs->font_name_list), "select_row",
GTK_SIGNAL_FUNC (font_selected), fs);
gtk_signal_connect (
GTK_OBJECT (fs->font_name_list), "realize",
GTK_SIGNAL_FUNC (list_realized), NULL);
GTK_OBJECT (fs->font_name_list), "map",
GTK_SIGNAL_FUNC (list_mapped), NULL);
}
static char *styles [] = {
......@@ -176,8 +176,8 @@ fs_fill_font_style_list (FontSelector *fs)
GTK_OBJECT (fs->font_style_list), "select_row",
GTK_SIGNAL_FUNC(style_selected), fs);
gtk_signal_connect (
GTK_OBJECT (fs->font_name_list), "realize",
GTK_SIGNAL_FUNC(list_realized), NULL);
GTK_OBJECT (fs->font_style_list), "map",
GTK_SIGNAL_FUNC(list_mapped), NULL);
}
static void
......@@ -221,9 +221,9 @@ fs_fill_font_size_list (FontSelector *fs)
gtk_signal_connect (
GTK_OBJECT (fs->font_size_list), "select_row",
GTK_SIGNAL_FUNC(size_selected), fs);
gtk_signal_connect (
GTK_OBJECT (fs->font_name_list), "realize",
GTK_SIGNAL_FUNC (list_realized), NULL);
gtk_signal_connect (
GTK_OBJECT (fs->font_size_list), "map",
GTK_SIGNAL_FUNC (list_mapped), NULL);
gtk_signal_connect (
GTK_OBJECT (fs->font_size_entry), "changed",
......
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