~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to ext/tk/sample/demos-jp/search.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2010-07-31 17:08:39 UTC
  • mfrom: (1.1.4 upstream) (8.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100731170839-j034dmpdqt1cc4p6
Tags: 1.9.2~svn28788-1
* New release based on upstream snapshot from the 1.9.2 branch,
  after 1.9.2 RC2. That branch is (supposed to be) binary-compatible
  with the 1.9.1 branch.
  + Builds fine on i386. Closes: #580852.
* Upgrade to Standards-Version: 3.9.1. No changes needed.
* Updated generated incs.
* Patches that still need work:
  + Unclear status, need more investigation:
   090729_fix_Makefile_deps.dpatch
   090803_exclude_rdoc.dpatch
   203_adjust_base_of_search_path.dpatch
   902_define_YAML_in_yaml_stringio.rb.dpatch
   919_common.mk_tweaks.dpatch
   931_libruby_suffix.dpatch
   940_test_thread_mutex_sync_shorter.dpatch
  + Maybe not needed anymore, keeping but not applying.
   102_skip_test_copy_stream.dpatch (test doesn't block anymore?)
   104_skip_btest_io.dpatch (test doesn't block anymore?)
   201_gem_prelude.dpatch (we don't use that rubygems anyway?)
   202_gem_default_dir.dpatch (we don't use that rubygems anyway?)
   940_test_file_exhaustive_fails_as_root.dpatch
   940_test_priority_fails.dpatch
   100518_load_libc_libm.dpatch
* Add disable-tests.diff: disable some tests that cause failures on FreeBSD.
  Closes: #590002, #543805, #542927.
* However, many new failures on FreeBSD. Since that version is still an
  improvement, add the check that makes test suite failures non-fatal on
  FreeBSD again. That still needs to be investigated.
* Re-add 903_skip_base_ruby_check.dpatch
* Add build-dependency on ruby1.8 and drop all pre-generated files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
def textToggle(cmd1,sleep1,cmd2,sleep2)
60
60
  sleep_list = [sleep2, sleep1]
61
 
  TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, 
 
61
  TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep},
62
62
              -1, cmd1, cmd2).start(sleep1)
63
63
end
64
64
 
65
65
# toplevel widget ��¸�ߤ���к������
66
66
if defined?($search_demo) && $search_demo
67
 
  $search_demo.destroy 
 
67
  $search_demo.destroy
68
68
  $search_demo = nil
69
69
end
70
70
 
98
98
 
99
99
# frame ����
100
100
TkFrame.new(base_frame) {|f|
101
 
  TkLabel.new(f, 'text'=>'�ե�����̾:', 
 
101
  TkLabel.new(f, 'text'=>'�ե�����̾:',
102
102
              'width'=>13, 'anchor'=>'w').pack('side'=>'left')
103
103
  $search_fileName = TkVariable.new
104
 
  TkEntry.new(f, 'width'=>40, 
 
104
  TkEntry.new(f, 'width'=>40,
105
105
              'textvariable'=>$search_fileName) {
106
106
    pack('side'=>'left')
107
107
    bind('Return', proc{textLoadFile($search_text, $search_fileName.value)
108
108
                        $search_string_entry.focus})
109
109
    focus
110
110
  }
111
 
  TkButton.new(f, 'text'=>'�ɤ߹���', 
112
 
               'command'=>proc{textLoadFile($search_text, 
 
111
  TkButton.new(f, 'text'=>'�ɤ߹���',
 
112
               'command'=>proc{textLoadFile($search_text,
113
113
                                            $search_fileName.value)})\
114
114
  .pack('side'=>'left', 'pady'=>5, 'padx'=>10)
115
115
}.pack('side'=>'top', 'fill'=>'x')
116
116
 
117
117
TkFrame.new(base_frame) {|f|
118
 
  TkLabel.new(f, 'text'=>'����ʸ����:', 
 
118
  TkLabel.new(f, 'text'=>'����ʸ����:',
119
119
              'width'=>13, 'anchor'=>'w').pack('side'=>'left')
120
120
  $search_searchString = TkVariable.new
121
 
  $search_string_entry = TkEntry.new(f, 'width'=>40, 
 
121
  $search_string_entry = TkEntry.new(f, 'width'=>40,
122
122
                                     'textvariable'=>$search_searchString) {
123
123
    pack('side'=>'left')
124
 
    bind('Return', proc{textSearch($search_text, $search_searchString.value, 
 
124
    bind('Return', proc{textSearch($search_text, $search_searchString.value,
125
125
                                   $search_Tag)})
126
126
  }
127
 
  TkButton.new(f, 'text'=>'ȿž', 
128
 
               'command'=>proc{textSearch($search_text, 
129
 
                                          $search_searchString.value, 
 
127
  TkButton.new(f, 'text'=>'ȿž',
 
128
               'command'=>proc{textSearch($search_text,
 
129
                                          $search_searchString.value,
130
130
                                          $search_Tag)}) {
131
131
    pack('side'=>'left', 'pady'=>5, 'padx'=>10)
132
132
  }
139
139
    pack('side'=>'right', 'fill'=>'y')
140
140
  }
141
141
  pack('expand'=>'yes', 'fill'=>'both')
142
 
}  
 
142
}
143
143
 
144
144
# Set up display styles for text highlighting.
145
145
 
146
146
if TkWinfo.depth($search_demo) > 1
147
147
  textToggle(proc{
148
 
               $search_Tag.configure('background'=>'#ce5555', 
 
148
               $search_Tag.configure('background'=>'#ce5555',
149
149
                                     'foreground'=>'white')
150
150
             },
151
 
             800, 
 
151
             800,
152
152
             proc{
153
153
               $search_Tag.configure('background'=>'', 'foreground'=>'')
154
154
             },
155
155
             200 )
156
156
else
157
157
  textToggle(proc{
158
 
               $search_Tag.configure('background'=>'black', 
 
158
               $search_Tag.configure('background'=>'black',
159
159
                                     'foreground'=>'white')
160
160
             },
161
 
             800, 
 
161
             800,
162
162
             proc{
163
163
               $search_Tag.configure('background'=>'', 'foreground'=>'')
164
164
             },