-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.go
171 lines (149 loc) · 5.56 KB
/
action.go
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
package inkscape
import "fmt"
/*
action-list : Print a list of actions and exit.
convert-dpi-method : Import DPI convert method.
export-area : Export area.
export-area-drawing : Export drawing area.
export-area-page : Export page area.
export-area-snap : Export snap area to integer values.
export-background : Export background color.
export-background-opacity: Export background opacity.
export-do : Do export.
export-dpi : Export DPI.
export-filename : Export file name.
export-height : Export height.
export-id : Export id(s).
export-id-only : Export id(s) only.
export-ignore-filters: Export ignore filters.
export-latex : Export LaTeX.
export-margin : Export margin.
export-overwrite : Export over-write file.
export-pdf-version : Export PDF version.
export-plain-svg : Export as plain SVG.
export-ps-level : Export PostScript level.
export-text-to-path : Export convert text to paths.
export-type : Export file type.
export-use-hints : Export using saved hints.
export-width : Export width.
file-close : Close active document.
file-new : Open new document using template.
file-open : Open file.
inkscape-version : Print Inkscape version and exit.
no-convert-baseline : Import convert text baselines.
object-set-attribute: Set or update an attribute on selected objects. Usage: object-set-attribute:attribute name, attribute value;
object-set-property : Set or update a property on selected objects. Usage: object-set-property:property name, property value;
object-to-path : Convert shapes to paths.
object-unlink-clones: Unlink clones and symbols.
open-page : Import page number.
query-all : Query 'x', 'y', 'width', and 'height'.
query-height : Query 'height' value(s) of object(s).
query-width : Query 'width' value(s) of object(s).
query-x : Query 'x' value(s) of selected objects.
query-y : Query 'y' value(s) of selected objects.
quit-inkscape : Immediately quit Inkscape.
select : Select by ID (Deprecated)
select-all : Select all. Options: 'all' (every object including groups), 'layers', 'no-layers' (top level objects in layers), 'groups' (all groups including layers), 'no-groups' (all objects other than groups and layers, default).
select-by-class : Select by class
select-by-element : Select by SVG element (e.g. 'rect').
select-by-id : Select by ID
select-by-selector : Select by CSS selector
select-clear : Selection clear
select-invert : Invert selection. Options: 'all', 'layers', 'no-layers', 'groups', 'no-groups' (default).
select-list : Print a list of objects in current selection.
system-data-directory: Print system data directory and exit.
transform-remove : Remove any transforms from selected objects.
transform-rotate : Rotate selected objects by degrees.
transform-scale : Scale selected objects by scale factor.
transform-translate : Translate selected objects (dx,dy).
unselect : Unselect by ID (Deprecated)
unselect-by-id : Unselect by ID
user-data-directory : Print user data directory and exit.
vacuum-defs : Remove unused definitions (gradients, etc.).
verb : Execute verb(s).
verb-list : Print a list of verbs and exit.
window-close : Close the active window.
window-open : Open a window for the active document. GUI only.
*/
// DpiMethod define dpi method when converting
type DpiMethod string
// constant dpi method values
const (
DpiMethodNone DpiMethod = "none"
DpiMethodScaleViewbox = "scale-viewbox"
DpiMethodScaleDocument = "scale-document"
)
// ConvertDpiMethod .
func ConvertDpiMethod(method DpiMethod) string {
return "convert-dpi-method:" + string(method)
}
// ExportArea .
func ExportArea(x0, y0, x1, y1 int) string {
return fmt.Sprintf("export-area:%d:%d:%d:%d", x0, y0, x1, y1)
}
// ExportFileName .
func ExportFileName(filePath string) string {
return "export-filename:" + filePath
}
// ExportPdfVersion .
func ExportPdfVersion(version string) string {
return "export-pdf-version:" + version
}
// ExportDo .
func ExportDo() string {
return "export-do"
}
// FileOpen .
func FileOpen(filePath string) string {
return "file-open:" + filePath
}
// FileClose .
func FileClose() string {
return "file-close"
}
// SelectAll .
func SelectAll() string {
return "select-all"
}
// SelectByClass .
func SelectByClass(className string) string {
return "select-by-class:" + className
}
// SelectByElement .
func SelectByElement(elementName string) string {
return "select-by-element:" + elementName
}
// SelectByID .
func SelectByID(id string) string {
return "select-by-id:" + id
}
// SelectByCSS .
func SelectByCSS(query string) string {
return "select-by-selector:" + query
}
// SelectClear .
func SelectClear() string {
return "select-clear"
}
// InvertOption define option when invert selection
type InvertOption string
// invert selection option
const (
InvertOptionAll InvertOption = "all"
InvertOptionLayers = "layers"
InvertOptionNoLayers = "no-layers"
InvertOptionGroup = "group"
InvertOptionNoGroup = "no-group"
)
// SelectInvert .
func SelectInvert(option InvertOption) string {
return "select-invert:" + string(option)
}
// SelectList .
func SelectList() string {
return "select-list"
}
// Version print inksscape version and return
func Version() string {
return "inkscape-version"
}