summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 842291a)
raw | patch | inline | side by side (parent: 842291a)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Wed, 24 Oct 2007 19:39:25 +0000 (19:39 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Wed, 24 Oct 2007 19:39:25 +0000 (19:39 +0000) |
src/ui/widget/selected-style.cpp | patch | blob | history | |
src/ui/widget/selected-style.h | patch | blob | history |
index 8710162fd7f70d5249816bcd959efececf0464b7..613fa977d7655ae1fcd302713130802d58f0a6f8 100644 (file)
#include "verbs.h"
#include "color.h"
#include <display/sp-canvas.h>
+#include "pixmaps/cursor-adj-h.xpm"
+#include "pixmaps/cursor-adj-s.xpm"
+#include "pixmaps/cursor-adj-l.xpm"
+#include "sp-cursor.h"
static gdouble const _sw_presets[] = { 32 , 16 , 10 , 8 , 6 , 4 , 3 , 2 , 1.5 , 1 , 0.75 , 0.5 , 0.25 , 0.1 };
static gchar const *const _sw_presets_str[] = {"32", "16", "10", "8", "6", "4", "3", "2", "1.5", "1", "0.75", "0.5", "0.25", "0.1"};
fillstroke = mode;
startcolor_set = false;
undokey = "ssrot1";
+ cr = NULL;
+ cr_set = false;
}
RotateableSwatch::~RotateableSwatch() {
if (parent->_mode[fillstroke] != SS_COLOR)
return;
+ if (!cr_set) {
+ GtkWidget *w = GTK_WIDGET(gobj());
+
+ GdkBitmap *bitmap = NULL;
+ GdkBitmap *mask = NULL;
+ if (modifier == 2) { // saturation
+ sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, cursor_adj_s_xpm);
+ } else if (modifier == 1) { // lightness
+ sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, cursor_adj_l_xpm);
+ } else { // hue
+ sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, cursor_adj_h_xpm);
+ }
+ if ((bitmap != NULL) && (mask != NULL)) {
+ cr = gdk_cursor_new_from_pixmap(bitmap, mask,
+ &w->style->black,
+ &w->style->white,
+ 16, 16);
+ g_object_unref (bitmap);
+ g_object_unref (mask);
+ gdk_window_set_cursor(w->window, cr);
+ cr_set = true;
+ }
+ }
+
guint32 cc;
if (!startcolor_set) {
cc = startcolor = parent->_thisselected[fillstroke];
float hsl[3];
color_adjust(hsl, by, startcolor, modifier);
+ if (cr_set) {
+ GtkWidget *w = GTK_WIDGET(gobj());
+ gdk_window_set_cursor(w->window, NULL);
+ if (cr) {
+ gdk_cursor_unref (cr);
+ cr = NULL;
+ }
+ cr_set = false;
+ }
+
if (modifier == 2) { // saturation
sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey,
SP_VERB_DIALOG_FILL_STROKE, ("Adjust saturation"));
index 299e7861712fd4cdcc819357f48b51736870d95c..cd67abfc563e708adc3faf17efb2cfd2613fb1d9 100644 (file)
~RotateableSwatch();
guint fillstroke;
+
SelectedStyle *parent;
+
guint32 startcolor;
bool startcolor_set;
+
gchar *undokey;
+ GdkCursor *cr;
+ bool cr_set;
+
double color_adjust (float *hsl, double by, guint32 cc, guint state);
virtual void do_motion (double by, guint state);
virtual void do_release (double by, guint state);