#!/afs/ece/usr/tcl/bin/wish -f

set Bind_Keyword [file tail [info script]]
source "[file dirname [info script]]/../aux/frame.tcl"

# Help text.
set Help "" ; append Help {Paragrath -- Add keybindings for standard paragraph manipulation and formatting.

This program teaches text widgets about paragraphs, including formating,
selection, and several other paragraph features.

} $TH_Bindings_Help {

Widgets of Paragrath
} $TH_Frame_Help {
The paragraph tag is not always aligned to point only to paragraphs. This
shouldn't affect the appearance of the text, but the Tags menu may be screwey.
Doing an 'Update Paragraphs' (menu option under the Index menu) should fix
this.
}


# Gives app all the code necessary to do our functions.
proc teach_code {} {
  global Widget
  if {[widget_bindings] == ""} {return ""}
  include_files {paragraph.tcl th_para_begin} \
	{modes.tcl th_Text_tag_regions} \
	{edit.Text.tcl th_Text_delete_range} \
	{browse.Text.tcl th_Text_select_range}
  do_cmd "$Widget configure -wrap word\n" 0
  do_cmd "th_Text_tag_regions $Widget paragraph th_para_begin th_para_end th_para_next\n" 0
}

# For a widget, returns the appropriate bindings. (They will depend on the
# widget)
proc widget_bindings {} {
  global Bindings Class
  if {$Class != "Text"} {return ""}
  return [widget_frame_bindings $Bindings(Paragraph)]
}


