Check-in [76091b4829]
Not logged in

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

Overview
Comment:Image+thumb stuff
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 76091b482931494685717d51797f5a27772feb1d
User & Date: bernd 2019-11-28 16:14:18
Context
2019-11-28
16:15
Bump version number check-in: bcffa4f253 user: bernd tags: trunk, 0.9.4-20191128
16:14
Image+thumb stuff check-in: 76091b4829 user: bernd tags: trunk
14:48
Start image/thumbnail stuff check-in: b00fe09554 user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to gui.fs.

426
427
428
429
430
431
432
433
434
435


436
437
438
439
440
441
442
...
872
873
874
875
876
877
878

879
880
881
882
883
884
885
....
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
: nick[] ( box o:nick -- box )
    [: data >o ." clicked on " ke-nick $. cr o> ;] o click[] ;

Hash: avatar#

glue new Constant glue*avatar
glue*avatar >o pixelsize# 64 fm* 0e 0g glue-dup hglue-c glue! vglue-c glue! 0glue dglue-c glue! o>
: glue*thumb ( w h -- o )
    glue new >o pixelsize# fm* 0e 0g vglue-c glue!
    pixelsize# fm* 0e 0g hglue-c glue! 0glue dglue-c glue! o o> ;



: read-avatar ( addr u -- addr' u' )
    ?read-enc-hashed mem>thumb atlas-region ;
Variable user-avatar#
Variable dummy-thumb#
Variable user.png$
Variable thumb.png$
................................................................................
; wmsg-class is msg:.nobody
: new-msg-par ( -- )
    {{ }}p "msg-par" name!
    dup .subbox box[] drop box[] cbl >bl
    dup .subbox "msg-box" name!
    to msg-box to msg-par ;
:noname { d: pk -- o }

    pk [: .simple-id ." : " ;] $tmp notify-nick!
    pk key| pkc over str= { me? }
    pk enddate@ otr? { otr }
    pk key| last-bubble-pk $@ str= otr last-otr? = and
    pk startdate@ last-tick 64over to last-tick
    64- delta-bubble 64< and
    IF
................................................................................
		2drop
	    THEN
	LOOP
    THEN ; wmsg-class is msg:otrify

Hash: thumbs#

: thumb-frame ( addr u -- o )
    keysize safe/string key|
    2dup thumbs# #@ nip 0= IF
	2dup read-avatar 2swap thumbs# #!
    ELSE  2drop  THEN  last# cell+ $@ drop ;






: ?thumb ( addr u -- o )
    2dup ['] thumb-frame catch 0= IF
	>r 2drop r@ i.w r@ i.h glue*thumb r> }}thumb
	EXIT  THEN
    2drop
    128 128 glue*thumb dummy-thumb }}thumb >r

    <event ['] drop elit, msg:id$ e$, e$,
    :>fetch-thumb ?query-task event> r> ;

:noname ( addr u type -- )
    obj-red
    case 0 >r
	msg:image#     of  [: ." img["      2dup 85type ']' emit
	    ;] $tmp }}text >r







|
|
|
>
>







 







>







 







|





>
>
>
>
>




<

>
|







426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
...
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
....
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
: nick[] ( box o:nick -- box )
    [: data >o ." clicked on " ke-nick $. cr o> ;] o click[] ;

Hash: avatar#

glue new Constant glue*avatar
glue*avatar >o pixelsize# 64 fm* 0e 0g glue-dup hglue-c glue! vglue-c glue! 0glue dglue-c glue! o>
: wh-glue! ( w h -- )
    pixelsize# fm* 0e 0g vglue-c glue!
    pixelsize# fm* 0e 0g hglue-c glue! ;
: glue*thumb ( w h -- o )
    glue new >o wh-glue! 0glue dglue-c glue! o o> ;

: read-avatar ( addr u -- addr' u' )
    ?read-enc-hashed mem>thumb atlas-region ;
Variable user-avatar#
Variable dummy-thumb#
Variable user.png$
Variable thumb.png$
................................................................................
; wmsg-class is msg:.nobody
: new-msg-par ( -- )
    {{ }}p "msg-par" name!
    dup .subbox box[] drop box[] cbl >bl
    dup .subbox "msg-box" name!
    to msg-box to msg-par ;
:noname { d: pk -- o }
    pk key| to msg:id$
    pk [: .simple-id ." : " ;] $tmp notify-nick!
    pk key| pkc over str= { me? }
    pk enddate@ otr? { otr }
    pk key| last-bubble-pk $@ str= otr last-otr? = and
    pk startdate@ last-tick 64over to last-tick
    64- delta-bubble 64< and
    IF
................................................................................
		2drop
	    THEN
	LOOP
    THEN ; wmsg-class is msg:otrify

Hash: thumbs#

: thumb-frame ( addr u -- rect )
    keysize safe/string key|
    2dup thumbs# #@ nip 0= IF
	2dup read-avatar 2swap thumbs# #!
    ELSE  2drop  THEN  last# cell+ $@ drop ;

event: :>update-thumb { d: hash object -- }
    hash thumb-frame object .childs[] $@ drop @ >o to frame#
    frame# i.w frame# i.h tile-glue .wh-glue!  o>
    [: +sync +resize ;] msgs-box vpneeded +sync +resize ;

: ?thumb ( addr u -- o )
    2dup ['] thumb-frame catch 0= IF
	>r 2drop r@ i.w r@ i.h glue*thumb r> }}thumb
	EXIT  THEN

    128 128 glue*thumb dummy-thumb }}thumb >r
    <event r@ up@ [{: hash u1 object task :}h
	<event hash elit, u1 elit, object elit, :>update-thumb task event> ;] elit, msg:id$ e$, e$,
    :>fetch-thumb ?query-task event> r> ;

:noname ( addr u type -- )
    obj-red
    case 0 >r
	msg:image#     of  [: ." img["      2dup 85type ']' emit
	    ;] $tmp }}text >r