static Bool WWriteEntryToRC( WAccelEditInfo *einfo, WAccelEntry *entry, FILE *fp ) { char *keytext; char *flagtext; uint_16 key, flags, id; Bool ok; flagtext = NULL; ok = (einfo != NULL && entry != NULL); if( ok ) { if( entry->is32bit ) { key = entry->entry32.Ascii; flags = entry->entry32.Flags; id = entry->entry32.Id; } else { key = entry->entry.Ascii; flags = entry->entry.Flags; id = (uint_16)entry->entry.Id; } keytext = WGetKeyText( key, flags ); ok = (keytext != NULL); } if( ok ) { ok = WSetFlagsText( flags, &flagtext ); } if( ok ) { fprintf( fp, " %s,\t", keytext ); if( entry->symbol ) { fprintf( fp, "%s", entry->symbol ); } else { fprintf( fp, "%d", (int)id ); } if( flagtext != NULL ) { fprintf( fp, "%s\n", flagtext ); } else { fwrite( "\n", sizeof( char ), 1, fp ); } } if( flagtext != NULL ) { WMemFree( flagtext ); } return( ok ); }
static Bool WWriteMenuEntryItem( WMenuEntry *entry, FILE *fp, int depth ) { Bool ok; char *itemname; char *text; char *flagtext; text = NULL; flagtext = NULL; itemname = NULL; ok = ( entry && fp ); if( ok ) { depth++; fprintf( fp, "%*s", DEPTH_MULT*depth, "" ); } if( ok ) { if( !( entry->item->Item.Normal.ItemFlags & MENU_SEPARATOR ) ) { ok = FALSE; itemname = WGETMENUITEMTEXT(entry->item); if( itemname != NULL ) { text = WConvertStringFrom( itemname, "\t\x8\"\\", "ta\"\\" ); ok = ( text != NULL ); } } } if( ok ) { if( !( entry->item->Item.Normal.ItemFlags & MENU_SEPARATOR ) ) { ok = WSetFlagsText( entry->item->Item.Normal.ItemFlags, &flagtext ); } } if( ok ) { if( entry->item->Item.Normal.ItemFlags & MENU_POPUP ) { fprintf( fp, "POPUP \"%s\"%s\n", text, flagtext ); } else if( entry->item->Item.Normal.ItemFlags & MENU_SEPARATOR ) { fprintf( fp, "MENUITEM SEPARATOR\n" ); } else { if( entry->symbol ) { fprintf( fp, "MENUITEM \"%s\"\t%s%s\n", text, entry->symbol, flagtext ); } else { fprintf( fp, "MENUITEM \"%s\"\t%u%s\n", text, entry->item->Item.Normal.ItemID, flagtext ); } } } if( flagtext != NULL ) { WMemFree( flagtext ); } if( text != NULL ) { WMemFree( text ); } return( ok ); }