Ejemplo n.º 1
0
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_SHELL (display->shell);

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

  gimp_statusbar_push_length (GIMP_STATUSBAR (shell->statusbar),
                              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);
}
Ejemplo n.º 2
0
void
gimp_tool_replace_status (GimpTool    *tool,
                          GimpDisplay *display,
                          const gchar *format,
                          ...)
{
  GimpDisplayShell *shell;
  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_SHELL (display->shell);

  va_start (args, format);

  gimp_statusbar_replace_valist (GIMP_STATUSBAR (shell->statusbar),
                                 G_OBJECT_TYPE_NAME (tool),
                                 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);
}
Ejemplo n.º 3
0
static gboolean
gimp_display_shell_update_title_idle (gpointer data)
{
  GimpDisplayShell  *shell;
  GimpDisplayConfig *config;
  gchar              title[MAX_TITLE_BUF];

  shell  = GIMP_DISPLAY_SHELL (data);
  config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);

  shell->title_idle_id = 0;

  /* format the title */
  gimp_display_shell_format_title (shell, title, sizeof (title),
                                   config->image_title_format);
  gdk_window_set_title (GTK_WIDGET (shell)->window, title);

  /* format the statusbar */
  if (strcmp (config->image_title_format, config->image_status_format))
    {
      gimp_display_shell_format_title (shell, title, sizeof (title),
                                       config->image_status_format);
    }

  gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar), "title",
                          "%s", title);

  return FALSE;
}
Ejemplo n.º 4
0
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_SHELL (display->shell);

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

  gimp_statusbar_push_coords (GIMP_STATUSBAR (shell->statusbar),
                              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);
}
Ejemplo n.º 5
0
void
gimp_tool_push_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_SHELL (display->shell);

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

  va_start (args, format);

  gimp_statusbar_push_valist (GIMP_STATUSBAR (shell->statusbar),
                              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);
}
Ejemplo n.º 6
0
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_SHELL (display->shell);

  gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
                      G_OBJECT_TYPE_NAME (tool));

  tool->status_displays = g_list_remove (tool->status_displays, display);
}
Ejemplo n.º 7
0
void
gimp_display_shell_title_init (GimpDisplayShell *shell)
{
  GimpDisplayConfig *config;
  gchar              title[MAX_TITLE_BUF];

  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));

  config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);

  gimp_display_shell_format_title (shell, title, sizeof (title),
                                   config->image_status_format);

  gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar), "title",
                       "%s", title);
}
Ejemplo n.º 8
0
void
gimp_tool_push_status_coords (GimpTool    *tool,
                              GimpDisplay *display,
                              const gchar *title,
                              gdouble      x,
                              const gchar *separator,
                              gdouble      y,
                              const gchar *help)
{
  GimpDisplayShell *shell;

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

  shell = GIMP_DISPLAY_SHELL (display->shell);

  gimp_statusbar_push_coords (GIMP_STATUSBAR (shell->statusbar),
                              G_OBJECT_TYPE_NAME (tool),
                              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);
}
Ejemplo n.º 9
0
void
gimp_display_shell_clear_cursor (GimpDisplayShell *shell)
{
    GimpDialogFactory *factory;
    GimpSessionInfo   *session_info;

    g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));

    gimp_statusbar_clear_cursor (GIMP_STATUSBAR (shell->statusbar));

    factory = gimp_dialog_factory_from_name ("dock");
    session_info = gimp_dialog_factory_find_session_info (factory,
                   "gimp-cursor-view");
    if (session_info && session_info->widget)
    {
        GtkWidget *cursor_view;

        cursor_view = gtk_bin_get_child (GTK_BIN (session_info->widget));

        if (cursor_view)
            gimp_cursor_view_clear_cursor (GIMP_CURSOR_VIEW (cursor_view));
    }
}
Ejemplo n.º 10
0
void
gimp_display_shell_update_cursor (GimpDisplayShell *shell,
                                  gint              display_x,
                                  gint              display_y,
                                  gint              image_x,
                                  gint              image_y)
{
    GimpDialogFactory *factory;
    GimpSessionInfo   *session_info;
    GimpImage         *image;
    gboolean           new_cursor;

    g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));

    image = shell->display->image;

    new_cursor = (shell->draw_cursor &&
                  shell->proximity   &&
                  display_x >= 0     &&
                  display_y >= 0);

    /* Erase old cursor, if necessary */

    if (shell->have_cursor && (! new_cursor                 ||
                               display_x != shell->cursor_x ||
                               display_y != shell->cursor_y))
    {
        gimp_display_shell_expose_area (shell,
                                        shell->cursor_x - 7,
                                        shell->cursor_y - 7,
                                        15, 15);
        if (! new_cursor)
            shell->have_cursor = FALSE;
    }

    shell->have_cursor = new_cursor;
    shell->cursor_x    = display_x;
    shell->cursor_y    = display_y;

    /*  use the passed image_coords for the statusbar because they are
     *  possibly snapped...
     */
    gimp_statusbar_update_cursor (GIMP_STATUSBAR (shell->statusbar),
                                  image_x, image_y);

    factory = gimp_dialog_factory_from_name ("dock");
    session_info = gimp_dialog_factory_find_session_info (factory,
                   "gimp-cursor-view");
    if (session_info && session_info->widget)
    {
        GtkWidget *cursor_view;

        cursor_view = gtk_bin_get_child (GTK_BIN (session_info->widget));

        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, FALSE);

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