mate-desktop 1.29.2
Library with common API for various MATE modules
Loading...
Searching...
No Matches
mate-colorsel.c File Reference
View source
#include "config.h"
#include "private.h"
#include <math.h>
#include <string.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include "mate-colorsel.h"
#include "mate-hsv.h"
Include dependency graph for mate-colorsel.c:

Data Structures

struct  _MateColorSelectionPrivate
 

Macros

#define DEFAULT_COLOR_PALETTE   "#ef2929:#fcaf3e:#fce94f:#8ae234:#729fcf:#ad7fa8:#e9b96e:#888a85:#eeeeec:#cc0000:#f57900:#edd400:#73d216:#3465a4:#75507b:#c17d11:#555753:#d3d7cf:#a40000:#ce5c00:#c4a000:#4e9a06:#204a87:#5c3566:#8f5902:#2e3436:#babdb6:#000000:#2e3436:#555753:#888a85:#babdb6:#d3d7cf:#eeeeec:#f3f3f3:#ffffff"
 
#define GTK_CUSTOM_PALETTE_WIDTH   9
 
#define GTK_CUSTOM_PALETTE_HEIGHT   4
 
#define SIZE_OF_COLOR_PALETTE   (GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT * 8)
 
#define CUSTOM_PALETTE_ENTRY_WIDTH   20
 
#define CUSTOM_PALETTE_ENTRY_HEIGHT   20
 
#define DROPPER_WIDTH   16
 
#define DROPPER_HEIGHT   16
 
#define DROPPER_STRIDE   64
 
#define DROPPER_X_HOT   2
 
#define DROPPER_Y_HOT   16
 
#define CHECK_SIZE   16
 
#define BIG_STEP   20
 
#define SCALE(i)   (i / 65535.)
 
#define UNSCALE(d)   ((guint16)(d * 65535 + 0.5))
 
#define INTENSITY(r, g, b)   ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
 

Enumerations

enum  { COLOR_CHANGED , LAST_SIGNAL }
 
enum  {
  PROP_0 , PROP_HAS_PALETTE , PROP_HAS_OPACITY_CONTROL , PROP_CURRENT_RGBA ,
  PROP_CURRENT_ALPHA , PROP_HEX_STRING
}
 
enum  {
  COLORSEL_RED = 0 , COLORSEL_GREEN = 1 , COLORSEL_BLUE = 2 , COLORSEL_OPACITY = 3 ,
  COLORSEL_HUE , COLORSEL_SATURATION , COLORSEL_VALUE , COLORSEL_NUM_CHANNELS
}
 

Functions

static void mate_color_selection_dispose (GObject *object)
 
static void mate_color_selection_finalize (GObject *object)
 
static void update_color (MateColorSelection *colorsel)
 
static void mate_color_selection_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 
static void mate_color_selection_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 
static void mate_color_selection_realize (GtkWidget *widget)
 
static void mate_color_selection_unrealize (GtkWidget *widget)
 
static void mate_color_selection_show_all (GtkWidget *widget)
 
static gboolean mate_color_selection_grab_broken (GtkWidget *widget, GdkEventGrabBroken *event)
 
static void mate_color_selection_set_palette_color (MateColorSelection *colorsel, gint index, GdkRGBA *color)
 mate_color_selection_set_palette_color: @colorsel: a MateColorSelection.
 
static void default_noscreen_change_palette_func (const GdkRGBA *colors, gint n_colors)
 
static void default_change_palette_func (GdkScreen *screen, const GdkRGBA *colors, gint n_colors)
 
static void make_control_relations (AtkObject *atk_obj, GtkWidget *widget)
 
static void make_all_relations (AtkObject *atk_obj, MateColorSelectionPrivate *priv)
 
static void hsv_changed (GtkWidget *hsv, gpointer data)
 
static void get_screen_color (GtkWidget *button)
 
static void adjustment_changed (GtkAdjustment *adjustment, gpointer data)
 
static void opacity_entry_changed (GtkWidget *opacity_entry, gpointer data)
 
static void hex_changed (GtkWidget *hex_entry, gpointer data)
 
static gboolean hex_focus_out (GtkWidget *hex_entry, GdkEventFocus *event, gpointer data)
 
static void color_sample_new (MateColorSelection *colorsel)
 
static void make_label_spinbutton (MateColorSelection *colorsel, GtkWidget **spinbutton, gchar *text, GtkWidget *grid, gint i, gint j, gint channel_type, const gchar *tooltip)
 
static void make_palette_frame (MateColorSelection *colorsel, GtkWidget *grid, gint i, gint j)
 
static void set_selected_palette (MateColorSelection *colorsel, int x, int y)
 
static void set_focus_line_attributes (GtkWidget *drawing_area, cairo_t *cr, gint *focus_width)
 
static gboolean mouse_press (GtkWidget *invisible, GdkEventButton *event, gpointer data)
 
static void palette_change_notify_instance (GObject *object, GParamSpec *pspec, gpointer data)
 
static void update_palette (MateColorSelection *colorsel)
 
static void shutdown_eyedropper (GtkWidget *widget)
 
static void mate_color_selection_class_init (MateColorSelectionClass *klass)
 
static void mate_color_selection_init (MateColorSelection *colorsel)
 
static void color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which)
 
static void color_sample_update_samples (MateColorSelection *colorsel)
 
static void set_color_internal (MateColorSelection *colorsel, gdouble *color)
 
static void set_color_icon (GdkDragContext *context, gdouble *colors)
 
static void color_sample_drag_begin (GtkWidget *widget, GdkDragContext *context, gpointer data)
 
static void color_sample_drag_end (GtkWidget *widget, GdkDragContext *context, gpointer data)
 
static void color_sample_drop_handle (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time, gpointer data)
 
static void color_sample_drag_handle (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time, gpointer data)
 
static gboolean color_old_sample_draw (GtkWidget *da, cairo_t *cr, MateColorSelection *colorsel)
 
static gboolean color_cur_sample_draw (GtkWidget *da, cairo_t *cr, MateColorSelection *colorsel)
 
static void color_sample_setup_dnd (MateColorSelection *colorsel, GtkWidget *sample)
 
static void update_tooltips (MateColorSelection *colorsel)
 
static void palette_get_color (GtkWidget *drawing_area, gdouble *color)
 
static void palette_paint (GtkWidget *drawing_area, cairo_t *cr, gpointer data)
 
static void palette_drag_begin (GtkWidget *widget, GdkDragContext *context, gpointer data)
 
static void palette_drag_handle (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time, gpointer data)
 
static void palette_drag_end (GtkWidget *widget, GdkDragContext *context, gpointer data)
 
static GdkRGBA * get_current_colors (MateColorSelection *colorsel)
 
static void palette_change_color (GtkWidget *drawing_area, MateColorSelection *colorsel, gdouble *color)
 
static void palette_set_color (GtkWidget *drawing_area, MateColorSelection *colorsel, gdouble *color)
 
static gboolean palette_draw (GtkWidget *drawing_area, cairo_t *cr, gpointer data)
 
static void save_color_selected (GtkWidget *menuitem, gpointer data)
 
static void do_popup (MateColorSelection *colorsel, GtkWidget *drawing_area, const GdkEvent *trigger_event)
 
static gboolean palette_enter (GtkWidget *drawing_area, GdkEventCrossing *event, gpointer data)
 
static gboolean palette_leave (GtkWidget *drawing_area, GdkEventCrossing *event, gpointer data)
 
static gboolean _gtk_button_event_triggers_context_menu (GdkEventButton *event)
 
static gboolean palette_press (GtkWidget *drawing_area, GdkEventButton *event, gpointer data)
 
static gboolean palette_release (GtkWidget *drawing_area, GdkEventButton *event, gpointer data)
 
static void palette_drop_handle (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time, gpointer data)
 
static gint palette_activate (GtkWidget *widget, GdkEventKey *event, gpointer data)
 
static gboolean palette_popup (GtkWidget *widget, gpointer data)
 
static GtkWidget * palette_new (MateColorSelection *colorsel)
 
static GdkCursor * make_picker_cursor (GdkScreen *screen)
 
static void grab_color_at_mouse (GdkScreen *screen, GdkDevice *device, gint x_root, gint y_root, gpointer data)
 
static void mouse_motion (GtkWidget *invisible, GdkEventMotion *event, gpointer data)
 
static gboolean mouse_release (GtkWidget *invisible, GdkEventButton *event, gpointer data)
 
static gboolean key_press (GtkWidget *invisible, GdkEventKey *event, gpointer data)
 
static double scale_round (double val, double factor)
 
GtkWidget * mate_color_selection_new (void)
 mate_color_selection_new:
 
gboolean mate_color_selection_get_has_opacity_control (MateColorSelection *colorsel)
 mate_color_selection_get_has_opacity_control: @colorsel: a MateColorSelection.
 
void mate_color_selection_set_has_opacity_control (MateColorSelection *colorsel, gboolean has_opacity)
 mate_color_selection_set_has_opacity_control: @colorsel: a MateColorSelection.
 
gboolean mate_color_selection_get_has_palette (MateColorSelection *colorsel)
 mate_color_selection_get_has_palette: @colorsel: a MateColorSelection.
 
void mate_color_selection_set_has_palette (MateColorSelection *colorsel, gboolean has_palette)
 mate_color_selection_set_has_palette: @colorsel: a MateColorSelection.
 
void mate_color_selection_set_current_rgba (MateColorSelection *colorsel, const GdkRGBA *rgba)
 mate_color_selection_set_current_rgba: @colorsel: a MateColorSelection.
 
void mate_color_selection_set_current_alpha (MateColorSelection *colorsel, guint16 alpha)
 mate_color_selection_set_current_alpha: @colorsel: a MateColorSelection.
 
void mate_color_selection_set_color (MateColorSelection *colorsel, gdouble *color)
 mate_color_selection_set_color: @colorsel: a MateColorSelection.
 
void mate_color_selection_get_current_rgba (MateColorSelection *colorsel, GdkRGBA *color)
 mate_color_selection_get_current_rgba: @colorsel: a MateColorSelection.
 
guint16 mate_color_selection_get_current_alpha (MateColorSelection *colorsel)
 mate_color_selection_get_current_alpha: @colorsel: a MateColorSelection.
 
void mate_color_selection_get_color (MateColorSelection *colorsel, gdouble *color)
 mate_color_selection_get_color: @colorsel: a MateColorSelection.
 
void mate_color_selection_set_previous_color (MateColorSelection *colorsel, const GdkRGBA *color)
 mate_color_selection_set_previous_color: @colorsel: a MateColorSelection.
 
void mate_color_selection_set_previous_alpha (MateColorSelection *colorsel, guint16 alpha)
 mate_color_selection_set_previous_alpha: @colorsel: a MateColorSelection.
 
void mate_color_selection_get_previous_color (MateColorSelection *colorsel, GdkRGBA *color)
 mate_color_selection_get_previous_color: @colorsel: a MateColorSelection.
 
guint16 mate_color_selection_get_previous_alpha (MateColorSelection *colorsel)
 mate_color_selection_get_previous_alpha: @colorsel: a MateColorSelection.
 
gboolean mate_color_selection_is_adjusting (MateColorSelection *colorsel)
 mate_color_selection_is_adjusting: @colorsel: a MateColorSelection.
 
gboolean mate_color_selection_palette_from_string (const gchar *str, GdkRGBA **colors, gint *n_colors)
 mate_color_selection_palette_from_string: @str: a string encoding a color palette.
 
gchar * mate_color_selection_palette_to_string (const GdkRGBA *colors, gint n_colors)
 mate_color_selection_palette_to_string: @colors: (array length=n_colors): an array of colors.
 
MateColorSelectionChangePaletteFunc mate_color_selection_set_change_palette_hook (MateColorSelectionChangePaletteFunc func)
 mate_color_selection_set_change_palette_hook: @func: a function to call when the custom palette needs saving.
 
MateColorSelectionChangePaletteWithScreenFunc mate_color_selection_set_change_palette_with_screen_hook (MateColorSelectionChangePaletteWithScreenFunc func)
 mate_color_selection_set_change_palette_with_screen_hook: @func: a function to call when the custom palette needs saving.
 

Variables

static guint color_selection_signals [LAST_SIGNAL] = { 0 }
 
static MateColorSelectionChangePaletteFunc noscreen_change_palette_hook = default_noscreen_change_palette_func
 
static MateColorSelectionChangePaletteWithScreenFunc change_palette_hook = default_change_palette_func
 
static gchar color_palette [SIZE_OF_COLOR_PALETTE] = { 0 }
 
static const guchar dropper_bits []
 

Macro Definition Documentation

◆ BIG_STEP

#define BIG_STEP   20

◆ CHECK_SIZE

#define CHECK_SIZE   16

◆ CUSTOM_PALETTE_ENTRY_HEIGHT

#define CUSTOM_PALETTE_ENTRY_HEIGHT   20

◆ CUSTOM_PALETTE_ENTRY_WIDTH

#define CUSTOM_PALETTE_ENTRY_WIDTH   20

◆ DEFAULT_COLOR_PALETTE

#define DEFAULT_COLOR_PALETTE   "#ef2929:#fcaf3e:#fce94f:#8ae234:#729fcf:#ad7fa8:#e9b96e:#888a85:#eeeeec:#cc0000:#f57900:#edd400:#73d216:#3465a4:#75507b:#c17d11:#555753:#d3d7cf:#a40000:#ce5c00:#c4a000:#4e9a06:#204a87:#5c3566:#8f5902:#2e3436:#babdb6:#000000:#2e3436:#555753:#888a85:#babdb6:#d3d7cf:#eeeeec:#f3f3f3:#ffffff"

◆ DROPPER_HEIGHT

#define DROPPER_HEIGHT   16

◆ DROPPER_STRIDE

#define DROPPER_STRIDE   64

◆ DROPPER_WIDTH

#define DROPPER_WIDTH   16

◆ DROPPER_X_HOT

#define DROPPER_X_HOT   2

◆ DROPPER_Y_HOT

#define DROPPER_Y_HOT   16

◆ GTK_CUSTOM_PALETTE_HEIGHT

#define GTK_CUSTOM_PALETTE_HEIGHT   4

◆ GTK_CUSTOM_PALETTE_WIDTH

#define GTK_CUSTOM_PALETTE_WIDTH   9

◆ INTENSITY

#define INTENSITY (   r,
  g,
  b 
)    ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)

◆ SCALE

#define SCALE (   i)    (i / 65535.)

◆ SIZE_OF_COLOR_PALETTE

#define SIZE_OF_COLOR_PALETTE   (GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT * 8)

◆ UNSCALE

#define UNSCALE (   d)    ((guint16)(d * 65535 + 0.5))

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
COLOR_CHANGED 
LAST_SIGNAL 

◆ anonymous enum

anonymous enum
Enumerator
PROP_0 
PROP_HAS_PALETTE 
PROP_HAS_OPACITY_CONTROL 
PROP_CURRENT_RGBA 
PROP_CURRENT_ALPHA 
PROP_HEX_STRING 

◆ anonymous enum

anonymous enum
Enumerator
COLORSEL_RED 
COLORSEL_GREEN 
COLORSEL_BLUE 
COLORSEL_OPACITY 
COLORSEL_HUE 
COLORSEL_SATURATION 
COLORSEL_VALUE 
COLORSEL_NUM_CHANNELS 

Function Documentation

◆ _gtk_button_event_triggers_context_menu()

static gboolean _gtk_button_event_triggers_context_menu ( GdkEventButton *  event)
static

Referenced by palette_press().

◆ adjustment_changed()

static void adjustment_changed ( GtkAdjustment *  adjustment,
gpointer  data 
)
static

References _MateColorSelectionPrivate::changing, _MateColorSelectionPrivate::color, COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_HUE, COLORSEL_RED, COLORSEL_SATURATION, COLORSEL_VALUE, MATE_COLOR_SELECTION, _MateColorSelection::private_data, and update_color().

Referenced by make_label_spinbutton(), and mate_color_selection_init().

Here is the call graph for this function:

◆ color_cur_sample_draw()

static gboolean color_cur_sample_draw ( GtkWidget *  da,
cairo_t *  cr,
MateColorSelection *  colorsel 
)
static

References color_sample_draw_sample().

Referenced by color_sample_new().

Here is the call graph for this function:

◆ color_old_sample_draw()

static gboolean color_old_sample_draw ( GtkWidget *  da,
cairo_t *  cr,
MateColorSelection *  colorsel 
)
static

References color_sample_draw_sample().

Referenced by color_sample_new().

Here is the call graph for this function:

◆ color_sample_drag_begin()

static void color_sample_drag_begin ( GtkWidget *  widget,
GdkDragContext *  context,
gpointer  data 
)
static

References _MateColorSelectionPrivate::color, _MateColorSelectionPrivate::old_color, _MateColorSelectionPrivate::old_sample, _MateColorSelection::private_data, and set_color_icon().

Referenced by color_sample_setup_dnd().

Here is the call graph for this function:

◆ color_sample_drag_end()

static void color_sample_drag_end ( GtkWidget *  widget,
GdkDragContext *  context,
gpointer  data 
)
static

Referenced by color_sample_setup_dnd().

◆ color_sample_drag_handle()

static void color_sample_drag_handle ( GtkWidget *  widget,
GdkDragContext *  context,
GtkSelectionData *  selection_data,
guint  info,
guint  time,
gpointer  data 
)
static

◆ color_sample_draw_sample()

◆ color_sample_drop_handle()

static void color_sample_drop_handle ( GtkWidget *  widget,
GdkDragContext *  context,
gint  x,
gint  y,
GtkSelectionData *  selection_data,
guint  info,
guint  time,
gpointer  data 
)
static

References _MateColorSelectionPrivate::cur_sample, _MateColorSelection::private_data, and set_color_internal().

Referenced by color_sample_setup_dnd().

Here is the call graph for this function:

◆ color_sample_new()

static void color_sample_new ( MateColorSelection *  colorsel)
static

References color_cur_sample_draw(), color_old_sample_draw(), color_sample_setup_dnd(), _MateColorSelectionPrivate::cur_sample, _MateColorSelectionPrivate::old_sample, _MateColorSelection::private_data, _MateColorSelectionPrivate::sample_area, and update_tooltips().

Referenced by mate_color_selection_init().

Here is the call graph for this function:

◆ color_sample_setup_dnd()

static void color_sample_setup_dnd ( MateColorSelection *  colorsel,
GtkWidget *  sample 
)
static

References color_sample_drag_begin(), color_sample_drag_end(), color_sample_drag_handle(), color_sample_drop_handle(), _MateColorSelectionPrivate::cur_sample, and _MateColorSelection::private_data.

Referenced by color_sample_new().

Here is the call graph for this function:

◆ color_sample_update_samples()

◆ default_change_palette_func()

static void default_change_palette_func ( GdkScreen *  screen,
const GdkRGBA *  colors,
gint  n_colors 
)
static

References color_palette, mate_color_selection_palette_to_string(), and SIZE_OF_COLOR_PALETTE.

Referenced by default_noscreen_change_palette_func(), and palette_change_color().

Here is the call graph for this function:

◆ default_noscreen_change_palette_func()

static void default_noscreen_change_palette_func ( const GdkRGBA *  colors,
gint  n_colors 
)
static

References default_change_palette_func().

Referenced by palette_change_color().

Here is the call graph for this function:

◆ do_popup()

static void do_popup ( MateColorSelection *  colorsel,
GtkWidget *  drawing_area,
const GdkEvent *  trigger_event 
)
static

References save_color_selected().

Referenced by palette_popup(), and palette_press().

Here is the call graph for this function:

◆ get_current_colors()

static GdkRGBA * get_current_colors ( MateColorSelection *  colorsel)
static

References color_palette, DEFAULT_COLOR_PALETTE, GTK_CUSTOM_PALETTE_HEIGHT, GTK_CUSTOM_PALETTE_WIDTH, mate_color_selection_palette_from_string(), and SIZE_OF_COLOR_PALETTE.

Referenced by palette_change_color(), and update_palette().

Here is the call graph for this function:

◆ get_screen_color()

static void get_screen_color ( GtkWidget *  button)
static

References _MateColorSelectionPrivate::dropper_grab_widget, _MateColorSelectionPrivate::grab_time, _MateColorSelectionPrivate::has_grab, key_press(), make_picker_cursor(), mouse_press(), and _MateColorSelection::private_data.

Referenced by mate_color_selection_init().

Here is the call graph for this function:

◆ grab_color_at_mouse()

static void grab_color_at_mouse ( GdkScreen *  screen,
GdkDevice *  device,
gint  x_root,
gint  y_root,
gpointer  data 
)
static

References _MateColorSelectionPrivate::color, COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_HUE, COLORSEL_RED, COLORSEL_SATURATION, COLORSEL_VALUE, _MateColorSelection::private_data, SCALE, and update_color().

Referenced by key_press(), mouse_motion(), and mouse_release().

Here is the call graph for this function:

◆ hex_changed()

static void hex_changed ( GtkWidget *  hex_entry,
gpointer  data 
)
static

References _MateColorSelectionPrivate::changing, _MateColorSelectionPrivate::color, COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_HUE, COLORSEL_RED, COLORSEL_SATURATION, COLORSEL_VALUE, _MateColorSelectionPrivate::hex_entry, MATE_COLOR_SELECTION, _MateColorSelection::private_data, and update_color().

Referenced by hex_focus_out(), and mate_color_selection_init().

Here is the call graph for this function:

◆ hex_focus_out()

static gboolean hex_focus_out ( GtkWidget *  hex_entry,
GdkEventFocus *  event,
gpointer  data 
)
static

References hex_changed().

Referenced by mate_color_selection_init().

Here is the call graph for this function:

◆ hsv_changed()

static void hsv_changed ( GtkWidget *  hsv,
gpointer  data 
)
static

References _MateColorSelectionPrivate::changing, _MateColorSelectionPrivate::color, COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_HUE, COLORSEL_RED, COLORSEL_SATURATION, COLORSEL_VALUE, MATE_COLOR_SELECTION, MATE_HSV, mate_hsv_get_color(), _MateColorSelection::private_data, and update_color().

Referenced by mate_color_selection_init().

Here is the call graph for this function:

◆ key_press()

static gboolean key_press ( GtkWidget *  invisible,
GdkEventKey *  event,
gpointer  data 
)
static

References BIG_STEP, grab_color_at_mouse(), key_press(), mouse_press(), and shutdown_eyedropper().

Referenced by get_screen_color(), key_press(), and mouse_press().

Here is the call graph for this function:

◆ make_all_relations()

static void make_all_relations ( AtkObject *  atk_obj,
MateColorSelectionPrivate *  priv 
)
static

◆ make_control_relations()

static void make_control_relations ( AtkObject *  atk_obj,
GtkWidget *  widget 
)
static

Referenced by make_all_relations().

◆ make_label_spinbutton()

static void make_label_spinbutton ( MateColorSelection *  colorsel,
GtkWidget **  spinbutton,
gchar *  text,
GtkWidget *  grid,
gint  i,
gint  j,
gint  channel_type,
const gchar *  tooltip 
)
static

References adjustment_changed(), COLORSEL_HUE, COLORSEL_SATURATION, and COLORSEL_VALUE.

Referenced by mate_color_selection_init().

Here is the call graph for this function:

◆ make_palette_frame()

static void make_palette_frame ( MateColorSelection *  colorsel,
GtkWidget *  grid,
gint  i,
gint  j 
)
static

References _MateColorSelectionPrivate::custom_palette, CUSTOM_PALETTE_ENTRY_HEIGHT, CUSTOM_PALETTE_ENTRY_WIDTH, palette_new(), and _MateColorSelection::private_data.

Referenced by mate_color_selection_init().

Here is the call graph for this function:

◆ make_picker_cursor()

static GdkCursor * make_picker_cursor ( GdkScreen *  screen)
static

◆ mate_color_selection_class_init()

◆ mate_color_selection_dispose()

static void mate_color_selection_dispose ( GObject *  object)
static

◆ mate_color_selection_finalize()

static void mate_color_selection_finalize ( GObject *  object)
static

◆ mate_color_selection_get_color()

void mate_color_selection_get_color ( MateColorSelection *  colorsel,
gdouble *  color 
)

mate_color_selection_get_color: @colorsel: a MateColorSelection.

@color: an array of 4 #gdouble to fill in with the current color.

Sets @color to be the current color in the MateColorSelection widget.

Deprecated: 2.0: Use mate_color_selection_get_current_color() instead.

References _MateColorSelectionPrivate::color, COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_OPACITY, COLORSEL_RED, _MateColorSelectionPrivate::has_opacity, MATE_IS_COLOR_SELECTION, and _MateColorSelection::private_data.

◆ mate_color_selection_get_current_alpha()

guint16 mate_color_selection_get_current_alpha ( MateColorSelection *  colorsel)

mate_color_selection_get_current_alpha: @colorsel: a MateColorSelection.

Returns the current alpha value.

Return value: an integer between 0 and 65535.

References _MateColorSelectionPrivate::color, COLORSEL_OPACITY, _MateColorSelectionPrivate::has_opacity, MATE_IS_COLOR_SELECTION, _MateColorSelection::private_data, and UNSCALE.

Referenced by mate_color_selection_get_property().

◆ mate_color_selection_get_current_rgba()

void mate_color_selection_get_current_rgba ( MateColorSelection *  colorsel,
GdkRGBA *  color 
)

mate_color_selection_get_current_rgba: @colorsel: a MateColorSelection.

@color: (out): a #GdkRGBA to fill in with the current color.

Sets @color to be the current color in the MateColorSelection widget.

References _MateColorSelectionPrivate::color, COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_RED, MATE_IS_COLOR_SELECTION, and _MateColorSelection::private_data.

Referenced by copy_color(), and mate_color_selection_get_property().

◆ mate_color_selection_get_has_opacity_control()

gboolean mate_color_selection_get_has_opacity_control ( MateColorSelection *  colorsel)

mate_color_selection_get_has_opacity_control: @colorsel: a MateColorSelection.

Determines whether the colorsel has an opacity control.

Return value: TRUE if the @colorsel has an opacity control. FALSE if it does't.

References _MateColorSelectionPrivate::has_opacity, MATE_IS_COLOR_SELECTION, and _MateColorSelection::private_data.

Referenced by mate_color_selection_get_property().

◆ mate_color_selection_get_has_palette()

gboolean mate_color_selection_get_has_palette ( MateColorSelection *  colorsel)

mate_color_selection_get_has_palette: @colorsel: a MateColorSelection.

Determines whether the color selector has a color palette.

Return value: TRUE if the selector has a palette. FALSE if it hasn't.

References _MateColorSelectionPrivate::has_palette, MATE_IS_COLOR_SELECTION, and _MateColorSelection::private_data.

Referenced by mate_color_selection_get_property().

◆ mate_color_selection_get_previous_alpha()

guint16 mate_color_selection_get_previous_alpha ( MateColorSelection *  colorsel)

mate_color_selection_get_previous_alpha: @colorsel: a MateColorSelection.

Returns the previous alpha value.

Return value: an integer between 0 and 65535.

References COLORSEL_OPACITY, _MateColorSelectionPrivate::has_opacity, MATE_IS_COLOR_SELECTION, _MateColorSelectionPrivate::old_color, _MateColorSelection::private_data, and UNSCALE.

◆ mate_color_selection_get_previous_color()

void mate_color_selection_get_previous_color ( MateColorSelection *  colorsel,
GdkRGBA *  color 
)

mate_color_selection_get_previous_color: @colorsel: a MateColorSelection.

@color: (out): a #GdkRGBA to fill in with the original color value.

Fills @color in with the original color value.

References COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_RED, MATE_IS_COLOR_SELECTION, _MateColorSelectionPrivate::old_color, and _MateColorSelection::private_data.

◆ mate_color_selection_get_property()

static void mate_color_selection_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  pspec 
)
static

◆ mate_color_selection_grab_broken()

static gboolean mate_color_selection_grab_broken ( GtkWidget *  widget,
GdkEventGrabBroken *  event 
)
static

References shutdown_eyedropper().

Referenced by mate_color_selection_class_init().

Here is the call graph for this function:

◆ mate_color_selection_init()

static void mate_color_selection_init ( MateColorSelection *  colorsel)
static

◆ mate_color_selection_is_adjusting()

gboolean mate_color_selection_is_adjusting ( MateColorSelection *  colorsel)

mate_color_selection_is_adjusting: @colorsel: a MateColorSelection.

Gets the current state of the @colorsel.

Return value: TRUE if the user is currently dragging a color around, and FALSE if the selection has stopped.

References MATE_HSV, mate_hsv_is_adjusting(), MATE_IS_COLOR_SELECTION, _MateColorSelection::private_data, and _MateColorSelectionPrivate::triangle_colorsel.

Here is the call graph for this function:

◆ mate_color_selection_new()

GtkWidget * mate_color_selection_new ( void  )

mate_color_selection_new:

Creates a new MateColorSelection.

Return value: a new MateColorSelection

References _MateColorSelectionPrivate::default_alpha_set, _MateColorSelectionPrivate::default_set, mate_color_selection_set_has_opacity_control(), MATE_TYPE_COLOR_SELECTION, _MateColorSelection::private_data, and set_color_internal().

Referenced by mate_color_selection_dialog_init().

Here is the call graph for this function:

◆ mate_color_selection_palette_from_string()

gboolean mate_color_selection_palette_from_string ( const gchar *  str,
GdkRGBA **  colors,
gint *  n_colors 
)

mate_color_selection_palette_from_string: @str: a string encoding a color palette.

@colors: (out) (array length=n_colors): return location for allocated array of #GdkRGBA. @n_colors: return location for length of array.

Parses a color palette string; the string is a colon-separated list of color names readable by gdk_color_parse().

Return value: TRUE if a palette was successfully parsed.

Referenced by get_current_colors().

◆ mate_color_selection_palette_to_string()

gchar * mate_color_selection_palette_to_string ( const GdkRGBA *  colors,
gint  n_colors 
)

mate_color_selection_palette_to_string: @colors: (array length=n_colors): an array of colors.

@n_colors: length of the array.

Encodes a palette as a string, useful for persistent storage.

Return value: allocated string encoding the palette.

References scale_round().

Referenced by default_change_palette_func().

Here is the call graph for this function:

◆ mate_color_selection_realize()

static void mate_color_selection_realize ( GtkWidget *  widget)
static

References MATE_COLOR_SELECTION, palette_change_notify_instance(), _MateColorSelection::private_data, _MateColorSelectionPrivate::settings_connection, and update_palette().

Referenced by mate_color_selection_class_init().

Here is the call graph for this function:

◆ mate_color_selection_set_change_palette_hook()

MateColorSelectionChangePaletteFunc mate_color_selection_set_change_palette_hook ( MateColorSelectionChangePaletteFunc  func)

mate_color_selection_set_change_palette_hook: @func: a function to call when the custom palette needs saving.

Installs a global function to be called whenever the user tries to modify the palette in a color selection. This function should save the new palette contents, and update the GtkSettings property "gtk-color-palette" so all MateColorSelection widgets will be modified.

Return value: the previous change palette hook (that was replaced).

Deprecated: 2.4: This function does not work in multihead environments. Use mate_color_selection_set_change_palette_with_screen_hook() instead.

References noscreen_change_palette_hook.

◆ mate_color_selection_set_change_palette_with_screen_hook()

MateColorSelectionChangePaletteWithScreenFunc mate_color_selection_set_change_palette_with_screen_hook ( MateColorSelectionChangePaletteWithScreenFunc  func)

mate_color_selection_set_change_palette_with_screen_hook: @func: a function to call when the custom palette needs saving.

Installs a global function to be called whenever the user tries to modify the palette in a color selection. This function should save the new palette contents, and update the GtkSettings property "gtk-color-palette" so all MateColorSelection widgets will be modified.

Return value: the previous change palette hook (that was replaced).

Since: 1.9.1

References change_palette_hook.

◆ mate_color_selection_set_color()

void mate_color_selection_set_color ( MateColorSelection *  colorsel,
gdouble *  color 
)

mate_color_selection_set_color: @colorsel: a MateColorSelection.

@color: an array of 4 doubles specifying the red, green, blue and opacity to set the current color to.

Sets the current color to be @color. The first time this is called, it will also set the original color to be @color too.

Deprecated: 2.0: Use mate_color_selection_set_current_color() instead.

References MATE_IS_COLOR_SELECTION, and set_color_internal().

Here is the call graph for this function:

◆ mate_color_selection_set_current_alpha()

void mate_color_selection_set_current_alpha ( MateColorSelection *  colorsel,
guint16  alpha 
)

mate_color_selection_set_current_alpha: @colorsel: a MateColorSelection.

@alpha: an integer between 0 and 65535.

Sets the current opacity to be @alpha. The first time this is called, it will also set the original opacity to be @alpha too.

References _MateColorSelectionPrivate::changing, _MateColorSelectionPrivate::color, COLORSEL_NUM_CHANNELS, COLORSEL_OPACITY, _MateColorSelectionPrivate::default_alpha_set, MATE_IS_COLOR_SELECTION, _MateColorSelectionPrivate::old_color, _MateColorSelection::private_data, SCALE, and update_color().

Referenced by mate_color_selection_set_property().

Here is the call graph for this function:

◆ mate_color_selection_set_current_rgba()

void mate_color_selection_set_current_rgba ( MateColorSelection *  colorsel,
const GdkRGBA *  rgba 
)

mate_color_selection_set_current_rgba: @colorsel: a MateColorSelection.

@color: A #GdkRGBA to set the current color with.

Sets the current color to be @color. The first time this is called, it will also set the original color to be @color too.

References _MateColorSelectionPrivate::changing, _MateColorSelectionPrivate::color, COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_HUE, COLORSEL_NUM_CHANNELS, COLORSEL_OPACITY, COLORSEL_RED, COLORSEL_SATURATION, COLORSEL_VALUE, _MateColorSelectionPrivate::default_set, MATE_IS_COLOR_SELECTION, _MateColorSelectionPrivate::old_color, _MateColorSelection::private_data, and update_color().

Referenced by mate_color_selection_set_property().

Here is the call graph for this function:

◆ mate_color_selection_set_has_opacity_control()

void mate_color_selection_set_has_opacity_control ( MateColorSelection *  colorsel,
gboolean  has_opacity 
)

mate_color_selection_set_has_opacity_control: @colorsel: a MateColorSelection.

@has_opacity: TRUE if @colorsel can set the opacity, FALSE otherwise.

Sets the @colorsel to use or not use opacity.

References color_sample_update_samples(), _MateColorSelectionPrivate::has_opacity, MATE_IS_COLOR_SELECTION, _MateColorSelectionPrivate::opacity_entry, _MateColorSelectionPrivate::opacity_label, _MateColorSelectionPrivate::opacity_slider, and _MateColorSelection::private_data.

Referenced by mate_color_selection_dialog_init(), mate_color_selection_new(), and mate_color_selection_set_property().

Here is the call graph for this function:

◆ mate_color_selection_set_has_palette()

void mate_color_selection_set_has_palette ( MateColorSelection *  colorsel,
gboolean  has_palette 
)

mate_color_selection_set_has_palette: @colorsel: a MateColorSelection.

@has_palette: TRUE if palette is to be visible, FALSE otherwise.

Shows and hides the palette based upon the value of @has_palette.

References _MateColorSelectionPrivate::has_palette, MATE_IS_COLOR_SELECTION, _MateColorSelectionPrivate::palette_frame, _MateColorSelection::private_data, and update_tooltips().

Referenced by main(), mate_color_selection_dialog_init(), and mate_color_selection_set_property().

Here is the call graph for this function:

◆ mate_color_selection_set_palette_color()

static void mate_color_selection_set_palette_color ( MateColorSelection *  colorsel,
gint  index,
GdkRGBA *  color 
)
static

mate_color_selection_set_palette_color: @colorsel: a MateColorSelection.

@index: the color index of the palette. @color: A #GdkRGBA to set the palette with.

Sets the palette located at @index to have @color as its color.

References _MateColorSelectionPrivate::custom_palette, GTK_CUSTOM_PALETTE_HEIGHT, GTK_CUSTOM_PALETTE_WIDTH, MATE_IS_COLOR_SELECTION, palette_set_color(), and _MateColorSelection::private_data.

Referenced by update_palette().

Here is the call graph for this function:

◆ mate_color_selection_set_previous_alpha()

void mate_color_selection_set_previous_alpha ( MateColorSelection *  colorsel,
guint16  alpha 
)

mate_color_selection_set_previous_alpha: @colorsel: a MateColorSelection.

@alpha: an integer between 0 and 65535.

Sets the 'previous' alpha to be @alpha. This function should be called with some hesitations, as it might seem confusing to have that alpha change.

References _MateColorSelectionPrivate::changing, color_sample_update_samples(), COLORSEL_OPACITY, _MateColorSelectionPrivate::default_alpha_set, MATE_IS_COLOR_SELECTION, _MateColorSelectionPrivate::old_color, _MateColorSelection::private_data, and SCALE.

Here is the call graph for this function:

◆ mate_color_selection_set_previous_color()

void mate_color_selection_set_previous_color ( MateColorSelection *  colorsel,
const GdkRGBA *  color 
)

mate_color_selection_set_previous_color: @colorsel: a MateColorSelection.

@color: a #GdkRGBA to set the previous color with.

Sets the 'previous' color to be @color. This function should be called with some hesitations, as it might seem confusing to have that color change. Calling mate_color_selection_set_current_color() will also set this color the first time it is called.

References _MateColorSelectionPrivate::changing, color_sample_update_samples(), COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_HUE, COLORSEL_RED, COLORSEL_SATURATION, COLORSEL_VALUE, _MateColorSelectionPrivate::default_set, MATE_IS_COLOR_SELECTION, _MateColorSelectionPrivate::old_color, and _MateColorSelection::private_data.

Here is the call graph for this function:

◆ mate_color_selection_set_property()

static void mate_color_selection_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

◆ mate_color_selection_show_all()

static void mate_color_selection_show_all ( GtkWidget *  widget)
static

◆ mate_color_selection_unrealize()

static void mate_color_selection_unrealize ( GtkWidget *  widget)
static

◆ mouse_motion()

static void mouse_motion ( GtkWidget *  invisible,
GdkEventMotion *  event,
gpointer  data 
)
static

References grab_color_at_mouse().

Referenced by mouse_press(), and mouse_release().

Here is the call graph for this function:

◆ mouse_press()

static gboolean mouse_press ( GtkWidget *  invisible,
GdkEventButton *  event,
gpointer  data 
)
static

References key_press(), mouse_motion(), mouse_press(), and mouse_release().

Referenced by get_screen_color(), key_press(), and mouse_press().

Here is the call graph for this function:

◆ mouse_release()

static gboolean mouse_release ( GtkWidget *  invisible,
GdkEventButton *  event,
gpointer  data 
)
static

References grab_color_at_mouse(), mouse_motion(), mouse_release(), and shutdown_eyedropper().

Referenced by mouse_press(), and mouse_release().

Here is the call graph for this function:

◆ opacity_entry_changed()

static void opacity_entry_changed ( GtkWidget *  opacity_entry,
gpointer  data 
)
static

References _MateColorSelectionPrivate::changing, MATE_COLOR_SELECTION, _MateColorSelectionPrivate::opacity_entry, _MateColorSelectionPrivate::opacity_slider, _MateColorSelection::private_data, and update_color().

Referenced by mate_color_selection_init().

Here is the call graph for this function:

◆ palette_activate()

static gint palette_activate ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  data 
)
static

References MATE_COLOR_SELECTION, palette_get_color(), and set_color_internal().

Referenced by palette_new().

Here is the call graph for this function:

◆ palette_change_color()

static void palette_change_color ( GtkWidget *  drawing_area,
MateColorSelection *  colorsel,
gdouble *  color 
)
static

◆ palette_change_notify_instance()

static void palette_change_notify_instance ( GObject *  object,
GParamSpec *  pspec,
gpointer  data 
)
static

References MATE_COLOR_SELECTION, and update_palette().

Referenced by mate_color_selection_realize().

Here is the call graph for this function:

◆ palette_drag_begin()

static void palette_drag_begin ( GtkWidget *  widget,
GdkDragContext *  context,
gpointer  data 
)
static

References palette_get_color(), and set_color_icon().

Referenced by palette_set_color().

Here is the call graph for this function:

◆ palette_drag_end()

static void palette_drag_end ( GtkWidget *  widget,
GdkDragContext *  context,
gpointer  data 
)
static

Referenced by palette_new().

◆ palette_drag_handle()

static void palette_drag_handle ( GtkWidget *  widget,
GdkDragContext *  context,
GtkSelectionData *  selection_data,
guint  info,
guint  time,
gpointer  data 
)
static

References COLORSEL_BLUE, COLORSEL_GREEN, COLORSEL_RED, and palette_get_color().

Referenced by palette_set_color().

Here is the call graph for this function:

◆ palette_draw()

static gboolean palette_draw ( GtkWidget *  drawing_area,
cairo_t *  cr,
gpointer  data 
)
static

References palette_paint().

Referenced by palette_new().

Here is the call graph for this function:

◆ palette_drop_handle()

static void palette_drop_handle ( GtkWidget *  widget,
GdkDragContext *  context,
gint  x,
gint  y,
GtkSelectionData *  selection_data,
guint  info,
guint  time,
gpointer  data 
)
static

References MATE_COLOR_SELECTION, palette_change_color(), and set_color_internal().

Referenced by palette_new().

Here is the call graph for this function:

◆ palette_enter()

static gboolean palette_enter ( GtkWidget *  drawing_area,
GdkEventCrossing *  event,
gpointer  data 
)
static

Referenced by palette_new().

◆ palette_get_color()

static void palette_get_color ( GtkWidget *  drawing_area,
gdouble *  color 
)
static

◆ palette_leave()

static gboolean palette_leave ( GtkWidget *  drawing_area,
GdkEventCrossing *  event,
gpointer  data 
)
static

Referenced by palette_new().

◆ palette_new()

static GtkWidget * palette_new ( MateColorSelection *  colorsel)
static

References palette_activate(), palette_drag_end(), palette_draw(), palette_drop_handle(), palette_enter(), palette_leave(), palette_popup(), palette_press(), and palette_release().

Referenced by make_palette_frame().

Here is the call graph for this function:

◆ palette_paint()

static void palette_paint ( GtkWidget *  drawing_area,
cairo_t *  cr,
gpointer  data 
)
static

References palette_get_color(), and set_focus_line_attributes().

Referenced by palette_draw().

Here is the call graph for this function:

◆ palette_popup()

static gboolean palette_popup ( GtkWidget *  widget,
gpointer  data 
)
static

References do_popup(), and MATE_COLOR_SELECTION.

Referenced by palette_new().

Here is the call graph for this function:

◆ palette_press()

static gboolean palette_press ( GtkWidget *  drawing_area,
GdkEventButton *  event,
gpointer  data 
)
static

References _gtk_button_event_triggers_context_menu(), do_popup(), and MATE_COLOR_SELECTION.

Referenced by palette_new().

Here is the call graph for this function:

◆ palette_release()

static gboolean palette_release ( GtkWidget *  drawing_area,
GdkEventButton *  event,
gpointer  data 
)
static

References MATE_COLOR_SELECTION, palette_get_color(), and set_color_internal().

Referenced by palette_new().

Here is the call graph for this function:

◆ palette_set_color()

static void palette_set_color ( GtkWidget *  drawing_area,
MateColorSelection *  colorsel,
gdouble *  color 
)
static

References palette_drag_begin(), and palette_drag_handle().

Referenced by mate_color_selection_set_palette_color().

Here is the call graph for this function:

◆ save_color_selected()

static void save_color_selected ( GtkWidget *  menuitem,
gpointer  data 
)
static

References _MateColorSelectionPrivate::color, MATE_COLOR_SELECTION, palette_change_color(), and _MateColorSelection::private_data.

Referenced by do_popup().

Here is the call graph for this function:

◆ scale_round()

static double scale_round ( double  val,
double  factor 
)
static

◆ set_color_icon()

static void set_color_icon ( GdkDragContext *  context,
gdouble *  colors 
)
static

◆ set_color_internal()

◆ set_focus_line_attributes()

static void set_focus_line_attributes ( GtkWidget *  drawing_area,
cairo_t *  cr,
gint *  focus_width 
)
static

References INTENSITY, and palette_get_color().

Referenced by palette_paint().

Here is the call graph for this function:

◆ set_selected_palette()

static void set_selected_palette ( MateColorSelection *  colorsel,
int  x,
int  y 
)
static

◆ shutdown_eyedropper()

◆ update_color()

◆ update_palette()

static void update_palette ( MateColorSelection *  colorsel)
static

References get_current_colors(), GTK_CUSTOM_PALETTE_HEIGHT, GTK_CUSTOM_PALETTE_WIDTH, and mate_color_selection_set_palette_color().

Referenced by mate_color_selection_realize(), and palette_change_notify_instance().

Here is the call graph for this function:

◆ update_tooltips()

Variable Documentation

◆ change_palette_hook

◆ color_palette

gchar color_palette[SIZE_OF_COLOR_PALETTE] = { 0 }
static

◆ color_selection_signals

guint color_selection_signals[LAST_SIGNAL] = { 0 }
static

◆ dropper_bits

const guchar dropper_bits[]
static

Referenced by make_picker_cursor().

◆ noscreen_change_palette_hook