Improved xorriso-tcltk file browser
This commit is contained in:
parent
448d1b21e3
commit
8d5d0d1391
@ -1025,9 +1025,9 @@ set browse_disk_window_var ""
|
||||
set browse_iso_window_is_active 0
|
||||
set browse_iso_window_var ""
|
||||
|
||||
# Whether a selection event in the file browser shal trigger a Return in
|
||||
# the associated text field after setting the selected value.
|
||||
set browse_select_is_return 1
|
||||
# Whether to bring the selected browser item directly into the text field
|
||||
set browse_select_is_setvar 1
|
||||
|
||||
|
||||
|
||||
# ------ GUI callback procedures ----
|
||||
@ -2196,9 +2196,18 @@ proc browse_tree_fill_dir {tr parent children} {
|
||||
# The command to be executed when the user selects a node.
|
||||
#
|
||||
proc browse_tree_select {adr_var_name tr selected} {
|
||||
global browse_select_is_setvar
|
||||
|
||||
if {"$browse_select_is_setvar" == 0} {return ""}
|
||||
browse_tree_accept "$adr_var_name" 0 "$tr" "$selected"
|
||||
}
|
||||
|
||||
|
||||
# The command to be executed when the user double-clicks a node.
|
||||
#
|
||||
proc browse_tree_accept {adr_var_name do_return tr selected} {
|
||||
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
|
||||
global isomanip_move_target indev_adr outdev_adr
|
||||
global browse_select_is_return
|
||||
|
||||
if {[llength "$selected"] == 0} {
|
||||
set value ""
|
||||
@ -2207,35 +2216,91 @@ proc browse_tree_select {adr_var_name tr selected} {
|
||||
}
|
||||
if {"$adr_var_name" == "burn_write_image_adr"} {
|
||||
set burn_write_image_adr "$value"
|
||||
if {"$browse_select_is_return" == 1} {burn_write_image}
|
||||
if {"$do_return" == 1} {burn_write_image}
|
||||
}
|
||||
if {"$adr_var_name" == "extract_to_adr"} {
|
||||
set extract_to_adr "$value"
|
||||
if {"$browse_select_is_return" == 1} {extract_to}
|
||||
if {"$do_return" == 1} {extract_to}
|
||||
}
|
||||
if {"$adr_var_name" == "insert_from_adr"} {
|
||||
set insert_from_adr "$value"
|
||||
if {"$browse_select_is_return" == 1} {insert_from}
|
||||
if {"$do_return" == 1} {insert_from}
|
||||
}
|
||||
if {"$adr_var_name" == "isodir_adr"} {
|
||||
set isodir_adr "$value"
|
||||
if {"$browse_select_is_return" == 1} {isodir_return "browse_tree_select"}
|
||||
if {"$do_return" == 1} {isodir_return "browse_tree_select"}
|
||||
}
|
||||
if {"$adr_var_name" == "isomanip_move_target"} {
|
||||
set isomanip_move_target "$value"
|
||||
# No browse_select_is_return because the field is shared between buttons
|
||||
# No do_return because the field is shared between buttons
|
||||
}
|
||||
if {"$adr_var_name" == "indev_adr"} {
|
||||
set indev_adr "$value"
|
||||
if {"$browse_select_is_return" == 1} {indev_return}
|
||||
if {"$do_return" == 1} {indev_return}
|
||||
}
|
||||
if {"$adr_var_name" == "outdev_adr"} {
|
||||
set outdev_adr "$value"
|
||||
if {"$browse_select_is_return" == 1} {outdev_return}
|
||||
if {"$do_return" == 1} {outdev_return}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Accept the single selected item of the tree browser
|
||||
# Called by the \"Accept\" button in the browser window.
|
||||
#
|
||||
proc browse_tree_accept_sel {adr_var_name do_return tr} {
|
||||
set selected [$tr selection get]
|
||||
if {[llength "$selected"] != 1} {
|
||||
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item clicking the \"Accept\" button."
|
||||
return ""
|
||||
}
|
||||
browse_tree_accept "$adr_var_name" 1 "$tr" "$selected"
|
||||
}
|
||||
|
||||
|
||||
# Move up one directory level of the file browser selection
|
||||
#
|
||||
proc browse_tree_up {adr_var_name tr which_fs} {
|
||||
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
|
||||
global isomanip_move_target indev_adr outdev_adr
|
||||
|
||||
set selected [$tr selection get]
|
||||
if {[llength "$selected"] != 1} {
|
||||
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item clicking the \"Up\" button."
|
||||
return ""
|
||||
}
|
||||
set adr [file dirname [lindex "$selected" 0]]
|
||||
eval set mem $$adr_var_name
|
||||
set $adr_var_name "$adr"
|
||||
browse_tree_populate "$which_fs"
|
||||
set $adr_var_name "$mem"
|
||||
if {"$adr" != "/" && "$adr" != ""} {
|
||||
$tr selection clear
|
||||
$tr selection set "$adr"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Move down one directory level of the file browser selection
|
||||
#
|
||||
proc browse_tree_down {adr_var_name tr which_fs} {
|
||||
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
|
||||
global isomanip_move_target indev_adr outdev_adr
|
||||
|
||||
set selected [$tr selection get]
|
||||
if {[llength "$selected"] != 1} {
|
||||
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item clicking the \"Down\" button."
|
||||
return ""
|
||||
}
|
||||
set adr [lindex "$selected" 0]
|
||||
eval set mem $$adr_var_name
|
||||
set $adr_var_name "$adr"
|
||||
browse_tree_populate "$which_fs"
|
||||
set $adr_var_name "$mem"
|
||||
$tr selection set "$adr"
|
||||
}
|
||||
|
||||
|
||||
# The command to be executed when the user closes a directory node.
|
||||
# It replaces the directory content list by a single dummy item.
|
||||
#
|
||||
@ -2252,7 +2317,6 @@ proc browse_tree_populate {which_fs} {
|
||||
global browse_iso_window_is_active browse_disk_window_is_active
|
||||
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
|
||||
global isomanip_move_target indev_adr outdev_adr
|
||||
global browse_select_is_return
|
||||
|
||||
if {"$which_fs" == "isofs"} {
|
||||
if {"$browse_iso_window_is_active" == 0} {return ""}
|
||||
@ -2290,6 +2354,14 @@ proc browse_tree_populate {which_fs} {
|
||||
}
|
||||
|
||||
|
||||
# The procedure to be run by mouse button 3 in the file browser.
|
||||
# It has to strip off the surplus parameter added by the Tree widget.
|
||||
#
|
||||
proc browse_tree_help {about_what button_color from_item} {
|
||||
window_help "$about_what" "$button_color"
|
||||
}
|
||||
|
||||
|
||||
# Destroy the hard disk browser pop-up window.
|
||||
#
|
||||
proc destroy_browse_disk {w} {
|
||||
@ -2353,7 +2425,7 @@ proc browse_iso_refresh {} {
|
||||
proc browse_tree {adr_var which_fs} {
|
||||
upvar $adr_var adr
|
||||
global have_bwidget browse_disk_window_is_active browse_iso_window_is_active
|
||||
global browse_disk_window_var browse_iso_window_var
|
||||
global browse_disk_window_var browse_iso_window_var tree_window_lines
|
||||
|
||||
set button_color "grey"
|
||||
|
||||
@ -2399,12 +2471,22 @@ proc browse_tree {adr_var which_fs} {
|
||||
# BWidget Tree
|
||||
frame $w.tree_frame
|
||||
frame $w.tree_frame_y
|
||||
Tree $w.tree -width 80 \
|
||||
Tree $w.tree -width 80 -height "$tree_window_lines" \
|
||||
-opencmd "$open_dir_cmd $w.tree" \
|
||||
-closecmd "browse_tree_close_dir $w.tree" \
|
||||
-selectcommand "browse_tree_select $adr_var" \
|
||||
-selectfill 1 \
|
||||
-yscrollcommand "$w.treescroll_y set" \
|
||||
-xscrollcommand "$w.treescroll_x set"
|
||||
|
||||
# ??? why doesn't <Return> work ?
|
||||
# $w.tree bindText <Return> "browse_tree_accept $adr_var 1 $w.tree"
|
||||
|
||||
# At least double-click does work
|
||||
$w.tree bindText <Double-Button-1> "browse_tree_accept $adr_var 1 $w.tree"
|
||||
|
||||
$w.tree bindText <Button-3> {browse_tree_help "Browse tree" grey}
|
||||
|
||||
scrollbar $w.treescroll_y -command "$w.tree yview"
|
||||
scrollbar $w.treescroll_x -orient horizontal -command "$w.tree xview "
|
||||
pack $w.tree -in $w.tree_frame_y -side left -expand 1 -fill both
|
||||
@ -2412,19 +2494,29 @@ proc browse_tree {adr_var which_fs} {
|
||||
pack $w.tree_frame_y $w.treescroll_x -in $w.tree_frame \
|
||||
-side top -expand 1 -fill both
|
||||
|
||||
# >>> BAUSTELLE
|
||||
|
||||
# >>> Need key bindings for navigation and selection
|
||||
|
||||
# >>> Need help bindings
|
||||
|
||||
button $w.close -text "Close" -command "$destroy_cmd $w" \
|
||||
frame $w.button_line
|
||||
set button_width 10
|
||||
button $w.accept -text "Accept" -width "$button_width" \
|
||||
-command "browse_tree_accept_sel $adr_var 1 $w.tree"
|
||||
bind_help $w.accept "Accept (browse tree)"
|
||||
button $w.up -text "Up" -width "$button_width" \
|
||||
-command "browse_tree_up $adr_var $w.tree $which_fs"
|
||||
bind_help $w.up "Up (browse tree)"
|
||||
button $w.down -text "Down" -width "$button_width" \
|
||||
-command "browse_tree_down $adr_var $w.tree $which_fs"
|
||||
bind_help $w.down "Down (browse tree)"
|
||||
button $w.help -text "Help" -width "$button_width" \
|
||||
-command {window_help "Browse tree" grey}
|
||||
bind_help $w.help "Browse tree"
|
||||
button $w.close -text "Close" -width "$button_width" \
|
||||
-command "$destroy_cmd $w" \
|
||||
-background "$button_color"
|
||||
bind_help $w.close "Close (browse tree)"
|
||||
pack $w.accept $w.up $w.down $w.help $w.close \
|
||||
-in $w.button_line -side left -expand 1 -fill both
|
||||
|
||||
# >>> Need "Up" button
|
||||
|
||||
pack $w.tree_frame $w.close -side top
|
||||
|
||||
pack $w.tree_frame $w.button_line -side top
|
||||
focus $w.tree
|
||||
} else {
|
||||
raise $w
|
||||
}
|
||||
@ -2765,6 +2857,9 @@ set help_window_lines 18
|
||||
# The distance of the help text from the help window border
|
||||
set help_window_border_width 0
|
||||
|
||||
# The number of items to display in a tree browser window
|
||||
set tree_window_lines 12
|
||||
|
||||
|
||||
# -------- GUI definition procedures
|
||||
|
||||
@ -3351,13 +3446,13 @@ proc init_localfs_aux {} {
|
||||
.overwrite_disk_files_button \
|
||||
-in .localfs_aux_frame -side left
|
||||
if {"$have_bwidget" == 1} {
|
||||
checkbutton .browse_select_is_return -text "File browser Return" \
|
||||
checkbutton .browse_select_is_setvar -text "File browser textfield" \
|
||||
-indicatoron 1 -selectcolor "" \
|
||||
-relief ridge -borderwidth 2 \
|
||||
-variable "browse_select_is_return" \
|
||||
-variable "browse_select_is_setvar" \
|
||||
-onvalue 1 -offvalue 0
|
||||
bind_help .browse_select_is_return "File browser Return"
|
||||
pack .browse_select_is_return -in .localfs_aux_frame -side left
|
||||
bind_help .browse_select_is_setvar "File browser textfield"
|
||||
pack .browse_select_is_setvar -in .localfs_aux_frame -side left
|
||||
}
|
||||
|
||||
button .avail_button -text "Refresh avail:" \
|
||||
@ -3983,70 +4078,85 @@ underneath \"ISO directory:\".
|
||||
This copies the selected files or directory trees from the input drive
|
||||
to the address on hard disk which is given by the text field right of
|
||||
the button."
|
||||
}
|
||||
if {"$what" == "Browse tree"} {
|
||||
return "[tell_file_browser_help 0]"
|
||||
}
|
||||
if {"$what" == "Close (browse tree)"} {
|
||||
return \
|
||||
"The \"Close\" button in the file browser closes the browser window without
|
||||
performing other actions."
|
||||
}
|
||||
if {"$what" == "Up (browse tree)"} {
|
||||
return \
|
||||
"The \"Up\" button in the file browser brings you to the parent directory
|
||||
of the currently selected file tree item.
|
||||
|
||||
The parent directory will be opened.
|
||||
All opened directory trees underneath the parent will be closed."
|
||||
}
|
||||
if {"$what" == "Down (browse tree)"} {
|
||||
return \
|
||||
"The \"Down\" button in the file browser opens the directory underneath
|
||||
the currently selected file tree item.
|
||||
|
||||
It has the same effect as clicking the \"+\" node of the selected item."
|
||||
}
|
||||
if {"$what" == "Accept (browse tree)"} {
|
||||
return \
|
||||
"The \"Accept\" button in the file browser brings the single selected item
|
||||
from the file browser tree into effect with the associated text field.
|
||||
|
||||
It works as if the item had been double clicked."
|
||||
}
|
||||
if {"$what" == "Browse disk (extract)"} {
|
||||
return \
|
||||
"The \"/\" button in the \"Extract to disk:\" line pops up a file tree
|
||||
browser to select a target address in the hard disk filesystem.
|
||||
|
||||
Click on the \"+\" resp. \"-\" nodes to open resp. close directories.
|
||||
Click on an item to bring it into effect with the \"Extract to disk:\"
|
||||
field."
|
||||
[tell_file_browser_help 1]"
|
||||
}
|
||||
if {"$what" == "Browse disk (burn image)"} {
|
||||
return \
|
||||
"The \"/\" button beneath the \"Burn image file\" field pops up a file
|
||||
tree browser to select a source address in the hard disk filesystem.
|
||||
|
||||
Click on the \"+\" resp. \"-\" nodes to open resp. close directories.
|
||||
Click on an item to bring it into effect with the \"Burn image file\"
|
||||
field."
|
||||
[tell_file_browser_help 1]"
|
||||
}
|
||||
if {"$what" == "Browse disk (insert)"} {
|
||||
return \
|
||||
"The \"/\" button beneath the \"Insert from disk\" field pops up a file
|
||||
tree browser to select a source address in the hard disk filesystem.
|
||||
|
||||
Click on the \"+\" resp. \"-\" nodes to open resp. close directories.
|
||||
Click on an item to bring it into effect with the \"Insert from disk\"
|
||||
field."
|
||||
|
||||
[tell_file_browser_help 1]"
|
||||
}
|
||||
if {"$what" == "Browse disk (indev)"} {
|
||||
return \
|
||||
"The \"/\" button in the \"Input drive or image\" line pops up a file tree
|
||||
browser to select a source address in the hard disk filesystem.
|
||||
|
||||
Click on the \"+\" resp. \"-\" nodes to open resp. close directories.
|
||||
Click on an item to bring it into effect with the \"Input drive or image\"
|
||||
field."
|
||||
[tell_file_browser_help 1]"
|
||||
}
|
||||
if {"$what" == "Browse disk (outdev)"} {
|
||||
return \
|
||||
"The \"/\" button in the \"Output drive or image\" line pops up a file tree
|
||||
browser to select a source address in the hard disk filesystem.
|
||||
|
||||
Click on the \"+\" resp. \"-\" nodes to open resp. close directories.
|
||||
Click on an item to bring it into effect with the \"Output drive or image\"
|
||||
field."
|
||||
[tell_file_browser_help 1]"
|
||||
}
|
||||
if {"$what" == "Browse ISO (isodir)"} {
|
||||
return \
|
||||
"The \"/\" button in the \"ISO directory\" line pops up a file tree
|
||||
browser to select the current directory in the ISO filesystem model.
|
||||
|
||||
Click on the \"+\" resp. \"-\" nodes to open resp. close directories.
|
||||
Click on an item to bring it into effect with the \"ISO directory\"
|
||||
field."
|
||||
[tell_file_browser_help 1]"
|
||||
}
|
||||
if {"$what" == "Browse ISO (move target)"} {
|
||||
return \
|
||||
"The \"/\" button in the \"ISO selection:\" line pops up a file tree
|
||||
browser to select the current directory in the ISO filesystem model.
|
||||
|
||||
Click on the \"+\" resp. \"-\" nodes to open resp. close directories.
|
||||
Click on an item to bring it into the address field for \"Rename to:\"
|
||||
and \"Make dir\"."
|
||||
[tell_file_browser_help 1]"
|
||||
}
|
||||
if {"$what" == "Browse disk (dummy)"} {
|
||||
return \
|
||||
@ -4134,14 +4244,17 @@ This is DANGEROUS, of course, but comes in handy with restoring of backups.
|
||||
The frontend program will only detect the most obvious name collisions,
|
||||
but xorriso will reliably refuse to overwrite files if this is banned."
|
||||
}
|
||||
if {"$what" == "File browser Return"} {
|
||||
if {"$what" == "File browser textfield"} {
|
||||
return \
|
||||
"The \"File browser Return\" switch controls whether a selection click in
|
||||
the file browser shall also hit the Return key after setting the
|
||||
selected address into the text input field.
|
||||
"The \"File browser textfield\" switch controls whether a single click
|
||||
or cursor movement in the file browser shall bring the selected file
|
||||
address into the associated text input field.
|
||||
|
||||
If the switch is disabled, then the address gets written into the field
|
||||
but no further action is triggered."
|
||||
only if double clicked.
|
||||
|
||||
In any case, double clicked addresses get treated as if the Return key
|
||||
had been hit in the text field."
|
||||
}
|
||||
if {"$what" == "Refresh avail:"} {
|
||||
return \
|
||||
@ -4282,6 +4395,30 @@ resp. directory creation."
|
||||
}
|
||||
|
||||
|
||||
# Tell the general help text of the file browser.
|
||||
#
|
||||
proc tell_file_browser_help {with_separator} {
|
||||
set sep ""
|
||||
if {"$with_separator" == 1} {
|
||||
set sep \
|
||||
"-------------------------------------------------------------------------\n\n"
|
||||
}
|
||||
return \
|
||||
"${sep}The file tree browser presents to you a directory tree and
|
||||
lets you bring into effect one of the file addresses in that tree.
|
||||
|
||||
Click on the \"+\" resp. \"-\" nodes to open resp. close directories.
|
||||
|
||||
Double click on an item to bring it into effect with the associated
|
||||
text field. I.e. double clicking also hits the Return key in that field.
|
||||
|
||||
If the \"File browser textfield\" switch is enabled then a single click
|
||||
or a cursor movement by the arrow keys brings the selected item into
|
||||
the associated text field, but does not hit the Return key. So you may
|
||||
edit the name before hitting Return yourself."
|
||||
}
|
||||
|
||||
|
||||
# ------- Misc helper procedures -------
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2012.12.30.115258"
|
||||
#define Xorriso_timestamP "2012.12.30.195312"
|
||||
|
Loading…
Reference in New Issue
Block a user