⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 projedit.tcl

📁 This Source-Navigator, an IDE for C/C++/Fortran/Java/Tcl/PHP/Python and a host of other languages.
💻 TCL
📖 第 1 页 / 共 4 页
字号:
# Copyright (c) 2000, 2001, Red Hat, Inc.# # This file is part of Source-Navigator.# # Source-Navigator is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License as published# by the Free Software Foundation; either version 2, or (at your option)# any later version.# # Source-Navigator is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU# General Public License for more details.# # You should have received a copy of the GNU General Public License along# with Source-Navigator; see the file COPYING.  If not, write to# the Free Software Foundation, 59 Temple Place - Suite 330, Boston,# MA 02111-1307, USA.# #################################################### Window for project symbols##################################################itcl::class Project& {    inherit sourcenav::Window    constructor {args} {        global sn_options        global sn_newargs        set width 780        set height 580        withdraw        eval itk_initialize $args        ${this} on_close "${this} windows_close"        set Toolbar $itk_component(hull).exp        set Statusbar $itk_component(hull).msg        set Reuse $itk_component(hull).msg.reuse        #state for new project dependent widgets        if {$itk_option(-new_project)} {            set new_state normal            set exist_state disabled        } else {            set new_state disabled            set exist_state normal        }        AddToolbar        #AddMenu        AddStatusbar        #Field for project name        set sn_newargs(path) $sn_options(sys,project-file)        if {! [file exists $sn_newargs(path)] && [file exists\          $sn_newargs(path).proj]} {            set sn_newargs(path) $sn_newargs(path).proj        }        set prjname_Entry $itk_component(hull).prjname        LabelEntryButton& ${prjname_Entry} -text [get_indep String\          ProjectName] -underline [get_indep Pos ProjectName] -anchor nw\          -variable sn_newargs(path) -native 1 -buttonballoon\          [get_indep String ChooseINFO] -save_open "save"\          -defaultextension ".proj" -extensions $sn_options(project_extensions)        pack ${prjname_Entry} -side top -anchor nw -fill x -padx 5 -pady 5        ${prjname_Entry} configure -state ${new_state}        #frame for tree & Buttons        set treebtnsfr $itk_component(hull).treebtns        pack [frame ${treebtnsfr}] -side top -fill both -expand 1        #Tree frame        set treefr ${treebtnsfr}.tree        pack [frame ${treefr}] -side left -fill both -expand 1        #project views        set Views_Combo ${treefr}.views        Combo& ${Views_Combo} \          -label [get_indep String View] -entryvariable ${this}-view\          -selectcommand "${this} change_view ${Views_Combo}"\          -postcommand "${this} post_views ${Views_Combo}" -state ${exist_state}        pack ${Views_Combo} -side top -fill x        #Project tree        set tree ${treefr}.tree        set treew ${tree}.tree        Tree ${tree} -tabs {250 250} -tabsize 1 -labels {Name Directory}\          -indentwidth 20 -selectborderwidth 2 -fillcommand\          "${this} Display_ProjectFiles" -selectmode extended\          -font $sn_options(def,default-font)\          -selectforeground $sn_options(def,select-fg)\          -selectbackground $sn_options(def,select-bg) -plusimage plus_image\          -minusimage minus_image        #		-hiddenimage dir+_image        pack ${tree} -side top -fill both -expand 1        set treew [${tree} tree]        ${tree} treebind <1> "${this} tree_toggle %W %x %y"        ${tree} treebind <ButtonRelease-1> "${this} control_file_buttons"        ${tree} treebind <3> "focus %W; ${this} select_post_tree_menu %W %X %Y %y;\          break"        ${tree} treebind <Double-1> "${this} tree_edit_file %W"        ${tree} treebind <Return> "${this} tree_edit_file %W; break"        ${tree} treebind <space> "${this} tree_edit_file %W; break"        #Buttons frame        set btnsfr ${treebtnsfr}.btns        pack [frame ${btnsfr}] -side right -fill y -padx 5 -pady 5        #file commands frame        set filefr ${treebtnsfr}.btns.file        pack [frame ${filefr}] -side left -fill y -padx 5 -pady 5        #View button        button ${filefr}.view -text [get_indep String View]\          -underline [get_indep Pos View] -state disabled -command "${this} hide_view_unload_files View \[${treew} curselection\]"        balloon_bind_info ${filefr}.view [get_indep String ViewINFO]        #hide button        button ${filefr}.hide -text [get_indep String Hide]\          -underline [get_indep Pos Hide] -state disabled -command "${this} hide_view_unload_files Hide \[${treew} curselection\]"        balloon_bind_info ${filefr}.hide [get_indep String HideINFO]        #unload button        button ${filefr}.unload -text [get_indep String Unload]\          -underline [get_indep Pos Unload] -state disabled -command "${this} hide_view_unload_files Unload \[${treew} curselection\]"        balloon_bind_info ${filefr}.unload [get_indep String UnloadINFO]        #statistic button        button ${filefr}.stat -text [get_indep String Statistics]\          -underline [get_indep Pos Statistics] -state disabled -command "                ${this} disp_file_statistic \[${treew} curselection\]"        balloon_bind_info ${filefr}.stat [get_indep String StatisticsINFO]        foreach button {view hide unload stat} {            pack ${filefr}.${button} -side top -pady 3 -anchor nw -fill x        }        #project commands frame        set btnsfr ${treebtnsfr}.btns.prj        pack [frame ${btnsfr}] -side right -fill y -padx 5 -pady 5 -anchor ne        #Ok button        button ${btnsfr}.ok -text [get_indep String Ok] -underline\          [get_indep Pos Ok] -command " ${this} apply exit " -state ${new_state}        balloon_bind_info ${btnsfr}.ok [get_indep String ProjectOkINFO]        #Apply button        button ${btnsfr}.apply -text [get_indep String Apply]\          -underline [get_indep Pos Apply] -command " ${this} apply "\          -state ${exist_state}        balloon_bind_info ${btnsfr}.apply [get_indep String ApplyINFO]        #Undo button        button ${btnsfr}.undo -text [get_indep String EditUndo]\          -underline [get_indep Pos EditUndo] -command " ${this} undo "\          -state ${exist_state}        balloon_bind_info ${btnsfr}.undo [get_indep String UndoINFO]        #cancel button        button ${btnsfr}.cancel -text [get_indep String Cancel]\          -underline [get_indep Pos Cancel] -command " ${this} windows_close "\          -state normal        balloon_bind_info ${btnsfr}.cancel [get_indep String ProjectCancelINFO]        foreach button {ok apply undo cancel} {            pack ${btnsfr}.${button} -side top -pady 3 -anchor nw -fill x        }        pack [frame ${btnsfr}.space1 -height 15] -side top -fill x        #allow to add files any way.        set state normal        #Add ... button        button ${btnsfr}.add -text [get_indep String LoadFiles]\          -underline [get_indep Pos LoadFiles] -command " ${this} add_files "\          -state ${state}        balloon_bind_info ${btnsfr}.add [get_indep String LoadNewFilesINFO]        #Add a directory        button ${btnsfr}.adddir -text [get_indep String LoadDirectory]\          -underline [get_indep Pos LoadDirectory] -command " ${this}\          add_directory " -state ${state}        balloon_bind_info ${btnsfr}.adddir [get_indep String LoadDirectoryINFO]        #Add from a project        button ${btnsfr}.addprj -text [get_indep String LoadFromProject]\          -underline [get_indep Pos LoadFromProject] -command " ${this}\          add_from_project " -state ${state}        balloon_bind_info ${btnsfr}.addprj [get_indep String\          LoadFromProjectINFO]        foreach button {add adddir addprj} {            pack ${btnsfr}.${button} -side top -pady 3 -anchor nw -fill x        }        pack [frame ${btnsfr}.space2 -height 15] -side top -fill x        #Project Preferences        #No project preferences if the project already exists        if {$itk_option(-new_project)} {            button ${btnsfr}.pref -text [get_indep String preference]\              -underline [get_indep Pos preference] -command\              " sn_project_preferences $itk_option(-new_project) " -state normal            balloon_bind_info ${btnsfr}.pref [get_indep String preference]            pack ${btnsfr}.pref -side bottom -side top -pady 20 -anchor nw\              -fill x        }        if {$itk_option(-new_project)} {            ${this} configure -title [sn_title [get_indep String NewProj]\	$itk_option(-new_project)]        } else {            ${this} configure -title [sn_title [get_indep String ProjectEditor]]        }        ${this} configure -iconname [get_indep String ProjectEditor]        #correct tabs        set Tree_Mode ""        toggle_disp_mode        #Read project file list        ReadProjectFiles 1        #fill the tree widget with the file names of        #the project        Refresh        ${this} configure -geometry ${width}x${height}        ${this} centerOnScreen        ${this} deiconify# FIXME: Do we really need this call to take_focus here?        ${this} take_focus	        #call user function        if {[catch {sn_rc_projecteditor $itk_component(hull)\                      $itk_component(hull).menu} err]} {            sn_log "error while exec sn_rc_projecteditor: ${err}"        }        if {$itk_option(-variable) != ""} {            vwait $itk_option(-variable)        }    }    destructor {        foreach v [::info globals "${this}-*"] {            catch {uplevel #0 unset ${v}}        }    }    method AddToolbar {} {        frame ${Toolbar} -relief groove -border 2        pack ${Toolbar} -side top -fill x        #View mode (tree, categorie, list)        global ${this}-Tree_Mode        set ${this}-Tree_Mode ${Tree_Mode}        set lbls [list [get_indep String Tree] [get_indep String Categorie]\          [get_indep String List]]        Radio& ${Toolbar}.treemode -variable ${this}-Tree_Mode -labels ${lbls}\          -contents {tree cat list} -label [get_indep String ViewMode]\          -labelwidth -1 -command " ${this} toggle_disp_mode "        pack ${Toolbar}.treemode -side left        pack [frame ${Toolbar}.space -width 5] -side left        #display dirname        #button $Toolbar.dirs  #		-text "directories"  #		-image sign_image \          #		-command "$this toggle_directories $Toolbar.dirs"  #		-relief\          sunken  #		-state disabled        #balloon_bind_info $Toolbar.dirs [get_indep String Disp_Directories]        #pack $Toolbar.dirs -side left        global ${this}-disp_Directories        set ${this}-disp_Directories ${disp_Directories}        checkbutton ${Toolbar}.dirs -text [get_indep String Fullpath]\          -variable ${this}-disp_Directories -command " ${this}\          toggle_directories ${Toolbar}.dirs " -onvalue 1 -offvalue 0\          -state disabled        balloon_bind_info ${Toolbar}.dirs [get_indep String Disp_Directories]        pack ${Toolbar}.dirs -side left    }    protected variable disp_Directories 1    method toggle_directories {btn} {        upvar #0 ${this}-disp_Directories disp_Dir        set disp_Directories ${disp_Dir}        #toggle displaying tabs        toggle_disp_mode        #redisplay contents        Display_ProjectFiles    }    method AddStatusbar {} {        global sn_options        frame ${Statusbar}        pack [label ${Statusbar}.msg -font $sn_options(def,layout-font)\          -relief groove -bd 2 -anchor w -textvar ${this}.msg] -expand y\          -fill x -side left        pack ${Statusbar} -side bottom -fill x    }    method handle_select {} {    }    method file_post {m} {    }    method edit_post {m} {    }    method tools_post {m} {    }    method AddMenu {} {        global sn_options        set m $itk_component.menu        set state normal        menu ${m} -tearoff 0        ## File menu        ####################        menu ${m}.file -tearoff 0 -postcommand "${this} file_post ${m}.file"        ${m} add cascade -label [get_indep String EditFile] -menu ${m}.file\          -underline [get_indep Pos EditFile]        #Statistiks        if {$itk_option(-new_project)} {            set state disabled        } else {            set state normal        }        ${m}.file add command -label [get_indep String Statistics]\          -underline [get_indep Pos Statistics] -command " sn_statistic "\          -state ${state}        ${m}.file add separator        #close window        ${m}.file add command -command " ${this} windows_close "\          -label [get_indep String WindowsClose] -underline [get_indep Pos\          WindowsClose]        #exit program        ${m}.file add command -label [get_indep String Exit]\          -underline [get_indep Pos Exit] -command " sn_exit "        ##Windows        AddWindowsMenu ${m} $itk_component(hull)        ##Help        AddHelpMenu ${m} $itk_component(hull)        ${this} configure -menu ${m}    }    method control_file_buttons {} {        set sels [${treew} curselection]        set view_state normal        set unload_state normal        set hide_state normal        set rename_state normal        set statistic_state disabled        if {${sels} != ""} {            set rootname [${treew} rootname [lindex ${sels} 0]]            set rootname2 [${treew} rootname [lindex ${sels} end]]        } else {            set rootname ""            set rootname2 ""        }        if {${rootname} != "" && ${rootname} == ${rootname2}} {            if {${rootname} == [get_indep String ProjectFiles]} {                set view_state disabled                set statistic_state normal            }\            elseif {${rootname} == [get_indep String UnloadedFiles]} {                set unload_state disabled            } else {                set hide_state disabled            }        } else {            set view_state disabled            set unload_state disabled            set hide_state disabled            set rename_state disabled        }        if {$itk_option(-new_project)} {            #no hide by new projects            set hide_state disabled            set statistic_state disabled        }        ${filefr}.view configure -state ${view_state}        ${filefr}.hide configure -state ${hide_state}        ${filefr}.unload configure -state ${unload_state}        ${filefr}.stat configure -state ${statistic_state}    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -