Updated 2003-09-09 04:52:09

This page describes the changes to gui.tcl that are required for Wikit to run on the PocketPC:

  • Replace the use of gbuttons with standard buttons. While this doesn't look as nice, gbuttons use IncrTcl, and as far as I know, IncrTcl isn't available on PocketPC yet.
  • Add an "Exit" button. This is useful since menu's and the "X" button don't work with Tcl 8.4.4 on the PocketPC.
  • Change the layout of the buttons and search input box to better fit in the PocketPC's (small) screen dimensions.
  • Automatically change the size of the window when editing so that the PocketPC keyboard doesn't obscure the input.

This patch is against Wikit version: 2003/08/20 19:06:22 68261-69214.

Patch gui.tcl:
 17,19d16
 < if {[catch {package require gbutton}]} {
 <     puts stderr "cannot load gbutton"
 < } else {
 105c102
 <         focus $top.n.enter
 ---
 >         focus $top.n.f2.enter
 108c105
 <         gButton::modify Back \
 ---
 > 	$top.n.f0.back \
 134c131
 <         if {![string equal [gButton::cget Back -text] Back]} {
 ---
 >         if {![string equal [$top.n.f0.back cget -text] Back]} {
 136,139c133,136
 <           gButton::modify Back -text Back -command "Wikit::ShowPage"
 <           gButton::modify Forward -text Forward -command "Wikit::ShowPage -1"
 <           gButton::modify Home -text Home -command "Wikit::ShowPage $toppage"
 < 	  gButton::modify Edit -text Edit -command "Wikit::EditPage"
 ---
 > 	    $top.n.f0.back configure -text Back -command "Wikit::ShowPage"
 > 	    $top.n.f0.forward configure -text Forward -command "Wikit::ShowPage -1"
 > 	    $top.n.f0.home configure -text Home -command "Wikit::ShowPage $toppage"
 > 	    $top.n.f0.edit configure -text Edit -command "Wikit::EditPage"
 142c139
 <         gButton::modify Edit -state normal
 ---
 >         $top.n.f0.edit configure -state normal
 162c159
 <       $top.n.mode configure -text Search:
 ---
 >       $top.n.f2.mode configure -text Search:
 194c191
 <       focus $top.n.enter
 ---
 >       focus $top.n.f2.enter
 196c193
 <           gButton::modify Home -state disabled
 ---
 > 	  $top.n.f0.home configure -state disabled
 198c195
 <           gButton::modify Home -state normal
 ---
 > 	  $top.n.f0.home configure -state normal
 201c198
 <           gButton::modify Help -state disabled
 ---
 > 	  $top.n.f1.help configure -state disabled
 203c200
 <           gButton::modify Help -state normal
 ---
 > 	  $top.n.f1.help configure -state normal
 212a210,211
 >       variable topwin
 >
 218,227c217,228
 <       gButton::modify Back -text Cancel -command "Wikit::ShowPage $id
 <         $D tag configure fixed -foreground $Color::fixedFg -background $Color::fixedBg -font wikit_fixed -wrap none
 < 	    " -state normal
 <       gButton::modify Forward -text Save -command "
 <         $D tag configure fixed -foreground $Color::fixedFg -background $Color::fixedBg -font wikit_fixed -wrap none
 < 		SavePage $id \[$D get 1.0 end\] local \[$top.n.enter get\]
 < 		Wikit::ShowPage $id" -state normal
 <       gButton::modify Home -text Copy -state disabled -command Wikit::Copy
 <       gButton::modify Edit -text Paste -state normal -command Wikit::Paste
 <       gButton::modify Help -state disabled
 ---
 >       $top.n.f0.back configure -text Cancel -command "Wikit::ShowPage $id
 >              wm geometry $topwin 236x267+0+4
 >              $D tag configure fixed -foreground $Color::fixedFg -background $Color::fixedBg -font wikit_fixed -wrap none" \
 > 	     -state normal
 >       $top.n.f0.forward configure -text Save -command "
 >           wm geometry $topwin 236x267+0+4
 > 	  $D tag configure fixed -foreground $Color::fixedFg -background $Color::fixedBg -font wikit_fixed -wrap none
 > 	  SavePage $id \[$D get 1.0 end\] local \[$top.n.f2.enter get\]
 > 	  Wikit::ShowPage $id" -state normal
 >       $top.n.f0.home configure -text Copy -state disabled -command Wikit::Copy
 >       $top.n.f0.edit configure -text Paste -state normal -command Wikit::Paste
 >       $top.n.f1.help configure -state disabled
 230c231
 <       $top.n.mode configure -text "Edit Title:"
 ---
 >       $top.n.f2.mode configure -text "Edit Title:"
 236a238
 >       wm geometry $topwin 236x190+0+4
 246a249
 >       variable top
 252c255
 < 		gButton::modify Forward -state normal
 ---
 > 		$top.n.f0.forward configure -state normal
 276c279
 < 	gButton::modify Back -text Back -command "Wikit::ShowPage"
 ---
 > 	$top.n.f0.back configure -text Back -command "Wikit::ShowPage"
 279c282
 < 	gButton::modify Forward -state disabled
 ---
 > 	    $top.n.f0.forward configure -state disabled
 283c286
 < 	gButton::modify Back -state $state
 ---
 > 	$top.n.f0.back configure -state $state
 335,336d337
 <
 <         gButton::init -bg $Color::wikiBg -font wikit_button -disabledfill $Color::btnDisable
 350,354c351,356
 <         set b0 [gButton #auto $top.n.f0]
 <         $b0 new Back
 <         $b0 new Forward
 <         $b0 new Home
 <         label $top.n.mode -width 7 -anchor e -bg $Color::wikiBg \
 ---
 >         button $top.n.f0.back -command "Wikit::ShowPage" -text Back
 >         button $top.n.f0.forward -command "Wikit::ShowPage -1" -text Forward
 >         button $top.n.f0.home -command "Wikit::ShowPage $toppage" -text Home
 > 	button $top.n.f0.exit -command exit -text Exit
 > 	frame $top.n.f2 -background $Color::wikiBg
 >         label $top.n.f2.mode -width 7 -anchor e -bg $Color::wikiBg \
 356,359c358,361
 <         entry $top.n.enter -textvariable Wikit::currMode -font wikit_default
 <         if {!$readonly} {
 <           $b0 new Edit
 <           gButton::modify Edit -command "Wikit::EditPage"
 ---
 >         entry $top.n.f2.enter -textvariable Wikit::currMode -font wikit_default
 > 	pack $top.n.f2.mode $top.n.f2.enter -side left -padx 2
 > 	if {!$readonly} {
 >           button $top.n.f0.edit -command "Wikit::EditPage" -text Edit
 361,364c363,365
 <         $b0 size
 <         pack $top.n.f0 -side left -padx 0 -pady 0
 <         pack $top.n.mode -side left -padx 4 -pady 4
 <         pack $top.n.enter -side left -padx 4 -expand 1 -fill x
 ---
 > 	pack $top.n.f0.back $top.n.f0.forward $top.n.f0.home $top.n.f0.edit $top.n.f0.exit -side left -padx 2
 > 	pack $top.n.f0 -side top -padx 0 -pady 0 -expand 1 -fill x
 >         pack $top.n.f2 -side bottom -padx 0 -expand 1 -fill x
 366,368c367,368
 <         set b1 [gButton #auto $top.n.f1]
 <         $b1 new Help
 <         $b1 size
 ---
 >         button $top.n.f1.help -text [lindex [GetTitle 3] 0] \
 >                                 -command "Wikit::ShowPage 3"
 413,416d412
 <         gButton::modify Back -command "Wikit::ShowPage"
 <         gButton::modify Forward -command "Wikit::ShowPage -1"
 <         gButton::modify Help -text [lindex [GetTitle 3] 0] \
 <                                 -command "Wikit::ShowPage 3"
 419d414
 <       gButton::modify Home -command "Wikit::ShowPage $toppage"
 423a419
 >       wm geometry $topwin 236x267+0+4
 428c424
 <       wm minsize $topwin [winfo width $topwin] [winfo height $topwin]
 ---
 > #      wm minsize $topwin [winfo width $topwin] [winfo height $topwin]
 439a436
 >       variable top
 454c451
 <       set txt [gButton::cget Edit -text]
 ---
 >       set txt [$top.n.f0.edit cget -text]
 502a500,501
 > 	variable top
 >
 508c507
 <       gButton::modify Home -state $state
 ---
 >       $top.n.f0.home configure -state $state
 512d510
 < }