2008-01-28 21:08:35 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* 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 2 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
1999-08-26 22:29:37 +00:00
|
|
|
#include "config.h"
|
2000-04-30 18:17:55 +00:00
|
|
|
|
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
|
|
|
|
1999-08-26 22:29:37 +00:00
|
|
|
#include "gimpressionist.h"
|
2004-07-02 13:31:25 +00:00
|
|
|
/*
|
2004-07-05 16:50:46 +00:00
|
|
|
* The Page Specific Imports
|
2004-07-02 13:31:25 +00:00
|
|
|
* */
|
2004-07-05 16:50:46 +00:00
|
|
|
#include "brush.h"
|
2004-07-02 13:31:25 +00:00
|
|
|
#include "color.h"
|
|
|
|
#include "general.h"
|
2004-07-23 19:34:47 +00:00
|
|
|
#include "orientation.h"
|
2004-07-29 18:41:47 +00:00
|
|
|
#include "orientmap.h"
|
2004-07-02 13:31:25 +00:00
|
|
|
#include "placement.h"
|
|
|
|
#include "preview.h"
|
|
|
|
#include "size.h"
|
2004-07-13 19:38:59 +00:00
|
|
|
#include "paper.h"
|
2004-07-06 14:17:17 +00:00
|
|
|
#include "presets.h"
|
2004-07-02 13:31:25 +00:00
|
|
|
|
1999-08-26 22:29:37 +00:00
|
|
|
#include "ppmtool.h"
|
2000-04-30 18:17:55 +00:00
|
|
|
|
2003-10-24 20:57:29 +00:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1999-10-25 19:20:41 +00:00
|
|
|
|
2003-10-24 21:50:25 +00:00
|
|
|
|
2005-09-09 18:07:31 +00:00
|
|
|
static GtkWidget *dialog = NULL;
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
void
|
|
|
|
store_values (void)
|
1999-08-26 22:29:37 +00:00
|
|
|
{
|
2004-07-14 13:28:01 +00:00
|
|
|
paper_store ();
|
|
|
|
brush_store ();
|
|
|
|
general_store ();
|
1999-08-26 22:29:37 +00:00
|
|
|
}
|
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
void
|
|
|
|
restore_values (void)
|
1999-08-26 22:29:37 +00:00
|
|
|
{
|
2004-07-14 13:28:01 +00:00
|
|
|
brush_restore ();
|
|
|
|
paper_restore ();
|
|
|
|
orientation_restore ();
|
|
|
|
size_restore ();
|
|
|
|
place_restore ();
|
|
|
|
general_restore ();
|
|
|
|
color_restore ();
|
|
|
|
|
|
|
|
update_orientmap_dialog ();
|
1999-08-26 22:29:37 +00:00
|
|
|
}
|
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
GtkWidget *
|
|
|
|
create_one_column_list (GtkWidget *parent,
|
|
|
|
void (*changed_cb) (GtkTreeSelection *selection,
|
|
|
|
gpointer data))
|
2002-12-17 20:18:16 +00:00
|
|
|
{
|
2004-09-02 23:28:44 +00:00
|
|
|
GtkListStore *store;
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
GtkCellRenderer *renderer;
|
2002-12-17 20:18:16 +00:00
|
|
|
GtkTreeViewColumn *column;
|
2004-09-02 23:28:44 +00:00
|
|
|
GtkWidget *swin, *view;
|
2002-12-17 20:18:16 +00:00
|
|
|
|
|
|
|
swin = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
|
2004-07-02 13:31:25 +00:00
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
2004-09-02 23:28:44 +00:00
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin),
|
2004-07-02 13:31:25 +00:00
|
|
|
GTK_SHADOW_IN);
|
2002-12-17 20:18:16 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (parent), swin, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (swin);
|
2004-09-02 23:28:44 +00:00
|
|
|
gtk_widget_set_size_request (swin, 150,-1);
|
2002-12-17 20:18:16 +00:00
|
|
|
|
|
|
|
store = gtk_list_store_new (1, G_TYPE_STRING);
|
|
|
|
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
|
|
|
|
|
|
|
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
|
2003-01-07 06:16:02 +00:00
|
|
|
g_object_unref (store);
|
2002-12-17 20:18:16 +00:00
|
|
|
gtk_widget_show (view);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
|
|
|
column = gtk_tree_view_column_new_with_attributes ("Preset", renderer,
|
2004-07-02 13:31:25 +00:00
|
|
|
"text", 0,
|
|
|
|
NULL);
|
2002-12-17 20:18:16 +00:00
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (swin), view);
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
|
|
|
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
2004-09-02 23:28:44 +00:00
|
|
|
g_signal_connect (selection, "changed", G_CALLBACK (changed_cb), NULL);
|
2002-12-17 20:18:16 +00:00
|
|
|
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
2003-11-06 15:27:05 +00:00
|
|
|
static void
|
|
|
|
dialog_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data)
|
1999-08-26 22:29:37 +00:00
|
|
|
{
|
2003-11-06 15:27:05 +00:00
|
|
|
switch (response_id)
|
2000-04-30 18:17:55 +00:00
|
|
|
{
|
2003-11-06 15:27:05 +00:00
|
|
|
case GTK_RESPONSE_OK:
|
2004-07-14 13:28:01 +00:00
|
|
|
store_values ();
|
2003-11-06 15:27:05 +00:00
|
|
|
pcvals.run = TRUE;
|
|
|
|
gtk_widget_destroy (widget);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
gtk_widget_destroy (widget);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-04-30 18:17:55 +00:00
|
|
|
|
2003-11-06 15:27:05 +00:00
|
|
|
static GtkWidget *
|
|
|
|
create_dialog (void)
|
|
|
|
{
|
|
|
|
GtkWidget *notebook;
|
2004-05-25 15:27:46 +00:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *preview_box;
|
2000-04-30 18:17:55 +00:00
|
|
|
|
2008-08-11 19:42:08 +00:00
|
|
|
gimp_ui_init (PLUG_IN_BINARY, TRUE);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2008-08-11 19:42:08 +00:00
|
|
|
dialog = gimp_dialog_new (_("GIMPressionist"), PLUG_IN_BINARY,
|
2005-09-09 18:07:31 +00:00
|
|
|
NULL, 0,
|
2008-08-11 19:42:08 +00:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2005-09-09 18:07:31 +00:00
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
2003-10-24 21:50:25 +00:00
|
|
|
|
2005-09-09 18:07:31 +00:00
|
|
|
NULL);
|
2002-11-19 20:25:57 +00:00
|
|
|
|
2005-09-09 18:07:31 +00:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
2005-09-05 21:40:29 +00:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
2005-09-09 18:07:31 +00:00
|
|
|
gimp_window_set_transient (GTK_WINDOW (dialog));
|
2005-02-08 20:40:33 +00:00
|
|
|
|
2005-09-09 18:07:31 +00:00
|
|
|
g_signal_connect (dialog, "response",
|
2003-11-06 15:27:05 +00:00
|
|
|
G_CALLBACK (dialog_response),
|
|
|
|
NULL);
|
2005-09-09 18:07:31 +00:00
|
|
|
g_signal_connect (dialog, "destroy",
|
2003-11-06 15:27:05 +00:00
|
|
|
G_CALLBACK (gtk_main_quit),
|
|
|
|
NULL);
|
2002-11-19 20:25:57 +00:00
|
|
|
|
2004-05-25 15:27:46 +00:00
|
|
|
hbox = gtk_hbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
2005-09-09 18:07:31 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
2004-05-25 15:27:46 +00:00
|
|
|
gtk_widget_show (hbox);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-05-25 15:27:46 +00:00
|
|
|
preview_box = create_preview ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), preview_box, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (preview_box);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
|
|
|
notebook = gtk_notebook_new ();
|
2004-05-25 15:27:46 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 5);
|
2004-09-02 23:28:44 +00:00
|
|
|
gtk_widget_show (notebook);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2003-11-06 15:27:05 +00:00
|
|
|
create_presetpage (GTK_NOTEBOOK (notebook));
|
|
|
|
create_paperpage (GTK_NOTEBOOK (notebook));
|
|
|
|
create_brushpage (GTK_NOTEBOOK (notebook));
|
|
|
|
create_orientationpage (GTK_NOTEBOOK (notebook));
|
|
|
|
create_sizepage (GTK_NOTEBOOK (notebook));
|
|
|
|
create_placementpage (GTK_NOTEBOOK (notebook));
|
|
|
|
create_colorpage (GTK_NOTEBOOK (notebook));
|
|
|
|
create_generalpage (GTK_NOTEBOOK (notebook));
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-11-14 02:50:33 +00:00
|
|
|
updatepreview (NULL, NULL);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-07-05 16:50:46 +00:00
|
|
|
/*
|
|
|
|
* This is to make sure the values from the pcvals will be reflected
|
|
|
|
* in the GUI here. Otherwise they will be set to the defaults.
|
|
|
|
* */
|
2004-07-14 13:28:01 +00:00
|
|
|
restore_values ();
|
2004-07-05 16:50:46 +00:00
|
|
|
|
2005-09-09 18:07:31 +00:00
|
|
|
gtk_widget_show (dialog);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2005-09-09 18:07:31 +00:00
|
|
|
return dialog;
|
1999-08-26 22:29:37 +00:00
|
|
|
}
|
|
|
|
|
2003-11-06 15:27:05 +00:00
|
|
|
gint
|
|
|
|
create_gimpressionist (void)
|
1999-08-26 22:29:37 +00:00
|
|
|
{
|
2003-11-06 15:27:05 +00:00
|
|
|
pcvals.run = FALSE;
|
|
|
|
|
|
|
|
create_dialog ();
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2002-11-19 20:25:57 +00:00
|
|
|
gtk_main ();
|
1999-08-26 22:29:37 +00:00
|
|
|
|
|
|
|
return pcvals.run;
|
|
|
|
}
|