1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* CML_explorer.c -- This is a plug-in for The GIMP 1.0
|
2000-02-13 17:29:59 +08:00
|
|
|
* Time-stamp: <2000-02-13 18:18:37 yasuhiro>
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1997 Shuji Narazaki <narazaki@InetQ.or.jp>
|
1997-12-09 13:54:04 +08:00
|
|
|
* Version: 1.0.11
|
1997-11-25 06:05:25 +08:00
|
|
|
* URL: http://www.inetq.or.jp/~narazaki/TheGIMP/
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
|
|
|
* Comment:
|
|
|
|
* CML is the abbreviation of Coupled-Map Lattice that is a model of
|
|
|
|
* complex systems, proposed by a physicist[1,2].
|
|
|
|
*
|
|
|
|
* Similar models are summaried as follows:
|
|
|
|
*
|
2004-07-31 02:45:34 +08:00
|
|
|
* Value Time Space
|
|
|
|
* Coupled-Map Lattice cont. discrete discrete
|
|
|
|
* Celluar Automata discrete discrete discrete
|
|
|
|
* Diffrential Eq. cont. cont. cont.
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
|
|
|
* (But this program uses a parameter: hold-rate to avoid very fast changes.
|
|
|
|
* Thus time is rather continuous than discrete.
|
|
|
|
* Yes, this change to model changes the output completely.)
|
|
|
|
*
|
|
|
|
* References:
|
|
|
|
* 1. Kunihiko Kaneko, Period-doubling of kind-antikink patterns,
|
|
|
|
* quasi-periodicity in antiferro-like structures and spatial
|
|
|
|
* intermittency in coupled map lattices -- Toward a prelude to a
|
|
|
|
* "field theory of chaos", Prog. Theor. Phys. 72 (1984) 480.
|
|
|
|
*
|
|
|
|
* 2. Kunihiko Kaneko ed., Theory and Applications of Coupled Map
|
|
|
|
* Lattices (Wiley, 1993).
|
|
|
|
*
|
|
|
|
* About Parameter File:
|
|
|
|
* I assume that the possible longest line in CMP parameter file is 1023.
|
|
|
|
* Please read CML_save_to_file_callback if you want know details of syntax.
|
|
|
|
*
|
|
|
|
* Format version 1.0 starts with:
|
|
|
|
* ; This is a parameter file for CML_explorer
|
|
|
|
* ; File format version: 1.0
|
|
|
|
* ;
|
2004-07-31 02:45:34 +08:00
|
|
|
* Hue
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
|
|
|
* The old format for CML_explorer included in gimp-0.99.[89] is:
|
|
|
|
* ; CML parameter file (version: 1.0)
|
2004-07-31 02:45:34 +08:00
|
|
|
* ; Hue
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
|
|
|
* (This file format is interpreted as format version 0.99 now.)
|
|
|
|
*
|
|
|
|
* Thanks:
|
|
|
|
* This version contains patches from:
|
|
|
|
* Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
|
|
|
|
* Sean P Cier <scier@andrew.cmu.edu>
|
|
|
|
* David Mosberger-Tang <davidm@azstarnet.com>
|
|
|
|
* Michael Sweet <mike@easysw.com>
|
|
|
|
*
|
|
|
|
*/
|
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 <errno.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2005-03-04 23:12:29 +08:00
|
|
|
#include <glib/gstdio.h>
|
2000-01-07 00:40:17 +08:00
|
|
|
|
2000-01-18 01:02:26 +08:00
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
|
|
|
|
2000-01-07 00:40:17 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1999-05-30 00:35:47 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
#define PARAM_FILE_FORMAT_VERSION 1.0
|
2005-08-14 02:29:14 +08:00
|
|
|
#define PLUG_IN_PROC "plug-in-cml-explorer"
|
|
|
|
#define PLUG_IN_BINARY "CML_explorer"
|
2000-01-28 03:26:00 +08:00
|
|
|
#define VALS CML_explorer_vals
|
|
|
|
#define PROGRESS_UPDATE_NUM 100
|
|
|
|
#define CML_LINE_SIZE 1024
|
|
|
|
#define TILE_CACHE_SIZE 32
|
|
|
|
#define SCALE_WIDTH 130
|
|
|
|
#define PREVIEW_WIDTH 64
|
|
|
|
#define PREVIEW_HEIGHT 220
|
|
|
|
|
|
|
|
#define CANNONIZE(p, x) (255*(((p).range_h - (p).range_l)*(x) + (p).range_l))
|
|
|
|
#define HCANNONIZE(p, x) (254*(((p).range_h - (p).range_l)*(x) + (p).range_l))
|
|
|
|
#define POS_IN_TORUS(i,size) ((i < 0) ? size + i : ((size <= i) ? i - size : i))
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-11-14 10:50:33 +08:00
|
|
|
typedef struct _WidgetEntry WidgetEntry;
|
|
|
|
|
|
|
|
struct _WidgetEntry
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkWidget *widget;
|
|
|
|
gpointer value;
|
2004-11-14 10:50:33 +08:00
|
|
|
void (*updater) (WidgetEntry *);
|
|
|
|
};
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CML_KEEP_VALUES,
|
|
|
|
CML_KEEP_FIRST,
|
|
|
|
CML_FILL,
|
|
|
|
CML_LOGIST,
|
|
|
|
CML_LOGIST_STEP,
|
|
|
|
CML_POWER,
|
|
|
|
CML_POWER_STEP,
|
|
|
|
CML_REV_POWER,
|
|
|
|
CML_REV_POWER_STEP,
|
|
|
|
CML_DELTA,
|
|
|
|
CML_DELTA_STEP,
|
|
|
|
CML_SIN_CURVE,
|
2004-04-20 16:35:36 +08:00
|
|
|
CML_SIN_CURVE_STEP,
|
|
|
|
CML_NUM_VALUES
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
static const gchar *function_names[CML_NUM_VALUES] =
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
|
|
|
N_("Keep image's values"),
|
|
|
|
N_("Keep the first value"),
|
|
|
|
N_("Fill with parameter k"),
|
|
|
|
N_("k{x(1-x)}^p"),
|
|
|
|
N_("k{x(1-x)}^p stepped"),
|
|
|
|
N_("kx^p"),
|
|
|
|
N_("kx^p stepped"),
|
|
|
|
N_("k(1-x^p)"),
|
|
|
|
N_("k(1-x^p) stepped"),
|
|
|
|
N_("Delta function"),
|
|
|
|
N_("Delta function stepped"),
|
|
|
|
N_("sin^p-based function"),
|
|
|
|
N_("sin^p, stepped")
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
COMP_NONE,
|
|
|
|
COMP_MAX_LINEAR,
|
|
|
|
COMP_MAX_LINEAR_P1,
|
|
|
|
COMP_MAX_LINEAR_M1,
|
|
|
|
COMP_MIN_LINEAR,
|
|
|
|
COMP_MIN_LINEAR_P1,
|
|
|
|
COMP_MIN_LINEAR_M1,
|
|
|
|
COMP_MAX_LINEAR_P1L,
|
|
|
|
COMP_MAX_LINEAR_P1U,
|
|
|
|
COMP_MAX_LINEAR_M1L,
|
|
|
|
COMP_MAX_LINEAR_M1U,
|
|
|
|
COMP_MIN_LINEAR_P1L,
|
|
|
|
COMP_MIN_LINEAR_P1U,
|
|
|
|
COMP_MIN_LINEAR_M1L,
|
2004-04-20 16:35:36 +08:00
|
|
|
COMP_MIN_LINEAR_M1U,
|
|
|
|
COMP_NUM_VALUES
|
2000-01-28 03:26:00 +08:00
|
|
|
};
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
static const gchar *composition_names[COMP_NUM_VALUES] =
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
|
|
|
N_("None"),
|
|
|
|
N_("Max (x, -)"),
|
|
|
|
N_("Max (x+d, -)"),
|
|
|
|
N_("Max (x-d, -)"),
|
|
|
|
N_("Min (x, -)"),
|
|
|
|
N_("Min (x+d, -)"),
|
|
|
|
N_("Min (x-d, -)"),
|
|
|
|
N_("Max (x+d, -), (x < 0.5)"),
|
|
|
|
N_("Max (x+d, -), (0.5 < x)"),
|
|
|
|
N_("Max (x-d, -), (x < 0.5)"),
|
|
|
|
N_("Max (x-d, -), (0.5 < x)"),
|
|
|
|
N_("Min (x+d, -), (x < 0.5)"),
|
|
|
|
N_("Min (x+d, -), (0.5 < x)"),
|
|
|
|
N_("Min (x-d, -), (x < 0.5)"),
|
|
|
|
N_("Min (x-d, -), (0.5 < x)")
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
STANDARD,
|
|
|
|
AVERAGE,
|
|
|
|
ANTILOG,
|
|
|
|
RAND_POWER0,
|
|
|
|
RAND_POWER1,
|
|
|
|
RAND_POWER2,
|
|
|
|
MULTIPLY_RANDOM0,
|
|
|
|
MULTIPLY_RANDOM1,
|
|
|
|
MULTIPLY_GRADIENT,
|
2004-04-20 16:35:36 +08:00
|
|
|
RAND_AND_P,
|
|
|
|
ARRANGE_NUM_VALUES
|
2000-01-28 03:26:00 +08:00
|
|
|
};
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
static const gchar *arrange_names[ARRANGE_NUM_VALUES] =
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
|
|
|
N_("Standard"),
|
|
|
|
N_("Use average value"),
|
|
|
|
N_("Use reverse value"),
|
|
|
|
N_("With random power (0,10)"),
|
|
|
|
N_("With random power (0,1)"),
|
|
|
|
N_("With gradient power (0,1)"),
|
|
|
|
N_("Multiply rand. value (0,1)"),
|
|
|
|
N_("Multiply rand. value (0,2)"),
|
|
|
|
N_("Multiply gradient (0,1)"),
|
|
|
|
N_("With p and random (0,1)"),
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_INITIAL_RANDOM_INDEPENDENT = 6,
|
|
|
|
CML_INITIAL_RANDOM_SHARED,
|
|
|
|
CML_INITIAL_RANDOM_FROM_SEED,
|
2004-04-20 16:35:36 +08:00
|
|
|
CML_INITIAL_RANDOM_FROM_SEED_SHARED,
|
|
|
|
CML_INITIAL_NUM_VALUES
|
2000-01-28 03:26:00 +08:00
|
|
|
};
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
static const gchar *initial_value_names[CML_INITIAL_NUM_VALUES] =
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
|
|
|
N_("All black"),
|
|
|
|
N_("All gray"),
|
|
|
|
N_("All white"),
|
|
|
|
N_("The first row of the image"),
|
|
|
|
N_("Continuous gradient"),
|
|
|
|
N_("Continuous grad. w/o gap"),
|
|
|
|
N_("Random, ch. independent"),
|
|
|
|
N_("Random shared"),
|
|
|
|
N_("Randoms from seed"),
|
|
|
|
N_("Randoms from seed (shared)")
|
|
|
|
};
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
#define CML_PARAM_NUM 15
|
2000-01-28 03:26:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
gint function;
|
|
|
|
gint composition;
|
|
|
|
gint arrange;
|
|
|
|
gint cyclic_range;
|
2004-07-31 02:45:34 +08:00
|
|
|
gdouble mod_rate; /* diff / old-value */
|
|
|
|
gdouble env_sensitivity; /* self-diff : env-diff */
|
2000-01-28 03:26:00 +08:00
|
|
|
gint diffusion_dist;
|
1997-11-25 06:05:25 +08:00
|
|
|
gdouble ch_sensitivity;
|
2000-01-28 03:26:00 +08:00
|
|
|
gint range_num;
|
1997-11-25 06:05:25 +08:00
|
|
|
gdouble power;
|
|
|
|
gdouble parameter_k;
|
|
|
|
gdouble range_l;
|
|
|
|
gdouble range_h;
|
|
|
|
gdouble mutation_rate;
|
|
|
|
gdouble mutation_dist;
|
|
|
|
} CML_PARAM;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CML_PARAM hue;
|
|
|
|
CML_PARAM sat;
|
|
|
|
CML_PARAM val;
|
2000-01-28 03:26:00 +08:00
|
|
|
gint initial_value;
|
|
|
|
gint scale;
|
|
|
|
gint start_offset;
|
|
|
|
gint seed;
|
|
|
|
gchar last_file_name[256];
|
1997-11-25 06:05:25 +08:00
|
|
|
} ValueType;
|
|
|
|
|
|
|
|
static ValueType VALS =
|
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
/* function composition arra
|
|
|
|
cyc chng sens diff cor n pow k (l,h) rnd dist */
|
|
|
|
{
|
|
|
|
CML_SIN_CURVE, COMP_NONE, STANDARD,
|
|
|
|
1, 0.5, 0.7, 2, 0.0, 1, 1.0, 1.0, 0, 1, 0.0, 0.1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
CML_FILL, COMP_NONE, STANDARD,
|
|
|
|
0, 0.6, 0.1, 2, 0.0, 1, 1.4, 0.9, 0, 0.9, 0.0, 0.1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
CML_FILL, COMP_NONE, STANDARD,
|
|
|
|
0, 0.5, 0.2, 2, 0.0, 1, 2.0, 1.0, 0, 0.9, 0.0, 0.1
|
|
|
|
},
|
|
|
|
6, /* random value 1 */
|
|
|
|
1, /* scale */
|
|
|
|
0, /* start_offset */
|
|
|
|
0, /* seed */
|
|
|
|
"" /* last filename */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static CML_PARAM *channel_params[] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
&VALS.hue,
|
|
|
|
&VALS.sat,
|
|
|
|
&VALS.val
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
static const gchar *channel_names[] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
N_("Hue"),
|
|
|
|
N_("Saturation"),
|
|
|
|
N_("Value")
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
static const gchar *load_channel_names[] =
|
|
|
|
{
|
|
|
|
N_("(None)"),
|
|
|
|
N_("Hue"),
|
|
|
|
N_("Saturation"),
|
|
|
|
N_("Value")
|
|
|
|
};
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void query (void);
|
2003-07-02 02:54:28 +08:00
|
|
|
static void run (const gchar *name,
|
2004-07-31 02:45:34 +08:00
|
|
|
gint nparams,
|
|
|
|
const GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-01-12 16:15:03 +08:00
|
|
|
static GimpPDBStatusType CML_main_function (gboolean preview_p);
|
2000-08-23 16:43:03 +08:00
|
|
|
static void CML_compute_next_step (gint size,
|
2004-07-31 02:45:34 +08:00
|
|
|
gdouble **h,
|
|
|
|
gdouble **s,
|
|
|
|
gdouble **v,
|
|
|
|
gdouble **hn,
|
|
|
|
gdouble **sn,
|
|
|
|
gdouble **vn,
|
|
|
|
gdouble **haux,
|
|
|
|
gdouble **saux,
|
|
|
|
gdouble **vaux);
|
2000-08-23 16:43:03 +08:00
|
|
|
static gdouble CML_next_value (gdouble *vec,
|
2004-07-31 02:45:34 +08:00
|
|
|
gint pos,
|
|
|
|
gint size,
|
|
|
|
gdouble c1,
|
|
|
|
gdouble c2,
|
|
|
|
CML_PARAM *param,
|
|
|
|
gdouble aux);
|
2000-08-23 16:43:03 +08:00
|
|
|
static gdouble logistic_function (CML_PARAM *param,
|
2004-07-31 02:45:34 +08:00
|
|
|
gdouble x,
|
|
|
|
gdouble power);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
static gint CML_explorer_dialog (void);
|
2002-09-05 05:03:24 +08:00
|
|
|
static GtkWidget * CML_dialog_channel_panel_new (CML_PARAM *param,
|
2004-07-31 02:45:34 +08:00
|
|
|
gint channel_id);
|
2002-09-05 05:03:24 +08:00
|
|
|
static GtkWidget * CML_dialog_advanced_panel_new (void);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
static void CML_explorer_toggle_entry_init (WidgetEntry *widget_entry,
|
2004-07-31 02:45:34 +08:00
|
|
|
GtkWidget *widget,
|
|
|
|
gpointer value_ptr);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
static void CML_explorer_int_entry_init (WidgetEntry *widget_entry,
|
2004-07-31 02:45:34 +08:00
|
|
|
GtkObject *object,
|
|
|
|
gpointer value_ptr);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
static void CML_explorer_double_entry_init (WidgetEntry *widget_entry,
|
2004-07-31 02:45:34 +08:00
|
|
|
GtkObject *object,
|
|
|
|
gpointer value_ptr);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
static void CML_explorer_menu_update (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data);
|
2000-01-28 03:26:00 +08:00
|
|
|
static void CML_initial_value_menu_update (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data);
|
2000-01-28 03:26:00 +08:00
|
|
|
static void CML_explorer_menu_entry_init (WidgetEntry *widget_entry,
|
2004-07-31 02:45:34 +08:00
|
|
|
GtkWidget *widget,
|
|
|
|
gpointer value_ptr);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
static void preview_update (void);
|
|
|
|
static void function_graph_new (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer *data);
|
2000-01-28 03:26:00 +08:00
|
|
|
static void CML_set_or_randomize_seed_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data);
|
2000-01-28 03:26:00 +08:00
|
|
|
static void CML_copy_parameters_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data);
|
2000-01-28 03:26:00 +08:00
|
|
|
static void CML_initial_value_sensitives_update (void);
|
|
|
|
|
2003-11-19 22:51:52 +08:00
|
|
|
static void CML_save_to_file_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
2004-05-18 02:49:44 +08:00
|
|
|
static void CML_save_to_file_response (GtkWidget *dialog,
|
2003-11-19 22:51:52 +08:00
|
|
|
gint response_id,
|
|
|
|
gpointer data);
|
2003-12-03 10:36:04 +08:00
|
|
|
static gboolean force_overwrite (const gchar *filename,
|
2003-11-19 22:51:52 +08:00
|
|
|
GtkWidget *parent);
|
|
|
|
|
|
|
|
static void CML_preview_update_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data);
|
2003-11-19 22:51:52 +08:00
|
|
|
static void CML_load_from_file_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data);
|
2003-11-19 22:51:52 +08:00
|
|
|
static gboolean CML_load_parameter_file (const gchar *filename,
|
2004-07-31 02:45:34 +08:00
|
|
|
gboolean interactive_mode);
|
2004-05-18 02:49:44 +08:00
|
|
|
static void CML_load_from_file_response (GtkWidget *dialog,
|
2003-11-19 22:51:52 +08:00
|
|
|
gint response_id,
|
|
|
|
gpointer data);
|
|
|
|
static gint parse_line_to_gint (FILE *file,
|
2004-07-31 02:45:34 +08:00
|
|
|
gboolean *flag);
|
2003-11-19 22:51:52 +08:00
|
|
|
static gdouble parse_line_to_gdouble (FILE *file,
|
2004-07-31 02:45:34 +08:00
|
|
|
gboolean *flag);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpPlugInInfo PLUG_IN_INFO =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-18 01:02:26 +08:00
|
|
|
NULL, /* init_proc */
|
|
|
|
NULL, /* quit_proc */
|
|
|
|
query, /* query_proc */
|
|
|
|
run, /* run_proc */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static GtkWidget *preview;
|
|
|
|
static WidgetEntry widget_pointers[4][CML_PARAM_NUM];
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkWidget *widget;
|
|
|
|
gint logic;
|
1997-11-25 06:05:25 +08:00
|
|
|
} CML_sensitive_widget_table;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
#define RANDOM_SENSITIVES_NUM 5
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2000-02-05 06:18:50 +08:00
|
|
|
static CML_sensitive_widget_table random_sensitives[RANDOM_SENSITIVES_NUM] =
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
|
|
|
{ NULL, 0 },
|
|
|
|
{ NULL, 0 },
|
|
|
|
{ NULL, 0 },
|
|
|
|
{ NULL, 0 },
|
|
|
|
{ NULL, 0 }
|
|
|
|
};
|
|
|
|
|
2004-01-12 17:19:49 +08:00
|
|
|
static GRand *gr;
|
|
|
|
static gint drawable_id = 0;
|
|
|
|
static gint copy_source = 0;
|
|
|
|
static gint copy_destination = 0;
|
|
|
|
static gint selective_load_source = 0;
|
|
|
|
static gint selective_load_destination = 0;
|
|
|
|
static gboolean CML_preview_defer = FALSE;
|
|
|
|
|
|
|
|
static gdouble *mem_chank0 = NULL;
|
|
|
|
static gint mem_chank0_size = 0;
|
|
|
|
static guchar *mem_chank1 = NULL;
|
|
|
|
static gint mem_chank1_size = 0;
|
|
|
|
static guchar *mem_chank2 = NULL;
|
|
|
|
static gint mem_chank2_size = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-03-19 10:11:53 +08:00
|
|
|
MAIN ()
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-18 01:02:26 +08:00
|
|
|
query (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
static GimpParamDef args [] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-07 22:59:33 +08:00
|
|
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
|
|
|
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
|
|
|
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
|
|
|
{ GIMP_PDB_STRING, "parameter_file_name", "The name of parameter file. CML_explorer makes an image with its settings." }
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_install_procedure (PLUG_IN_PROC,
|
2004-07-31 02:45:34 +08:00
|
|
|
"Make an image of Coupled-Map Lattice",
|
|
|
|
"Make an image of Coupled-Map Lattice (CML). CML is "
|
|
|
|
"a kind of Cellula Automata on continuous (value) "
|
|
|
|
"domain. In GIMP_RUN_NONINTERACTIVE, the name of a "
|
|
|
|
"prameter file is passed as the 4th arg. You can "
|
|
|
|
"control CML_explorer via parameter file.",
|
|
|
|
/* Or do you want to call me with over 50 args? */
|
|
|
|
"Shuji Narazaki (narazaki@InetQ.or.jp); "
|
|
|
|
"http://www.inetq.or.jp/~narazaki/TheGIMP/",
|
|
|
|
"Shuji Narazaki",
|
|
|
|
"1997",
|
|
|
|
N_("CML _Explorer..."),
|
|
|
|
"RGB*, GRAY*",
|
|
|
|
GIMP_PLUGIN,
|
|
|
|
G_N_ELEMENTS (args), 0,
|
|
|
|
args, NULL);
|
2004-05-07 22:59:33 +08:00
|
|
|
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Render/Pattern");
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-07-02 02:54:28 +08:00
|
|
|
run (const gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
const GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-08-23 16:43:03 +08:00
|
|
|
static GimpParam values[1];
|
|
|
|
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
|
2002-09-07 04:44:47 +08:00
|
|
|
GimpRunMode run_mode;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-23 16:43:03 +08:00
|
|
|
run_mode = param[0].data.d_int32;
|
1997-11-25 06:05:25 +08:00
|
|
|
drawable_id = param[2].data.d_drawable;
|
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
INIT_I18N ();
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1997-11-25 06:05:25 +08:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
|
|
|
|
switch (run_mode)
|
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_INTERACTIVE:
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_get_data (PLUG_IN_PROC, &VALS);
|
2000-01-28 03:26:00 +08:00
|
|
|
if (! CML_explorer_dialog ())
|
2004-07-31 02:45:34 +08:00
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_NONINTERACTIVE:
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
gchar *filename = param[3].data.d_string;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
if (! CML_load_parameter_file (filename, FALSE))
|
|
|
|
return;
|
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_WITH_LAST_VALS:
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_get_data (PLUG_IN_PROC, &VALS);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
2000-01-28 03:26:00 +08:00
|
|
|
status = CML_main_function (FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_displays_flush();
|
2000-08-22 09:26:57 +08:00
|
|
|
if (run_mode == GIMP_RUN_INTERACTIVE && status == GIMP_PDB_SUCCESS)
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_set_data (PLUG_IN_PROC, &VALS, sizeof (ValueType));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-09-05 05:03:24 +08:00
|
|
|
g_free (mem_chank0);
|
|
|
|
g_free (mem_chank1);
|
|
|
|
g_free (mem_chank2);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1997-11-25 06:05:25 +08:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
}
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
static GimpPDBStatusType
|
2004-01-12 16:15:03 +08:00
|
|
|
CML_main_function (gboolean preview_p)
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpDrawable *drawable = NULL;
|
|
|
|
GimpPixelRgn dest_rgn, src_rgn;
|
2000-01-28 03:26:00 +08:00
|
|
|
guchar *dest_buffer = NULL;
|
2004-01-12 17:19:49 +08:00
|
|
|
guchar *src_buffer = NULL;
|
2000-01-28 03:26:00 +08:00
|
|
|
gint x1, x2, y1, y2;
|
|
|
|
gint dx, dy;
|
2004-01-12 17:19:49 +08:00
|
|
|
gboolean dest_has_alpha = FALSE;
|
|
|
|
gboolean dest_is_gray = FALSE;
|
|
|
|
gboolean src_has_alpha = FALSE;
|
|
|
|
gboolean src_is_gray = FALSE;
|
2000-01-28 03:26:00 +08:00
|
|
|
gint total, processed = 0;
|
|
|
|
gint keep_height = 1;
|
|
|
|
gint cell_num, width_by_pixel, height_by_pixel;
|
|
|
|
gint index;
|
|
|
|
gint src_bpp, src_bpl;
|
|
|
|
gint dest_bpp, dest_bpl;
|
|
|
|
gdouble *hues, *sats, *vals;
|
|
|
|
gdouble *newh, *news, *newv;
|
|
|
|
gdouble *haux, *saux, *vaux;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* open THE drawable */
|
|
|
|
drawable = gimp_drawable_get (drawable_id);
|
|
|
|
gimp_drawable_mask_bounds (drawable_id, &x1, &y1, &x2, &y2);
|
|
|
|
src_has_alpha = dest_has_alpha = gimp_drawable_has_alpha (drawable_id);
|
1999-10-17 08:07:55 +08:00
|
|
|
src_is_gray = dest_is_gray = gimp_drawable_is_gray (drawable_id);
|
1997-11-25 06:05:25 +08:00
|
|
|
src_bpp = dest_bpp = (src_is_gray ? 1 : 3) + (src_has_alpha ? 1 : 0);
|
|
|
|
|
|
|
|
if (preview_p)
|
|
|
|
{
|
|
|
|
dest_has_alpha = FALSE;
|
2004-01-12 16:15:03 +08:00
|
|
|
dest_bpp = 3;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
if (PREVIEW_WIDTH < x2 - x1) /* preview < drawable (selection) */
|
|
|
|
x2 = x1 + PREVIEW_WIDTH;
|
2000-01-28 03:26:00 +08:00
|
|
|
if (PREVIEW_HEIGHT < y2 - y1)
|
2004-07-31 02:45:34 +08:00
|
|
|
y2 = y1 + PREVIEW_HEIGHT;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
width_by_pixel = x2 - x1;
|
|
|
|
height_by_pixel = y2 - y1;
|
|
|
|
dest_bpl = width_by_pixel * dest_bpp;
|
|
|
|
src_bpl = width_by_pixel * src_bpp;
|
|
|
|
cell_num = (width_by_pixel - 1)/ VALS.scale + 1;
|
|
|
|
total = height_by_pixel * width_by_pixel;
|
2000-08-23 16:43:03 +08:00
|
|
|
if (total < 1)
|
|
|
|
return GIMP_PDB_EXECUTION_ERROR;
|
1997-11-25 06:05:25 +08:00
|
|
|
keep_height = VALS.scale;
|
|
|
|
|
|
|
|
/* configure reusable memories */
|
|
|
|
if (mem_chank0_size < 9 * cell_num * sizeof (gdouble))
|
|
|
|
{
|
2002-09-05 05:03:24 +08:00
|
|
|
g_free (mem_chank0);
|
1997-11-25 06:05:25 +08:00
|
|
|
mem_chank0_size = 9 * cell_num * sizeof (gdouble);
|
|
|
|
mem_chank0 = (gdouble *) g_malloc (mem_chank0_size);
|
|
|
|
}
|
|
|
|
hues = mem_chank0;
|
|
|
|
sats = mem_chank0 + cell_num;
|
|
|
|
vals = mem_chank0 + 2 * cell_num;
|
|
|
|
newh = mem_chank0 + 3 * cell_num;
|
|
|
|
news = mem_chank0 + 4 * cell_num;
|
|
|
|
newv = mem_chank0 + 5 * cell_num;
|
|
|
|
haux = mem_chank0 + 6 * cell_num;
|
|
|
|
saux = mem_chank0 + 7 * cell_num;
|
|
|
|
vaux = mem_chank0 + 8 * cell_num;
|
|
|
|
|
|
|
|
if (mem_chank1_size < src_bpl * keep_height)
|
|
|
|
{
|
2002-09-05 05:03:24 +08:00
|
|
|
g_free (mem_chank1);
|
1997-11-25 06:05:25 +08:00
|
|
|
mem_chank1_size = src_bpl * keep_height;
|
|
|
|
mem_chank1 = (guchar *) g_malloc (mem_chank1_size);
|
|
|
|
}
|
|
|
|
src_buffer = mem_chank1;
|
|
|
|
|
|
|
|
if (mem_chank2_size < dest_bpl * keep_height)
|
|
|
|
{
|
2002-09-05 05:03:24 +08:00
|
|
|
g_free (mem_chank2);
|
1997-11-25 06:05:25 +08:00
|
|
|
mem_chank2_size = dest_bpl * keep_height;
|
|
|
|
mem_chank2 = (guchar *) g_malloc (mem_chank2_size);
|
|
|
|
}
|
|
|
|
dest_buffer = mem_chank2;
|
2003-08-24 03:35:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (! preview_p)
|
|
|
|
gimp_pixel_rgn_init (&dest_rgn, drawable, x1, y1,
|
2004-07-31 02:45:34 +08:00
|
|
|
width_by_pixel, height_by_pixel,
|
|
|
|
TRUE, TRUE);
|
2003-08-24 03:35:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_pixel_rgn_init (&src_rgn, drawable, x1, y1,
|
2004-07-31 02:45:34 +08:00
|
|
|
width_by_pixel, height_by_pixel,
|
|
|
|
FALSE, FALSE);
|
2003-08-24 03:35:05 +08:00
|
|
|
|
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c
2002-11-20 Dave Neary <bolsh@gimp.org>
* configure.in
* app/core/gimpbrushpipe.c
* app/gui/about-dialog.c
* app/paint-funcs/paint-funcs-generic.h
* app/paint-funcs/paint-funcs.c
* libgimpmath/gimpmath.h
* libgimpwidgets/gimpwidgets.c
* plug-ins/common/CML_explorer.c
* plug-ins/common/blur.c
* plug-ins/common/cubism.c
* plug-ins/common/gee.c
* plug-ins/common/gee_zoom.c
* plug-ins/common/gqbist.c
* plug-ins/common/jigsaw.c
* plug-ins/common/lic.c
* plug-ins/common/noisify.c
* plug-ins/common/nova.c
* plug-ins/common/papertile.c
* plug-ins/common/plasma.c
* plug-ins/common/randomize.c
* plug-ins/common/sample_colorize.c
* plug-ins/common/scatter_hsv.c
* plug-ins/common/shift.c
* plug-ins/common/sinus.c
* plug-ins/common/smooth_palette.c
* plug-ins/common/snoise.c
* plug-ins/common/sparkle.c
* plug-ins/common/spheredesigner.c
* plug-ins/common/spread.c
* plug-ins/common/warp.c
* plug-ins/common/wind.c
* plug-ins/flame/cmap.c
* plug-ins/flame/flame.c
* plug-ins/flame/libifs.c
* plug-ins/gflare/gflare.c
* plug-ins/gimpressionist/gimpressionist.c
* plug-ins/gimpressionist/gimpressionist.h
* plug-ins/gimpressionist/plasma.c
* plug-ins/gimpressionist/repaint.c
* plug-ins/ifscompose/ifscompose_utils.c
* plug-ins/maze/algorithms.c
* plug-ins/maze/maze.c
* plug-ins/maze/maze.h
* plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX,
G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(),
srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand*
equivalent. Programs which require seed setting for reproducible
results, and anything in the core, gets a dedicated GRand * for
the lifetime required. Programs which only ever used random
numbers for tossing a coin, rolling a dice, etc use g_random
functions. For the rest, judgement was used. Where it was easy, a
GRand * object was used and g_rand_* functions were
preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
|
|
|
gr = g_rand_new ();
|
|
|
|
if (VALS.initial_value == CML_INITIAL_RANDOM_FROM_SEED)
|
|
|
|
g_rand_set_seed (gr, VALS.seed);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (index = 0; index < cell_num; index++)
|
|
|
|
{
|
|
|
|
switch (VALS.hue.arrange)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
case RAND_POWER0:
|
|
|
|
haux [index] = g_rand_double_range (gr, 0, 10);
|
|
|
|
break;
|
|
|
|
case RAND_POWER2:
|
|
|
|
case MULTIPLY_GRADIENT:
|
|
|
|
haux [index] = (gdouble) abs ((index % 511) - 255) / (gdouble) 256;
|
|
|
|
break;
|
|
|
|
case RAND_POWER1:
|
|
|
|
case MULTIPLY_RANDOM0:
|
|
|
|
haux [index] = g_rand_double (gr);
|
|
|
|
break;
|
|
|
|
case MULTIPLY_RANDOM1:
|
|
|
|
haux [index] = g_rand_double_range (gr, 0, 2);
|
|
|
|
break;
|
|
|
|
case RAND_AND_P:
|
|
|
|
haux [index] = ((index % (2 * VALS.hue.diffusion_dist) == 0) ?
|
2004-01-12 16:15:03 +08:00
|
|
|
g_rand_double (gr) : VALS.hue.power);
|
2004-07-31 02:45:34 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
haux [index] = VALS.hue.power;
|
|
|
|
break;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
switch (VALS.sat.arrange)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
case RAND_POWER0:
|
|
|
|
saux [index] = g_rand_double_range (gr, 0, 10);
|
|
|
|
break;
|
|
|
|
case RAND_POWER2:
|
|
|
|
case MULTIPLY_GRADIENT:
|
|
|
|
saux [index] = (gdouble) abs ((index % 511) - 255) / (gdouble) 256;
|
|
|
|
break;
|
|
|
|
case RAND_POWER1:
|
|
|
|
case MULTIPLY_RANDOM0:
|
|
|
|
saux [index] = g_rand_double (gr);
|
|
|
|
break;
|
|
|
|
case MULTIPLY_RANDOM1:
|
|
|
|
saux [index] = g_rand_double_range (gr, 0, 2);
|
|
|
|
break;
|
|
|
|
case RAND_AND_P:
|
|
|
|
saux [index] = ((index % (2 * VALS.sat.diffusion_dist) == 0) ?
|
2004-01-12 16:15:03 +08:00
|
|
|
g_rand_double (gr) : VALS.sat.power);
|
2004-07-31 02:45:34 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
saux [index] = VALS.sat.power;
|
|
|
|
break;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
switch (VALS.val.arrange)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
case RAND_POWER0:
|
|
|
|
vaux [index] = g_rand_double_range (gr, 0, 10);
|
|
|
|
break;
|
|
|
|
case RAND_POWER2:
|
|
|
|
case MULTIPLY_GRADIENT:
|
|
|
|
vaux [index] = (gdouble) abs ((index % 511) - 255) / (gdouble) 256;
|
|
|
|
break;
|
|
|
|
case RAND_POWER1:
|
|
|
|
case MULTIPLY_RANDOM0:
|
|
|
|
vaux [index] = g_rand_double (gr);
|
|
|
|
break;
|
|
|
|
case MULTIPLY_RANDOM1:
|
|
|
|
vaux [index] = g_rand_double_range (gr, 0, 2);
|
|
|
|
break;
|
|
|
|
case RAND_AND_P:
|
|
|
|
vaux [index] = ((index % (2 * VALS.val.diffusion_dist) == 0) ?
|
2004-01-12 16:15:03 +08:00
|
|
|
g_rand_double (gr) : VALS.val.power);
|
2004-07-31 02:45:34 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
vaux [index] = VALS.val.power;
|
|
|
|
break;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
switch (VALS.initial_value)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
hues[index] = sats[index] = vals[index] = 0.5 * (VALS.initial_value);
|
|
|
|
break;
|
|
|
|
case 3: /* use the values of the image (drawable) */
|
|
|
|
break; /* copy from the drawable after this loop */
|
|
|
|
case 4: /* grandient 1 */
|
|
|
|
hues[index] = sats[index] = vals[index]
|
|
|
|
= (gdouble) (index % 256) / (gdouble) 256;
|
|
|
|
break; /* gradinet 2 */
|
|
|
|
case 5:
|
|
|
|
hues[index] = sats[index] = vals[index]
|
|
|
|
= (gdouble) abs ((index % 511) - 255) / (gdouble) 256;
|
|
|
|
break;
|
|
|
|
case CML_INITIAL_RANDOM_INDEPENDENT:
|
|
|
|
case CML_INITIAL_RANDOM_FROM_SEED:
|
|
|
|
hues[index] = g_rand_double (gr);
|
|
|
|
sats[index] = g_rand_double (gr);
|
|
|
|
vals[index] = g_rand_double (gr);
|
|
|
|
break;
|
|
|
|
case CML_INITIAL_RANDOM_SHARED:
|
|
|
|
case CML_INITIAL_RANDOM_FROM_SEED_SHARED:
|
|
|
|
hues[index] = sats[index] = vals[index] = g_rand_double (gr);
|
|
|
|
break;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (VALS.initial_value == 3)
|
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
int index;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-01-12 16:15:03 +08:00
|
|
|
for (index = 0;
|
|
|
|
index < MIN (cell_num, width_by_pixel / VALS.scale);
|
|
|
|
index++)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
guchar buffer[4];
|
|
|
|
int rgbi[3];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
gimp_pixel_rgn_get_pixel (&src_rgn, buffer,
|
|
|
|
x1 + (index * VALS.scale), y1);
|
|
|
|
for (i = 0; i < 3; i++) rgbi[i] = buffer[i];
|
|
|
|
gimp_rgb_to_hsv_int (rgbi, rgbi + 1, rgbi + 2);
|
|
|
|
hues[index] = (gdouble) rgbi[0] / (gdouble) 255;
|
|
|
|
sats[index] = (gdouble) rgbi[1] / (gdouble) 255;
|
|
|
|
vals[index] = (gdouble) rgbi[2] / (gdouble) 255;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2004-01-12 16:15:03 +08:00
|
|
|
|
|
|
|
if (! preview_p)
|
|
|
|
gimp_progress_init (_("CML_explorer: evoluting..."));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* rolling start */
|
|
|
|
for (index = 0; index < VALS.start_offset; index++)
|
|
|
|
CML_compute_next_step (cell_num, &hues, &sats, &vals, &newh, &news, &newv,
|
2004-07-31 02:45:34 +08:00
|
|
|
&haux, &saux, &vaux);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* rendering */
|
|
|
|
for (dy = 0; dy < height_by_pixel; dy += VALS.scale)
|
|
|
|
{
|
2004-01-12 16:15:03 +08:00
|
|
|
gint r, g, b, h, s, v;
|
|
|
|
gint offset_x, offset_y, dest_offset;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (height_by_pixel < dy + keep_height)
|
2004-07-31 02:45:34 +08:00
|
|
|
keep_height = height_by_pixel - dy;
|
2003-08-24 03:35:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if ((VALS.hue.function == CML_KEEP_VALUES) ||
|
2004-07-31 02:45:34 +08:00
|
|
|
(VALS.sat.function == CML_KEEP_VALUES) ||
|
|
|
|
(VALS.val.function == CML_KEEP_VALUES))
|
|
|
|
gimp_pixel_rgn_get_rect (&src_rgn, src_buffer,
|
|
|
|
x1, y1 + dy, width_by_pixel, keep_height);
|
2003-01-18 23:02:50 +08:00
|
|
|
|
2004-01-12 16:15:03 +08:00
|
|
|
CML_compute_next_step (cell_num,
|
|
|
|
&hues, &sats, &vals,
|
|
|
|
&newh, &news, &newv,
|
2004-07-31 02:45:34 +08:00
|
|
|
&haux, &saux, &vaux);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (dx = 0; dx < cell_num; dx++)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
h = r = HCANNONIZE (VALS.hue, hues[dx]);
|
|
|
|
s = g = CANNONIZE (VALS.sat, sats[dx]);
|
|
|
|
v = b = CANNONIZE (VALS.val, vals[dx]);
|
|
|
|
|
|
|
|
if (! dest_is_gray)
|
|
|
|
gimp_hsv_to_rgb_int (&r, &g, &b);
|
|
|
|
|
|
|
|
/* render destination */
|
|
|
|
for (offset_y = 0;
|
|
|
|
(offset_y < VALS.scale) && (dy + offset_y < height_by_pixel);
|
|
|
|
offset_y++)
|
|
|
|
for (offset_x = 0;
|
|
|
|
(offset_x < VALS.scale) && (dx * VALS.scale + offset_x < width_by_pixel);
|
|
|
|
offset_x++)
|
|
|
|
{
|
|
|
|
if ((VALS.hue.function == CML_KEEP_VALUES) ||
|
|
|
|
(VALS.sat.function == CML_KEEP_VALUES) ||
|
|
|
|
(VALS.val.function == CML_KEEP_VALUES))
|
|
|
|
{
|
|
|
|
int rgbi[3];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < src_bpp; i++)
|
|
|
|
rgbi[i] = src_buffer[offset_y * src_bpl
|
2004-01-12 17:19:49 +08:00
|
|
|
+ (dx * VALS.scale + offset_x) * src_bpp + i];
|
2004-07-31 02:45:34 +08:00
|
|
|
if (src_is_gray && (VALS.val.function == CML_KEEP_VALUES))
|
2004-01-12 16:15:03 +08:00
|
|
|
{
|
|
|
|
b = rgbi[0];
|
|
|
|
}
|
2004-07-31 02:45:34 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_rgb_to_hsv_int (rgbi, rgbi + 1, rgbi + 2);
|
|
|
|
|
|
|
|
r = (VALS.hue.function == CML_KEEP_VALUES) ? rgbi[0] : h;
|
|
|
|
g = (VALS.sat.function == CML_KEEP_VALUES) ? rgbi[1] : s;
|
|
|
|
b = (VALS.val.function == CML_KEEP_VALUES) ? rgbi[2] : v;
|
|
|
|
gimp_hsv_to_rgb_int (&r, &g, &b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dest_offset = (offset_y * dest_bpl +
|
2004-01-12 17:19:49 +08:00
|
|
|
(dx * VALS.scale + offset_x) * dest_bpp);
|
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
if (dest_is_gray)
|
2004-01-12 16:15:03 +08:00
|
|
|
{
|
|
|
|
dest_buffer[dest_offset++] = b;
|
|
|
|
if (preview_p)
|
|
|
|
{
|
|
|
|
dest_buffer[dest_offset++] = b;
|
|
|
|
dest_buffer[dest_offset++] = b;
|
|
|
|
}
|
|
|
|
}
|
2004-07-31 02:45:34 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
dest_buffer[dest_offset++] = r;
|
|
|
|
dest_buffer[dest_offset++] = g;
|
|
|
|
dest_buffer[dest_offset++] = b;
|
|
|
|
}
|
|
|
|
if (dest_has_alpha)
|
|
|
|
dest_buffer[dest_offset] = 255;
|
|
|
|
|
|
|
|
if ((!preview_p) &&
|
2004-01-12 16:15:03 +08:00
|
|
|
(++processed % (total / PROGRESS_UPDATE_NUM + 1)) == 0)
|
2004-07-31 02:45:34 +08:00
|
|
|
gimp_progress_update ((gdouble) processed / (gdouble) total);
|
|
|
|
}
|
|
|
|
}
|
2004-01-12 16:15:03 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (preview_p)
|
2004-07-31 02:45:34 +08:00
|
|
|
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview),
|
|
|
|
0, dy,
|
|
|
|
width_by_pixel, keep_height,
|
|
|
|
GIMP_RGB_IMAGE,
|
|
|
|
dest_buffer,
|
|
|
|
dest_bpl);
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2004-07-31 02:45:34 +08:00
|
|
|
gimp_pixel_rgn_set_rect (&dest_rgn, dest_buffer, x1, y1 + dy,
|
|
|
|
width_by_pixel, keep_height);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
if (preview_p)
|
|
|
|
{
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_queue_draw (preview);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_progress_update (1.0);
|
|
|
|
gimp_drawable_flush (drawable);
|
2001-06-15 04:07:38 +08:00
|
|
|
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
|
2004-01-12 16:15:03 +08:00
|
|
|
gimp_drawable_update (drawable->drawable_id,
|
|
|
|
x1, y1, (x2 - x1), (y2 - y1));
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_drawable_detach (drawable);
|
|
|
|
}
|
|
|
|
|
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c
2002-11-20 Dave Neary <bolsh@gimp.org>
* configure.in
* app/core/gimpbrushpipe.c
* app/gui/about-dialog.c
* app/paint-funcs/paint-funcs-generic.h
* app/paint-funcs/paint-funcs.c
* libgimpmath/gimpmath.h
* libgimpwidgets/gimpwidgets.c
* plug-ins/common/CML_explorer.c
* plug-ins/common/blur.c
* plug-ins/common/cubism.c
* plug-ins/common/gee.c
* plug-ins/common/gee_zoom.c
* plug-ins/common/gqbist.c
* plug-ins/common/jigsaw.c
* plug-ins/common/lic.c
* plug-ins/common/noisify.c
* plug-ins/common/nova.c
* plug-ins/common/papertile.c
* plug-ins/common/plasma.c
* plug-ins/common/randomize.c
* plug-ins/common/sample_colorize.c
* plug-ins/common/scatter_hsv.c
* plug-ins/common/shift.c
* plug-ins/common/sinus.c
* plug-ins/common/smooth_palette.c
* plug-ins/common/snoise.c
* plug-ins/common/sparkle.c
* plug-ins/common/spheredesigner.c
* plug-ins/common/spread.c
* plug-ins/common/warp.c
* plug-ins/common/wind.c
* plug-ins/flame/cmap.c
* plug-ins/flame/flame.c
* plug-ins/flame/libifs.c
* plug-ins/gflare/gflare.c
* plug-ins/gimpressionist/gimpressionist.c
* plug-ins/gimpressionist/gimpressionist.h
* plug-ins/gimpressionist/plasma.c
* plug-ins/gimpressionist/repaint.c
* plug-ins/ifscompose/ifscompose_utils.c
* plug-ins/maze/algorithms.c
* plug-ins/maze/maze.c
* plug-ins/maze/maze.h
* plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX,
G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(),
srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand*
equivalent. Programs which require seed setting for reproducible
results, and anything in the core, gets a dedicated GRand * for
the lifetime required. Programs which only ever used random
numbers for tossing a coin, rolling a dice, etc use g_random
functions. For the rest, judgement was used. Where it was easy, a
GRand * object was used and g_rand_* functions were
preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
|
|
|
g_rand_free (gr);
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
return GIMP_PDB_SUCCESS;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_compute_next_step (gint size,
|
2004-07-31 02:45:34 +08:00
|
|
|
gdouble **h,
|
|
|
|
gdouble **s,
|
|
|
|
gdouble **v,
|
|
|
|
gdouble **hn,
|
|
|
|
gdouble **sn,
|
|
|
|
gdouble **vn,
|
|
|
|
gdouble **haux,
|
|
|
|
gdouble **saux,
|
|
|
|
gdouble **vaux)
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
gint index;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (index = 0; index < size; index++)
|
|
|
|
(*hn)[index] = CML_next_value (*h, index, size,
|
2004-07-31 02:45:34 +08:00
|
|
|
(*s)[POS_IN_TORUS (index, size)],
|
|
|
|
(*v)[POS_IN_TORUS (index, size)],
|
|
|
|
&VALS.hue,
|
|
|
|
(*haux)[POS_IN_TORUS (index , size)]);
|
1997-11-25 06:05:25 +08:00
|
|
|
for (index = 0; index < size; index++)
|
|
|
|
(*sn)[index] = CML_next_value (*s, index, size,
|
2004-07-31 02:45:34 +08:00
|
|
|
(*v)[POS_IN_TORUS (index , size)],
|
|
|
|
(*h)[POS_IN_TORUS (index , size)],
|
|
|
|
&VALS.sat,
|
|
|
|
(*saux)[POS_IN_TORUS (index , size)]);
|
1997-11-25 06:05:25 +08:00
|
|
|
for (index = 0; index < size; index++)
|
|
|
|
(*vn)[index] = CML_next_value (*v, index, size,
|
2004-07-31 02:45:34 +08:00
|
|
|
(*h)[POS_IN_TORUS (index , size)],
|
|
|
|
(*s)[POS_IN_TORUS (index , size)],
|
|
|
|
&VALS.val,
|
|
|
|
(*vaux)[POS_IN_TORUS (index , size)]);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
#define GD_SWAP(x, y) { gdouble *tmp = *x; *x = *y; *y = tmp; }
|
1997-11-25 06:05:25 +08:00
|
|
|
GD_SWAP (h, hn);
|
|
|
|
GD_SWAP (s, sn);
|
|
|
|
GD_SWAP (v, vn);
|
2004-07-31 02:45:34 +08:00
|
|
|
#undef SWAP
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
#define AVE_DIST(x, y) (((x) * (x) + (y) * (y))/ 2.0)
|
|
|
|
#define LOGISTICS(x) logistic_function (param, x, power)
|
|
|
|
#define ENV_FACTOR(x) (param->env_sensitivity * LOGISTICS (x))
|
|
|
|
#define C_ENV_FACTOR(x) (param->mod_rate * ENV_FACTOR (x))
|
|
|
|
#define CHN_FACTOR(x) (param->ch_sensitivity * LOGISTICS (x))
|
|
|
|
#define C_CHN_FACTOR(x) (param->mod_rate * CHN_FACTOR (x))
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static gdouble
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_next_value (gdouble *vec,
|
2004-07-31 02:45:34 +08:00
|
|
|
gint pos,
|
|
|
|
gint size,
|
|
|
|
gdouble c1,
|
|
|
|
gdouble c2,
|
|
|
|
CML_PARAM *param,
|
|
|
|
gdouble power)
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
|
|
|
gdouble val = vec[pos];
|
|
|
|
gdouble diff = 0;
|
|
|
|
gdouble self_diff = 0;
|
|
|
|
gdouble by_env = 0;
|
|
|
|
gdouble self_mod_rate = 0;
|
|
|
|
gdouble hold_rate = 1 - param->mod_rate;
|
|
|
|
gdouble env_factor = 0;
|
|
|
|
gint index;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
self_mod_rate = (1 - param->env_sensitivity - param->ch_sensitivity);
|
|
|
|
|
|
|
|
switch (param->arrange)
|
|
|
|
{
|
|
|
|
case ANTILOG:
|
|
|
|
self_diff = self_mod_rate * LOGISTICS (1 - vec[pos]);
|
|
|
|
for (index = 1; index <= param->diffusion_dist / 2; index++)
|
2004-07-31 02:45:34 +08:00
|
|
|
env_factor += ENV_FACTOR (1 - vec[POS_IN_TORUS (pos + index, size)])
|
|
|
|
+ ENV_FACTOR (1 - vec[POS_IN_TORUS (pos - index, size)]);
|
1997-11-25 06:05:25 +08:00
|
|
|
if ((param->diffusion_dist % 2) == 1)
|
2004-07-31 02:45:34 +08:00
|
|
|
env_factor += (ENV_FACTOR (1 - vec[POS_IN_TORUS (pos + index, size)])
|
|
|
|
+ ENV_FACTOR (1 - vec[POS_IN_TORUS (pos - index, size)])) / 2;
|
1997-11-25 06:05:25 +08:00
|
|
|
env_factor /= (gdouble) param->diffusion_dist;
|
|
|
|
by_env = env_factor + (CHN_FACTOR (1 - c1) + CHN_FACTOR (1 - c2)) / 2;
|
|
|
|
diff = param->mod_rate * (self_diff + by_env);
|
|
|
|
val = hold_rate * vec[pos] + diff;
|
|
|
|
break;
|
|
|
|
case AVERAGE:
|
|
|
|
self_diff = self_mod_rate * LOGISTICS (vec[pos]);
|
|
|
|
for (index = 1; index <= param->diffusion_dist / 2; index++)
|
2004-07-31 02:45:34 +08:00
|
|
|
env_factor += vec[POS_IN_TORUS (pos + index, size)] + vec[POS_IN_TORUS (pos - index, size)];
|
1997-11-25 06:05:25 +08:00
|
|
|
if ((param->diffusion_dist % 2) == 1)
|
2004-07-31 02:45:34 +08:00
|
|
|
env_factor += (vec[POS_IN_TORUS (pos + index, size)] + vec[POS_IN_TORUS (pos - index, size)]) / 2;
|
1997-11-25 06:05:25 +08:00
|
|
|
env_factor /= (gdouble) param->diffusion_dist;
|
|
|
|
by_env = ENV_FACTOR (env_factor) + (CHN_FACTOR (c1) + CHN_FACTOR (c2)) / 2;
|
|
|
|
diff = param->mod_rate * (self_diff + by_env);
|
|
|
|
val = hold_rate * vec[pos] + diff;
|
|
|
|
break;
|
|
|
|
case MULTIPLY_RANDOM0:
|
|
|
|
case MULTIPLY_RANDOM1:
|
|
|
|
case MULTIPLY_GRADIENT:
|
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
gdouble tmp;
|
|
|
|
|
|
|
|
tmp = power;
|
|
|
|
power = param->power;
|
|
|
|
self_diff = self_mod_rate * LOGISTICS (vec[pos]);
|
|
|
|
for (index = 1; index <= param->diffusion_dist / 2; index++)
|
|
|
|
env_factor += ENV_FACTOR (vec[POS_IN_TORUS (pos + index, size)])
|
|
|
|
+ ENV_FACTOR (vec[POS_IN_TORUS (pos - index, size)]);
|
|
|
|
if ((param->diffusion_dist % 2) == 1)
|
|
|
|
env_factor += (ENV_FACTOR (vec[POS_IN_TORUS (pos + index, size)])
|
|
|
|
+ ENV_FACTOR (vec[POS_IN_TORUS (pos - index, size)])) / 2;
|
|
|
|
env_factor /= (gdouble) param->diffusion_dist;
|
|
|
|
by_env = (env_factor + CHN_FACTOR (c1) + CHN_FACTOR (c2)) / 2;
|
|
|
|
diff = pow (param->mod_rate * (self_diff + by_env), tmp);
|
|
|
|
val = hold_rate * vec[pos] + diff;
|
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
case STANDARD:
|
|
|
|
case RAND_POWER0:
|
|
|
|
case RAND_POWER1:
|
|
|
|
case RAND_POWER2:
|
|
|
|
case RAND_AND_P:
|
|
|
|
default:
|
|
|
|
self_diff = self_mod_rate * LOGISTICS (vec[pos]);
|
|
|
|
|
|
|
|
for (index = 1; index <= param->diffusion_dist / 2; index++)
|
2004-07-31 02:45:34 +08:00
|
|
|
env_factor += ENV_FACTOR (vec[POS_IN_TORUS (pos + index, size)])
|
|
|
|
+ ENV_FACTOR (vec[POS_IN_TORUS (pos - index, size)]);
|
1997-11-25 06:05:25 +08:00
|
|
|
if ((param->diffusion_dist % 2) == 1)
|
2004-07-31 02:45:34 +08:00
|
|
|
env_factor += (ENV_FACTOR (vec[POS_IN_TORUS (pos + index, size)])
|
|
|
|
+ ENV_FACTOR (vec[POS_IN_TORUS (pos - index, size)])) / 2;
|
1997-11-25 06:05:25 +08:00
|
|
|
env_factor /= (gdouble) param->diffusion_dist;
|
|
|
|
by_env = env_factor + (CHN_FACTOR (c1) + CHN_FACTOR (c2)) / 2;
|
|
|
|
diff = param->mod_rate * (self_diff + by_env);
|
|
|
|
val = hold_rate * vec[pos] + diff;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* finalize */
|
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c
2002-11-20 Dave Neary <bolsh@gimp.org>
* configure.in
* app/core/gimpbrushpipe.c
* app/gui/about-dialog.c
* app/paint-funcs/paint-funcs-generic.h
* app/paint-funcs/paint-funcs.c
* libgimpmath/gimpmath.h
* libgimpwidgets/gimpwidgets.c
* plug-ins/common/CML_explorer.c
* plug-ins/common/blur.c
* plug-ins/common/cubism.c
* plug-ins/common/gee.c
* plug-ins/common/gee_zoom.c
* plug-ins/common/gqbist.c
* plug-ins/common/jigsaw.c
* plug-ins/common/lic.c
* plug-ins/common/noisify.c
* plug-ins/common/nova.c
* plug-ins/common/papertile.c
* plug-ins/common/plasma.c
* plug-ins/common/randomize.c
* plug-ins/common/sample_colorize.c
* plug-ins/common/scatter_hsv.c
* plug-ins/common/shift.c
* plug-ins/common/sinus.c
* plug-ins/common/smooth_palette.c
* plug-ins/common/snoise.c
* plug-ins/common/sparkle.c
* plug-ins/common/spheredesigner.c
* plug-ins/common/spread.c
* plug-ins/common/warp.c
* plug-ins/common/wind.c
* plug-ins/flame/cmap.c
* plug-ins/flame/flame.c
* plug-ins/flame/libifs.c
* plug-ins/gflare/gflare.c
* plug-ins/gimpressionist/gimpressionist.c
* plug-ins/gimpressionist/gimpressionist.h
* plug-ins/gimpressionist/plasma.c
* plug-ins/gimpressionist/repaint.c
* plug-ins/ifscompose/ifscompose_utils.c
* plug-ins/maze/algorithms.c
* plug-ins/maze/maze.c
* plug-ins/maze/maze.h
* plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX,
G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(),
srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand*
equivalent. Programs which require seed setting for reproducible
results, and anything in the core, gets a dedicated GRand * for
the lifetime required. Programs which only ever used random
numbers for tossing a coin, rolling a dice, etc use g_random
functions. For the rest, judgement was used. Where it was easy, a
GRand * object was used and g_rand_* functions were
preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
|
|
|
if (g_rand_double (gr) < param->mutation_rate)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c
2002-11-20 Dave Neary <bolsh@gimp.org>
* configure.in
* app/core/gimpbrushpipe.c
* app/gui/about-dialog.c
* app/paint-funcs/paint-funcs-generic.h
* app/paint-funcs/paint-funcs.c
* libgimpmath/gimpmath.h
* libgimpwidgets/gimpwidgets.c
* plug-ins/common/CML_explorer.c
* plug-ins/common/blur.c
* plug-ins/common/cubism.c
* plug-ins/common/gee.c
* plug-ins/common/gee_zoom.c
* plug-ins/common/gqbist.c
* plug-ins/common/jigsaw.c
* plug-ins/common/lic.c
* plug-ins/common/noisify.c
* plug-ins/common/nova.c
* plug-ins/common/papertile.c
* plug-ins/common/plasma.c
* plug-ins/common/randomize.c
* plug-ins/common/sample_colorize.c
* plug-ins/common/scatter_hsv.c
* plug-ins/common/shift.c
* plug-ins/common/sinus.c
* plug-ins/common/smooth_palette.c
* plug-ins/common/snoise.c
* plug-ins/common/sparkle.c
* plug-ins/common/spheredesigner.c
* plug-ins/common/spread.c
* plug-ins/common/warp.c
* plug-ins/common/wind.c
* plug-ins/flame/cmap.c
* plug-ins/flame/flame.c
* plug-ins/flame/libifs.c
* plug-ins/gflare/gflare.c
* plug-ins/gimpressionist/gimpressionist.c
* plug-ins/gimpressionist/gimpressionist.h
* plug-ins/gimpressionist/plasma.c
* plug-ins/gimpressionist/repaint.c
* plug-ins/ifscompose/ifscompose_utils.c
* plug-ins/maze/algorithms.c
* plug-ins/maze/maze.c
* plug-ins/maze/maze.h
* plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX,
G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(),
srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand*
equivalent. Programs which require seed setting for reproducible
results, and anything in the core, gets a dedicated GRand * for
the lifetime required. Programs which only ever used random
numbers for tossing a coin, rolling a dice, etc use g_random
functions. For the rest, judgement was used. Where it was easy, a
GRand * object was used and g_rand_* functions were
preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
|
|
|
val += ((g_rand_double (gr) < 0.5) ? -1.0 : 1.0) * param->mutation_dist * g_rand_double (gr);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
if (param->cyclic_range)
|
|
|
|
{
|
|
|
|
if (1.0 < val)
|
2004-07-31 02:45:34 +08:00
|
|
|
val = val - (int) val;
|
1997-11-25 06:05:25 +08:00
|
|
|
else if (val < 0.0)
|
2004-07-31 02:45:34 +08:00
|
|
|
val = val - floor (val);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
/* The range of val should be [0,1], not [0,1).
|
|
|
|
Cannonization shuold be done in color mapping phase. */
|
|
|
|
val = CLAMP (val, 0.0, 1);
|
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c
2002-11-20 Dave Neary <bolsh@gimp.org>
* configure.in
* app/core/gimpbrushpipe.c
* app/gui/about-dialog.c
* app/paint-funcs/paint-funcs-generic.h
* app/paint-funcs/paint-funcs.c
* libgimpmath/gimpmath.h
* libgimpwidgets/gimpwidgets.c
* plug-ins/common/CML_explorer.c
* plug-ins/common/blur.c
* plug-ins/common/cubism.c
* plug-ins/common/gee.c
* plug-ins/common/gee_zoom.c
* plug-ins/common/gqbist.c
* plug-ins/common/jigsaw.c
* plug-ins/common/lic.c
* plug-ins/common/noisify.c
* plug-ins/common/nova.c
* plug-ins/common/papertile.c
* plug-ins/common/plasma.c
* plug-ins/common/randomize.c
* plug-ins/common/sample_colorize.c
* plug-ins/common/scatter_hsv.c
* plug-ins/common/shift.c
* plug-ins/common/sinus.c
* plug-ins/common/smooth_palette.c
* plug-ins/common/snoise.c
* plug-ins/common/sparkle.c
* plug-ins/common/spheredesigner.c
* plug-ins/common/spread.c
* plug-ins/common/warp.c
* plug-ins/common/wind.c
* plug-ins/flame/cmap.c
* plug-ins/flame/flame.c
* plug-ins/flame/libifs.c
* plug-ins/gflare/gflare.c
* plug-ins/gimpressionist/gimpressionist.c
* plug-ins/gimpressionist/gimpressionist.h
* plug-ins/gimpressionist/plasma.c
* plug-ins/gimpressionist/repaint.c
* plug-ins/ifscompose/ifscompose_utils.c
* plug-ins/maze/algorithms.c
* plug-ins/maze/maze.c
* plug-ins/maze/maze.h
* plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX,
G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(),
srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand*
equivalent. Programs which require seed setting for reproducible
results, and anything in the core, gets a dedicated GRand * for
the lifetime required. Programs which only ever used random
numbers for tossing a coin, rolling a dice, etc use g_random
functions. For the rest, judgement was used. Where it was easy, a
GRand * object was used and g_rand_* functions were
preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return val;
|
|
|
|
}
|
2000-01-28 03:26:00 +08:00
|
|
|
#undef AVE_DIST
|
1997-11-25 06:05:25 +08:00
|
|
|
#undef LOGISTICS
|
|
|
|
#undef ENV_FACTOR
|
|
|
|
#undef C_ENV_FACTOR
|
|
|
|
#undef CHN_FACTOR
|
|
|
|
#undef C_CHN_FACTOR
|
|
|
|
|
|
|
|
static gdouble
|
2000-01-28 03:26:00 +08:00
|
|
|
logistic_function (CML_PARAM *param,
|
2004-07-31 02:45:34 +08:00
|
|
|
gdouble x,
|
|
|
|
gdouble power)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
gdouble x1 = x;
|
|
|
|
gdouble result = 0;
|
2000-01-28 03:26:00 +08:00
|
|
|
gint n = param->range_num;
|
|
|
|
gint step;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
step = (int) (x * (gdouble) n);
|
|
|
|
x1 = (x - ((gdouble) step / (gdouble) n)) * n;
|
|
|
|
switch (param->function)
|
|
|
|
{
|
|
|
|
case CML_KEEP_VALUES:
|
|
|
|
case CML_KEEP_FIRST:
|
|
|
|
result = x;
|
|
|
|
return result;
|
|
|
|
break;
|
|
|
|
case CML_FILL:
|
|
|
|
result = CLAMP (param->parameter_k, 0.0, 1.0);
|
|
|
|
return result;
|
|
|
|
break;
|
|
|
|
case CML_LOGIST:
|
|
|
|
result = param->parameter_k * pow (4 * x1 * (1.0 - x1), power);
|
|
|
|
break;
|
|
|
|
case CML_LOGIST_STEP:
|
|
|
|
result = param->parameter_k * pow (4 * x1 * (1.0 - x1), power);
|
|
|
|
result = (result + step) / (gdouble) n;
|
|
|
|
break;
|
|
|
|
case CML_POWER:
|
|
|
|
result = param->parameter_k * pow (x1, power);
|
|
|
|
break;
|
|
|
|
case CML_POWER_STEP:
|
|
|
|
result = param->parameter_k * pow (x1, power);
|
|
|
|
result = (result + step) / (gdouble) n;
|
|
|
|
break;
|
|
|
|
case CML_REV_POWER:
|
|
|
|
result = param->parameter_k * (1 - pow (x1, power));
|
|
|
|
break;
|
|
|
|
case CML_REV_POWER_STEP:
|
|
|
|
result = param->parameter_k * (1 - pow (x1, power));
|
|
|
|
result = (result + step) / (gdouble) n;
|
|
|
|
break;
|
|
|
|
case CML_DELTA:
|
|
|
|
result = param->parameter_k * 2 * ((x1 < 0.5) ? x1 : (1.0 - x1));
|
|
|
|
break;
|
|
|
|
case CML_DELTA_STEP:
|
|
|
|
result = param->parameter_k * 2 * ((x1 < 0.5) ? x1 : (1.0 - x1));
|
|
|
|
result = (result + step) / (gdouble) n;
|
|
|
|
break;
|
|
|
|
case CML_SIN_CURVE:
|
|
|
|
if (1.0 < power)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = 0.5 * (sin (G_PI * ABS (x1 - 0.5) / power) / sin (G_PI * 0.5 / power) + 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2004-07-31 02:45:34 +08:00
|
|
|
result = 0.5 * (pow (sin (G_PI * ABS (x1 - 0.5)), power) + 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
if (x1 < 0.5) result = 1 - result;
|
|
|
|
break;
|
|
|
|
case CML_SIN_CURVE_STEP:
|
|
|
|
if (1.0 < power)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = 0.5 * (sin (G_PI * ABS (x1 - 0.5) / power) / sin (G_PI * 0.5 / power) + 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2004-07-31 02:45:34 +08:00
|
|
|
result = 0.5 * (pow (sin (G_PI * ABS (x1 - 0.5)), power) + 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
if (x1 < 0.5) result = 1 - result;
|
|
|
|
result = (result + step) / (gdouble) n;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (param->composition)
|
|
|
|
{
|
|
|
|
case COMP_NONE:
|
|
|
|
break;
|
|
|
|
case COMP_MAX_LINEAR:
|
|
|
|
result = MAX ((gdouble) x, (gdouble) result);
|
|
|
|
break;
|
|
|
|
case COMP_MAX_LINEAR_P1:
|
|
|
|
result = MAX ((gdouble) x + (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
|
|
|
break;
|
|
|
|
case COMP_MAX_LINEAR_P1L:
|
|
|
|
if (x < 0.5)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = MAX ((gdouble) x + (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case COMP_MAX_LINEAR_P1U:
|
|
|
|
if (0.5 < x)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = MAX ((gdouble) x + (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case COMP_MAX_LINEAR_M1:
|
|
|
|
result = MAX ((gdouble) x - (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
|
|
|
break;
|
|
|
|
case COMP_MAX_LINEAR_M1L:
|
|
|
|
if (x < 0.5)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = MAX ((gdouble) x - (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case COMP_MAX_LINEAR_M1U:
|
|
|
|
if (0.5 < x)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = MAX ((gdouble) x - (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case COMP_MIN_LINEAR:
|
|
|
|
result = MIN ((gdouble) x, (gdouble) result);
|
|
|
|
break;
|
|
|
|
case COMP_MIN_LINEAR_P1:
|
|
|
|
result = MIN ((gdouble) x + (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
|
|
|
break;
|
|
|
|
case COMP_MIN_LINEAR_P1L:
|
|
|
|
if (x < 0.5)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = MIN ((gdouble) x + (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case COMP_MIN_LINEAR_P1U:
|
|
|
|
if (0.5 < x)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = MIN ((gdouble) x + (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case COMP_MIN_LINEAR_M1:
|
|
|
|
result = MIN ((gdouble) x - (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
|
|
|
break;
|
|
|
|
case COMP_MIN_LINEAR_M1L:
|
|
|
|
if (x < 0.5)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = MIN ((gdouble) x - (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
case COMP_MIN_LINEAR_M1U:
|
|
|
|
if (0.5 < x)
|
2004-07-31 02:45:34 +08:00
|
|
|
result = MIN ((gdouble) x - (gdouble) 1 / (gdouble) 256, (gdouble) result);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dialog stuff */
|
2000-01-28 03:26:00 +08:00
|
|
|
static gint
|
|
|
|
CML_explorer_dialog (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkWidget *dlg;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *abox;
|
2004-05-18 02:49:44 +08:00
|
|
|
GtkWidget *bbox;
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkWidget *button;
|
2003-11-06 23:27:05 +08:00
|
|
|
gboolean run;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_ui_init (PLUG_IN_BINARY, TRUE);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2005-08-14 02:29:14 +08:00
|
|
|
dlg = gimp_dialog_new (_("Coupled-Map-Lattice Explorer"), PLUG_IN_BINARY,
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL, 0,
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2005-02-09 04:40:33 +08:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
CML_preview_defer = TRUE;
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 12);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (abox), frame);
|
|
|
|
gtk_widget_show (frame);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
preview = gimp_preview_area_new ();
|
|
|
|
gtk_widget_set_size_request (preview,
|
|
|
|
PREVIEW_WIDTH, PREVIEW_HEIGHT);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), preview);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (preview);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
bbox = gtk_vbutton_box_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (bbox);
|
|
|
|
|
2004-06-21 06:47:33 +08:00
|
|
|
button = gtk_button_new_with_label (_("New seed"));
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (bbox), button);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-05-18 02:49:44 +08:00
|
|
|
G_CALLBACK (CML_preview_update_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
&VALS);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
random_sensitives[0].widget = button;
|
|
|
|
random_sensitives[0].logic = TRUE;
|
|
|
|
|
2004-06-21 06:47:33 +08:00
|
|
|
button = gtk_button_new_with_label (_("Fix seed"));
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (bbox), button);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-05-18 02:49:44 +08:00
|
|
|
G_CALLBACK (CML_set_or_randomize_seed_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
&VALS);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
random_sensitives[1].widget = button;
|
|
|
|
random_sensitives[1].logic = TRUE;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-06-21 06:47:33 +08:00
|
|
|
button = gtk_button_new_with_label (_("Random seed"));
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (bbox), button);
|
2000-01-28 03:26:00 +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
|
|
|
G_CALLBACK (CML_set_or_randomize_seed_callback),
|
|
|
|
&VALS);
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
random_sensitives[2].widget = button;
|
|
|
|
random_sensitives[2].logic = FALSE;
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
bbox = gtk_vbutton_box_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (bbox);
|
|
|
|
|
|
|
|
button = gtk_button_new_from_stock (GTK_STOCK_OPEN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (bbox), button);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-05-18 02:49:44 +08:00
|
|
|
G_CALLBACK (CML_load_from_file_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
&VALS);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (bbox), button);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-05-18 02:49:44 +08:00
|
|
|
G_CALLBACK (CML_save_to_file_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
&VALS);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
GtkWidget *notebook;
|
|
|
|
GtkWidget *page;
|
|
|
|
|
|
|
|
notebook = gtk_notebook_new ();
|
|
|
|
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (notebook);
|
|
|
|
|
2002-09-05 05:03:24 +08:00
|
|
|
page = CML_dialog_channel_panel_new (&VALS.hue, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page,
|
2004-07-31 02:45:34 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Hue")));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-09-05 05:03:24 +08:00
|
|
|
page = CML_dialog_channel_panel_new (&VALS.sat, 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page,
|
2004-07-31 02:45:34 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("Sat_uration")));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-09-05 05:03:24 +08:00
|
|
|
page = CML_dialog_channel_panel_new (&VALS.val, 2);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page,
|
2004-07-31 02:45:34 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Value")));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-09-05 05:03:24 +08:00
|
|
|
page = CML_dialog_advanced_panel_new ();
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page,
|
2004-07-31 02:45:34 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Advanced")));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
2004-05-28 09:12:12 +08:00
|
|
|
GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *combo;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkObject *adj;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2004-06-21 06:47:33 +08:00
|
|
|
frame = gimp_frame_new (_("Channel Independent Parameters"));
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
table = gtk_table_new (3, 3, FALSE);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new_array (CML_INITIAL_NUM_VALUES,
|
|
|
|
initial_value_names);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
VALS.initial_value);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (CML_initial_value_menu_update),
|
|
|
|
&VALS.initial_value);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
CML_explorer_menu_entry_init (&widget_pointers[3][0],
|
2004-07-31 02:45:34 +08:00
|
|
|
combo, &VALS.initial_value);
|
2004-05-28 09:12:12 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-06-21 06:47:33 +08:00
|
|
|
_("Initial value:"), 0.0, 0.5,
|
2004-05-28 09:12:12 +08:00
|
|
|
combo, 2, FALSE);
|
|
|
|
gtk_size_group_add_widget (group, label);
|
|
|
|
g_object_unref (group);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Zoom scale:"), SCALE_WIDTH, 3,
|
|
|
|
VALS.scale, 1, 10, 1, 2, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2004-05-28 09:12:12 +08:00
|
|
|
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_int_entry_init (&widget_pointers[3][1],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, &VALS.scale);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Start offset:"), SCALE_WIDTH, 3,
|
|
|
|
VALS.start_offset, 0, 100, 1, 10, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2004-05-28 09:12:12 +08:00
|
|
|
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_int_entry_init (&widget_pointers[3][2],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, &VALS.start_offset);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2002-09-05 05:03:24 +08:00
|
|
|
frame =
|
2004-07-31 02:45:34 +08:00
|
|
|
gimp_frame_new (_("Seed of Random (only for \"From Seed\" Modes)"));
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
table = gtk_table_new (2, 3, FALSE);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Seed:"), SCALE_WIDTH, 0,
|
|
|
|
VALS.seed, 0, (guint32) -1, 1, 10, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2004-05-28 09:12:12 +08:00
|
|
|
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_int_entry_init (&widget_pointers[3][3],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, &VALS.seed);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
random_sensitives[3].widget = table;
|
|
|
|
random_sensitives[3].logic = FALSE;
|
|
|
|
|
|
|
|
button =
|
2004-07-31 02:45:34 +08:00
|
|
|
gtk_button_new_with_label
|
|
|
|
(_("Switch to \"From seed\" with the last seed"));
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 3, 1, 2);
|
|
|
|
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
|
|
|
G_CALLBACK (CML_set_or_randomize_seed_callback),
|
|
|
|
&VALS);
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
random_sensitives[4].widget = button;
|
|
|
|
random_sensitives[4].logic = TRUE;
|
|
|
|
|
|
|
|
gimp_help_set_help_data (button,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("\"Fix seed\" button is an alias of me.\n"
|
|
|
|
"The same seed produces the same image, "
|
|
|
|
"if (1) the widths of images are same "
|
|
|
|
"(this is the reason why image on drawable "
|
|
|
|
"is different from preview), and (2) all "
|
|
|
|
"mutation rates equal to zero."), NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
|
2004-07-31 02:45:34 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("O_thers")));
|
2000-01-28 03:26:00 +08:00
|
|
|
}
|
2004-04-20 16:35:36 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-28 09:12:12 +08:00
|
|
|
GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *combo;
|
|
|
|
GtkWidget *vbox;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
frame = gimp_frame_new (_("Copy Settings"));
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
table = gtk_table_new (3, 2, FALSE);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new_array (G_N_ELEMENTS (channel_names),
|
|
|
|
channel_names);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), copy_source);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (gimp_int_combo_box_get_active),
|
|
|
|
©_source);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-05-28 09:12:12 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-06-21 06:47:33 +08:00
|
|
|
_("Source channel:"), 0.0, 0.5,
|
2004-05-28 09:12:12 +08:00
|
|
|
combo, 1, FALSE);
|
|
|
|
gtk_size_group_add_widget (group, label);
|
|
|
|
g_object_unref (group);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new_array (G_N_ELEMENTS (channel_names),
|
|
|
|
channel_names);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
copy_destination);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (gimp_int_combo_box_get_active),
|
|
|
|
©_destination);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-05-28 09:12:12 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-06-21 06:47:33 +08:00
|
|
|
_("Destination channel:"), 0.0, 0.5,
|
2004-05-28 09:12:12 +08:00
|
|
|
combo, 1, FALSE);
|
|
|
|
gtk_size_group_add_widget (group, label);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-06-21 06:47:33 +08:00
|
|
|
button = gtk_button_new_with_label (_("Copy parameters"));
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), button, 0, 2, 2, 3,
|
2004-07-31 02:45:34 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
|
2000-01-28 03:26:00 +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
|
|
|
G_CALLBACK (CML_copy_parameters_callback),
|
|
|
|
&VALS);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
frame = gimp_frame_new (_("Selective Load Settings"));
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new_array (G_N_ELEMENTS (load_channel_names),
|
|
|
|
load_channel_names);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
selective_load_source);
|
|
|
|
|
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (gimp_int_combo_box_get_active),
|
|
|
|
&selective_load_source);
|
|
|
|
|
2004-05-28 09:12:12 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
2004-06-21 06:47:33 +08:00
|
|
|
_("Source channel in file:"),
|
2004-05-28 09:12:12 +08:00
|
|
|
0.0, 0.5,
|
|
|
|
combo, 1, FALSE);
|
|
|
|
gtk_size_group_add_widget (group, label);
|
2004-04-20 16:35:36 +08:00
|
|
|
|
|
|
|
combo = gimp_int_combo_box_new_array (G_N_ELEMENTS (load_channel_names),
|
|
|
|
load_channel_names);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
selective_load_destination);
|
|
|
|
|
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (gimp_int_combo_box_get_active),
|
|
|
|
&selective_load_destination);
|
|
|
|
|
2004-05-28 09:12:12 +08:00
|
|
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
2004-06-21 06:47:33 +08:00
|
|
|
_("Destination channel:"),
|
2004-05-28 09:12:12 +08:00
|
|
|
0.0, 0.5,
|
|
|
|
combo, 1, FALSE);
|
|
|
|
gtk_size_group_add_widget (group, label);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2002-09-05 05:03:24 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
|
2004-07-31 02:45:34 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Misc Ops.")));
|
2000-01-28 03:26:00 +08:00
|
|
|
}
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_initial_value_sensitives_update ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-06 18:39:27 +08:00
|
|
|
/* Displaying preview might takes a long time. Thus, first, dialog itself
|
2000-01-28 03:26:00 +08:00
|
|
|
* should be shown before making preview in it.
|
|
|
|
*/
|
|
|
|
gtk_widget_show (dlg);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_preview_defer = FALSE;
|
|
|
|
preview_update ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
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
|
|
|
gtk_widget_destroy (dlg);
|
|
|
|
|
|
|
|
return run;
|
2000-01-28 03:26:00 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static GtkWidget *
|
2002-09-05 05:03:24 +08:00
|
|
|
CML_dialog_channel_panel_new (CML_PARAM *param,
|
2004-07-31 02:45:34 +08:00
|
|
|
gint channel_id)
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
|
|
|
GtkWidget *table;
|
2004-04-20 16:35:36 +08:00
|
|
|
GtkWidget *combo;
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkWidget *toggle;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkObject *adj;
|
|
|
|
gpointer *chank;
|
|
|
|
gint index = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
table = gtk_table_new (13, 3, FALSE);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new_array (CML_NUM_VALUES, function_names);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), param->function);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (CML_explorer_menu_update),
|
|
|
|
¶m->function);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_menu_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
combo, ¶m->function);
|
2000-01-31 11:13:02 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Function type:"), 0.0, 0.5,
|
|
|
|
combo, 2, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new_array (COMP_NUM_VALUES, composition_names);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
param->composition);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (CML_explorer_menu_update),
|
|
|
|
¶m->composition);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
CML_explorer_menu_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
combo, ¶m->composition);
|
2000-01-31 11:13:02 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Composition:"), 0.0, 0.5,
|
|
|
|
combo, 2, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
combo = gimp_int_combo_box_new_array (ARRANGE_NUM_VALUES, arrange_names);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), param->arrange);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-04-20 16:35:36 +08:00
|
|
|
g_signal_connect (combo, "changed",
|
|
|
|
G_CALLBACK (CML_explorer_menu_update),
|
|
|
|
¶m->arrange);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
CML_explorer_menu_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
combo, ¶m->arrange);
|
2000-01-31 11:13:02 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Misc arrange:"), 0.0, 0.5,
|
|
|
|
combo, 2, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-06-21 06:47:33 +08:00
|
|
|
toggle = gtk_check_button_new_with_label (_("Use cyclic range"));
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
2004-07-31 02:45:34 +08:00
|
|
|
param->cyclic_range);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), toggle, 0, 3, index, index + 1);
|
|
|
|
CML_explorer_toggle_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
toggle, ¶m->cyclic_range);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (toggle);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Mod. rate:"), SCALE_WIDTH, 5,
|
|
|
|
param->mod_rate, 0.0, 1.0, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, ¶m->mod_rate);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Env. sensitivity:"), SCALE_WIDTH, 5,
|
|
|
|
param->env_sensitivity, 0.0, 1.0, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, ¶m->env_sensitivity);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Diffusion dist.:"), SCALE_WIDTH, 5,
|
|
|
|
param->diffusion_dist, 2, 10, 1, 2, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_int_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, ¶m->diffusion_dist);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("# of subranges:"), SCALE_WIDTH, 5,
|
|
|
|
param->range_num, 1, 10, 1, 2, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_int_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, ¶m->range_num);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("P(ower factor):"), SCALE_WIDTH, 5,
|
|
|
|
param->power, 0.0, 10.0, 0.1, 1.0, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, ¶m->power);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Parameter k:"), SCALE_WIDTH, 5,
|
|
|
|
param->parameter_k, 0.0, 10.0, 0.1, 1.0, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, ¶m->parameter_k);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Range low:"), SCALE_WIDTH, 5,
|
|
|
|
param->range_l, 0.0, 1.0, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, ¶m->range_l);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Range high:"), SCALE_WIDTH, 5,
|
|
|
|
param->range_h, 0.0, 1.0, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index],
|
2004-07-31 02:45:34 +08:00
|
|
|
adj, ¶m->range_h);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
chank = g_new (gpointer, 2);
|
2003-11-15 02:05:39 +08:00
|
|
|
chank[0] = GINT_TO_POINTER (channel_id);
|
|
|
|
chank[1] = param;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-06-21 06:47:33 +08:00
|
|
|
button = gtk_button_new_with_label (_("Plot a graph of the settings"));
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), button,
|
2004-07-31 02:45:34 +08:00
|
|
|
0, 3, index, index + 1);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (button);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (function_graph_new),
|
|
|
|
chank);
|
2002-09-05 05:03:24 +08:00
|
|
|
return table;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *
|
2002-09-05 05:03:24 +08:00
|
|
|
CML_dialog_advanced_panel_new (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *subframe;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkObject *adj;
|
|
|
|
|
|
|
|
gint index = 0;
|
|
|
|
gint widget_offset = 12;
|
|
|
|
gint channel_id;
|
|
|
|
CML_PARAM *param;
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (channel_id = 0; channel_id < 3; channel_id++)
|
|
|
|
{
|
|
|
|
param = (CML_PARAM *)&VALS + channel_id;
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
subframe = gimp_frame_new (gettext (channel_names[channel_id]));
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), subframe, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (subframe);
|
|
|
|
|
|
|
|
table = gtk_table_new (3, 3, FALSE);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (subframe), table);
|
|
|
|
gtk_widget_show (table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
index = 0;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Ch. sensitivity:"), SCALE_WIDTH, 0,
|
|
|
|
param->ch_sensitivity, 0.0, 1.0, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index +
|
2004-07-31 02:45:34 +08:00
|
|
|
widget_offset],
|
|
|
|
adj, ¶m->ch_sensitivity);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Mutation rate:"), SCALE_WIDTH, 0,
|
|
|
|
param->mutation_rate, 0.0, 1.0, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index +
|
2004-07-31 02:45:34 +08:00
|
|
|
widget_offset],
|
|
|
|
adj, ¶m->mutation_rate);
|
1997-11-25 06:05:25 +08:00
|
|
|
index++;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, index,
|
2004-07-31 02:45:34 +08:00
|
|
|
_("Mutation dist.:"), SCALE_WIDTH, 0,
|
|
|
|
param->mutation_dist, 0.0, 1.0, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
NULL, NULL);
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_double_entry_init (&widget_pointers[channel_id][index +
|
2004-07-31 02:45:34 +08:00
|
|
|
widget_offset],
|
|
|
|
adj, ¶m->mutation_dist);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2002-09-05 05:03:24 +08:00
|
|
|
return vbox;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-01-28 03:26:00 +08:00
|
|
|
preview_update (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-01-12 17:19:49 +08:00
|
|
|
if (! CML_preview_defer)
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_main_function (TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
static gboolean
|
|
|
|
function_graph_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *ev,
|
|
|
|
gpointer *data)
|
|
|
|
{
|
|
|
|
gint x, y, last_y;
|
|
|
|
gint rgbi[3];
|
|
|
|
guchar *buffer;
|
|
|
|
gint channel_id = GPOINTER_TO_INT (data[0]);
|
|
|
|
CML_PARAM *param = data[1];
|
|
|
|
|
|
|
|
buffer = g_new (guchar, 256*256*3);
|
|
|
|
for (x = 0; x < 256; x++)
|
|
|
|
{
|
|
|
|
/* hue */
|
|
|
|
rgbi[0] = rgbi[1] = rgbi[2] = 127;
|
|
|
|
if ((0 <= channel_id) && (channel_id <= 2))
|
|
|
|
rgbi[channel_id] = CANNONIZE ((*param), ((gdouble) x / (gdouble) 255));
|
|
|
|
gimp_hsv_to_rgb_int (rgbi, rgbi+1, rgbi+2);
|
|
|
|
for (y = 0; y < 256; y++)
|
|
|
|
{
|
|
|
|
buffer[(y*256+x)*3+0] = rgbi[0];
|
|
|
|
buffer[(y*256+x)*3+1] = rgbi[1];
|
|
|
|
buffer[(y*256+x)*3+2] = rgbi[2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_draw_rgb_image (widget->window, widget->style->black_gc,
|
|
|
|
0, 0, 256, 256,
|
|
|
|
GDK_RGB_DITHER_NORMAL,
|
|
|
|
buffer,
|
|
|
|
3 * 256);
|
|
|
|
|
|
|
|
g_free (buffer);
|
|
|
|
|
|
|
|
gdk_draw_line (widget->window, widget->style->white_gc, 0,255, 255, 0);
|
|
|
|
|
|
|
|
y = 255 * CLAMP (logistic_function (param, 0, param->power),
|
|
|
|
0, 1.0);
|
|
|
|
for (x = 0; x < 256; x++)
|
|
|
|
{
|
|
|
|
last_y = y;
|
|
|
|
/* curve */
|
|
|
|
y = 255 * CLAMP (logistic_function (param, x/(gdouble)255, param->power),
|
|
|
|
0, 1.0);
|
|
|
|
gdk_draw_line (widget->window, widget->style->black_gc,
|
|
|
|
x, 255-last_y, x, 255-y);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
function_graph_new (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer *data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-07 00:40:17 +08:00
|
|
|
GtkWidget *dlg;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *preview;
|
|
|
|
|
|
|
|
dlg = gimp_dialog_new (_("Graph of the current settings"), "cml_explorer",
|
2003-11-10 06:44:45 +08:00
|
|
|
gtk_widget_get_toplevel (widget), 0,
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
2000-01-07 00:40:17 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
2000-01-07 00:40:17 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
NULL);
|
2000-01-07 00:40:17 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, FALSE, FALSE, 0);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
preview = gtk_drawing_area_new ();
|
|
|
|
gtk_widget_set_size_request (preview, 256, 256);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), preview);
|
|
|
|
gtk_widget_show (preview);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (preview, "expose-event",
|
2004-07-31 02:45:34 +08:00
|
|
|
G_CALLBACK (function_graph_expose), data);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (dlg);
|
|
|
|
|
2003-11-12 02:11:56 +08:00
|
|
|
gimp_dialog_run (GIMP_DIALOG (dlg));
|
2003-11-06 23:27:05 +08:00
|
|
|
|
|
|
|
gtk_widget_destroy (dlg);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_set_or_randomize_seed_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
CML_preview_defer = TRUE;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
switch (VALS.initial_value)
|
|
|
|
{
|
|
|
|
case CML_INITIAL_RANDOM_INDEPENDENT:
|
|
|
|
VALS.initial_value = CML_INITIAL_RANDOM_FROM_SEED;
|
|
|
|
break;
|
|
|
|
case CML_INITIAL_RANDOM_SHARED:
|
|
|
|
VALS.initial_value = CML_INITIAL_RANDOM_FROM_SEED_SHARED;
|
|
|
|
break;
|
|
|
|
case CML_INITIAL_RANDOM_FROM_SEED:
|
|
|
|
VALS.initial_value = CML_INITIAL_RANDOM_INDEPENDENT;
|
|
|
|
break;
|
|
|
|
case CML_INITIAL_RANDOM_FROM_SEED_SHARED:
|
|
|
|
VALS.initial_value = CML_INITIAL_RANDOM_SHARED;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (widget_pointers[3][3].widget && widget_pointers[3][3].updater)
|
|
|
|
(widget_pointers[3][3].updater) (widget_pointers[3]+3);
|
|
|
|
if (widget_pointers[3][0].widget && widget_pointers[3][0].updater)
|
|
|
|
(widget_pointers[3][0].updater) (widget_pointers[3]);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
CML_initial_value_sensitives_update ();
|
2000-01-28 03:26:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
CML_preview_defer = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_copy_parameters_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
gint index;
|
|
|
|
WidgetEntry *widgets;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (copy_source == copy_destination)
|
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
g_message (_("Warning: the source and the destination are the same channel."));
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
}
|
2002-06-14 04:32:21 +08:00
|
|
|
*channel_params[copy_destination] = *channel_params[copy_source];
|
1997-11-25 06:05:25 +08:00
|
|
|
CML_preview_defer = TRUE;
|
|
|
|
widgets = widget_pointers[copy_destination];
|
2004-01-12 17:19:49 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
for (index = 0; index < CML_PARAM_NUM; index++)
|
|
|
|
if (widgets[index].widget && widgets[index].updater)
|
2000-01-28 03:26:00 +08:00
|
|
|
(widgets[index].updater) (widgets + index);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
CML_preview_defer = FALSE;
|
|
|
|
preview_update ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_initial_value_sensitives_update (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
gint i = 0;
|
|
|
|
gint flag1, flag2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
flag1 = (CML_INITIAL_RANDOM_INDEPENDENT <= VALS.initial_value)
|
|
|
|
& (VALS.initial_value <= CML_INITIAL_RANDOM_FROM_SEED_SHARED);
|
|
|
|
flag2 = (CML_INITIAL_RANDOM_INDEPENDENT <= VALS.initial_value)
|
|
|
|
& (VALS.initial_value <= CML_INITIAL_RANDOM_SHARED);
|
|
|
|
|
2001-12-06 10:28:58 +08:00
|
|
|
for (; i < G_N_ELEMENTS (random_sensitives) ; i++)
|
1997-11-25 06:05:25 +08:00
|
|
|
if (random_sensitives[i].widget)
|
|
|
|
gtk_widget_set_sensitive (random_sensitives[i].widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
flag1 & (random_sensitives[i].logic == flag2));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void
|
|
|
|
CML_preview_update_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
WidgetEntry seed_widget = widget_pointers[3][3];
|
2000-01-07 00:40:17 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
preview_update ();
|
2000-01-07 00:40:17 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_preview_defer = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
if (seed_widget.widget && seed_widget.updater)
|
2002-09-05 05:03:24 +08:00
|
|
|
seed_widget.updater (&seed_widget);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_preview_defer = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
/* parameter file saving functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_save_to_file_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-18 02:49:44 +08:00
|
|
|
static GtkWidget *dialog = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
if (! dialog)
|
2003-06-06 18:39:27 +08:00
|
|
|
{
|
2004-05-18 02:49:44 +08:00
|
|
|
dialog =
|
|
|
|
gtk_file_chooser_dialog_new (_("Save Parameters to"),
|
|
|
|
GTK_WINDOW (gtk_widget_get_toplevel (widget)),
|
|
|
|
GTK_FILE_CHOOSER_ACTION_SAVE,
|
|
|
|
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
|
2003-11-10 06:44:45 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
NULL);
|
2003-08-24 03:35:05 +08:00
|
|
|
|
2005-04-08 01:10:05 +08:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
2004-11-08 19:24:43 +08:00
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
2003-11-19 22:51:52 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
g_signal_connect (dialog, "response",
|
2004-07-31 02:45:34 +08:00
|
|
|
G_CALLBACK (CML_save_to_file_response),
|
|
|
|
NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (dialog, "delete-event",
|
2003-11-19 22:51:52 +08:00
|
|
|
G_CALLBACK (gtk_true),
|
|
|
|
NULL);
|
2003-06-06 18:39:27 +08:00
|
|
|
}
|
2003-06-06 18:56:08 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
if (strlen (VALS.last_file_name))
|
|
|
|
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
|
|
|
|
VALS.last_file_name);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-05-18 02:49:44 +08:00
|
|
|
CML_save_to_file_response (GtkWidget *dialog,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-18 02:49:44 +08:00
|
|
|
gchar *filename;
|
|
|
|
FILE *file;
|
|
|
|
gint channel_id;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-11-19 22:51:52 +08:00
|
|
|
if (response_id != GTK_RESPONSE_OK)
|
|
|
|
{
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_widget_hide (dialog);
|
2003-11-19 22:51:52 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
1997-11-25 06:05:25 +08:00
|
|
|
if (! filename)
|
|
|
|
return;
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
if (g_file_test (filename, G_FILE_TEST_EXISTS) &&
|
|
|
|
! force_overwrite (filename, dialog))
|
|
|
|
return;
|
2003-06-13 22:37:00 +08:00
|
|
|
|
2005-03-04 23:12:29 +08:00
|
|
|
file = g_fopen (filename, "w");
|
2003-12-03 19:29:40 +08:00
|
|
|
|
|
|
|
if (! file)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-11-15 21:53:33 +08:00
|
|
|
g_message (_("Could not open '%s' for writing: %s"),
|
2004-01-19 11:06:04 +08:00
|
|
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
2004-05-18 02:49:44 +08:00
|
|
|
g_free (filename);
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
}
|
2003-11-19 22:51:52 +08:00
|
|
|
|
|
|
|
fprintf (file, "; This is a parameter file for CML_explorer\n");
|
|
|
|
fprintf (file, "; File format version: %1.1f\n", PARAM_FILE_FORMAT_VERSION);
|
|
|
|
fprintf (file, ";\n");
|
|
|
|
|
|
|
|
for (channel_id = 0; channel_id < 3; channel_id++)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-11-19 22:51:52 +08:00
|
|
|
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
|
|
|
|
|
|
|
|
CML_PARAM param = *(CML_PARAM *)(channel_params[channel_id]);
|
|
|
|
|
|
|
|
fprintf (file, "\t%s\n", channel_names[channel_id]);
|
|
|
|
fprintf (file, "Function_type : %d (%s)\n",
|
|
|
|
param.function, function_names[param.function]);
|
|
|
|
fprintf (file, "Compostion_type : %d (%s)\n",
|
|
|
|
param.composition, composition_names[param.composition]);
|
|
|
|
fprintf (file, "Arrange : %d (%s)\n",
|
|
|
|
param.arrange, arrange_names[param.arrange]);
|
|
|
|
fprintf (file, "Cyclic_range : %d (%s)\n",
|
|
|
|
param.cyclic_range, (param.cyclic_range ? "TRUE" : "FALSE"));
|
|
|
|
fprintf (file, "Mod. rate : %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.mod_rate));
|
|
|
|
fprintf (file, "Env_sensitivtiy : %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.env_sensitivity));
|
|
|
|
fprintf (file, "Diffusion dist. : %d\n", param.diffusion_dist);
|
|
|
|
fprintf (file, "Ch. sensitivity : %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.ch_sensitivity));
|
|
|
|
fprintf (file, "Num. of Subranges: %d\n", param.range_num);
|
|
|
|
fprintf (file, "Power_factor : %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.power));
|
|
|
|
fprintf (file, "Parameter_k : %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.parameter_k));
|
|
|
|
fprintf (file, "Range_low : %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.range_l));
|
|
|
|
fprintf (file, "Range_high : %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.range_h));
|
|
|
|
fprintf (file, "Mutation_rate : %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.mutation_rate));
|
|
|
|
fprintf (file, "Mutation_distance: %s\n",
|
|
|
|
g_ascii_dtostr (buf, sizeof (buf), param.mutation_dist));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2003-11-19 22:51:52 +08:00
|
|
|
fprintf (file, "\n");
|
|
|
|
fprintf (file, "Initial value : %d (%s)\n",
|
|
|
|
VALS.initial_value, initial_value_names[VALS.initial_value]);
|
|
|
|
fprintf (file, "Zoom scale : %d\n", VALS.scale);
|
|
|
|
fprintf (file, "Start offset : %d\n", VALS.start_offset);
|
|
|
|
fprintf (file, "Random seed : %d\n", VALS.seed);
|
|
|
|
fclose(file);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
g_message (_("Parameters were saved to '%s'"),
|
2004-01-19 11:06:04 +08:00
|
|
|
gimp_filename_to_utf8 (filename));
|
2003-11-19 22:51:52 +08:00
|
|
|
|
|
|
|
strncpy (VALS.last_file_name, filename,
|
|
|
|
sizeof (VALS.last_file_name) - 1);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
g_free (filename);
|
|
|
|
|
|
|
|
gtk_widget_hide (dialog);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-12-03 10:36:04 +08:00
|
|
|
static gboolean
|
2003-11-10 06:44:45 +08:00
|
|
|
force_overwrite (const gchar *filename,
|
|
|
|
GtkWidget *parent)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkWidget *dlg;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
gchar *buffer;
|
2003-11-06 23:27:05 +08:00
|
|
|
gboolean overwrite;
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
dlg = gimp_dialog_new (_("CML Explorer: Overwrite File?"), "cml_explorer",
|
2003-11-19 22:51:52 +08:00
|
|
|
parent, GTK_DIALOG_MODAL,
|
2005-08-14 02:29:14 +08:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-07-31 02:45:34 +08:00
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
|
|
|
|
hbox, FALSE, FALSE, 12);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
2003-12-03 19:29:40 +08:00
|
|
|
buffer = g_strdup_printf (_("File '%s' exists.\n"
|
|
|
|
"Overwrite it?"), filename);
|
1997-11-25 06:05:25 +08:00
|
|
|
label = gtk_label_new (buffer);
|
1999-12-30 02:07:43 +08:00
|
|
|
g_free (buffer);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 12);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (label);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (dlg);
|
|
|
|
|
2003-11-12 02:11:56 +08:00
|
|
|
overwrite = (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
|
|
|
gtk_widget_destroy (dlg);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
return overwrite;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
/* parameter file loading functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_load_from_file_callback (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-18 02:49:44 +08:00
|
|
|
static GtkWidget *dialog = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
if (! dialog)
|
2003-06-06 18:39:27 +08:00
|
|
|
{
|
2004-05-18 02:49:44 +08:00
|
|
|
dialog =
|
|
|
|
gtk_file_chooser_dialog_new ("",
|
|
|
|
GTK_WINDOW (gtk_widget_get_toplevel (widget)),
|
|
|
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
|
|
|
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-04-08 01:10:05 +08:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
2004-11-08 19:24:43 +08:00
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
2003-11-19 22:51:52 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
g_signal_connect (dialog, "response",
|
2004-07-31 02:45:34 +08:00
|
|
|
G_CALLBACK (CML_load_from_file_response),
|
|
|
|
NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (dialog, "delete-event",
|
2003-12-03 10:36:04 +08:00
|
|
|
G_CALLBACK (gtk_true),
|
|
|
|
NULL);
|
2003-06-06 18:39:27 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-06-06 18:39:27 +08:00
|
|
|
if ((selective_load_source == 0) || (selective_load_destination == 0))
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (dialog), _("Load Parameters from"));
|
2003-06-06 18:39:27 +08:00
|
|
|
else
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (dialog), _("Selective Load from"));
|
2003-08-24 03:35:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (strlen (VALS.last_file_name) > 0)
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
|
|
|
|
VALS.last_file_name);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-05-18 02:49:44 +08:00
|
|
|
CML_load_from_file_response (GtkWidget *dialog,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-11-19 22:51:52 +08:00
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-18 02:49:44 +08:00
|
|
|
gchar *filename;
|
|
|
|
gint channel_id;
|
|
|
|
gboolean flag = TRUE;
|
2003-11-19 22:51:52 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
2003-11-19 22:51:52 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_widget_set_sensitive (dialog, FALSE);
|
2003-11-19 22:51:52 +08:00
|
|
|
flag = CML_load_parameter_file (filename, TRUE);
|
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
g_free (filename);
|
|
|
|
|
2003-11-19 22:51:52 +08:00
|
|
|
if (flag)
|
|
|
|
{
|
|
|
|
WidgetEntry *widgets;
|
2004-05-18 02:49:44 +08:00
|
|
|
gint index;
|
2003-11-19 22:51:52 +08:00
|
|
|
|
|
|
|
CML_preview_defer = TRUE;
|
|
|
|
|
|
|
|
for (channel_id = 0; channel_id < 3; channel_id++)
|
|
|
|
{
|
|
|
|
widgets = widget_pointers[channel_id];
|
|
|
|
for (index = 0; index < CML_PARAM_NUM; index++)
|
|
|
|
if (widgets[index].widget && widgets[index].updater)
|
|
|
|
(widgets[index].updater) (widgets + index);
|
|
|
|
}
|
|
|
|
/* channel independent parameters */
|
|
|
|
widgets = widget_pointers[3];
|
|
|
|
for (index = 0; index < 4; index++)
|
|
|
|
if (widgets[index].widget && widgets[index].updater)
|
|
|
|
(widgets[index].updater) (widgets + index);
|
|
|
|
|
|
|
|
CML_preview_defer = FALSE;
|
|
|
|
|
|
|
|
preview_update ();
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-11-19 22:51:52 +08:00
|
|
|
|
2004-05-18 02:49:44 +08:00
|
|
|
gtk_widget_hide (GTK_WIDGET (dialog));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2004-01-12 17:19:49 +08:00
|
|
|
static gboolean
|
2001-07-29 17:43:09 +08:00
|
|
|
CML_load_parameter_file (const gchar *filename,
|
2004-07-31 02:45:34 +08:00
|
|
|
gboolean interactive_mode)
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
|
|
|
FILE *file;
|
|
|
|
gint channel_id;
|
2002-09-05 05:03:24 +08:00
|
|
|
gboolean flag = TRUE;
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_PARAM ch[3];
|
|
|
|
gint initial_value = 0;
|
|
|
|
gint scale = 1;
|
|
|
|
gint start_offset = 0;
|
|
|
|
gint seed = 0;
|
|
|
|
gint old2new_function_id[] = { 3, 4, 5, 6, 7, 9, 10, 11, 1, 2 };
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-03-04 23:12:29 +08:00
|
|
|
file = g_fopen (filename, "r");
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (!file)
|
|
|
|
{
|
2003-11-15 21:53:33 +08:00
|
|
|
g_message (_("Could not open '%s' for reading: %s"),
|
2004-01-19 11:06:04 +08:00
|
|
|
gimp_filename_to_utf8 (filename), g_strerror (errno));
|
1997-11-25 06:05:25 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
gimp-joke-980321
* app/iscissors.c, app/tips_dialog.c, app/gradient.c,
libgimp/gimp.c, plug-ins/AlienMap/AlienMap.c,
plug-ins/bmp/bmp.c, plug-ins/fits/fitsrw.h,
plug-ins/fits/fitsrw.c, plug-ins/flarefx/flarefx.c,
plug-ins/gfig/gfig.c, plug-ins/gfli/gfli.c,
plug-ins/gicon/gicon.c, plug-ins/gqbist/gqbist.c,
plug-ins/gtm/gtm.c, plug-ins/hot/hot.c,
plug-ins/ifscompose/ifscompose.c,
plug-ins/ifscompose/ifscompose_utils.c
plug-ins/max_rgb/max_rgb.c, plug-ins/nlfilt/nlfilt.c,
plug-ins/pat/pat.c, plug-ins/pcx/pcx.c, plug-ins/rotate/rotate.c,
plug-ins/script-fu/script-fu-server.c, plug-ins/snoise/snoise.c,
plug-ins/threshold_alpha/threshold_alpha.c,
plug-ins/zealouscrop/zealouscrop.c :gimp-joke-980321
plug-ins/CML_explorer, plug-ins/autocrop,
plug-ins/align_layers, plug-ins/blinds,
plug-ins/bmp, plug-ins/megawidget: gimp-joke-980322
Applied gimp-joke-980322-0.patch and gimp-joke-980321-0.patch
from Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp>. Mostly
portability for DEC osf1's cc. Lots of MAIN();'s, trailing
commas in enums, and guchar/gchar madness.
Gimp now sends mail, cleans vinyl records,
removes stubborn stains, julien fries, and more!
-adrian
1998-03-23 04:44:39 +08:00
|
|
|
gchar line[CML_LINE_SIZE];
|
1997-11-25 06:05:25 +08:00
|
|
|
gdouble version = 0.99;
|
|
|
|
|
|
|
|
version = parse_line_to_gdouble (file, &flag); /* old format returns 1 */
|
|
|
|
if (version == 1.0)
|
2004-07-31 02:45:34 +08:00
|
|
|
version = 0.99;
|
1997-11-25 06:05:25 +08:00
|
|
|
else if (! flag)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
flag = TRUE;
|
|
|
|
version = parse_line_to_gdouble (file, &flag); /* maybe new format */
|
|
|
|
if (flag)
|
|
|
|
fgets (line, CML_LINE_SIZE - 1, file); /* one more comment line */
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
if (version == 0)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
if (interactive_mode)
|
|
|
|
gimp_message (_("Error: it's not CML parameter file."));
|
|
|
|
fclose(file);
|
|
|
|
return FALSE;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
if (interactive_mode)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
if (version < PARAM_FILE_FORMAT_VERSION)
|
|
|
|
g_message (_("Warning: '%s' is an old format file."),
|
2004-01-19 11:06:04 +08:00
|
|
|
gimp_filename_to_utf8 (filename));
|
2004-07-31 02:45:34 +08:00
|
|
|
if (PARAM_FILE_FORMAT_VERSION < version)
|
|
|
|
g_message (_("Warning: '%s' is a parameter file for newer "
|
2004-01-19 11:06:04 +08:00
|
|
|
"CML_explorer than me."),
|
|
|
|
gimp_filename_to_utf8 (filename));
|
2004-07-31 02:45:34 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
for (channel_id = 0; flag && (channel_id < 3); channel_id++)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
/* patched by Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu> */
|
|
|
|
if (fgets (line, CML_LINE_SIZE - 1, file) == NULL) /* skip channel name */
|
|
|
|
{
|
|
|
|
flag = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ch[channel_id].function = parse_line_to_gint (file, &flag);
|
|
|
|
if (version < 1.0)
|
|
|
|
ch[channel_id].function = old2new_function_id [ch[channel_id].function];
|
|
|
|
if (1.0 <= version)
|
|
|
|
ch[channel_id].composition = parse_line_to_gint (file, &flag);
|
|
|
|
else
|
|
|
|
ch[channel_id].composition = COMP_NONE;
|
|
|
|
ch[channel_id].arrange = parse_line_to_gint (file, &flag);
|
|
|
|
ch[channel_id].cyclic_range = parse_line_to_gint (file, &flag);
|
|
|
|
ch[channel_id].mod_rate = parse_line_to_gdouble (file, &flag);
|
|
|
|
ch[channel_id].env_sensitivity = parse_line_to_gdouble (file, &flag);
|
|
|
|
if (1.0 <= version)
|
|
|
|
ch[channel_id].diffusion_dist = parse_line_to_gint (file, &flag);
|
|
|
|
else
|
|
|
|
ch[channel_id].diffusion_dist = 2;
|
|
|
|
ch[channel_id].ch_sensitivity = parse_line_to_gdouble (file, &flag);
|
|
|
|
ch[channel_id].range_num = parse_line_to_gint (file, &flag);
|
|
|
|
ch[channel_id].power = parse_line_to_gdouble (file, &flag);
|
|
|
|
ch[channel_id].parameter_k = parse_line_to_gdouble (file, &flag);
|
|
|
|
ch[channel_id].range_l = parse_line_to_gdouble (file, &flag);
|
|
|
|
ch[channel_id].range_h = parse_line_to_gdouble (file, &flag);
|
|
|
|
ch[channel_id].mutation_rate = parse_line_to_gdouble (file, &flag);
|
|
|
|
ch[channel_id].mutation_dist = parse_line_to_gdouble (file, &flag);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
if (flag)
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
gint dummy;
|
|
|
|
|
|
|
|
if (fgets (line, CML_LINE_SIZE - 1, file) == NULL) /* skip a line */
|
|
|
|
dummy = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
initial_value = parse_line_to_gint (file, &dummy);
|
|
|
|
scale = parse_line_to_gint (file, &dummy);
|
|
|
|
start_offset = parse_line_to_gint (file, &dummy);
|
|
|
|
seed = parse_line_to_gint (file, &dummy);
|
|
|
|
}
|
|
|
|
if (! dummy)
|
|
|
|
{
|
|
|
|
initial_value = 0;
|
|
|
|
scale = 1;
|
|
|
|
start_offset = 0;
|
|
|
|
seed = 0;
|
|
|
|
}
|
|
|
|
}
|
2004-01-12 17:19:49 +08:00
|
|
|
fclose (file);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2004-01-12 17:19:49 +08:00
|
|
|
if (! flag)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
if (interactive_mode)
|
2004-07-31 02:45:34 +08:00
|
|
|
gimp_message (_("Error: failed to load parameters"));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((selective_load_source == 0) || (selective_load_destination == 0))
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
VALS.hue = ch[0];
|
|
|
|
VALS.sat = ch[1];
|
|
|
|
VALS.val = ch[2];
|
|
|
|
|
|
|
|
VALS.initial_value = initial_value;
|
|
|
|
VALS.scale = scale;
|
|
|
|
VALS.start_offset = start_offset;
|
|
|
|
VALS.seed = seed;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2004-07-31 02:45:34 +08:00
|
|
|
{
|
|
|
|
memcpy ((CML_PARAM *)&VALS + (selective_load_destination - 1),
|
|
|
|
(void *)&ch[selective_load_source - 1],
|
|
|
|
sizeof (CML_PARAM));
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-07-29 17:43:09 +08:00
|
|
|
strncpy (VALS.last_file_name, filename,
|
|
|
|
sizeof (VALS.last_file_name) - 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2004-01-12 17:19:49 +08:00
|
|
|
parse_line_to_gint (FILE *file,
|
2004-07-31 02:45:34 +08:00
|
|
|
gboolean *flag)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
gchar line[CML_LINE_SIZE];
|
gimp-joke-980321
* app/iscissors.c, app/tips_dialog.c, app/gradient.c,
libgimp/gimp.c, plug-ins/AlienMap/AlienMap.c,
plug-ins/bmp/bmp.c, plug-ins/fits/fitsrw.h,
plug-ins/fits/fitsrw.c, plug-ins/flarefx/flarefx.c,
plug-ins/gfig/gfig.c, plug-ins/gfli/gfli.c,
plug-ins/gicon/gicon.c, plug-ins/gqbist/gqbist.c,
plug-ins/gtm/gtm.c, plug-ins/hot/hot.c,
plug-ins/ifscompose/ifscompose.c,
plug-ins/ifscompose/ifscompose_utils.c
plug-ins/max_rgb/max_rgb.c, plug-ins/nlfilt/nlfilt.c,
plug-ins/pat/pat.c, plug-ins/pcx/pcx.c, plug-ins/rotate/rotate.c,
plug-ins/script-fu/script-fu-server.c, plug-ins/snoise/snoise.c,
plug-ins/threshold_alpha/threshold_alpha.c,
plug-ins/zealouscrop/zealouscrop.c :gimp-joke-980321
plug-ins/CML_explorer, plug-ins/autocrop,
plug-ins/align_layers, plug-ins/blinds,
plug-ins/bmp, plug-ins/megawidget: gimp-joke-980322
Applied gimp-joke-980322-0.patch and gimp-joke-980321-0.patch
from Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp>. Mostly
portability for DEC osf1's cc. Lots of MAIN();'s, trailing
commas in enums, and guchar/gchar madness.
Gimp now sends mail, cleans vinyl records,
removes stubborn stains, julien fries, and more!
-adrian
1998-03-23 04:44:39 +08:00
|
|
|
gchar *str;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (! *flag)
|
|
|
|
return 0;
|
|
|
|
if (fgets (line, CML_LINE_SIZE - 1, file) == NULL)
|
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
*flag = FALSE; /* set FALSE if fail to parse */
|
1997-11-25 06:05:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
str = &line[0];
|
|
|
|
while (*str != ':')
|
|
|
|
if (*str == '\000')
|
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
*flag = FALSE;
|
|
|
|
return 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
2004-01-12 17:19:49 +08:00
|
|
|
{
|
|
|
|
str++;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-01-12 17:19:49 +08:00
|
|
|
return atoi (str + 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gdouble
|
2004-01-12 17:19:49 +08:00
|
|
|
parse_line_to_gdouble (FILE *file,
|
2004-07-31 02:45:34 +08:00
|
|
|
gboolean *flag)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
gchar line[CML_LINE_SIZE];
|
|
|
|
gchar *str;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (! *flag)
|
2004-01-12 17:19:49 +08:00
|
|
|
return 0.0;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (fgets (line, CML_LINE_SIZE - 1, file) == NULL)
|
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
*flag = FALSE; /* set FALSE if fail to parse */
|
2004-01-12 17:19:49 +08:00
|
|
|
return 0.0;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
str = &line[0];
|
|
|
|
while (*str != ':')
|
|
|
|
if (*str == '\000')
|
|
|
|
{
|
2004-07-31 02:45:34 +08:00
|
|
|
*flag = FALSE;
|
|
|
|
return 0.0;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
2004-01-12 17:19:49 +08:00
|
|
|
{
|
|
|
|
str++;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-01-12 17:19:49 +08:00
|
|
|
return g_ascii_strtod (str + 1, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
/* toggle button functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_toggle_update (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
gimp_toggle_button_update (widget, data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
preview_update ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_toggle_entry_change_value (WidgetEntry *widget_entry)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget_entry->widget),
|
2004-07-31 02:45:34 +08:00
|
|
|
*(gint *) (widget_entry->value));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_toggle_entry_init (WidgetEntry *widget_entry,
|
2004-07-31 02:45:34 +08:00
|
|
|
GtkWidget *widget,
|
|
|
|
gpointer value_ptr)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (widget, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (CML_explorer_toggle_update),
|
|
|
|
value_ptr);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
widget_entry->widget = widget;
|
|
|
|
widget_entry->value = value_ptr;
|
|
|
|
widget_entry->updater = CML_explorer_toggle_entry_change_value;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
/* int adjustment functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_int_adjustment_update (GtkAdjustment *adjustment,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
gimp_int_adjustment_update (adjustment, data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
preview_update ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_int_entry_change_value (WidgetEntry *widget_entry)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkAdjustment *adjustment = (GtkAdjustment *) (widget_entry->widget);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_adjustment_set_value (adjustment, *(gint *) (widget_entry->value));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_explorer_int_entry_init (WidgetEntry *widget_entry,
|
2004-07-31 02:45:34 +08:00
|
|
|
GtkObject *adjustment,
|
|
|
|
gpointer value_ptr)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adjustment, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (CML_explorer_int_adjustment_update),
|
|
|
|
value_ptr);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
widget_entry->widget = (GtkWidget *) adjustment;
|
|
|
|
widget_entry->value = value_ptr;
|
|
|
|
widget_entry->updater = CML_explorer_int_entry_change_value;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
/* double adjustment functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void
|
|
|
|
CML_explorer_double_adjustment_update (GtkAdjustment *adjustment,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
gimp_double_adjustment_update (adjustment, data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
preview_update ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void
|
|
|
|
CML_explorer_double_entry_change_value (WidgetEntry *widget_entry)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
GtkAdjustment *adjustment = (GtkAdjustment *) (widget_entry->widget);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_adjustment_set_value (adjustment, *(gdouble *) (widget_entry->value));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void
|
|
|
|
CML_explorer_double_entry_init (WidgetEntry *widget_entry,
|
2004-07-31 02:45:34 +08:00
|
|
|
GtkObject *adjustment,
|
|
|
|
gpointer value_ptr)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adjustment, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (CML_explorer_double_adjustment_update),
|
|
|
|
value_ptr);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
widget_entry->widget = (GtkWidget *) adjustment;
|
|
|
|
widget_entry->value = value_ptr;
|
|
|
|
widget_entry->updater = CML_explorer_double_entry_change_value;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
/* menu functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void
|
|
|
|
CML_explorer_menu_update (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-04-20 16:35:36 +08:00
|
|
|
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
preview_update ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void
|
|
|
|
CML_initial_value_menu_update (GtkWidget *widget,
|
2004-07-31 02:45:34 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-04-20 16:35:36 +08:00
|
|
|
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
CML_initial_value_sensitives_update ();
|
|
|
|
preview_update ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void
|
|
|
|
CML_explorer_menu_entry_change_value (WidgetEntry *widget_entry)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-04-20 16:35:36 +08:00
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget_entry->widget),
|
|
|
|
*(gint *) (widget_entry->value));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
static void
|
|
|
|
CML_explorer_menu_entry_init (WidgetEntry *widget_entry,
|
2004-07-31 02:45:34 +08:00
|
|
|
GtkWidget *widget,
|
|
|
|
gpointer value_ptr)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-01-28 03:26:00 +08:00
|
|
|
widget_entry->widget = widget;
|
|
|
|
widget_entry->value = value_ptr;
|
|
|
|
widget_entry->updater = CML_explorer_menu_entry_change_value;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|