Workbench title bar

14 posts / 0 new
Last post
Massi
Massi's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2012-03-28 17:16
Workbench title bar
Hello OS4 developers! I am now interested in rendering text / graphics into the Workbench title bar. The target is, say AmigaOS 4.1 Update 1. Any help is more than welcome as usual :) Thanks, regards
jabirulo
jabirulo's picture
Offline
Last seen: 3 days 3 hours ago
Joined: 2013-05-30 00:53
Don't know if this piece of
Don't know if this piece of code works, try it:
  1. /* SetWBTitle.c Testprogram to change the WB Screen Title */
  2.  
  3. //extern struct IntuitionBase *IntuitionBase;
  4.  
  5. #include <proto/dos.h>
  6. #include <proto/intuition.h>
  7. //#include <intuition/intuition.h>
  8. //#include <intuition/intuitionbase.h>
  9. #include <proto/exec.h>
  10. #include <stdio.h>
  11.  
  12. #define MYNAME "Opis Screen "
  13.  
  14. int main(void)
  15. {
  16. UBYTE *OldTitle, *DefTitle;
  17. UBYTE NewTitle[100];
  18. UBYTE lock;
  19. long i=0;
  20. struct Screen *screen;
  21. struct Window *window, *nextwindow;
  22.  
  23. sprintf(NewTitle, MYNAME "%ld",i);
  24.  
  25. lock = LockIBase(0);
  26. OldTitle = IntuitionBase->ActiveScreen->Title;
  27. DefTitle = IntuitionBase->ActiveScreen->DefaultTitle;
  28. screen = IntuitionBase->FirstScreen;
  29.  
  30. /* go through all Windows and set the New Window Title when it's = default (WB) */
  31. if ((window = screen->FirstWindow) != NULL)
  32. {
  33. while (window)
  34. {
  35. nextwindow = window->NextWindow;
  36. if ( window->ScreenTitle == ()OldTitle )
  37. {
  38. window->ScreenTitle = NewTitle;
  39. }
  40. window = nextwindow;
  41. }
  42. }
  43. /* change the Screen and Default Title (neeed for new Windows) */
  44. screen->Title=NewTitle;
  45. screen->DefaultTitle=NewTitle;
  46. UnlockIBase(lock);
  47. for(i=1; i<11; i++)
  48. {
  49. Delay(50);
  50.  
  51. sprintf(NewTitle, MYNAME "%ld",i);
  52. if (screen == IntuitionBase->ActiveScreen && IntuitionBase->ActiveWindow->ScreenTitle == NewTitle)
  53. {
  54. SetWindowTitles(IntuitionBase->ActiveWindow,(UBYTE *) -1,NewTitle);
  55. }
  56. }
  57. if (screen == IntuitionBase->ActiveScreen && IntuitionBase->ActiveWindow->ScreenTitle == NewTitle )
  58. {
  59. SetWindowTitles(IntuitionBase->ActiveWindow,(UBYTE *) -1,OldTitle);
  60. }
  61. lock = LockIBase(0);
  62. /* go through all Windows and set the OldTitle but only when it's = NewTitle */
  63. if ((window = screen->FirstWindow) != NULL)
  64. {
  65. while (window)
  66. {
  67. nextwindow = window->NextWindow;
  68. if (window->ScreenTitle == NewTitle)
  69. {
  70. window->ScreenTitle = OldTitle;
  71. }
  72. window = nextwindow;
  73. }
  74. }
  75. /* change back the Screen and Default Title to the old ones */
  76. screen->Title=OldTitle;
  77. screen->DefaultTitle=DefTitle;
  78. UnlockIBase(lock);
  79. return 0;
  80. }
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
trixie
trixie's picture
Offline
Last seen: 1 month 1 week ago
Joined: 2011-02-03 13:58
@Massi There is currently no
@Massi There is currently no public framework for rendering into the Workbench screen bar. What jabirulo shows you is a hack, don't use it.
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition Author of WordNet for OS4
hypex
hypex's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-09-09 16:20
@Massi You could try to open
@Massi You could try to open an invisible window on top of the title bar. You could use a backdrop/borderleess one and also try setting the opaqueness. Solid images are easier, but text has to be merged with the title gradient. It may be easier to simply blit from the area of the screen onto your window if it is clear. Or clone the WB screen in the background to use as a template then close it off. If you wish to display it next to the depth gadget then go through the list of gadgets and find the X position of it. :-)
xenic
xenic's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2011-05-07 04:52
@trixie There is currently no
@trixie
There is currently no public framework for rendering into the Workbench screen bar. What jabirulo shows you is a hack, don't use it.
It's not just a hack; it defeats the way the system is supposed to work. Every program can add a screen title to it's winodw that will be displayed when the window is active. If Workbench displayed some bogus title when my program's window is active, I would think it's a bug and report it on the Hyperion forums. I don't know who's in charge here; but I think that the code should be removed before someone reads this topic and thinks that code is O.K.
X1000 - OS 4.1FE
xenic
xenic's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2011-05-07 04:52
@hypex You could try to open
@hypex
You could try to open an invisible window on top of the title bar.
Please don't mess with my Workbench title bar or advise others to do it. As I mentioned in my reply to trixie, the Workbench title bar has an intended purpose: to display a title for the currently active window. I've already added jabirulo to my list of programmers whose programs I won't use. I don't want to add you to that list because you've written some good stuff.
X1000 - OS 4.1FE
trixie
trixie's picture
Offline
Last seen: 1 month 1 week ago
Joined: 2011-02-03 13:58
@all To sum up, before the
@all To sum up, before the OS provides a solution for displaying stuff in the screen bar (like MorphOS has it), refrain from messing with the idea. All interim "solutions" will either be kludges, or plain illegal.
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition Author of WordNet for OS4
hypex
hypex's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-09-09 16:20
Please don't mess with my
Please don't mess with my Workbench title bar or advise others to do it.
It's not messed with unless you install something that modifies it which you know about. But I do recall some programs like TitleClock IIRC which put a little clock up there. Which I found useful on my A1200. I was only advising on a safe way to do it by using a workaround and not actually modifying it. Since I also thought the code example posted was bad going about hacking title strings. A bit messy.
I don't want to add you to that list because you've written some good stuff.
Thanks. :-) FWIW none of my programs do this but for any tricks they do I usually provide a slight technical description.
jabirulo
jabirulo's picture
Offline
Last seen: 3 days 3 hours ago
Joined: 2013-05-30 00:53
@xenic :-( Someone asked if
@xenic :-( Someone asked if it could be done and I posted "possible solution/hack/code" I just copy&pasted a piece of code I can't remember since when I have it and where I get it. :-( If you want I can remove such piece of code if it makes you "uncomfortable". And please don't be so rude by adding phrases like: ..'my list of programmers whose programs I won't use. I don't want to add you to that list because you've written some good stuff.' :-(
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
kas1e
kas1e's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2010-11-30 15:30
@all Just in case some of you
@all Just in case some of you in interest: i create in os4-BZ enhancement about providing necessary framework for. Not that it will be done now or anytime, but at least its noted in.
xenic
xenic's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2011-05-07 04:52
@Hypex It's not messed with
@Hypex
It's not messed with unless you install something that modifies it which you know about. But I do recall some programs like TitleClock IIRC which put a little clock up there. Which I found useful on my A1200.
I have the system clock (SYS:Utilities/Clock) in digital format on my WorkBench title bar. I don't really see the need to have it embedded in the WorkBench title bar.
X1000 - OS 4.1FE
xenic
xenic's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2011-05-07 04:52
@jabirulo And please don't be
@jabirulo
And please don't be so rude by adding phrases like: ..'my list of programmers whose programs I won't use. I don't want to add you to that list because you've written some good stuf.
Sorry. I just get upset when I see code that shouldn't be used.
X1000 - OS 4.1FE
hypex
hypex's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-09-09 16:20
@xenic I don't really see
@xenic
I don't really see the need to have it embedded in the WorkBench title bar.
Well that is over the top and similar to the work around I was proposing. But I think this whole idea stems from other OS where all sorts of items appear in the title bar including clocks. I think it would be a good idea if this was included in AmigaOS. For example I like the idea of a clock but being limited to the Workbench title bar isn't good enough for me. What happens when I switch to another screen? There goes my clock! I like the idea of screen title bars inheriting things like "widgets" from the Workbench bar such as a clock. I think the basic idea could be done by building on what a title bar has now and that is gadgets. Over the years windows got more attention but I think it's time to update screen bars so dynamic gadgets can be added. IIRC the basics are there to add gadgets to a custom screen when opening.
trixie
trixie's picture
Offline
Last seen: 1 month 1 week ago
Joined: 2011-02-03 13:58
@hypex IIRC the basics are
@hypex
IIRC the basics are there to add gadgets to a custom screen when opening.
This should easily be achievable via BOOPSI, i.e. through a (hypothetical) screenbar.gadget class. Provided that Intuition adds appropriate support for it in the screens department, of course.
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition Author of WordNet for OS4
Log in or register to post comments