mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 12:32:37 +00:00
cee3baea0f
2008-03-18 Michael Natterer <mitch@gimp.org> First draft of the "no image open" window, which is implemented as a display without image (a view with NULL model). Didn't change the display's appearance yet so I can first make sure the display without image works properly in all details before hiding these details. * app/core/gimp-gui.[ch]: add "gimp" parameter to display_create() and allow "image" to be NULL. * app/core/gimpcontext.c (gimp_context_real_set_display): a display's image can be NULL now. * app/display/gimpdisplay.[ch]: add Gimp and GimpDisplayConfig members. Add Gimp parameter to gimp_display_shell_new(). Changed gimp_display_reconnect() to gimp_display_set_image() and allow to set a NULL image. * app/gui/gui-vtable.c (gui_display_create): if there is a single display without an image, call gimp_display_set_image() on that display instead of creating a new one. * app/display/gimpdisplayshell-close.c: if the last display is closed, don't close it but make it empty. Factored out that code to gimp_display_shell_really_close(). * app/display/gimpdisplayshell-dnd.c: when dropping uris on an empty display, open the first one into that display and the other ones as layers of the newly opened image. This is consistent with dropping on an existing image but maybe needs some discussion. * app/display/gimpdisplayshell-callbacks.c: bail out early in the tool event callback so tools never have to deal with empty displays. In expose(), draw the drop zone on the empty display. * app/display/gimpdisplayshell-title.c: set the empty display's title to "Gimp - Drop Files". * app/display/gimpdisplay-foreach.c * app/display/gimpdisplay-handlers.c * app/display/gimpdisplayshell-appearance.c * app/display/gimpdisplayshell-autoscroll.c * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-dnd.c * app/display/gimpdisplayshell-draw.c * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell-preview.c * app/display/gimpdisplayshell-render.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-scroll.c * app/display/gimpdisplayshell-selection.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.c * app/display/gimpnavigationeditor.c * app/display/gimpstatusbar.c: use display->gimp and display->config instead of going via the image. Guard against empty displays in some few places (most places can't be called). Where needed, use the canvas' dimensions instead of the image's dimensions so scroll offsets and scrollbars still have sane values instead of the last image's ones. * app/actions/actions.c (action_data_get_gimp) (action_data_get_context): use display->gimp instead of display->image->gimp. * app/actions/edit-commands.c (edit_paste_cmd_callback): redirect to "paste as new" if there is an empty display. * app/actions/tools-commands.c (tools_select_cmd_callback): don't initialize the new tool on an empty display. * app/actions/view-actions.c (view_actions_update): changed lots of sensitivity settings to be insensitive when there is no image (instead of no display). * app/actions/view-commands.c: use the display's config object instead of gimp's. svn path=/trunk/; revision=25113
144 lines
4.6 KiB
C
144 lines
4.6 KiB
C
/* GIMP - The GNU Image Manipulation Program
|
|
* Copyright (C) 1999 Manish Singh
|
|
*
|
|
* 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
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
#include "display-types.h"
|
|
|
|
#include "core/gimp.h"
|
|
#include "core/gimpimage.h"
|
|
|
|
#include "widgets/gimpcolordisplayeditor.h"
|
|
#include "widgets/gimphelp-ids.h"
|
|
#include "widgets/gimpviewabledialog.h"
|
|
|
|
#include "gimpdisplay.h"
|
|
#include "gimpdisplayshell.h"
|
|
#include "gimpdisplayshell-filter.h"
|
|
#include "gimpdisplayshell-filter-dialog.h"
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
typedef struct
|
|
{
|
|
GimpDisplayShell *shell;
|
|
GtkWidget *dialog;
|
|
|
|
GimpColorDisplayStack *old_stack;
|
|
} ColorDisplayDialog;
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
static void gimp_display_shell_filter_dialog_response (GtkWidget *widget,
|
|
gint response_id,
|
|
ColorDisplayDialog *cdd);
|
|
|
|
static void gimp_display_shell_filter_dialog_free (ColorDisplayDialog *cdd);
|
|
|
|
|
|
/* public functions */
|
|
|
|
GtkWidget *
|
|
gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell)
|
|
{
|
|
ColorDisplayDialog *cdd;
|
|
GtkWidget *editor;
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
|
|
|
cdd = g_slice_new0 (ColorDisplayDialog);
|
|
|
|
cdd->shell = shell;
|
|
cdd->dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (shell->display->image),
|
|
gimp_get_user_context (shell->display->gimp),
|
|
_("Color Display Filters"),
|
|
"gimp-display-filters",
|
|
GIMP_STOCK_DISPLAY_FILTER,
|
|
_("Configure Color Display Filters"),
|
|
GTK_WIDGET (cdd->shell),
|
|
gimp_standard_help_func,
|
|
GIMP_HELP_DISPLAY_FILTER_DIALOG,
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
|
|
|
NULL);
|
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (cdd->dialog),
|
|
GTK_RESPONSE_OK,
|
|
GTK_RESPONSE_CANCEL,
|
|
-1);
|
|
|
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (cdd->dialog), TRUE);
|
|
|
|
g_object_weak_ref (G_OBJECT (cdd->dialog),
|
|
(GWeakNotify) gimp_display_shell_filter_dialog_free, cdd);
|
|
|
|
g_signal_connect (cdd->dialog, "response",
|
|
G_CALLBACK (gimp_display_shell_filter_dialog_response),
|
|
cdd);
|
|
|
|
if (shell->filter_stack)
|
|
{
|
|
cdd->old_stack = gimp_color_display_stack_clone (shell->filter_stack);
|
|
|
|
g_object_weak_ref (G_OBJECT (cdd->dialog),
|
|
(GWeakNotify) g_object_unref, cdd->old_stack);
|
|
}
|
|
else
|
|
{
|
|
GimpColorDisplayStack *stack = gimp_color_display_stack_new ();
|
|
|
|
gimp_display_shell_filter_set (shell, stack);
|
|
g_object_unref (stack);
|
|
}
|
|
|
|
editor = gimp_color_display_editor_new (shell->filter_stack);
|
|
gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cdd->dialog)->vbox), editor);
|
|
gtk_widget_show (editor);
|
|
|
|
return cdd->dialog;
|
|
}
|
|
|
|
|
|
/* private functions */
|
|
|
|
static void
|
|
gimp_display_shell_filter_dialog_response (GtkWidget *widget,
|
|
gint response_id,
|
|
ColorDisplayDialog *cdd)
|
|
{
|
|
if (response_id != GTK_RESPONSE_OK)
|
|
gimp_display_shell_filter_set (cdd->shell, cdd->old_stack);
|
|
|
|
gtk_widget_destroy (GTK_WIDGET (cdd->dialog));
|
|
}
|
|
|
|
static void
|
|
gimp_display_shell_filter_dialog_free (ColorDisplayDialog *cdd)
|
|
{
|
|
g_slice_free (ColorDisplayDialog, cdd);
|
|
}
|