2009-07-13 13:21:31 -03:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2009-08-24 22:51:46 -03:00
|
|
|
#define DEFAULT_PRESSURE_OPACITY TRUE
|
|
|
|
#define DEFAULT_PRESSURE_HARDNESS FALSE
|
|
|
|
|
2009-07-13 13:21:31 -03:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "widgets-types.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
|
2009-10-03 12:59:45 +03:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
|
|
|
|
2009-07-13 13:21:31 -03:00
|
|
|
#include "gimpdocked.h"
|
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
2009-08-07 20:29:34 -03:00
|
|
|
#include "gimpmenufactory.h"
|
2009-08-23 11:56:03 -03:00
|
|
|
#include "gimpdynamicseditor.h"
|
2009-08-20 04:25:26 +03:00
|
|
|
#include "core/gimpdynamics.h"
|
2009-07-13 13:21:31 -03:00
|
|
|
|
2009-08-23 11:56:03 -03:00
|
|
|
#include "core/gimptoolinfo.h"
|
|
|
|
#include "tools/gimptooloptions-gui.h"
|
|
|
|
#include "gimppropwidgets.h"
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
|
2009-07-13 13:21:31 -03:00
|
|
|
/* local function prototypes */
|
|
|
|
|
|
|
|
static void gimp_dynamics_editor_docked_iface_init (GimpDockedInterface *face);
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
static GObject * gimp_dynamics_editor_constructor (GType type,
|
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params);
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
static void gimp_dynamics_editor_set_data (GimpDataEditor *editor,
|
|
|
|
GimpData *data);
|
2009-07-13 13:21:31 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
static void gimp_dynamics_editor_set_context (GimpDocked *docked,
|
|
|
|
GimpContext *context);
|
2009-08-24 15:55:44 -03:00
|
|
|
|
2009-10-10 21:47:25 +02:00
|
|
|
static void gimp_dynamics_editor_notify_model (GimpDynamics *options,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpDynamicsEditor *editor);
|
|
|
|
static void gimp_dynamics_editor_notify_data (GimpDynamics *options,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpDynamicsEditor *editor);
|
2009-07-13 13:21:31 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
static void dynamics_output_maping_row_gui (GObject *config,
|
|
|
|
const gchar *property_name_part,
|
|
|
|
const gchar *property_label,
|
|
|
|
GtkTable *table,
|
|
|
|
gint row,
|
|
|
|
GtkWidget *labels[]);
|
|
|
|
|
|
|
|
static GtkWidget * dynamics_check_button_new (GObject *config,
|
|
|
|
const gchar *property_name,
|
|
|
|
GtkTable *table,
|
|
|
|
gint column,
|
|
|
|
gint row);
|
|
|
|
|
|
|
|
|
|
|
|
static void dynamics_check_button_size_allocate (GtkWidget *toggle,
|
|
|
|
GtkAllocation *allocation,
|
|
|
|
GtkWidget *label);
|
|
|
|
|
2009-07-13 13:21:31 -03:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpDynamicsEditor, gimp_dynamics_editor,
|
|
|
|
GIMP_TYPE_DATA_EDITOR,
|
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
|
|
|
|
gimp_dynamics_editor_docked_iface_init))
|
|
|
|
|
|
|
|
#define parent_class gimp_dynamics_editor_parent_class
|
|
|
|
|
|
|
|
static GimpDockedInterface *parent_docked_iface = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dynamics_editor_init (GimpDynamicsEditor *editor)
|
|
|
|
{
|
2009-08-23 11:56:03 -03:00
|
|
|
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
2009-10-10 21:47:25 +02:00
|
|
|
GimpDynamics *dynamics;
|
|
|
|
GObject *config;
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-03 12:59:45 +03:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *box;
|
|
|
|
|
2009-08-23 11:56:03 -03:00
|
|
|
GtkWidget *vbox;
|
2009-08-20 12:51:07 -03:00
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
gint n_dynamics = 0;
|
2009-10-07 23:32:17 +03:00
|
|
|
GtkWidget *dynamics_labels[6];
|
2009-10-10 21:47:25 +02:00
|
|
|
|
|
|
|
editor->dynamics_model = g_object_new (GIMP_TYPE_DYNAMICS, NULL);
|
|
|
|
|
|
|
|
g_signal_connect (editor->dynamics_model, "notify",
|
|
|
|
G_CALLBACK (gimp_dynamics_editor_notify_model),
|
|
|
|
editor);
|
|
|
|
|
|
|
|
dynamics = editor->dynamics_model;
|
|
|
|
|
|
|
|
config = G_OBJECT (dynamics);
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-03 12:59:45 +03:00
|
|
|
vbox = gtk_vbox_new (FALSE, 6);
|
2009-10-03 13:03:51 +03:00
|
|
|
gtk_box_pack_start (GTK_BOX (data_editor), vbox, TRUE, TRUE, 0);
|
2009-10-03 12:59:45 +03:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_labels[n_dynamics] = gtk_label_new (_("Pressure"));
|
2009-08-25 21:28:24 +03:00
|
|
|
n_dynamics++;
|
2009-08-23 11:56:03 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_labels[n_dynamics] = gtk_label_new (_("Velocity"));
|
2009-08-25 21:28:24 +03:00
|
|
|
n_dynamics++;
|
2009-08-23 11:56:03 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_labels[n_dynamics] = gtk_label_new (_("Direction"));
|
2009-08-25 21:28:24 +03:00
|
|
|
n_dynamics++;
|
2009-08-23 11:56:03 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_labels[n_dynamics] = gtk_label_new (_("Tilt"));
|
2009-08-25 21:28:24 +03:00
|
|
|
n_dynamics++;
|
2009-08-23 11:56:03 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_labels[n_dynamics] = gtk_label_new (_("Random"));
|
2009-08-25 21:28:24 +03:00
|
|
|
n_dynamics++;
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_labels[n_dynamics] = gtk_label_new (_("Fade"));
|
2009-08-25 21:28:24 +03:00
|
|
|
n_dynamics++;
|
2009-08-23 11:56:03 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
/* NB: When adding new dynamics driver, increase size of the
|
2009-08-23 11:56:03 -03:00
|
|
|
* dynamics_labels[] array
|
|
|
|
*/
|
2009-08-20 12:51:07 -03:00
|
|
|
|
|
|
|
if (n_dynamics > 0)
|
|
|
|
{
|
|
|
|
GtkWidget *inner_frame;
|
2009-08-25 21:28:24 +03:00
|
|
|
GtkWidget *fixed;
|
|
|
|
gint i;
|
|
|
|
gboolean rtl = gtk_widget_get_direction (vbox) == GTK_TEXT_DIR_RTL;
|
|
|
|
|
|
|
|
|
2009-08-20 12:51:07 -03:00
|
|
|
inner_frame = gimp_frame_new (NULL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), inner_frame);
|
|
|
|
gtk_widget_show (inner_frame);
|
|
|
|
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
table = gtk_table_new (9, n_dynamics + 2, FALSE);
|
2009-08-20 12:51:07 -03:00
|
|
|
gtk_container_add (GTK_CONTAINER (inner_frame), table);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2009-08-23 11:56:03 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
|
|
|
|
"opacity",
|
|
|
|
_("Opacity"),
|
|
|
|
table,
|
|
|
|
1,
|
|
|
|
dynamics_labels);
|
|
|
|
|
|
|
|
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
|
|
|
|
"hardness",
|
|
|
|
_("Hardness"),
|
|
|
|
table,
|
|
|
|
2,
|
|
|
|
dynamics_labels);
|
|
|
|
|
|
|
|
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
|
|
|
|
"rate",
|
|
|
|
_("Rate"),
|
|
|
|
table,
|
|
|
|
3,
|
|
|
|
dynamics_labels);
|
|
|
|
|
|
|
|
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
|
|
|
|
"size",
|
|
|
|
_("Size"),
|
|
|
|
table,
|
|
|
|
4,
|
|
|
|
dynamics_labels);
|
|
|
|
|
|
|
|
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
|
|
|
|
"aspect-ratio",
|
|
|
|
_("Aspect ratio"),
|
|
|
|
table,
|
|
|
|
5,
|
|
|
|
dynamics_labels);
|
|
|
|
|
|
|
|
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
|
|
|
|
"color",
|
|
|
|
_("Color"),
|
|
|
|
table,
|
|
|
|
6,
|
|
|
|
dynamics_labels);
|
|
|
|
|
|
|
|
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
|
|
|
|
"angle",
|
|
|
|
_("Angle"),
|
|
|
|
table,
|
|
|
|
7,
|
|
|
|
dynamics_labels);
|
|
|
|
|
|
|
|
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
|
|
|
|
"jitter",
|
|
|
|
_("Jitter"),
|
|
|
|
table,
|
|
|
|
8,
|
|
|
|
dynamics_labels);
|
2009-08-25 21:28:24 +03:00
|
|
|
fixed = gtk_fixed_new ();
|
|
|
|
gtk_table_attach (GTK_TABLE (table), fixed, 0, n_dynamics + 2, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (fixed);
|
|
|
|
|
|
|
|
for (i = 0; i < n_dynamics; i++)
|
|
|
|
{
|
|
|
|
gtk_label_set_angle (GTK_LABEL (dynamics_labels[i]),
|
2009-10-07 19:32:37 +03:00
|
|
|
90);
|
2009-08-25 21:28:24 +03:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (dynamics_labels[i]), 1.0, 1.0);
|
|
|
|
gtk_fixed_put (GTK_FIXED (fixed), dynamics_labels[i], 0, 0);
|
|
|
|
gtk_widget_show (dynamics_labels[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2009-08-23 11:56:03 -03:00
|
|
|
}
|
2009-07-13 13:21:31 -03:00
|
|
|
|
2009-10-10 21:47:25 +02:00
|
|
|
static void
|
|
|
|
gimp_dynamics_editor_class_init (GimpDynamicsEditorClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->constructor = gimp_dynamics_editor_constructor;
|
|
|
|
|
|
|
|
editor_class->set_data = gimp_dynamics_editor_set_data;
|
|
|
|
editor_class->title = _("Dynamics Editor");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dynamics_editor_docked_iface_init (GimpDockedInterface *iface)
|
|
|
|
{
|
|
|
|
parent_docked_iface = g_type_interface_peek_parent (iface);
|
|
|
|
|
|
|
|
if (! parent_docked_iface)
|
|
|
|
parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED);
|
|
|
|
|
|
|
|
iface->set_context = gimp_dynamics_editor_set_context;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GObject *
|
|
|
|
gimp_dynamics_editor_constructor (GType type,
|
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params)
|
|
|
|
{
|
|
|
|
GObject *object;
|
|
|
|
|
|
|
|
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
|
|
|
|
|
|
|
gimp_docked_set_show_button_bar (GIMP_DOCKED (object), FALSE);
|
|
|
|
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dynamics_editor_set_data (GimpDataEditor *editor,
|
|
|
|
GimpData *data)
|
|
|
|
{
|
|
|
|
GimpDynamicsEditor *dynamics_editor = GIMP_DYNAMICS_EDITOR (editor);
|
|
|
|
|
|
|
|
if (editor->data)
|
|
|
|
g_signal_handlers_disconnect_by_func (editor->data,
|
|
|
|
gimp_dynamics_editor_notify_data,
|
|
|
|
editor);
|
|
|
|
|
|
|
|
GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data);
|
|
|
|
|
|
|
|
if (editor->data)
|
2009-10-10 23:02:18 +02:00
|
|
|
{
|
|
|
|
g_signal_handlers_block_by_func (dynamics_editor->dynamics_model,
|
|
|
|
gimp_dynamics_editor_notify_model,
|
|
|
|
editor);
|
|
|
|
|
|
|
|
gimp_config_copy (GIMP_CONFIG (editor->data),
|
|
|
|
GIMP_CONFIG (dynamics_editor->dynamics_model),
|
|
|
|
0);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func (dynamics_editor->dynamics_model,
|
|
|
|
gimp_dynamics_editor_notify_model,
|
|
|
|
editor);
|
|
|
|
|
|
|
|
g_signal_connect (editor->data, "notify",
|
|
|
|
G_CALLBACK (gimp_dynamics_editor_notify_data),
|
|
|
|
editor);
|
|
|
|
}
|
2009-10-10 21:47:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dynamics_editor_notify_model (GimpDynamics *options,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpDynamicsEditor *editor)
|
|
|
|
{
|
|
|
|
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
|
|
|
|
|
|
|
if (data_editor->data)
|
|
|
|
{
|
|
|
|
g_signal_handlers_block_by_func (data_editor->data,
|
|
|
|
gimp_dynamics_editor_notify_data,
|
|
|
|
editor);
|
|
|
|
|
|
|
|
gimp_config_copy (GIMP_CONFIG (editor->dynamics_model),
|
|
|
|
GIMP_CONFIG (data_editor->data),
|
|
|
|
0);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func (data_editor->data,
|
|
|
|
gimp_dynamics_editor_notify_data,
|
|
|
|
editor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dynamics_editor_notify_data (GimpDynamics *options,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpDynamicsEditor *editor)
|
|
|
|
{
|
|
|
|
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func (editor->dynamics_model,
|
|
|
|
gimp_dynamics_editor_notify_model,
|
|
|
|
editor);
|
|
|
|
|
|
|
|
gimp_config_copy (GIMP_CONFIG (data_editor->data),
|
|
|
|
GIMP_CONFIG (editor->dynamics_model),
|
|
|
|
0);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func (editor->dynamics_model,
|
|
|
|
gimp_dynamics_editor_notify_model,
|
|
|
|
editor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_dynamics_editor_set_context (GimpDocked *docked,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (docked);
|
|
|
|
|
|
|
|
parent_docked_iface->set_context (docked, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
gimp_dynamics_editor_new (GimpContext *context,
|
|
|
|
GimpMenuFactory *menu_factory)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
return g_object_new (GIMP_TYPE_DYNAMICS_EDITOR,
|
|
|
|
"menu-factory", menu_factory,
|
|
|
|
"menu-identifier", "<DynamicsEditor>",
|
|
|
|
"ui-path", "/dynamics-editor-popup",
|
|
|
|
"data-factory", context->gimp->dynamics_factory,
|
|
|
|
"context", context,
|
|
|
|
"data", gimp_context_get_dynamics (context),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-13 13:21:31 -03:00
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_output_maping_row_gui(GObject *config,
|
|
|
|
const gchar *property_name_part,
|
|
|
|
const gchar *property_label,
|
|
|
|
GtkTable *table,
|
|
|
|
gint row,
|
|
|
|
GtkWidget *labels[])
|
2009-07-13 13:21:31 -03:00
|
|
|
{
|
2009-10-07 23:32:17 +03:00
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *button;
|
|
|
|
gint column=1;
|
2009-07-13 13:21:31 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
label = gtk_label_new (property_label);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2009-07-13 13:21:31 -03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
/*gboolean pressure;
|
|
|
|
gboolean velocity;
|
|
|
|
gboolean direction;
|
|
|
|
gboolean tilt;
|
|
|
|
gboolean random;
|
|
|
|
gboolean fade;
|
|
|
|
*/
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
button = dynamics_check_button_new (config, g_strconcat("pressure-", property_name_part, NULL),
|
2009-07-13 13:21:31 -03:00
|
|
|
table, column, row);
|
|
|
|
g_signal_connect (button, "size-allocate",
|
|
|
|
G_CALLBACK (dynamics_check_button_size_allocate),
|
|
|
|
labels[column - 1]);
|
|
|
|
column++;
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
button = dynamics_check_button_new (config, g_strconcat("velocity-", property_name_part, NULL),
|
2009-07-13 13:21:31 -03:00
|
|
|
table, column, row);
|
|
|
|
g_signal_connect (button, "size-allocate",
|
|
|
|
G_CALLBACK (dynamics_check_button_size_allocate),
|
|
|
|
labels[column - 1]);
|
|
|
|
column++;
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
button = dynamics_check_button_new (config, g_strconcat("direction-", property_name_part, NULL),
|
2009-07-13 13:21:31 -03:00
|
|
|
table, column, row);
|
|
|
|
g_signal_connect (button, "size-allocate",
|
|
|
|
G_CALLBACK (dynamics_check_button_size_allocate),
|
|
|
|
labels[column - 1]);
|
|
|
|
column++;
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
button = dynamics_check_button_new (config, g_strconcat("tilt-", property_name_part, NULL),
|
2009-07-13 13:21:31 -03:00
|
|
|
table, column, row);
|
|
|
|
g_signal_connect (button, "size-allocate",
|
|
|
|
G_CALLBACK (dynamics_check_button_size_allocate),
|
|
|
|
labels[column - 1]);
|
|
|
|
column++;
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
button = dynamics_check_button_new (config, g_strconcat("random-", property_name_part, NULL),
|
2009-07-13 13:21:31 -03:00
|
|
|
table, column, row);
|
|
|
|
g_signal_connect (button, "size-allocate",
|
|
|
|
G_CALLBACK (dynamics_check_button_size_allocate),
|
|
|
|
labels[column - 1]);
|
|
|
|
column++;
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
button = dynamics_check_button_new (config, g_strconcat("fading-", property_name_part, NULL),
|
2009-07-13 13:21:31 -03:00
|
|
|
table, column, row);
|
|
|
|
g_signal_connect (button, "size-allocate",
|
|
|
|
G_CALLBACK (dynamics_check_button_size_allocate),
|
|
|
|
labels[column - 1]);
|
|
|
|
column++;
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-07-13 13:21:31 -03:00
|
|
|
}
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
static GtkWidget *
|
|
|
|
dynamics_check_button_new (GObject *config,
|
|
|
|
const gchar *property_name,
|
|
|
|
GtkTable *table,
|
|
|
|
gint column,
|
|
|
|
gint row)
|
2009-08-25 21:28:24 +03:00
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
button = gimp_prop_check_button_new (config, property_name, NULL);
|
|
|
|
gtk_table_attach (table, button, column, column + 1, row, row + 1,
|
|
|
|
GTK_SHRINK, GTK_SHRINK, 0, 0);
|
|
|
|
gtk_widget_show (button);
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
return button;
|
2009-08-25 21:28:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-07 23:32:17 +03:00
|
|
|
dynamics_check_button_size_allocate (GtkWidget *toggle,
|
|
|
|
GtkAllocation *allocation,
|
|
|
|
GtkWidget *label)
|
2009-08-25 21:28:24 +03:00
|
|
|
{
|
2009-10-07 23:32:17 +03:00
|
|
|
GtkWidget *fixed = label->parent;
|
|
|
|
gint x, y;
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
if (gtk_widget_get_direction (label) == GTK_TEXT_DIR_LTR)
|
|
|
|
x = allocation->x;
|
|
|
|
else
|
|
|
|
x = allocation->x + allocation->width - label->allocation.width;
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
x -= fixed->allocation.x;
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
y = fixed->allocation.height - label->allocation.height;
|
2009-08-25 21:28:24 +03:00
|
|
|
|
2009-10-07 23:32:17 +03:00
|
|
|
gtk_fixed_move (GTK_FIXED (fixed), label, x, y);
|
2009-08-25 21:28:24 +03:00
|
|
|
}
|