TKE  3.6
Advanced code editor for programmers
gui Namespace Reference

Functions

 set_title
 
 set_browse_directory bsdir
 
 get_browse_directory
 
 create_images
 
 create
 
 handle_menu_popup w mnu
 
 check_fif_for_return
 
 handle_warning_width_change name1 name2 op
 
 handle_max_undo name1 name2 op
 
 handle_matching_char name1 name2 op
 
 set_matching_char value
 
 handle_bracket_audit name1 name2 op
 
 handle_relative_line_numbers name1 name2 op
 
 handle_line_number_alignment name1 name2 op
 
 handle_allow_tab_scrolling name1 name2 op
 
 handle_vim_mode name1 name2 op
 
 handle_editor_font name1 name2 op
 
 handle_auto_cwd name1 name2 op
 
 handle_browse_directory ?name1? ?name2? ?op?
 
 handle_show_birdseye name1 name2 op
 
 handle_birdseye_font_size name1 name2 op
 
 handle_birdseye_width name1 name2 op
 
 handle_code_folding name1 name2 op
 
 handle_cursor_width name1 name2 op
 
 handle_extra_line_spacing name1 name2 op
 
 set_auto_cwd value
 
 toggle_labelbutton w
 
 movable_to_other_pane
 
 setup_tab_popup_menu
 
 show_sidebar_view
 
 hide_sidebar_view
 
 show_console_view
 
 hide_console_view
 
 show_tab_view
 
 hide_tab_view
 
 show_status_view
 
 hide_status_view
 
 set_line_number_view value
 
 set_line_number_width val
 
 update_tab tab
 
 save_session
 
 load_session info new
 
 next_tab
 
 previous_tab
 
 last_tab
 
 next_pane
 
 panes
 
 tabs_in_pane
 
 align_panes
 
 pane_sync_tab_change
 
 set_pane_sync value
 
 sync_scroll txt yscroll
 
 sync_birdseye_helper tab top
 
 sync_birdseye tab top
 
 yview tab txt args
 
 yscrollcommand tab txt vb args
 
 align_lines txt1 txt2 line1 line2 adjust_txt1
 
 add_to_recently_opened fname
 
 get_last_opened
 
 clear_last_opened
 
 select_all
 
 untitled_check
 
 add_buffer index name save_command args
 
 add_new_file index args
 
 add_file index fname args
 
 add_tab_content tab
 
 check_highlightable txt contents
 
 add_files_and_raise host index args
 
 raise_window
 
 update_file file_index
 
 update_current
 
 prompt_for_save
 
 save_prehandle fname save_as force pperms
 
 save_posthandle fname perms
 
 set_current_eol_translation value
 
 set_current_modified value
 
 check_for_modified txtt
 
 save_current args
 
 save_all
 
 close_check tab force exiting
 
 close_check_by_tabbar w tab
 
 close_current args
 
 close_tab_by_tabbar w tab
 
 close_tab tab args
 
 close_others
 
 close_all args
 
 close_others_current_pane
 
 close_current_pane
 
 close_files indices
 
 close_dir_files dirs
 
 hide_tab tab
 
 show_tab tab
 
 hide_current
 
 hide_files indices
 
 hide_all
 
 show_files indices
 
 show_all
 
 sort_tabs
 
 move_to_pane
 
 merge_panes
 
 undo
 
 undoable
 
 redo
 
 redoable
 
 cut
 
 copy
 
 selected
 
 paste
 
 paste_and_format
 
 pastable
 
 editable
 
 format_text
 
 update_search_method tab
 
 handle_search_change tab value
 
 handle_replace_change tab value
 
 search_clear
 
 search ?dir?
 
 find_resilient dir ?type?
 
 close_search
 
 search_and_replace
 
 close_search_and_replace
 
 get_search_data type
 
 set_search_data type data
 
 set_tab_image tab
 
 set_current_file_lock lock
 
 set_current_file_lock_with_current
 
 set_current_file_favorite favorite
 
 set_current_file_favorite_with_current
 
 show_current_in_sidebar
 
 set_info_message msg args
 
 clear_info_message hide_info fr fg fb br bg bb args
 
 set_error_message msg ?detail?
 
 panel_set_ui_state state
 
 panel_place w
 
 panel_forget w
 
 get_user_response msg pvar args
 
 get_file_info index attr
 
 fif_get_input prsp_list
 
 show_about
 
 insert_numbers txt
 
 toggle_split_pane
 
 toggle_birdseye
 
 get_all_texts
 
 get_info from from_type args
 
 add_notebook
 
 handle_notebook_motion W x y
 
 set_tab_tooltip W tab
 
 clear_tab_tooltip W
 
 adjust_insert_tab_index index title
 
 insert_tab tb index fname args
 
 show_split_pane tab
 
 handle_destroy_txt txt
 
 hide_split_pane tab
 
 show_birdseye tab
 
 highlight_birdseye be txt
 
 handle_birdseye_enter be txt m
 
 handle_birdseye_leave be m
 
 handle_birdseye_left_press W x y tab txt
 
 handle_birdseye_motion W x y tab txt
 
 handle_birdseye_control_left W
 
 handle_birdseye_control_right W
 
 hide_birdseye tab
 
 make_drop_target win type args
 
 handle_drop_enter win type actions buttons force
 
 handle_drop win type actions modifiers dtype data types
 
 handle_drop_leave win type
 
 handle_text_drop_enter txt actions buttons args
 
 handle_entry_drop_enter win actions buttons args
 
 handle_tokenentry_drop_enter win actions buttons args
 
 handle_text_drop_leave txt
 
 handle_entry_drop_leave win
 
 handle_tokenentry_drop_leave win
 
 format_dropped_data txt pdata pcursor
 
 handle_text_drop txt action modifier dtype data args
 
 handle_entry_drop win action modifier dtype data args
 
 handle_tokenentry_drop win action modifier dtype data args
 
 text_changed txt data
 
 selection_changed txt
 
 select_line w x y
 
 select_lines w x y
 
 set_current_tab tabbar tab
 
 show_current_tab tabbar
 
 handle_tabbar_select tabbar args
 
 current_txt
 
 current_search
 
 update_position txt
 
 display_file_counts txt
 
 get_symbol_list
 
 create_current_marker
 
 remove_current_marker
 
 remove_txt_markers txt
 
 remove_current_markers
 
 remove_all_markers
 
 get_marker_list
 
 jump_to pos
 
 jump_to_txt txt pos
 
 jump_to_marker txt name
 
 show_match_pair
 
 find_match_pair txt str1 str2 dir ?startpos?
 
 find_match_char txt char dir ?startpos?
 
 goto_mismatch dir args
 
 update_tab_markers tab
 
 mark_command tab win type tag
 
 show_tabs tb side
 
 update_indent_button
 
 create_encoding_menu w
 
 set_current_encoding value
 
 set_encoding tab value ?setfocus?
 
 update_encode_button
 
 handle_txt_focus txtt
 
 set_txt_focus txt
 
 last_txt_focus ?tab?
 
 scrub_text txt
 
 jump_to_cursor dir jump
 
 jump_to_difference dir jump
 
 show_difference_line_change show
 
 handle_font_change dir
 
 change_working_directory dir
 
 cleanup_txt txt
 
 docsearch_get_input docs prsplist args
 
 update_theme txt
 

Function Documentation

§ add_buffer()

gui::add_buffer   index name save_command args  

Definition at line 1649 of file gui.tcl.

1649  proc add_buffer {index name save_command args} {
1650 
1651  variable widgets
1652  variable pw_current
1653  variable undo_count
1654 
1655  # Handle options
1656  array set opts [list \
1657  -lock 0 \
1658  -readonly 0 \
1659  -sidebar 0 \
1660  -gutters [list] \
1661  -other 0 \
1662  -tags [list] \
1663  -lang "" \
1664  -background 0 \
1665  -remote ""
1666  ]
1667  array set opts $args
1668 
1669  # Perform untitled tab check
1670  if {[untitled_check]} {
1671  if {($name ne "Untitled") && !$opts(-other)} {
1672  close_tab [get_info {} current tab] -keeptab 0
1673  }
1674  }
1675 
1676  # If the file is already loaded, display the tab
1677  if {($name ne "Untitled") && ([set file_index [files::get_index $name $opts(-remote) -buffer 1]] != -1)} {
1678 
1679  if {!$opts(-background)} {
1680  get_info $file_index fileindex tabbar tab
1681  set_current_tab $tabbar $tab
1682  }
1683 
1684  } else {
1685 
1686  if {$opts(-other)} {
1687 
1688  # If the other pane does not exist, add it
1689  if {[llength [$widgets(nb_pw) panes]] == 1} {
1690  add_notebook
1691  }
1692 
1693  # Set the current pane to the other one
1694  set pw_current [expr $pw_current ^ 1]
1695 
1696  }
1697 
1698  # Adjust the index (if necessary)
1699  set index [adjust_insert_tab_index $index $name]
1700 
1701  # Get the tabbar
1702  get_info $pw_current paneindex tabbar
1703 
1704  # Get the current index
1705  set tab [insert_tab $tabbar $index $name -gutters $opts(-gutters) -tags $opts(-tags) -lang $opts(-lang)]
1706 
1707  # Create the file info structure
1708  files::add $name $tab \
1709  -save_cmd $save_command \
1710  -lock $opts(-lock) \
1711  -readonly $opts(-readonly) \
1712  -sidebar $opts(-sidebar) \
1713  -buffer 1 \
1714  -gutters $opts(-gutters) \
1715  -tags $opts(-tags) \
1716  -remote $opts(-remote)
1717 
1718  # Get the current text widget
1719  get_info $tab tab txt tabbar
1720 
1721  # Perform an insertion adjust, if necessary
1722  if {[vim::in_vim_mode $txt.t]} {
1723  vim::adjust_insert $txt.t
1724  }
1725 
1726  # Change the tab text
1727  $tabbar tab $tab -text " [file tail $name]"
1728 
1729  # Add the file's directory to the sidebar and highlight it
1730  if {$opts(-sidebar)} {
1731  sidebar::add_directory [file normalize [file dirname $name]] -remote $opts(-remote)
1732  # sidebar::highlight_filename $name 0
1733  }
1734 
1735  # Make this tab the currently displayed tab
1736  if {!$opts(-background)} {
1737  set_current_tab $tabbar $tab
1738  }
1739 
1740  set undo_count($tab) 0
1741 
1742  }
1743 
1744  # Set the tab image for the current file
1745  set_tab_image $tab
1746 
1747  return $tab
1748 
1749  }

§ add_file()

gui::add_file   index fname args  

Definition at line 1795 of file gui.tcl.

1795  proc add_file {index fname args} {
1796 
1797  variable widgets
1798  variable pw_current
1799  variable last_opened
1800 
1801  # Handle arguments
1802  array set opts {
1803  -savecommand ""
1804  -lock 0
1805  -readonly 0
1806  -sidebar 1
1807  -gutters {}
1808  -diff 0
1809  -other 0
1810  -tags {}
1811  -lazy 0
1812  -remember 1
1813  -remote ""
1814  -cursor 1.0
1815  -xview 0
1816  -yview 0
1817  -lang ""
1818  }
1819  array set opts $args
1820 
1821  # If have a single untitled tab in view, close it before adding the file
1822  if {[untitled_check] && !$opts(-other)} {
1823  close_tab [get_info {} current tab] -keeptab 0
1824  }
1825 
1826  # If the file is already loaded, display the tab
1827  if {[set file_index [files::get_index $fname $opts(-remote) -diff $opts(-diff)]] != -1} {
1828 
1829  # Get the tab associated with the given file index
1830  get_info $file_index fileindex tabbar tab
1831 
1832  # Otherwise, load the file in a new tab
1833  } else {
1834 
1835  if {$opts(-other)} {
1836 
1837  # If the other pane does not exist, add it
1838  if {[llength [$widgets(nb_pw) panes]] == 1} {
1839  add_notebook
1840  }
1841 
1842  # Set the current pane to the other one
1843  set pw_current [expr $pw_current ^ 1]
1844 
1845  }
1846 
1847  # Adjust the index (if necessary)
1848  set index [adjust_insert_tab_index $index [file tail $fname]]
1849 
1850  # Get the tabbar
1851  get_info $pw_current paneindex tabbar
1852 
1853  # Add the tab to the editor frame
1854  set tab [insert_tab $tabbar $index $fname -diff $opts(-diff) -gutters $opts(-gutters) -tags $opts(-tags) -lang $opts(-lang)]
1855 
1856  # Create the file information
1857  files::add $fname $tab \
1858  -save_cmd $opts(-savecommand) \
1859  -lock $opts(-lock) \
1860  -readonly $opts(-readonly) \
1861  -sidebar $opts(-sidebar) \
1862  -buffer 0 \
1863  -gutters $opts(-gutters) \
1864  -diff $opts(-diff) \
1865  -tags $opts(-tags) \
1866  -loaded 0 \
1867  -remember $opts(-remember) \
1868  -remote $opts(-remote) \
1869  -xview $opts(-xview) \
1870  -yview $opts(-yview) \
1871  -cursor $opts(-cursor)
1872 
1873  # Run any plugins that should run when a file is opened
1875 
1876  }
1877 
1878  # Add the file's directory to the sidebar and highlight it
1879  if {$opts(-sidebar)} {
1880  sidebar::add_directory [file dirname $fname] -remote $opts(-remote)
1881  sidebar::highlight_filename $fname [expr ($opts(-diff) * 2) + 1]
1882  }
1883 
1884  # Make this tab the currently displayed tab
1885  if {!$opts(-lazy)} {
1886  set_current_tab $tabbar $tab
1887  }
1888 
1889  # Set the tab image for the current file
1890  set_tab_image $tab
1891 
1892  return $tab
1893 
1894  }

§ add_files_and_raise()

gui::add_files_and_raise   host index args  

Definition at line 2010 of file gui.tcl.

2010  proc add_files_and_raise {host index args} {
2011 
2012  # Add the list of files to the editor panel.
2013  foreach fname [lreverse $args] {
2014  if {[file isdirectory $fname]} {
2016  } elseif {![::check_file_for_import $fname]} {
2017  add_file $index [files::normalize $host $fname]
2018  }
2019  }
2020 
2021  # Raise ourselves
2022  raise_window
2023 
2024  }

§ add_new_file()

gui::add_new_file   index args  

Definition at line 1765 of file gui.tcl.

1765  proc add_new_file {index args} {
1766 
1767  array set opts {
1768  -name "Untitled"
1769  -save_as ""
1770  }
1771  array set opts $args
1772 
1773  # Add the buffer
1774  return [add_buffer $index $opts(-name) {eval files::save_new_file $opts(-save_as)} {*}$args]
1775 
1776  }

§ add_notebook()

gui::add_notebook

Definition at line 4199 of file gui.tcl.

4199  proc add_notebook {} {
4200 
4201  variable widgets
4202  variable curr_notebook
4203 
4204  # Create editor notebook
4205  $widgets(nb_pw) add [set nb [ttk::frame $widgets(nb_pw).nb[incr curr_notebook]]] -weight 1
4206 
4207  # Add the tabbar frame
4208  ttk::frame $nb.tbf
4209  tabbar::tabbar $nb.tbf.tb -closeimage tab_close -activecloseimage tab_activeclose \
4210  -command [list gui::handle_tabbar_select] \
4211  -checkcommand [list gui::close_check_by_tabbar] \
4212  -closecommand [list gui::close_tab_by_tabbar]
4213 
4214  # Configure the tabbar
4215  $nb.tbf.tb configure {*}[theme::get_category_options tabs 1]
4216 
4217  grid rowconfigure $nb.tbf 0 -weight 1
4218  grid columnconfigure $nb.tbf 0 -weight 1
4219  grid $nb.tbf.tb -row 0 -column 0 -sticky news
4220  grid remove $nb.tbf.tb
4221 
4222  bind [$nb.tbf.tb scrollpath left] <Button-$::right_click> [list gui::show_tabs $nb.tbf.tb left]
4223  bind [$nb.tbf.tb scrollpath right] <Button-$::right_click> [list gui::show_tabs $nb.tbf.tb right]
4224 
4225  # Create popup menu for extra tabs
4226  menu $nb.tbf.tb.mnu -tearoff 0
4227 
4228  ttk::frame $nb.tf
4229 
4230  pack $nb.tbf -fill x
4231  pack $nb.tf -fill both -expand yes
4232 
4233  bind [$nb.tbf.tb btag] <ButtonPress-$::right_click> {
4234  if {[%W cget -state] eq "disabled"} {
4235  return
4236  }
4237  if {[info exists gui::tab_tip(%W)]} {
4238  unset gui::tab_tip(%W)
4239  tooltip::tooltip clear %W
4240  tooltip::hide
4241  }
4242  set pane [winfo parent [winfo parent [winfo parent %W]]]
4243  set gui::pw_current [lsearch [$gui::widgets(nb_pw) panes] [winfo parent [winfo parent [winfo parent %W]]]]
4244  if {![catch { [winfo parent %W] select @%x,%y }]} {
4245  gui::set_current_tab [winfo parent %W] [[winfo parent %W] select]
4246  tk_popup $gui::widgets(menu) %X %Y
4247  }
4248  }
4249 
4250  # Handle tooltips
4251  bind [$nb.tbf.tb btag] <Motion> [list gui::handle_notebook_motion %W %x %y]
4252 
4253  # Register the tabbar and menu for theming
4254  theme::register_widget $nb.tbf.tb tabs
4255  theme::register_widget $nb.tbf.tb.mnu menus
4256 
4257  }

§ add_tab_content()

gui::add_tab_content   tab  

Definition at line 1898 of file gui.tcl.

1898  proc add_tab_content {tab} {
1899 
1900  variable undo_count
1901 
1902  # Get some of the file information
1903  get_info $tab tab tabbar txt fname diff loaded lock readonly xview yview cursor remember
1904 
1905  # Indicate that we are loading the tab
1906  $tabbar tab $tab -busy 1
1907 
1908  if {!$loaded && [files::get_file $tab contents]} {
1909 
1910  # If we are locked, make sure that we enable the text widget for insertion
1911  if {$lock || $readonly} {
1912  $txt configure -state normal
1913  }
1914 
1915  # Delete any dspace characters
1916  vim::remove_dspace $txt
1917 
1918  # Initialize the undo count
1919  set undo_count($tab) 0
1920 
1921  # Check the highlightable value
1922  check_highlightable $txt $contents
1923 
1924  # Insert the file contents
1925  $txt fastinsert end $contents
1926 
1927  # Highlight text and add update code folds
1928  $txt syntax highlight 1.0 end
1929  $txt see 1.0
1930 
1931  # Add any previous markers saved for this text widget
1932  markers::tagify $tab
1933 
1934  # Check brackets
1936 
1937  # Change the text to unmodified
1938  $txt edit reset
1939  files::set_info $tab tab modified 0
1940 
1941  # Set the insertion mark to the first position
1942  ::tk::TextSetCursor $txt.t $cursor
1943 
1944  # Set the yview
1945  $txt xview moveto $xview
1946  $txt yview moveto $yview
1947 
1948  # Perform an insertion adjust, if necessary
1949  if {[vim::in_vim_mode $txt.t]} {
1950  vim::adjust_insert $txt.t
1951  }
1952 
1953  # Add the file to the list of recently opened files
1954  if {$remember} {
1955  add_to_recently_opened $fname
1956  }
1957 
1958  # Parse Vim modeline information, if needed
1959  vim::parse_modeline $txt
1960 
1961  # If a diff command was specified, run and parse it now
1962  if {$diff} {
1963  diff::show $txt
1964  }
1965 
1966  # If we are locked, make sure that we disable the text widget
1967  if {$lock || $readonly} {
1968  $txt configure -state disabled
1969  }
1970 
1971  # Update tab
1972  update_tab $tab
1973 
1974  }
1975 
1976  # Specify that we have completed loading the tab
1977  $tabbar tab $tab -busy 0
1978 
1979  }

§ add_to_recently_opened()

gui::add_to_recently_opened   fname  

Definition at line 1569 of file gui.tcl.

1569  proc add_to_recently_opened {fname} {
1570 
1571  variable last_opened
1572 
1573  if {[set index [lsearch $last_opened $fname]] != -1} {
1574  set last_opened [lreplace $last_opened $index $index]
1575  }
1576 
1577  set last_opened [lrange [list $fname {*}$last_opened] 0 20]
1578 
1579  }

§ adjust_insert_tab_index()

gui::adjust_insert_tab_index   index title  

Definition at line 4327 of file gui.tcl.

4327  proc adjust_insert_tab_index {index title} {
4328 
4329  if {[preferences::get View/OpenTabsAlphabetically] && ($index eq "end")} {
4330 
4331  set sorted_index 0
4332 
4333  if {![catch { get_info {} current tabbar}]} {
4334  foreach tab [$tabbar tabs] {
4335  regexp {(\S+)$} [$tabbar tab $tab -text] -> curr_title
4336  if {[string compare $title $curr_title] == -1} {
4337  return $sorted_index
4338  }
4339  incr sorted_index
4340  }
4341  }
4342 
4343  }
4344 
4345  return $index
4346 
4347  }

§ align_lines()

gui::align_lines   txt1 txt2 line1 line2 adjust_txt1  

Definition at line 1544 of file gui.tcl.

1544  proc align_lines {txt1 txt2 line1 line2 adjust_txt1} {
1545 
1546  if {[set bbox1 [$txt1 bbox $line1]] eq ""} {
1547  $txt1 see $line1
1548  set bbox1 [$txt1 bbox $line1]
1549  }
1550  if {[set bbox2 [$txt2 bbox $line2]] eq ""} {
1551  $txt2 see $line2
1552  set bbox2 [$txt2 bbox $line2]
1553  }
1554 
1555  # Attempt to line up the right pane to the left pane
1556  $txt2 yview scroll [expr [lindex $bbox2 1] - [lindex $bbox1 1]] pixels
1557 
1558  # Check to see if the two are aligned, if not then attempt to align the left line to the right
1559  if {$adjust_txt1} {
1560  if {[lindex $bbox1 1] != [lindex [$txt2 bbox $line2] 1]} {
1561  $txt1 yview scroll [expr [lindex $bbox1 1] - [lindex $bbox2 1]] pixels
1562  }
1563  }
1564 
1565  }

§ align_panes()

gui::align_panes

Definition at line 1345 of file gui.tcl.

1345  proc align_panes {} {
1346 
1347  align_lines [get_info 0 paneindex txt] [get_info 1 paneindex txt] insert insert 1
1348 
1349  }

§ change_working_directory()

gui::change_working_directory   dir  

Definition at line 6293 of file gui.tcl.

6293  proc change_working_directory {dir} {
6294 
6295  # Change the current working directory to dir
6296  cd $dir
6297 
6298  # Update the title
6299  set_title
6300 
6301  }

§ check_fif_for_return()

gui::check_fif_for_return

Definition at line 545 of file gui.tcl.

545  proc check_fif_for_return {} {
546 
547  variable widgets
548  variable user_exit_status
549 
550  if {([llength [$widgets(fif_in) tokenget]] > 0) && \
551  ([$widgets(fif_in) entryget] eq "") && \
552  ([$widgets(fif_find) get] ne "")} {
553  set user_exit_status 1
554  return 1
555  }
556 
557  return 0
558 
559  }

§ check_for_modified()

gui::check_for_modified   txtt  

Definition at line 2218 of file gui.tcl.

2218  proc check_for_modified {txtt} {
2219 
2220  variable undo_count
2221 
2222  get_info [winfo parent $txtt] txt tabbar tab fname
2223 
2224  if {$undo_count($tab) == [$txtt edit undocount]} {
2225  files::set_info $tab tab modified 0
2226  $txtt edit modified 0
2227  $tabbar tab $tab -text [format " %s" [file tail $fname]]
2228  set_title
2229  }
2230 
2231  }

§ check_highlightable()

gui::check_highlightable   txt contents  

Definition at line 1986 of file gui.tcl.

1986  proc check_highlightable {txt contents} {
1987 
1988  variable widgets
1989 
1990  set highlightable 1
1991 
1992  foreach line [split $contents \n] {
1993  if {[string length $line] > 8192} {
1994  set highlightable 0
1995  break;
1996  }
1997  }
1998 
1999  # Set the highlight value
2000  $txt configure -highlight $highlightable
2001 
2002  # Update the auto-indentation value
2003  indent::update_auto_indent $txt.t $widgets(info_indent)
2004 
2005  }

§ cleanup_txt()

gui::cleanup_txt   txt  

Definition at line 6308 of file gui.tcl.

6308  proc cleanup_txt {txt} {
6309 
6310  foreach ns [namespace children ::] {
6311  if {[info procs ${ns}::handle_destroy_txt] ne ""} {
6312  eval ${ns}::handle_destroy_txt $txt
6313  }
6314  }
6315 
6316  }

§ clear_info_message()

gui::clear_info_message   hide_info fr fg fb br bg bb args  

Definition at line 3538 of file gui.tcl.

3538  proc clear_info_message {hide_info fr fg fb br bg bb args} {
3539 
3540  variable widgets
3541  variable info_clear
3542  variable info_msgs
3543 
3544  array set opts {
3545  -fade_count 0
3546  -win ""
3547  }
3548  array set opts $args
3549 
3550  if {$opts(-fade_count) == 10} {
3551 
3552  # Clear the text
3553  $widgets(info_msg) configure -text ""
3554 
3555  # Clear the message memory
3556  unset -nocomplain info_msgs($opts(-win))
3557 
3558  # Clear the info_clear variable
3559  set info_clear ""
3560 
3561  # If the status bar is supposed to be hidden, hide it now
3562  if {$hide_info} {
3564  }
3565 
3566  } else {
3567 
3568  # Calculate the color
3569  set color [format {#%02x%02x%02x} \
3570  [expr $fr - ((($fr - $br) / 10) * $opts(-fade_count))] \
3571  [expr $fg - ((($fg - $bg) / 10) * $opts(-fade_count))] \
3572  [expr $fb - ((($fb - $bb) / 10) * $opts(-fade_count))]]
3573 
3574  # Set the foreground color to simulate the fade effect
3575  $widgets(info_msg) configure -foreground $color
3576 
3577  set info_clear [after 100 [list gui::clear_info_message $hide_info $fr $fg $fb $br $bg $bb -fade_count [incr opts(-fade_count)] -win $opts(-win)]]
3578 
3579  }
3580 
3581  }

§ clear_last_opened()

gui::clear_last_opened

Definition at line 1593 of file gui.tcl.

1593  proc clear_last_opened {} {
1594 
1595  variable last_opened
1596 
1597  set last_opened [list]
1598 
1599  }

§ clear_tab_tooltip()

gui::clear_tab_tooltip   W  

Definition at line 4314 of file gui.tcl.

4314  proc clear_tab_tooltip {W} {
4315 
4316  variable tab_tip
4317 
4318  unset -nocomplain tab_tip($W)
4319  tooltip::tooltip clear $W
4320  tooltip::hide
4321 
4322  }

§ close_all()

gui::close_all   args  

Definition at line 2617 of file gui.tcl.

2617  proc close_all {args} {
2618 
2619  variable widgets
2620 
2621  array set opts {
2622  -force 0
2623  -exiting 0
2624  }
2625  array set opts $args
2626 
2627  foreach nb [lreverse [$widgets(nb_pw) panes]] {
2628  foreach tab [lreverse [$nb.tbf.tb tabs]] {
2629  close_tab $tab -lazy 1 {*}$args
2630  }
2631  }
2632 
2633  }

§ close_check()

gui::close_check   tab force exiting  

Definition at line 2440 of file gui.tcl.

2440  proc close_check {tab force exiting} {
2441 
2442  # Get the tab information
2443  get_info $tab tab tabbar fname modified diff
2444 
2445  # If the file needs to be saved, do it now
2446  if {$modified && !$diff && !$force} {
2447  set fname [file tail $fname]
2448  set msg [format "%s %s?" [msgcat::mc "Save"] $fname]
2449  set_current_tab $tabbar $tab
2450  if {[set answer [tk_messageBox -default yes -type [expr {$exiting ? {yesno} : {yesnocancel}}] -message $msg -title [msgcat::mc "Save request"]]] eq "yes"} {
2451  return [save_current -force $force]
2452  } elseif {$answer eq "cancel"} {
2453  return 0
2454  }
2455  }
2456 
2457  return 1
2458 
2459  }

§ close_check_by_tabbar()

gui::close_check_by_tabbar   w tab  

Definition at line 2464 of file gui.tcl.

2464  proc close_check_by_tabbar {w tab} {
2465 
2466  return [close_check $tab 0 0]
2467 
2468  }

§ close_current()

gui::close_current   args  

Definition at line 2475 of file gui.tcl.

2475  proc close_current {args} {
2476 
2477  array set opts {
2478  -force 0
2479  -exiting 0
2480  }
2481  array set opts $args
2482 
2483  close_tab [get_info {} current tab] -force $opts(-force) -exiting $opts(-exiting)
2484 
2485  }

§ close_current_pane()

gui::close_current_pane

Definition at line 2659 of file gui.tcl.

2659  proc close_current_pane {} {
2660 
2661  variable widgets
2662  variable pw_current
2663 
2664  set nb [lindex [$widgets(nb_pw) panes] $pw_current]
2665 
2666  foreach tab [lreverse [$nb.tbf.tb tabs]] {
2667  close_tab $tab -lazy 1
2668  }
2669 
2670  }

§ close_dir_files()

gui::close_dir_files   dirs  

Definition at line 2693 of file gui.tcl.

2693  proc close_dir_files {dirs} {
2694 
2695  set set_current 0
2696 
2697  foreach dir $dirs {
2698  foreach index [lreverse [files::get_indices fname $dir*]] {
2699  close_tab [get_info $index fileindex tab] -lazy 1
2700  set set_current 1
2701  }
2702  }
2703 
2704  # Set the current tab if we have lost it
2705  if {$set_current} {
2706  get_info {} current tabbar tab
2707  set_current_tab $tabbar $tab
2708  }
2709 
2710  }

§ close_files()

gui::close_files   indices  

Definition at line 2674 of file gui.tcl.

2674  proc close_files {indices} {
2675 
2676  if {[llength $indices] > 0} {
2677 
2678  # Perform a lazy close
2679  foreach index [lsort -decreasing $indices] {
2680  catch { close_tab [get_info $index fileindex tab] -lazy 1}
2681  }
2682 
2683  # Set the current tab
2684  get_info {} current tabbar tab
2685  set_current_tab $tabbar $tab
2686 
2687  }
2688 
2689  }

§ close_others()

gui::close_others

Definition at line 2593 of file gui.tcl.

2593  proc close_others {} {
2594 
2595  variable widgets
2596  variable pw_current
2597 
2598  set current_nb [lindex [$widgets(nb_pw) panes] $pw_current]
2599  set current_tab [$current_nb.tbf.tb select]
2600 
2601  foreach nb [lreverse [$widgets(nb_pw) panes]] {
2602  foreach tab [lreverse [$nb.tbf.tb tabs]] {
2603  if {$tab ne $current_tab} {
2604  close_tab $tab -lazy 1
2605  }
2606  }
2607  }
2608 
2609  # Set the current tab
2610  get_info {} current tabbar tab
2611  set_current_tab $tabbar $tab
2612 
2613  }

§ close_others_current_pane()

gui::close_others_current_pane

Definition at line 2637 of file gui.tcl.

2637  proc close_others_current_pane {} {
2638 
2639  variable widgets
2640  variable pw_current
2641 
2642  set nb [lindex [$widgets(nb_pw) panes] $pw_current]
2643  set current_tab [$nb.tbf.tb select]
2644 
2645  foreach tab [lreverse [$nb.tbf.tb tabs]] {
2646  if {$tab ne $current_tab} {
2647  close_tab $tab -lazy 1
2648  }
2649  }
2650 
2651  # Set the current tab
2652  get_info {} current tabbar tab
2653  set_current_tab $tabbar $tab
2654 
2655  }

§ close_search()

gui::close_search

Definition at line 3252 of file gui.tcl.

3252  proc close_search {} {
3253 
3254  # Get the current text frame
3255  get_info {} current tab txt
3256 
3257  # Hide the search frame
3258  panel_forget $tab.sf
3259 
3260  # Put the focus on the text widget
3262 
3263  # Set the unfocussed insertion cursor to none
3264  catch { $txt configure -insertunfocussed none}
3265 
3266  }

§ close_search_and_replace()

gui::close_search_and_replace

Definition at line 3302 of file gui.tcl.

3302  proc close_search_and_replace {} {
3303 
3304  # Get the current tab
3305  get_info {} current tab
3306 
3307  # Hide the search and replace bar
3308  panel_forget $tab.rf
3309 
3310  # Put the focus on the text widget
3312 
3313  }

§ close_tab()

gui::close_tab   tab args  

Definition at line 2506 of file gui.tcl.

2506  proc close_tab {tab args} {
2507 
2508  variable widgets
2509  variable pw_current
2510 
2511  array set opts {
2512  -exiting 0
2513  -keeptab 1
2514  -lazy 0
2515  -force 0
2516  -check 1
2517  -tabbar ""
2518  }
2519  array set opts $args
2520 
2521  # Get information
2522  get_info $tab tab pane tabbar tabindex txt txt2 fileindex fname diff
2523 
2524  # Figure out if the tab has txt2 opened
2525  set txt2_exists [winfo exists $txt2]
2526 
2527  # Perform save check on close
2528  if {$opts(-check)} {
2529  if {![close_check $tab $opts(-force) $opts(-exiting)]} {
2530  return
2531  }
2532  }
2533 
2534  # Unhighlight the file in the file browser (if the file was not a difference view)
2535  sidebar::highlight_filename $fname [expr $diff * 2]
2536 
2537  # Run the close event for this file
2538  plugins::handle_on_close $fileindex
2539 
2540  # Delete the file from files
2541  files::remove $tab
2542 
2543  # Remove the tab from the tabbar (unless this has already been done by the tabbar)
2544  if {$opts(-tabbar) eq ""} {
2545  $tabbar delete $tabindex
2546  } else {
2547  set tabbar $opts(-tabbar)
2548  set pane [winfo parent [winfo parent $tabbar]]
2549  set pw_current [lsearch [$widgets(nb_pw) panes] $pane]
2550  }
2551 
2552  # Delete the text frame
2553  catch { pack forget $tab}
2554 
2555  # Destroy the text frame
2556  destroy $tab
2557 
2558  # Clean up any code that is reliant on the text widget (if we are not exiting
2559  # the application) to avoid memory leaks
2560  if {!$opts(-exiting)} {
2561  cleanup_txt $txt
2562  if {$txt2_exists} {
2563  cleanup_txt $txt2
2564  }
2565  }
2566 
2567  # Display the current pane (if one exists)
2568  if {!$opts(-lazy) && ([set tab [$tabbar select]] ne "")} {
2569  set_current_tab $tabbar $tab
2570  }
2571 
2572  # If we have no more tabs and there is another pane, remove this pane
2573  if {([llength [$tabbar tabs]] == 0) && ([llength [$widgets(nb_pw) panes]] > 1)} {
2574  $widgets(nb_pw) forget $pane
2575  set pw_current 0
2576  set tabbar [get_info 0 paneindex tabbar]
2577  }
2578 
2579  # Add a new file if we have no more tabs, we are the only pane, and the preference
2580  # setting is to not close after the last tab is closed.
2581  if {([llength [$tabbar tabs]] == 0) && ([llength [$widgets(nb_pw) panes]] == 1) && !$opts(-exiting)} {
2582  if {[preferences::get General/ExitOnLastClose] || $::cl_exit_on_close} {
2584  } elseif {$opts(-keeptab)} {
2585  add_new_file end
2586  }
2587  }
2588 
2589  }

§ close_tab_by_tabbar()

gui::close_tab_by_tabbar   w tab  

Definition at line 2491 of file gui.tcl.

2491  proc close_tab_by_tabbar {w tab} {
2492 
2493  variable pw_current
2494 
2495  # Close the tab specified by tab (we don't need to check because the check
2496  # will have already been performed with the -checkcommand passed to the
2497  # tabbar.
2498  close_tab $tab -tabbar $w -check 0
2499 
2500  return 1
2501 
2502  }

§ copy()

gui::copy

Definition at line 2990 of file gui.tcl.

2990  proc copy {} {
2991 
2992  # Perform the copy
2993  [current_txt] copy
2994 
2995  # Add the clipboard contents to history
2997 
2998  }

§ create()

gui::create

Definition at line 251 of file gui.tcl.

251  proc create {} {
252 
253  variable widgets
254  variable search_method
255  variable fif_method
256 
257  # Set the application icon photo
258  wm iconphoto . [image create photo -file [file join $::tke_dir lib images tke_logo_128.gif]]
259  wm geometry . 800x600
260 
261  # Create images
263 
264  # Create the panedwindow
265  set widgets(pw) [ttk::panedwindow .pw -orient horizontal]
266 
267  # Add the sidebar
268  set widgets(sb) [sidebar::create $widgets(pw).sb]
269 
270  # Create panedwindow (to support split pane view)
271  $widgets(pw) add [ttk::frame $widgets(pw).tf]
272 
273  # Create the notebook panedwindow
274  set widgets(nb_pw) [ttk::panedwindow $widgets(pw).tf.nbpw -orient horizontal]
275 
276  # Add notebook
278 
279  # Pack the notebook panedwindow
280  pack $widgets(nb_pw) -fill both -expand yes
281 
282  # Create the find_in_files widget
283  set max_width [expr [msgcat::mcmax "Regexp" "Glob" "Exact"] + 1]
284  set widgets(fif) [ttk::frame .fif]
285  ttk::label $widgets(fif).lf -text [format "%s: " [msgcat::mc "Find"]]
286  set widgets(fif_find) [ttk::entry $widgets(fif).ef]
287  set widgets(fif_type) [ttk::button $widgets(fif).type -style BButton -width $max_width -command [list gui::handle_menu_popup $widgets(fif).type .fif.typeMenu]]
288  set widgets(fif_case) [ttk::checkbutton $widgets(fif).case -text "Aa" -variable gui::case_sensitive]
289  ttk::label $widgets(fif).li -text [format "%s: " [msgcat::mc "In"]]
290  set widgets(fif_in) [tokenentry::tokenentry $widgets(fif).ti -font [$widgets(fif_find) cget -font] \
291  -tokenshape square -highlightthickness 2 -highlightbackground white -highlightcolor white]
292  set widgets(fif_save) [ttk::checkbutton $widgets(fif).save -text [msgcat::mc "Save"] \
293  -variable gui::saved -command [list search::update_save fif]]
294  set widgets(fif_close) [ttk::label $widgets(fif).close -image form_close]
295 
296  # Create the search type menu
297  set type_menu [menu $widgets(fif).typeMenu -tearoff 0]
298  $type_menu add radiobutton -label [msgcat::mc "Regexp"] -variable gui::fif_method -value "regexp" -command [list $widgets(fif_type) configure -text [msgcat::mc "Regexp"]]
299  $type_menu add radiobutton -label [msgcat::mc "Glob"] -variable gui::fif_method -value "glob" -command [list $widgets(fif_type) configure -text [msgcat::mc "Glob"]]
300  $type_menu add radiobutton -label [msgcat::mc "Exact"] -variable gui::fif_method -value "exact" -command [list $widgets(fif_type) configure -text [msgcat::mc "Exact"]]
301 
302  tooltip::tooltip $widgets(fif_case) [msgcat::mc "Case sensitivity"]
303 
304  bind $widgets(fif_find) <Return> [list gui::check_fif_for_return]
305  bind [$widgets(fif_in) entrytag] <Return> { if {[gui::check_fif_for_return]} break }
306  bind $widgets(fif_case) <Return> [list gui::check_fif_for_return]
307  bind $widgets(fif_save) <Return> [list gui::check_fif_for_return]
308  bind $widgets(fif_find) <Escape> [list set gui::user_exit_status 0]
309  bind [$widgets(fif_in) entrytag] <Escape> [list set gui::user_exit_status 0]
310  bind $widgets(fif_case) <Escape> [list set gui::user_exit_status 0]
311  bind $widgets(fif_save) <Escape> [list set gui::user_exit_status 0]
312  bind $widgets(fif_close) <Button-1> [list set gui::user_exit_status 0]
313  bind $widgets(fif_find) <Up> "search::traverse_history fif 1; break"
314  bind $widgets(fif_find) <Down> "search::traverse_history fif -1; break"
315  bind $widgets(fif_close) <Key-space> [list set gui::user_exit_status 0]
316 
317  # Make the fif_in field a drop target
318  make_drop_target $widgets(fif_in) tokenentry -types {files dirs}
319 
320  grid columnconfigure $widgets(fif) 1 -weight 1
321  grid $widgets(fif).lf -row 0 -column 0 -sticky ew -pady 2
322  grid $widgets(fif).ef -row 0 -column 1 -sticky ew -pady 2
323  grid $widgets(fif).type -row 0 -column 2 -sticky news -padx 2 -pady 2
324  grid $widgets(fif).case -row 0 -column 3 -sticky news -padx 2 -pady 2
325  grid $widgets(fif).close -row 0 -column 4 -sticky news -padx 2 -pady 2
326  grid $widgets(fif).li -row 1 -column 0 -sticky ew -pady 2
327  grid $widgets(fif).ti -row 1 -column 1 -sticky ew -pady 2
328  grid $widgets(fif).save -row 1 -column 3 -sticky news -padx 2 -pady 2 -columnspan 2
329 
330  # Create the documentation search bar
331  set widgets(doc) [ttk::frame .doc]
332  ttk::label $widgets(doc).l1f -text [format "%s: " [msgcat::mc "Search"]]
333  ttk::menubutton $widgets(doc).mb -menu [menu .doc.docPopup -tearoff 0]
334  ttk::label $widgets(doc).l2f -text [format "%s: " [msgcat::mc "for"]]
335  ttk::entry $widgets(doc).e
336  ttk::checkbutton $widgets(doc).save -text [msgcat::mc "Save"] -variable gui::saved \
337  -command [list search::update_save docsearch]
338  ttk::label $widgets(doc).close -image form_close
339 
340  bind $widgets(doc).e <Return> [list set gui::user_exit_status 1]
341  bind $widgets(doc).e <Escape> [list set gui::user_exit_status 0]
342  bind $widgets(doc).e <Up> "search::traverse_history docsearch 1; break"
343  bind $widgets(doc).e <Down> "search::traverse_history docsearch -1; break"
344  bind $widgets(doc).mb <Return> [list set gui::user_exit_status 1]
345  bind $widgets(doc).mb <Escape> [list set gui::user_exit_status 0]
346  bind $widgets(doc).save <Return> [list set gui::user_exit_status 1]
347  bind $widgets(doc).save <Escape> [list set gui::user_exit_status 0]
348  bind $widgets(doc).close <Button-1> [list set gui::user_exit_status 0]
349  bind $widgets(doc).close <Key-space> [list set gui::user_exit_status 0]
350 
351  pack $widgets(doc).l1f -side left -padx 2 -pady 2
352  pack $widgets(doc).mb -side left -padx 2 -pady 2
353  pack $widgets(doc).l2f -side left -padx 2 -pady 2
354  pack $widgets(doc).e -side left -padx 2 -pady 2 -fill x -expand yes
355  pack $widgets(doc).save -side left -padx 2 -pady 2
356  pack $widgets(doc).close -side left -padx 2 -pady 2
357 
358  # Create the information bar
359  set widgets(info) [ttk::frame .if]
360  set widgets(info_state) [ttk::label .if.l1]
361  ttk::separator .if.s1 -orient vertical
362  set widgets(info_msg) [ttk::label .if.l2]
363  ttk::separator .if.s2 -orient vertical
364  set widgets(info_encode) [ttk::button .if.enc -style BButton -command [list gui::handle_menu_popup .if.enc [gui::create_encoding_menu .if.enc]]]
365  ttk::separator .if.s3 -orient vertical
366  set widgets(info_indent) [ttk::button .if.ind -style BButton -command [list gui::handle_menu_popup .if.ind [indent::create_menu .if.ind]]]
367  ttk::separator .if.s4 -orient vertical
368  set widgets(info_syntax) [ttk::button .if.syn -style BButton -command [list gui::handle_menu_popup .if.syn [syntax::create_menu .if.syn]]]
369  ttk::label .if.sp -text " "
370 
371  $widgets(info_encode) configure -state disabled
372  $widgets(info_indent) configure -state disabled
373  $widgets(info_syntax) configure -state disabled
374 
375  pack .if.l1 -side left -padx 2 -pady 2
376  pack .if.s1 -side left -padx 2 -pady 10 -fill y
377  pack .if.l2 -side left -padx 2 -pady 2
378  pack .if.sp -side right -padx 2 -pady 2
379  pack .if.syn -side right -padx 2 -pady 2
380  pack .if.s3 -side right -padx 2 -pady 10 -fill y
381  pack .if.ind -side right -padx 2 -pady 2
382  pack .if.s2 -side right -padx 2 -pady 10 -fill y
383  pack .if.enc -side right -padx 2 -pady 2
384  pack .if.s4 -side right -padx 2 -pady 10 -fill y
385 
386  # Create the configurable response widget
387  set widgets(ursp) [ttk::frame .rf]
388  set widgets(ursp_label) [ttk::label .rf.l]
389  set widgets(ursp_entry) [ttk::entry .rf.e]
390  ttk::label .rf.close -image form_close
391 
392  bind $widgets(ursp_entry) <Return> [list set gui::user_exit_status 1]
393  bind $widgets(ursp_entry) <Escape> [list set gui::user_exit_status 0]
394  bind .rf.close <Button-1> [list set gui::user_exit_status 0]
395  bind .rf.close <Key-space> [list set gui::user_exit_status 0]
396 
397  # Make the user field a drag and drop target
398  make_drop_target $widgets(ursp_entry) entry
399 
400  grid rowconfigure .rf 0 -weight 1
401  grid columnconfigure .rf 1 -weight 1
402  grid $widgets(ursp_label) -row 0 -column 0 -sticky news -padx 2 -pady 2
403  grid $widgets(ursp_entry) -row 0 -column 1 -sticky news -padx 2 -pady 2
404  grid .rf.close -row 0 -column 2 -sticky news -padx 2 -pady 2
405 
406  # Pack the notebook
407  grid rowconfigure . 0 -weight 1
408  grid columnconfigure . 0 -weight 1
409  grid $widgets(pw) -row 0 -column 0 -sticky news
410  grid $widgets(info) -row 1 -column 0 -sticky ew
411 
412  ttk::separator .sep -orient horizontal
413 
414  # Create tab popup
415  set widgets(menu) [menu $widgets(nb_pw).popupMenu -tearoff 0 -postcommand gui::setup_tab_popup_menu]
416  $widgets(menu) add command -label [msgcat::mc "Close Tab"] -command [list gui::close_current]
417  $widgets(menu) add command -label [msgcat::mc "Close All Other Tabs"] -command gui::close_others
418  $widgets(menu) add command -label [msgcat::mc "Close All Tabs"] -command gui::close_all
419  $widgets(menu) add separator
420  $widgets(menu) add command -label [msgcat::mc "Close Other Tabs In Pane"] -command gui::close_others_current_pane
421  $widgets(menu) add command -label [msgcat::mc "Close All Tabs In Pane"] -command gui::close_current_pane
422  $widgets(menu) add separator
423  $widgets(menu) add command -label [msgcat::mc "Hide Tab"] -command [list gui::hide_current]
424  $widgets(menu) add separator
425  $widgets(menu) add checkbutton -label [msgcat::mc "Split View"] -onvalue 1 -offvalue 0 \
426  -variable menus::show_split_pane -command [list gui::toggle_split_pane]
427  $widgets(menu) add checkbutton -label [msgcat::mc "Bird's Eye View"] -onvalue 1 -offvalue 0 \
428  -variable menus::show_birdseye -command [list gui::toggle_birdseye]
429  $widgets(menu) add separator
430  $widgets(menu) add checkbutton -label [msgcat::mc "Locked"] -onvalue 1 -offvalue 0 \
431  -variable gui::file_locked -command [list gui::set_current_file_lock_with_current]
432  $widgets(menu) add checkbutton -label [msgcat::mc "Favorited"] -onvalue 1 -offvalue 0 \
433  -variable gui::file_favorited -command [list gui::set_current_file_favorite_with_current]
434  $widgets(menu) add separator
435  $widgets(menu) add command -label [msgcat::mc "Show in Sidebar"] -command gui::show_current_in_sidebar
436  $widgets(menu) add separator
437  $widgets(menu) add command -label [msgcat::mc "Move to Other Pane"] -command gui::move_to_pane
438 
439  # Add the menu to the themable widgets
440  theme::register_widget $widgets(menu) menus
441  theme::register_widget .doc.docPopup menus
442 
443  # Add plugins to tab popup
444  plugins::handle_tab_popup $widgets(menu)
445 
446  # Add the menu bar
448 
449  # Show the sidebar (if necessary)
450  if {[preferences::get View/ShowSidebar]} {
452  } else {
454  }
455 
456  # Show the console (if necessary)
457  if {[preferences::get View/ShowConsole]} {
459  } else {
460  # hide_console_view
461  }
462 
463  # Show the tabbar (if necessary)
464  if {[preferences::get View/ShowTabBar]} {
466  } else {
468  }
469 
470  # Show the status bar (if necessary)
471  if {[preferences::get View/ShowStatusBar]} {
473  } else {
475  }
476 
477  # Save the initial state since this value can be modified from Vim
478  set_matching_char [preferences::get Editor/HighlightMatchingChar]
479 
480  # Make sure that the browse directory is updated
482 
483  # Set the default search method
484  if {![preferences::get Editor/VimMode]} {
485  set search_method [preferences::get Find/DefaultMethod]
486  }
487 
488  # Set the default Find in Files search method
489  set fif_method [preferences::get Find/DefaultFIFMethod]
490 
491  # Add the available encodings to the command launcher
492  foreach encname [encoding names] {
493  launcher::register [format "%s: %s" [msgcat::mc "Encoding"] [string toupper $encname]] [list gui::set_current_encoding $encname]
494  }
495 
496  # If the user attempts to close the window via the window manager, treat
497  # it as an exit request from the menu system.
498  wm protocol . WM_DELETE_WINDOW [list menus::exit_command]
499 
500  # Trace changes to the Appearance/Theme preference variable
501  trace variable preferences::prefs(Editor/WarningWidth) w gui::handle_warning_width_change
502  trace variable preferences::prefs(Editor/MaxUndo) w gui::handle_max_undo
503  trace variable preferences::prefs(Editor/HighlightMatchingChar) w gui::handle_matching_char
504  trace variable preferences::prefs(Editor/HighlightMismatchingChar) w gui::handle_bracket_audit
505  trace variable preferences::prefs(Editor/RelativeLineNumbers) w gui::handle_relative_line_numbers
506  trace variable preferences::prefs(Editor/LineNumberAlignment) w gui::handle_line_number_alignment
507  trace variable preferences::prefs(View/AllowTabScrolling) w gui::handle_allow_tab_scrolling
508  trace variable preferences::prefs(Editor/VimMode) w gui::handle_vim_mode
509  trace variable preferences::prefs(Appearance/EditorFont) w gui::handle_editor_font
510  trace variable preferences::prefs(General/AutoChangeWorkingDirectory) w gui::handle_auto_cwd
511  trace variable preferences::prefs(General/DefaultFileBrowserDirectory) w gui::handle_browse_directory
512  trace variable preferences::prefs(View/ShowBirdsEyeView) w gui::handle_show_birdseye
513  trace variable preferences::prefs(View/BirdsEyeViewFontSize) w gui::handle_birdseye_font_size
514  trace variable preferences::prefs(View/BirdsEyeViewWidth) w gui::handle_birdseye_width
515  trace variable preferences::prefs(View/EnableCodeFolding) w gui::handle_code_folding
516  trace variable preferences::prefs(Appearance/CursorWidth) w gui::handle_cursor_width
517  trace variable preferences::prefs(Appearance/ExtraLineSpacing) w gui::handle_extra_line_spacing
518 
519  # Create general UI bindings
520  bind all <Control-plus> [list gui::handle_font_change 1]
521  bind all <Control-minus> [list gui::handle_font_change -1]
522 
523  }

§ create_current_marker()

gui::create_current_marker

Definition at line 5599 of file gui.tcl.

5599  proc create_current_marker {} {
5600 
5601  # Get the current text widget
5602  get_info {} current tab txt
5603 
5604  # Get the current line
5605  set line [lindex [split [$txt index insert] .] 0]
5606 
5607  # Add the marker at the current line
5608  if {[set tag [ctext::linemapSetMark $txt $line]] ne ""} {
5609  if {[markers::add $tab tag $tag]} {
5610  update_tab_markers $tab
5611  } else {
5612  ctext::linemapClearMark $txt $line
5613  }
5614  }
5615 
5616  }

§ create_encoding_menu()

gui::create_encoding_menu   w  

Definition at line 5974 of file gui.tcl.

5974  proc create_encoding_menu {w} {
5975 
5976  variable widgets
5977 
5978  # Create the menubutton menu
5979  set mnu [menu ${w}Menu -tearoff 0]
5980 
5981  # If we are running in Aqua, don't perform the column break
5982  set dobreak [expr {[tk windowingsystem] ne "aqua"}]
5983 
5984  # Populate the menu with the available languages
5985  set i 0
5986  foreach enc [lsort -dictionary [encoding names]] {
5987  $mnu add radiobutton -label [string toupper $enc] -variable gui::current_encoding \
5988  -value $enc -command [list gui::set_current_encoding $enc] -columnbreak [expr (($i % 20) == 0) && $dobreak]
5989  incr i
5990  }
5991 
5992  # Register the menu
5993  theme::register_widget $mnu menus
5994 
5995  return $mnu
5996 
5997  }

§ create_images()

gui::create_images

Definition at line 122 of file gui.tcl.

122  proc create_images {} {
123 
124  # Create tab images
125  theme::register_image tab_lock bitmap tabs -background \
126  {msgcat::mc "Image used in tab to indicate that the tab’s file is locked."} \
127  -file [file join $::tke_dir lib images lock.bmp] \
128  -maskfile [file join $::tke_dir lib images lock.bmp] \
129  -foreground 2
130  theme::register_image tab_readonly bitmap tabs -background \
131  {msgcat::mc "Image used in tab to indicate that the tab's file is readonly."} \
132  -file [file join $::tke_dir lib images lock.bmp] \
133  -maskfile [file join $::tke_dir lib images lock.bmp] \
134  -foreground 2
135  theme::register_image tab_diff bitmap tabs -background \
136  {msgcat::mc "Image used in tab to indicate that the tab contains a difference view."} \
137  -file [file join $::tke_dir lib images diff.bmp] \
138  -maskfile [file join $::tke_dir lib images diff.bmp] \
139  -foreground 2
140  theme::register_image tab_close bitmap tabs -background \
141  {msgcat::mc "Image used in tab which, when clicked, closes the tab."} \
142  -file [file join $::tke_dir lib images close.bmp] \
143  -maskfile [file join $::tke_dir lib images close.bmp] \
144  -foreground 2
145  theme::register_image tab_activeclose bitmap tabs -background \
146  {msgcat::mc "Images used in tab which will be displayed when the mouse enters the close button area"} \
147  -file [file join $::tke_dir lib images active_close.bmp] \
148  -maskfile [file join $::tke_dir lib images active_close.bmp] \
149  -foreground 2
150 
151  # Create close button for forms
152  theme::register_image form_close bitmap ttk_style background \
153  {msgcat::mc "Image displayed in fill-in forms which closes the form UI. Used in forms such as search, search/replace, and find in files."} \
154  -file [file join $::tke_dir lib images close.bmp] \
155  -maskfile [file join $::tke_dir lib images close.bmp] \
156  -foreground 2
157 
158  # Create next/previous button for search
159  theme::register_image search_next bitmap ttk_style background \
160  {msgcat::mc "Image displayed in find field to search for next match."} \
161  -file [file join $::tke_dir lib images right.bmp] \
162  -maskfile [file join $::tke_dir lib images right.bmp] \
163  -foreground 2
164  theme::register_image search_prev bitmap ttk_style background \
165  {msgcat::mc "Image displayed in find field to search for previous match."} \
166  -file [file join $::tke_dir lib images left.bmp] \
167  -maskfile [file join $::tke_dir lib images left.bmp] \
168  -foreground 2
169 
170  # Create main logo image
171  image create photo logo -file [file join $::tke_dir lib images tke_logo_64.gif]
172 
173  # Create menu images
174  theme::register_image menu_lock bitmap menus -background \
175  {msgcat::mc "Image used in tab menus to indicate that the file is locked."} \
176  -file [file join $::tke_dir lib images lock.bmp] \
177  -maskfile [file join $::tke_dir lib images lock.bmp] \
178  -foreground black
179  theme::register_image menu_readonly bitmap menus -background \
180  {msgcat::mc "Image used in tab menus to indicate that the file is readonly."} \
181  -file [file join $::tke_dir lib images lock.bmp] \
182  -maskfile [file join $::tke_dir lib images lock.bmp] \
183  -foreground black
184  theme::register_image menu_diff bitmap menus -background \
185  {msgcat::mc "Image used in tab menus to indicate that the file is associated with a difference view."} \
186  -file [file join $::tke_dir lib images diff.bmp] \
187  -maskfile [file join $::tke_dir lib images diff.bmp] \
188  -foreground black
189  theme::register_image menu_check bitmap menus -background \
190  {msgcat::mc "Image used in the menus to indicate that a menu item is selected."} \
191  -file [file join $::tke_dir lib images menu_check.bmp] \
192  -maskfile [file join $::tke_dir lib images menu_check.bmp] \
193  -foreground black
194  theme::register_image menu_nocheck bitmap menus -background \
195  {msgcat::mc "Image used in the menus to indicate that a menu item is not selected."} \
196  -file [file join $::tke_dir lib images menu_nocheck.bmp] \
197  -maskfile [file join $::tke_dir lib images menu_nocheck.bmp] \
198  -foreground black
199 
200  # Create preference images
201  theme::register_image pref_checked photo ttk_style background \
202  {msgcat::mc "Image used in the preferences window to indicate that a table item is selected."} \
203  -file [file join $::tke_dir lib images checked.gif]
204  theme::register_image pref_unchecked photo ttk_style background \
205  {msgcat::mc "Image used in the preferences window to indicate that a table item is deselected."} \
206  -file [file join $::tke_dir lib images unchecked.gif]
207  theme::register_image pref_check photo ttk_style background \
208  {msgcat::mc "Image used in the preferences window to indicate that something is true."} \
209  -file [file join $::tke_dir lib images check.gif]
210  theme::register_image pref_general photo ttk_style background \
211  {msgcat::mc "Image used in the preferences window in the General tab."} \
212  -file [file join $::tke_dir lib images general.gif]
213  theme::register_image pref_appearance photo ttk_style background \
214  {msgcat::mc "Image used in the preferences window in the Appearance tab."} \
215  -file [file join $::tke_dir lib images appearance.gif]
216  theme::register_image pref_editor photo ttk_style background \
217  {msgcat::mc "Image used in the preferences window in the Editor tab."} \
218  -file [file join $::tke_dir lib images editor.gif]
219  theme::register_image pref_emmet photo ttk_style background \
220  {msgcat::mc "Image used in the preferences window in the Emmet tab."} \
221  -file [file join $::tke_dir lib images emmet.gif]
222  theme::register_image pref_find photo ttk_style background \
223  {msgcat::mc "Image used in the preferences window in the Find tab."} \
224  -file [file join $::tke_dir lib images find.gif]
225  theme::register_image pref_sidebar photo ttk_style background \
226  {msgcat::mc "Image used in the preferences window in the Sidebar tab."} \
227  -file [file join $::tke_dir lib images sidebar.gif]
228  theme::register_image pref_view photo ttk_style background \
229  {msgcat::mc "Image used in the preferences window in the View tab."} \
230  -file [file join $::tke_dir lib images view.gif]
231  theme::register_image pref_snippets photo ttk_style background \
232  {msgcat::mc "Image used in the preferences window in the Snippets tab."} \
233  -file [file join $::tke_dir lib images snippets.gif]
234  theme::register_image pref_shortcuts photo ttk_style background \
235  {msgcat::mc "Image used in the preferences window in the Shortcuts tab."} \
236  -file [file join $::tke_dir lib images shortcut.gif]
237  theme::register_image pref_plugins photo ttk_style background \
238  {msgcat::mc "Image used in the preferences window in the Plugins tab."} \
239  -file [file join $::tke_dir lib images plugins.gif]
240  theme::register_image pref_documentation photo ttk_style background \
241  {msgcat::mc "Image used in the preferences window in the Documentation tab."} \
242  -file [file join $::tke_dir lib images documentation.gif]
243  theme::register_image pref_advanced photo ttk_style background \
244  {msgcat::mc "Image used in the preferences window in the Advanced tab."} \
245  -file [file join $::tke_dir lib images advanced.gif]
246 
247  }

§ current_search()

gui::current_search

Definition at line 5519 of file gui.tcl.

5519  proc current_search {} {
5520 
5521  get_info {} current tab
5522 
5523  return $tab.sf.e
5524 
5525  }

§ current_txt()

gui::current_txt

Definition at line 5507 of file gui.tcl.

5507  proc current_txt {} {
5508 
5509  if {[catch { get_info {} current focus} focus]} {
5510  return [expr {[catch { get_info {} current txt } txt] ? "" : $txt}]
5511  }
5512 
5513  return $focus
5514 
5515  }

§ cut()

gui::cut

Definition at line 2978 of file gui.tcl.

2978  proc cut {} {
2979 
2980  # Perform the cut
2981  [current_txt] cut
2982 
2983  # Add the clipboard contents to history
2985 
2986  }

§ display_file_counts()

gui::display_file_counts   txt  

Definition at line 5552 of file gui.tcl.

5552  proc display_file_counts {txt} {
5553 
5554  variable widgets
5555 
5556  # Get the current position of the insertion cursor
5557  lassign [split [$txt index insert] .] line column
5558 
5559  # Get the total line count
5560  set lines [$txt count -lines 1.0 end]
5561 
5562  # Get the total character count
5563  set chars [$txt count -chars 1.0 end]
5564 
5565  # Update the information widget
5566  set_info_message [format "%s: %d, %s: %d" [msgcat::mc "Total Lines"] $lines [msgcat::mc "Total Characters"] $chars]
5567 
5568  }

§ docsearch_get_input()

gui::docsearch_get_input   docs prsplist args  

Definition at line 6320 of file gui.tcl.

6320  proc docsearch_get_input {docs prsplist args} {
6321 
6322  variable widgets
6323  variable saved
6324 
6325  upvar $prsplist rsplist
6326 
6327  array set opts {
6328  -str ""
6329  -url ""
6330  }
6331  array set opts $args
6332 
6333  # Clear the saved indicator
6334  set saved 0
6335 
6336  # Clear the entry field
6337  $widgets(doc).e delete 0 end
6338 
6339  # Initialize the text in the menubutton
6340  $widgets(doc).mb configure -text [lindex $docs 0 0]
6341 
6342  # Populate the documentation list
6343  [$widgets(doc).mb cget -menu] delete 0 end
6344  foreach item $docs {
6345  [$widgets(doc).mb cget -menu] add command -label [lindex $item 0] -command [list $widgets(doc).mb configure -text [lindex $item 0]]
6346  }
6347 
6348  # Initialize the widget
6349  if {$opts(-str) ne ""} {
6350  $widgets(doc).e insert end $opts(-str)
6351  }
6352  if {($opts(-url) ne "") && ([set name [lsearch -exact -inline -index 1 $docs $opts(-url)]] ne "")} {
6353  $widgets(doc).mb configure -text $name
6354  }
6355 
6356  # Display the user input widget
6357  panel_place $widgets(doc)
6358 
6359  # Wait for the panel to be done
6360  focus $widgets(doc).mb
6361  tkwait variable gui::user_exit_status
6362 
6363  # Hide the user input widget
6364  panel_forget $widgets(doc)
6365 
6366  set name [$widgets(doc).mb cget -text]
6367  set url [lindex [lsearch -exact -index 0 -inline $docs $name] 1]
6368  set rsplist [list str [$widgets(doc).e get] name $name url $url save $saved]
6369 
6370  return [set gui::user_exit_status]
6371 
6372  }

§ editable()

gui::editable

Definition at line 3075 of file gui.tcl.

3075  proc editable {} {
3076 
3077  return [expr {[[current_txt] cget -state] eq "normal"}]
3078 
3079  }

§ fif_get_input()

gui::fif_get_input   prsp_list  

Definition at line 3774 of file gui.tcl.

3774  proc fif_get_input {prsp_list} {
3775 
3776  variable widgets
3777  variable fif_files
3778  variable fif_method
3779  variable case_sensitive
3780  variable saved
3781 
3782  upvar $prsp_list rsp_list
3783 
3784  # Initialize variables
3785  set case_sensitive 1
3786  set saved 0
3787 
3788  # Reset the input widgets
3789  $widgets(fif_find) delete 0 end
3790  $widgets(fif_in) delete 0 end
3791 
3792  # Populate the fif_in tokenentry menu
3793  set fif_files [sidebar::get_fif_files]
3794  $widgets(fif_in) configure -listvar gui::fif_files -matchmode regexp -matchindex 0 -matchdisplayindex 0
3795 
3796  switch $fif_method {
3797  "regexp" { $widgets(fif_type) configure -text [msgcat::mc "Regexp"]}
3798  "glob" { $widgets(fif_type) configure -text [msgcat::mc "Glob"]}
3799  "exact" { $widgets(fif_type) configure -text [msgcat::mc "Exact"]}
3800  }
3801 
3802  # Display the FIF widget
3803  panel_place $widgets(fif)
3804 
3805  # Wait for the panel to be exited
3806  focus $widgets(fif_find)
3807  tkwait variable gui::user_exit_status
3808 
3809  # Hide the widget
3810  panel_forget $widgets(fif)
3811 
3812  # Get the list of files/directories from the list of tokens
3813  set ins [list]
3814  foreach token [$widgets(fif_in) tokenget] {
3815  if {[set index [lsearch -index 0 $fif_files $token]] != -1} {
3816  lappend ins {*}[lindex $fif_files $index 1]
3817  } else {
3818  lappend ins [utils::perform_substitutions $token]
3819  }
3820  }
3821 
3822  # Gather the input to return
3823  set rsp_list [list find [$widgets(fif_find) get] in $ins method $fif_method case $case_sensitive save $saved]
3824 
3825  return [set gui::user_exit_status]
3826 
3827  }

§ find_match_char()

gui::find_match_char   txt char dir ?startpos?  

Definition at line 5833 of file gui.tcl.

5833  proc find_match_char {txt char dir {startpos insert}} {
5834 
5835  set last_found ""
5836 
5837  if {[$txt is escaped $startpos]} {
5838  return -1
5839  }
5840 
5841  if {$dir eq "-forwards"} {
5842  set startpos [$txt index "$startpos+1c"]
5843  set endpos "end"
5844  } else {
5845  set endpos "1.0"
5846  }
5847 
5848  while {1} {
5849 
5850  if {[set found [$txt search $dir $char $startpos $endpos]] eq ""} {
5851  return -1
5852  }
5853 
5854  set last_found $found
5855  set startpos [expr {($dir eq "-backwards") ? $found : [$txt index "$found+1c"]}]
5856 
5857  if {[$txt is escaped $last_found]} {
5858  continue
5859  }
5860 
5861  return $last_found
5862 
5863  }
5864 
5865  }

§ find_match_pair()

gui::find_match_pair   txt str1 str2 dir ?startpos?  

Definition at line 5777 of file gui.tcl.

5777  proc find_match_pair {txt str1 str2 dir {startpos insert}} {
5778 
5779  if {[$txt is escaped $startpos] || [$txt is incommentstring $startpos]} {
5780  return -1
5781  }
5782 
5783  set search_re "[set str1]|[set str2]"
5784  set count 1
5785  set pos [$txt index [expr {($dir eq "-forwards") ? "$startpos+1c" : $startpos}]]
5786 
5787  # Calculate the endpos
5788  if {[set incomstr [$txt is incommentstring $pos srange]]} {
5789  if {$dir eq "-forwards"} {
5790  set endpos [lindex $srange 1]
5791  } else {
5792  set endpos [lindex $srange 0]
5793  }
5794  } else {
5795  if {$dir eq "-forwards"} {
5796  set endpos "end"
5797  } else {
5798  set endpos "1.0"
5799  }
5800  }
5801 
5802  while {1} {
5803 
5804  if {[set found [$txt search $dir -regexp -- $search_re $pos $endpos]] eq ""} {
5805  return -1
5806  }
5807 
5808  set char [$txt get $found]
5809  if {$dir eq "-forwards"} {
5810  set pos "$found+1c"
5811  } else {
5812  set pos $found
5813  }
5814 
5815  if {[$txt is escaped $found] || (!$incomstr && [$txt is incommentstring $found])} {
5816  continue
5817  } elseif {[string equal $char [subst $str2]]} {
5818  incr count
5819  } elseif {[string equal $char [subst $str1]]} {
5820  incr count -1
5821  if {$count == 0} {
5822  return $found
5823  }
5824  }
5825 
5826  }
5827 
5828  }

§ find_resilient()

gui::find_resilient   dir ?type?  

Definition at line 3237 of file gui.tcl.

3237  proc find_resilient {dir {type find}} {
3238 
3239  get_info {} current tab
3240 
3241  # Clear the selection of the search entry
3242  $tab.sf.e selection clear
3243  $tab.rf.fe selection clear
3244 
3245  # Perform the search
3246  search::find_resilient $dir $type
3247 
3248  }

§ format_dropped_data()

gui::format_dropped_data   txt pdata pcursor  

Definition at line 5146 of file gui.tcl.

5146  proc format_dropped_data {txt pdata pcursor} {
5147 
5148  upvar $pdata data
5149  upvar $pcursor cursor
5150 
5151  # Get the formatting information for the current editing buffer
5152  array set formatting [syntax::get_formatting $txt]
5153 
5154  # If the data is an image, adjust for an image if we can
5155  if {[lsearch [list .png .jpg .jpeg .gif .bmp .tiff .svg] [string tolower [file extension $data]]] != -1} {
5156  if {[info exists formatting(image)]} {
5157  set pattern [lindex $formatting(image) 1]
5158  set cursor [string first \{TEXT\} $pattern]
5159  set data [string map [list \{REF\} $data \{TEXT\} {}] $pattern]
5160  }
5161 
5162  # Otherwise, if the data looks like a URL reference, change the data to a
5163  # link if we can
5164  } elseif {[utils::is_url $data]} {
5165  if {[info exists formatting(link)]} {
5166  set pattern [lindex $formatting(link) 1]
5167  set cursor [string first \{TEXT\} $pattern]
5168  set data [string map [list \{REF\} $data \{TEXT\} {}] $pattern]
5169  }
5170  }
5171 
5172  }

§ format_text()

gui::format_text

Definition at line 3084 of file gui.tcl.

3084  proc format_text {} {
3085 
3086  # Get the file information
3087  get_info {} current txt fname lock readonly
3088 
3089  # Get the locked/readonly status
3090  set readonly [expr $lock || $readonly]
3091 
3092  # If the file is locked or readonly, set the state so that it can be modified
3093  if {$readonly} {
3094  $txt configure -state normal
3095  }
3096 
3097  # If any text is selected, format it
3098  if {[llength [set selected [$txt tag ranges sel]]] > 0} {
3099  foreach {endpos startpos} [lreverse [$txt tag ranges sel]] {
3100  indent::format_text $txt.t $startpos $endpos
3101  }
3102 
3103  # Otherwise, select the full file
3104  } else {
3105  indent::format_text $txt.t 1.0 end
3106  }
3107 
3108  # If the file is locked or readonly, clear the modified state and reset the text state
3109  # back to disabled
3110  if {$readonly} {
3111 
3112  # Clear the modified state
3114 
3115  # Reset the state
3116  $txt configure -state disabled
3117 
3118  }
3119 
3120  }

§ get_all_texts()

gui::get_all_texts

Definition at line 4039 of file gui.tcl.

4039  proc get_all_texts {} {
4040 
4041  set txts [list]
4042 
4043  foreach tab [files::get_tabs] {
4044  get_info $tab tab txt txt2
4045  lappend txts $txt
4046  if {[winfo exists $txt2]} {
4047  lappend txts $txt2
4048  }
4049  }
4050 
4051  return $txts
4052 
4053  }

§ get_browse_directory()

gui::get_browse_directory

Definition at line 107 of file gui.tcl.

107  proc get_browse_directory {} {
108 
109  variable browse_dir
110 
111  switch $browse_dir {
112  last { return ""}
113  buffer { return [file dirname [get_info {} current fname]]}
114  current { return [pwd]}
115  default { return $browse_dir}
116  }
117 
118  }

§ get_file_info()

gui::get_file_info   index attr  

Definition at line 3739 of file gui.tcl.

3739  proc get_file_info {index attr} {
3740 
3741  # Perform error detections
3742  if {($index < 0) || ($index >= [files::get_file_num])} {
3743  return -code error [msgcat::mc "File index is out of range"]
3744  }
3745 
3746  # Get the current text widget
3747  get_info $index fileindex txt remote
3748 
3749  switch $attr {
3750  "sb_index" {
3751  return [sidebar::get_index $index $remote]
3752  }
3753  "txt" {
3754  return $txt.t
3755  }
3756  "current" {
3757  return [expr {$txt eq [current_txt]}]
3758  }
3759  "vimmode" {
3760  return [vim::in_vim_mode $txt.t]
3761  }
3762  "lang" {
3763  return [syntax::get_language $txt]
3764  }
3765  default {
3766  return [files::get_info $index fileindex $attr]
3767  }
3768  }
3769 
3770  }

§ get_info()

gui::get_info   from from_type args  

Definition at line 4079 of file gui.tcl.

4079  proc get_info {from from_type args} {
4080 
4081  variable widgets
4082  variable pw_current
4083  variable txt_current
4084 
4085  # Convert from to a tab
4086  switch $from_type {
4087  current {
4088  set tab [[lindex [$widgets(nb_pw) panes] $pw_current].tbf.tb select]
4089  }
4090  pane {
4091  set tab [$from.tbf.tb select]
4092  }
4093  paneindex {
4094  set tab [[lindex [$widgets(nb_pw) panes] $from].tbf.tb select]
4095  }
4096  tabbar {
4097  set tab [$from select]
4098  }
4099  tab {
4100  set tab $from
4101  }
4102  tabindex {
4103  set tab [lindex [[lindex [$widgets(nb_pw) panes] $pw_current].tbf.tb tabs] $from]
4104  }
4105  fileindex {
4106  files::get_info $from fileindex tab
4107  }
4108  txt -
4109  txt2 {
4110  set tab [winfo parent [winfo parent [winfo parent $from]]]
4111  }
4112  beye {
4113  set tab [winfo parent $from]
4114  }
4115  fname {
4116  files::get_info $from fname tab
4117  }
4118  }
4119 
4120  if {$tab eq ""} {
4121  set paneindex $pw_current
4122  } else {
4123  set panes [$widgets(nb_pw) panes]
4124  set paneindex [expr {(([llength $panes] == 1) || ([lsearch [[lindex $panes 0].tbf.tb tabs] $tab] != -1)) ? 0 : 1}]
4125  }
4126 
4127  set i 0
4128  foreach to_type $args {
4129  upvar $to_type type$i
4130  switch $to_type {
4131  pane {
4132  set type$i [lindex [$widgets(nb_pw) panes] $paneindex]
4133  }
4134  paneindex {
4135  set type$i $paneindex
4136  }
4137  tabbar {
4138  set type$i [lindex [$widgets(nb_pw) panes] $paneindex].tbf.tb
4139  }
4140  tab {
4141  if {$tab eq ""} {
4142  return -code error "Unable to get tab information"
4143  }
4144  set type$i $tab
4145  }
4146  tabindex {
4147  if {$tab eq ""} {
4148  return -code error "Unable to get tab index information"
4149  }
4150  set type$i [lsearch [[lindex [$widgets(nb_pw) panes] $paneindex].tbf.tb tabs] $tab]
4151  }
4152  txt {
4153  if {$tab eq ""} {
4154  return -code error "Unable to get txt information"
4155  }
4156  set type$i "$tab.pw.tf.txt"
4157  }
4158  txt2 {
4159  if {$tab eq ""} {
4160  return -code error "Unable to get txt2 information"
4161  }
4162  set type$i "$tab.pw.tf2.txt"
4163  }
4164  focus {
4165  if {($tab eq "") || ![info exists txt_current($tab)]} {
4166  return -code error "Unable to get focus information"
4167  }
4168  set type$i $txt_current($tab)
4169  }
4170  beye {
4171  if {$tab eq ""} {
4172  return -code error "Unable to get beye information"
4173  }
4174  set type$i "$tab.be"
4175  }
4176  lang {
4177  if {$tab eq ""} {
4178  return -code error "Unable to get lang information"
4179  }
4180  set type$i [syntax::get_language "$tab.pw.tf.txt"]
4181  }
4182  default {
4183  if {$tab eq ""} {
4184  return -code error "Unable to get $to_type information"
4185  }
4186  set type$i [files::get_info $tab tab $to_type]
4187  }
4188  }
4189  set retval [set type$i]
4190  incr i
4191  }
4192 
4193  return $retval
4194 
4195  }

§ get_last_opened()

gui::get_last_opened

Definition at line 1583 of file gui.tcl.

1583  proc get_last_opened {} {
1584 
1585  variable last_opened
1586 
1587  return $last_opened
1588 
1589  }

§ get_marker_list()

gui::get_marker_list

Definition at line 5675 of file gui.tcl.

5675  proc get_marker_list {} {
5676 
5677  # Create a list of marker names and index
5678  set markers [list]
5679  foreach {name tab pos} [markers::get_markers] {
5680  get_info $tab tab txt fname
5681  lappend markers [list "[file tail $fname] - $name" $txt $name]
5682  }
5683 
5684  return [lsort -index 0 -dictionary $markers]
5685 
5686  }

§ get_search_data()

gui::get_search_data   type  

Definition at line 3317 of file gui.tcl.

3317  proc get_search_data {type} {
3318 
3319  variable widgets
3320  variable case_sensitive
3321  variable saved
3322  variable search_method
3323 
3324  # Get the current tab
3325  get_info {} current tab
3326 
3327  switch $type {
3328  "find" { return [list find [$tab.sf.e get] method $search_method case $case_sensitive save $saved]}
3329  "replace" { return [list find [$tab.rf.fe get] replace [$tab.rf.re get] method $search_method case $case_sensitive save $saved]}
3330  "fif" { return [list find [$widgets(fif_find) get] in [$widgets(fif_in) tokenget] method $search_method case $case_sensitive save $saved]}
3331  "docsearch" { return [list find [$widgets(doc).e get] name [$widgets(doc).mb cget -text] save $saved]}
3332  }
3333 
3334  }

§ get_symbol_list()

gui::get_symbol_list

Definition at line 5573 of file gui.tcl.

5573  proc get_symbol_list {} {
5574 
5575  variable lengths
5576 
5577  # Get current text widget
5578  set txt [current_txt]
5579 
5580  set proclist [list]
5581  foreach tag [$txt tag names] {
5582  if {[string range $tag 0 9] eq "__symbols:"} {
5583  if {[set type [string range $tag 10 end]] ne ""} {
5584  append type ": "
5585  }
5586  foreach {startpos endpos} [$txt tag ranges $tag] {
5587  lappend proclist "$type[$txt get $startpos $endpos]" $startpos
5588  }
5589  }
5590  }
5591 
5592  return $proclist
5593 
5594  }

§ get_user_response()

gui::get_user_response   msg pvar args  

Definition at line 3690 of file gui.tcl.

3690  proc get_user_response {msg pvar args} {
3691 
3692  variable widgets
3693 
3694  array set opts {
3695  -allow_vars 0
3696  -selrange {}
3697  }
3698  array set opts $args
3699 
3700  upvar $pvar var
3701 
3702  # Initialize the widget
3703  $widgets(ursp_label) configure -text $msg
3704  $widgets(ursp_entry) delete 0 end
3705 
3706  # If var contains a value, display it and select it
3707  if {$var ne ""} {
3708  $widgets(ursp_entry) insert end $var
3709  if {$opts(-selrange) ne ""} {
3710  $widgets(ursp_entry) selection range {*}$opts(-selrange)
3711  }
3712  }
3713 
3714  # Display the user input widget
3715  panel_place $widgets(ursp)
3716 
3717  # Wait for the ursp_entry widget to be closed
3718  focus $widgets(ursp_entry)
3719  tkwait variable gui::user_exit_status
3720 
3721  # Hide the user input widget
3722  panel_forget $widgets(ursp)
3723 
3724  # Get the user response value
3725  set var [$widgets(ursp_entry) get]
3726 
3727  # If variable substitutions are allowed, perform any substitutions
3728  if {$opts(-allow_vars)} {
3729  set var [utils::perform_substitutions $var]
3730  }
3731 
3732  return [set gui::user_exit_status]
3733 
3734  }

§ goto_mismatch()

gui::goto_mismatch   dir args  

Definition at line 5870 of file gui.tcl.

5870  proc goto_mismatch {dir args} {
5871 
5872  return [ctext::gotoBracketMismatch [current_txt] $dir {*}$args]
5873 
5874  }

§ handle_allow_tab_scrolling()

gui::handle_allow_tab_scrolling   name1 name2 op  

Definition at line 649 of file gui.tcl.

649  proc handle_allow_tab_scrolling {name1 name2 op} {
650 
651  variable widgets
652 
653  foreach pane [$widgets(nb_pw) panes] {
654  $pane.tbf.tb configure -mintabwidth [expr {[preferences::get View/AllowTabScrolling] ? [lindex [$pane.tbf.tb configure -mintabwidth] 3] : 1}]
655  }
656 
657  }

§ handle_auto_cwd()

gui::handle_auto_cwd   name1 name2 op  

Definition at line 680 of file gui.tcl.

680  proc handle_auto_cwd {name1 name2 op} {
681 
682  set_auto_cwd [preferences::get General/AutoChangeWorkingDirectory]
683 
684  }

§ handle_birdseye_control_left()

gui::handle_birdseye_control_left   W  

Definition at line 4943 of file gui.tcl.

4943  proc handle_birdseye_control_left {W} {
4944 
4945  $W yview scroll -1 pages
4946 
4947  }

§ handle_birdseye_control_right()

gui::handle_birdseye_control_right   W  

Definition at line 4951 of file gui.tcl.

4951  proc handle_birdseye_control_right {W} {
4952 
4953  $W yview scroll 1 pages
4954 
4955  }

§ handle_birdseye_enter()

gui::handle_birdseye_enter   be txt m  

Definition at line 4848 of file gui.tcl.

4848  proc handle_birdseye_enter {be txt m} {
4849 
4850  variable be_show_after_id
4851 
4852  if {$m eq "NotifyNormal"} {
4853 
4854  # Highlight the shown text
4855  set be_show_after_id [after 300 [list gui::highlight_birdseye $be $txt]]
4856 
4857  }
4858 
4859  }

§ handle_birdseye_font_size()

gui::handle_birdseye_font_size   name1 name2 op  

Definition at line 726 of file gui.tcl.

726  proc handle_birdseye_font_size {name1 name2 op} {
727 
728  set font_size [preferences::get View/BirdsEyeViewFontSize]
729 
730  foreach txt [get_all_texts] {
731  if {[string first "tf2" $txt] == -1} {
732  if {[winfo exists [get_info $txt txt beye]]} {
733  $beye configure -font "-size $font_size"
734  }
735  }
736  }
737 
738  }

§ handle_birdseye_leave()

gui::handle_birdseye_leave   be m  

Definition at line 4863 of file gui.tcl.

4863  proc handle_birdseye_leave {be m} {
4864 
4865  variable be_show_after_id
4866 
4867  if {$m eq "NotifyNormal"} {
4868 
4869  # Cancel the bird's eye show activity if it is valid
4870  after cancel $be_show_after_id
4871 
4872  # Clear the selection
4873  $be tag remove sel 1.0 end
4874 
4875  }
4876 
4877  }

§ handle_birdseye_left_press()

gui::handle_birdseye_left_press   W x y tab txt  

Definition at line 4881 of file gui.tcl.

4881  proc handle_birdseye_left_press {W x y tab txt} {
4882 
4883  variable be_last_y
4884  variable be_ignore
4885 
4886  set cursor [$W index @$x,$y]
4887 
4888  lassign [$W tag ranges sel] selstart selend
4889 
4890  # If we clicked on the selection, start a motion event
4891  if {[$W compare $selstart <= $cursor] && [$W compare $selend >= $cursor]} {
4892  set be_last_y $y
4893 
4894  # Otherwise, jump the view to the given location
4895  } else {
4896 
4897  set be_last_y ""
4898  set height [winfo height $txt]
4899  set be_ignore($tab) 1
4900 
4901  # TBD - We will want to make sure that the cursor line is centered vertically
4902  $txt see $cursor
4903  $txt yview scroll [expr [lindex [$txt bbox $cursor] 1] - ($height / 2)] pixels
4904 
4905  # Highlight the bird's eye viewer
4906  highlight_birdseye $W $txt
4907 
4908  }
4909 
4910  return 1
4911 
4912  }

§ handle_birdseye_motion()

gui::handle_birdseye_motion   W x y tab txt  

Definition at line 4916 of file gui.tcl.

4916  proc handle_birdseye_motion {W x y tab txt} {
4917 
4918  variable be_last_y
4919  variable be_ignore
4920 
4921  if {($be_last_y ne "") && ($y != $be_last_y)} {
4922 
4923  # Get the current cursor
4924  set cursor [$W index @$x,$y]
4925  set height [winfo height $txt]
4926  set be_ignore($tab) 1
4927 
4928  # TBD - We will want to make sure that the cursor line is centered vertically
4929  $txt see $cursor
4930  $txt yview scroll [expr [lindex [$txt bbox $cursor] 1] - ($height / 2)] pixels
4931 
4932  # Highlight the bird's eye viewer to match the text widget
4933  highlight_birdseye $W $txt
4934 
4935  }
4936 
4937  return 1
4938 
4939  }

§ handle_birdseye_width()

gui::handle_birdseye_width   name1 name2 op  

Definition at line 742 of file gui.tcl.

742  proc handle_birdseye_width {name1 name2 op} {
743 
744  set width [preferences::get View/BirdsEyeViewWidth]
745 
746  foreach txt [get_all_texts] {
747  if {[string first "tf2" $txt] == -1} {
748  if {[winfo exists [get_info $txt txt beye]]} {
749  $beye configure -width $width
750  }
751  }
752  }
753 
754  }

§ handle_bracket_audit()

gui::handle_bracket_audit   name1 name2 op  

Definition at line 609 of file gui.tcl.

609  proc handle_bracket_audit {name1 name2 op} {
610 
611  # Get the preference value
612  set value [preferences::get Editor/HighlightMismatchingChar]
613 
614  # Set the -matchaudit option in each opened text widget to the given value
615  foreach txt [get_all_texts] {
616  $txt configure -matchaudit $value
617  }
618 
619  }

§ handle_browse_directory()

gui::handle_browse_directory   ?name1? ?name2? ?op?  

Definition at line 689 of file gui.tcl.

689  proc handle_browse_directory {{name1 ""} {name2 ""} {op ""}} {
690 
691  variable browse_dir
692 
693  # Set the browse directory to the value
694  set browse_dir [preferences::get General/DefaultFileBrowserDirectory]
695 
696  # Adjust browse_dir to be last if the browse directory type was an actual pathname and it
697  # does not exist.
698  if {([lsearch [list last buffer current] $browse_dir] == -1) && ![file isdirectory $browse_dir]} {
699  set browse_dir "last"
700  }
701 
702  }

§ handle_code_folding()

gui::handle_code_folding   name1 name2 op  

Definition at line 758 of file gui.tcl.

758  proc handle_code_folding {name1 name2 op} {
759 
760  set enable [preferences::get View/EnableCodeFolding]
761 
762  foreach txt [get_all_texts] {
763  folding::set_fold_enable $txt $enable
764  }
765 
766  }

§ handle_cursor_width()

gui::handle_cursor_width   name1 name2 op  

Definition at line 770 of file gui.tcl.

770  proc handle_cursor_width {name1 name2 op} {
771 
772  set width [preferences::get Appearance/CursorWidth]
773 
774  foreach txt [get_all_texts] {
775  if {![$txt cget -blockcursor]} {
776  $txt configure -insertwidth $width
777  }
778  }
779 
780  }

§ handle_destroy_txt()

gui::handle_destroy_txt   txt  

Definition at line 4735 of file gui.tcl.

4735  proc handle_destroy_txt {txt} {
4736 
4737  variable line_sel_anchor
4738  variable txt_current
4739  variable cursor_hist
4740  variable be_after_id
4741  variable be_ignore
4742  variable undo_count
4743 
4744  set tab [join [lrange [split $txt .] 0 end-3] .]
4745 
4746  catch { unset line_sel_anchor($txt.l)}
4747  catch { unset txt_current($tab)}
4748  catch { unset undo_count($tab)}
4749  catch { array unset cursor_hist $txt,*}
4750 
4751  # Only unset the bird's eye variables if we are destroying txt
4752  if {[lindex [split $txt .] end-1] eq "tf"} {
4753  catch { unset be_after_id($tab)}
4754  catch { unset be_ignore($tab)}
4755  }
4756 
4757  }

§ handle_drop()

gui::handle_drop   win type actions modifiers dtype data types  

Definition at line 5035 of file gui.tcl.

5035  proc handle_drop {win type actions modifiers dtype data types} {
5036 
5037  # If we are attempting to drop a file, check to see if it is the proper type
5038  if {$dtype == 0} {
5039  set tdata [list]
5040  set files [expr {[lsearch $types files] != -1}]
5041  set dirs [expr {[lsearch $types dirs] != -1}]
5042  foreach item $data {
5043  if {($files && [file isfile $item]) || ($dirs && [file isdirectory $item])} {
5044  lappend tdata $item
5045  }
5046  }
5047  set data $tdata
5048  }
5049 
5050  if {$data ne ""} {
5051  catch { handle_${type}_drop $win $actions $modifiers $dtype $data {*}[array get opts]}
5052  }
5053 
5054  catch { handle_${type}_drop_leave $win}
5055 
5056  return "link"
5057 
5058  }

§ handle_drop_enter()

gui::handle_drop_enter   win type actions buttons force  

Definition at line 5019 of file gui.tcl.

5019  proc handle_drop_enter {win type actions buttons force} {
5020 
5021  if {!$force && ([$win cget -state] ne "normal")} {
5022  return "refuse_drop"
5023  }
5024 
5025  if {[catch { handle_${type}_drop_enter $win $actions $buttons} rc] || ($rc == 0)} {
5026  return "refuse_drop"
5027  }
5028 
5029  return "link"
5030 
5031  }

§ handle_drop_leave()

gui::handle_drop_leave   win type  

Definition at line 5062 of file gui.tcl.

5062  proc handle_drop_leave {win type} {
5063 
5064  catch { handle_${type}_drop_leave $win}
5065 
5066  }

§ handle_editor_font()

gui::handle_editor_font   name1 name2 op  

Definition at line 669 of file gui.tcl.

669  proc handle_editor_font {name1 name2 op} {
670 
671  # Update the size of the editor_font
672  font configure editor_font {*}[font configure TkFixedFont] {*}[preferences::get Appearance/EditorFont]
673 
674  }

§ handle_entry_drop()

gui::handle_entry_drop   win action modifier dtype data args  

Definition at line 5229 of file gui.tcl.

5229  proc handle_entry_drop {win action modifier dtype data args} {
5230 
5231  # We are not going to allow
5232  if {($dtype == 0) && ([llength $data] > 1)} {
5233  return
5234  }
5235 
5236  # Get the state before the drop
5237  set state [$win cget -state]
5238 
5239  # Allow the entry field to be modified and clear the field
5240  $win configure -state normal
5241  $win delete 0 end
5242 
5243  # Insert the information
5244  $win insert insert {*}$data
5245 
5246  # Return the state of the entry field
5247  $win configure -state $state
5248 
5249  }

§ handle_entry_drop_enter()

gui::handle_entry_drop_enter   win actions buttons args  

Definition at line 5092 of file gui.tcl.

5092  proc handle_entry_drop_enter {win actions buttons args} {
5093 
5094  # Make sure that the text window has the focus
5095  focus -force $win
5096 
5097  # Cause the entry field to display that it can accept the data
5098  $win state alternate
5099 
5100  return 1
5101 
5102  }

§ handle_entry_drop_leave()

gui::handle_entry_drop_leave   win  

Definition at line 5129 of file gui.tcl.

5129  proc handle_entry_drop_leave {win} {
5130 
5131  $win state focus
5132 
5133  }

§ handle_extra_line_spacing()

gui::handle_extra_line_spacing   name1 name2 op  

Definition at line 785 of file gui.tcl.

785  proc handle_extra_line_spacing {name1 name2 op} {
786 
787  set spacing [preferences::get Appearance/ExtraLineSpacing]
788 
789  foreach txt [get_all_texts] {
790  $txt configure -spacing2 $spacing -spacing3 $spacing
791  }
792 
793  }

§ handle_font_change()

gui::handle_font_change   dir  

Definition at line 6270 of file gui.tcl.

6270  proc handle_font_change {dir} {
6271 
6272  # Get the current cursor position
6273  lassign [winfo pointerxy .] x y
6274 
6275  # Get the window containing x and y
6276  set win [winfo containing $x $y]
6277 
6278  # Get the class of the given window
6279  switch [winfo class $win] {
6280  "Text" -
6281  "Listbox" {
6282  array set f [font actual [$win cget -font]]
6283  set f(-size) [expr ($f(-size) < 0) ? ($f(-size) - $dir) : ($f(-size) + $dir)]
6284  $win configure -font [array get f]
6285  }
6286  }
6287 
6288  }

§ handle_line_number_alignment()

gui::handle_line_number_alignment   name1 name2 op  

Definition at line 637 of file gui.tcl.

637  proc handle_line_number_alignment {name1 name2 op} {
638 
639  set value [preferences::get Editor/LineNumberAlignment]
640 
641  foreach txt [get_all_texts] {
642  $txt configure -linemap_align $value
643  }
644 
645  }

§ handle_matching_char()

gui::handle_matching_char   name1 name2 op  

Definition at line 585 of file gui.tcl.

585  proc handle_matching_char {name1 name2 op} {
586 
587  set_matching_char [preferences::get Editor/HighlightMatchingChar]
588 
589  }

§ handle_max_undo()

gui::handle_max_undo   name1 name2 op  

Definition at line 574 of file gui.tcl.

574  proc handle_max_undo {name1 name2 op} {
575 
576  # Set the max_undo to the specified value
577  foreach txt [get_all_texts] {
578  $txt configure -maxundo [preferences::get Editor/MaxUndo]
579  }
580 
581  }

§ handle_menu_popup()

gui::handle_menu_popup   w mnu  

Definition at line 527 of file gui.tcl.

527  proc handle_menu_popup {w mnu} {
528 
529  set menu_width [winfo reqwidth $mnu]
530  set menu_height [winfo reqheight $mnu]
531  set w_width [winfo width $w]
532  set w_x [winfo rootx $w]
533  set w_y [winfo rooty $w]
534 
535  set x [expr ($w_x + $w_width) - $menu_width]
536  set y [expr $w_y - ($menu_height + 4)]
537 
538  tk_popup $mnu $x $y
539 
540  }

§ handle_notebook_motion()

gui::handle_notebook_motion   W x y  

Definition at line 4261 of file gui.tcl.

4261  proc handle_notebook_motion {W x y} {
4262 
4263  variable tab_tip
4264  variable tab_close
4265 
4266  # Adjust W
4267  set W [winfo parent $W]
4268 
4269  # If the tab is one of the left or right shift tabs, exit now
4270  if {[set tab_index [$W index @$x,$y]] == -1} {
4271  return
4272  }
4273 
4274  set tab [lindex [$W tabs] $tab_index]
4275 
4276  # Handle tooltip
4277  if {![info exists tab_tip($W)]} {
4278  set_tab_tooltip $W $tab
4279  } elseif {$tab_tip($W) ne $tab} {
4281  set_tab_tooltip $W $tab
4282  } else {
4284  }
4285 
4286  }

§ handle_relative_line_numbers()

gui::handle_relative_line_numbers   name1 name2 op  

Definition at line 624 of file gui.tcl.

624  proc handle_relative_line_numbers {name1 name2 op} {
625 
626  set linemap_type [expr {[preferences::get Editor/RelativeLineNumbers] ? "relative" : "absolute"}]
627 
628  foreach txt [get_all_texts] {
629  $txt configure -linemap_type $linemap_type
630  }
631 
632  }

§ handle_replace_change()

gui::handle_replace_change   tab value  

Definition at line 3164 of file gui.tcl.

3164  proc handle_replace_change {tab value} {
3165 
3166  set state [expr {($value eq "") ? "disabled" : "normal"}]
3167 
3168  $tab.rf.act.prev configure -state $state
3169  $tab.rf.act.next configure -state $state
3170  $tab.rf.act.rep configure -state $state
3171  $tab.rf.act.repa configure -state $state
3172 
3173  return 1
3174 
3175  }

§ handle_search_change()

gui::handle_search_change   tab value  

Definition at line 3151 of file gui.tcl.

3151  proc handle_search_change {tab value} {
3152 
3153  set state [expr {($value eq "") ? "disabled" : "normal"}]
3154 
3155  $tab.sf.prev configure -state $state
3156  $tab.sf.next configure -state $state
3157 
3158  return 1
3159 
3160  }

§ handle_show_birdseye()

gui::handle_show_birdseye   name1 name2 op  

Definition at line 706 of file gui.tcl.

706  proc handle_show_birdseye {name1 name2 op} {
707 
708  if {[preferences::get View/ShowBirdsEyeView]} {
709  foreach tab [files::get_tabs] {
710  if {![winfo exists [get_info $tab tab txt2]]} {
711  show_birdseye $tab
712  }
713  }
714  } else {
715  foreach tab [files::get_tabs] {
716  if {![winfo exists [get_info $tab tab txt2]]} {
717  hide_birdseye $tab
718  }
719  }
720  }
721 
722  }

§ handle_tabbar_select()

gui::handle_tabbar_select   tabbar args  

Definition at line 5498 of file gui.tcl.

5498  proc handle_tabbar_select {tabbar args} {
5499 
5500  show_current_tab $tabbar
5501 
5502  }

§ handle_text_drop()

gui::handle_text_drop   txt action modifier dtype data args  

Definition at line 5176 of file gui.tcl.

5176  proc handle_text_drop {txt action modifier dtype data args} {
5177 
5178  gui::get_info $txt txt fileindex
5179 
5180  # If the data is text or the Alt key modifier is held during the drop, insert the data at the
5181  # current insertion point
5182  if {[plugins::handle_on_drop $fileindex $dtype $data]} {
5183  # Do nothing
5184 
5185  # If we are inserting text or the file name, do that now
5186  } elseif {$dtype} {
5187 
5188  set cursor 0
5189 
5190  # Attempt to format the data
5191  format_dropped_data $txt data cursor
5192 
5193  # Insert the data
5194  if {[multicursor::enabled $txt.t]} {
5195  multicursor::insert $txt.t $data
5196  } else {
5197  $txt insert insert $data
5198  }
5199 
5200  # If we need to adjust the cursor(s) do it now.
5201  if {$cursor != 0} {
5202  # TBD
5203  }
5204 
5205  # Otherwise, insert the content of the file(s) after the insertion line
5206  } elseif {![::check_file_for_import $data] && ![utils::is_binary $data]} {
5207  set str "\n"
5208  foreach ifile $data {
5209  if {[file isfile $ifile]} {
5210  if {![catch { open $ifile r} rc]} {
5211  append str [read $rc]
5212  close $rc
5213  }
5214  }
5215  }
5216  if {[multicursor::enabled $txt.t]} {
5217  multicursor::insert $txt.t $str
5218  } else {
5219  $txt insert "insert lineend" $str
5220  }
5221  }
5222 
5223  }

§ handle_text_drop_enter()

gui::handle_text_drop_enter   txt actions buttons args  

Definition at line 5071 of file gui.tcl.

5071  proc handle_text_drop_enter {txt actions buttons args} {
5072 
5073  get_info $txt txt readonly lock diff
5074 
5075  # If the file is readonly, refuse the drop
5076  if {$readonly || $lock || $diff} {
5077  return 0
5078  }
5079 
5080  # Make sure the text widget has the focus
5081  focus -force $txt.t
5082 
5083  # Set the highlight color to green
5084  ctext::set_border_color $txt green
5085 
5086  return 1
5087 
5088  }

§ handle_text_drop_leave()

gui::handle_text_drop_leave   txt  

Definition at line 5120 of file gui.tcl.

5120  proc handle_text_drop_leave {txt} {
5121 
5122  # Set the highlight color to green
5123  ctext::set_border_color $txt white
5124 
5125  }

§ handle_tokenentry_drop()

gui::handle_tokenentry_drop   win action modifier dtype data args  

Definition at line 5253 of file gui.tcl.

5253  proc handle_tokenentry_drop {win action modifier dtype data args} {
5254 
5255  # Insert the information
5256  $win tokeninsert end $data
5257 
5258  }

§ handle_tokenentry_drop_enter()

gui::handle_tokenentry_drop_enter   win actions buttons args  

Definition at line 5106 of file gui.tcl.

5106  proc handle_tokenentry_drop_enter {win actions buttons args} {
5107 
5108  # Display the highlight color
5109  $win configure -highlightbackground green -highlightcolor green
5110 
5111  # Make sure the entry received focus
5112  focus -force $win
5113 
5114  return 1
5115 
5116  }

§ handle_tokenentry_drop_leave()

gui::handle_tokenentry_drop_leave   win  

Definition at line 5137 of file gui.tcl.

5137  proc handle_tokenentry_drop_leave {win} {
5138 
5139  $win configure -highlightbackground white -highlightcolor white
5140 
5141  }

§ handle_txt_focus()

gui::handle_txt_focus   txtt  

Definition at line 6062 of file gui.tcl.

6062  proc handle_txt_focus {txtt} {
6063 
6064  variable widgets
6065  variable pw_current
6066  variable txt_current
6067  variable info_msgs
6068 
6069  # It is possible that getting the parent of txtt could cause errors, so just
6070  # silently catch them and move on
6071  catch {
6072 
6073  # Get the text information
6074  get_info [winfo parent $txtt] txt paneindex tab txt fileindex fname buffer diff
6075  set pw_current $paneindex
6076 
6077  # Set the line and row information
6078  update_position $txt
6079 
6080  # Check to see if the file has changed
6081  catch { files::check_file $fileindex}
6082 
6083  # Save the text widget
6084  set txt_current($tab) [winfo parent $txtt]
6085 
6086  # Update the informational message if one exists for the text widget
6087  if {[info exists info_msgs($txt)]} {
6088  set_info_message [lindex $info_msgs($txt) 0] -clear_delay [lindex $info_msgs($txt) 1] -win [winfo parent $txtt]
6089  } else {
6090  set_info_message "" -win [winfo parent $txtt]
6091  }
6092 
6093  # Remove the find or find/replace panels if we are told to do so
6094  if {[preferences::get Find/ClosePanelsOnTextFocus]} {
6095  panel_forget $tab.sf
6096  panel_forget $tab.rf
6097  }
6098 
6099  # Let the plugins know about the FocusIn event
6101 
6102  }
6103 
6104  }

§ handle_vim_mode()

gui::handle_vim_mode   name1 name2 op  

Definition at line 661 of file gui.tcl.

661  proc handle_vim_mode {name1 name2 op} {
662 
664 
665  }

§ handle_warning_width_change()

gui::handle_warning_width_change   name1 name2 op  

Definition at line 563 of file gui.tcl.

563  proc handle_warning_width_change {name1 name2 op} {
564 
565  # Set the warning width to the specified value
566  foreach txt [get_all_texts] {
567  $txt configure -warnwidth [preferences::get Editor/WarningWidth]
568  }
569 
570  }

§ hide_all()

gui::hide_all

Definition at line 2776 of file gui.tcl.

2776  proc hide_all {} {
2777 
2778  foreach tab [files::get_tabs] {
2779  hide_tab $tab
2780  }
2781 
2782  }

§ hide_birdseye()

gui::hide_birdseye   tab  

Definition at line 4959 of file gui.tcl.

4959  proc hide_birdseye {tab} {
4960 
4961  variable be_after_id
4962  variable be_ignore
4963 
4964  # Get the tab that contains the bird's eye viewer
4965  get_info $tab tab beye
4966 
4967  if {[winfo exists $beye]} {
4968 
4969  # Cancel the scroll event if one is still set
4970  if {$be_after_id($tab) ne ""} {
4971  after cancel $be_after_id($tab)
4972  }
4973 
4974  # Remove the be_after_id
4975  unset be_after_id($tab)
4976  unset be_ignore($tab)
4977 
4978  # Remove the widget from the grid
4979  grid forget $beye
4980 
4981  # Destroy the bird's eye viewer
4982  destroy $beye
4983 
4984  }
4985 
4986  }

§ hide_console_view()

gui::hide_console_view

Definition at line 938 of file gui.tcl.

938  proc hide_console_view {} {
939 
940  if {[catch { tkcon hide}]} {
941  catch { console hide}
942  }
943 
944  }

§ hide_current()

gui::hide_current

Definition at line 2754 of file gui.tcl.

2754  proc hide_current {} {
2755 
2756  # Get the current tabbar and tab
2757  hide_tab [get_info {} current tab]
2758 
2759  }

§ hide_files()

gui::hide_files   indices  

Definition at line 2765 of file gui.tcl.

2765  proc hide_files {indices} {
2766 
2767  # Perform a lazy close
2768  foreach index [lsort -decreasing $indices] {
2769  hide_tab [get_info $index fileindex tab]
2770  }
2771 
2772  }

§ hide_sidebar_view()

gui::hide_sidebar_view

Definition at line 918 of file gui.tcl.

918  proc hide_sidebar_view {} {
919 
920  variable widgets
921 
922  catch { $widgets(pw) forget $widgets(sb)}
923 
924  }

§ hide_split_pane()

gui::hide_split_pane   tab  

Definition at line 4761 of file gui.tcl.

4761  proc hide_split_pane {tab} {
4762 
4763  # Get the current paned window
4764  get_info $tab tab txt
4765  set pw [winfo parent [winfo parent $txt]]
4766 
4767  # Delete the extra text widget
4768  $pw forget $pw.tf2
4769 
4770  # Destroy the extra text widget frame
4771  destroy $pw.tf2
4772 
4773  # Cleanup the text widget
4774  cleanup_txt $pw.tf2.txt
4775 
4776  # Set the focus back on the tf text widget
4777  set_txt_focus $pw.tf.txt
4778 
4779  }

§ hide_status_view()

gui::hide_status_view

Definition at line 988 of file gui.tcl.

988  proc hide_status_view {} {
989 
990  variable widgets
991 
992  catch { grid remove $widgets(info)}
993 
994  update idletasks
995 
996  }

§ hide_tab()

gui::hide_tab   tab  

Definition at line 2714 of file gui.tcl.

2714  proc hide_tab {tab} {
2715 
2716  variable widgets
2717 
2718  # Get the current tabbar
2719  get_info $tab tab tabbar fname remote
2720 
2721  # Hide the tab
2722  $tabbar tab $tab -state hidden
2723 
2724  # Make sure the sidebar is updated properly
2725  sidebar::set_hide_state $fname $remote 1
2726 
2727  # Update ourselves to reflect the current tab show in the tabbar
2728  show_current_tab $tabbar
2729 
2730  }

§ hide_tab_view()

gui::hide_tab_view

Definition at line 962 of file gui.tcl.

962  proc hide_tab_view {} {
963 
964  variable widgets
965 
966  foreach nb [$widgets(nb_pw) panes] {
967  if {[lsearch [pack slaves $nb] $nb.tbf] != -1} {
968  pack forget $nb.tbf
969  }
970  }
971 
972  }

§ highlight_birdseye()

gui::highlight_birdseye   be txt  

Definition at line 4833 of file gui.tcl.

4833  proc highlight_birdseye {be txt} {
4834 
4835  # Get the start and end shown lines of the given text widget
4836  set startline [$txt index @0,0]
4837  set endline [$txt index @0,[winfo height $txt]]
4838 
4839  # Set the selection
4840  $be tag remove sel 1.0 end
4841  $be tag add sel $startline $endline
4842 
4843  }

§ insert_numbers()

gui::insert_numbers   txt  

Definition at line 3986 of file gui.tcl.

3986  proc insert_numbers {txt} {
3987 
3988  if {[multicursor::enabled $txt]} {
3989 
3990  set var1 ""
3991 
3992  # Get the number string from the user
3993  if {[get_user_response [msgcat::mc "Starting number:"] var1]} {
3994 
3995  # Insert the numbers (if not successful, output an error to the user)
3996  if {![multicursor::insert_numbers $txt $var1]} {
3997  set_info_message [msgcat::mc "Unable to successfully parse number string"]
3998  }
3999 
4000  }
4001 
4002  # Otherwise, display an error message to the user
4003  } else {
4004  set_info_message [msgcat::mc "Must be in multicursor mode to insert numbers"]
4005  }
4006 
4007  }

§ insert_tab()

gui::insert_tab   tb index fname args  

Definition at line 4356 of file gui.tcl.

4356  proc insert_tab {tb index fname args} {
4357 
4358  variable widgets
4359  variable curr_id
4360  variable language
4361  variable case_sensitive
4362  variable numberwidth
4363  variable show_match_chars
4364 
4365  array set opts {
4366  -diff 0
4367  -gutters [list]
4368  -tags [list]
4369  -lang ""
4370  }
4371  array set opts $args
4372 
4373  # Get the scrollbar coloring information
4374  array set sb_opts [theme::get_category_options text_scrollbar 1]
4375 
4376  # Get the unique tab ID
4377  set id [incr curr_id]
4378 
4379  # Calculate the title name
4380  set title [file tail $fname]
4381 
4382  # Make the tabbar visible and the syntax menubutton enabled
4383  grid $tb
4384  $widgets(info_encode) configure -state normal
4385  $widgets(info_indent) configure -state normal
4386  $widgets(info_syntax) configure -state normal
4387 
4388  # Create the tab frame
4389  set tab [ttk::frame .tab$id]
4390 
4391  # Create the editor pane
4392  ttk::panedwindow $tab.pw
4393 
4394  # Create tab frame name
4395  set txt $tab.pw.tf.txt
4396 
4397  # Create the editor frame
4398  $tab.pw add [frame $tab.pw.tf -background $sb_opts(-background)]
4399  ctext $txt -wrap none -undo 1 -autoseparators 1 -insertofftime 0 \
4400  -highlightcolor orange -warnwidth [preferences::get Editor/WarningWidth] \
4401  -maxundo [preferences::get Editor/MaxUndo] \
4402  -insertwidth [preferences::get Appearance/CursorWidth] \
4403  -spacing2 [preferences::get Appearance/ExtraLineSpacing] \
4404  -spacing3 [preferences::get Appearance/ExtraLineSpacing] \
4405  -diff_mode $opts(-diff) -matchchar $show_match_chars \
4406  -matchaudit [preferences::get Editor/HighlightMismatchingChar] \
4407  -linemap_mark_command [list gui::mark_command $tab] -linemap_mark_color orange \
4408  -linemap_relief flat -linemap_minwidth $numberwidth -linemap_separator 1 \
4409  -linemap_type [expr {[preferences::get Editor/RelativeLineNumbers] ? "relative" : "absolute"}] \
4410  -linemap_align [preferences::get Editor/LineNumberAlignment] \
4411  -xscrollcommand [list $tab.pw.tf.hb set] -yscrollcommand [list gui::yscrollcommand $tab $txt $tab.pw.tf.vb]
4412  scroller::scroller $tab.pw.tf.hb {*}[array get sb_opts] -orient horizontal -autohide 0 -command [list $txt xview]
4413  scroller::scroller $tab.pw.tf.vb {*}[array get sb_opts] -orient vertical -autohide 1 -command [list gui::yview $tab $txt] \
4414  -markcommand1 [list markers::get_positions $tab] -markhide1 [expr [preferences::get View/ShowMarkerMap] ^ 1] \
4415  -markcommand2 [expr {$opts(-diff) ? [list diff::get_marks $txt] : ""}]
4416 
4417  # Update the widgets to match the current theme
4418  update_theme $txt
4419 
4420  # Register the widgets
4421  theme::register_widget $txt syntax
4422  theme::register_widget $tab.pw.tf.vb text_scrollbar
4423  theme::register_widget $tab.pw.tf.hb text_scrollbar
4424 
4425  # Create the editor font if it does not currently exist
4426  if {[lsearch [font names] editor_font] == -1} {
4427  font create editor_font {*}[font configure TkFixedFont] {*}[preferences::get Appearance/EditorFont]
4428  }
4429 
4430  $txt configure -font editor_font
4431 
4432  bind Ctext <<Modified>> [list gui::text_changed %W %d]
4433  bind $txt.t <FocusIn> [list +gui::handle_txt_focus %W]
4434  bind $txt.t <<CursorChanged>> [list +gui::update_position $txt]
4435  bind $txt.l <ButtonPress-1> [list gui::select_line %W %x %y]
4436  bind $txt.l <B1-Motion> [list gui::select_lines %W %x %y]
4437  bind $txt.l <Shift-ButtonPress-1> [list gui::select_lines %W %x %y]
4438  bind $txt <<Selection>> [list gui::selection_changed $txt]
4439  bind $txt <Motion> [list gui::clear_tab_tooltip $tb]
4440  bind Text <<Cut>> ""
4441  bind Text <<Copy>> ""
4442  bind Text <<Paste>> ""
4443  bind Text <Control-d> ""
4444  bind Text <Control-i> ""
4445 
4446  # Move the all bindtag ahead of the Text bindtag
4447  set text_index [lsearch [bindtags $txt.t] Text]
4448  set all_index [lsearch [bindtags $txt.t] all]
4449  bindtags $txt.t [lreplace [bindtags $txt.t] $all_index $all_index]
4450  bindtags $txt.t [linsert [bindtags $txt.t] $text_index all]
4451 
4452  grid rowconfigure $tab.pw.tf 0 -weight 1
4453  grid columnconfigure $tab.pw.tf 0 -weight 1
4454  grid $tab.pw.tf.txt -row 0 -column 0 -sticky news
4455  grid $tab.pw.tf.vb -row 0 -column 1 -sticky ns
4456  grid $tab.pw.tf.hb -row 1 -column 0 -sticky ew
4457 
4458  # Create the Vim command bar
4459  vim::bind_command_entry $txt [entry $tab.ve]
4460 
4461  # Create the search type menu
4462  set type_menu [menu $tab.typeMenu -tearoff 0]
4463  set max_width [expr [msgcat::mcmax "Regexp" "Glob" "Exact"] + 1]
4464  $type_menu add radiobutton -label [msgcat::mc "Regexp"] -variable gui::search_method -value "regexp" -command [list gui::update_search_method $tab]
4465  $type_menu add radiobutton -label [msgcat::mc "Glob"] -variable gui::search_method -value "glob" -command [list gui::update_search_method $tab]
4466  $type_menu add radiobutton -label [msgcat::mc "Exact"] -variable gui::search_method -value "exact" -command [list gui::update_search_method $tab]
4467 
4468  # Create the search bar
4469  ttk::frame $tab.sf
4470  ttk::label $tab.sf.l1 -text [format "%s:" [msgcat::mc "Find"]]
4471  ttk::entry $tab.sf.e -validate key -validatecommand [list gui::handle_search_change $tab %P]
4472  ttk::button $tab.sf.prev -style BButton -image search_prev -command [list gui::find_resilient prev] -state disabled
4473  ttk::button $tab.sf.next -style BButton -image search_next -command [list gui::find_resilient next] -state disabled
4474  ttk::button $tab.sf.type -style BButton -width $max_width -command [list gui::handle_menu_popup $tab.sf.type $type_menu]
4475  ttk::checkbutton $tab.sf.case -text " Aa" -variable gui::case_sensitive
4476  ttk::checkbutton $tab.sf.save -text [format " %s" [msgcat::mc "Save"]] -variable gui::saved -command [list search::update_save find]
4477  ttk::label $tab.sf.close -image form_close
4478 
4479  tooltip::tooltip $tab.sf.next [msgcat::mc "Find next occurrence"]
4480  tooltip::tooltip $tab.sf.prev [msgcat::mc "Find previous occurrence"]
4481  tooltip::tooltip $tab.sf.case [msgcat::mc "Case sensitivity"]
4482  tooltip::tooltip $tab.sf.save [msgcat::mc "Save this search"]
4483 
4484  pack $tab.sf.l1 -side left -padx 4 -pady 2
4485  pack $tab.sf.e -side left -padx 4 -pady 2 -fill x -expand yes
4486  pack $tab.sf.close -side right -padx 4 -pady 2
4487  pack $tab.sf.save -side right -padx 4 -pady 2
4488  pack $tab.sf.case -side right -padx 4 -pady 2
4489  pack $tab.sf.type -side right -padx 4 -pady 2
4490  pack $tab.sf.next -side right -padx 4 -pady 2
4491  pack $tab.sf.prev -side right -padx 4 -pady 2
4492 
4493  bind $tab.sf.e <Escape> [list gui::close_search]
4494  bind $tab.sf.case <Escape> [list gui::close_search]
4495  bind $tab.sf.save <Escape> [list gui::close_search]
4496  bind $tab.sf.type <Escape> [list gui::close_search]
4497  bind $tab.sf.next <Escape> [list gui::close_search]
4498  bind $tab.sf.prev <Escape> [list gui::close_search]
4499  bind $tab.sf.e <Up> "search::traverse_history find 1; break"
4500  bind $tab.sf.e <Down> "search::traverse_history find -1; break"
4501  bind $tab.sf.close <Button-1> [list gui::close_search]
4502  bind $tab.sf.close <Key-space> [list gui::close_search]
4503 
4504  # Create the search/replace bar
4505  ttk::frame $tab.rf
4506  ttk::label $tab.rf.fl -text [format "%s:" [msgcat::mc "Find"]]
4507  ttk::entry $tab.rf.fe -validate key -validatecommand [list gui::handle_replace_change $tab %P]
4508  ttk::label $tab.rf.rl -text [format "%s:" [msgcat::mc "Replace"]]
4509  ttk::entry $tab.rf.re
4510  ttk::frame $tab.rf.act
4511  ttk::button $tab.rf.act.prev -style BButton -image search_prev -command [list gui::find_resilient prev replace] -state disabled
4512  ttk::button $tab.rf.act.next -style BButton -image search_next -command [list gui::find_resilient next replace] -state disabled
4513  ttk::button $tab.rf.act.rep -style BButton -text [msgcat::mc "Replace"] -command [list search::replace_one] -state disabled
4514  ttk::button $tab.rf.act.repa -style BButton -text [msgcat::mc "Replace All"] -command [list search::replace_start 1] -state disabled
4515  ttk::frame $tab.rf.opts
4516  ttk::button $tab.rf.opts.type -style BButton -width $max_width -command [list gui::handle_menu_popup $tab.rf.opts.type $type_menu]
4517  ttk::checkbutton $tab.rf.opts.case -text " Aa" -variable gui::case_sensitive
4518  ttk::checkbutton $tab.rf.opts.save -text [format " %s" [msgcat::mc "Save"]] -variable gui::saved \
4519  -command [list search::update_save replace]
4520  ttk::label $tab.rf.close -image form_close
4521  ttk::separator $tab.rf.sep -orient horizontal
4522 
4523  tooltip::tooltip $tab.rf.act.next [msgcat::mc "Find next occurrence"]
4524  tooltip::tooltip $tab.rf.act.prev [msgcat::mc "Find previous occurrence"]
4525  tooltip::tooltip $tab.rf.opts.case [msgcat::mc "Case sensitivity"]
4526  tooltip::tooltip $tab.rf.opts.save [msgcat::mc "Save this search"]
4527 
4528  pack $tab.rf.act.prev -side left -padx 4
4529  pack $tab.rf.act.next -side left -padx 4
4530  pack $tab.rf.act.rep -side left -padx 4
4531  pack $tab.rf.act.repa -side left -padx 4
4532 
4533  pack $tab.rf.opts.type -side left -padx 4
4534  pack $tab.rf.opts.case -side left -padx 4
4535  pack $tab.rf.opts.save -side right -padx 4
4536 
4537  grid columnconfigure $tab.rf 1 -weight 1
4538  grid $tab.rf.fl -row 0 -column 0 -sticky news -padx 4 -pady 2
4539  grid $tab.rf.fe -row 0 -column 1 -sticky news -padx 4 -pady 2
4540  grid $tab.rf.act -row 0 -column 2 -sticky news -padx 4 -pady 2
4541  grid $tab.rf.close -row 0 -column 3 -sticky news -padx 4 -pady 2
4542  grid $tab.rf.rl -row 1 -column 0 -sticky news -padx 4 -pady 2
4543  grid $tab.rf.re -row 1 -column 1 -sticky news -padx 4 -pady 2
4544  grid $tab.rf.opts -row 1 -column 2 -sticky news -padx 4 -pady 2
4545  grid $tab.rf.sep -row 2 -column 0 -sticky news -column 4
4546 
4547  bind $tab.rf.fe <Return> [list search::replace_start]
4548  bind $tab.rf.re <Return> [list search::replace_start]
4549  bind $tab.rf.opts.type <Return> [list search::replace_start]
4550  bind $tab.rf.opts.case <Return> [list search::replace_start]
4551  bind $tab.rf.opts.save <Return> [list search::replace_start]
4552  bind $tab.rf.fe <Escape> [list gui::close_search_and_replace]
4553  bind $tab.rf.re <Escape> [list gui::close_search_and_replace]
4554  bind $tab.rf.opts.type <Escape> [list gui::close_search_and_replace]
4555  bind $tab.rf.opts.case <Escape> [list gui::close_search_and_replace]
4556  bind $tab.rf.opts.save <Escape> [list gui::close_search_and_replace]
4557  bind $tab.rf.act.prev <Escape> [list gui::close_search_and_replace]
4558  bind $tab.rf.act.next <Escape> [list gui::close_search_and_replace]
4559  bind $tab.rf.act.rep <Escape> [list gui::close_search_and_replace]
4560  bind $tab.rf.act.repa <Escape> [list gui::close_search_and_replace]
4561  bind $tab.rf.close <Button-1> [list gui::close_search_and_replace]
4562  bind $tab.rf.close <Key-space> [list gui::close_search_and_replace]
4563  bind $tab.rf.fe <Up> "search::traverse_history replace 1; break"
4564  bind $tab.rf.fe <Down> "search::traverse_history replace -1; break"
4565 
4566  # Create the diff bar
4567  if {$opts(-diff)} {
4568  ttk::frame $tab.df
4569  pack [diff::create_diff_bar $txt $tab.df.df] -fill x
4570  pack [ttk::separator $tab.df.sep -orient horizontal] -fill x
4571  }
4572 
4573  grid rowconfigure $tab 0 -weight 1
4574  grid columnconfigure $tab 0 -weight 1
4575  grid $tab.pw -row 0 -column 0 -sticky news
4576  # grid $tab.sb -row 0 -column 2 -sticky news
4577  if {$opts(-diff)} {
4578  grid $tab.df -row 1 -column 0 -sticky ew -columnspan 2
4579  }
4580 
4581  # grid remove $tab.sb
4582 
4583  # Separator
4584  ttk::separator $tab.sep -orient horizontal
4585 
4586  # Get the adjusted index
4587  set adjusted_index [$tb index $index]
4588 
4589  # Add the text bindings
4590  if {!$opts(-diff)} {
4592  vim::set_vim_mode $txt
4595  }
4596  select::add $txt $tab.sb
4597  plugins::handle_text_bindings $txt $opts(-tags)
4598  make_drop_target $txt text
4599 
4600  # Apply the appropriate syntax highlighting for the given extension
4601  syntax::set_language $txt [expr {($opts(-lang) eq "") ? [syntax::get_default_language $fname] : $opts(-lang)}]
4602 
4603  # Snippet bindings must go after syntax language setting
4604  if {!$opts(-diff)} {
4606  folding::initialize $txt
4607  }
4608 
4609  # Add any gutters
4610  foreach gutter $opts(-gutters) {
4611  $txt gutter create {*}$gutter
4612  }
4613 
4614  # Add the new tab to the notebook in alphabetical order (if specified) and if
4615  # the given index is "end"
4616  if {[preferences::get View/OpenTabsAlphabetically] && ($index eq "end")} {
4617  set added 0
4618  foreach t [$tb tabs] {
4619  if {[string compare " $title" [$tb tab $t -text]] == -1} {
4620  $tb insert $t $tab -text " $title" -emboss 0
4621  set added 1
4622  break
4623  }
4624  }
4625  if {$added == 0} {
4626  $tb insert end $tab -text " $title" -emboss 0
4627  }
4628 
4629  # Otherwise, add the tab in the specified location
4630  } else {
4631  $tb insert $index $tab -text " $title" -emboss 0
4632  }
4633 
4634  # Display the bird's eye viewer
4635  if {[preferences::get View/ShowBirdsEyeView]} {
4636  show_birdseye $tab
4637  }
4638 
4639  return $tab
4640 
4641  }

§ jump_to()

gui::jump_to   pos  

Definition at line 5690 of file gui.tcl.

5690  proc jump_to {pos} {
5691 
5692  jump_to_txt [current_txt] $pos
5693 
5694  }

§ jump_to_cursor()

gui::jump_to_cursor   dir jump  

Definition at line 6160 of file gui.tcl.

6160  proc jump_to_cursor {dir jump} {
6161 
6162  variable cursor_hist
6163 
6164  # Get the current text widget
6165  set txt [current_txt]
6166 
6167  # Get the index of the cursor in the cursor hist to use
6168  if {![info exists cursor_hist($txt,hist)]} {
6169  set cursor_hist($txt,hist) [$txt edit cursorhist]
6170  set cursor_hist($txt,index) [llength $cursor_hist($txt,hist)]
6171  }
6172 
6173  set index $cursor_hist($txt,index)
6174  set length [llength $cursor_hist($txt,hist)]
6175  set diff [preferences::get Find/JumpDistance]
6176 
6177  if {$index == $length} {
6178  set last_line [lindex [split [$txt index insert] .] 0]
6179  } else {
6180  set last_line [lindex [split [lindex $cursor_hist($txt,hist) $index] .] 0]
6181  }
6182 
6183  # Get the cursor index
6184  while {([incr index $dir] >= 0) && ($index < $length)} {
6185  set cursor [lindex $cursor_hist($txt,hist) $index]
6186  set index_line [lindex [split $cursor .] 0]
6187  if {[expr abs( $index_line - $last_line ) >= $diff]} {
6188  if {$jump} {
6189  set cursor_hist($txt,index) $index
6190  ::tk::TextSetCursor $txt.t "$cursor linestart"
6191  if {[vim::in_vim_mode $txt.t]} {
6192  vim::adjust_insert $txt.t
6193  }
6194  }
6195  return 1
6196  }
6197  }
6198 
6199  return 0
6200 
6201  }

§ jump_to_difference()

gui::jump_to_difference   dir jump  

Definition at line 6206 of file gui.tcl.

6206  proc jump_to_difference {dir jump} {
6207 
6208  # Get the current text widget
6209  set txt [current_txt]
6210 
6211  # Get the list of ranges
6212  if {[$txt cget -diff_mode] && ([llength [set ranges [$txt diff ranges both]]] > 0)} {
6213 
6214  if {$jump} {
6215 
6216  # Get the list of difference ranges
6217  if {$dir == 1} {
6218  set index [$txt index @0,[winfo height $txt]]
6219  foreach {start end} $ranges {
6220  if {[$txt compare $start > $index]} {
6221  $txt see $start
6222  return 1
6223  }
6224  }
6225  $txt see [lindex $ranges 0]
6226  } else {
6227  set index [$txt index @0,0]
6228  foreach {end start} [lreverse $ranges] {
6229  if {[$txt compare $start < $index]} {
6230  $txt see $start
6231  return 1
6232  }
6233  }
6234  $txt see [lindex $ranges end-1]
6235  }
6236 
6237  }
6238 
6239  return 1
6240 
6241  }
6242 
6243  return 0
6244 
6245  }

§ jump_to_marker()

gui::jump_to_marker   txt name  

Definition at line 5717 of file gui.tcl.

5717  proc jump_to_marker {txt name} {
5718 
5719  # Change the current tab, if necessary
5720  get_info $txt txt tabbar tab
5721  set_current_tab $tabbar $tab
5722 
5723  # Get the marker position
5724  set pos [markers::get_index $tab $name]
5725 
5726  # Make sure that the cursor is visible
5727  folding::show_line $txt.t [lindex [split $pos .] 0]
5728 
5729  # Make the line viewable
5730  ::tk::TextSetCursor $txt.t $pos
5731 
5732  # Adjust the insert
5733  vim::adjust_insert $txt.t
5734 
5735  }

§ jump_to_txt()

gui::jump_to_txt   txt pos  

Definition at line 5698 of file gui.tcl.

5698  proc jump_to_txt {txt pos} {
5699 
5700  # Change the current tab, if necessary
5701  get_info $txt txt tabbar tab
5702  set_current_tab $tabbar $tab
5703 
5704  # Make sure that the cursor is visible
5705  folding::show_line $txt.t [lindex [split $pos .] 0]
5706 
5707  # Make the line viewable
5708  ::tk::TextSetCursor $txt.t $pos
5709 
5710  # Adjust the insert
5711  vim::adjust_insert $txt.t
5712 
5713  }

§ last_tab()

gui::last_tab

Definition at line 1297 of file gui.tcl.

1297  proc last_tab {} {
1298 
1299  # Get the current tabbar
1300  get_info {} current tabbar
1301 
1302  # Select the last tab
1303  set_current_tab $tabbar [lindex [$tabbar tabs -shown] [$tabbar index last]]
1304 
1305  }

§ last_txt_focus()

gui::last_txt_focus   ?tab?  

Definition at line 6122 of file gui.tcl.

6122  proc last_txt_focus {{tab ""}} {
6123 
6124  variable txt_current
6125 
6126  if {$tab eq ""} {
6127  return $txt_current([get_info {} current tab])
6128  } elseif {[info exists txt_current($tab)]} {
6129  return $txt_current($tab)
6130  } else {
6131  return [get_info $tab tab txt]
6132  }
6133 
6134  }

§ load_session()

gui::load_session   info new  

Definition at line 1140 of file gui.tcl.

1140  proc load_session {info new} {
1141 
1142  variable widgets
1143  variable last_opened
1144  variable pw_current
1145 
1146  array set content [list \
1147  Geometry [wm geometry .] \
1148  CurrentWorkingDirectory [pwd] \
1149  Sidebar [list] \
1150  Launcher [list] \
1151  FileInfo [list] \
1152  CurrentTabs [list] \
1153  LastOpened ""]
1154 
1155  array set content $info
1156 
1157  array set finfo {
1158  xview 0
1159  yview 0
1160  cursor ""
1161  beye 0
1162  split 0
1163  }
1164 
1165  # Put the state information into the rest of the GUI
1166  if {[info exists content(Fullscreen)] && $content(Fullscreen)} {
1167  wm attributes . -fullscreen 1
1168  } else {
1169  wm geometry . $content(Geometry)
1170  if {[info exists content(Zoomed)] && $content(Zoomed)} {
1171  switch [tk windowingsystem] {
1172  x11 { wm attributes . -zoomed 1}
1173  default { wm state . zoomed}
1174  }
1175  }
1176  }
1177 
1178  # Restore the "last_opened" list
1179  set last_opened $content(LastOpened)
1180 
1181  # Load the session information into the launcher
1182  launcher::load_session $content(Launcher)
1183 
1184  # If we are loading a new TKE session, exit now since we don't want to load the rest
1185  if {$new} return
1186 
1187  # Load the session information into the sidebar
1188  sidebar::load_session $content(Sidebar)
1189 
1190  # Set the current working directory to the saved value
1191  if {[file exists $content(CurrentWorkingDirectory)]} {
1192  cd $content(CurrentWorkingDirectory)
1193  }
1194 
1195  # Put the list in order
1196  if {[llength $content(FileInfo)] > 0} {
1197  set ordered [lrepeat 2 [lrepeat [llength $content(FileInfo)] ""]]
1198  set i 0
1199  foreach finfo_list $content(FileInfo) {
1200  array set finfo $finfo_list
1201  lset ordered $finfo(pane) $finfo(tab) $i
1202  incr i
1203  }
1204  } else {
1205  set ordered [list "" ""]
1206  }
1207 
1208  # If the second pane is necessary, create it now
1209  if {[llength $content(CurrentTabs)] == 2} {
1210  add_notebook
1211  }
1212 
1213  # Add the tabs (in order) to each of the panes and set the current tab in each pane
1214  for {set pane 0} {$pane < [llength $content(CurrentTabs)]} {incr pane} {
1215  set pw_current $pane
1216  set tab ""
1217  foreach index [lindex $ordered $pane] {
1218  if {$index ne ""} {
1219  array set finfo [lindex $content(FileInfo) $index]
1220  if {[file exists $finfo(fname)]} {
1221  set tab [add_file $finfo(tab) $finfo(fname) \
1222  -savecommand $finfo(savecommand) -lock $finfo(lock) -readonly $finfo(readonly) \
1223  -diff $finfo(diff) -sidebar $finfo(sidebar) -lazy 1 \
1224  -xview $finfo(xview) -yview $finfo(yview) -cursor $finfo(cursor) -lang $finfo(language)]
1225  get_info $tab tab txt
1226  if {[info exists finfo(indent)]} {
1227  indent::set_indent_mode $txt $finfo(indent)
1228  }
1229  if {[info exists finfo(encode)]} {
1230  set_encoding $tab $finfo(encode)
1231  }
1232  if {$finfo(diff) && [info exists finfo(diffdata)]} {
1233  diff::set_session_data $txt $finfo(diffdata)
1234  }
1235  if {$finfo(split)} {
1236  show_split_pane $tab
1237  }
1238  if {$finfo(beye)} {
1239  show_birdseye $tab
1240  }
1241  if {[info exists finfo(markers)]} {
1242  foreach {mname line} $finfo(markers) {
1243  markers::add $tab line $line $mname
1244  }
1245  }
1246  }
1247  }
1248  }
1249  if {$tab ne ""} {
1250  if {[catch { get_info [lindex $content(CurrentTabs) $pane] tabindex tabbar tab}]} {
1251  set_current_tab [get_info $pane paneindex tabbar] $tab
1252  } else {
1253  set_current_tab $tabbar $tab
1254  }
1255  }
1256  }
1257 
1258  }

§ make_drop_target()

gui::make_drop_target   win type args  

Definition at line 4991 of file gui.tcl.

4991  proc make_drop_target {win type args} {
4992 
4993  array set opts {
4994  -types {files dirs text}
4995  -force 0
4996  }
4997  array set opts $args
4998 
4999  set types [list]
5000  if {[lsearch $opts(-types) *s] != -1} { lappend types DND_Files}
5001  if {[lsearch $opts(-types) text] != -1} { lappend types DND_Text}
5002 
5003  # Make ourselves a drop target (if Tkdnd is available)
5004  catch {
5005 
5006  tkdnd::drop_target register $win $types
5007 
5008  bind $win <<DropEnter>> [list gui::handle_drop_enter %W $type %a %b $opts(-force)]
5009  bind $win <<DropLeave>> [list gui::handle_drop_leave %W $type]
5010  bind $win <<Drop:DND_Files>> [list gui::handle_drop %W $type %A %m 0 %D $opts(-types)]
5011  bind $win <<Drop:DND_Text>> [list gui::handle_drop %W $type %A %m 1 %D $opts(-types)]
5012 
5013  }
5014 
5015  }

§ mark_command()

gui::mark_command   tab win type tag  

Definition at line 5897 of file gui.tcl.

5897  proc mark_command {tab win type tag} {
5898 
5899  if {$type eq "marked"} {
5900  if {![markers::add $tab tag $tag]} {
5901  return 0
5902  }
5903  } else {
5904  markers::delete_by_tag $tab $tag
5905  }
5906 
5907  # Update the markers in the scrollbar
5908  update_tab_markers $tab
5909 
5910  return 1
5911 
5912  }

§ merge_panes()

gui::merge_panes

Definition at line 2913 of file gui.tcl.

2913  proc merge_panes {} {
2914 
2915  variable widgets
2916  variable pw_current
2917 
2918  while {[llength [$widgets(nb_pw) panes]] == 2} {
2919 
2920  # Make the second pane the current pane
2921  set pw_current 1
2922 
2923  # Move the pane
2924  move_to_pane
2925 
2926  }
2927 
2928  }

§ movable_to_other_pane()

gui::movable_to_other_pane

Definition at line 833 of file gui.tcl.

833  proc movable_to_other_pane {} {
834 
835  variable widgets
836 
837  return [expr {([llength [[get_info {} current tabbar] tabs]] > 1) || ([llength [$widgets(nb_pw) panes]] > 1)}]
838 
839  }

§ move_to_pane()

gui::move_to_pane

Definition at line 2843 of file gui.tcl.

2843  proc move_to_pane {} {
2844 
2845  variable widgets
2846  variable pw_current
2847 
2848  # Get the list of panes
2849  set panes [$widgets(nb_pw) panes]
2850 
2851  # If the other pane does not exist, add it
2852  if {[llength $panes] == 1} {
2853  add_notebook
2854  set panes [$widgets(nb_pw) panes]
2855  }
2856 
2857  # Get information
2858  get_info {} current pane tabbar tab tabindex
2859 
2860  # Get the current title
2861  set title [$tabbar tab $tabindex -text]
2862 
2863  # Remove the tab from the tabbar
2864  $tabbar delete $tabindex
2865 
2866  # Remove the tab from the current pane
2867  catch { pack forget $tab}
2868 
2869  # Display the current pane (if one exists)
2870  if {[set ctab [$tabbar select]] ne ""} {
2871  set_current_tab $tabbar $ctab
2872  set pw_current [expr $pw_current ^ 1]
2873  } else {
2874  $widgets(nb_pw) forget $pane
2875  set pw_current 0
2876  }
2877 
2878  # Get the other tabbar
2879  get_info {} current tabbar
2880 
2881  # Make sure that tabbar is visible
2882  grid $tabbar
2883 
2884  # Add the new tab to the notebook in alphabetical order (if specified)
2885  if {[preferences::get View/OpenTabsAlphabetically]} {
2886  set added 0
2887  foreach t [$tabbar tabs] {
2888  if {[string compare $title [$tabbar tab $t -text]] == -1} {
2889  $tabbar insert $t $tab -text $title -emboss 0
2890  set added 1
2891  break
2892  }
2893  }
2894  if {$added == 0} {
2895  $tabbar insert end $tab -text $title -emboss 0
2896  }
2897 
2898  # Otherwise, add the tab in the specified location
2899  } else {
2900  $tabbar insert end $tab -text $title -emboss 0
2901  }
2902 
2903  # Now move the current tab from the previous current pane to the new current pane
2904  set_current_tab $tabbar $tab
2905 
2906  # Set the tab image for the moved file
2907  set_tab_image $tab
2908 
2909  }

§ next_pane()

gui::next_pane

Definition at line 1310 of file gui.tcl.

1310  proc next_pane {} {
1311 
1312  variable widgets
1313  variable pw_current
1314 
1315  # If we have more than one pane, go to it
1316  if {[llength [$widgets(nb_pw) panes]] > 1} {
1317  set pw_current [expr $pw_current ^ 1]
1318  get_info {} current tabbar tab
1319  set_current_tab $tabbar $tab
1320  }
1321 
1322  }

§ next_tab()

gui::next_tab

Definition at line 1263 of file gui.tcl.

1263  proc next_tab {} {
1264 
1265  # Get the location information for the current tab in the current pane
1266  get_info {} current tabbar tabindex
1267 
1268  # If the new tab index is at the end, circle to the first tab
1269  if {[incr tabindex] == [$tabbar index end]} {
1270  set tabindex 0
1271  }
1272 
1273  # Select the next tab
1274  set_current_tab $tabbar [lindex [$tabbar tabs -shown] $tabindex]
1275 
1276  }

§ pane_sync_tab_change()

gui::pane_sync_tab_change

Definition at line 1353 of file gui.tcl.

1353  proc pane_sync_tab_change {} {
1354 
1355  variable synced
1356  variable synced_key
1357 
1358  # Unselect the current key
1359  if {$synced_key ne ""} {
1360  catch {
1361  [winfo parent [lindex $synced_key 0]].vb configure -usealt 0
1362  [winfo parent [lindex $synced_key 1]].vb configure -usealt 0
1363  }
1365  set synced_key ""
1366  }
1367 
1368  # Set the new pair
1369  catch {
1370 
1371  # Get the current text widgets
1372  set txt1 [get_info 0 paneindex txt]
1373  set txt2 [get_info 1 paneindex txt]
1374 
1375  # Create the synced key
1376  set key "$txt1 $txt2"
1377 
1378  if {[info exists synced($key)]} {
1379 
1381 
1382  set synced_key $key
1383 
1384  [winfo parent $txt1].vb configure -usealt 1
1385  [winfo parent $txt2].vb configure -usealt 1
1386 
1387  }
1388 
1389  }
1390 
1391  }

§ panel_forget()

gui::panel_forget   w  

Definition at line 3663 of file gui.tcl.

3663  proc panel_forget {w} {
3664 
3665  variable panel_focus
3666 
3667  if {[winfo parent $w] eq "."} {
3668  set sep .sep
3669  } else {
3670  set sep [winfo parent $w].sep
3671  }
3672 
3673  # Remove the given panels from display
3674  place forget $w
3675  place forget $sep
3676 
3677  # Enable the UI
3678  # panel_set_ui_state normal
3679 
3680  # Return the focus
3681  if {$panel_focus ne ""} {
3682  focus $panel_focus
3683  set panel_focus ""
3684  }
3685 
3686  }

§ panel_place()

gui::panel_place   w  

Definition at line 3629 of file gui.tcl.

3629  proc panel_place {w} {
3630 
3631  variable widgets
3632  variable panel_focus
3633 
3634  if {[winfo parent $w] eq "."} {
3635  set top [winfo height $widgets(info)]
3636  set sep .sep
3637  } else {
3638  set top 0
3639  set sep [winfo parent $w].sep
3640  }
3641 
3642  set stop [winfo reqheight $sep]
3643  set wtop [winfo reqheight $w]
3644 
3645  # Place the separator
3646  place $sep -relwidth 1.0 -rely 1.0 -y [expr 0 - ($top + $stop)]
3647  raise $sep
3648 
3649  # Place the window and make sure that the window is raised above all others
3650  place $w -relwidth 1.0 -rely 1.0 -y [expr 0 - ($top + $stop + $wtop)]
3651  raise $w
3652 
3653  # Disable the UI
3654  # panel_set_ui_state disabled
3655 
3656  # Remember who has the focus
3657  set panel_focus [focus]
3658 
3659  }

§ panel_set_ui_state()

gui::panel_set_ui_state   state  

Definition at line 3598 of file gui.tcl.

3598  proc panel_set_ui_state {state} {
3599 
3600  variable widgets
3601 
3602  set markable [expr {($state eq "normal")}]
3603 
3604  # Disable the tabbars
3605  foreach pane [$widgets(nb_pw) panes] {
3606  get_info $pane pane tabbar txt txt2
3607  $tabbar configure -state $state
3608  $txt configure -state $state -linemap_markable $markable
3609  if {[winfo exists $txt2]} {
3610  $txt2 configure -state $state -linemap_markable $markable
3611  }
3612  }
3613 
3614  # For good measure, we'll even disable the information bar items
3615  $widgets(info_encode) configure -state $state
3616  $widgets(info_indent) configure -state $state
3617  $widgets(info_syntax) configure -state $state
3618 
3619  # Disable the menubar
3620  menus::set_state $state
3621 
3622  # Disable the sidebar from executing
3623  sidebar::set_state [expr {($state eq "normal") ? "normal" : "viewonly"}]
3624 
3625  }

§ panes()

gui::panes

Definition at line 1326 of file gui.tcl.

1326  proc panes {} {
1327 
1328  variable widgets
1329 
1330  return [llength [$widgets(nb_pw) panes]]
1331 
1332  }

§ pastable()

gui::pastable

Definition at line 3067 of file gui.tcl.

3067  proc pastable {} {
3068 
3069  return [expr {![catch {clipboard get} contents] && ($contents ne "") && [editable]}]
3070 
3071  }

§ paste()

gui::paste

Definition at line 3016 of file gui.tcl.

3016  proc paste {} {
3017 
3018  # Get the current text widget
3019  set txt [current_txt]
3020 
3021  # If the current txt widget has the focus, paste clipboard contents to it and record the
3022  # paste with the Vim namespace.
3023  if {[focus] eq "$txt.t"} {
3024 
3025  # Perform the paste
3026  $txt paste
3027 
3028  # Handle the Vim paste
3029  vim::handle_paste $txt
3030 
3031  return 1
3032 
3033  }
3034 
3035  return 0
3036 
3037  }

§ paste_and_format()

gui::paste_and_format

Definition at line 3042 of file gui.tcl.

3042  proc paste_and_format {} {
3043 
3044  if {![catch {clipboard get}]} {
3045 
3046  # Get the length of the clipboard text
3047  set cliplen [string length [clipboard get]]
3048 
3049  # Get the position of the insertion cursor
3050  set insertpos [[current_txt] index insert]
3051 
3052  # Perform the paste operation
3053  if {[paste]} {
3054 
3055  # Have the indent namespace format the clipboard contents
3056  indent::format_text [current_txt].t $insertpos "$insertpos+${cliplen}c"
3057 
3058  }
3059 
3060  }
3061 
3062  }

§ previous_tab()

gui::previous_tab

Definition at line 1280 of file gui.tcl.

1280  proc previous_tab {} {
1281 
1282  # Get the location information for the current tab in the current pane
1283  get_info {} current tabbar tabindex
1284 
1285  # If the new tab index is at the less than 0, circle to the last tab
1286  if {[incr tabindex -1] == -1} {
1287  set tabindex [expr [$tabbar index end] - 1]
1288  }
1289 
1290  # Select the previous tab
1291  set_current_tab $tabbar [lindex [$tabbar tabs -shown] $tabindex]
1292 
1293  }

§ prompt_for_save()

gui::prompt_for_save

Definition at line 2122 of file gui.tcl.

2122  proc prompt_for_save {} {
2123 
2124  # Get the directory of the current file
2125  set dirname [gui::get_browse_directory]
2126 
2127  # Get the list of save options
2128  set save_opts [list]
2129  if {[llength [set extensions [syntax::get_extensions]]] > 0} {
2130  lappend save_opts -defaultextension [lindex $extensions 0]
2131  }
2132 
2133  # Get the save file from the user
2134  return [tk_getSaveFile {*}$save_opts -parent . -title [msgcat::mc "Save As"] -initialdir $dirname]
2135 
2136  }

§ raise_window()

gui::raise_window

Definition at line 2028 of file gui.tcl.

2028  proc raise_window {} {
2029 
2030  variable widgets
2031 
2032  # If the notebook widget doesn't exist this will cause an error to occur.
2033  if {$widgets(nb_pw) ne ""} {
2034 
2035  wm withdraw .
2036  wm deiconify .
2037 
2038  }
2039 
2040  }

§ redo()

gui::redo

Definition at line 2955 of file gui.tcl.

2955  proc redo {} {
2956 
2957  # Get the current textbox
2958  set txt [current_txt]
2959 
2960  # Perform the redo operation from Vim perspective
2961  vim::redo $txt.t
2962 
2963  }

§ redoable()

gui::redoable

Definition at line 2967 of file gui.tcl.

2967  proc redoable {} {
2968 
2969  # Get the current textbox
2970  set txt [current_txt]
2971 
2972  return [$txt edit redoable]
2973 
2974  }

§ remove_all_markers()

gui::remove_all_markers

Definition at line 5664 of file gui.tcl.

5664  proc remove_all_markers {} {
5665 
5666  foreach txt [get_all_texts] {
5667  remove_txt_markers $txt
5668  }
5669 
5670  }

§ remove_current_marker()

gui::remove_current_marker

Definition at line 5620 of file gui.tcl.

5620  proc remove_current_marker {} {
5621 
5622  # Get the current text widget
5623  get_info {} current tab txt
5624 
5625  # Get the current line number
5626  set line [lindex [split [$txt index insert] .] 0]
5627 
5628  # Remove all markers at the current line
5629  markers::delete_by_line $tab $line
5630  ctext::linemapClearMark $txt $line
5631 
5632  # Update the tab's marker view
5633  update_tab_markers $tab
5634 
5635  }

§ remove_current_markers()

gui::remove_current_markers

Definition at line 5656 of file gui.tcl.

5656  proc remove_current_markers {} {
5657 
5659 
5660  }

§ remove_txt_markers()

gui::remove_txt_markers   txt  

Definition at line 5639 of file gui.tcl.

5639  proc remove_txt_markers {txt} {
5640 
5641  get_info $txt txt tab
5642 
5643  foreach {name t line} [markers::get_markers $tab] {
5644  set line [lindex [split $line .] 0]
5645  markers::delete_by_name $tab $name
5646  ctext::linemapClearMark $txt $line
5647  }
5648 
5649  # Update the marker display
5650  update_tab_markers $tab
5651 
5652  }

§ save_all()

gui::save_all

Definition at line 2363 of file gui.tcl.

2363  proc save_all {} {
2364 
2365  variable undo_count
2366 
2367  for {set i 0} {$i < [files::get_file_num]} {incr i} {
2368 
2369  # Get file information
2370  get_info $i fileindex tabbar tab txt fname modified diff save_cmd buffer
2371 
2372  # If the file needs to be saved, do it
2373  if {$modified && !$diff} {
2374 
2375  # If the file needs to be saved as a new filename, call the save_current
2376  # procedure
2377  if {$buffer && ($save_cmd ne "")} {
2378 
2379  # Run the save command and if it ran successfully,
2380  if {[catch { {*}$save_cmd $i} rc]} {
2381 
2382  continue
2383 
2384  } elseif {$rc == 0} {
2385 
2386  # Change the tab text
2387  $tabbar tab $tab -text " [file tail $fname]"
2388 
2389  # Change the text to unmodified
2390  $txt edit modified false
2391  set undo_count($tab) [$txt edit undocount]
2392  files::set_info $i fileindex modified 0
2393 
2394  # Save the current
2395  } else {
2396 
2397  set_current_tab $tabbar $tab
2398  save_current -force 1
2399 
2400  }
2401 
2402  # Perform a tab-only save
2403  } else {
2404 
2405  # Run the on_save plugins
2407 
2408  # Save the file contents
2409  if {![files::set_file $tab [scrub_text $txt]]} {
2410  continue
2411  }
2412 
2413  # Change the tab text
2414  $tabbar tab $tab -text " [file tail $fname]"
2415 
2416  # Change the text to unmodified
2417  $txt edit modified false
2418  set undo_count($tab) [$txt edit undocount]
2419  files::set_info $i fileindex modified 0
2420 
2421  # If there is a save command, run it now
2422  if {$save_cmd ne ""} {
2423  eval {*}$save_cmd $i
2424  }
2425 
2426  }
2427 
2428  }
2429 
2430  }
2431 
2432  # Make sure that the title is consistent
2433  set_title
2434 
2435  }

§ save_current()

gui::save_current   args  

Definition at line 2236 of file gui.tcl.

2236  proc save_current {args} {
2237 
2238  variable undo_count
2239 
2240  array set opts {
2241  -force 0
2242  -save_as ""
2243  -remote ""
2244  }
2245  array set opts $args
2246 
2247  # Get current information
2248  get_info {} current tabbar tab txt fileindex fname buffer save_cmd diff buffer mtime sidebar lang
2249 
2250  # If the current file is a buffer and it has a save command, run the save command
2251  if {$buffer && ($save_cmd ne "")} {
2252 
2253  # Execute the save command. If it errors or returns a value of 0, return immediately
2254  if {[catch { {*}$save_cmd $fileindex} rc]} {
2255  return 0
2256  } elseif {$rc == 0} {
2258  return 1
2259  }
2260 
2261  # Retrieve some values in case they changed in the save command
2262  get_info {} current fname buffer save_cmd
2263 
2264  }
2265 
2266  # Get the difference mode of the current file
2267  set matching_index -1
2268 
2269  # If a save_as name is specified, change the filename
2270  if {$opts(-save_as) ne ""} {
2271 
2272  # Add the file to the sidebar and indicate that it is opened
2273  sidebar::highlight_filename $fname [expr $diff * 2]
2274  set matching_index [files::get_index $opts(-save_as) $opts(-remote)]
2275 
2276  # Set the filename, remote tag indicator and set the tab attributes to match
2277  # the same as a file
2278  files::set_info $fileindex fileindex \
2279  fname [set fname [file normalize $opts(-save_as)]] \
2280  remote [set remote $opts(-remote)] \
2281  readonly 0 buffer 0 remember 1
2282 
2283  # Update the tab image to reflect that fact that we not readonly
2284  set_tab_image $tab
2285 
2286  # If the current file doesn't have a filename, allow the user to set it
2287  } elseif {$buffer || $diff} {
2288 
2289  if {[set sfile [prompt_for_save]] eq ""} {
2290  return 0
2291  } else {
2292  set matching_index [files::get_index $sfile ""]
2293  files::set_info $fileindex fileindex fname [set fname $sfile]
2294  }
2295 
2296  }
2297 
2298  # Run the on_save plugins
2299  plugins::handle_on_save $fileindex
2300 
2301  # If we need to do a force write, do it now
2302  set perms ""
2303  if {![save_prehandle $fname $opts(-save_as) $opts(-force) perms]} {
2304  return 0
2305  }
2306 
2307  # If the file already exists in one of the open tabs, close it now
2308  if {$matching_index != -1} {
2309  close_tab [files::get_info $matching_index fileindex tab] -keeptab 0 -check 0
2310  }
2311 
2312  # Save the file contents
2313  if {![files::set_file $tab [scrub_text $txt]]} {
2314  return 0
2315  }
2316 
2317  # If we need to do a force write, do it now
2318  if {![save_posthandle $fname $perms]} {
2319  return 0
2320  }
2321 
2322  # If the file doesn't have a timestamp, it's a new file so add and highlight it in the sidebar
2323  if {($mtime eq "") || ($opts(-save_as) ne "")} {
2324 
2325  # Add the filename to the most recently opened list
2326  add_to_recently_opened $fname
2327 
2328  # If it is okay to add the file to the sidebar, do it now
2329  if {$sidebar} {
2330  sidebar::insert_file [sidebar::add_directory [file dirname $fname] -remote $opts(-remote)] $fname $opts(-remote)
2331  sidebar::highlight_filename $fname [expr ($diff * 2) + 1]
2332  }
2333 
2334  # Syntax highlight the file
2336 
2337  }
2338 
2339  # If the information panel needs to be updated for this file, do it now
2340  sidebar::update_info_panel_for_file $fname $opts(-remote)
2341 
2342  # Set the modified state to 0
2344  set undo_count($tab) [$txt edit undocount]
2345 
2346  # If there is a save command, run it now
2347  if {$save_cmd ne ""} {
2348  eval {*}$save_cmd $fileindex
2349 
2350  # Otherwise, if the file type is TclPlugin, automatically reload the plugin
2351  } elseif {[lsearch [list PluginTcl PluginHeader] $lang] != -1} {
2353  }
2354 
2355  return 1
2356 
2357  }

§ save_posthandle()

gui::save_posthandle   fname perms  

Definition at line 2172 of file gui.tcl.

2172  proc save_posthandle {fname perms} {
2173 
2174  if {$perms ne ""} {
2175  catch { file attributes $fname -permissions $perms}
2176  }
2177 
2178  return 1
2179 
2180  }

§ save_prehandle()

gui::save_prehandle   fname save_as force pperms  

Definition at line 2140 of file gui.tcl.

2140  proc save_prehandle {fname save_as force pperms} {
2141 
2142  upvar $pperms perms
2143 
2144  set perms ""
2145 
2146  if {[file exists $fname]} {
2147  if {$save_as eq ""} {
2148  if {![file writable $fname]} {
2149  if {$force} {
2150  set perms [file attributes $fname -permissions]
2151  if {[catch { file attributes $fname -permissions 700} rc]} {
2152  set_info_message [msgcat::mc "No write permissions. Use '!' to force write."]
2153  return 0
2154  }
2155  } else {
2156  set_info_message [msgcat::mc "No write permissions. Use '!' to force write."]
2157  return 0
2158  }
2159  }
2160  } elseif {!$force} {
2161  set_info_message [msgcat::mc "File already exists. Use '!' to force an overwrite"]
2162  return 0
2163  }
2164  }
2165 
2166  return 1
2167 
2168  }

§ save_session()

gui::save_session

Definition at line 1039 of file gui.tcl.

1039  proc save_session {} {
1040 
1041  variable widgets
1042  variable last_opened
1043 
1044  # Gather content to save
1045  set content(Geometry) [::window_geometry .]
1046  set content(Fullscreen) [wm attributes . -fullscreen]
1047  set content(CurrentWorkingDirectory) [pwd]
1048  set content(Sidebar) [sidebar::save_session]
1049  set content(Launcher) [launcher::save_session]
1050 
1051  # Calculate the zoomed state
1052  switch [tk windowingsystem] {
1053  x11 {
1054  set content(Zoomed) [wm attributes . -zoomed]
1055  }
1056  default {
1057  set content(Zoomed) [expr {[wm state .] eq "zoomed"}]
1058  }
1059  }
1060 
1061  foreach nb [$widgets(nb_pw) panes] {
1062 
1063  set tabindex 0
1064  set current_tab ""
1065  set current_set 0
1066 
1067  foreach tab [$nb.tbf.tb tabs] {
1068 
1069  # Get the file tab information
1070  get_info $tab tab paneindex txt fname save_cmd lock readonly diff sidebar buffer remember remote txt2 beye encode
1071 
1072  # If we need to forget this file, don't save it to the session
1073  if {!$remember || ($remote ne "")} {
1074  continue
1075  }
1076 
1077  set finfo(pane) $paneindex
1078  set finfo(fname) $fname
1079  set finfo(savecommand) $save_cmd
1080  set finfo(lock) $lock
1081  set finfo(readonly) $readonly
1082  set finfo(diff) $diff
1083  set finfo(sidebar) $sidebar
1084  set finfo(buffer) $buffer
1085  set finfo(remember) $remember
1086  set finfo(encode) $encode
1087 
1088  # Save the tab as a current tab if it's not a buffer
1089  if {!$finfo(buffer) && !$current_set} {
1090  set current_tab $tabindex
1091  if {[$nb.tbf.tb select] eq $tab} {
1092  set current_set 1
1093  }
1094  }
1095 
1096  set finfo(tab) $tabindex
1097  set finfo(language) [syntax::get_language $txt]
1098  set finfo(indent) [indent::get_indent_mode $txt]
1099  set finfo(modified) 0
1100  set finfo(cursor) [$txt index insert]
1101  set finfo(xview) [lindex [$txt xview] 0]
1102  set finfo(yview) [lindex [$txt yview] 0]
1103  set finfo(beye) [winfo exists $beye]
1104  set finfo(split) [winfo exists $txt2]
1105 
1106  # Add markers
1107  set finfo(markers) [list]
1108  foreach {mname mtxt pos} [markers::get_markers $tab] {
1109  lappend finfo(markers) $mname [lindex [split $pos .] 0]
1110  }
1111 
1112  # Add diff data, if applicable
1113  if {$finfo(diff)} {
1114  set finfo(diffdata) [diff::get_session_data $txt]
1115  }
1116  lappend content(FileInfo) [array get finfo]
1117 
1118  incr tabindex
1119 
1120  }
1121 
1122  # Set the current tab for the pane (if one exists)
1123  if {$current_tab ne ""} {
1124  lappend content(CurrentTabs) $current_tab
1125  }
1126 
1127  }
1128 
1129  # Get the last_opened list
1130  set content(LastOpened) $last_opened
1131 
1132  # Return the content array
1133  return [array get content]
1134 
1135  }

§ scrub_text()

gui::scrub_text   txt  

Definition at line 6139 of file gui.tcl.

6139  proc scrub_text {txt} {
6140 
6141  variable trailing_ws_re
6142 
6143  # Clear any snippet tabstops embedded in the text widget
6145 
6146  # Clean up the text from Vim
6147  set str [vim::get_cleaned_content $txt]
6148 
6149  if {[preferences::get Editor/RemoveTrailingWhitespace]} {
6150  regsub -all -lineanchor -- $trailing_ws_re $str {} str
6151  }
6152 
6153  return $str
6154 
6155  }

§ search()

gui::search   ?dir?  

Definition at line 3197 of file gui.tcl.

3197  proc search {{dir "next"}} {
3198 
3199  variable saved
3200 
3201  # Get the tab information
3202  get_info {} current tab txt
3203 
3204  # Update the search method menubutton label
3206 
3207  # Display the search bar and separator
3208  panel_forget $tab.rf
3209  panel_place $tab.sf
3210 
3211  # Add bindings
3212  bind $tab.sf.e <Return> [list search::find_start $dir]
3213  bind $tab.sf.case <Return> [list search::find_start $dir]
3214  bind $tab.sf.save <Return> [list search::find_start $dir]
3215 
3216  # Reset the saved indicator
3217  set saved 0
3218 
3219  # If a line or less is selected, populate the search bar with it
3220  if {([llength [set ranges [$txt tag ranges sel]]] == 2) && ([$txt count -lines {*}$ranges] == 0)} {
3221  $tab.sf.e delete 0 end
3222  $tab.sf.e insert end [$txt get {*}$ranges]
3223  } else {
3224  $tab.sf.e selection range 0 end
3225  }
3226 
3227  # Place the focus on the search bar
3228  focus $tab.sf.e
3229 
3230  # Set the unfocussed insertion cursor to hollow
3231  catch { $txt configure -insertunfocussed hollow}
3232 
3233  }

§ search_and_replace()

gui::search_and_replace

Definition at line 3270 of file gui.tcl.

3270  proc search_and_replace {} {
3271 
3272  variable saved
3273 
3274  # Get the tab information
3275  get_info {} current tab txt
3276 
3277  # Update the search method menubutton label
3279 
3280  # Display the search bar and separator
3281  panel_forget $tab.sf
3282  panel_place $tab.rf
3283 
3284  # Reset the saved indicator
3285  set saved 0
3286 
3287  # If a line or less is selected, populate the find entry with it
3288  if {([llength [set ranges [$txt tag ranges sel]]] == 2) && ([$txt count -lines {*}$ranges] == 0)} {
3289  $tab.rf.fe delete 0 end
3290  $tab.rf.fe insert end [$txt get {*}$ranges]
3291  } else {
3292  $tab.rf.fe selection range 0 end
3293  }
3294 
3295  # Place the focus on the find entry field
3296  focus $tab.rf.fe
3297 
3298  }

§ search_clear()

gui::search_clear

Definition at line 3179 of file gui.tcl.

3179  proc search_clear {} {
3180 
3181  # Get the current tab
3182  get_info {} current tab
3183 
3184  # Clear the find UI
3185  $tab.sf.e delete 0 end
3186  handle_search_change $tab ""
3187 
3188  # Clear the find/replace UI
3189  $tab.rf.fe delete 0 end
3190  $tab.rf.re delete 0 end
3191  handle_replace_change $tab ""
3192 
3193  }

§ select_all()

gui::select_all

Definition at line 1603 of file gui.tcl.

1603  proc select_all {} {
1604 
1605  # Get the current text widget
1606  set txt [current_txt]
1607 
1608  # Set the selection to include everything
1609  $txt tag add sel 1.0 end
1610 
1611  }

§ select_line()

gui::select_line   w x y  

Definition at line 5309 of file gui.tcl.

5309  proc select_line {w x y} {
5310 
5311  variable line_sel_anchor
5312 
5313  # Get the parent window
5314  set txt [winfo parent $w]
5315 
5316  # Get the last line
5317  set fontwidth [font measure [$txt cget -font] -displayof . "0"]
5318  set last_line [lindex [split [$txt index end-1c] .] 0]
5319  set line_chars [expr ([$txt cget -linemap] ? max( [$txt cget -linemap_minwidth], [string length $last_line] ) : 1) + 1]
5320 
5321  # We will only select the line if we clicked in the line number area
5322  if {$x > ($fontwidth * $line_chars)} {
5323  return
5324  }
5325 
5326  # Get the current line from the line sidebar
5327  set index [$txt index @0,$y]
5328 
5329  # Select the corresponding line in the text widget
5330  $txt tag remove sel 1.0 end
5331  $txt tag add sel "$index linestart" "$index lineend"
5332 
5333  $txt mark set insert "$index lineend"
5334  vim::adjust_insert $txt.t
5335 
5336  # Save the selected line to the anchor
5337  set line_sel_anchor($w) $index
5338 
5339  }

§ select_lines()

gui::select_lines   w x y  

Definition at line 5344 of file gui.tcl.

5344  proc select_lines {w x y} {
5345 
5346  variable line_sel_anchor
5347 
5348  # Get the parent window
5349  set txt [winfo parent $w]
5350 
5351  # Get the last line
5352  set fontwidth [font measure [$txt cget -font] -displayof . "0"]
5353  set last_line [lindex [split [$txt index end-1c] .] 0]
5354  set line_chars [expr ([$txt cget -linemap] ? max( [$txt cget -linemap_minwidth], [string length $last_line] ) : 1) + 1]
5355 
5356  # We will only select the line if we clicked in the line number area
5357  if {$x > ($fontwidth * $line_chars)} {
5358  return
5359  }
5360 
5361  # Get the current line from the line sidebar
5362  set index [$txt index @$x,$y]
5363 
5364  # Remove the current selection
5365  $txt tag remove sel 1.0 end
5366 
5367  # If the anchor has not been set, set it now
5368  if {![info exists line_sel_anchor($w)]} {
5369  set line_sel_anchor($w) $index
5370  }
5371 
5372  # Add the selection between the anchor and this line, inclusive
5373  if {[$txt compare $index < $line_sel_anchor($w)]} {
5374  $txt tag add sel "$index linestart" "$line_sel_anchor($w) lineend"
5375  $txt mark set insert "$line_sel_anchor($w) lineend"
5376  } else {
5377  $txt tag add sel "$line_sel_anchor($w) linestart" "$index lineend"
5378  $txt mark set insert "$index lineend"
5379  }
5380 
5381  # Make sure that the insertion cursor is handled properly when in Vim mode
5382  vim::adjust_insert $txt.t
5383 
5384  }

§ selected()

gui::selected

Definition at line 3002 of file gui.tcl.

3002  proc selected {} {
3003 
3004  if {([set txt [current_txt]] ne "") && \
3005  ([llength [$txt tag ranges sel]] > 0)} {
3006  return 1
3007  } else {
3008  return 0
3009  }
3010 
3011  }

§ selection_changed()

gui::selection_changed   txt  

Definition at line 5291 of file gui.tcl.

5291  proc selection_changed {txt} {
5292 
5293  # Get the first range of selected text
5294  if {[set range [$txt tag nextrange sel 1.0]] ne ""} {
5295 
5296  # Get the current search entry field
5297  set sentry [current_search]
5298 
5299  # Set the search frame
5300  $sentry delete 0 end
5301  $sentry insert end [$txt get {*}$range]
5302 
5303  }
5304 
5305  }

§ set_auto_cwd()

gui::set_auto_cwd   value  

Definition at line 797 of file gui.tcl.

797  proc set_auto_cwd {value} {
798 
799  variable auto_cwd
800 
801  # Update the auto_cwd variable and if a file exists, update the current
802  # working directory if auto_cwd is true.
803  if {[set auto_cwd $value] && [files::get_file_num]} {
804 
805  # Get the current file information
806  get_info {} current fname buffer diff
807 
808  # If the current file is neither a buffer nor a difference view, update
809  # the current working directory and title bar.
810  if {!$buffer && !$diff} {
811  cd [file dirname $fname]
812  set_title
813  }
814 
815  }
816 
817  }

§ set_browse_directory()

gui::set_browse_directory   bsdir  

Definition at line 97 of file gui.tcl.

97  proc set_browse_directory {bsdir} {
98 
99  variable browse_dir
100 
101  set browse_dir $bsdir
102 
103  }

§ set_current_encoding()

gui::set_current_encoding   value  

Definition at line 6001 of file gui.tcl.

6001  proc set_current_encoding {value} {
6002 
6003  gui::get_info {} current tab fileindex
6004 
6005  # Set the encoding
6006  if {![set_encoding $tab $value]} {
6007  return
6008  }
6009 
6010  # Update the encode button
6012 
6013  # Update the file with the new encoding
6014  update_file $fileindex
6015 
6016  # Set the focus back to the text editor
6018 
6019  }

§ set_current_eol_translation()

gui::set_current_eol_translation   value  

Definition at line 2184 of file gui.tcl.

2184  proc set_current_eol_translation {value} {
2185 
2186  # Get the file index of the current file
2187  files::set_info [get_info {} current fileindex] fileindex eol $value
2188 
2189  }

§ set_current_file_favorite()

gui::set_current_file_favorite   favorite  

Definition at line 3443 of file gui.tcl.

3443  proc set_current_file_favorite {favorite} {
3444 
3445  # Get the current file name
3446  get_info {} current fname
3447 
3448  # Add or remove the file from the favorites list
3449  if {$favorite} {
3450  favorites::add $fname
3451  } else {
3452  favorites::remove $fname
3453  }
3454 
3455  }

§ set_current_file_favorite_with_current()

gui::set_current_file_favorite_with_current

Definition at line 3460 of file gui.tcl.

3460  proc set_current_file_favorite_with_current {} {
3461 
3462  variable file_favorited
3463 
3464  set_current_file_favorite $file_favorited
3465 
3466  }

§ set_current_file_lock()

gui::set_current_file_lock   lock  

Definition at line 3417 of file gui.tcl.

3417  proc set_current_file_lock {lock} {
3418 
3419  # Get the current tab information
3420  get_info {} current tab
3421 
3422  # Set the current lock status
3423  files::set_info $tab tab lock $lock
3424 
3425  # Set the tab image to match
3426  set_tab_image $tab
3427 
3428  }

§ set_current_file_lock_with_current()

gui::set_current_file_lock_with_current

Definition at line 3433 of file gui.tcl.

3433  proc set_current_file_lock_with_current {} {
3434 
3435  variable file_locked
3436 
3437  set_current_file_lock $file_locked
3438 
3439  }

§ set_current_modified()

gui::set_current_modified   value  

Definition at line 2194 of file gui.tcl.

2194  proc set_current_modified {value} {
2195 
2196  # Get the current file information
2197  get_info {} current tabbar tab txt fname
2198 
2199  # Set the file modified status to the given value
2200  files::set_info $tab tab modified $value
2201 
2202  # Set the text widget status
2203  if {$value == 0} {
2204  $txt edit modified $value
2205  }
2206 
2207  # Update the current tab text
2208  $tabbar tab $tab -text [format "%s %s" [expr {$value ? " *" : ""}] [file tail $fname]]
2209 
2210  # Update the title
2211  set_title
2212 
2213  }

§ set_current_tab()

gui::set_current_tab   tabbar tab  

Definition at line 5388 of file gui.tcl.

5388  proc set_current_tab {tabbar tab} {
5389 
5390  variable widgets
5391  variable pw_current
5392 
5393  # Get the frame containing the text widget
5394  set tf [winfo parent [winfo parent $tabbar]].tf
5395 
5396  # If there is no tab being set, just delete the packed slave
5397  if {$tab eq ""} {
5398  if {[set slave [pack slaves $tf]] ne ""} {
5399  pack forget $slave
5400  }
5401  return
5402  }
5403 
5404  # Get the tab's file information
5405  get_info $tab tab fname remote
5406 
5407  # Make sure that the tab state is shown
5408  $tabbar tab $tab -state normal
5409 
5410  # Make sure the sidebar is updated properly
5411  sidebar::set_hide_state $fname $remote 0
5412 
5413  # Make the tab the selected tab in the tabbar
5414  $tabbar select $tab
5415 
5416  # Make sure that the tab's content is displayed
5417  show_current_tab $tabbar
5418 
5419  }

§ set_encoding()

gui::set_encoding   tab value ?setfocus?  

Definition at line 6023 of file gui.tcl.

6023  proc set_encoding {tab value {setfocus 1}} {
6024 
6025  variable widgets
6026 
6027  # Get the current tab info
6028  get_info $tab tab fileindex encode
6029 
6030  # If the value did not change, do nothing
6031  if {$value eq $encode} {
6032  return 0
6033  }
6034 
6035  # Save the file encoding
6036  files::set_info $fileindex fileindex encode $value
6037 
6038  return 1
6039 
6040  }

§ set_error_message()

gui::set_error_message   msg ?detail?  

Definition at line 3586 of file gui.tcl.

3586  proc set_error_message {msg {detail ""}} {
3587 
3588  tk_messageBox -parent . -icon error -title [msgcat::mc "Error"] -type ok -default ok -message $msg -detail $detail
3589 
3590  }

§ set_info_message()

gui::set_info_message   msg args  

Definition at line 3481 of file gui.tcl.

3481  proc set_info_message {msg args} {
3482 
3483  variable widgets
3484  variable info_clear
3485  variable info_msgs
3486 
3487  array set opts {
3488  -clear_delay 3000
3489  -win ""
3490  }
3491  array set opts $args
3492 
3493  if {[info exists widgets(info_msg)]} {
3494 
3495  if {$info_clear ne ""} {
3496  after cancel $info_clear
3497  }
3498 
3499  lassign [winfo rgb . [set foreground [utils::get_default_foreground]]] fr fg fb
3500  lassign [winfo rgb . [utils::get_default_background]] br bg bb
3501  $widgets(info_msg) configure -text $msg -foreground $foreground
3502 
3503  # Remember or clear the message for the window, if necessary
3504  if {$opts(-win) ne ""} {
3505  if {$msg eq ""} {
3506  unset -nocomplain info_msgs($opts(-win))
3507  } else {
3508  set info_msgs($opts(-win)) [list $msg $opts(-clear_delay)]
3509  }
3510  }
3511 
3512  # If the status bar is supposed to be hidden, show it now
3513  if {![winfo ismapped $widgets(info)]} {
3515  set hide_info 1
3516  } else {
3517  set hide_info 0
3518  }
3519 
3520  # Call ourselves
3521  if {($opts(-clear_delay) > 0) && ([string trim $msg] ne "")} {
3522  set info_clear [after $opts(-clear_delay) \
3523  [list gui::clear_info_message $hide_info \
3524  [expr $fr >> 8] [expr $fg >> 8] [expr $fb >> 8] \
3525  [expr $br >> 8] [expr $bg >> 8] [expr $bb >> 8] -win $opts(-win)]]
3526  }
3527 
3528  } else {
3529 
3530  puts $msg
3531 
3532  }
3533 
3534  }

§ set_line_number_view()

gui::set_line_number_view   value  

Definition at line 1000 of file gui.tcl.

1000  proc set_line_number_view {value} {
1001 
1002  # Show the line numbers in the current editor
1003  [current_txt] configure -linemap $value
1004 
1005  }

§ set_line_number_width()

gui::set_line_number_width   val  

Definition at line 1010 of file gui.tcl.

1010  proc set_line_number_width {val} {
1011 
1012  variable numberwidth
1013 
1014  set numberwidth $val
1015 
1016  for {set i 0} {$i < [files::get_file_num]} {incr i} {
1017  [get_info $i fileindex txt] configure -linemap_minwidth $val
1018  }
1019 
1020  }

§ set_matching_char()

gui::set_matching_char   value  

Definition at line 593 of file gui.tcl.

593  proc set_matching_char {value} {
594 
595  variable show_match_chars
596 
597  # Save this value because it can be changed from Vim
598  set show_match_chars $value
599 
600  # Update all existing text widgets to the new value
601  foreach txt [get_all_texts] {
602  $txt configure -matchchar $value
603  }
604 
605  }

§ set_pane_sync()

gui::set_pane_sync   value  

Definition at line 1397 of file gui.tcl.

1397  proc set_pane_sync {value} {
1398 
1399  variable synced
1400  variable synced_key
1401 
1402  # Get the displayed text widgets
1403  set txt1 [get_info 0 paneindex txt]
1404  set txt2 [get_info 1 paneindex txt]
1405 
1406  # Set the menu indicator to the given value
1408 
1409  if {$value} {
1410 
1411  # Record the synced_key (if this value is the empty string, we are not currently synced)
1412  set synced_key "$txt1 $txt2"
1413 
1414  # Record the text widgets that we are sync'ing
1415  set synced($synced_key) [list [$txt1 index @0,0] [$txt2 index @0,0]]
1416 
1417  # Set the scrollbar colors to indicate that we are synced
1418  [winfo parent $txt1].vb configure -usealt 1
1419  [winfo parent $txt2].vb configure -usealt 1
1420 
1421  } else {
1422 
1423  # Return the scrollbar colors to their normal colors
1424  [winfo parent [lindex $synced_key 0]].vb configure -usealt 0
1425  [winfo parent [lindex $synced_key 1]].vb configure -usealt 0
1426 
1427  # Delete the synced recording
1428  unset synced($synced_key)
1429 
1430  # Clear the synced key
1431  set synced_key ""
1432 
1433  }
1434 
1435  }

§ set_search_data()

gui::set_search_data   type data  

Definition at line 3339 of file gui.tcl.

3339  proc set_search_data {type data} {
3340 
3341  variable widgets
3342  variable case_sensitive
3343  variable saved
3344  variable search_method
3345 
3346  # Get the current tab
3347  get_info {} current tab
3348 
3349  array set data_array $data
3350 
3351  switch $type {
3352  "find" {
3353  set search_method $data_array(method)
3354  set case_sensitive $data_array(case)
3355  set saved $data_array(save)
3356  $tab.sf.e delete 0 end
3357  $tab.sf.e insert end $data_array(find)
3358  handle_search_change $tab $data_array(find)
3359  }
3360  "replace" {
3361  set search_method $data_array(method)
3362  set case_sensitive $data_array(case)
3363  set saved $data_array(save)
3364  $tab.rf.fe delete 0 end
3365  $tab.rf.re delete 0 end
3366  $tab.rf.fe insert end $data_array(find)
3367  $tab.rf.re insert end $data_array(replace)
3368  handle_replace_change $tab $data_array(find)
3369  }
3370  "fif" {
3371  set search_method $data_array(method)
3372  set case_sensitive $data_array(case)
3373  set saved $data_array(save)
3374  $widgets(fif_find) delete 0 end
3375  $widgets(fif_find) insert end $data_array(find)
3376  $widgets(fif_in) tokendelete 0 end
3377  $widgets(fif_in) tokeninsert end $data_array(in)
3378  }
3379  "docsearch" {
3380  set saved $data_array(save)
3381  $widgets(doc).mb configure -text [expr {($data_array(name) eq "") ? [[$widgets(doc).mb cget -menu] entrycget 0 -label] : $data_array(name)}]
3382  $widgets(doc).e delete 0 end
3383  $widgets(doc).e insert end $data_array(find)
3384  }
3385  }
3386 
3387  }

§ set_tab_image()

gui::set_tab_image   tab  

Definition at line 3391 of file gui.tcl.

3391  proc set_tab_image {tab} {
3392 
3393  # Get the tab information
3394  get_info $tab tab tabbar txt diff readonly lock
3395 
3396  # Change the state of the text widget to match the lock value
3397  if {$diff} {
3398  $tabbar tab $tab -compound left -image tab_diff
3399  $txt configure -state disabled
3400  } elseif {$readonly} {
3401  $tabbar tab $tab -compound left -image tab_readonly
3402  $txt configure -state disabled
3403  } elseif {$lock} {
3404  $tabbar tab $tab -compound left -image tab_lock
3405  $txt configure -state disabled
3406  } else {
3407  $tabbar tab $tab -image ""
3408  $txt configure -state normal
3409  }
3410 
3411  return 1
3412 
3413  }

§ set_tab_tooltip()

gui::set_tab_tooltip   W tab  

Definition at line 4290 of file gui.tcl.

4290  proc set_tab_tooltip {W tab} {
4291 
4292  variable tab_tip
4293 
4294  # Get the full pathname to the current file
4295  get_info $tab tab fname remote
4296 
4297  # Figure out what to display
4298  if {$remote eq ""} {
4299  set tip $fname
4300  } else {
4301  set remote [join [lassign [split $remote ,] group] ,]
4302  set tip "$fname ($remote)"
4303  }
4304 
4305  # Create the tooltip
4306  set tab_tip($W) $tab
4307  tooltip::tooltip $W $tip
4308  event generate $W <Enter>
4309 
4310  }

§ set_title()

gui::set_title

Definition at line 71 of file gui.tcl.

71  proc set_title {} {
72 
73  # Get the current tab
74  if {![catch { get_info {} current tabbar}] && ([llength [$tabbar tabs]] > 0)} {
75  set tab_name [$tabbar tab current -text]
76  } else {
77  set tab_name ""
78  }
79 
80  # Get the host name
81  if {($::tcl_platform(os) eq "Darwin") && ([lindex [split $::tcl_platform(osVersion) .] 0] >= 16)} {
82  set host ""
83  } else {
84  set host "[lindex [split [info hostname] .] 0]:"
85  }
86 
87  if {[set session [sessions::current]] ne ""} {
88  wm title . "$tab_name ($session) \[${host}[pwd]\]"
89  } else {
90  wm title . "$tab_name \[${host}[pwd]\]"
91  }
92 
93  }

§ set_txt_focus()

gui::set_txt_focus   txt  

Definition at line 6108 of file gui.tcl.

6108  proc set_txt_focus {txt} {
6109 
6110  variable txt_current
6111 
6112  # Set the focus
6113  focus $txt.t
6114 
6115  # Save the last text widget in focus
6116  set txt_current([get_info $txt txt tab]) $txt
6117 
6118  }

§ setup_tab_popup_menu()

gui::setup_tab_popup_menu

Definition at line 843 of file gui.tcl.

843  proc setup_tab_popup_menu {} {
844 
845  variable widgets
846  variable file_locked
847  variable file_favorited
848  variable pw_current
849 
850  # Get the current information
851  get_info {} current txt fname readonly lock diff tabbar remote buffer txt2 beye
852 
853  # Set the file_locked and file_favorited variable
854  set file_locked $lock
855  set file_favorited [favorites::is_favorite $fname]
856 
857  # Set the state of the menu items
858  if {[files::get_file_num] > 1} {
859  $widgets(menu) entryconfigure [msgcat::mc "Close All Other Tabs"] -state normal
860  } else {
861  $widgets(menu) entryconfigure [msgcat::mc "Close All Other Tabs"] -state disabled
862  }
863  if {[llength [$widgets(nb_pw) panes]] == 2} {
864  if {[llength [$tabbar tabs]] > 1} {
865  $widgets(menu) entryconfigure [msgcat::mc "Close Other Tabs In Pane"] -state normal
866  } else {
867  $widgets(menu) entryconfigure [msgcat::mc "Close Other Tabs In Pane"] -state disabled
868  }
869  $widgets(menu) entryconfigure [msgcat::mc "Close All Tabs In Pane"] -state normal
870  } else {
871  $widgets(menu) entryconfigure [msgcat::mc "Close Other Tabs In Pane"] -state disabled
872  $widgets(menu) entryconfigure [msgcat::mc "Close All Tabs In Pane"] -state disabled
873  }
874  if {$diff} {
875  $widgets(menu) entryconfigure [msgcat::mc "Hide Tab"] -state disabled
876  } else {
877  $widgets(menu) entryconfigure [msgcat::mc "Hide Tab"] -state normal
878  }
879  if {([llength [$tabbar tabs]] > 1) || ([llength [$widgets(nb_pw) panes]] > 1)} {
880  $widgets(menu) entryconfigure [format "%s*" [msgcat::mc "Move"]] -state normal
881  } else {
882  $widgets(menu) entryconfigure [format "%s*" [msgcat::mc "Move"]] -state disabled
883  }
884  if {$readonly || $diff} {
885  $widgets(menu) entryconfigure [msgcat::mc "Locked"] -state disabled
886  } else {
887  $widgets(menu) entryconfigure [msgcat::mc "Locked"] -state normal
888  }
889  if {![file exists $fname]} {
890  $widgets(menu) entryconfigure [msgcat::mc "Favorited"] -state disabled
891  $widgets(menu) entryconfigure [msgcat::mc "Show in Sidebar"] -state disabled
892  } else {
893  $widgets(menu) entryconfigure [msgcat::mc "Show in Sidebar"] -state normal
894  $widgets(menu) entryconfigure [msgcat::mc "Favorited"] -state [expr {($diff || $buffer || ($remote ne "")) ? "disabled" : "normal"}]
895  }
896 
897  # Make the split pane and bird's eye indicators look correct
898  set menus::show_split_pane [winfo exists $txt2]
899  set menus::show_birdseye [winfo exists $beye]
900 
901  # Handle plugin states
902  plugins::menu_state $widgets(menu) tab_popup
903 
904  }

§ show_about()

gui::show_about

Definition at line 3831 of file gui.tcl.

3831  proc show_about {} {
3832 
3833  # Generate the version string
3834  if {$::version_point == 0} {
3835  set version_str "$::version_major.$::version_minor ($::version_hgid)"
3836  } else {
3837  set version_str "$::version_major.$::version_minor.$::version_point ($::version_hgid)"
3838  }
3839 
3840  if {[preferences::get General/UpdateReleaseType] eq "devel"} {
3841  set release_type "Development"
3842  } else {
3843  set release_type "Stable"
3844  }
3845 
3846  toplevel .aboutwin
3847  wm title .aboutwin ""
3848  wm transient .aboutwin .
3849  wm resizable .aboutwin 0 0
3850 
3851  ttk::frame .aboutwin.f
3852  ttk::label .aboutwin.f.logo -compound left -image logo -text " TKE" \
3853  -font [font create -family Helvetica -size 30 -weight bold]
3854 
3855  ttk::frame .aboutwin.f.if
3856  ttk::label .aboutwin.f.if.l0 -text [format "%s:" [msgcat::mc "Version"]]
3857  ttk::label .aboutwin.f.if.v0 -text $version_str
3858  ttk::label .aboutwin.f.if.l1 -text [format "%s:" [msgcat::mc "Release Type"]]
3859  ttk::label .aboutwin.f.if.v1 -text $release_type
3860  ttk::label .aboutwin.f.if.l2 -text [format "%s:" [msgcat::mc "License"]]
3861  ttk::label .aboutwin.f.if.v2 -text "GPL 2.0"
3862  ttk::label .aboutwin.f.if.l3 -text [format "%s:" [msgcat::mc "Tcl/Tk Version"]]
3863  ttk::label .aboutwin.f.if.v3 -text [info patchlevel]
3864  ttk::label .aboutwin.f.if.l4 -text [format "\n%s:" [msgcat::mc "Developer"]]
3865  ttk::label .aboutwin.f.if.v4 -text "\nTrevor Williams"
3866  ttk::label .aboutwin.f.if.l5 -text [format "%s:" [msgcat::mc "Email"]]
3867  ttk::label .aboutwin.f.if.v5 -text "phase1geo@gmail.com"
3868  ttk::label .aboutwin.f.if.l6 -text "Twitter:"
3869  ttk::label .aboutwin.f.if.v6 -text "@TkeTextEditor"
3870  ttk::label .aboutwin.f.if.l7 -text "Website:"
3871  ttk::label .aboutwin.f.if.v7 -text "http://tke.sourceforge.net"
3872 
3873  bind .aboutwin.f.if.v2 <Enter> [list %W configure -cursor [ttk::cursor link]]
3874  bind .aboutwin.f.if.v2 <Leave> [list %W configure -cursor [ttk::cursor standard]]
3875  bind .aboutwin.f.if.v2 <Button-1> {
3876  destroy .aboutwin
3877  gui::add_file end [file join $::tke_dir LICENSE] -sidebar 0 -readonly 1
3878  }
3879  bind .aboutwin.f.if.v5 <Enter> [list %W configure -cursor [ttk::cursor link]]
3880  bind .aboutwin.f.if.v5 <Leave> [list %W configure -cursor [ttk::cursor standard]]
3881  bind .aboutwin.f.if.v5 <Button-1> [list utils::open_file_externally {mailto:phase1geo@gmail.com} 1]
3882  bind .aboutwin.f.if.v6 <Enter> [list %W configure -cursor [ttk::cursor link]]
3883  bind .aboutwin.f.if.v6 <Leave> [list %W configure -cursor [ttk::cursor standard]]
3884  bind .aboutwin.f.if.v6 <Button-1> [list utils::open_file_externally {https://twitter.com/TkeTextEditor} 1]
3885  bind .aboutwin.f.if.v7 <Enter> [list %W configure -cursor [ttk::cursor link]]
3886  bind .aboutwin.f.if.v7 <Leave> [list %W configure -cursor [ttk::cursor standard]]
3887  bind .aboutwin.f.if.v7 <Button-1> [list utils::open_file_externally {http://tke.sourceforge.net} 1]
3888 
3889  grid .aboutwin.f.if.l0 -row 0 -column 0 -sticky news -padx 2 -pady 2
3890  grid .aboutwin.f.if.v0 -row 0 -column 1 -sticky news -padx 2 -pady 2
3891  grid .aboutwin.f.if.l1 -row 1 -column 0 -sticky news -padx 2 -pady 2
3892  grid .aboutwin.f.if.v1 -row 1 -column 1 -sticky news -padx 2 -pady 2
3893  grid .aboutwin.f.if.l2 -row 2 -column 0 -sticky news -padx 2 -pady 2
3894  grid .aboutwin.f.if.v2 -row 2 -column 1 -sticky news -padx 2 -pady 2
3895  grid .aboutwin.f.if.l3 -row 3 -column 0 -sticky news -padx 2 -pady 2
3896  grid .aboutwin.f.if.v3 -row 3 -column 1 -sticky news -padx 2 -pady 2
3897  grid .aboutwin.f.if.l4 -row 4 -column 0 -sticky news -padx 2 -pady 2
3898  grid .aboutwin.f.if.v4 -row 4 -column 1 -sticky news -padx 2 -pady 2
3899  grid .aboutwin.f.if.l5 -row 5 -column 0 -sticky news -padx 2 -pady 2
3900  grid .aboutwin.f.if.v5 -row 5 -column 1 -sticky news -padx 2 -pady 2
3901  grid .aboutwin.f.if.l6 -row 6 -column 0 -sticky news -padx 2 -pady 2
3902  grid .aboutwin.f.if.v6 -row 6 -column 1 -sticky news -padx 2 -pady 2
3903  grid .aboutwin.f.if.l7 -row 7 -column 0 -sticky news -padx 2 -pady 2
3904  grid .aboutwin.f.if.v7 -row 7 -column 1 -sticky news -padx 2 -pady 2
3905 
3906  ttk::frame .aboutwin.f.cf
3907  ttk::label .aboutwin.f.cf.l -text [msgcat::mc "Credits"] -anchor center
3908  ttk::separator .aboutwin.f.cf.sep1 -orient horizontal
3909  # ttk::labelframe .aboutwin.f.cf -text [msgcat::mc "Credits"] -labelanchor n
3910  set txt [text .aboutwin.f.cf.t -wrap word -height 5 -relief flat -highlightthickness 0 \
3911  -font "TkDefaultFont" -width 80 \
3912  -background [utils::get_default_background] \
3913  -foreground [utils::get_default_foreground] \
3914  -yscrollcommand { utils::set_yscrollbar .aboutwin.f.cf.vb }]
3915  scroller::scroller .aboutwin.f.cf.vb -orient vertical -command { .aboutwin.f.cf.t yview }
3916  ttk::separator .aboutwin.f.cf.sep2 -orient horizontal
3917 
3918  # Register the widget for theming
3919  theme::register_widget .aboutwin.f.cf.vb misc_scrollbar
3920 
3921  grid rowconfigure .aboutwin.f.cf 2 -weight 1
3922  grid columnconfigure .aboutwin.f.cf 0 -weight 1
3923  grid .aboutwin.f.cf.l -row 0 -column 0 -sticky ew -columnspan 2 -padx 2 -pady 4
3924  grid .aboutwin.f.cf.sep1 -row 1 -column 0 -sticky ew -columnspan 2
3925  grid .aboutwin.f.cf.t -row 2 -column 0 -sticky news
3926  grid .aboutwin.f.cf.vb -row 2 -column 1 -sticky ns
3927  grid .aboutwin.f.cf.sep2 -row 3 -column 0 -sticky ew -columnspan 2
3928 
3929  ttk::button .aboutwin.f.credits -style BButton -text [msgcat::mc "Credits"] -command {
3930  if {[.aboutwin.f.credits cget -text] eq [msgcat::mc "Credits"]} {
3931  pack forget .aboutwin.f.if
3932  pack .aboutwin.f.cf -after .aboutwin.f.logo -padx 2 -pady 2 -fill both -expand yes
3933  .aboutwin.f.credits configure -text [msgcat::mc "Back"]
3934  } else {
3935  pack forget .aboutwin.f.cf
3936  pack .aboutwin.f.if -after .aboutwin.f.logo -padx 2 -pady 2
3937  .aboutwin.f.credits configure -text [msgcat::mc "Credits"]
3938  }
3939  }
3940  ttk::label .aboutwin.f.copyright -text [format "%s %d-%d" [msgcat::mc "Copyright"] 2013 18]
3941 
3942  pack .aboutwin.f.logo -padx 2 -pady 8 -anchor w
3943  pack .aboutwin.f.if -padx 2 -pady 2
3944  pack .aboutwin.f.credits -padx 2 -pady 2
3945  pack .aboutwin.f.copyright -padx 2 -pady 8
3946 
3947  pack .aboutwin.f -fill both -expand yes
3948 
3949  # Center the window in the editor window
3950  ::tk::PlaceWindow .aboutwin widget .
3951 
3952  # Add credit information
3953  $txt insert end "Special thanks to the following:\n\n"
3954  $txt insert end "\uff65 The " {} "filerunner" frlink " project for creating and sharing their FTP and SFTP codebase to make built-in remote file editing possible.\n\n" {}
3955  $txt insert end "\uff65 Dr. Casaba Nemethi for his full-featured " {} "tablelist" tllink " project.\n\n" {}
3956  $txt insert end "\uff65 Jean-Claude Wippler for his excellent webdav package.\n\n" {}
3957 
3958  $txt tag configure frlink -underline 1
3959  $txt tag bind frlink <Enter> [list $txt configure -cursor [ttk::cursor link]]
3960  $txt tag bind frlink <Leave> [list $txt configure -cursor [ttk::cursor standard]]
3961  $txt tag bind frlink <Button-1> [list utils::open_file_externally "http://filerunner.sourceforge.net"]
3962 
3963  $txt tag configure tllink -underline 1
3964  $txt tag bind tllink <Enter> [list $txt configure -cursor [ttk::cursor link]]
3965  $txt tag bind tllink <Leave> [list $txt configure -cursor [ttk::cursor standard]]
3966  $txt tag bind tllink <Button-1> [list utils::open_file_externally "http://www.nemethi.de"]
3967 
3968  # Make sure that the user cannot change the text.
3969  $txt configure -state disabled
3970 
3971  wm withdraw .aboutwin
3972  update
3973 
3974  set x [expr [winfo reqwidth .aboutwin.f.cf] + 4]
3975  # set x [expr max( [winfo reqwidth .aboutwin.f.logo], [winfo reqwidth .aboutwin.f.if], [winfo reqwidth .aboutwin.f.cf] ) + 4]
3976  set y [expr [winfo reqheight .aboutwin.f.logo] + [winfo reqheight .aboutwin.f.credits] + [winfo reqheight .aboutwin.f.copyright] + 40]
3977  incr y [winfo reqheight .aboutwin.f.if]
3978  wm geometry .aboutwin ${x}x${y}
3979  wm deiconify .aboutwin
3980 
3981  }

§ show_all()

gui::show_all

Definition at line 2799 of file gui.tcl.

2799  proc show_all {} {
2800 
2801  foreach tab [files::get_tabs] {
2802  show_tab $tab
2803  }
2804 
2805  }

§ show_birdseye()

gui::show_birdseye   tab  

Definition at line 4784 of file gui.tcl.

4784  proc show_birdseye {tab} {
4785 
4786  variable be_after_id
4787  variable be_ignore
4788 
4789  # Get the tab that contains the text widget
4790  get_info $tab tab txt beye
4791 
4792  if {![winfo exists $beye]} {
4793 
4794  # Calculate the background color
4795  set background [utils::auto_adjust_color [$txt cget -background] 25]
4796 
4797  # Create the bird's eye viewer
4798  $txt._t peer create $beye -width [preferences::get View/BirdsEyeViewWidth] -bd 0 \
4799  -highlightthickness 0 -font "-size [preferences::get View/BirdsEyeViewFontSize]" \
4800  -wrap none -cursor [ttk::cursor standard] \
4801  -background [$txt cget -background] -foreground [$txt cget -foreground] \
4802  -inactiveselectbackground $background -selectbackground $background
4803 
4804  # Add the bird's eye viewer to the tab's grid manager
4805  grid $beye -row 0 -column 1 -sticky ns
4806 
4807  # Setup bindings
4808  bind $beye <Enter> [list gui::handle_birdseye_enter %W $txt %m]
4809  bind $beye <Leave> [list gui::handle_birdseye_leave %W %m]
4810  bind $beye <ButtonPress-1> [list gui::handle_birdseye_left_press %W %x %y $tab $txt]
4811  bind $beye <B1-Motion> [list gui::handle_birdseye_motion %W %x %y $tab $txt]
4812  bind $beye <Control-Button-1> [list gui::handle_birdseye_control_left %W]
4813  bind $beye <Control-Button-$::right_click> [list gui::handle_birdseye_control_right %W]
4814  bind $beye <MouseWheel> [bind Text <MouseWheel>]
4815  bind $beye <Button-4> [bind Text <Button-4>]
4816  bind $beye <Button-5> [bind Text <Button-5>]
4817 
4818  set index [lsearch [bindtags $beye] "Text"]
4819  bindtags $beye [lreplace [bindtags $beye] $index $index]
4820 
4821  set be_after_id($tab) ""
4822  set be_ignore($tab) 0
4823 
4824  # Make sure that the bird's eye viewer is below any lower panel
4825  lower $beye
4826 
4827  }
4828 
4829  }

§ show_console_view()

gui::show_console_view

Definition at line 928 of file gui.tcl.

928  proc show_console_view {} {
929 
930  if {[catch { tkcon show}]} {
931  catch { console show}
932  }
933 
934  }

§ show_current_in_sidebar()

gui::show_current_in_sidebar

Definition at line 3470 of file gui.tcl.

3470  proc show_current_in_sidebar {} {
3471 
3472  get_info {} current fname remote
3473 
3474  # Display the file in the sidebar
3475  sidebar::view_file $fname $remote
3476 
3477  }

§ show_current_tab()

gui::show_current_tab   tabbar  

Definition at line 5426 of file gui.tcl.

5426  proc show_current_tab {tabbar} {
5427 
5428  variable widgets
5429  variable pw_current
5430  variable auto_cwd
5431 
5432  # Get the frame containing the text widget
5433  set tf [winfo parent [winfo parent $tabbar]].tf
5434 
5435  # If the current tabbar contains no visible tabs, remove the editing frame
5436  if {[$tabbar select] eq ""} {
5437  if {[set slave [pack slaves $tf]] ne ""} {
5438  pack forget $slave
5439  }
5440  return
5441  }
5442 
5443  # Get the current information
5444  get_info $tabbar tabbar tab paneindex fname buffer diff
5445 
5446  # If nothing is changing, stop now
5447  if {($pw_current eq $paneindex) && ([pack slaves $tf] eq $tab)} {
5448  return
5449  }
5450 
5451  # Update the current panedwindow indicator
5452  set pw_current $paneindex
5453 
5454  # Add the tab content, if necessary
5455  add_tab_content $tab
5456 
5457  # Remove the current tab frame (if it exists)
5458  if {[set slave [pack slaves $tf]] ne ""} {
5459  pack forget $slave
5460  }
5461 
5462  # Display the tab frame
5463  pack [$tabbar select] -in $tf -fill both -expand yes
5464 
5465  # Update the pane synchronization status
5467 
5468  # Update the preferences
5470 
5471  # Reload the snippets to correspond to the current file
5473 
5474  # Update the encoding indicator
5476 
5477  # Update the indentation indicator
5478  indent::update_button $widgets(info_indent)
5479 
5480  # Set the syntax menubutton to the current language
5481  syntax::update_button $widgets(info_syntax)
5482 
5483  # If we are supposed to automatically change the working directory, do it now
5484  if {$auto_cwd && !$buffer && !$diff} {
5485  cd [file dirname $fname]
5486  }
5487 
5488  # Make sure that the title bar is updated
5489  set_title
5490 
5491  # Set the text focus
5493 
5494  }

§ show_difference_line_change()

gui::show_difference_line_change   show  

Definition at line 6251 of file gui.tcl.

6251  proc show_difference_line_change {show} {
6252 
6253  # Get the current information
6254  get_info {} current txt fname
6255 
6256  if {[$txt cget -diff_mode] && ![catch { $txt index sel.first} rc]} {
6257  if {$show} {
6258  diff::find_current_version $txt $fname [lindex [split $rc .] 0]
6259  }
6260  return 1
6261  }
6262 
6263  return 0
6264 
6265  }

§ show_files()

gui::show_files   indices  

Definition at line 2788 of file gui.tcl.

2788  proc show_files {indices} {
2789 
2790  # Make sure that all specified files are shown
2791  foreach index [lsort -decreasing $indices] {
2792  show_tab [get_info $index fileindex tab]
2793  }
2794 
2795  }

§ show_match_pair()

gui::show_match_pair

Definition at line 5740 of file gui.tcl.

5740  proc show_match_pair {} {
5741 
5742  # Get the current widget
5743  set txt [current_txt]
5744 
5745  # If we are escaped or in a comment/string, we should not match
5746  if {[$txt is escaped insert] || [$txt is incommentstring insert]} {
5747  return
5748  }
5749 
5750  # If the current character is a matchable character, change the
5751  # insertion cursor to the matching character.
5752  switch -- [$txt get insert] {
5753  "\{" { set index [ctext::getMatchBracket $txt curlyR]}
5754  "\}" { set index [ctext::getMatchBracket $txt curlyL]}
5755  "\[" { set index [ctext::getMatchBracket $txt squareR]}
5756  "\]" { set index [ctext::getMatchBracket $txt squareL]}
5757  "\(" { set index [ctext::getMatchBracket $txt parenR]}
5758  "\)" { set index [ctext::getMatchBracket $txt parenL]}
5759  "<" { set index [ctext::getMatchBracket $txt angledR]}
5760  ">" { set index [ctext::getMatchBracket $txt angledL]}
5761  "\"" { set index [find_match_char $txt "\"" [expr {([lsearch [$txt tag names insert-1c] __dQuote*] == -1) ? "-forwards" : "-backwards"}]]}
5762  "'" { set index [find_match_char $txt "'" [expr {([lsearch [$txt tag names insert-1c] __sQuote*] == -1) ? "-forwards" : "-backwards"}]]}
5763  "`" { set index [find_match_char $txt "`" [expr {([lsearch [$txt tag names insert-1c] __bQuote*] == -1) ? "-forwards" : "-backwards"}]]}
5764  default { set index [find_match_pair $txt {*}[lrange [syntax::get_indentation_expressions $txt] 0 1] -backwards]}
5765  }
5766 
5767  # Change the insertion cursor to the matching character
5768  if {($index ne "") && ($index != -1)} {
5769  ::tk::TextSetCursor $txt.t $index
5770  }
5771 
5772  }

§ show_sidebar_view()

gui::show_sidebar_view

Definition at line 908 of file gui.tcl.

908  proc show_sidebar_view {} {
909 
910  variable widgets
911 
912  $widgets(pw) insert 0 $widgets(sb)
913 
914  }

§ show_split_pane()

gui::show_split_pane   tab  

Definition at line 4648 of file gui.tcl.

4648  proc show_split_pane {tab} {
4649 
4650  variable show_match_chars
4651 
4652  # Get the current paned window
4653  get_info $tab tab tabbar txt txt2 diff
4654 
4655  # Get the paned window of the text widget
4656  set pw [winfo parent [winfo parent $txt]]
4657 
4658  # Get the scrollbar coloring information
4659  array set sb_opts [set scrollbar_opts [theme::get_category_options text_scrollbar 1]]
4660 
4661  # Create the editor frame
4662  $pw insert 0 [frame $pw.tf2 -background $sb_opts(-background)]
4663  ctext $txt2 -wrap none -undo 1 -autoseparators 1 -insertofftime 0 -font editor_font \
4664  -insertwidth [preferences::get Appearance/CursorWidth] \
4665  -spacing2 [preferences::get Appearance/ExtraLineSpacing] \
4666  -spacing3 [preferences::get Appearance/ExtraLineSpacing] \
4667  -highlightcolor orange -warnwidth [preferences::get Editor/WarningWidth] \
4668  -maxundo [preferences::get Editor/MaxUndo] -matchchar $show_match_chars \
4669  -matchaudit [preferences::get Editor/HighlightMismatchingChar] \
4670  -linemap [preferences::get View/ShowLineNumbers] -linemap_separator 1 \
4671  -linemap_mark_command [list gui::mark_command $tab] -linemap_mark_color orange -peer $txt \
4672  -linemap_align [preferences::get Editor/LineNumberAlignment] \
4673  -xscrollcommand "$pw.tf2.hb set" \
4674  -yscrollcommand "$pw.tf2.vb set"
4675  scroller::scroller $pw.tf2.hb {*}$scrollbar_opts -orient horizontal -autohide 0 -command "$txt2 xview"
4676  scroller::scroller $pw.tf2.vb {*}$scrollbar_opts -orient vertical -autohide 1 -command "$txt2 yview" \
4677  -markcommand1 [list markers::get_positions $tab] -markhide1 [expr [preferences::get View/ShowMarkerMap] ^ 1] \
4678  -markcommand2 [expr {$diff ? [list diff::get_marks $txt] : ""}]
4679 
4680  # Update the widgets to match the current theme
4681  update_theme $txt2
4682 
4683  # Register the widgets
4684  theme::register_widget $txt2 syntax_split
4685  theme::register_widget $pw.tf2.vb text_scrollbar
4686  theme::register_widget $pw.tf2.hb text_scrollbar
4687 
4688  bind $txt2.t <FocusIn> [list +gui::handle_txt_focus %W]
4689  bind $txt2.t <<CursorChanged>> [list +gui::update_position $txt2]
4690  bind $txt2.l <ButtonPress-1> [list gui::select_line %W %x %y]
4691  bind $txt2.l <B1-Motion> [list gui::select_lines %W %x %y]
4692  bind $txt2.l <Shift-ButtonPress-1> [list gui::select_lines %W %x %y]
4693  bind $txt2 <<Selection>> [list gui::selection_changed $txt2]
4694  bind $txt2 <Motion> [list gui::clear_tab_tooltip $tabbar]
4695 
4696  # Move the all bindtag ahead of the Text bindtag
4697  set text_index [lsearch [bindtags $txt2.t] Text]
4698  set all_index [lsearch [bindtags $txt2.t] all]
4699  bindtags $txt2.t [lreplace [bindtags $txt2.t] $all_index $all_index]
4700  bindtags $txt2.t [linsert [bindtags $txt2.t] $text_index all]
4701 
4702  grid rowconfigure $pw.tf2 0 -weight 1
4703  grid columnconfigure $pw.tf2 0 -weight 1
4704  grid $pw.tf2.txt -row 0 -column 0 -sticky news
4705  grid $pw.tf2.vb -row 0 -column 1 -sticky ns
4706  grid $pw.tf2.hb -row 1 -column 0 -sticky ew
4707 
4708  # Associate the existing command entry field with this text widget
4709  vim::bind_command_entry $txt2 $tab.ve
4710 
4711  # Add the text bindings
4712  indent::add_bindings $txt2
4713  vim::set_vim_mode $txt2
4717  make_drop_target $txt2 text
4718 
4719  # Apply the appropriate syntax highlighting for the given extension
4721 
4722  # Snippet bindings must go after syntax language is set
4724 
4725  # Apply code foldings
4726  folding::initialize $txt2
4727 
4728  # Give the text widget the focus
4729  set_txt_focus $txt2
4730 
4731  }

§ show_status_view()

gui::show_status_view

Definition at line 976 of file gui.tcl.

976  proc show_status_view {} {
977 
978  variable widgets
979 
980  catch { grid $widgets(info)}
981 
982  update idletasks
983 
984  }

§ show_tab()

gui::show_tab   tab  

Definition at line 2734 of file gui.tcl.

2734  proc show_tab {tab} {
2735 
2736  variable widgets
2737 
2738  # Get the current tabbar
2739  get_info $tab tab tabbar fname remote
2740 
2741  # Show the tab
2742  $tabbar tab $tab -state normal
2743 
2744  # Make sure the sidebar is updated properly
2745  sidebar::set_hide_state $fname $remote 0
2746 
2747  # Update ourselves to reflect the current tab show in the tabbar
2748  show_current_tab $tabbar
2749 
2750  }

§ show_tab_view()

gui::show_tab_view

Definition at line 948 of file gui.tcl.

948  proc show_tab_view {} {
949 
950  variable widgets
951 
952  foreach nb [$widgets(nb_pw) panes] {
953  if {[lsearch [pack slaves $nb] $nb.tbf] == -1} {
954  pack $nb.tbf -before $nb.tf -fill x
955  }
956  }
957 
958  }

§ show_tabs()

gui::show_tabs   tb side  

Definition at line 5916 of file gui.tcl.

5916  proc show_tabs {tb side} {
5917 
5918  # If the tabbar is disabled, don't show the tab menu
5919  if {[$tb cget -state] eq "disabled"} {
5920  return
5921  }
5922 
5923  set mnu $tb.mnu
5924 
5925  # Get the shown tabs
5926  set shown [$tb xview shown]
5927  lset shown 1 [expr [lindex $shown 1] + 1]
5928 
5929  # Clear the menu
5930  $mnu delete 0 end
5931 
5932  set i 0
5933  foreach tab [$tb tabs] {
5934  if {[lindex $shown 0] == $i} {
5935  if {$i > 0} {
5936  $mnu add separator
5937  }
5938  set shown [lassign $shown tmp]
5939  }
5940  set tab_image [$tb tab $tab -image]
5941  set img [expr {($tab_image ne "") ? "menu_[string range $tab_image 4 end]" : ""}]
5942  $mnu add command -compound left -image $img -label [$tb tab $tab -text] \
5943  -command [list gui::set_current_tab $tb $tab]
5944  incr i
5945  }
5946 
5947  # Figure out where to display the menu
5948  if {$side eq "right"} {
5949  set x [expr ([winfo rootx $tb] + [winfo width $tb]) - [winfo reqwidth $mnu]]
5950  } else {
5951  set x [winfo rootx $tb]
5952  }
5953  set y [expr [winfo rooty $tb] + [winfo height $tb]]
5954 
5955  # Display the menu
5956  tk_popup $mnu $x $y
5957 
5958  }

§ sort_tabs()

gui::sort_tabs

Definition at line 2810 of file gui.tcl.

2810  proc sort_tabs {} {
2811 
2812  variable widgets
2813 
2814  foreach nb [$widgets(nb_pw) panes] {
2815 
2816  get_info $nb pane tabbar tab
2817 
2818  # Get the list of opened tabs
2819  set tabs [list]
2820  foreach atab [$tabbar tabs] {
2821  set fullname [$tabbar tab $atab -text]
2822  regexp {(\S+)$} $fullname -> name
2823  lappend tabs [list $name $fullname $atab]
2824  $tabbar delete $atab
2825  }
2826 
2827  # Sort the tabs by alphabetical order and move them
2828  foreach atab [lsort -index 0 $tabs] {
2829  lassign $atab name fullname tabid
2830  $tabbar insert end $tabid -text $fullname -emboss 0
2831  }
2832 
2833  # Reset the current tab
2834  $tabbar select $tab
2835 
2836  }
2837 
2838  }

§ sync_birdseye()

gui::sync_birdseye   tab top  

Definition at line 1486 of file gui.tcl.

1486  proc sync_birdseye {tab top} {
1487 
1488  variable be_after_id
1489  variable be_ignore
1490 
1491  # If bird's eye view is not enabled, exit immediately
1492  if {![info exists be_after_id($tab)]} {
1493  return
1494  }
1495 
1496  if {$be_after_id($tab) ne ""} {
1497  after cancel $be_after_id($tab)
1498  }
1499 
1500  if {$be_ignore($tab) == 0} {
1501  set be_after_id($tab) [after 50 [list gui::sync_birdseye_helper $tab $top]]
1502  }
1503 
1504  set be_ignore($tab) 0
1505 
1506  }

§ sync_birdseye_helper()

gui::sync_birdseye_helper   tab top  

Definition at line 1471 of file gui.tcl.

1471  proc sync_birdseye_helper {tab top} {
1472 
1473  variable be_after_id
1474 
1475  # Get the current tab
1476  if {[winfo exists [get_info $tab tab beye]]} {
1477  $beye yview moveto $top
1478  }
1479 
1480  set be_after_id($tab) ""
1481 
1482  }

§ sync_scroll()

gui::sync_scroll   txt yscroll  

Definition at line 1440 of file gui.tcl.

1440  proc sync_scroll {txt yscroll} {
1441 
1442  variable synced
1443  variable synced_key
1444  variable synced_count
1445  variable synced_txt
1446 
1447  # If we are not currently synced, return now
1448  if {($synced_key eq "") || (($synced_txt ne $txt) && ($synced_txt ne ""))} {
1449  set synced_txt ""
1450  return
1451  }
1452 
1453  set top [$txt index @0,0]
1454  lassign $synced_key txt0 txt1
1455  lassign $synced($synced_key) top0 top1
1456 
1457  if {$txt eq $txt0} {
1458  set line_diff [$txt count -lines $top0 $top]
1459  align_lines $txt0 $txt1 $top [$txt1 index "$top1+${line_diff}l"] 0
1460  } else {
1461  set line_diff [$txt count -lines $top1 $top]
1462  align_lines $txt1 $txt0 $top [$txt0 index "$top0+${line_diff}l"] 0
1463  }
1464 
1465  set synced_txt $txt
1466 
1467  }

§ tabs_in_pane()

gui::tabs_in_pane

Definition at line 1336 of file gui.tcl.

1336  proc tabs_in_pane {} {
1337 
1338  return [llength [[get_info {} current tabbar] tabs]]
1339 
1340  }

§ text_changed()

gui::text_changed   txt data  

Definition at line 5262 of file gui.tcl.

5262  proc text_changed {txt data} {
5263 
5264  variable cursor_hist
5265 
5266  if {[$txt edit modified]} {
5267 
5268  # Get file information
5269  get_info $txt txt tabbar tab fileindex readonly
5270 
5271  if {!$readonly && ([lindex $data 2] ne "ignore")} {
5273  }
5274 
5275  # Clear the cursor history
5276  array unset cursor_hist $txt,*
5277 
5278  }
5279 
5280  # Update the folding gutter
5281  if {[lindex $data 2] ne "ignore"} {
5282  foreach {startpos endpos} [lindex $data 1] {
5283  folding::add_folds $txt $startpos $endpos
5284  }
5285  }
5286 
5287  }

§ toggle_birdseye()

gui::toggle_birdseye

Definition at line 4025 of file gui.tcl.

4025  proc toggle_birdseye {} {
4026 
4027  get_info {} current tab beye
4028 
4029  if {[winfo exists $beye]} {
4030  hide_birdseye $tab
4031  } else {
4032  show_birdseye $tab
4033  }
4034 
4035  }

§ toggle_labelbutton()

gui::toggle_labelbutton   w  

Definition at line 821 of file gui.tcl.

821  proc toggle_labelbutton {w} {
822 
823  if {[$w cget -relief] eq "raised"} {
824  $w configure -relief sunken
825  } else {
826  $w configure -relief raised
827  }
828 
829  }

§ toggle_split_pane()

gui::toggle_split_pane

Definition at line 4011 of file gui.tcl.

4011  proc toggle_split_pane {} {
4012 
4013  get_info {} current tab txt2
4014 
4015  if {[winfo exists $txt2]} {
4016  hide_split_pane $tab
4017  } else {
4018  show_split_pane $tab
4019  }
4020 
4021  }

§ undo()

gui::undo

Definition at line 2932 of file gui.tcl.

2932  proc undo {} {
2933 
2934  # Get the current textbox
2935  set txt [current_txt]
2936 
2937  # Perform the undo operation from Vim perspective
2938  vim::undo $txt.t
2939 
2940  }

§ undoable()

gui::undoable

Definition at line 2944 of file gui.tcl.

2944  proc undoable {} {
2945 
2946  # Get the current textbox
2947  set txt [current_txt]
2948 
2949  return [$txt edit undoable]
2950 
2951  }

§ untitled_check()

gui::untitled_check

Definition at line 1616 of file gui.tcl.

1616  proc untitled_check {} {
1617 
1618  variable widgets
1619 
1620  if {[files::get_file_num] == 1} {
1621  get_info {} current fname buffer txt
1622  if {($fname eq "Untitled") && $buffer && ([vim::get_cleaned_content $txt] eq "")} {
1623  return 1
1624  }
1625  }
1626 
1627  return 0
1628 
1629  }

§ update_current()

gui::update_current

Definition at line 2107 of file gui.tcl.

2107  proc update_current {} {
2108 
2109  get_info {} current fileindex tab
2110 
2111  # Update the file
2112  update_file $fileindex
2113 
2114 
2115 
2116  }

§ update_encode_button()

gui::update_encode_button

Definition at line 6045 of file gui.tcl.

6045  proc update_encode_button {} {
6046 
6047  variable widgets
6048  variable current_encoding
6049 
6050  # Get the current encoding
6051  get_info {} current encode
6052 
6053  set current_encoding $encode
6054 
6055  # Update the encode button
6056  $widgets(info_encode) configure -text [string toupper $encode]
6057 
6058  }

§ update_file()

gui::update_file   file_index  

Definition at line 2044 of file gui.tcl.

2044  proc update_file {file_index} {
2045 
2046  variable undo_count
2047 
2048  # Get the file information
2049  get_info $file_index fileindex tabbar tab txt fname diff lock remote
2050 
2051  # If the editor is a difference view and is not updateable, stop now
2052  if {$diff && ![diff::updateable $txt]} {
2053  return
2054  }
2055 
2056  # Get the current insertion index
2057  set insert_index [$txt index insert]
2058 
2059  # Delete the text widget
2060  $txt configure -state normal
2061  $txt delete 1.0 end
2062 
2063  if {[files::get_file $tab contents]} {
2064 
2065  # Updat the highlightability attribute of the text widget
2066  check_highlightable $txt $contents
2067 
2068  # Read the file contents and insert them
2069  $txt insert end $contents
2070 
2071  # Change the tab text
2072  $tabbar tab $tab -text " [file tail $fname]"
2073 
2074  # Update the title bar (if necessary)
2075  set_title
2076 
2077  # Change the text to unmodified
2078  $txt edit reset
2079  set undo_count($txt) 0
2080  files::set_info $file_index fileindex modified 0
2081 
2082  # Set the insertion mark to the first position
2083  ::tk::TextSetCursor $txt.t $insert_index
2084  if {[vim::in_vim_mode $txt.t]} {
2085  vim::adjust_insert $txt.t
2086  }
2087 
2088  # If a diff command was specified, run and parse it now
2089  if {$diff} {
2090  diff::show $txt
2091  }
2092 
2093  # Allow plugins to be run on update
2094  plugins::handle_on_update $file_index
2095 
2096  }
2097 
2098  # If we are locked, set our state back to disabled
2099  if {$lock} {
2100  $txt configure -state disabled
2101  }
2102 
2103  }

§ update_indent_button()

gui::update_indent_button

Definition at line 5964 of file gui.tcl.

5964  proc update_indent_button {} {
5965 
5966  variable widgets
5967 
5968  indent::update_button $widgets(info_indent)
5969 
5970  }

§ update_position()

gui::update_position   txt  

Definition at line 5530 of file gui.tcl.

5530  proc update_position {txt} {
5531 
5532  variable widgets
5533 
5534  # Get the current position of the insertion cursor
5535  lassign [split [$txt index insert] .] line column
5536 
5537  # Update the information widgets
5538  if {[set vim_mode [expr {[select::in_select_mode $txt.t stype] ? "[string toupper $stype] SELECT MODE" : [vim::get_mode $txt]}]] ne ""} {
5539  if {$vim_mode eq "MULTIMOVE MODE"} {
5540  $widgets(info_state) configure -text [format "%s" $vim_mode]
5541  } else {
5542  $widgets(info_state) configure -text [format "%s, %s: %d, %s: %d" $vim_mode [msgcat::mc "Line"] $line [msgcat::mc "Column"] [expr $column + 1]]
5543  }
5544  } else {
5545  $widgets(info_state) configure -text [format "%s: %d, %s: %d" [msgcat::mc "Line"] $line [msgcat::mc "Column"] [expr $column + 1]]
5546  }
5547 
5548  }

§ update_search_method()

gui::update_search_method   tab  

Definition at line 3125 of file gui.tcl.

3125  proc update_search_method {tab} {
3126 
3127  variable search_method
3128 
3129  switch $search_method {
3130  glob { set lbl [msgcat::mc "Glob"]}
3131  exact { set lbl [msgcat::mc "Exact"]}
3132  default { set lbl [msgcat::mc "Regexp"]}
3133  }
3134 
3135  # Update the labels
3136  $tab.sf.type configure -text $lbl
3137  $tab.rf.opts.type configure -text $lbl
3138 
3139  # If the find field for the given search type is not an empty string, perform the
3140  # search with the new search method
3141  if {[winfo ismapped $tab.sf]} {
3142  search::find_resilient "next" "find"
3143  } elseif {[winfo ismapped $tab.rf]} {
3144  search::find_resilient "next" "replace"
3145  }
3146 
3147  }

§ update_tab()

gui::update_tab   tab  

Definition at line 1025 of file gui.tcl.

1025  proc update_tab {tab} {
1026 
1027  get_info $tab tab tabbar fname
1028 
1029  # Update the tab name
1030  $tabbar tab $tab -text " [file tail $fname]"
1031 
1032  # Update the title if necessary
1033  set_title
1034 
1035  }

§ update_tab_markers()

gui::update_tab_markers   tab  

Definition at line 5878 of file gui.tcl.

5878  proc update_tab_markers {tab} {
5879 
5880  # Get the pathname of txt and txt2 from the given tab
5881  get_info $tab tab txt txt2
5882 
5883  # The txt widget will always exist, so update it now
5885  scroller::update_markers [winfo parent $txt].vb
5886 
5887  # If the split view widget exists, update it as well
5888  if {[winfo exists $txt2]} {
5889  ctext::linemapUpdate $txt2
5890  scroller::update_markers [winfo parent $txt2].vb
5891  }
5892 
5893  }

§ update_theme()

gui::update_theme   txt  

Definition at line 6377 of file gui.tcl.

6377  proc update_theme {txt} {
6378 
6379  # Get the current syntax theme
6380  array set theme [theme::get_syntax_colors]
6381  array set stheme [theme::get_category_options text_scrollbar 1]
6382 
6383  [winfo parent $txt] configure -background $stheme(-background)
6384 
6385  # Set the text background color to the current theme
6386  $txt configure -background $theme(background) -foreground $theme(foreground) \
6387  -selectbackground $theme(select_background) -selectforeground $theme(select_foreground) \
6388  -insertbackground $theme(cursor) -highlightcolor $theme(border_highlight) \
6389  -linemapbg $theme(linemap) -linemapfg $theme(line_number) \
6390  -linemap_mark_color $theme(marker) -linemap_separator_color $theme(linemap_separator) \
6391  -warnwidth_bg $theme(warning_width) -relief flat \
6392  -diffaddbg $theme(difference_add) -diffsubbg $theme(difference_sub) \
6393  -matchchar_fg $theme(background) -matchchar_bg $theme(foreground) \
6394  -matchaudit_bg $theme(attention) -theme [array get theme]
6395 
6396  catch {
6397 
6398  # If the bird's eye view exists, update it
6399  get_info $txt txt beye
6400 
6401  if {[winfo exists $beye]} {
6402 
6403  # Calculate the background color
6404  set background [utils::auto_adjust_color [$txt cget -background] 25]
6405 
6406  # Create the bird's eye viewer
6407  $beye configure -background $theme(background) -foreground $theme(foreground) \
6408  -inactiveselectbackground $background -selectbackground $background
6409 
6410  }
6411 
6412  }
6413 
6414  }

§ yscrollcommand()

gui::yscrollcommand   tab txt vb args  

Definition at line 1529 of file gui.tcl.

1529  proc yscrollcommand {tab txt vb args} {
1530 
1531  # Set the vertical scrollbar position
1532  $vb set {*}$args
1533 
1534  # Set birdseye view
1535  sync_birdseye $tab [lindex $args 0]
1536 
1537  # Perform sync scrolling, if necessary
1538  sync_scroll $txt 1
1539 
1540  }

§ yview()

gui::yview   tab txt args  

Definition at line 1511 of file gui.tcl.

1511  proc yview {tab txt args} {
1512 
1513  # Return the yview information
1514  if {[llength $args] == 0} {
1515  return [$txt yview]
1516 
1517  # Otherwise, set the yview given the arguments
1518  } else {
1519  $txt yview {*}$args
1520  sync_birdseye $tab [lindex $args 1]
1521  sync_scroll $txt 0
1522  }
1523 
1524  }