📄 targetedit.tcl
字号:
if {${use_debugger} == 1} { $itk_component(executeradio) deselect $itk_component(debugradio) select } else { $itk_component(executeradio) select $itk_component(debugradio) deselect } } public method SetLibraryFiles {{lib_files ""}} { if {${lib_files} == ""} { set lib_files [${b_target} GetLibraryFiles] } else { if {${lib_files} == "none"} { set lib_files "" } ${b_target} SetLibraryFiles ${lib_files} } $itk_component(liblbx) delete 0 end # FIXME: this is dangerous, lib names with special meaning could hose us! eval {$itk_component(liblbx) insert end} ${lib_files} } public method SetBuildDirectory {{dir ""}} { global sn_options if {${dir} == ""} { # Lets see if we can get for build target object set dir [${b_target} GetBuildDirectory] } else { # Lets write this data ${b_target} SetBuildDirectory ${dir} } if {${dir} == ""} { # Set the build dir to the project dir. set dir $sn_options(sys,project-dir) ${b_target} SetBuildDirectory ${dir} } $itk_component(bdirleb) configure -value ${dir} } public method SetTargetType {{type ""}} { if {${type} == ""} { # Lets see if we can get for build target object set type [${b_target} GetTargetType] } else { # Lets write this data ${b_target} SetTargetType ${type} } if {${type}==""} { # Use Executable as default set type "Executable" } $itk_component(ttypecbx) configure -editable 1 $itk_component(ttypecbx) delete 0 end $itk_component(ttypecbx) insert 0 ${type} $itk_component(ttypecbx) configure -editable 0 } public method SetToolChain {{tools ""}} { if {${tools} == ""} { # Lets see if we can get for build target object set tools [${b_target} GetToolChain] if {${tools} != ""} { # Write it back initialise the tool chain field. # (Can cause side effects if we don't.) ${b_target} SetToolChain ${tools} } } else { # Lets write this data ${b_target} SetToolChain ${tools} } if {${tools} == ""} { # Use Executable as default set tools "GNUPro (native)" ${b_target} SetToolChain ${tools} } $itk_component(tchaincbx) configure -editable 1 $itk_component(tchaincbx) delete 0 end $itk_component(tchaincbx) insert 0 ${tools} $itk_component(tchaincbx) configure -editable 0 } public method SetSourceFiles {{files ""}} { if {${files}==""} { # Lets see if we can get for build target object set files [${b_target} GetSourceFiles] } else { # Lets write this data ${b_target} SetSourceFiles ${tools} } if {${files}!=""} { $itk_component(srctree) delete 0 end $itk_component(srctree) insert 0 -text Files fill_file_tree -widget $itk_component(srctree) -contents ${files} -parent end } } public method SetBuildRules {{cls ""} {dummy ""}} { # Get toolchain and select the right spex. set tchain_obj [GetToolChainObject [$itk_component(tchaincbx) get]] set rules [${tchain_obj} GetRulesList] set rulenum -1 # Store off selected rule (if any). # We can try to look neat by selecting this rule afterwards. set selected [$itk_component(buildruletable) curselection]# FIXME: ARRRAGSHS$#4@!!!, we should not be using internal widget names # Clean rule table $itk_component(buildruletable).tree delete 0 end # Write rules... foreach rule ${rules} { incr rulenum set rulesindex(${rulenum}) ${rule} set finfo [${tchain_obj} GetFileInfo ${rule}] set ginfo [${tchain_obj} GetGeneralInfo ${rule}] set rule_status [${b_target} GetRuleStatus ${rule}] set info "\{${rule_status}\t${finfo}\t${ginfo}\}" $itk_component(buildruletable) insert end ${info} } # Select the last selected rule (if we can). catch {$itk_component(buildruletable) selection set $selected} } public method rules_tab_selected_hack {} { $itk_component(buildruletable) start_motion 2 2 $itk_component(buildruletable) motion 2 3 $itk_component(buildruletable) resize 2 2 } public method cb_rule_togle {} { set tool_chain [$itk_component(tchaincbx) get] set tchain_obj [GetToolChainObject ${tool_chain}] set sel [$itk_component(buildruletable) curselection] if {[${b_target} GetRuleStatus $rulesindex(${sel})]=="Enabled"} { ${b_target} SetRuleStatus $rulesindex(${sel}) "Disabled" } else { ${b_target} SetRuleStatus $rulesindex(${sel}) "Enabled" } SetBuildRules $itk_component(buildruletable) selection set ${sel} HandleRuleTableState } public method HandleRuleTableState {} { set tool_chain [$itk_component(tchaincbx) get] set tchain_obj [GetToolChainObject ${tool_chain}] set sel [$itk_component(buildruletable) curselection] if {${sel} == ""} { # If nothing is selected then disable togle button. $itk_component(buildruledisable) configure -state disabled $itk_component(buildruleedit) configure -state disabled } else { $itk_component(buildruledisable) configure -state normal $itk_component(buildruleedit) configure -state normal if {[${b_target} GetRuleStatus $rulesindex(${sel})] == "Enabled"} { $itk_component(buildruledisable) configure \ -text [get_indep String IDETEBuildRuleDisable] \ -under [get_indep Pos IDETEBuildRuleDisable] } else { $itk_component(buildruledisable) configure \ -text [get_indep String IDETEBuildRuleEnable] \ -under [get_indep Pos IDETEBuildRuleEnable] } } } public method ruletable_double_cb {} { set tool_chain [$itk_component(tchaincbx) get] set tchain_obj [GetToolChainObject ${tool_chain}] set sel [$itk_component(buildruletable) curselection] if {${NewTarget} == "1"} { # Don't generate the Auto Include paths again. set NewTarget "" ${b_target} SetAutoIncludes $rulesindex(${sel})\ [GenerateIncludePaths ${src_file_list}] } set ttdlg [snIdeToolsDlg .toolchaindlg -toolchain ${tchain_obj}\ -rule $rulesindex(${sel}) -buildtarget [itcl::code ${b_target}]] $ttdlg activate itcl::delete object $ttdlg UpdateCmdLine HandleRuleTableState } public method HandleLibsTabState {} { set selected [$itk_component(liblbx) curselect] if {${selected}==""} { $itk_component(libadd) configure -state normal $itk_component(libdel) configure -state disabled $itk_component(libup) configure -state disabled $itk_component(libdown) configure -state disabled } else { $itk_component(libadd) configure -state normal $itk_component(libdel) configure -state normal # If the 1st lib is selected disabled "Move up" if {${selected} == "0"} { $itk_component(libup) configure -state disabled } else { $itk_component(libup) configure -state normal } # If the last lib is selected disabled "Move down" set tmpsel ${selected} incr tmpsel if {${tmpsel} == [$itk_component(liblbx) size]} { $itk_component(libdown) configure -state disabled } else { $itk_component(libdown) configure -state normal } } } public method cb_double_click_lib {} { HandleLibsTabState } public method cb_add_lib {} { set libfiles [Editor&::FileDialog $itk_component(hull)] # FIXME : this is dangerous, a file named foo[exit]bar.txt could exit the IDE! eval {$itk_component(liblbx) insert end} $libfiles HandleLibsTabState } public method cb_del_lib {} { set selected [$itk_component(liblbx) curselect] $itk_component(liblbx) delete ${selected} HandleLibsTabState } public method cb_up_lib {} { set selected [$itk_component(liblbx) curselect] set libfile [$itk_component(liblbx) get ${selected}] $itk_component(liblbx) delete ${selected} set selected [expr "${selected} - 1"] $itk_component(liblbx) insert ${selected} ${libfile} $itk_component(liblbx) selection set ${selected} HandleLibsTabState } public method cb_down_lib {} { set selected [$itk_component(liblbx) curselect] set libfile [$itk_component(liblbx) get ${selected}] $itk_component(liblbx) delete ${selected} incr selected $itk_component(liblbx) insert ${selected} ${libfile} $itk_component(liblbx) selection set ${selected} HandleLibsTabState } public method ok_cb {} { #TODO: check form is completed enough # Generate the Auto include paths if it has been done yet. if {${NewTarget} == "1"} { # Don't generate the Auto Include paths again. set NewTarget "" set sel [$itk_component(buildruletable) curselection] ${b_target} SetAutoIncludes $rulesindex(${sel})\ [GenerateIncludePaths ${src_file_list}] } # Call custom remove GUI proc. # NB: The user should save any custom data here. RemoveCustomGUI SaveData deactivate 1 } public method SaveData {} { # Write Data to build target object SetBuildDirectory [$itk_component(bdirleb) cget -value] SetToolChain [$itk_component(tchaincbx) get] SetTargetType [$itk_component(ttypecbx) get] # Pass "none" if no libraries are listed. if {[$itk_component(liblbx) get 0 end] == ""} { SetLibraryFiles none } else { SetLibraryFiles [$itk_component(liblbx) get 0 end] } SetOutputFilename [$itk_component(lfileent) get] # Pass "%none%" if no entry point. if {[$itk_component(enptent) get] == ""} { SetLinkerEntryPoint "%none%" } else { SetLinkerEntryPoint [$itk_component(enptent) get] } # Pass "%none%" if no user flags. if {[$itk_component(lflagsent) get] == ""} { SetUserLinkFlags "%none%" } else { SetUserLinkFlags [$itk_component(lflagsent) get] } # Save Launch command line ${b_target} SetLaunchCommandLine [$itk_component(launchcommand) get] # Save linker tool SetLinkerExecutable $linkerlocal ${b_target} SaveData } public method cancel_cb {} { deactivate 0 } public method DestroyDialog {} { itcl::delete object ${b_target} }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -