summaryrefslogtreecommitdiffhomepage
path: root/mixgtk
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-04-22 00:04:10 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-04-22 00:04:10 +0000
commite406c332499f01a97379c163ce1326cfc13ee570 (patch)
tree287130984c77222f1ad77d8ddbb9a3242c8d5e76 /mixgtk
parentdaced5b02dd5d363e610fdac4140bee64515d317 (diff)
downloadmdk-e406c332499f01a97379c163ce1326cfc13ee570.tar.gz
mdk-e406c332499f01a97379c163ce1326cfc13ee570.tar.bz2
color custumozation added
Diffstat (limited to 'mixgtk')
-rw-r--r--mixgtk/Makefile.am3
-rw-r--r--mixgtk/mixgtk.c5
-rw-r--r--mixgtk/mixgtk.glade384
-rw-r--r--mixgtk/mixgtk_colorsel.c181
-rw-r--r--mixgtk/mixgtk_colorsel.h40
-rw-r--r--mixgtk/mixgtk_mixal.c18
-rw-r--r--mixgtk/mixgtk_mixal.h24
-rw-r--r--mixgtk/mixgtk_widgets.c3
-rw-r--r--mixgtk/mixgtk_widgets.h3
9 files changed, 641 insertions, 20 deletions
diff --git a/mixgtk/Makefile.am b/mixgtk/Makefile.am
index a385647..adf036e 100644
--- a/mixgtk/Makefile.am
+++ b/mixgtk/Makefile.am
@@ -25,7 +25,8 @@ gmixvm_SOURCES = mixgtk.c mixgtk_gen_handlers.h mixgtk_gen_handlers.c \
mixgtk_device.h mixgtk_device.c \
mixgtk_mixvm.h mixgtk_mixvm.c \
mixgtk_mixal.h mixgtk_mixal.c \
- mixgtk_input.h mixgtk_input.c
+ mixgtk_input.h mixgtk_input.c \
+ mixgtk_colorsel.h mixgtk_colorsel.c
endif
diff --git a/mixgtk/mixgtk.c b/mixgtk/mixgtk.c
index 1bbc175..2e2b44c 100644
--- a/mixgtk/mixgtk.c
+++ b/mixgtk/mixgtk.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk.c :
* Main function of the mix gtk front-end
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/03/14 23:08:50 jose"
+ * Last change: Time-stamp: "2001-04-22 01:00:42 jao"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -30,6 +30,7 @@
#include "mixgtk_mixvm.h"
#include "mixgtk_mixal.h"
#include "mixgtk_input.h"
+#include "mixgtk_colorsel.h"
int
main(int argc, char *argv[])
@@ -70,7 +71,7 @@ main(int argc, char *argv[])
return EXIT_FAILURE;
}
- if (!mixgtk_mixal_init (vm))
+ if (!mixgtk_mixal_init (vm) || !mixgtk_colorsel_init ())
{
g_error ("Unable to initialise application (mixal widgets)\n");
return EXIT_FAILURE;
diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade
index ced029b..665c8ec 100644
--- a/mixgtk/mixgtk.glade
+++ b/mixgtk/mixgtk.glade
@@ -101,7 +101,7 @@
<widget>
<class>GtkMenuItem</class>
<name>debug</name>
- <label>Debu_g</label>
+ <label>D_ebug</label>
<right_justify>False</right_justify>
<widget>
@@ -164,6 +164,42 @@
<widget>
<class>GtkMenuItem</class>
+ <name>settings1</name>
+ <label>_Settings</label>
+ <right_justify>False</right_justify>
+
+ <widget>
+ <class>GtkMenu</class>
+ <name>settings1_menu</name>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>colors</name>
+ <signal>
+ <name>activate</name>
+ <handler>on_colors_activate</handler>
+ <last_modification_time>Wed, 11 Apr 2001 23:15:11 GMT</last_modification_time>
+ </signal>
+ <label>_Colors...</label>
+ <right_justify>False</right_justify>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>fonts1</name>
+ <signal>
+ <name>activate</name>
+ <handler>on_fonts1_activate</handler>
+ <last_modification_time>Wed, 11 Apr 2001 23:15:11 GMT</last_modification_time>
+ </signal>
+ <label>_Fonts...</label>
+ <right_justify>False</right_justify>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
<name>help</name>
<label>_Help</label>
<right_justify>True</right_justify>
@@ -230,6 +266,11 @@
<class>GtkNotebook</class>
<name>main_notebook</name>
<can_focus>True</can_focus>
+ <signal>
+ <name>switch_page</name>
+ <handler>mixgtk_mixal_update</handler>
+ <last_modification_time>Sat, 21 Apr 2001 20:24:38 GMT</last_modification_time>
+ </signal>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
@@ -1700,4 +1741,345 @@
</widget>
</widget>
+<widget>
+ <class>GtkDialog</class>
+ <name>color_dialog</name>
+ <width>275</width>
+ <height>214</height>
+ <visible>False</visible>
+ <signal>
+ <name>delete_event</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Thu, 12 Apr 2001 21:05:54 GMT</last_modification_time>
+ </signal>
+ <signal>
+ <name>destroy_event</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Thu, 12 Apr 2001 21:06:09 GMT</last_modification_time>
+ </signal>
+ <signal>
+ <name>destroy</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Thu, 12 Apr 2001 21:06:23 GMT</last_modification_time>
+ </signal>
+ <title>MIXAL colors</title>
+ <type>GTK_WINDOW_DIALOG</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>True</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>False</allow_grow>
+ <auto_shrink>False</auto_shrink>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>Dialog:vbox</child_name>
+ <name>dialog-vbox7</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <child_name>Dialog:action_area</child_name>
+ <name>dialog-action_area7</name>
+ <border_width>10</border_width>
+ <homogeneous>True</homogeneous>
+ <spacing>5</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <name>hbuttonbox7</name>
+ <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
+ <spacing>30</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>colors_ok</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_colors_ok_clicked</handler>
+ <last_modification_time>Thu, 12 Apr 2001 21:05:07 GMT</last_modification_time>
+ </signal>
+ <label>OK</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>colors_apply</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_colors_apply_clicked</handler>
+ <last_modification_time>Thu, 12 Apr 2001 21:04:56 GMT</last_modification_time>
+ </signal>
+ <label>Apply</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>colors_cancel</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_colors_cancel_clicked</handler>
+ <last_modification_time>Thu, 12 Apr 2001 21:04:45 GMT</last_modification_time>
+ </signal>
+ <label>Cancel</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFixed</class>
+ <name>fixed1</name>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label230</name>
+ <x>184</x>
+ <y>32</y>
+ <width>78</width>
+ <height>16</height>
+ <label>Foreground</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label226</name>
+ <x>0</x>
+ <y>8</y>
+ <width>143</width>
+ <height>16</height>
+ <label>Click to change color</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label227</name>
+ <x>0</x>
+ <y>56</y>
+ <width>79</width>
+ <height>16</height>
+ <label>Current line</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label229</name>
+ <x>88</x>
+ <y>32</y>
+ <width>78</width>
+ <height>16</height>
+ <label>Background</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkDrawingArea</class>
+ <name>clbg_area</name>
+ <x>90</x>
+ <y>56</y>
+ <width>75</width>
+ <height>15</height>
+ </widget>
+
+ <widget>
+ <class>GtkDrawingArea</class>
+ <name>clfg_area</name>
+ <x>184</x>
+ <y>56</y>
+ <width>75</width>
+ <height>15</height>
+ </widget>
+
+ <widget>
+ <class>GtkDrawingArea</class>
+ <name>bpfg_area</name>
+ <x>184</x>
+ <y>94</y>
+ <width>75</width>
+ <height>15</height>
+ </widget>
+
+ <widget>
+ <class>GtkDrawingArea</class>
+ <name>plbg_area</name>
+ <x>90</x>
+ <y>128</y>
+ <width>75</width>
+ <height>15</height>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label231</name>
+ <x>1</x>
+ <y>128</y>
+ <width>77</width>
+ <height>16</height>
+ <label>Unselected</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkDrawingArea</class>
+ <name>bpbg_area</name>
+ <x>90</x>
+ <y>93</y>
+ <width>75</width>
+ <height>15</height>
+ </widget>
+
+ <widget>
+ <class>GtkDrawingArea</class>
+ <name>plfg_area</name>
+ <x>184</x>
+ <y>128</y>
+ <width>75</width>
+ <height>15</height>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label228</name>
+ <x>0</x>
+ <y>94</y>
+ <width>76</width>
+ <height>16</height>
+ <label>Breakpoint</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
+<widget>
+ <class>GtkColorSelectionDialog</class>
+ <name>colorsel_dialog</name>
+ <border_width>10</border_width>
+ <visible>False</visible>
+ <signal>
+ <name>delete_event</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Sat, 21 Apr 2001 23:14:28 GMT</last_modification_time>
+ </signal>
+ <signal>
+ <name>destroy_event</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Sat, 21 Apr 2001 23:14:54 GMT</last_modification_time>
+ </signal>
+ <signal>
+ <name>destroy</name>
+ <handler>gtk_widget_hide</handler>
+ <last_modification_time>Sat, 21 Apr 2001 23:15:12 GMT</last_modification_time>
+ </signal>
+ <title>Select Color</title>
+ <type>GTK_WINDOW_DIALOG</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>True</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <policy>GTK_UPDATE_CONTINUOUS</policy>
+
+ <widget>
+ <class>GtkButton</class>
+ <child_name>ColorSel:ok_button</child_name>
+ <name>ok_colorserdlg</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_ok_colorseldlg_clicked</handler>
+ <last_modification_time>Sat, 21 Apr 2001 23:17:15 GMT</last_modification_time>
+ </signal>
+ <label>OK</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <child_name>ColorSel:cancel_button</child_name>
+ <name>cancel_colorseldlg</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>on_cancel_colorseldlg_clicked</handler>
+ <last_modification_time>Sat, 21 Apr 2001 23:17:37 GMT</last_modification_time>
+ </signal>
+ <label>Cancel</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <child_name>ColorSel:help_button</child_name>
+ <name>help_button1</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <label>Help</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+</widget>
+
</GTK-Interface>
diff --git a/mixgtk/mixgtk_colorsel.c b/mixgtk/mixgtk_colorsel.c
new file mode 100644
index 0000000..c1f5a3d
--- /dev/null
+++ b/mixgtk/mixgtk_colorsel.c
@@ -0,0 +1,181 @@
+/* -*-c-*- -------------- mixgtk_colorsel.c :
+ * Implementation of the functions declared in mixgtk_colorsel.h
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: "2001-04-22 01:54:20 jao"
+ * ------------------------------------------------------------------
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <mixlib/mix.h>
+#include "mixgtk_widgets.h"
+#include "mixgtk_mixal.h"
+#include "mixgtk_colorsel.h"
+
+/* types of line colors */
+#define LNO_ 3
+/* colors per line */
+#define ZNO_ 2
+
+
+static GtkWidget *color_dialog_ = NULL;
+static const char *anames_[LNO_][ZNO_] = {
+ {"bpbg_area", "bpfg_area"},
+ {"clbg_area", "clfg_area"},
+ {"plbg_area", "plfg_area"}
+};
+
+typedef struct
+{
+ GtkWidget *area;
+ gboolean changed;
+ GdkColor color;
+} area_id_t;
+
+static area_id_t areas_[LNO_][ZNO_];
+static area_id_t *current_ = NULL;
+
+#define COLORSEL_DLG_NAME_ "colorsel_dialog"
+static GtkWidget *colorseldlg_ = NULL;
+
+
+static void
+set_area_color_ (GtkWidget *area, const GdkColor *color)
+{
+ static GdkColor gdk_color;
+
+ GdkColormap *colormap = gdk_window_get_colormap (area->window);
+
+ g_assert (area);
+ g_assert (color);
+
+ gdk_color.red = color->red;
+ gdk_color.green = color->green;
+ gdk_color.blue = color->blue;
+ gdk_color_alloc (colormap, &gdk_color);
+ gdk_window_set_background (area->window, &gdk_color);
+ gdk_window_clear (area->window);
+ gtk_widget_draw (area, FALSE);
+}
+
+
+
+/* drawingarea event handler */
+static gint
+area_event_(GtkWidget *widget, GdkEvent *event, gpointer areaid)
+{
+ gint handled = FALSE;
+ /* Check if we've received a button pressed event */
+ if (event->type == GDK_BUTTON_PRESS)
+ {
+/* handled = TRUE; */
+ current_ = (area_id_t *)areaid;
+ /* Show the dialog */
+ gtk_widget_show (colorseldlg_);
+ }
+ return handled;
+}
+
+/* initialise the color selection dialog */
+gboolean
+mixgtk_colorsel_init (void)
+{
+ int i, j;
+ color_dialog_ = mixgtk_widget_factory_get (MIXGTK_WIDGET_COLORSEL_DIALOG);
+ g_return_val_if_fail (color_dialog_ != NULL, FALSE);
+ colorseldlg_ = mixgtk_widget_factory_get_by_name (COLORSEL_DLG_NAME_);
+ g_return_val_if_fail (colorseldlg_ != NULL, FALSE);
+ for (i = 0; i < LNO_; ++i)
+ for (j = 0; j < ZNO_; ++j)
+ {
+ areas_[i][j].area = mixgtk_widget_factory_get_by_name (anames_[i][j]);
+ g_return_val_if_fail (areas_[i][j].area != NULL, FALSE);
+ areas_[i][j].changed = FALSE;
+ gtk_widget_set_events (areas_[i][j].area, GDK_BUTTON_PRESS_MASK);
+ gtk_signal_connect (GTK_OBJECT(areas_[i][j].area), "event",
+ (GtkSignalFunc)area_event_, (gpointer)&areas_[i][j]);
+
+ }
+ return TRUE;
+}
+
+/* gtk callbacks */
+void
+on_colors_activate (GtkWidget *w, gpointer p)
+{
+ int i, j;
+
+ /* must show widget before changing its colors */
+ gtk_widget_show (color_dialog_);
+
+ for (i = 0; i < LNO_; ++i)
+ for (j = 0; j < ZNO_; ++j)
+ {
+ areas_[i][j].changed = FALSE;
+ set_area_color_ (areas_[i][j].area, mixgtk_mixal_get_color (i, j));
+ }
+ current_ = NULL;
+}
+
+void
+on_ok_colorseldlg_clicked (GtkWidget *widget, gpointer data)
+{
+ static gdouble color[3];
+ GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG (colorseldlg_)->colorsel;
+ gtk_widget_hide (colorseldlg_);
+ /* Get current color */
+ gtk_color_selection_get_color (GTK_COLOR_SELECTION (colorsel), color);
+ /* Fit to a unsigned 16 bit integer (0..65535) and
+ * insert into the GdkColor structure */
+ current_->color.red = (guint16)(color[0]*65535.0);
+ current_->color.green = (guint16)(color[1]*65535.0);
+ current_->color.blue = (guint16)(color[2]*65535.0);
+ set_area_color_ (current_->area, &current_->color);
+ current_->changed = TRUE;
+}
+
+void
+on_cancel_colorseldlg_clicked (GtkWidget *widget, gpointer data)
+{
+ gtk_widget_hide (colorseldlg_);
+}
+
+void
+on_colors_apply_clicked (GtkWidget *widget, gpointer data)
+{
+ int i, j;
+ for (i = 0; i < LNO_; ++i)
+ for (j = 0; j < ZNO_; ++j)
+ {
+ if (areas_[i][j].changed)
+ mixgtk_mixal_set_color (i, j, &areas_[i][j].color);
+ }
+}
+
+void
+on_colors_ok_clicked (GtkWidget *widget, gpointer data)
+{
+ on_colors_apply_clicked (widget, data);
+ gtk_widget_hide (color_dialog_);
+}
+
+void
+on_colors_cancel_clicked (GtkWidget *widget, gpointer data)
+{
+ gtk_widget_hide (color_dialog_);
+}
+
diff --git a/mixgtk/mixgtk_colorsel.h b/mixgtk/mixgtk_colorsel.h
new file mode 100644
index 0000000..aa50724
--- /dev/null
+++ b/mixgtk/mixgtk_colorsel.h
@@ -0,0 +1,40 @@
+/* -*-c-*- ---------------- mixgtk_colorsel.h :
+ * Functions to handle the color selection customization
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: <2001-04-22 00:52:11 jao>
+ * ------------------------------------------------------------------
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef MIXGTK_COLORSEL_H
+#define MIXGTK_COLORSEL_H
+
+#include <gtk/gtk.h>
+
+/* initialise the color selection dialog */
+extern gboolean
+mixgtk_colorsel_init (void);
+
+/* gtk callbacks */
+extern void
+on_colors_activate (GtkWidget *w, gpointer p);
+
+
+#endif /* MIXGTK_COLORSEL_H */
+
diff --git a/mixgtk/mixgtk_mixal.c b/mixgtk/mixgtk_mixal.c
index 21c83e9..14afacc 100644
--- a/mixgtk/mixgtk_mixal.c
+++ b/mixgtk/mixgtk_mixal.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_mixal.c :
* Implementation of the functions declared in mixgtk_mixal.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "2001-04-21 23:19:05 jao"
+ * Last change: Time-stamp: "2001-04-22 01:02:28 jao"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -72,14 +72,14 @@ mixgtk_mixal_init (mix_vm_t *vm)
/* set the plain, location pointer and break colors */
void
mixgtk_mixal_set_color (mixal_line_t line, mixal_line_zone_t zone,
- guint16 color[3])
+ const GdkColor *color)
{
g_return_if_fail (color != NULL);
- g_return_if_fail (line > MIXAL_LINE_PLAIN);
- g_return_if_fail (zone > MIXAL_LINE_FG);
- colors_[line][zone].red = color[0];
- colors_[line][zone].green = color[1];
- colors_[line][zone].blue = color[2];
+ g_return_if_fail (line <= MIXAL_LINE_PLAIN);
+ g_return_if_fail (zone <= MIXAL_LINE_FG);
+ colors_[line][zone].red = color->red;
+ colors_[line][zone].green = color->green;
+ colors_[line][zone].blue = color->blue;
gdk_colormap_alloc_color (colormap_, &colors_[line][zone], FALSE, TRUE);
mixgtk_mixal_update_bp_all ();
}
@@ -87,8 +87,8 @@ mixgtk_mixal_set_color (mixal_line_t line, mixal_line_zone_t zone,
const GdkColor *
mixgtk_mixal_get_color (mixal_line_t line, mixal_line_zone_t zone)
{
- g_return_val_if_fail (line > MIXAL_LINE_PLAIN, FALSE);
- g_return_val_if_fail (zone > MIXAL_LINE_FG, FALSE);
+ g_return_val_if_fail (line <= MIXAL_LINE_PLAIN, FALSE);
+ g_return_val_if_fail (zone <= MIXAL_LINE_FG, FALSE);
return &colors_[line][zone];
}
diff --git a/mixgtk/mixgtk_mixal.h b/mixgtk/mixgtk_mixal.h
index 89ef52a..eaf0e23 100644
--- a/mixgtk/mixgtk_mixal.h
+++ b/mixgtk/mixgtk_mixal.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_mixal.h :
* Declarations for functions displaying the mixal source file
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/03/31 01:02:31 jose>
+ * Last change: Time-stamp: <2001-04-21 23:54:18 jao>
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -28,16 +28,30 @@
#include <gtk/gtk.h>
#include <mixlib/mix_vm.h>
+/* the possible colorised elements */
+typedef enum {
+ MIXAL_LINE_BREAK,
+ MIXAL_LINE_LOC,
+ MIXAL_LINE_PLAIN
+} mixal_line_t;
+
+typedef enum {
+ MIXAL_LINE_BG,
+ MIXAL_LINE_FG
+} mixal_line_zone_t;
+
+
/* initialise the mixal widget */
extern gboolean
mixgtk_mixal_init (mix_vm_t *vm);
-/* set the location pointer and break colors */
+/* set the plain, location pointer and break colors */
extern void
-mixgtk_mixal_set_loc_color (GdkColor *bg, GdkColor *fg);
+mixgtk_mixal_set_color (mixal_line_t line, mixal_line_zone_t zone,
+ const GdkColor *color);
-extern void
-mixgtk_mixal_set_break_color (GdkColor *bg, GdkColor *fg);
+extern const GdkColor *
+mixgtk_mixal_get_color (mixal_line_t line, mixal_line_zone_t zone);
/* load the corresponding mixal file */
diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c
index 165da81..c27b707 100644
--- a/mixgtk/mixgtk_widgets.c
+++ b/mixgtk/mixgtk_widgets.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixgtk_widgets.c :
* Implementation of the functions declared in mixgtk_widgets.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/03/15 14:42:37 jose"
+ * Last change: Time-stamp: "2001-04-22 00:01:30 jao"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -37,6 +37,7 @@ static const gchar *names_[] = {
"word_dialog",
"about_dialog",
"goto_dialog",
+ "color_dialog",
"command_prompt",
"command_log",
"mixal_clist",
diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h
index f20ddc3..00147fc 100644
--- a/mixgtk/mixgtk_widgets.h
+++ b/mixgtk/mixgtk_widgets.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_widgets.h :
* glade-based factory of mixvm widgets
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/03/15 14:42:13 jose>
+ * Last change: Time-stamp: <2001-04-22 00:01:13 jao>
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -35,6 +35,7 @@ typedef enum {
MIXGTK_WIDGET_WORD_DIALOG, /* input dialog for a mix word */
MIXGTK_WIDGET_ABOUT_DIALOG,
MIXGTK_WIDGET_GOTO_DIALOG,
+ MIXGTK_WIDGET_COLORSEL_DIALOG, /* color selection dialog */
MIXGTK_WIDGET_PROMPT, /* command prompt */
MIXGTK_WIDGET_LOG, /* command output */
MIXGTK_WIDGET_MIXAL, /* mixal source file */