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));
    }
}
예제 #2
0
static GimpColormapEditor *
context_get_colormap_editor (void)
{
  GimpSessionInfo *info = NULL;

  g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (gimp_dialog_factory_get_singleton ()), NULL);

  info = gimp_dialog_factory_find_session_info (gimp_dialog_factory_get_singleton (),
                                                "gimp-indexed-palette");
  if (info && gimp_session_info_get_widget (info))
    return GIMP_COLORMAP_EDITOR (gtk_bin_get_child (GTK_BIN (gimp_session_info_get_widget (info))));

  return NULL;
}
예제 #3
0
static GimpPaletteEditor *
context_get_palette_editor (void)
{
  GimpSessionInfo *info = NULL;

  g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (gimp_dialog_factory_get_singleton ()), NULL);

  info = gimp_dialog_factory_find_session_info (gimp_dialog_factory_get_singleton (),
                                                "gimp-palette-editor");
  if (info && gimp_session_info_get_widget (info))
    return GIMP_PALETTE_EDITOR (gtk_bin_get_child (GTK_BIN (gimp_session_info_get_widget (info))));

  return NULL;
}
예제 #4
0
static gboolean
dialogs_actions_toolbox_exists (Gimp *gimp)
{
  GimpDialogFactory *factory       = gimp_dialog_factory_get_singleton ();
  GimpSessionInfo   *info          = NULL;
  GList             *windows       = gimp ? gimp_get_image_windows (gimp) : NULL;
  gboolean           toolbox_found = FALSE;
  GList             *iter;

  /* First look in session managed windows */
  info = gimp_dialog_factory_find_session_info (factory, "gimp-toolbox-window");
  toolbox_found = info && gimp_session_info_get_widget (info);

  /* Then in image windows */
  if (! toolbox_found)
    {
      for (iter = windows; iter; iter = g_list_next (iter))
        {
          GimpImageWindow *window = GIMP_IMAGE_WINDOW (windows->data);
      
          if (gimp_image_window_has_toolbox (window))
            {
              toolbox_found = TRUE;
              break;
            }
        }
    }

  return toolbox_found;
}
예제 #5
0
/**
 * gimp_session_info_get_info_with_widget:
 * @info:
 * @widget: #GtkWidget to use
 *
 * Temporarily sets @widget on @info and calls
 * gimp_session_info_get_info(), then restores the old widget that was
 * set.
 **/
void
gimp_session_info_get_info_with_widget (GimpSessionInfo *info,
                                        GtkWidget       *widget)
{
  GtkWidget *old_widget;

  g_return_if_fail (GIMP_IS_SESSION_INFO (info));
  g_return_if_fail (GTK_IS_WIDGET (widget));

  old_widget = gimp_session_info_get_widget (info);

  gimp_session_info_set_widget (info, widget);
  gimp_session_info_get_info (info);
  gimp_session_info_set_widget (info, old_widget);
}
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);
        }
    }
}