gimp/app/display/gimpstatusbar.c

1693 lines
52 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program Copyright (C) 1995
* Spencer Kimball and Peter Mattis
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
*
* This program is free software: you can redistribute it and/or modify
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
* (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/>.
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
*/
#include "config.h"
#include <string.h>
#include <gegl.h>
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
#include "display-types.h"
First draft of the "no image open" window, which is implemented as a 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
2008-03-19 05:22:21 +08:00
#include "config/gimpdisplayconfig.h"
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
#include "core/gimpimage.h"
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
#include "core/gimpprogress.h"
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
#include "widgets/gimpuimanager.h"
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
#include "widgets/gimpwidgets-utils.h"
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
#include "gimpdisplay.h"
removed gdisp->scale, gdisp->dot_for_dot, the scaling marcos and the 2002-06-27 Michael Natterer <mitch@gimp.org> * app/display/gimpdisplay.[ch]: removed gdisp->scale, gdisp->dot_for_dot, the scaling marcos and the gdisplay_[un]transform[_f]() functions. * app/display/gimpdisplayshell.[ch]: added them here. Named the transform functions gimp_display_shell_[un]transform_xy[_f](). Made the gimp_display_shell_[un]transform_coords() functions copy all values of the GimpCoords struct, not just x and y. * app/display/gimpstatusbar.[ch]: keep a pointer to GimpDisplayShell, not GimpDisplay. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-render.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-scroll.c * app/display/gimpdisplayshell-selection.c * app/display/gimpnavigationview.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/select-commands.c * app/gui/view-commands.c * app/tools/gimpbezierselecttool.c * app/tools/gimpcroptool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpvectortool.c: changed accordingly. * app/gui/layers-commands.c: if(gimage->selection_mask) is always TRUE, use if(!gimp_image_mask_is_empty(gimage)) instead. * app/tools/gimpfuzzyselecttool.[ch]: moved global variables to the object struct.
2002-06-27 06:16:59 +08:00
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-scale.h"
#include "gimpimagewindow.h"
#include "gimpscalecombobox.h"
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
#include "gimpstatusbar.h"
#include "gimp-intl.h"
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
/* maximal width of the string holding the cursor-coordinates */
#define CURSOR_LEN 256
/* the spacing of the hbox */
#define HBOX_SPACING 1
/* spacing between the icon and the statusbar label */
#define ICON_SPACING 2
/* timeout (in milliseconds) for temporary statusbar messages */
#define MESSAGE_TIMEOUT 8000
/* minimal interval (in microseconds) between progress updates */
#define MIN_PROGRESS_UPDATE_INTERVAL 50000
typedef struct _GimpStatusbarMsg GimpStatusbarMsg;
struct _GimpStatusbarMsg
{
guint context_id;
gchar *icon_name;
gchar *text;
};
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
static void gimp_statusbar_progress_iface_init (GimpProgressInterface *iface);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
static void gimp_statusbar_dispose (GObject *object);
static void gimp_statusbar_finalize (GObject *object);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
static void gimp_statusbar_screen_changed (GtkWidget *widget,
GdkScreen *previous);
static void gimp_statusbar_style_updated (GtkWidget *widget);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
static GimpProgress *
gimp_statusbar_progress_start (GimpProgress *progress,
gboolean cancellable,
const gchar *message);
static void gimp_statusbar_progress_end (GimpProgress *progress);
static gboolean gimp_statusbar_progress_is_active (GimpProgress *progress);
static void gimp_statusbar_progress_set_text (GimpProgress *progress,
const gchar *message);
static void gimp_statusbar_progress_set_value (GimpProgress *progress,
gdouble percentage);
static gdouble gimp_statusbar_progress_get_value (GimpProgress *progress);
static void gimp_statusbar_progress_pulse (GimpProgress *progress);
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
static gboolean gimp_statusbar_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message);
static void gimp_statusbar_progress_canceled (GtkWidget *button,
GimpStatusbar *statusbar);
2010-10-20 02:26:16 +08:00
static gboolean gimp_statusbar_label_draw (GtkWidget *widget,
cairo_t *cr,
GimpStatusbar *statusbar);
static void gimp_statusbar_update (GimpStatusbar *statusbar);
static void gimp_statusbar_unit_changed (GimpUnitComboBox *combo,
GimpStatusbar *statusbar);
static void gimp_statusbar_scale_changed (GimpScaleComboBox *combo,
GimpStatusbar *statusbar);
static void gimp_statusbar_scale_activated (GimpScaleComboBox *combo,
GimpStatusbar *statusbar);
static gboolean gimp_statusbar_rotate_pressed (GtkWidget *event_box,
GdkEvent *event,
GimpStatusbar *statusbar);
static gboolean gimp_statusbar_horiz_flip_pressed (GtkWidget *event_box,
GdkEvent *event,
GimpStatusbar *statusbar);
static gboolean gimp_statusbar_vert_flip_pressed (GtkWidget *event_box,
GdkEvent *event,
GimpStatusbar *statusbar);
static void gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
GimpStatusbar *statusbar);
static void gimp_statusbar_shell_rotated (GimpDisplayShell *shell,
GimpStatusbar *statusbar);
static void gimp_statusbar_shell_status_notify(GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpStatusbar *statusbar);
static guint gimp_statusbar_get_context_id (GimpStatusbar *statusbar,
const gchar *context);
static gboolean gimp_statusbar_temp_timeout (GimpStatusbar *statusbar);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
static void gimp_statusbar_add_message (GimpStatusbar *statusbar,
guint context_id,
const gchar *icon_name,
const gchar *format,
va_list args,
gboolean move_to_front) G_GNUC_PRINTF (4, 0);
static void gimp_statusbar_remove_message (GimpStatusbar *statusbar,
guint context_id);
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
static void gimp_statusbar_msg_free (GimpStatusbarMsg *msg);
static gchar * gimp_statusbar_vprintf (const gchar *format,
va_list args) G_GNUC_PRINTF (1, 0);
static GdkPixbuf * gimp_statusbar_load_icon (GimpStatusbar *statusbar,
const gchar *icon_name);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
G_DEFINE_TYPE_WITH_CODE (GimpStatusbar, gimp_statusbar, GTK_TYPE_FRAME,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
gimp_statusbar_progress_iface_init))
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
#define parent_class gimp_statusbar_parent_class
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
static void
gimp_statusbar_class_init (GimpStatusbarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->dispose = gimp_statusbar_dispose;
object_class->finalize = gimp_statusbar_finalize;
widget_class->screen_changed = gimp_statusbar_screen_changed;
widget_class->style_updated = gimp_statusbar_style_updated;
gtk_widget_class_set_css_name (widget_class, "statusbar");
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
static void
gimp_statusbar_progress_iface_init (GimpProgressInterface *iface)
{
iface->start = gimp_statusbar_progress_start;
iface->end = gimp_statusbar_progress_end;
iface->is_active = gimp_statusbar_progress_is_active;
iface->set_text = gimp_statusbar_progress_set_text;
iface->set_value = gimp_statusbar_progress_set_value;
iface->get_value = gimp_statusbar_progress_get_value;
iface->pulse = gimp_statusbar_progress_pulse;
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
iface->message = gimp_statusbar_progress_message;
}
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
static void
gimp_statusbar_init (GimpStatusbar *statusbar)
{
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *image;
GtkWidget *label;
GimpUnitStore *store;
gtk_frame_set_shadow_type (GTK_FRAME (statusbar), GTK_SHADOW_IN);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, HBOX_SPACING);
gtk_container_add (GTK_CONTAINER (statusbar), hbox);
gtk_widget_show (hbox);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
statusbar->shell = NULL;
statusbar->messages = NULL;
statusbar->context_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
statusbar->seq_context_id = 1;
statusbar->temp_context_id =
gimp_statusbar_get_context_id (statusbar, "gimp-statusbar-temp");
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
statusbar->cursor_format_str[0] = '\0';
statusbar->cursor_format_str_f[0] = '\0';
statusbar->length_format_str[0] = '\0';
statusbar->progress_active = FALSE;
statusbar->progress_shown = FALSE;
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
statusbar->cursor_label = gtk_label_new ("8888, 8888");
gtk_box_pack_start (GTK_BOX (hbox), statusbar->cursor_label,
FALSE, FALSE, 0);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
gtk_widget_show (statusbar->cursor_label);
store = gimp_unit_store_new (2);
statusbar->unit_combo = gimp_unit_combo_box_new_with_model (store);
g_object_unref (store);
gtk_combo_box_set_wrap_width (GTK_COMBO_BOX (statusbar->unit_combo), 1);
gtk_widget_set_can_focus (statusbar->unit_combo, FALSE);
g_object_set (statusbar->unit_combo, "focus-on-click", FALSE, NULL);
gtk_box_pack_start (GTK_BOX (hbox), statusbar->unit_combo,
FALSE, FALSE, 0);
gtk_widget_show (statusbar->unit_combo);
g_signal_connect (statusbar->unit_combo, "changed",
G_CALLBACK (gimp_statusbar_unit_changed),
statusbar);
statusbar->scale_combo = gimp_scale_combo_box_new ();
gtk_widget_set_can_focus (statusbar->scale_combo, FALSE);
g_object_set (statusbar->scale_combo, "focus-on-click", FALSE, NULL);
gtk_box_pack_start (GTK_BOX (hbox), statusbar->scale_combo,
FALSE, FALSE, 0);
gtk_widget_show (statusbar->scale_combo);
g_signal_connect (statusbar->scale_combo, "changed",
G_CALLBACK (gimp_statusbar_scale_changed),
statusbar);
g_signal_connect (statusbar->scale_combo, "entry-activated",
G_CALLBACK (gimp_statusbar_scale_activated),
statusbar);
/* Shell transform status */
statusbar->rotate_widget = gtk_event_box_new ();
gtk_box_pack_start (GTK_BOX (hbox), statusbar->rotate_widget,
FALSE, FALSE, 1);
gtk_widget_show (statusbar->rotate_widget);
statusbar->rotate_label = gtk_label_new (NULL);
gtk_container_add (GTK_CONTAINER (statusbar->rotate_widget),
statusbar->rotate_label);
gtk_widget_show (statusbar->rotate_label);
g_signal_connect (statusbar->rotate_widget, "button-press-event",
G_CALLBACK (gimp_statusbar_rotate_pressed),
statusbar);
statusbar->horizontal_flip_icon = gtk_event_box_new ();
gtk_box_pack_start (GTK_BOX (hbox), statusbar->horizontal_flip_icon,
FALSE, FALSE, 1);
gtk_widget_show (statusbar->horizontal_flip_icon);
image = gtk_image_new_from_icon_name ("object-flip-horizontal",
GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (statusbar->horizontal_flip_icon), image);
gtk_widget_show (image);
g_signal_connect (statusbar->horizontal_flip_icon, "button-press-event",
G_CALLBACK (gimp_statusbar_horiz_flip_pressed),
statusbar);
statusbar->vertical_flip_icon = gtk_event_box_new ();
gtk_box_pack_start (GTK_BOX (hbox), statusbar->vertical_flip_icon,
FALSE, FALSE, 1);
gtk_widget_show (statusbar->vertical_flip_icon);
image = gtk_image_new_from_icon_name ("object-flip-vertical",
GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (statusbar->vertical_flip_icon), image);
gtk_widget_show (image);
g_signal_connect (statusbar->vertical_flip_icon, "button-press-event",
G_CALLBACK (gimp_statusbar_vert_flip_pressed),
statusbar);
statusbar->label = gtk_label_new ("");
gtk_label_set_ellipsize (GTK_LABEL (statusbar->label), PANGO_ELLIPSIZE_END);
gtk_widget_set_halign (GTK_WIDGET (statusbar->label), GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), statusbar->label, TRUE, TRUE, 1);
gtk_widget_show (statusbar->label);
2010-10-20 02:26:16 +08:00
g_signal_connect_after (statusbar->label, "draw",
G_CALLBACK (gimp_statusbar_label_draw),
statusbar);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
statusbar->progressbar = g_object_new (GTK_TYPE_PROGRESS_BAR,
"show-text", TRUE,
"ellipsize", PANGO_ELLIPSIZE_END,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), statusbar->progressbar,
TRUE, TRUE, 0);
/* don't show the progress bar */
/* construct the cancel button's contents manually because we
* always want image and label regardless of settings, and we want
* a menu size image.
*/
statusbar->cancel_button = gtk_button_new ();
gtk_widget_set_can_focus (statusbar->cancel_button, FALSE);
gtk_button_set_relief (GTK_BUTTON (statusbar->cancel_button),
GTK_RELIEF_NONE);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
gtk_widget_set_sensitive (statusbar->cancel_button, FALSE);
gtk_box_pack_end (GTK_BOX (hbox), statusbar->cancel_button,
FALSE, FALSE, 0);
/* don't show the cancel button */
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (statusbar->cancel_button), hbox2);
gtk_widget_show (hbox2);
image = gtk_image_new_from_icon_name ("gtk-cancel", GTK_ICON_SIZE_MENU);
gtk_box_pack_start (GTK_BOX (hbox2), image, FALSE, FALSE, 2);
gtk_widget_show (image);
label = gtk_label_new ("Cancel");
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 2);
gtk_widget_show (label);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
g_signal_connect (statusbar->cancel_button, "clicked",
G_CALLBACK (gimp_statusbar_progress_canceled),
statusbar);
}
static void
gimp_statusbar_dispose (GObject *object)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (object);
if (statusbar->temp_timeout_id)
{
g_source_remove (statusbar->temp_timeout_id);
statusbar->temp_timeout_id = 0;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
static void
gimp_statusbar_finalize (GObject *object)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (object);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
g_clear_object (&statusbar->icon);
g_clear_pointer (&statusbar->icon_hash, g_hash_table_unref);
g_slist_free_full (statusbar->messages,
(GDestroyNotify) gimp_statusbar_msg_free);
statusbar->messages = NULL;
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
g_clear_pointer (&statusbar->context_ids, g_hash_table_destroy);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_statusbar_screen_changed (GtkWidget *widget,
GdkScreen *previous)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (widget);
if (GTK_WIDGET_CLASS (parent_class)->screen_changed)
GTK_WIDGET_CLASS (parent_class)->screen_changed (widget, previous);
g_clear_pointer (&statusbar->icon_hash, g_hash_table_unref);
}
static void
gimp_statusbar_style_updated (GtkWidget *widget)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (widget);
g_clear_pointer (&statusbar->icon_hash, g_hash_table_unref);
GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
}
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
static GimpProgress *
gimp_statusbar_progress_start (GimpProgress *progress,
gboolean cancellable,
const gchar *message)
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
if (! statusbar->progress_active)
{
GtkWidget *bar = statusbar->progressbar;
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
statusbar->progress_active = TRUE;
statusbar->progress_value = 0.0;
statusbar->progress_last_update_time = g_get_monotonic_time ();
gimp_statusbar_push (statusbar, "progress", NULL, "%s", message);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), 0.0);
gtk_widget_set_sensitive (statusbar->cancel_button, cancellable);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
if (cancellable)
{
if (message)
{
gchar *tooltip = g_strdup_printf (_("Cancel <i>%s</i>"), message);
gimp_help_set_help_data_with_markup (statusbar->cancel_button,
tooltip, NULL);
g_free (tooltip);
}
gtk_widget_show (statusbar->cancel_button);
}
gtk_widget_show (statusbar->progressbar);
gtk_widget_hide (statusbar->label);
if (! gtk_widget_get_visible (GTK_WIDGET (statusbar)))
{
gtk_widget_show (GTK_WIDGET (statusbar));
statusbar->progress_shown = TRUE;
}
#if 0
/* FIXME flush_expose */
gimp_widget_flush_expose (bar);
#endif
gimp_statusbar_override_window_title (statusbar);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
return progress;
}
return NULL;
}
static void
gimp_statusbar_progress_end (GimpProgress *progress)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
if (statusbar->progress_active)
{
GtkWidget *bar = statusbar->progressbar;
if (statusbar->progress_shown)
{
gtk_widget_hide (GTK_WIDGET (statusbar));
statusbar->progress_shown = FALSE;
}
statusbar->progress_active = FALSE;
statusbar->progress_value = 0.0;
gtk_widget_hide (bar);
gtk_widget_show (statusbar->label);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
gimp_statusbar_pop (statusbar, "progress");
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), 0.0);
gtk_widget_set_sensitive (statusbar->cancel_button, FALSE);
gtk_widget_hide (statusbar->cancel_button);
gimp_statusbar_restore_window_title (statusbar);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
}
}
static gboolean
gimp_statusbar_progress_is_active (GimpProgress *progress)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
return statusbar->progress_active;
}
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
static void
gimp_statusbar_progress_set_text (GimpProgress *progress,
const gchar *message)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
if (statusbar->progress_active)
{
gimp_statusbar_replace (statusbar, "progress", NULL, "%s", message);
#if 0
/* FIXME flush_expose */
gimp_widget_flush_expose (bar);
#endif
gimp_statusbar_override_window_title (statusbar);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
}
}
static void
gimp_statusbar_progress_set_value (GimpProgress *progress,
gdouble percentage)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
if (statusbar->progress_active)
{
guint64 time = g_get_monotonic_time ();
if (time - statusbar->progress_last_update_time >=
MIN_PROGRESS_UPDATE_INTERVAL)
{
GtkWidget *bar = statusbar->progressbar;
GtkAllocation allocation;
gdouble diff;
gtk_widget_get_allocation (bar, &allocation);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
statusbar->progress_value = percentage;
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
diff = fabs (percentage -
gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (bar)));
/* only update the progress bar if this causes a visible change */
if (allocation.width * diff >= 1.0)
{
statusbar->progress_last_update_time = time;
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar),
percentage);
#if 0
/* FIXME flush_expose */
gimp_widget_flush_expose (bar);
#endif
}
}
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
}
}
static gdouble
gimp_statusbar_progress_get_value (GimpProgress *progress)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
if (statusbar->progress_active)
return statusbar->progress_value;
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
return 0.0;
}
static void
gimp_statusbar_progress_pulse (GimpProgress *progress)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
if (statusbar->progress_active)
{
guint64 time = g_get_monotonic_time ();
if (time - statusbar->progress_last_update_time >=
MIN_PROGRESS_UPDATE_INTERVAL)
{
GtkWidget *bar = statusbar->progressbar;
statusbar->progress_last_update_time = time;
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar));
#if 0
/* FIXME flush_expose */
gimp_widget_flush_expose (bar);
#endif
}
}
}
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
static gboolean
gimp_statusbar_progress_message (GimpProgress *progress,
Gimp *gimp,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
PangoLayout *layout;
const gchar *icon_name;
gboolean handle_msg = FALSE;
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
/* don't accept a message if we are already displaying a more severe one */
if (statusbar->temp_timeout_id && statusbar->temp_severity > severity)
return FALSE;
/* we can only handle short one-liners */
layout = gtk_widget_create_pango_layout (statusbar->label, message);
icon_name = gimp_get_message_icon_name (severity);
if (pango_layout_get_line_count (layout) == 1)
{
GtkAllocation label_allocation;
gint width;
gtk_widget_get_allocation (statusbar->label, &label_allocation);
pango_layout_get_pixel_size (layout, &width, NULL);
if (width < label_allocation.width)
{
if (icon_name)
{
GdkPixbuf *pixbuf;
pixbuf = gimp_statusbar_load_icon (statusbar, icon_name);
width += ICON_SPACING + gdk_pixbuf_get_width (pixbuf);
g_object_unref (pixbuf);
handle_msg = (width < label_allocation.width);
}
else
{
handle_msg = TRUE;
}
}
}
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
g_object_unref (layout);
if (handle_msg)
gimp_statusbar_push_temp (statusbar, severity, icon_name, "%s", message);
return handle_msg;
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
}
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
static void
gimp_statusbar_progress_canceled (GtkWidget *button,
GimpStatusbar *statusbar)
{
if (statusbar->progress_active)
gimp_progress_cancel (GIMP_PROGRESS (statusbar));
}
static void
gimp_statusbar_set_text (GimpStatusbar *statusbar,
const gchar *icon_name,
const gchar *text)
{
if (statusbar->progress_active)
{
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (statusbar->progressbar),
text);
}
else
{
g_clear_object (&statusbar->icon);
if (icon_name)
statusbar->icon = gimp_statusbar_load_icon (statusbar, icon_name);
if (statusbar->icon)
{
PangoAttrList *attrs;
PangoAttribute *attr;
PangoRectangle rect;
gchar *tmp;
tmp = g_strconcat (" ", text, NULL);
gtk_label_set_text (GTK_LABEL (statusbar->label), tmp);
g_free (tmp);
rect.x = 0;
rect.y = 0;
rect.width = PANGO_SCALE * (gdk_pixbuf_get_width (statusbar->icon) +
ICON_SPACING);
rect.height = 0;
attrs = pango_attr_list_new ();
attr = pango_attr_shape_new (&rect, &rect);
attr->start_index = 0;
attr->end_index = 1;
pango_attr_list_insert (attrs, attr);
gtk_label_set_attributes (GTK_LABEL (statusbar->label), attrs);
pango_attr_list_unref (attrs);
}
else
{
gtk_label_set_text (GTK_LABEL (statusbar->label), text);
gtk_label_set_attributes (GTK_LABEL (statusbar->label), NULL);
}
}
}
static void
gimp_statusbar_update (GimpStatusbar *statusbar)
{
GimpStatusbarMsg *msg = NULL;
if (statusbar->messages)
msg = statusbar->messages->data;
if (msg && msg->text)
{
gimp_statusbar_set_text (statusbar, msg->icon_name, msg->text);
}
else
{
gimp_statusbar_set_text (statusbar, NULL, "");
}
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
/* public functions */
GtkWidget *
gimp_statusbar_new (void)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
return g_object_new (GIMP_TYPE_STATUSBAR, NULL);
}
void
gimp_statusbar_set_shell (GimpStatusbar *statusbar,
GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (shell == statusbar->shell)
return;
if (statusbar->shell)
{
g_signal_handlers_disconnect_by_func (statusbar->shell,
gimp_statusbar_shell_scaled,
statusbar);
g_signal_handlers_disconnect_by_func (statusbar->shell,
gimp_statusbar_shell_rotated,
statusbar);
g_signal_handlers_disconnect_by_func (statusbar->shell,
gimp_statusbar_shell_status_notify,
statusbar);
}
removed gdisp->scale, gdisp->dot_for_dot, the scaling marcos and the 2002-06-27 Michael Natterer <mitch@gimp.org> * app/display/gimpdisplay.[ch]: removed gdisp->scale, gdisp->dot_for_dot, the scaling marcos and the gdisplay_[un]transform[_f]() functions. * app/display/gimpdisplayshell.[ch]: added them here. Named the transform functions gimp_display_shell_[un]transform_xy[_f](). Made the gimp_display_shell_[un]transform_coords() functions copy all values of the GimpCoords struct, not just x and y. * app/display/gimpstatusbar.[ch]: keep a pointer to GimpDisplayShell, not GimpDisplay. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-render.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-scroll.c * app/display/gimpdisplayshell-selection.c * app/display/gimpnavigationview.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/select-commands.c * app/gui/view-commands.c * app/tools/gimpbezierselecttool.c * app/tools/gimpcroptool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpvectortool.c: changed accordingly. * app/gui/layers-commands.c: if(gimage->selection_mask) is always TRUE, use if(!gimp_image_mask_is_empty(gimage)) instead. * app/tools/gimpfuzzyselecttool.[ch]: moved global variables to the object struct.
2002-06-27 06:16:59 +08:00
statusbar->shell = shell;
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
g_signal_connect_object (statusbar->shell, "scaled",
G_CALLBACK (gimp_statusbar_shell_scaled),
statusbar, 0);
g_signal_connect_object (statusbar->shell, "rotated",
G_CALLBACK (gimp_statusbar_shell_rotated),
statusbar, 0);
g_signal_connect_object (statusbar->shell, "notify::status",
G_CALLBACK (gimp_statusbar_shell_status_notify),
statusbar, 0);
gimp_statusbar_shell_rotated (shell, statusbar);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
gboolean
gimp_statusbar_get_visible (GimpStatusbar *statusbar)
{
g_return_val_if_fail (GIMP_IS_STATUSBAR (statusbar), FALSE);
if (statusbar->progress_shown)
return FALSE;
return gtk_widget_get_visible (GTK_WIDGET (statusbar));
}
void
gimp_statusbar_set_visible (GimpStatusbar *statusbar,
gboolean visible)
{
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
if (statusbar->progress_shown)
{
if (visible)
{
statusbar->progress_shown = FALSE;
return;
}
}
gtk_widget_set_visible (GTK_WIDGET (statusbar), visible);
}
void
gimp_statusbar_empty (GimpStatusbar *statusbar)
{
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
gtk_widget_hide (statusbar->cursor_label);
gtk_widget_hide (statusbar->unit_combo);
gtk_widget_hide (statusbar->scale_combo);
gtk_widget_hide (statusbar->rotate_widget);
gtk_widget_hide (statusbar->horizontal_flip_icon);
gtk_widget_hide (statusbar->vertical_flip_icon);
}
void
gimp_statusbar_fill (GimpStatusbar *statusbar)
{
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
gtk_widget_show (statusbar->cursor_label);
gtk_widget_show (statusbar->unit_combo);
gtk_widget_show (statusbar->scale_combo);
gtk_widget_show (statusbar->rotate_widget);
gimp_statusbar_shell_rotated (statusbar->shell, statusbar);
}
void
gimp_statusbar_override_window_title (GimpStatusbar *statusbar)
{
GtkWidget *toplevel;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (statusbar));
if (gimp_image_window_is_iconified (GIMP_IMAGE_WINDOW (toplevel)))
{
const gchar *message = gimp_statusbar_peek (statusbar, "progress");
if (message)
gtk_window_set_title (GTK_WINDOW (toplevel), message);
}
}
void
gimp_statusbar_restore_window_title (GimpStatusbar *statusbar)
{
GtkWidget *toplevel;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (statusbar));
if (gimp_image_window_is_iconified (GIMP_IMAGE_WINDOW (toplevel)))
{
g_object_notify (G_OBJECT (statusbar->shell), "title");
}
}
void
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
gimp_statusbar_push (GimpStatusbar *statusbar,
const gchar *context,
const gchar *icon_name,
const gchar *format,
...)
{
va_list args;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (context != NULL);
g_return_if_fail (format != NULL);
va_start (args, format);
gimp_statusbar_push_valist (statusbar, context, icon_name, format, args);
va_end (args);
}
void
gimp_statusbar_push_valist (GimpStatusbar *statusbar,
const gchar *context,
const gchar *icon_name,
const gchar *format,
va_list args)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
guint context_id;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (context != NULL);
g_return_if_fail (format != NULL);
context_id = gimp_statusbar_get_context_id (statusbar, context);
gimp_statusbar_add_message (statusbar,
context_id,
icon_name, format, args,
/* move_to_front = */ TRUE);
}
void
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
gimp_statusbar_push_coords (GimpStatusbar *statusbar,
const gchar *context,
const gchar *icon_name,
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
GimpCursorPrecision precision,
const gchar *title,
gdouble x,
const gchar *separator,
gdouble y,
const gchar *help)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
GimpDisplayShell *shell;
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (title != NULL);
g_return_if_fail (separator != NULL);
if (help == NULL)
help = "";
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
shell = statusbar->shell;
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
switch (precision)
{
case GIMP_CURSOR_PRECISION_PIXEL_CENTER:
x = (gint) x;
y = (gint) y;
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
break;
case GIMP_CURSOR_PRECISION_PIXEL_BORDER:
x = RINT (x);
y = RINT (y);
break;
case GIMP_CURSOR_PRECISION_SUBPIXEL:
break;
}
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
if (shell->unit == GIMP_UNIT_PIXEL)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
if (precision == GIMP_CURSOR_PRECISION_SUBPIXEL)
{
gimp_statusbar_push (statusbar, context,
icon_name,
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
statusbar->cursor_format_str_f,
title,
x,
separator,
y,
help);
}
else
{
gimp_statusbar_push (statusbar, context,
icon_name,
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
statusbar->cursor_format_str,
title,
(gint) RINT (x),
separator,
(gint) RINT (y),
help);
}
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
else /* show real world units */
{
First draft of the "no image open" window, which is implemented as a 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
2008-03-19 05:22:21 +08:00
gdouble xres;
gdouble yres;
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
gimp_image_get_resolution (gimp_display_get_image (shell->display),
&xres, &yres);
gimp_statusbar_push (statusbar, context,
icon_name,
statusbar->cursor_format_str,
title,
gimp_pixels_to_units (x, shell->unit, xres),
separator,
gimp_pixels_to_units (y, shell->unit, yres),
help);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
}
void
gimp_statusbar_push_length (GimpStatusbar *statusbar,
const gchar *context,
const gchar *icon_name,
const gchar *title,
GimpOrientationType axis,
gdouble value,
const gchar *help)
{
GimpDisplayShell *shell;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (title != NULL);
if (help == NULL)
help = "";
shell = statusbar->shell;
if (shell->unit == GIMP_UNIT_PIXEL)
{
gimp_statusbar_push (statusbar, context,
icon_name,
statusbar->length_format_str,
title,
(gint) RINT (value),
help);
}
else /* show real world units */
{
First draft of the "no image open" window, which is implemented as a 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
2008-03-19 05:22:21 +08:00
gdouble xres;
gdouble yres;
gdouble resolution;
gimp_image_get_resolution (gimp_display_get_image (shell->display),
&xres, &yres);
switch (axis)
{
case GIMP_ORIENTATION_HORIZONTAL:
resolution = xres;
break;
case GIMP_ORIENTATION_VERTICAL:
resolution = yres;
break;
default:
g_return_if_reached ();
break;
}
gimp_statusbar_push (statusbar, context,
icon_name,
statusbar->length_format_str,
title,
gimp_pixels_to_units (value, shell->unit, resolution),
help);
}
}
void
gimp_statusbar_replace (GimpStatusbar *statusbar,
const gchar *context,
const gchar *icon_name,
const gchar *format,
...)
{
va_list args;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (context != NULL);
g_return_if_fail (format != NULL);
va_start (args, format);
gimp_statusbar_replace_valist (statusbar, context, icon_name, format, args);
va_end (args);
}
void
gimp_statusbar_replace_valist (GimpStatusbar *statusbar,
const gchar *context,
const gchar *icon_name,
const gchar *format,
va_list args)
{
guint context_id;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (context != NULL);
g_return_if_fail (format != NULL);
context_id = gimp_statusbar_get_context_id (statusbar, context);
gimp_statusbar_add_message (statusbar,
context_id,
icon_name, format, args,
/* move_to_front = */ FALSE);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
const gchar *
gimp_statusbar_peek (GimpStatusbar *statusbar,
const gchar *context)
{
GSList *list;
guint context_id;
g_return_val_if_fail (GIMP_IS_STATUSBAR (statusbar), NULL);
g_return_val_if_fail (context != NULL, NULL);
context_id = gimp_statusbar_get_context_id (statusbar, context);
for (list = statusbar->messages; list; list = list->next)
{
GimpStatusbarMsg *msg = list->data;
if (msg->context_id == context_id)
{
return msg->text;
}
}
return NULL;
}
void
gimp_statusbar_pop (GimpStatusbar *statusbar,
const gchar *context)
{
guint context_id;
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (context != NULL);
context_id = gimp_statusbar_get_context_id (statusbar, context);
gimp_statusbar_remove_message (statusbar,
context_id);
}
void
gimp_statusbar_push_temp (GimpStatusbar *statusbar,
GimpMessageSeverity severity,
const gchar *icon_name,
const gchar *format,
...)
{
va_list args;
va_start (args, format);
gimp_statusbar_push_temp_valist (statusbar, severity, icon_name, format, args);
va_end (args);
}
void
gimp_statusbar_push_temp_valist (GimpStatusbar *statusbar,
GimpMessageSeverity severity,
const gchar *icon_name,
const gchar *format,
va_list args)
{
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
g_return_if_fail (severity <= GIMP_MESSAGE_WARNING);
g_return_if_fail (format != NULL);
/* don't accept a message if we are already displaying a more severe one */
if (statusbar->temp_timeout_id && statusbar->temp_severity > severity)
return;
if (statusbar->temp_timeout_id)
g_source_remove (statusbar->temp_timeout_id);
statusbar->temp_timeout_id =
g_timeout_add (MESSAGE_TIMEOUT,
(GSourceFunc) gimp_statusbar_temp_timeout, statusbar);
statusbar->temp_severity = severity;
gimp_statusbar_add_message (statusbar,
statusbar->temp_context_id,
icon_name, format, args,
/* move_to_front = */ TRUE);
if (severity >= GIMP_MESSAGE_WARNING)
gimp_widget_blink (statusbar->label);
}
void
gimp_statusbar_pop_temp (GimpStatusbar *statusbar)
{
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
if (statusbar->temp_timeout_id)
{
g_source_remove (statusbar->temp_timeout_id);
statusbar->temp_timeout_id = 0;
gimp_statusbar_remove_message (statusbar,
statusbar->temp_context_id);
}
}
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
void
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
GimpCursorPrecision precision,
gdouble x,
gdouble y)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
GimpDisplayShell *shell;
GimpImage *image;
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
gchar buffer[CURSOR_LEN];
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
shell = statusbar->shell;
image = gimp_display_get_image (shell->display);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
if (! image ||
x < 0 ||
y < 0 ||
x >= gimp_image_get_width (image) ||
y >= gimp_image_get_height (image))
{
gtk_widget_set_sensitive (statusbar->cursor_label, FALSE);
}
else
{
gtk_widget_set_sensitive (statusbar->cursor_label, TRUE);
}
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
switch (precision)
{
case GIMP_CURSOR_PRECISION_PIXEL_CENTER:
x = (gint) x;
y = (gint) y;
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
break;
case GIMP_CURSOR_PRECISION_PIXEL_BORDER:
x = RINT (x);
y = RINT (y);
break;
case GIMP_CURSOR_PRECISION_SUBPIXEL:
break;
}
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
if (shell->unit == GIMP_UNIT_PIXEL)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
if (precision == GIMP_CURSOR_PRECISION_SUBPIXEL)
{
g_snprintf (buffer, sizeof (buffer),
statusbar->cursor_format_str_f,
"", x, ", ", y, "");
}
else
{
g_snprintf (buffer, sizeof (buffer),
statusbar->cursor_format_str,
"", (gint) RINT (x), ", ", (gint) RINT (y), "");
}
}
else /* show real world units */
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
GtkTreeModel *model;
GimpUnitStore *store;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (statusbar->unit_combo));
store = GIMP_UNIT_STORE (model);
gimp_unit_store_set_pixel_values (store, x, y);
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
gimp_unit_store_get_values (store, shell->unit, &x, &y);
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
g_snprintf (buffer, sizeof (buffer),
statusbar->cursor_format_str,
"", x, ", ", y, "");
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), buffer);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
void
gimp_statusbar_clear_cursor (GimpStatusbar *statusbar)
{
gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), "");
gtk_widget_set_sensitive (statusbar->cursor_label, TRUE);
}
/* private functions */
static gboolean
2010-10-20 02:26:16 +08:00
gimp_statusbar_label_draw (GtkWidget *widget,
cairo_t *cr,
GimpStatusbar *statusbar)
{
if (statusbar->icon)
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
{
PangoRectangle rect;
GtkAllocation allocation;
gint x, y;
gtk_label_get_layout_offsets (GTK_LABEL (widget), &x, &y);
gtk_widget_get_allocation (widget, &allocation);
x -= allocation.x;
y -= allocation.y;
pango_layout_index_to_pos (gtk_label_get_layout (GTK_LABEL (widget)), 0,
&rect);
/* the rectangle width is negative when rendering right-to-left */
x += PANGO_PIXELS (rect.x) + (rect.width < 0 ?
PANGO_PIXELS (rect.width) : 0);
y += PANGO_PIXELS (rect.y);
gdk_cairo_set_source_pixbuf (cr, statusbar->icon, x, y);
cairo_paint (cr);
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
}
return FALSE;
}
static void
gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
GimpStatusbar *statusbar)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
static PangoLayout *layout = NULL;
GimpImage *image = gimp_display_get_image (shell->display);
GtkTreeModel *model;
const gchar *text;
First draft of the "no image open" window, which is implemented as a 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
2008-03-19 05:22:21 +08:00
gint image_width;
gint image_height;
gdouble image_xres;
gdouble image_yres;
gint width;
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
First draft of the "no image open" window, which is implemented as a 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
2008-03-19 05:22:21 +08:00
if (image)
{
image_width = gimp_image_get_width (image);
image_height = gimp_image_get_height (image);
gimp_image_get_resolution (image, &image_xres, &image_yres);
}
else
{
image_width = shell->disp_width;
image_height = shell->disp_height;
image_xres = shell->display->config->monitor_xres;
image_yres = shell->display->config->monitor_yres;
}
g_signal_handlers_block_by_func (statusbar->scale_combo,
gimp_statusbar_scale_changed, statusbar);
gimp_scale_combo_box_set_scale (GIMP_SCALE_COMBO_BOX (statusbar->scale_combo),
gimp_zoom_model_get_factor (shell->zoom));
g_signal_handlers_unblock_by_func (statusbar->scale_combo,
gimp_statusbar_scale_changed, statusbar);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
model = gtk_combo_box_get_model (GTK_COMBO_BOX (statusbar->unit_combo));
First draft of the "no image open" window, which is implemented as a 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
2008-03-19 05:22:21 +08:00
gimp_unit_store_set_resolutions (GIMP_UNIT_STORE (model),
image_xres, image_yres);
g_signal_handlers_block_by_func (statusbar->unit_combo,
gimp_statusbar_unit_changed, statusbar);
gimp_unit_combo_box_set_active (GIMP_UNIT_COMBO_BOX (statusbar->unit_combo),
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
shell->unit);
g_signal_handlers_unblock_by_func (statusbar->unit_combo,
gimp_statusbar_unit_changed, statusbar);
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
if (shell->unit == GIMP_UNIT_PIXEL)
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
{
g_snprintf (statusbar->cursor_format_str,
sizeof (statusbar->cursor_format_str),
"%%s%%d%%s%%d%%s");
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
g_snprintf (statusbar->cursor_format_str_f,
sizeof (statusbar->cursor_format_str_f),
"%%s%%.1f%%s%%.1f%%s");
g_snprintf (statusbar->length_format_str,
sizeof (statusbar->length_format_str),
"%%s%%d%%s");
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
else /* show real world units */
{
gint w_digits;
gint h_digits;
w_digits = gimp_unit_get_scaled_digits (shell->unit, image_xres);
h_digits = gimp_unit_get_scaled_digits (shell->unit, image_yres);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
g_snprintf (statusbar->cursor_format_str,
sizeof (statusbar->cursor_format_str),
"%%s%%.%df%%s%%.%df%%s",
w_digits, h_digits);
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
strcpy (statusbar->cursor_format_str_f, statusbar->cursor_format_str);
g_snprintf (statusbar->length_format_str,
sizeof (statusbar->length_format_str),
"%%s%%.%df%%s", MAX (w_digits, h_digits));
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
Bug 496772 – Position shown in the statusbar needs more precision (for 2008-08-20 Michael Natterer <mitch@gimp.org> Bug 496772 – Position shown in the statusbar needs more precision (for some tools) * app/display/display-enums.[ch]: add enum GimpCursorPrecision which can be one of { PIXEL_CENTER, PIXEL_BORDER, SUBPIXEL }. * app/display/gimpdisplayshell-cursor.[ch]: add "precision" parameter to gimp_display_shell_update_cursor() and pass it on to the statusbar. * app/display/gimpstatusbar.[ch]: add "precision" parameters to the cursor coordinates APIs, offset the passed coords accordingly and display them with one decimal point if SUBPIXEL is requested and the display's unit is PIXEL. Keep a second floating-point format string around at any time. * app/tools/gimptoolcontrol.[ch]: add a "precision" member and API so tools can configure the precision they need. Defalt to PIXEL_CENTER since that's right for almost all tools. * app/display/gimpdisplayshell-callbacks.c: pass the tool's precision to gimp_display_shell_update_cursor(). * app/tools/gimptool.[ch]: add "precision" parameter to gimp_tool_push_status_coords() and pass it on to the statusbar. * app/tools/gimpaligntool.c * app/tools/gimpblendtool.c * app/tools/gimpcolortool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimpperspectiveclonetool.c * app/tools/gimprectangleselecttool.c * app/tools/gimprectangletool.c * app/tools/gimptransformtool.c * app/tools/gimpvectortool.c: set precision in init() where needed. Adjust the precision in the fly when needed, e.g. while moving guides or when toggling hard-edge on paint tools. Also pass an appropriate precision to gimp_tool_push_status_coords(), which is not always the tool's precision as used for cursor display. svn path=/trunk/; revision=26681
2008-08-21 00:22:09 +08:00
gimp_statusbar_update_cursor (statusbar, GIMP_CURSOR_PRECISION_SUBPIXEL,
-image_width, -image_height);
text = gtk_label_get_text (GTK_LABEL (statusbar->cursor_label));
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
/* one static layout for all displays should be fine */
if (! layout)
layout = gtk_widget_create_pango_layout (statusbar->cursor_label, NULL);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
pango_layout_set_text (layout, text, -1);
pango_layout_get_pixel_size (layout, &width, NULL);
gtk_widget_set_size_request (statusbar->cursor_label, width, -1);
gimp_statusbar_clear_cursor (statusbar);
app/display/Makefile.am app/display/display-types.h new widget derived 2002-02-03 Michael Natterer <mitch@gimp.org> * app/display/Makefile.am * app/display/display-types.h * app/display/gimpstatusbar.[ch]: new widget derived from GtkStatusbar. Contains the coordinates display, a progress bar which is also used for status message display and a cancel button. Added a simplified API for pushing/popping messages which takes a string as context_id and does the conversion to guint internally on each call. * app/display/gimpdisplayshell.[ch]: removed the status bar code. * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/gui/view-commands.c * app/gimpprogress.c: changed accordingly. Removed knowledge about GimpDisplayShell from tools: * app/tools/gimptool.[ch]: added gimp_tool_push_status() and gimp_tool_pop_status() so tools don't need to fiddle with display details. * app/tools/gimpdrawtool.[ch]: pass a GimpDisplay instead of a GdkWindow to gimp_draw_tool_start() (the window passed was always gdisp->shell->canvas->window). * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.[ch] * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.[ch] * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.[ch] * app/tools/gimpmovetool.c * app/tools/gimppainttool.[ch] * app/tools/gimppathtool.c * app/tools/gimprectselecttool.[ch] * app/tools/gimptransformtool.c: changed accordingly: - pass GimpDisplay to gimp_draw_tool_start(). - use GimpTool's new status push/pop functions. - removed the statusbar context_id from all tool structs. * app/gui/dialogs-constructors.[ch]: a bit cleanup in preparation of dockable editor dialogs.
2002-02-03 20:10:23 +08:00
}
static void
gimp_statusbar_shell_rotated (GimpDisplayShell *shell,
GimpStatusbar *statusbar)
{
if (shell->rotate_angle != 0.0)
{
/* Degree symbol U+00B0. There are no spaces between the value and the
* unit for angular rotation.
*/
gchar *text = g_strdup_printf (" %.2f\xC2\xB0", shell->rotate_angle);
gtk_label_set_text (GTK_LABEL (statusbar->rotate_label), text);
g_free (text);
gtk_widget_show (statusbar->rotate_widget);
}
else
{
gtk_widget_hide (statusbar->rotate_widget);
}
if (shell->flip_horizontally)
gtk_widget_show (statusbar->horizontal_flip_icon);
else
gtk_widget_hide (statusbar->horizontal_flip_icon);
if (shell->flip_vertically)
gtk_widget_show (statusbar->vertical_flip_icon);
else
gtk_widget_hide (statusbar->vertical_flip_icon);
}
static void
gimp_statusbar_shell_status_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpStatusbar *statusbar)
{
gimp_statusbar_replace (statusbar, "title",
NULL, "%s", shell->status);
}
static void
gimp_statusbar_unit_changed (GimpUnitComboBox *combo,
GimpStatusbar *statusbar)
{
tools/pdbgen/pdb/image.pdb app/pdb/image_cmds.c reverted changes I did to 2004-06-01 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c * app/core/gimpimage.[ch]: reverted changes I did to the image unit earlier. As in 2.0, it will continue to not accept pixels. This makes the PDB API and the XCF format compatible again and fixes bug #142961 (and to some extent bug #137704). * app/core/Makefile.am * app/core/gimpimage-unit.[ch]: removed these files. The convenience accessors defined here aren't commonly used any longer. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added a unit parameter to gimp_display_new(). Made "unit" and "scale" properties of GimpDisplayShell. * app/actions/image-commands.c * app/actions/images-commands.c * app/actions/layers-commands.c * app/actions/select-commands.c * app/actions/view-commands.c * app/core/gimp-edit.c * app/core/gimp.[ch] * app/core/gimptemplate.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c * app/display/gimpdisplayshell-title.c * app/display/gimpstatusbar.c * app/file/file-open.c * app/gui/gui-vtable.c * app/gui/info-window.c * app/gui/offset-dialog.c * app/gui/resize-dialog.[ch] * app/pdb/display_cmds.c * app/tools/gimpcroptool.c * app/tools/gimpmeasuretool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/vectors/gimpvectors-export.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/display.pdb: changed accordingly. Use the display unit where the image unit was used before.
2004-06-02 06:04:20 +08:00
gimp_display_shell_set_unit (statusbar->shell,
gimp_unit_combo_box_get_active (combo));
}
static void
gimp_statusbar_scale_changed (GimpScaleComboBox *combo,
GimpStatusbar *statusbar)
{
gimp_display_shell_scale (statusbar->shell,
GIMP_ZOOM_TO,
gimp_scale_combo_box_get_scale (combo),
GIMP_ZOOM_FOCUS_BEST_GUESS);
}
static void
gimp_statusbar_scale_activated (GimpScaleComboBox *combo,
GimpStatusbar *statusbar)
{
gtk_widget_grab_focus (statusbar->shell->canvas);
}
static gboolean
gimp_statusbar_rotate_pressed (GtkWidget *event_box,
GdkEvent *event,
GimpStatusbar *statusbar)
{
GimpImageWindow *window = gimp_display_shell_get_window (statusbar->shell);
GimpUIManager *manager = gimp_image_window_get_ui_manager (window);
gimp_ui_manager_activate_action (manager, "view", "view-rotate-other");
return FALSE;
}
static gboolean
gimp_statusbar_horiz_flip_pressed (GtkWidget *event_box,
GdkEvent *event,
GimpStatusbar *statusbar)
{
GimpImageWindow *window = gimp_display_shell_get_window (statusbar->shell);
GimpUIManager *manager = gimp_image_window_get_ui_manager (window);
gimp_ui_manager_activate_action (manager, "view", "view-flip-horizontally");
return FALSE;
}
static gboolean
gimp_statusbar_vert_flip_pressed (GtkWidget *event_box,
GdkEvent *event,
GimpStatusbar *statusbar)
{
GimpImageWindow *window = gimp_display_shell_get_window (statusbar->shell);
GimpUIManager *manager = gimp_image_window_get_ui_manager (window);
gimp_ui_manager_activate_action (manager, "view", "view-flip-vertically");
return FALSE;
}
static guint
gimp_statusbar_get_context_id (GimpStatusbar *statusbar,
const gchar *context)
{
guint id = GPOINTER_TO_UINT (g_hash_table_lookup (statusbar->context_ids,
context));
if (! id)
{
id = statusbar->seq_context_id++;
g_hash_table_insert (statusbar->context_ids,
g_strdup (context), GUINT_TO_POINTER (id));
}
return id;
}
static gboolean
gimp_statusbar_temp_timeout (GimpStatusbar *statusbar)
{
gimp_statusbar_pop_temp (statusbar);
return FALSE;
}
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
static void
gimp_statusbar_add_message (GimpStatusbar *statusbar,
guint context_id,
const gchar *icon_name,
const gchar *format,
va_list args,
gboolean move_to_front)
{
gchar *message;
GSList *list;
GimpStatusbarMsg *msg;
gint position;
message = gimp_statusbar_vprintf (format, args);
for (list = statusbar->messages; list; list = g_slist_next (list))
{
msg = list->data;
if (msg->context_id == context_id)
{
gboolean is_front_message = (list == statusbar->messages);
if ((is_front_message || ! move_to_front) &&
strcmp (msg->text, message) == 0 &&
g_strcmp0 (msg->icon_name, icon_name) == 0)
{
g_free (message);
return;
}
if (move_to_front)
{
statusbar->messages = g_slist_remove (statusbar->messages, msg);
gimp_statusbar_msg_free (msg);
break;
}
else
{
g_free (msg->icon_name);
msg->icon_name = g_strdup (icon_name);
g_free (msg->text);
msg->text = message;
if (is_front_message)
gimp_statusbar_update (statusbar);
return;
}
}
}
msg = g_slice_new (GimpStatusbarMsg);
msg->context_id = context_id;
msg->icon_name = g_strdup (icon_name);
msg->text = message;
/* find the position at which to insert the new message */
position = 0;
/* progress messages are always at the front of the list */
if (! (statusbar->progress_active &&
context_id == gimp_statusbar_get_context_id (statusbar, "progress")))
{
if (statusbar->progress_active)
position++;
/* temporary messages are in front of all other non-progress messages */
if (statusbar->temp_timeout_id &&
context_id != statusbar->temp_context_id)
position++;
}
statusbar->messages = g_slist_insert (statusbar->messages, msg, position);
if (position == 0)
gimp_statusbar_update (statusbar);
}
static void
gimp_statusbar_remove_message (GimpStatusbar *statusbar,
guint context_id)
{
GSList *list;
gboolean needs_update = FALSE;
for (list = statusbar->messages; list; list = g_slist_next (list))
{
GimpStatusbarMsg *msg = list->data;
if (msg->context_id == context_id)
{
needs_update = (list == statusbar->messages);
statusbar->messages = g_slist_remove (statusbar->messages, msg);
gimp_statusbar_msg_free (msg);
break;
}
}
if (needs_update)
gimp_statusbar_update (statusbar);
}
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
static void
gimp_statusbar_msg_free (GimpStatusbarMsg *msg)
{
g_free (msg->icon_name);
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
g_free (msg->text);
g_slice_free (GimpStatusbarMsg, msg);
Added message severities and make sure all messages are routed through a 2006-10-09 Michael Natterer <mitch@gimp.org> Added message severities and make sure all messages are routed through a central function, so redirecting to the error console or stderr work again: * app/core/core-enums.[ch]: added enum GimpMessageSeverity { INFO, WARNING, ERROR }. * app/core/gimp.[ch] (gimp_message) (gimp_message_valist): added severity parameter. Changed "GimpProgress *progress" parameter to "GObject *handler", where "handler" can be either a GimpProgress, a GtkWidget or NULL. * app/core/gimp-gui.[ch] (gimp_show_message): ditto. Honor --console-messages again. Always dispatch to the GUI message handler first if it exists. * app/gui/gui-message.[ch]: pass severity parameters around. (gui_message_error_dialog): if "handler" is a progress, dispatch the message to it first. If it is a widget (and *not* a progress), use a GtkMessageDialog on top of that widget's toplevel. Fall back to the usual GimpErrorDialog otherwise. * app/core/gimpprogress.[ch] (gimp_progress_message): added severity parameter. Also added boolean return value to the virtual function so it can decide to fail if it can't handle the message. * app/display/gimpdisplay.c: implement GimpProgress::message() and redirect the message to GimpDisplayShell. * app/display/gimpdisplayshell-progress.c: implement GimpProgress::message() and redirect the message to GimpStatusbar if it is not an error and if the status bar is visible. * app/display/gimpstatusbar.[ch]: implement GimpProgress::message(), but fail on messages that contain a newline. Show the right icons for the message severities (work in progress). * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_message() and its _valist() variant. * app/widgets/gimperrorconsole.[ch]: show the right icons for the message severities. * app/widgets/gimpthumbbox.c (gimp_thumb_box_progress_message): return TRUE to swallow all messages. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_show_message_dialog(). Added gimp_get_message_stock_id(). * app/errors.c * app/actions/edit-commands.c * app/actions/error-console-commands.c * app/actions/file-commands.c * app/actions/select-commands.c * app/actions/text-editor-commands.c * app/actions/vectors-commands.c * app/core/gimpimage-convert.c * app/core/gimpimagefile.c * app/dialogs/convert-dialog.c * app/dialogs/file-open-dialog.c * app/dialogs/file-open-location-dialog.c * app/dialogs/file-save-dialog.c * app/dialogs/palette-import-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell-dnd.c * app/pdb/gimppdb.c * app/plug-in/gimpplugin.c * app/tools/gimpimagemaptool.c * app/tools/gimptool.c * app/tools/gimpvectortool.c * app/widgets/gimpactionview.c * app/widgets/gimpcontrollerlist.c * app/widgets/gimppdbdialog.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/palette.pdb: added severity parameter to gimp_message() calls. Convert all calls to gimp_show_message_dialog() and gimp_display_shell_message() to gimp_message(). Also converted some more g_message() calls. * app/pdb/brush_cmds.c * app/pdb/gradient_cmds.c * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/palette_cmds.c: regenerated.
2006-10-09 16:17:22 +08:00
}
static gchar *
gimp_statusbar_vprintf (const gchar *format,
va_list args)
{
gchar *message;
gchar *newline;
message = g_strdup_vprintf (format, args);
/* guard us from multi-line strings */
newline = strchr (message, '\r');
if (newline)
*newline = '\0';
newline = strchr (message, '\n');
if (newline)
*newline = '\0';
return message;
}
static GdkPixbuf *
gimp_statusbar_load_icon (GimpStatusbar *statusbar,
const gchar *icon_name)
{
GdkPixbuf *icon;
if (G_UNLIKELY (! statusbar->icon_hash))
{
statusbar->icon_hash =
g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) g_object_unref);
}
icon = g_hash_table_lookup (statusbar->icon_hash, icon_name);
if (icon)
return g_object_ref (icon);
icon = gimp_widget_load_icon (statusbar->label, icon_name, 16);
/* this is not optimal but so what */
if (g_hash_table_size (statusbar->icon_hash) > 16)
g_hash_table_remove_all (statusbar->icon_hash);
g_hash_table_insert (statusbar->icon_hash,
g_strdup (icon_name), g_object_ref (icon));
return icon;
}