summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.h
blob: e86000f7018b28b1524e6902b9e18191def4e1c4 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#ifndef SEEN_SELECTION_CHEMISTRY_H
#define SEEN_SELECTION_CHEMISTRY_H

/*
 * Miscellanous operations on selected items
 *
 * Authors:
 *   Lauris Kaplinski <lauris@kaplinski.com>
 *   Frank Felfe <innerspace@iname.com>
 *   bulia byak <buliabyak@users.sf.net>
 *   Jon A. Cruz <jon@joncruz.org>
 *   Abhishek Sharma
 *
 * Copyright (C) 1999-2012 authors
 * Copyright (C) 2001-2002 Ximian, Inc.
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#include "sp-item.h"
#include "2geom/forward.h"

namespace Inkscape { class Selection; }

namespace Inkscape {
namespace LivePathEffect {
    class PathParam;
}
}

class SPCSSAttr;
class SPDesktop;

namespace Inkscape {
    class SelectionHelper {
    public:
        static void selectAll(SPDesktop *desktop);
        static void selectAllInAll(SPDesktop *desktop);
        static void selectNone(SPDesktop *desktop);
        static void selectSameFillStroke(SPDesktop *dt);
        static void selectSameFillColor(SPDesktop *dt);
        static void selectSameStrokeColor(SPDesktop *dt);
        static void selectSameStrokeStyle(SPDesktop *dt);
        static void selectSameObjectType(SPDesktop *dt);
        static void invert(SPDesktop *desktop);
        static void invertAllInAll(SPDesktop *desktop);
        static void reverse(SPDesktop *dt);
        static void selectNext(SPDesktop *desktop);
        static void selectPrev(SPDesktop *desktop);
        static void fixSelection(SPDesktop *desktop);
    };
} // namespace Inkscape

void sp_selection_delete(SPDesktop *desktop);
void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone = false);
void sp_edit_clear_all(Inkscape::Selection *selection);

void sp_edit_select_all(SPDesktop *desktop);
void sp_edit_select_all_in_all_layers (SPDesktop *desktop);
void sp_edit_invert (SPDesktop *desktop);
void sp_edit_invert_in_all_layers (SPDesktop *desktop);

void sp_selection_clone(SPDesktop *desktop);
void sp_selection_unlink(SPDesktop *desktop);
void sp_selection_relink(SPDesktop *desktop);
void sp_select_clone_original(SPDesktop *desktop);
void sp_selection_clone_original_path_lpe(SPDesktop *desktop);

void sp_selection_to_marker(SPDesktop *desktop, bool apply = true);
void sp_selection_to_guides(SPDesktop *desktop);

void sp_selection_symbols(SPDesktop *desktop, bool apply = true);
void sp_selection_symbol(SPDocument *doc, SPObject *group);
void sp_selection_unsymbol(SPDesktop *desktop);

void sp_selection_tile(SPDesktop *desktop, bool apply = true);
void sp_selection_untile(SPDesktop *desktop);

//void sp_selection_group_impl(GSList const *reprs_to_group, Inkscape::XML::Node *group, Inkscape::XML::Document *xml_doc, SPDocument *doc);
void sp_selection_group(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop);

void sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop);

SPCSSAttr *take_style_from_item (SPObject *object);

void sp_selection_cut(SPDesktop *desktop);
void sp_selection_copy(SPDesktop *desktop);
void sp_selection_paste(SPDesktop *desktop, bool in_place);
void sp_selection_paste_style(SPDesktop *desktop);
void sp_selection_paste_livepatheffect(SPDesktop *desktop);
void sp_selection_remove_livepatheffect(SPDesktop *desktop);

void sp_selection_remove_filter(SPDesktop *desktop);

void sp_set_style_clipboard (SPCSSAttr *css);

void sp_selection_paste_size(SPDesktop *desktop, bool apply_x, bool apply_y);
void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool apply_y);

void sp_selection_to_next_layer( SPDesktop *desktop, bool suppressDone = false );
void sp_selection_to_prev_layer( SPDesktop *desktop, bool suppressDone = false );
void sp_selection_to_layer( SPDesktop *desktop, SPObject *layer, bool suppressDone = false );

void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine const &affine, bool set_i2d = true, bool compensate = true);
void sp_selection_remove_transform (SPDesktop *desktop);
void sp_selection_scale_absolute (Inkscape::Selection *selection, double x0, double x1, double y0, double y1);
void sp_selection_scale_relative(Inkscape::Selection *selection, Geom::Point const &align, Geom::Scale const &scale);
void sp_selection_rotate_relative (Inkscape::Selection *selection, Geom::Point const &center, gdouble angle);
void sp_selection_skew_relative (Inkscape::Selection *selection, Geom::Point const &align, double dx, double dy);
void sp_selection_move_relative (Inkscape::Selection *selection, Geom::Point const &move, bool compensate = true);
void sp_selection_move_relative (Inkscape::Selection *selection, double dx, double dy);

void sp_selection_rotate_90 (SPDesktop *desktop, bool ccw);
void sp_selection_rotate (Inkscape::Selection *selection, gdouble angle);
void sp_selection_rotate_screen (Inkscape::Selection *selection, gdouble angle);

void sp_selection_scale (Inkscape::Selection *selection, gdouble grow);
void sp_selection_scale_screen (Inkscape::Selection *selection, gdouble grow_pixels);
void sp_selection_scale_times (Inkscape::Selection *selection, gdouble times);

void sp_selection_move (Inkscape::Selection *selection, gdouble dx, gdouble dy);
void sp_selection_move_screen (Inkscape::Selection *selection, gdouble dx, gdouble dy);

void sp_selection_item_next (SPDesktop *desktop);
void sp_selection_item_prev (SPDesktop *desktop);

void sp_selection_next_patheffect_param(SPDesktop * dt);

void sp_selection_edit_clip_or_mask(SPDesktop * dt, bool clip);

enum SPSelectStrokeStyleType {
    SP_FILL_COLOR  = 0,
    SP_STROKE_COLOR  = 1,
    SP_STROKE_STYLE_WIDTH = 2,
    SP_STROKE_STYLE_DASHES = 3,
    SP_STROKE_STYLE_MARKERS = 4
};

void sp_select_same_fill_stroke_style(SPDesktop *desktop, gboolean fill, gboolean strok, gboolean style);
void sp_select_same_stroke_style(SPDesktop *desktop);
void sp_select_same_object_type(SPDesktop *desktop);
GSList *sp_get_same_fill_or_stroke_color(SPItem *sel, GSList *src, SPSelectStrokeStyleType type);
GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleType type);
GSList *sp_get_same_object_type(SPItem *sel, GSList *src);

void scroll_to_show_item(SPDesktop *desktop, SPItem *item);

void sp_undo (SPDesktop *desktop, SPDocument *doc);
void sp_redo (SPDesktop *desktop, SPDocument *doc);

void sp_selection_get_export_hints (Inkscape::Selection *selection, Glib::ustring &filename, float *xdpi, float *ydpi);
void sp_document_get_export_hints (SPDocument * doc, Glib::ustring &filename, float *xdpi, float *ydpi);

void sp_selection_create_bitmap_copy (SPDesktop *desktop);

void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer);
void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path);

bool fit_canvas_to_selection(SPDesktop *, bool with_margins = false);
void verb_fit_canvas_to_selection(SPDesktop *);
bool fit_canvas_to_drawing(SPDocument *, bool with_margins = false);
void verb_fit_canvas_to_drawing(SPDesktop *);
void fit_canvas_to_selection_or_drawing(SPDesktop *);

void unlock_all(SPDesktop *dt);
void unlock_all_in_all_layers(SPDesktop *dt);
void unhide_all(SPDesktop *dt);
void unhide_all_in_all_layers(SPDesktop *dt);

GSList *get_all_items(GSList *list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, bool ingroups, GSList const *exclude);

GSList *sp_degroup_list (GSList *items);

/* selection cycling */
typedef enum
{
    SP_CYCLE_SIMPLE,
    SP_CYCLE_VISIBLE, // cycle only visible items
    SP_CYCLE_FOCUS // readjust visible area to view selected item
} SPCycleType;



// TOOD fixme: This should be moved into preference repr
extern SPCycleType SP_CYCLING;

#endif // SEEN_SELECTION_CHEMISTRY_H