Could someone strip out the macro from this?

12 posts / 0 new
Last post
AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 3 months ago
Joined: 2012-02-18 19:55
Could someone strip out the macro from this?

Hello,

could someone help me to remove the macros from sdk\examples\Reaction\os4examples\imageButton\imagebut.c?

i'm getting mad.

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 3 months ago
Joined: 2012-02-18 19:55
Thank you trixie. I looked at

Thank you trixie.
I looked at sdk\include\... reaction\reaction_macros...

This helped me a little. I will post specific problem i encountered as soon as possibile.

jabirulo
jabirulo's picture
Offline
Last seen: 2 weeks 4 hours ago
Joined: 2013-05-30 00:53
1)Replace 'ButtonObject,'

1)Replace 'ButtonObject,' with 'IIntuition->NewObject(NULL, "button.gadget",'
BitMapObject -> "bitmap.image"
WindowObject -> "window.class"
LayoutObject -> "layout.gadget"

2)Replace all the 'xxxEnd,' with 'TAG_END),', note the last tag (semicolon) 'WindowEnd;' -> 'TAG_DONE);'

'VLayoutObject,' -> 'IIntuition->NewObject(NULL, "layout.gadget", LAYOUT_Orientation,LAYOUT_ORIENT_VERT,'

'RA_OpenWindow(win)' -> '(struct Window *)IIntuition->IDoMethod(win, WM_OPEN))'

'RA_HandleInput(win, &code)))' -> 'IIntuition->IDoMethod(win, WM_HANDLEINPUT, &code)))'

and comment out 'reaction/reaction_macros.h' include

Hope it helps.

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 3 months ago
Joined: 2012-02-18 19:55
@jabirulo i need this part

@jabirulo

i need this part particularly:

" LAYOUT_AddChild, LayoutObject,
LAYOUT_VertAlignment, LALIGN_CENTER,
LAYOUT_HorizAlignment, LALIGN_CENTER,

LAYOUT_AddChild, OBJ(OBJ_IBUT_1) = ButtonObject,
BUTTON_BevelStyle, BVS_NONE,
BUTTON_Transparent, TRUE,
BUTTON_RenderImage, OBJ(OBJ_SEL) = BitMapObject,
BITMAP_SourceFile, "images/unsel.gif",
BITMAP_DisabledSourceFile, "images/ghosted.gif",
BITMAP_Screen, screen,
BITMAP_Masking, TRUE,
BitMapEnd,
BUTTON_SelectImage, OBJ(OBJ_UNSEL) = BitMapObject,
BITMAP_SourceFile, "images/sel.gif",
BITMAP_Screen, screen,
BITMAP_Masking, TRUE,
BitMapEnd,
ButtonEnd,
CHILD_WeightedWidth, 0,
CHILD_WeightedHeight, 0,

LayoutEnd,"

could you please help me?

jabirulo
jabirulo's picture
Offline
Last seen: 2 weeks 4 hours ago
Joined: 2013-05-30 00:53
..LAYOUT_AddChild,
  1. ..
  2. LAYOUT_AddChild, /*LayoutObject,*/
  3. IIntuition->NewObject(NULL, "layout.gadget",
  4. LAYOUT_VertAlignment, LALIGN_CENTER,
  5. LAYOUT_HorizAlignment, LALIGN_CENTER,
  6.  
  7. LAYOUT_AddChild, OBJ(OBJ_IBUT_1) = /*ButtonObject,*/
  8. IIntuition->NewObject(NULL, "button.gadget",
  9. BUTTON_BevelStyle, BVS_NONE,
  10. BUTTON_Transparent, TRUE,
  11. BUTTON_RenderImage, OBJ(OBJ_SEL) = /*BitMapObject,*/
  12. IIntuition->NewObject(NULL, "bitmap.image",
  13. BITMAP_SourceFile, "images/unsel.gif",
  14. BITMAP_DisabledSourceFile, "images/ghosted.gif",
  15. BITMAP_Screen, screen,
  16. BITMAP_Masking, TRUE,
  17. /*BitMapEnd,*/
  18. TAG_END),
  19. BUTTON_SelectImage, OBJ(OBJ_UNSEL) = /*BitMapObject,*/
  20. IIntuition->NewObject(NULL, "bitmap.image",
  21. BITMAP_SourceFile, "images/sel.gif",
  22. BITMAP_Screen, screen,
  23. BITMAP_Masking, TRUE,
  24. /*BitMapEnd,*/
  25. TAG_END),
  26. /*ButtonEnd,*/
  27. TAG_END),
  28. CHILD_WeightedWidth, 0,
  29. CHILD_WeightedHeight, 0,
  30.  
  31. /*LayoutEnd,*/
  32. TAG_END),
  33. ..

As previous post:
1)Replaced XXXObject with IIntuition->NewObject(NULL, "Name_Of_The_Object",
2)Replaced XXXEnd with TAG_END

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

jabirulo
jabirulo's picture
Offline
Last seen: 2 weeks 4 hours ago
Joined: 2013-05-30 00:53
BTW: just a classes load

BTW: just a classes load question, how do I open/use chooser.gadget in case I want to use IChooser->AllocChooserNode()?

  1. struct ClassLibrary *ChooserBase; // the class library base
  2. Class *ChooseerClass; // the class pointer
  3. struct ChooserIFace *IChooser;
  4. ..
  5. ChooserBase = IIntuition->OpenClass("gadgets/chooser.gadget", 52, &ChooserClass);
  6. if(!ChooserBase) return FALSE;
  7. IChooser = (struct ChooserIFace *)IExec->GetInterface(ChooserBase, "main", 1, NULL);
  8. if(!IChooser) return FALSE;

or do I have to use (or both are valid):

  1. struct Library *ChooserBase;
  2. ..
  3. ChooserBase = (struct Library *)IExec->OpenLibrary("gadgets/chooser.gadget", 52);
  4. if(!ChooserBase) return FALSE;
  5. IChooser = (struct ChooserIFace *)IExec->GetInterface( (struct Library *)ChooserBase, "main", 1, NULL);
  6. ..

TIA

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

salass00
salass00's picture
Offline
Last seen: 1 month 3 days ago
Joined: 2011-02-03 11:27
Instantiating from the class


Instantiating from the class pointer can be faster, depending on the number of objects and complexity of your GUI. Steven says there's hardly a noticeable difference compared to using the public name; this may be true on his X1000 but on a lowly 600MHz Sam I can definitely tell :-)

Using class pointers also forces you to open the classes before you use them (which is good), while when using class names it can be easy to forget as the compiler won't produce an error if you don't handle this part and might not even cause your compiled program to fail if the classes are already in use by other programs.

Log in or register to post comments