Check-in [0002f7b7bb]
Not logged in

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

Overview
Comment:More work on album viewer
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0002f7b7bbf483d850103e9c1e4d86c06e6a4994
User & Date: bernd 2019-12-04 22:55:04
Context
2019-12-05
14:43
Fix for new exif API check-in: a149c7ede6 user: bernd tags: trunk
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to gui.fs.

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
....
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
....
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
1111
$FFFFFFFF new-color, FValue login-bg-col#
$FF000000 $FF0000FF fade-color, FValue pw-err-col#
$000000FF dup text-emoji-color: black-emoji
$000000FF new-color, FValue otr-col#
$FFFFFFFF new-color, FValue chat-col#
$80FFFFFF new-color, FValue chat-bg-col#
$FFFFFFFF new-color, FValue posting-bg-col#
$FFFFFFCC new-color, FValue album-bg-col#

: entropy-colorize ( -- )
    prev-text$ erase  addr prev-text$ $free
    edit-w .text$ passphrase-entropy 1e fmin pw-bg-col# f+
    pw-back >o to w-color o> ;
: size-limit ( -- )
    edit-w .text$ nip #800 u> IF
................................................................................
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
................................................................................
	    "  " }}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
	msg:snapshot#  of  [: ." snapshot[" 85type ']' emit







|







 







>
>
>
>





|
>
|
>





|
>
|
>
|
>
|
>







 







<
<
<
<
<


|
<
|


|
>
>









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








<
|
|







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
....
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
....
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
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141

1142
1143
1144
1145
1146
1147
1148
1149
1150
$FFFFFFFF new-color, FValue login-bg-col#
$FF000000 $FF0000FF fade-color, FValue pw-err-col#
$000000FF dup text-emoji-color: black-emoji
$000000FF new-color, FValue otr-col#
$FFFFFFFF new-color, FValue chat-col#
$80FFFFFF new-color, FValue chat-bg-col#
$FFFFFFFF new-color, FValue posting-bg-col#
$000000CC new-color, FValue album-bg-col#

: entropy-colorize ( -- )
    prev-text$ erase  addr prev-text$ $free
    edit-w .text$ passphrase-entropy 1e fmin pw-bg-col# f+
    pw-back >o to w-color o> ;
: size-limit ( -- )
    edit-w .text$ nip #800 u> IF
................................................................................
slide-deck Constant default-sd
slide-class new Constant album-sd
album-sd to slide-deck

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

Variable imgs[]

: >imgs ( o -- o ) dup imgs[] >stack ;

0 Value imgs-box

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

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

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






default-sd to slide-deck

: group.imgs ( addr u -- )

     bounds ?DO
	    I $@ over be-64@ .ticks space
	    1 64s /string 85type cr
	cell +LOOP ;
: .imgs ( -- )
    imgs# [: dup $. ." :" cr cell+ $@ group.imgs ;] #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 ;

: img>group# ( img u -- n )
    msg-group$ $@ imgs# #@ bounds ?DO
	2dup I $@ 1 64s /string str= IF
	    2drop I last# cell+ $@ drop - cell/  unloop  EXIT
	THEN
    cell +LOOP  2drop -1 ;

: >album-viewer ( img u -- )
    img>group# dup 0< IF  drop  EXIT  THEN
    album-sd to slide-deck
    dup 3 and slide# ! -4 and >r
    4 0 DO
	I slides[] $[] @
	I slide# @ = IF  /flop  ELSE  /flip  THEN
	drop  LOOP
    { | i# }  last# cell+ $@ r> cells safe/string 4 cells min bounds U+DO
	I $@ 1 64s /string 2dup need-hashed? IF  85type ."  need" cr
	ELSE
	    i# imgs[] $[] @ >o image-tex
	    ?read-enc-hashed save-mem
	    mem-exif  [: 2dup >thumb-scan ;] catch  file-exif drop
	    mem>texture  img-orient 1- dup to rotate#  4 and IF  swap  THEN
	    tile-glue >o
	    pixelsize# fm* fdup vglue-c df! dpy-h @ fm/
	    pixelsize# fm* fdup hglue-c df! dpy-w @ fm/ fmax 1/f fdup
	    vglue-c df@ f* vglue-c df!
	    hglue-c df@ f* hglue-c df!
	    o> o>
	THEN
	1 +to i#
    cell +LOOP
    album-viewer n2o-frame .childs[] >stack
    +sync +resize ;

: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

		    [:  addr data $@ >album-viewer ;]
		    2swap $make dup +imgs 64#1 +to msg:timestamp
		    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
	msg:snapshot#  of  [: ." snapshot[" 85type ']' emit