2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
* Film plug-in (C) 1997 Peter Kirchgessner
|
|
|
|
* e-mail: pkirchg@aol.com, WWW: http://members.aol.com/pkirchg
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08:00
|
|
|
* (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
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This plug-in generates a film roll with several images
|
|
|
|
*/
|
|
|
|
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <string.h>
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-01 05:03:44 +08:00
|
|
|
|
2005-08-14 05:39:56 +08:00
|
|
|
#define PLUG_IN_PROC "plug-in-film"
|
|
|
|
#define PLUG_IN_BINARY "film"
|
2011-04-09 02:31:34 +08:00
|
|
|
#define PLUG_IN_ROLE "gimp-film"
|
2005-08-14 05:39:56 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
/* Maximum number of pictures per film */
|
|
|
|
#define MAX_FILM_PICTURES 64
|
|
|
|
#define COLOR_BUTTON_WIDTH 50
|
|
|
|
#define COLOR_BUTTON_HEIGHT 20
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-06-19 10:17:58 +08:00
|
|
|
#define FONT_LEN 256
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Define how the plug-in works. Values marked (r) are with regard */
|
|
|
|
/* to film_height (i.e. it should be a value from 0.0 to 1.0) */
|
2000-02-09 10:32:35 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint film_height; /* height of the film */
|
2001-01-12 07:36:59 +08:00
|
|
|
GimpRGB film_color; /* color of film */
|
2000-02-09 10:32:35 +08:00
|
|
|
gdouble picture_height; /* height of picture (r) */
|
|
|
|
gdouble picture_space; /* space between pictures (r) */
|
|
|
|
gdouble hole_offset; /* distance from hole to edge of film (r) */
|
|
|
|
gdouble hole_width; /* width of hole (r) */
|
|
|
|
gdouble hole_height; /* height of holes (r) */
|
|
|
|
gdouble hole_space; /* distance of holes (r) */
|
|
|
|
gdouble number_height; /* height of picture numbering (r) */
|
|
|
|
gint number_start; /* number for first picture */
|
2001-01-12 07:36:59 +08:00
|
|
|
GimpRGB number_color; /* color of number */
|
2004-06-19 10:17:58 +08:00
|
|
|
gchar number_font[FONT_LEN]; /* font family to use for numbering */
|
2000-02-09 10:32:35 +08:00
|
|
|
gint number_pos[2]; /* flags where to draw numbers (top/bottom) */
|
|
|
|
gint keep_height; /* flag if to keep max. image height */
|
|
|
|
gint num_images; /* number of images */
|
2019-09-12 18:42:09 +08:00
|
|
|
gint32 images[MAX_FILM_PICTURES]; /* list of image IDs */
|
1997-11-25 06:05:25 +08:00
|
|
|
} FilmVals;
|
|
|
|
|
|
|
|
/* Data to use for the dialog */
|
|
|
|
typedef struct
|
|
|
|
{
|
2010-10-25 07:26:00 +08:00
|
|
|
GtkAdjustment *advanced_adj[7];
|
|
|
|
GtkTreeModel *image_list_all;
|
|
|
|
GtkTreeModel *image_list_film;
|
1997-11-25 06:05:25 +08:00
|
|
|
} FilmInterface;
|
|
|
|
|
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
typedef struct _Film Film;
|
|
|
|
typedef struct _FilmClass FilmClass;
|
|
|
|
|
|
|
|
struct _Film
|
|
|
|
{
|
|
|
|
GimpPlugIn parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _FilmClass
|
|
|
|
{
|
|
|
|
GimpPlugInClass parent_class;
|
|
|
|
};
|
2000-02-09 10:32:35 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
#define FILM_TYPE (film_get_type ())
|
|
|
|
#define FILM (obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FILM_TYPE, Film))
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
GType film_get_type (void) G_GNUC_CONST;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
static GList * film_query_procedures (GimpPlugIn *plug_in);
|
|
|
|
static GimpProcedure * film_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
static GimpValueArray * film_run (GimpProcedure *procedure,
|
2019-08-18 19:45:58 +08:00
|
|
|
GimpRunMode run_mode,
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpImage *image,
|
|
|
|
GimpDrawable *drawable,
|
2019-08-14 18:39:07 +08:00
|
|
|
const GimpValueArray *args,
|
|
|
|
gpointer run_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-09-12 03:48:34 +08:00
|
|
|
static GimpImage * create_new_image (guint width,
|
2019-08-14 18:39:07 +08:00
|
|
|
guint height,
|
|
|
|
GimpImageType gdtype,
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpLayer **layer);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
static gchar * compose_image_name (GimpImage *image);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
static GimpImage * film (void);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
static gboolean check_filmvals (void);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
static void set_pixels (gint numpix,
|
|
|
|
guchar *dst,
|
|
|
|
GimpRGB *color);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
static guchar * create_hole_rgb (gint width,
|
|
|
|
gint height);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
static void draw_number (GimpLayer *layer,
|
2019-08-14 18:39:07 +08:00
|
|
|
gint num,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint height);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
static void add_list_item_callback (GtkWidget *widget,
|
|
|
|
GtkTreeSelection *sel);
|
|
|
|
static void del_list_item_callback (GtkWidget *widget,
|
|
|
|
GtkTreeSelection *sel);
|
|
|
|
|
|
|
|
static GtkTreeModel * add_image_list (gboolean add_box_flag,
|
2019-08-19 05:14:37 +08:00
|
|
|
GList *images,
|
2019-08-14 18:39:07 +08:00
|
|
|
GtkWidget *hbox);
|
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
static gboolean film_dialog (GimpImage *image);
|
2019-08-14 18:39:07 +08:00
|
|
|
static void film_reset_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void film_font_select_callback (GimpFontSelectButton *button,
|
|
|
|
const gchar *name,
|
|
|
|
gboolean closing,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (Film, film, GIMP_TYPE_PLUG_IN)
|
|
|
|
|
|
|
|
GIMP_MAIN (FILM_TYPE)
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
|
|
|
|
static gdouble advanced_defaults[] =
|
|
|
|
{
|
|
|
|
0.695, /* Picture height */
|
|
|
|
0.040, /* Picture spacing */
|
|
|
|
0.058, /* Hole offset to edge of film */
|
|
|
|
0.052, /* Hole width */
|
|
|
|
0.081, /* Hole height */
|
|
|
|
0.081, /* Hole distance */
|
2000-02-14 21:23:12 +08:00
|
|
|
0.052 /* Image number height */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static FilmVals filmvals =
|
|
|
|
{
|
2000-02-09 10:32:35 +08:00
|
|
|
256, /* Height of film */
|
2001-01-12 07:36:59 +08:00
|
|
|
{ 0.0, 0.0, 0.0, 1.0 }, /* Color of film */
|
2000-02-09 10:32:35 +08:00
|
|
|
0.695, /* Picture height */
|
|
|
|
0.040, /* Picture spacing */
|
|
|
|
0.058, /* Hole offset to edge of film */
|
|
|
|
0.052, /* Hole width */
|
|
|
|
0.081, /* Hole height */
|
|
|
|
0.081, /* Hole distance */
|
|
|
|
0.052, /* Image number height */
|
|
|
|
1, /* Start index of numbering */
|
2001-01-12 07:36:59 +08:00
|
|
|
{ 0.93, 0.61, 0.0, 1.0 }, /* Color of number */
|
2004-06-19 10:17:58 +08:00
|
|
|
"Monospace", /* Font family for numbering */
|
2000-02-09 10:32:35 +08:00
|
|
|
{ TRUE, TRUE }, /* Numbering on top and bottom */
|
2018-04-19 02:57:03 +08:00
|
|
|
0, /* Don't keep max. image height */
|
2000-02-09 10:32:35 +08:00
|
|
|
0, /* Number of images */
|
2019-09-12 18:42:09 +08:00
|
|
|
{ 0 } /* Input image list */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static FilmInterface filmint =
|
|
|
|
{
|
2000-02-09 10:32:35 +08:00
|
|
|
{ NULL }, /* advanced adjustments */
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL, NULL /* image list widgets */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2019-08-14 18:39:07 +08:00
|
|
|
film_class_init (FilmClass *klass)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-08-14 18:39:07 +08:00
|
|
|
GimpPlugInClass *plug_in_class = GIMP_PLUG_IN_CLASS (klass);
|
|
|
|
|
|
|
|
plug_in_class->query_procedures = film_query_procedures;
|
|
|
|
plug_in_class->create_procedure = film_create_procedure;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-08-14 18:39:07 +08:00
|
|
|
film_init (Film *film)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-08-14 18:39:07 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
static GList *
|
|
|
|
film_query_procedures (GimpPlugIn *plug_in)
|
|
|
|
{
|
|
|
|
return g_list_append (NULL, g_strdup (PLUG_IN_PROC));
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpProcedure *
|
|
|
|
film_create_procedure (GimpPlugIn *plug_in,
|
2019-08-18 19:45:58 +08:00
|
|
|
const gchar *name)
|
2019-08-14 18:39:07 +08:00
|
|
|
{
|
|
|
|
GimpProcedure *procedure = NULL;
|
1999-10-09 09:44:31 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
if (! strcmp (name, PLUG_IN_PROC))
|
|
|
|
{
|
2019-08-30 18:52:28 +08:00
|
|
|
procedure = gimp_image_procedure_new (plug_in, name,
|
|
|
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
2019-08-18 19:45:58 +08:00
|
|
|
film_run, NULL, NULL);
|
2019-08-14 18:39:07 +08:00
|
|
|
|
|
|
|
gimp_procedure_set_image_types (procedure, "*");
|
|
|
|
|
|
|
|
gimp_procedure_set_menu_label (procedure, N_("_Filmstrip..."));
|
|
|
|
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Combine");
|
|
|
|
|
|
|
|
gimp_procedure_set_documentation (procedure,
|
|
|
|
N_("Combine several images on a "
|
|
|
|
"film strip"),
|
|
|
|
"Compose several images to a roll film",
|
|
|
|
name);
|
|
|
|
gimp_procedure_set_attribution (procedure,
|
|
|
|
"Peter Kirchgessner",
|
|
|
|
"Peter Kirchgessner (peter@kirchgessner.net)",
|
|
|
|
"1997");
|
|
|
|
|
2019-08-19 16:02:07 +08:00
|
|
|
GIMP_PROC_ARG_INT (procedure, "film-height",
|
|
|
|
"Film height",
|
|
|
|
"Height of film (0: fit to images)",
|
|
|
|
0, GIMP_MAX_IMAGE_SIZE, 0,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_RGB (procedure, "film-color",
|
|
|
|
"Film color",
|
|
|
|
"Color of the film",
|
|
|
|
TRUE, NULL,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_INT (procedure, "number-start",
|
|
|
|
"Number start",
|
|
|
|
"Start index for numbering",
|
|
|
|
G_MININT, G_MAXINT, 1,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_STRING (procedure, "number-font",
|
|
|
|
"Number font",
|
|
|
|
"Font for drawing numbers",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_RGB (procedure, "number-color",
|
|
|
|
"Number color",
|
|
|
|
"Color for numbers",
|
|
|
|
TRUE, NULL,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_BOOLEAN (procedure, "at-top",
|
|
|
|
"At top",
|
|
|
|
"Draw numbers at top",
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_BOOLEAN (procedure, "at-bottom",
|
|
|
|
"At bottom",
|
|
|
|
"Draw numbers at bottom",
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_INT (procedure, "num-images",
|
|
|
|
"Num images",
|
|
|
|
"Number of images to be used for film",
|
|
|
|
1, MAX_FILM_PICTURES, 1,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
2019-09-05 20:39:32 +08:00
|
|
|
GIMP_PROC_ARG_OBJECT_ARRAY (procedure, "images",
|
|
|
|
"Images",
|
|
|
|
"num-images images to be used for film",
|
|
|
|
GIMP_TYPE_IMAGE,
|
|
|
|
G_PARAM_READWRITE);
|
2019-08-19 16:02:07 +08:00
|
|
|
|
|
|
|
GIMP_PROC_VAL_IMAGE (procedure, "new-image",
|
|
|
|
"New image",
|
2019-09-22 01:10:46 +08:00
|
|
|
"Output image",
|
2019-08-29 17:25:35 +08:00
|
|
|
FALSE,
|
2019-08-19 16:02:07 +08:00
|
|
|
G_PARAM_READWRITE);
|
2019-08-14 18:39:07 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
return procedure;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
static GimpValueArray *
|
|
|
|
film_run (GimpProcedure *procedure,
|
2019-08-18 19:45:58 +08:00
|
|
|
GimpRunMode run_mode,
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpImage *image,
|
|
|
|
GimpDrawable *drawable,
|
2019-08-14 18:39:07 +08:00
|
|
|
const GimpValueArray *args,
|
|
|
|
gpointer run_data)
|
|
|
|
{
|
2019-09-05 20:39:32 +08:00
|
|
|
GimpValueArray *return_vals = NULL;
|
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
|
|
|
GimpImage **images;
|
|
|
|
gint i;
|
2019-08-14 18:39:07 +08:00
|
|
|
|
|
|
|
INIT_I18N ();
|
|
|
|
gegl_init (NULL, NULL);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
switch (run_mode)
|
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_INTERACTIVE:
|
2005-08-14 05:39:56 +08:00
|
|
|
gimp_get_data (PLUG_IN_PROC, &filmvals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
if (! film_dialog (image))
|
2019-09-12 18:42:09 +08:00
|
|
|
{
|
|
|
|
return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL,
|
|
|
|
NULL);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_NONINTERACTIVE:
|
2019-08-20 07:03:38 +08:00
|
|
|
filmvals.film_height = GIMP_VALUES_GET_INT (args, 0);
|
2019-08-14 18:39:07 +08:00
|
|
|
if (filmvals.film_height <= 0)
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
2019-08-14 18:39:07 +08:00
|
|
|
filmvals.keep_height = TRUE;
|
|
|
|
filmvals.film_height = 128; /* arbitrary */
|
2006-12-02 04:42:36 +08:00
|
|
|
}
|
2000-02-09 10:32:35 +08:00
|
|
|
else
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
2019-08-14 18:39:07 +08:00
|
|
|
filmvals.keep_height = FALSE;
|
2006-12-02 04:42:36 +08:00
|
|
|
}
|
2019-08-20 07:03:38 +08:00
|
|
|
GIMP_VALUES_GET_RGB (args, 1, &filmvals.film_color);
|
2019-09-05 20:39:32 +08:00
|
|
|
filmvals.number_start = GIMP_VALUES_GET_INT (args, 2);
|
|
|
|
g_strlcpy (filmvals.number_font,
|
|
|
|
GIMP_VALUES_GET_STRING (args, 3),
|
|
|
|
FONT_LEN);
|
2019-08-20 07:03:38 +08:00
|
|
|
GIMP_VALUES_GET_RGB (args, 4, &filmvals.number_color);
|
2019-09-05 20:39:32 +08:00
|
|
|
filmvals.number_pos[0] = GIMP_VALUES_GET_INT (args, 5);
|
|
|
|
filmvals.number_pos[1] = GIMP_VALUES_GET_INT (args, 6);
|
|
|
|
filmvals.num_images = GIMP_VALUES_GET_INT (args, 7);
|
|
|
|
images = GIMP_VALUES_GET_OBJECT_ARRAY (args, 8);
|
2019-08-19 05:14:37 +08:00
|
|
|
|
|
|
|
for (i = 0; i < filmvals.num_images; i++)
|
2019-09-12 18:42:09 +08:00
|
|
|
filmvals.images[i] = gimp_image_get_id (images[i]);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_WITH_LAST_VALS:
|
2005-08-14 05:39:56 +08:00
|
|
|
gimp_get_data (PLUG_IN_PROC, &filmvals);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
if (! check_filmvals ())
|
2000-08-22 09:26:57 +08:00
|
|
|
status = GIMP_PDB_CALLING_ERROR;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpImage *image;
|
2019-08-14 18:39:07 +08:00
|
|
|
|
2005-09-30 16:16:10 +08:00
|
|
|
gimp_progress_init (_("Composing images"));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
image = film ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
if (! image)
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
|
|
|
status = GIMP_PDB_EXECUTION_ERROR;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
2019-08-14 18:39:07 +08:00
|
|
|
return_vals = gimp_procedure_new_return_values (procedure, status,
|
|
|
|
NULL);
|
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
GIMP_VALUES_SET_IMAGE (return_vals, 1, image);
|
2019-08-14 18:39:07 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
gimp_image_undo_enable (image);
|
|
|
|
gimp_image_clean_all (image);
|
2019-08-14 18:39:07 +08:00
|
|
|
|
2006-12-02 04:42:36 +08:00
|
|
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
2019-08-19 05:14:37 +08:00
|
|
|
gimp_display_new (image);
|
2006-12-02 04:42:36 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Store data */
|
2000-08-22 09:26:57 +08:00
|
|
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
2005-08-14 05:39:56 +08:00
|
|
|
gimp_set_data (PLUG_IN_PROC, &filmvals, sizeof (FilmVals));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2019-08-14 18:39:07 +08:00
|
|
|
if (! return_vals)
|
|
|
|
return_vals = gimp_procedure_new_return_values (procedure, status, NULL);
|
|
|
|
|
|
|
|
return return_vals;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Compose a roll film image from several images */
|
2019-08-19 05:14:37 +08:00
|
|
|
static GimpImage *
|
1997-11-25 06:05:25 +08:00
|
|
|
film (void)
|
|
|
|
{
|
2011-10-06 11:08:46 +08:00
|
|
|
gint width, height;
|
2006-12-02 04:42:36 +08:00
|
|
|
guchar *hole;
|
|
|
|
gint film_height, film_width;
|
|
|
|
gint picture_width, picture_height;
|
|
|
|
gint picture_space, picture_x0, picture_y0;
|
|
|
|
gint hole_offset, hole_width, hole_height, hole_space, hole_x;
|
|
|
|
gint number_height, num_images, num_pictures;
|
2019-08-19 05:14:37 +08:00
|
|
|
gint picture_count;
|
2006-12-02 04:42:36 +08:00
|
|
|
gdouble f;
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpImage *image_dst;
|
|
|
|
GimpImage *image_tmp;
|
|
|
|
GimpLayer *layer_src;
|
|
|
|
GimpLayer *layer_dst;
|
|
|
|
GimpLayer *new_layer;
|
|
|
|
GimpLayer *floating_sel;
|
|
|
|
|
2019-09-12 18:42:09 +08:00
|
|
|
GList *images_src = NULL;
|
|
|
|
GList *layers = NULL;
|
2019-08-19 05:14:37 +08:00
|
|
|
GList *iter;
|
|
|
|
GList *iter2;
|
2019-09-12 18:42:09 +08:00
|
|
|
gint i;
|
2019-08-19 05:14:37 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
|
|
|
|
num_images = filmvals.num_images;
|
|
|
|
|
|
|
|
if (num_images <= 0)
|
2019-08-19 05:14:37 +08:00
|
|
|
return NULL;
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2019-09-12 18:42:09 +08:00
|
|
|
for (i = 0; i < filmvals.num_images; i++)
|
|
|
|
{
|
|
|
|
images_src = g_list_append (images_src,
|
|
|
|
gimp_image_get_by_id (filmvals.images[i]));
|
|
|
|
}
|
|
|
|
|
2004-12-13 06:00:31 +08:00
|
|
|
gimp_context_push ();
|
|
|
|
gimp_context_set_foreground (&filmvals.number_color);
|
2006-12-02 04:42:36 +08:00
|
|
|
gimp_context_set_background (&filmvals.film_color);
|
2004-12-13 06:00:31 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
if (filmvals.keep_height) /* Search maximum picture height */
|
|
|
|
{
|
|
|
|
picture_height = 0;
|
2019-08-19 05:14:37 +08:00
|
|
|
for (iter = images_src; iter; iter = iter->next)
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
height = gimp_image_height (iter->data);
|
2006-12-02 04:42:36 +08:00
|
|
|
if (height > picture_height) picture_height = height;
|
|
|
|
}
|
2000-02-09 10:32:35 +08:00
|
|
|
film_height = (int)(picture_height / filmvals.picture_height + 0.5);
|
|
|
|
filmvals.film_height = film_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
film_height = filmvals.film_height;
|
|
|
|
picture_height = (int)(film_height * filmvals.picture_height + 0.5);
|
|
|
|
}
|
2004-12-13 06:00:31 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
picture_space = (int)(film_height * filmvals.picture_space + 0.5);
|
|
|
|
picture_y0 = (film_height - picture_height)/2;
|
|
|
|
|
|
|
|
number_height = film_height * filmvals.number_height;
|
|
|
|
|
|
|
|
/* Calculate total film width */
|
|
|
|
film_width = 0;
|
|
|
|
num_pictures = 0;
|
2019-08-27 19:26:27 +08:00
|
|
|
for (iter = images_src; iter; iter = g_list_next (iter))
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
2019-08-27 19:26:27 +08:00
|
|
|
layers = gimp_image_list_layers (iter->data);
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
/* Get scaled image size */
|
2019-08-19 05:14:37 +08:00
|
|
|
width = gimp_image_width (iter->data);
|
|
|
|
height = gimp_image_height (iter->data);
|
2000-02-09 10:32:35 +08:00
|
|
|
f = ((double)picture_height) / (double)height;
|
|
|
|
picture_width = width * f;
|
|
|
|
|
2019-08-27 19:26:27 +08:00
|
|
|
for (iter2 = layers; iter2; iter2 = g_list_next (iter2))
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
if (gimp_layer_is_floating_sel (iter2->data))
|
2006-12-02 04:42:36 +08:00
|
|
|
continue;
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2006-12-02 04:42:36 +08:00
|
|
|
film_width += (picture_space/2); /* Leading space */
|
|
|
|
film_width += picture_width; /* Scaled image width */
|
|
|
|
film_width += (picture_space/2); /* Trailing space */
|
|
|
|
num_pictures++;
|
|
|
|
}
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
g_list_free (layers);
|
2000-02-09 10:32:35 +08:00
|
|
|
}
|
2004-12-13 06:00:31 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#ifdef FILM_DEBUG
|
2003-12-06 00:30:01 +08:00
|
|
|
g_printerr ("film_height = %d, film_width = %d\n", film_height, film_width);
|
|
|
|
g_printerr ("picture_height = %d, picture_space = %d, picture_y0 = %d\n",
|
|
|
|
picture_height, picture_space, picture_y0);
|
|
|
|
g_printerr ("Number of pictures = %d\n", num_pictures);
|
1997-11-25 06:05:25 +08:00
|
|
|
#endif
|
|
|
|
|
2019-09-12 03:48:34 +08:00
|
|
|
image_dst = create_new_image ((guint) film_width, (guint) film_height,
|
2019-08-19 05:14:37 +08:00
|
|
|
GIMP_RGB_IMAGE, &layer_dst);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
/* Fill film background */
|
2019-08-19 05:14:37 +08:00
|
|
|
gimp_drawable_fill (GIMP_DRAWABLE (layer_dst), GIMP_FILL_BACKGROUND);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
/* Draw all the holes */
|
|
|
|
hole_offset = film_height * filmvals.hole_offset;
|
2019-06-29 00:40:41 +08:00
|
|
|
hole_width = film_height * filmvals.hole_width;
|
2000-02-09 10:32:35 +08:00
|
|
|
hole_height = film_height * filmvals.hole_height;
|
2019-06-29 00:40:41 +08:00
|
|
|
hole_space = film_height * filmvals.hole_space;
|
2000-02-09 10:32:35 +08:00
|
|
|
hole_x = hole_space / 2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
#ifdef FILM_DEBUG
|
2003-12-06 00:30:01 +08:00
|
|
|
g_printerr ("hole_x %d hole_offset %d hole_width %d hole_height %d hole_space %d\n",
|
|
|
|
hole_x, hole_offset, hole_width, hole_height, hole_space );
|
1997-11-25 06:05:25 +08:00
|
|
|
#endif
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
hole = create_hole_rgb (hole_width, hole_height);
|
|
|
|
if (hole)
|
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
GeglBuffer *buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer_dst));
|
2019-06-29 00:40:41 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
while (hole_x < film_width)
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
2019-06-29 00:40:41 +08:00
|
|
|
gegl_buffer_set (buffer,
|
|
|
|
GEGL_RECTANGLE (hole_x,
|
|
|
|
hole_offset,
|
|
|
|
hole_width,
|
|
|
|
hole_height), 0,
|
|
|
|
babl_format ("R'G'B' u8"), hole,
|
|
|
|
GEGL_AUTO_ROWSTRIDE);
|
|
|
|
|
|
|
|
gegl_buffer_set (buffer,
|
|
|
|
GEGL_RECTANGLE (hole_x,
|
|
|
|
film_height - hole_offset - hole_height,
|
|
|
|
hole_width,
|
|
|
|
hole_height), 0,
|
|
|
|
babl_format ("R'G'B' u8"), hole,
|
|
|
|
GEGL_AUTO_ROWSTRIDE);
|
2006-12-02 04:42:36 +08:00
|
|
|
|
|
|
|
hole_x += hole_width + hole_space;
|
|
|
|
}
|
2019-06-29 00:40:41 +08:00
|
|
|
|
|
|
|
g_object_unref (buffer);
|
2000-02-09 10:32:35 +08:00
|
|
|
g_free (hole);
|
|
|
|
}
|
2006-12-02 04:42:36 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
/* Compose all images and layers */
|
|
|
|
picture_x0 = 0;
|
|
|
|
picture_count = 0;
|
2019-08-19 05:14:37 +08:00
|
|
|
for (iter = images_src; iter; iter = iter->next)
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
image_tmp = gimp_image_duplicate (iter->data);
|
|
|
|
width = gimp_image_width (image_tmp);
|
|
|
|
height = gimp_image_height (image_tmp);
|
2000-02-14 21:23:12 +08:00
|
|
|
f = ((gdouble) picture_height) / (gdouble) height;
|
2000-02-09 10:32:35 +08:00
|
|
|
picture_width = width * f;
|
2019-08-19 05:14:37 +08:00
|
|
|
if (gimp_image_base_type (image_tmp) != GIMP_RGB)
|
|
|
|
gimp_image_convert_rgb (image_tmp);
|
|
|
|
gimp_image_scale (image_tmp, picture_width, picture_height);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-27 19:26:27 +08:00
|
|
|
layers = gimp_image_list_layers (image_tmp);
|
|
|
|
|
|
|
|
for (iter2 = layers; iter2; iter2 = g_list_next (iter2))
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
if (gimp_layer_is_floating_sel (iter2->data))
|
2006-12-02 04:42:36 +08:00
|
|
|
continue;
|
|
|
|
|
|
|
|
picture_x0 += picture_space / 2;
|
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
layer_src = iter2->data;
|
|
|
|
gimp_layer_resize_to_image_size (layer_src);
|
|
|
|
new_layer = gimp_layer_new_from_drawable (GIMP_DRAWABLE (layer_src),
|
|
|
|
image_dst);
|
|
|
|
gimp_image_insert_layer (image_dst, new_layer, NULL, -1);
|
2008-10-20 14:04:39 +08:00
|
|
|
gimp_layer_set_offsets (new_layer, picture_x0, picture_y0);
|
2006-12-02 04:42:36 +08:00
|
|
|
|
|
|
|
/* Draw picture numbers */
|
|
|
|
if ((number_height > 0) &&
|
|
|
|
(filmvals.number_pos[0] || filmvals.number_pos[1]))
|
|
|
|
{
|
|
|
|
if (filmvals.number_pos[0])
|
2019-08-19 05:14:37 +08:00
|
|
|
draw_number (layer_dst,
|
2008-10-20 14:04:39 +08:00
|
|
|
filmvals.number_start + picture_count,
|
2006-12-02 04:42:36 +08:00
|
|
|
picture_x0 + picture_width/2,
|
|
|
|
(hole_offset-number_height)/2, number_height);
|
|
|
|
if (filmvals.number_pos[1])
|
2019-08-19 05:14:37 +08:00
|
|
|
draw_number (layer_dst,
|
2008-10-20 14:04:39 +08:00
|
|
|
filmvals.number_start + picture_count,
|
2006-12-02 04:42:36 +08:00
|
|
|
picture_x0 + picture_width/2,
|
|
|
|
film_height - (hole_offset + number_height)/2,
|
|
|
|
number_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
picture_x0 += picture_width + (picture_space/2);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2004-08-31 03:01:41 +08:00
|
|
|
gimp_progress_update (((gdouble) (picture_count + 1)) /
|
|
|
|
(gdouble) num_pictures);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2006-12-02 04:42:36 +08:00
|
|
|
picture_count++;
|
|
|
|
}
|
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
g_list_free (layers);
|
2019-08-27 19:26:27 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
gimp_image_delete (image_tmp);
|
2000-02-09 10:32:35 +08:00
|
|
|
}
|
2019-08-27 19:26:27 +08:00
|
|
|
|
2019-09-12 18:42:09 +08:00
|
|
|
g_list_free (images_src);
|
|
|
|
|
2011-04-11 01:05:08 +08:00
|
|
|
gimp_progress_update (1.0);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
gimp_image_flatten (image_dst);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
/* Drawing text/numbers leaves us with a floating selection. Stop it */
|
2019-08-19 05:14:37 +08:00
|
|
|
floating_sel = gimp_image_get_floating_sel (image_dst);
|
|
|
|
if (floating_sel)
|
2006-12-02 04:42:36 +08:00
|
|
|
gimp_floating_sel_anchor (floating_sel);
|
2000-08-03 08:48:55 +08:00
|
|
|
|
2004-12-13 06:00:31 +08:00
|
|
|
gimp_context_pop ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
return image_dst;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check filmvals. Unreasonable values are reset to a default. */
|
2003-06-10 21:19:22 +08:00
|
|
|
/* If this is not possible, FALSE is returned. Otherwise TRUE is returned. */
|
|
|
|
static gboolean
|
1997-11-25 06:05:25 +08:00
|
|
|
check_filmvals (void)
|
|
|
|
{
|
2019-09-12 18:42:09 +08:00
|
|
|
gint i, j;
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
if (filmvals.film_height < 10)
|
|
|
|
filmvals.film_height = 10;
|
|
|
|
|
|
|
|
if (filmvals.number_start < 0)
|
|
|
|
filmvals.number_start = 0;
|
|
|
|
|
2004-06-19 10:17:58 +08:00
|
|
|
if (filmvals.number_font[0] == '\0')
|
|
|
|
strcpy (filmvals.number_font, "Monospace");
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2019-09-12 18:42:09 +08:00
|
|
|
for (i = 0, j = 0; i < filmvals.num_images; i++)
|
|
|
|
{
|
|
|
|
if (gimp_image_id_is_valid (filmvals.images[i]))
|
|
|
|
{
|
|
|
|
filmvals.images[j] = filmvals.images[i];
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
filmvals.num_images = j;
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
if (filmvals.num_images < 1)
|
2003-06-10 21:19:22 +08:00
|
|
|
return FALSE;
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Assigns numpix pixels starting at dst with color r,g,b */
|
|
|
|
static void
|
2001-01-12 07:36:59 +08:00
|
|
|
set_pixels (gint numpix,
|
|
|
|
guchar *dst,
|
|
|
|
GimpRGB *color)
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
2006-12-02 04:42:36 +08:00
|
|
|
register gint k;
|
2000-02-09 10:32:35 +08:00
|
|
|
register guchar ur, ug, ub, *udest;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-01-12 07:36:59 +08:00
|
|
|
ur = color->r * 255.999;
|
|
|
|
ug = color->g * 255.999;
|
|
|
|
ub = color->b * 255.999;
|
2000-02-09 10:32:35 +08:00
|
|
|
k = numpix;
|
|
|
|
udest = dst;
|
2001-01-12 07:36:59 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
while (k-- > 0)
|
|
|
|
{
|
|
|
|
*(udest++) = ur;
|
|
|
|
*(udest++) = ug;
|
|
|
|
*(udest++) = ub;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create the RGB-pixels that make up the hole */
|
2000-02-09 10:32:35 +08:00
|
|
|
static guchar *
|
|
|
|
create_hole_rgb (gint width,
|
2006-12-02 04:42:36 +08:00
|
|
|
gint height)
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
|
|
|
guchar *hole, *top, *bottom;
|
2006-12-02 04:42:36 +08:00
|
|
|
gint radius, length, k;
|
2000-02-09 10:32:35 +08:00
|
|
|
|
|
|
|
hole = g_new (guchar, width * height * 3);
|
|
|
|
|
|
|
|
/* Fill a rectangle with white */
|
|
|
|
memset (hole, 255, width * height * 3);
|
|
|
|
radius = height / 4;
|
|
|
|
if (radius > width / 2)
|
|
|
|
radius = width / 2;
|
|
|
|
top = hole;
|
|
|
|
bottom = hole + (height-1)*width*3;
|
|
|
|
for (k = radius-1; k > 0; k--) /* Rounding corners */
|
|
|
|
{
|
2006-12-02 04:42:36 +08:00
|
|
|
length = (int)(radius - sqrt ((gdouble) (radius * radius - k * k))
|
2008-10-20 14:04:39 +08:00
|
|
|
- 0.5);
|
2000-02-09 10:32:35 +08:00
|
|
|
if (length > 0)
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
|
|
|
set_pixels (length, top, &filmvals.film_color);
|
|
|
|
set_pixels (length, top + (width-length)*3, &filmvals.film_color);
|
|
|
|
set_pixels (length, bottom, &filmvals.film_color);
|
|
|
|
set_pixels (length, bottom + (width-length)*3, &filmvals.film_color);
|
|
|
|
}
|
2000-02-09 10:32:35 +08:00
|
|
|
top += width*3;
|
|
|
|
bottom -= width*3;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hole;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw the number of the picture onto the film */
|
|
|
|
static void
|
2019-08-19 05:14:37 +08:00
|
|
|
draw_number (GimpLayer *layer,
|
|
|
|
gint num,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint height)
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
2006-12-02 04:42:36 +08:00
|
|
|
gchar buf[32];
|
|
|
|
gint k, delta, max_delta;
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpImage *image;
|
|
|
|
GimpLayer *text_layer;
|
2006-12-02 04:42:36 +08:00
|
|
|
gint text_width, text_height, text_ascent, descent;
|
|
|
|
gchar *fontname = filmvals.number_font;
|
2000-02-09 10:32:35 +08:00
|
|
|
|
|
|
|
g_snprintf (buf, sizeof (buf), "%d", num);
|
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
image = gimp_item_get_image (GIMP_ITEM (layer));
|
2000-02-09 10:32:35 +08:00
|
|
|
|
|
|
|
max_delta = height / 10;
|
|
|
|
if (max_delta < 1)
|
|
|
|
max_delta = 1;
|
|
|
|
|
2018-04-19 02:57:03 +08:00
|
|
|
/* Numbers don't need the descent. Inquire it and move the text down */
|
2004-06-19 10:17:58 +08:00
|
|
|
for (k = 0; k < max_delta * 2 + 1; k++)
|
|
|
|
{
|
|
|
|
/* Try different font sizes if inquire of extent failed */
|
|
|
|
gboolean success;
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
delta = (k+1) / 2;
|
2004-06-19 10:17:58 +08:00
|
|
|
|
|
|
|
if ((k & 1) == 0)
|
2006-12-02 04:42:36 +08:00
|
|
|
delta = -delta;
|
2004-06-19 10:17:58 +08:00
|
|
|
|
|
|
|
success = gimp_text_get_extents_fontname (buf,
|
2006-12-02 04:42:36 +08:00
|
|
|
height + delta, GIMP_PIXELS,
|
|
|
|
fontname,
|
|
|
|
&text_width, &text_height,
|
|
|
|
&text_ascent, &descent);
|
2004-06-19 10:17:58 +08:00
|
|
|
|
|
|
|
if (success)
|
2006-12-02 04:42:36 +08:00
|
|
|
{
|
|
|
|
height += delta;
|
|
|
|
break;
|
|
|
|
}
|
2000-02-09 10:32:35 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
text_layer = gimp_text_fontname (image, GIMP_DRAWABLE (layer),
|
|
|
|
x, y + descent / 2,
|
|
|
|
buf, 1, FALSE,
|
|
|
|
height, GIMP_PIXELS,
|
|
|
|
fontname);
|
2000-08-03 08:48:55 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
if (! text_layer)
|
2000-08-03 08:48:55 +08:00
|
|
|
g_message ("draw_number: Error in drawing text\n");
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
/* Create an image. Sets layer, drawable and rgn. Returns image */
|
|
|
|
static GimpImage *
|
2019-09-12 03:48:34 +08:00
|
|
|
create_new_image (guint width,
|
2000-02-09 10:32:35 +08:00
|
|
|
guint height,
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpImageType gdtype,
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpLayer **layer)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpImage *image;
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpImageBaseType gitype;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
if ((gdtype == GIMP_GRAY_IMAGE) || (gdtype == GIMP_GRAYA_IMAGE))
|
|
|
|
gitype = GIMP_GRAY;
|
|
|
|
else if ((gdtype == GIMP_INDEXED_IMAGE) || (gdtype == GIMP_INDEXEDA_IMAGE))
|
|
|
|
gitype = GIMP_INDEXED;
|
2000-02-09 10:32:35 +08:00
|
|
|
else
|
2000-08-22 09:26:57 +08:00
|
|
|
gitype = GIMP_RGB;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
image = gimp_image_new (width, height, gitype);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
gimp_image_undo_disable (image);
|
|
|
|
*layer = gimp_layer_new (image, _("Background"), width, height,
|
|
|
|
gdtype,
|
|
|
|
100,
|
|
|
|
gimp_image_get_default_new_layer_mode (image));
|
|
|
|
gimp_image_insert_layer (image, *layer, NULL, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
return image;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
static gchar *
|
2019-08-19 05:14:37 +08:00
|
|
|
compose_image_name (GimpImage *image)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-05-08 08:30:26 +08:00
|
|
|
gchar *image_name;
|
|
|
|
gchar *name;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
/* Compose a name of the basename and the image-ID */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
name = gimp_image_get_name (image);
|
2002-05-08 08:30:26 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
image_name = g_strdup_printf ("%s-%d", name, gimp_image_get_id (image));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-08 08:30:26 +08:00
|
|
|
g_free (name);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-08 08:30:26 +08:00
|
|
|
return image_name;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-06-10 21:19:22 +08:00
|
|
|
add_list_item_callback (GtkWidget *widget,
|
|
|
|
GtkTreeSelection *sel)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-06-10 21:19:22 +08:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GList *paths;
|
|
|
|
GList *list;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
paths = gtk_tree_selection_get_selected_rows (sel, &model);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
for (list = paths; list; list = g_list_next (list))
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
2003-06-10 21:19:22 +08:00
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter (model, &iter, list->data))
|
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpImage *image;
|
2002-05-08 08:30:26 +08:00
|
|
|
gchar *name;
|
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
gtk_tree_model_get (model, &iter,
|
2019-08-19 05:14:37 +08:00
|
|
|
0, &image,
|
2003-06-10 21:19:22 +08:00
|
|
|
1, &name,
|
|
|
|
-1);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
gtk_list_store_append (GTK_LIST_STORE (filmint.image_list_film),
|
|
|
|
&iter);
|
2002-05-08 08:30:26 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
gtk_list_store_set (GTK_LIST_STORE (filmint.image_list_film),
|
|
|
|
&iter,
|
2019-08-19 05:14:37 +08:00
|
|
|
0, image,
|
2003-06-10 21:19:22 +08:00
|
|
|
1, name,
|
|
|
|
-1);
|
2002-05-08 08:30:26 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
g_free (name);
|
2006-12-02 04:42:36 +08:00
|
|
|
}
|
2002-05-08 08:30:26 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
gtk_tree_path_free (list->data);
|
2000-02-09 10:32:35 +08:00
|
|
|
}
|
2003-06-10 21:19:22 +08:00
|
|
|
|
|
|
|
g_list_free (paths);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-06-10 21:19:22 +08:00
|
|
|
del_list_item_callback (GtkWidget *widget,
|
|
|
|
GtkTreeSelection *sel)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-06-10 21:19:22 +08:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GList *paths;
|
|
|
|
GList *references = NULL;
|
|
|
|
GList *list;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
paths = gtk_tree_selection_get_selected_rows (sel, &model);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
for (list = paths; list; list = g_list_next (list))
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
2003-06-10 21:19:22 +08:00
|
|
|
GtkTreeRowReference *ref;
|
|
|
|
|
|
|
|
ref = gtk_tree_row_reference_new (model, list->data);
|
|
|
|
references = g_list_prepend (references, ref);
|
|
|
|
gtk_tree_path_free (list->data);
|
2000-02-09 10:32:35 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
g_list_free (paths);
|
|
|
|
|
|
|
|
for (list = references; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
path = gtk_tree_row_reference_get_path (list->data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
if (gtk_tree_model_get_iter (model, &iter, path))
|
|
|
|
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
gtk_tree_row_reference_free (list->data);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
g_list_free (references);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
static GtkTreeModel *
|
2003-06-05 00:13:18 +08:00
|
|
|
add_image_list (gboolean add_box_flag,
|
2019-08-19 05:14:37 +08:00
|
|
|
GList *images,
|
2000-02-09 10:32:35 +08:00
|
|
|
GtkWidget *hbox)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-06-10 21:19:22 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *scrolled_win;
|
|
|
|
GtkWidget *tv;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkListStore *store;
|
|
|
|
GtkTreeSelection *sel;
|
2019-08-19 05:14:37 +08:00
|
|
|
GList *list;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-05 00:13:18 +08:00
|
|
|
label = gtk_label_new (add_box_flag ?
|
2005-08-23 07:39:12 +08:00
|
|
|
_("Available images:") :
|
|
|
|
_("On film:"));
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
2003-06-10 21:19:22 +08:00
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
|
|
|
|
GTK_SHADOW_IN);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (scrolled_win);
|
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
store = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING);
|
|
|
|
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
|
|
|
|
g_object_unref (store);
|
|
|
|
|
|
|
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tv), FALSE);
|
|
|
|
|
|
|
|
if (! add_box_flag)
|
|
|
|
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (tv), TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv), 0, NULL,
|
|
|
|
gtk_cell_renderer_text_new (),
|
|
|
|
"text", 1,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_win), tv);
|
|
|
|
gtk_widget_show (tv);
|
|
|
|
|
|
|
|
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv));
|
|
|
|
gtk_tree_selection_set_mode (sel, GTK_SELECTION_MULTIPLE);
|
2003-06-05 00:13:18 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
for (list = images; list; list = list->next)
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
2003-06-10 21:19:22 +08:00
|
|
|
GtkTreeIter iter;
|
|
|
|
gchar *name;
|
2002-05-08 08:30:26 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
gtk_list_store_append (store, &iter);
|
2002-05-08 08:30:26 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
name = compose_image_name (list->data);
|
2003-06-10 21:19:22 +08:00
|
|
|
|
|
|
|
gtk_list_store_set (store, &iter,
|
2019-08-19 05:14:37 +08:00
|
|
|
0, gimp_image_get_id (list->data),
|
2003-06-10 21:19:22 +08:00
|
|
|
1, name,
|
|
|
|
-1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
g_free (name);
|
2000-02-09 10:32:35 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (add_box_flag ?
|
|
|
|
_("_Add") : _("_Remove"));
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2001-12-29 21:26:29 +08:00
|
|
|
add_box_flag ?
|
|
|
|
G_CALLBACK (add_list_item_callback) :
|
|
|
|
G_CALLBACK (del_list_item_callback),
|
2003-06-10 21:19:22 +08:00
|
|
|
sel);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2003-06-10 21:19:22 +08:00
|
|
|
return GTK_TREE_MODEL (store);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-05-31 03:43:54 +08:00
|
|
|
static void
|
2003-11-06 23:27:05 +08:00
|
|
|
create_selection_tab (GtkWidget *notebook,
|
2019-08-19 05:14:37 +08:00
|
|
|
GimpImage *image)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2017-12-31 20:57:41 +08:00
|
|
|
GimpColorConfig *config;
|
|
|
|
GtkSizeGroup *group;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *vbox2;
|
|
|
|
GtkWidget *hbox;
|
2018-05-08 08:34:33 +08:00
|
|
|
GtkWidget *grid;
|
2017-12-31 20:57:41 +08:00
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *toggle;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkAdjustment *adj;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *font_button;
|
2019-08-27 19:26:27 +08:00
|
|
|
GList *image_list;
|
2019-08-19 05:14:37 +08:00
|
|
|
gint j;
|
2004-05-19 20:08:05 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
2004-05-19 20:08:05 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
2003-06-05 00:13:18 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), hbox,
|
2004-05-27 01:29:30 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("Selection")));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
|
2018-05-08 08:34:33 +08:00
|
|
|
gtk_widget_set_hexpand (vbox2, FALSE);
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_widget_show (vbox2);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-19 20:08:05 +08:00
|
|
|
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
|
2013-06-07 05:26:16 +08:00
|
|
|
/* Film height/color */
|
2005-06-17 07:45:32 +08:00
|
|
|
frame = gimp_frame_new (_("Filmstrip"));
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, FALSE, 0);
|
2003-05-31 03:43:54 +08:00
|
|
|
gtk_widget_show (frame);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
2003-05-31 03:43:54 +08:00
|
|
|
gtk_widget_show (vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1997-12-26 15:08:20 +08:00
|
|
|
/* Keep maximum image height */
|
2004-05-27 01:29:30 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("_Fit height to images"));
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
1997-12-26 15:08:20 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&filmvals.keep_height);
|
|
|
|
|
2018-05-08 08:34:33 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (grid);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Film height */
|
2018-06-25 00:15:16 +08:00
|
|
|
adj = gtk_adjustment_new (filmvals.film_height, 10,
|
|
|
|
GIMP_MAX_IMAGE_SIZE, 1, 10, 0);
|
2019-03-09 20:25:19 +08:00
|
|
|
spinbutton = gimp_spin_button_new (adj, 1, 0);
|
2016-05-18 15:49:22 +08:00
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
|
|
|
|
2018-05-08 08:34:33 +08:00
|
|
|
label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 0,
|
|
|
|
_("_Height:"), 0.0, 0.5,
|
|
|
|
spinbutton, 1);
|
2004-05-19 20:08:05 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
|
|
|
g_object_unref (group);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
|
|
|
&filmvals.film_height);
|
|
|
|
|
2011-05-11 17:41:26 +08:00
|
|
|
g_object_bind_property (toggle, "active",
|
|
|
|
spinbutton, "sensitive",
|
|
|
|
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
|
|
|
|
g_object_bind_property (toggle, "active",
|
|
|
|
/* FIXME: eeeeeek */
|
2018-05-08 08:34:33 +08:00
|
|
|
g_list_nth_data (gtk_container_get_children (GTK_CONTAINER (grid)), 1), "sensitive",
|
2011-05-11 17:41:26 +08:00
|
|
|
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
2006-12-02 04:42:36 +08:00
|
|
|
filmvals.keep_height);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
/* Film color */
|
|
|
|
button = gimp_color_button_new (_("Select Film Color"),
|
2006-12-02 04:42:36 +08:00
|
|
|
COLOR_BUTTON_WIDTH, COLOR_BUTTON_HEIGHT,
|
|
|
|
&filmvals.film_color,
|
|
|
|
GIMP_COLOR_AREA_FLAT);
|
2018-05-08 08:34:33 +08:00
|
|
|
label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
|
|
|
|
_("Co_lor:"), 0.0, 0.5,
|
|
|
|
button, 1);
|
2004-05-19 20:08:05 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (button, "color-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_color_button_get_color),
|
|
|
|
&filmvals.film_color);
|
|
|
|
|
2017-12-31 20:57:41 +08:00
|
|
|
config = gimp_get_color_configuration ();
|
|
|
|
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (button), config);
|
|
|
|
|
2013-06-07 05:26:16 +08:00
|
|
|
/* Film numbering: Startindex/Font/color */
|
2004-05-19 20:08:05 +08:00
|
|
|
frame = gimp_frame_new (_("Numbering"));
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), frame, TRUE, TRUE, 0);
|
2003-05-31 03:43:54 +08:00
|
|
|
gtk_widget_show (frame);
|
2003-11-27 03:20:24 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
2003-05-31 03:43:54 +08:00
|
|
|
gtk_widget_show (vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2018-05-08 08:34:33 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (grid);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Startindex */
|
2018-06-25 00:15:16 +08:00
|
|
|
adj = gtk_adjustment_new (filmvals.number_start, 0,
|
|
|
|
GIMP_MAX_IMAGE_SIZE, 1, 10, 0);
|
2019-03-09 20:25:19 +08:00
|
|
|
spinbutton = gimp_spin_button_new (adj, 1, 0);
|
2016-05-18 15:49:22 +08:00
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
|
|
|
|
2018-05-08 08:34:33 +08:00
|
|
|
label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 0,
|
|
|
|
_("Start _index:"), 0.0, 0.5,
|
|
|
|
spinbutton, 1);
|
2004-05-19 20:08:05 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
|
|
|
&filmvals.number_start);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Fontfamily for numbering */
|
2005-06-05 06:36:05 +08:00
|
|
|
font_button = gimp_font_select_button_new (NULL, filmvals.number_font);
|
|
|
|
g_signal_connect (font_button, "font-set",
|
|
|
|
G_CALLBACK (film_font_select_callback), &filmvals);
|
2018-05-08 08:34:33 +08:00
|
|
|
label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
|
|
|
|
_("_Font:"), 0.0, 0.5,
|
|
|
|
font_button, 1);
|
2004-05-19 20:08:05 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
|
|
|
/* Numbering color */
|
|
|
|
button = gimp_color_button_new (_("Select Number Color"),
|
2006-12-02 04:42:36 +08:00
|
|
|
COLOR_BUTTON_WIDTH, COLOR_BUTTON_HEIGHT,
|
|
|
|
&filmvals.number_color,
|
|
|
|
GIMP_COLOR_AREA_FLAT);
|
2018-05-08 08:34:33 +08:00
|
|
|
label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 2,
|
|
|
|
_("Co_lor:"), 0.0, 0.5,
|
|
|
|
button, 1);
|
2004-05-19 20:08:05 +08:00
|
|
|
gtk_size_group_add_widget (group, label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (button, "color-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_color_button_get_color),
|
|
|
|
&filmvals.number_color);
|
|
|
|
|
2017-12-31 20:57:41 +08:00
|
|
|
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (button), config);
|
|
|
|
g_object_unref (config);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
for (j = 0; j < 2; j++)
|
2000-02-09 10:32:35 +08:00
|
|
|
{
|
2004-05-27 01:29:30 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (j ? _("At _bottom")
|
|
|
|
: _("At _top"));
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
2006-12-02 04:42:36 +08:00
|
|
|
filmvals.number_pos[j]);
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_widget_show (toggle);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
2003-06-05 00:13:18 +08:00
|
|
|
&filmvals.number_pos[j]);
|
2000-02-09 10:32:35 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*** The right frame keeps the image selection ***/
|
2004-05-19 20:08:05 +08:00
|
|
|
frame = gimp_frame_new (_("Image Selection"));
|
2018-05-08 08:34:33 +08:00
|
|
|
gtk_widget_set_hexpand (frame, TRUE);
|
2000-02-09 10:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
2003-05-31 03:43:54 +08:00
|
|
|
gtk_widget_show (frame);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
|
|
|
|
|
|
|
/* Get a list of all image names */
|
2019-08-27 19:26:27 +08:00
|
|
|
image_list = gimp_list_images ();
|
|
|
|
filmint.image_list_all = add_image_list (TRUE, image_list, hbox);
|
|
|
|
g_list_free (image_list);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Get a list of the images used for the film */
|
2019-08-27 19:26:27 +08:00
|
|
|
image_list = g_list_prepend (NULL, image);
|
|
|
|
filmint.image_list_film = add_image_list (FALSE, image_list, hbox);
|
|
|
|
g_list_free (image_list);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
2003-05-31 03:43:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
create_advanced_tab (GtkWidget *notebook)
|
|
|
|
{
|
2010-10-25 07:26:00 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
2018-05-08 08:34:33 +08:00
|
|
|
GtkWidget *grid;
|
2010-10-25 07:26:00 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkAdjustment *adj;
|
|
|
|
GtkWidget *button;
|
|
|
|
gint row;
|
2003-05-31 03:43:54 +08:00
|
|
|
|
2005-06-17 07:45:32 +08:00
|
|
|
frame = gimp_frame_new (_("All Values are Fractions of the Strip Height"));
|
2004-05-19 20:08:05 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
|
2003-06-05 00:13:18 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame,
|
|
|
|
gtk_label_new_with_mnemonic (_("Ad_vanced")));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (frame);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2003-06-05 00:13:18 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2018-05-08 08:34:33 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (grid);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
|
|
|
row = 0;
|
|
|
|
|
|
|
|
filmint.advanced_adj[0] = adj =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
|
|
|
|
_("Image _height:"), 0, 0,
|
|
|
|
filmvals.picture_height,
|
|
|
|
0.0, 1.0, 0.001, 0.01, 3,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&filmvals.picture_height);
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
filmint.advanced_adj[1] = adj =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
|
|
|
|
_("Image spac_ing:"), 0, 0,
|
|
|
|
filmvals.picture_space,
|
|
|
|
0.0, 1.0, 0.001, 0.01, 3,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2018-05-08 08:34:33 +08:00
|
|
|
gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 0, 1), 6);
|
|
|
|
gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 1, 1), 6);
|
|
|
|
gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 2, 1), 6);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&filmvals.picture_space);
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
filmint.advanced_adj[2] = adj =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
|
|
|
|
_("_Hole offset:"), 0, 0,
|
|
|
|
filmvals.hole_offset,
|
|
|
|
0.0, 1.0, 0.001, 0.01, 3,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&filmvals.hole_offset);
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
filmint.advanced_adj[3] = adj =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
|
|
|
|
_("Ho_le width:"), 0, 0,
|
|
|
|
filmvals.hole_width,
|
|
|
|
0.0, 1.0, 0.001, 0.01, 3,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&filmvals.hole_width);
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
filmint.advanced_adj[4] = adj =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
|
|
|
|
_("Hol_e height:"), 0, 0,
|
|
|
|
filmvals.hole_height,
|
|
|
|
0.0, 1.0, 0.001, 0.01, 3,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&filmvals.hole_height);
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
filmint.advanced_adj[5] = adj =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
|
|
|
|
_("Hole sp_acing:"), 0, 0,
|
|
|
|
filmvals.hole_space,
|
|
|
|
0.0, 1.0, 0.001, 0.01, 3,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2018-05-08 08:34:33 +08:00
|
|
|
gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 0, 5), 6);
|
|
|
|
gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 1, 5), 6);
|
|
|
|
gtk_widget_set_margin_bottom (gtk_grid_get_child_at (GTK_GRID (grid), 2, 5), 6);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&filmvals.hole_space);
|
|
|
|
|
2000-02-09 10:32:35 +08:00
|
|
|
filmint.advanced_adj[6] = adj =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, row++,
|
|
|
|
_("_Number height:"), 0, 0,
|
|
|
|
filmvals.number_height,
|
|
|
|
0.0, 1.0, 0.001, 0.01, 3,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&filmvals.number_height);
|
2003-06-05 00:13:18 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2003-06-05 00:13:18 +08:00
|
|
|
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("Re_set"));
|
2003-06-05 00:13:18 +08:00
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
g_signal_connect (button, "clicked",
|
|
|
|
G_CALLBACK (film_reset_callback),
|
|
|
|
NULL);
|
2003-05-31 03:43:54 +08:00
|
|
|
}
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2003-06-19 19:36:12 +08:00
|
|
|
static gboolean
|
2019-08-19 05:14:37 +08:00
|
|
|
film_dialog (GimpImage *image)
|
2003-05-31 03:43:54 +08:00
|
|
|
{
|
|
|
|
GtkWidget *dlg;
|
|
|
|
GtkWidget *main_vbox;
|
|
|
|
GtkWidget *notebook;
|
2003-11-06 23:27:05 +08:00
|
|
|
gboolean run;
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2019-09-21 01:39:00 +08:00
|
|
|
gimp_ui_init (PLUG_IN_BINARY);
|
2000-02-09 10:32:35 +08:00
|
|
|
|
2011-04-09 02:31:34 +08:00
|
|
|
dlg = gimp_dialog_new (_("Filmstrip"), PLUG_IN_ROLE,
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL, 0,
|
2006-12-02 04:42:36 +08:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2017-02-12 23:18:24 +08:00
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
_("_OK"), GTK_RESPONSE_OK,
|
2003-05-31 03:43:54 +08:00
|
|
|
|
2006-12-02 04:42:36 +08:00
|
|
|
NULL);
|
2003-05-31 03:43:54 +08:00
|
|
|
|
2018-05-10 23:04:37 +08:00
|
|
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
|
2005-08-14 05:39:56 +08:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
2005-02-09 04:40:33 +08:00
|
|
|
|
2005-09-10 02:07:31 +08:00
|
|
|
gimp_window_set_transient (GTK_WINDOW (dlg));
|
2005-09-06 05:40:29 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2004-05-19 20:08:05 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
2011-03-04 17:44:58 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
|
|
|
|
main_vbox, TRUE, TRUE, 0);
|
2003-05-31 03:43:54 +08:00
|
|
|
gtk_widget_show (main_vbox);
|
|
|
|
|
2003-06-05 00:13:18 +08:00
|
|
|
notebook = gtk_notebook_new ();
|
2003-05-31 03:43:54 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);
|
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
create_selection_tab (notebook, image);
|
2003-05-31 03:43:54 +08:00
|
|
|
create_advanced_tab (notebook);
|
|
|
|
|
|
|
|
gtk_widget_show (notebook);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (dlg);
|
|
|
|
|
2003-11-12 02:11:56 +08:00
|
|
|
run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
if (run)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
gint num_images = 0;
|
|
|
|
gboolean iter_valid;
|
|
|
|
GtkTreeIter iter;
|
2003-06-10 21:19:22 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
for (iter_valid = gtk_tree_model_get_iter_first (filmint.image_list_film,
|
|
|
|
&iter);
|
|
|
|
iter_valid;
|
|
|
|
iter_valid = gtk_tree_model_iter_next (filmint.image_list_film,
|
|
|
|
&iter))
|
|
|
|
{
|
2019-08-19 05:14:37 +08:00
|
|
|
gint image_id;
|
2003-06-10 21:19:22 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_tree_model_get (filmint.image_list_film, &iter,
|
2019-08-19 05:14:37 +08:00
|
|
|
0, &image_id,
|
2003-11-06 23:27:05 +08:00
|
|
|
-1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-19 05:14:37 +08:00
|
|
|
if ((image_id >= 0) && (num_images < MAX_FILM_PICTURES))
|
2019-09-08 21:51:51 +08:00
|
|
|
{
|
2019-09-12 18:42:09 +08:00
|
|
|
filmvals.images[num_images] = image_id;
|
|
|
|
num_images++;
|
2019-09-08 21:51:51 +08:00
|
|
|
}
|
2003-11-06 23:27:05 +08:00
|
|
|
}
|
2019-09-12 18:42:09 +08:00
|
|
|
|
|
|
|
filmvals.num_images = num_images;
|
2003-11-06 23:27:05 +08:00
|
|
|
}
|
2003-06-10 21:19:22 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_widget_destroy (dlg);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
return run;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1997-12-26 15:08:20 +08:00
|
|
|
static void
|
2000-02-09 10:32:35 +08:00
|
|
|
film_reset_callback (GtkWidget *widget,
|
2006-12-02 04:42:36 +08:00
|
|
|
gpointer data)
|
1997-12-26 15:08:20 +08:00
|
|
|
{
|
2001-12-06 10:28:58 +08:00
|
|
|
gint i;
|
1997-12-26 15:08:20 +08:00
|
|
|
|
2001-12-06 10:28:58 +08:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (advanced_defaults) ; i++)
|
2010-10-25 07:26:00 +08:00
|
|
|
gtk_adjustment_set_value (filmint.advanced_adj[i],
|
2006-12-02 04:42:36 +08:00
|
|
|
advanced_defaults[i]);
|
1997-12-26 15:08:20 +08:00
|
|
|
}
|
2003-06-05 01:54:16 +08:00
|
|
|
|
|
|
|
static void
|
2005-06-05 06:36:05 +08:00
|
|
|
film_font_select_callback (GimpFontSelectButton *button,
|
|
|
|
const gchar *name,
|
|
|
|
gboolean closing,
|
|
|
|
gpointer data)
|
2003-06-05 01:54:16 +08:00
|
|
|
{
|
|
|
|
FilmVals *vals = (FilmVals *) data;
|
|
|
|
|
2004-06-19 10:17:58 +08:00
|
|
|
g_strlcpy (vals->number_font, name, FONT_LEN);
|
2003-06-05 01:54:16 +08:00
|
|
|
}
|