r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[View] discuss view related issues

Henrik
2-May-2009
[8613]
I'm not sure the View engine supports filtering at all. The DRAW 
engine does for upward scaling, but not downward scaling < 1. I only 
mentioned thumbs, because it's a common scenario. :-)
jocko
2-May-2009
[8614]
ok, anyway,  to my opinion, it'a a must for the R3 engine.
Henrik
2-May-2009
[8615]
R3 does this elegantly already: It's based only on DRAW and all options 
for filtering from AGG are exposed. It fully supports high quality 
down and upscaling. :-)
jocko
2-May-2009
[8616]
Nice ! Another reason to expect a close beta release !
Steeve
2-May-2009
[8617]
Hey what are you saying, you can do the scaling you want  with Draw...
jocko
2-May-2009
[8618]
yes for the scaling,  but it seems that there is no interpolation 
(apart from nearest)
Maxim
3-May-2009
[8619]
is there a definite documentation on the systray support in windows? 
 I have some working code (from Izkata) but I am wondering if there 
is more to the interface than what I am using.

an exhaustive code example could also suffice
[unknown: 5]
3-May-2009
[8620x2]
I don't even think I used systray in REBOL since going to Vista. 
 So dunno if it works on Vista.
I would give you what I got but it is in archives as part of my easyserv 
project long ago.
Maxim
3-May-2009
[8622x4]
anyone know how to change the system tray icon dynamically?  by this 
I mean... the winapi calls which play around with that?
can anyone explain to me why offset on para and font do nothing every 
I try to use them?
I could use the scroll, but since its a field, the moment I enter 
text, the scroll goes back its default, which is badly aligned with 
the fields I am trying to get clean  \ :-(
ahhh I forgot that the para's offset is called origin... its been 
a while since I've tinkered with VID  :-)
Steeve
4-May-2009
[8626x2]
Jocko, in R2 if you use effect dialect to resize images, yes it uses 
nearest interpolation.
But draw uses blinear by default.
see:

img: logo.gif
siz: img/size * 4
view layout [
	below
	image img
	image img siz effect [aspect]
	box siz effect [draw [image img 0x0 siz]]
]


In R3 it's annouced that  image-filter supports NEAREST,BILINEAR,BICUBIC 
and GAUSSIAN interpolation
We can do a other missing interpolations in R2 wit maths, but it 
will be slow...
Henrik
4-May-2009
[8628]
do http://www.hmkdesign.dk/rebol/thumbtest/thumbtest.r


A small test I did to compare methods for generating thumbnails in 
R2.
Steeve
4-May-2009
[8629]
uh ? they are not done with Rebol are they Henrik ?
Henrik
4-May-2009
[8630]
The 3rd party ones (the last two) are pre-done. The rest are done 
with R2.
Gregg
4-May-2009
[8631x2]
Max, I found some old systray experimental code. No guarantees.
REBOL []

; r/3 = 'activate = left-click
; r/3 = 'activate = rt-click+menu-item-sel

hex: func [
    {Returns the base-10 value of a hexadecimal number.}
    value [integer! string! issue!] "A hexadecimal number"
][

    ; Convert to an issue first, so integers can also be translated.
    to integer! to issue! value
]

make-elements: func [name count type /local result][
    if not word? type [type: type?/word type]
    result: copy "^/"
    repeat i count [
        append result join name [i " [" type "]" newline]
    ]
    to block! result
]

NOTIFYICONDATA: make struct! compose [
    cbSize  [integer!]
    hwnd    [integer!]
    uId     [integer!]
    uFlags  [integer!]
    uCallBackMessage [integer!]
    hIcon   [integer!]
    (make-elements 'szTip 64 #"@")  ; CHAR
] none
NOTIFYICONDATA/cbSize: length? third NOTIFYICONDATA

;change at third NOTIFYICONDATA 25 "New ToolTip!"
;probe NOTIFYICONDATA
;halt

;constants required by Shell_NotifyIcon API call:
NIM_ADD:     hex 0
NIM_MODIFY:  hex 1
NIM_DELETE:  hex 2
NIF_MESSAGE: hex 1
NIF_ICON:    hex 2
NIF_TIP:     hex 4
WM_MOUSEMOVE:       hex 200
WM_LBUTTONDOWN:     hex 201  ;   'Button down
WM_LBUTTONUP:       hex 202  ;     'Button up
WM_LBUTTONDBLCLK:   hex 203  ; 'Double-click
WM_RBUTTONDOWN:     hex 204  ;   'Button down
WM_RBUTTONUP:       hex 205  ;     'Button up
WM_RBUTTONDBLCLK:   hex 206  ; 'Double-click


;Public Declare Function SetForegroundWindow Lib "user32" (ByVal 
hwnd As Long) As Long

lib: load/library %shell32.dll

Shell_NotifyIcon: make routine! compose/deep [
    dwMessage [integer!]
    pnid      [struct! [(NOTIFYICONDATA)]]
    return:   [integer!]
] lib "Shell_NotifyIconA"


my-hwnd?: does [second get-modes system/ports/system [window]]

set-tray-tooltip: func [struct string] [
    change at third struct 25 string
    struct
]



system-awake: func [port /local evt][
    if all [evt: pick port 1  (evt/1 = 'tray)] [
        status/text: mold evt
        show status
;         if any [
;             (evt/3 = 'activate)
;             all [(evt/3 = 'menu)  (evt/4 = 'desktop)]
;         ] [
;             if not desktop-loaded [
;                 link-exec-start-desktop/force
;             ]
;         ]
;         if all [(evt/3 = 'menu)  (evt/4 = 'quit)] [quit]
    ]
    false
]

system/ports/system/awake: :system-awake
append system/ports/wait-list system/ports/system

view layout [
    style button button 200
    button "Add Tray Menus" [
        set-modes system/ports/system compose/deep [
            tray: [
                add main [

                    help: (rejoin ["REBOL/Link" any [""]]) ; tooltip

                    menu: [test: "Test" desktop: "Start Desktop" bar quit: "Quit"]
                ]
                add other [
                    ;help: (rejoin ["REBOL/Link" any [""]])
                    menu: [test-2: "Test-2" bar quit-2: "Quit-2"]
                ]
            ]
        ]
    ]
    button "Remove Tray Main Menu" [
        set-modes system/ports/system [
            tray: [remove main]
        ]
    ]
    button "Remove Tray Other Menu" [
        set-modes system/ports/system [
            tray: [remove other]
        ]
    ]
    ;button "Change Tray Other Menu" [
    ;    set-modes system/ports/system [
    ;        tray: [
    ;            change other [
    ;                help: "New Help!"

    ;                menu: [test-3: "Test-3" bar quit-3: "Quit-3"]
    ;            ]
    ;        ]
    ;    ]
    ;]
    button "Modify Tooltip" [
        nid: make struct! NOTIFYICONDATA none
        nid/hwnd: my-hwnd?
        nid/uid: 1
        nid/cbSize: length? third nid
        nid/uFlags:  NIF_TIP  ; NIF_ICON
        ;nid/hIcon:
        ;nid/szTip:  "New ToolTip!^@"
        set-tray-tooltip nid "New ToolTip A!"
        ;print mold third nid
        res: Shell_NotifyIcon NIM_MODIFY nid
        print [res to logic! res]
    ]
    button "Modify Other Tooltip" [
        nid: make struct! NOTIFYICONDATA none
        nid/hwnd: my-hwnd?
        nid/uid: 2
        nid/cbSize: length? third nid
        nid/uFlags:  NIF_TIP  ; NIF_ICON
        ;nid/hIcon:
        ;nid/szTip:  "New ToolTip!^@"
        set-tray-tooltip nid "New ToolTip B!"
        ;print mold third nid
        res: Shell_NotifyIcon NIM_MODIFY nid
        print [res to logic! res]
    ]
    button "Unview" [unview]
    status: text 200
]



free lib
Maxim
7-May-2009
[8633]
thanks!! I'll look into this :-)
Pekr
7-May-2009
[8634]
Systray? Systray was done by Cyphre for me on contract, and released 
for free. IIRC Cheyenne used it at some point ...
Janko
7-May-2009
[8635]
If there wouldn't be a systray I probably wouldn't switch my bigger 
project to rebol and consequently started with all projects in rebol.. 
cheyenne was the most cruicial reason, if there wouldn't be cheyenne 
I would never switch -- but systray was the final nail in the coffin 
of the previous languge for that particular project. So, thanks  
Pekr and Cyphre!
Henrik
9-May-2009
[8636]
Is there a simple way to replace one style with another in a pane? 
I would like to interchange a FIELD and an INFO in the same spot, 
but by directly altering the field face.
ICarii
9-May-2009
[8637]
do you mean as in hidden pane swapping?
Henrik
9-May-2009
[8638]
tighter than that. it must be the face itself that should be swapped.
ICarii
9-May-2009
[8639x2]
define a separate: field/info and swap the face reference i guess
just save then reassign pane/face
Henrik
9-May-2009
[8641]
well, it's about which parameters that need to be brought over. size, 
offset and internal data should be the same.
ICarii
9-May-2009
[8642]
should be simple as a variable swap - just have to use globals in 
R2
Henrik
9-May-2009
[8643x2]
I don't think I want to do it that way. The face I swap with could 
probably be obtained using GET-STYLE. But then certain parameters 
from the old face should be grafted onto the new face.
well, about to test, so we'll see if it works...
ICarii
9-May-2009
[8645]
couldn't you get the same effect by selectively locking teh field 
object?
Henrik
9-May-2009
[8646]
locking, how?
ICarii
9-May-2009
[8647x2]
override the feel
style lockable-field field feel [...]
Henrik
9-May-2009
[8649]
that's not enough. it has to be visual as well.
ICarii
9-May-2009
[8650]
you can intercept the redraw
Henrik
9-May-2009
[8651]
that's too complicated.
ICarii
9-May-2009
[8652]
redraw: func [face act pos] [set-face-look..]  ..  not really that 
complicated..
Henrik
9-May-2009
[8653]
It won't do if it has to be added to every face in VID. Besides I've 
built something simpler now.
ICarii
9-May-2009
[8654x2]
:)
alternately I would add a single redraw check at the top level and 
scan children for a 'lock value in a predefined field / flags.
jocko
9-May-2009
[8656x2]
Steeve, Henrik
Steeve, Henrik, thank you for these infos concerning interpolation 
modes with effect and draw
Maxim
9-May-2009
[8658]
the easiest way I`ve done this henrik is to have a face which has 
two extra facets (style, protected) and a function called change, 
 


calling 'change to another style gets all the values from the global 
style block for that stylename, and changes all facets excluding 
any which are in the protected block.  it also sets the stylename 
within the function, so you can easily do decisions based on that.


alternatively, you can make an external function which does the same, 
but adding the protected inside the 'WITH [ ] spec makes it easier 
to contextualize the system.
Henrik
12-May-2009
[8659]
If I have a window-feel with a 'detect function, could it be performed 
after an 'engage function for a face in that window? Is there a way 
to swap that around?
Maxim
12-May-2009
[8660x3]
you can always modify view*/wake-event to it fires other events after 
the do-event.
to=so
just remember to bind the func block to *view before submitting it 
to func

ex:  

view*: system/view
view*/wake-event: func [port ] bind [ 
	.... your wake event redefinition code ...
] in view* 'self


obviously you can mold/all + load  the wake-event func body directly 
or copy it from sdk code if you want.