Skip to content

Commit

Permalink
2020-07-13 22:43:43 UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
Decent Espresso committed Jul 13, 2020
1 parent 7b3b718 commit 98c8319
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
50 changes: 50 additions & 0 deletions gui.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2068,12 +2068,62 @@ proc listbox_moveto {lb dest1 dest2} {
$lb yview moveto $dest2
}

# convenience function to link a "scale" widget with a "listbox" so that the scale becomes a scrollbar to the listbox, rather than using the ugly Tk native scrollbar

proc listbox_moveto_new {lb dest1 dest2} {

# get number of items visible in list box

set visible_items [lindex [split [$lb configure -height] " "] 4]

# get total items in listbox

set total_items [$lb size]

# if all the items fit on screen then there is nothing to do

if {$visible_items >= $total_items} {return}

# determine which item would be at the top if the last items is at the bottom

set last_top_item [expr $total_items - $visible_items]

# determine which item should be at the top for the requested value

set top_item [expr int(round($last_top_item * $dest2))]

$lb yview $top_item

}

# convenience function to link a "scale" widget with a "listbox" so that the scale becomes a scrollbar to the listbox, rather than using the ugly Tk native scrollbar
proc scale_scroll {lb dest1 dest2} {
upvar $lb fieldname
set fieldname $dest1
}

# convenience function to link a "scale" widget with a "listbox" so that the scale becomes a scrollbar to the listbox, rather than using the ugly Tk native scrollbar
proc scale_scroll_new {lb value dest1 dest2} {

return [scale_scroll $lb $dest1 $dest2]

#TODO: get a reference to the listbox somehow?

# get number of items visible in list box
set visible_items [lindex [split [$lb configure -height] " "] 4]
# get total items in listbox
set total_items [$lb size]
# if all the items fit on screen then there is nothing to do
if {$visible_items >= $total_items} {return}
# determine which item would be at the top if the last items is at the bottom
set last_top_item [expr $total_items - $visible_items]
# determine what percentage of the way down the current item is
set rescaled_value [expr $dest1 / $total_items * $visible_items]

upvar $value fieldname
set fieldname $rescaled_value
}

proc calibration_gui_init {} {

# calibration should always take place in Celsius
Expand Down
4 changes: 2 additions & 2 deletions manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"translation.tcl" 394251 1594411629 74fed483b6d121b3716169b06770bd83396dce79d3162df6b1788f24d0ea3ef3
"de1plus.tcl" 170 1515060265 5fed814ddfcaeeb20317ebf4b554b4c88a5dac1f7e606c193adecc2388014687
"de1.tcl" 144 1515562773 badcd3b35fd9257cacb1e21807e8dc836137ca6cdcbf01c21df5f96b76254b2c
"gui.tcl" 77311 1594575364 24e5b8cec37826f388986fe68cba327c49cec13d7f9fca794ff3a56aeed64ac6
"gui.tcl" 79070 1594680221 6a6b0a940ef2f2e9fd7292bd8a5a8ab8fc1c123ae055f74486a3a872511a5cc9
"machine.tcl" 24133 1594496138 cebaae40fbd51c15934f84e8d664f376f9229bd8a49ea53806d091f087e3c6b9
"utils.tcl" 77468 1594172818 1e35bd2dadb57011c383e593d0795923dc64f5756962c2c565091835838bf417
"main.tcl" 647 1545380109 379121426d075b5e3a1fbbfdffd73a23110acc3be81e22efb2eb8232d1240f71
Expand Down Expand Up @@ -44,7 +44,7 @@
"godshots/export/columnar/readme.txt" 296 1545298443 bb57ed445a77d13ea3d6168c2d195caf1608b603b94125e2e00d6a8c839fae8e
"splash/1280x800/de1.jpg" 35488 1523957754 49c9de9c31039ae3d6afc8b5427d6bce8dac1b29448f25767605a6775207c757
"splash/2560x1600/de1.jpg" 384894 1513854361 e281b598098ac6acda37553815ef9880508dd1c66cf8d9ae386a3d3ddcd1ef38
"skins/default/de1_skin_settings.tcl" 127410 1594432938 0f9c48e188ffd2f6c848843a47fc870e9576321a710903fdce414eb86f55264a
"skins/default/de1_skin_settings.tcl" 127539 1594680191 dbce06a89aa4bf9c9f45e6ac6e3db8895249b3729d5dde1517a58718edbbb321
"skins/default/skin.tcl" 3982 1516857381 5396820dffbe19fb2e764e64c5ea31c58b82b2bf7e18e53bee93de6fd9db7db5
"skins/default/standard_includes.tcl" 3594 1594062739 41fc7eb31c7c10a916241df96d5ec46ea5ade7019bd71b985c1d3d5bfc61d3fc
"skins/default/standard_stop_buttons.tcl" 2697 1578964025 c08b787ab2d1379e2a3389afd0de93b726fc8e9dba302554e82e49c12d92e962
Expand Down
8 changes: 4 additions & 4 deletions skins/default/de1_skin_settings.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ add_de1_widget "settings_2c" listbox 70 310 {
load_advanced_profile_step 1
bind $widget <<ListboxSelect>> ::load_advanced_profile_step

} -background #fbfaff -yscrollcommand {scale_scroll ::advsteps_slider} -font $listbox_font -bd 0 -height $adv_listbox_height -width 18 -foreground #d3dbf3 -borderwidth 0 -selectborderwidth 0 -relief flat -highlightthickness 0 -selectmode single -selectbackground #c0c4e1
} -background #fbfaff -yscrollcommand {scale_scroll_new $::advanced_shot_steps_widget ::advsteps_slider} -font $listbox_font -bd 0 -height $adv_listbox_height -width 18 -foreground #d3dbf3 -borderwidth 0 -selectborderwidth 0 -relief flat -highlightthickness 0 -selectmode single -selectbackground #c0c4e1

set ::advsteps_slider 0

Expand Down Expand Up @@ -364,7 +364,7 @@ add_de1_widget "settings_1" listbox 50 305 {
set ::globals(profiles_listbox) $widget
fill_profiles_listbox
bind $::globals(profiles_listbox) <<ListboxSelect>> ::preview_profile
} -background #fbfaff -yscrollcommand {scale_scroll ::profiles_slider} -font $listbox_font -bd 0 -height 15 -width 32 -foreground #d3dbf3 -borderwidth 0 -selectborderwidth 0 -relief flat -highlightthickness 0 -selectmode single -selectbackground #c0c4e1
} -background #fbfaff -yscrollcommand {scale_scroll_new $::globals(profiles_listbox) ::profiles_slider} -font $listbox_font -bd 0 -height 15 -width 32 -foreground #d3dbf3 -borderwidth 0 -selectborderwidth 0 -relief flat -highlightthickness 0 -selectmode single -selectbackground #c0c4e1

set ::profiles_slider 0

Expand Down Expand Up @@ -464,7 +464,7 @@ add_de1_text "settings_4" 50 220 -text [translate "Update App"] -font Helv_10_bo
set ::globals(tablet_styles_listbox) $widget
fill_skin_listbox
bind $::globals(tablet_styles_listbox) <<ListboxSelect>> ::preview_tablet_skin
} -background #fbfaff -yscrollcommand {scale_scroll ::skin_slider} -font $listbox_font -bd 0 -height 10 -width 30 -foreground #d3dbf3 -borderwidth 0 -selectborderwidth 0 -relief flat -highlightthickness 0 -selectmode single -selectbackground #c0c4e1
} -background #fbfaff -yscrollcommand {scale_scroll_new $::globals(tablet_styles_listbox) ::skin_slider} -font $listbox_font -bd 0 -height 10 -width 30 -foreground #d3dbf3 -borderwidth 0 -selectborderwidth 0 -relief flat -highlightthickness 0 -selectmode single -selectbackground #c0c4e1

set ::skin_slider 0
set ::skin_scrollbar [add_de1_widget "tabletstyles" scale 10000 1 {} -from 0 -to .90 -bigincrement 0.2 -background "#d3dbf3" -borderwidth 1 -showvalue 0 -resolution .01 -length [rescale_x_skin 400] -width [rescale_y_skin 150] -variable ::skin_slider -font Helv_10_bold -sliderlength [rescale_x_skin 125] -relief flat -command {listbox_moveto $::globals(tablet_styles_listbox) $::skin_slider} -foreground #FFFFFF -troughcolor "#f7f6fa" -borderwidth 0 -highlightthickness 0]
Expand Down Expand Up @@ -550,7 +550,7 @@ add_de1_text "settings_4" 50 220 -text [translate "Update App"] -font Helv_10_bo
set ::languages_widget $widget
bind $widget <<ListboxSelect>> ::load_language
fill_languages_listbox
} -background #fbfaff -yscrollcommand {scale_scroll ::language_slider} -font global_font -bd 0 -height 9 -width 26 -foreground #d3dbf3 -borderwidth 0 -selectborderwidth 0 -relief flat -highlightthickness 0 -selectmode single -selectbackground #c0c4e1
} -background #fbfaff -yscrollcommand {scale_scroll_new $::languages_widget ::language_slider} -font global_font -bd 0 -height 9 -width 26 -foreground #d3dbf3 -borderwidth 0 -selectborderwidth 0 -relief flat -highlightthickness 0 -selectmode single -selectbackground #c0c4e1


set ::language_slider 0
Expand Down
2 changes: 1 addition & 1 deletion timestamp.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1594667095
1594680223

0 comments on commit 98c8319

Please sign in to comment.