mirror of https://github.com/GNOME/gimp.git
updated version 1.4.2
1999-04-30 Michael Natterer <mitschel@cs.tu-berlin.de> * plug-ins/gdyntext/*: updated version 1.4.2
This commit is contained in:
parent
f2681a95d1
commit
11ef0a819e
|
@ -1,3 +1,7 @@
|
|||
1999-04-30 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* plug-ins/gdyntext/*: updated version 1.4.2
|
||||
|
||||
1999-04-30 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/flip_tool.c: fixed a cut-and-paste bug: vertical flip
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Apr 25 1999
|
||||
* MADE 1.4.2 RELEASE
|
||||
* Added the "Apply" button.
|
||||
Apr 15 1999
|
||||
* MADE 1.4.1 RELEASE
|
||||
* Fixed garbaged layer bug when there is an active selection.
|
||||
Apr 14 1999
|
||||
* MADE 1.4.0 RELEASE
|
||||
* Added customizable line spacing.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
GIMP Dynamic Text -- image filter plug-in for The GIMP program
|
||||
==============================================================
|
||||
|
||||
GDynText 1.4.1
|
||||
GDynText 1.4.2
|
||||
Copyright (C) 1998,1999 Marco Lamberto
|
||||
E-mail: lm@geocities.com
|
||||
Web page: http://www.geocities.com/Tokyo/1474/gimp/
|
||||
|
|
|
@ -340,16 +340,11 @@ static void gdt_run(char *name, int nparams, GParam *param, int *nreturn_vals,
|
|||
gdtvals.new_layer = !gimp_drawable_has_alpha(gdtvals.drawable_id);
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_undo_push_group_start(gdtvals.image_id);
|
||||
|
||||
gdt_render_text(&gdtvals);
|
||||
gdt_set_values(&gdtvals);
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
gimp_set_data("plug_in_gdyntext", &gdtvals, sizeof(GdtVals));
|
||||
values[1].data.d_int32 = gdtvals.layer_id;
|
||||
|
||||
gimp_undo_push_group_end(gdtvals.image_id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -501,8 +496,9 @@ void gdt_set_values(GdtVals *data)
|
|||
data->spacing);
|
||||
|
||||
#ifdef GIMP_HAVE_PARASITES
|
||||
parasite = parasite_new(GDYNTEXT_PARASITE, PARASITE_PERSISTENT | PARASITE_UNDOABLE,
|
||||
strlen(lname), lname);
|
||||
parasite = parasite_new(GDYNTEXT_PARASITE,
|
||||
PARASITE_PERSISTENT | PARASITE_UNDOABLE,
|
||||
strlen(lname), lname);
|
||||
gimp_drawable_attach_parasite(data->drawable_id, parasite);
|
||||
parasite_free(parasite);
|
||||
|
||||
|
@ -525,6 +521,12 @@ void gdt_set_values(GdtVals *data)
|
|||
|
||||
|
||||
void gdt_render_text(GdtVals *data)
|
||||
{
|
||||
gdt_render_text_p(data, TRUE);
|
||||
}
|
||||
|
||||
|
||||
void gdt_render_text_p(GdtVals *data, gboolean show_progress)
|
||||
{
|
||||
gint layer_ox, layer_oy, i, nret_vals, xoffs;
|
||||
gint32 layer_f, selection_empty, selection_channel;
|
||||
|
@ -536,23 +538,27 @@ void gdt_render_text(GdtVals *data)
|
|||
GParam *ret_vals;
|
||||
GParamColor old_color, text_color;
|
||||
|
||||
gimp_progress_init("GIMP Dynamic Text");
|
||||
|
||||
/* save and remove current selection */
|
||||
ret_vals = gimp_run_procedure("gimp_selection_is_empty", &nret_vals,
|
||||
if (show_progress)
|
||||
gimp_progress_init("GIMP Dynamic Text");
|
||||
ret_vals = gimp_run_procedure("gimp_undo_push_group_start", &nret_vals,
|
||||
PARAM_IMAGE, data->image_id, PARAM_END);
|
||||
selection_empty = ret_vals[1].data.d_int32;
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
if (selection_empty == FALSE) {
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
|
||||
/* save and remove current selection */
|
||||
ret_vals = gimp_run_procedure("gimp_selection_is_empty", &nret_vals,
|
||||
PARAM_IMAGE, data->image_id, PARAM_END);
|
||||
selection_empty = ret_vals[1].data.d_int32;
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
if (selection_empty == FALSE) {
|
||||
/* there is an active selection to save */
|
||||
ret_vals = gimp_run_procedure("gimp_selection_save", &nret_vals,
|
||||
ret_vals = gimp_run_procedure("gimp_selection_save", &nret_vals,
|
||||
PARAM_IMAGE, data->image_id, PARAM_END);
|
||||
selection_channel = ret_vals[1].data.d_int32;
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
ret_vals = gimp_run_procedure("gimp_selection_none", &nret_vals,
|
||||
selection_channel = ret_vals[1].data.d_int32;
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
ret_vals = gimp_run_procedure("gimp_selection_none", &nret_vals,
|
||||
PARAM_IMAGE, data->image_id, PARAM_END);
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
}
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
}
|
||||
|
||||
text_style = strsplit(data->font_style, '-');
|
||||
|
||||
|
@ -715,8 +721,8 @@ void gdt_render_text(GdtVals *data)
|
|||
PARAM_STRING, g_array_index(text_style, char *, 2), /* set_width */
|
||||
PARAM_STRING, "*", /* spacing */
|
||||
#ifdef GIMP_HAVE_FEATURES_1_1_5
|
||||
PARAM_STRING, "*", /* registry */
|
||||
PARAM_STRING, "*", /* encoding */
|
||||
PARAM_STRING, "*", /* registry */
|
||||
PARAM_STRING, "*", /* encoding */
|
||||
#endif
|
||||
PARAM_END);
|
||||
layer_f = ret_vals[1].data.d_layer;
|
||||
|
@ -731,8 +737,9 @@ void gdt_render_text(GdtVals *data)
|
|||
PARAM_LAYER, layer_f,
|
||||
PARAM_END);
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
gimp_progress_update((double)(i + 2) * 100.0 * (double)text_height /
|
||||
(double)layer_height);
|
||||
if (show_progress)
|
||||
gimp_progress_update((double)(i + 2) * 100.0 * (double)text_height /
|
||||
(double)layer_height);
|
||||
}
|
||||
g_array_free(text_lines_w, TRUE);
|
||||
g_array_free(text_style, TRUE);
|
||||
|
@ -762,19 +769,24 @@ void gdt_render_text(GdtVals *data)
|
|||
|
||||
gimp_layer_set_preserve_transparency(data->layer_id, 1);
|
||||
|
||||
/* restore old selection if any */
|
||||
if (selection_empty == FALSE) {
|
||||
ret_vals = gimp_run_procedure("gimp_selection_load", &nret_vals,
|
||||
/* restore old selection if any */
|
||||
if (selection_empty == FALSE) {
|
||||
ret_vals = gimp_run_procedure("gimp_selection_load", &nret_vals,
|
||||
#ifndef GIMP_HAVE_PARASITES
|
||||
PARAM_IMAGE, data->image_id,
|
||||
#endif
|
||||
PARAM_CHANNEL, selection_channel, PARAM_END);
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
gimp_image_remove_channel(data->image_id, selection_channel);
|
||||
}
|
||||
PARAM_CHANNEL, selection_channel, PARAM_END);
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
gimp_image_remove_channel(data->image_id, selection_channel);
|
||||
}
|
||||
|
||||
ret_vals = gimp_run_procedure("gimp_undo_push_group_end", &nret_vals,
|
||||
PARAM_IMAGE, data->image_id, PARAM_END);
|
||||
gimp_destroy_params(ret_vals, nret_vals);
|
||||
|
||||
gimp_displays_flush();
|
||||
gimp_progress_update(100.0);
|
||||
if (show_progress)
|
||||
gimp_progress_update(100.0);
|
||||
}
|
||||
|
||||
/* vim: set ts=2 sw=2 tw=79 ai nowrap: */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#define GDYNTEXT_VERSION "1.4.1"
|
||||
#define GDYNTEXT_VERSION "1.4.2"
|
||||
#define GDYNTEXT_MAGIC "GDT09"
|
||||
#define GDYNTEXT_WEB_PAGE "http://www.geocities.com/Tokyo/1474/gimp/"
|
||||
#define MAX_TEXT_SIZE (64 * 1024)
|
||||
|
@ -85,6 +85,7 @@ typedef struct {
|
|||
void gdt_get_values(GdtVals *data);
|
||||
void gdt_set_values(GdtVals *data);
|
||||
void gdt_render_text(GdtVals *data);
|
||||
void gdt_render_text_p(GdtVals *data, gboolean show_progress);
|
||||
GArray *strsplit(const char *text, const char sep);
|
||||
|
||||
#endif /* _GDYNTEXT_H_ */
|
||||
|
|
|
@ -53,6 +53,7 @@ typedef struct {
|
|||
GtkWidget *font_preview;
|
||||
GtkWidget *hbox_fp;
|
||||
GtkWidget *charmap_window_toggle;
|
||||
GtkWidget *new_layer_toggle;
|
||||
gboolean font_preview_enabled;
|
||||
gboolean ok_pressed;
|
||||
} GdtMainWindow;
|
||||
|
@ -62,6 +63,7 @@ GtkWidget *create_about_dialog(void);
|
|||
GtkWidget *create_color_selection_dialog(void);
|
||||
GdtMainWindow *create_main_window(GdtMainWindow **main_window, GdtVals *data);
|
||||
GtkWidget *create_message_window(GtkWidget **mw);
|
||||
void set_gdt_vals(GdtVals *data);
|
||||
void gtk_text_set_font(GtkText *text, GdkFont *font);
|
||||
void load_text(GtkWidget *widget, gpointer data);
|
||||
void on_about_dialog_close(GtkWidget *widget, gpointer data);
|
||||
|
@ -79,6 +81,7 @@ void on_main_window_about_clicked(GtkWidget *widget, gpointer data);
|
|||
void on_main_window_align_c_clicked(GtkWidget *widget, gpointer data);
|
||||
void on_main_window_align_l_clicked(GtkWidget *widget, gpointer data);
|
||||
void on_main_window_align_r_clicked(GtkWidget *widget, gpointer data);
|
||||
void on_main_window_apply_clicked(GtkWidget *widget, gpointer data);
|
||||
void on_main_window_cancel_clicked(GtkWidget *widget, gpointer data);
|
||||
void on_main_window_font_color_clicked(GtkWidget *widget, gpointer data);
|
||||
void on_main_window_ok_press_event(GtkWidget *widget, GdkEvent *event, gpointer data);
|
||||
|
@ -240,6 +243,7 @@ GdtMainWindow *create_main_window(GdtMainWindow **main_window, GdtVals *data)
|
|||
GtkWidget *button_about;
|
||||
GtkWidget *button_ok;
|
||||
GtkWidget *button_cancel;
|
||||
GtkWidget *button_apply;
|
||||
GtkWidget *font_preview_toggle;
|
||||
GtkWidget *vscrollbar;
|
||||
GtkWidget *rbutt;
|
||||
|
@ -284,7 +288,7 @@ GdtMainWindow *create_main_window(GdtMainWindow **main_window, GdtVals *data)
|
|||
/* NEW LAYER Toggle */
|
||||
icon = gdk_pixmap_create_from_xpm_d(mw->window->window, &mask, transparent, new_layer_xpm);
|
||||
gtk_icon = gtk_pixmap_new(icon, mask);
|
||||
telem = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL,
|
||||
mw->new_layer_toggle = telem = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL,
|
||||
NULL, _("Toggle creation of a new layer"), NULL, gtk_icon, NULL, NULL);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(telem), data->new_layer);
|
||||
gtk_signal_connect(GTK_OBJECT(telem), "toggled", GTK_SIGNAL_FUNC(on_button_toggled), &data->new_layer);
|
||||
|
@ -509,13 +513,21 @@ GdtMainWindow *create_main_window(GdtMainWindow **main_window, GdtVals *data)
|
|||
"in changing the layer name as done in GIMP 1.0."), NULL);
|
||||
#endif
|
||||
|
||||
button_cancel = gtk_button_new_with_label(_("Cancel"));
|
||||
button_cancel = gtk_button_new_with_label(_("Close"));
|
||||
GTK_WIDGET_SET_FLAGS(button_cancel, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect(GTK_OBJECT(button_cancel), "clicked",
|
||||
GTK_SIGNAL_FUNC(on_main_window_cancel_clicked), &mw->ok_pressed);
|
||||
gtk_box_pack_start(GTK_BOX(hbbox2), button_cancel, FALSE, FALSE, 0);
|
||||
gtk_widget_show(button_cancel);
|
||||
|
||||
button_apply = gtk_button_new_with_label(_("Apply"));
|
||||
GTK_WIDGET_SET_FLAGS(button_apply, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect(GTK_OBJECT(button_apply), "clicked",
|
||||
GTK_SIGNAL_FUNC(on_main_window_apply_clicked), data);
|
||||
gtk_box_pack_start(GTK_BOX(hbbox2), button_apply, FALSE, FALSE, 0);
|
||||
gtk_widget_show(button_apply);
|
||||
|
||||
|
||||
gtk_widget_grab_default(button_ok);
|
||||
|
||||
/* setup font preview */
|
||||
|
@ -576,26 +588,30 @@ gboolean gdt_create_ui(GdtVals *data)
|
|||
|
||||
gtk_main();
|
||||
|
||||
if (main_window->ok_pressed) {
|
||||
data->preview = main_window->font_preview_enabled;
|
||||
strncpy(data->font_family,
|
||||
font_selection_get_font_family(FONT_SELECTION(main_window->font_selection)),
|
||||
sizeof(data->font_family));
|
||||
strncpy(data->font_style,
|
||||
font_selection_get_font_style(FONT_SELECTION(main_window->font_selection)),
|
||||
sizeof(data->font_style));
|
||||
data->font_size = font_selection_get_font_size(FONT_SELECTION(main_window->font_selection));
|
||||
data->rotation = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(main_window->font_rotation));
|
||||
data->spacing = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(main_window->line_spacing));
|
||||
data->font_metric = font_selection_get_font_metric(FONT_SELECTION(main_window->font_selection));
|
||||
strncpy(data->text, gtk_editable_get_chars(GTK_EDITABLE(main_window->textarea), 0, -1),
|
||||
sizeof(data->text));
|
||||
data->font_color = TO_RGB(col);
|
||||
}
|
||||
if (main_window->ok_pressed)
|
||||
set_gdt_vals(data);
|
||||
return main_window->ok_pressed;
|
||||
}
|
||||
|
||||
|
||||
void set_gdt_vals(GdtVals *data) {
|
||||
data->preview = main_window->font_preview_enabled;
|
||||
strncpy(data->font_family,
|
||||
font_selection_get_font_family(FONT_SELECTION(main_window->font_selection)),
|
||||
sizeof(data->font_family));
|
||||
strncpy(data->font_style,
|
||||
font_selection_get_font_style(FONT_SELECTION(main_window->font_selection)),
|
||||
sizeof(data->font_style));
|
||||
data->font_size = font_selection_get_font_size(FONT_SELECTION(main_window->font_selection));
|
||||
data->rotation = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(main_window->font_rotation));
|
||||
data->spacing = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(main_window->line_spacing));
|
||||
data->font_metric = font_selection_get_font_metric(FONT_SELECTION(main_window->font_selection));
|
||||
strncpy(data->text, gtk_editable_get_chars(GTK_EDITABLE(main_window->textarea), 0, -1),
|
||||
sizeof(data->text));
|
||||
data->font_color = TO_RGB(col);
|
||||
}
|
||||
|
||||
|
||||
void update_font_color_preview(void)
|
||||
{
|
||||
guchar row[COLOR_PREVIEW_WIDTH * 3];
|
||||
|
@ -622,6 +638,18 @@ void update_font_color_preview(void)
|
|||
}
|
||||
|
||||
|
||||
void on_main_window_apply_clicked(GtkWidget *widget, gpointer data0)
|
||||
{
|
||||
GdtVals *data = (GdtVals *)data0;
|
||||
|
||||
set_gdt_vals(data);
|
||||
gdt_render_text_p(data, FALSE);
|
||||
gdt_set_values(data);
|
||||
if (data->new_layer)
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(main_window->new_layer_toggle), FALSE);
|
||||
}
|
||||
|
||||
|
||||
void on_main_window_cancel_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
*(gboolean *)data = FALSE;
|
||||
|
@ -632,7 +660,7 @@ void on_main_window_cancel_clicked(GtkWidget *widget, gpointer data)
|
|||
void on_main_window_ok_press_event(GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||
{
|
||||
#ifdef GIMP_HAVE_PARASITES
|
||||
/* holding the SHIF while clicking on OK will force layer name change */
|
||||
/* holding the SHIFT while clicking on OK will force layer name change */
|
||||
((GdtVals *)data)->change_layer_name = (event->button.state & GDK_SHIFT_MASK);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue