Beispiel #1
0
static void
windows_menu_display_reorder (GimpContainer *container,
                              GimpDisplay   *display,
                              gint           new_index,
                              GimpUIManager *manager)
{
  gint n_display = gimp_container_get_n_children (container);
  gint i;

  for (i = new_index; i < n_display; i++)
    {
      GimpObject *d = gimp_container_get_child_by_index (container, i);

      windows_menu_display_remove (container, GIMP_DISPLAY (d), manager);
    }

  /* If I don't ensure the menu items are effectively removed, adding
   * the same ones may simply cancel the effect of the removal, hence
   * losing the menu reordering.
   */
  gtk_ui_manager_ensure_update (GTK_UI_MANAGER (manager));

  for (i = new_index; i < n_display; i++)
    {
      GimpObject *d = gimp_container_get_child_by_index (container, i);

      windows_menu_display_add (container, GIMP_DISPLAY (d), manager);
    }
}
Beispiel #2
0
static gboolean
gui_unique_win32_idle_open (IdleOpenData *data)
{
  /*  We want to be called again later in case that GIMP is not fully
   *  started yet.
   */
  if (! gimp_is_restored (unique_gimp))
    return TRUE;

  if (data->name)
    {
      file_open_from_command_line (unique_gimp, data->name, data->as_new);
    }
  else
    {
      /*  raise the first display  */
      GimpObject *display;

      display = gimp_container_get_first_child (unique_gimp->displays);

      gtk_window_present (GTK_WINDOW (GIMP_DISPLAY (display)->shell));
    }

  return FALSE;
}
Beispiel #3
0
static void
gimp_display_progress_pulse (GimpProgress *progress)
{
  GimpDisplay *display = GIMP_DISPLAY (progress);

  if (display->shell)
    gimp_progress_pulse (GIMP_PROGRESS (display->shell));
}
Beispiel #4
0
static void
gimp_display_progress_set_value (GimpProgress *progress,
                                 gdouble       percentage)
{
  GimpDisplay *display = GIMP_DISPLAY (progress);

  if (display->shell)
    gimp_progress_set_value (GIMP_PROGRESS (display->shell), percentage);
}
Beispiel #5
0
static void
gimp_display_progress_set_text (GimpProgress *progress,
                                const gchar  *message)
{
  GimpDisplay *display = GIMP_DISPLAY (progress);

  if (display->shell)
    gimp_progress_set_text (GIMP_PROGRESS (display->shell), message);
}
Beispiel #6
0
static guint32
gui_display_get_window (GimpObject *display)
{
  GimpDisplay *disp = GIMP_DISPLAY (display);

  if (disp->shell)
    return (guint32) gimp_window_get_native (GTK_WINDOW (disp->shell));

  return 0;
}
Beispiel #7
0
static guint32
gimp_display_progress_get_window (GimpProgress *progress)
{
  GimpDisplay *display = GIMP_DISPLAY (progress);

  if (display->shell)
    return gimp_progress_get_window (GIMP_PROGRESS (display->shell));

  return 0;
}
Beispiel #8
0
static gdouble
gimp_display_progress_get_value (GimpProgress *progress)
{
  GimpDisplay *display = GIMP_DISPLAY (progress);

  if (display->shell)
    return gimp_progress_get_value (GIMP_PROGRESS (display->shell));

  return 0.0;
}
Beispiel #9
0
static gboolean
gimp_display_progress_is_active (GimpProgress *progress)
{
  GimpDisplay *display = GIMP_DISPLAY (progress);

  if (display->shell)
    return gimp_progress_is_active (GIMP_PROGRESS (display->shell));

  return FALSE;
}
Beispiel #10
0
static GimpProgress *
gimp_display_progress_start (GimpProgress *progress,
                             const gchar  *message,
                             gboolean      cancelable)
{
  GimpDisplay *display = GIMP_DISPLAY (progress);

  if (display->shell)
    return gimp_progress_start (GIMP_PROGRESS (display->shell),
                                message, cancelable);

  return NULL;
}
Beispiel #11
0
static gboolean
gimp_display_progress_message (GimpProgress        *progress,
                               Gimp                *gimp,
                               GimpMessageSeverity  severity,
                               const gchar         *domain,
                               const gchar         *message)
{
  GimpDisplay *display = GIMP_DISPLAY (progress);

  if (display->shell)
    return gimp_progress_message (GIMP_PROGRESS (display->shell), gimp,
                                  severity, domain, message);

  return FALSE;
}
Beispiel #12
0
/**
 * dialogs_restore_window:
 * @factory:
 * @screen:
 * @monitor:
 * @info:
 *
 * "restores" the image window. We don't really restore anything since
 * the image window is created earlier, so we just look for and return
 * the already-created image window.
 *
 * Returns:
 **/
static GtkWidget *
dialogs_restore_window (GimpDialogFactory *factory,
                        GdkScreen         *screen,
                        gint               monitor,
                        GimpSessionInfo   *info)
{
  Gimp             *gimp    = gimp_dialog_factory_get_context (factory)->gimp;
  GimpDisplay      *display = GIMP_DISPLAY (gimp_get_empty_display (gimp));
  GimpDisplayShell *shell   = gimp_display_get_shell (display);
  GtkWidget        *dialog;

  dialog = GTK_WIDGET (gimp_display_shell_get_window (shell));

  return dialog;
}
Beispiel #13
0
static guint32
gui_display_get_window_id (GimpObject *display)
{
  GimpDisplay      *disp  = GIMP_DISPLAY (display);
  GimpDisplayShell *shell = gimp_display_get_shell (disp);

  if (shell)
    {
      GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));

      if (GTK_IS_WINDOW (toplevel))
        return gimp_window_get_native_id (GTK_WINDOW (toplevel));
    }

  return 0;
}
Beispiel #14
0
static GimpObject *
gui_get_empty_display (Gimp *gimp)
{
  GimpObject *display = NULL;

  if (gimp_container_get_n_children (gimp->displays) == 1)
    {
      display = gimp_container_get_first_child (gimp->displays);

      if (gimp_display_get_image (GIMP_DISPLAY (display)))
        {
          /* The display was not empty */
          display = NULL;
        }
    }

  return display;
}
Beispiel #15
0
gboolean
gimp_dbus_service_activate (GimpDBusService  *service,
                            GError          **dbus_error)
{
  GimpObject *display;

  g_return_val_if_fail (GIMP_IS_DBUS_SERVICE (service), FALSE);

  /*  We want to be called again later in case that GIMP is not fully
   *  started yet.
   */
  if (! gimp_is_restored (service->gimp))
    return TRUE;

  display = gimp_container_get_first_child (service->gimp->displays);

  if (display)
    gimp_display_shell_present (gimp_display_get_shell (GIMP_DISPLAY (display)));

  return TRUE;
}
Beispiel #16
0
void
windows_show_display_previous_cmd_callback (GtkAction *action,
                                            gpointer   data)
{
  GimpDisplay *display;
  Gimp        *gimp;
  gint         index;
  return_if_no_display (display, data);
  return_if_no_gimp (gimp, data);

  index = gimp_container_get_child_index (gimp->displays,
                                          GIMP_OBJECT (display));
  index--;

  if (index < 0)
    index = gimp_container_get_n_children (gimp->displays) - 1;

  display = GIMP_DISPLAY (gimp_container_get_child_by_index (gimp->displays,
                                                             index));
  gimp_display_shell_present (gimp_display_get_shell (display));
}
Beispiel #17
0
static GimpObject *
gui_display_create (Gimp      *gimp,
                    GimpImage *image,
                    GimpUnit   unit,
                    gdouble    scale)
{
  GimpContext *context = gimp_get_user_context (gimp);
  GimpDisplay *display = GIMP_DISPLAY (gui_get_empty_display (gimp));

  if (display)
    {
      gimp_display_fill (display, image, unit, scale);
    }
  else
    {
      GList *image_managers = gimp_ui_managers_from_name ("<Image>");

      g_return_val_if_fail (image_managers != NULL, NULL);

      display = gimp_display_new (gimp, image, unit, scale,
                                  global_menu_factory,
                                  image_managers->data,
                                  global_display_factory);
   }

  if (gimp_context_get_display (context) == display)
    {
      gimp_context_set_image (context, image);
      gimp_context_display_changed (context);
    }
  else
    {
      gimp_context_set_display (context, display);
    }

  gimp_ui_manager_update (GIMP_DISPLAY_SHELL (display->shell)->menubar_manager,
                          display);

  return GIMP_OBJECT (display);
}
Beispiel #18
0
static void
gimp_display_set_property (GObject      *object,
                           guint         property_id,
                           const GValue *value,
                           GParamSpec   *pspec)
{
  GimpDisplay *display = GIMP_DISPLAY (object);

  switch (property_id)
    {
    case PROP_ID:
      display->ID = g_value_get_int (value);
      break;
    case PROP_IMAGE:
    case PROP_SHELL:
      g_assert_not_reached ();
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
}
Beispiel #19
0
gboolean
gimp_dbus_service_activate (GimpDBusServiceUI     *service,
                            GDBusMethodInvocation *invocation)
{
  Gimp *gimp = GIMP_DBUS_SERVICE (service)->gimp;

  /*  We want to be called again later in case that GIMP is not fully
   *  started yet.
   */
  if (gimp_is_restored (gimp))
    {
      GimpObject *display;

      display = gimp_container_get_first_child (gimp->displays);

      if (display)
        gimp_display_shell_present (gimp_display_get_shell (GIMP_DISPLAY (display)));
    }

  gimp_dbus_service_ui_complete_activate (service, invocation);

  return TRUE;
}
Beispiel #20
0
static void
gimp_display_get_property (GObject    *object,
                           guint       property_id,
                           GValue     *value,
                           GParamSpec *pspec)
{
  GimpDisplay *display = GIMP_DISPLAY (object);

  switch (property_id)
    {
    case PROP_ID:
      g_value_set_int (value, display->ID);
      break;
    case PROP_IMAGE:
      g_value_set_object (value, display->image);
      break;
    case PROP_SHELL:
      g_value_set_object (value, display->shell);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
}
Beispiel #21
0
static void
gui_restore_after_callback (Gimp               *gimp,
                            GimpInitStatusFunc  status_callback)
{
  GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
  GimpDisplay   *display;

  if (gimp->be_verbose)
    g_print ("INIT: %s\n", G_STRFUNC);

  gimp->message_handler = GIMP_MESSAGE_BOX;

  /*  load the recent documents after gimp_real_restore() because we
   *  need the mime-types implemented by plug-ins
   */
  status_callback (NULL, _("Documents"), 0.9);
  gimp_recent_list_load (gimp);

  /*  enable this to always have icons everywhere  */
  if (g_getenv ("GIMP_ICONS_LIKE_A_BOSS"))
    {
      GdkScreen *screen = gdk_screen_get_default ();

      g_object_set (G_OBJECT (gtk_settings_get_for_screen (screen)),
                    "gtk-button-images", TRUE,
                    "gtk-menu-images",   TRUE,
                    NULL);
    }

  if (gui_config->restore_accels)
    menus_restore (gimp);

  ui_configurer = g_object_new (GIMP_TYPE_UI_CONFIGURER,
                                "gimp", gimp,
                                NULL);

  image_ui_manager = gimp_menu_factory_manager_new (global_menu_factory,
                                                    "<Image>",
                                                    gimp,
                                                    gui_config->tearoff_menus);
  gimp_ui_manager_update (image_ui_manager, gimp);

  gimp_action_history_init (gimp);

#ifdef GDK_WINDOWING_QUARTZ
  {
    GtkosxApplication *osx_app;
    GtkWidget         *menu;
    GtkWidget         *item;

    osx_app = gtkosx_application_get ();

    menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
                                      "/image-menubar");
    if (GTK_IS_MENU_ITEM (menu))
      menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));

    gtkosx_application_set_menu_bar (osx_app, GTK_MENU_SHELL (menu));
    gtkosx_application_set_use_quartz_accelerators (osx_app, FALSE);

    gui_add_to_app_menu (image_ui_manager, osx_app,
                         "/image-menubar/Help/dialogs-about", 0);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         "/image-menubar/Help/dialogs-search-action", 1);

#define PREFERENCES "/image-menubar/Edit/Preferences/"

    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-preferences", 3);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-input-devices", 4);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-keyboard-shortcuts", 5);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-module-dialog", 6);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "plug-in-unit-editor", 7);

#undef PREFERENCES

    item = gtk_separator_menu_item_new ();
    gtkosx_application_insert_app_menu_item (osx_app, item, 8);

    item = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
                                      "/image-menubar/File/file-quit");
    gtk_widget_hide (item);

    g_signal_connect (osx_app, "NSApplicationBlockTermination",
                      G_CALLBACK (gui_quartz_quit_callback),
                      image_ui_manager);

    gtkosx_application_ready (osx_app);
  }
#endif /* GDK_WINDOWING_QUARTZ */

  g_signal_connect_object (gui_config, "notify::single-window-mode",
                           G_CALLBACK (gui_single_window_mode_notify),
                           ui_configurer, 0);
  g_signal_connect_object (gui_config, "notify::tearoff-menus",
                           G_CALLBACK (gui_tearoff_menus_notify),
                           image_ui_manager, 0);
  g_signal_connect (image_ui_manager, "show-tooltip",
                    G_CALLBACK (gui_menu_show_tooltip),
                    gimp);
  g_signal_connect (image_ui_manager, "hide-tooltip",
                    G_CALLBACK (gui_menu_hide_tooltip),
                    gimp);

  gimp_devices_restore (gimp);
  gimp_controllers_restore (gimp, image_ui_manager);

  if (status_callback == splash_update)
    splash_destroy ();

  color_history_restore (gimp);

  if (gimp_get_show_gui (gimp))
    {
      GimpDisplayShell *shell;
      GtkWidget        *toplevel;

      /*  create the empty display  */
      display = GIMP_DISPLAY (gimp_create_display (gimp, NULL,
                                                   GIMP_UNIT_PIXEL, 1.0,
                                                   G_OBJECT (initial_screen),
                                                   initial_monitor));

      shell = gimp_display_get_shell (display);

      if (gui_config->restore_session)
        session_restore (gimp,
                         initial_screen,
                         initial_monitor);

      /*  move keyboard focus to the display  */
      toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
      gtk_window_present (GTK_WINDOW (toplevel));
    }

  /*  indicate that the application has finished loading  */
  gdk_notify_startup_complete ();

  /*  clear startup monitor variables  */
  initial_screen  = NULL;
  initial_monitor = -1;
}
Beispiel #22
0
static void
gui_display_delete (GimpObject *display)
{
  gimp_display_close (GIMP_DISPLAY (display));
}
Beispiel #23
0
static gint
gui_display_get_ID (GimpObject *display)
{
  return gimp_display_get_ID (GIMP_DISPLAY (display));
}
Beispiel #24
0
static void
gui_restore_after_callback (Gimp               *gimp,
                            GimpInitStatusFunc  status_callback)
{
  GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
  GimpDisplay   *display;

  if (gimp->be_verbose)
    g_print ("INIT: %s\n", G_STRFUNC);

  gimp->message_handler = GIMP_MESSAGE_BOX;

  if (gui_config->restore_accels)
    menus_restore (gimp);

  ui_configurer = g_object_new (GIMP_TYPE_UI_CONFIGURER,
                                "gimp", gimp,
                                NULL);

  image_ui_manager = gimp_menu_factory_manager_new (global_menu_factory,
                                                    "<Image>",
                                                    gimp,
                                                    gui_config->tearoff_menus);
  gimp_ui_manager_update (image_ui_manager, gimp);

#ifdef GDK_WINDOWING_QUARTZ
  {
    GtkosxApplication *osx_app;
    GtkWidget         *menu;
    GtkWidget         *item;

    osx_app = gtkosx_application_get ();

    menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
                                      "/image-menubar");
    if (GTK_IS_MENU_ITEM (menu))
      menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));

    gtkosx_application_set_menu_bar (osx_app, GTK_MENU_SHELL (menu));
    gtkosx_application_set_use_quartz_accelerators (osx_app, FALSE);

    gui_add_to_app_menu (image_ui_manager, osx_app,
                         "/image-menubar/Help/dialogs-about", 0);

#define PREFERENCES "/image-menubar/Edit/Preferences/"

    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-preferences", 2);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-input-devices", 3);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-keyboard-shortcuts", 4);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-module-dialog", 5);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "plug-in-unit-editor", 6);

#undef PREFERENCES

    item = gtk_separator_menu_item_new ();
    gtkosx_application_insert_app_menu_item (osx_app, item, 7);

    item = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
                                      "/image-menubar/File/file-quit");
    gtk_widget_hide (item);

    g_signal_connect (osx_app, "NSApplicationBlockTermination",
                      G_CALLBACK (gui_quartz_quit_callback),
                      image_ui_manager);

    gtkosx_application_ready (osx_app);
  }
#endif /* GDK_WINDOWING_QUARTZ */

  g_signal_connect_object (gui_config, "notify::single-window-mode",
                           G_CALLBACK (gui_single_window_mode_notify),
                           ui_configurer, 0);
  g_signal_connect_object (gui_config, "notify::tearoff-menus",
                           G_CALLBACK (gui_tearoff_menus_notify),
                           image_ui_manager, 0);
  g_signal_connect (image_ui_manager, "show-tooltip",
                    G_CALLBACK (gui_menu_show_tooltip),
                    gimp);
  g_signal_connect (image_ui_manager, "hide-tooltip",
                    G_CALLBACK (gui_menu_hide_tooltip),
                    gimp);

  gimp_devices_restore (gimp);
  gimp_controllers_restore (gimp, image_ui_manager);

  if (status_callback == splash_update)
    splash_destroy ();

  color_history_restore (gimp);

  if (gimp_get_show_gui (gimp))
    {
      GimpDisplayShell *shell;

      /*  create the empty display  */
      display = GIMP_DISPLAY (gimp_create_display (gimp,
                                                   NULL,
                                                   GIMP_UNIT_PIXEL,
                                                   1.0));

      shell = gimp_display_get_shell (display);

      if (gui_config->restore_session)
        session_restore (gimp);

      /*  move keyboard focus to the display  */
      gtk_window_present (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell))));
    }

  /*  indicate that the application has finished loading  */
  gdk_notify_startup_complete ();
}