📄 multiview.tcl
字号:
-command " ${this} file_print " balloon_bind_info ${FindEditFr}.print [get_indep String\ PrintFile] pack ${FindEditFr}.print -side left } #undo button ${FindEditFr}.undo -takefocus 0 -image undo_image\ -command " ${this} edit_undo " balloon_bind_info ${FindEditFr}.undo [get_indep String EditUndoINFO] pack ${FindEditFr}.undo -side left #delete button ${FindEditFr}.delete -takefocus 0 -image waste_image\ -command " ${this} edit_delete " balloon_bind_info ${FindEditFr}.delete [get_indep String\ EINFODeleteSection] pack ${FindEditFr}.delete -side left #cut button ${FindEditFr}.cut -takefocus 0 -image cut_image -command\ " ${this} edit_cut " balloon_bind_info ${FindEditFr}.cut [get_indep String\ EINFOCutSelection] pack ${FindEditFr}.cut -side left #copy button ${FindEditFr}.copy -takefocus 0 -image copy_image\ -command " ${this} edit_copy " balloon_bind_info ${FindEditFr}.copy [get_indep String\ EINFOCopySelection] pack ${FindEditFr}.copy -side left #paste button ${FindEditFr}.paste -takefocus 0 -image paste_image\ -command " ${this} edit_paste " balloon_bind_info ${FindEditFr}.paste [get_indep String\ EINFOPasteSelection] pack ${FindEditFr}.paste -side left #compile button ${FindEditFr}.compile -takefocus 0 -image compile_image\ -command " ${this} do_compile_file " balloon_bind_info ${FindEditFr}.compile [get_indep String\ CompileINFO] pack ${FindEditFr}.compile -side left } #combobox for the find command, do not use filter Combo& ${FindEditFr}.find_hist -width 16 \ -entryballoon [get_indep String EINFOEnterPattern]\ -buttonballoon [get_indep String EINFOSearchHistory]\ -selectcommand "${this} toolbar_findtext ${FindEditFr}.find_hist"\ -postcommand "${this} toolbar_findtext_postcommand\ ${FindEditFr}.find_hist" set FindCombo ${FindEditFr}.find_hist bind ${FindEditFr}.find_hist.entry <Control-f>\ [bind ${FindEditFr}.find_hist.entry <Return>] bind ${FindEditFr}.find_hist.entry <F3>\ [bind ${FindEditFr}.find_hist.entry <Return>] pack ${FindEditFr}.find_hist -side left #button to find next/selected entry button ${FindEditFr}.find -takefocus 0 -image find_image -command\ " ${this} toolbar_search_pattern " balloon_bind_info ${FindEditFr}.find [get_indep String\ SearchFindSelectionINFO] pack ${FindEditFr}.find -side left #some free space pack [frame ${FindEditFr}.gap -width 5] -side left #Retriever button ${FindEditFr}.definition -takefocus 0 -image search_image\ -command " ${this} toolbar_retriever " bind_history ${FindEditFr}.definition retrieve balloon_bind_info ${FindEditFr}.definition [get_indep String\ RetrieverINFO] pack ${FindEditFr}.definition -side left #Grep button ${FindEditFr}.grep -takefocus 0 -image grep_image \ -command "${this} search_grep" bind_history ${FindEditFr}.grep grep balloon_bind_info ${FindEditFr}.grep [get_indep String INFOGrep] pack ${FindEditFr}.grep -side left #some free space pack [frame ${FindEditFr}.gap2 -width 5] -side left } method AddStatusbar {} { global sn_options itk_component add statusbar { frame $itk_component(hull).statusbar } #use the option flag itk_component add reuse { checkbutton $itk_component(statusbar).reuse\ -relief groove\ -text [get_indep String Reuse]\ -variable [itcl::scope reusable]\ -font $sn_options(def,layout-font) } balloon_bind_info $itk_component(reuse) [get_indep String ReusableINFO] pack $itk_component(reuse) -side left set reusable $sn_options(def,reuse-window) set keep $sn_options(def,window-switchable) itk_component add keep { checkbutton $itk_component(statusbar).keep\ -relief groove\ -text [get_indep String Keep]\ -variable [itcl::scope keep]\ -font $sn_options(def,layout-font) } balloon_bind_info $itk_component(keep) [get_indep String KeepINFO] pack $itk_component(keep) -side left itk_component add linenum { label $itk_component(statusbar).linenum\ -font $sn_options(def,layout-font)\ -relief groove -bd 2 -anchor e -width 8\ -textvar [itcl::scope linenum] } pack $itk_component(linenum) -fill y -side left # Create a frame with a groove and a border width of # 2 so that the message entry maintains the same look # that it had with earlier versions. This is needed # so that the file info can be anchored east so that # the file name still displays when the window is # too small to display the whole file name. set message_frame [frame $itk_component(statusbar).mf \ -relief groove -bd 2] itk_component add message { label $itk_component(statusbar).mf.message\ -font $sn_options(def,layout-font)\ -relief flat -bd 0 -anchor e \ -textvar [itcl::scope message] } pack $message_frame -expand y -fill both -side left pack $itk_component(message) -side left -anchor e pack $itk_component(statusbar) -side bottom -fill x } method file_post {m} { global sn_options global prj_lines_num #call post command for project menus ProjectMenuEntries_post ${m} "" .prjsub set fast_state normal set new_state normal set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { set state disabled set save_state disabled set fast_state disabled set rev_state disabled } else { set state normal if {[${ed} cget -file_changed]} { set save_state normal } else { set save_state disabled set fast_state disabled } #no revert for new files if {[${ed} cget -filename] == $sn_options(noname_file)} { set rev_state disabled } else { set rev_state ${state} } } #normal save is only possible, when no process is #running if {${save_state} == "normal" && [sn_processes_running]} { set save_state disabled } #we can't create/open files by readonly-project if {$sn_options(readonly)} { set new_state "disabled" } #file commands ${m} entryconfig [get_indep String EditNewFile] -state ${new_state} ${m} entryconfig [get_indep String Open] -state ${new_state} ${m} entryconfig [get_indep String EditSave] -state ${save_state} ${m} entryconfig [get_indep String EditSaveFileAs] -state ${state} ${m} entryconfig [get_indep String EditFastSave] -state ${fast_state} ${m} entryconfig [get_indep String Revert] -state ${rev_state} } proc post_recent_project {m topm pm} { #get file menu widget name set event_window [lmatch [winfo children [namespace tail ${topm}]]\ {*#menu}] set child [lindex [winfo children ${event_window}] 0] #Add menu entries for project history return [update_project_menu_list ${m} ${pm}] } proc update_project_menu_list {menu event_window} { global sn_options global sn_projects_list set pf $sn_projects_list(filename) if {[info exists sn_projects_list(mtime)] && $sn_projects_list(mtime)\ == [file mtime ${pf}] && ![catch {${menu} index {*1.*}}]} { return 0 } set exist_projs [sn_read_exist_projects 1] set proj_name $sn_options(sys,project-file) set off [lsearch -exact ${exist_projs} ${proj_name}] if {${off} != -1} { set exist_projs [lreplace ${exist_projs} ${off} ${off}] } # Lets create the menu labels! ${menu} delete 0 end set menu_proj "" set i 1 set idx 0 foreach pr ${exist_projs} { set lb [file tail ${pr}] if {${i} < 10} { ${menu} add command -label "${i}. ${lb}" -command\ [list sn_open_project ${pr}] -underline 0 } else { ${menu} add command -label "${i}. ${lb}" -command\ [list sn_open_project ${pr}] } menu_balloon_bind_info ${event_window} ${idx} ${pr} incr i incr idx } return [expr {${i} > 1}] } method file_new {} { if {${ActiveWidget} != $itk_component(editor)} { $itk_component(notebook) raise edit } [list_find_editor ${ActiveWidget}] new_file } method file_open {} { if {${ActiveWidget} != $itk_component(editor)} { $itk_component(notebook) raise edit } [list_find_editor ${ActiveWidget}] open_file } #Project callbacks proc file_open_project {} { sn_open_project } proc file_save_project {} { sn_save_project } proc delete_current_project {} { if {[sn_delete_current_project]} { sn_projectmanager delete_interp } } proc file_close_project {} { if {[sn_quit]} { sn_projectmanager delete_interp } } #Save managment method file_save {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} save_file } method file_saveas {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} saveas_file 0 [${ed} cget -filename] } method file_fastsave {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} fastsave_file } method file_saveall {} { Editor&::SaveAll } method file_revert {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} revert_file } method file_print {} { ${ActiveWidget} print } method edit_post {m} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { set state disabled set modstate disabled set dostate disabled } else { set state normal if {[${ed} canModify]} { set modstate normal } else { set modstate disabled } if {[${ed} cget -file_changed]} { set dostate normal } else { set dostate disabled } } ${m} entryconfig [get_indep String EditUndo] -state ${dostate} ${m} entryconfig [get_indep String EditRedo] -state ${dostate} ${m} entryconfig [get_indep String EditCut] -state ${modstate} ${m} entryconfig [get_indep String EditCopy] -state ${state} ${m} entryconfig [get_indep String EditPaste] -state ${modstate} ${m} entryconfig [get_indep String EditDelete] -state ${modstate} ${m} entryconfig [get_indep String SelectAll] -state ${state} ${m} entryconfig [get_indep String EditInsertFile] -state ${modstate} ${m} entryconfig [get_indep String EditIdent] -state ${modstate} ${m} entryconfig [get_indep String EditOutdent] -state ${modstate} } method edit_undo {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} Undo } method edit_redo {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} Redo } method edit_cut {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} Cut } method edit_copy {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} Copy } method edit_paste {} { set ed [list_find_editor ${ActiveWidget}] if {${ed} == ""} { bell return } ${ed} Paste }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -