home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
monitors
/
rsys
/
rsyssrc.lha
/
RSysGfxIntuiLists.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-19
|
15KB
|
659 lines
/*
***************************************************************************
*
* Datei:
* RSysGfxIntuiLists.c
*
* Inhalt:
*
* --- Globale Routinen ---
*
* void MakeFontList ( void );
* void MakeScreenList ( void );
* void MakeWindowList ( void );
* void RSysGadgetList ( void );
* void RSysGetDisplayModes ( void );
* void SysBlitterWaitList ( void );
* void SysPubScreenList ( void );
* void SysTOFWaitList ( void );
*
* --- Lokale Routinen ---
*
* static void gadgetinfo ( struct Gadget *gad , int i );
*
* Bemerkungen:
* Listen der Graphics- und Intuition-Library.
* (Teilweise ausgelagert aus RSysSpecialLists.c)
*
* Erstellungsdatum:
* 07-Jul-93 Rolf Böhme
*
* Änderungen:
* 07-Jul-93 Rolf Böhme Erstellung
*
***************************************************************************
*/
#include "RSys.h"
/*
* MakeFontList() erzeugt eine Liste aller im System in der
* GfxBase definierten Fonts
*/
void
MakeFontList(void)
{
struct Node *node;
struct TextFont *font;
int i = 0;
DPOS;
countentries = CountNodes(&GfxBase->TextFonts);
if (NoEntries()) return;
Entries = AllocScrollEntries(countentries);
Forbid();
for (node = GfxBase->TextFonts.lh_Head; node->ln_Succ && (i < countentries); node = node->ln_Succ)
{
font = (struct TextFont *) node;
Entries[i].se_obj_id.address = font;
savestrcpy(Entries[i].se_obj_id.fullname, node, MAXFULLNAME - 1, NT_FONT);
sprintf(Entries[i].se_Entry, EntryAttr[FONTS].ea_dataformat,
Entries[i].se_obj_id.address,
Entries[i].se_obj_id.fullname,
((font->tf_Flags & FPF_DISKFONT) ? "Disk" : "ROM"),
font->tf_YSize,
font->tf_XSize,
font->tf_LoChar,
font->tf_HiChar);
i++;
}
countentries = i;
Permit();
CreateEntryList(SORT, 9);
return;
}
/*
* MakeWindowList() erzeugt eine Liste der offenen Windows im
* System. Dazu werden alle geöffneten Screens durchsucht
*/
void
MakeWindowList(void)
{
ULONG lock;
struct Window *win;
struct Screen *scr;
char scrtitle[11];
int i = 0;
DPOS;
countentries = CountIntuiObjects((int)GD_WindowsGad);
if (NoEntries()) return;
Entries = AllocScrollEntries(countentries);
lock = LockIBase(NULL);
for (scr = IntuitionBase->FirstScreen; scr && (i < countentries); scr = scr->NextScreen)
for (win = scr->FirstWindow; win && (i < countentries); win = win->NextWindow)
{
Entries[i].se_obj_id.address = win;
if ((char *)win->Title) strncpy(Entries[i].se_obj_id.fullname, (char *)win->Title, MAXFULLNAME - 1);
else
strcpy(Entries[i].se_obj_id.fullname, field[NO_TITLE]);
if ((char *)scr->DefaultTitle) strncpy(scrtitle, (char *)scr->DefaultTitle, 10);
else
strcpy(scrtitle, field[NO_TITLE]);
sprintf(Entries[i].se_Entry, EntryAttr[WINDOWS].ea_dataformat,
Entries[i].se_obj_id.address,
Entries[i].se_obj_id.fullname,
win->Height,
win->Width,
win->LeftEdge,
win->TopEdge,
scrtitle);
i++;
}
countentries = i;
UnlockIBase(lock);
CreateEntryList(SORT, 9);
return;
}
/*
* MakeScreenList() erzeugt eine Liste aller geöffneten Screens
*/
void
MakeScreenList(void)
{
ULONG lock;
struct Screen *scr;
int i = 0;
char pub[5];
DPOS;
countentries = CountIntuiObjects((int)GD_ScreensGad);
if (NoEntries()) return;
Entries = AllocScrollEntries(countentries);
lock = LockIBase(NULL);
for (scr = IntuitionBase->FirstScreen; scr && (i < countentries); scr = scr->NextScreen)
{
Entries[i].se_obj_id.address = scr;
if (scr->Title) strncpy(Entries[i].se_obj_id.fullname, (char *)scr->Title, MAXFULLNAME - 1);
else
strcpy(Entries[i].se_obj_id.fullname, field[NO_TITLE]);
strcpy(pub, " ");
if ((scr->Flags & WBENCHSCREEN) == WBENCHSCREEN) pub[0] = 'W';
if ((scr->Flags & PUBLICSCREEN) == PUBLICSCREEN) pub[1] = 'P';
if ((scr->Flags & CUSTOMSCREEN) == CUSTOMSCREEN) pub[2] = 'C';
sprintf(Entries[i].se_Entry, EntryAttr[SCREENS].ea_dataformat,
Entries[i].se_obj_id.address,
Entries[i].se_obj_id.fullname,
scr->Height, scr->Width, scr->LeftEdge, scr->TopEdge,
pub);
i++;
}
countentries = i;
UnlockIBase(lock);
CreateEntryList(SORT, 9);
return;
}
/*
* SysPubScreenList() zeigt alle im System angemeldeten
* Public Screens an
*/
void
SysPubScreenList(void)
{
struct Node *node;
struct Screen *scr;
struct PubScreenNode *PSNodes;
struct List *PSList = NULL;
char name[20],taskname[16];
int i = 0;
struct Node **adr;
DPOS;
HandleHelp(MN_SysPubScreenList);
PrintHeader(SYSPUBSCR, NULL);
EmptyListView();
PSList = LockPubScreenList();
countentries = CountNodes(PSList);
UnlockPubScreenList();
if (NoEntries()) return;
PSNodes = (struct PubScreenNode *) MyAllocVec(countentries*sizeof(struct PubScreenNode),
MEMF_ANY | MEMF_CLEAR, NO_KILL);
adr = (struct Node **) MyAllocVec(countentries*sizeof(struct Node *),
MEMF_ANY | MEMF_CLEAR, NO_KILL);
if(!PSNodes || ! adr)
{
MyFreeVec(PSNodes);
MyFreeVec(adr);
return;
}
PSList = LockPubScreenList();
for (node = PSList->lh_Head; node->ln_Succ && (i < countentries); node = node->ln_Succ)
{
adr[i] = node;
CopyMem(node,&PSNodes[i++],sizeof(struct PubScreenNode));
}
UnlockPubScreenList();
Entries = AllocScrollEntries(countentries);
for (i = 0; i < countentries; i++)
{
scr = PSNodes[i].psn_Screen;
savestrcpy(name,&(PSNodes[i].psn_Node),19, NT_UNKNOWN);
Forbid();
if(PSNodes[i].psn_SigTask) savestrcpy(taskname,&PSNodes[i].psn_SigTask->tc_Node, 15, NT_TASK);
else
strcpy(taskname,field[NO_TASK]);
Permit();
Entries[i].se_obj_id.address = adr[i];
sprintf(Entries[i].se_Entry, EntryAttr[SYSPUBSCR].ea_dataformat,
adr[i],
name,
PSNodes[i].psn_VisitorCount,
taskname);
}
MyFreeVec(PSNodes);
MyFreeVec(adr);
CreateEntryList(SORT, 9);
PrintStatistics();
return;
}
void
RSysGetDisplayModes(void)
{
struct DisplayInfo dinfo;
struct NameInfo ninfo;
struct DisplayNode {
struct Node dn_Node;
struct DisplayInfo dn_dinfo;
struct NameInfo dn_ninfo;
struct DimensionInfo dn_diminfo;
}
*dnode,*copydnode;
struct Node *dispnode;
struct List *DispList;
ULONG modeID = INVALID_ID;
struct Remember *DispKey = NULL;
int i;
DPOS;
HandleHelp(MN_RSysGetDisplayModes);
PrintHeader(DISPLAYMODES, NULL);
EmptyListView();
DispList = AllocRemember(&DispKey,sizeof(struct List),MEMF_CLEAR);
if(DispList)
{
NewList(DispList);
while ((modeID = NextDisplayInfo (modeID)) != INVALID_ID)
{
if (GetDisplayInfoData (NULL, (UBYTE *) &dinfo, sizeof(dinfo),
DTAG_DISP,modeID))
{
if ((dinfo.NotAvailable == 0) && (modeID & MONITOR_ID_MASK))
{
/*
* Hier gelangt das Programm nur dann hin, wenn
* der Modus verfügbar ist und nicht der
* Default-Monitor benötigt wird, sondern ein
* PAL-, NTSC- oder andere Monitore
*/
if (GetDisplayInfoData (NULL,(UBYTE *) &ninfo, sizeof(ninfo),
DTAG_NAME,modeID))
{
if(dnode = AllocRemember(&DispKey,sizeof(struct DisplayNode),
MEMF_CLEAR|MEMF_PUBLIC))
{
if(dnode->dn_Node.ln_Name = AllocRemember(&DispKey,
strlen((char *)ninfo.Name) +1,
MEMF_CLEAR|MEMF_PUBLIC))
{
strcpy (dnode->dn_Node.ln_Name, (char *)ninfo.Name);
GetDisplayInfoData (NULL,(UBYTE *) &(dnode->dn_diminfo),
sizeof(struct DimensionInfo),
DTAG_DIMS, modeID);
GetDisplayInfoData (NULL, (UBYTE *) &(dnode->dn_dinfo),
sizeof(struct DisplayInfo),
DTAG_DISP, modeID);
AddTail(DispList, (struct Node *) dnode);
}
}
}
}
}
}
countentries = CountNodes(DispList);
if(!NoEntries())
{
Entries = AllocScrollEntries(countentries);
for(dispnode = (struct Node *)DispList->lh_Head, i = 0;
dispnode->ln_Succ && (i < countentries);
dispnode = dispnode->ln_Succ)
{
copydnode = (struct DisplayNode *)dispnode;
Entries[i].se_obj_id.address = dispnode;
sprintf(Entries[i].se_Entry, EntryAttr[DISPLAYMODES].ea_dataformat,
Entries[i].se_obj_id.address,
copydnode->dn_Node.ln_Name,
copydnode->dn_diminfo.MaxDepth,
copydnode->dn_diminfo.MinRasterWidth,
copydnode->dn_diminfo.MinRasterHeight,
copydnode->dn_diminfo.MaxRasterWidth,
copydnode->dn_diminfo.MaxRasterHeight);
i++;
}
CreateEntryList(SORT, 9);
}
FreeRemember(&DispKey,TRUE);
PrintStatistics();
}
else ErrorHandle("No memory for Displaynodes", MEMORY_ERR, ALLOC_FAIL, KILL);
return;
}
void
SysTOFWaitList(void)
{
struct Node *node, **adr;
struct Node *TWQNodes;
char name[20];
int i = 0;
DPOS;
HandleHelp(MN_SysTOFWaitList);
PrintHeader(TOFWAIT, NULL);
EmptyListView();
countentries = CountNodes(&GfxBase->TOF_WaitQ);
if (NoEntries()) return;
TWQNodes = (struct Node *)MyAllocVec(countentries*sizeof(struct Node), MEMF_ANY | MEMF_CLEAR, NO_KILL);
adr = (struct Node **) MyAllocVec(countentries*sizeof(struct Node *), MEMF_ANY | MEMF_CLEAR, NO_KILL);
if(!TWQNodes || !adr)
{
MyFreeVec(TWQNodes);
MyFreeVec(adr);
return;
}
Disable();
for (node = GfxBase->TOF_WaitQ.lh_Head; node->ln_Succ && (i < countentries); node = node->ln_Succ)
{
adr[i] = node;
CopyMem(node,&TWQNodes[i++],sizeof(struct Node));
}
Enable();
Entries = AllocScrollEntries(countentries);
for (i = 0; i < countentries; i++)
{
savestrcpy(name,&TWQNodes[i],19, NT_TASK);
Entries[i].se_obj_id.address = &TWQNodes[i];
sprintf(Entries[i].se_Entry, EntryAttr[TOFWAIT].ea_dataformat,
adr[i],
name,
TWQNodes[i].ln_Pri );
}
MyFreeVec(TWQNodes);
MyFreeVec(adr);
CreateEntryList(SORT, 9);
PrintStatistics();
return;
}
/*
* SysBlitterWaitList() erzeugt eine Liste aller Tasks,
* die auf den Blitter warten. Diese Liste ist in der
* GfxBase (graphics.library) zu finden
*/
void
SysBlitterWaitList(void)
{
struct Node *node, **adr;
struct Node *BWQNodes;
char name[20];
int i = 0;
DPOS;
HandleHelp(MN_SysBlitterWaitList);
PrintHeader(BLITTERWAIT, NULL);
EmptyListView();
countentries = CountNodes(&GfxBase->BlitWaitQ);
if (NoEntries()) return;
BWQNodes = (struct Node *) MyAllocVec(countentries*sizeof(struct Node), MEMF_ANY | MEMF_CLEAR, NO_KILL);
adr = (struct Node **) MyAllocVec(countentries*sizeof(struct Node *), MEMF_ANY | MEMF_CLEAR, NO_KILL);
if(!BWQNodes || ! adr)
{
MyFreeVec(BWQNodes);
MyFreeVec(adr);
return;
}
Disable();
for (node = GfxBase->BlitWaitQ.lh_Head; node->ln_Succ && (i < countentries); node = node->ln_Succ)
{
adr[i] = node;
CopyMem(node,&BWQNodes[i++],sizeof(struct Node));
}
Enable();
Entries = AllocScrollEntries(countentries);
for (i = 0; i < countentries; i++)
{
savestrcpy(name,&BWQNodes[i],19, NT_TASK);
Entries[i].se_obj_id.address = adr[i];
sprintf(Entries[i].se_Entry, EntryAttr[BLITTERWAIT].ea_dataformat,
adr[i],
name,
BWQNodes[i].ln_Pri );
}
MyFreeVec(BWQNodes);
MyFreeVec(adr);
CreateEntryList(SORT, 9);
PrintStatistics();
return;
}
static void
gadgetinfo(struct Gadget *gad, int i)
{
char title[15], typ[7];
if(gad->GadgetText && gad->GadgetText->IText) strncpy(title, (char *)(gad->GadgetText->IText), 15);
else if(gad->GadgetRender || gad->SelectRender) strcpy(title, field[HAS_IMAGE]);
else
strcpy(title, field[NO_FIELD]);
if(SETFLAG(gad,GTYP_SYSGADGET)) strcpy(typ,"SYS");
else if(SETFLAG(gad,GTYP_SCRGADGET)) strcpy(typ,"SCR");
else if(SETFLAG(gad,GTYP_GZZGADGET)) strcpy(typ,"GZZ");
else if(SETFLAG(gad,GTYP_REQGADGET)) strcpy(typ,"REQ");
else
strcpy(typ,"CUS");
if(SETFLAG(gad, GTYP_WDRAGGING)) strcat(typ,"WDR");
else if(SETFLAG(gad, GTYP_SDRAGGING)) strcat(typ,"SDR");
else if(SETFLAG(gad, GTYP_WUPFRONT)) strcat(typ,"WUP");
else if(SETFLAG(gad, GTYP_SUPFRONT)) strcat(typ,"SUP");
else if(SETFLAG(gad, GTYP_WDOWNBACK)) strcat(typ,"WDO");
else if(SETFLAG(gad, GTYP_SDOWNBACK)) strcat(typ,"SDO");
else if(SETFLAG(gad, GTYP_CLOSE)) strcat(typ,"CLO");
else if(SETFLAG(gad, GTYP_BOOLGADGET)) strcat(typ,"BOO");
else if(SETFLAG(gad, GTYP_GADGET0002)) strcat(typ,"G02");
else if(SETFLAG(gad, GTYP_PROPGADGET)) strcat(typ,"PRO");
else if(SETFLAG(gad, GTYP_STRGADGET)) strcat(typ,"STR");
else if(SETFLAG(gad, GTYP_CUSTOMGADGET)) strcat(typ,"CUS");
else if(SETFLAG(gad, GTYP_SIZING)) strcat(typ,"SIZ");
else
strcat(typ,"UNK");
Entries[i].se_obj_id.address = gad;
sprintf(Entries[i].se_Entry, EntryAttr[ALLGADGETS].ea_dataformat,
gad, title, typ, gad->LeftEdge, gad->TopEdge, gad->Width,
gad->Height);
return;
}
/*
* MakeWindowList() erzeugt eine Liste der offenen Windows im
* System. Dazu werden alle geöffneten Screens durchsucht
*/
void
RSysGadgetList(void)
{
ULONG lock;
struct Window *win;
struct Screen *scr;
struct Gadget *gad;
int i = 0;
DPOS;
HandleHelp(MN_RSysGadgetList);
PrintHeader(ALLGADGETS, NULL);
EmptyListView();
countentries = 0;
PrintInfo("Please wait! Lock Intuition...", NO_SPEAK, 0);
lock = LockIBase(NULL);
for (scr = IntuitionBase->FirstScreen; scr; scr = scr->NextScreen)
{
countentries++;
for(gad = scr->FirstGadget; gad; gad = gad->NextGadget) countentries++;
for (win = scr->FirstWindow; win; win = win->NextWindow)
{
countentries++;
if(win->FirstRequest)
for(gad = win->FirstRequest->ReqGadget; gad; gad = gad->NextGadget) countentries++;
for(gad = win->FirstGadget; gad; gad = gad->NextGadget) countentries++;
}
}
UnlockIBase(lock);
if (NoEntries()) return;
Entries = AllocScrollEntries(countentries);
PrintInfo("Please wait! Lock Intuition again...", NO_SPEAK, 0);
lock = LockIBase(NULL);
for (scr = IntuitionBase->FirstScreen; scr && (i < countentries); scr = scr->NextScreen)
{
Entries[i].se_obj_id.address = scr;
if (scr->Title) sprintf(Entries[i++].se_Entry,"%08lx * SCR: %-20.20s *", scr, (char *)scr->Title);
else
sprintf(Entries[i++].se_Entry,"%08lx * SCR: %s *", scr, field[NO_TITLE]);
for(gad = scr->FirstGadget; gad && (i < countentries); gad = gad->NextGadget)
gadgetinfo(gad, i++);
for (win = scr->FirstWindow; win && (i < countentries); win = win->NextWindow)
{
Entries[i].se_obj_id.address = win;
if ((char *)win->Title) sprintf(Entries[i++].se_Entry,"%08lx ** WIN: %-20.20s **", win, (char *)win->Title);
else
sprintf(Entries[i++].se_Entry,"%08lx ** WIN: %s **", win, field[NO_TITLE]);
if(win->FirstRequest)
for(gad = win->FirstRequest->ReqGadget; gad && (i < countentries); gad = gad->NextGadget)
gadgetinfo(gad, i++);
for(gad = win->FirstGadget; gad && (i < countentries); gad = gad->NextGadget)
gadgetinfo(gad, i++);
}
}
countentries = i;
UnlockIBase(lock);
CreateEntryList(NO_SORT, 0);
PrintStatistics();
return;
}