diff --git a/src/tools/rc/decompile.cpp b/src/tools/rc/decompile.cpp index 8cc7809a36..d177645b3c 100644 --- a/src/tools/rc/decompile.cpp +++ b/src/tools/rc/decompile.cpp @@ -713,8 +713,28 @@ write_app_flags(const void *data, size_t length) static void write_app_icon(uint32 which, const void *data, size_t length) { - fprintf(sOutputFile, "resource %s_icon ", which == B_MINI_ICON ? "mini" : "large"); - write_raw(NULL, B_RAW_TYPE, data, length, which); + int32 lineWidth = 32; + const char* type = ""; + switch (which) { + case B_MINI_ICON: + type = "mini"; + lineWidth = 16; + break; + case B_LARGE_ICON: + type = "large"; + break; + case 'VICN': + type = "vector"; + break; + case 'PNG ': + type = "png"; + break; + default: + fprintf(stderr, "write_app_icon() called with invalid type!\n"); + break; + } + fprintf(sOutputFile, "resource %s_icon ", type); + write_raw(NULL, B_RAW_TYPE, data, length, lineWidth); } @@ -828,6 +848,20 @@ write_data(int32 id, const char *name, type_code type, } break; + case B_RAW_TYPE: + if (!strcmp(name, "BEOS:ICON")) { + write_app_icon('VICN', data, length); + return; + } + break; + + case 'PNG ': + if (!strcmp(name, "BEOS:ICON")) { + write_app_icon('PNG ', data, length); + return; + } + break; + case 'MICN': if (!strcmp(name, "BEOS:M:STD_ICON")) { write_app_icon(B_MINI_ICON, data, length); diff --git a/src/tools/rc/parser.y b/src/tools/rc/parser.y index 2c8d2d3670..f5df2626f0 100644 --- a/src/tools/rc/parser.y +++ b/src/tools/rc/parser.y @@ -1575,6 +1575,48 @@ add_app_version() } +static void +add_png_icon() +{ + field_t* fields = (field_t*)alloc_mem(1 * sizeof(field_t)); + fields[0].type = get_type("raw"); + fields[0].name = "icon"; + fields[0].resize = 0; + fields[0].data = make_data(fields[0].resize, fields[0].type); + + type_t type; + type.code = 'PNG '; + type.name = "png_icon"; + type.fields = fields; + type.count = 1; + type.def_id = 101; + type.def_name = "BEOS:ICON"; + + type_table.insert(make_pair(type.name, type)); +} + + +static void +add_vector_icon() +{ + field_t* fields = (field_t*)alloc_mem(1 * sizeof(field_t)); + fields[0].type = get_type("raw"); + fields[0].name = "icon"; + fields[0].resize = 0; + fields[0].data = make_data(fields[0].resize, fields[0].type); + + type_t type; + type.code = 'RAWT'; + type.name = "vector_icon"; + type.fields = fields; + type.count = 1; + type.def_id = 101; + type.def_name = "BEOS:ICON"; + + type_table.insert(make_pair(type.name, type)); +} + + static void add_large_icon() { @@ -1680,6 +1722,8 @@ init_parser() add_app_version(); add_large_icon(); add_mini_icon(); + add_vector_icon(); + add_png_icon(); add_file_types(); add_define("B_SINGLE_LAUNCH", 0x0);