Hi,
Does anyone know if the tooltypes for WBPattern are documented anywhere? I'm trying to set up a context menu command that can set a picture as the background, and I what to know how to use the scaling options in LEFT, TOP, WIDTH and HEIGHT.
Thanks.
Documentation for WBPattern tooltypes/CLI options
- thomasrapp
- Posts: 310
- Joined: Sat Jun 18, 2011 11:22 pm
Re: Documentation for WBPattern tooltypes/CLI options
I am quite sure that LEFT / TOP / WIDTH / HEIGHT refer to the window of the WBPattern program, not to the pattern itself.
- nbache
- Beta Tester
- Posts: 1714
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Documentation for WBPattern tooltypes/CLI options
That is correct.thomasrapp wrote:I am quite sure that LEFT / TOP / WIDTH / HEIGHT refer to the window of the WBPattern program, not to the pattern itself.
@daveyw:
Off the top of my head, the easiest way to do what you want is probably to set in WBPattern.prefs the size/position etc. you want, let it point to a picture file you place e.g. in RAM: or in a dedicated place on your disk, save off those settings as a specific name, e.g. ENVARC:SYS/wbpattern_mypattern.prefs, and then have a script, bound to your ContextMenus entry, copy the relevant picture to the path and name you have in those settings, followed by "WBPattern FROM ENVARC:SYS/wbpattern_mypattern.prefs USE".
You might have to start off by calling "WBPattern FROM ENVARC:SYS/wbpattern.prefs USE" to briefly set your normal setting, I'm not sure if the copy command will let you overwrite the picture file if WBPattern points to it.
Or you might prefer using makelink instead of copying, but then you probably have to remove any existing link first (not sure if using FORCE will let you overwrite).
Hope this is enough inspiration for some experimentation
Best regards,
Niels
Re: Documentation for WBPattern tooltypes/CLI options
Thanks for the info. Hmmm... sounds like my quick little project would involve a more complex script. I'll leave it just as a simple, direct CLI call for now, knowing that the AR might end up wrong depending upon the image, and revisit it again.
Re: Documentation for WBPattern tooltypes/CLI options
Actually turned out to be fairly simple.
I created the two template prefs files, one with scaling set to fill screen, and the other to fit picture. I've added this to my context menu config:
The user can set the picture as a background, with the option of either scaling to fit the screen or leaving the picture size as-is. The third option, Save, saves the selection to the default Prefs file.
Thanks for the guidance.
I guess I could try writing a script to fail the operation if the user is selecting a jpeg on the RAM disk, but this is good for now.
I created the two template prefs files, one with scaling set to fill screen, and the other to fit picture. I've added this to my context menu config:
Code: Select all
,jpeg,SEPARATOR
,jpeg,>Set as background
tbimages:bgimage,jpeg,Fill screen,CLI,sys:prefs/wbpattern use sys:prefs/presets/wbpattern_fill_screen wbimage=%f
tbimages:bgimage,jpeg,Fit picture,CLI,sys:prefs/wbpattern use sys:prefs/presets/wbpattern_fit_picture wbimage=%f
,jpeg,Save,CLI,sys:prefs/wbpattern save sys:prefs/Env-Archive/Sys/wbpattern.prefs wbimage=%f
,jpeg,>Set as background
Thanks for the guidance.
I guess I could try writing a script to fail the operation if the user is selecting a jpeg on the RAM disk, but this is good for now.
- nbache
- Beta Tester
- Posts: 1714
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Documentation for WBPattern tooltypes/CLI options
Brilliant!
The only potential problem I can see is if you use them on a picture stored on e.g. a USB stick, which is subsequently removed.
Best regards,
Niels
The only potential problem I can see is if you use them on a picture stored on e.g. a USB stick, which is subsequently removed.
Best regards,
Niels
Re: Documentation for WBPattern tooltypes/CLI options
Well, yes, it was your suggestion Niels.nbache wrote:Brilliant!
Yeah, my thought to write a script to block the user from selecting an image on the ram disk would need to be expanded to cover removeable media as well. Or possibly copy the target to SYS: Prefs to ensure it remains accessible. Something to mull over...nbache wrote:
The only potential problem I can see is if you use them on a picture stored on e.g. a USB stick, which is subsequently removed.
Best regards,
Niels
Re: Documentation for WBPattern tooltypes/CLI options
SYS:Prefs/WBPattern prefs doesn't prevent the user from selecting an image from any location he wants. What if a user just wants to test a backdrop image before changing it permanently? I almost always test utilities, programs, images from ram: before installing them permanently. The user might select an image from a floppy, an FFS formatted CDRW, DiskImage device media, a RAD: drive or in my case an external hard disk connected to by my eSATAp adapter. If you can't detect them all and block them, blocking is futile anyway.daveyw wrote: Yeah, my thought to write a script to block the user from selecting an image on the ram disk would need to be expanded to cover removeable media as well. Or possibly copy the target to SYS: Prefs to ensure it remains accessible. Something to mull over...
If your context menu copied the image to SYS:Prefs without asking me first I'd be upset. Why not just have the context menu open "WBPattern.prefs" and let the user decide what he want's to do??
AmigaOne X1000 with 2GB memory - OS4.1 FE
- nbache
- Beta Tester
- Posts: 1714
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Documentation for WBPattern tooltypes/CLI options
Not to mention a network drive, e.g. mounted ad hoc with SMBFS and not necessarily mounted at every boot.xenic wrote:The user might select an image from a floppy, an FFS formatted CDRW, DiskImage device media, a RAD: drive or in my case an external hard disk connected to by my eSATAp adapter.
I agree.If you can't detect them all and block them, blocking is futile anyway.
If it is copied to a specific filename (I'd put it down in a Prefs/presets subdirectory or something) and overwritten every time, I can't see why it would be harmful. Of course it should be mentioned in a user guide, that this is what the functionality is designed to do - and why.If your context menu copied the image to SYS:Prefs without asking me first I'd be upset.
Best regards,
Niels
Re: Documentation for WBPattern tooltypes/CLI options
@nbache
I wouldn't say it would be harmful. If the user wants to use an image located on another partition, I think it should be the user's choice. If a user is careless enough to select & save an image on removable media, then he is going to learn from that mistake and not do it in the future. I don't think WBPattern prefs limits where an image can be located and see no reason why his context menu should.If it is copied to a specific filename (I'd put it down in a Prefs/presets subdirectory or something) and overwritten every time, I can't see why it would be harmful. Of course it should be mentioned in a user guide, that this is what the functionality is designed to do - and why.
AmigaOne X1000 with 2GB memory - OS4.1 FE