/* PIKA - Photo and Image Kooker Application
 * a rebranding of The GNU Image Manipulation Program (created with heckimp)
 * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
 *
 * Original copyright, applying to most contents (license remains unchanged): 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (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/>.
 */

#include "config.h"

#include <gegl.h>
#include <gtk/gtk.h>

#include "libpikawidgets/pikawidgets.h"

#include "dialogs-types.h"

#include "core/pika.h"
#include "core/pikacontext.h"

#include "config/pikaguiconfig.h"

#include "menus/menus.h"

#include "widgets/pikabrusheditor.h"
#include "widgets/pikabrushfactoryview.h"
#include "widgets/pikabufferview.h"
#include "widgets/pikachanneltreeview.h"
#include "widgets/pikacoloreditor.h"
#include "widgets/pikacolormapeditor.h"
#include "widgets/pikacriticaldialog.h"
#include "widgets/pikadashboard.h"
#include "widgets/pikadevicestatus.h"
#include "widgets/pikadialogfactory.h"
#include "widgets/pikadockwindow.h"
#include "widgets/pikadocumentview.h"
#include "widgets/pikadynamicseditor.h"
#include "widgets/pikadynamicsfactoryview.h"
#include "widgets/pikaerrorconsole.h"
#include "widgets/pikaerrordialog.h"
#include "widgets/pikafontfactoryview.h"
#include "widgets/pikagradienteditor.h"
#include "widgets/pikahistogrameditor.h"
#include "widgets/pikaimageview.h"
#include "widgets/pikalayertreeview.h"
#include "widgets/pikamenudock.h"
#include "widgets/pikapaletteeditor.h"
#include "widgets/pikapatternfactoryview.h"
#include "widgets/pikasamplepointeditor.h"
#include "widgets/pikaselectioneditor.h"
#include "widgets/pikasymmetryeditor.h"
#include "widgets/pikatemplateview.h"
#include "widgets/pikatoolbox.h"
#include "widgets/pikatooloptionseditor.h"
#include "widgets/pikatoolpresetfactoryview.h"
#include "widgets/pikatoolpreseteditor.h"
#include "widgets/pikaundoeditor.h"
#include "widgets/pikavectorstreeview.h"

#include "display/pikacursorview.h"
#include "display/pikanavigationeditor.h"

#include "about-dialog.h"
#include "action-search-dialog.h"
#include "dialogs.h"
#include "dialogs-constructors.h"
#include "extensions-dialog.h"
#include "file-open-dialog.h"
#include "file-open-location-dialog.h"
#include "file-save-dialog.h"
#include "image-new-dialog.h"
#include "input-devices-dialog.h"
#include "keyboard-shortcuts-dialog.h"
#include "module-dialog.h"
#include "palette-import-dialog.h"
#include "preferences-dialog.h"
#include "quit-dialog.h"
#include "tips-dialog.h"
#include "welcome-dialog.h"

#include "pika-intl.h"


/**********************/
/*  toplevel dialogs  */
/**********************/

GtkWidget *
dialogs_image_new_new (PikaDialogFactory *factory,
                       PikaContext       *context,
                       PikaUIManager     *ui_manager,
                       gint               view_size)
{
  return image_new_dialog_new (context);
}

GtkWidget *
dialogs_file_open_new (PikaDialogFactory *factory,
                       PikaContext       *context,
                       PikaUIManager     *ui_manager,
                       gint               view_size)
{
  return file_open_dialog_new (context->pika);
}

GtkWidget *
dialogs_file_open_location_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return file_open_location_dialog_new (context->pika);
}

GtkWidget *
dialogs_file_save_new (PikaDialogFactory *factory,
                       PikaContext       *context,
                       PikaUIManager     *ui_manager,
                       gint               view_size)
{
  return file_save_dialog_new (context->pika, FALSE);
}

GtkWidget *
dialogs_file_export_new (PikaDialogFactory *factory,
                         PikaContext       *context,
                         PikaUIManager     *ui_manager,
                         gint               view_size)
{
  return file_save_dialog_new (context->pika, TRUE);
}

GtkWidget *
dialogs_preferences_get (PikaDialogFactory *factory,
                         PikaContext       *context,
                         PikaUIManager     *ui_manager,
                         gint               view_size)
{
  return preferences_dialog_create (context->pika);
}

GtkWidget *
dialogs_extensions_get (PikaDialogFactory *factory,
                        PikaContext       *context,
                        PikaUIManager     *ui_manager,
                        gint               view_size)
{
  return extensions_dialog_new (context->pika);
}

GtkWidget *
dialogs_keyboard_shortcuts_get (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return keyboard_shortcuts_dialog_new (context->pika);
}

GtkWidget *
dialogs_input_devices_get (PikaDialogFactory *factory,
                           PikaContext       *context,
                           PikaUIManager     *ui_manager,
                           gint               view_size)
{
  return input_devices_dialog_new (context->pika);
}

GtkWidget *
dialogs_module_get (PikaDialogFactory *factory,
                    PikaContext       *context,
                    PikaUIManager     *ui_manager,
                    gint               view_size)
{
  return module_dialog_new (context->pika);
}

GtkWidget *
dialogs_palette_import_get (PikaDialogFactory *factory,
                            PikaContext       *context,
                            PikaUIManager     *ui_manager,
                            gint               view_size)
{
  return palette_import_dialog_new (context);
}

GtkWidget *
dialogs_tips_get (PikaDialogFactory *factory,
                  PikaContext       *context,
                  PikaUIManager     *ui_manager,
                  gint               view_size)
{
  return tips_dialog_create (context->pika);
}

GtkWidget *
dialogs_welcome_get (PikaDialogFactory *factory,
                     PikaContext       *context,
                     PikaUIManager     *ui_manager,
                     gint               view_size)
{
  return welcome_dialog_create (context->pika);
}

GtkWidget *
dialogs_about_get (PikaDialogFactory *factory,
                   PikaContext       *context,
                   PikaUIManager     *ui_manager,
                   gint               view_size)
{
  return about_dialog_create (context->pika);
}

GtkWidget *
dialogs_action_search_get (PikaDialogFactory *factory,
                           PikaContext       *context,
                           PikaUIManager     *ui_manager,
                           gint               view_size)
{
  return action_search_dialog_create (context->pika);
}

GtkWidget *
dialogs_error_get (PikaDialogFactory *factory,
                   PikaContext       *context,
                   PikaUIManager     *ui_manager,
                   gint               view_size)
{
  return pika_error_dialog_new (_("PIKA Message"));
}

GtkWidget *
dialogs_critical_get (PikaDialogFactory *factory,
                      PikaContext       *context,
                      PikaUIManager     *ui_manager,
                      gint               view_size)
{
  return pika_critical_dialog_new (_("PIKA Debug"),
                                   context->pika->config->last_known_release,
                                   context->pika->config->last_release_timestamp);
}

GtkWidget *
dialogs_close_all_get (PikaDialogFactory *factory,
                       PikaContext       *context,
                       PikaUIManager     *ui_manager,
                       gint               view_size)
{
  return close_all_dialog_new (context->pika);
}

GtkWidget *
dialogs_quit_get (PikaDialogFactory *factory,
                  PikaContext       *context,
                  PikaUIManager     *ui_manager,
                  gint               view_size)
{
  return quit_dialog_new (context->pika);
}


/***********/
/*  docks  */
/***********/

GtkWidget *
dialogs_toolbox_new (PikaDialogFactory *factory,
                     PikaContext       *context,
                     PikaUIManager     *ui_manager,
                     gint               view_size)
{
  return pika_toolbox_new (factory,
                           context,
                           ui_manager);
}

GtkWidget *
dialogs_toolbox_dock_window_new (PikaDialogFactory *factory,
                                 PikaContext       *context,
                                 PikaUIManager     *ui_manager,
                                 gint               view_size)
{
  static gint  role_serial = 1;
  GtkWidget   *dock;
  gchar       *role;

  role = g_strdup_printf ("pika-toolbox-%d", role_serial++);
  dock = pika_dock_window_new (role,
                               "<Toolbox>",
                               TRUE,
                               factory,
                               context);
  g_free (role);

  return dock;
}

GtkWidget *
dialogs_dock_new (PikaDialogFactory *factory,
                  PikaContext       *context,
                  PikaUIManager     *ui_manager,
                  gint               view_size)
{
  return pika_menu_dock_new ();
}

GtkWidget *
dialogs_dock_window_new (PikaDialogFactory *factory,
                         PikaContext       *context,
                         PikaUIManager     *ui_manager,
                         gint               view_size)
{
  static gint  role_serial = 1;
  GtkWidget   *dock;
  gchar       *role;

  role = g_strdup_printf ("pika-dock-%d", role_serial++);
  dock = pika_dock_window_new (role,
                               "<Dock>",
                               FALSE,
                               factory,
                               context);
  g_free (role);

  return dock;
}


/***************/
/*  dockables  */
/***************/

/*****  singleton dialogs  *****/

GtkWidget *
dialogs_tool_options_new (PikaDialogFactory *factory,
                          PikaContext       *context,
                          PikaUIManager     *ui_manager,
                          gint               view_size)
{
  return pika_tool_options_editor_new (context->pika,
                                       menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_device_status_new (PikaDialogFactory *factory,
                           PikaContext       *context,
                           PikaUIManager     *ui_manager,
                           gint               view_size)
{
  return pika_device_status_new (context->pika);
}

GtkWidget *
dialogs_error_console_new (PikaDialogFactory *factory,
                           PikaContext       *context,
                           PikaUIManager     *ui_manager,
                           gint               view_size)
{
  return pika_error_console_new (context->pika,
                                 menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_cursor_view_new (PikaDialogFactory *factory,
                         PikaContext       *context,
                         PikaUIManager     *ui_manager,
                         gint               view_size)
{
  return pika_cursor_view_new (context->pika,
                               menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_dashboard_new (PikaDialogFactory *factory,
                       PikaContext       *context,
                       PikaUIManager     *ui_manager,
                       gint               view_size)
{
  return pika_dashboard_new (context->pika,
                             menus_get_global_menu_factory (context->pika));
}


/*****  list views  *****/

GtkWidget *
dialogs_image_list_view_new (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  return pika_image_view_new (PIKA_VIEW_TYPE_LIST,
                              context->pika->images,
                              context,
                              view_size, 1,
                              menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_brush_list_view_new (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  return pika_brush_factory_view_new (PIKA_VIEW_TYPE_LIST,
                                      context->pika->brush_factory,
                                      context,
                                      TRUE,
                                      view_size, 1,
                                      menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_dynamics_list_view_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_dynamics_factory_view_new (PIKA_VIEW_TYPE_LIST,
                                         context->pika->dynamics_factory,
                                         context,
                                         view_size, 1,
                                         menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_mypaint_brush_list_view_new (PikaDialogFactory *factory,
                                     PikaContext       *context,
                                     PikaUIManager     *ui_manager,
                                     gint               view_size)
{
  return pika_data_factory_view_new (PIKA_VIEW_TYPE_LIST,
                                     context->pika->mybrush_factory,
                                     context,
                                     view_size, 1,
                                     menus_get_global_menu_factory (context->pika),
                                     "<MyPaintBrushes>",
                                     "/mypaint-brushes-popup",
                                     "mypaint-brushes");
}

GtkWidget *
dialogs_pattern_list_view_new (PikaDialogFactory *factory,
                               PikaContext       *context,
                               PikaUIManager     *ui_manager,
                               gint               view_size)
{
  return pika_pattern_factory_view_new (PIKA_VIEW_TYPE_LIST,
                                        context->pika->pattern_factory,
                                        context,
                                        view_size, 1,
                                        menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_gradient_list_view_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_data_factory_view_new (PIKA_VIEW_TYPE_LIST,
                                     context->pika->gradient_factory,
                                     context,
                                     view_size, 1,
                                     menus_get_global_menu_factory (context->pika),
                                     "<Gradients>",
                                     "/gradients-popup",
                                     "gradients");
}

GtkWidget *
dialogs_palette_list_view_new (PikaDialogFactory *factory,
                               PikaContext       *context,
                               PikaUIManager     *ui_manager,
                               gint               view_size)
{
  return pika_data_factory_view_new (PIKA_VIEW_TYPE_LIST,
                                     context->pika->palette_factory,
                                     context,
                                     view_size, 1,
                                     menus_get_global_menu_factory (context->pika),
                                     "<Palettes>",
                                     "/palettes-popup",
                                     "palettes");
}

GtkWidget *
dialogs_font_list_view_new (PikaDialogFactory *factory,
                            PikaContext       *context,
                            PikaUIManager     *ui_manager,
                            gint               view_size)
{
  return pika_font_factory_view_new (PIKA_VIEW_TYPE_LIST,
                                     context->pika->font_factory,
                                     context,
                                     view_size, 1,
                                     menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_buffer_list_view_new (PikaDialogFactory *factory,
                              PikaContext       *context,
                              PikaUIManager     *ui_manager,
                              gint               view_size)
{
  return pika_buffer_view_new (PIKA_VIEW_TYPE_LIST,
                               context->pika->named_buffers,
                               context,
                               view_size, 1,
                               menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_tool_preset_list_view_new (PikaDialogFactory *factory,
                                   PikaContext       *context,
                                   PikaUIManager     *ui_manager,
                                   gint               view_size)
{
  return pika_tool_preset_factory_view_new (PIKA_VIEW_TYPE_LIST,
                                            context->pika->tool_preset_factory,
                                            context,
                                            view_size, 1,
                                            menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_document_list_view_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_document_view_new (PIKA_VIEW_TYPE_LIST,
                                 context->pika->documents,
                                 context,
                                 view_size, 0,
                                 menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_template_list_view_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_template_view_new (PIKA_VIEW_TYPE_LIST,
                                 context->pika->templates,
                                 context,
                                 view_size, 0,
                                 menus_get_global_menu_factory (context->pika));
}


/*****  grid views  *****/

GtkWidget *
dialogs_image_grid_view_new (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  return pika_image_view_new (PIKA_VIEW_TYPE_GRID,
                              context->pika->images,
                              context,
                              view_size, 1,
                              menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_brush_grid_view_new (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  return pika_brush_factory_view_new (PIKA_VIEW_TYPE_GRID,
                                      context->pika->brush_factory,
                                      context,
                                      TRUE,
                                      view_size, 1,
                                      menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_dynamics_grid_view_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_dynamics_factory_view_new (PIKA_VIEW_TYPE_GRID,
                                         context->pika->dynamics_factory,
                                         context,
                                         view_size, 1,
                                         menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_mypaint_brush_grid_view_new (PikaDialogFactory *factory,
                                     PikaContext       *context,
                                     PikaUIManager     *ui_manager,
                                     gint               view_size)
{
  return pika_data_factory_view_new (PIKA_VIEW_TYPE_GRID,
                                     context->pika->mybrush_factory,
                                     context,
                                     view_size, 1,
                                     menus_get_global_menu_factory (context->pika),
                                     "<MyPaintBrushes>",
                                     "/mypaint-brushes-popup",
                                     "mypaint-brushes");
}

GtkWidget *
dialogs_pattern_grid_view_new (PikaDialogFactory *factory,
                               PikaContext       *context,
                               PikaUIManager     *ui_manager,
                               gint               view_size)
{
  return pika_pattern_factory_view_new (PIKA_VIEW_TYPE_GRID,
                                        context->pika->pattern_factory,
                                        context,
                                        view_size, 1,
                                        menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_gradient_grid_view_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_data_factory_view_new (PIKA_VIEW_TYPE_GRID,
                                     context->pika->gradient_factory,
                                     context,
                                     view_size, 1,
                                     menus_get_global_menu_factory (context->pika),
                                     "<Gradients>",
                                     "/gradients-popup",
                                     "gradients");
}

GtkWidget *
dialogs_palette_grid_view_new (PikaDialogFactory *factory,
                               PikaContext       *context,
                               PikaUIManager     *ui_manager,
                               gint               view_size)
{
  return pika_data_factory_view_new (PIKA_VIEW_TYPE_GRID,
                                     context->pika->palette_factory,
                                     context,
                                     view_size, 1,
                                     menus_get_global_menu_factory (context->pika),
                                     "<Palettes>",
                                     "/palettes-popup",
                                     "palettes");
}

GtkWidget *
dialogs_font_grid_view_new (PikaDialogFactory *factory,
                            PikaContext       *context,
                            PikaUIManager     *ui_manager,
                            gint               view_size)
{
  return pika_font_factory_view_new (PIKA_VIEW_TYPE_GRID,
                                     context->pika->font_factory,
                                     context,
                                     view_size, 1,
                                     menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_buffer_grid_view_new (PikaDialogFactory *factory,
                              PikaContext       *context,
                              PikaUIManager     *ui_manager,
                              gint               view_size)
{
  return pika_buffer_view_new (PIKA_VIEW_TYPE_GRID,
                               context->pika->named_buffers,
                               context,
                               view_size, 1,
                               menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_tool_preset_grid_view_new (PikaDialogFactory *factory,
                                   PikaContext       *context,
                                   PikaUIManager     *ui_manager,
                                   gint               view_size)
{
  return pika_tool_preset_factory_view_new (PIKA_VIEW_TYPE_GRID,
                                            context->pika->tool_preset_factory,
                                            context,
                                            view_size, 1,
                                            menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_document_grid_view_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_document_view_new (PIKA_VIEW_TYPE_GRID,
                                 context->pika->documents,
                                 context,
                                 view_size, 0,
                                 menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_template_grid_view_new (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_template_view_new (PIKA_VIEW_TYPE_GRID,
                                 context->pika->templates,
                                 context,
                                 view_size, 0,
                                 menus_get_global_menu_factory (context->pika));
}


/*****  image related dialogs  *****/

GtkWidget *
dialogs_layer_list_view_new (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  if (view_size < 1)
    view_size = context->pika->config->layer_preview_size;

  return pika_item_tree_view_new (PIKA_TYPE_LAYER_TREE_VIEW,
                                  view_size, 2, TRUE,
                                  pika_context_get_image (context),
                                  menus_get_global_menu_factory (context->pika),
                                  "<Layers>",
                                  "/layers-popup");
}

GtkWidget *
dialogs_channel_list_view_new (PikaDialogFactory *factory,
                               PikaContext       *context,
                               PikaUIManager     *ui_manager,
                               gint               view_size)
{
  if (view_size < 1)
    view_size = context->pika->config->layer_preview_size;

  return pika_item_tree_view_new (PIKA_TYPE_CHANNEL_TREE_VIEW,
                                  view_size, 1, TRUE,
                                  pika_context_get_image (context),
                                  menus_get_global_menu_factory (context->pika),
                                  "<Channels>",
                                  "/channels-popup");
}

GtkWidget *
dialogs_vectors_list_view_new (PikaDialogFactory *factory,
                               PikaContext       *context,
                               PikaUIManager     *ui_manager,
                               gint               view_size)
{
  if (view_size < 1)
    view_size = context->pika->config->layer_preview_size;

  return pika_item_tree_view_new (PIKA_TYPE_VECTORS_TREE_VIEW,
                                  view_size, 1, TRUE,
                                  pika_context_get_image (context),
                                  menus_get_global_menu_factory (context->pika),
                                  "<Vectors>",
                                  "/vectors-popup");
}

GtkWidget *
dialogs_colormap_editor_new (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  return pika_colormap_editor_new (menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_histogram_editor_new (PikaDialogFactory *factory,
                              PikaContext       *context,
                              PikaUIManager     *ui_manager,
                              gint               view_size)
{
  return pika_histogram_editor_new ();
}

GtkWidget *
dialogs_selection_editor_new (PikaDialogFactory *factory,
                              PikaContext       *context,
                              PikaUIManager     *ui_manager,
                              gint               view_size)
{
  return pika_selection_editor_new (menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_symmetry_editor_new (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  return pika_symmetry_editor_new (menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_undo_editor_new (PikaDialogFactory *factory,
                         PikaContext       *context,
                         PikaUIManager     *ui_manager,
                         gint               view_size)
{
  return pika_undo_editor_new (context->pika->config,
                               menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_sample_point_editor_new (PikaDialogFactory *factory,
                                 PikaContext       *context,
                                 PikaUIManager     *ui_manager,
                                 gint               view_size)
{
  return pika_sample_point_editor_new (menus_get_global_menu_factory (context->pika));
}


/*****  display related dialogs  *****/

GtkWidget *
dialogs_navigation_editor_new (PikaDialogFactory *factory,
                               PikaContext       *context,
                               PikaUIManager     *ui_manager,
                               gint               view_size)
{
  return pika_navigation_editor_new (menus_get_global_menu_factory (context->pika));
}


/*****  misc dockables  *****/

GtkWidget *
dialogs_color_editor_new (PikaDialogFactory *factory,
                          PikaContext       *context,
                          PikaUIManager     *ui_manager,
                          gint               view_size)
{
  return pika_color_editor_new (context);
}


/*************/
/*  editors  */
/*************/

GtkWidget *
dialogs_brush_editor_get (PikaDialogFactory *factory,
                          PikaContext       *context,
                          PikaUIManager     *ui_manager,
                          gint               view_size)
{
  return pika_brush_editor_new (context,
                                menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_dynamics_editor_get (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  return pika_dynamics_editor_new (context,
                                   menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_gradient_editor_get (PikaDialogFactory *factory,
                             PikaContext       *context,
                             PikaUIManager     *ui_manager,
                             gint               view_size)
{
  return pika_gradient_editor_new (context,
                                   menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_palette_editor_get (PikaDialogFactory *factory,
                            PikaContext       *context,
                            PikaUIManager     *ui_manager,
                            gint               view_size)
{
  return pika_palette_editor_new (context,
                                  menus_get_global_menu_factory (context->pika));
}

GtkWidget *
dialogs_tool_preset_editor_get (PikaDialogFactory *factory,
                                PikaContext       *context,
                                PikaUIManager     *ui_manager,
                                gint               view_size)
{
  return pika_tool_preset_editor_new (context,
                                      menus_get_global_menu_factory (context->pika));
}
