Stringscan

Check-in [21d76d7da6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More polish
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:21d76d7da66c25c3e365fbd49e00db5f7f6122b745eb5cb6cedc11ede6a1855d
User & Date: kevin 2017-06-11 04:52:04
Context
2017-06-12
03:39
Refine selection of files in listbox check-in: b5b1f268c0 user: kevin tags: trunk
2017-06-11
04:52
More polish check-in: 21d76d7da6 user: kevin tags: trunk
04:20
More refinements check-in: 8ff20c9b76 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to stringscan.rb.

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
179
180
181
182
183
184
185

186
187
188
189
190
191

192
193
194
195
196
197
198
199
200
201
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
      $appmenu.add :command, :label => 'About Stringscan', :command=> proc{aboutWindow}
      $appmenu.add :separator
    end
    $searchmenu = TkMenu.new($menubar)
    $menubar.add :cascade, :menu => $searchmenu, :label => 'Search'
    $searchmenu.add :command, :label => 'Run Search', :command => proc{stringgrep}
    $searchmenu.add :command, :label => 'Choose Directory...', :command => proc{ $dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
      $dirname.value = $dirname
    }
    if $platform == 'win32'
      $searchmenu.add :command, :label => "Exit", :command=>exit
    end
    if $platform == 'aqua'
      Tk.tk_call("windowlist::windowMenu",  $menubar)
    end
................................................................................
    $buttonframe = Tk::Tile::Frame.new($mainframe){padding 2}.pack('side' => 'top','fill' => 'both','expand' => 'no')
    $choosebutton = Tk::Tile::Button.new($buttonframe) {
      image $folderimage
      takefocus 0
      padding 5
      command  proc{
        $dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
        $dirname.value = $dirname
      }
    }.pack('side' => 'left','fill' => 'both','expand' => 'no')
    Tk::RbWidget::BalloonHelp.new($choosebutton, 'text'=>'Select Directory', 'background'=>'lightyellow', 'relief'=>'flat')
    stringgrepProc = proc {stringgrep}
    $runbutton = Tk::Tile::Button.new($buttonframe) {
      image $glassimage
      takefocus 0
................................................................................
      begin
      if $lbox.curselection.empty?
        return
      else
        highlighttext TkSelection.get
      end
      rescue

      end
    }
  end

  #read file for display in text widget
  def highlighttext(file)

   $tbox.delete('1.0', 'end') 
   f = open(file, 'rb')
   $tbox.configure('state'=>'normal')
    while(!f.eof?)
      $tbox.insert('end', f.read(1000))
	end
    f.close
    $tbox.configure('state'=>'disabled')
    $tbox.tag_configure('search', :background=>'yellow')
    sethighlight
................................................................................
    :icon => 'info', :title => 'About Stringscan',
    :parent => $root
  end

 
  #here we initialize our app class
   def initialize
    $dirname = nil
    $searchterm = nil

        if $platform == 'aqua'
          ##map Ruby proc to "odoc" Apple Event
          setDir = Tk.install_cmd(proc{
                               |*args|
                               filename=(args[0]).delete('{}')
                               begin







|







 







|







 







>






>


<







 







|
|







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

196
197
198
199
200
201
202
...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
      $appmenu.add :command, :label => 'About Stringscan', :command=> proc{aboutWindow}
      $appmenu.add :separator
    end
    $searchmenu = TkMenu.new($menubar)
    $menubar.add :cascade, :menu => $searchmenu, :label => 'Search'
    $searchmenu.add :command, :label => 'Run Search', :command => proc{stringgrep}
    $searchmenu.add :command, :label => 'Choose Directory...', :command => proc{ $dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
      $direntry.value = $dirname
    }
    if $platform == 'win32'
      $searchmenu.add :command, :label => "Exit", :command=>exit
    end
    if $platform == 'aqua'
      Tk.tk_call("windowlist::windowMenu",  $menubar)
    end
................................................................................
    $buttonframe = Tk::Tile::Frame.new($mainframe){padding 2}.pack('side' => 'top','fill' => 'both','expand' => 'no')
    $choosebutton = Tk::Tile::Button.new($buttonframe) {
      image $folderimage
      takefocus 0
      padding 5
      command  proc{
        $dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
        $direntry.value = $dirname
      }
    }.pack('side' => 'left','fill' => 'both','expand' => 'no')
    Tk::RbWidget::BalloonHelp.new($choosebutton, 'text'=>'Select Directory', 'background'=>'lightyellow', 'relief'=>'flat')
    stringgrepProc = proc {stringgrep}
    $runbutton = Tk::Tile::Button.new($buttonframe) {
      image $glassimage
      takefocus 0
................................................................................
      begin
      if $lbox.curselection.empty?
        return
      else
        highlighttext TkSelection.get
      end
      rescue
        raise
      end
    }
  end

  #read file for display in text widget
  def highlighttext(file)
   $tbox.configure('state'=>'normal')
   $tbox.delete('1.0', 'end') 
   f = open(file, 'rb')

    while(!f.eof?)
      $tbox.insert('end', f.read(1000))
	end
    f.close
    $tbox.configure('state'=>'disabled')
    $tbox.tag_configure('search', :background=>'yellow')
    sethighlight
................................................................................
    :icon => 'info', :title => 'About Stringscan',
    :parent => $root
  end

 
  #here we initialize our app class
   def initialize
    $dirname = ""
    $searchterm = ""

        if $platform == 'aqua'
          ##map Ruby proc to "odoc" Apple Event
          setDir = Tk.install_cmd(proc{
                               |*args|
                               filename=(args[0]).delete('{}')
                               begin