2005-03-04 21:23:32 +08:00
|
|
|
/**********************************************************************
|
2006-12-10 05:33:38 +08:00
|
|
|
GIMP - The GNU Image Manipulation Program
|
2005-03-04 21:23:32 +08:00
|
|
|
Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
2009-01-18 06:28:01 +08:00
|
|
|
This program is free software: you can redistribute it and/or modify
|
2005-03-04 21:23:32 +08:00
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2005-03-04 21:23:32 +08:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2005-03-04 21:23:32 +08:00
|
|
|
*********************************************************************/
|
|
|
|
|
2000-01-06 06:37:07 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2003-06-13 22:37:00 +08:00
|
|
|
#include <errno.h>
|
1999-09-09 10:51:57 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2005-03-04 21:23:32 +08:00
|
|
|
#include <glib/gstdio.h>
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <libgimp/gimp.h>
|
2000-01-29 11:19:53 +08:00
|
|
|
#include <libgimp/gimpui.h>
|
|
|
|
|
2008-03-25 04:27:34 +08:00
|
|
|
#include "fractal-explorer.h"
|
|
|
|
#include "fractal-explorer-dialogs.h"
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2000-01-06 06:37:07 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2004-01-12 01:39:28 +08:00
|
|
|
#define ZOOM_UNDO_SIZE 100
|
2003-11-06 23:27:05 +08:00
|
|
|
|
|
|
|
|
2004-10-06 07:28:17 +08:00
|
|
|
static gint n_gradient_samples = 0;
|
2003-12-14 07:58:33 +08:00
|
|
|
static gdouble *gradient_samples = NULL;
|
|
|
|
static gchar *gradient_name = NULL;
|
2003-10-02 05:47:49 +08:00
|
|
|
static gboolean ready_now = FALSE;
|
2003-12-14 07:58:33 +08:00
|
|
|
static gchar *tpath = NULL;
|
2003-10-02 05:47:49 +08:00
|
|
|
static DialogElements *elements = NULL;
|
|
|
|
static GtkWidget *cmap_preview;
|
|
|
|
static GtkWidget *maindlg;
|
|
|
|
|
2004-01-12 01:39:28 +08:00
|
|
|
static explorer_vals_t zooms[ZOOM_UNDO_SIZE];
|
|
|
|
static gint zoomindex = 0;
|
|
|
|
static gint zoommax = 0;
|
2003-10-02 05:47:49 +08:00
|
|
|
|
2003-12-14 07:58:33 +08:00
|
|
|
static gint oldxpos = -1;
|
|
|
|
static gint oldypos = -1;
|
2003-10-02 05:47:49 +08:00
|
|
|
static gdouble x_press = -1.0;
|
|
|
|
static gdouble y_press = -1.0;
|
|
|
|
|
|
|
|
static explorer_vals_t standardvals =
|
|
|
|
{
|
|
|
|
0,
|
|
|
|
-2.0,
|
|
|
|
2.0,
|
|
|
|
-1.5,
|
|
|
|
1.5,
|
|
|
|
50.0,
|
|
|
|
-0.75,
|
|
|
|
-0.2,
|
|
|
|
0,
|
|
|
|
1.0,
|
|
|
|
1.0,
|
|
|
|
1.0,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
256,
|
|
|
|
0
|
|
|
|
};
|
2000-01-29 11:19:53 +08:00
|
|
|
|
1999-09-09 10:51:57 +08:00
|
|
|
/**********************************************************************
|
2000-01-29 11:19:53 +08:00
|
|
|
FORWARD DECLARATIONS
|
1999-09-09 10:51:57 +08:00
|
|
|
*********************************************************************/
|
|
|
|
|
2004-04-16 00:58:21 +08:00
|
|
|
static void load_file_chooser_response (GtkFileChooser *chooser,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data);
|
|
|
|
static void save_file_chooser_response (GtkFileChooser *chooser,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data);
|
|
|
|
static void create_load_file_chooser (GtkWidget *widget,
|
|
|
|
GtkWidget *dialog);
|
|
|
|
static void create_save_file_chooser (GtkWidget *widget,
|
|
|
|
GtkWidget *dialog);
|
|
|
|
|
2004-07-30 04:52:56 +08:00
|
|
|
static void cmap_preview_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
/**********************************************************************
|
|
|
|
CALLBACKS
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
static void
|
2003-11-06 23:27:05 +08:00
|
|
|
dialog_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
switch (response_id)
|
|
|
|
{
|
|
|
|
case GTK_RESPONSE_OK:
|
|
|
|
wint.run = TRUE;
|
|
|
|
gtk_widget_destroy (widget);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
gtk_widget_destroy (widget);
|
|
|
|
break;
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dialog_reset_callback (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
wvals.xmin = standardvals.xmin;
|
|
|
|
wvals.xmax = standardvals.xmax;
|
|
|
|
wvals.ymin = standardvals.ymin;
|
|
|
|
wvals.ymax = standardvals.ymax;
|
|
|
|
wvals.iter = standardvals.iter;
|
2000-12-29 23:22:01 +08:00
|
|
|
wvals.cx = standardvals.cx;
|
|
|
|
wvals.cy = standardvals.cy;
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
dialog_change_scale ();
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dialog_redraw_callback (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
gint alwaysprev = wvals.alwayspreview;
|
|
|
|
|
|
|
|
wvals.alwayspreview = TRUE;
|
2000-12-29 23:22:01 +08:00
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
2000-01-29 11:19:53 +08:00
|
|
|
wvals.alwayspreview = alwaysprev;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dialog_undo_zoom_callback (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
2004-01-12 01:39:28 +08:00
|
|
|
if (zoomindex > 0)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
zooms[zoomindex] = wvals;
|
|
|
|
zoomindex--;
|
|
|
|
wvals = zooms[zoomindex];
|
|
|
|
dialog_change_scale ();
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dialog_redo_zoom_callback (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
if (zoomindex < zoommax)
|
|
|
|
{
|
|
|
|
zoomindex++;
|
|
|
|
wvals = zooms[zoomindex];
|
|
|
|
dialog_change_scale ();
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dialog_step_in_callback (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
double xdifferenz;
|
|
|
|
double ydifferenz;
|
|
|
|
|
2004-01-12 01:39:28 +08:00
|
|
|
if (zoomindex < ZOOM_UNDO_SIZE - 1)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
zooms[zoomindex]=wvals;
|
|
|
|
zoomindex++;
|
|
|
|
}
|
2004-01-12 01:39:28 +08:00
|
|
|
zoommax = zoomindex;
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
xdifferenz = wvals.xmax - wvals.xmin;
|
|
|
|
ydifferenz = wvals.ymax - wvals.ymin;
|
|
|
|
wvals.xmin += 1.0 / 6.0 * xdifferenz;
|
|
|
|
wvals.ymin += 1.0 / 6.0 * ydifferenz;
|
|
|
|
wvals.xmax -= 1.0 / 6.0 * xdifferenz;
|
|
|
|
wvals.ymax -= 1.0 / 6.0 * ydifferenz;
|
2000-01-29 11:19:53 +08:00
|
|
|
zooms[zoomindex] = wvals;
|
|
|
|
|
|
|
|
dialog_change_scale ();
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
2000-12-29 23:22:01 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
dialog_step_out_callback (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
gdouble xdifferenz;
|
|
|
|
gdouble ydifferenz;
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2004-01-12 01:39:28 +08:00
|
|
|
if (zoomindex < ZOOM_UNDO_SIZE - 1)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
zooms[zoomindex]=wvals;
|
|
|
|
zoomindex++;
|
|
|
|
}
|
2004-01-12 01:39:28 +08:00
|
|
|
zoommax = zoomindex;
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
xdifferenz = wvals.xmax - wvals.xmin;
|
|
|
|
ydifferenz = wvals.ymax - wvals.ymin;
|
|
|
|
wvals.xmin -= 1.0 / 4.0 * xdifferenz;
|
|
|
|
wvals.ymin -= 1.0 / 4.0 * ydifferenz;
|
|
|
|
wvals.xmax += 1.0 / 4.0 * xdifferenz;
|
|
|
|
wvals.ymax += 1.0 / 4.0 * ydifferenz;
|
2000-01-29 11:19:53 +08:00
|
|
|
zooms[zoomindex] = wvals;
|
|
|
|
|
|
|
|
dialog_change_scale ();
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
explorer_toggle_update (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
gimp_toggle_button_update (widget, data);
|
|
|
|
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
explorer_radio_update (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
2006-10-06 18:38:20 +08:00
|
|
|
gboolean c_sensitive;
|
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_radio_button_update (widget, data);
|
|
|
|
|
2006-10-06 18:38:20 +08:00
|
|
|
switch (wvals.fractaltype)
|
|
|
|
{
|
|
|
|
case TYPE_MANDELBROT:
|
|
|
|
case TYPE_SIERPINSKI:
|
|
|
|
c_sensitive = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
c_sensitive = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_scale_entry_set_sensitive (elements->cx, c_sensitive);
|
|
|
|
gimp_scale_entry_set_sensitive (elements->cy, c_sensitive);
|
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
explorer_double_adjustment_update (GtkAdjustment *adjustment,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
gimp_double_adjustment_update (adjustment, data);
|
|
|
|
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
explorer_number_of_colors_callback (GtkAdjustment *adjustment,
|
2003-12-14 07:58:33 +08:00
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
gimp_int_adjustment_update (adjustment, data);
|
|
|
|
|
|
|
|
g_free (gradient_samples);
|
|
|
|
|
2003-06-19 19:36:12 +08:00
|
|
|
if (! gradient_name)
|
2004-09-23 23:05:48 +08:00
|
|
|
gradient_name = gimp_context_get_gradient ();
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2004-10-06 07:28:17 +08:00
|
|
|
gimp_gradient_get_uniform_samples (gradient_name,
|
|
|
|
wvals.ncolors,
|
|
|
|
wvals.gradinvert,
|
|
|
|
&n_gradient_samples,
|
|
|
|
&gradient_samples);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-06-26 09:47:22 +08:00
|
|
|
explorer_gradient_select_callback (GimpGradientSelectButton *gradient_button,
|
|
|
|
const gchar *name,
|
|
|
|
gint width,
|
|
|
|
const gdouble *gradient_data,
|
|
|
|
gboolean dialog_closing,
|
|
|
|
gpointer data)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
g_free (gradient_name);
|
|
|
|
g_free (gradient_samples);
|
|
|
|
|
|
|
|
gradient_name = g_strdup (name);
|
|
|
|
|
2004-10-06 07:28:17 +08:00
|
|
|
gimp_gradient_get_uniform_samples (gradient_name,
|
|
|
|
wvals.ncolors,
|
|
|
|
wvals.gradinvert,
|
|
|
|
&n_gradient_samples,
|
|
|
|
&gradient_samples);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
if (wvals.colormode == 1)
|
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
set_cmap_preview ();
|
2003-08-18 20:17:21 +08:00
|
|
|
dialog_update_preview ();
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
static void
|
2004-10-06 07:28:17 +08:00
|
|
|
preview_draw_crosshair (gint px,
|
|
|
|
gint py)
|
2003-10-02 05:47:49 +08:00
|
|
|
{
|
|
|
|
gint x, y;
|
|
|
|
guchar *p_ul;
|
|
|
|
|
|
|
|
p_ul = wint.wimage + 3 * (preview_width * py + 0);
|
2003-11-10 06:44:45 +08:00
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
for (x = 0; x < preview_width; x++)
|
|
|
|
{
|
|
|
|
p_ul[0] ^= 254;
|
|
|
|
p_ul[1] ^= 254;
|
|
|
|
p_ul[2] ^= 254;
|
|
|
|
p_ul += 3;
|
|
|
|
}
|
2003-11-10 06:44:45 +08:00
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
p_ul = wint.wimage + 3 * (preview_width * 0 + px);
|
2003-11-10 06:44:45 +08:00
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
for (y = 0; y < preview_height; y++)
|
|
|
|
{
|
|
|
|
p_ul[0] ^= 254;
|
|
|
|
p_ul[1] ^= 254;
|
|
|
|
p_ul[2] ^= 254;
|
|
|
|
p_ul += 3 * preview_width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
preview_redraw (void)
|
|
|
|
{
|
2004-07-30 04:52:56 +08:00
|
|
|
gimp_preview_area_draw (GIMP_PREVIEW_AREA (wint.preview),
|
|
|
|
0, 0, preview_width, preview_height,
|
|
|
|
GIMP_RGB_IMAGE,
|
|
|
|
wint.wimage, preview_width * 3);
|
2003-11-10 06:44:45 +08:00
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
gtk_widget_queue_draw (wint.preview);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
preview_button_press_event (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
GdkEventButton *event)
|
2003-10-02 05:47:49 +08:00
|
|
|
{
|
|
|
|
if (event->button == 1)
|
|
|
|
{
|
|
|
|
x_press = event->x;
|
|
|
|
y_press = event->y;
|
|
|
|
xbild = preview_width;
|
|
|
|
ybild = preview_height;
|
|
|
|
xdiff = (xmax - xmin) / xbild;
|
|
|
|
ydiff = (ymax - ymin) / ybild;
|
|
|
|
|
|
|
|
preview_draw_crosshair (x_press, y_press);
|
|
|
|
preview_redraw ();
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
preview_motion_notify_event (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
GdkEventButton *event)
|
2003-10-02 05:47:49 +08:00
|
|
|
{
|
|
|
|
if (oldypos != -1)
|
|
|
|
{
|
|
|
|
preview_draw_crosshair (oldxpos, oldypos);
|
|
|
|
}
|
|
|
|
|
|
|
|
oldxpos = event->x;
|
|
|
|
oldypos = event->y;
|
|
|
|
|
|
|
|
if ((oldxpos >= 0.0) &&
|
|
|
|
(oldypos >= 0.0) &&
|
|
|
|
(oldxpos < preview_width) &&
|
|
|
|
(oldypos < preview_height))
|
|
|
|
{
|
|
|
|
preview_draw_crosshair (oldxpos, oldypos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
oldypos = -1;
|
|
|
|
oldxpos = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
preview_redraw ();
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
preview_leave_notify_event (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
GdkEventButton *event)
|
2003-10-02 05:47:49 +08:00
|
|
|
{
|
|
|
|
if (oldypos != -1)
|
|
|
|
{
|
|
|
|
preview_draw_crosshair (oldxpos, oldypos);
|
|
|
|
}
|
|
|
|
oldxpos = -1;
|
|
|
|
oldypos = -1;
|
|
|
|
|
|
|
|
preview_redraw ();
|
|
|
|
|
2009-10-09 23:11:19 +08:00
|
|
|
gdk_window_set_cursor (gtk_widget_get_window (maindlg), NULL);
|
2003-10-02 05:47:49 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
preview_enter_notify_event (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
GdkEventButton *event)
|
2003-10-02 05:47:49 +08:00
|
|
|
{
|
2004-05-20 21:32:35 +08:00
|
|
|
static GdkCursor *cursor = NULL;
|
|
|
|
|
|
|
|
if (! cursor)
|
|
|
|
{
|
|
|
|
GdkDisplay *display = gtk_widget_get_display (maindlg);
|
|
|
|
|
|
|
|
cursor = gdk_cursor_new_for_display (display, GDK_TCROSS);
|
|
|
|
|
|
|
|
}
|
2003-11-02 04:06:01 +08:00
|
|
|
|
2009-10-09 23:11:19 +08:00
|
|
|
gdk_window_set_cursor (gtk_widget_get_window (maindlg), cursor);
|
2003-10-02 05:47:49 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
preview_button_release_event (GtkWidget *widget,
|
2003-12-14 07:58:33 +08:00
|
|
|
GdkEventButton *event)
|
2003-10-02 05:47:49 +08:00
|
|
|
{
|
|
|
|
gdouble l_xmin;
|
|
|
|
gdouble l_xmax;
|
|
|
|
gdouble l_ymin;
|
|
|
|
gdouble l_ymax;
|
|
|
|
|
|
|
|
if (event->button == 1)
|
|
|
|
{
|
|
|
|
gdouble x_release, y_release;
|
|
|
|
|
|
|
|
x_release = event->x;
|
|
|
|
y_release = event->y;
|
|
|
|
|
|
|
|
if ((x_press >= 0.0) && (y_press >= 0.0) &&
|
2003-12-14 07:58:33 +08:00
|
|
|
(x_release >= 0.0) && (y_release >= 0.0) &&
|
|
|
|
(x_press < preview_width) && (y_press < preview_height) &&
|
|
|
|
(x_release < preview_width) && (y_release < preview_height))
|
|
|
|
{
|
|
|
|
l_xmin = (wvals.xmin +
|
|
|
|
(wvals.xmax - wvals.xmin) * (x_press / preview_width));
|
|
|
|
l_xmax = (wvals.xmin +
|
|
|
|
(wvals.xmax - wvals.xmin) * (x_release / preview_width));
|
|
|
|
l_ymin = (wvals.ymin +
|
|
|
|
(wvals.ymax - wvals.ymin) * (y_press / preview_height));
|
|
|
|
l_ymax = (wvals.ymin +
|
|
|
|
(wvals.ymax - wvals.ymin) * (y_release / preview_height));
|
|
|
|
|
2004-01-12 01:39:28 +08:00
|
|
|
if (zoomindex < ZOOM_UNDO_SIZE - 1)
|
|
|
|
{
|
|
|
|
zooms[zoomindex] = wvals;
|
|
|
|
zoomindex++;
|
|
|
|
}
|
2003-12-14 07:58:33 +08:00
|
|
|
zoommax = zoomindex;
|
|
|
|
wvals.xmin = l_xmin;
|
|
|
|
wvals.xmax = l_xmax;
|
|
|
|
wvals.ymin = l_ymin;
|
|
|
|
wvals.ymax = l_ymax;
|
|
|
|
dialog_change_scale ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
oldypos = oldxpos = -1;
|
|
|
|
}
|
2003-10-02 05:47:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
/**********************************************************************
|
|
|
|
FUNCTION: explorer_dialog
|
|
|
|
*********************************************************************/
|
1999-09-09 10:51:57 +08:00
|
|
|
|
|
|
|
gint
|
2000-01-29 11:19:53 +08:00
|
|
|
explorer_dialog (void)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *top_hbox;
|
|
|
|
GtkWidget *left_vbox;
|
|
|
|
GtkWidget *abox;
|
|
|
|
GtkWidget *vbox;
|
2006-06-13 21:25:57 +08:00
|
|
|
GtkWidget *bbox;
|
2000-01-29 11:19:53 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *toggle;
|
|
|
|
GtkWidget *toggle_vbox;
|
|
|
|
GtkWidget *toggle_vbox2;
|
|
|
|
GtkWidget *toggle_vbox3;
|
|
|
|
GtkWidget *notebook;
|
|
|
|
GtkWidget *hbox;
|
2018-05-05 23:19:33 +08:00
|
|
|
GtkWidget *grid;
|
2000-01-29 11:19:53 +08:00
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *gradient;
|
2005-03-05 01:07:34 +08:00
|
|
|
gchar *path;
|
2004-05-20 21:32:35 +08:00
|
|
|
gchar *gradient_name;
|
|
|
|
GSList *group = NULL;
|
|
|
|
gint i;
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2008-08-12 03:42:08 +08:00
|
|
|
gimp_ui_init (PLUG_IN_BINARY, TRUE);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2005-03-05 01:07:34 +08:00
|
|
|
path = gimp_gimprc_query ("fractalexplorer-path");
|
2003-12-14 07:58:33 +08:00
|
|
|
|
2005-03-05 01:07:34 +08:00
|
|
|
if (path)
|
|
|
|
{
|
|
|
|
fractalexplorer_path = g_filename_from_utf8 (path, -1, NULL, NULL, NULL);
|
|
|
|
g_free (path);
|
|
|
|
}
|
|
|
|
else
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
2005-04-08 01:10:05 +08:00
|
|
|
gchar *gimprc = gimp_personal_rc_file ("gimprc");
|
|
|
|
gchar *full_path = gimp_config_build_data_path ("fractalexplorer");
|
|
|
|
gchar *esc_path = g_strescape (full_path, NULL);
|
2003-12-14 07:58:33 +08:00
|
|
|
g_free (full_path);
|
|
|
|
|
|
|
|
g_message (_("No %s in gimprc:\n"
|
|
|
|
"You need to add an entry like\n"
|
|
|
|
"(%s \"%s\")\n"
|
|
|
|
"to your %s file."),
|
|
|
|
"fractalexplorer-path",
|
2005-04-08 01:10:05 +08:00
|
|
|
"fractalexplorer-path",
|
|
|
|
esc_path, gimp_filename_to_utf8 (gimprc));
|
2003-12-14 07:58:33 +08:00
|
|
|
|
|
|
|
g_free (gimprc);
|
|
|
|
g_free (esc_path);
|
|
|
|
}
|
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
wint.wimage = g_new (guchar, preview_width * preview_height * 3);
|
|
|
|
elements = g_new (DialogElements, 1);
|
|
|
|
|
|
|
|
dialog = maindlg =
|
2011-04-09 02:31:34 +08:00
|
|
|
gimp_dialog_new (_("Fractal Explorer"), PLUG_IN_ROLE,
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL, 0,
|
2008-08-12 03:42:08 +08:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2017-02-12 23:18:24 +08:00
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
_("_OK"), GTK_RESPONSE_OK,
|
2002-02-05 21:29:46 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL);
|
2003-10-02 05:47:49 +08:00
|
|
|
|
2018-05-10 23:04:37 +08:00
|
|
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
2005-09-06 05:40:29 +08:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
2005-09-10 02:07:31 +08:00
|
|
|
gimp_window_set_transient (GTK_WINDOW (dialog));
|
2005-09-06 05:40:29 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
G_CALLBACK (dialog_response),
|
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (dialog, "destroy",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gtk_main_quit),
|
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
top_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
2018-05-05 23:19:33 +08:00
|
|
|
gtk_widget_set_vexpand (top_hbox, FALSE);
|
2004-05-20 21:32:35 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (top_hbox), 12);
|
2009-07-16 00:57:12 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
|
|
|
top_hbox, FALSE, FALSE, 0);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (top_hbox);
|
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
left_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (top_hbox), left_vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (left_vbox);
|
|
|
|
|
|
|
|
/* Preview */
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
2004-05-20 21:32:35 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (left_vbox), vbox, FALSE, FALSE, 0);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2004-05-20 21:32:35 +08:00
|
|
|
abox = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), abox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
2004-05-20 21:32:35 +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-29 11:19:53 +08:00
|
|
|
|
2004-07-30 04:52:56 +08:00
|
|
|
wint.preview = gimp_preview_area_new ();
|
|
|
|
gtk_widget_set_size_request (wint.preview, preview_width, preview_height);
|
2004-05-20 21:32:35 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), wint.preview);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (wint.preview, "button-press-event",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (preview_button_press_event),
|
|
|
|
NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (wint.preview, "button-release-event",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (preview_button_release_event),
|
2003-12-14 07:58:33 +08:00
|
|
|
NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (wint.preview, "motion-notify-event",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (preview_motion_notify_event),
|
|
|
|
NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (wint.preview, "leave-notify-event",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (preview_leave_notify_event),
|
|
|
|
NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (wint.preview, "enter-notify-event",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (preview_enter_notify_event),
|
|
|
|
NULL);
|
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_set_events (wint.preview, (GDK_BUTTON_PRESS_MASK |
|
2003-12-14 07:58:33 +08:00
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
|
|
|
GDK_POINTER_MOTION_MASK |
|
|
|
|
GDK_LEAVE_NOTIFY_MASK |
|
|
|
|
GDK_ENTER_NOTIFY_MASK));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (wint.preview);
|
|
|
|
|
2005-08-23 08:18:08 +08:00
|
|
|
toggle = gtk_check_button_new_with_label (_("Realtime preview"));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_toggle_update),
|
|
|
|
&wvals.alwayspreview);
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
wvals.alwayspreview);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (toggle);
|
2006-06-13 21:25:57 +08:00
|
|
|
gimp_help_set_help_data (toggle, _("If enabled the preview will "
|
|
|
|
"be redrawn automatically"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2006-06-13 21:25:57 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("R_edraw preview"));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (dialog_redraw_callback),
|
|
|
|
dialog);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
/* Zoom Options */
|
2004-05-20 21:32:35 +08:00
|
|
|
frame = gimp_frame_new (_("Zoom"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (left_vbox), frame, FALSE, FALSE, 0);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (bbox), TRUE);
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (bbox);
|
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("Zoom _In"));
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, TRUE, TRUE, 0);
|
2002-09-08 00:31:32 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-05-20 21:32:35 +08:00
|
|
|
G_CALLBACK (dialog_step_in_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
dialog);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("Zoom _Out"));
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, TRUE, TRUE, 0);
|
2002-09-08 00:31:32 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-05-20 21:32:35 +08:00
|
|
|
G_CALLBACK (dialog_step_out_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
dialog);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (bbox), TRUE);
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (bbox);
|
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("_Undo"));
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, TRUE, TRUE, 0);
|
2002-09-08 00:31:32 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2006-06-13 21:25:57 +08:00
|
|
|
gimp_help_set_help_data (button, _("Undo last zoom change"), NULL);
|
2004-05-20 21:32:35 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-05-20 21:32:35 +08:00
|
|
|
G_CALLBACK (dialog_undo_zoom_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
dialog);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("_Redo"));
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, TRUE, TRUE, 0);
|
2002-09-08 00:31:32 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2006-06-13 21:25:57 +08:00
|
|
|
gimp_help_set_help_data (button, _("Redo last zoom change"), NULL);
|
2004-05-20 21:32:35 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-05-20 21:32:35 +08:00
|
|
|
G_CALLBACK (dialog_redo_zoom_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
dialog);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
/* Create notebook */
|
|
|
|
notebook = gtk_notebook_new ();
|
2018-05-05 23:19:33 +08:00
|
|
|
gtk_widget_set_halign (notebook, GTK_ALIGN_START);
|
|
|
|
gtk_widget_set_hexpand (notebook, FALSE);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (top_hbox), notebook, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (notebook);
|
|
|
|
|
|
|
|
/* "Parameters" page */
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2004-05-20 21:32:35 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
|
2003-12-14 07:58:33 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Parameters")));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2004-05-20 21:32:35 +08:00
|
|
|
frame = gimp_frame_new (_("Fractal Parameters"));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2018-05-05 23:19:33 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
|
|
|
gtk_widget_show (grid);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->xmin =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
|
|
|
|
_("Left:"), SCALE_WIDTH, 10,
|
|
|
|
wvals.xmin, -3, 3, 0.001, 0.01, 5,
|
|
|
|
TRUE, 0, 0, NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->xmin, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.xmin);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->xmax =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
|
|
|
|
_("Right:"), SCALE_WIDTH, 10,
|
|
|
|
wvals.xmax, -3, 3, 0.001, 0.01, 5,
|
|
|
|
TRUE, 0, 0, NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->xmax, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.xmax);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->ymin =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 2,
|
|
|
|
_("Top:"), SCALE_WIDTH, 10,
|
|
|
|
wvals.ymin, -3, 3, 0.001, 0.01, 5,
|
|
|
|
TRUE, 0, 0, NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->ymin, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.ymin);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->ymax =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 3,
|
|
|
|
_("Bottom:"), SCALE_WIDTH, 10,
|
|
|
|
wvals.ymax, -3, 3, 0.001, 0.01, 5,
|
|
|
|
TRUE, 0, 0, NULL, NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->ymax, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.ymax);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->iter =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 4,
|
|
|
|
_("Iterations:"), SCALE_WIDTH, 10,
|
|
|
|
wvals.iter, 1, 1000, 1, 10, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("The higher the number of iterations, "
|
|
|
|
"the more details will be calculated"), NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->iter, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.iter);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->cx =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 5,
|
|
|
|
_("CX:"), SCALE_WIDTH, 10,
|
|
|
|
wvals.cx, -2.5, 2.5, 0.001, 0.01, 5,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Changes aspect of fractal"), NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->cx, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.cx);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->cy =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 6,
|
|
|
|
_("CY:"), SCALE_WIDTH, 10,
|
|
|
|
wvals.cy, -2.5, 2.5, 0.001, 0.01, 5,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Changes aspect of fractal"), NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->cy, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.cy);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
2018-05-05 23:19:33 +08:00
|
|
|
gtk_widget_set_margin_top (bbox, 12);
|
2011-09-30 18:17:53 +08:00
|
|
|
gtk_box_set_homogeneous (GTK_BOX (bbox), TRUE);
|
2018-05-05 23:19:33 +08:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), bbox, 0, 7, 3, 1);
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_widget_show (bbox);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("_Open"));
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, TRUE, TRUE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-04-16 00:58:21 +08:00
|
|
|
G_CALLBACK (create_load_file_chooser),
|
2001-12-29 21:26:29 +08:00
|
|
|
dialog);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
gimp_help_set_help_data (button, _("Load a fractal from file"), NULL);
|
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("_Reset"));
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, TRUE, TRUE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2006-10-17 20:17:53 +08:00
|
|
|
G_CALLBACK (dialog_reset_callback),
|
2001-12-29 21:26:29 +08:00
|
|
|
dialog);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
gimp_help_set_help_data (button, _("Reset parameters to default values"),
|
2003-12-14 07:58:33 +08:00
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("_Save"));
|
2006-06-13 21:25:57 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, TRUE, TRUE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2004-04-16 00:58:21 +08:00
|
|
|
G_CALLBACK (create_save_file_chooser),
|
2001-12-29 21:26:29 +08:00
|
|
|
dialog);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
gimp_help_set_help_data (button, _("Save active fractal to file"), NULL);
|
2003-08-18 20:17:21 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
/* Fractal type toggle box */
|
2004-05-20 21:32:35 +08:00
|
|
|
frame = gimp_frame_new (_("Fractal Type"));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
2004-05-20 21:32:35 +08:00
|
|
|
gtk_widget_show (frame);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
2004-05-20 21:32:35 +08:00
|
|
|
gtk_widget_show (hbox);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
toggle_vbox =
|
2003-11-15 02:05:39 +08:00
|
|
|
gimp_int_radio_group_new (FALSE, NULL,
|
2003-12-14 07:58:33 +08:00
|
|
|
G_CALLBACK (explorer_radio_update),
|
|
|
|
&wvals.fractaltype, wvals.fractaltype,
|
|
|
|
|
|
|
|
_("Mandelbrot"), TYPE_MANDELBROT,
|
|
|
|
&(elements->type[TYPE_MANDELBROT]),
|
|
|
|
_("Julia"), TYPE_JULIA,
|
|
|
|
&(elements->type[TYPE_JULIA]),
|
|
|
|
_("Barnsley 1"), TYPE_BARNSLEY_1,
|
|
|
|
&(elements->type[TYPE_BARNSLEY_1]),
|
|
|
|
_("Barnsley 2"), TYPE_BARNSLEY_2,
|
|
|
|
&(elements->type[TYPE_BARNSLEY_2]),
|
|
|
|
_("Barnsley 3"), TYPE_BARNSLEY_3,
|
|
|
|
&(elements->type[TYPE_BARNSLEY_3]),
|
|
|
|
_("Spider"), TYPE_SPIDER,
|
|
|
|
&(elements->type[TYPE_SPIDER]),
|
|
|
|
_("Man'o'war"), TYPE_MAN_O_WAR,
|
|
|
|
&(elements->type[TYPE_MAN_O_WAR]),
|
|
|
|
_("Lambda"), TYPE_LAMBDA,
|
|
|
|
&(elements->type[TYPE_LAMBDA]),
|
|
|
|
_("Sierpinski"), TYPE_SIERPINSKI,
|
|
|
|
&(elements->type[TYPE_SIERPINSKI]),
|
|
|
|
|
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
toggle_vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
2000-01-29 11:19:53 +08:00
|
|
|
for (i = TYPE_BARNSLEY_2; i <= TYPE_SPIDER; i++)
|
|
|
|
{
|
2003-01-07 14:16:02 +08:00
|
|
|
g_object_ref (elements->type[i]);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_hide (elements->type[i]);
|
|
|
|
gtk_container_remove (GTK_CONTAINER (toggle_vbox), elements->type[i]);
|
|
|
|
gtk_box_pack_start (GTK_BOX (toggle_vbox2), elements->type[i],
|
2003-12-14 07:58:33 +08:00
|
|
|
FALSE, FALSE, 0);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (elements->type[i]);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_object_unref (elements->type[i]);
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
toggle_vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
2000-01-29 11:19:53 +08:00
|
|
|
for (i = TYPE_MAN_O_WAR; i <= TYPE_SIERPINSKI; i++)
|
|
|
|
{
|
2003-01-07 14:16:02 +08:00
|
|
|
g_object_ref (elements->type[i]);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_hide (elements->type[i]);
|
|
|
|
gtk_container_remove (GTK_CONTAINER (toggle_vbox), elements->type[i]);
|
|
|
|
gtk_box_pack_start (GTK_BOX (toggle_vbox3), elements->type[i],
|
2003-12-14 07:58:33 +08:00
|
|
|
FALSE, FALSE, 0);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (elements->type[i]);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_object_unref (elements->type[i]);
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), toggle_vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (toggle_vbox);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), toggle_vbox2, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (toggle_vbox2);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), toggle_vbox3, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (toggle_vbox3);
|
|
|
|
|
|
|
|
/* Color page */
|
2011-09-30 18:17:53 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2004-05-20 21:32:35 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
|
2003-12-14 07:58:33 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("Co_lors")));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
/* Number of Colors frame */
|
2004-05-20 21:32:35 +08:00
|
|
|
frame = gimp_frame_new (_("Number of Colors"));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2018-05-05 23:19:33 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
|
|
|
gtk_widget_show (grid);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->ncol =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
|
|
|
|
_("Number of colors:"), SCALE_WIDTH, 0,
|
|
|
|
wvals.ncolors, 2, MAXNCOLORS, 1, 10, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Change the number of colors in the mapping"),
|
|
|
|
NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->ncol, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_number_of_colors_callback),
|
|
|
|
&wvals.ncolors);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->useloglog = toggle =
|
2003-10-02 05:47:49 +08:00
|
|
|
gtk_check_button_new_with_label (_("Use loglog smoothing"));
|
2018-05-05 23:19:33 +08:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), toggle, 0, 1, 3, 1);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_toggle_update),
|
|
|
|
&wvals.useloglog);
|
2000-08-28 08:42:32 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), wvals.useloglog);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
gimp_help_set_help_data (toggle, _("Use log log smoothing to eliminate "
|
2003-12-14 07:58:33 +08:00
|
|
|
"\"banding\" in the result"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
/* Color Density frame */
|
2004-05-20 21:32:35 +08:00
|
|
|
frame = gimp_frame_new (_("Color Density"));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2018-05-05 23:19:33 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
|
|
|
gtk_widget_show (grid);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->red =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
|
|
|
|
_("Red:"), SCALE_WIDTH, 0,
|
|
|
|
wvals.redstretch, 0, 1, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Change the intensity of the red channel"), NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->red, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.redstretch);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->green =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
|
|
|
|
_("Green:"), SCALE_WIDTH, 0,
|
|
|
|
wvals.greenstretch, 0, 1, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Change the intensity of the green channel"), NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->green, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.greenstretch);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->blue =
|
2018-05-11 19:52:33 +08:00
|
|
|
gimp_scale_entry_new (GTK_GRID (grid), 0, 2,
|
|
|
|
_("Blue:"), SCALE_WIDTH, 0,
|
|
|
|
wvals.bluestretch, 0, 1, 0.01, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Change the intensity of the blue channel"), NULL);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (elements->blue, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_double_adjustment_update),
|
|
|
|
&wvals.bluestretch);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
/* Color Function frame */
|
2004-05-20 21:32:35 +08:00
|
|
|
frame = gimp_frame_new (_("Color Function"));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
/* Redmode radio frame */
|
2003-11-15 02:05:39 +08:00
|
|
|
frame = gimp_int_radio_group_new (TRUE, _("Red"),
|
2003-12-14 07:58:33 +08:00
|
|
|
G_CALLBACK (explorer_radio_update),
|
|
|
|
&wvals.redmode, wvals.redmode,
|
2003-11-15 02:05:39 +08:00
|
|
|
|
2011-11-17 06:13:03 +08:00
|
|
|
_("Sine"), SINUS,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->redmode[SINUS],
|
2011-11-17 06:13:03 +08:00
|
|
|
_("Cosine"), COSINUS,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->redmode[COSINUS],
|
2011-11-17 06:13:03 +08:00
|
|
|
C_("color-function", "None"), NONE,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->redmode[NONE],
|
2003-11-15 02:05:39 +08:00
|
|
|
|
2003-12-14 07:58:33 +08:00
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->redmode[SINUS],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use sine-function for this color component"),
|
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->redmode[COSINUS],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use cosine-function for this color "
|
|
|
|
"component"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->redmode[NONE],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use linear mapping instead of any "
|
|
|
|
"trigonometrical function for this color "
|
|
|
|
"channel"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2009-10-09 23:11:19 +08:00
|
|
|
toggle_vbox = gtk_bin_get_child (GTK_BIN (frame));
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->redinvert = toggle =
|
|
|
|
gtk_check_button_new_with_label (_("Inversion"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), wvals.redinvert);
|
|
|
|
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_toggle_update),
|
|
|
|
&wvals.redinvert);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
gimp_help_set_help_data (toggle,
|
2003-12-14 07:58:33 +08:00
|
|
|
_("If you enable this option higher color values "
|
|
|
|
"will be swapped with lower ones and vice "
|
|
|
|
"versa"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
/* Greenmode radio frame */
|
2003-11-15 02:05:39 +08:00
|
|
|
frame = gimp_int_radio_group_new (TRUE, _("Green"),
|
2003-12-14 07:58:33 +08:00
|
|
|
G_CALLBACK (explorer_radio_update),
|
|
|
|
&wvals.greenmode, wvals.greenmode,
|
2003-11-15 02:05:39 +08:00
|
|
|
|
2011-11-17 06:13:03 +08:00
|
|
|
_("Sine"), SINUS,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->greenmode[SINUS],
|
2011-11-17 06:13:03 +08:00
|
|
|
_("Cosine"), COSINUS,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->greenmode[COSINUS],
|
2011-11-17 06:13:03 +08:00
|
|
|
C_("color-function", "None"), NONE,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->greenmode[NONE],
|
2003-11-15 02:05:39 +08:00
|
|
|
|
2003-12-14 07:58:33 +08:00
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->greenmode[SINUS],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use sine-function for this color component"),
|
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->greenmode[COSINUS],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use cosine-function for this color "
|
|
|
|
"component"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->greenmode[NONE],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use linear mapping instead of any "
|
|
|
|
"trigonometrical function for this color "
|
|
|
|
"channel"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2009-10-09 23:11:19 +08:00
|
|
|
toggle_vbox = gtk_bin_get_child (GTK_BIN (frame));
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->greeninvert = toggle =
|
|
|
|
gtk_check_button_new_with_label (_("Inversion"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), wvals.greeninvert);
|
|
|
|
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_toggle_update),
|
|
|
|
&wvals.greeninvert);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
gimp_help_set_help_data (toggle,
|
2003-12-14 07:58:33 +08:00
|
|
|
_("If you enable this option higher color values "
|
|
|
|
"will be swapped with lower ones and vice "
|
|
|
|
"versa"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
/* Bluemode radio frame */
|
2003-11-15 02:05:39 +08:00
|
|
|
frame = gimp_int_radio_group_new (TRUE, _("Blue"),
|
2003-12-14 07:58:33 +08:00
|
|
|
G_CALLBACK (explorer_radio_update),
|
|
|
|
&wvals.bluemode, wvals.bluemode,
|
2003-11-15 02:05:39 +08:00
|
|
|
|
2011-11-17 06:13:03 +08:00
|
|
|
_("Sine"), SINUS,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->bluemode[SINUS],
|
2011-11-17 06:13:03 +08:00
|
|
|
_("Cosine"), COSINUS,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->bluemode[COSINUS],
|
2011-11-17 06:13:03 +08:00
|
|
|
C_("color-function", "None"), NONE,
|
2003-12-14 07:58:33 +08:00
|
|
|
&elements->bluemode[NONE],
|
2003-11-15 02:05:39 +08:00
|
|
|
|
2003-12-14 07:58:33 +08:00
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->bluemode[SINUS],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use sine-function for this color component"),
|
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->bluemode[COSINUS],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use cosine-function for this color "
|
|
|
|
"component"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gimp_help_set_help_data (elements->bluemode[NONE],
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Use linear mapping instead of any "
|
|
|
|
"trigonometrical function for this color "
|
|
|
|
"channel"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2009-10-09 23:11:19 +08:00
|
|
|
toggle_vbox = gtk_bin_get_child (GTK_BIN (frame));
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
elements->blueinvert = toggle =
|
|
|
|
gtk_check_button_new_with_label (_("Inversion"));
|
2000-08-28 08:42:32 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON( toggle), wvals.blueinvert);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_toggle_update),
|
|
|
|
&wvals.blueinvert);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
gimp_help_set_help_data (toggle,
|
2003-12-14 07:58:33 +08:00
|
|
|
_("If you enable this option higher color values "
|
|
|
|
"will be swapped with lower ones and vice "
|
|
|
|
"versa"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
/* Colormode toggle box */
|
2004-05-20 21:32:35 +08:00
|
|
|
frame = gimp_frame_new (_("Color Mode"));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
toggle_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), toggle_vbox);
|
|
|
|
gtk_widget_show (toggle_vbox);
|
|
|
|
|
|
|
|
toggle = elements->colormode[0] =
|
2003-10-02 05:47:49 +08:00
|
|
|
gtk_radio_button_new_with_label (group, _("As specified above"));
|
2001-12-29 21:26:29 +08:00
|
|
|
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
|
2001-12-29 21:26:29 +08:00
|
|
|
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
|
|
|
|
GINT_TO_POINTER (0));
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_radio_update),
|
|
|
|
&wvals.colormode);
|
2000-08-28 08:42:32 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
2003-12-14 07:58:33 +08:00
|
|
|
wvals.colormode == 0);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
gimp_help_set_help_data (toggle,
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Create a color-map with the options you "
|
|
|
|
"specified above (color density/function). The "
|
|
|
|
"result is visible in the preview image"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (toggle_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
toggle = elements->colormode[1] =
|
|
|
|
gtk_radio_button_new_with_label (group,
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Apply active gradient to final image"));
|
2001-12-29 21:26:29 +08:00
|
|
|
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
|
2001-12-29 21:26:29 +08:00
|
|
|
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
|
|
|
|
GINT_TO_POINTER (1));
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (explorer_radio_update),
|
|
|
|
&wvals.colormode);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
2003-12-14 07:58:33 +08:00
|
|
|
wvals.colormode == 1);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (toggle);
|
|
|
|
gimp_help_set_help_data (toggle,
|
2003-12-14 07:58:33 +08:00
|
|
|
_("Create a color-map using a gradient from "
|
|
|
|
"the gradient editor"), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2004-09-23 23:05:48 +08:00
|
|
|
gradient_name = gimp_context_get_gradient ();
|
2004-10-06 07:28:17 +08:00
|
|
|
|
|
|
|
gimp_gradient_get_uniform_samples (gradient_name,
|
|
|
|
wvals.ncolors,
|
|
|
|
wvals.gradinvert,
|
|
|
|
&n_gradient_samples,
|
|
|
|
&gradient_samples);
|
|
|
|
|
2006-06-26 09:47:22 +08:00
|
|
|
gradient = gimp_gradient_select_button_new (_("FractalExplorer Gradient"),
|
|
|
|
gradient_name);
|
|
|
|
g_signal_connect (gradient, "gradient-set",
|
|
|
|
G_CALLBACK (explorer_gradient_select_callback), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
g_free (gradient_name);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), gradient, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (gradient);
|
|
|
|
|
|
|
|
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
{
|
|
|
|
gint xsize, ysize;
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 23:38:26 +08:00
|
|
|
for (ysize = 1; ysize * ysize * ysize < 8192; ysize++) /**/;
|
2000-01-29 11:19:53 +08:00
|
|
|
xsize = wvals.ncolors / ysize;
|
2000-01-29 23:38:26 +08:00
|
|
|
while (xsize * ysize < 8192) xsize++;
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_set_size_request (abox, xsize, ysize * 4);
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
|
|
|
gtk_box_pack_start (GTK_BOX (toggle_vbox), abox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (abox);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2004-07-30 04:52:56 +08:00
|
|
|
cmap_preview = gimp_preview_area_new ();
|
|
|
|
gtk_widget_set_size_request (cmap_preview, 32, 32);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (abox), cmap_preview);
|
2008-08-12 22:45:59 +08:00
|
|
|
g_signal_connect (cmap_preview, "size-allocate",
|
2004-07-30 04:52:56 +08:00
|
|
|
G_CALLBACK (cmap_preview_size_allocate), NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (cmap_preview);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
frame = add_objects_list ();
|
2003-08-18 20:17:21 +08:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame,
|
2003-12-14 07:58:33 +08:00
|
|
|
gtk_label_new_with_mnemonic (_("_Fractals")));
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (frame);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2006-10-06 16:33:02 +08:00
|
|
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_widget_show (dialog);
|
|
|
|
ready_now = TRUE;
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
g_free (wint.wimage);
|
|
|
|
|
|
|
|
return wint.run;
|
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
|
1999-09-09 10:51:57 +08:00
|
|
|
/**********************************************************************
|
|
|
|
FUNCTION: dialog_update_preview
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
void
|
2000-01-29 11:19:53 +08:00
|
|
|
dialog_update_preview (void)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
gint ycoord;
|
|
|
|
guchar *p_ul;
|
2003-08-18 20:17:21 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
if (NULL == wint.preview)
|
|
|
|
return;
|
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
if (ready_now && wvals.alwayspreview)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
|
|
|
xmin = wvals.xmin;
|
|
|
|
xmax = wvals.xmax;
|
|
|
|
ymin = wvals.ymin;
|
|
|
|
ymax = wvals.ymax;
|
|
|
|
xbild = preview_width;
|
|
|
|
ybild = preview_height;
|
|
|
|
xdiff = (xmax - xmin) / xbild;
|
|
|
|
ydiff = (ymax - ymin) / ybild;
|
|
|
|
|
|
|
|
p_ul = wint.wimage;
|
2006-11-15 03:44:21 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
for (ycoord = 0; ycoord < preview_height; ycoord++)
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
2006-11-16 01:35:12 +08:00
|
|
|
explorer_render_row (NULL,
|
|
|
|
p_ul,
|
|
|
|
ycoord,
|
|
|
|
preview_width,
|
|
|
|
3);
|
|
|
|
p_ul += preview_width * 3;
|
2006-10-06 17:05:52 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
preview_redraw ();
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
|
|
|
|
/**********************************************************************
|
2004-07-30 04:52:56 +08:00
|
|
|
FUNCTION: cmap_preview_size_allocate()
|
1999-09-09 10:51:57 +08:00
|
|
|
*********************************************************************/
|
|
|
|
|
2004-07-30 04:52:56 +08:00
|
|
|
static void
|
|
|
|
cmap_preview_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2004-07-30 04:52:56 +08:00
|
|
|
gint i;
|
|
|
|
gint x;
|
|
|
|
gint y;
|
|
|
|
gint j;
|
|
|
|
guchar *b;
|
|
|
|
GimpPreviewArea *preview = GIMP_PREVIEW_AREA (widget);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2004-07-30 04:52:56 +08:00
|
|
|
b = g_new (guchar, allocation->width * allocation->height * 3);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2004-07-30 04:52:56 +08:00
|
|
|
for (y = 0; y < allocation->height; y++)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
2004-07-30 04:52:56 +08:00
|
|
|
for (x = 0; x < allocation->width; x++)
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
2004-07-30 04:52:56 +08:00
|
|
|
i = x + (y / 4) * allocation->width;
|
2003-12-14 07:58:33 +08:00
|
|
|
if (i > wvals.ncolors)
|
|
|
|
{
|
|
|
|
for (j = 0; j < 3; j++)
|
2004-07-30 04:52:56 +08:00
|
|
|
b[(y*allocation->width + x) * 3 + j] = 0;
|
2003-12-14 07:58:33 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-06-13 01:00:02 +08:00
|
|
|
b[(y*allocation->width + x) * 3] = colormap[i].r;
|
|
|
|
b[(y*allocation->width + x) * 3 + 1] = colormap[i].g;
|
|
|
|
b[(y*allocation->width + x) * 3 + 2] = colormap[i].b;
|
2003-12-14 07:58:33 +08:00
|
|
|
}
|
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2004-07-30 04:52:56 +08:00
|
|
|
gimp_preview_area_draw (preview,
|
|
|
|
0, 0, allocation->width, allocation->height,
|
|
|
|
GIMP_RGB_IMAGE, b, allocation->width*3);
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_queue_draw (cmap_preview);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
g_free (b);
|
2004-07-30 04:52:56 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
FUNCTION: set_cmap_preview()
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
void
|
|
|
|
set_cmap_preview (void)
|
|
|
|
{
|
|
|
|
gint xsize, ysize;
|
|
|
|
|
|
|
|
if (NULL == cmap_preview)
|
|
|
|
return;
|
|
|
|
|
|
|
|
make_color_map ();
|
|
|
|
|
|
|
|
for (ysize = 1; ysize * ysize * ysize < wvals.ncolors; ysize++)
|
|
|
|
/**/;
|
|
|
|
xsize = wvals.ncolors / ysize;
|
|
|
|
while (xsize * ysize < wvals.ncolors)
|
|
|
|
xsize++;
|
|
|
|
|
|
|
|
gtk_widget_set_size_request (cmap_preview, xsize, ysize * 4);
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
FUNCTION: make_color_map()
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
void
|
2000-01-29 11:19:53 +08:00
|
|
|
make_color_map (void)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
gint i;
|
|
|
|
gint r;
|
|
|
|
gint gr;
|
|
|
|
gint bl;
|
|
|
|
gdouble redstretch;
|
|
|
|
gdouble greenstretch;
|
|
|
|
gdouble bluestretch;
|
|
|
|
gdouble pi = atan (1) * 4;
|
|
|
|
|
2003-04-07 00:06:03 +08:00
|
|
|
/* get gradient samples if they don't exist -- fixes gradient color
|
|
|
|
* mode for noninteractive use (bug #103470).
|
|
|
|
*/
|
|
|
|
if (gradient_samples == NULL)
|
2004-10-06 07:28:17 +08:00
|
|
|
{
|
|
|
|
gchar *gradient_name = gimp_context_get_gradient ();
|
|
|
|
|
|
|
|
gimp_gradient_get_uniform_samples (gradient_name,
|
|
|
|
wvals.ncolors,
|
|
|
|
wvals.gradinvert,
|
|
|
|
&n_gradient_samples,
|
|
|
|
&gradient_samples);
|
|
|
|
|
|
|
|
g_free (gradient_name);
|
|
|
|
}
|
2003-04-07 00:06:03 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
redstretch = wvals.redstretch * 127.5;
|
|
|
|
greenstretch = wvals.greenstretch * 127.5;
|
|
|
|
bluestretch = wvals.bluestretch * 127.5;
|
|
|
|
|
|
|
|
for (i = 0; i < wvals.ncolors; i++)
|
|
|
|
if (wvals.colormode == 1)
|
|
|
|
{
|
2006-06-13 01:00:02 +08:00
|
|
|
colormap[i].r = (guchar)(gradient_samples[i * 4] * 255.9);
|
|
|
|
colormap[i].g = (guchar)(gradient_samples[i * 4 + 1] * 255.9);
|
|
|
|
colormap[i].b = (guchar)(gradient_samples[i * 4 + 2] * 255.9);
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-14 07:58:33 +08:00
|
|
|
double x = (i*2.0) / wvals.ncolors;
|
|
|
|
r = gr = bl = 0;
|
|
|
|
|
|
|
|
switch (wvals.redmode)
|
|
|
|
{
|
|
|
|
case SINUS:
|
|
|
|
r = (int) redstretch *(1.0 + sin((x - 1) * pi));
|
|
|
|
break;
|
|
|
|
case COSINUS:
|
|
|
|
r = (int) redstretch *(1.0 + cos((x - 1) * pi));
|
|
|
|
break;
|
|
|
|
case NONE:
|
|
|
|
r = (int)(redstretch *(x));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (wvals.greenmode)
|
|
|
|
{
|
|
|
|
case SINUS:
|
|
|
|
gr = (int) greenstretch *(1.0 + sin((x - 1) * pi));
|
|
|
|
break;
|
|
|
|
case COSINUS:
|
|
|
|
gr = (int) greenstretch *(1.0 + cos((x - 1) * pi));
|
|
|
|
break;
|
|
|
|
case NONE:
|
|
|
|
gr = (int)(greenstretch *(x));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (wvals.bluemode)
|
|
|
|
{
|
|
|
|
case SINUS:
|
|
|
|
bl = (int) bluestretch * (1.0 + sin ((x - 1) * pi));
|
|
|
|
break;
|
|
|
|
case COSINUS:
|
|
|
|
bl = (int) bluestretch * (1.0 + cos ((x - 1) * pi));
|
|
|
|
break;
|
|
|
|
case NONE:
|
|
|
|
bl = (int) (bluestretch * x);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = MIN (r, 255);
|
|
|
|
gr = MIN (gr, 255);
|
|
|
|
bl = MIN (bl, 255);
|
|
|
|
|
|
|
|
if (wvals.redinvert)
|
|
|
|
r = 255 - r;
|
|
|
|
|
|
|
|
if (wvals.greeninvert)
|
|
|
|
gr = 255 - gr;
|
|
|
|
|
|
|
|
if (wvals.blueinvert)
|
|
|
|
bl = 255 - bl;
|
|
|
|
|
2006-06-13 01:00:02 +08:00
|
|
|
colormap[i].r = r;
|
|
|
|
colormap[i].g = gr;
|
|
|
|
colormap[i].b = bl;
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
FUNCTION: dialog_change_scale
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
void
|
2000-01-29 11:19:53 +08:00
|
|
|
dialog_change_scale (void)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
ready_now = FALSE;
|
|
|
|
|
2010-10-25 07:35:35 +08:00
|
|
|
gtk_adjustment_set_value (elements->xmin, wvals.xmin);
|
|
|
|
gtk_adjustment_set_value (elements->xmax, wvals.xmax);
|
|
|
|
gtk_adjustment_set_value (elements->ymin, wvals.ymin);
|
|
|
|
gtk_adjustment_set_value (elements->ymax, wvals.ymax);
|
|
|
|
gtk_adjustment_set_value (elements->iter, wvals.iter);
|
|
|
|
gtk_adjustment_set_value (elements->cx, wvals.cx);
|
|
|
|
gtk_adjustment_set_value (elements->cy, wvals.cy);
|
|
|
|
|
|
|
|
gtk_adjustment_set_value (elements->red, wvals.redstretch);
|
|
|
|
gtk_adjustment_set_value (elements->green,wvals.greenstretch);
|
|
|
|
gtk_adjustment_set_value (elements->blue, wvals.bluestretch);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON (elements->type[wvals.fractaltype]), TRUE);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON (elements->redmode[wvals.redmode]), TRUE);
|
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON (elements->greenmode[wvals.greenmode]), TRUE);
|
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON (elements->bluemode[wvals.bluemode]), TRUE);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (elements->redinvert),
|
2003-12-14 07:58:33 +08:00
|
|
|
wvals.redinvert);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (elements->greeninvert),
|
2003-12-14 07:58:33 +08:00
|
|
|
wvals.greeninvert);
|
2000-01-29 11:19:53 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (elements->blueinvert),
|
2003-12-14 07:58:33 +08:00
|
|
|
wvals.blueinvert);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON (elements->colormode[wvals.colormode]), TRUE);
|
|
|
|
|
|
|
|
ready_now = TRUE;
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
FUNCTION: save_options
|
|
|
|
*********************************************************************/
|
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
static void
|
2000-01-29 11:19:53 +08:00
|
|
|
save_options (FILE * fp)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2006-10-06 16:33:02 +08:00
|
|
|
gchar buf[64];
|
|
|
|
|
1999-09-09 10:51:57 +08:00
|
|
|
/* Save options */
|
2003-08-18 20:17:21 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
fprintf (fp, "fractaltype: %i\n", wvals.fractaltype);
|
2006-10-06 16:33:02 +08:00
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.xmin);
|
|
|
|
fprintf (fp, "xmin: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.xmax);
|
|
|
|
fprintf (fp, "xmax: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.ymin);
|
|
|
|
fprintf (fp, "ymin: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.ymax);
|
|
|
|
fprintf (fp, "ymax: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.iter);
|
|
|
|
fprintf (fp, "iter: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.cx);
|
|
|
|
fprintf (fp, "cx: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.cy);
|
|
|
|
fprintf (fp, "cy: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.redstretch * 128.0);
|
|
|
|
fprintf (fp, "redstretch: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.greenstretch * 128.0);
|
|
|
|
fprintf (fp, "greenstretch: %s\n", buf);
|
|
|
|
|
|
|
|
g_ascii_formatd (buf, sizeof (buf), "%0.15f", wvals.bluestretch * 128.0);
|
|
|
|
fprintf (fp, "bluestretch: %s\n", buf);
|
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
fprintf (fp, "redmode: %i\n", wvals.redmode);
|
|
|
|
fprintf (fp, "greenmode: %i\n", wvals.greenmode);
|
|
|
|
fprintf (fp, "bluemode: %i\n", wvals.bluemode);
|
|
|
|
fprintf (fp, "redinvert: %i\n", wvals.redinvert);
|
|
|
|
fprintf (fp, "greeninvert: %i\n", wvals.greeninvert);
|
|
|
|
fprintf (fp, "blueinvert: %i\n", wvals.blueinvert);
|
|
|
|
fprintf (fp, "colormode: %i\n", wvals.colormode);
|
|
|
|
fputs ("#**********************************************************************\n", fp);
|
|
|
|
fprintf(fp, "<EOF>\n");
|
|
|
|
fputs ("#**********************************************************************\n", fp);
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
static void
|
2000-01-29 11:19:53 +08:00
|
|
|
save_callback (void)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2005-03-04 21:23:32 +08:00
|
|
|
FILE *fp;
|
|
|
|
const gchar *savename = filename;
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2005-03-04 21:23:32 +08:00
|
|
|
fp = g_fopen (savename, "wt+");
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2003-08-18 20:17:21 +08:00
|
|
|
if (!fp)
|
2000-01-29 11:19:53 +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 (savename), g_strerror (errno));
|
2000-01-29 11:19:53 +08:00
|
|
|
return;
|
|
|
|
}
|
2003-06-13 22:37:00 +08:00
|
|
|
|
1999-09-09 10:51:57 +08:00
|
|
|
/* Write header out */
|
2000-01-29 11:19:53 +08:00
|
|
|
fputs (FRACTAL_HEADER, fp);
|
|
|
|
fputs ("#**********************************************************************\n", fp);
|
2007-06-06 16:44:52 +08:00
|
|
|
fputs ("# This is a data file for the Fractal Explorer plug-in for GIMP *\n", fp);
|
2000-01-29 11:19:53 +08:00
|
|
|
fputs ("#**********************************************************************\n", fp);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
save_options (fp);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
if (ferror (fp))
|
2003-11-15 21:53:33 +08:00
|
|
|
g_message (_("Could not write '%s': %s"),
|
2004-01-19 11:06:04 +08:00
|
|
|
gimp_filename_to_utf8 (savename), g_strerror (ferror (fp)));
|
2003-06-13 22:37:00 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
fclose (fp);
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
static void
|
2004-04-16 00:58:21 +08:00
|
|
|
save_file_chooser_response (GtkFileChooser *chooser,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2003-11-19 22:51:52 +08:00
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
2004-04-16 00:58:21 +08:00
|
|
|
filename = gtk_file_chooser_get_filename (chooser);
|
2003-11-19 22:51:52 +08:00
|
|
|
|
|
|
|
save_callback ();
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2004-04-16 00:58:21 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (chooser));
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
2006-10-06 16:33:02 +08:00
|
|
|
static void
|
|
|
|
file_chooser_set_default_folder (GtkFileChooser *chooser)
|
|
|
|
{
|
|
|
|
GList *path_list;
|
|
|
|
gchar *dir;
|
|
|
|
|
|
|
|
if (! fractalexplorer_path)
|
|
|
|
return;
|
|
|
|
|
2012-09-27 05:29:51 +08:00
|
|
|
path_list = gimp_path_parse (fractalexplorer_path, 256, FALSE, NULL);
|
2006-10-06 16:33:02 +08:00
|
|
|
|
|
|
|
dir = gimp_path_get_user_writable_dir (path_list);
|
|
|
|
|
|
|
|
if (! dir)
|
|
|
|
dir = g_strdup (gimp_directory ());
|
|
|
|
|
|
|
|
gtk_file_chooser_set_current_folder (chooser, dir);
|
|
|
|
|
|
|
|
g_free (dir);
|
|
|
|
gimp_path_free (path_list);
|
|
|
|
}
|
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
static void
|
2004-04-16 00:58:21 +08:00
|
|
|
load_file_chooser_response (GtkFileChooser *chooser,
|
|
|
|
gint response_id,
|
|
|
|
gpointer data)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2003-11-19 22:51:52 +08:00
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
2004-04-16 00:58:21 +08:00
|
|
|
filename = gtk_file_chooser_get_filename (chooser);
|
2003-11-19 22:51:52 +08:00
|
|
|
|
|
|
|
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
|
|
|
{
|
|
|
|
explorer_load ();
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show (maindlg);
|
|
|
|
dialog_change_scale ();
|
|
|
|
set_cmap_preview ();
|
|
|
|
dialog_update_preview ();
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
2004-04-16 00:58:21 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (chooser));
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
static void
|
2004-04-16 00:58:21 +08:00
|
|
|
create_load_file_chooser (GtkWidget *widget,
|
|
|
|
GtkWidget *dialog)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
static GtkWidget *window = NULL;
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
if (!window)
|
|
|
|
{
|
2004-04-16 00:58:21 +08:00
|
|
|
window =
|
|
|
|
gtk_file_chooser_dialog_new (_("Load Fractal Parameters"),
|
|
|
|
GTK_WINDOW (dialog),
|
|
|
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
|
|
|
|
2017-02-12 23:18:24 +08:00
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
_("_Open"), GTK_RESPONSE_OK,
|
2004-04-16 00:58:21 +08:00
|
|
|
|
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2004-04-16 00:58:21 +08:00
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
|
2003-11-10 06:44:45 +08:00
|
|
|
|
2018-05-10 23:04:37 +08:00
|
|
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (window),
|
2005-04-08 01:10:05 +08:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
2006-10-06 16:33:02 +08:00
|
|
|
file_chooser_set_default_folder (GTK_FILE_CHOOSER (window));
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (window, "destroy",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gtk_widget_destroyed),
|
|
|
|
&window);
|
2003-11-19 22:51:52 +08:00
|
|
|
g_signal_connect (window, "response",
|
2004-04-16 00:58:21 +08:00
|
|
|
G_CALLBACK (load_file_chooser_response),
|
2001-12-29 21:26:29 +08:00
|
|
|
window);
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2003-11-19 22:51:52 +08:00
|
|
|
gtk_window_present (GTK_WINDOW (window));
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
static void
|
2004-04-16 00:58:21 +08:00
|
|
|
create_save_file_chooser (GtkWidget *widget,
|
|
|
|
GtkWidget *dialog)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
static GtkWidget *window = NULL;
|
|
|
|
|
2004-04-16 00:58:21 +08:00
|
|
|
if (! window)
|
2000-01-29 11:19:53 +08:00
|
|
|
{
|
2004-04-16 00:58:21 +08:00
|
|
|
window =
|
|
|
|
gtk_file_chooser_dialog_new (_("Save Fractal Parameters"),
|
|
|
|
GTK_WINDOW (dialog),
|
|
|
|
GTK_FILE_CHOOSER_ACTION_SAVE,
|
|
|
|
|
2017-02-12 23:18:24 +08:00
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
_("_Save"), GTK_RESPONSE_OK,
|
2004-04-16 00:58:21 +08:00
|
|
|
|
|
|
|
NULL);
|
2000-01-29 11:19:53 +08:00
|
|
|
|
2018-05-10 23:04:37 +08:00
|
|
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (window),
|
2005-04-08 01:10:05 +08:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
2007-02-02 16:57:15 +08:00
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
|
2005-04-08 01:10:05 +08:00
|
|
|
|
2007-02-02 16:57:15 +08:00
|
|
|
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (window),
|
|
|
|
TRUE);
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (window, "destroy",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gtk_widget_destroyed),
|
|
|
|
&window);
|
2003-11-19 22:51:52 +08:00
|
|
|
g_signal_connect (window, "response",
|
2004-04-16 00:58:21 +08:00
|
|
|
G_CALLBACK (save_file_chooser_response),
|
2001-12-29 21:26:29 +08:00
|
|
|
window);
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
if (tpath)
|
|
|
|
{
|
2004-04-16 00:58:21 +08:00
|
|
|
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (window), tpath);
|
2000-01-29 11:19:53 +08:00
|
|
|
}
|
|
|
|
else
|
2000-12-29 23:22:01 +08:00
|
|
|
{
|
2006-10-06 16:33:02 +08:00
|
|
|
file_chooser_set_default_folder (GTK_FILE_CHOOSER (window));
|
2000-12-29 23:22:01 +08:00
|
|
|
}
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2003-11-19 22:51:52 +08:00
|
|
|
gtk_window_present (GTK_WINDOW (window));
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
2003-10-02 05:47:49 +08:00
|
|
|
gchar*
|
2000-01-29 11:19:53 +08:00
|
|
|
get_line (gchar *buf,
|
2003-12-14 07:58:33 +08:00
|
|
|
gint s,
|
|
|
|
FILE *from,
|
|
|
|
gint init)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
gint slen;
|
|
|
|
gchar *ret;
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
if (init)
|
|
|
|
line_no = 1;
|
|
|
|
else
|
|
|
|
line_no++;
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
do
|
|
|
|
{
|
|
|
|
ret = fgets (buf, s, from);
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
while (!ferror (from) && buf[0] == '#');
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
slen = strlen (buf);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
|
|
|
/* The last newline is a pain */
|
2000-01-29 11:19:53 +08:00
|
|
|
if (slen > 0)
|
|
|
|
buf[slen - 1] = '\0';
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
if (ferror (from))
|
|
|
|
{
|
|
|
|
g_warning ("Error reading file");
|
|
|
|
return NULL;
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
return ret;
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2000-01-29 11:19:53 +08:00
|
|
|
load_options (fractalexplorerOBJ *xxx,
|
2003-12-14 07:58:33 +08:00
|
|
|
FILE *fp)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
gchar load_buf[MAX_LOAD_LINE];
|
|
|
|
gchar str_buf[MAX_LOAD_LINE];
|
|
|
|
gchar opt_buf[MAX_LOAD_LINE];
|
|
|
|
|
|
|
|
/* default values */
|
2003-10-02 05:47:49 +08:00
|
|
|
xxx->opts = standardvals;
|
2003-08-18 20:17:21 +08:00
|
|
|
xxx->opts.gradinvert = FALSE;
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
get_line (load_buf, MAX_LOAD_LINE, fp, 0);
|
|
|
|
|
|
|
|
while (!feof (fp) && strcmp (load_buf, "<EOF>"))
|
|
|
|
{
|
1999-09-09 10:51:57 +08:00
|
|
|
/* Get option name */
|
2007-05-31 18:35:06 +08:00
|
|
|
sscanf (load_buf, "%255s %255s", str_buf, opt_buf);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
if (!strcmp (str_buf, "fractaltype:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
gint sp = 0;
|
|
|
|
|
|
|
|
sp = atoi (opt_buf);
|
|
|
|
if (sp < 0)
|
|
|
|
return -1;
|
|
|
|
xxx->opts.fractaltype = sp;
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "xmin:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.xmin = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "xmax:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.xmax = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp(str_buf, "ymin:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.ymin = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "ymax:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.ymax = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp(str_buf, "redstretch:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
gdouble sp = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
xxx->opts.redstretch = sp / 128.0;
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp(str_buf, "greenstretch:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
gdouble sp = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
xxx->opts.greenstretch = sp / 128.0;
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "bluestretch:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
gdouble sp = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
xxx->opts.bluestretch = sp / 128.0;
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "iter:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.iter = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp(str_buf, "cx:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.cx = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "cy:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.cy = g_ascii_strtod (opt_buf, NULL);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp(str_buf, "redmode:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.redmode = atoi (opt_buf);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp(str_buf, "greenmode:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.greenmode = atoi (opt_buf);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp(str_buf, "bluemode:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.bluemode = atoi (opt_buf);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "redinvert:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.redinvert = atoi (opt_buf);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "greeninvert:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.greeninvert = atoi (opt_buf);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp(str_buf, "blueinvert:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.blueinvert = atoi (opt_buf);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
else if (!strcmp (str_buf, "colormode:"))
|
2003-12-14 07:58:33 +08:00
|
|
|
{
|
|
|
|
xxx->opts.colormode = atoi (opt_buf);
|
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
get_line (load_buf, MAX_LOAD_LINE, fp, 0);
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
return 0;
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-01-29 11:19:53 +08:00
|
|
|
explorer_load (void)
|
1999-09-09 10:51:57 +08:00
|
|
|
{
|
2000-01-29 11:19:53 +08:00
|
|
|
FILE *fp;
|
|
|
|
gchar load_buf[MAX_LOAD_LINE];
|
|
|
|
|
2003-08-18 20:17:21 +08:00
|
|
|
g_assert (filename != NULL);
|
2005-03-04 21:23:32 +08:00
|
|
|
|
|
|
|
fp = g_fopen (filename, "rt");
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
if (!fp)
|
|
|
|
{
|
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));
|
2000-01-29 11:19:53 +08:00
|
|
|
return;
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
get_line (load_buf, MAX_LOAD_LINE, fp, 1);
|
1999-09-09 10:51:57 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
if (strncmp (FRACTAL_HEADER, load_buf, strlen (load_buf)))
|
|
|
|
{
|
2004-01-19 11:06:04 +08:00
|
|
|
g_message (_("'%s' is not a FractalExplorer file"),
|
|
|
|
gimp_filename_to_utf8 (filename));
|
2010-11-10 02:03:47 +08:00
|
|
|
fclose (fp);
|
2000-01-29 11:19:53 +08:00
|
|
|
return;
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
if (load_options (current_obj,fp))
|
|
|
|
{
|
2003-11-15 21:53:33 +08:00
|
|
|
g_message (_("'%s' is corrupt. Line %d Option section incorrect"),
|
2004-01-19 11:06:04 +08:00
|
|
|
gimp_filename_to_utf8 (filename), line_no);
|
2010-11-10 02:03:47 +08:00
|
|
|
fclose (fp);
|
2000-01-29 11:19:53 +08:00
|
|
|
return;
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|
2000-01-29 11:19:53 +08:00
|
|
|
|
|
|
|
wvals = current_obj->opts;
|
2003-06-13 22:37:00 +08:00
|
|
|
|
2000-01-29 11:19:53 +08:00
|
|
|
fclose (fp);
|
1999-09-09 10:51:57 +08:00
|
|
|
}
|