drx 0.4.4 → 0.4.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.
- data/ext/drx_core.c +5 -0
- data/lib/drx/graphviz.rb +1 -1
- data/lib/drx/tk/app.rb +25 -6
- data/lib/drx/tk/imagemap.rb +5 -2
- metadata +2 -2
data/ext/drx_core.c
CHANGED
@@ -72,7 +72,12 @@ static VALUE t_get_super(VALUE self, VALUE obj)
|
|
72
72
|
if (TYPE(obj) != T_CLASS && TYPE(obj) != T_ICLASS && TYPE(obj) != T_MODULE) {
|
73
73
|
rb_raise(rb_eTypeError, "Only T_CLASS/T_MODULE is expected as the argument (got %d)", TYPE(obj));
|
74
74
|
}
|
75
|
+
#ifdef RCLASS_SUPER
|
76
|
+
// Ruby 1.8.7 and above have this macro.
|
75
77
|
return RCLASS_SUPER(obj) ? RCLASS_SUPER(obj) : Qnil;
|
78
|
+
#else
|
79
|
+
return RCLASS(obj)->super ? RCLASS(obj)->super : Qnil;
|
80
|
+
#endif
|
76
81
|
}
|
77
82
|
|
78
83
|
/**
|
data/lib/drx/graphviz.rb
CHANGED
@@ -236,7 +236,7 @@ module Drx
|
|
236
236
|
# of included modules, or modules included in them). To prevent
|
237
237
|
# clutter we print the arrow to Module only if it comes from
|
238
238
|
# Class (or a module included in it).
|
239
|
-
return (my_ancestors + [self]).include?
|
239
|
+
return (my_ancestors + [self]).include?(_Class)
|
240
240
|
#
|
241
241
|
# A somewhat irrelevant note (I don't have a better place to put it):
|
242
242
|
#
|
data/lib/drx/tk/app.rb
CHANGED
@@ -8,7 +8,25 @@ module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = true; end
|
|
8
8
|
require 'tk'
|
9
9
|
require 'drx/tk/imagemap'
|
10
10
|
|
11
|
-
Tk
|
11
|
+
# -------- Start of legacy Tk handling ------------
|
12
|
+
#
|
13
|
+
# Tweaks for old Ruby/Tk should go here.
|
14
|
+
#
|
15
|
+
require 'tkextlib/tile' if !defined? Tk::Tile
|
16
|
+
if Tk.respond_to? :default_widget_set
|
17
|
+
# Replace all legacy widgets by their nifty Tile versions.
|
18
|
+
Tk.default_widget_set = :Ttk
|
19
|
+
else
|
20
|
+
# The non-Tile Panedwindow doesn't support :weight
|
21
|
+
class TkPanedwindow
|
22
|
+
alias original_add add
|
23
|
+
def add(what, opts = {})
|
24
|
+
opts.delete :weight
|
25
|
+
original_add(what, opts)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
# -------- End of legacy Tk handling ------------
|
12
30
|
|
13
31
|
module Drx
|
14
32
|
module TkGUI
|
@@ -40,7 +58,7 @@ module Drx
|
|
40
58
|
def initialize
|
41
59
|
@navigation_history = []
|
42
60
|
@eval_history = LineHistory.new
|
43
|
-
@graph_opts = { :size => '
|
61
|
+
@graph_opts = { :size => '90%', :style => 'default' }
|
44
62
|
|
45
63
|
@eval_entry = TkEntry.new(toplevel) {
|
46
64
|
font 'Courier'
|
@@ -91,7 +109,7 @@ module Drx
|
|
91
109
|
}
|
92
110
|
|
93
111
|
@graph_size_menu = Tk::Tile::Combobox.new(toplevel) {
|
94
|
-
set '
|
112
|
+
set '90%'
|
95
113
|
values ['100%', '90%', '80%', '60%']
|
96
114
|
state :readonly
|
97
115
|
width 6
|
@@ -209,8 +227,8 @@ module Drx
|
|
209
227
|
def system_customizations
|
210
228
|
if Application.first_window?
|
211
229
|
# Try to make the Unixy GUI less ugly.
|
212
|
-
if Tk.windowingsystem == 'x11' and
|
213
|
-
|
230
|
+
if Tk::Tile.respond_to? :themes and Tk.windowingsystem == 'x11' and Tk::Tile.themes.include? 'clam'
|
231
|
+
Tk::Tile.set_theme 'clam'
|
214
232
|
end
|
215
233
|
end
|
216
234
|
end
|
@@ -387,7 +405,7 @@ module Drx
|
|
387
405
|
when :rest; '*' + (arg[1] || 'args').to_s
|
388
406
|
when :block; '&' + (arg[1] || 'arg').to_s
|
389
407
|
end
|
390
|
-
end.join
|
408
|
+
end.join(', ')
|
391
409
|
rescue NameError
|
392
410
|
return '---'
|
393
411
|
rescue SyntaxError => e
|
@@ -433,6 +451,7 @@ module Drx
|
|
433
451
|
Tempfiles.new do |files|
|
434
452
|
ObjInfo.new(obj).generate_diagram(files, @graph_opts)
|
435
453
|
if (output = Tk.getSaveFile(:parent => toplevel, :defaultextension => '.gif')) != ''
|
454
|
+
require 'fileutils'
|
436
455
|
FileUtils.cp(files['gif'], output)
|
437
456
|
end
|
438
457
|
end
|
data/lib/drx/tk/imagemap.rb
CHANGED
@@ -198,8 +198,11 @@ module TkImageMap
|
|
198
198
|
# If there are few sides, we assume it's a real polygon.
|
199
199
|
return nil
|
200
200
|
end
|
201
|
-
|
202
|
-
|
201
|
+
# Alas, Ruby 1.8.6 doesn't have #minmax
|
202
|
+
xs = points.map {|p| p[0]}
|
203
|
+
ys = points.map {|p| p[1]}
|
204
|
+
x_min, x_max = xs.min, xs.max
|
205
|
+
y_min, y_max = ys.min, ys.max
|
203
206
|
# @todo: try to figure out if the points trace a circle?
|
204
207
|
#center_x = x_min + (x_max - x_min) / 2.0
|
205
208
|
#center_y = y_min + (y_max - y_min) / 2.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mooffie
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-04-
|
12
|
+
date: 2010-04-21 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|