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

📄 multiview.tcl

📁 This Source-Navigator, an IDE for C/C++/Fortran/Java/Tcl/PHP/Python and a host of other languages.
💻 TCL
📖 第 1 页 / 共 5 页
字号:
# 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 with all availiable tools by SN## Copyright (c) 1999 Cygnus Solutions, Inc.#################################################### Short cuts:## edit     == editor## classbr  == class browser## ctree    == Class Hierarchy## xref     == cross reference## incbr    == include browser## dbg      == Debug## retr     == Retriever## grep     == Grep## make     == Make#global for the hole projectitcl::class MultiWindow& {    global sn_options sn_elix    inherit sourcenav::Window    constructor {args} {        global sn_options	# Setup some default behavior for the MultiWindow.        ${this} withdraw        ${this} on_close "${this} windows_close dummy"        # Don't close window by hitting Escape.        ${this} bind_tk <Escape> {;}        # Init variables to nagivate between view points.        set view_positions(next) ""        set view_positions(prev) ""	eval itk_initialize $args        # Set initial size based on user prefs.        set height [expr {int([winfo screenheight .] *            ($sn_options(def,window-size)*0.01))}]        set width [expr {int([winfo screenwidth .] *            ($sn_options(def,window-size)*0.01))}]        $this configure -geometry ${width}x${height}        # Add menu.        AddMenu        # Add the toolbar.        AddToolbar        # Add statusbar.        AddStatusbar	# Add the main notebook.	itk_component add notebook {	    tixNoteBook $itk_component(hull).nbook -ipadx 0 -ipady 0	} { }	# Configure the big bad notebook widget.        set NotebookFrame [$itk_component(notebook) subwidget nbframe]        ${NotebookFrame} config -inactivebackground lightgray	# Add the pages to the notebook widget.        $itk_component(notebook) add edit\                -raisecmd [itcl::code ${this} RaiseEditor]\		-label [get_indep String MultiEditor]\		-under [get_indep Pos MultiEditor]\		-state [tool_Exists edit]	AddEditor $itk_component(notebook) edit        $itk_component(notebook) add ctree\		-raisecmd [itcl::code ${this} RaiseClassHierarchy]\		-image tree_image\		-label [get_indep String MultiClassHierarchy]\		-under [get_indep Pos MultiClassHierarchy]\		-state [tool_Exists ctree]	AddClassHierarchy $itk_component(notebook) ctree        $itk_component(notebook) add classbr\		-raisecmd [itcl::code ${this} RaiseClassBrowser]\                -label [get_indep String MultiClass]\		-under [get_indep Pos MultiClass]\		-state [tool_Exists classbr]	AddClassBrowser $itk_component(notebook) classbr        $itk_component(notebook) add xref \		-raisecmd [itcl::code ${this} RaiseXReference]\		-label [get_indep String MultiXRef]\		-under [get_indep Pos MultiXRef]\		-state [tool_Exists xref]	AddXReference $itk_component(notebook) xref        $itk_component(notebook) add incbr\		-raisecmd [itcl::code ${this} RaiseInclude]\	        -label [get_indep String MultiInclude]\		-under [get_indep Pos MultiInclude]\		-state [tool_Exists incbr]	AddInclude $itk_component(notebook) incbr        $itk_component(notebook) add retr\		-raisecmd [itcl::code ${this} RaiseRetriever]\		-label [get_indep String MultiRetriever]\		-under [get_indep Pos MultiRetriever]\		-state [tool_Exists retr]	AddRetriever $itk_component(notebook) retr        $itk_component(notebook) add grep \            -raisecmd [itcl::code ${this} RaiseGrep] \            -label [get_indep String MultiGrep] \            -under [get_indep Pos MultiGrep] \            -state [tool_Exists grep]	AddGrep $itk_component(notebook) grep        pack $itk_component(notebook) -fill both -side left -expand y -anchor nw        $itk_component(notebook) raise $itk_option(-raise)        #call user function        catch {sn_rc_mainwindow $itk_component(hull) $itk_component(menu)}        update idletasks        after idle "${this} deiconify"    }    destructor {        foreach v [::info globals "${this}-*"] {            catch {uplevel #0 unset ${v}}        }    }    protected variable Activate_executed 0    # Activate different notebook page:    # save filter options for the actual tool and    # restore those for the activated tool (notebook page)    method Activate {page paned pane tool} {	# FIXME: Shouldn't this be in sn_options array?        global Switch_Is_Enabled        upvar #0 ${SymbolsFilter}-related related        upvar #0 ${tool}-related toolrel        incr Activate_executed        set old_view ${ActiveWidget}        #save related for now active tool        if {${ActiveWidget} != ""} {            upvar #0 ${ActiveWidget}-related rel            set rel ${related}            #dump current position            history_stack_add_point ${ActiveWidget}        }        #save filter flags for the active widget (radios and checkbuttons)        foreach btn [eval list $AllFilterOptions(radio)\          $AllFilterOptions(checkbutton)] {            set variable [${btn} cget -variable]            upvar #0 ${variable} value            upvar #0 ${ActiveWidget}-Filter(${btn}) var            set var ${value}        }        #get selection from current tool, only when keep        #is seted or the global variable to disable switching        #is on        if {${keep} && ${Switch_Is_Enabled} > 0 && ${ActiveWidget} != ""} {            set sel [${ActiveWidget} Selection]        } else {            set sel ""        }        #deactivate current notepad	if {$ActiveWidget != ""} {	    $ActiveWidget deactivate	}        #hide editor buttons, we must hide it first,        #to enable the icons of the next view as first        #and if an editor is availiable we put the toolbar        #buttons on the far right side of the toolbar        if {[${tool} whoami] != "edit"} {            pack forget ${FindEditFr}        }        #restore the information about related        if {[catch {set related ${toolrel}}]} {            if {[${tool} whoami] == "edit"} {                set related 1            } else {                set related 0            }        }        set ActiveWidget ${tool}        set ActivePage ${page}        set ActivePaned ${paned}        set ActivePane ${pane}        #restore the values of the filter checkbuttons and radios        foreach btn [eval list $AllFilterOptions(radio)\          $AllFilterOptions(checkbutton)] {            catch {                set variable [${btn} cget -variable]		upvar #0 ${variable} var                upvar #0 ${ActiveWidget}-Filter(${btn}) value                set var ${value}            }        }        # Delete contents of drop down list        $itk_component(symbolcombo) configure -contents ""        $itk_component(symbolcombo) selecttext ""        ${ActiveWidget} activate        #if there is a selection, goto it        if {${sel} != ""} {            ::eval ${ActiveWidget} gotosymbol ${sel} 0        }        ${ActiveWidget} SetTitle        ${ActiveWidget} Focus        #verify if we have an editor to display the toolbar        #icons        DeActivate_Editor_buttons        #call user function        catch {sn_rc_changeview ${this} ${ActiveWidget} ${old_view}}    }    #View toolbar buttons for the editor, if an editor is    #availiable    method DeActivate_Editor_buttons {} {        if {[list_find_editor ${ActiveWidget}] != ""} {            pack ${FindEditFr} -side left        } else {            pack forget ${FindEditFr}        }    }    #####################################################    # create editor    #####################################################    method AddEditor {nb page} {        global sn_options	itk_component add editor_page {	    ${nb} subwidget ${page}	} { }        $itk_component(editor_page) configure -bg white              itk_component add editorpaned {            tixPanedWindow $itk_component(editor_page).paned\		    -paneborderwidth 0\		    -orientation $sn_options(def,window-alighment)	} { }        itk_component add editorpane {	    $itk_component(editorpaned) add edit -size 500	} { }	itk_component add editor {	    Editor& $itk_component(editorpane).editor\		    -symbols $itk_component(symbolcombo)\		    -symbols_filter ${SymbolsFilter}\		    -menu $itk_component(menu)\		    -toolbar ""\                    -mesg_area $itk_component(message)\		    -message_var [itcl::scope message]\		    -linenumber_var [itcl::scope linenum] \		    -filename ${symbolname}\		    -findcombo ${FindCombo} \                    -parent $this	} { }        pack $itk_component(editor) -fill both -expand y        pack $itk_component(editorpaned) -fill both -expand y        lappend AvailTools $itk_component(editor)	# Just creating it, might not want to use it just yet.	$itk_component(editor) deactivate    }    method RaiseEditor {} {        Activate $itk_component(editor_page) $itk_component(editorpaned)\		$itk_component(editorpane) $itk_component(editor)    }    #####################################################    # Class hierarchy    #####################################################    method AddClassHierarchy {nb page} {        global sn_options	itk_component add classtree_page {	    ${nb} subwidget ${page}	} { }	itk_component add classtreepaned {	    tixPanedWindow $itk_component(classtree_page).paned\		    -paneborderwidth 0\		    -orientation $sn_options(def,window-alighment)	} { }	itk_component add classtreepane {	    $itk_component(classtreepaned) add ctree	} { }	itk_component add classtree {	    ClassTree& $itk_component(classtreepane).classtree\		    -symbols $itk_component(symbolcombo)\		    -symbols_filter $SymbolsFilter\		    -menu $itk_component(classtree_menu)\		    -toolbar $itk_component(toolbar)\		    -message_var [itcl::scope message]\		    -doubleclickcommand "${this} ClassHierarchyEdit" \		    -parent $this	} { }        pack $itk_component(classtree) -fill both -expand y        pack $itk_component(classtreepaned) -fill both -expand y        lappend AvailTools $itk_component(classtree)	# Just creating it, might not want to use it just yet.	$itk_component(classtree) deactivate    }    method RaiseClassHierarchy {} {        Activate $itk_component(classtree_page) $itk_component(classtreepaned)\		$itk_component(classtreepane) $itk_component(classtree)    }    method ClassHierarchyEdit {{scope ""} {sym ""} {cls ""} {file ""} {from\      ""} {type ""} {prm ""} {to ""} {always 1}} {        sn_retrieve_symbol ${sym} ${scope}    }    #####################################################    # Class Browser    #####################################################    method AddClassBrowser {nb page} {        global sn_options	itk_component add class_page {	    ${nb} subwidget ${page}	} { }        itk_component add classpaned {	    tixPanedWindow $itk_component(class_page).paned\		    -paneborderwidth 0\		    -orientation $sn_options(def,window-alighment)	} { }        itk_component add classpane {	    $itk_component(classpaned) add classbr	} { }	itk_component add classbrowser {	    Class& $itk_component(classpane).classbrowser\		    -symbols $itk_component(symbolcombo)\		    -symbols_filter ${SymbolsFilter}\		    -menu $itk_component(classbrowser_menu)\		    -toolbar $itk_component(toolbar)\		    -mesg_area $itk_component(message)\		    -class_doubleclickcommand\		     [itcl::code ${this} ClassBrowserEditClass]\		    -doubleclickcommand [itcl::code ${this} EditObject] \		    -parent $this	} { }        pack $itk_component(classbrowser) -fill both -expand y        pack $itk_component(classpaned) -fill both -expand y        lappend AvailTools $itk_component(classbrowser)	# Just creating it, might not want to use it just yet.	$itk_component(classbrowser) deactivate    }    method RaiseClassBrowser {} {        Activate $itk_component(class_page) $itk_component(classpaned)\		$itk_component(classpane) $itk_component(classbrowser)    }    method ClassBrowserEditClass {class} {        sn_retrieve_symbol ${class} "cl" "" -beg 1 1

⌨️ 快捷键说明

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