gtk2svg 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/gtk2svg.rb +44 -3
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccfe25fe699cb9ee62a6052c6512f9891b917fad
|
4
|
+
data.tar.gz: 038eb2d824b87dd9a6fe60b115cb402a121c77b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb71e6657fc4ed46441d8cab2f137607208cc9cfb465757fefe6d149d9cfc20e558527601563dcdf1e832ac02d11f4cb45e90c26d5ffe0607b8242c1593af313
|
7
|
+
data.tar.gz: a540fd61abe55be7dc3a7e293ab9cba2860022e9c2b4710ecb06ef75356b80570b5c84bcffbc5c9324148476ad134e0464b7313a8199be1196787705f93c7dd2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/gtk2svg.rb
CHANGED
@@ -14,9 +14,16 @@ module Gtk2SVG
|
|
14
14
|
|
15
15
|
class Render < DomRender
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
|
18
|
+
def circle(e, attributes, style)
|
19
|
+
|
20
|
+
h = attributes
|
21
|
+
|
22
|
+
x, y= %i(cx cy).map{|x| h[x].to_i }
|
23
|
+
radius = h[:r].to_i * 2
|
24
|
+
|
25
|
+
[:draw_arc, [x, y, radius, radius], style, render_all(e)]
|
26
|
+
end
|
20
27
|
|
21
28
|
def ellipse(e, attributes, style)
|
22
29
|
|
@@ -48,6 +55,14 @@ module Gtk2SVG
|
|
48
55
|
[:draw_rectangle, [x1, y1, x2, y2], style, render_all(e)]
|
49
56
|
end
|
50
57
|
|
58
|
+
def script(e, attributes, style)
|
59
|
+
[:script]
|
60
|
+
end
|
61
|
+
|
62
|
+
def svg(x, attributes, style)
|
63
|
+
[:window, render_all(x)]
|
64
|
+
end
|
65
|
+
|
51
66
|
def text(e, attributes, style)
|
52
67
|
|
53
68
|
style.merge!({font_size: '20'})
|
@@ -122,6 +137,10 @@ module Gtk2SVG
|
|
122
137
|
def render(a)
|
123
138
|
draw a
|
124
139
|
end
|
140
|
+
|
141
|
+
def script(args)
|
142
|
+
|
143
|
+
end
|
125
144
|
|
126
145
|
private
|
127
146
|
|
@@ -176,6 +195,7 @@ module Gtk2SVG
|
|
176
195
|
|
177
196
|
class Main
|
178
197
|
|
198
|
+
|
179
199
|
attr_accessor :doc, :svg
|
180
200
|
attr_reader :width, :height
|
181
201
|
|
@@ -184,6 +204,7 @@ module Gtk2SVG
|
|
184
204
|
@svg = svg
|
185
205
|
@doc = Svgle.new(svg, callback: self)
|
186
206
|
@area = area = Gtk::DrawingArea.new
|
207
|
+
client_code = []
|
187
208
|
|
188
209
|
window = Gtk::Window.new
|
189
210
|
width, height = %i(width height).map{|x| @doc.root.attributes[x] }
|
@@ -199,12 +220,32 @@ module Gtk2SVG
|
|
199
220
|
drawing.render a
|
200
221
|
end
|
201
222
|
|
223
|
+
area.add_events(Gdk::Event::POINTER_MOTION_MASK)
|
224
|
+
|
225
|
+
area.signal_connect('motion_notify_event') do |item, event|
|
226
|
+
|
227
|
+
@doc.root.each_recursive do |x|
|
228
|
+
|
229
|
+
eval x.text.unescape if x.name == 'script'
|
230
|
+
|
231
|
+
if x.attributes[:onmousemove] and x.hotspot? event.x, event.y then
|
232
|
+
#onmousemove(event.x,event.y)
|
233
|
+
eval x.onmousemove()
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
202
239
|
window.add(area).show_all
|
203
240
|
window.show_all.signal_connect("destroy"){Gtk.main_quit}
|
204
241
|
|
205
242
|
Thread.new {Gtk.main }
|
206
243
|
end
|
207
244
|
|
245
|
+
def onmousemove(x,y)
|
246
|
+
|
247
|
+
end
|
248
|
+
|
208
249
|
def refresh()
|
209
250
|
@area.queue_draw
|
210
251
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtk2svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
fnNu6z0ydxzHCvBhE0pU4jDzxPTASZiyllpSpQgz9OX3DAlUgWFQLHmj1hGk6GH4
|
32
32
|
QldMu2GTc/3h2w==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-11-
|
34
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: gtk2
|
metadata.gz.sig
CHANGED
Binary file
|