sp-color-slider.cpp revision 372e1a0de671b9304f69cb6f12b9a4ad810d9e68
#define __SP_COLOR_SLIDER_C__
/*
* A slider with colored background
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
*
* This code is in public domain
*/
#include <gtk/gtkversion.h>
#include <gtk/gtksignal.h>
#include "sp-color-scales.h"
#include "preferences.h"
#define SLIDER_WIDTH 96
#define SLIDER_HEIGHT 8
#define ARROW_SIZE 7
enum {
};
/* static void sp_color_slider_draw (GtkWidget *widget, GdkRectangle *area); */
/* static void sp_color_slider_draw_focus (GtkWidget *widget); */
/* static void sp_color_slider_draw_default (GtkWidget *widget); */
static void sp_color_slider_adjustment_value_changed (GtkAdjustment *adjustment, SPColorSlider *slider);
static GtkWidgetClass *parent_class;
sp_color_slider_get_type (void)
{
//TODO: switch to GObject
// GtkType and such calls were deprecated a while back with the
// introduction of GObject as a separate layer, with GType instead. --JonCruz
if (!type) {
GtkTypeInfo info = {
(gchar*) "SPColorSlider",
sizeof (SPColorSlider),
sizeof (SPColorSliderClass),
};
}
return type;
}
static void
{
GTK_TYPE_NONE, 0);
GTK_TYPE_NONE, 0);
GTK_TYPE_NONE, 0);
GTK_TYPE_NONE, 0);
/* widget_class->draw = sp_color_slider_draw; */
/* widget_class->draw_focus = sp_color_slider_draw_focus; */
/* widget_class->draw_default = sp_color_slider_draw_default; */
}
static void
{
/* We are widget with window */
}
static void
{
if (slider->adjustment) {
}
}
static void
{
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
}
static void
{
}
static void
{
if (GTK_WIDGET_REALIZED (widget)) {
/* Resize GdkWindow */
gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height);
}
}
static gint
{
if (GTK_WIDGET_DRAWABLE (widget)) {
}
return FALSE;
}
static gint
{
}
return FALSE;
}
static gint
{
if (slider->value != slider->oldvalue) gtk_signal_emit (GTK_OBJECT (slider), slider_signals[CHANGED]);
}
return FALSE;
}
static gint
{
}
return FALSE;
}
{
return GTK_WIDGET (slider);
}
void
{
if (!adjustment) {
}
else {
}
#endif
if (slider->adjustment) {
}
}
}
void
{
// Remove any map, if set
}
void
{
}
void
{
}
static void
{
}
static void
{
} else {
}
}
}
static void
{
const guchar *b;
gboolean colorsOnTop = Inkscape::Preferences::get()->getBool("/options/workarounds/colorsontop", false);
/* Widget area */
warea.x = 0;
warea.y = 0;
/* Color gradient area */
/* Arrow area */
/* Actual paintable area */
return;
}
b = NULL;
// Draw shadow
if (colorsOnTop) {
0, 0,
}
/* Paintable part of color gradient area */
gint s, d;
/* Render map pixelstore */
b = sp_color_slider_render_map (cpaint.x - carea.x, cpaint.y - carea.y, cpaint.width, cpaint.height,
if (b != NULL) {
}
} else {
gint i;
/* Render gradient */
// part 1: from c0 to cm
for (i = 0; i < 4; i++) {
}
c, dc,
/* Draw pixelstore */
if (b != NULL) {
}
}
// part 2: from cm to c1
for (i = 0; i < 4; i++) {
}
b = sp_color_slider_render_gradient (MAX(cpaint.x - carea.x, carea.width/2), cpaint.y - carea.y, wi, cpaint.height,
c, dc,
/* Draw pixelstore */
if (b != NULL) {
}
}
}
}
/* Draw shadow */
if (!colorsOnTop) {
0, 0,
}
/* Draw arrow */
x = aarea.x;
while ( w > 0 )
{
w -=2;
x++;
if ( w > 0 )
{
}
y1++;
y2--;
}
}
}
/* Colors are << 16 */
static const guchar *
{
gint x, y;
guint r, g, b, a;
}
if (!buf) {
}
r = c[0];
g = c[1];
b = c[2];
a = c[3];
guchar *d;
cr = r >> 16;
cg = g >> 16;
cb = b >> 16;
ca = a >> 16;
d = dp;
/* Background value */
d += 3 * width;
}
r += dc[0];
g += dc[1];
b += dc[2];
a += dc[3];
dp += 3;
}
return buf;
}
/* Positions are << 16 */
static const guchar *
{
gint x, y;
}
if (!buf) {
}
guchar *d;
d = dp;
/* Background value */
d += 3 * width;
}
dp += 3;
}
return buf;
}