Worked around the 4 reserved characters of Bwidget Tree
This commit is contained in:
parent
df45a58c8c
commit
dcc674813e
@ -2450,8 +2450,10 @@ proc browse_tree_fill_dir {tr parent children} {
|
||||
|
||||
if {$parent == "/"} {
|
||||
set parent_name root
|
||||
set parent_dir /
|
||||
} else {
|
||||
set parent_name $parent
|
||||
set parent_name [escape_to_tree $parent]
|
||||
set parent_dir $parent_name
|
||||
}
|
||||
if {[$tr exists $parent_name] == 0} {return ""}
|
||||
|
||||
@ -2459,27 +2461,20 @@ proc browse_tree_fill_dir {tr parent children} {
|
||||
|
||||
foreach i $children {
|
||||
set name [string range $i 2 end]
|
||||
|
||||
# >>> Escape $|^!
|
||||
|
||||
set adr [combine_dir_and_name $parent $name]
|
||||
set escpd [escape_to_tree $name]
|
||||
set adr [combine_dir_and_name $parent_dir $escpd]
|
||||
$tr insert end $parent_name $adr -text $name
|
||||
if {[string range $i 0 0] == "d"} {
|
||||
set dir_dummy [combine_dir_and_name $adr "_"]
|
||||
|
||||
# <<<
|
||||
catch {
|
||||
# >>> Fails if the path contains $|^!
|
||||
$tr insert end $adr $dir_dummy -text " "
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# The command to be executed when the user double-clicks a node.
|
||||
#
|
||||
proc browse_tree_accept {adr_var_name do_return tr selected} {
|
||||
proc browse_tree_accept {adr_var_name do_return tr value} {
|
||||
global have_bwidget
|
||||
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
|
||||
global isomanip_move_target indev_adr outdev_adr cmd_log_target
|
||||
@ -2487,15 +2482,6 @@ proc browse_tree_accept {adr_var_name do_return tr selected} {
|
||||
|
||||
# Caution: Before using $tr, check for $have_bwidget
|
||||
|
||||
if {[llength $selected] > 1} {
|
||||
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You may only select a single file"
|
||||
return ""
|
||||
}
|
||||
if {[llength $selected] == 0} {
|
||||
set value ""
|
||||
} else {
|
||||
set value [lindex $selected 0]
|
||||
}
|
||||
if {$adr_var_name == "burn_write_image_adr"} {
|
||||
set burn_write_image_adr $value
|
||||
if {$do_return == 1} {burn_write_image}
|
||||
@ -2576,6 +2562,29 @@ proc browse_tree_topic {adr_var_name} {
|
||||
}
|
||||
|
||||
|
||||
# Unescape &|^! from Bwidget tree browser
|
||||
#
|
||||
proc unescape_from_tree {text} {
|
||||
return [string map [list "\{\{\}" "\{" "\{+\}" "&" "\{I\}" "|" \
|
||||
"\{A\}" "^" "\{.\}" "!"] \
|
||||
$text]
|
||||
|
||||
# <<< alternative encoding
|
||||
# set escpd [string map [list "\\\\" "\\" "\\+" "&" "\\I" "|" \
|
||||
# "\\A" "^" "\\." "!"] \
|
||||
}
|
||||
|
||||
|
||||
# Escape &|^! which are special to BWidget Tree
|
||||
#
|
||||
proc escape_to_tree {text} {
|
||||
return [string map [list "\{" "\{\{\}" "&" "\{+\}" "|" "\{I\}" \
|
||||
"^" "\{A\}" "!" "\{.\}"] \
|
||||
$text]
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Accept the single selected item of the tree browser
|
||||
# Called by the \"Accept\" button in the browser window.
|
||||
#
|
||||
@ -2586,7 +2595,8 @@ proc browse_tree_accept_sel {adr_var_name do_return tr} {
|
||||
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item before clicking the \"Accept\" button."
|
||||
return ""
|
||||
}
|
||||
browse_tree_accept $adr_var_name $do_return $tr $selected
|
||||
browse_tree_accept $adr_var_name $do_return $tr \
|
||||
[unescape_from_tree [lindex $selected 0]]
|
||||
}
|
||||
|
||||
|
||||
@ -2598,16 +2608,16 @@ proc browse_tree_accept_entry {adr_var_name do_return tr} {
|
||||
global debug_log_file execute_script_adr
|
||||
|
||||
eval set text $$adr_var_name
|
||||
set selected [list $text]
|
||||
browse_tree_accept $adr_var_name $do_return $tr $selected
|
||||
browse_tree_accept $adr_var_name $do_return $tr $text
|
||||
}
|
||||
|
||||
|
||||
# Hand the variable from double click over to browse_tree_accept as list.
|
||||
# Called by double click in browser tree
|
||||
# Submit a Tree-escaped path to browse_tree_accept.
|
||||
# Called by Double-click in browser.
|
||||
#
|
||||
proc browse_tree_accept_bindtext {adr_var_name do_return tr item} {
|
||||
browse_tree_accept $adr_var_name $do_return $tr [list $item]
|
||||
proc browse_tree_accept_escd {adr_var_name do_return tr escd_path} {
|
||||
browse_tree_accept $adr_var_name $do_return $tr \
|
||||
[unescape_from_tree $escd_path]
|
||||
}
|
||||
|
||||
|
||||
@ -2708,7 +2718,7 @@ proc browse_tree_populate {which_fs} {
|
||||
if {$i == ""} {
|
||||
continue
|
||||
}
|
||||
set path [combine_dir_and_name $path $i]
|
||||
set path [combine_dir_and_name $path [escape_to_tree $i]]
|
||||
$open_dir_cmd $w.tree $path
|
||||
catch {
|
||||
$w.tree opentree $path 0
|
||||
@ -2748,9 +2758,10 @@ proc destroy_browse_disk {w} {
|
||||
# the hard disk filesystem.
|
||||
#
|
||||
proc browse_disk_open_dir {tr name} {
|
||||
if {[localfs_filetype $name] != "d"} {return ""}
|
||||
set lslist [localfs_ls $name]
|
||||
browse_tree_fill_dir $tr $name $lslist
|
||||
set escpd [unescape_from_tree $name]
|
||||
if {[localfs_filetype $escpd] != "d"} {return ""}
|
||||
set lslist [localfs_ls $escpd]
|
||||
browse_tree_fill_dir $tr $escpd $lslist
|
||||
}
|
||||
|
||||
|
||||
@ -2765,9 +2776,10 @@ proc browse_disk_refresh {} {
|
||||
# the ISO model.
|
||||
#
|
||||
proc browse_iso_open_dir {tr name} {
|
||||
if {[isofs_filetype $name] != "d"} {return ""}
|
||||
set lslist [isofs_ls $name]
|
||||
browse_tree_fill_dir $tr $name $lslist
|
||||
set escpd [unescape_from_tree $name]
|
||||
if {[isofs_filetype $escpd] != "d"} {return ""}
|
||||
set lslist [isofs_ls $escpd]
|
||||
browse_tree_fill_dir $tr $escpd $lslist
|
||||
}
|
||||
|
||||
|
||||
@ -2869,7 +2881,7 @@ proc browse_tree {adr_var which_fs} {
|
||||
|
||||
# At least double-click does work
|
||||
$w.tree bindText <Double-Button-1> \
|
||||
"browse_tree_accept_bindtext $adr_var 1 $w.tree"
|
||||
"browse_tree_accept_escd $adr_var 1 $w.tree"
|
||||
|
||||
$w.tree bindText <Button-3> {browse_tree_help "Browse tree" grey}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2013.01.06.174508"
|
||||
#define Xorriso_timestamP "2013.01.06.194655"
|
||||
|
Loading…
Reference in New Issue
Block a user