gtkhtml r9099 - branches/gnome-2-24/components/editor
- From: mbarnes svn gnome org
- To: svn-commits-list gnome org
- Subject: gtkhtml r9099 - branches/gnome-2-24/components/editor
- Date: Mon, 12 Jan 2009 04:53:33 +0000 (UTC)
Author: mbarnes
Date: Mon Jan 12 04:53:33 2009
New Revision: 9099
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=9099&view=rev
Log:
2009-01-12 Matthew Barnes <mbarnes redhat com>
** Fixes bug #566014
* gtkhtml-color-combo.c:
* gtkhtml-color-state.c:
New 'default-transparent' boolean property indicates the default
color should be treated as transparent.
* gtkhtml-color-combo.c (color_combo_notify_current_color_cb):
Set the color swatch color to NULL if the default color was chosen
and the 'default-transparent' property is TRUE.
* gtkhtml-color-swatch.c (gtkhtml_color_swatch_set_color):
Allow color to be NULL.
* gtkhtml-editor-signals.c (cell_properties_set_background_color_cb),
gtkhtml_editor_table_properties_color_changed_cb):
Treat the default color as transparent.
* gtkhtml-editor-signals.c
gtkhtml_editor_cell_properties_show_window_cb),
gtkhtml_editor_table_properties_show_window_cb):
Initialize the color combo.
Modified:
branches/gnome-2-24/components/editor/ChangeLog
branches/gnome-2-24/components/editor/gtkhtml-color-combo.c
branches/gnome-2-24/components/editor/gtkhtml-color-combo.h
branches/gnome-2-24/components/editor/gtkhtml-color-state.c
branches/gnome-2-24/components/editor/gtkhtml-color-state.h
branches/gnome-2-24/components/editor/gtkhtml-color-swatch.c
branches/gnome-2-24/components/editor/gtkhtml-editor-signals.c
branches/gnome-2-24/components/editor/gtkhtml-editor.glade
Modified: branches/gnome-2-24/components/editor/gtkhtml-color-combo.c
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-color-combo.c (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-color-combo.c Mon Jan 12 04:53:33 2009
@@ -39,6 +39,7 @@
PROP_CURRENT_COLOR,
PROP_DEFAULT_COLOR,
PROP_DEFAULT_LABEL,
+ PROP_DEFAULT_TRANSPARENT,
PROP_PALETTE,
PROP_POPUP_SHOWN,
PROP_STATE
@@ -128,8 +129,12 @@
GdkColor color;
swatch = GTKHTML_COLOR_SWATCH (combo->priv->swatch);
- gtkhtml_color_combo_get_current_color (combo, &color);
- gtkhtml_color_swatch_set_color (swatch, &color);
+ if (gtkhtml_color_combo_get_current_color (combo, &color))
+ gtkhtml_color_swatch_set_color (swatch, &color);
+ else if (gtkhtml_color_combo_get_default_transparent (combo))
+ gtkhtml_color_swatch_set_color (swatch, NULL);
+ else
+ gtkhtml_color_swatch_set_color (swatch, &color);
g_signal_emit (G_OBJECT (combo), signals[CHANGED], 0);
}
@@ -443,6 +448,12 @@
g_value_get_string (value));
return;
+ case PROP_DEFAULT_TRANSPARENT:
+ gtkhtml_color_combo_set_default_transparent (
+ GTKHTML_COLOR_COMBO (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_PALETTE:
gtkhtml_color_combo_set_palette (
GTKHTML_COLOR_COMBO (object),
@@ -498,6 +509,13 @@
GTKHTML_COLOR_COMBO (object)));
return;
+ case PROP_DEFAULT_TRANSPARENT:
+ g_value_set_boolean (
+ value,
+ gtkhtml_color_combo_get_default_transparent (
+ GTKHTML_COLOR_COMBO (object)));
+ return;
+
case PROP_PALETTE:
g_value_set_object (
value, gtkhtml_color_combo_get_palette (
@@ -719,6 +737,17 @@
g_object_class_install_property (
object_class,
+ PROP_DEFAULT_TRANSPARENT,
+ g_param_spec_boolean (
+ "default-transparent",
+ "Default is transparent",
+ "Whether the default color is transparent",
+ FALSE,
+ G_PARAM_CONSTRUCT |
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_PALETTE,
g_param_spec_object (
"palette",
@@ -1073,6 +1102,24 @@
gtkhtml_color_state_set_default_label (combo->priv->state, text);
}
+gboolean
+gtkhtml_color_combo_get_default_transparent (GtkhtmlColorCombo *combo)
+{
+ g_return_val_if_fail (GTKHTML_IS_COLOR_COMBO (combo), FALSE);
+
+ return gtkhtml_color_state_get_default_transparent (combo->priv->state);
+}
+
+void
+gtkhtml_color_combo_set_default_transparent (GtkhtmlColorCombo *combo,
+ gboolean transparent)
+{
+ g_return_if_fail (GTKHTML_IS_COLOR_COMBO (combo));
+
+ gtkhtml_color_state_set_default_transparent (
+ combo->priv->state, transparent);
+}
+
GtkhtmlColorPalette *
gtkhtml_color_combo_get_palette (GtkhtmlColorCombo *combo)
{
Modified: branches/gnome-2-24/components/editor/gtkhtml-color-combo.h
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-color-combo.h (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-color-combo.h Mon Jan 12 04:53:33 2009
@@ -86,6 +86,11 @@
void gtkhtml_color_combo_set_default_label
(GtkhtmlColorCombo *combo,
const gchar *text);
+gboolean gtkhtml_color_combo_get_default_transparent
+ (GtkhtmlColorCombo *combo);
+void gtkhtml_color_combo_set_default_transparent
+ (GtkhtmlColorCombo *combo,
+ gboolean transparent);
GtkhtmlColorPalette *
gtkhtml_color_combo_get_palette (GtkhtmlColorCombo *combo);
void gtkhtml_color_combo_set_palette (GtkhtmlColorCombo *combo,
Modified: branches/gnome-2-24/components/editor/gtkhtml-color-state.c
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-color-state.c (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-color-state.c Mon Jan 12 04:53:33 2009
@@ -31,6 +31,7 @@
PROP_CURRENT_COLOR,
PROP_DEFAULT_COLOR,
PROP_DEFAULT_LABEL,
+ PROP_DEFAULT_TRANSPARENT,
PROP_PALETTE
};
@@ -45,6 +46,7 @@
gchar *default_label;
GtkhtmlColorPalette *palette;
gulong palette_handler_id;
+ gboolean default_transparent;
};
static gpointer parent_class;
@@ -83,6 +85,12 @@
g_value_get_string (value));
return;
+ case PROP_DEFAULT_TRANSPARENT:
+ gtkhtml_color_state_set_default_transparent (
+ GTKHTML_COLOR_STATE (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_PALETTE:
gtkhtml_color_state_set_palette (
GTKHTML_COLOR_STATE (object),
@@ -120,6 +128,13 @@
GTKHTML_COLOR_STATE (object)));
return;
+ case PROP_DEFAULT_TRANSPARENT:
+ g_value_set_boolean (
+ value,
+ gtkhtml_color_state_get_default_transparent (
+ GTKHTML_COLOR_STATE (object)));
+ return;
+
case PROP_PALETTE:
g_value_set_object (
value, gtkhtml_color_state_get_palette (
@@ -216,6 +231,17 @@
g_object_class_install_property (
object_class,
+ PROP_DEFAULT_TRANSPARENT,
+ g_param_spec_boolean (
+ "default-transparent",
+ "Default is transparent",
+ "Whether the default color is transparent",
+ FALSE,
+ G_PARAM_CONSTRUCT |
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_PALETTE,
g_param_spec_object (
"palette",
@@ -385,6 +411,25 @@
g_object_notify (G_OBJECT (state), "default-label");
}
+gboolean
+gtkhtml_color_state_get_default_transparent (GtkhtmlColorState *state)
+{
+ g_return_val_if_fail (GTKHTML_IS_COLOR_STATE (state), FALSE);
+
+ return state->priv->default_transparent;
+}
+
+void
+gtkhtml_color_state_set_default_transparent (GtkhtmlColorState *state,
+ gboolean transparent)
+{
+ g_return_if_fail (GTKHTML_IS_COLOR_STATE (state));
+
+ state->priv->default_transparent = transparent;
+
+ g_object_notify (G_OBJECT (state), "default-transparent");
+}
+
GtkhtmlColorPalette *
gtkhtml_color_state_get_palette (GtkhtmlColorState *state)
{
Modified: branches/gnome-2-24/components/editor/gtkhtml-color-state.h
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-color-state.h (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-color-state.h Mon Jan 12 04:53:33 2009
@@ -86,6 +86,11 @@
void gtkhtml_color_state_set_default_label
(GtkhtmlColorState *state,
const gchar *text);
+gboolean gtkhtml_color_state_get_default_transparent
+ (GtkhtmlColorState *state);
+void gtkhtml_color_state_set_default_transparent
+ (GtkhtmlColorState *state,
+ gboolean transparent);
GtkhtmlColorPalette *
gtkhtml_color_state_get_palette (GtkhtmlColorState *state);
void gtkhtml_color_state_set_palette (GtkhtmlColorState *state,
Modified: branches/gnome-2-24/components/editor/gtkhtml-color-swatch.c
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-color-swatch.c (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-color-swatch.c Mon Jan 12 04:53:33 2009
@@ -271,7 +271,6 @@
GtkWidget *drawing_area;
g_return_if_fail (GTKHTML_IS_COLOR_SWATCH (swatch));
- g_return_if_fail (color != NULL);
drawing_area = swatch->priv->drawing_area;
gtk_widget_modify_bg (drawing_area, GTK_STATE_NORMAL, color);
Modified: branches/gnome-2-24/components/editor/gtkhtml-editor-signals.c
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-editor-signals.c (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-editor-signals.c Mon Jan 12 04:53:33 2009
@@ -183,14 +183,19 @@
HTMLTableCell *cell,
GtkWidget *widget)
{
+ GtkhtmlColorCombo *combo;
GtkHTML *html;
GdkColor color;
+ gboolean got_color;
+ combo = GTKHTML_COLOR_COMBO (widget);
html = gtkhtml_editor_get_html (editor);
- gtkhtml_color_combo_get_current_color (
- GTKHTML_COLOR_COMBO (widget), &color);
- html_engine_table_cell_set_bg_color (html->engine, cell, &color);
+ /* The default table cell color is transparent. */
+ got_color = gtkhtml_color_combo_get_current_color (combo, &color);
+
+ html_engine_table_cell_set_bg_color (
+ html->engine, cell, got_color ? &color : NULL);
}
static void
@@ -463,9 +468,9 @@
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
widget = WIDGET (CELL_PROPERTIES_COLOR_COMBO);
- if (cell->have_bg)
- gtkhtml_color_combo_set_current_color (
- GTKHTML_COLOR_COMBO (widget), &cell->bg);
+ gtkhtml_color_combo_set_current_color (
+ GTKHTML_COLOR_COMBO (widget),
+ cell->have_bg ? &cell->bg : NULL);
widget = WIDGET (CELL_PROPERTIES_IMAGE_FILE_CHOOSER);
if (cell->have_bgPixmap) {
@@ -1688,6 +1693,27 @@
}
AUTOCONNECTED_SIGNAL_HANDLER (void
+gtkhtml_editor_table_properties_color_changed_cb (GtkWidget *window,
+ GtkhtmlColorCombo *combo))
+{
+ GtkhtmlEditor *editor;
+ HTMLTable *table;
+ GtkHTML *html;
+ GdkColor color;
+ gboolean got_color;
+
+ editor = extract_gtkhtml_editor (window);
+ html = gtkhtml_editor_get_html (editor);
+ table = HTML_TABLE (editor->priv->table_object);
+
+ /* The default table color is transparent. */
+ got_color = gtkhtml_color_combo_get_current_color (combo, &color);
+
+ html_engine_table_set_bg_color (
+ html->engine, table, got_color ? &color : NULL);
+}
+
+AUTOCONNECTED_SIGNAL_HANDLER (void
gtkhtml_editor_table_properties_cols_changed_cb (GtkWidget *window,
GtkSpinButton *button))
{
@@ -1861,7 +1887,9 @@
widget = WIDGET (TABLE_PROPERTIES_BORDER_SPIN_BUTTON);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
- /* TODO - Initialize color combo */
+ widget = WIDGET (TABLE_PROPERTIES_COLOR_COMBO);
+ gtkhtml_color_combo_set_current_color (
+ GTKHTML_COLOR_COMBO (widget), table->bgColor);
if (table->bgPixmap != NULL) {
gchar *filename;
Modified: branches/gnome-2-24/components/editor/gtkhtml-editor.glade
==============================================================================
--- branches/gnome-2-24/components/editor/gtkhtml-editor.glade (original)
+++ branches/gnome-2-24/components/editor/gtkhtml-editor.glade Mon Jan 12 04:53:33 2009
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.1 on Tue Apr 1 08:13:39 2008 -->
+<!--Generated with glade3 3.4.5 on Wed Dec 31 00:39:22 2008 -->
<glade-interface>
<requires lib="gtkhtml-editor"/>
<widget class="GtkWindow" id="text-properties-window">
@@ -1717,6 +1717,8 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="default_color">#000000000000</property>
<property name="default_label">Transparent</property>
+ <property name="default_transparent">True</property>
+ <signal name="changed" handler="gtkhtml_editor_table_properties_color_changed_cb" object="table-properties-window"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -2614,6 +2616,8 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="default_color">#000000000000</property>
<property name="default_label">Transparent</property>
+ <property name="default_transparent">True</property>
+ <signal name="changed" handler="gtkhtml_editor_cell_properties_color_changed_cb" object="cell-properties-window"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -3156,7 +3160,6 @@
<widget class="GtkTable" id="image-properties-link-table">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">1</property>
<property name="n_columns">3</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]