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
|
|
|
*/
|
2000-12-14 02:53:35 +08:00
|
|
|
|
1999-08-26 06:51:44 +08:00
|
|
|
#include "config.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools/tools-types.h"
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets/widgets-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
#include "core/gimpimage.h"
|
2001-07-11 20:39:49 +08:00
|
|
|
#include "core/gimpunit.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2001-11-01 05:20:09 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "widgets/gimppreview.h"
|
|
|
|
|
2001-03-08 09:07:03 +08:00
|
|
|
#include "tools/gimptool.h"
|
2001-06-15 00:23:40 +08:00
|
|
|
#include "tools/gimpmovetool.h" /* need icon of move tool */
|
|
|
|
#include "tools/gimpcolorpickertool.h" /* need icon of color picker tool */
|
2001-02-21 20:18:09 +08:00
|
|
|
#include "tools/tool_manager.h"
|
|
|
|
|
2001-04-18 05:43:29 +08:00
|
|
|
#include "info-dialog.h"
|
|
|
|
#include "info-window.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "colormaps.h"
|
2001-01-22 09:46:28 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
|
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
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
|
|
|
|
gchar dimensions_str[MAX_BUF];
|
|
|
|
gchar real_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 resolution_str[MAX_BUF];
|
|
|
|
|
|
|
|
gchar *unit_str;
|
|
|
|
GtkWidget *pos_labels[4];
|
|
|
|
GtkWidget *unit_labels[2];
|
|
|
|
GtkWidget *color_labels[4];
|
|
|
|
|
|
|
|
gboolean showing_extended;
|
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
|
|
|
};
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
static gchar * info_window_title (GimpDisplay *gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
1999-10-31 01:49:50 +08:00
|
|
|
static void
|
2001-08-15 00:33:28 +08:00
|
|
|
info_window_image_renamed_callback (GimpImage *gimage,
|
|
|
|
gpointer data)
|
1999-10-31 01:49:50 +08:00
|
|
|
{
|
2001-01-14 11:55:56 +08:00
|
|
|
InfoDialog *id;
|
|
|
|
gchar *title;
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp;
|
1999-11-30 08:11:08 +08:00
|
|
|
InfoWinData *iwd;
|
1999-10-31 01:49:50 +08:00
|
|
|
|
|
|
|
id = (InfoDialog *) data;
|
|
|
|
|
1999-11-30 08:11:08 +08:00
|
|
|
iwd = (InfoWinData *) id->user_data;
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
gdisp = (GimpDisplay *) iwd->gdisp;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
title = info_window_title (gdisp);
|
1999-10-31 01:49:50 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (id->shell), title);
|
|
|
|
g_free (title);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2001-01-23 04:46:50 +08:00
|
|
|
InfoDialog *info_win;
|
1999-08-13 06:21:04 +08:00
|
|
|
InfoWinData *iwd;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2001-08-15 00:33:28 +08:00
|
|
|
info_win = (InfoDialog *) g_object_get_data (G_OBJECT (widget), "user_data");
|
1999-10-27 02:27:27 +08:00
|
|
|
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
|
|
|
{
|
2001-06-15 00:23:40 +08:00
|
|
|
iwd->showing_extended = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iwd->showing_extended = TRUE;
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
|
|
|
|
/* displays information:
|
|
|
|
* cursor pos
|
|
|
|
* cursor pos in real units
|
|
|
|
* color under cursor
|
|
|
|
* Can't we find a better place for this than in the image window? (Ralf)
|
|
|
|
*/
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
static void
|
2001-10-29 19:47:11 +08:00
|
|
|
info_window_create_extended (InfoDialog *info_win,
|
|
|
|
Gimp *gimp)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2001-06-15 00:23:40 +08:00
|
|
|
GtkWidget *main_table;
|
2001-01-23 04:46:50 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
2001-02-21 20:18:09 +08:00
|
|
|
GtkWidget *preview;
|
1999-08-13 06:21:04 +08:00
|
|
|
InfoWinData *iwd;
|
2001-06-15 00:23:40 +08:00
|
|
|
gint i;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
main_table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (main_table), 0, 4);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (main_table), 4);
|
|
|
|
|
|
|
|
/* cursor information */
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
table = gtk_table_new (5, 3, FALSE);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (gimp, GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE);
|
2001-06-15 00:23:40 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
|
|
|
gtk_widget_show (preview);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("X:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Y:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
iwd->pos_labels[i] = label = gtk_label_new (_("N/A"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i+1, i+2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
if (i & 1)
|
|
|
|
{
|
|
|
|
iwd->unit_labels[i/2] = label = gtk_label_new (NULL);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 2, 3, i+1, i+2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_table_attach (GTK_TABLE (main_table), hbox, 0, 1, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
|
|
|
|
/* color information */
|
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_widget_show (alignment);
|
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
1999-08-13 06:21:04 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_show (frame);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
table = gtk_table_new (5, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
|
|
|
gtk_widget_show (table);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (gimp, GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE);
|
2001-02-21 20:18:09 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1,
|
2000-02-12 22:38:15 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
2001-02-21 20:18:09 +08:00
|
|
|
gtk_widget_show (preview);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
label = gtk_label_new (_("R:"));
|
2000-02-12 23:04:39 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
2000-02-12 23:04:39 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("G:"));
|
2000-02-12 23:04:39 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
2000-02-12 23:04:39 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("B:"));
|
2000-02-12 23:04:39 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
2000-02-12 23:04:39 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("A:"));
|
2000-02-12 23:04:39 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
|
2000-02-12 23:04:39 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
iwd->color_labels[i] = label = gtk_label_new (_("N/A"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i+1, i+2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (main_table), hbox, 1, 2, 1, 2,
|
1999-08-13 06:21:04 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2001-06-15 00:23:40 +08:00
|
|
|
gtk_widget_show (hbox);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
|
2001-08-01 08:35:59 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (info_win->info_notebook),
|
2001-06-15 00:23:40 +08:00
|
|
|
main_table, gtk_label_new (_("Extended")));
|
|
|
|
gtk_widget_show (main_table);
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
/* Set back to first page */
|
2001-08-01 08:35:59 +08:00
|
|
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (info_win->info_notebook), 0);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-08-15 00:33:28 +08:00
|
|
|
g_object_set_data (G_OBJECT (info_win->info_notebook), "user_data",
|
|
|
|
info_win);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-08-15 00:33:28 +08:00
|
|
|
g_signal_connect (G_OBJECT (info_win->info_notebook), "switch_page",
|
|
|
|
G_CALLBACK (info_window_page_switch),
|
|
|
|
NULL);
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
InfoDialog *
|
2001-10-29 19:47:11 +08:00
|
|
|
info_window_create (GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-01-23 04:46:50 +08:00
|
|
|
InfoDialog *info_win;
|
1997-11-25 06:05:25 +08:00
|
|
|
InfoWinData *iwd;
|
2001-01-23 04:46:50 +08:00
|
|
|
gchar *title;
|
|
|
|
gint type;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
type = gimp_image_base_type (gdisp->gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
title = info_window_title (gdisp);
|
|
|
|
info_win = info_dialog_notebook_new (title,
|
1999-09-28 01:58:10 +08:00
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/info_window.html");
|
2001-06-18 21:10:03 +08:00
|
|
|
g_free (title);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* create the action area */
|
2001-09-21 18:47:19 +08:00
|
|
|
gimp_dialog_create_action_area (GIMP_DIALOG (info_win->shell),
|
1999-10-27 02:27:27 +08:00
|
|
|
|
2001-08-04 03:43:19 +08:00
|
|
|
GTK_STOCK_CLOSE, info_window_close_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
info_win, NULL, NULL, TRUE, FALSE,
|
1999-10-27 02:27:27 +08:00
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
iwd = g_new0 (InfoWinData, 1);
|
|
|
|
iwd->gdisp = gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
info_win->user_data = iwd;
|
2000-02-08 04:03:03 +08:00
|
|
|
|
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);
|
2000-02-08 04:03:03 +08:00
|
|
|
info_dialog_add_label (info_win, '\0',
|
|
|
|
iwd->real_dimensions_str);
|
1999-04-03 03:46:59 +08:00
|
|
|
info_dialog_add_label (info_win, _("Resolution:"),
|
|
|
|
iwd->resolution_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
|
|
|
|
1999-10-31 01:49:50 +08:00
|
|
|
/* Add extra tabs */
|
2001-10-29 19:47:11 +08:00
|
|
|
info_window_create_extended (info_win, gdisp->gimage->gimp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-31 01:49:50 +08:00
|
|
|
/* keep track of image name changes */
|
2001-08-15 00:33:28 +08:00
|
|
|
g_signal_connect (G_OBJECT (gdisp->gimage), "name_changed",
|
|
|
|
G_CALLBACK (info_window_image_renamed_callback),
|
|
|
|
info_win);
|
1999-10-31 01:49:50 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
/* update the fields */
|
|
|
|
info_window_update (gdisp);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return info_win;
|
|
|
|
}
|
|
|
|
|
1999-11-30 08:11:08 +08:00
|
|
|
static InfoDialog *info_window_auto = NULL;
|
|
|
|
|
|
|
|
static gchar *
|
2001-10-29 19:47:11 +08:00
|
|
|
info_window_title (GimpDisplay *gdisp)
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
2001-08-30 01:48:28 +08:00
|
|
|
gchar *basename;
|
|
|
|
gchar *title;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2001-08-30 01:48:28 +08:00
|
|
|
basename = g_path_get_basename (gimp_image_filename (gdisp->gimage));
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
title = g_strdup_printf (_("Info: %s-%d.%d"),
|
|
|
|
basename,
|
|
|
|
gimp_image_get_ID (gdisp->gimage),
|
|
|
|
gdisp->instance);
|
2000-01-15 01:06:35 +08:00
|
|
|
|
2001-08-30 01:48:28 +08:00
|
|
|
g_free (basename);
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
return title;
|
1999-11-30 08:11:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-06-18 21:10:03 +08:00
|
|
|
info_window_change_display (GimpContext *context,
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *newdisp,
|
2001-06-18 21:10:03 +08:00
|
|
|
gpointer data)
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp = newdisp;
|
|
|
|
GimpDisplay *old_gdisp;
|
2001-01-23 04:46:50 +08:00
|
|
|
GimpImage *gimage;
|
1999-11-30 08:11:08 +08:00
|
|
|
InfoWinData *iwd;
|
|
|
|
|
|
|
|
iwd = (InfoWinData *) info_window_auto->user_data;
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
old_gdisp = (GimpDisplay *) iwd->gdisp;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
|
|
|
if (!info_window_auto || gdisp == old_gdisp || !gdisp)
|
2001-01-23 04:46:50 +08:00
|
|
|
return;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
|
|
|
gimage = gdisp->gimage;
|
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
if (gimage && gimp_container_have (context->gimp->images,
|
|
|
|
GIMP_OBJECT (gimage)))
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
|
|
|
iwd->gdisp = gdisp;
|
2001-01-23 04:46:50 +08:00
|
|
|
info_window_update (gdisp);
|
1999-11-30 08:11:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-10-29 19:47:11 +08:00
|
|
|
info_window_follow_auto (Gimp *gimp)
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
2001-06-18 21:10:03 +08:00
|
|
|
GimpContext *context;
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
context = gimp_get_user_context (gimp);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
|
|
|
gdisp = gimp_context_get_display (context);
|
|
|
|
|
|
|
|
if (! gdisp)
|
1999-11-30 08:11:08 +08:00
|
|
|
return;
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! info_window_auto)
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
2001-06-18 21:10:03 +08:00
|
|
|
info_window_auto = info_window_create (gdisp);
|
|
|
|
|
2001-07-25 08:42:47 +08:00
|
|
|
g_signal_connect (G_OBJECT (context), "display_changed",
|
|
|
|
G_CALLBACK (info_window_change_display),
|
|
|
|
NULL);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
|
|
|
info_window_update (gdisp);
|
1999-11-30 08:11:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
info_dialog_popup (info_window_auto);
|
|
|
|
}
|
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
|
|
|
|
/* Updates all extended information. */
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
void
|
2001-10-29 19:47:11 +08:00
|
|
|
info_window_update_extended (GimpDisplay *gdisp,
|
|
|
|
gdouble tx,
|
|
|
|
gdouble ty)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2001-01-23 04:46:50 +08:00
|
|
|
InfoWinData *iwd;
|
2001-06-15 00:23:40 +08:00
|
|
|
gdouble unit_factor;
|
|
|
|
gint unit_digits;
|
|
|
|
gchar format_buf[32];
|
|
|
|
gchar buf[32];
|
2001-01-23 04:46:50 +08:00
|
|
|
guchar *color;
|
|
|
|
GimpImageType sample_type;
|
2001-11-01 05:20:09 +08:00
|
|
|
InfoDialog *info_win;
|
2001-01-23 04:46:50 +08:00
|
|
|
gboolean force_update = FALSE;
|
2001-06-15 00:23:40 +08:00
|
|
|
gint i;
|
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
info_win = GIMP_DISPLAY_SHELL (gdisp->shell)->info_dialog;
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! info_win && info_window_auto != NULL)
|
2001-01-23 04:46:50 +08:00
|
|
|
info_win = info_window_auto;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! info_win)
|
1999-08-13 06:21:04 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2001-01-23 04:46:50 +08:00
|
|
|
if (iwd->gdisp != gdisp)
|
1999-11-30 08:11:08 +08:00
|
|
|
force_update = TRUE;
|
|
|
|
|
|
|
|
iwd->gdisp = gdisp;
|
|
|
|
|
2001-01-23 04:46:50 +08:00
|
|
|
if (force_update)
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
2001-01-23 04:46:50 +08:00
|
|
|
gchar *title;
|
|
|
|
|
|
|
|
info_window_update (gdisp);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2001-01-23 04:46:50 +08:00
|
|
|
title = info_window_title (gdisp);
|
|
|
|
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title);
|
|
|
|
g_free (title);
|
1999-11-30 08:11:08 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! iwd || ! iwd->showing_extended)
|
1999-08-13 06:21:04 +08:00
|
|
|
return;
|
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
/* fill in position information */
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (tx < 0.0 && ty < 0.0)
|
2001-06-15 00:23:40 +08:00
|
|
|
{
|
|
|
|
iwd->unit_str = NULL;
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->pos_labels[i]), _("N/A"));
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->unit_labels[i]), NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* width and height */
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
unit_factor = _gimp_unit_get_factor (gdisp->gimage->gimp,
|
|
|
|
gdisp->gimage->unit);
|
|
|
|
unit_digits = _gimp_unit_get_digits (gdisp->gimage->gimp,
|
|
|
|
gdisp->gimage->unit);
|
2001-06-15 00:23:40 +08:00
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
if (iwd->unit_str != _gimp_unit_get_abbreviation (gdisp->gimage->gimp,
|
|
|
|
gdisp->gimage->unit))
|
2001-06-15 00:23:40 +08:00
|
|
|
{
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
iwd->unit_str = _gimp_unit_get_abbreviation (gdisp->gimage->gimp,
|
|
|
|
gdisp->gimage->unit);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2001-06-15 00:23:40 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->unit_labels[0]), iwd->unit_str);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->unit_labels[1]), iwd->unit_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_snprintf (format_buf, sizeof (format_buf),
|
|
|
|
"%%.%df", unit_digits);
|
|
|
|
|
|
|
|
g_snprintf (buf, sizeof (buf), "%d", (gint) tx);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->pos_labels[0]), buf);
|
|
|
|
|
|
|
|
g_snprintf (buf, sizeof (buf), format_buf,
|
|
|
|
tx * unit_factor / gdisp->gimage->xresolution);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->pos_labels[1]), buf);
|
|
|
|
|
|
|
|
g_snprintf (buf, sizeof (buf), "%d", (gint) ty);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->pos_labels[2]), buf);
|
|
|
|
|
|
|
|
g_snprintf (buf, sizeof (buf), format_buf,
|
|
|
|
ty * unit_factor / gdisp->gimage->yresolution);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->pos_labels[3]), buf);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fill in color information */
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! (color = gimp_image_get_color_at (gdisp->gimage, tx, ty))
|
|
|
|
|| (tx < 0.0 && ty < 0.0))
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2001-06-15 00:23:40 +08:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), _("N/A"));
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
2001-06-15 00:23:40 +08:00
|
|
|
else
|
2000-02-12 22:38:15 +08:00
|
|
|
{
|
2001-06-15 00:23:40 +08:00
|
|
|
sample_type = gimp_image_composite_type (gdisp->gimage);
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
for (i = RED_PIX;
|
2001-06-15 00:23:40 +08:00
|
|
|
i <= (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type) ?
|
|
|
|
ALPHA_PIX : BLUE_PIX);
|
|
|
|
i++)
|
|
|
|
{
|
|
|
|
g_snprintf (buf, sizeof (buf), "%d", (gint) color[i]);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == ALPHA_PIX)
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), _("N/A"));
|
2001-06-18 21:10:03 +08:00
|
|
|
|
|
|
|
g_free (color);
|
2000-02-12 22:38:15 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
|
|
|
info_window_free (InfoDialog *info_win)
|
|
|
|
{
|
1999-10-31 01:49:50 +08:00
|
|
|
InfoWinData *iwd;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! info_win && info_window_auto)
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_set_sensitive (info_window_auto->vbox, FALSE);
|
1999-11-30 08:11:08 +08:00
|
|
|
return;
|
|
|
|
}
|
1999-10-31 01:49:50 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! info_win)
|
1999-12-01 05:33:12 +08:00
|
|
|
return;
|
|
|
|
|
1999-10-31 01:49:50 +08:00
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
|
|
|
|
2001-08-15 00:33:28 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (G_OBJECT (iwd->gdisp->gimage),
|
|
|
|
info_window_image_renamed_callback,
|
|
|
|
info_win);
|
1999-10-31 01:49:50 +08:00
|
|
|
|
|
|
|
g_free (iwd);
|
1997-11-25 06:05:25 +08:00
|
|
|
info_dialog_free (info_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-10-29 19:47:11 +08:00
|
|
|
info_window_update (GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
InfoWinData *iwd;
|
1999-10-31 01:49:50 +08:00
|
|
|
gint 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];
|
2001-11-01 05:20:09 +08:00
|
|
|
InfoDialog *info_win;
|
|
|
|
|
|
|
|
info_win = GIMP_DISPLAY_SHELL (gdisp->shell)->info_dialog;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! info_win && info_window_auto != NULL)
|
2000-02-12 22:38:15 +08:00
|
|
|
info_win = info_window_auto;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! info_win)
|
1999-11-30 08:11:08 +08:00
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
if (info_window_auto)
|
|
|
|
gtk_widget_set_sensitive (info_window_auto->vbox, TRUE);
|
1999-11-30 08:11:08 +08:00
|
|
|
|
|
|
|
/* If doing info_window_auto then return if this display
|
|
|
|
* is not the one we are showing.
|
|
|
|
*/
|
2000-02-08 04:03:03 +08:00
|
|
|
if (info_window_auto && iwd->gdisp != gdisp)
|
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* width and height */
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
unit_factor = _gimp_unit_get_factor (gdisp->gimage->gimp,
|
|
|
|
gdisp->gimage->unit);
|
|
|
|
unit_digits = _gimp_unit_get_digits (gdisp->gimage->gimp,
|
|
|
|
gdisp->gimage->unit);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2000-02-08 04:03:03 +08:00
|
|
|
g_snprintf (iwd->dimensions_str, MAX_BUF,
|
|
|
|
_("%d x %d pixels"),
|
|
|
|
(int) gdisp->gimage->width,
|
|
|
|
(int) gdisp->gimage->height);
|
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),
|
2000-02-08 04:03:03 +08:00
|
|
|
"%%.%df x %%.%df %s",
|
1999-04-03 03:46:59 +08:00
|
|
|
unit_digits + 1, unit_digits + 1,
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
_gimp_unit_get_plural (gdisp->gimage->gimp,
|
|
|
|
gdisp->gimage->unit));
|
2000-02-08 04:03:03 +08:00
|
|
|
g_snprintf (iwd->real_dimensions_str, MAX_BUF, format_buf,
|
1999-04-03 03:46:59 +08:00
|
|
|
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 */
|
2000-02-12 22:38:15 +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);
|
|
|
|
|
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",
|
2001-06-18 21:10:03 +08:00
|
|
|
SCALEDEST (gdisp), SCALESRC (gdisp));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
type = gimp_image_base_type (gdisp->gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* 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)
|
2000-02-08 04:03:03 +08:00
|
|
|
g_snprintf (iwd->color_type_str, MAX_BUF, "%s (%d %s)",
|
|
|
|
_("Indexed Color"), gdisp->gimage->num_cols, _("colors"));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* visual class */
|
2001-06-18 21:10:03 +08:00
|
|
|
if (type == RGB || type == INDEXED)
|
|
|
|
g_snprintf (iwd->visual_class_str, MAX_BUF, "%s",
|
|
|
|
gettext (visual_classes[g_visual->type]));
|
1997-11-25 06:05:25 +08:00
|
|
|
else if (type == GRAY)
|
2001-06-18 21:10:03 +08:00
|
|
|
g_snprintf (iwd->visual_class_str, MAX_BUF, "%s",
|
|
|
|
gettext (visual_classes[g_visual->type]));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* visual depth */
|
2001-05-14 01:25:12 +08:00
|
|
|
g_snprintf (iwd->visual_depth_str, MAX_BUF, "%d", g_visual->depth);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
info_dialog_update (info_win);
|
|
|
|
}
|