Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Menu icon - MAC

bartimar
Newcomer
Hi, I'm pretty desperate adding icon in the ArchiCAD menu on MAC.

I already add icons in Dialog on Win/MAC and Menu icon only on Win.

After inspecting few .bundle(s) from Graphisoft, I see there are tiff images named with ID prefixed with 'b' (like bmp or bitmap, I guess)

in grc I have

'GBMP' 32555 "mainicon" {
"mainicon"
}

'STR#' MENU_OPTIONS_TEST "Menu description" {
/* [ 1] */ "TEST"
/* [ 2] */ "STEST^32555"
}

Which file format should I use now? bmp, tiff?
How should I name the file? mainicon, 32555, b32555?
Where the file should be? I have it always in RO folder (by .ro files), I guess the -p <path> is just useless.

I tried like very combination for naming the file and extension, but this still doesnt work. The icon in menu is always loaded from other AC Addons. (example: for "STEST^32555" AC will look in other bundles for file b32555.tif and show it)

I will be thankful for any advice. I spent like 4 hours to figure out the format for GICN should be .tif, THERE ISNT A SINGLE LINE ABOUT IT IN DOCUMENTATION! I really hate this API...

EDIT:
Also doesnt work on Picture (should be also GBMP) in dialog

'GBMP' 32552 "Icon" {
"iconfile"
}

Picture 10 10 30 30 32552 ClientEdge
4 REPLIES 4

Tibor Lorantfy
Advisor
Hi,

You can use bmp file format.
Here's a short guide how to add icon to an ArchiCAD add-on menu item:
  • UPDATED ( 2013.09.04. 9:21 AM )

    1. Place your bmp images into an RFIX/Images folder.

    2. Place icon definition into your Fix.grc file:
    'GBMP' <ICON_ID> "Menu Icon" {   
    "<BMP_FILE_NAME_WITHOUT_EXTENSION>"   
    }


    3. Add the defined icon to the menu item in your localized grc file:
    'STR#' <MENU_ID> "Menu strings" {  
    /* [   ] */	"My menu"  
    /* [  1] */	"Menu item with icon^<ICON_ID>"  
    }


    4. Check that you have the compileGRCs.pl script in RFIX.mac folder. Build and test it!

I don't think that this is so ugly, so you shouldn't hate this API.
I hope after these few steps it will work for you. But if won't, I can help you further.

Regards,
Tibor

bartimar
Newcomer
OK, I just found out the solution.

With my example, I need to have mainicon.bmp by .ro files, ResConv will make bmainicon.tif and the ID 32555 is OK, I transfered the bundle desperately to test on another MAC and everything was fine (the icon was in Menu, and even transparent). So the fault was on ArchiCAD, he just holds the Addon ID and all the resources and refuse to register another.

Temporary solution for developing is to change the Addon ID... and that IS SO ANNOYING!

bartimar
Newcomer
Tibor: I just read your answer, here is my reply:
You can use bmp file format.
There are so many bmp formats in this world...
Place your bmp images into an Images folder somewhere near the resources. (images should be in RFIX/Images)
near resources? What resources? Images SHOULD be in RFIX/Images? Why the should be? Because of compileGRCs.pl from examples? Cause of -p path parameter of ResConv? Please, be more specific, or people will waste so much time guessing the proper settings... just like me
Place icon definition into your grc file:
Code:

'GBMP' <ICON_ID> "Menu Icon" {  
"<BMP_FILE_NAME_WITHOUT_EXTENSION>"  
}
Where in grc file? Before the use of ^ in menu strings? in FIX or INT? Just so vague like in documentation.
In your XCode project modify the custom build command of the grc, write the following option after the ResConv.exe command:
Code:

-p <IMAGES_FOLDER>
(in our case: -p "RFIX\Images")
I dont think I want to run ResConv.exe on Mac...
Custom build command? In XCode there are no custom build commands (like in Visual Studio), in XCode you provided a perl script
-p "RFIX\Images" ? Again, we are talking about Mac, I guess you know the difference between slash and backlash and Win/Mac. And the relative path of Images - depends from where you run the perl script. If you are talking about API examples, the perl script should be called like RFIX.mac/compileGRCs.pl and the path RFIX/Images (yeah, it looks ugly - as it is)
Add the defined icon to the menu item in your grc file:
Yeah, so simple.. but what if the icon is broken (something else is displayed)? Where is answer to this? You just cant rely that always will be fine with one little given example. in API Examples there isnt any menu icon demonstration...

You could at least mention that ResConv will make tiff file (yeah, again no mention in documentation) from bmp, then copy all tiff files to .ro files (i guess Rez needs that)
Also you could mention that on MAC for GICN 32555 (with given 32555.bmp) will be 32555.tif output, for GBMP 32555 someicon (with given someicon.bmp) will be b32555.tif output... I get this output from ResConv, so I figured out (the b32555.tif i realized from other bundles in AC addons folder) that everything should be fine.. I didnt know that everything should be copied in .bundle contents! Again, no mention, no examples, so many wasted time on this...
I don't think that this is so ugly, so you shouldn't hate this API.
Let me give you an example of nice API and ArchiCAD API and compare it

Nice API:
ACSetMenuItemIcon("../../Resources/Images/mainicon.bmp",TRANSPARENCY_ON,KEEP_PROPORTION); //Backward compatible, the paths work for MAC/Win

ArchiCAD API:

One strange file
'GBMP' 32555 "mainicon" {
"mainicon"
}

'STR#' MENU_OPTIONS_TEST "Menu description" {
/* [ 1] */ "TEST"
/* [ 2] */ "STEST^32555"
}

Call some strange binary to compile
../ResConv -p <some_path_i_dont_know_for_what_cause_of_bad_docs> -another_useless_parameter

And in Code (if you are lucky and you have an API Call for this)

#ifdef macintosh
#ifndef AC15
SomeNonWorkingAPICallWithoutExceptionOrDocumentedError(blabla) //Non backward compatible
#endif
#elif windows
//There should be a simple Window resize API call, I hope they will code it in like 30 years..
#endif

Sorry for rage, but the doc is bad, dont tell me something other... the API is also bad - I will be glad compiling C++ code when I have to compile with GCC... (there are no C++ in API, just C)

Tibor Lorantfy
Advisor
Hi bartimar,

Thank you for calling my attention to my faults.

RFIX folder contains resources that do not require localization (so called Fix). Usually the images are these (while menu names are typically localized), that's why they should be placed to that folder.
But of course all of this depends on you and on your addon's specification. Anyway the relative location of your images must be the -p parameter of ResConv.

If the bmp images were placed somewhere in RFIX folder, then in my opinion it's self-understood that the GBMP resource definition should be placed in grc file, which is in RFIX folder.
I would highlight again that this depends only on you, you can place it to the another grc file, if you compile that with the proper -p parameter.

Regards,
Tibor

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!