T.R | Title | User | Personal Name | Date | Lines |
---|
3352.1 | | WJG::GUINEAU | Every player gets a prize... | Wed Jan 17 1990 11:04 | 9 |
| I believe you start at the IntuitionBase pointer (from OpenLibrary() of
intuition.library) and follow the screen list to the one with the
"I'm the Workbench" bit set...
Does this help? I don't remember the specifics but it's in the Intuition
ROM Kernel manual.
John
|
3352.2 | Sounds right | SMAUG::SPODARYK | Binary Throttle | Wed Jan 17 1990 13:19 | 7 |
| Yes, this makes sense. I'll have to do some more digging
in my ancient ROM Kernel Manual (V1.0 + 1.1 additions, ouch!).
Will there actually be a V1.4 full doc set, or will there
be additions to V1.3? I'd like to get a V1.3 set sometime.
-Steve
|
3352.3 | late_night_hacking = SUCCESS; | SMAUG::SPODARYK | Binary Throttle | Thu Jan 18 1990 01:14 | 36 |
| /*
* S Spodaryk 18-Jan-1989
*
* Return information about the WorkBench screen.
*
* This assumes that IntuitionBase is a valid return from the
* OpenLibrary( "intuition.library", REVISION ) call.
*
*/
void Get_Display_Statistics( long *width, long *height, long *planes )
{
extern struct IntuitionBase *IntuitionBase;
struct Screen *screen_ptr = IntuitionBase -> FirstScreen;
*width = 640; /* establish some defaults */
*height = 400;
*planes = 2;
while ( screen_ptr != NULL ) { /* we've got a screen */
if ( (screen_ptr -> Flags & 0x000F) == WBENCHSCREEN ) {
*width = screen_ptr -> Width; /* found it */
*height = screen_ptr -> Height;
*planes = screen_ptr -> BitMap.Depth;
break;
}
else { /* continue walking down the list of screens */
screen_ptr = screen_ptr -> NextScreen;
}
}
}
|
3352.4 | | FROCKY::BALZER | Christian Balzer DTN:785-1029 | Thu Jan 18 1990 05:07 | 8 |
| Re: .2
If you can afford it, get the 1.3 stuff, it's really nice.
You can bet that 1.4 will get it's own manual (all in good time).
Regards,
<CB>
|
3352.5 | Careful following them pointers | TLE::RMEYERS | Randy Meyers | Thu Jan 18 1990 14:17 | 22 |
| Re: .3
I believe that there is a function called GetScreenData() in the
graphics library (it might be in Intuition instead). I'd recommend
using it instead.
The routine posted in .3 has two problems:
1. It will crash the system if another task closes a
screen while this routine is walking the list of screens!
2. It stops when it finds the first WBENCHSCREEN. There may
be several if various (maybe even supported) hacks are used.
The first problem can be fixed by either calling Disable()/Enable()
around the loop, or by using the function LockIBase() (or something
like that). LockIBase has the advantage that it only prevents
Intuition from modifying any data structures, which is all you need
in this case.
I don't know how to fix the second problem. I hope Commodore got it
right in GetScreenData().
|
3352.6 | Thanks, what about this? | SMAUG::SPODARYK | Binary Throttle | Thu Jan 18 1990 16:26 | 36 |
| re: .4+.5
Randy, thanks for the tips. That's one reason why I posted the
code. If it was 100% correct then maybe it would be useful to
someone else. If not, I was hoping someone would point out
the error of my ways.
That code is only called once, and would probably work for 99.99%
of the time, but... I'll check into GetScreenData().
As an aside... I'm doing one other thing that is probably
very illegal (but seemingly safe). When I change a gadgets
characteristics (for mutual exclusion) rather than just
RefreshGadgets(), I use something like this ( w/error handling )
void ImprovedRefreshGadgets( struct Gadget *gadget, long number )
{
struct Gadget *saved_gadget_ptr, *gadget_ptr = gadget;
while ( number-- > 0 )
gadget_ptr = gadget_ptr -> NextGadget;
saved_gadget_ptr = gadget_ptr->NextGadget; /* save next gadget */
gadget_ptr->NextGadget = NULL; /* temporarily trunc list */
RefreshGadgets( gadget, window, etc );
gadget_ptr->NextGadget = saved_gadget_ptr; /* reset pointer */
}
This allows me to refresh a sub-portion of a gadget list, without
having to redraw all 18 gadgets. I'm not proud of it, but is
this semi-acceptable?
-Steve
|
3352.7 | Not in my ROM Kernal V2 | WHAMMY::SPODARYK | Binary Throttle | Thu Jan 18 1990 23:01 | 8 |
| re: GetScreenData();
Could some kind soul post the info on this routine? My doc set
doesn't mention it.
Thanks again,
Steve
|
3352.8 | RefreshGList() | TLE::RMEYERS | Randy Meyers | Fri Jan 19 1990 13:05 | 13 |
| Re: .6
Yep, as you suggested, playing with the gadget list yourself is
very naughty. The manuals warn you never to alter any field
in a gadget directly.
It turns out there is a routine to do what you want. RefreshGList()
is like RefreshGadgets except it takes a count of the number of
gadgets to refresh.
There were several "GList" routines added back in 1.1 or 1.2 to
replace the "Gadget" routines because of the problem of not being
able to specify the number of gadgets to operate upon.
|
3352.9 | Intuition Routines | TLE::RMEYERS | Randy Meyers | Fri Jan 19 1990 18:09 | 97 |
| Re: .7
> Could some kind soul post the info on this routine?
It turns out that both of the following routines are in Intuition:
GetScreenData -- Get copy of a screen data structure.
SYNOPSIS
Success = GetScreenData(Buffer, Size, Type, Screen )
D0 A0 D0 D1 A1
BOOL Success;
CPTR Buffer;
USHORT Size;
USHORT Type;
struct Screen *Screen;
FUNCTION
This function copies into the caller's buffer data from a Screen structure
Typically, this call will be used to find the size, title bar height, and
other values for a standard screen, such as the Workbench screen.
To get the data for the Workbench screen, one would call:
GetScreenData(buff, sizeof(struct Screen), WBENCHSCREEN, NULL)
NOTE: if the requested standard screen is not open, this function
will have the effect of opening it.
INPUTS
Buffer = pointer to a buffer into which data can be copied
Size = the size of the buffer provided, in bytes
Type = the screen type, as specified in OpenWindow (WBENCHSCREEN,
CUSTOMSCREEN, ...)
Screen = ignored, unless type is CUSTOMSCREEN, which results only in
copying 'size' bytes from 'screen' to 'buffer'
RESULT
TRUE if successful
FALSE if standard screen of Type 'type' could not be opened.
BUGS
SEE ALSO
OpenWindow()
RefreshGList -- Refresh (redraw) a chosen number of gadgets.
SYNOPSIS
RefreshGList(Gadgets, Window, Requester, NumGad)
A0 A1 A2 D0
struct Gadget *Gadget;
struct Window *Window;
struct Requester *Requester;
SHORT NumGad;
FUNCTION
Refreshes (redraws) Gadgets in the Gadget List starting
from the specified Gadget. At most NumGad gadgets are redrawn.
If NumGad is -1, all gadgets until a terminating NULL value
in the NextGadget field is found will be refreshed, making this
routine a superset of RefreshGadgets().
The Requester variable can point to a Requester structure. If
the first Gadget in the list has the REQGADGET flag set, the
Gadget list refers to Gadgets in a Requester and the Pointer
must necessarily point to a Window. If these are not the Gadgets
of a Requester, the Requester argument may be NULL.
Be sure to see the RefreshGadgets() function description, as this
function is simple an extension of that.
INPUTS
Gadgets = pointer to the first in the list of Gadgets wanting refreshment
Window = pointer to the Window containing the Gadget or its Requester
Requester = pointer to a Requester (ignored if Gadget is not attached to
a Requester).
NumGad = maximum number of gadgets to be refreshed. A value of -1
will cause all gadgets to be refreshed from Gadget to the
end of the list. A value of -2 will also do this, but if Gadget
is a Requester Gadget (REQGADGET) ALL gadgets in the requester
will be refreshed (this is a mode compatible with v1.1
RefreshGadgets().
RESULT
None
BUGS
SEE ALSO
RefreshGadgets()
|
3352.10 | thanks again | SMAUG::SPODARYK | Binary Throttle | Sat Jan 20 1990 01:42 | 6 |
| Randy,
Thanks very much for the info. Are you going to go to the
"Amigoid Luncheon" so I can buy you a beer?
Steve
|
3352.11 | I like diet coke | TLE::RMEYERS | Randy Meyers | Mon Jan 22 1990 03:41 | 5 |
| Re: .10
I'd love to go, but unfortunately I have a 1pm meeting every Thursday
(and Marlboro is about an hour from Nashua). Besides, you really
wouldn't make me drink a beer, would you?
|