# Jots Client Tcl code for tkgoodstuff proc JotsDeclare {} { set Prefs_taborder(:Clients,Jots) "Misc Geometry Button Colors" set Prefs_taborder(:Clients,Jots,Button) "Misc Colors" TKGDeclare Jots(dir) {$env(HOME)/.tkgjots} -typelist [list Clients Jots Misc]\ -label "Your Jots Directory" TKGDeclare Jots(startwithnew) 0 -typelist [list Clients Jots Misc]\ -label "Create new item when opening a folder"\ -vartype boolean TKGDeclare Jots(lines) 20 -typelist [list Clients Jots Geometry]\ -label "Height of text screen (lines)" TKGDeclare Jots(columns) 60 -typelist [list Clients Jots Geometry]\ -label "Width of text screen (characters)" TKGDeclare Jots(showfindtool) 0 -typelist [list Clients Jots Misc]\ -label "Show Find tool at startup"\ -vartype boolean TKGDeclare Jots(showhotlist) 1 -typelist [list Clients Jots Misc]\ -label "Show HotList at startup"\ -vartype boolean TKGColorDeclare Jots(hots_cur_bg) \#87ceff [list Clients Jots Colors]\ "HotList button background for current folder" TKGColorDeclare Jots(hots_cur_fg) {} [list Clients Jots Colors]\ "HotList button foreground for current folder" $TKG(foreground) TKGDeclare Jots(makebutton) 1 -typelist [list Clients Jots Button Misc]\ -label "Produce a button"\ -vartype boolean TKGDeclare Jots(text) Jots -typelist [list Clients Jots Button Misc]\ -label "Label text" TKGDeclare Jots(imagefile) %jots\ -typelist [list Clients Jots Button Misc] -label "Icon file" ConfigDeclare Jots ClientButton1 Jots [list Clients Jots Button] ConfigDeclare Jots ClientButton3 Jots [list Clients Jots Button] } proc JotsCreateWindow {} { if [TKGReGrid JotsButton] return uplevel { set Jots(hotfile) "$Jots(dir)/.hotjots" set Jots(hots_cur_abg) $Jots(hots_cur_bg) set Jots(hots_cur_afg) $Jots(hots_cur_fg) } global Jots if $Jots(makebutton) { lappend c TKGMakeButton JotsButton -balloon {Jots notecard manager} foreach switch { iconside ignore font imagefile text foreground background activeforeground activebackground relief } { lappend c -$switch $Jots($switch) } set w [eval $c] bind $w <1> +JotsPopup } else { TKGAddToHook TKG_clientwindowscreated_hook \ {if { [lsearch $TKG(clients) Clock ] != -1 } { RecursiveBind [set Clock_window] <3> {JotsPopup} }} } } proc JotsPopup {} { global Jots env if $Jots(makebutton) { upvar #0 JotsButton-params P if ![string match [$P(pathname) cget -relief] sunken] { $P(pathname) configure -relief sunken } } set Jots(index) 0 set Jots(selectfolders) 1 set Jots(edited) -1 set Jots(openfolders) "" set w .jots if [winfo exists $w] { wm deiconify $w focus $w raise $w return } toplevel $w wm withdraw $w wm title $w "Jots" wm iconname $w "Jots" wm protocol $w WM_DELETE_WINDOW JotsFinalExit frame $w.menu -relief raised -bd 2 grid columnconfigure $w 0 -weight 1 grid $w.menu -sticky ew -row 0 -column 0 # pack $w.menu -side top -fill x set m $w.menu.file.m menubutton $w.menu.file -text "File" -menu $m menu $m $m add command -label "Open folder" -command JotsOpen $m add command -label "New folder" -command JotsNew $m add command -label "Merge into current folder" -command JotsMerge $m add cascade -label "Go to open folder" -menu .jots.menu.file.m.openfolders menu .jots.menu.file.m.openfolders $m add separator $m add command -label "Save current folder" -command JotsSave $m add command -label "Save current folder as ..." -command JotsSaveAs $m add command -label "Save to ascii file ..." -command JotsSaveAscii $m add separator $m add command -label "Close current folder ..." -command JotsClose $m add command -label "Delete current folder ..." -command JotsDeleteFolder $m add separator $m add command -label "Exit ..." -command "JotsExit" set m $w.menu.hotlist.m menubutton $w.menu.hotlist -text "Hotlist" -menu $m menu $m $m add command -label "Add folder to hot list" -command JotsAddHot $m add command -label "Remove folder from hot list" -command JotsRemoveHot $m add separator set m $w.menu.edit.m menubutton $w.menu.edit -text "Edit" -menu $m menu $m $m add command -label "Cut Entry" -command JotsCut $m add command -label "Copy Entry" -command JotsCopy $m add command -label "Paste" -command JotsPaste set m $w.menu.find.m menubutton $w.menu.find -text "Find" -menu $m menu $m $m add checkbutton -label "Show Find Tool" -variable Jots(showfindtool) trace variable Jots(showfindtool) w JotsPackFind $m add separator pack $w.menu.file $w.menu.edit $w.menu.find $w.menu.hotlist -side left set m $w.menu.help.m menubutton $w.menu.help -text "Help" -menu $m menu $m $m add command -label "About Jots" -command JotsAbout $m add separator $m add command -label "Help" -command JotsHelp pack $w.menu.help -side right frame $w.hots # pack $w.hots -side top -fill x -padx .1c -pady .1c -expand n grid $w.hots -row 1 -column 0 -sticky ew -padx .1c -pady .1c set Jots(hotswindow) $w.hots grid rowconfigure $w 2 -weight 1 frame $w.middle grid rowconfigure $w.middle 0 -weight 1 grid columnconfigure $w.middle 0 -weight 1 set ww $w.middle.jotsentry frame $ww -relief sunken -bd 3 grid columnconfigure $ww 0 -weight 1 grid rowconfigure $ww 0 -weight 1 frame $ww.view grid columnconfigure $ww.view 0 -weight 1 grid rowconfigure $ww.view 0 -weight 1 text $ww.view.text -width $Jots(columns) -height $Jots(lines)\ -takefocus 0 -yscrollcommand "$ww.view.scrollbar set" \ -relief sunken -borderwidth 2 -state disabled -wrap word set Jots(textwindow) $ww.view.text grid $ww.view.text -row 0 -column 0 -sticky nsew scrollbar $ww.view.scrollbar -command "$ww.view.text yview" grid $ww.view.scrollbar -row 0 -column 1 -sticky nsew -padx 2 $ww.view.text configure -state normal grid $ww.view -row 0 -column 0 -sticky nsew -pady .3c -padx .3c frame $ww.indices foreach i {0 1 2} { grid columnconfigure $ww.indices $i -weight 1 } frame $ww.indices.jots_folder grid columnconfigure $ww.indices.jots_folder 1 -weight 1 label $ww.indices.jots_folder.jots_folderlabel -text Folder: grid $ww.indices.jots_folder.jots_folderlabel -row 0 -column 0 entry $ww.indices.jots_folder.jots_folderentry \ -textvariable Jots(folder) -takefocus 0 -state disabled -relief flat grid $ww.indices.jots_folder.jots_folderentry -row 0 -column 1 -sticky ew frame $ww.indices.jots_date grid columnconfigure $ww.indices.jots_date 1 -weight 1 label $ww.indices.jots_date.jots_datelabel -text Date: grid $ww.indices.jots_date.jots_datelabel -row 0 -column 0 entry $ww.indices.jots_date.jots_dateentry\ -textvariable Jots(date) -width 18 -takefocus 0 -state disabled -relief flat grid $ww.indices.jots_date.jots_dateentry -row 0 -column 1 -sticky ew frame $ww.indices.jots_time grid columnconfigure $ww.indices.jots_time 1 -weight 1 label $ww.indices.jots_time.jots_timelabel -text Time: grid $ww.indices.jots_time.jots_timelabel -row 0 -column 0 entry $ww.indices.jots_time.jots_timeentry \ -textvariable Jots(time) -width 5 -takefocus 0 -state disabled -relief flat grid $ww.indices.jots_time.jots_timeentry -row 0 -column 1 -sticky ew $ww.indices.jots_folder.jots_folderentry configure -background [$ww.view cget -background] $ww.indices.jots_date.jots_dateentry configure -background [$ww.view cget -background] $ww.indices.jots_time.jots_timeentry configure -background [$ww.view cget -background] grid $ww.indices.jots_folder $ww.indices.jots_date $ww.indices.jots_time\ -row 0 -sticky ew -padx .2c -pady .1c grid $ww.indices -row 1 -column 0 -sticky ew grid $ww -row 0 -column 0 -sticky nsew grid $w.middle -row 2 -column 0 -sticky nsew -padx .3c -pady .2c scrollbar $w.scroll -orient horizontal -command "JotsScroll" \ -width .7c grid $w.scroll -row 3 -column 0 -sticky ew -pady .3c -padx .3c set Jots(SB) $w.scroll trace variable Jots(index) w JotsSUpdate frame $w.buttons button $w.buttons.new -command JotsNewEntry -text "New\nEntry" pack $w.buttons.new -side left -expand y -fill y -padx .4c -pady .4c button $w.buttons.del -command JotsCut -text "Delete\nEntry" pack $w.buttons.del -side left -expand y -fill y -padx .4c -pady .4c button $w.buttons.prev -command JotsPrev -text "Previous\nEntry" pack $w.buttons.prev -side left -expand y -fill y -padx .4c -pady .4c button $w.buttons.next -command JotsNext -text "Next\nEntry" pack $w.buttons.next -side left -expand y -fill y -padx .4c -pady .4c button $w.buttons.dismiss -text "Save All\nand Exit"\ -command JotsDismiss pack $w.buttons.dismiss -side left -expand y -fill y -padx .4c -pady .4c grid $w.buttons -row 5 -sticky ew bind $Jots(textwindow) {set Jots(edited) $Jots(index)} bind $Jots(textwindow)