rubyosa 0.3.0.1 → 0.4.0
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/AUTHORS +3 -0
- data/bin/rdoc-osa +137 -78
- data/sample/Photoshop/new_doc.rb +13 -0
- data/sample/Photoshop/new_doc_with_text.rb +34 -0
- data/sample/iTunes/name_that_tune.rb +97 -0
- data/sample/iTunes/tag_genre_lastfm.rb +16 -4
- data/src/lib/rbosa.rb +808 -749
- data/src/lib/rbosa_properties.rb +7 -2
- data/src/rbosa.c +11 -1
- metadata +5 -2
data/src/lib/rbosa_properties.rb
CHANGED
@@ -30,8 +30,10 @@ module OSA
|
|
30
30
|
@sym_to_code = {}
|
31
31
|
@code_to_sym = {}
|
32
32
|
|
33
|
-
def self.add_property(sym, code)
|
34
|
-
|
33
|
+
def self.add_property(sym, code, override=false)
|
34
|
+
unless override
|
35
|
+
return if @sym_to_code.has_key?(sym) or @code_to_sym.has_key?(code)
|
36
|
+
end
|
35
37
|
@sym_to_code[sym] = code
|
36
38
|
@code_to_sym[code] = sym
|
37
39
|
end
|
@@ -134,3 +136,6 @@ end
|
|
134
136
|
:visible, 'pvis'
|
135
137
|
|
136
138
|
].each_slice(2) { |sym, code| OSA.add_property(sym, code) }
|
139
|
+
|
140
|
+
# A convenience shortcut to :point_size
|
141
|
+
OSA.add_property(:size, 'ptsz', true)
|
data/src/rbosa.c
CHANGED
@@ -271,6 +271,7 @@ rbosa_app_send_event (VALUE self, VALUE event_class, VALUE event_id, VALUE param
|
|
271
271
|
VALUE rb_timeout;
|
272
272
|
SInt32 timeout;
|
273
273
|
VALUE rb_reply;
|
274
|
+
unsigned has_direct_param;
|
274
275
|
|
275
276
|
error = AECreateAppleEvent (RVAL2FOURCHAR (event_class),
|
276
277
|
RVAL2FOURCHAR (event_id),
|
@@ -282,6 +283,7 @@ rbosa_app_send_event (VALUE self, VALUE event_class, VALUE event_id, VALUE param
|
|
282
283
|
rb_raise (rb_eArgError, "Cannot create Apple Event '%s%s' : %s (%d)",
|
283
284
|
RVAL2CSTR (event_class), RVAL2CSTR (event_id), error_code_to_string (error), error);
|
284
285
|
|
286
|
+
has_direct_param = 0;
|
285
287
|
if (!NIL_P (params)) {
|
286
288
|
unsigned i;
|
287
289
|
|
@@ -289,6 +291,7 @@ rbosa_app_send_event (VALUE self, VALUE event_class, VALUE event_id, VALUE param
|
|
289
291
|
VALUE ary;
|
290
292
|
VALUE type;
|
291
293
|
VALUE element;
|
294
|
+
FourCharCode code;
|
292
295
|
|
293
296
|
ary = RARRAY (params)->ptr[i];
|
294
297
|
if (NIL_P (ary) || RARRAY (ary)->len != 2)
|
@@ -296,6 +299,10 @@ rbosa_app_send_event (VALUE self, VALUE event_class, VALUE event_id, VALUE param
|
|
296
299
|
|
297
300
|
type = RARRAY (ary)->ptr[0];
|
298
301
|
element = RARRAY (ary)->ptr[1];
|
302
|
+
code = RVAL2FOURCHAR (type);
|
303
|
+
|
304
|
+
if (code == '----')
|
305
|
+
has_direct_param = 1;
|
299
306
|
|
300
307
|
error = AEPutParamDesc (&ae, RVAL2FOURCHAR (type), rbosa_element_aedesc (element));
|
301
308
|
if (error != noErr) {
|
@@ -308,7 +315,10 @@ rbosa_app_send_event (VALUE self, VALUE event_class, VALUE event_id, VALUE param
|
|
308
315
|
|
309
316
|
rb_timeout = rb_iv_get (mOSA, "@timeout");
|
310
317
|
timeout = NIL_P (rb_timeout) ? kAEDefaultTimeout : NUM2INT (rb_timeout);
|
311
|
-
|
318
|
+
|
319
|
+
if (has_direct_param == 0)
|
320
|
+
AEPutAttributePtr (&ae, 'subj', typeNull, NULL, 0);
|
321
|
+
|
312
322
|
error = AESend (&ae, &reply, (RVAL2CBOOL(need_retval) ? kAEWaitReply : kAENoReply) | kAECanInteract | kAECanSwitchLayer,
|
313
323
|
kAENormalPriority, timeout, NULL, NULL);
|
314
324
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rubyosa
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.4.0
|
7
|
+
date: 2007-04-11 00:00:00 +02:00
|
8
8
|
summary: A Ruby/AppleEvent bridge.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -55,6 +55,9 @@ files:
|
|
55
55
|
- sample/AddressBook/inspect.rb
|
56
56
|
- sample/iTunes/tag_genre_lastfm.rb
|
57
57
|
- data/rubyosa/rdoc_html.rb
|
58
|
+
- sample/Photoshop/new_doc.rb
|
59
|
+
- sample/Photoshop/new_doc_with_text.rb
|
60
|
+
- sample/iTunes/name_that_tune.rb
|
58
61
|
test_files: []
|
59
62
|
|
60
63
|
rdoc_options: []
|