Commit 9e336cfd authored by Roman Lebedev's avatar Roman Lebedev

DTGTK slider is gone.

FIXME: if there is non-bauhaus sliders with accels, there is a regression. Or that was for DTGTK_SLIDER?
parent f51541dd
......@@ -23,7 +23,6 @@
#include "dtgtk/button.h"
#include "dtgtk/icon.h"
#include "dtgtk/tristatebutton.h"
#include "dtgtk/slider.h"
#include "dtgtk/tristatebutton.h"
#include "dtgtk/gradientslider.h"
#include "develop/pixelpipe.h"
......
......@@ -33,7 +33,6 @@
#include "dtgtk/button.h"
#include "dtgtk/icon.h"
#include "dtgtk/tristatebutton.h"
#include "dtgtk/slider.h"
#include "dtgtk/tristatebutton.h"
#include "dtgtk/gradientslider.h"
#include "dtgtk/label.h"
......
......@@ -35,7 +35,6 @@
#include "dtgtk/button.h"
#include "dtgtk/icon.h"
#include "dtgtk/tristatebutton.h"
#include "dtgtk/slider.h"
#include "dtgtk/gradientslider.h"
#include "libs/modulegroups.h"
......
......@@ -22,7 +22,6 @@
#include "dtgtk/button.h"
#include "dtgtk/icon.h"
#include "dtgtk/tristatebutton.h"
#include "dtgtk/slider.h"
#include "dtgtk/tristatebutton.h"
#include "dtgtk/gradientslider.h"
#include "develop/pixelpipe.h"
......
This diff is collapsed.
/*
This file is part of darktable,
copyright (c) 2010 Henrik Andersson.
darktable 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.
darktable 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 darktable. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DTGTK_SLIDER_H
#define DTGTK_SLIDER_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define DTGTK_SLIDER(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, dtgtk_slider_get_type(), GtkDarktableSlider)
#define DTGTK_SLIDER_CLASS(klass) \
GTK_CHECK_CLASS_CAST(klass, dtgtk_slider_get_type(), GtkDarktableSliderClass)
#define DTGTK_IS_SLIDER(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, dtgtk_slider_get_type())
#define DTGTK_IS_SLIDER_CLASS(klass) GTK_CHECK_CLASS_TYPE(obj, dtgtk_slider_get_type())
typedef enum _darktable_slider_type
{
/** Default type , a standard slider, this is default */
DARKTABLE_SLIDER_BAR = 0,
/** Value slider, doesn't show a bar, just a value */
DARKTABLE_SLIDER_VALUE
} darktable_slider_type_t;
typedef enum _darktable_slider_format_type
{
/** Default format type , value is displayed as float*/
DARKTABLE_SLIDER_FORMAT_FLOAT = 0,
/** Value is displayed as ratio eg. 50/50*/
DARKTABLE_SLIDER_FORMAT_RATIO,
DARKTABLE_SLIDER_FORMAT_PERCENT,
DARKTABLE_SLIDER_FORMAT_NONE
} darktable_slider_format_type_t;
typedef struct _GtkDarktableSlider
{
GtkEventBox widget;
GtkWidget *entry;
GtkBox *hbox;
GtkAdjustment *adjustment;
gboolean is_dragging;
gboolean is_sensibility_key_pressed;
gboolean is_entry_active;
gboolean is_changed;
gboolean force_sign;
gint prev_x_root;
gint motion_direction;
gint digits;
gint snapsize;
gint labelwidth;
gint labelheight;
gdouble default_value;
darktable_slider_type_t type;
darktable_slider_format_type_t fmt_type;
} GtkDarktableSlider;
typedef struct _GtkDarktableSliderClass
{
GtkEventBoxClass parent_class;
} GtkDarktableSliderClass;
enum
{
VALUE_CHANGED,
SLIDER_LAST_SIGNAL
};
GType dtgtk_slider_get_type(void);
/** Instansiate a new darktable slider control passing adjustment as range */
GtkWidget *dtgtk_slider_new(GtkAdjustment *adjustment);
/** Instansiate a new slider with specified range values */
GtkWidget *dtgtk_slider_new_with_range(darktable_slider_type_t type, gdouble min, gdouble max, gdouble step,
gdouble value, gint digits);
/** Get the value of the slider */
gdouble dtgtk_slider_get_value(GtkDarktableSlider *slider);
/** Set label of slider */
void dtgtk_slider_set_label(GtkDarktableSlider *slider, gchar *label);
/** Set unit of value */
void dtgtk_slider_set_unit(GtkDarktableSlider *slider, gchar *unit);
/** Set the default value of slider */
void dtgtk_slider_set_default_value(GtkDarktableSlider *slider, gdouble val);
/** Set force of sign of positive in displayed value */
void dtgtk_slider_set_force_sign(GtkDarktableSlider *slider, gboolean force);
/** Set the value of the slider */
void dtgtk_slider_set_value(GtkDarktableSlider *slider, gdouble value);
/** Set the type of the slider */
void dtgtk_slider_set_type(GtkDarktableSlider *slider, darktable_slider_type_t type);
/** Set digits to use when displaying value*/
void dtgtk_slider_set_digits(GtkDarktableSlider *slider, gint digits);
/** Set value display format */
void dtgtk_slider_set_format_type(GtkDarktableSlider *slider, darktable_slider_format_type_t type);
/** set step size to snap values to. 0 for no snapping (default). */
void dtgtk_slider_set_snap(GtkDarktableSlider *slider, gint snapsize);
G_END_DECLS
#endif
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-space on;
......@@ -19,7 +19,6 @@
#include "common/darktable.h"
#include "gui/accelerators.h"
#include "control/control.h"
#include "dtgtk/slider.h"
#include "common/debug.h"
#include "develop/blend.h"
......@@ -336,59 +335,6 @@ void dt_accel_connect_button_lib(dt_lib_module_t *module, const gchar *path, Gtk
dt_accel_connect_lib(module, path, closure);
}
static gboolean slider_edit_callback(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval,
GdkModifierType modifier, gpointer data)
{
GtkDarktableSlider *slider = DTGTK_SLIDER(data);
char sv[32] = { 0 };
slider->is_entry_active = TRUE;
gdouble value = gtk_adjustment_get_value(slider->adjustment);
snprintf(sv, sizeof(sv), "%.*f", slider->digits, value);
gtk_entry_set_text(GTK_ENTRY(slider->entry), sv);
gtk_widget_show(GTK_WIDGET(slider->entry));
gtk_widget_grab_focus(GTK_WIDGET(slider->entry));
gtk_widget_queue_draw(GTK_WIDGET(slider));
return TRUE;
}
static gboolean slider_increase_callback(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval,
GdkModifierType modifier, gpointer data)
{
GtkDarktableSlider *slider = DTGTK_SLIDER(data);
float value = gtk_adjustment_get_value(slider->adjustment);
value += gtk_adjustment_get_step_increment(slider->adjustment);
if(slider->snapsize) value = slider->snapsize * (((int)value) / slider->snapsize);
gtk_adjustment_set_value(slider->adjustment, value);
gtk_widget_queue_draw(GTK_WIDGET(slider));
g_signal_emit_by_name(G_OBJECT(slider), "value-changed");
return TRUE;
}
static gboolean slider_decrease_callback(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval,
GdkModifierType modifier, gpointer data)
{
GtkDarktableSlider *slider = DTGTK_SLIDER(data);
float value = gtk_adjustment_get_value(slider->adjustment);
value -= gtk_adjustment_get_step_increment(slider->adjustment);
if(slider->snapsize) value = slider->snapsize * (((int)value) / slider->snapsize);
gtk_adjustment_set_value(slider->adjustment, value);
gtk_widget_queue_draw(GTK_WIDGET(slider));
g_signal_emit_by_name(G_OBJECT(slider), "value-changed");
return TRUE;
}
static gboolean slider_reset_callback(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval,
GdkModifierType modifier, gpointer data)
{
GtkDarktableSlider *slider = DTGTK_SLIDER(data);
gtk_adjustment_set_value(slider->adjustment, slider->default_value);
gtk_widget_queue_draw(GTK_WIDGET(slider));
g_signal_emit_by_name(G_OBJECT(slider), "value-changed");
return TRUE;
}
static gboolean bauhaus_slider_edit_callback(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval,
GdkModifierType modifier, gpointer data)
{
......@@ -449,14 +395,9 @@ void dt_accel_connect_slider_iop(dt_iop_module_t *module, const gchar *path, Gtk
char *paths[] = { increase_path, decrease_path, reset_path, edit_path };
dt_accel_paths_slider_iop(paths, 256, module->op, path);
if(DT_IS_BAUHAUS_WIDGET(slider))
{
closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_increase_callback), (gpointer)slider, NULL);
}
else
{
closure = g_cclosure_new(G_CALLBACK(slider_increase_callback), (gpointer)slider, NULL);
}
assert(DT_IS_BAUHAUS_WIDGET(slider));
closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_increase_callback), (gpointer)slider, NULL);
accel = _lookup_accel(increase_path);
......@@ -472,14 +413,7 @@ void dt_accel_connect_slider_iop(dt_iop_module_t *module, const gchar *path, Gtk
module->accel_closures = g_slist_prepend(module->accel_closures, accel);
}
if(DT_IS_BAUHAUS_WIDGET(slider))
{
closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_decrease_callback), (gpointer)slider, NULL);
}
else
{
closure = g_cclosure_new(G_CALLBACK(slider_decrease_callback), (gpointer)slider, NULL);
}
closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_decrease_callback), (gpointer)slider, NULL);
accel = _lookup_accel(decrease_path);
......@@ -495,14 +429,7 @@ void dt_accel_connect_slider_iop(dt_iop_module_t *module, const gchar *path, Gtk
module->accel_closures = g_slist_prepend(module->accel_closures, accel);
}
if(DT_IS_BAUHAUS_WIDGET(slider))
{
closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_reset_callback), (gpointer)slider, NULL);
}
else
{
closure = g_cclosure_new(G_CALLBACK(slider_reset_callback), (gpointer)slider, NULL);
}
closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_reset_callback), (gpointer)slider, NULL);
accel = _lookup_accel(reset_path);
......@@ -518,14 +445,7 @@ void dt_accel_connect_slider_iop(dt_iop_module_t *module, const gchar *path, Gtk
module->accel_closures = g_slist_prepend(module->accel_closures, accel);
}
if(DT_IS_BAUHAUS_WIDGET(slider))
{
closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_edit_callback), (gpointer)slider, NULL);
}
else
{
closure = g_cclosure_new(G_CALLBACK(slider_edit_callback), (gpointer)slider, NULL);
}
closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_edit_callback), (gpointer)slider, NULL);
accel = _lookup_accel(edit_path);
......
......@@ -33,7 +33,6 @@
#include "common/imageio.h"
#include "common/colorspaces.h"
#include "control/conf.h"
#include "dtgtk/slider.h"
#include "common/imageio_format.h"
DT_MODULE(1)
......
......@@ -20,7 +20,6 @@
#endif
#include "common/darktable.h"
#include "develop/imageop.h"
#include "dtgtk/slider.h"
#include "gui/gtk.h"
#include <gtk/gtk.h>
#include <stdlib.h>
......
......@@ -23,7 +23,6 @@
#include "common/darktable.h"
#include "develop/imageop.h"
#include "dtgtk/label.h"
#include "dtgtk/slider.h"
#include "gui/gtk.h"
#include <gtk/gtk.h>
#include <stdlib.h>
......
......@@ -37,7 +37,6 @@
#include "gui/gtk.h"
#include "gui/presets.h"
#include "dtgtk/resetlabel.h"
#include "dtgtk/slider.h"
#include "bauhaus/bauhaus.h"
#include "develop/pixelpipe.h"
#include "common/histogram.h"
......
......@@ -29,7 +29,6 @@
#include "control/control.h"
#include "gui/accelerators.h"
#include "gui/gtk.h"
#include "dtgtk/slider.h"
DT_MODULE_INTROSPECTION(1, dt_iop_gamma_params_t)
......
......@@ -31,7 +31,6 @@
#include "control/control.h"
#include "dtgtk/label.h"
#include "dtgtk/resetlabel.h"
#include "dtgtk/slider.h"
#include "dtgtk/gradientslider.h"
#include "dtgtk/button.h"
#include "gui/accelerators.h"
......
......@@ -26,7 +26,6 @@
#include "develop/develop.h"
#include "develop/imageop.h"
#include "control/control.h"
#include "dtgtk/slider.h"
#include "dtgtk/button.h"
#include "dtgtk/togglebutton.h"
#include "dtgtk/resetlabel.h"
......
......@@ -33,7 +33,6 @@
#include "control/control.h"
#include "control/conf.h"
#include "dtgtk/togglebutton.h"
#include "dtgtk/slider.h"
#include "dtgtk/gradientslider.h"
#include "gui/gtk.h"
#include "gui/presets.h"
......
......@@ -27,7 +27,6 @@
#include "control/conf.h"
#include "control/signal.h"
#include "gui/gtk.h"
#include "dtgtk/slider.h"
#include "dtgtk/label.h"
#include "libs/lib.h"
#include "gui/accelerators.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment