Revision: 54968
http://brlcad.svn.sourceforge.net/brlcad/?rev=54968&view=rev
Author: bob1961
Date: 2013-03-29 15:47:25 +0000 (Fri, 29 Mar 2013)
Log Message:
-----------
Update the Command widgets invoke method to store the actual command the was
executed (i.e., this command may be one that gets built up by the more-args
mechanism that prompts the user for input). Also added a cmd_history_callback
so that the application can be notified of the actual command that was executed.
Modified Paths:
--------------
brlcad/trunk/src/tclscripts/archer/Archer.tcl
brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
brlcad/trunk/src/tclscripts/lib/Command.tcl
Modified: brlcad/trunk/src/tclscripts/archer/Archer.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/Archer.tcl 2013-03-29 15:42:26 UTC
(rev 54967)
+++ brlcad/trunk/src/tclscripts/archer/Archer.tcl 2013-03-29 15:47:25 UTC
(rev 54968)
@@ -9042,6 +9042,7 @@
::update
if {[$itk_component(preferencesDialog) activate]} {
applyPreferencesIfDiff
+ $itk_component(ged) refresh_all
}
}
Modified: brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl 2013-03-29 15:42:26 UTC
(rev 54967)
+++ brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl 2013-03-29 15:47:25 UTC
(rev 54968)
@@ -1349,7 +1349,8 @@
-scrollmargin 2 -visibleitems 80x15 \
-textbackground $SystemWindow -prompt "ArcherCore> " \
-prompt2 "% " -result_color black -cmd_color red \
- -background $LABEL_BACKGROUND_COLOR
+ -background $LABEL_BACKGROUND_COLOR \
+ -cmd_history_callback [::itcl::code $this addHistory]
} {}
$itk_component(cmd) component text configure -background white
@@ -3483,6 +3484,8 @@
return
}
+ set cmd [string trim $cmd]
+
set maxlines 1000
set tw [$itk_component(history) component text]
@@ -3540,13 +3543,11 @@
set i [lsearch -exact $mArcherCoreCommands $cmd]
if {$i != -1} {
- addHistory $args
return [uplevel $mCoreCmdLevel $args]
}
set i [lsearch -exact $mUnwrappedDbCommands $cmd]
if {$i != -1} {
- addHistory $args
return [eval gedCmd $args]
}
Modified: brlcad/trunk/src/tclscripts/lib/Command.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/lib/Command.tcl 2013-03-29 15:42:26 UTC (rev
54967)
+++ brlcad/trunk/src/tclscripts/lib/Command.tcl 2013-03-29 15:47:25 UTC (rev
54968)
@@ -29,17 +29,21 @@
constructor {args} {}
destructor {}
- itk_option define -edit_style edit_style Edit_style emacs
+ itk_option define -edit_style edit_style Edit_Style emacs
itk_option define -prompt prompt Prompt "> "
itk_option define -prompt2 prompt2 Prompt ""
- itk_option define -cmd_prefix cmd_prefix Cmd_prefix ""
+ itk_option define -cmd_prefix cmd_prefix Cmd_Prefix ""
itk_option define -selection_color selection_color TextColor #fefe8e
itk_option define -prompt_color prompt_color TextColor red1
itk_option define -cmd_color cmd_color TextColor black
itk_option define -oldcmd_color oldcmd_color TextColor red3
itk_option define -result_color result_color TextColor blue3
itk_option define -maxlines maxlines MaxLines 1000
+ itk_option define -cmd_history_callback cmd_history_callback
Cmd_History_Callback ""
+ public common CMD_MORE_ARGS "BUILT_BY_MORE_ARGS"
+ public common CMD_MORE_ARGS_LEN [string length $CMD_MORE_ARGS]
+
public method clear {}
public method history {}
public method edit_style {args}
@@ -88,7 +92,7 @@
private method tab_completion {}
private method tab_expansion {line}
private method print {str}
- public method print_more_args_prompt {_prompt}
+ public method print_more_args_prompt {args}
private method print_prompt {}
private method print_prompt2 {}
private method print_tag {str tag}
@@ -355,6 +359,12 @@
$w tag add oldcmd promptEnd insert
print_tag "Error: $msg\n" result
} else {
+ set i [string first $CMD_MORE_ARGS $msg]
+ if {$i != -1} {
+ set begin [expr {$i + $CMD_MORE_ARGS_LEN}]
+ set cmd [string range $msg $begin end]
+ set msg [string range $msg 0 $i-1]
+ }
$w tag add oldcmd promptEnd insert
if {$msg != ""} {
@@ -364,6 +374,10 @@
if {$do_history} {
$hist add $cmd
+
+ if {$itk_option(-cmd_history_callback) != ""} {
+ $itk_option(-cmd_history_callback) $cmd
+ }
}
if {$more_args_interrupted} {
@@ -1353,8 +1367,8 @@
$w insert insert $str
}
-::itcl::body Command::print_more_args_prompt {_prompt} {
- $itk_component(text) insert insert $_prompt
+::itcl::body Command::print_more_args_prompt {args} {
+ eval $itk_component(text) insert insert $args
}
::itcl::body Command::print_prompt {} {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete
for recognition, cash, and the chance to get your game on Steam.
$5K grand prize plus 10 genre and skill prizes. Submit your demo
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits