Commit 4a9ae946 authored by Manish Singh's avatar Manish Singh
Browse files

user_install added gimpressionist, levels, and curves dirs

* user_install
* user_install.bat: added gimpressionist, levels, and curves dirs

* app/color_panel.c
* app/color_select.c
* app/colormaps.[ch]
* app/palette.c
* app/selection.c: remove vestigal colormap code; use get_color
directly now

* libgimp/color_display.h
* app/gdisplay_color.c: bugfixes, added state load/save hooks,
redid the interface to work on blocks, removed dummy default
handler, work on gamma correction stuff

* app/gimpbrushpipe.c: #include <stdlib.h>

* app/gximage.c: minor cleanups

* app/levels.c: default to ~/.gimp-1.1/levels for load/save; minor
gui prettification

* app/main.c
* app/menus.c: plug-in menu translation patch from SHIRASAKI Yasuhiro
<yasuhiro@awa.tohoku.ac.jp>

* libgimp/stdplugins-intl.h: add INIT_I18N_UI() for calling
gtk_set_locale()

* plug-ins/Lighting/lightin_main.c: use INIT_I18N_UI()

-Yosh
parent df7ad092
Fri Aug 27 10:57:28 PDT 1999 Manish Singh <yosh@gimp.org>
* user_install
* user_install.bat: added gimpressionist, levels, and curves dirs
* app/color_panel.c
* app/color_select.c
* app/colormaps.[ch]
* app/palette.c
* app/selection.c: remove vestigal colormap code; use get_color
directly now
* libgimp/color_display.h
* app/gdisplay_color.c: bugfixes, added state load/save hooks,
redid the interface to work on blocks, removed dummy default
handler, work on gamma correction stuff
* app/gimpbrushpipe.c: #include <stdlib.h>
* app/gximage.c: minor cleanups
* app/levels.c: default to ~/.gimp-1.1/levels for load/save; minor
gui prettification
* app/main.c
* app/menus.c: plug-in menu translation patch from SHIRASAKI Yasuhiro
<yasuhiro@awa.tohoku.ac.jp>
* libgimp/stdplugins-intl.h: add INIT_I18N_UI() for calling
gtk_set_locale()
* plug-ins/Lighting/lightin_main.c: use INIT_I18N_UI()
Fri Aug 27 18:57:50 BST 1999 Andy Thomas <alt@gimp.org>
* app/nav_window.c
......
......@@ -170,11 +170,9 @@ color_panel_draw (ColorPanel *color_panel)
private = (ColorPanelPrivate *) color_panel->private_part;
widget = private->drawing_area;
fg.pixel = old_color_pixel;
store_color (&fg.pixel,
color_panel->color[0],
color_panel->color[1],
color_panel->color[2]);
fg.pixel = get_color (color_panel->color[0],
color_panel->color[1],
color_panel->color[2]);
gdk_gc_set_foreground (private->gc, &fg);
gdk_draw_rectangle (widget->window, private->gc, 1, 0, 0,
......
......@@ -957,9 +957,10 @@ color_select_update_colors (ColorSelect *csp,
/* if we haven't yet been realised, there's no need to redraw
* anything. */
if (!window) return;
if (!window)
return;
store_color (&color.pixel, red, green, blue);
color.pixel = get_color (red, green, blue);
gdk_window_get_size (window, &width, &height);
......
......@@ -50,54 +50,25 @@ gulong new_color_pixel;
gulong marching_ants_pixels[8];
static void make_color (gulong *pixel_ptr,
int red,
int green,
int blue,
int readwrite);
static void
set_app_colors (void)
{
cycled_marching_ants = FALSE;
make_color (&g_black_pixel, 0, 0, 0, FALSE);
make_color (&g_gray_pixel, 127, 127, 127, FALSE);
make_color (&g_white_pixel, 255, 255, 255, FALSE);
make_color (&g_color_pixel, 255, 255, 0, FALSE);
make_color (&g_normal_guide_pixel, 0, 127, 255, FALSE);
make_color (&g_active_guide_pixel, 255, 0, 0, FALSE);
g_black_pixel = get_color (0, 0, 0);
g_gray_pixel = get_color (127, 127, 127);
g_white_pixel = get_color (255, 255, 255);
g_color_pixel = get_color (255, 255, 0);
store_color (&foreground_pixel, 0, 0, 0);
store_color (&background_pixel, 255, 255, 255);
store_color (&old_color_pixel, 0, 0, 0);
store_color (&new_color_pixel, 255, 255, 255);
g_normal_guide_pixel = get_color (0, 127, 255);
g_active_guide_pixel = get_color (255, 0, 0);
foreground_pixel = get_color (0, 0, 0);
background_pixel = get_color (255, 255, 255);
old_color_pixel = get_color (0, 0, 0);
new_color_pixel = get_color (255, 255, 255);
}
/* This probably doesn't belong here - RLL*/
/* static unsigned int
gamma_correct (int intensity, double gamma)
{
unsigned int val;
double ind;
double one_over_gamma;
if (gamma != 0.0)
one_over_gamma = 1.0 / gamma;
else
one_over_gamma = 1.0;
ind = (double) intensity / 256.0;
val = (int) (256 * pow (ind, one_over_gamma));
return val;
} */
/*************************************************************************/
gulong
get_color (int red,
int green,
......@@ -106,29 +77,8 @@ get_color (int red,
return gdk_rgb_xpixel_from_rgb ((red << 16) | (green << 8) | blue);
}
static void
make_color (gulong *pixel_ptr,
int red,
int green,
int blue,
int readwrite)
{
*pixel_ptr = get_color (red, green, blue);
}
void
store_color (gulong *pixel_ptr,
int red,
int green,
int blue)
{
*pixel_ptr = get_color (red, green, blue);
}
void
get_standard_colormaps ()
get_standard_colormaps (void)
{
GtkPreviewInfo *info;
......
......@@ -43,8 +43,6 @@ extern gulong new_color_pixel;
extern gulong marching_ants_pixels[8];
gulong get_color (int red, int green, int blue);
void store_color (gulong *pixel, int red, int green, int blue);
void get_standard_colormaps (void);
#endif /* __COLORMAPS_H__ */
......@@ -21,6 +21,7 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
......
......@@ -21,6 +21,7 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
......
......@@ -599,9 +599,6 @@ render_image_rgb (RenderInfo *info)
dest[1] = src[1];
dest[2] = src[2];
/* info->gdisp->cd_convert (info->gdisp->cd_ID, x, y,
src[0], src[1], src[2], dest); */
src += 3;
dest += 3;
}
......
......@@ -93,9 +93,9 @@ cycle_ant_colors (Selection *select)
{
index = (i + (8 - select->index_in)) % 8;
if (index < 4)
store_color (&marching_ants_pixels[i], 0, 0, 0);
marching_ants_pixels[i] = get_color (0, 0, 0);
else
store_color (&marching_ants_pixels[i], 255, 255, 255);
marching_ants_pixels[i] = get_color (255, 255, 255);
}
}
......
......@@ -93,12 +93,9 @@ gdisplay_color_attach (GDisplay *gdisp,
info->refs = g_slist_append (info->refs, gdisp);
if (info->methods.new)
{
gdisp->cd_ID = info->methods.new (gdisp->gimage->base_type,
gdisp->gimage->width,
gdisp->gimage->height);
gdisp->cd_convert = info->methods.convert;
}
gdisp->cd_ID = info->methods.new (gdisp->gimage->base_type);
gdisp->cd_convert = info->methods.convert;
}
}
......@@ -107,45 +104,72 @@ gdisplay_color_detach (GDisplay *gdisp)
{
ColorDisplayInfo *info;
if ((info = g_hash_table_lookup (color_display_table, gdisp->cd_name)))
if (gdisp->cd_name)
{
if (info->methods.destroy)
info->methods.destroy (gdisp->cd_ID);
if ((info = g_hash_table_lookup (color_display_table, gdisp->cd_name)))
{
if (info->methods.destroy)
info->methods.destroy (gdisp->cd_ID);
info->refs = g_slist_remove (info->refs, gdisp);
info->refs = g_slist_remove (info->refs, gdisp);
if (!info->refs && info->methods.finalize)
info->methods.finalize ();
}
g_free (gdisp->cd_name);
if (!info->refs && info->methods.finalize)
info->methods.finalize ();
}
g_free (gdisp->cd_name);
gdisp->cd_name = NULL;
}
}
typedef struct _GammaContext GammaContext;
struct _GammaContext
{
double gamma;
guchar *lookup;
};
static
gpointer gamma_new (int type)
{
int i;
GammaContext *context = NULL;
context = g_new (GammaContext, 1);
context->gamma = 1.0;
context->lookup = g_new (guchar, 256);
for (i = 0; i < 256; i++)
context->lookup[i] = i;
return context;
}
static
void dummy_convert (gpointer cd_ID,
int x,
int y,
guchar r,
guchar g,
guchar b,
guchar *dest)
void gamma_destroy (gpointer cd_ID)
{
dest[0] = r;
dest[1] = g;
dest[2] = b;
GammaContext *context = (GammaContext *) cd_ID;
g_free (context->lookup);
g_free (context);
}
static
void gamma_convert (gpointer cd_ID,
guchar *buf,
int width,
int height,
int bpp)
{
int i;
guchar *lookup = ((GammaContext *) cd_ID)->lookup;
for (i = 0; i < width * height * bpp; i++)
*buf++ = lookup[*buf];
}
void
gdisplay_color_init (void)
{
GimpColorDisplayMethods methods = {
NULL,
NULL,
dummy_convert,
NULL,
NULL,
NULL
};
gimp_color_display_register ("None", &methods);
}
......@@ -599,9 +599,6 @@ render_image_rgb (RenderInfo *info)
dest[1] = src[1];
dest[2] = src[2];
/* info->gdisp->cd_convert (info->gdisp->cd_ID, x, y,
src[0], src[1], src[2], dest); */
src += 3;
dest += 3;
}
......
......@@ -93,9 +93,9 @@ cycle_ant_colors (Selection *select)
{
index = (i + (8 - select->index_in)) % 8;
if (index < 4)
store_color (&marching_ants_pixels[i], 0, 0, 0);
marching_ants_pixels[i] = get_color (0, 0, 0);
else
store_color (&marching_ants_pixels[i], 255, 255, 255);
marching_ants_pixels[i] = get_color (255, 255, 255);
}
}
......
......@@ -47,7 +47,7 @@ create_gximage (GdkVisual *visual, int width, int height)
{
GXImage * gximage;
gximage = (GXImage *) g_malloc (sizeof (GXImage));
gximage = g_new (GXImage, 1);
gximage->visual = visual;
gximage->gc = NULL;
......@@ -72,37 +72,37 @@ delete_gximage (GXImage *gximage)
/* Function definitions */
void
gximage_init ()
gximage_init (void)
{
gximage = create_gximage (g_visual, GXIMAGE_WIDTH, GXIMAGE_HEIGHT);
}
void
gximage_free ()
gximage_free (void)
{
delete_gximage (gximage);
}
guchar*
gximage_get_data ()
gximage_get_data (void)
{
return gximage->data;
}
int
gximage_get_bpp ()
gximage_get_bpp (void)
{
return 3;
}
int
gximage_get_bpl ()
gximage_get_bpl (void)
{
return 3 * GXIMAGE_WIDTH;
}
int
gximage_get_byte_order ()
gximage_get_byte_order (void)
{
return GDK_MSB_FIRST;
}
......
......@@ -93,12 +93,9 @@ gdisplay_color_attach (GDisplay *gdisp,
info->refs = g_slist_append (info->refs, gdisp);
if (info->methods.new)
{
gdisp->cd_ID = info->methods.new (gdisp->gimage->base_type,
gdisp->gimage->width,
gdisp->gimage->height);
gdisp->cd_convert = info->methods.convert;
}
gdisp->cd_ID = info->methods.new (gdisp->gimage->base_type);
gdisp->cd_convert = info->methods.convert;
}
}
......@@ -107,45 +104,72 @@ gdisplay_color_detach (GDisplay *gdisp)
{
ColorDisplayInfo *info;
if ((info = g_hash_table_lookup (color_display_table, gdisp->cd_name)))
if (gdisp->cd_name)
{
if (info->methods.destroy)
info->methods.destroy (gdisp->cd_ID);
if ((info = g_hash_table_lookup (color_display_table, gdisp->cd_name)))
{
if (info->methods.destroy)
info->methods.destroy (gdisp->cd_ID);
info->refs = g_slist_remove (info->refs, gdisp);
info->refs = g_slist_remove (info->refs, gdisp);
if (!info->refs && info->methods.finalize)
info->methods.finalize ();
}
g_free (gdisp->cd_name);
if (!info->refs && info->methods.finalize)
info->methods.finalize ();
}
g_free (gdisp->cd_name);
gdisp->cd_name = NULL;
}
}
typedef struct _GammaContext GammaContext;
struct _GammaContext
{
double gamma;
guchar *lookup;
};
static
gpointer gamma_new (int type)
{
int i;
GammaContext *context = NULL;
context = g_new (GammaContext, 1);
context->gamma = 1.0;
context->lookup = g_new (guchar, 256);
for (i = 0; i < 256; i++)
context->lookup[i] = i;
return context;
}
static
void dummy_convert (gpointer cd_ID,
int x,
int y,
guchar r,
guchar g,
guchar b,
guchar *dest)
void gamma_destroy (gpointer cd_ID)
{
dest[0] = r;
dest[1] = g;
dest[2] = b;
GammaContext *context = (GammaContext *) cd_ID;
g_free (context->lookup);
g_free (context);
}
static
void gamma_convert (gpointer cd_ID,
guchar *buf,
int width,
int height,
int bpp)
{
int i;
guchar *lookup = ((GammaContext *) cd_ID)->lookup;
for (i = 0; i < width * height * bpp; i++)
*buf++ = lookup[*buf];
}
void
gdisplay_color_init (void)
{
GimpColorDisplayMethods methods = {
NULL,
NULL,
dummy_convert,
NULL,
NULL,
NULL
};
gimp_color_display_register ("None", &methods);
}
......@@ -21,6 +21,7 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
......
......@@ -957,9 +957,10 @@ color_select_update_colors (ColorSelect *csp,
/* if we haven't yet been realised, there's no need to redraw
* anything. */
if (!window) return;
if (!window)
return;
store_color (&color.pixel, red, green, blue);
color.pixel = get_color (red, green, blue);
gdk_window_get_size (window, &width, &height);
......
......@@ -833,7 +833,25 @@ static gchar *
menu_translate (const gchar *path,
gpointer data)
{
return gettext (path);
static gchar menupath[256];
gchar *retval;
retval = gettext (path);
if (!strcmp (path, retval))
{
strcpy (menupath, "<Image>");
strncat (menupath, path, sizeof(menupath) - sizeof("<Image>"));
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Image>");
if (!strcmp (path, retval))
{
strcpy (menupath, "<Toolbox>");
strncat (menupath, path, sizeof(menupath) - sizeof("<Toolbox>"));
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Toolbox>");
}
}
return retval;
}
static gint
......
......@@ -276,7 +276,7 @@ palette_set_foreground (gint r,
palette_get_foreground (&rr, &gg, &bb);
if (no_interface == FALSE)
{
store_color (&foreground_pixel, rr, gg, bb);
foreground_pixel = get_color (rr, gg, bb);
color_area_update ();
device_status_update (current_device);
}
......@@ -297,7 +297,7 @@ palette_set_background (gint r,
palette_get_background (&rr, &gg, &bb);
if (no_interface == FALSE)
{
store_color (&background_pixel, rr, gg, bb);
background_pixel = get_color (rr, gg, bb);
color_area_update ();
}
}
......
......@@ -47,7 +47,7 @@ create_gximage (GdkVisual *visual, int width, int height)
{
GXImage * gximage;
gximage = (GXImage *) g_malloc (sizeof (GXImage));
gximage = g_new (GXImage, 1);
gximage->visual = visual;
gximage->gc = NULL;
......@@ -72,37 +72,37 @@ delete_gximage (GXImage *gximage)
/* Function definitions */