Renamed x_window_setup_colors() and x_window_free_colors() to
x_color_init() and x_color_free() respectively. And moved them to
x_color.c
---
gschem/include/prototype.h | 4 +-
gschem/src/gschem.c | 2 +-
gschem/src/x_color.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
gschem/src/x_window.c | 42 ----------------------------------------
4 files changed, 49 insertions(+), 45 deletions(-)
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index e2d71c3..e4405f5 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -737,6 +737,8 @@ void x_scrollbars_update(GSCHEM_TOPLEVEL *w_current);
void x_basic_warp_cursor(GtkWidget *widget, gint x, gint y, gboolean relative);
/* x_color.c */
void x_color_allocate_all(void);
+void x_color_init (void);
+void x_color_free (void);
GdkColor *x_get_color(int color);
GdkColor *x_get_darkcolor(int color);
gchar *x_color_get_name(int index);
@@ -847,8 +849,6 @@ void x_stroke_record (GSCHEM_TOPLEVEL *w_current, gint x,
gint y);
gint x_stroke_translate_and_execute (GSCHEM_TOPLEVEL *w_current);
/* x_window.c */
void x_window_setup (GSCHEM_TOPLEVEL *w_current);
-void x_window_setup_colors(void);
-void x_window_free_colors();
void x_window_setup_gc(GSCHEM_TOPLEVEL *w_current);
void x_window_free_gc(GSCHEM_TOPLEVEL *w_current);
void x_window_create_drawing(GtkWidget *drawbox, GSCHEM_TOPLEVEL *w_current);
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index 144d9d4..030615f 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -248,7 +248,7 @@ void main_prog(void *closure, int argc, char *argv[])
/* At end, complete set up of window. */
colormap = gdk_colormap_get_system ();
- x_window_setup_colors();
+ x_color_init();
x_window_setup (w_current);
/* Repaint the background in-case we have to throw up a "restore backup?"
diff --git a/gschem/src/x_color.c b/gschem/src/x_color.c
index 8205c65..7983e55 100644
--- a/gschem/src/x_color.c
+++ b/gschem/src/x_color.c
@@ -37,6 +37,52 @@
extern COLOR colors[MAX_COLORS];
+
+/*! \brief Initializes the color system for the application.
+ * \par Function Documentation
+ * This function initializes the default \b black and \b white color.
+ *
+ * It also allocates the colormap.
+ */
+void
+x_color_init (void)
+{
+ gdk_color_parse ("black", &black);
+ if (!gdk_colormap_alloc_color (colormap,
+ &black,
+ FALSE,
+ TRUE)) {
+ fprintf (stderr, _("Could not allocate the color %s!\n"), _("black"));
+ exit (-1);
+ }
+
+ gdk_color_parse ("white", &white);
+ if (!gdk_colormap_alloc_color (colormap,
+ &white,
+ FALSE,
+ TRUE)) {
+ fprintf (stderr, _("Could not allocate the color %s!\n"), _("white"));
+ exit (-1);
+ }
+
+ x_color_allocate_all ();
+
+}
+
+/*! \brief Frees memory used by the color system.
+ * \par Function Documentation
+ * This function frees the colors from colormap along with
+ * \b black and \b white.
+ */
+void
+x_color_free (void)
+{
+ GdkColor *colors[] = { &black, &white };
+
+ gdk_colormap_free_colors (colormap, *colors, 2);
+
+}
+
/*! \todo Finish function documentation!!!
* \brief
* \par Function Documentation
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 814cf1d..afafbb6 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -76,48 +76,6 @@ void x_window_setup (GSCHEM_TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_window_setup_colors(void)
-{
- gdk_color_parse ("black", &black);
- if (!gdk_colormap_alloc_color (colormap,
- &black,
- FALSE,
- TRUE)) {
- fprintf (stderr, _("Could not allocate the color %s!\n"), _("black"));
- exit (-1);
- }
-
- gdk_color_parse ("white", &white);
- if (!gdk_colormap_alloc_color (colormap,
- &white,
- FALSE,
- TRUE)) {
- fprintf (stderr, _("Could not allocate the color %s!\n"), _("white"));
- exit (-1);
- }
-
- x_color_allocate_all ();
-
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void x_window_free_colors()
-{
- GdkColor *colors[] = { &black, &white };
-
- gdk_colormap_free_colors (colormap, *colors, 2);
-
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
void x_window_setup_gc(GSCHEM_TOPLEVEL *w_current)
{
GdkGCValues values;
--
1.5.6
_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev