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-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include "apptypes.h"
|
|
|
|
|
2001-02-21 20:18:09 +08:00
|
|
|
#include "tools/color_picker.h"
|
|
|
|
#include "tools/tool.h"
|
|
|
|
#include "tools/tool_manager.h"
|
|
|
|
|
2001-02-04 06:05:41 +08:00
|
|
|
#include "context_manager.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "colormaps.h"
|
|
|
|
#include "gdisplay.h"
|
2001-02-04 06:05:41 +08:00
|
|
|
#include "gimpcontainer.h"
|
1999-11-30 08:11:08 +08:00
|
|
|
#include "gimpcontext.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "gimpimage.h"
|
2001-02-21 20:18:09 +08:00
|
|
|
#include "gimppreview.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "info_dialog.h"
|
|
|
|
#include "info_window.h"
|
2001-01-22 09:46:28 +08:00
|
|
|
|
2001-01-22 05:58:16 +08:00
|
|
|
#include "pdb/procedural_db.h"
|
|
|
|
|
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
|
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
gchar dimensions_str[MAX_BUF];
|
2000-02-08 04:03:03 +08:00
|
|
|
gchar real_dimensions_str[MAX_BUF];
|
1999-10-27 02:27:27 +08:00
|
|
|
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[MAX_BUF];
|
|
|
|
|
1999-10-31 01:49:50 +08:00
|
|
|
GDisplay *gdisp;
|
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
|
|
|
};
|
|
|
|
|
2000-01-15 01:06:35 +08:00
|
|
|
static gchar * info_window_title (GDisplay *gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
1999-10-31 01:49:50 +08:00
|
|
|
static void
|
|
|
|
info_window_image_rename_callback (GimpImage *gimage,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-01-14 11:55:56 +08:00
|
|
|
InfoDialog *id;
|
|
|
|
gchar *title;
|
|
|
|
GDisplay *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;
|
|
|
|
|
|
|
|
gdisp = (GDisplay *) iwd->gdisp;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
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
|
2000-02-12 22:38:15 +08:00
|
|
|
info_window_create_extended (InfoDialog *info_win)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
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;
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
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-02-21 20:18:09 +08:00
|
|
|
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (GIMP_TYPE_COLOR_PICKER)), 22, 0, FALSE);
|
|
|
|
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);
|
|
|
|
|
|
|
|
iwd->labelRvalue = 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, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
iwd->labelGvalue = 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, 2, 3,
|
1999-08-13 06:21:04 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_show (label);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
iwd->labelBvalue = 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, 3, 4,
|
1999-08-13 06:21:04 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_show (label);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
iwd->labelAvalue = 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, 4, 5,
|
1999-08-13 06:21:04 +08:00
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_widget_show (label);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK(info_win->info_notebook),
|
|
|
|
hbox, gtk_label_new (_("Extended")));
|
|
|
|
gtk_widget_show (hbox);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
/* Set back to first page */
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_notebook_set_page (GTK_NOTEBOOK(info_win->info_notebook), 0);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_object_set_user_data (GTK_OBJECT (info_win->info_notebook),
|
|
|
|
(gpointer)info_win);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (info_win->info_notebook), "switch_page",
|
|
|
|
GTK_SIGNAL_FUNC (info_window_page_switch), NULL);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
*/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
InfoDialog *
|
1999-10-31 01:49:50 +08:00
|
|
|
info_window_create (GDisplay *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;
|
|
|
|
gchar *title_buf;
|
|
|
|
gint type;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
title = g_basename (gimp_image_filename (gdisp->gimage));
|
|
|
|
type = gimp_image_base_type (gdisp->gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* create the info dialog */
|
2000-02-12 22:38:15 +08:00
|
|
|
title_buf = info_window_title (gdisp);
|
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,
|
2000-01-07 00:40:17 +08:00
|
|
|
info_win, NULL, NULL, TRUE, FALSE,
|
1999-10-27 02:27:27 +08:00
|
|
|
|
|
|
|
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;
|
2000-02-08 04:03:03 +08:00
|
|
|
|
|
|
|
iwd->dimensions_str[0] = '\0';
|
|
|
|
iwd->real_dimensions_str[0] = '\0';
|
|
|
|
iwd->resolution_str[0] = '\0';
|
|
|
|
iwd->scale_str[0] = '\0';
|
|
|
|
iwd->color_type_str[0] = '\0';
|
|
|
|
iwd->visual_class_str[0] = '\0';
|
|
|
|
iwd->visual_depth_str[0] = '\0';
|
|
|
|
iwd->gdisp = gdisp;
|
|
|
|
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);
|
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
|
|
|
/* update the fields */
|
1999-11-30 08:11:08 +08:00
|
|
|
/*gdisp->window_info_dialog = info_win;*/
|
|
|
|
info_window_update (gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-31 01:49:50 +08:00
|
|
|
/* Add extra tabs */
|
2000-02-12 22:38:15 +08:00
|
|
|
info_window_create_extended (info_win);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-31 01:49:50 +08:00
|
|
|
/* keep track of image name changes */
|
2001-01-14 11:55:56 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "name_changed",
|
1999-10-31 01:49:50 +08:00
|
|
|
GTK_SIGNAL_FUNC (info_window_image_rename_callback),
|
|
|
|
info_win);
|
|
|
|
|
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 *
|
2000-01-15 01:06:35 +08:00
|
|
|
info_window_title (GDisplay *gdisp)
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
2000-01-15 01:06:35 +08:00
|
|
|
gchar *title;
|
|
|
|
gchar *title_buf;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
title = g_basename (gimp_image_filename (gdisp->gimage));
|
1999-11-30 08:11:08 +08:00
|
|
|
|
|
|
|
/* create the info dialog */
|
1999-12-15 07:09:54 +08:00
|
|
|
title_buf = g_strdup_printf (_("Info: %s-%d.%d"),
|
1999-11-30 08:11:08 +08:00
|
|
|
title,
|
|
|
|
pdb_image_to_id (gdisp->gimage),
|
|
|
|
gdisp->instance);
|
2000-01-15 01:06:35 +08:00
|
|
|
|
1999-11-30 08:11:08 +08:00
|
|
|
return title_buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
info_window_change_display (GimpContext *context, /* NOT USED */
|
|
|
|
GDisplay *newdisp,
|
|
|
|
gpointer data /* Not used */)
|
|
|
|
{
|
2001-01-23 04:46:50 +08:00
|
|
|
GDisplay *gdisp = newdisp;
|
|
|
|
GDisplay *old_gdisp;
|
|
|
|
GimpImage *gimage;
|
1999-11-30 08:11:08 +08:00
|
|
|
InfoWinData *iwd;
|
|
|
|
|
|
|
|
iwd = (InfoWinData *) info_window_auto->user_data;
|
|
|
|
|
|
|
|
old_gdisp = (GDisplay *) iwd->gdisp;
|
|
|
|
|
|
|
|
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-02-04 22:10:03 +08:00
|
|
|
if (gimage && gimp_container_have (image_context, 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
|
2000-01-15 01:06:35 +08:00
|
|
|
info_window_follow_auto (void)
|
1999-11-30 08:11:08 +08:00
|
|
|
{
|
|
|
|
GDisplay * gdisp;
|
|
|
|
|
|
|
|
gdisp = gdisplay_active ();
|
|
|
|
|
|
|
|
if (!gdisp)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(!info_window_auto)
|
|
|
|
{
|
|
|
|
info_window_auto = info_window_create ((void *) gdisp);
|
2001-01-23 04:46:50 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
|
|
|
|
"display_changed",
|
|
|
|
GTK_SIGNAL_FUNC (info_window_change_display),
|
|
|
|
NULL);
|
|
|
|
info_window_update (gdisp); /* Update to include the info */
|
1999-11-30 08:11:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
info_dialog_popup (info_window_auto);
|
|
|
|
/*
|
|
|
|
iwd = (NavWinData *)nav_window_auto->user_data;
|
|
|
|
gtk_widget_set_sensitive(nav_window_auto->vbox,TRUE);
|
|
|
|
iwd->frozen = FALSE;
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
void
|
2000-01-15 01:06:35 +08:00
|
|
|
info_window_update_RGB (GDisplay *gdisp,
|
|
|
|
gdouble tx,
|
|
|
|
gdouble ty)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2001-01-23 04:46:50 +08:00
|
|
|
InfoWinData *iwd;
|
|
|
|
gchar buff[4];
|
|
|
|
guchar *color;
|
|
|
|
GimpImageType sample_type;
|
|
|
|
InfoDialog *info_win = gdisp->window_info_dialog;
|
|
|
|
gboolean force_update = FALSE;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2000-01-15 01:06:35 +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
|
|
|
|
1999-10-31 01:49:50 +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);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-01-23 04:46:50 +08:00
|
|
|
if (!iwd || !iwd->showingPreview)
|
1999-08-13 06:21:04 +08:00
|
|
|
return;
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
/* gimp_image_active_drawable (gdisp->gimage) */
|
1999-10-31 01:49:50 +08:00
|
|
|
if (!(color = gimp_image_get_color_at (gdisp->gimage, tx, ty))
|
1999-08-13 06:21:04 +08:00
|
|
|
|| (tx < 0.0 && ty < 0.0))
|
|
|
|
{
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelRvalue), _("N/A"));
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelGvalue), _("N/A"));
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelBvalue), _("N/A"));
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), _("N/A"));
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
1999-10-31 01:49:50 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
g_snprintf (buff, sizeof (buff), "%d", (gint) color[RED_PIX]);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelRvalue), buff);
|
1999-10-31 01:49:50 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
g_snprintf (buff, sizeof (buff), "%d", (gint) color[GREEN_PIX]);
|
1999-10-31 01:49:50 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelGvalue), buff);
|
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
g_snprintf (buff, sizeof (buff), "%d", (gint) color[BLUE_PIX]);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelBvalue), buff);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
sample_type = gimp_image_composite_type (gdisp->gimage);
|
|
|
|
|
2000-12-14 02:53:35 +08:00
|
|
|
if (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type))
|
2000-02-12 22:38:15 +08:00
|
|
|
{
|
|
|
|
g_snprintf (buff, sizeof (buff), "%d", (gint) color[ALPHA_PIX]);
|
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff);
|
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
else
|
2000-02-12 22:38:15 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), _("N/A"));
|
1999-08-13 06:21:04 +08:00
|
|
|
|
|
|
|
g_free(color);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2000-02-12 22:38:15 +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
|
|
|
|
2000-02-12 22:38:15 +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;
|
|
|
|
|
|
|
|
gtk_signal_disconnect_by_data (GTK_OBJECT (iwd->gdisp->gimage), info_win);
|
|
|
|
|
|
|
|
g_free (iwd);
|
1997-11-25 06:05:25 +08:00
|
|
|
info_dialog_free (info_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-11-30 08:11:08 +08:00
|
|
|
info_window_update (GDisplay *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-01-23 04:46:50 +08:00
|
|
|
InfoDialog *info_win = gdisp->window_info_dialog;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
2000-02-12 22:38:15 +08:00
|
|
|
if (!info_win && info_window_auto != NULL)
|
|
|
|
info_win = info_window_auto;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
|
|
|
if (!info_win)
|
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
iwd = (InfoWinData *) info_win->user_data;
|
1999-11-30 08:11:08 +08:00
|
|
|
|
|
|
|
/* Make it sensitive... */
|
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 */
|
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);
|
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,
|
2000-02-08 04:03:03 +08:00
|
|
|
gimp_unit_get_plural (gdisp->gimage->unit));
|
|
|
|
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",
|
1997-11-25 06:05:25 +08:00
|
|
|
SCALEDEST (gdisp), SCALESRC (gdisp));
|
|
|
|
|
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 */
|
|
|
|
if (type == RGB ||
|
|
|
|
type == INDEXED)
|
2000-02-12 22:38:15 +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
|
|
|
else if (type == GRAY)
|
2000-02-12 22:38:15 +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 */
|
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
|
|
|
|
|
|
|
info_dialog_update (info_win);
|
|
|
|
}
|