[dia] Colour & LineWidth areas as 'real' widgets
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Colour & LineWidth areas as 'real' widgets
- Date: Sun, 12 May 2019 14:36:10 +0000 (UTC)
commit b3e047388ac8736586533d726ac78061313af517
Author: Zander Brown <zbrown gnome org>
Date: Fri Dec 28 00:42:48 2018 +0000
Colour & LineWidth areas as 'real' widgets
app/color_area.c | 449 ------------------------
app/dia-colour-area.c | 305 ++++++++++++++++
app/{color_area.h => dia-colour-area.h} | 33 +-
app/dia-line-width-area.c | 261 ++++++++++++++
app/{linewidth_area.h => dia-line-width-area.h} | 19 +-
app/linewidth_area.c | 278 ---------------
app/meson.build | 4 +-
app/toolbox.c | 8 +-
8 files changed, 619 insertions(+), 738 deletions(-)
---
diff --git a/app/dia-colour-area.c b/app/dia-colour-area.c
new file mode 100644
index 00000000..eba2a221
--- /dev/null
+++ b/app/dia-colour-area.c
@@ -0,0 +1,305 @@
+/* Dia -- an diagram creation/manipulation program
+ * Copyright (C) 1998 Alexander Larsson
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include "intl.h"
+
+#include "dia-colour-area.h"
+#include "attributes.h"
+#include "persistence.h"
+
+#define FORE_AREA 0
+#define BACK_AREA 1
+#define SWAP_AREA 2
+#define DEF_AREA 3
+
+#define FOREGROUND 0
+#define BACKGROUND 1
+
+G_DEFINE_TYPE (DiaColourArea, dia_colour_area, GTK_TYPE_EVENT_BOX)
+
+/* Local functions */
+static int
+dia_colour_area_target (DiaColourArea *self,
+ int x,
+ int y)
+{
+ gint rect_w, rect_h;
+ GtkAllocation alloc;
+
+ gtk_widget_get_allocation (GTK_WIDGET (self), &alloc);
+
+ rect_w = alloc.width * 0.65;
+ rect_h = alloc.height * 0.65;
+
+ /* foreground active */
+ if (x > 0 && x < rect_w &&
+ y > 0 && y < rect_h)
+ return FORE_AREA;
+ else if (x > (alloc.width - rect_w) && x < alloc.width &&
+ y > (alloc.height - rect_h) && y < alloc.height)
+ return BACK_AREA;
+ else if (x > 0 && x < (alloc.width - rect_w) &&
+ y > rect_h && y < alloc.height)
+ return DEF_AREA;
+ else if (x > rect_w && x < alloc.width &&
+ y > 0 && y < (alloc.height - rect_h))
+ return SWAP_AREA;
+ else
+ return -1;
+}
+
+static gboolean
+dia_colour_area_draw (GtkWidget *self, /*cairo_t *ctx*/
+ GdkEventExpose *event)
+{
+ GdkColor fg, bg;
+ gint rect_w, rect_h;
+ gint img_width, img_height;
+ DiaColourArea *priv = DIA_COLOUR_AREA (self);
+ cairo_t *ctx = gdk_cairo_create (gtk_widget_get_window (self));
+ GtkAllocation alloc;
+
+ gtk_widget_get_allocation (GTK_WIDGET (self), &alloc);
+
+ DIA_COLOR_TO_GDK (attributes_get_foreground(), fg);
+ DIA_COLOR_TO_GDK (attributes_get_background(), bg);
+
+ rect_w = alloc.width * 0.65;
+ rect_h = alloc.height * 0.65;
+
+ gdk_cairo_set_source_color (ctx, &bg);
+
+ cairo_rectangle (ctx,
+ (alloc.width - rect_w),
+ (alloc.height - rect_h),
+ rect_w, rect_h);
+ cairo_fill (ctx);
+
+ gdk_cairo_set_source_color (ctx, &fg);
+ cairo_rectangle (ctx, 0, 0, rect_w, rect_h);
+ cairo_fill (ctx);
+
+ /* draw the default colours pixmap */
+ img_width = gdk_pixbuf_get_width (priv->reset);
+ img_height = gdk_pixbuf_get_height (priv->reset);
+ gdk_cairo_set_source_pixbuf (ctx, priv->reset, 0, alloc.height - img_height);
+ cairo_rectangle (ctx, 0, alloc.height - img_height, img_width, img_height);
+ cairo_fill (ctx);
+
+ /* draw the swap pixmap */
+ img_width = gdk_pixbuf_get_width (priv->swap);
+ img_height = gdk_pixbuf_get_height (priv->swap);
+ gdk_cairo_set_source_pixbuf (ctx, priv->swap, alloc.width - img_width, 0);
+ cairo_rectangle (ctx, alloc.width - img_width, 0, img_width, img_height);
+ cairo_fill (ctx);
+
+ return FALSE;
+}
+
+static void
+dia_colour_area_response (GtkDialog *chooser,
+ gint response,
+ DiaColourArea *self)
+{
+ if (response == GTK_RESPONSE_OK) {
+ GdkColor gdk_color;
+ Color color;
+ GtkWidget *selection;
+ guint alpha;
+
+ // gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (chooser), &color);
+ selection = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (chooser));
+ gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (selection), &gdk_color);
+ alpha = gtk_color_selection_get_current_alpha (GTK_COLOR_SELECTION (selection));
+
+ GDK_COLOR_TO_DIA (gdk_color, color);
+ color.alpha = alpha / 65535.0;
+
+ if (self->edit_color == FOREGROUND) {
+ attributes_set_foreground (&color);
+ } else {
+ attributes_set_background (&color);
+ }
+ } else {
+ attributes_set_foreground (&self->stored_foreground);
+ attributes_set_background (&self->stored_background);
+ }
+
+ gtk_widget_hide (self->color_select);
+ self->color_select_active = 0;
+
+ /* Trigger redraw */
+ gtk_widget_queue_draw (GTK_WIDGET (self));
+}
+
+static void
+dia_colour_area_edit (DiaColourArea *self)
+{
+ GtkWidget *window;
+ GdkColor gdk_color;
+ Color color;
+ GtkWidget *selection;
+
+ if (!self->color_select_active) {
+ self->stored_foreground = attributes_get_foreground ();
+ self->stored_background = attributes_get_background ();
+ }
+
+ if (self->active_color == FOREGROUND) {
+ color = attributes_get_foreground ();
+ DIA_COLOR_TO_GDK (color, gdk_color);
+ self->edit_color = FOREGROUND;
+ } else {
+ color = attributes_get_background ();
+ DIA_COLOR_TO_GDK (color, gdk_color);
+ self->edit_color = BACKGROUND;
+ }
+
+ if (self->color_select) {
+ window = self->color_select;
+
+ gtk_window_set_title (GTK_WINDOW (self->color_select),
+ self->edit_color == FOREGROUND ?
+ _("Select foreground color") : _("Select background color"));
+
+ if (!self->color_select_active) {
+ gtk_widget_show (self->color_select);
+ }
+ } else {
+ window = self->color_select =
+ /*gtk_color_chooser_dialog_new (self->edit_color == FOREGROUND ?
+ _("Select foreground color") : _("Select background color"),
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));*/
+ gtk_color_selection_dialog_new (self->edit_color == FOREGROUND ?
+ _("Select foreground color") : _("Select background color"));
+
+ selection = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG
(self->color_select));
+
+ self->color_select_active = 1;
+ //gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (window), TRUE);
+ gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (selection), TRUE);
+
+ g_signal_connect (G_OBJECT (window), "response",
+ G_CALLBACK (dia_colour_area_response), self);
+
+ /* Make sure window is shown before setting its colors: */
+ gtk_widget_show (self->color_select);
+ }
+
+ selection = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG
(self->color_select));
+
+ gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (selection), &gdk_color);
+ gtk_color_selection_set_current_alpha (GTK_COLOR_SELECTION (selection),
+ (guint) (color.alpha * 65535.0));
+ //gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (self->color_select), &color);
+}
+
+static gint
+dia_colour_area_event (GtkWidget *widget,
+ GdkEvent *event)
+{
+ DiaColourArea *self = DIA_COLOUR_AREA (widget);
+ GdkEventButton *bevent;
+ int target;
+
+ switch (event->type) {
+ case GDK_BUTTON_PRESS:
+ bevent = (GdkEventButton *) event;
+
+ if (bevent->button == 1) {
+ switch ((target = dia_colour_area_target (self, bevent->x, bevent->y))) {
+ case FORE_AREA:
+ case BACK_AREA:
+ if (target == self->active_color) {
+ dia_colour_area_edit (self);
+ } else {
+ self->active_color = target;
+ /* Trigger redraw */
+ gtk_widget_queue_draw (GTK_WIDGET (self));
+ }
+ break;
+ case SWAP_AREA:
+ attributes_swap_fgbg();
+ /* Trigger redraw */
+ gtk_widget_queue_draw (GTK_WIDGET (self));
+ break;
+ case DEF_AREA:
+ attributes_default_fgbg();
+ /* Trigger redraw */
+ gtk_widget_queue_draw (GTK_WIDGET (self));
+ break;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+#include "pixmaps/swap.xpm"
+#include "pixmaps/default.xpm"
+
+static void
+dia_colour_area_class_init (DiaColourAreaClass *class)
+{
+ GtkWidgetClass *widget_class;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->expose_event = dia_colour_area_draw;
+ widget_class->event = dia_colour_area_event;
+
+ attributes_set_foreground (persistence_register_color ("fg_color", &color_black));
+ attributes_set_background (persistence_register_color ("bg_color", &color_white));
+}
+
+static void
+dia_colour_area_init (DiaColourArea *self)
+{
+ self->reset = gdk_pixbuf_new_from_xpm_data (default_xpm);
+ self->swap = gdk_pixbuf_new_from_xpm_data (swap_xpm);
+
+ self->active_color = 0;
+
+ self->color_select = NULL;
+ self->color_select_active = 0;
+
+ gtk_widget_set_events (GTK_WIDGET (self), GDK_BUTTON_PRESS_MASK);
+}
+
+GtkWidget *
+dia_colour_area_new (int width,
+ int height)
+{
+ GtkWidget *event_box;
+
+ event_box = g_object_new (DIA_TYPE_COLOUR_AREA, NULL);
+ gtk_widget_set_size_request (event_box, width, height);
+
+ gtk_widget_show (event_box);
+
+ return event_box;
+}
diff --git a/app/color_area.h b/app/dia-colour-area.h
similarity index 56%
rename from app/color_area.h
rename to app/dia-colour-area.h
index d745732e..d83997e7 100644
--- a/app/color_area.h
+++ b/app/dia-colour-area.h
@@ -15,11 +15,36 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef COLOR_AREA_H
-#define COLOR_AREA_H
+#ifndef COLOUR_AREA_H
+#define COLOUR_AREA_H
#include <gtk/gtk.h>
-GtkWidget *color_area_create (int width, int height);
+#include "color.h"
-#endif /* COLOR_AREA_H */
+#ifndef EVENT_APTR
+#define EVENT_APTR
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkEventBox, g_object_unref)
+#endif
+
+#define DIA_TYPE_COLOUR_AREA (dia_colour_area_get_type ())
+G_DECLARE_FINAL_TYPE (DiaColourArea, dia_colour_area, DIA, COLOUR_AREA, GtkEventBox)
+
+struct _DiaColourArea
+{
+ GtkEventBox parent;
+ int active_color;
+
+ GdkPixbuf *reset;
+ GdkPixbuf *swap;
+
+ GtkWidget *color_select;
+ int color_select_active;
+ int edit_color;
+ Color stored_foreground;
+ Color stored_background;
+};
+
+GtkWidget *dia_colour_area_new (int width, int height);
+
+#endif /* COLOUR_AREA_H */
diff --git a/app/dia-line-width-area.c b/app/dia-line-width-area.c
new file mode 100644
index 00000000..d38a9141
--- /dev/null
+++ b/app/dia-line-width-area.c
@@ -0,0 +1,261 @@
+/* Dia -- an diagram creation/manipulation program
+ * Copyright (C) 1998 Alexander Larsson
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "dia-line-width-area.h"
+#include "attributes.h"
+#include "persistence.h"
+#include "intl.h"
+
+#if !defined(rint)
+# include <math.h>
+# define rint(x) floor ((x) + 0.5)
+#endif
+
+#define BASE_WIDTH 0.05
+#define PIXELS_BETWEEN_LINES 6
+#define NUMLINES 5
+
+#define X_OFFSET(i) (PIXELS_BETWEEN_LINES*(i)+((i)-1)*(i)/2)
+
+#define AREA_WIDTH X_OFFSET(NUMLINES+1)
+#define AREA_HEIGHT 42
+
+G_DEFINE_TYPE (DiaLineWidthArea, dia_line_width_area, GTK_TYPE_EVENT_BOX)
+
+static int
+linewidth_area_target (int x, int y)
+{
+ int i;
+ int x_offs;
+ for (i=1;i<=NUMLINES;i++) {
+ x_offs = X_OFFSET(i);
+ if ((x>=x_offs-PIXELS_BETWEEN_LINES/2) &&
+ (x<x_offs+i+PIXELS_BETWEEN_LINES/2))
+ return i;
+ }
+ return 0;
+}
+
+static int
+linewidth_number_from_width (real width)
+{
+ if (fabs(width/BASE_WIDTH-rint(width/BASE_WIDTH)) > 0.0005 ||
+ (width/BASE_WIDTH > NUMLINES)) {
+ return 0;
+ } else {
+ return width/BASE_WIDTH+1.0005;
+ }
+}
+
+static void
+dia_line_width_area_dialog_respond (GtkWidget *widget,
+ gint response_id,
+ DiaLineWidthArea *self)
+{
+ if (response_id == GTK_RESPONSE_OK) {
+ float newvalue = gtk_spin_button_get_value (GTK_SPIN_BUTTON (self->button));
+ self->active = linewidth_number_from_width (newvalue);
+ /* Trigger redraw */
+ gtk_widget_queue_draw (GTK_WIDGET (self));
+ attributes_set_default_linewidth (newvalue);
+ }
+ gtk_widget_hide(self->dialog);
+}
+
+static void
+dia_line_width_area_dialog_ok (GtkWidget *widget, DiaLineWidthArea *self)
+{
+ gtk_dialog_response (GTK_DIALOG (self->dialog), GTK_RESPONSE_OK);
+}
+
+/* Crashes with gtk_widget_destroyed, so use this instead */
+static void
+dialog_destroyed(GtkWidget *widget, gpointer data)
+{
+ GtkWidget **wid = (GtkWidget**)data;
+ if (wid) *wid = NULL;
+}
+
+static void
+dia_line_width_area_create_dialog (DiaLineWidthArea *self,
+ GtkWindow *toplevel)
+{
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkAdjustment *adj;
+
+ self->dialog = gtk_dialog_new_with_buttons (_("Line width"), toplevel, 0,
+ _("Cancel"), GTK_RESPONSE_CANCEL,
+ _("Okay"), GTK_RESPONSE_OK,
+ NULL);
+
+ gtk_dialog_set_default_response (GTK_DIALOG(self->dialog), GTK_RESPONSE_OK);
+ gtk_window_set_role (GTK_WINDOW (self->dialog), "linewidth_window");
+ gtk_window_set_resizable (GTK_WINDOW (self->dialog), TRUE);
+ gtk_container_set_border_width (GTK_CONTAINER (self->dialog), 2);
+
+ hbox = gtk_hbox_new (FALSE, 5);
+ label = gtk_label_new(_("Line width:"));
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ gtk_widget_show (label);
+ adj = (GtkAdjustment *) gtk_adjustment_new(0.1, 0.00, 10.0, 0.01, 0.05, 0.0);
+ self->button = gtk_spin_button_new(adj, attributes_get_default_linewidth(), 2);
+ gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(self->button), TRUE);
+ gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(self->button), TRUE);
+ gtk_box_pack_start(GTK_BOX (hbox), self->button, TRUE, TRUE, 0);
+ gtk_widget_show (self->button);
+ gtk_widget_show(hbox);
+ gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG (self->dialog))), hbox, TRUE, TRUE, 0);
+
+ gtk_widget_show (self->button);
+
+ g_signal_connect(G_OBJECT (self->dialog), "response",
+ G_CALLBACK (dia_line_width_area_dialog_respond), self);
+ g_signal_connect_after (G_OBJECT (self->button), "activate",
+ G_CALLBACK (dia_line_width_area_dialog_ok), self);
+
+ g_signal_connect (G_OBJECT (self->dialog), "delete_event",
+ G_CALLBACK(gtk_widget_hide), NULL);
+ g_signal_connect (G_OBJECT (self->dialog), "destroy",
+ G_CALLBACK(dialog_destroyed), &self->dialog);
+
+ persistence_register_window (GTK_WINDOW (self->dialog));
+}
+
+static gboolean
+dia_line_width_area_draw (GtkWidget *self, /*cairo_t *ctx*/
+ GdkEventExpose *event)
+{
+ GdkColor fg;
+ int i;
+ int x_offs;
+ GtkStyle *style;
+ double dashes[] = { 3 };
+ DiaLineWidthArea *priv = DIA_LINE_WIDTH_AREA (self);
+ GtkAllocation alloc;
+ cairo_t *ctx = gdk_cairo_create (gtk_widget_get_window (self));
+
+ gtk_widget_get_allocation (self, &alloc);
+
+ cairo_set_line_width (ctx, 1);
+ cairo_set_line_cap (ctx, CAIRO_LINE_CAP_BUTT);
+ cairo_set_line_join (ctx, CAIRO_LINE_JOIN_MITER);
+ cairo_set_dash (ctx, dashes, 1, 0);
+
+ style = gtk_widget_get_style (self);
+ fg = style->fg[gtk_widget_get_state (self)];
+
+ /*gtk_style_context_get_color (gtk_widget_get_style_context (self),
+ gtk_widget_get_state_flags (self),
+ &fg);*/
+
+ gdk_cairo_set_source_color (ctx, &fg);
+
+ for (i = 0; i <= NUMLINES; i++) {
+ x_offs = X_OFFSET(i);
+
+ cairo_rectangle (ctx, x_offs, 2, i, alloc.height - 4);
+ cairo_fill (ctx);
+ }
+
+ if (priv->active != 0) {
+ cairo_rectangle (ctx, X_OFFSET(priv->active) - 2, 0,
+ priv->active + 4, alloc.height - 1);
+ cairo_stroke (ctx);
+ }
+
+ return FALSE;
+}
+
+static gint
+dia_line_width_area_event (GtkWidget *self,
+ GdkEvent *event)
+{
+ GdkEventButton *bevent;
+ int target;
+ DiaLineWidthArea *priv = DIA_LINE_WIDTH_AREA (self);
+
+ switch (event->type)
+ {
+ case GDK_BUTTON_PRESS:
+ bevent = (GdkEventButton *) event;
+ if (bevent->button == 1) {
+ target = linewidth_area_target (bevent->x, bevent->y);
+ if (target != 0) {
+ priv->active = target;
+ /* Trigger redraw */
+ gtk_widget_queue_draw (self);
+ attributes_set_default_linewidth(BASE_WIDTH*(target-1));
+ }
+ }
+ break;
+
+ case GDK_2BUTTON_PRESS:
+ if (priv->dialog == NULL)
+ dia_line_width_area_create_dialog (priv, GTK_WINDOW (gtk_widget_get_toplevel (self)));
+ else
+ gtk_widget_grab_focus (priv->button);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->button), attributes_get_default_linewidth ());
+
+ gtk_widget_show (priv->dialog);
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+static void
+dia_line_width_area_class_init (DiaLineWidthAreaClass *class)
+{
+ GtkWidgetClass *widget_class;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->expose_event = dia_line_width_area_draw;
+ widget_class->event = dia_line_width_area_event;
+
+ attributes_set_default_linewidth (persistence_register_real ("linewidth", 0.1));
+}
+
+static void
+dia_line_width_area_init (DiaLineWidthArea *self)
+{
+ self->active = linewidth_number_from_width (attributes_get_default_linewidth ());
+
+ gtk_widget_set_events (GTK_WIDGET (self), GDK_BUTTON_PRESS_MASK);
+}
+
+
+GtkWidget *
+dia_line_width_area_new ()
+{
+ GtkWidget *event_box;
+
+ event_box = g_object_new (DIA_TYPE_LINE_WIDTH_AREA, NULL);
+ gtk_widget_set_size_request (event_box, AREA_WIDTH, AREA_HEIGHT);
+
+ gtk_widget_show (event_box);
+
+ return event_box;
+}
diff --git a/app/linewidth_area.h b/app/dia-line-width-area.h
similarity index 68%
rename from app/linewidth_area.h
rename to app/dia-line-width-area.h
index d32b037f..597d8f66 100644
--- a/app/linewidth_area.h
+++ b/app/dia-line-width-area.h
@@ -20,7 +20,24 @@
#include <gtk/gtk.h>
-GtkWidget *linewidth_area_create (void);
+#ifndef EVENT_APTR
+#define EVENT_APTR
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkEventBox, g_object_unref)
+#endif
+
+#define DIA_TYPE_LINE_WIDTH_AREA (dia_line_width_area_get_type ())
+G_DECLARE_FINAL_TYPE (DiaLineWidthArea, dia_line_width_area, DIA, LINE_WIDTH_AREA, GtkEventBox)
+
+struct _DiaLineWidthArea
+{
+ GtkEventBox parent;
+
+ int active;
+ GtkWidget *dialog;
+ GtkWidget *button;
+};
+
+GtkWidget *dia_line_width_area_new ();
#endif /* LINEWDITH_AREA_H */
diff --git a/app/meson.build b/app/meson.build
index 4dd631ba..c8d5ca4f 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -15,8 +15,8 @@ dia_sources = [
'disp_callbacks.c',
'display.c',
'select.c',
- 'color_area.c',
- 'linewidth_area.c',
+ 'dia-colour-area.c',
+ 'dia-line-width-area.c',
'grid.c',
'handle_ops.c',
'interface.c',
diff --git a/app/toolbox.c b/app/toolbox.c
index 12af33a0..55534d3d 100644
--- a/app/toolbox.c
+++ b/app/toolbox.c
@@ -27,13 +27,13 @@
#include "diadynamicmenu.h"
#include "attributes.h"
#include "sheet.h"
-#include "color_area.h"
+#include "dia-colour-area.h"
+#include "dia-line-width-area.h"
#include "intl.h"
#include "message.h"
#include "object.h"
#include "widgets.h"
-#include "linewidth_area.h"
#include "preferences.h"
#include "persistence.h"
@@ -477,7 +477,7 @@ create_color_area (GtkWidget *parent)
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
- col_area = color_area_create (54, 42);
+ col_area = dia_colour_area_new (54, 42);
gtk_container_add (GTK_CONTAINER (alignment), col_area);
@@ -495,7 +495,7 @@ create_color_area (GtkWidget *parent)
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
- line_area = linewidth_area_create ();
+ line_area = dia_line_width_area_new ();
gtk_container_add (GTK_CONTAINER (alignment), line_area);
gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
gtk_widget_set_tooltip_text(line_area, _("Line widths. Click on a line to set the default line width for
new objects. Double-click to set the line width more precisely."));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]