Fixed carve-it.scm and circuit.scm (circuit broke due to a plugin update,

* Fixed carve-it.scm and circuit.scm (circuit broke due
         to a plugin update, carve-it broke due to theadd-layer stuff)

        * Added a close button to the color picker info window

        * changed index_palette.c a bit...now if you click with
        MB11, it changes the current active color, clicking with MB3
        opens the color in the color selector for editing

        * Made some of the <Image>/Color/* menus sensitive to the image
        type (gdisplay.c)

-adrian


CVS:
This commit is contained in:
Adrian Likins 1998-01-29 03:13:44 +00:00
parent a3c4954710
commit 8cd58f4bae
9 changed files with 146 additions and 7 deletions

View File

@ -1,3 +1,17 @@
Wed Jan 28 22:03:42 EST 1998 Adrian Likins <adrian@gimp.org>
* Fixed carve-it.scm and circuit.scm (circuit broke due
to a plugin update, carve-it broke due to theadd-layer stuff)
* Added a close button to the color picker info window
* changed index_palette.c a bit...now if you click with
MB11, it changes the current active color, clicking with MB3
opens the color in the color selector for editing
* Made some of the <Image>/Colr/* menus sensitive to the image
type (gdisplay.c)
Wed Jan 28 13:17:06 1998 Scott Goehring <scott@poverty.bloomington.in.us>
* app/gimage.c (gimage_add_channel): Added safety code for add

View File

@ -18,6 +18,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_picker.h"
#include "drawable.h"
#include "gdisplay.h"
@ -38,6 +39,7 @@ static void color_picker_button_release (Tool *, GdkEventButton *, gpointer);
static void color_picker_motion (Tool *, GdkEventMotion *, gpointer);
static void color_picker_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void color_picker_control (Tool *, int, void *);
static void color_picker_info_window_close_callback (GtkWidget *, gpointer);
static int get_color (GImage *, GimpDrawable *, int, int, int, int);
static void color_picker_info_update (Tool *, int);
@ -117,6 +119,11 @@ create_color_picker_options (void)
return options;
}
static ActionAreaItem action_items[] =
{
{ "Close", color_picker_info_window_close_callback, NULL, NULL },
};
static void
color_picker_button_press (Tool *tool,
GdkEventButton *bevent,
@ -166,6 +173,9 @@ color_picker_button_press (Tool *tool,
default :
break;
}
/* Create the action area */
action_items[0].user_data = color_picker_info;
build_action_area (GTK_DIALOG (color_picker_info->shell), action_items, 1, 0);
}
gdk_pointer_grab (gdisp->canvas->window, FALSE,
@ -198,6 +208,8 @@ color_picker_button_press (Tool *tool,
COLOR_UPDATE));
update_type = COLOR_UPDATE;
}
}
static void
@ -580,3 +592,10 @@ color_picker_invoker (Argument *args)
return return_args;
}
static void
color_picker_info_window_close_callback (GtkWidget *w,
gpointer client_data)
{
info_dialog_popdown ((InfoDialog *) client_data);
}

View File

@ -1005,6 +1005,19 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
menus_set_sensitive ("<Image>/Image/Grayscale", (base_type != GRAY));
menus_set_sensitive ("<Image>/Image/Indexed", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Threshold", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Posterize", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Equalize", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Invert", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Color Balance", (base_type == RGB));
menus_set_sensitive ("<Image>/Image/Colors/Brightness-Contrast", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Hue-Saturation", (base_type == RGB));
menus_set_sensitive ("<Image>/Image/Colors/Curves", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Levels", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Desaturate", (base_type == RGB));
menus_set_sensitive ("<Image>/Select", lp);
menus_set_sensitive ("<Image>/Edit/Cut", lp);
menus_set_sensitive ("<Image>/Edit/Copy", lp);

View File

@ -1005,6 +1005,19 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
menus_set_sensitive ("<Image>/Image/Grayscale", (base_type != GRAY));
menus_set_sensitive ("<Image>/Image/Indexed", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Threshold", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Posterize", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Equalize", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Invert", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Color Balance", (base_type == RGB));
menus_set_sensitive ("<Image>/Image/Colors/Brightness-Contrast", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Hue-Saturation", (base_type == RGB));
menus_set_sensitive ("<Image>/Image/Colors/Curves", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Levels", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Desaturate", (base_type == RGB));
menus_set_sensitive ("<Image>/Select", lp);
menus_set_sensitive ("<Image>/Edit/Cut", lp);
menus_set_sensitive ("<Image>/Edit/Copy", lp);

View File

@ -1005,6 +1005,19 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
menus_set_sensitive ("<Image>/Image/Grayscale", (base_type != GRAY));
menus_set_sensitive ("<Image>/Image/Indexed", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Threshold", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Posterize", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Equalize", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Invert", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Color Balance", (base_type == RGB));
menus_set_sensitive ("<Image>/Image/Colors/Brightness-Contrast", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Hue-Saturation", (base_type == RGB));
menus_set_sensitive ("<Image>/Image/Colors/Curves", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Levels", (base_type != INDEXED));
menus_set_sensitive ("<Image>/Image/Colors/Desaturate", (base_type == RGB));
menus_set_sensitive ("<Image>/Select", lp);
menus_set_sensitive ("<Image>/Edit/Cut", lp);
menus_set_sensitive ("<Image>/Edit/Copy", lp);

View File

@ -24,6 +24,7 @@
#include "buildmenu.h"
#include "colormaps.h"
#include "color_select.h"
#include "color_area.h"
#include "errors.h"
#include "gdisplay.h"
#include "gimage.h"
@ -32,6 +33,7 @@
#include "image_render.h"
#include "interface.h"
#include "indexed_palette.h"
#include "palette.h"
#include "undo.h"
#define EVENT_MASK GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK
@ -117,6 +119,7 @@ indexed_palette_create (int gimage_id)
GtkWidget *ops_menu;
GtkWidget *menu_bar;
GtkWidget *menu_bar_item;
GtkWidget *hbox;
GtkAcceleratorTable *table;
int default_index;
@ -197,6 +200,14 @@ indexed_palette_create (int gimage_id)
gtk_widget_show (indexedP->palette);
gtk_widget_show (frame);
/* some helpful hints */
hbox = gtk_hbox_new(FALSE, 1);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 1);
label = gtk_label_new (" Click to select color. Right-click to edit color");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 1);
gtk_widget_show (hbox);
gtk_widget_show (label);
/* The action area */
action_items[0].user_data = indexedP;
build_action_area (GTK_DIALOG (indexedP->shell), action_items, 1, 0);
@ -408,6 +419,18 @@ indexed_palette_area_events (GtkWidget *widget,
bevent = (GdkEventButton *) event;
if (bevent->button == 1)
{
indexedP->col_index = 16 * ((int)bevent->y / CELL_HEIGHT) + ((int)bevent->x / CELL_WIDTH);
r = gimage->cmap[indexedP->col_index * 3 + 0];
g = gimage->cmap[indexedP->col_index * 3 + 1];
b = gimage->cmap[indexedP->col_index * 3 + 2];
if (active_color == FOREGROUND)
palette_set_foreground (r, g, b);
else if (active_color == BACKGROUND)
palette_set_background (r, g, b);
}
if (bevent->button == 3)
{
indexedP->col_index = 16 * ((int)bevent->y / CELL_HEIGHT) + ((int)bevent->x / CELL_WIDTH);
r = gimage->cmap[indexedP->col_index * 3 + 0];

View File

@ -18,6 +18,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_picker.h"
#include "drawable.h"
#include "gdisplay.h"
@ -38,6 +39,7 @@ static void color_picker_button_release (Tool *, GdkEventButton *, gpointer);
static void color_picker_motion (Tool *, GdkEventMotion *, gpointer);
static void color_picker_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void color_picker_control (Tool *, int, void *);
static void color_picker_info_window_close_callback (GtkWidget *, gpointer);
static int get_color (GImage *, GimpDrawable *, int, int, int, int);
static void color_picker_info_update (Tool *, int);
@ -117,6 +119,11 @@ create_color_picker_options (void)
return options;
}
static ActionAreaItem action_items[] =
{
{ "Close", color_picker_info_window_close_callback, NULL, NULL },
};
static void
color_picker_button_press (Tool *tool,
GdkEventButton *bevent,
@ -166,6 +173,9 @@ color_picker_button_press (Tool *tool,
default :
break;
}
/* Create the action area */
action_items[0].user_data = color_picker_info;
build_action_area (GTK_DIALOG (color_picker_info->shell), action_items, 1, 0);
}
gdk_pointer_grab (gdisp->canvas->window, FALSE,
@ -198,6 +208,8 @@ color_picker_button_press (Tool *tool,
COLOR_UPDATE));
update_type = COLOR_UPDATE;
}
}
static void
@ -580,3 +592,10 @@ color_picker_invoker (Argument *args)
return return_args;
}
static void
color_picker_info_window_close_callback (GtkWidget *w,
gpointer client_data)
{
info_dialog_popdown ((InfoDialog *) client_data);
}

View File

@ -25,6 +25,18 @@
(cond ((< mean 127) (+ 1.0 (* 0.5 (/ (- 127 mean) 127.0))))
((>= mean 127) (- 1.0 (* 0.5 (/ (- mean 127) 127.0)))))))
(define (copy-layer-carve-it dest-image dest-drawable source-image source-drawable)
(gimp-selection-all dest-image)
(gimp-edit-clear dest-image dest-drawable)
(gimp-selection-none dest-image)
(gimp-selection-all source-image)
(gimp-edit-copy source-image source-drawable)
(let ((floating-sel (car (gimp-edit-paste dest-image dest-drawable FALSE))))
(gimp-floating-sel-anchor floating-sel)))
(define (script-fu-carve-it mask-img mask-drawable bg-layer carve-white)
(let* ((width (car (gimp-drawable-width mask-drawable)))
(height (car (gimp-drawable-height mask-drawable)))
@ -53,13 +65,27 @@
(csl-mask 0)
(inset-layer 0)
(il-mask 0)
(layer1 (car (gimp-layer-copy bg-layer TRUE)))
(bg-height (car (gimp-drawable-height bg-layer)))
(bg-width (car (gimp-drawable-width bg-layer)))
(bg-type (car (gimp-drawable-type bg-layer)))
(bg-image (car (gimp-drawable-image bg-layer)))
(layer1 (car (gimp-layer-new img bg-height bg-width bg-type "Layer1" 100 NORMAL)))
(inset-layer (car (gimp-layer-new img bg-height bg-width bg-type "inset1" 100 NORMAL)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-brush (car (gimp-brushes-get-brush))))
(gimp-image-disable-undo img)
(gimp-selection-all img)
(gimp-edit-clear img inset-layer)
(gimp-edit-clear img layer1)
(gimp-selection-none img)
(copy-layer-carve-it img layer1 bg-image bg-layer)
(gimp-edit-clear img inset-layer)
(gimp-edit-copy mask-img mask-drawable)
(gimp-image-add-channel img mask 0)
(gimp-image-add-layer img layer1 0)
(plug-in-tile 1 img layer1 width height FALSE)
(set! mask-fs (car (gimp-edit-paste img mask FALSE)))
@ -128,9 +154,8 @@
(gimp-palette-set-background '(255 255 255))
(gimp-edit-fill img il-mask)
(gimp-selection-none img)
(gimp-selection-none bg-image)
(gimp-levels img inset-layer 0 0 255 inset-gamma 0 255)
(gimp-image-remove-channel img mask)
(gimp-image-remove-channel img mask-fat)
(gimp-image-remove-channel img mask-highlight)

View File

@ -92,7 +92,7 @@
(gimp-palette-set-foreground '(14 14 14))))
(gimp-selection-load image active-selection)
(plug-in-maze 1 image active-layer 5 seed 57 1)
(plug-in-maze 1 image active-layer 5 TRUE seed 57 1)
(plug-in-oilify 1 image active-layer mask-size)
(plug-in-edge 1 image active-layer 2 1)
(gimp-desaturate image active-layer)