Stringscan

Check-in [4152534079]
Login

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

Overview
Comment:Add acclerators
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 41525340793fb1d8168bed5d4e16e13c3a4f44413c2d23d8d6651be6604d5954
User & Date: kevin 2017-07-08 23:11:47
Context
2017-07-09
00:42
Tweak Tcl path check-in: 959c1b5a35 user: kevin tags: trunk
2017-07-08
23:11
Add acclerators check-in: 4152534079 user: kevin tags: trunk
03:14
Add files to Windows build check-in: 943324f2d0 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to stringscan.rb.

22
23
24
25
26
27
28






29
30
31
32
33
34
35
	TkPackage.require('fullscreen')
end
TkPackage.require('regproc')
TkPackage.require('machelp')
TkPackage.require('softwareupdate')
TkPackage.require('xplat')








class StringscanApp

#here we initialize our app class
def initialize

	$dirname = ""







>
>
>
>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	TkPackage.require('fullscreen')
end
TkPackage.require('regproc')
TkPackage.require('machelp')
TkPackage.require('softwareupdate')
TkPackage.require('xplat')

if $platform == 'aqua'
	$accelkey = 'Command'
else 
	$accelkey = 'Control'
end


class StringscanApp

#here we initialize our app class
def initialize

	$dirname = ""
136
137
138
139
140
141
142

143
144
145
146
147
148
149
150
151
152
153
154
155
		$appmenu.add :command, :label => 'About Stringscan', :command=> proc{aboutWindow}
		$appmenu.add :command, :label => 'License', :command=>proc{getReg}
		$appmenu.add :command, :label=>'Check for Updates', :command=>proc{checkUpdate}
		$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
	$helpmenu = TkSysMenu_Help.new($menubar)
	$menubar.add :cascade, :menu => $helpmenu, :label => 'Help'
	if $platform != 'aqua'







>
|
<
<
<

|







142
143
144
145
146
147
148
149
150



151
152
153
154
155
156
157
158
159
		$appmenu.add :command, :label => 'About Stringscan', :command=> proc{aboutWindow}
		$appmenu.add :command, :label => 'License', :command=>proc{getReg}
		$appmenu.add :command, :label=>'Check for Updates', :command=>proc{checkUpdate}
		$appmenu.add :separator
	end
	$searchmenu = TkMenu.new($menubar)
	$menubar.add :cascade, :menu => $searchmenu, :label => 'Search'
	$searchmenu.add :command, :label => 'Choose Directory...', 'accelerator' => "#{$accelkey}+O", :command => proc{choosedir}
	$searchmenu.add :command, :label => 'Run Search', 'accelerator' => "#{$accelkey}+R", :command => proc{stringgrep}



	if $platform == 'win32'
		$searchmenu.add :command, :label => "Exit", :command=>exit, 'accelerator' => "#{$accelkey}+Q"
	end
	if $platform == 'aqua'
		Tk.tk_call("windowlist::windowMenu",  $menubar)
	end
	$helpmenu = TkSysMenu_Help.new($menubar)
	$menubar.add :cascade, :menu => $helpmenu, :label => 'Help'
	if $platform != 'aqua'
170
171
172
173
174
175
176

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
		$helpmenu.add :command, :label=>'Check for Updates', :command=>proc{checkUpdate}
			end
	$root['menu'] = $menubar
	$mainframe = Tk::Tile::Frame.new($root).pack('side' => 'top','fill' => 'both','expand' => 'yes')
	
	#button frame and buttons
	$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
		padding 5







>




|
<
<
<







174
175
176
177
178
179
180
181
182
183
184
185
186



187
188
189
190
191
192
193
		$helpmenu.add :command, :label=>'Check for Updates', :command=>proc{checkUpdate}
			end
	$root['menu'] = $menubar
	$mainframe = Tk::Tile::Frame.new($root).pack('side' => 'top','fill' => 'both','expand' => 'yes')
	
	#button frame and buttons
	$buttonframe = Tk::Tile::Frame.new($mainframe){padding 2}.pack('side' => 'top','fill' => 'both','expand' => 'no')
	choosedirproc = proc{choosedir}
	$choosebutton = Tk::Tile::Button.new($buttonframe) {
		image $folderimage
		takefocus 0
		padding 5
		command  choosedirproc



	}.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
		padding 5
254
255
256
257
258
259
260













261
262
263
264
265
266
267
		highlightcolor 'SlateGray3'
		bg 'white'
		state 'disabled'
	}.pack('side'=>'left','fill' => 'both', 'expand' => 'yes')
	$tscrollframe = Tk::Frame.new($bottomrightframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
	$tscroll = Tk::Scrollbar.new($tscrollframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
	$tbox.yscrollbar($tscroll)













end

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







>
>
>
>
>
>
>
>
>
>
>
>
>







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
		highlightcolor 'SlateGray3'
		bg 'white'
		state 'disabled'
	}.pack('side'=>'left','fill' => 'both', 'expand' => 'yes')
	$tscrollframe = Tk::Frame.new($bottomrightframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
	$tscroll = Tk::Scrollbar.new($tscrollframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
	$tbox.yscrollbar($tscroll)
	
	$root.bind("#{$accelkey}-Q", proc{exit})
	$root.bind("#{$accelkey}-q", proc{exit})
	$root.bind("#{$accelkey}-O", proc{choosedir})
	$root.bind("#{$accelkey}-o", proc{choosedir})
	$root.bind("#{$accelkey}-R", proc{stringgrep})
	$root.bind("#{$accelkey}-r", proc{stringgrep})
end

#select search directory
def choosedir
	$dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
	$direntry.value = $dirname
end

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