color-slider.cpp revision b02b1fe4d1407fc43c0993eb3636dd704188d8af
/**
* @file
* A slider with colored background - implementation.
*/
/* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
*
* This code is in public domain
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "color-slider.h"
#include <gtkmm/adjustment.h>
#include "widgets/sp-color-scales.h"
#include "preferences.h"
namespace Inkscape {
namespace UI {
namespace Widget {
: _dragging(false)
, _adjustment(NULL)
, _value(0.0)
, _oldvalue(0.0)
, _mapsize(0)
{
_c0[0] = 0x00;
_cm[0] = 0xff;
_c0[0] = 0xff;
_b0 = 0x5f;
_b1 = 0xa0;
_bmask = 0x08;
}
ColorSlider::~ColorSlider() {
if (_adjustment) {
_adjustment = NULL;
}
}
void ColorSlider::on_realize() {
set_realized();
if(!_refGdkWindow)
{
#if !GTK_CHECK_VERSION(3,0,0)
#endif
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
style_attach();
}
}
void ColorSlider::on_unrealize() {
}
}
if (get_realized()) {
}
}
//TODO: if not GTK3
bool result = false;
if (get_is_drawable()) {
}
return result;
}
_dragging = true;
#if GTK_CHECK_VERSION(3,0,0)
_refGdkWindow->gobj(),
NULL,
#else
#endif
}
return false;
}
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
_dragging = false;
}
}
return false;
}
if (_dragging) {
}
return false;
}
if (!adjustment) {
} else {
}
if (_adjustment != adjustment) {
if (_adjustment) {
//if GTK2
}
_adjustment->reference();
}
}
void ColorSlider::on_adjustment_changed() {
queue_draw();
}
void ColorSlider::on_adjustment_value_changed() {
} else {
}
}
}
// Remove any map, if set
_map = 0;
queue_draw();
}
queue_draw();
}
queue_draw();
}
gboolean colorsOnTop = Inkscape::Preferences::get()->getBool("/options/workarounds/colorsontop", false);
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
// Draw shadow
if (colorsOnTop) {
#if GTK_CHECK_VERSION(3,0,0)
#else
0, 0,
#endif
}
/* Paintable part of color gradient area */
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
if (_map) {
/* Render map pixelstore */
gint s = 0;
_map, s, d,
}
} else {
/* Render gradient */
// part 1: from c0 to cm
for (gint i = 0; i < 4; i++) {
c[i] = _c0[i] << 16;
}
/* Draw pixelstore 1 */
}
}
// part 2: from cm to c1
for (gint i = 0; i < 4; i++) {
c[i] = _cm[i] << 16;
}
c, dc,
/* Draw pixelstore 2 */
}
}
}
/* Draw shadow */
if (!colorsOnTop) {
#if GTK_CHECK_VERSION(3,0,0)
#else
0, 0,
#endif
}
/* Draw arrow */
// Define top arrow
// Define bottom arrow
// Render both arrows
cr->stroke_preserve();
return false;
}
}//namespace Widget
}//namespace UI
}//namespace Inkscape
enum {
};
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
static void sp_color_slider_adjustment_value_changed (GtkAdjustment *adjustment, SPColorSlider *slider);
static GtkWidgetClass *parent_class;
sp_color_slider_get_type (void)
{
if (!type) {
sizeof (SPColorSliderClass),
sizeof (SPColorSlider),
0,
};
}
return type;
}
{
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
/* 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 */
}
{
if (slider->adjustment) {
g_signal_handlers_disconnect_matched (G_OBJECT (slider->adjustment), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, slider);
}
}
static void
{
attributes.x = allocation.x;
attributes.y = allocation.y;
#if !GTK_CHECK_VERSION(3,0,0)
#endif
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
#if !GTK_CHECK_VERSION(3,0,0)
// This doesn't do anything in GTK+ 3
#endif
}
static void
{
}
#if GTK_CHECK_VERSION(3,0,0)
static void sp_color_slider_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width)
{
}
static void sp_color_slider_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height)
{
}
#endif
static void
{
if (gtk_widget_get_realized (widget)) {
/* Resize GdkWindow */
allocation->x, allocation->y,
}
}
#if !GTK_CHECK_VERSION(3,0,0)
{
if (gtk_widget_is_drawable(widget)) {
}
return result;
}
#endif
static gint
{
#if GTK_CHECK_VERSION(3,0,0)
NULL,
#else
#endif
}
return FALSE;
}
static gint
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
if (slider->value != slider->oldvalue) g_signal_emit (G_OBJECT (slider), slider_signals[CHANGED], 0);
}
return FALSE;
}
static gint
{
}
return FALSE;
}
{
return GTK_WIDGET (slider);
}
{
if (!adjustment) {
} else {
}
if (slider->adjustment) {
g_signal_handlers_disconnect_matched (G_OBJECT (slider->adjustment), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, slider);
}
}
}
void
{
// Remove any map, if set
}
void
{
}
void
{
}
static void
{
}
static void
{
} else {
}
}
}
{
gboolean colorsOnTop = Inkscape::Preferences::get()->getBool("/options/workarounds/colorsontop", false);
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
// Draw shadow
if (colorsOnTop) {
#if GTK_CHECK_VERSION(3,0,0)
cr,
0, 0,
#else
0, 0,
#endif
}
/* Paintable part of color gradient area */
#if GTK_CHECK_VERSION(3,0,0)
&padding);
#else
#endif
/* Render map pixelstore */
gint s = 0;
}
} else {
/* Render gradient */
// part 1: from c0 to cm
for (gint i = 0; i < 4; i++) {
}
/* Draw pixelstore 1 */
}
}
// part 2: from cm to c1
for (gint i = 0; i < 4; i++) {
}
c, dc,
/* Draw pixelstore 2 */
}
}
}
/* Draw shadow */
if (!colorsOnTop) {
#if GTK_CHECK_VERSION(3,0,0)
cr,
0, 0,
#else
0, 0,
#endif
}
/* Draw arrow */
// Define top arrow
// Define bottom arrow
// Render both arrows
cairo_fill(cr);
return FALSE;
}
/* 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) {
}
/* Background value */
d += 3 * width;
}
dp += 3;
}
return buf;
}