Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
ea2dd584
Commit
ea2dd584
authored
Nov 19, 2002
by
Maurits Rijk
Browse files
Lots of code clean-up. GIMPressionist now more or less has the same look and
feel as other plug-ins (#81963)
parent
6049528e
Changes
19
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
ea2dd584
2002-11-19 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/gimpressionist/brush.c
* plug-ins/gimpressionist/color.c
* plug-ins/gimpressionist/general.c
* plug-ins/gimpressionist/gimp.c
* plug-ins/gimpressionist/gimpressionist.[ch]
* plug-ins/gimpressionist/orientation.c
* plug-ins/gimpressionist/orientmap.c
* plug-ins/gimpressionist/paper.c
* plug-ins/gimpressionist/placement.c
* plug-ins/gimpressionist/plasma.c
* plug-ins/gimpressionist/ppmtool.[ch]
* 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: lots and lots of changes.
gimpressionist now looks more or less like other plug-ins, using
gimp_scale widgets for data entry, the gimp_color_button for color
selection, the OK and Cancel button at the bottom, etc. There are still
a few things left to do, mostly more code clean-up.
2002-11-19 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimppatheditor.[ch]: added new function
...
...
plug-ins/gimpressionist/brush.c
View file @
ea2dd584
...
...
@@ -29,27 +29,25 @@
GtkWidget
*
brushlist
=
NULL
;
GtkWidget
*
brushprev
=
NULL
;
static
GtkWidget
*
brushprev
=
NULL
;
GtkObject
*
brushreliefadjust
=
NULL
;
GtkObject
*
brushaspectadjust
=
NULL
;
GtkObject
*
brushgammaadjust
=
NULL
;
GtkWidget
*
brushdrawablemenu
=
NULL
;
GtkWidget
*
brushemptyitem
;
static
GtkWidget
*
brushemptyitem
;
gint32
brushdrawableid
;
int
brushfile
=
2
;
struct
ppm
brushppm
=
{
0
,
0
,
NULL
};
ppm
_t
brushppm
=
{
0
,
0
,
NULL
};
void
updatebrushprev
(
char
*
fn
);
static
void
updatebrushprev
(
char
*
fn
);
int
colorfile
(
char
*
fn
)
static
gboolean
colorfile
(
char
*
fn
)
{
if
(
!
fn
)
return
0
;
if
(
strstr
(
fn
,
".ppm"
))
return
1
;
return
0
;
return
fn
&&
strstr
(
fn
,
".ppm"
);
}
void
brushdmenuselect
(
gint32
id
,
gpointer
data
)
...
...
@@ -59,7 +57,7 @@ void brushdmenuselect(gint32 id, gpointer data)
guchar
*
src
;
gint
alpha
,
has_alpha
,
bpp
;
gint
x
,
y
;
struct
ppm
*
p
;
ppm
_t
*
p
;
gint
x1
,
y1
,
x2
,
y2
;
gint
row
,
col
;
GimpDrawable
*
drawable
;
...
...
@@ -225,10 +223,10 @@ gint validdrawable(gint32 imageid, gint32 drawableid, gpointer data)
return
(
gimp_drawable_is_rgb
(
drawableid
)
||
gimp_drawable_is_gray
(
drawableid
));
}
void
reloadbrush
(
char
*
fn
,
struct
ppm
*
p
)
void
reloadbrush
(
char
*
fn
,
ppm
_t
*
p
)
{
static
char
lastfn
[
200
]
=
""
;
static
struct
ppm
cache
=
{
0
,
0
,
NULL
};
static
ppm
_t
cache
=
{
0
,
0
,
NULL
};
if
(
strcmp
(
fn
,
lastfn
))
{
strncpy
(
lastfn
,
fn
,
199
);
...
...
@@ -238,7 +236,7 @@ void reloadbrush(char *fn, struct ppm *p)
pcvals
.
colorbrushes
=
colorfile
(
fn
);
}
void
padbrush
(
struct
ppm
*
p
,
int
width
,
int
height
)
static
void
padbrush
(
ppm
_t
*
p
,
int
width
,
int
height
)
{
guchar
black
[
3
]
=
{
0
,
0
,
0
};
int
left
=
(
width
-
p
->
width
)
/
2
;
...
...
@@ -256,14 +254,14 @@ void updatebrushprev(char *fn)
if
(
fn
)
brushfile
=
1
;
if
(
!
fn
&&
brushfile
)
{
if
(
!
fn
&&
brushfile
)
{
memset
(
buf
,
0
,
100
);
for
(
i
=
0
;
i
<
100
;
i
++
)
{
gtk_preview_draw_row
(
GTK_PREVIEW
(
brushprev
),
buf
,
0
,
i
,
100
);
}
}
else
{
double
sc
;
struct
ppm
p
=
{
0
,
0
,
NULL
};
ppm
_t
p
=
{
0
,
0
,
NULL
};
guchar
gammatable
[
256
];
int
newheight
;
...
...
@@ -286,7 +284,7 @@ void updatebrushprev(char *fn)
sc
=
p
.
width
>
newheight
?
p
.
width
:
newheight
;
sc
=
100
.
0
/
sc
;
resize_fast
(
&
p
,
p
.
width
*
sc
,
newheight
*
sc
);
padbrush
(
&
p
,
100
,
100
);
padbrush
(
&
p
,
100
,
100
);
for
(
i
=
0
;
i
<
100
;
i
++
)
{
int
k
=
i
*
p
.
width
*
3
;
memset
(
buf
,
0
,
100
);
...
...
@@ -300,7 +298,7 @@ void updatebrushprev(char *fn)
gtk_widget_queue_draw
(
brushprev
);
}
int
brushdontupdate
=
0
;
static
gboolean
brushdontupdate
=
FALSE
;
void
selectbrush
(
GtkWidget
*
wg
,
GtkWidget
*
p
)
{
...
...
@@ -310,9 +308,9 @@ void selectbrush(GtkWidget *wg, GtkWidget *p)
static
char
*
oldl
=
NULL
;
static
char
fname
[
200
];
if
(
brushdontupdate
)
return
;
if
(
brushdontupdate
)
return
;
if
(
brushfile
==
0
)
{
if
(
brushfile
==
0
)
{
updatebrushprev
(
NULL
);
return
;
}
...
...
@@ -332,11 +330,11 @@ void selectbrush(GtkWidget *wg, GtkWidget *p)
if
(
!
tmpw
)
return
;
l
=
(
gchar
*
)
gtk_label_get_text
(
GTK_LABEL
(
GTK_BIN
(
tmpw
)
->
child
));
if
(
oldl
)
if
(
strcmp
(
oldl
,
l
))
{
brushdontupdate
=
1
;
if
(
oldl
&&
strcmp
(
oldl
,
l
))
{
brushdontupdate
=
TRUE
;
gtk_adjustment_set_value
(
GTK_ADJUSTMENT
(
brushgammaadjust
),
1
.
0
);
gtk_adjustment_set_value
(
GTK_ADJUSTMENT
(
brushaspectadjust
),
0
.
0
);
brushdontupdate
=
0
;
brushdontupdate
=
FALSE
;
}
oldl
=
l
;
...
...
@@ -346,7 +344,7 @@ void selectbrush(GtkWidget *wg, GtkWidget *p)
updatebrushprev
(
fname
);
}
void
selectbrushfile
(
GtkWidget
*
wg
,
GtkWidget
*
p
)
static
void
selectbrushfile
(
GtkWidget
*
wg
,
GtkWidget
*
p
)
{
brushfile
=
1
;
if
(
GTK_IS_WIDGET
(
presetsavebutton
))
...
...
@@ -357,20 +355,12 @@ void selectbrushfile(GtkWidget *wg, GtkWidget *p)
void
create_brushpage
(
GtkNotebook
*
notebook
)
{
GtkWidget
*
box1
,
*
box2
,
*
box3
,
*
thispage
;
GtkWidget
*
labelbox
,
*
menubox
;
GtkWidget
*
scrolled_win
,
*
list
;
GtkWidget
*
tmpw
;
GtkWidget
*
tmpw
,
*
table
;
GtkWidget
*
dmenu
;
GtkWidget
*
label
;
labelbox
=
gtk_hbox_new
(
FALSE
,
0
);
tmpw
=
gtk_label_new
(
_
(
"Brush"
));
gtk_box_pack_start
(
GTK_BOX
(
labelbox
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show_all
(
labelbox
);
menubox
=
gtk_hbox_new
(
FALSE
,
0
);
tmpw
=
gtk_label_new
(
_
(
"Brush"
));
gtk_box_pack_start
(
GTK_BOX
(
menubox
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show_all
(
menubox
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"_Brush"
));
thispage
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
thispage
),
5
);
...
...
@@ -431,31 +421,16 @@ void create_brushpage(GtkNotebook *notebook)
gtk_box_pack_start
(
GTK_BOX
(
thispage
),
box1
,
FALSE
,
FALSE
,
5
);
gtk_widget_show
(
box1
);
box2
=
gtk_vbox_new
(
TRUE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box1
),
box2
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
box2
);
if
(
!
standalone
)
{
if
(
!
standalone
)
{
GtkWidget
*
emptyitem
;
tmpw
=
gtk_label_new
(
_
(
"Select:"
));
gtk_box_pack_start
(
GTK_BOX
(
box2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
}
tmpw
=
gtk_label_new
(
_
(
"Aspect ratio:"
));
gtk_box_pack_start
(
GTK_BOX
(
box2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
tmpw
=
gtk_label_new
(
_
(
"Relief:"
));
gtk_box_pack_start
(
GTK_BOX
(
box2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
box2
=
gtk_vbox_new
(
TRUE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box1
),
box2
,
FALSE
,
FALSE
,
10
);
gtk_widget_show
(
box2
);
if
(
!
standalone
)
{
GtkWidget
*
emptyitem
;
box3
=
gtk_hbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box2
),
box3
,
FALSE
,
FALSE
,
0
);
...
...
@@ -474,35 +449,40 @@ void create_brushpage(GtkNotebook *notebook)
brushdrawablemenu
=
dmenu
=
gimp_drawable_menu_new
(
validdrawable
,
brushdmenuselect
,
NULL
,
-
1
);
gtk_menu_shell_prepend
(
GTK_MENU_SHELL
(
dmenu
),
emptyitem
);
gtk_option_menu_set_menu
(
GTK_OPTION_MENU
(
tmpw
),
dmenu
);
tmpw
=
gtk_button_new_with_label
(
_
(
"Save..."
));
tmpw
=
gtk_button_new_from_stock
(
GTK_STOCK_SAVE_AS
);
gtk_box_pack_start
(
GTK_BOX
(
box3
),
tmpw
,
FALSE
,
FALSE
,
0
);
g_signal_connect
(
G_OBJECT
(
tmpw
),
"clicked"
,
G_CALLBACK
(
savebrush
),
NULL
);
g_signal_connect
(
G_OBJECT
(
tmpw
),
"clicked"
,
G_CALLBACK
(
savebrush
),
NULL
);
gtk_widget_show
(
tmpw
);
}
brushaspectadjust
=
gtk_adjustment_new
(
pcvals
.
brushaspect
,
-
1
.
0
,
2
.
0
,
0
.
1
,
0
.
1
,
1
.
0
);
tmpw
=
gtk_hscale_new
(
GTK_ADJUSTMENT
(
brushaspectadjust
));
gtk_widget_set_size_request
(
GTK_WIDGET
(
tmpw
),
150
,
30
);
gtk_scale_set_draw_value
(
GTK_SCALE
(
tmpw
),
TRUE
);
gtk_scale_set_digits
(
GTK_SCALE
(
tmpw
),
2
);
gtk_box_pack_start
(
GTK_BOX
(
box2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
gtk_tooltips_set_tip
(
GTK_TOOLTIPS
(
tooltips
),
tmpw
,
_
(
"Specifies the aspect ratio of the brush"
),
NULL
);
g_signal_connect
(
G_OBJECT
(
brushaspectadjust
),
"value_changed"
,
G_CALLBACK
(
selectbrush
),
list
);
brushreliefadjust
=
gtk_adjustment_new
(
pcvals
.
brushrelief
,
0
.
0
,
101
.
0
,
1
.
0
,
1
.
0
,
1
.
0
);
tmpw
=
gtk_hscale_new
(
GTK_ADJUSTMENT
(
brushreliefadjust
));
gtk_widget_set_size_request
(
GTK_WIDGET
(
tmpw
),
150
,
30
);
gtk_scale_set_draw_value
(
GTK_SCALE
(
tmpw
),
TRUE
);
gtk_scale_set_digits
(
GTK_SCALE
(
tmpw
),
2
);
gtk_box_pack_start
(
GTK_BOX
(
box2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
gtk_tooltips_set_tip
(
GTK_TOOLTIPS
(
tooltips
),
tmpw
,
_
(
"Specifies the amount of embossing to apply to each brush stroke"
),
NULL
);
table
=
gtk_table_new
(
2
,
3
,
FALSE
);
gtk_table_set_col_spacings
(
GTK_TABLE
(
table
),
4
);
gtk_box_pack_start
(
GTK_BOX
(
box2
),
table
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
table
);
brushaspectadjust
=
gimp_scale_entry_new
(
GTK_TABLE
(
table
),
0
,
0
,
_
(
"Aspect ratio:"
),
150
,
-
1
,
pcvals
.
brushaspect
,
-
1
.
0
,
1
.
0
,
0
.
1
,
0
.
1
,
2
,
TRUE
,
0
,
0
,
_
(
"Specifies the aspect ratio of the brush"
),
NULL
);
g_signal_connect
(
brushaspectadjust
,
"value_changed"
,
G_CALLBACK
(
gimp_double_adjustment_update
),
&
pcvals
.
brushaspect
);
brushreliefadjust
=
gimp_scale_entry_new
(
GTK_TABLE
(
table
),
0
,
1
,
_
(
"Relief:"
),
150
,
-
1
,
pcvals
.
brushrelief
,
0
.
0
,
100
.
0
,
1
.
0
,
10
.
0
,
1
,
TRUE
,
0
,
0
,
_
(
"Specifies the amount of embossing to apply to the image (in percent)"
),
NULL
);
g_signal_connect
(
brushreliefadjust
,
"value_changed"
,
G_CALLBACK
(
gimp_double_adjustment_update
),
&
pcvals
.
brushrelief
);
g_signal_connect
(
G_OBJECT
(
list
),
"selection_changed"
,
G_CALLBACK
(
selectbrushfile
),
...
...
@@ -511,5 +491,5 @@ void create_brushpage(GtkNotebook *notebook)
gtk_list_select_item
(
GTK_LIST
(
list
),
0
);
selectbrush
(
NULL
,
list
);
gtk_notebook_append_page_menu
(
notebook
,
thispage
,
label
box
,
menubox
);
gtk_notebook_append_page_menu
(
notebook
,
thispage
,
label
,
NULL
);
}
plug-ins/gimpressionist/color.c
View file @
ea2dd584
#include
"config.h"
#include
<stdio.h>
#include
<string.h>
#include
<sys/types.h>
#ifdef HAVE_UNISTD_H
#include
<unistd.h>
#endif
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include
<gtk/gtk.h>
#include
<libgimp/gimpui.h>
#include
"gimpressionist.h"
#include
"ppmtool.h"
#include
"libgimp/stdplugins-intl.h"
...
...
@@ -28,37 +21,19 @@ GtkObject *colornoiseadjust = NULL;
void
colorchange
(
GtkWidget
*
wg
,
void
*
d
,
int
num
)
{
int
n
;
if
(
wg
)
{
n
=
(
long
)
d
;
pcvals
.
colortype
=
n
;
if
(
wg
)
{
pcvals
.
colortype
=
(
int
)
d
;
}
else
{
int
i
;
n
=
num
;
for
(
i
=
0
;
i
<
NUMCOLORRADIO
;
i
++
)
if
(
i
!=
n
)
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
colorradio
[
i
]),
FALSE
);
else
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
colorradio
[
n
]),
TRUE
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
colorradio
[
num
]),
TRUE
);
}
}
void
create_colorpage
(
GtkNotebook
*
notebook
)
{
GtkWidget
*
box0
,
*
box1
,
*
box2
,
*
box3
,
*
thispage
;
GtkWidget
*
labelbox
,
*
menubox
;
GtkWidget
*
tmpw
;
int
i
;
labelbox
=
gtk_hbox_new
(
FALSE
,
0
);
tmpw
=
gtk_label_new
(
_
(
"Color"
));
gtk_box_pack_start
(
GTK_BOX
(
labelbox
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show_all
(
labelbox
);
GtkWidget
*
box0
,
*
box1
,
*
box2
,
*
thispage
;
GtkWidget
*
label
,
*
tmpw
,
*
table
;
menubox
=
gtk_hbox_new
(
FALSE
,
0
);
tmpw
=
gtk_label_new
(
_
(
"Color"
));
gtk_box_pack_start
(
GTK_BOX
(
menubox
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show_all
(
menubox
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"Co_lor"
));
thispage
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
thispage
),
5
);
...
...
@@ -72,57 +47,47 @@ void create_colorpage(GtkNotebook *notebook)
gtk_box_pack_start
(
GTK_BOX
(
box0
),
box1
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
box1
);
box2
=
gtk_vbox_new
(
TRUE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box1
),
box2
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
box2
);
tmpw
=
gtk_label_new
(
_
(
"Color:"
));
gtk_box_pack_start
(
GTK_BOX
(
box
2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box
1
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
box3
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box1
),
box3
,
FALSE
,
FALSE
,
10
);
gtk_widget_show
(
box3
);
i
=
pcvals
.
colortype
;
box2
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box1
),
box2
,
FALSE
,
FALSE
,
10
);
gtk_widget_show
(
box2
);
colorradio
[
0
]
=
tmpw
=
gtk_radio_button_new_with_label
(
NULL
,
_
(
"Average under brush"
));
gtk_box_pack_start
(
GTK_BOX
(
box
3
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box
2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
tmpw
),
FALSE
);
gtk_signal_connect
(
GTK_OBJECT
(
tmpw
),
"clicked"
,
(
GtkSignalFunc
)
colorchange
,
(
void
*
)
0
);
g_signal_connect
(
G_OBJECT
(
tmpw
),
"clicked"
,
G_CALLBACK
(
colorchange
),
(
gpointer
)
0
);
gtk_tooltips_set_tip
(
GTK_TOOLTIPS
(
tooltips
),
tmpw
,
_
(
"Color is computed from the average of all pixels under the brush"
),
NULL
);
if
(
i
==
0
)
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
tmpw
),
TRUE
);
colorradio
[
1
]
=
tmpw
=
gtk_radio_button_new_with_label
(
gtk_radio_button_group
(
GTK_RADIO_BUTTON
(
tmpw
)),
_
(
"Center of brush"
));
gtk_box_pack_start
(
GTK_BOX
(
box3
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
tmpw
),
FALSE
);
colorradio
[
1
]
=
tmpw
=
gtk_radio_button_new_with_label
(
gtk_radio_button_get_group
(
GTK_RADIO_BUTTON
(
tmpw
)),
_
(
"Center of brush"
));
gtk_box_pack_start
(
GTK_BOX
(
box2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
g
tk
_signal_connect
(
G
TK
_OBJECT
(
tmpw
),
"clicked"
,
(
GtkSignalFunc
)
colorchange
,
(
void
*
)
1
);
g_signal_connect
(
G_OBJECT
(
tmpw
),
"clicked"
,
G_CALLBACK
(
colorchange
)
,
(
gpointer
)
1
);
gtk_tooltips_set_tip
(
GTK_TOOLTIPS
(
tooltips
),
tmpw
,
_
(
"Samples the color from the pixel in the center of the brush"
),
NULL
);
if
(
i
==
1
)
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
tmpw
),
TRUE
);
box1
=
gtk_hbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
box0
),
box1
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
box1
);
tmpw
=
gtk_label_new
(
_
(
"Color noise:"
));
gtk_box_pack_start
(
GTK_BOX
(
box1
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);
colornoiseadjust
=
gtk_adjustment_new
(
pcvals
.
colornoise
,
0
.
0
,
101
.
0
,
1
.
0
,
1
.
0
,
1
.
0
);
tmpw
=
gtk_hscale_new
(
GTK_ADJUSTMENT
(
colornoiseadjust
));
gtk_widget_set_usize
(
GTK_WIDGET
(
tmpw
),
150
,
30
);
gtk_scale_set_draw_value
(
GTK_SCALE
(
tmpw
),
TRUE
);
gtk_scale_set_digits
(
GTK_SCALE
(
tmpw
),
1
);
gtk_box_pack_start
(
GTK_BOX
(
box1
),
tmpw
,
FALSE
,
FALSE
,
10
);
gtk_widget_show
(
tmpw
);
gtk_tooltips_set_tip
(
GTK_TOOLTIPS
(
tooltips
),
tmpw
,
_
(
"Adds random noise to the color"
),
NULL
);
gtk_notebook_append_page_menu
(
notebook
,
thispage
,
labelbox
,
menubox
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
colorradio
[
pcvals
.
colortype
]),
TRUE
);
table
=
gtk_table_new
(
1
,
3
,
FALSE
);
gtk_table_set_col_spacings
(
GTK_TABLE
(
table
),
4
);
gtk_box_pack_start
(
GTK_BOX
(
box0
),
table
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
table
);
colornoiseadjust
=
gimp_scale_entry_new
(
GTK_TABLE
(
table
),
0
,
0
,
_
(
"Color noise:"
),
100
,
-
1
,
pcvals
.
colornoise
,
0
.
0
,
100
.
0
,
1
.
0
,
5
.
0
,
0
,
TRUE
,
0
,
0
,
_
(
"Adds random noise to the color"
),
NULL
);
g_signal_connect
(
brushdensityadjust
,
"value_changed"
,
G_CALLBACK
(
gimp_double_adjustment_update
),
&
pcvals
.
colornoise
);
gtk_notebook_append_page_menu
(
notebook
,
thispage
,
label
,
NULL
);
}
plug-ins/gimpressionist/general.c
View file @
ea2dd584
#include
"config.h"
#include
<stdio.h>
#include
<string.h>
#include
<sys/types.h>
#ifdef HAVE_UNISTD_H
#include
<unistd.h>
#endif
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include
<gtk/gtk.h>
#include
"gimpressionist.h"
#include
"ppmtool.h"
#include
<libgimp/gimp.h>
#include
<libgimp/gimpui.h>
#include
"libgimp/stdplugins-intl.h"
...
...
@@ -27,6 +17,7 @@ GtkObject *generaldarkedgeadjust = NULL;
GtkWidget
*
generalpaintedges
=
NULL
;
GtkWidget
*
generaltileable
=
NULL
;
GtkWidget
*
generaldropshadow
=
NULL
;
GtkWidget
*
generalcolbutton
;
GtkObject
*
generalshadowadjust
=
NULL
;
GtkObject
*
generalshadowdepth
=
NULL
;
GtkObject
*
generalshadowblur
=
NULL
;
...
...
@@ -34,116 +25,36 @@ GtkObject *devthreshadjust = NULL;
#define NUMGENERALBGRADIO 4
GtkWidget
*
generalbgradio
[
NUMGENERALBGRADIO
];
static
GtkWidget
*
generalbgradio
[
NUMGENERALBGRADIO
];
void
generalbgchange
(
GtkWidget
*
wg
,
void
*
d
,
int
num
)
{
int
n
;
if
(
wg
)
{
n
=
(
long
)
d
;
n
=
(
int
)
d
;
if
(
!
img_has_alpha
&&
(
n
==
3
))
n
=
1
;
pcvals
.
generalbgtype
=
n
;
}
else
{
int
i
;
n
=
num
;
if
(
!
img_has_alpha
&&
(
n
==
3
))
n
=
1
;
for
(
i
=
0
;
i
<
NUMGENERALBGRADIO
;
i
++
)
if
(
i
!=
n
)
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
generalbgradio
[
i
]),
FALSE
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
generalbgradio
[
n
]),
TRUE
);
}
}
void
drawcolor
(
GtkWidget
*
w
)
{
static
GtkWidget
*
lastw
=
NULL
;
int
x
,
y
;
guchar
buf
[
COLORBUTTONWIDTH
*
3
];
if
(
w
)
lastw
=
w
;
else
w
=
lastw
;
if
(
!
w
)
return
;
for
(
x
=
0
;
x
<
COLORBUTTONWIDTH
;
x
++
)
memcpy
(
&
buf
[
x
*
3
],
&
pcvals
.
color
,
3
);
for
(
y
=
0
;
y
<
COLORBUTTONHEIGHT
;
y
++
)
gtk_preview_draw_row
(
GTK_PREVIEW
(
w
),
buf
,
0
,
y
,
COLORBUTTONWIDTH
);
gtk_widget_draw
(
w
,
NULL
);
}
void
selectcolor_ok
(
GtkWidget
*
w
,
gpointer
d
)
static
void
selectcolor
(
GtkWidget
*
widget
,
gpointer
data
)
{
GtkWidget
*
win
=
(
GtkWidget
*
)
d
;
gdouble
tmpcol
[
3
];
gtk_color_selection_get_color
(
GTK_COLOR_SELECTION
(
GTK_COLOR_SELECTION_DIALOG
(
win
)
->
colorsel
),
tmpcol
);
pcvals
.
color
[
0
]
=
tmpcol
[
0
]
*
255
.
0
;
pcvals
.
color
[
1
]
=
tmpcol
[
1
]
*
255
.
0
;
pcvals
.
color
[
2
]
=
tmpcol
[
2
]
*
255
.
0
;
drawcolor
(
NULL
);
gtk_widget_destroy
(
win
);
}
void
selectcolor
(
void
)
{
static
GtkWidget
*
window
=
NULL
;
gdouble
tmpcol
[
3
];
if
(
window
)
{
gtk_window_present
(
GTK_WINDOW
(
window
));
return
;
}
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
generalbgradio
[
0
]),
TRUE
);
window
=
gtk_color_selection_dialog_new
(
_
(
"Color Selection Dialog"
));
gtk_signal_connect
(
GTK_OBJECT
(
window
),
"destroy"
,
GTK_SIGNAL_FUNC
(
gtk_widget_destroyed
),
&
window
);
tmpcol
[
0
]
=
pcvals
.
color
[
0
]
/
255
.
0
;
tmpcol
[
1
]
=
pcvals
.
color
[
1
]
/
255
.
0
;
tmpcol
[
2
]
=
pcvals
.
color
[
2
]
/
255
.
0
;
gtk_color_selection_set_color
(
GTK_COLOR_SELECTION
(
GTK_COLOR_SELECTION_DIALOG
(
window
)
->
colorsel
),
tmpcol
);
/*
gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG (window)->colorsel),
"color_changed",
GTK_SIGNAL_FUNC(color_selection_changed),
window);
*/
gtk_signal_connect
(
GTK_OBJECT
(
GTK_COLOR_SELECTION_DIALOG
(
window
)
->
ok_button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
selectcolor_ok
),
window
);
gtk_signal_connect_object
(
GTK_OBJECT
(
GTK_COLOR_SELECTION_DIALOG
(
window
)
->
cancel_button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
gtk_widget_destroy
),
GTK_OBJECT
(
window
));
gtk_widget_show
(
window
);
}
void
create_generalpage
(
GtkNotebook
*
notebook
)
{
GtkWidget
*
box1
,
*
box2
,
*
box3
,
*
box4
,
*
thispage
;
GtkWidget
*
labelbox
,
*
menubox
;
GtkWidget
*
tmpw
,
*
colbutton
;
labelbox
=
gtk_hbox_new
(
FALSE
,
0
);
tmpw
=
gtk_label_new
(
_
(
"General"
));
gtk_box_pack_start
(
GTK_BOX
(
labelbox
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show_all
(
labelbox
);
menubox
=
gtk_hbox_new
(
FALSE
,
0
);
tmpw
=
gtk_label_new
(
_
(
"General"
));
gtk_box_pack_start
(
GTK_BOX
(
menubox
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show_all
(
menubox
);
GtkWidget
*
label
,
*
tmpw
;
label
=
gtk_label_new_with_mnemonic
(
_
(
"_General"
));
thispage
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
thispage
),
5
);
...
...
@@ -161,15 +72,13 @@ void create_generalpage(GtkNotebook *notebook)
gtk_box_pack_start
(
GTK_BOX
(
box2
),
tmpw
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
tmpw
);