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

http://bugzilla.gnome.org/show_bug.cgi?id=62109 send a style with only the

2001-10-10  Jody Goldberg <jgoldberg@home.com>

	http://bugzilla.gnome.org/show_bug.cgi?id=62109
	* widget-font-selector.c (reload_preview) : send a style with only the
	  elements that changed, not the entire format.  Only send the signal
	  if something actually changed.
	(font_selected) : signature change for reload_preview.
	(style_selected) : Ditto.
	(size_changed) : Ditto.
	(canvas_size_changed) : Ditto.
	(font_selector_set_value) : Ditto.
	(font_selector_set_style) : Ditto.
	(font_selector_set_strike) : Ditto.
	(font_selector_set_underline) : Ditto.
	(font_selector_set_color) : Ditto.

2001-10-10  Jody Goldberg <jgoldberg@home.com>

	http://bugzilla.gnome.org/show_bug.cgi?id=62109
	* dialog-cell-format.c (cb_font_changed) : Only set elements that
	  changed.

2001-10-10  Jody Goldberg <jgoldberg@home.com>

	* src/mstyle.c (mstyle_merge) : delete.

2001-10-10  Jody Goldberg <jgoldberg@home.com>

	* py-gnumeric.c (py_mstyle_merge_method) : delete.
	(py_MStyle_object_methods) : remove mstyle_merge.
parent 809253d0
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* src/mstyle.c (mstyle_merge) : delete.
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* src/plugin-util.c (gnumeric_fopen) : be smarter about what type of
......
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* src/mstyle.c (mstyle_merge) : delete.
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* src/plugin-util.c (gnumeric_fopen) : be smarter about what type of
......
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* src/mstyle.c (mstyle_merge) : delete.
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* src/plugin-util.c (gnumeric_fopen) : be smarter about what type of
......
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* src/mstyle.c (mstyle_merge) : delete.
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* src/plugin-util.c (gnumeric_fopen) : be smarter about what type of
......
2001-10-10 Jody Goldberg <jgoldberg@home.com>
* py-gnumeric.c (py_mstyle_merge_method) : delete.
(py_MStyle_object_methods) : remove mstyle_merge.
2001-10-07 Jody Goldberg <jgoldberg@home.com>
* Release 0.71
......
......@@ -59,7 +59,6 @@ MStyle:
- get_font_size
- set_wrap_text
- get_wrap_text
- merge
Cell:
Methods:
......@@ -914,8 +913,6 @@ static PyObject *
py_mstyle_set_wrap_text_method (py_MStyle_object *self, PyObject *args);
static PyObject *
py_mstyle_get_wrap_text_method (py_MStyle_object *self, PyObject *args);
static PyObject *
py_mstyle_merge_method (py_MStyle_object *self, PyObject *args);
static struct PyMethodDef py_MStyle_object_methods[] = {
{"set_font_bold", (PyCFunction) py_mstyle_set_font_bold_method, METH_VARARGS},
......@@ -928,7 +925,6 @@ static struct PyMethodDef py_MStyle_object_methods[] = {
{"get_font_size", (PyCFunction) py_mstyle_get_font_size_method, METH_VARARGS},
{"set_wrap_text", (PyCFunction) py_mstyle_set_wrap_text_method, METH_VARARGS},
{"get_wrap_text", (PyCFunction) py_mstyle_get_wrap_text_method, METH_VARARGS},
{"merge", (PyCFunction) py_mstyle_merge_method, METH_VARARGS},
{NULL, NULL}
};
......@@ -1063,21 +1059,6 @@ py_mstyle_get_wrap_text_method (py_MStyle_object *self, PyObject *args)
return Py_BuildValue ("i", mstyle_get_wrap_text (self->mstyle));
}
static PyObject *
py_mstyle_merge_method (py_MStyle_object *self, PyObject *args)
{
py_MStyle_object *other;
if (!PyArg_ParseTuple (args, "O!:merge", &py_MStyle_object_type, &other)) {
return NULL;
}
mstyle_merge (self->mstyle, other->mstyle);
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *
py_MStyle_object_getattr (py_MStyle_object *self, gchar *name)
{
......
2001-10-10 Jody Goldberg <jgoldberg@home.com>
http://bugzilla.gnome.org/show_bug.cgi?id=62109
* dialog-cell-format.c (cb_font_changed) : Only set elements that
changed.
2001-10-10 Andreas J. Guelzow <aguelzow@taliesin.ca>
* Makefile.am : Add anova-one.glade, anova-two.glade, fourier-analysis.glade,
......
......@@ -1202,20 +1202,35 @@ fmt_dialog_init_align_page (FormatState *state)
static void
cb_font_changed (GtkWidget *widget, MStyle *mstyle, FormatState *state)
{
static MStyleElementType const font_types [] = {
MSTYLE_FONT_NAME,
MSTYLE_FONT_SIZE,
MSTYLE_FONT_BOLD,
MSTYLE_FONT_ITALIC,
MSTYLE_FONT_UNDERLINE,
MSTYLE_FONT_STRIKETHROUGH,
MSTYLE_COLOR_FORE
};
int i;
static int const num_font_types = sizeof (font_types) /
sizeof (MStyleElementType);
gboolean changed = FALSE;
g_return_if_fail (state != NULL);
if (!state->enable_edit)
return;
mstyle_replace_element (mstyle, state->result, MSTYLE_FONT_NAME);
mstyle_replace_element (mstyle, state->result, MSTYLE_FONT_SIZE);
mstyle_replace_element (mstyle, state->result, MSTYLE_FONT_BOLD);
mstyle_replace_element (mstyle, state->result, MSTYLE_FONT_ITALIC);
mstyle_replace_element (mstyle, state->result, MSTYLE_FONT_UNDERLINE);
mstyle_replace_element (mstyle, state->result, MSTYLE_FONT_STRIKETHROUGH);
mstyle_replace_element (mstyle, state->result, MSTYLE_COLOR_FORE);
for (i = 0 ; i < num_font_types; i++) {
MStyleElementType const t = font_types [i];
if (mstyle_is_element_set (mstyle, t)) {
mstyle_replace_element (mstyle, state->result, t);
changed = TRUE;
}
}
fmt_dialog_changed (state);
if (changed)
fmt_dialog_changed (state);
}
/*
......
......@@ -687,44 +687,6 @@ mstyle_unref (MStyle *style)
mstyle_destroy (style);
}
/**
* mstyle_merge:
* @master: the master style
* @slave: the slave style
*
* This function removes any style elements from the slave
* that are masked by the master style. Thus eventualy the
* slave style becomes redundant and can be removed.
* NB. if slave->ref_count == 1 we operate on it directly
* otherwise we must copy.
*
* Returns: the masked style.
**/
MStyle *
mstyle_merge (const MStyle *master, MStyle *slave)
{
MStyle *psts;
int i;
g_return_val_if_fail (slave != NULL, NULL);
g_return_val_if_fail (master != NULL, NULL);
psts = slave;
for (i = 0; i < MSTYLE_ELEMENT_MAX; i++) {
if (master->elements[i].type && psts->elements[i].type) {
if (psts->ref_count > 1) {
psts = mstyle_copy (slave);
mstyle_unref (slave);
}
mstyle_element_unref (psts->elements[i]);
psts->elements[i].type = MSTYLE_ELEMENT_UNSET;
}
}
return psts;
}
char *
mstyle_to_string (const MStyle *style)
{
......
......@@ -128,7 +128,6 @@ const char *mstyle_get_validation_msg (const MStyle *st);
gboolean mstyle_visible_in_blank(const MStyle *st);
MStyle *mstyle_merge (const MStyle *master, MStyle *slave);
char *mstyle_to_string (const MStyle *st); /* Debug only ! leaks like a sieve */
void mstyle_dump (const MStyle *st);
......
2001-10-10 Jody Goldberg <jgoldberg@home.com>
http://bugzilla.gnome.org/show_bug.cgi?id=62109
* widget-font-selector.c (reload_preview) : send a style with only the
elements that changed, not the entire format. Only send the signal
if something actually changed.
(font_selected) : signature change for reload_preview.
(style_selected) : Ditto.
(size_changed) : Ditto.
(canvas_size_changed) : Ditto.
(font_selector_set_value) : Ditto.
(font_selector_set_style) : Ditto.
(font_selector_set_strike) : Ditto.
(font_selector_set_underline) : Ditto.
(font_selector_set_color) : Ditto.
2001-10-07 Jody Goldberg <jgoldberg@home.com>
* Release 0.71
......
......@@ -44,9 +44,15 @@ enum {
static guint fs_signals [LAST_SIGNAL] = { 0 };
static void
reload_preview (FontSelector *fs)
reload_preview (FontSelector *fs, MStyle *style)
{
gtk_signal_emit (GTK_OBJECT (fs), fs_signals [FONT_CHANGED], fs->mstyle, NULL);
if (style != NULL) {
MStyle *old = fs->mstyle;
gtk_signal_emit (GTK_OBJECT (fs),
fs_signals [FONT_CHANGED], style);
fs->mstyle = mstyle_copy_merge (old, style);
mstyle_unref (old);
}
gnome_canvas_request_redraw (fs->font_preview_canvas, INT_MIN, INT_MIN,
INT_MAX/2, INT_MAX/2);
......@@ -70,12 +76,14 @@ static void
font_selected (GtkCList *font_list, int col, int row, GdkEvent *event, FontSelector *fs)
{
gchar *text;
MStyle *change;
gtk_clist_get_text (font_list, GPOINTER_TO_INT (font_list->selection->data), 0, &text);
gtk_entry_set_text (GTK_ENTRY (fs->font_name_entry), text);
mstyle_set_font_name (fs->mstyle, text);
reload_preview (fs);
change = mstyle_new ();
mstyle_set_font_name (change, text);
reload_preview (fs, change);
}
static void
......@@ -111,30 +119,31 @@ static char *styles [] = {
static void
style_selected (GtkCList *style_list, int col, int row, GdkEvent *event, FontSelector *fs)
{
MStyle *change = mstyle_new ();
row = GPOINTER_TO_INT (style_list->selection->data);
switch (row) {
case 0:
mstyle_set_font_bold (fs->mstyle, FALSE);
mstyle_set_font_italic (fs->mstyle, FALSE);
mstyle_set_font_bold (change, FALSE);
mstyle_set_font_italic (change, FALSE);
break;
case 1:
mstyle_set_font_bold (fs->mstyle, TRUE);
mstyle_set_font_italic (fs->mstyle, FALSE);
mstyle_set_font_bold (change, TRUE);
mstyle_set_font_italic (change, FALSE);
break;
case 2:
mstyle_set_font_bold (fs->mstyle, TRUE);
mstyle_set_font_italic (fs->mstyle, TRUE);
mstyle_set_font_bold (change, TRUE);
mstyle_set_font_italic (change, TRUE);
break;
case 3:
mstyle_set_font_bold (fs->mstyle, FALSE);
mstyle_set_font_italic (fs->mstyle, TRUE);
mstyle_set_font_bold (change, FALSE);
mstyle_set_font_italic (change, TRUE);
break;
}
gtk_entry_set_text (GTK_ENTRY (fs->font_style_entry), _(styles [row]));
reload_preview (fs);
reload_preview (fs, change);
}
static void
......@@ -177,8 +186,9 @@ size_changed (GtkEntry *entry, FontSelector *fs)
text = gtk_entry_get_text (entry);
size = atof (text);
if (size >= 1. && size < 128) {
mstyle_set_font_size (fs->mstyle, size);
reload_preview (fs);
MStyle *change = mstyle_new ();
mstyle_set_font_size (change, size);
reload_preview (fs, change);
}
}
......@@ -243,7 +253,7 @@ canvas_size_changed (GtkWidget *widget, GtkAllocation *allocation, FontSelector
gnome_canvas_set_scroll_region (fs->font_preview_canvas, 0, 0,
fs->width, fs->height);
reload_preview (fs);
reload_preview (fs, NULL);
}
static void
......@@ -389,7 +399,7 @@ font_selector_set_value (FontSelector *fs, const Value *v)
else
fs->value = value_new_string ("AaBbCcDdEe12345");
reload_preview (fs);
reload_preview (fs, NULL);
}
void
......@@ -419,6 +429,7 @@ font_selector_set_style (FontSelector *fs,
gboolean is_italic)
{
int n;
MStyle *change;
g_return_if_fail (fs != NULL);
g_return_if_fail (IS_FONT_SELECTOR (fs));
......@@ -436,39 +447,46 @@ font_selector_set_style (FontSelector *fs,
}
select_row (fs->font_style_list, n);
mstyle_set_font_bold (fs->mstyle, is_bold);
mstyle_set_font_italic (fs->mstyle, is_italic);
reload_preview (fs);
change = mstyle_new ();
mstyle_set_font_bold (change, is_bold);
mstyle_set_font_italic (change, is_italic);
reload_preview (fs, change);
}
void
font_selector_set_strike (FontSelector *fs, gboolean strikethrough)
{
MStyle *change;
g_return_if_fail (fs != NULL);
g_return_if_fail (IS_FONT_SELECTOR (fs));
mstyle_set_font_strike (fs->mstyle, strikethrough);
reload_preview (fs);
change = mstyle_new ();
mstyle_set_font_strike (change, strikethrough);
reload_preview (fs, change);
}
void
font_selector_set_underline (FontSelector *fs, StyleUnderlineType sut)
font_selector_set_underline (FontSelector *fs, StyleUnderlineType underline)
{
MStyle *change;
g_return_if_fail (fs != NULL);
g_return_if_fail (IS_FONT_SELECTOR (fs));
mstyle_set_font_uline (fs->mstyle, sut);
reload_preview (fs);
change = mstyle_new ();
mstyle_set_font_uline (change, underline);
reload_preview (fs, change);
}
void
font_selector_set_color (FontSelector *fs, StyleColor *color)
{
MStyle *change;
g_return_if_fail (fs != NULL);
g_return_if_fail (IS_FONT_SELECTOR (fs));
mstyle_set_color (fs->mstyle, MSTYLE_COLOR_FORE, color);
reload_preview (fs);
change = mstyle_new ();
mstyle_set_color (change, MSTYLE_COLOR_FORE, color);
reload_preview (fs, change);
}
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