Commit b3e9a312 authored by ERDI Gergo's avatar ERDI Gergo Committed by ÉRDI Gergo

Added myself to the contributors list

2000-02-01  ERDI Gergo  <cactus@cactus.rulez.org>

	* src/about.c (dialog_about): Added myself to the contributors list

	* src/widgets/gtk-combo-box.c (gtk_combo_box_popup_hide):
	explicitly cast function pointers to avoid a warning

	* src/solver-lp.c (simplex_step_three): Default value for `min' to
	eliminate a warning

	* src/dialogs/dialog-advanced-filter.c: Included ranges.h
	(removing an `implicit declaration' warning)

	* src/commands.c: Included `dialogs.h'

	* src/workbook.c (workbook_standard_toolbar_orient): Hide the zoom
	combo box on vertical toolbars

	* src/widgets/gtk-combo-text.[ch]: New widget: easy-to-use combo box

2000-01-28  ERDI Gergo  <cactus@cactus.rulez.org>

	* src/workbook.c (workbook_create_standard_toobar): Added a zoom
	button to the toolbar as requested
parent 045c02d4
2000-02-01 ERDI Gergo <cactus@cactus.rulez.org>
* src/about.c (dialog_about): Added myself to the contributors list
* src/widgets/gtk-combo-box.c (gtk_combo_box_popup_hide):
explicitly cast function pointers to avoid a warning
* src/solver-lp.c (simplex_step_three): Default value for `min' to
eliminate a warning
* src/dialogs/dialog-advanced-filter.c: Included ranges.h
(removing an `implicit declaration' warning)
* src/commands.c: Included `dialogs.h'
* src/workbook.c (workbook_standard_toolbar_orient): Hide the zoom
combo box on vertical toolbars
* src/widgets/gtk-combo-text.[ch]: New widget: easy-to-use combo box
2000-01-28 ERDI Gergo <cactus@cactus.rulez.org>
* src/workbook.c (workbook_create_standard_toobar): Added a zoom
button to the toolbar as requested
2000-02-05 JP Rosevear <jpr@arcavia.com>
* src/commands.h : Fix typo
......
2000-02-01 ERDI Gergo <cactus@cactus.rulez.org>
* src/about.c (dialog_about): Added myself to the contributors list
* src/widgets/gtk-combo-box.c (gtk_combo_box_popup_hide):
explicitly cast function pointers to avoid a warning
* src/solver-lp.c (simplex_step_three): Default value for `min' to
eliminate a warning
* src/dialogs/dialog-advanced-filter.c: Included ranges.h
(removing an `implicit declaration' warning)
* src/commands.c: Included `dialogs.h'
* src/workbook.c (workbook_standard_toolbar_orient): Hide the zoom
combo box on vertical toolbars
* src/widgets/gtk-combo-text.[ch]: New widget: easy-to-use combo box
2000-01-28 ERDI Gergo <cactus@cactus.rulez.org>
* src/workbook.c (workbook_create_standard_toobar): Added a zoom
button to the toolbar as requested
2000-02-05 JP Rosevear <jpr@arcavia.com>
* src/commands.h : Fix typo
......
......@@ -43,6 +43,7 @@ dialog_about (Workbook *wb)
N_("Daniel Veillard, XML support."),
N_("Vladimir Vuksan, financial functions."),
N_("Morten Welinder, Gnumeric hacker."),
N_("Gerg rdi, Gnumeric hacker."),
NULL
};
......
......@@ -19,6 +19,7 @@
#include "selection.h"
#include "datetime.h"
#include "colrow.h"
#include "dialogs.h"
/*
* NOTE : This is a work in progress
......
......@@ -129,13 +129,13 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
arrow = combo_box->priv->arrow_button;
gtk_signal_handler_block_by_func (GTK_OBJECT (arrow),
gtk_combo_toggle_pressed,
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (arrow), FALSE);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (arrow),
gtk_combo_toggle_pressed,
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
}
......
......@@ -43,6 +43,7 @@ dialog_about (Workbook *wb)
N_("Daniel Veillard, XML support."),
N_("Vladimir Vuksan, financial functions."),
N_("Morten Welinder, Gnumeric hacker."),
N_("Gerg rdi, Gnumeric hacker."),
NULL
};
......
......@@ -24,4 +24,6 @@ libwidgets_a_SOURCES = \
widget-font-selector.c \
widget-font-selector.h \
gnumeric-dashed-canvas-line.c \
gnumeric-dashed-canvas-line.h
gnumeric-dashed-canvas-line.h \
gtk-combo-text.c \
gtk-combo-text.h
......@@ -129,13 +129,13 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
arrow = combo_box->priv->arrow_button;
gtk_signal_handler_block_by_func (GTK_OBJECT (arrow),
gtk_combo_toggle_pressed,
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (arrow), FALSE);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (arrow),
gtk_combo_toggle_pressed,
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
}
......
......@@ -129,13 +129,13 @@ gtk_combo_box_popup_hide (GtkComboBox *combo_box)
arrow = combo_box->priv->arrow_button;
gtk_signal_handler_block_by_func (GTK_OBJECT (arrow),
gtk_combo_toggle_pressed,
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (arrow), FALSE);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (arrow),
gtk_combo_toggle_pressed,
GTK_SIGNAL_FUNC (gtk_combo_toggle_pressed),
combo_box);
}
......
#include "gtk-combo-text.h"
#include <gtk/gtksignal.h>
#include <gtk/gtkentry.h>
#include <gtk/gtklist.h>
/* static GtkComboBoxClass *gtk_combo_text_parent_class;*/
static void
gtk_combo_text_class_init (GtkObjectClass *class)
{
}
static void
gtk_combo_text_init (GtkComboText *object)
{
}
GtkType
gtk_combo_text_get_type (void)
{
static GtkType type = 0;
if (!type){
GtkTypeInfo info = {
"GtkComboText",
sizeof (GtkComboText),
sizeof (GtkComboTextClass),
(GtkClassInitFunc) gtk_combo_text_class_init,
(GtkObjectInitFunc) gtk_combo_text_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (gtk_combo_box_get_type (), &info);
}
return type;
}
static void
list_select_cb (GtkWidget *caller, gpointer data)
{
GtkComboText *combo = GTK_COMBO_TEXT (data);
GtkEntry *entry = GTK_ENTRY (combo->entry);
gchar *value = (gchar*) gtk_object_get_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");
gtk_combo_box_popup_hide (GTK_COMBO_BOX (combo));
}
void
gtk_combo_text_construct (GtkComboText *combo_text)
{
GtkWidget *entry, *list;
entry = combo_text->entry = gtk_entry_new ();
list = combo_text->list = gtk_list_new ();
gtk_widget_show (entry);
gtk_widget_show (list);
gtk_combo_box_construct (GTK_COMBO_BOX (combo_text), entry, list);
}
GtkWidget*
gtk_combo_text_new ()
{
GtkComboText *combo_text;
combo_text = gtk_type_new (gtk_combo_text_get_type ());
gtk_combo_text_construct (combo_text);
return GTK_WIDGET (combo_text);
}
void
gtk_combo_text_add_item (GtkComboText *combo_text,
const gchar *item,
const gchar *value)
{
GtkWidget *listitem;
g_return_if_fail (item);
if (!value)
value = item;
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);
gtk_signal_connect (GTK_OBJECT (listitem), "select",
GTK_SIGNAL_FUNC (list_select_cb),
(gpointer) combo_text);
gtk_container_add (GTK_CONTAINER (combo_text->list),
listitem);
}
#ifndef _GTK_COMBO_TEXT_H
#define _GTK_COMBO_TEXT_H
#include "gtk-combo-box.h"
#define GTK_COMBO_TEXT(obj) GTK_CHECK_CAST (obj, gtk_combo_text_get_type (), GtkComboText)
#define GTK_COMBO_TEXT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_combo_text_get_type (), GtkComboTextClass)
#define GTK_IS_COMBO_TEXT(obj) GTK_CHECK_TYPE (obj, gtk_combo_text_get_type ())
typedef struct _GtkComboText GtkComboText;
/* typedef struct _GtkComboTextPrivate GtkComboTextPrivate;*/
typedef struct _GtkComboBoxClass GtkComboTextClass;
struct _GtkComboText {
GtkComboBox parent;
GtkWidget *entry;
GtkWidget *list;
};
struct _GtkComboTextClass {
GtkComboBoxClass parent_class;
};
GtkType gtk_combo_text_get_type (void);
void gtk_combo_text_construct (GtkComboText *combo_text);
GtkWidget *gtk_combo_text_new();
void gtk_combo_text_add_item (GtkComboText *combo_text,
const gchar *item,
const gchar *value);
#endif
......@@ -125,6 +125,9 @@ typedef struct {
#else
GtkObjectClass gtk_parent_class;
#endif
/* Signals */
void (* sheet_changed) (Sheet *sh);
} WorkbookClass;
GtkType workbook_get_type (void);
......
......@@ -31,6 +31,11 @@ struct _WorkbookPrivate {
*/
GtkWidget *size_widget;
/*
* GtkCombo for the zoomer
*/
GtkWidget *zoom_entry;
/*
* ColorCombos for the foreground and background
*/
......
......@@ -33,6 +33,7 @@
#include "workbook-view.h"
#include "command-context-gui.h"
#include "commands.h"
#include "widgets/gtk-combo-text.h"
#ifdef ENABLE_BONOBO
#include <bonobo/bonobo-persist-file.h>
......@@ -57,6 +58,16 @@ static GList *workbook_list = NULL;
static WORKBOOK_PARENT_CLASS *workbook_parent_class;
/* Workbook signals */
enum {
SHEET_CHANGED,
LAST_SIGNAL
};
static gint workbook_signals [LAST_SIGNAL] = {
0, /* SHEET_CHANGED */
};
static void workbook_set_focus (GtkWindow *window, GtkWidget *focus, Workbook *wb);
static int workbook_can_close (Workbook *wb);
......@@ -1409,6 +1420,8 @@ workbook_focus_current_sheet (Workbook *wb)
gtk_window_set_focus (GTK_WINDOW (wb->toplevel), sheet_view->sheet_view);
gtk_signal_emit (GTK_OBJECT (wb), workbook_signals[SHEET_CHANGED], sheet);
wb->current_sheet = sheet;
} else
g_warning ("There is no current sheet in this workbook");
......@@ -2064,6 +2077,20 @@ static void
workbook_class_init (GtkObjectClass *object_class)
{
workbook_parent_class = gtk_type_class (WORKBOOK_PARENT_CLASS_TYPE);
workbook_signals [SHEET_CHANGED] =
gtk_signal_new (
"sheet_changed",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (WorkbookClass,
sheet_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE,
1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, workbook_signals, LAST_SIGNAL);
object_class->destroy = workbook_destroy;
}
......@@ -2094,6 +2121,46 @@ workbook_get_type (void)
return type;
}
static void
change_zoom_in_current_sheet_cb (GtkWidget *caller, Workbook *wb)
{
int factor = atoi (gtk_entry_get_text (GTK_ENTRY (caller)));
sheet_set_zoom_factor(wb->current_sheet, (double)factor / 100);
}
static void
change_displayed_zoom_cb (GtkObject *caller, Sheet* sheet, gpointer data)
{
GtkWidget *combo;
gchar *str;
int factor = (int) (sheet->last_zoom_factor_used * 100);
g_return_if_fail (combo = WORKBOOK (caller)->priv->zoom_entry);
str = g_strdup_printf("%d", factor);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO_TEXT (combo)->entry),
str);
g_free (str);
}
/*
* Hide/show some toolbar items depending on the toolbar orientation
*/
static void
workbook_standard_toolbar_orient (GtkToolbar *toolbar,
GtkOrientation orientation,
gpointer data)
{
Workbook* wb = (Workbook*)data;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_widget_show (wb->priv->zoom_entry);
else
gtk_widget_hide (wb->priv->zoom_entry);
}
/*
* These create toolbar routines are kept independent, as they
* will need some manual customization in the future (like adding
......@@ -2102,7 +2169,21 @@ workbook_get_type (void)
static GtkWidget *
workbook_create_standard_toobar (Workbook *wb)
{
GtkWidget *toolbar;
#define NUM_PRESET_ZOOM 5
#define DEF_PRESET_ZOOM 1
static struct {
char const * const name;
char const * const factor;
} preset_zoom[NUM_PRESET_ZOOM] = {
{ "200%", "200" },
{ "100%", "100" },
{ "75%", "75" },
{ "50%", "50" },
{ "25%", "25" },
};
int i, len;
GtkWidget *toolbar, *zoom, *entry;
const char *name = "StandardToolbar";
......@@ -2115,7 +2196,41 @@ workbook_create_standard_toobar (Workbook *wb)
GNOME_DOCK_ITEM_BEH_NORMAL,
GNOME_DOCK_TOP, 1, 0, 0);
/* Zoom combo box */
zoom = wb->priv->zoom_entry = gtk_combo_text_new ();
entry = GTK_COMBO_TEXT (zoom)->entry;
gtk_signal_connect (GTK_OBJECT (entry), "activate",
GTK_SIGNAL_FUNC (change_zoom_in_current_sheet_cb), wb);
/* Change the value when the displayed sheet is changed */
gtk_signal_connect (GTK_OBJECT (wb), "sheet_changed",
(GtkSignalFunc) (change_displayed_zoom_cb), NULL);
/* Set a reasonable default width */
len = gdk_string_measure (entry->style->font, "000000");
gtk_widget_set_usize (entry, len, 0);
/* Preset values */
for (i = 0; i < NUM_PRESET_ZOOM; i++)
{
gtk_combo_text_add_item(GTK_COMBO_TEXT (zoom),
preset_zoom[i].name,
preset_zoom[i].factor);
}
/* Add it to the toolbar */
gtk_widget_show (zoom);
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar),
zoom, _("Zoom"), NULL);
gtk_signal_connect (
GTK_OBJECT(toolbar), "orientation-changed",
GTK_SIGNAL_FUNC (&workbook_standard_toolbar_orient), wb);
return toolbar;
#undef NUM_PRESET_ZOOM
#undef DEF_PRESET_ZOOM
}
static void
......
......@@ -125,6 +125,9 @@ typedef struct {
#else
GtkObjectClass gtk_parent_class;
#endif
/* Signals */
void (* sheet_changed) (Sheet *sh);
} WorkbookClass;
GtkType workbook_get_type (void);
......
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