gimp/app/widgets/gimpcontainerbox.c

221 lines
7.2 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpcontainerbox.c
* Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "gimpcontainerbox.h"
#include "gimpcontainerview.h"
#include "gimpdnd.h"
#include "gimpdocked.h"
Bill Skaggs <weskaggs@primate.ucdavis.edu> * libgimpwidgets/gimppropwidgets.[ch]: magic-copied from app/widgets and un-movable things then removed. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.def * libgimpwidgets/gimpwidgets.h: corresponding changes * app/widgets/gimppropwidgets.[ch]: remove functions that were moved. * app/dialogs/stroke-dialog.c * app/dialogs/tips-dialog.c * app/dialogs/user-install-dialog.c * app/tools/gimpairbrushtool.c * app/tools/gimpblendoptions.c * app/tools/gimpbucketfilloptions.c * app/tools/gimpclonetool.c * app/tools/gimpcoloroptions.c * app/tools/gimpcolorpickeroptions.c * app/tools/gimpconvolvetool.c * app/tools/gimpcropoptions.c * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpflipoptions.c * app/tools/gimphistogramoptions.c * app/tools/gimpimagemaptool.c * app/tools/gimpinkoptions-gui.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifyoptions.c * app/tools/gimpmeasureoptions.c * app/tools/gimpmoveoptions.c * app/tools/gimpselectionoptions.c * app/tools/gimpsmudgetool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformoptions.c * app/tools/gimpvectoroptions.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontrollereditor.c * app/widgets/gimpdevicestatus.c * app/widgets/gimpgrideditor.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogrameditor.c * app/widgets/gimpsizebox.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptooloptionseditor.c: fix includes.
2005-02-05 04:47:42 +08:00
#include "gimppropwidgets.h"
#include "gimpview.h"
app/widgets/gimppreview-popup.c renamed these files... * app/widgets/gimppreview-popup.c * app/widgets/gimppreview-popup.h: renamed these files... * app/widgets/gimpview-popup.c * app/widgets/gimpview-popup.h: .. to these files, and changed the GimpPreviewPopup type to GimpViewPopup. * app/widgets/gimppreviewrenderer.c * app/widgets/gimppreviewrenderer.h: renamed these files... * app/widgets/gimpviewrenderer.c * app/widgets/gimpviewrenderer.h: .. to these files, and changed GimpPreviewRenderer to GimpViewRenderer. This is the second step of the great Preview->View renaming process. * app/display/gimpdisplayshell-layer-select.c * app/display/gimpnavigationeditor.c * app/widgets/Makefile.am * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcellrendererviewable.h * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainercombobox.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerentry.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview-dnd.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcontainerview.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpnavigationpreview.c * app/widgets/gimppatternfactoryview.c * app/widgets/gimppreviewrenderer-utils.c * app/widgets/gimppreviewrendererbrush.c * app/widgets/gimppreviewrendererbrush.h * app/widgets/gimppreviewrendererdrawable.c * app/widgets/gimppreviewrendererdrawable.h * app/widgets/gimppreviewrenderergradient.c * app/widgets/gimppreviewrenderergradient.h * app/widgets/gimppreviewrendererimage.c * app/widgets/gimppreviewrendererimage.h * app/widgets/gimppreviewrendererimagefile.c * app/widgets/gimppreviewrendererimagefile.h * app/widgets/gimppreviewrendererlayer.c * app/widgets/gimppreviewrenderervectors.c * app/widgets/gimpselectioneditor.c * app/widgets/gimptemplateview.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpview.c * app/widgets/gimpview.h * app/widgets/gimpviewablebutton.c * app/widgets/widgets-enums.h * app/widgets/widgets-types.h: Modified accordingly.
2004-08-26 06:31:44 +08:00
#include "gimpviewrenderer.h"
static void gimp_container_box_view_iface_init (GimpContainerViewInterface *iface);
static void gimp_container_box_docked_iface_init (GimpDockedInterface *iface);
static void gimp_container_box_constructed (GObject *object);
static GtkWidget * gimp_container_box_get_preview (GimpDocked *docked,
GimpContext *context,
GtkIconSize size);
static void gimp_container_box_set_context (GimpDocked *docked,
reoedered to somehow reflect the class hierarchy. 2004-05-23 Michael Natterer <mitch@gimp.org> * app/widgets/widgets-types.h: reoedered to somehow reflect the class hierarchy. Some dockable context handling cleanup: * app/widgets/gimpdocked.[ch]: removed "prev_context" parameter from GimpDocked::set_context(). Widgets which need the old context to disconnect from should remember it themselves. * app/widgets/gimpdockable.c (gimp_dockable_set_context): don't pass the old context to gimp_docked_set_context(). Some cleanup. * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainereditor.c: changed accordingly. * app/display/gimpnavigationview.[ch] * app/widgets/gimpimageeditor.[ch] * app/widgets/gimpitemtreeview.[ch]: added a "context" member which holds the context set by GimpDocked::set_context(). * app/widgets/gimpdrawabletreeview.c: use the view's context instead of gimp_get_user_context(). * app/widgets/gimpcoloreditor.[ch]: removed separate API to set the context because it implements the GimpDockedInterface. * app/widgets/gimpcomponenteditor.c * app/widgets/gimperrorconsole.c: pass "menu-factory", "menu-identifier" and "ui-path" to g_object_new() instead of calling gimp_editor_create_menu() later. Action cleanup partly related to the context stuff above: * app/actions/actions.c (action_data_get_gimp): get the Gimp from context->gimp, not gimage->gimp because gimage may be NULL. (action_data_get_context): changed to use the new context members added above. * app/actions/channels-actions.c (channels_actions_update): cleanup. * app/actions/edit-actions.c (edit_actions_update): fixed sensitivity of "edit-undo-clear". * app/actions/vectors-actions.c (vectors_actions_update): make "vectors-merge-visible" sensitive only if there is more than one GimpVectors in the image. * app/actions/colormap-editor-actions.c * app/actions/gradient-editor-actions.c * app/actions/palette-editor-actions.c: added FG/BG color previews to actions which take colors from them. Changed code to be safe against "context" being NULL. * app/actions/drawable-commands.c: s/active_drawable/drawable/g. Makes the code more readable. * app/actions/select-commands.[ch] * app/actions/vectors-commands.[ch]: removed public stroke utility functions and other stuff which is not needed any more because dialog buttons invoke the correct actions now. Moved the functions' code to the resp. action callbacks.
2004-05-23 18:04:41 +08:00
GimpContext *context);
G_DEFINE_TYPE_WITH_CODE (GimpContainerBox, gimp_container_box,
GIMP_TYPE_EDITOR,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW,
gimp_container_box_view_iface_init)
G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
gimp_container_box_docked_iface_init))
#define parent_class gimp_container_box_parent_class
static void
gimp_container_box_class_init (GimpContainerBoxClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = gimp_container_box_constructed;
object_class->set_property = gimp_container_view_set_property;
object_class->get_property = gimp_container_view_get_property;
gimp_container_view_install_properties (object_class);
}
static void
gimp_container_box_init (GimpContainerBox *box)
{
GtkWidget *sb;
box->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_box_pack_start (GTK_BOX (box), box->scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (box->scrolled_win);
sb = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (box->scrolled_win));
gtk_widget_set_can_focus (sb, FALSE);
}
static void
gimp_container_box_view_iface_init (GimpContainerViewInterface *iface)
{
}
static void
gimp_container_box_docked_iface_init (GimpDockedInterface *iface)
{
iface->get_preview = gimp_container_box_get_preview;
iface->set_context = gimp_container_box_set_context;
}
static void
gimp_container_box_constructed (GObject *object)
{
GimpContainerBox *box = GIMP_CONTAINER_BOX (object);
/* This is evil: the hash table of "insert_data" is created on
* demand when GimpContainerView API is used, using a
* value_free_func that is set in the interface_init functions of
* its implementors. Therefore, no GimpContainerView API must be
* called from any init() function, because the interface_init()
* function of a subclass that sets the right value_free_func might
* not have been called yet, leaving the insert_data hash table
* without memory management.
*
* Call GimpContainerView API from GObject::constructed() instead,
* which runs after everything is set up correctly.
*/
gimp_container_view_set_dnd_widget (GIMP_CONTAINER_VIEW (box),
box->scrolled_win);
G_OBJECT_CLASS (parent_class)->constructed (object);
}
void
gimp_container_box_set_size_request (GimpContainerBox *box,
gint width,
gint height)
{
GimpContainerView *view;
GtkScrolledWindowClass *sw_class;
GtkStyleContext *sw_style;
GtkWidget *sb;
GtkRequisition req;
GtkBorder border;
app/actions/dockable-actions.c app/actions/dockable-commands.[ch] 2006-01-17 Michael Natterer <mitch@gimp.org> * app/actions/dockable-actions.c * app/actions/dockable-commands.[ch] * app/dialogs/dialogs-constructors.[ch] * app/dialogs/dialogs.c * app/display/gimpdisplayshell-layer-select.c * app/widgets/gimpbrusheditor.[ch] * app/widgets/gimpbrushfactoryview.h * app/widgets/gimpbufferview.[ch] * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcomponenteditor.[ch] * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainercombobox.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerentry.[ch] * app/widgets/gimpcontainergridview.[ch] * app/widgets/gimpcontainerpopup.[ch] * app/widgets/gimpcontainertreeview.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdevicestatus.c * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpfontview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemtreeview.[ch] * app/widgets/gimplayertreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimppatternfactoryview.[ch] * app/widgets/gimppropwidgets.[ch] * app/widgets/gimpselectioneditor.[ch] * app/widgets/gimpsessioninfo.[ch] * app/widgets/gimptemplateview.[ch] * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.[ch] * app/widgets/gimpundoeditor.[ch] * app/widgets/gimpviewablebox.c * app/widgets/gimpviewablebutton.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpviewrenderer.c: change the word "preview" to "view" whereever we talk about GimpView or GimpViewRenderer objects or their sizes. Ther were renamed from "Preview" a long time ago and we had a preview/view naming mess ever since.
2006-01-17 18:08:50 +08:00
gint view_size;
gint scrollbar_width;
gint border_x;
gint border_y;
g_return_if_fail (GIMP_IS_CONTAINER_BOX (box));
view = GIMP_CONTAINER_VIEW (box);
app/actions/dockable-actions.c app/actions/dockable-commands.[ch] 2006-01-17 Michael Natterer <mitch@gimp.org> * app/actions/dockable-actions.c * app/actions/dockable-commands.[ch] * app/dialogs/dialogs-constructors.[ch] * app/dialogs/dialogs.c * app/display/gimpdisplayshell-layer-select.c * app/widgets/gimpbrusheditor.[ch] * app/widgets/gimpbrushfactoryview.h * app/widgets/gimpbufferview.[ch] * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcomponenteditor.[ch] * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainercombobox.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerentry.[ch] * app/widgets/gimpcontainergridview.[ch] * app/widgets/gimpcontainerpopup.[ch] * app/widgets/gimpcontainertreeview.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdevicestatus.c * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpfontview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemtreeview.[ch] * app/widgets/gimplayertreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimppatternfactoryview.[ch] * app/widgets/gimppropwidgets.[ch] * app/widgets/gimpselectioneditor.[ch] * app/widgets/gimpsessioninfo.[ch] * app/widgets/gimptemplateview.[ch] * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.[ch] * app/widgets/gimpundoeditor.[ch] * app/widgets/gimpviewablebox.c * app/widgets/gimpviewablebutton.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpviewrenderer.c: change the word "preview" to "view" whereever we talk about GimpView or GimpViewRenderer objects or their sizes. Ther were renamed from "Preview" a long time ago and we had a preview/view naming mess ever since.
2006-01-17 18:08:50 +08:00
view_size = gimp_container_view_get_view_size (view, NULL);
More GimpContainerView chopping: 2004-05-10 Michael Natterer <mitch@gimp.org> More GimpContainerView chopping: * app/widgets/gimpcontainerview.[ch]: added GimpContainerViewPrivate struct (which is currently puclic :-) and removed all members from the GimpContainerView struct. Added accessors for "context", "container" and "preview_size / preview_border_width". Added macro to get the private struct (*not* via G_TYPE_INSTANCE_GET_PRIVATE because that's unavailable for interfaces). * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbufferview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview-dnd.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdocumentview.c * app/widgets/gimpfontview.c * app/widgets/gimpimageview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpsessioninfo.c * app/widgets/gimptemplateview.c * app/widgets/gimptoolview.c * app/actions/brushes-actions.c * app/actions/buffers-actions.c * app/actions/dockable-actions.c * app/actions/dockable-commands.c * app/actions/documents-actions.c * app/actions/fonts-actions.c * app/actions/gradients-actions.c * app/actions/gradients-commands.c * app/actions/images-actions.c * app/actions/palettes-actions.c * app/actions/palettes-commands.c * app/actions/patterns-actions.c * app/actions/templates-actions.c * app/actions/tools-actions.c * app/actions/tools-commands.c: changed accordingly.
2004-05-11 01:16:50 +08:00
app/actions/dockable-actions.c app/actions/dockable-commands.[ch] 2006-01-17 Michael Natterer <mitch@gimp.org> * app/actions/dockable-actions.c * app/actions/dockable-commands.[ch] * app/dialogs/dialogs-constructors.[ch] * app/dialogs/dialogs.c * app/display/gimpdisplayshell-layer-select.c * app/widgets/gimpbrusheditor.[ch] * app/widgets/gimpbrushfactoryview.h * app/widgets/gimpbufferview.[ch] * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcomponenteditor.[ch] * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainercombobox.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerentry.[ch] * app/widgets/gimpcontainergridview.[ch] * app/widgets/gimpcontainerpopup.[ch] * app/widgets/gimpcontainertreeview.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdevicestatus.c * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpfontview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemtreeview.[ch] * app/widgets/gimplayertreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimppatternfactoryview.[ch] * app/widgets/gimppropwidgets.[ch] * app/widgets/gimpselectioneditor.[ch] * app/widgets/gimpsessioninfo.[ch] * app/widgets/gimptemplateview.[ch] * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.[ch] * app/widgets/gimpundoeditor.[ch] * app/widgets/gimpviewablebox.c * app/widgets/gimpviewablebutton.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpviewrenderer.c: change the word "preview" to "view" whereever we talk about GimpView or GimpViewRenderer objects or their sizes. Ther were renamed from "Preview" a long time ago and we had a preview/view naming mess ever since.
2006-01-17 18:08:50 +08:00
g_return_if_fail (width <= 0 || width >= view_size);
g_return_if_fail (height <= 0 || height >= view_size);
sw_class = GTK_SCROLLED_WINDOW_GET_CLASS (box->scrolled_win);
if (sw_class->scrollbar_spacing >= 0)
scrollbar_width = sw_class->scrollbar_spacing;
else
gtk_widget_style_get (GTK_WIDGET (box->scrolled_win),
"scrollbar-spacing", &scrollbar_width,
NULL);
sb = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (box->scrolled_win));
gtk_widget_get_preferred_size (sb, &req, NULL);
scrollbar_width += req.width;
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
2008-06-28 23:50:27 +08:00
border_x = border_y = gtk_container_get_border_width (GTK_CONTAINER (box));
sw_style = gtk_widget_get_style_context (box->scrolled_win);
app/widgets/gimpactionview.c app/widgets/gimpblobeditor.c 2008-06-28 Michael Natterer <mitch@gimp.org> * app/widgets/gimpactionview.c * app/widgets/gimpblobeditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbrushselect.c * app/widgets/gimpcellrendererdashes.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcolorbar.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcolorframe.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcurveview.c * app/widgets/gimpdasheditor.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdock.c * app/widgets/gimpdockable.c * app/widgets/gimpdockseparator.c * app/widgets/gimpfgbgeditor.c * app/widgets/gimpfgbgview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimphandlebar.c * app/widgets/gimphistogrambox.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimpmessagebox.c * app/widgets/gimppaletteview.c * app/widgets/gimpscalebutton.c * app/widgets/gimpsessioninfo-book.c * app/widgets/gimpsessioninfo-dock.c * app/widgets/gimpsettingseditor.c * app/widgets/gimpstrokeeditor.c * app/widgets/gimptemplateeditor.c * app/widgets/gimptemplateview.c * app/widgets/gimpthumbbox.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpuimanager.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderervectors.c * app/widgets/gimpwidgets-utils.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26008
2008-06-28 23:50:27 +08:00
gtk_style_context_get_border (sw_style, 0, &border);
border_x += border.left + border.right + scrollbar_width;
border_y += border.top + border.bottom;
gtk_widget_set_size_request (box->scrolled_win,
width > 0 ? width + border_x : -1,
height > 0 ? height + border_y : -1);
}
static void
gimp_container_box_set_context (GimpDocked *docked,
reoedered to somehow reflect the class hierarchy. 2004-05-23 Michael Natterer <mitch@gimp.org> * app/widgets/widgets-types.h: reoedered to somehow reflect the class hierarchy. Some dockable context handling cleanup: * app/widgets/gimpdocked.[ch]: removed "prev_context" parameter from GimpDocked::set_context(). Widgets which need the old context to disconnect from should remember it themselves. * app/widgets/gimpdockable.c (gimp_dockable_set_context): don't pass the old context to gimp_docked_set_context(). Some cleanup. * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainereditor.c: changed accordingly. * app/display/gimpnavigationview.[ch] * app/widgets/gimpimageeditor.[ch] * app/widgets/gimpitemtreeview.[ch]: added a "context" member which holds the context set by GimpDocked::set_context(). * app/widgets/gimpdrawabletreeview.c: use the view's context instead of gimp_get_user_context(). * app/widgets/gimpcoloreditor.[ch]: removed separate API to set the context because it implements the GimpDockedInterface. * app/widgets/gimpcomponenteditor.c * app/widgets/gimperrorconsole.c: pass "menu-factory", "menu-identifier" and "ui-path" to g_object_new() instead of calling gimp_editor_create_menu() later. Action cleanup partly related to the context stuff above: * app/actions/actions.c (action_data_get_gimp): get the Gimp from context->gimp, not gimage->gimp because gimage may be NULL. (action_data_get_context): changed to use the new context members added above. * app/actions/channels-actions.c (channels_actions_update): cleanup. * app/actions/edit-actions.c (edit_actions_update): fixed sensitivity of "edit-undo-clear". * app/actions/vectors-actions.c (vectors_actions_update): make "vectors-merge-visible" sensitive only if there is more than one GimpVectors in the image. * app/actions/colormap-editor-actions.c * app/actions/gradient-editor-actions.c * app/actions/palette-editor-actions.c: added FG/BG color previews to actions which take colors from them. Changed code to be safe against "context" being NULL. * app/actions/drawable-commands.c: s/active_drawable/drawable/g. Makes the code more readable. * app/actions/select-commands.[ch] * app/actions/vectors-commands.[ch]: removed public stroke utility functions and other stuff which is not needed any more because dialog buttons invoke the correct actions now. Moved the functions' code to the resp. action callbacks.
2004-05-23 18:04:41 +08:00
GimpContext *context)
{
gimp_container_view_set_context (GIMP_CONTAINER_VIEW (docked), context);
}
static GtkWidget *
gimp_container_box_get_preview (GimpDocked *docked,
GimpContext *context,
GtkIconSize size)
{
GimpContainerView *view = GIMP_CONTAINER_VIEW (docked);
More GimpContainerView chopping: 2004-05-10 Michael Natterer <mitch@gimp.org> More GimpContainerView chopping: * app/widgets/gimpcontainerview.[ch]: added GimpContainerViewPrivate struct (which is currently puclic :-) and removed all members from the GimpContainerView struct. Added accessors for "context", "container" and "preview_size / preview_border_width". Added macro to get the private struct (*not* via G_TYPE_INSTANCE_GET_PRIVATE because that's unavailable for interfaces). * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbufferview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview-dnd.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdocumentview.c * app/widgets/gimpfontview.c * app/widgets/gimpimageview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpsessioninfo.c * app/widgets/gimptemplateview.c * app/widgets/gimptoolview.c * app/actions/brushes-actions.c * app/actions/buffers-actions.c * app/actions/dockable-actions.c * app/actions/dockable-commands.c * app/actions/documents-actions.c * app/actions/fonts-actions.c * app/actions/gradients-actions.c * app/actions/gradients-commands.c * app/actions/images-actions.c * app/actions/palettes-actions.c * app/actions/palettes-commands.c * app/actions/patterns-actions.c * app/actions/templates-actions.c * app/actions/tools-actions.c * app/actions/tools-commands.c: changed accordingly.
2004-05-11 01:16:50 +08:00
GimpContainer *container;
GtkWidget *preview;
gint width;
gint height;
gint border_width = 1;
const gchar *prop_name;
More GimpContainerView chopping: 2004-05-10 Michael Natterer <mitch@gimp.org> More GimpContainerView chopping: * app/widgets/gimpcontainerview.[ch]: added GimpContainerViewPrivate struct (which is currently puclic :-) and removed all members from the GimpContainerView struct. Added accessors for "context", "container" and "preview_size / preview_border_width". Added macro to get the private struct (*not* via G_TYPE_INSTANCE_GET_PRIVATE because that's unavailable for interfaces). * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbufferview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview-dnd.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdocumentview.c * app/widgets/gimpfontview.c * app/widgets/gimpimageview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpsessioninfo.c * app/widgets/gimptemplateview.c * app/widgets/gimptoolview.c * app/actions/brushes-actions.c * app/actions/buffers-actions.c * app/actions/dockable-actions.c * app/actions/dockable-commands.c * app/actions/documents-actions.c * app/actions/fonts-actions.c * app/actions/gradients-actions.c * app/actions/gradients-commands.c * app/actions/images-actions.c * app/actions/palettes-actions.c * app/actions/palettes-commands.c * app/actions/patterns-actions.c * app/actions/templates-actions.c * app/actions/tools-actions.c * app/actions/tools-commands.c: changed accordingly.
2004-05-11 01:16:50 +08:00
container = gimp_container_view_get_container (view);
g_return_val_if_fail (container != NULL, NULL);
gtk_icon_size_lookup (size, &width, &height);
prop_name = gimp_context_type_to_prop_name (gimp_container_get_children_type (container));
Changed GimpViewable preview rendering to have a context to get 2006-08-29 Michael Natterer <mitch@gimp.org> Changed GimpViewable preview rendering to have a context to get FG/BG/whatever from. Use the context to enable dynamic FG/BG colors in gradients. Fixes bug #127676 and bug #352214. Addresses bug #128367 (doesn't fix it because there's no loading/saving and no GUI yet). * app/core/core-enums.[ch]: added enum GimpGradientColor to enable specifying gradient colors in terms of foreground and background. * app/core/gimpgradient.[ch]: added color_type members to the GimpGradientSegment struct and honor them in gimp_gradient_get_color_at(). Added GimpContext parameters to all functions which finally call get_color_at(). * app/core/gimp-gradients.c: use the new method to implement the builtin gradients. * app/core/gimpviewable.[ch]: added GimpContext parameters to all get_preview() and get_pixbuf() functions. * app/core/gimpbrush.c * app/core/gimpbuffer.c * app/core/gimpdrawable-preview.[ch] * app/core/gimpgradient.c * app/core/gimpimage-preview.[ch] * app/core/gimpimagefile.c * app/core/gimppalette.c * app/core/gimppattern.c * app/core/gimpundo.[ch] * app/text/gimpfont.c * app/vectors/gimpvectors-preview.[ch]: changed ::get_preview() and ::get_pixbuf() implementations accordingly. * app/core/gimpdrawable-blend.c * app/core/gimppalette-import.[ch] * app/dialogs/dialogs-constructors.c * app/dialogs/palette-import-dialog.c * app/dialogs/resize-dialog.c * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell.c * app/display/gimpnavigationeditor.c * app/paint/gimppaintoptions.c * app/tools/gimpeditselectiontool.c * app/tools/gimptexttool.c * app/actions/gradient-editor-commands.c * app/widgets/gimpaction.c * app/widgets/gimpbrusheditor.[ch] * app/widgets/gimpbufferview.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpclipboard.c * app/widgets/gimpcoloreditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainercombobox.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerentry.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdevicestatus.c * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawabletreeview.c * app/widgets/gimpfiledialog.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpgradientselect.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimppropwidgets.[ch] * app/widgets/gimpselectioneditor.c * app/widgets/gimpthumbbox.[ch] * app/widgets/gimptoolbox-image-area.c * app/widgets/gimptoolbox-indicator-area.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimpundoeditor.c * app/widgets/gimpvectorstreeview.c * app/widgets/gimpview-popup.[ch] * app/widgets/gimpview.[ch] * app/widgets/gimpviewablebutton.c * app/widgets/gimpviewabledialog.c * app/widgets/gimpviewrenderer.[ch] * app/widgets/gimpviewrenderer-frame.c * app/widgets/gimpviewrendererbrush.c * app/widgets/gimpviewrendererbuffer.c * app/widgets/gimpviewrendererdrawable.c * app/widgets/gimpviewrenderergradient.c * app/widgets/gimpviewrendererimage.c * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb: added tons of GimpContext members and parameters, implement GimpDocked::set_context() in many widgets. Pass these locally remembered contexts to GimpViewable functions. Did some minor cleanups on the way. There are still some minor FIXMEs around where the code uses a NULL context (which is allowed by the APIs) * app/pdb/drawable_cmds.c * app/pdb/gradient_cmds.c * app/pdb/gradients_cmds.c * app/pdb/image_cmds.c: regenerated.
2006-08-30 05:44:51 +08:00
preview = gimp_prop_view_new (G_OBJECT (context), prop_name,
context, height);
GIMP_VIEW (preview)->renderer->size = -1;
app/actions/dockable-actions.c app/actions/dockable-commands.[ch] 2006-01-17 Michael Natterer <mitch@gimp.org> * app/actions/dockable-actions.c * app/actions/dockable-commands.[ch] * app/dialogs/dialogs-constructors.[ch] * app/dialogs/dialogs.c * app/display/gimpdisplayshell-layer-select.c * app/widgets/gimpbrusheditor.[ch] * app/widgets/gimpbrushfactoryview.h * app/widgets/gimpbufferview.[ch] * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcomponenteditor.[ch] * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainercombobox.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerentry.[ch] * app/widgets/gimpcontainergridview.[ch] * app/widgets/gimpcontainerpopup.[ch] * app/widgets/gimpcontainertreeview.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdevicestatus.c * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpfontview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemtreeview.[ch] * app/widgets/gimplayertreeview.c * app/widgets/gimpmenudock.c * app/widgets/gimppatternfactoryview.[ch] * app/widgets/gimppropwidgets.[ch] * app/widgets/gimpselectioneditor.[ch] * app/widgets/gimpsessioninfo.[ch] * app/widgets/gimptemplateview.[ch] * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.[ch] * app/widgets/gimpundoeditor.[ch] * app/widgets/gimpviewablebox.c * app/widgets/gimpviewablebutton.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpviewrenderer.c: change the word "preview" to "view" whereever we talk about GimpView or GimpViewRenderer objects or their sizes. Ther were renamed from "Preview" a long time ago and we had a preview/view naming mess ever since.
2006-01-17 18:08:50 +08:00
gimp_container_view_get_view_size (view, &border_width);
border_width = MIN (1, border_width);
app/widgets/gimppreview-popup.c renamed these files... * app/widgets/gimppreview-popup.c * app/widgets/gimppreview-popup.h: renamed these files... * app/widgets/gimpview-popup.c * app/widgets/gimpview-popup.h: .. to these files, and changed the GimpPreviewPopup type to GimpViewPopup. * app/widgets/gimppreviewrenderer.c * app/widgets/gimppreviewrenderer.h: renamed these files... * app/widgets/gimpviewrenderer.c * app/widgets/gimpviewrenderer.h: .. to these files, and changed GimpPreviewRenderer to GimpViewRenderer. This is the second step of the great Preview->View renaming process. * app/display/gimpdisplayshell-layer-select.c * app/display/gimpnavigationeditor.c * app/widgets/Makefile.am * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcellrendererviewable.c * app/widgets/gimpcellrendererviewable.h * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainercombobox.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainerentry.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview-dnd.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpcontainerview.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpnavigationpreview.c * app/widgets/gimppatternfactoryview.c * app/widgets/gimppreviewrenderer-utils.c * app/widgets/gimppreviewrendererbrush.c * app/widgets/gimppreviewrendererbrush.h * app/widgets/gimppreviewrendererdrawable.c * app/widgets/gimppreviewrendererdrawable.h * app/widgets/gimppreviewrenderergradient.c * app/widgets/gimppreviewrenderergradient.h * app/widgets/gimppreviewrendererimage.c * app/widgets/gimppreviewrendererimage.h * app/widgets/gimppreviewrendererimagefile.c * app/widgets/gimppreviewrendererimagefile.h * app/widgets/gimppreviewrendererlayer.c * app/widgets/gimppreviewrenderervectors.c * app/widgets/gimpselectioneditor.c * app/widgets/gimptemplateview.c * app/widgets/gimptooloptionseditor.c * app/widgets/gimptoolview.c * app/widgets/gimpview.c * app/widgets/gimpview.h * app/widgets/gimpviewablebutton.c * app/widgets/widgets-enums.h * app/widgets/widgets-types.h: Modified accordingly.
2004-08-26 06:31:44 +08:00
gimp_view_renderer_set_size_full (GIMP_VIEW (preview)->renderer,
width, height, border_width);
return preview;
}