added gradient preview to the toolbox.
--Sven
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
Wed Sep 1 13:29:09 MEST 1999 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/gimpcontextpreview.[ch]: added gradient preview.
|
||||||
|
|
||||||
|
* app/gradient_select.c
|
||||||
|
* app/indicator_area.[ch]
|
||||||
|
* app/interface.c: display the active gradient in the toolbox.
|
||||||
|
|
||||||
Tue Aug 31 23:13:51 PDT 1999 Manish Singh <yosh@gimp.org>
|
Tue Aug 31 23:13:51 PDT 1999 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* app/tile_swap.c: no leading underscore for S_IFOO constants
|
* app/tile_swap.c: no leading underscore for S_IFOO constants
|
||||||
|
@ -267,7 +267,7 @@ create_indicator_area (GtkWidget *parent)
|
|||||||
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
|
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
||||||
|
|
||||||
ind_area = indicator_area_create (54, 42);
|
ind_area = indicator_area_create ();
|
||||||
gtk_container_add (GTK_CONTAINER (alignment), ind_area);
|
gtk_container_add (GTK_CONTAINER (alignment), ind_area);
|
||||||
gtk_widget_show (ind_area);
|
gtk_widget_show (ind_area);
|
||||||
gtk_widget_show (alignment);
|
gtk_widget_show (alignment);
|
||||||
|
@ -267,7 +267,7 @@ create_indicator_area (GtkWidget *parent)
|
|||||||
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
|
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
||||||
|
|
||||||
ind_area = indicator_area_create (54, 42);
|
ind_area = indicator_area_create ();
|
||||||
gtk_container_add (GTK_CONTAINER (alignment), ind_area);
|
gtk_container_add (GTK_CONTAINER (alignment), ind_area);
|
||||||
gtk_widget_show (ind_area);
|
gtk_widget_show (ind_area);
|
||||||
gtk_widget_show (alignment);
|
gtk_widget_show (alignment);
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "gimpbrushpipe.h"
|
#include "gimpbrushpipe.h"
|
||||||
#include "gimpbrushpipeP.h"
|
#include "gimpbrushpipeP.h"
|
||||||
#include "gimpcontextpreview.h"
|
#include "gimpcontextpreview.h"
|
||||||
|
#include "gradient.h"
|
||||||
|
#include "gradient_header.h"
|
||||||
#include "interface.h" /* for tool_tips */
|
#include "interface.h" /* for tool_tips */
|
||||||
#include "patterns.h"
|
#include "patterns.h"
|
||||||
#include "temp_buf.h"
|
#include "temp_buf.h"
|
||||||
@ -46,14 +48,22 @@ static unsigned char scale_indicator_bits[7][7][3] =
|
|||||||
{ WHT, WHT, WHT, WHT, WHT, WHT, WHT }
|
{ WHT, WHT, WHT, WHT, WHT, WHT, WHT }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* size of the gradient popup */
|
||||||
|
#define GRADIENT_POPUP_WIDTH 128
|
||||||
|
#define GRADIENT_POPUP_HEIGHT 32
|
||||||
|
|
||||||
|
/* event mask for the context_preview */
|
||||||
#define CONTEXT_PREVIEW_EVENT_MASK (GDK_BUTTON_PRESS_MASK | \
|
#define CONTEXT_PREVIEW_EVENT_MASK (GDK_BUTTON_PRESS_MASK | \
|
||||||
GDK_BUTTON_RELEASE_MASK | \
|
GDK_BUTTON_RELEASE_MASK | \
|
||||||
GDK_ENTER_NOTIFY_MASK | \
|
GDK_ENTER_NOTIFY_MASK | \
|
||||||
GDK_LEAVE_NOTIFY_MASK)
|
GDK_LEAVE_NOTIFY_MASK)
|
||||||
|
|
||||||
|
/* shared widgets for the popups */
|
||||||
static GtkWidget *gcp_popup = NULL;
|
static GtkWidget *gcp_popup = NULL;
|
||||||
static GtkWidget *gcp_popup_preview = NULL;
|
static GtkWidget *gcp_popup_preview = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/* signals */
|
||||||
enum {
|
enum {
|
||||||
CLICKED,
|
CLICKED,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
@ -75,6 +85,8 @@ static void gimp_context_preview_draw_brush (GimpContextPreview *)
|
|||||||
static void gimp_context_preview_draw_brush_popup (GimpContextPreview *);
|
static void gimp_context_preview_draw_brush_popup (GimpContextPreview *);
|
||||||
static void gimp_context_preview_draw_pattern (GimpContextPreview *);
|
static void gimp_context_preview_draw_pattern (GimpContextPreview *);
|
||||||
static void gimp_context_preview_draw_pattern_popup (GimpContextPreview *);
|
static void gimp_context_preview_draw_pattern_popup (GimpContextPreview *);
|
||||||
|
static void gimp_context_preview_draw_gradient (GimpContextPreview *);
|
||||||
|
static void gimp_context_preview_draw_gradient_popup (GimpContextPreview *);
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -195,9 +207,14 @@ gimp_context_preview_update (GimpContextPreview *gcp,
|
|||||||
break;
|
break;
|
||||||
case GCP_PATTERN:
|
case GCP_PATTERN:
|
||||||
gimp_context_preview_draw_pattern (gcp);
|
gimp_context_preview_draw_pattern (gcp);
|
||||||
|
break;
|
||||||
|
case GCP_GRADIENT:
|
||||||
|
gimp_context_preview_draw_gradient (gcp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (gcp));
|
||||||
|
|
||||||
if (gcp->show_tooltips)
|
if (gcp->show_tooltips)
|
||||||
{
|
{
|
||||||
@ -217,6 +234,12 @@ gimp_context_preview_update (GimpContextPreview *gcp,
|
|||||||
name = pattern->name;
|
name = pattern->name;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GCP_GRADIENT:
|
||||||
|
{
|
||||||
|
gradient_t *gradient = (gradient_t *)(gcp->data);
|
||||||
|
name = gradient->name;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -276,6 +299,10 @@ gimp_context_preview_popup_open (GimpContextPreview *gcp,
|
|||||||
height = pattern->mask->height;
|
height = pattern->mask->height;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GCP_GRADIENT:
|
||||||
|
width = GRADIENT_POPUP_WIDTH;
|
||||||
|
height = GRADIENT_POPUP_HEIGHT;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -328,6 +355,9 @@ gimp_context_preview_popup_open (GimpContextPreview *gcp,
|
|||||||
case GCP_PATTERN:
|
case GCP_PATTERN:
|
||||||
gimp_context_preview_draw_pattern_popup (gcp);
|
gimp_context_preview_draw_pattern_popup (gcp);
|
||||||
break;
|
break;
|
||||||
|
case GCP_GRADIENT:
|
||||||
|
gimp_context_preview_draw_gradient_popup (gcp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -355,7 +385,8 @@ gimp_context_preview_data_matches_type (GimpContextPreview *gcp,
|
|||||||
match = GIMP_IS_BRUSH (data);
|
match = GIMP_IS_BRUSH (data);
|
||||||
break;
|
break;
|
||||||
case GCP_PATTERN:
|
case GCP_PATTERN:
|
||||||
match = data != NULL; /* would be nice if pattern was a real gtk_object */
|
case GCP_GRADIENT:
|
||||||
|
match = data != NULL; /* would be nicer if these were real gtk_objects */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -527,8 +558,6 @@ gimp_context_preview_draw_brush (GimpContextPreview *gcp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_free (buf);
|
g_free (buf);
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (gcp));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -636,3 +665,90 @@ gimp_context_preview_draw_pattern (GimpContextPreview *gcp)
|
|||||||
|
|
||||||
g_free(buf);
|
g_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* gradient draw functions */
|
||||||
|
|
||||||
|
static void
|
||||||
|
draw_gradient (GtkPreview *preview,
|
||||||
|
gradient_t *gradient,
|
||||||
|
gint width,
|
||||||
|
gint height)
|
||||||
|
{
|
||||||
|
gradient_t *old_gradient = curr_gradient;
|
||||||
|
guchar *p0, *p1, *even, *odd;
|
||||||
|
gint x, y;
|
||||||
|
gdouble dx, cur_x;
|
||||||
|
gdouble r, g, b, a;
|
||||||
|
gdouble c0, c1;
|
||||||
|
|
||||||
|
curr_gradient = gradient;
|
||||||
|
|
||||||
|
dx = 1.0 / (width - 1);
|
||||||
|
cur_x = 0.0;
|
||||||
|
p0 = even = g_new (guchar, 3 * width);
|
||||||
|
p1 = odd = g_new (guchar, 3 * width);
|
||||||
|
|
||||||
|
for (x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
grad_get_color_at (cur_x, &r, &g, &b, &a);
|
||||||
|
|
||||||
|
if ((x / GRAD_CHECK_SIZE_SM) & 1)
|
||||||
|
{
|
||||||
|
c0 = GRAD_CHECK_LIGHT;
|
||||||
|
c1 = GRAD_CHECK_DARK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c0 = GRAD_CHECK_DARK;
|
||||||
|
c1 = GRAD_CHECK_LIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
*p0++ = (c0 + (r - c0) * a) * 255.0;
|
||||||
|
*p0++ = (c0 + (g - c0) * a) * 255.0;
|
||||||
|
*p0++ = (c0 + (b - c0) * a) * 255.0;
|
||||||
|
|
||||||
|
*p1++ = (c1 + (r - c1) * a) * 255.0;
|
||||||
|
*p1++ = (c1 + (g - c1) * a) * 255.0;
|
||||||
|
*p1++ = (c1 + (b - c1) * a) * 255.0;
|
||||||
|
|
||||||
|
cur_x += dx;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
if ((y / GRAD_CHECK_SIZE_SM) & 1)
|
||||||
|
gtk_preview_draw_row (preview, odd, 0, y, width);
|
||||||
|
else
|
||||||
|
gtk_preview_draw_row (preview, even, 0, y, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (odd);
|
||||||
|
g_free (even);
|
||||||
|
curr_gradient = old_gradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_context_preview_draw_gradient_popup (GimpContextPreview *gcp)
|
||||||
|
{
|
||||||
|
gradient_t *gradient;
|
||||||
|
|
||||||
|
g_return_if_fail (gcp != NULL && gcp->data != NULL);
|
||||||
|
|
||||||
|
gradient = (gradient_t*)(gcp->data);
|
||||||
|
draw_gradient (GTK_PREVIEW (gcp_popup_preview), gradient,
|
||||||
|
GRADIENT_POPUP_WIDTH, GRADIENT_POPUP_HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_context_preview_draw_gradient (GimpContextPreview *gcp)
|
||||||
|
{
|
||||||
|
gradient_t *gradient;
|
||||||
|
|
||||||
|
g_return_if_fail (gcp != NULL && gcp->data != NULL);
|
||||||
|
|
||||||
|
gradient = (gradient_t*)(gcp->data);
|
||||||
|
draw_gradient (GTK_PREVIEW (gcp), gradient, gcp->width, gcp->height);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ typedef enum
|
|||||||
{
|
{
|
||||||
GCP_BRUSH = 0,
|
GCP_BRUSH = 0,
|
||||||
GCP_PATTERN,
|
GCP_PATTERN,
|
||||||
|
GCP_GRADIENT,
|
||||||
GCP_LAST
|
GCP_LAST
|
||||||
} GimpContextPreviewType;
|
} GimpContextPreviewType;
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "gimprc.h"
|
#include "gimprc.h"
|
||||||
#include "gradient.h"
|
#include "gradient.h"
|
||||||
#include "gradient_header.h"
|
#include "gradient_header.h"
|
||||||
|
#include "indicator_area.h"
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
@ -261,6 +262,7 @@ sel_list_item_update(GtkWidget *widget,
|
|||||||
if(gsp == gradient_select_dialog)
|
if(gsp == gradient_select_dialog)
|
||||||
{
|
{
|
||||||
grad_set_grad_to_name(gsp->grad->name);
|
grad_set_grad_to_name(gsp->grad->name);
|
||||||
|
gradient_area_update (); /* update the indicator_area */
|
||||||
import_palette_grad_update(gsp->grad);
|
import_palette_grad_update(gsp->grad);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -279,7 +281,7 @@ grad_select_edit_callback (GtkWidget *w,
|
|||||||
|
|
||||||
grad_create_gradient_editor_init(TRUE);
|
grad_create_gradient_editor_init(TRUE);
|
||||||
|
|
||||||
/* Set the current gradient in this dailog to the "real current"*/
|
/* Set the current gradient in this dialog to the "real current"*/
|
||||||
if(gsp && gsp->grad)
|
if(gsp && gsp->grad)
|
||||||
grad_set_grad_to_name(gsp->grad->name);
|
grad_set_grad_to_name(gsp->grad->name);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "gimprc.h"
|
#include "gimprc.h"
|
||||||
#include "gradient.h"
|
#include "gradient.h"
|
||||||
#include "gradient_header.h"
|
#include "gradient_header.h"
|
||||||
|
#include "indicator_area.h"
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
@ -261,6 +262,7 @@ sel_list_item_update(GtkWidget *widget,
|
|||||||
if(gsp == gradient_select_dialog)
|
if(gsp == gradient_select_dialog)
|
||||||
{
|
{
|
||||||
grad_set_grad_to_name(gsp->grad->name);
|
grad_set_grad_to_name(gsp->grad->name);
|
||||||
|
gradient_area_update (); /* update the indicator_area */
|
||||||
import_palette_grad_update(gsp->grad);
|
import_palette_grad_update(gsp->grad);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -279,7 +281,7 @@ grad_select_edit_callback (GtkWidget *w,
|
|||||||
|
|
||||||
grad_create_gradient_editor_init(TRUE);
|
grad_create_gradient_editor_init(TRUE);
|
||||||
|
|
||||||
/* Set the current gradient in this dailog to the "real current"*/
|
/* Set the current gradient in this dialog to the "real current"*/
|
||||||
if(gsp && gsp->grad)
|
if(gsp && gsp->grad)
|
||||||
grad_set_grad_to_name(gsp->grad->name);
|
grad_set_grad_to_name(gsp->grad->name);
|
||||||
}
|
}
|
||||||
|
@ -21,17 +21,21 @@
|
|||||||
#include "appenv.h"
|
#include "appenv.h"
|
||||||
#include "gimpbrushlist.h"
|
#include "gimpbrushlist.h"
|
||||||
#include "gimpcontextpreview.h"
|
#include "gimpcontextpreview.h"
|
||||||
|
#include "gradient.h"
|
||||||
|
#include "gradient_header.h"
|
||||||
#include "indicator_area.h"
|
#include "indicator_area.h"
|
||||||
#include "interface.h" /* for tool_tips */
|
#include "interface.h" /* for tool_tips */
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
#define CELL_SIZE 23 /* The size of the previews */
|
#define CELL_SIZE 23 /* The size of the previews */
|
||||||
#define CELL_PADDING 2 /* How much between brush and pattern cells */
|
#define GRAD_CELL_WIDTH 48 /* The width of the gradient preview */
|
||||||
|
#define GRAD_CELL_HEIGHT 12 /* The height of the gradient preview */
|
||||||
|
#define CELL_PADDING 2 /* How much between brush and pattern cells */
|
||||||
|
|
||||||
/* Static variables */
|
/* Static variables */
|
||||||
static GtkWidget *indicator_table;
|
|
||||||
static GtkWidget *brush_preview;
|
static GtkWidget *brush_preview;
|
||||||
static GtkWidget *pattern_preview;
|
static GtkWidget *pattern_preview;
|
||||||
|
static GtkWidget *gradient_preview;
|
||||||
|
|
||||||
|
|
||||||
/* The _area_update () functions should be called _preview_update(),
|
/* The _area_update () functions should be called _preview_update(),
|
||||||
@ -88,11 +92,28 @@ pattern_preview_clicked (GtkWidget *widget,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
void
|
||||||
indicator_area_create (int width,
|
gradient_area_update ()
|
||||||
int height)
|
|
||||||
{
|
{
|
||||||
indicator_table = gtk_table_new (1, 3, FALSE);
|
gimp_context_preview_update (GIMP_CONTEXT_PREVIEW (gradient_preview), curr_gradient);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gradient_preview_clicked (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
grad_create_gradient_editor ();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
indicator_area_create ()
|
||||||
|
{
|
||||||
|
GtkWidget *indicator_table;
|
||||||
|
|
||||||
|
indicator_table = gtk_table_new (2, 2, FALSE);
|
||||||
|
gtk_table_set_row_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
|
||||||
|
gtk_table_set_col_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
|
||||||
|
|
||||||
brush_preview = gimp_context_preview_new (GCP_BRUSH,
|
brush_preview = gimp_context_preview_new (GCP_BRUSH,
|
||||||
CELL_SIZE, CELL_SIZE,
|
CELL_SIZE, CELL_SIZE,
|
||||||
@ -116,11 +137,24 @@ indicator_area_create (int width,
|
|||||||
gtk_table_attach_defaults (GTK_TABLE(indicator_table), pattern_preview,
|
gtk_table_attach_defaults (GTK_TABLE(indicator_table), pattern_preview,
|
||||||
1, 2, 0, 1);
|
1, 2, 0, 1);
|
||||||
|
|
||||||
|
gradient_preview = gimp_context_preview_new (GCP_GRADIENT,
|
||||||
|
GRAD_CELL_WIDTH, GRAD_CELL_HEIGHT,
|
||||||
|
FALSE);
|
||||||
|
gtk_tooltips_set_tip (tool_tips, gradient_preview,
|
||||||
|
_("The active gradient.\nClick to open the Gradients Dialog."),
|
||||||
|
NULL);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gradient_preview), "clicked",
|
||||||
|
(GtkSignalFunc) gradient_preview_clicked, NULL);
|
||||||
|
gtk_table_attach_defaults (GTK_TABLE(indicator_table), gradient_preview,
|
||||||
|
0, 2, 1, 2);
|
||||||
|
|
||||||
brush_area_update ();
|
brush_area_update ();
|
||||||
pattern_area_update ();
|
pattern_area_update ();
|
||||||
|
gradient_area_update ();
|
||||||
|
|
||||||
gtk_widget_show (brush_preview);
|
gtk_widget_show (brush_preview);
|
||||||
gtk_widget_show (pattern_preview);
|
gtk_widget_show (pattern_preview);
|
||||||
|
gtk_widget_show (gradient_preview);
|
||||||
gtk_widget_show (indicator_table);
|
gtk_widget_show (indicator_table);
|
||||||
|
|
||||||
return (indicator_table);
|
return (indicator_table);
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#define __INDICATOR_AREA_H__
|
#define __INDICATOR_AREA_H__
|
||||||
#include "patterns.h"
|
#include "patterns.h"
|
||||||
#include "gimpbrushlist.h"
|
#include "gimpbrushlist.h"
|
||||||
GtkWidget *
|
|
||||||
indicator_area_create (int width, int height);
|
|
||||||
|
|
||||||
void brush_area_update(void);
|
GtkWidget *indicator_area_create (void);
|
||||||
void pattern_area_update(void);
|
void brush_area_update (void);
|
||||||
|
void pattern_area_update (void);
|
||||||
|
void gradient_area_update (void);
|
||||||
|
|
||||||
#endif /* __INDICATOR_AREA_H__ */
|
#endif /* __INDICATOR_AREA_H__ */
|
||||||
|
|
||||||
|
@ -21,17 +21,21 @@
|
|||||||
#include "appenv.h"
|
#include "appenv.h"
|
||||||
#include "gimpbrushlist.h"
|
#include "gimpbrushlist.h"
|
||||||
#include "gimpcontextpreview.h"
|
#include "gimpcontextpreview.h"
|
||||||
|
#include "gradient.h"
|
||||||
|
#include "gradient_header.h"
|
||||||
#include "indicator_area.h"
|
#include "indicator_area.h"
|
||||||
#include "interface.h" /* for tool_tips */
|
#include "interface.h" /* for tool_tips */
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
#define CELL_SIZE 23 /* The size of the previews */
|
#define CELL_SIZE 23 /* The size of the previews */
|
||||||
#define CELL_PADDING 2 /* How much between brush and pattern cells */
|
#define GRAD_CELL_WIDTH 48 /* The width of the gradient preview */
|
||||||
|
#define GRAD_CELL_HEIGHT 12 /* The height of the gradient preview */
|
||||||
|
#define CELL_PADDING 2 /* How much between brush and pattern cells */
|
||||||
|
|
||||||
/* Static variables */
|
/* Static variables */
|
||||||
static GtkWidget *indicator_table;
|
|
||||||
static GtkWidget *brush_preview;
|
static GtkWidget *brush_preview;
|
||||||
static GtkWidget *pattern_preview;
|
static GtkWidget *pattern_preview;
|
||||||
|
static GtkWidget *gradient_preview;
|
||||||
|
|
||||||
|
|
||||||
/* The _area_update () functions should be called _preview_update(),
|
/* The _area_update () functions should be called _preview_update(),
|
||||||
@ -88,11 +92,28 @@ pattern_preview_clicked (GtkWidget *widget,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
void
|
||||||
indicator_area_create (int width,
|
gradient_area_update ()
|
||||||
int height)
|
|
||||||
{
|
{
|
||||||
indicator_table = gtk_table_new (1, 3, FALSE);
|
gimp_context_preview_update (GIMP_CONTEXT_PREVIEW (gradient_preview), curr_gradient);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gradient_preview_clicked (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
grad_create_gradient_editor ();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
indicator_area_create ()
|
||||||
|
{
|
||||||
|
GtkWidget *indicator_table;
|
||||||
|
|
||||||
|
indicator_table = gtk_table_new (2, 2, FALSE);
|
||||||
|
gtk_table_set_row_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
|
||||||
|
gtk_table_set_col_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
|
||||||
|
|
||||||
brush_preview = gimp_context_preview_new (GCP_BRUSH,
|
brush_preview = gimp_context_preview_new (GCP_BRUSH,
|
||||||
CELL_SIZE, CELL_SIZE,
|
CELL_SIZE, CELL_SIZE,
|
||||||
@ -116,11 +137,24 @@ indicator_area_create (int width,
|
|||||||
gtk_table_attach_defaults (GTK_TABLE(indicator_table), pattern_preview,
|
gtk_table_attach_defaults (GTK_TABLE(indicator_table), pattern_preview,
|
||||||
1, 2, 0, 1);
|
1, 2, 0, 1);
|
||||||
|
|
||||||
|
gradient_preview = gimp_context_preview_new (GCP_GRADIENT,
|
||||||
|
GRAD_CELL_WIDTH, GRAD_CELL_HEIGHT,
|
||||||
|
FALSE);
|
||||||
|
gtk_tooltips_set_tip (tool_tips, gradient_preview,
|
||||||
|
_("The active gradient.\nClick to open the Gradients Dialog."),
|
||||||
|
NULL);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gradient_preview), "clicked",
|
||||||
|
(GtkSignalFunc) gradient_preview_clicked, NULL);
|
||||||
|
gtk_table_attach_defaults (GTK_TABLE(indicator_table), gradient_preview,
|
||||||
|
0, 2, 1, 2);
|
||||||
|
|
||||||
brush_area_update ();
|
brush_area_update ();
|
||||||
pattern_area_update ();
|
pattern_area_update ();
|
||||||
|
gradient_area_update ();
|
||||||
|
|
||||||
gtk_widget_show (brush_preview);
|
gtk_widget_show (brush_preview);
|
||||||
gtk_widget_show (pattern_preview);
|
gtk_widget_show (pattern_preview);
|
||||||
|
gtk_widget_show (gradient_preview);
|
||||||
gtk_widget_show (indicator_table);
|
gtk_widget_show (indicator_table);
|
||||||
|
|
||||||
return (indicator_table);
|
return (indicator_table);
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#define __INDICATOR_AREA_H__
|
#define __INDICATOR_AREA_H__
|
||||||
#include "patterns.h"
|
#include "patterns.h"
|
||||||
#include "gimpbrushlist.h"
|
#include "gimpbrushlist.h"
|
||||||
GtkWidget *
|
|
||||||
indicator_area_create (int width, int height);
|
|
||||||
|
|
||||||
void brush_area_update(void);
|
GtkWidget *indicator_area_create (void);
|
||||||
void pattern_area_update(void);
|
void brush_area_update (void);
|
||||||
|
void pattern_area_update (void);
|
||||||
|
void gradient_area_update (void);
|
||||||
|
|
||||||
#endif /* __INDICATOR_AREA_H__ */
|
#endif /* __INDICATOR_AREA_H__ */
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ create_indicator_area (GtkWidget *parent)
|
|||||||
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
|
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
||||||
|
|
||||||
ind_area = indicator_area_create (54, 42);
|
ind_area = indicator_area_create ();
|
||||||
gtk_container_add (GTK_CONTAINER (alignment), ind_area);
|
gtk_container_add (GTK_CONTAINER (alignment), ind_area);
|
||||||
gtk_widget_show (ind_area);
|
gtk_widget_show (ind_area);
|
||||||
gtk_widget_show (alignment);
|
gtk_widget_show (alignment);
|
||||||
|
@ -21,17 +21,21 @@
|
|||||||
#include "appenv.h"
|
#include "appenv.h"
|
||||||
#include "gimpbrushlist.h"
|
#include "gimpbrushlist.h"
|
||||||
#include "gimpcontextpreview.h"
|
#include "gimpcontextpreview.h"
|
||||||
|
#include "gradient.h"
|
||||||
|
#include "gradient_header.h"
|
||||||
#include "indicator_area.h"
|
#include "indicator_area.h"
|
||||||
#include "interface.h" /* for tool_tips */
|
#include "interface.h" /* for tool_tips */
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
#define CELL_SIZE 23 /* The size of the previews */
|
#define CELL_SIZE 23 /* The size of the previews */
|
||||||
#define CELL_PADDING 2 /* How much between brush and pattern cells */
|
#define GRAD_CELL_WIDTH 48 /* The width of the gradient preview */
|
||||||
|
#define GRAD_CELL_HEIGHT 12 /* The height of the gradient preview */
|
||||||
|
#define CELL_PADDING 2 /* How much between brush and pattern cells */
|
||||||
|
|
||||||
/* Static variables */
|
/* Static variables */
|
||||||
static GtkWidget *indicator_table;
|
|
||||||
static GtkWidget *brush_preview;
|
static GtkWidget *brush_preview;
|
||||||
static GtkWidget *pattern_preview;
|
static GtkWidget *pattern_preview;
|
||||||
|
static GtkWidget *gradient_preview;
|
||||||
|
|
||||||
|
|
||||||
/* The _area_update () functions should be called _preview_update(),
|
/* The _area_update () functions should be called _preview_update(),
|
||||||
@ -88,11 +92,28 @@ pattern_preview_clicked (GtkWidget *widget,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
void
|
||||||
indicator_area_create (int width,
|
gradient_area_update ()
|
||||||
int height)
|
|
||||||
{
|
{
|
||||||
indicator_table = gtk_table_new (1, 3, FALSE);
|
gimp_context_preview_update (GIMP_CONTEXT_PREVIEW (gradient_preview), curr_gradient);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gradient_preview_clicked (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
grad_create_gradient_editor ();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
indicator_area_create ()
|
||||||
|
{
|
||||||
|
GtkWidget *indicator_table;
|
||||||
|
|
||||||
|
indicator_table = gtk_table_new (2, 2, FALSE);
|
||||||
|
gtk_table_set_row_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
|
||||||
|
gtk_table_set_col_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
|
||||||
|
|
||||||
brush_preview = gimp_context_preview_new (GCP_BRUSH,
|
brush_preview = gimp_context_preview_new (GCP_BRUSH,
|
||||||
CELL_SIZE, CELL_SIZE,
|
CELL_SIZE, CELL_SIZE,
|
||||||
@ -116,11 +137,24 @@ indicator_area_create (int width,
|
|||||||
gtk_table_attach_defaults (GTK_TABLE(indicator_table), pattern_preview,
|
gtk_table_attach_defaults (GTK_TABLE(indicator_table), pattern_preview,
|
||||||
1, 2, 0, 1);
|
1, 2, 0, 1);
|
||||||
|
|
||||||
|
gradient_preview = gimp_context_preview_new (GCP_GRADIENT,
|
||||||
|
GRAD_CELL_WIDTH, GRAD_CELL_HEIGHT,
|
||||||
|
FALSE);
|
||||||
|
gtk_tooltips_set_tip (tool_tips, gradient_preview,
|
||||||
|
_("The active gradient.\nClick to open the Gradients Dialog."),
|
||||||
|
NULL);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gradient_preview), "clicked",
|
||||||
|
(GtkSignalFunc) gradient_preview_clicked, NULL);
|
||||||
|
gtk_table_attach_defaults (GTK_TABLE(indicator_table), gradient_preview,
|
||||||
|
0, 2, 1, 2);
|
||||||
|
|
||||||
brush_area_update ();
|
brush_area_update ();
|
||||||
pattern_area_update ();
|
pattern_area_update ();
|
||||||
|
gradient_area_update ();
|
||||||
|
|
||||||
gtk_widget_show (brush_preview);
|
gtk_widget_show (brush_preview);
|
||||||
gtk_widget_show (pattern_preview);
|
gtk_widget_show (pattern_preview);
|
||||||
|
gtk_widget_show (gradient_preview);
|
||||||
gtk_widget_show (indicator_table);
|
gtk_widget_show (indicator_table);
|
||||||
|
|
||||||
return (indicator_table);
|
return (indicator_table);
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#define __INDICATOR_AREA_H__
|
#define __INDICATOR_AREA_H__
|
||||||
#include "patterns.h"
|
#include "patterns.h"
|
||||||
#include "gimpbrushlist.h"
|
#include "gimpbrushlist.h"
|
||||||
GtkWidget *
|
|
||||||
indicator_area_create (int width, int height);
|
|
||||||
|
|
||||||
void brush_area_update(void);
|
GtkWidget *indicator_area_create (void);
|
||||||
void pattern_area_update(void);
|
void brush_area_update (void);
|
||||||
|
void pattern_area_update (void);
|
||||||
|
void gradient_area_update (void);
|
||||||
|
|
||||||
#endif /* __INDICATOR_AREA_H__ */
|
#endif /* __INDICATOR_AREA_H__ */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user