1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* 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
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
1999-08-26 06:51:44 +08:00
|
|
|
#include "config.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
|
|
|
#include "colormaps.h"
|
|
|
|
#include "gdisplay.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "gimpui.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "gximage.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "info_dialog.h"
|
|
|
|
#include "info_window.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "interface.h"
|
1999-08-13 06:21:04 +08:00
|
|
|
#include "scroll.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-11-23 22:47:09 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
1999-04-03 03:46:59 +08:00
|
|
|
#include "libgimp/gimpunit.h"
|
1999-08-13 06:21:04 +08:00
|
|
|
#include "pixmaps/dropper.xpm"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#define MAX_BUF 256
|
|
|
|
|
|
|
|
typedef struct _InfoWinData InfoWinData;
|
1999-10-27 02:27:27 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
struct _InfoWinData
|
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
gchar dimensions_str[MAX_BUF];
|
|
|
|
gchar scale_str[MAX_BUF];
|
|
|
|
gchar color_type_str[MAX_BUF];
|
|
|
|
gchar visual_class_str[MAX_BUF];
|
|
|
|
gchar visual_depth_str[MAX_BUF];
|
|
|
|
gchar shades_str[MAX_BUF];
|
|
|
|
gchar resolution_str[MAX_BUF];
|
|
|
|
gchar unit_str[MAX_BUF];
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
void *gdisp_ptr; /* I'a not happy 'bout this one */
|
1999-10-27 02:27:27 +08:00
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
GtkWidget *labelBvalue;
|
|
|
|
GtkWidget *labelGvalue;
|
|
|
|
GtkWidget *labelRvalue;
|
|
|
|
GtkWidget *labelAvalue;
|
1999-10-27 02:27:27 +08:00
|
|
|
|
|
|
|
gboolean showingPreview;
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The different classes of visuals */
|
1999-10-27 02:27:27 +08:00
|
|
|
static gchar *visual_classes[] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1998-11-23 22:47:09 +08:00
|
|
|
N_("Static Gray"),
|
|
|
|
N_("Grayscale"),
|
|
|
|
N_("Static Color"),
|
|
|
|
N_("Pseudo Color"),
|
|
|
|
N_("True Color"),
|
|
|
|
N_("Direct Color"),
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
get_shades (GDisplay *gdisp,
|
|
|
|
char *buf)
|
|
|
|
{
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (buf, MAX_BUF, "Using GdkRgb - we'll get back to you");
|
1998-08-20 14:46:07 +08:00
|
|
|
#if 0
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkPreviewInfo *info;
|
|
|
|
|
|
|
|
info = gtk_preview_get_info ();
|
|
|
|
|
|
|
|
switch (gimage_base_type (gdisp->gimage))
|
|
|
|
{
|
|
|
|
case GRAY:
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (buf, MAX_BUF, "%d", info->ngray_shades);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case RGB:
|
|
|
|
switch (gdisp->depth)
|
|
|
|
{
|
|
|
|
case 8 :
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (buf, MAX_BUF, "%d / %d / %d",
|
|
|
|
info->nred_shades,
|
|
|
|
info->ngreen_shades,
|
|
|
|
info->nblue_shades);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case 15 : case 16 :
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (buf, MAX_BUF, "%d / %d / %d",
|
|
|
|
(1 << (8 - info->visual->red_prec)),
|
|
|
|
(1 << (8 - info->visual->green_prec)),
|
|
|
|
(1 << (8 - info->visual->blue_prec)));
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case 24 :
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (buf, MAX_BUF, "256 / 256 / 256");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INDEXED:
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (buf, MAX_BUF, "%d", gdisp->gimage->num_cols);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
1998-08-20 14:46:07 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
info_window_close_callback (GtkWidget *widget,
|
1999-10-27 02:27:27 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
info_dialog_popdown ((InfoDialog *) data);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
static void
|
1999-10-27 02:27:27 +08:00
|
|
|
info_window_page_switch (GtkWidget *widget,
|
1999-08-13 06:21:04 +08:00
|
|
|
GtkNotebookPage *page,
|
1999-10-27 02:27:27 +08:00
|
|
|
gint page_num)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
|
|
|
InfoDialog *info_win;
|
|
|
|
InfoWinData *iwd;
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
info_win = (InfoDialog *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
/* Only deal with the second page */
|
1999-10-27 02:27:27 +08:00
|
|
|
if (page_num != 1)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
|
|
|
iwd->showingPreview = FALSE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
iwd->showingPreview = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-10-27 02:27:27 +08:00
|
|
|
info_window_image_preview_book (InfoDialog *info_win)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
|
|
|
GtkWidget *hbox1;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *table2;
|
|
|
|
GtkWidget *labelBvalue;
|
|
|
|
GtkWidget *labelGvalue;
|
|
|
|
GtkWidget *labelRvalue;
|
|
|
|
GtkWidget *labelAvalue;
|
|
|
|
GtkWidget *labelB;
|
|
|
|
GtkWidget *labelG;
|
|
|
|
GtkWidget *labelR;
|
|
|
|
GtkWidget *labelA;
|
|
|
|
GtkWidget *pixmapwid;
|
|
|
|
GdkPixmap *pixmap;
|
|
|
|
GdkBitmap *mask;
|
|
|
|
GtkStyle *style;
|
|
|
|
|
|
|
|
InfoWinData *iwd;
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
hbox1 = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_widget_show (hbox1);
|
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
|
|
|
|
frame = gtk_frame_new(NULL);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox1), alignment, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
table2 = gtk_table_new (5, 2, TRUE);
|
|
|
|
gtk_container_border_width (GTK_CONTAINER (table2), 2);
|
|
|
|
gtk_widget_show (table2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
|
|
|
|
1999-10-27 08:09:39 +08:00
|
|
|
labelAvalue = gtk_label_new (_("N/A"));
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (labelAvalue);
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), labelAvalue, 1, 2, 4, 5,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
|
1999-10-27 08:09:39 +08:00
|
|
|
labelBvalue = gtk_label_new (_("N/A"));
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (labelBvalue);
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), labelBvalue, 1, 2, 3, 4,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
|
1999-10-27 08:09:39 +08:00
|
|
|
labelGvalue = gtk_label_new (_("N/A"));
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (labelGvalue);
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), labelGvalue, 1, 2, 2, 3,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
|
1999-10-27 08:09:39 +08:00
|
|
|
labelRvalue = gtk_label_new (_("N/A"));
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (labelRvalue);
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), labelRvalue, 1, 2, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
|
1999-10-27 08:09:39 +08:00
|
|
|
labelA = gtk_label_new (_("A:"));
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (labelA);
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), labelA, 0, 1, 4, 5,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
|
1999-10-27 08:09:39 +08:00
|
|
|
labelB = gtk_label_new (_("B:"));
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (labelB);
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), labelB, 0, 1, 3, 4,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
|
1999-10-27 08:09:39 +08:00
|
|
|
labelG = gtk_label_new (_("G:"));
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (labelG);
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), labelG, 0, 1, 2, 3,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
|
1999-10-27 08:09:39 +08:00
|
|
|
labelR = gtk_label_new (_("R:"));
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (labelR);
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), labelR, 0, 1, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
|
|
|
|
gtk_widget_realize(info_win->shell);
|
|
|
|
style = gtk_widget_get_style (info_win->shell);
|
|
|
|
|
|
|
|
pixmap = gdk_pixmap_create_from_xpm_d (info_win->shell->window, &mask,
|
|
|
|
&style->bg[GTK_STATE_NORMAL],
|
|
|
|
dropper_xpm);
|
|
|
|
pixmapwid = gtk_pixmap_new (pixmap, mask);
|
|
|
|
|
|
|
|
gtk_table_attach (GTK_TABLE (table2), pixmapwid, 0, 2, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (pixmapwid);
|
|
|
|
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(info_win->info_notebook),
|
|
|
|
hbox1,
|
|
|
|
gtk_label_new (_("Extended")));
|
|
|
|
|
|
|
|
/* Set back to first page */
|
|
|
|
gtk_notebook_set_page(GTK_NOTEBOOK(info_win->info_notebook),0);
|
|
|
|
|
|
|
|
gtk_object_set_user_data(GTK_OBJECT (info_win->info_notebook),
|
|
|
|
(gpointer)info_win);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (info_win->info_notebook), "switch_page",
|
|
|
|
GTK_SIGNAL_FUNC (info_window_page_switch), NULL);
|
|
|
|
|
|
|
|
iwd->labelBvalue = labelBvalue;
|
|
|
|
iwd->labelGvalue = labelGvalue;
|
|
|
|
iwd->labelRvalue = labelRvalue;
|
|
|
|
iwd->labelAvalue = labelAvalue;
|
|
|
|
}
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* displays information:
|
|
|
|
* image name
|
|
|
|
* image width, height
|
|
|
|
* zoom ratio
|
|
|
|
* image color type
|
|
|
|
* Display info:
|
|
|
|
* visual class
|
|
|
|
* visual depth
|
|
|
|
* shades of color/gray
|
|
|
|
*/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
InfoDialog *
|
|
|
|
info_window_create (void *gdisp_ptr)
|
|
|
|
{
|
|
|
|
InfoDialog *info_win;
|
|
|
|
GDisplay *gdisp;
|
|
|
|
InfoWinData *iwd;
|
|
|
|
char * title, * title_buf;
|
|
|
|
int type;
|
|
|
|
|
|
|
|
gdisp = (GDisplay *) gdisp_ptr;
|
|
|
|
|
1999-02-07 18:45:56 +08:00
|
|
|
title = g_basename (gimage_filename (gdisp->gimage));
|
1997-11-25 06:05:25 +08:00
|
|
|
type = gimage_base_type (gdisp->gimage);
|
|
|
|
|
|
|
|
/* create the info dialog */
|
1998-12-26 02:22:01 +08:00
|
|
|
title_buf = g_strdup_printf (_("%s: Window Info"), title);
|
1999-09-28 01:58:10 +08:00
|
|
|
info_win = info_dialog_notebook_new (title_buf,
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/info_window.html");
|
1997-11-25 06:05:25 +08:00
|
|
|
g_free (title_buf);
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* create the action area */
|
|
|
|
gimp_dialog_create_action_area (GTK_DIALOG (info_win->shell),
|
|
|
|
|
|
|
|
_("Close"), info_window_close_callback,
|
|
|
|
info_win, NULL, TRUE, FALSE,
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
iwd = g_new (InfoWinData, 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
info_win->user_data = iwd;
|
|
|
|
iwd->dimensions_str[0] = '\0';
|
1998-10-05 18:05:29 +08:00
|
|
|
iwd->resolution_str[0] = '\0';
|
1999-04-03 03:46:59 +08:00
|
|
|
iwd->unit_str[0] = '\0';
|
1997-11-25 06:05:25 +08:00
|
|
|
iwd->scale_str[0] = '\0';
|
|
|
|
iwd->color_type_str[0] = '\0';
|
|
|
|
iwd->visual_class_str[0] = '\0';
|
|
|
|
iwd->visual_depth_str[0] = '\0';
|
|
|
|
iwd->shades_str[0] = '\0';
|
1999-08-13 06:21:04 +08:00
|
|
|
iwd->showingPreview = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* add the information fields */
|
1999-04-03 03:46:59 +08:00
|
|
|
info_dialog_add_label (info_win, _("Dimensions (w x h):"),
|
|
|
|
iwd->dimensions_str);
|
|
|
|
info_dialog_add_label (info_win, _("Resolution:"),
|
|
|
|
iwd->resolution_str);
|
|
|
|
info_dialog_add_label (info_win, _("Unit:"),
|
|
|
|
iwd->unit_str);
|
|
|
|
info_dialog_add_label (info_win, _("Scale Ratio:"),
|
|
|
|
iwd->scale_str);
|
|
|
|
info_dialog_add_label (info_win, _("Display Type:"),
|
|
|
|
iwd->color_type_str);
|
|
|
|
info_dialog_add_label (info_win, _("Visual Class:"),
|
|
|
|
iwd->visual_class_str);
|
|
|
|
info_dialog_add_label (info_win, _("Visual Depth:"),
|
|
|
|
iwd->visual_depth_str);
|
1997-11-25 06:05:25 +08:00
|
|
|
if (type == RGB)
|
1999-04-03 03:46:59 +08:00
|
|
|
info_dialog_add_label (info_win, _("Shades of Color:"),
|
|
|
|
iwd->shades_str);
|
1997-11-25 06:05:25 +08:00
|
|
|
else if (type == INDEXED)
|
1999-04-03 03:46:59 +08:00
|
|
|
info_dialog_add_label (info_win, _("Shades:"),
|
|
|
|
iwd->shades_str);
|
1997-11-25 06:05:25 +08:00
|
|
|
else if (type == GRAY)
|
1999-04-03 03:46:59 +08:00
|
|
|
info_dialog_add_label (info_win, _("Shades of Gray:"),
|
|
|
|
iwd->shades_str);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* update the fields */
|
|
|
|
info_window_update (info_win, gdisp_ptr);
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
/* Add extra tabs */
|
1999-10-27 02:27:27 +08:00
|
|
|
info_window_image_preview_book (info_win);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return info_win;
|
|
|
|
}
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
void
|
|
|
|
info_window_update_RGB (InfoDialog *info_win,
|
|
|
|
void *gdisp_ptr,
|
|
|
|
gdouble tx,
|
|
|
|
gdouble ty)
|
|
|
|
{
|
|
|
|
GDisplay *gdisp;
|
|
|
|
InfoWinData *iwd;
|
|
|
|
char buff[5];
|
|
|
|
guchar *color;
|
|
|
|
gint has_alpha;
|
|
|
|
gint sample_type;
|
|
|
|
|
|
|
|
if(!info_win)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gdisp = (GDisplay *) gdisp_ptr;
|
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
|
|
|
|
|
|
|
if(!iwd || iwd->showingPreview == FALSE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* gimage_active_drawable (gdisp->gimage) */
|
|
|
|
if (!(color = gimp_image_get_color_at(gdisp->gimage, tx, ty))
|
|
|
|
|| (tx < 0.0 && ty < 0.0))
|
|
|
|
{
|
|
|
|
g_snprintf(buff,5,"%4s","N/A");
|
|
|
|
gtk_label_set_text(GTK_LABEL(iwd->labelBvalue),buff);
|
|
|
|
gtk_label_set_text(GTK_LABEL(iwd->labelGvalue),buff);
|
|
|
|
gtk_label_set_text(GTK_LABEL(iwd->labelRvalue),buff);
|
|
|
|
gtk_label_set_text(GTK_LABEL(iwd->labelAvalue),buff);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_snprintf(buff,5,"%4d",(gint)color[BLUE_PIX]);
|
|
|
|
gtk_label_set_text(GTK_LABEL(iwd->labelBvalue),buff);
|
|
|
|
g_snprintf(buff,5,"%4d",(gint)color[GREEN_PIX]);
|
|
|
|
gtk_label_set_text(GTK_LABEL(iwd->labelGvalue),buff);
|
|
|
|
g_snprintf(buff,5,"%4d",(gint)color[RED_PIX]);
|
|
|
|
gtk_label_set_text(GTK_LABEL(iwd->labelRvalue),buff);
|
|
|
|
|
|
|
|
sample_type = gimp_image_composite_type (gdisp->gimage);
|
|
|
|
has_alpha = TYPE_HAS_ALPHA (sample_type);
|
|
|
|
|
|
|
|
if(has_alpha)
|
|
|
|
g_snprintf(buff,5,"%4d",(gint)color[ALPHA_PIX]);
|
|
|
|
else
|
|
|
|
g_snprintf(buff,5,"%4s","N/A");
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(iwd->labelAvalue),buff);
|
|
|
|
|
|
|
|
g_free(color);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
|
|
|
info_window_free (InfoDialog *info_win)
|
|
|
|
{
|
|
|
|
g_free (info_win->user_data);
|
|
|
|
info_dialog_free (info_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
info_window_update (InfoDialog *info_win,
|
|
|
|
void *gdisp_ptr)
|
|
|
|
{
|
1999-04-03 03:46:59 +08:00
|
|
|
GDisplay *gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
InfoWinData *iwd;
|
1999-04-03 03:46:59 +08:00
|
|
|
int type;
|
1999-05-23 01:56:35 +08:00
|
|
|
gdouble unit_factor;
|
1999-04-03 03:46:59 +08:00
|
|
|
gint unit_digits;
|
|
|
|
gchar format_buf[32];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gdisp = (GDisplay *) gdisp_ptr;
|
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
|
|
|
|
|
|
|
/* width and height */
|
1999-04-03 03:46:59 +08:00
|
|
|
unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
|
|
|
|
unit_digits = gimp_unit_get_digits (gdisp->gimage->unit);
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
g_snprintf (format_buf, sizeof (format_buf),
|
1999-10-27 08:09:39 +08:00
|
|
|
_("%%d x %%d pixels (%%.%df x %%.%df %s)"),
|
1999-04-03 03:46:59 +08:00
|
|
|
unit_digits + 1, unit_digits + 1,
|
|
|
|
gimp_unit_get_symbol (gdisp->gimage->unit));
|
|
|
|
g_snprintf (iwd->dimensions_str, MAX_BUF, format_buf,
|
|
|
|
(int) gdisp->gimage->width,
|
|
|
|
(int) gdisp->gimage->height,
|
|
|
|
gdisp->gimage->width * unit_factor / gdisp->gimage->xresolution,
|
|
|
|
gdisp->gimage->height * unit_factor / gdisp->gimage->yresolution);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-10-05 18:05:29 +08:00
|
|
|
/* image resolution */
|
1998-12-26 02:22:01 +08:00
|
|
|
g_snprintf (iwd->resolution_str, MAX_BUF, "%g x %g dpi",
|
1999-04-03 03:46:59 +08:00
|
|
|
gdisp->gimage->xresolution,
|
|
|
|
gdisp->gimage->yresolution);
|
|
|
|
|
|
|
|
/* image unit */
|
|
|
|
g_snprintf (iwd->unit_str, MAX_BUF, "%s",
|
|
|
|
gimp_unit_get_plural (gdisp->gimage->unit));
|
1998-10-05 18:05:29 +08:00
|
|
|
|
1998-12-06 05:48:37 +08:00
|
|
|
/* user zoom ratio */
|
1998-12-26 02:22:01 +08:00
|
|
|
g_snprintf (iwd->scale_str, MAX_BUF, "%d:%d",
|
1997-11-25 06:05:25 +08:00
|
|
|
SCALEDEST (gdisp), SCALESRC (gdisp));
|
|
|
|
|
|
|
|
type = gimage_base_type (gdisp->gimage);
|
|
|
|
|
|
|
|
/* color type */
|
1998-08-20 08:35:40 +08:00
|
|
|
if (type == RGB)
|
1998-12-26 02:22:01 +08:00
|
|
|
g_snprintf (iwd->color_type_str, MAX_BUF, "%s", _("RGB Color"));
|
1998-08-20 08:35:40 +08:00
|
|
|
else if (type == GRAY)
|
1998-12-26 02:22:01 +08:00
|
|
|
g_snprintf (iwd->color_type_str, MAX_BUF, "%s", _("Grayscale"));
|
1998-08-20 08:35:40 +08:00
|
|
|
else if (type == INDEXED)
|
1998-12-26 02:22:01 +08:00
|
|
|
g_snprintf (iwd->color_type_str, MAX_BUF, "%s", _("Indexed Color"));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* visual class */
|
|
|
|
if (type == RGB ||
|
|
|
|
type == INDEXED)
|
1998-12-26 02:22:01 +08:00
|
|
|
g_snprintf (iwd->visual_class_str, MAX_BUF, "%s", visual_classes[g_visual->type]);
|
1997-11-25 06:05:25 +08:00
|
|
|
else if (type == GRAY)
|
1998-12-26 02:22:01 +08:00
|
|
|
g_snprintf (iwd->visual_class_str, MAX_BUF, "%s", visual_classes[g_visual->type]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* visual depth */
|
1998-12-26 02:22:01 +08:00
|
|
|
g_snprintf (iwd->visual_depth_str, MAX_BUF, "%d", gdisp->depth);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* pure color shades */
|
|
|
|
get_shades (gdisp, iwd->shades_str);
|
|
|
|
|
|
|
|
info_dialog_update (info_win);
|
|
|
|
}
|