rlint/control.c

208 lines
4.5 KiB
C
Raw Normal View History

2018-07-20 01:06:32 +00:00
#include <resources.h>
#include <control.h>
#include <window.h>
#include <textedit.h>
2018-07-20 01:06:32 +00:00
#include "rlint.h"
void check_rControlList(Handle h) {
unsigned i;
Ref *list = *(Ref **)h;
for(i = 0; ; ++i) {
Ref ref = list[i];
if (!ref) break;
2018-07-20 01:35:32 +00:00
check(rControlTemplate, ref);
2018-07-20 01:06:32 +00:00
}
}
void check_rControlTemplate(Handle h) {
ControlTemplate *ptr = *(ControlTemplate **)h;
Ref ref;
unsigned moreFlags = ptr->moreFlags;
if (ptr->procRef == simpleButtonControl) {
2018-07-20 01:35:32 +00:00
ref = ((SimpleButtonTemplate *)ptr)->titleRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rPString, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = ((SimpleButtonTemplate *)ptr)->colorTableRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x0c) == colorTableIsResource)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == checkControl) {
2018-07-20 01:35:32 +00:00
ref = ((CheckBoxTemplate *)ptr)->titleRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rPString, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = ((CheckBoxTemplate *)ptr)->colorTableRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x0c) == colorTableIsResource)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == radioControl) {
2018-07-20 01:35:32 +00:00
ref = ((RadioButtonTemplate *)ptr)->titleRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rPString, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = ((RadioButtonTemplate *)ptr)->colorTableRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x0c) == colorTableIsResource)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == scrollBarControl) {
2018-07-20 01:35:32 +00:00
ref = ((ScrollBarTemplate *)ptr)->colorTableRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x0c) == colorTableIsResource)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == iconButtonControl) {
2018-07-20 01:35:32 +00:00
ref = ((IconButtonTemplate *)ptr)->titleRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rPString, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = ((IconButtonTemplate *)ptr)->colorTableRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x0c) == colorTableIsResource)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = ((IconButtonTemplate *)ptr)->iconRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x30) == 0x20)
2018-07-20 01:35:32 +00:00
check(rIcon, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == scrollBarControl) {
2018-07-20 01:35:32 +00:00
ref = ((LineEditTemplate *)ptr)->defaultRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rPString, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == listControl) {
2018-07-20 01:35:32 +00:00
ref = ((ListTemplate *)ptr)->listRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rListRef, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = ((ListTemplate *)ptr)->colorTableRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x0c) == colorTableIsResource)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == pictureControl) {
2018-07-20 01:35:32 +00:00
ref = ((PictureTemplate *)ptr)->pictureRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rPicture, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == popUpControl) {
2018-07-20 01:35:32 +00:00
ref = ((PopupTemplate *)ptr)->menuRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x07) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rMenu, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = ((PopupTemplate *)ptr)->colorTableRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x18) == 0x10)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == growControl) {
2018-07-20 01:35:32 +00:00
ref = ((SizeBoxTemplate *)ptr)->colorTableRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x0c) == colorTableIsResource)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == statTextControl) {
2018-07-20 01:35:32 +00:00
ref = ((StaticTextTemplate *)ptr)->textRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rTextForLETextBox2, ref);
2018-07-20 01:06:32 +00:00
return;
}
if (ptr->procRef == editTextControl) {
unsigned desc;
2018-07-20 01:35:32 +00:00
ref = ((TextEditTemplate *)ptr)->styleRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x03) == titleIsResource)
2018-07-20 01:35:32 +00:00
check(rStyleBlock, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = ((TextEditTemplate *)ptr)->colorRef;
2018-07-20 01:06:32 +00:00
if ((moreFlags & 0x0c) == colorTableIsResource)
2018-07-20 01:35:32 +00:00
check(rCtlColorTbl, ref);
2018-07-20 01:06:32 +00:00
ref = ((TextEditTemplate *)ptr)->textRef;
desc = ((TextEditTemplate *)ptr)->textDescriptor;
if ((desc & 0x18) == teTextIsResource) {
switch(desc & 0x07) {
case teDataIsPString: check(rPString, ref); break;
case teDataIsCString: check(rCString, ref); break;
case teDataIsC1Input: check(rC1InputString, ref); break;
case teDataIsC1Output: check(rC1OutputString, ref); break;
case teDataIsTextBox2: check(rTextForLETextBox2, ref); break;
case teDataIsTextBlock: check(rTextBlock, ref); break;
}
}
2018-07-20 01:06:32 +00:00
return;
}
}
void check_rWindParam1(Handle h) {
WindParam1 *ptr = *(WindParam1 **)h;
Ref ref;
unsigned desc = ptr->p1InDesc;
2018-07-20 01:35:32 +00:00
ref = (Ref)ptr->p1Title;
if (ref && (desc & 0x0200)) check(rPString, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = (Ref)ptr->p1ColorTable;
if (ref && (desc & 0x0800)) check(rWindColor, ref);
2018-07-20 01:06:32 +00:00
2018-07-20 01:35:32 +00:00
ref = (Ref)ptr->p1ControlList;
if (ref) {
switch(desc & 0xff) {
case singleResource: check(rControlTemplate, ref); break;
case resourceToResource: check(rControlList, ref); break;
default: break; /* warn about invalid value ? */
}
2018-07-20 01:06:32 +00:00
}
}