mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 05:31:07 +00:00
Remove GtkGammaCurve completely
This commit is contained in:
parent
a86b5ad47b
commit
d97ca04f5b
@ -1137,8 +1137,7 @@ myapp --display=:1
|
||||
| | | +GtkCombo
|
||||
| | | `GtkStatusbar
|
||||
| | `GtkVBox
|
||||
| | +GtkColorSelection
|
||||
| | `GtkGammaCurve
|
||||
| | `GtkColorSelection
|
||||
| +GtkButton
|
||||
| | +GtkOptionMenu
|
||||
| | `GtkToggleButton
|
||||
|
@ -1762,22 +1762,6 @@ GTK_FRAME_GET_CLASS
|
||||
gtk_frame_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgamma</FILE>
|
||||
<TITLE>GtkGammaCurve</TITLE>
|
||||
GtkGammaCurve
|
||||
gtk_gamma_curve_new
|
||||
<SUBSECTION Standard>
|
||||
GTK_GAMMA_CURVE
|
||||
GTK_IS_GAMMA_CURVE
|
||||
GTK_TYPE_GAMMA_CURVE
|
||||
GTK_GAMMA_CURVE_CLASS
|
||||
GTK_IS_GAMMA_CURVE_CLASS
|
||||
GTK_GAMMA_CURVE_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_gamma_curve_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkhandlebox</FILE>
|
||||
<TITLE>GtkHandleBox</TITLE>
|
||||
|
@ -66,7 +66,6 @@ gtk_font_button_get_type
|
||||
gtk_font_selection_dialog_get_type
|
||||
gtk_font_selection_get_type
|
||||
gtk_frame_get_type
|
||||
gtk_gamma_curve_get_type
|
||||
gtk_handle_box_get_type
|
||||
gtk_hbox_get_type
|
||||
gtk_hbutton_box_get_type
|
||||
|
@ -85,7 +85,6 @@
|
||||
<link linkend="GtkPixmap">GtkPixmap</link>
|
||||
<link linkend="GtkPreview">GtkPreview</link>
|
||||
<link linkend="GtkCurve">GtkCurve</link>
|
||||
<link linkend="GtkGammaCurve">GtkGammaCurve</link>
|
||||
|
||||
<emphasis>Misc. Widgets</emphasis>
|
||||
<link linkend="GtkArrow">GtkArrow</link>
|
||||
|
@ -22,16 +22,6 @@ As of GTK+ 2.20, #GtkCurve has been deprecated since it is too specialized.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>#GtkGammaCurve</term>
|
||||
<listitem><para>a subclass for editing gamma curves.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkGammaCurve
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A subclass of GtkCurve for editing gamma curves
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkGammaCurve widget is a variant of #GtkCurve specifically for
|
||||
editing gamma curves, which are used in graphics applications such as the
|
||||
Gimp.
|
||||
</para>
|
||||
<para>
|
||||
The #GtkGammaCurve widget shows a curve which the user can edit with the
|
||||
mouse just like a #GtkCurve widget. On the right of the curve it also displays
|
||||
5 buttons, 3 of which change between the 3 curve modes (spline, linear and
|
||||
free), and the other 2 set the curve to a particular gamma value, or reset it
|
||||
to a straight line.
|
||||
</para>
|
||||
<para>
|
||||
As of GTK+ 2.20, #GtkGammaCurve has been deprecated since it is too specialized.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkGammaCurve ##### -->
|
||||
<para>
|
||||
The #GtkGammaCurve struct contains private data only, and
|
||||
should be accessed using the functions below.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_gamma_curve_new ##### -->
|
||||
<para>
|
||||
Creates a new #GtkGammaCurve.
|
||||
</para>
|
||||
|
||||
@Returns: a new #GtkGammaCurve.
|
||||
@Deprecated: 2.20: Don't use this widget anymore.
|
||||
|
||||
|
@ -2001,8 +2001,7 @@ GObject
|
||||
| | | | `GtkVButtonBox
|
||||
| | | +GtkVBox
|
||||
| | | | +GtkColorSelection
|
||||
| | | | +GtkFontSelection
|
||||
| | | | `GtkGammaCurve
|
||||
| | | | `GtkFontSelection
|
||||
| | | `GtkHBox
|
||||
| | | +GtkCombo
|
||||
| | | `GtkStatusbar
|
||||
|
@ -1520,15 +1520,6 @@ gtk_frame_set_shadow_type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_GAMMA_CURVE_H__)
|
||||
#if IN_FILE(__GTK_GAMMA_CURVE_C__)
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
gtk_gamma_curve_get_type G_GNUC_CONST
|
||||
gtk_gamma_curve_new
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_GC_H__)
|
||||
#if IN_FILE(__GTK_GC_C__)
|
||||
gtk_gc_get
|
||||
|
494
gtk/gtkgamma.c
494
gtk/gtkgamma.c
@ -1,494 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1997 David Mosberger
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixdata.h>
|
||||
|
||||
#include "gtkgamma.h"
|
||||
#include "gtkcurve.h"
|
||||
#include "gtkdialog.h"
|
||||
#include "gtkdrawingarea.h"
|
||||
#include "gtkentry.h"
|
||||
#include "gtkhbox.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkradiobutton.h"
|
||||
#include "gtkstock.h"
|
||||
#include "gtktable.h"
|
||||
#include "gtkvbox.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
/* forward declarations: */
|
||||
static void gtk_gamma_curve_destroy (GtkObject *object);
|
||||
|
||||
static void curve_type_changed_callback (GtkWidget *w, gpointer data);
|
||||
static void button_realize_callback (GtkWidget *w);
|
||||
static void button_toggled_callback (GtkWidget *w, gpointer data);
|
||||
static void button_clicked_callback (GtkWidget *w, gpointer data);
|
||||
|
||||
enum
|
||||
{
|
||||
LINEAR = 0,
|
||||
SPLINE,
|
||||
FREE,
|
||||
GAMMA,
|
||||
RESET,
|
||||
NUM_XPMS
|
||||
};
|
||||
|
||||
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
#pragma align 4 (spline_pixdata)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
static const guint8 spline_pixdata[] __attribute__ ((__aligned__ (4))) =
|
||||
#else
|
||||
static const guint8 spline_pixdata[] =
|
||||
#endif
|
||||
{ ""
|
||||
/* Pixbuf magic (0x47646b50) */
|
||||
"GdkP"
|
||||
/* length: header (24) + pixel_data (182) */
|
||||
"\0\0\0\316"
|
||||
/* pixdata_type (0x2010002) */
|
||||
"\2\1\0\2"
|
||||
/* rowstride (64) */
|
||||
"\0\0\0@"
|
||||
/* width (16) */
|
||||
"\0\0\0\20"
|
||||
/* height (16) */
|
||||
"\0\0\0\20"
|
||||
/* pixel_data: */
|
||||
"\216\0\0\0\0\202\0\0\0\377\211\0\0\0\0\206\377\0\0\377\1\0\0\0\377\207"
|
||||
"\0\0\0\0\202\377\0\0\377\214\0\0\0\0\2\0\0\0\377\274--\377\215\0\0\0"
|
||||
"\0\203\0\0\0\377\215\0\0\0\0\2\274--\377\0\0\0\377\216\0\0\0\0\1\377"
|
||||
"\0\0\377\216\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\216\0\0"
|
||||
"\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377"
|
||||
"\217\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\216\0\0\0\0\2\0"
|
||||
"\0\0\377\274--\377\216\0\0\0\0\202\0\0\0\377\216\0\0\0\0"};
|
||||
|
||||
|
||||
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
#pragma align 4 (linear_pixdata)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
static const guint8 linear_pixdata[] __attribute__ ((__aligned__ (4))) =
|
||||
#else
|
||||
static const guint8 linear_pixdata[] =
|
||||
#endif
|
||||
{ ""
|
||||
/* Pixbuf magic (0x47646b50) */
|
||||
"GdkP"
|
||||
/* length: header (24) + pixel_data (323) */
|
||||
"\0\0\1["
|
||||
/* pixdata_type (0x2010002) */
|
||||
"\2\1\0\2"
|
||||
/* rowstride (64) */
|
||||
"\0\0\0@"
|
||||
/* width (16) */
|
||||
"\0\0\0\20"
|
||||
/* height (16) */
|
||||
"\0\0\0\20"
|
||||
/* pixel_data: */
|
||||
"\216\0\0\0\0\202\0\0\0\377\216\0\0\0\0\2\202AA\377\0\0\0\377\216\0\0"
|
||||
"\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377"
|
||||
"\206\0\0\0\0\3\177\177\177\377\0\0\0\377\177\177\177\377\205\0\0\0\0"
|
||||
"\1\377\0\0\377\207\0\0\0\0\203\0\0\0\377\205\0\0\0\0\1\377\0\0\377\207"
|
||||
"\0\0\0\0\3\202AA\377\0\0\0\377\202AA\377\204\0\0\0\0\1\377\0\0\377\210"
|
||||
"\0\0\0\0\3\377\0\0\377\0\0\0\0\377\0\0\377\204\0\0\0\0\1\377\0\0\377"
|
||||
"\207\0\0\0\0\1\377\0\0\377\203\0\0\0\0\1\377\0\0\377\202\0\0\0\0\1\377"
|
||||
"\0\0\377\210\0\0\0\0\1\377\0\0\377\203\0\0\0\0\1\377\0\0\377\202\0\0"
|
||||
"\0\0\1\377\0\0\377\207\0\0\0\0\1\377\0\0\377\205\0\0\0\0\3\377\0\0\377"
|
||||
"\0\0\0\377\202AA\377\207\0\0\0\0\1\377\0\0\377\205\0\0\0\0\203\0\0\0"
|
||||
"\377\206\0\0\0\0\1\377\0\0\377\206\0\0\0\0\3\177\177\177\377\0\0\0\377"
|
||||
"\177\177\177\377\205\0\0\0\0\2\0\0\0\377\202AA\377\216\0\0\0\0\202\0"
|
||||
"\0\0\377\216\0\0\0\0"};
|
||||
|
||||
|
||||
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
#pragma align 4 (free_pixdata)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
static const guint8 free_pixdata[] __attribute__ ((__aligned__ (4))) =
|
||||
#else
|
||||
static const guint8 free_pixdata[] =
|
||||
#endif
|
||||
{ ""
|
||||
/* Pixbuf magic (0x47646b50) */
|
||||
"GdkP"
|
||||
/* length: header (24) + pixel_data (204) */
|
||||
"\0\0\0\344"
|
||||
/* pixdata_type (0x2010002) */
|
||||
"\2\1\0\2"
|
||||
/* rowstride (64) */
|
||||
"\0\0\0@"
|
||||
/* width (16) */
|
||||
"\0\0\0\20"
|
||||
/* height (16) */
|
||||
"\0\0\0\20"
|
||||
/* pixel_data: */
|
||||
"\246\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\220\0\0\0\0\1\377"
|
||||
"\0\0\377\217\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\220\0\0"
|
||||
"\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377\217\0\0\0\0\1\377\0\0\377"
|
||||
"\214\0\0\0\0\1\377\0\0\377\203\0\0\0\0\2\377\0\0\377\0\0\0\0\205\377"
|
||||
"\0\0\377\204\0\0\0\0\1\377\0\0\377\204\0\0\0\0\1\377\0\0\377\211\0\0"
|
||||
"\0\0\1\377\0\0\377\205\0\0\0\0\1\377\0\0\377\210\0\0\0\0\1\377\0\0\377"
|
||||
"\207\0\0\0\0\1\377\0\0\377\206\0\0\0\0\1\377\0\0\377\210\0\0\0\0\1\377"
|
||||
"\0\0\377\205\0\0\0\0\1\377\0\0\377\217\0\0\0\0"};
|
||||
|
||||
|
||||
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
#pragma align 4 (gamma_pixdata)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
static const guint8 gamma_pixdata[] __attribute__ ((__aligned__ (4))) =
|
||||
#else
|
||||
static const guint8 gamma_pixdata[] =
|
||||
#endif
|
||||
{ ""
|
||||
/* Pixbuf magic (0x47646b50) */
|
||||
"GdkP"
|
||||
/* length: header (24) + pixel_data (218) */
|
||||
"\0\0\0\362"
|
||||
/* pixdata_type (0x2010002) */
|
||||
"\2\1\0\2"
|
||||
/* rowstride (64) */
|
||||
"\0\0\0@"
|
||||
/* width (16) */
|
||||
"\0\0\0\20"
|
||||
/* height (16) */
|
||||
"\0\0\0\20"
|
||||
/* pixel_data: */
|
||||
"\264\0\0\0\0\2\0\0\0\377^^^\377\202\0\0\0\0\3\214\214\214\377\0\0\0\377"
|
||||
"\214\214\214\377\211\0\0\0\0\7FFF\377\27\27\27\377\273\273\273\377\0"
|
||||
"\0\0\0uuu\377\27\27\27\377\244\244\244\377\212\0\0\0\0\3uuu\377\214\214"
|
||||
"\214\377\0\0\0\0\202FFF\377\214\0\0\0\0\4\0\0\0\377\0\0\0\0\0\0\0\377"
|
||||
"\214\214\214\377\214\0\0\0\0\3FFF\377\0\0\0\0FFF\377\215\0\0\0\0\3FF"
|
||||
"F\377\27\27\27\377\214\214\214\377\215\0\0\0\0\2\244\244\244\377\0\0"
|
||||
"\0\377\216\0\0\0\0\2uuu\377^^^\377\216\0\0\0\0\2///\377\0\0\0\377\216"
|
||||
"\0\0\0\0\202\0\0\0\377\216\0\0\0\0\2\0\0\0\377///\377\250\0\0\0\0"};
|
||||
|
||||
|
||||
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
#pragma align 4 (reset_pixdata)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
static const guint8 reset_pixdata[] __attribute__ ((__aligned__ (4))) =
|
||||
#else
|
||||
static const guint8 reset_pixdata[] =
|
||||
#endif
|
||||
{ ""
|
||||
/* Pixbuf magic (0x47646b50) */
|
||||
"GdkP"
|
||||
/* length: header (24) + pixel_data (173) */
|
||||
"\0\0\0\305"
|
||||
/* pixdata_type (0x2010002) */
|
||||
"\2\1\0\2"
|
||||
/* rowstride (64) */
|
||||
"\0\0\0@"
|
||||
/* width (16) */
|
||||
"\0\0\0\20"
|
||||
/* height (16) */
|
||||
"\0\0\0\20"
|
||||
/* pixel_data: */
|
||||
"\216\0\0\0\0\202\0\0\0\377\216\0\0\0\0\2\202AA\377\0\0\0\377\215\0\0"
|
||||
"\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377"
|
||||
"\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377"
|
||||
"\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0"
|
||||
"\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377\216\0\0\0\0\1\377\0\0\377"
|
||||
"\216\0\0\0\0\1\377\0\0\377\215\0\0\0\0\2\0\0\0\377\202AA\377\216\0\0"
|
||||
"\0\0\202\0\0\0\377\216\0\0\0\0"};
|
||||
|
||||
G_DEFINE_TYPE (GtkGammaCurve, gtk_gamma_curve, GTK_TYPE_VBOX)
|
||||
|
||||
static void
|
||||
gtk_gamma_curve_class_init (GtkGammaCurveClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
object_class->destroy = gtk_gamma_curve_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_gamma_curve_init (GtkGammaCurve *curve)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
int i;
|
||||
|
||||
curve->gamma = 1.0;
|
||||
|
||||
curve->table = gtk_table_new (1, 2, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (curve->table), 3);
|
||||
gtk_container_add (GTK_CONTAINER (curve), curve->table);
|
||||
|
||||
curve->curve = gtk_curve_new ();
|
||||
g_signal_connect (curve->curve, "curve-type-changed",
|
||||
G_CALLBACK (curve_type_changed_callback), curve);
|
||||
gtk_table_attach_defaults (GTK_TABLE (curve->table), curve->curve, 0, 1, 0, 1);
|
||||
|
||||
vbox = gtk_vbox_new (/* homogeneous */ FALSE, /* spacing */ 3);
|
||||
gtk_table_attach (GTK_TABLE (curve->table), vbox, 1, 2, 0, 1, 0, 0, 0, 0);
|
||||
|
||||
/* toggle buttons: */
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
curve->button[i] = gtk_toggle_button_new ();
|
||||
g_object_set_data (G_OBJECT (curve->button[i]), I_("_GtkGammaCurveIndex"),
|
||||
GINT_TO_POINTER (i));
|
||||
gtk_container_add (GTK_CONTAINER (vbox), curve->button[i]);
|
||||
g_signal_connect (curve->button[i], "realize",
|
||||
G_CALLBACK (button_realize_callback), NULL);
|
||||
g_signal_connect (curve->button[i], "toggled",
|
||||
G_CALLBACK (button_toggled_callback), curve);
|
||||
gtk_widget_show (curve->button[i]);
|
||||
}
|
||||
|
||||
/* push buttons: */
|
||||
for (i = 3; i < 5; ++i)
|
||||
{
|
||||
curve->button[i] = gtk_button_new ();
|
||||
g_object_set_data (G_OBJECT (curve->button[i]), I_("_GtkGammaCurveIndex"),
|
||||
GINT_TO_POINTER (i));
|
||||
gtk_container_add (GTK_CONTAINER (vbox), curve->button[i]);
|
||||
g_signal_connect (curve->button[i], "realize",
|
||||
G_CALLBACK (button_realize_callback), NULL);
|
||||
g_signal_connect (curve->button[i], "clicked",
|
||||
G_CALLBACK (button_clicked_callback), curve);
|
||||
gtk_widget_show (curve->button[i]);
|
||||
}
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (curve->table);
|
||||
gtk_widget_show (curve->curve);
|
||||
}
|
||||
|
||||
static void
|
||||
button_realize_callback (GtkWidget *w)
|
||||
{
|
||||
GtkWidget *image;
|
||||
struct {
|
||||
const guint8 *stream;
|
||||
gint length;
|
||||
} streams[5] = {
|
||||
{ linear_pixdata, sizeof (linear_pixdata) },
|
||||
{ spline_pixdata, sizeof (spline_pixdata) },
|
||||
{ free_pixdata, sizeof (free_pixdata) },
|
||||
{ gamma_pixdata, sizeof (gamma_pixdata) },
|
||||
{ reset_pixdata, sizeof (reset_pixdata) }
|
||||
};
|
||||
GdkPixdata pixdata;
|
||||
GdkPixbuf *pixbuf;
|
||||
int i;
|
||||
|
||||
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (w), "_GtkGammaCurveIndex"));
|
||||
gdk_pixdata_deserialize (&pixdata, streams[i].length, streams[i].stream, NULL);
|
||||
pixbuf = gdk_pixbuf_from_pixdata (&pixdata, TRUE, NULL);
|
||||
image = gtk_image_new_from_pixbuf (pixbuf);
|
||||
gtk_container_add (GTK_CONTAINER (w), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
button_toggled_callback (GtkWidget *w, gpointer data)
|
||||
{
|
||||
GtkGammaCurve *c = data;
|
||||
GtkCurveType type;
|
||||
int active, i;
|
||||
|
||||
if (!GTK_TOGGLE_BUTTON (w)->active)
|
||||
return;
|
||||
|
||||
active = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (w), "_GtkGammaCurveIndex"));
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
if ((i != active) && GTK_TOGGLE_BUTTON (c->button[i])->active)
|
||||
break;
|
||||
|
||||
if (i < 3)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c->button[i]), FALSE);
|
||||
|
||||
switch (active)
|
||||
{
|
||||
case 0: type = GTK_CURVE_TYPE_SPLINE; break;
|
||||
case 1: type = GTK_CURVE_TYPE_LINEAR; break;
|
||||
default: type = GTK_CURVE_TYPE_FREE; break;
|
||||
}
|
||||
gtk_curve_set_curve_type (GTK_CURVE (c->curve), type);
|
||||
}
|
||||
|
||||
static void
|
||||
gamma_cancel_callback (GtkWidget *w, gpointer data)
|
||||
{
|
||||
GtkGammaCurve *c = data;
|
||||
|
||||
gtk_widget_destroy (c->gamma_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
gamma_ok_callback (GtkWidget *w, gpointer data)
|
||||
{
|
||||
GtkGammaCurve *c = data;
|
||||
const gchar *start;
|
||||
gchar *end;
|
||||
gfloat v;
|
||||
|
||||
start = gtk_entry_get_text (GTK_ENTRY (c->gamma_text));
|
||||
if (start)
|
||||
{
|
||||
v = g_strtod (start, &end);
|
||||
if (end > start && v > 0.0)
|
||||
c->gamma = v;
|
||||
}
|
||||
gtk_curve_set_gamma (GTK_CURVE (c->curve), c->gamma);
|
||||
gamma_cancel_callback (w, data);
|
||||
}
|
||||
|
||||
static void
|
||||
button_clicked_callback (GtkWidget *w, gpointer data)
|
||||
{
|
||||
GtkGammaCurve *c = data;
|
||||
int active;
|
||||
|
||||
active = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (w), "_GtkGammaCurveIndex"));
|
||||
if (active == 3)
|
||||
{
|
||||
/* set gamma */
|
||||
if (c->gamma_dialog)
|
||||
return;
|
||||
else
|
||||
{
|
||||
GtkWidget *vbox, *hbox, *label, *button;
|
||||
gchar buf[64];
|
||||
|
||||
c->gamma_dialog = gtk_dialog_new ();
|
||||
gtk_window_set_screen (GTK_WINDOW (c->gamma_dialog),
|
||||
gtk_widget_get_screen (w));
|
||||
gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), _("Gamma"));
|
||||
g_object_add_weak_pointer (G_OBJECT (c->gamma_dialog),
|
||||
(gpointer *)&c->gamma_dialog);
|
||||
|
||||
vbox = GTK_DIALOG (c->gamma_dialog)->vbox;
|
||||
|
||||
hbox = gtk_hbox_new (/* homogeneous */ FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Gamma value"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
|
||||
gtk_widget_show (label);
|
||||
|
||||
sprintf (buf, "%g", c->gamma);
|
||||
c->gamma_text = gtk_entry_new ();
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), c->gamma_text);
|
||||
gtk_entry_set_text (GTK_ENTRY (c->gamma_text), buf);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), c->gamma_text, TRUE, TRUE, 2);
|
||||
gtk_widget_show (c->gamma_text);
|
||||
|
||||
/* fill in action area: */
|
||||
hbox = GTK_DIALOG (c->gamma_dialog)->action_area;
|
||||
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gamma_cancel_callback), c);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_OK);
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gamma_ok_callback), c);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (c->gamma_dialog);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* reset */
|
||||
gtk_curve_reset (GTK_CURVE (c->curve));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
curve_type_changed_callback (GtkWidget *w, gpointer data)
|
||||
{
|
||||
GtkGammaCurve *c = data;
|
||||
GtkCurveType new_type;
|
||||
int active;
|
||||
|
||||
new_type = GTK_CURVE (w)->curve_type;
|
||||
switch (new_type)
|
||||
{
|
||||
case GTK_CURVE_TYPE_SPLINE: active = 0; break;
|
||||
case GTK_CURVE_TYPE_LINEAR: active = 1; break;
|
||||
default: active = 2; break;
|
||||
}
|
||||
if (!GTK_TOGGLE_BUTTON (c->button[active])->active)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c->button[active]), TRUE);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_gamma_curve_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_GAMMA_CURVE, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_gamma_curve_destroy (GtkObject *object)
|
||||
{
|
||||
GtkGammaCurve *c = GTK_GAMMA_CURVE (object);
|
||||
|
||||
if (c->gamma_dialog)
|
||||
gtk_widget_destroy (c->gamma_dialog);
|
||||
|
||||
GTK_OBJECT_CLASS (gtk_gamma_curve_parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
#define __GTK_GAMMA_CURVE_C__
|
||||
#include "gtkaliasdef.c"
|
@ -1,82 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1997 David Mosberger
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
||||
#ifndef __GTK_GAMMA_CURVE_H__
|
||||
#define __GTK_GAMMA_CURVE_H__
|
||||
|
||||
|
||||
#include <gtk/gtkvbox.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_GAMMA_CURVE (gtk_gamma_curve_get_type ())
|
||||
#define GTK_GAMMA_CURVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GAMMA_CURVE, GtkGammaCurve))
|
||||
#define GTK_GAMMA_CURVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_GAMMA_CURVE, GtkGammaCurveClass))
|
||||
#define GTK_IS_GAMMA_CURVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_GAMMA_CURVE))
|
||||
#define GTK_IS_GAMMA_CURVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GAMMA_CURVE))
|
||||
#define GTK_GAMMA_CURVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_GAMMA_CURVE, GtkGammaCurveClass))
|
||||
|
||||
typedef struct _GtkGammaCurve GtkGammaCurve;
|
||||
typedef struct _GtkGammaCurveClass GtkGammaCurveClass;
|
||||
|
||||
|
||||
struct _GtkGammaCurve
|
||||
{
|
||||
GtkVBox vbox;
|
||||
|
||||
GtkWidget *GSEAL (table);
|
||||
GtkWidget *GSEAL (curve);
|
||||
GtkWidget *GSEAL (button[5]); /* spline, linear, free, gamma, reset */
|
||||
|
||||
gfloat GSEAL (gamma);
|
||||
GtkWidget *GSEAL (gamma_dialog);
|
||||
GtkWidget *GSEAL (gamma_text);
|
||||
};
|
||||
|
||||
struct _GtkGammaCurveClass
|
||||
{
|
||||
GtkVBoxClass parent_class;
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
void (*_gtk_reserved3) (void);
|
||||
void (*_gtk_reserved4) (void);
|
||||
};
|
||||
|
||||
|
||||
GType gtk_gamma_curve_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget* gtk_gamma_curve_new (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_GAMMA_CURVE_H__ */
|
||||
|
||||
#endif /* GTK_DISABLE_DEPRECATED */
|
@ -10830,56 +10830,6 @@ create_selection_test (GtkWidget *widget)
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
/*
|
||||
* Gamma Curve
|
||||
*/
|
||||
|
||||
void
|
||||
create_gamma_curve (GtkWidget *widget)
|
||||
{
|
||||
static GtkWidget *window = NULL, *curve;
|
||||
static int count = 0;
|
||||
gfloat vec[256];
|
||||
gint max;
|
||||
gint i;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (widget));
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "test");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK(gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
curve = gtk_gamma_curve_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), curve);
|
||||
gtk_widget_show (curve);
|
||||
}
|
||||
|
||||
max = 127 + (count % 2)*128;
|
||||
gtk_curve_set_range (GTK_CURVE (GTK_GAMMA_CURVE (curve)->curve),
|
||||
0, max, 0, max);
|
||||
for (i = 0; i < max; ++i)
|
||||
vec[i] = (127 / sqrt (max)) * sqrt (i);
|
||||
gtk_curve_set_vector (GTK_CURVE (GTK_GAMMA_CURVE (curve)->curve),
|
||||
max, vec);
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else if (count % 4 == 3)
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test scrolling
|
||||
*/
|
||||
@ -11761,7 +11711,6 @@ struct {
|
||||
{ "flipping", create_flipping },
|
||||
{ "focus", create_focus },
|
||||
{ "font selection", create_font_selection },
|
||||
{ "gamma curve", create_gamma_curve, TRUE },
|
||||
{ "gridded geometry", create_gridded_geometry },
|
||||
{ "handle box", create_handle_box },
|
||||
{ "image from drawable", create_get_image },
|
||||
|
Loading…
Reference in New Issue
Block a user