Commit 23ee66f7 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

plug-ins/gimpressionist/gimpressionist.[ch]

2005-10-06  Sven Neumann  <sven@gimp.org>

	* plug-ins/gimpressionist/gimpressionist.[ch]
	* plug-ins/gimpressionist/orientation.c
	* plug-ins/gimpressionist/orientmap.[ch]
	* plug-ins/gimpressionist/placement.c
	* plug-ins/gimpressionist/presets.c
	* plug-ins/gimpressionist/preview.c
	* plug-ins/gimpressionist/repaint.c
	* plug-ins/gimpressionist/size.c
	* plug-ins/gimpressionist/sizemap.c: various minor improvements
	like setting all dialogs transient to the main window.
parent ac93e670
2005-10-06 Sven Neumann <sven@gimp.org>
* plug-ins/gimpressionist/gimpressionist.[ch]
* plug-ins/gimpressionist/orientation.c
* plug-ins/gimpressionist/orientmap.[ch]
* plug-ins/gimpressionist/placement.c
* plug-ins/gimpressionist/presets.c
* plug-ins/gimpressionist/preview.c
* plug-ins/gimpressionist/repaint.c
* plug-ins/gimpressionist/size.c
* plug-ins/gimpressionist/sizemap.c: various minor improvements
like setting all dialogs transient to the main window.
2005-10-06 Sven Neumann <sven@gimp.org>
* plug-ins/gimpressionist/presets.c
......
......@@ -96,7 +96,7 @@ create_one_column_list (GtkWidget *parent,
}
static void
show_about (void)
show_about (GtkWidget *parent)
{
static GtkWidget *window = NULL;
......@@ -114,9 +114,9 @@ show_about (void)
}
window =
gimp_dialog_new (_("The GIMPressionist"), "gimpressionist",
NULL, 0,
gimp_standard_help_func, HELP_ID,
gimp_dialog_new (_("About GIMPressionist"), "gimpressionist",
gtk_widget_get_toplevel (parent), 0,
gimp_standard_help_func, NULL,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
......@@ -169,7 +169,7 @@ dialog_response (GtkWidget *widget,
switch (response_id)
{
case RESPONSE_ABOUT:
show_about ();
show_about (widget);
break;
case GTK_RESPONSE_OK:
......@@ -193,9 +193,9 @@ create_dialog (void)
gimp_ui_init ("gimpressionist", TRUE);
dialog = gimp_dialog_new (_("Gimpressionist"), "gimpressionist",
dialog = gimp_dialog_new (_("GIMPressionist"), "gimpressionist",
NULL, 0,
gimp_standard_help_func, HELP_ID,
gimp_standard_help_func, PLUG_IN_NAME,
GTK_STOCK_ABOUT, RESPONSE_ABOUT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......
......@@ -9,9 +9,8 @@
#include "ppmtool.h"
/* Defines */
#define PLUG_IN_NAME "plug_in_gimpressionist"
#define PLUG_IN_NAME "plug-in-gimpressionist"
#define PLUG_IN_VERSION "v1.0, November 2003"
#define HELP_ID "plug-in-gimppressionist"
#define PREVIEWSIZE 150
#define MAXORIENTVECT 50
......@@ -128,14 +127,14 @@ void readdirintolist_extended (char *subdir, GtkWidget *view, char *selected,
GtkWidget *create_one_column_list (GtkWidget *parent,
void (*changed_cb)
(GtkTreeSelection *selection,
(GtkTreeSelection *selection,
gpointer data));
void brush_reload (const gchar *fn, struct ppm *p);
double get_direction (double x, double y, int from);
void create_sizemap_dialog (void);
void create_sizemap_dialog (GtkWidget *parent);
double getsiz_proto (double x, double y, int n, smvector_t *vec,
double smstrexp, int voronoi);
......
......@@ -45,11 +45,11 @@ void orientation_restore (void)
}
static void
create_orientmap_dialog_helper (void)
create_orientmap_dialog_helper (GtkWidget *widget)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (orient_radio[7]), TRUE);
create_orientmap_dialog ();
create_orientmap_dialog (widget);
}
......
......@@ -487,7 +487,7 @@ update_orientmap_dialog (void)
}
void
create_orientmap_dialog (void)
create_orientmap_dialog (GtkWidget *parent)
{
GtkWidget *tmpw, *tmpw2;
GtkWidget *table1, *table2;
......@@ -506,8 +506,8 @@ create_orientmap_dialog (void)
orient_map_window =
gimp_dialog_new (_("Orientation Map Editor"), "gimpressionist",
NULL, 0,
gimp_standard_help_func, HELP_ID,
gtk_widget_get_toplevel (parent), 0,
gimp_standard_help_func, PLUG_IN_NAME,
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......@@ -530,7 +530,8 @@ create_orientmap_dialog (void)
table1 = gtk_table_new (2, 5, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table1), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (orient_map_window)->vbox), table1);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (orient_map_window)->vbox),
table1);
gtk_widget_show (table1);
frame = gtk_frame_new (_("Vectors"));
......
#ifndef __ORIENTMAP_H
#define __ORIENTMAP_H
void create_orientmap_dialog (void);
void create_orientmap_dialog (GtkWidget *parent);
void update_orientmap_dialog (void);
void orientation_map_free_resources(void);
......
......@@ -81,6 +81,17 @@ create_placementpage (GtkNotebook *notebook)
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (placement_radio[pcvals.place_type]), TRUE);
placement_center = gtk_check_button_new_with_mnemonic ( _("Centered"));
tmpw = placement_center;
gtk_box_pack_start (GTK_BOX (vbox), tmpw, FALSE, FALSE, 0);
gtk_widget_show (tmpw);
gimp_help_set_help_data
(tmpw, _("Focus the brush strokes around the center of the image"), NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tmpw),
pcvals.placement_center);
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
......@@ -98,15 +109,5 @@ create_placementpage (GtkNotebook *notebook)
G_CALLBACK (gimp_double_adjustment_update),
&pcvals.brush_density);
placement_center = gtk_check_button_new_with_mnemonic ( _("Centerize"));
tmpw = placement_center;
gtk_box_pack_start (GTK_BOX (vbox), tmpw, FALSE, FALSE, 0);
gtk_widget_show (tmpw);
gimp_help_set_help_data
(tmpw, _("Focus the brush strokes around the center of the image"), NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tmpw),
pcvals.placement_center);
gtk_notebook_append_page_menu (notebook, vbox, label, NULL);
}
......@@ -608,7 +608,7 @@ save_preset_response (GtkWidget *widget,
}
static void
create_save_preset (void)
create_save_preset (GtkWidget *parent)
{
static GtkWidget *window = NULL;
GtkWidget *box, *label;
......@@ -623,8 +623,8 @@ create_save_preset (void)
window =
gimp_dialog_new (_("Save Current"), "gimpressionist",
NULL, 0,
gimp_standard_help_func, HELP_ID,
gtk_widget_get_toplevel (parent), 0,
gimp_standard_help_func, PLUG_IN_NAME,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
......@@ -899,8 +899,9 @@ read_description (const char *fn)
}
}
static void presets_list_select_preset (GtkTreeSelection *selection,
gpointer data)
static void
presets_list_select_preset (GtkTreeSelection *selection,
gpointer data)
{
GtkTreeIter iter;
GtkTreeModel *model;
......@@ -914,9 +915,11 @@ static void presets_list_select_preset (GtkTreeSelection *selection,
&preset_name, -1);
gtk_tree_model_get (model, &iter, PRESETS_LIST_COLUMN_FILENAME,
&preset_filename, -1);
/* TODO : Maybe make the factory defaults behavior in regards
* to the preset's object name and filename more robust?
* */
*
*/
if (strcmp (preset_filename, factory_defaults))
{
gtk_entry_set_text (GTK_ENTRY (presetnameentry), preset_name);
......@@ -925,7 +928,9 @@ static void presets_list_select_preset (GtkTreeSelection *selection,
selected_preset_orig_name = g_strdup (preset_name);
selected_preset_filename = g_strdup (selected_preset_filename);
}
read_description (preset_filename);
g_free (preset_name);
g_free (preset_filename);
}
......@@ -948,7 +953,7 @@ create_presets_list (GtkWidget *parent)
GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (parent), swin, FALSE, FALSE, 0);
gtk_widget_show (swin);
gtk_widget_set_size_request (swin, 150,-1);
gtk_widget_set_size_request (swin, 200, -1);
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
......@@ -999,7 +1004,7 @@ create_presetpage (GtkNotebook *notebook)
presetnameentry = tmpw = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (box1), tmpw, FALSE, FALSE, 0);
gtk_widget_set_size_request (tmpw, 150, -1);
gtk_widget_set_size_request (tmpw, 200, -1);
gtk_widget_show (tmpw);
presetsavebutton = tmpw = gtk_button_new_with_label ( _("Save Current..."));
......@@ -1055,7 +1060,7 @@ create_presetpage (GtkNotebook *notebook)
* Make sure the label's width is reasonable and it won't stretch
* the dialog more than its width.
* */
gtk_widget_set_size_request (tmpw, 200, -1);
gtk_widget_set_size_request (tmpw, 240, -1);
gtk_misc_set_alignment (GTK_MISC (tmpw), 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (vbox), tmpw, TRUE, TRUE, 0);
......
......@@ -17,9 +17,13 @@
static GtkWidget *preview = NULL;
static GtkWidget *previewbutton = NULL;
void preview_set_button_label (gchar * text)
void
preview_set_button_label (const gchar *text)
{
gtk_label_set_text (GTK_LABEL (GTK_BIN (previewbutton)->child), text);
g_object_set (previewbutton,
"label", text,
"use-underline", TRUE,
NULL);
}
static void
......
......@@ -222,6 +222,9 @@ apply_brush (ppm_t *brush,
int shadowdepth = pcvals.general_shadow_depth;
int shadowblur = pcvals.general_shadow_blur;
atmp.col = 0;
atmp.width = 0;
tmp = *p;
if (img_has_alpha)
atmp = *a;
......@@ -1045,9 +1048,11 @@ repaint (ppm_t *p, ppm_t *a)
if (doy)
{
if (dox < 0)
apply_brush (brush, shadow, &tmp, &atmp, tx+orig_width,ty+doy*orig_height,r,g,b);
apply_brush (brush, shadow, &tmp, &atmp,
tx+orig_width, ty + doy * orig_height, r, g, b);
if (dox > 0)
apply_brush (brush, shadow, &tmp, &atmp, tx-orig_width,ty+doy*orig_height,r,g,b);
apply_brush (brush, shadow, &tmp, &atmp,
tx-orig_width, ty + doy * orig_height, r, g, b);
}
}
}
......@@ -1151,13 +1156,15 @@ repaint (ppm_t *p, ppm_t *a)
ppm_kill (&paper_ppm);
ppm_kill (&dirmap);
ppm_kill (&sizmap);
if (runningvals.run)
{
gimp_progress_update (0.8);
}
else
{
preview_set_button_label (_("Update"));
preview_set_button_label (_("_Update"));
}
running = 0;
}
......@@ -50,10 +50,10 @@ size_restore (void)
}
static void
create_sizemap_dialog_helper (void)
create_sizemap_dialog_helper (GtkWidget *widget)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sizeradio[7]), TRUE);
create_sizemap_dialog ();
create_sizemap_dialog (widget);
}
static void
......
......@@ -362,7 +362,7 @@ update_sizemap_dialog (void)
#endif
void
create_sizemap_dialog (void)
create_sizemap_dialog (GtkWidget *parent)
{
GtkWidget *tmpw, *tmpw2;
GtkWidget *table1;
......@@ -381,8 +381,8 @@ create_sizemap_dialog (void)
smwindow =
gimp_dialog_new (_("Size Map Editor"), "gimpressionist",
NULL, 0,
gimp_standard_help_func, HELP_ID,
gtk_widget_get_toplevel (parent), 0,
gimp_standard_help_func, PLUG_IN_NAME,
GTK_STOCK_APPLY, RESPONSE_APPLY,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment