Browse Subversion Repository
Contents of /trunk/Ruby_Scripts/100.startup.rb
Parent Directory
| Revision Log
Revision 83 -
( show annotations)
( download)
Sun May 28 14:02:43 2017 UTC
(6 years, 10 months ago)
by toshinagata1964
File size: 1298 byte(s)
'Paste (merge)' and 'Paste with replace' commands are implemented. Previous 'Paste' command is now 'Paste with replace'. 'Paste (merge)' is identical to 'Merge'; the 'Merge' command will be deprecated later.
| 1 |
# Copyright (c) 2010-2017 Toshi Nagata. All rights reserved. |
| 2 |
# |
| 3 |
# This program is free software; you can redistribute it and/or modify |
| 4 |
# it under the terms of the GNU General Public License as published by |
| 5 |
# the Free Software Foundation version 2 of the License. |
| 6 |
# |
| 7 |
# This program is distributed in the hope that it will be useful, |
| 8 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 |
# GNU General Public License for more details. |
| 11 |
|
| 12 |
# This Ruby script is automatically invoked on startup |
| 13 |
|
| 14 |
# Do some initialization here |
| 15 |
|
| 16 |
# Convenience methods for MRDialog |
| 17 |
# These definitions allow MRDialog#run and MRDialog#new to accept a block, |
| 18 |
# which is executed under the context of the MRDialog object. |
| 19 |
class Dialog |
| 20 |
|
| 21 |
def self.run(*args, &block) |
| 22 |
obj = Dialog.new(*args) |
| 23 |
obj.instance_eval(&block) |
| 24 |
obj.run |
| 25 |
end |
| 26 |
|
| 27 |
alias initialize_orig initialize |
| 28 |
|
| 29 |
def initialize(*args, &block) |
| 30 |
initialize_orig(*args) |
| 31 |
instance_eval(&block) if block |
| 32 |
end |
| 33 |
|
| 34 |
def value(tag) |
| 35 |
attr(tag, :value) |
| 36 |
end |
| 37 |
|
| 38 |
def set_value(tag, value) |
| 39 |
set_attr(tag, :value=>value) |
| 40 |
value |
| 41 |
end |
| 42 |
|
| 43 |
end |
| 44 |
|
| 45 |
class Sequence |
| 46 |
|
| 47 |
def has_selection |
| 48 |
each_track { |tr| |
| 49 |
if tr.selection.length > 0 |
| 50 |
return true |
| 51 |
end |
| 52 |
} |
| 53 |
return false |
| 54 |
end |
| 55 |
|
| 56 |
end |
|