📄 conftooldlg.tcl
字号:
# Copyright (c) 2000, 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.# #################################################### Configure Build Rule Dialog for SN-IDE.## Copyright (c) 1999 Cygnus Solutions, Inc.## Written by Ian Roxborough <irox@cygnus.com>##################################################itcl::class snIdeToolsDlg { inherit sourcenav::Dialog method test {} { if {[info objects ${toolchain}]!=""} { # It's ok. } else { # it's not ok. error "Tool chain ${toolchain} does not exist" } } # The dialog window path. protected variable dlgwin "" protected variable focus "" #Last focus before create dialog. protected variable okbutt "" # The OK button. protected variable debugLookUp ;# Array to lookup string tags protected variable optimizeLookUp ;# Array ... protected variable warnLookUp ;# Array ... protected variable codeLookUp ;# Array ... # flags widgets: protected variable debugLBX "" protected variable optimizeLBX "" protected variable warnLBX "" protected variable codeLBX "" protected variable exeLEB "" protected variable uflagsENT "" protected variable cmdlTXT "" # includes widgets: protected variable AutoGenList "" protected variable UserGenList "" # define buttons/widgets protected variable DefNewButt "" protected variable DefDelButt "" protected variable DefSetButt "" protected variable UserDefsList "" protected variable EditDef "" itk_option define -toolchain toolChain ToolChain "" itk_option define -rule rule Rule "" itk_option define -buildtarget buildTarget BuildTarget "" protected variable editdefbox "" constructor args { eval itk_initialize $args $this configure -modality application #TODO: check tool_chain, rule and build_target are valid CreateDialog } method CreateDialog {} { global tkPriv #TODO: CheckToolChain #TODO: CheckRuleType set finfo [$itk_option(-toolchain) GetFileInfo $itk_option(-rule)] $this configure -title \ "[get_indep String IDEBuildRuleTitle] \[${finfo}\]" #create notebook widget set notebook [tixNoteBook $itk_component(hull).nb] #Add a leaf for Settings/flags. set flagsleaf [${notebook} add flags -label [get_indep String\ IDEBRSettingsTab] -under [get_indep Pos IDEBRSettingsTab]] FlagPage ${flagsleaf} #Add a leaf for Incudes Files. set includesleaf [${notebook} add includes -label [get_indep String\ IDEBRIncludesTab] -under [get_indep Pos IDEBRIncludesTab]] IncludesPage ${includesleaf} #Add a leaf for macro defines. set definesleaf [${notebook} add defines -label [get_indep String\ IDEBRDefinesTab] -under [get_indep Pos IDEBRDefinesTab]] DefinesPage ${definesleaf} pack ${notebook} -pady 6 -padx 6 # Add OK and Cancel buttons. set okbutt [button $itk_component(hull).ok -text [get_indep String IDEBROK]\ -width 11 -command " ${this} ok_cb "] set cancelbutt [button $itk_component(hull).canit -text [get_indep String\ IDEBRCancel] -width 11 -command " ${this} cancel_cb "] # bind Escape and Close Window button to Cancel wm protocol $itk_component(hull) WM_DELETE_WINDOW "${cancelbutt} invoke" bind $itk_component(hull) <Escape> "${cancelbutt} invoke" pack ${cancelbutt} ${okbutt} -pady 6 -padx 6 -side right InitializeFlagData UpdateCommandLineArguements dumy dumy } method FlagPage {container} { global FlagTags # TODO: check optimizations, debug, warnings, code generation. set optIDTagList [$itk_option(-toolchain) GetRuleFlagsIDTagsList $itk_option(-rule)\ Optimize] set debugIDTagList [$itk_option(-toolchain) GetRuleFlagsIDTagsList $itk_option(-rule)\ Debug] set warnIDTagList [$itk_option(-toolchain) GetRuleFlagsIDTagsList $itk_option(-rule)\ Warning] set codeGenIDTagList [$itk_option(-toolchain) GetRuleFlagsIDTagsList $itk_option(-rule)\ CodeGen] # # Create debug flag list # set debugLBX [combobox::combobox ${container}.dbglbx -command\ " ${this} cb_combobox_changed "] set debugLBL [label ${container}.dbglbl -text [get_indep String\ IDEBRDebugCombo]] if {${debugIDTagList} == ""} { #disable debug listbox if no flags ${debugLBX} configure -state disabled } else { foreach debugIDTag ${debugIDTagList} { set debugLookUp($FlagTags(${debugIDTag})) ${debugIDTag} set tmpCmd "${debugLBX} listinsert end\ \"$FlagTags(${debugIDTag})\"" eval ${tmpCmd} } ${debugLBX} configure -editable 0 } grid ${debugLBL} -column 1 -row 2 -sticky e grid ${debugLBX} -column 2 -row 2 # # Create optimizations list of flags # set optimizeLBL [label ${container}.optlbl -text [get_indep String\ IDEBROptimizationCombo]] set optimizeLBX [combobox::combobox ${container}.optlbx -command\ " ${this} cb_combobox_changed "] if {${optIDTagList} == ""} { #disable Optimizations listbox if not flags ${optimizeLBX} configure -state disabled } else { foreach optIDTag ${optIDTagList} { set optimizeLookUp($FlagTags(${optIDTag})) ${optIDTag} set tmpCmd "${optimizeLBX} listinsert end\ \"$FlagTags(${optIDTag})\"" eval ${tmpCmd} } ${optimizeLBX} configure -editable 0 } grid columnconfigure ${container} 0 -minsize 10 grid columnconfigure ${container} 3 -minsize 10 grid columnconfigure ${container} 6 -minsize 10 grid ${optimizeLBL} -column 4 -row 2 -sticky e grid ${optimizeLBX} -column 5 -row 2 -sticky we grid rowconfigure ${container} 1 -minsize 10 grid rowconfigure ${container} 3 -minsize 10 # # Create warnings flag list # set warnLBX [combobox::combobox ${container}.warnlbx -command\ " ${this} cb_combobox_changed "] set warnLBL [label ${container}.warnlbl -text [get_indep String\ IDEBRWarningCombo]] if {${warnIDTagList} == ""} { #disable warnings listbox if no flags ${warnLBX} configure -state disabled } else { foreach warnIDTag ${warnIDTagList} { set warnLookUp($FlagTags(${warnIDTag})) ${warnIDTag} set tmpCmd "${warnLBX} listinsert end\ \"$FlagTags(${warnIDTag})\"" eval ${tmpCmd} } ${warnLBX} configure -editable 0 } grid ${warnLBL} -column 1 -row 4 -sticky e grid ${warnLBX} -column 2 -row 4 -sticky we grid rowconfigure ${container} 5 -minsize 10 # # Create Code Generation flag list # set codeLBX [combobox::combobox ${container}.codelbx -command\ " ${this} cb_combobox_changed "] set codeLBL [label ${container}.codelbl -text [get_indep String\ IDEBRCodeGenCombo]] if {${codeGenIDTagList} == ""} { #disable debug listbox if no flags ${codeLBX} configure -state disabled } else { foreach codeGenIDTag ${codeGenIDTagList} { set codeLookUp($FlagTags(${codeGenIDTag})) ${codeGenIDTag} set tmpCmd "${codeLBX} listinsert end\ \"$FlagTags(${codeGenIDTag})\"" eval ${tmpCmd} } ${codeLBX} configure -editable 0 } grid ${codeLBL} -column 4 -row 4 -sticky e grid ${codeLBX} -column 5 -row 4 -sticky we # # create user flags entry # set uflagsLBL [label ${container}.uflbl -text [get_indep String\ IDEBRUserFlags]] set uflagsENT [entry ${container}.ufent -textvar userflags] bind ${uflagsENT} <KeyRelease> "${this} cb_combobox_changed" grid ${uflagsLBL} -column 1 -row 6 -sticky e grid ${uflagsENT} -column 2 -row 6 -sticky we # # create executable location # set exeLBL [label ${container}.exelbl -text [get_indep String\ IDEBRExecLocation]] set exeLEB [LabelEntryButton& ${container}.exeleb -text ""] bind [${exeLEB} component entry] <KeyRelease> "${this} cb_combobox_changed" grid ${exeLBL} -column 4 -row 6 -sticky e grid ${exeLEB} -column 5 -row 6 -sticky we grid rowconfigure ${container} 7 -minsize 10 # # Create text widget to display compiler command line flags # set cmdlTXT [text ${container}.cmdltxt -height 3 -width 10] grid ${cmdlTXT} -column 1 -columnspan 5 -row 8 -sticky we grid rowconfigure ${container} 9 -minsize 10 # Update the Compiler Command Line when the user does something. bind ${container} <ButtonRelease> "${this} UpdateCommandLineArguements" bind ${container} <KeyRelease> "${this} UpdateCommandLineArguements" } method cb_combobox_changed {{dumy1 ""} {dumy2 ""}} { # Update the cmd line display to reflex new settings. UpdateCommandLineArguements } method UpdateCommandLineArguements {{dummy1 ""} {dummy2 ""}} { set cmdline [GetCompilerCommandLine] # clear widget ${cmdlTXT} configure -state normal ${cmdlTXT} delete 0.0 end ${cmdlTXT} insert end ${cmdline} # Stop people editting it. ${cmdlTXT} configure -state disabled } method GetCompilerCommandLine {} { # Get the tool set tool [[${exeLEB} component entry] get] if {${tool}==""} { set tool [$itk_option(-toolchain) GetTool $itk_option(-rule)] } # Get the basic action set basicaction [$itk_option(-toolchain) GetBasicAction $itk_option(-rule)] # Get the flags set flags "" set flags "${flags} [$itk_option(-toolchain) GetRuleFlags $itk_option(-rule) Debug\ $debugLookUp([${debugLBX} get])]" set flags "${flags} [$itk_option(-toolchain) GetRuleFlags $itk_option(-rule) Optimize\ $optimizeLookUp([${optimizeLBX} get])]"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -