Page '''Notebook App - User Supplied Patches''' To use a patch, copy & paste into regular file and remove the first character, which is always a space here (for preformatted text). Later you can use it like follows: $ tar xvzf notebook.tar.gz $ cd notebookkit $ patch -p1 < patchfile patching file Makefile ... Patch 0: *********************************************************************** Patch file for notebook Version 1.1 Turns original Makefile into Unix Makefile, thereby assuming that TCL installation is under /usr/local/tcl, with the library directory at TCLLIB=/usr/local/tcl/lib and the packages are located under $(TCLLIB)/bwidget1.6 $(TCLLIB)/tcllib1.4 $(TCLLIB)/snit $(TCLLIB)/trycatch *********************************************************************** diff -Nawur notebookkit-1.1.orig/Makefile notebookkit-1.1/Makefile --- notebookkit-1.1.orig/Makefile Sun Jul 20 23:26:21 2003 +++ notebookkit-1.1/Makefile Mon Jul 21 19:42:13 2003 @@ -1,41 +1,34 @@ -WINKIT = /Users/will/tclkit/tclkit-win32.upx.exe -OSXKIT = /Users/will/tclkit/tclkit-darwin-ppc +WKIT = /Users/will/tclkit/tclkit-win32.upx.exe +TCLLIB=/usr/local/tcl/lib all: @echo "Use 'make build' to build the executable." @echo "Use 'make install' to install it." install: - cp -r * /Users/will/bin/notebookkit - -dist: build - cp notebook.exe notebook notebook.kit README.txt \ - /Users/will/work/wjduquette/notebook - make clean - cd .. ; tar cvf notebook1.1.tar notebookkit ; gzip notebook1.1.tar - cp ../notebook1.1.tar.gz /Users/will/work/wjduquette/notebook - -build: update buildvfs buildexe + cp notebook.exe /local/bin update: update.tcl cp -f help.nbk lib/app-notebook +build: update buildvfs buildexe + buildvfs: mkdir -p ./notebook.vfs cp main.tcl ./notebook.vfs cp -r lib ./notebook.vfs rm -rf ./notebook.vfs/lib/CVS rm -rf ./notebook.vfs/lib/*/CVS - cp -r /Library/Tcl/bwidget1.6 ./notebook.vfs/lib - cp -r /Library/Tcl/tcllib1.3 ./notebook.vfs/lib - cp -r /Users/will/Library/Tcl/snit ./notebook.vfs/lib - cp -r /Users/will/Library/Tcl/trycatch ./notebook.vfs/lib + cp -r $(TCLLIB)/bwidget1.6 ./notebook.vfs/lib + cp -r $(TCLLIB)/tcllib1.4 ./notebook.vfs/lib + cp -r $(TCLLIB)/snit ./notebook.vfs/lib + cp -r $(TCLLIB)/trycatch ./notebook.vfs/lib buildexe: - sdx.kit wrap notebook.exe -runtime $(WINKIT) - sdx.kit wrap notebook -runtime $(OSXKIT) sdx.kit wrap notebook.kit + #sdx.kit wrap notebook.kit -writable + # sdx.kit wrap notebook.exe -runtime $(WKIT) clean: - -rm -rf notebook.vfs notebook.exe notebook.kit notebook.bat notebook + -rm -rf notebook.vfs notebook.exe notebook.kit notebook.bat Patch 1: Jump to next link with TAB, follow link with ENTER or SPACE (to be published later) *********************************************************************** Patch file for notebook Version 1.1 Add functionality to use for jumping forward to next link, and underlining the link; and or to follow the link. By Ramon Ribó Rodríguez, Barcelona, Spain *********************************************************************** diff -Nawur notebookkit-1.1.orig/lib/app-notebook/renderpane.tcl notebookkit-1.1/lib/app-notebook/renderpane.tcl --- notebookkit-1.1.orig/lib/app-notebook/renderpane.tcl Sun Jun 29 23:21:31 2003 +++ notebookkit-1.1/lib/app-notebook/renderpane.tcl Mon Jul 21 22:35:49 2003 @@ -121,6 +121,74 @@ # Prepare to receive preferences events; unregister on # destroy. prefs register $selfns [mymethod UsePreferences] + + + # ramsan + bind $win.pane { + set range [%W tag ranges act] + if { $range == "" } { + set iniidx 1.0 + } else { set iniidx [lindex $range 1] } + + set newrange "" + foreach tag "link button img" { + set r [%W tag nextrange $tag $iniidx] + if { $r == "" } { continue } + if { $newrange == "" || \ + [%W compare [lindex $newrange 0] > [lindex $r 0]] } { + set newrange $r + set tagname $tag + } + } + if { $newrange == "" && [%W compare $iniidx != 1.0] } { + foreach tag "link button img" { + set r [%W tag nextrange $tag 1.0 $iniidx] + if { $r == "" } { continue } + if { $newrange == "" || \ + [%W compare [lindex $newrange 0] > [lindex $r 0]] } { + set newrange $r + set tagname $tag + } + } + } + if { $newrange == "" } { + bell + } else { + %W tag delete act + if { $tagname != "img" } { + %W tag conf act -underline 1 + } else { + %W tag conf act -background red + %W image configure [lindex $newrange 0] -padx 1 -pady 1 + } + eval %W tag add act $newrange + %W see [lindex $newrange 0] + } + break + } + # ramsan + bind $win.pane { + set range [%W tag ranges act] + if { $range == "" } { break } + set idx [lindex $range 0] + if { [lsearch [%W tag names $idx] link] != -1 } { + set comm [%W tag bind link <1>] + if { $comm == "" } { set comm [%W tag bind link ] } + } elseif { [lsearch [%W tag names $idx] button] != -1 } { + set comm [%W tag bind button <1>] + if { $comm == "" } { set comm [%W tag bind button ] } + } elseif { [lsearch [%W tag names $idx] img] != -1 } { + set ipos [lsearch -glob [%W tag names $idx] img,*] + set tag [lindex [%W tag names $idx] $ipos] + set comm [%W tag bind $tag <1>] + if { $comm == "" } { set comm [%W tag bind $tag ] } + } else { break } + foreach "x y wi he" [%W bbox $idx] break + set comm [string map [list %%x $x %%y $y] $comm] + eval $comm + } + # ramsan + bind $win.pane [bind $win.pane ] } destructor { Patch 2: *********************************************************************** Patch file for notebook Version 1.1 Add's support for tag '#unpre' to switch back from preformatted to normal mode. Good for inserting code examples. Patch supplied by Guido Ostkamp *********************************************************************** diff -Nawur notebookkit-1.1.orig/lib/app-notebook/renderpane.tcl notebookkit-1.1/lib/app-notebook/renderpane.tcl --- notebookkit-1.1.orig/lib/app-notebook/renderpane.tcl Sun Jun 29 23:21:31 2003 +++ notebookkit-1.1/lib/app-notebook/renderpane.tcl Mon Jul 21 22:35:49 2003 @@ -288,6 +356,8 @@ if {[string match "#---*" $value]} { $self InsertHLine } elseif {[string match "#pre*" $value]} { + # Skip it. + } elseif {[string match "#unpre*" $value]} { # Skip it. } else { $self insert end $value pre diff -Nawur notebookkit-1.1.orig/lib/markupparser/markupparser.tcl notebookkit-1.1/lib/markupparser/markupparser.tcl --- notebookkit-1.1.orig/lib/markupparser/markupparser.tcl Sun Jun 29 23:12:42 2003 +++ notebookkit-1.1/lib/markupparser/markupparser.tcl Mon Jul 21 23:21:41 2003 @@ -71,6 +71,14 @@ return -1 } +proc ::markupparser::FindEndOfLine {text} { + if {[regexp -indices {(\n)} $text match]} { + return [lindex $match 0] + } + return -1 +} + + # debugHandler tag value # # tag: A parsed markup tag @@ -314,6 +322,7 @@ # Parses text, generating a list directly proc ::markupparser::parse {text} { set result {} + set premode 0 # Q: Would scanning the string without modification be quicker? while {[string length $text] > 0} { @@ -329,9 +338,24 @@ lappend result HASH $para if {[string match "#pre*" $para] || [string match "#Tcl*" $para]} { - lappend result PRE $text + set premode 1 + } elseif {[string match "#unpre*" $para]} { + set premode 0 + } + continue + } + + if { $premode == 1 } { + set eop [FindEndOfLine $text] + + if {$eop == -1} { + set para $text set text "" + } else { + set para [string range $text 0 $eop] + set text [string range $text [expr {$eop + 1}] end] } + lappend result PRE $para continue } Patch 3: *********************************************************************** Patch file for notebook Version 1.1 Add proper mapping to Ctrl-c, Ctrl-x and Ctrl-v for Copy, Cut, and Paste functionality under Unix (otherwise this actions are only available through Meta-w, Control-w, Control-y). Patch supplied by Guido Ostkamp *********************************************************************** diff -Nawur notebookkit-1.1.orig/lib/app-notebook/pageeditor.tcl notebookkit-1.1/lib/app-notebook/pageeditor.tcl --- notebookkit-1.1.orig/lib/app-notebook/pageeditor.tcl Sun Jul 20 23:14:42 2003 +++ notebookkit-1.1/lib/app-notebook/pageeditor.tcl Tue Jul 22 22:54:47 2003 @@ -118,6 +118,12 @@ [list $win.pane.text insert insert "&lb;"] bind $win.pane.text \ [list $win.pane.text insert insert "&rb;"] + bind $win.pane.text \ + [tk_textCopy $win.pane.text] + bind $win.pane.text \ + [tk_textPaste $win.pane.text] + bind $win.pane.text \ + [tk_textCut $win.pane.text] #TBD bind $win.pane.text \ Patch 4: *********************************************************************** Patch file for notebook Version 1.1 Use confirmation for key after editing only, if something was changed. For copy only actions, this is not necessary. Patch supplied by Guido Ostkamp *********************************************************************** diff -Nawur notebookkit-1.1.orig/lib/app-notebook/pageeditor.tcl notebookkit-1.1/lib/app-notebook/pageeditor.tcl --- notebookkit-1.1.orig/lib/app-notebook/pageeditor.tcl Sun Jul 20 23:14:42 2003 +++ notebookkit-1.1/lib/app-notebook/pageeditor.tcl Tue Jul 22 22:54:47 2003 @@ -148,6 +154,7 @@ $self Revert + $win.pane.text edit modified 0 focus $win.pane.text } @@ -372,6 +379,7 @@ # Cancel editing. method Cancel {} { + if { [$win.pane.text edit modified] == 1 } { set result [tk_messageBox -icon question -parent $win \ -title "Are you sure?" \ -message "Return to browser without saving?" \ @@ -380,6 +388,7 @@ if {$result ne "yes"} { return + } } uplevel \#0 $options(-endcmd) [list $current 0] +# End of Notebook Database File