Made main Help window independent of help window for GUI elements

This commit is contained in:
Thomas Schmitt 2012-12-31 10:06:08 +00:00
parent cc2517846c
commit 09ef611fee
2 changed files with 95 additions and 53 deletions

View File

@ -1003,11 +1003,12 @@ set busy_text_exists 0
# Whether to demand a click before focus goes to entry or listbox
set click_to_focus "0"
# Whether .ack_window , .yesno_window , .help_window is already displayed
# (>>> Better would be to block user interaction until they are gone)
# Whether .ack_window , .yesno_window , .help_window, .main_help_window
# are already displayed.
set ack_window_is_active 0
set yesno_window_is_active 0
set help_window_is_active 0
set main_help_window_is_active 0
# Whether the help window already has a scroll bar
set help_window_has_scroll 0
@ -1026,7 +1027,7 @@ set browse_iso_window_is_active 0
set browse_iso_window_var ""
# Whether to bring the selected browser item directly into the text field
set browse_select_is_setvar 1
set browse_select_is_setvar 0
@ -2251,7 +2252,7 @@ proc browse_tree_accept {adr_var_name do_return tr selected} {
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."
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"
@ -2266,7 +2267,7 @@ proc browse_tree_up {adr_var_name tr which_fs} {
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."
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item before clicking the \"Up\" button."
return ""
}
set adr [file dirname [lindex "$selected" 0]]
@ -2289,7 +2290,7 @@ proc browse_tree_down {adr_var_name tr which_fs} {
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."
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item before clicking the \"Down\" button."
return ""
}
set adr [lindex "$selected" 0]
@ -2425,7 +2426,8 @@ 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 tree_window_lines
global browse_disk_window_var browse_iso_window_var
global tree_window_lines tree_window_width tree_window_button_width
set button_color "grey"
@ -2433,7 +2435,7 @@ proc browse_tree {adr_var which_fs} {
if {"$which_fs" == "isofs"} {
set w {.browse_iso_window}
set window_is_active "$browse_iso_window_is_active"
set title_name "xorriso-tcltk ISO filesystem browser"
set title_name "xorriso-tcltk ISO model browser"
set open_dir_cmd "browse_iso_open_dir"
set destroy_cmd "destroy_browse_iso"
if {"$browse_iso_window_var" != "$adr_var" && "$window_is_active" == 1} {
@ -2446,7 +2448,7 @@ proc browse_tree {adr_var which_fs} {
} else {
set w {.browse_disk_window}
set window_is_active "$browse_disk_window_is_active"
set title_name "xorriso-tcltk disk filesystem browser"
set title_name "xorriso-tcltk hard disk filesystem browser"
set open_dir_cmd "browse_disk_open_dir"
set destroy_cmd "destroy_browse_disk"
if {"$browse_disk_window_var" != "$adr_var" && "$window_is_active" == 1} {
@ -2470,8 +2472,8 @@ proc browse_tree {adr_var which_fs} {
if {"$re_use_widgets" == 0} {
# BWidget Tree
frame $w.tree_frame
frame $w.tree_frame_y
Tree $w.tree -width 80 -height "$tree_window_lines" \
frame $w.tree_frame_x
Tree $w.tree -width "$tree_window_width" -height "$tree_window_lines" \
-opencmd "$open_dir_cmd $w.tree" \
-closecmd "browse_tree_close_dir $w.tree" \
-selectcommand "browse_tree_select $adr_var" \
@ -2489,36 +2491,35 @@ proc browse_tree {adr_var which_fs} {
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
pack $w.treescroll_y -in $w.tree_frame_y -side left -fill y
pack $w.tree_frame_y $w.treescroll_x -in $w.tree_frame \
-side top -expand 1 -fill both
pack $w.tree -in $w.tree_frame_x -side top -expand 1 -fill both
pack $w.treescroll_x -in $w.tree_frame_x -side top -fill x
pack $w.treescroll_y $w.tree_frame_x -in $w.tree_frame \
-side left -expand 1 -fill both
frame $w.button_line
set button_width 10
button $w.accept -text "Accept" -width "$button_width" \
button $w.accept -text "Accept" -width "$tree_window_button_width" \
-command "browse_tree_accept_sel $adr_var 1 $w.tree"
bind_help $w.accept "Accept (browse tree)"
button $w.to_field -text "To field" -width "$button_width" \
button $w.to_field -text "Edit" -width "$tree_window_button_width" \
-command "browse_tree_accept_sel $adr_var 0 $w.tree"
bind_help $w.to_field "To field (browse tree)"
button $w.up -text "Up" -width "$button_width" \
bind_help $w.to_field "Edit (browse tree)"
button $w.up -text "Up" -width "$tree_window_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" \
button $w.down -text "Down" -width "$tree_window_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" \
button $w.help -text "Help" -width "$tree_window_button_width" \
-command {window_help "Browse tree" grey}
bind_help $w.help "Browse tree"
button $w.close -text "Close" -width "$button_width" \
button $w.close -text "Close" -width "$tree_window_button_width" \
-command "$destroy_cmd $w" \
-background "$button_color"
bind_help $w.close "Close (browse tree)"
pack $w.accept $w.to_field $w.up $w.down $w.help $w.close \
-in $w.button_line -side left -expand 1 -fill both
pack $w.up $w.down $w.accept $w.to_field $w.help $w.close \
-in $w.button_line -side left -expand 0
pack $w.tree_frame $w.button_line -side top
pack $w.tree_frame $w.button_line -side top -anchor w
focus $w.tree
} else {
raise $w
@ -2709,14 +2710,19 @@ proc window_ack {question button_color where} {
# Destroy the help pop-up window.
#
proc destroy_help {w} {
proc destroy_help {w help_main} {
global help_window_is_active help_window_has_scroll
global main_help_window_is_active
if {"$w" != ""} {
destroy "$w"
}
if {"$help_main" == 1} {
set main_help_window_is_active 0
} else {
set help_window_is_active 0
set help_window_has_scroll 0
}
}
@ -2729,25 +2735,46 @@ proc surround_text {text} {
#
proc window_help {about_what button_color} {
global help_window_is_active help_window_lines help_window_has_scroll
global help_window_border_width
global .help_window
global help_window_border_width main_help_window_is_active
global main_help_window_lines
global .help_window .main_help_window
# The main help window is independent of the GUI element help window
if {"$about_what" == "Help"} {
set help_main 1
set w {.main_help_window}
set window_is_active "$main_help_window_is_active"
set window_has_scroll 1
set window_lines "$main_help_window_lines"
} else {
set help_main 0
set w {.help_window}
set window_is_active "$help_window_is_active"
set window_has_scroll "$help_window_has_scroll"
set window_lines "$help_window_lines"
}
# Giving the help text some distance from the border decorations
set line_width 82
set helptext "\n\n [string map {\n "\n "} [tell_helptext "$about_what"]]\n"
if {[count_newlines "$helptext"] >= "$help_window_lines"} {
if {"$help_window_is_active" == 1 && "$help_window_has_scroll" == 0} {
destroy_help $w
if {[count_newlines "$helptext"] >= "$window_lines"} {
if {"$window_is_active" == 1 && "$window_has_scroll" == 0} {
destroy_help $w "$help_main"
set window_is_active 0
}
set help_window_has_scroll 1
if {"$help_main" == 0} {set help_window_has_scroll 1}
set window_has_scroll 1
}
set re_use_widgets 0
if {"$help_window_is_active" == 0} {
if {"$window_is_active" == 0} {
toplevel $w -borderwidth "$help_window_border_width" -class Help
wm title $w "xorriso-tcltk help text"
if {"$help_main" == 1} {
set main_help_window_is_active 1
} else {
set help_window_is_active 1
}
} else {
set re_use_widgets 1
}
@ -2758,17 +2785,17 @@ proc window_help {about_what button_color} {
raise $w
} else {
# wm geometry $w +0+0
set destroy_cmd "destroy_help $w"
set destroy_cmd "destroy_help $w $help_main"
frame $w.text_frame
text $w.text -width "$line_width" -height "$help_window_lines" \
text $w.text -width "$line_width" -height "$window_lines" \
-relief flat -borderwidth 0
$w.text insert end "$helptext"
pack $w.text -in $w.text_frame -side left -expand 1 -fill both
if {"$help_window_has_scroll" == 1} {
if {"$window_has_scroll" == 1} {
scrollbar $w.scroll_y -command "$w.text yview"
$w.text configure -yscrollcommand "$w.scroll_y set"
bind_listbox_keys $w.text "$help_window_lines" "text"
bind_listbox_keys $w.text "$window_lines" "text"
pack $w.scroll_y -in $w.text_frame -side left -fill y
}
@ -2855,13 +2882,18 @@ set export_msg_selection true
set export_selection false
# The number of lines in the display of the help texts
set help_window_lines 18
set main_help_window_lines 24
set help_window_lines 16
# 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
# The number of visible characters in a tree browser line
set tree_window_width 50
# The width in characters of the six buttons under the tree browser
set tree_window_button_width 6
# -------- GUI definition procedures
@ -3763,7 +3795,7 @@ Dependencies:
xorriso, Tcl language, Tk GUI toolkit, optionally Tcl/Tk package BWidget
Copyright (C) 2012, Thomas Schmitt <scdbackup@gmx.net>, libburnia-project.org
Provided under GNU GPL version 2 or later."
Provided under GNU GPL version 3 or later."
}
if {"$what" == "End"} {
return \
@ -3998,10 +4030,17 @@ command -eject \"out\"."
}
if {"$what" == "Blank"} {
return \
"The \"Blank\" button executes command -blank \"as_needed\" on the output drive.
"The \"Blank\" button executes command -blank \"as_needed\" on the output drive
in order to make a re-usable medium or an ISO image data file writable from
scratch.
This also applies to ISO image data files and overwritable media like DVD+RW,
which will get invalidated by a small write operation."
Genuine blanking applies only to CD-RW and DVD-RW.
But xorriso emulates ISO 9660 multi-session on DVD+RW, DVD-RAM,
formatted DVD-RW, BD-RE, as well as in ISO image data files on hard disk.
On those media and pseudo media, blanking will be performed by a small
write operation which invalidates their existing ISO filesystem.
One-time writable media CD-R, DVD-R, DVD+R, and BD-R cannot be blanked."
}
if {"$what" == "Format"} {
return \
@ -4113,13 +4152,16 @@ I.e. it hits the Return key of the field.
It works as if the item had been double clicked."
}
if {"$what" == "To field (browse tree)"} {
if {"$what" == "Edit (browse tree)"} {
return \
"The \"To field\" button in the file browser brings the single selected item
from the file browser tree into the associated text field. It does not hit
the Return key of the field.
"The \"Edit\" button in the file browser brings the single selected item
from the file browser tree into the associated text field.
It works as if the switch \"File browser text field\" was enabled."
It does not hit the Return key of the field, but gives you the opportunity
to edit the file address.
(This is done automatically with every selection if the switch
\"File browser text field\" is enabled.)"
}
if {"$what" == "Browse disk (extract)"} {
return \

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.12.30.203203"
#define Xorriso_timestamP "2012.12.31.100509"