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

📄 makepane.tcl

📁 This Source-Navigator, an IDE for C/C++/Fortran/Java/Tcl/PHP/Python and a host of other languages.
💻 TCL
📖 第 1 页 / 共 3 页
字号:
# 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.# ############################################ Make (build programs from source files)########################################### FIXME: This whole class is a bad copy of the greppane.tcl class.# We need to figure out how to make these two use a common parent# or how we can share the implementaitons!itcl::class Make {    inherit itk::Widget    constructor {args} {        global sn_options        eval itk_initialize $args        set s ${this}        #add toolbar icons        if {$itk_option(-toolbar) != ""} {            set toolbarf $itk_option(-toolbar).toolbarf            pack [frame ${toolbarf}] -side left            #prev            button ${toolbarf}.prev -takefocus 0 -text [get_indep String Prev]\              -image del_image -command [itcl::code ${this} incr_selected_line -1]            balloon_bind_info ${toolbarf}.prev [get_indep String PrevINFO]            pack ${toolbarf}.prev -side left -fill x -expand n            #next            button ${toolbarf}.next -takefocus 0 -text [get_indep String Next]\              -image add_image -command [itcl::code ${this} incr_selected_line +1]            balloon_bind_info ${toolbarf}.next [get_indep String NextINFO]            pack ${toolbarf}.next -side left -fill x -expand n        }        #Frame for command input        set input $itk_component(hull).input        frame ${input}        pack ${input} -side top -padx 5 -fill x        set entries ${input}.entries        frame ${entries}        pack ${entries} -fill x -expand y -side left -anchor nw -fill x# FIXME: This widget should not have a file selection button# on the far right side. It serves no purpose. Unfortunatly# this is documented in man screen shots so we can not fix# it yet.        #command string        Combo& ${entries}.entry \            -labelwidth 14 \            -anchor ne \            -label [get_indep String MakeEntry] \            -entryvariable ${this}-makecommand \            -selectcommand "${this} make_select_command ${entries}.entry"        balloon_bind_info [${entries}.entry component entry] [get_indep String\          MakeEntryINFO]        bind [${entries}.entry component entry] <Return> "${this} ExecMake"        pack ${entries}.entry -side top -expand y -fill x -anchor nw        #add choose button for the make command to evtl. choose an executable        button ${entries}.entry.choose -text [get_indep String Choose]\          -command [list sn_choose_file [${entries}.entry component entry]\          $sn_options(executable_defaultext)]        balloon_bind_info ${entries}.entry.choose [get_indep String ChooseINFO]        pack ${entries}.entry.choose -side right -before ${entries}.entry.arrow        #starting directory        Combo& ${entries}.dir -labelwidth 14 -anchor ne -label\          [get_indep String MakeStartDir] -entryvariable [itcl::scope startdir]        bind [${entries}.dir component entry] <Return> "${this} ExecMake"        pack ${entries}.dir -side top -expand y -fill x -anchor nw        button ${entries}.dir.choose -text [get_indep String Choose]\          -command [list sn_choose_dir [${entries}.dir component entry]]        balloon_bind_info ${entries}.dir.choose [get_indep String ChooseINFO]        pack ${entries}.dir.choose -side right -before ${entries}.dir.arrow# FIXME : all the hard coded strings in this class need to go into the string table.        # targets list        Combo& ${entries}.targets \            -labelwidth 14 \            -anchor ne \            -label "Build Targets" \            -entryvariable [itcl::scope target] \            -readonly 1 \            -selectcommand "${this} targets_cb"        pack ${entries}.targets -side top -expand y -fill x -anchor nw# FIXME: put in string table (This is a problem because we check the string everywhere)# Perhaps we should just use <Makefile>, that way it would not have the word External in it.        # Setting the target list.	set target "<External Makefile>"        set targets_list [list $target]        eval lappend targets_list [GetTargetsList]        ${entries}.targets configure -contents ${targets_list}        # Selecting the last target used, if any.        if {! [catch {paf_db_proj get -key IDEMakeCurrentTarget} targ]} {            if {![string equal $targ ""]} {                set target $targ            }        }        ${entries}.targets selecttext ${target}        #display history for make entries        make_add_history ${entries}.entry ${entries}.dir        #Buttons start        set btns ${input}.buttons        frame ${btns}        pack ${btns} -side right -anchor nw -fill x        button ${btns}.start -text [get_indep String StartMake] -command "${this} ExecMake"        balloon_bind_info ${btns}.start [get_indep String StartMakeINFO]        pack ${btns}.start -side top -padx 8 -pady 4 -fill x# FIXME : put in string table!        #Button cancel, if needed        button ${btns}.cancel -takefocus 0 -text "Stop" -command " ${this}\          close_make cancel " -state disabled        balloon_bind_info ${btns}.cancel [get_indep String CancelMakeINFO]        pack ${btns}.cancel -side top -padx 8 -pady 4 -fill x        button ${btns}.launch -takefocus 0 -text "Debug" -width 8 -command\          " ${this} cb_launch_build "        pack ${btns}.launch -side top -padx 8 -pady 4 -fill x        # Results	set browser [text $itk_component(hull).text \	    -exportselection n \	    -wrap word \	    -width ${width} \	    -height ${height}]        ${browser} tag configure sel -background $sn_options(def,select-bg)        Editor&::set_tab ${browser} 2        # Lock down bindings for this widget so we only use ours        bindtags $browser $browser	bind $browser <ButtonPress-1> [itcl::code $this text_b1_down %W %x %y]	bind $browser <B1-Motion> [itcl::code $this text_b1_motion %W %x %y]        bind $browser <Double-1> [itcl::code $this text_b1_double %W %x %y]        bind ${browser} <Return> "${this} handle_return"        bind ${browser} <space> "${this} handle_return"        bind ${browser} <3> {make_post_menu %W %X %Y ; break}        pack ${browser} -side bottom -fill both -expand y        set scroll_y [scrollbar $itk_component(hull).y \	    -orient vertical \	    -command "${browser} yview"]	${browser} configure -yscrollcommand "${scroll_y} set"        pack ${scroll_y} -side right -fill y -before ${browser}        Update_Layout        #set project directory to the start directory        if {$sn_options(make-lastdir) != "" && [file isdirectory\          $sn_options(make-lastdir)]} {            set startdir [file nativename $sn_options(make-lastdir)]        } else {            set startdir [file nativename $sn_options(sys,project-dir)]        }        global ${this}-makecommand        set ${this}-makecommand [file nativename\            $sn_options(both,make-command)]        if {${target} != "<External Makefile>"} {            set b_target [snBuildTarget .tmptarget]            ${b_target} LoadData ${target}            ${entries}.dir configure -entrytext [${b_target} GetBuildDirectory]            itcl::delete object ${b_target}            # Disable the directory combobox so the            # user can't edit the directory of the build target.            ${entries}.dir.choose configure -state disabled            ${entries}.dir configure -state disabled        }        SetTitle	#call user defined function        catch {sn_rc_make $itk_component(hull) ${browser}}        focus [${entries}.entry component entry]    }    destructor {        #to be sure that the process is terminated        catch {close ${make_fd}}        paf_db_proj put IDEMakeCurrentTarget ${target}        foreach v [::info globals "${this}-*"] {            catch {uplevel #0 unset ${v}}        }    }    method handle_cancel {} {        if {${cancelcommand} != ""} {            ::eval ${cancelcommand}        }    }    method getstartdir {} {        return ${startdir}    }    method setmakecommand {cmd} {# This needs to be an instance variable!        upvar #0 ${this}-makecommand makecommand        set makecommand ${cmd}        return ${makecommand}    }    # Call back if the debug or Run button is pressed.	    method cb_launch_build {} {        set exec_error ""        if {${target} == "<External Makefile>"} {            # The users is building with a external Makefile.            # We should bring up the debug dialog.            sn_debugger        } else {            # We need to find out if it's going to launch with            # or without the debugger.            set b_target [snBuildTarget .tmptarget]            ${b_target} LoadData ${target}            if {[${b_target} GetLaunchWithDebugger]==1} {                # We are launching with debugger.                set runDir [${b_target} GetBuildDirectory]                set execCmd [file join ${runDir}\                  [${b_target} GetLaunchCommandLine]]                sn_debugger ${runDir} [file join ${runDir} ${execCmd}]\                  [${b_target} GetDebugger]            } else {                global tcl_platform                # Just run it stand alone.                set runDir [${b_target} GetBuildDirectory]                set execCmd [${b_target} GetLaunchCommandLine]# FIXME: all of this stuff needs to be in a more generic exec# interface. Also, why catch and then run, why not check to see# if the directory exists before doing all this? Known Bug cause!	                catch {cd ${runDir}}                if {$tcl_platform(os)=="Windows NT"} {                    catch {exec cmd /c start ${execCmd} &} exec_error                }\                elseif {$tcl_platform(os)=="Windows 95"} {                    catch {exec command /c start ${execCmd} &} exec_error                } else {                    set execcmd "exec ${execCmd}"                    catch {eval ${execcmd}} exec_error                }                catch {cd $sn_options(sys,project-dir)}            }            itcl::delete object ${b_target}        }        if {${exec_error}!=""} {            sn_error_dialog ${exec_error}        }    }    # Call back if the selected "Build Target" is changed.    method targets_cb {w} {        sn_log "IDE_DEBUG(Make target_cb): target = ${target} "        if {${target} == "<External Makefile>"} {            # Enable the directory combobox so the            # user can edit it.            ${entries}.dir.choose configure -state normal            ${entries}.dir configure -state normal# FIXME: Put this and other strings in string table!            # We will be launching with debugger.            ${btns}.launch configure -text "Debug"        } else {            # enable the directory combobox            # so we can edit it.            ${entries}.dir.choose configure -state normal            ${entries}.dir configure -state normal            # We need to find out if it's going to launch with            # or without the debugger.            set b_target [snBuildTarget .tmptarget]            ${b_target} LoadData ${target}            if {[${b_target} GetLaunchWithDebugger]!=1} {                # We are not using the debugger.                ${btns}.launch configure -text "Run"            } else {                # We are launching with debugger.                ${btns}.launch configure -text "Debug"            }            # Set the new directory in the combobox            ${entries}.dir configure -entrytext [${b_target} GetBuildDirectory]            # Disable the directory combobox so the            # user can't edit the directory of the build target.            ${entries}.dir.choose configure -state disabled            ${entries}.dir configure -state disabled            itcl::delete object ${b_target}        }    }    # Update the targets combobox, debug/lunch and build dir.    method RefreshTargetInfo {} {        # get and set the targets list in the combobox.        set targets_list [list "<External Makefile>"]        eval lappend targets_list [GetTargetsList]        ${entries}.targets configure -contents ${targets_list}        if {${target} != "<External Makefile>"} {            # enable the directory combobox            # so we can edit it.            ${entries}.dir.choose configure -state normal            ${entries}.dir configure -state normal            # We need to find out if it's going to launch with            # or without the debugger.            set b_target [snBuildTarget .tmptarget]            ${b_target} LoadData ${target}            if {[${b_target} GetLaunchWithDebugger]!=1} {                # We are not using the debugger.                ${btns}.launch configure -text "Run"            } else {                # We are launching with debugger.                ${btns}.launch configure -text "Debug"            }            # Set the new directory in the combobox            ${entries}.dir configure -entrytext [${b_target} GetBuildDirectory]            # Disable the directory combobox so the            # user can't edit the directory of the build target.            ${entries}.dir.choose configure -state disabled            ${entries}.dir configure -state disabled            # Be clean, delete the build target after ourselfs.            itcl::delete object ${b_target}        }    }

⌨️ 快捷键说明

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