summaryrefslogtreecommitdiffstats
path: root/src/flood-context.h
blob: 48bf36f8515459d6d9b5b7d4aab59aa624526dd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef __SP_FLOOD_CONTEXT_H__
#define __SP_FLOOD_CONTEXT_H__

/*
 * Flood fill drawing context
 *
 * Authors:
 *   Lauris Kaplinski <lauris@kaplinski.com>
 *   John Bintz <jcoswell@coswellproductions.org>
 *
 * Released under GNU GPL
 */

#include <stddef.h>
#include <sigc++/sigc++.h>
#include <gtk/gtk.h>
#include "event-context.h"

#define SP_FLOOD_CONTEXT(obj) (dynamic_cast<SPFloodContext*>((SPEventContext*)obj))
#define SP_IS_FLOOD_CONTEXT(obj) (dynamic_cast<const SPFloodContext*>((const SPEventContext*)obj) != NULL)


#define FLOOD_COLOR_CHANNEL_R 1
#define FLOOD_COLOR_CHANNEL_G 2
#define FLOOD_COLOR_CHANNEL_B 4
#define FLOOD_COLOR_CHANNEL_A 8

class SPFloodContext : public SPEventContext {
public:
	SPFloodContext();
	virtual ~SPFloodContext();

	SPItem *item;

	sigc::connection sel_changed_connection;

	static const std::string prefsPath;

	virtual void setup();
	virtual bool root_handler(GdkEvent* event);
	virtual bool item_handler(SPItem* item, GdkEvent* event);

	virtual const std::string& getPrefsPath();

	static void set_channels(gint channels);

private:
	void selection_changed(Inkscape::Selection* selection);
	void finishItem();
};

GList* flood_channels_dropdown_items_list (void);
GList* flood_autogap_dropdown_items_list (void);

enum PaintBucketChannels {
    FLOOD_CHANNELS_RGB,
    FLOOD_CHANNELS_R,
    FLOOD_CHANNELS_G,
    FLOOD_CHANNELS_B,
    FLOOD_CHANNELS_H,
    FLOOD_CHANNELS_S,
    FLOOD_CHANNELS_L,
    FLOOD_CHANNELS_ALPHA
};

#endif