Commit 1c9a8ec6 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

rename color.[ch] -> style-color.[ch]


2000-12-30  Jody Goldberg <jgoldberg@home.com>

	* rename color.[ch] -> style-color.[ch]
parent e0b27708
2000-12-30 Jody Goldberg <jgoldberg@home.com>
* rename border.[ch] -> style-border.[ch]
* rename color.[ch] -> style-color.[ch]
2000-12-30 Jody Goldberg <jgoldberg@home.com>
......
2000-12-30 Jody Goldberg <jgoldberg@home.com>
* rename border.[ch] -> style-border.[ch]
* rename color.[ch] -> style-color.[ch]
2000-12-30 Jody Goldberg <jgoldberg@home.com>
......
2000-12-30 Jody Goldberg <jgoldberg@home.com>
* rename border.[ch] -> style-border.[ch]
* rename color.[ch] -> style-color.[ch]
2000-12-30 Jody Goldberg <jgoldberg@home.com>
......
2000-12-30 Jody Goldberg <jgoldberg@home.com>
* rename border.[ch] -> style-border.[ch]
* rename color.[ch] -> style-color.[ch]
2000-12-30 Jody Goldberg <jgoldberg@home.com>
......
2000-12-30 Jody Goldberg <jgoldberg@home.com>
* rename border.[ch] -> style-border.[ch]
* rename color.[ch] -> style-color.[ch]
2000-12-30 Jody Goldberg <jgoldberg@home.com>
......
......@@ -32,8 +32,9 @@
#include "number-match.h"
#include "cell.h"
#include "parse-util.h"
#include "style-border.h"
#include "style.h"
#include "style-border.h"
#include "style-color.h"
#include "selection.h"
#include "position.h"
#include "ranges.h"
......
......@@ -16,7 +16,7 @@
#include "ms-excel-read.h"
#include "ms-escher.h"
#include "parse-util.h"
#include "style.h"
#include "style-color.h"
#include "format.h"
#include "expr.h"
#include "gutils.h"
......
......@@ -33,7 +33,7 @@
#include "gnumeric-util.h"
#include "format.h"
#include "position.h"
#include "color.h"
#include "style-color.h"
#include "cell.h"
#include "sheet-object.h"
#include "sheet-object-cell-comment.h"
......
......@@ -5,12 +5,14 @@
* Michael Meeks (michael@imaginator.com)
* Jody Goldberg (jgoldberg@home.com)
*
* (C) 1998, 1999, 2000 Michael Meeks, Jody Goldberg
* (C) 1998-2001 Michael Meeks, Jody Goldberg
**/
#ifndef GNUMERIC_MS_EXCEL_XF_H
#define GNUMERIC_MS_EXCEL_XF_H
#include "style.h"
#include "style-border.h"
#include "style-color.h"
#define STYLE_TOP (MSTYLE_BORDER_TOP - MSTYLE_BORDER_TOP)
#define STYLE_BOTTOM (MSTYLE_BORDER_BOTTOM - MSTYLE_BORDER_TOP)
......
......@@ -29,6 +29,7 @@
#include "workbook-view.h"
#include "workbook.h"
#include "style.h"
#include "style-color.h"
#include "html.h"
#include "cell.h"
#include "value.h"
......
......@@ -29,6 +29,7 @@
#include "workbook-view.h"
#include "workbook.h"
#include "style.h"
#include "style-color.h"
#include "html.h"
#include "cell.h"
#include "value.h"
......
......@@ -27,6 +27,7 @@
#include "workbook.h"
#include "sheet.h"
#include "style.h"
#include "style-color.h"
#include "latex.h"
#include "font.h"
#include "cell.h"
......
......@@ -13,7 +13,6 @@
#include "gnumeric-util.h"
#include "format.h"
#include "gutils.h"
#include "color.h"
#include "io-context.h"
#include "xbase.h"
......
......@@ -26,8 +26,9 @@
#include "plugin.h"
#include "plugin-util.h"
#include "style.h"
#include "format.h"
#include "style-border.h"
#include "style-color.h"
#include "format.h"
#include "cell.h"
#include "position.h"
#include "expr.h"
......
......@@ -26,8 +26,9 @@
#include "plugin.h"
#include "plugin-util.h"
#include "style.h"
#include "format.h"
#include "style-border.h"
#include "style-color.h"
#include "format.h"
#include "cell.h"
#include "position.h"
#include "expr.h"
......
......@@ -59,8 +59,6 @@ GNUMERIC_BASE_SOURCES = \
cmd-edit.c \
collect.h \
collect.c \
color.c \
color.h \
colrow.c \
colrow.h \
commands.h \
......@@ -207,6 +205,8 @@ GNUMERIC_BASE_SOURCES = \
style.h \
style-border.c \
style-border.h \
style-color.c \
style-color.h \
summary.c \
summary.h \
symbol.h \
......
......@@ -8,6 +8,7 @@
#include <gdk/gdk.h>
#include "cell-draw.h"
#include "style.h"
#include "style-color.h"
#include "cell.h"
#include "value.h"
#include "workbook.h"
......
......@@ -10,7 +10,7 @@
#include <gnome.h>
#include <glade/glade.h>
#include "sheet.h"
#include "color.h"
#include "style-color.h"
#include "dialogs.h"
#include "utils-dialog.h"
#include "widgets/widget-font-selector.h"
......
......@@ -10,7 +10,7 @@
#include <gnome.h>
#include <glade/glade.h>
#include "sheet.h"
#include "color.h"
#include "style-color.h"
#include "dialogs.h"
#include "utils-dialog.h"
#include "widgets/widget-font-selector.h"
......
......@@ -36,7 +36,7 @@
#ifdef HAVE_IEEEFP_H
# include <ieeefp.h>
#endif
#include "style.h"
#include "style-color.h"
#include "format.h"
#include "expr.h"
#include "dates.h"
......
......@@ -13,7 +13,7 @@
#include "item-grid.h"
#include "sheet-control-gui.h"
#include "gnumeric-util.h"
#include "color.h"
#include "style-color.h"
#include "selection.h"
#include "parse-util.h"
#include "ranges.h"
......
......@@ -13,7 +13,7 @@
#include "item-grid.h"
#include "sheet-control-gui.h"
#include "gnumeric-util.h"
#include "color.h"
#include "style-color.h"
#include "selection.h"
#include "parse-util.h"
#include "ranges.h"
......
......@@ -9,7 +9,7 @@
#include "item-cursor.h"
#include "gnumeric-sheet.h"
#include "sheet-control-gui.h"
#include "color.h"
#include "style-color.h"
#include "clipboard.h"
#include "selection.h"
#include "sheet.h"
......
......@@ -27,7 +27,7 @@
#include "parse-util.h"
#include "mstyle.h"
#include "style-border.h"
#include "color.h"
#include "style-color.h"
#include "pattern.h"
#include <gal/widgets/e-cursors.h>
#include <math.h>
......
......@@ -35,7 +35,7 @@
#include "global-gnome-font.h"
#include "auto-format.h"
#include "style.h"
#include "color.h"
#include "style-color.h"
#include "../plugins/excel/boot.h"
......@@ -254,6 +254,7 @@ gnumeric_main (void *closure, int argc, char *argv [])
e_cursors_shutdown ();
format_match_finish ();
format_color_shutdown ();
gnumeric_color_shutdown ();
style_shutdown ();
global_gnome_font_shutdown ();
......
......@@ -35,7 +35,7 @@
#include "global-gnome-font.h"
#include "auto-format.h"
#include "style.h"
#include "color.h"
#include "style-color.h"
#include "../plugins/excel/boot.h"
......@@ -254,6 +254,7 @@ gnumeric_main (void *closure, int argc, char *argv [])
e_cursors_shutdown ();
format_match_finish ();
format_color_shutdown ();
gnumeric_color_shutdown ();
style_shutdown ();
global_gnome_font_shutdown ();
......
......@@ -8,9 +8,10 @@
* Almer S. Tigelaar <almer1@dds.nl>
*/
#include <config.h>
#include "mstyle.h"
#include "str.h"
#include "mstyle.h"
#include "style-border.h"
#include "style-color.h"
#include "pattern.h"
#include "format.h"
#include "main.h"
......
......@@ -8,7 +8,7 @@
*/
#include "config.h"
#include "pattern.h"
#include "color.h"
#include "style-color.h"
typedef struct {
int const x, y;
......
......@@ -29,7 +29,7 @@
#include "style-border.h"
#include "cell.h"
#include "cell-draw.h"
#include "color.h"
#include "style-color.h"
#include "pattern.h"
#include "mstyle.h"
......
......@@ -13,7 +13,7 @@
#include "gnumeric.h"
#include "eval.h"
#include "format.h"
#include "color.h"
#include "style-color.h"
#include "parse-util.h"
#include "cell.h"
#include "value.h"
......
......@@ -26,6 +26,7 @@
#include "expr.h"
#include "cell.h"
#include "style.h"
#include "style-color.h"
#include "sheet.h"
#include "sheet-merge.h"
#include "format.h"
......
......@@ -8,7 +8,7 @@
*/
#include <config.h>
#include "style-border.h"
#include "color.h"
#include "style-color.h"
#include "style.h"
struct LineDotPattern {
......
#ifndef GNUMERIC_BORDER_H
#define GNUMERIC_BORDER_H
#ifndef GNUMERIC_STYLE_BORDER_H
#define GNUMERIC_STYLE_BORDER_H
#include "gnumeric.h"
#include <libgnomeprint/gnome-print.h>
......@@ -84,4 +84,4 @@ void style_border_print (StyleBorder const * const border, StyleBorderLocation c
StyleBorder const * const extend_begin,
StyleBorder const * const extend_end);
#endif /* GNUMERIC_BORDER_H */
#endif /* GNUMERIC_STYLE_BORDER_H */
......@@ -9,13 +9,125 @@
*/
#include <config.h>
#include <gnome.h>
#include "color.h"
#include "style-color.h"
#include <gal/widgets/e-colors.h>
static int color_inited;
static gboolean color_inited = FALSE;
/* Public colors: shared by all of our items in Gnumeric */
GdkColor gs_white, gs_black, gs_light_gray, gs_dark_gray, gs_red, gs_lavender;
static GHashTable *style_color_hash;
StyleColor *
style_color_new (gushort red, gushort green, gushort blue)
{
StyleColor *sc;
StyleColor key;
key.red = red;
key.green = green;
key.blue = blue;
sc = g_hash_table_lookup (style_color_hash, &key);
if (!sc) {
sc = g_new (StyleColor, 1);
key.color.red = red;
key.color.green = green;
key.color.blue = blue;
sc->color = key.color;
sc->red = red;
sc->green = green;
sc->blue = blue;
sc->name = NULL;
sc->color.pixel = e_color_alloc (red, green, blue);
/* Make a contrasting selection color with an alpha of .5 */
red += (gs_lavender.red - red)/2;
green += (gs_lavender.green - green)/2;
blue += (gs_lavender.blue - blue)/2;
sc->selected_color.red = red;
sc->selected_color.green = green;
sc->selected_color.blue = blue;
sc->selected_color.pixel = e_color_alloc (red, green, blue);
g_hash_table_insert (style_color_hash, sc, sc);
sc->ref_count = 0;
}
sc->ref_count++;
return sc;
}
StyleColor *
style_color_black (void)
{
static StyleColor *color = NULL;
if (!color)
color = style_color_new (0, 0, 0);
return style_color_ref (color);
}
StyleColor *
style_color_white (void)
{
static StyleColor *color = NULL;
if (!color)
color = style_color_new (0xffff, 0xffff, 0xffff);
return style_color_ref (color);
}
StyleColor *
style_color_ref (StyleColor *sc)
{
g_return_val_if_fail (sc != NULL, NULL);
sc->ref_count++;
return sc;
}
void
style_color_unref (StyleColor *sc)
{
g_return_if_fail (sc != NULL);
g_return_if_fail (sc->ref_count > 0);
sc->ref_count--;
if (sc->ref_count != 0)
return;
/*
* There is no need to deallocate colors, as they come from
* the GDK Color Context
*/
g_hash_table_remove (style_color_hash, sc);
g_free (sc);
}
static gint
color_equal (gconstpointer v, gconstpointer v2)
{
const StyleColor *k1 = (const StyleColor *) v;
const StyleColor *k2 = (const StyleColor *) v2;
if (k1->red == k2->red &&
k1->green == k2->green &&
k1->blue == k2->blue)
return 1;
return 0;
}
static guint
color_hash (gconstpointer v)
{
const StyleColor *k = (const StyleColor *)v;
return (k->red << 16) | (k->green << 8) | (k->blue);
}
void
gnumeric_color_init (void)
......@@ -33,5 +145,17 @@ gnumeric_color_init (void)
e_color_alloc_name ("red", &gs_red);
e_color_alloc_name ("lavender",&gs_lavender);
color_inited = 1;
style_color_hash = g_hash_table_new (color_hash, color_equal);
color_inited = TRUE;
}
void
gnumeric_color_shutdown (void)
{
g_return_if_fail (color_inited);
color_inited = FALSE;
g_hash_table_destroy (style_color_hash);
style_color_hash = NULL;
}
#ifndef GNUMERIC_COLOR_H
#define GNUMERIC_COLOR_H
#ifndef GNUMERIC_STYLE_COLOR_H
#define GNUMERIC_STYLE_COLOR_H
void gnumeric_color_init (void);
#include "gnumeric.h"
#include <gdk/gdktypes.h>
struct _StyleColor {
int ref_count;
GdkColor color;
GdkColor selected_color;
char *name;
gushort red;
gushort green;
gushort blue;
};
/* Colors used by any GnumericSheet item */
extern GdkColor gs_white, gs_light_gray, gs_dark_gray, gs_black, gs_red, gs_lavender;
#endif /* GNUMERIC_COLOR_H */
StyleColor *style_color_new (gushort red, gushort green, gushort blue);
StyleColor *style_color_ref (StyleColor *sc);
void style_color_unref (StyleColor *sc);
StyleColor *style_color_black (void);
StyleColor *style_color_white (void);
void gnumeric_color_init (void);
void gnumeric_color_shutdown (void);
#endif /* GNUMERIC_STYLE_COLOR_H */
......@@ -11,7 +11,7 @@
#include "gnumeric.h"
#include "style.h"
#include "format.h"
#include "color.h"
#include "style-color.h"
#include "application.h"
#include "gnumeric-util.h"
......@@ -22,7 +22,6 @@
static GHashTable *style_font_hash;
static GHashTable *style_font_negative_hash;
static GHashTable *style_color_hash;
StyleFont *gnumeric_default_font;
StyleFont *gnumeric_default_bold_font;
......@@ -194,95 +193,6 @@ style_font_unref (StyleFont *sf)
g_free (sf);
}
StyleColor *
style_color_new (gushort red, gushort green, gushort blue)
{
StyleColor *sc;
StyleColor key;
key.red = red;
key.green = green;
key.blue = blue;
sc = g_hash_table_lookup (style_color_hash, &key);
if (!sc) {
sc = g_new (StyleColor, 1);
key.color.red = red;
key.color.green = green;
key.color.blue = blue;
sc->color = key.color;
sc->red = red;
sc->green = green;
sc->blue = blue;
sc->name = NULL;
sc->color.pixel = e_color_alloc (red, green, blue);
/* Make a contrasting selection color with an alpha of .5 */
red += (gs_lavender.red - red)/2;
green += (gs_lavender.green - green)/2;
blue += (gs_lavender.blue - blue)/2;
sc->selected_color.red = red;
sc->selected_color.green = green;
sc->selected_color.blue = blue;
sc->selected_color.pixel = e_color_alloc (red, green, blue);
g_hash_table_insert (style_color_hash, sc, sc);
sc->ref_count = 0;
}
sc->ref_count++;
return sc;
}
StyleColor *
style_color_black (void)
{
static StyleColor *color = NULL;
if (!color)
color = style_color_new (0, 0, 0);
return style_color_ref (color);
}
StyleColor *
style_color_white (void)
{
static StyleColor *color = NULL;
if (!color)
color = style_color_new (0xffff, 0xffff, 0xffff);
return style_color_ref (color);
}
StyleColor *
style_color_ref (StyleColor *sc)
{
g_return_val_if_fail (sc != NULL, NULL);
sc->ref_count++;
return sc;
}
void
style_color_unref (StyleColor *sc)
{
g_return_if_fail (sc != NULL);
g_return_if_fail (sc->ref_count > 0);
sc->ref_count--;
if (sc->ref_count != 0)
return;
/*
* There is no need to deallocate colors, as they come from
* the GDK Color Context
*/
g_hash_table_remove (style_color_hash, sc);
g_free (sc);
}
/*
* The routines used to hash and compare the different styles
*/
......@@ -313,28 +223,6 @@ style_font_hash_func (gconstpointer v)
return k->size + g_str_hash (k->font_name);
}
static gint
color_equal (gconstpointer v, gconstpointer v2)
{
const StyleColor *k1 = (const StyleColor *) v;
const StyleColor *k2 = (const StyleColor *) v2;
if (k1->red == k2->red &&
k1->green == k2->green &&
k1->blue == k2->blue)
return 1;
return 0;
}
static guint
color_hash (gconstpointer v)
{
const StyleColor *k = (const StyleColor *)v;
return (k->red << 16) | (k->green << 8) | (k->blue);
}
static void
font_init (void)
{
......@@ -409,8 +297,6 @@ style_init (void)
number_format_init ();
style_font_hash = g_hash_table_new (style_font_hash_func,
style_font_equal);
style_color_hash = g_hash_table_new (color_hash, color_equal);
style_font_negative_hash = g_hash_table_new (style_font_hash_func,
style_font_equal);
......@@ -460,8 +346,6 @@ style_shutdown (void)
number_format_shutdown ();
g_hash_table_destroy (style_font_hash);
style_font_hash = NULL;
g_hash_table_destroy (style_color_hash);
style_color_hash = NULL;
g_hash_table_foreach (style_font_negative_hash, delete_neg_font, NULL);
g_hash_table_destroy (style_font_negative_hash);
......
......@@ -53,16 +53,6 @@ struct _StyleFont {
unsigned int is_italic:1;
};
struct _StyleColor {
int ref_count;
GdkColor color;
GdkColor selected_color;
char *name;
gushort red;
gushort green;
gushort blue;
};
void style_init (void);
void style_shutdown (void);
......@@ -78,12 +68,6 @@ float style_font_get_width (StyleFont const *sf);
void style_font_ref (StyleFont *sf);
void style_font_unref (StyleFont *sf);