コード例 #1
0
ファイル: gimptool.c プロジェクト: AjayRamanathan/gimp
void
gimp_tool_push_status_coords (GimpTool            *tool,
                              GimpDisplay         *display,
                              GimpCursorPrecision  precision,
                              const gchar         *title,
                              gdouble              x,
                              const gchar         *separator,
                              gdouble              y,
                              const gchar         *help)
{
  GimpDisplayShell *shell;
  const gchar      *stock_id;

  g_return_if_fail (GIMP_IS_TOOL (tool));
  g_return_if_fail (GIMP_IS_DISPLAY (display));

  shell = gimp_display_get_shell (display);

  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));

  gimp_statusbar_push_coords (gimp_display_shell_get_statusbar (shell),
                              G_OBJECT_TYPE_NAME (tool), stock_id,
                              precision, title, x, separator, y,
                              help);

  tool->status_displays = g_list_remove (tool->status_displays, display);
  tool->status_displays = g_list_prepend (tool->status_displays, display);
}
コード例 #2
0
static gboolean
gimp_display_shell_progress_message (GimpProgress        *progress,
                                     Gimp                *gimp,
                                     GimpMessageSeverity  severity,
                                     const gchar         *domain,
                                     const gchar         *message)
{
  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

  switch (severity)
    {
    case GIMP_MESSAGE_ERROR:
      /* error messages are never handled here */
      break;

    case GIMP_MESSAGE_WARNING:
      /* warning messages go to the statusbar, if it's visible */
      if (! gimp_statusbar_get_visible (statusbar))
        break;
      else
        return gimp_progress_message (GIMP_PROGRESS (statusbar), gimp,
                                      severity, domain, message);

    case GIMP_MESSAGE_INFO:
      /* info messages go to the statusbar;
       * if they are not handled there, they are swallowed
       */
      gimp_progress_message (GIMP_PROGRESS (statusbar), gimp,
                             severity, domain, message);
      return TRUE;
    }

  return FALSE;
}
コード例 #3
0
ファイル: actions.c プロジェクト: jiapei100/gimp
void
action_message (GimpDisplay *display,
                GObject     *object,
                const gchar *format,
                ...)
{
  GimpDisplayShell *shell     = gimp_display_get_shell (display);
  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
  const gchar      *icon_name = NULL;
  va_list           args;

  if (GIMP_IS_TOOL_OPTIONS (object))
    {
      GimpToolInfo *tool_info = GIMP_TOOL_OPTIONS (object)->tool_info;

      icon_name = gimp_viewable_get_icon_name (GIMP_VIEWABLE (tool_info));
    }
  else if (GIMP_IS_VIEWABLE (object))
    {
      icon_name = gimp_viewable_get_icon_name (GIMP_VIEWABLE (object));
    }

  va_start (args, format);
  gimp_statusbar_push_temp_valist (statusbar, GIMP_MESSAGE_INFO,
                                   icon_name, format, args);
  va_end (args);
}
コード例 #4
0
ファイル: gimptool.c プロジェクト: AjayRamanathan/gimp
void
gimp_tool_replace_status (GimpTool    *tool,
                          GimpDisplay *display,
                          const gchar *format,
                          ...)
{
  GimpDisplayShell *shell;
  const gchar      *stock_id;
  va_list           args;

  g_return_if_fail (GIMP_IS_TOOL (tool));
  g_return_if_fail (GIMP_IS_DISPLAY (display));
  g_return_if_fail (format != NULL);

  shell = gimp_display_get_shell (display);

  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));

  va_start (args, format);

  gimp_statusbar_replace_valist (gimp_display_shell_get_statusbar (shell),
                                 G_OBJECT_TYPE_NAME (tool), stock_id,
                                 format, args);

  va_end (args);

  tool->status_displays = g_list_remove (tool->status_displays, display);
  tool->status_displays = g_list_prepend (tool->status_displays, display);
}
コード例 #5
0
ファイル: gimptool.c プロジェクト: AjayRamanathan/gimp
void
gimp_tool_push_status_length (GimpTool            *tool,
                              GimpDisplay         *display,
                              const gchar         *title,
                              GimpOrientationType  axis,
                              gdouble              value,
                              const gchar         *help)
{
  GimpDisplayShell *shell;
  const gchar      *stock_id;

  g_return_if_fail (GIMP_IS_TOOL (tool));
  g_return_if_fail (GIMP_IS_DISPLAY (display));

  shell = gimp_display_get_shell (display);

  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));

  gimp_statusbar_push_length (gimp_display_shell_get_statusbar (shell),
                              G_OBJECT_TYPE_NAME (tool), stock_id,
                              title, axis, value, help);

  tool->status_displays = g_list_remove (tool->status_displays, display);
  tool->status_displays = g_list_prepend (tool->status_displays, display);
}
コード例 #6
0
void
gimp_display_shell_clear_software_cursor (GimpDisplayShell *shell)
{
  GimpStatusbar     *statusbar;
  GimpSessionInfo   *session_info;

  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));

  gimp_canvas_item_set_visible (shell->cursor, FALSE);

  statusbar = gimp_display_shell_get_statusbar (shell);

  gimp_statusbar_clear_cursor (statusbar);

  session_info = gimp_dialog_factory_find_session_info (gimp_dialog_factory_get_singleton (),
                                                        "gimp-cursor-view");
  if (session_info && gimp_session_info_get_widget (session_info))
    {
      GtkWidget *cursor_view;

      cursor_view = gtk_bin_get_child (GTK_BIN (gimp_session_info_get_widget (session_info)));

      if (cursor_view)
        gimp_cursor_view_clear_cursor (GIMP_CURSOR_VIEW (cursor_view));
    }
}
コード例 #7
0
static void
gimp_display_shell_progress_pulse (GimpProgress *progress)
{
  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

  gimp_progress_pulse (GIMP_PROGRESS (statusbar));
}
コード例 #8
0
static gdouble
gimp_display_shell_progress_get_value (GimpProgress *progress)
{
  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

  return gimp_progress_get_value (GIMP_PROGRESS (statusbar));
}
コード例 #9
0
static gboolean
gimp_display_shell_progress_is_active (GimpProgress *progress)
{
  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

  return gimp_progress_is_active (GIMP_PROGRESS (statusbar));
}
コード例 #10
0
static void
gimp_display_shell_progress_set_text (GimpProgress *progress,
                                      const gchar  *message)
{
  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

  gimp_progress_set_text (GIMP_PROGRESS (statusbar), message);
}
コード例 #11
0
static void
gimp_display_shell_progress_set_value (GimpProgress *progress,
                                       gdouble       percentage)
{
  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

  gimp_progress_set_value (GIMP_PROGRESS (statusbar), percentage);
}
コード例 #12
0
static GimpProgress *
gimp_display_shell_progress_start (GimpProgress *progress,
                                   const gchar  *message,
                                   gboolean      cancelable)
{
  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

  return gimp_progress_start (GIMP_PROGRESS (statusbar), message, cancelable);
}
コード例 #13
0
static void
gimp_display_shell_exported_handler (GimpImage        *image,
                                     GFile            *file,
                                     GimpDisplayShell *shell)
{
  GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);

  gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
                            "document-save", _("Image exported to '%s'"),
                            gimp_file_get_utf8_name (file));
}
コード例 #14
0
static void
gimp_display_shell_exported_handler (GimpImage        *image,
                                     const gchar      *uri,
                                     GimpDisplayShell *shell)
{
  GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
  gchar         *filename  = file_utils_uri_display_name (uri);

  gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
                            "document-save", _("Image exported to '%s'"),
                            filename);
  g_free (filename);
}
コード例 #15
0
static void
gui_menu_hide_tooltip (GimpUIManager *manager,
                       Gimp          *gimp)
{
  GimpContext *context = gimp_get_user_context (gimp);
  GimpDisplay *display = gimp_context_get_display (context);

  if (display)
    {
      GimpDisplayShell *shell     = gimp_display_get_shell (display);
      GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

      gimp_statusbar_pop (statusbar, "menu-tooltip");
    }
}
コード例 #16
0
ファイル: gimptool.c プロジェクト: AjayRamanathan/gimp
void
gimp_tool_pop_status (GimpTool    *tool,
                      GimpDisplay *display)
{
  GimpDisplayShell *shell;

  g_return_if_fail (GIMP_IS_TOOL (tool));
  g_return_if_fail (GIMP_IS_DISPLAY (display));

  shell = gimp_display_get_shell (display);

  gimp_statusbar_pop (gimp_display_shell_get_statusbar (shell),
                      G_OBJECT_TYPE_NAME (tool));

  tool->status_displays = g_list_remove (tool->status_displays, display);
}
コード例 #17
0
static void
gui_menu_show_tooltip (GimpUIManager *manager,
                       const gchar   *tooltip,
                       Gimp          *gimp)
{
  GimpContext *context = gimp_get_user_context (gimp);
  GimpDisplay *display = gimp_context_get_display (context);

  if (display)
    {
      GimpDisplayShell *shell     = gimp_display_get_shell (display);
      GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);

      gimp_statusbar_push (statusbar, "menu-tooltip",
                           NULL, "%s", tooltip);
    }
}
コード例 #18
0
void
gimp_display_shell_update_software_cursor (GimpDisplayShell    *shell,
                                           GimpCursorPrecision  precision,
                                           gint                 display_x,
                                           gint                 display_y,
                                           gdouble              image_x,
                                           gdouble              image_y)
{
  GimpStatusbar   *statusbar;
  GimpSessionInfo *session_info;
  GimpImage       *image;

  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));

  image = gimp_display_get_image (shell->display);

  if (shell->draw_cursor &&
      shell->proximity   &&
      display_x >= 0     &&
      display_y >= 0)
    {
      gimp_canvas_item_begin_change (shell->cursor);

      gimp_canvas_cursor_set (shell->cursor,
                              display_x,
                              display_y);
      gimp_canvas_item_set_visible (shell->cursor, TRUE);

      gimp_canvas_item_end_change (shell->cursor);
    }
  else
    {
      gimp_canvas_item_set_visible (shell->cursor, FALSE);
    }

  /*  use the passed image_coords for the statusbar because they are
   *  possibly snapped...
   */
  statusbar = gimp_display_shell_get_statusbar (shell);

  gimp_statusbar_update_cursor (statusbar, precision, image_x, image_y);

  session_info = gimp_dialog_factory_find_session_info (gimp_dialog_factory_get_singleton (),
                                                        "gimp-cursor-view");
  if (session_info && gimp_session_info_get_widget (session_info))
    {
      GtkWidget *cursor_view;

      cursor_view = gtk_bin_get_child (GTK_BIN (gimp_session_info_get_widget (session_info)));

      if (cursor_view)
        {
          gint t_x = -1;
          gint t_y = -1;

          /*  ...but use the unsnapped display_coords for the info window  */
          if (display_x >= 0 && display_y >= 0)
            gimp_display_shell_untransform_xy (shell, display_x, display_y,
                                               &t_x, &t_y, FALSE);

          gimp_cursor_view_update_cursor (GIMP_CURSOR_VIEW (cursor_view),
                                          image, shell->unit,
                                          t_x, t_y);
        }
    }
}