Check-in [c8aeb0a95a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Show album viewer when clicked on thumbnail
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c8aeb0a95afe123c9234ae4375ce6a54cd1dd4a2
User & Date: bernd 2019-12-04 21:22:48
Context
2019-12-04
22:55
More work on album viewer check-in: 0002f7b7bb user: bernd tags: trunk
21:22
Show album viewer when clicked on thumbnail check-in: c8aeb0a95a user: bernd tags: trunk
2019-12-03
23:01
Use presentation-support.fs check-in: 73766584da user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to gui.fs.

1019
1020
1021
1022
1023
1024
1025
1026
1027

1028
1029
1030



1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051

1052








1053
1054
1055
1056
1057
1058
1059
1060
1061
1062







1063
1064
1065
1066
1067
1068
1069
1070

1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085

1086
1087
1088
1089
1090
1091
1092
	128 128 glue*thumb dummy-thumb }}thumb >r
	r@ [n:h update-thumb ;] { w^ xt } xt cell hash key| fetch-finish# #!
	hash key| ?fetch
    THEN  {{ glue*ll }}glue r> }}v 40%bv box[] ;

hash: imgs# \ hash of tables of

0 Value imgs-box
0 Value n2o-frame


glue ' new static-a with-allocater Constant iglue-left
glue ' new static-a with-allocater Constant iglue-right




: swap-images ( -- )
    imgs-box .childs[] dup >r get-stack >r 2swap r> r> set-stack ;

: prev-img ;
: next-img ;

: /mid ( o -- o' )
    >r {{ glue*l }}glue r> /center glue*l }}glue }}v box[] >bl ;

{{
    glue*wh album-bg-col# slide-frame dup .button1
    {{
	iglue-left }}glue
	tex: img0 ' img0 "doc/thumb.png" 0.666e }}image-file drop /mid
	tex: img1 ' img1 "doc/thumb.png" 0.666e }}image-file drop /mid /hflip
	tex: img2 ' img2 "doc/thumb.png" 0.666e }}image-file drop /mid /hflip
	tex: img3 ' img3 "doc/thumb.png" 0.666e }}image-file drop /mid /hflip
	iglue-right }}glue
    }}h dup to imgs-box
    {{

	glue*ll }}glue








	{{  \large
	    "  " }}text ' prev-img 0 click[]
	    glue*ll }}glue
	    "  " }}text ' next-img 0 click[]
	    \normal
	}}h box[]
	glue*ll }}glue
    }}v box[]
}}z box[] Constant album-viewer








: .imgs ( -- )
    imgs# [: dup $. ." :" cr
	cell+ $@ bounds ?DO
	    I $@ over be-64@ .ticks space
	    1 64s /string 85type cr
	cell +LOOP ;] #map ;
: +imgs ( addr$ -- )
    [: { w^ string | ts[ 1 64s ] } msg:timestamp ts[ be-64!

	ts[ 1 64s type  string $. ;] $tmp $make { w^ string }
    msg-group$ $@ imgs# #@ d0= IF
	string cell msg-group$ $@ imgs# #!
    ELSE
	string $@ last# cell+ $ins[]  string $free
    THEN ;

:noname ( addr u type -- )
    obj-red
    case 0 >r
	msg:image#     of
	    msg-box .childs[] $[]# ?dup-IF
		rdrop  1- msg-box .childs[] $[] @
		dup .name$ "thumbnail" str= IF
		    [: ." display image: " addr data $@ 85type cr ;]

		    2swap $make dup +imgs
		    click[] drop  EXIT  THEN  drop  THEN
	    [: ." img["      85type ']' emit ;] $tmp }}text  "image" name!
	endof
	msg:thumbnail# of  ?thumb  "thumbnail" name!  endof
	msg:patch#     of  [: ." patch["    85type ']' emit
	    ;] $tmp }}text  "patch" name!  endof







|
|
>

<
|
>
>
>




<
<
<






|
|
|
|
|
|


>
|
>
>
>
>
>
>
>
>

|

|






>
>
>
>
>
>
>







|
>




|









|
>







1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029

1030
1031
1032
1033
1034
1035
1036
1037



1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
	128 128 glue*thumb dummy-thumb }}thumb >r
	r@ [n:h update-thumb ;] { w^ xt } xt cell hash key| fetch-finish# #!
	hash key| ?fetch
    THEN  {{ glue*ll }}glue r> }}v 40%bv box[] ;

hash: imgs# \ hash of tables of

slide-deck Constant default-sd
slide-class new Constant album-sd
album-sd to slide-deck


glue new glue-left !
glue new glue-right !

0 Value imgs-box

: swap-images ( -- )
    imgs-box .childs[] dup >r get-stack >r 2swap r> r> set-stack ;




: /mid ( o -- o' )
    >r {{ glue*l }}glue r> /center glue*l }}glue }}v box[] >bl ;

{{
    glue*wh album-bg-col# slide-frame dup .button1
    {{
	glue-left @ }}glue
	tex: img0 ' img0 "doc/thumb.png" 0.666e }}image-file drop /mid        dup >slides
	tex: img1 ' img1 "doc/thumb.png" 0.666e }}image-file drop /mid /hflip dup >slides
	tex: img2 ' img2 "doc/thumb.png" 0.666e }}image-file drop /mid /hflip dup >slides
	tex: img3 ' img3 "doc/thumb.png" 0.666e }}image-file drop /mid /hflip dup >slides
	glue-right @ }}glue
    }}h dup to imgs-box
    {{
	{{
	    glue*ll }}glue
	    {{
		s" ❌" }}text 25%b
		[:  n2o-frame .childs[] stack> drop
		    default-sd to slide-deck
		    +sync +resize ;] 0 click[]
		glue*ll }}glue
	    }}v box[]
	}}h box[]
	{{  \large
	    "  " }}text ' prev-slide 0 click[]
	    glue*ll }}glue
	    "  " }}text ' next-slide 0 click[]
	    \normal
	}}h box[]
	glue*ll }}glue
    }}v box[]
}}z box[] Constant album-viewer

: >album-viewer ( -- )
    album-viewer n2o-frame .childs[] >stack
    album-sd to slide-deck
    +sync +resize ;

default-sd to slide-deck

: .imgs ( -- )
    imgs# [: dup $. ." :" cr
	cell+ $@ bounds ?DO
	    I $@ over be-64@ .ticks space
	    1 64s /string 85type cr
	cell +LOOP ;] #map ;
: +imgs ( addr$ -- )
    [: { w^ string | ts[ 1 64s ] }
	msg:timestamp ts[ be-64!
	ts[ 1 64s type  string $. ;] $tmp $make { w^ string }
    msg-group$ $@ imgs# #@ d0= IF
	string cell msg-group$ $@ imgs# #!
    ELSE
	string $@ last# cell+ $ins[] drop  string $free
    THEN ;

:noname ( addr u type -- )
    obj-red
    case 0 >r
	msg:image#     of
	    msg-box .childs[] $[]# ?dup-IF
		rdrop  1- msg-box .childs[] $[] @
		dup .name$ "thumbnail" str= IF
		    [:  ." display image: " addr data $@ 85type cr
			>album-viewer ;]
		    2swap $make dup +imgs
		    click[] drop  EXIT  THEN  drop  THEN
	    [: ." img["      85type ']' emit ;] $tmp }}text  "image" name!
	endof
	msg:thumbnail# of  ?thumb  "thumbnail" name!  endof
	msg:patch#     of  [: ." patch["    85type ']' emit
	    ;] $tmp }}text  "patch" name!  endof