From 25620bdc635a866d6ab65f5d8730163281fe329a Mon Sep 17 00:00:00 2001 From: SarahW Date: Mon, 21 Aug 2017 19:48:51 +0100 Subject: [PATCH] Add copy button to wx GUI. Patch from bit. --- src/pc.xrc | 11 + src/wx-config_sel.c | 50 ++ src/wx-resources.cpp | 588 +++++++++------- src/wx-utils.cc | 1549 +++++++++++++++++++++--------------------- src/wx-utils.h | 1 + 5 files changed, 1194 insertions(+), 1005 deletions(-) diff --git a/src/pc.xrc b/src/pc.xrc index 75af390..98c78b8 100644 --- a/src/pc.xrc +++ b/src/pc.xrc @@ -2482,6 +2482,17 @@ 0 + + + wxALL + 5 + + + Copy + icons/32x32/computer_go.png + 0 + + wxALL diff --git a/src/wx-config_sel.c b/src/wx-config_sel.c index df769b7..962c194 100644 --- a/src/wx-config_sel.c +++ b/src/wx-config_sel.c @@ -248,6 +248,56 @@ static int config_selection_dlgproc(void* hdlg, int message, INT_PARAM wParam, L return TRUE; } + else if (wParam == WX_ID("IDC_COPY")) + { + char name[64]; + char old_name[64]; + void* h; + int c; + + h = wx_getdlgitem(hdlg, WX_ID("IDC_LIST")); + c = wx_sendmessage(h, WX_LB_GETCURSEL, 0, 0); + if (c >= 0) + { + wx_sendmessage(h, WX_LB_GETTEXT, c, (LONG_PARAM)old_name); + strcpy(name, old_name); + + while (!done) + { + if (wx_textentrydialog(hdlg, "Enter name:", "New name", name, 1, 64, (LONG_PARAM)name)) + { + char old_path[512]; + char new_path[512]; + + strcpy(old_path, configs_path); + put_backslash(old_path); + strcat(old_path, old_name); + strcat(old_path, ".cfg"); + + strcpy(new_path, configs_path); + put_backslash(new_path); + strcat(new_path, name); + strcat(new_path, ".cfg"); + + pclog("Copy %s to %s\n", old_path, new_path); + + if (!wx_file_exists(new_path)) + { + wx_copy_file(old_path, new_path, 1); + + config_list_update(hdlg); + done = 1; + } + else + wx_simple_messagebox("Already exists", "A configuration with that name already exists."); + } + else + done = 1; + } + } + + return TRUE; + } else if (wParam == WX_ID("IDC_DELETE")) { char name[64]; diff --git a/src/wx-resources.cpp b/src/wx-resources.cpp index a2210cc..0621be6 100644 --- a/src/wx-resources.cpp +++ b/src/wx-resources.cpp @@ -1450,11 +1450,110 @@ static unsigned char xml_res_file_21[] = { 188,16,216,199,255,233,248,143,0,3,0,149,57,130,56,76,237,54,38,0,0,0,0, 73,69,78,68,174,66,96,130}; -static size_t xml_res_size_22 = 2051; +static size_t xml_res_size_22 = 1967; static unsigned char xml_res_file_22[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,32,0,0,0,32,8,6,0,0, 0,115,122,122,244,0,0,0,25,116,69,88,116,83,111,102,116,119,97,114,101, 0,65,100,111,98,101,32,73,109,97,103,101,82,101,97,100,121,113,201,101, +60,0,0,7,81,73,68,65,84,120,218,180,87,125,108,93,101,25,255,189,239,57, +231,158,115,123,215,142,174,235,166,67,35,84,199,24,100,72,157,153,102, +69,19,101,200,199,10,138,81,23,62,226,248,131,232,192,143,63,140,134,232, +152,134,65,130,136,35,209,108,134,96,52,33,58,194,103,22,65,182,105,153, +115,27,69,6,186,205,106,169,118,99,13,100,31,108,107,217,218,219,246,222, +123,190,94,127,207,57,231,94,110,187,22,70,19,79,250,244,124,190,239,243, +123,126,207,239,121,223,231,42,204,236,176,239,217,244,196,211,218,178, +191,104,140,57,231,65,74,41,196,81,248,135,159,124,107,213,87,120,27,38, +207,102,226,252,199,191,124,108,139,81,86,231,101,151,45,68,108,98,224, +92,48,208,147,86,26,61,61,7,161,76,244,199,245,223,189,249,198,42,136,247, +123,52,174,219,248,132,137,24,122,201,143,204,88,37,60,103,147,239,101, +156,140,151,121,146,104,102,0,192,139,163,8,126,16,97,231,129,195,120,31, +25,96,10,128,207,93,222,6,25,47,243,208,138,51,1,160,36,239,226,88,38,252, +124,123,91,250,212,212,254,77,123,252,229,192,0,162,216,48,109,166,150, +126,123,70,18,148,241,90,35,103,219,216,240,244,139,137,184,170,51,154, +42,144,58,106,228,42,166,227,101,139,62,76,231,152,240,206,158,160,106, +155,170,142,223,155,83,137,224,254,135,159,76,174,53,157,171,140,95,57, +59,249,60,114,141,205,116,24,163,90,33,166,202,140,50,233,243,122,69,139, +173,251,197,230,45,65,20,119,182,47,105,59,39,85,27,212,211,173,106,165, +164,180,194,254,125,125,152,93,240,176,232,162,11,17,69,239,128,144,67, +238,67,51,241,153,0,200,67,91,157,107,191,189,10,34,13,61,195,133,193,100, +118,245,21,237,184,247,161,223,225,206,175,173,64,16,198,117,116,43,116, +237,235,71,28,154,179,0,120,130,140,159,226,59,247,60,2,47,167,97,101,201, +172,165,19,117,247,117,41,172,221,115,114,201,92,16,25,108,248,225,55,18, +49,60,240,228,158,132,238,234,56,73,219,210,133,11,18,134,39,3,80,134,31, +86,2,96,78,99,30,207,12,182,35,159,83,112,93,11,142,235,80,104,10,185,156, +13,135,168,114,52,135,247,14,105,18,227,103,112,104,196,76,159,26,133,55, +186,8,34,130,34,26,91,219,48,74,242,157,6,167,50,109,133,209,217,0,32,159, +85,252,16,133,188,56,100,78,60,13,151,230,112,118,151,158,44,59,117,156, +0,208,25,0,58,182,45,3,135,115,217,58,141,48,239,57,168,84,66,58,176,176, +236,99,31,77,24,240,149,15,223,74,105,15,125,63,209,64,189,198,210,42,224, +135,101,63,34,253,14,148,99,193,114,53,108,57,231,44,222,11,0,154,165,161, +9,66,19,0,255,40,122,147,156,53,207,42,225,24,201,120,9,68,199,57,108,172, +204,135,72,224,246,134,65,172,220,180,129,78,35,108,89,179,134,139,16,166, +96,128,15,42,129,15,143,148,179,20,19,135,218,177,105,86,106,114,47,70, +6,136,35,209,136,156,73,50,108,1,34,139,75,168,224,145,129,50,1,196,124, +63,248,18,53,33,220,95,101,225,173,103,239,79,117,115,199,29,4,21,79,220, +88,170,50,42,83,4,110,46,199,168,117,226,84,217,86,10,134,215,182,45,233, +208,105,10,44,201,61,211,65,199,97,24,178,114,152,166,156,148,143,65,3, +47,202,126,133,121,30,199,218,171,142,241,28,33,240,207,224,229,237,111, +18,64,12,229,151,25,108,52,5,3,34,66,63,72,34,208,154,142,181,68,108,37, +105,176,115,233,57,164,211,33,31,40,177,140,134,75,97,34,42,19,48,223,4, +17,51,234,114,25,88,187,72,0,4,20,98,5,126,56,146,10,78,176,133,41,237, +134,206,35,238,33,6,147,0,200,203,50,197,227,50,135,154,220,38,121,167, +217,100,96,60,82,56,226,43,2,208,201,66,35,9,119,92,37,114,78,202,205,168, +52,133,82,243,13,174,147,4,34,1,69,178,225,196,172,36,237,37,244,135,113, +41,41,65,217,11,234,25,208,169,6,144,32,247,72,161,8,205,38,3,204,44,78, +86,98,156,162,243,88,4,200,242,176,36,69,212,134,164,71,89,86,2,72,68,169, +116,10,206,243,114,73,42,35,58,90,241,233,75,136,47,135,245,93,23,224,215, +175,44,193,103,150,93,76,192,54,129,68,103,3,16,105,86,18,13,56,201,162, +82,137,53,78,149,98,210,205,8,57,113,204,232,13,29,70,4,17,145,149,136, +14,35,233,110,152,174,88,89,100,129,227,56,185,231,230,201,128,204,167, +240,167,238,62,92,189,252,194,68,172,75,230,21,113,219,198,57,100,163,137, +197,96,79,40,195,26,3,227,204,163,67,6,138,140,250,72,49,68,49,80,24,165, +178,139,161,70,49,202,44,200,238,105,163,161,133,177,208,38,216,89,8,208, +204,168,230,160,208,48,31,81,88,224,164,77,184,161,99,49,118,252,237,76, +66,255,170,142,31,96,241,7,78,227,217,222,219,88,190,5,178,149,155,164, +1,89,136,40,40,103,182,139,61,95,151,9,178,149,221,72,209,142,191,179,218, +155,234,46,78,218,201,138,99,21,240,171,157,215,99,215,127,95,32,237,192, +186,231,146,229,0,134,243,47,95,127,107,242,105,178,0,234,2,174,251,196, +87,241,252,254,167,240,251,87,110,130,101,110,159,8,64,201,42,197,25,122, +14,191,141,127,30,26,154,176,202,79,215,241,40,82,111,171,38,108,239,123, +1,143,223,185,9,167,131,231,249,185,93,107,51,77,109,235,142,89,161,45, +232,61,254,20,174,255,228,45,216,214,179,25,253,56,51,1,128,25,29,29,233, +222,191,247,165,14,83,221,171,107,27,81,218,189,52,120,46,198,198,203,89, +199,1,82,237,161,84,14,57,184,9,138,141,85,49,56,141,61,253,91,147,215, +106,170,173,91,61,7,97,189,247,228,102,172,92,186,26,78,238,81,156,185, +23,191,233,90,135,27,5,64,249,183,15,220,245,77,158,231,214,53,40,106,249, +149,157,139,190,240,229,91,55,148,34,229,46,189,252,34,28,62,62,84,155, +180,237,131,45,216,119,224,16,154,189,185,248,215,32,48,26,29,227,230,48, +125,31,88,235,150,104,7,135,30,199,167,22,95,138,151,251,122,59,165,21, +16,135,37,218,155,180,147,117,1,120,43,190,116,75,151,202,55,192,229,98, +50,171,177,128,43,23,180,214,250,192,83,197,113,184,121,15,33,171,64,142, +146,57,202,253,99,250,30,223,100,171,175,150,77,203,170,96,239,161,94,84, +70,176,83,26,40,59,235,205,139,153,85,143,57,126,16,224,146,15,205,199, +200,88,9,7,95,63,130,254,58,49,72,15,216,58,247,60,52,55,180,2,39,128,138, +117,20,110,97,10,0,38,21,97,24,164,183,22,189,13,28,1,250,246,125,22,59, +239,219,253,61,62,10,166,107,74,237,144,43,221,249,173,179,241,145,243, +91,49,52,60,198,42,9,106,85,224,58,14,90,102,55,66,7,14,230,235,118,252, +236,209,191,167,59,226,100,255,226,156,225,173,190,41,29,58,240,6,240,218, +222,14,52,15,175,238,6,118,15,10,121,211,1,8,255,253,143,238,239,179,149, +248,249,210,37,23,163,253,210,54,52,53,53,162,138,96,100,164,136,158,215, +6,240,106,207,235,56,177,235,227,63,218,181,109,255,171,211,244,228,206, +53,63,197,54,39,15,244,31,4,118,108,199,238,23,31,236,94,15,116,191,197, +119,195,226,103,186,180,113,8,22,180,204,91,176,240,186,155,215,220,61, +235,188,150,142,180,91,54,217,26,192,69,106,120,168,123,235,99,15,223,55, +116,242,216,0,31,142,72,207,57,197,60,205,43,31,196,127,58,174,0,254,186, +3,67,127,190,27,215,242,217,241,204,121,233,221,0,200,10,233,138,22,104, +243,104,77,147,126,67,132,153,83,17,238,219,82,73,211,48,48,239,134,135, +112,130,26,24,217,122,23,174,225,253,97,218,96,61,216,247,250,113,106,103, +108,184,147,26,102,209,117,165,26,197,187,140,111,166,93,144,205,115,148, +118,74,132,55,233,55,235,255,245,144,69,191,33,187,30,155,236,92,142,255, +9,48,0,241,195,153,86,37,156,12,221,0,0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_23 = 2051; +static unsigned char xml_res_file_23[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,32,0,0,0,32,8,6,0,0, +0,115,122,122,244,0,0,0,25,116,69,88,116,83,111,102,116,119,97,114,101, +0,65,100,111,98,101,32,73,109,97,103,101,82,101,97,100,121,113,201,101, 60,0,0,7,165,73,68,65,84,120,218,156,87,107,112,21,103,25,126,190,221,61, 187,231,228,228,2,185,181,73,4,148,66,130,117,200,52,182,214,81,42,14,45, 86,7,80,212,233,216,17,157,78,127,56,26,188,212,209,254,160,25,172,12,242, @@ -1553,8 +1652,8 @@ static unsigned char xml_res_file_22[] = { 250,58,190,198,55,48,18,49,104,115,122,47,134,29,3,118,202,219,228,255, 5,24,0,238,123,163,24,29,62,142,101,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_23 = 1382; -static unsigned char xml_res_file_23[] = { +static size_t xml_res_size_24 = 1382; +static unsigned char xml_res_file_24[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,32,0,0,0,32,8,6,0,0, 0,115,122,122,244,0,0,0,25,116,69,88,116,83,111,102,116,119,97,114,101, 0,65,100,111,98,101,32,73,109,97,103,101,82,101,97,100,121,113,201,101, @@ -1623,8 +1722,8 @@ static unsigned char xml_res_file_23[] = { 87,93,129,205,251,40,255,176,89,15,134,167,154,149,127,4,24,0,227,17,114, 29,252,169,144,138,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_24 = 124939; -static unsigned char xml_res_file_24[] = { +static size_t xml_res_size_25 = 125407; +static unsigned char xml_res_file_25[] = { 60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101, 110,99,111,100,105,110,103,61,34,85,84,70,45,56,34,63,62,10,60,33,45,45, 32,104,116,116,112,58,47,47,100,111,99,115,46,119,120,119,105,100,103,101, @@ -6527,113 +6626,179 @@ static unsigned char xml_res_file_24[] = { 32,32,32,60,98,111,114,100,101,114,62,53,60,47,98,111,114,100,101,114,62, 10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99, 116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,66,117,116, -116,111,110,34,32,110,97,109,101,61,34,73,68,67,95,68,69,76,69,84,69,34, -62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,115,116, -121,108,101,62,119,120,66,85,95,65,85,84,79,68,82,65,87,60,47,115,116,121, -108,101,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60, -116,111,111,108,116,105,112,62,68,101,108,101,116,101,60,47,116,111,111, -108,116,105,112,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,60,98,105,116,109,97,112,62,119,120,45,114,101,115,111,117,114,99,101, -115,46,99,112,112,36,105,99,111,110,115,95,51,50,120,51,50,95,99,111,109, -112,117,116,101,114,95,100,101,108,101,116,101,46,112,110,103,60,47,98, -105,116,109,97,112,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,60,100,101,102,97,117,108,116,62,48,60,47,100,101,102,97,117,108, -116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98, -106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111, -98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98, -106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101, -99,116,62,10,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32, -99,108,97,115,115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32, -32,32,32,32,32,32,32,32,32,32,32,60,111,112,116,105,111,110,62,48,60,47, -111,112,116,105,111,110,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,102, -108,97,103,62,119,120,65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32, -32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,53,60,47,98,111,114,100, -101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99, -116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,66,117,116, -116,111,110,34,32,110,97,109,101,61,34,119,120,73,68,95,67,65,78,67,69, -76,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,115,116,121,108, +116,111,110,34,32,110,97,109,101,61,34,73,68,67,95,67,79,80,89,34,62,10, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,115,116,121,108, 101,62,119,120,66,85,95,65,85,84,79,68,82,65,87,60,47,115,116,121,108,101, -62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,116,111,111,108,116, -105,112,62,81,117,105,116,60,47,116,111,111,108,116,105,112,62,10,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,60,98,105,116,109,97,112,62,119,120, -45,114,101,115,111,117,114,99,101,115,46,99,112,112,36,105,99,111,110,115, -95,51,50,120,51,50,95,100,111,111,114,95,105,110,46,112,110,103,60,47,98, -105,116,109,97,112,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,100, -101,102,97,117,108,116,62,48,60,47,100,101,102,97,117,108,116,62,10,32, -32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,116,111, +111,108,116,105,112,62,67,111,112,121,60,47,116,111,111,108,116,105,112, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,105,116, +109,97,112,62,119,120,45,114,101,115,111,117,114,99,101,115,46,99,112,112, +36,105,99,111,110,115,95,51,50,120,51,50,95,99,111,109,112,117,116,101, +114,95,103,111,46,112,110,103,60,47,98,105,116,109,97,112,62,10,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,100,101,102,97,117,108, +116,62,48,60,47,100,101,102,97,117,108,116,62,10,32,32,32,32,32,32,32,32, 32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32, -32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,47,111, -98,106,101,99,116,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32, -32,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32, -99,108,97,115,115,61,34,119,120,68,105,97,108,111,103,34,32,110,97,109, -101,61,34,83,104,97,100,101,114,77,97,110,97,103,101,114,68,108,103,34, -62,10,32,32,32,32,60,115,116,121,108,101,62,119,120,68,69,70,65,85,76,84, -95,68,73,65,76,79,71,95,83,84,89,76,69,124,119,120,83,84,65,89,95,79,78, -95,84,79,80,60,47,115,116,121,108,101,62,10,32,32,32,32,60,116,105,116, -108,101,62,80,67,101,109,32,83,104,97,100,101,114,32,77,97,110,97,103,101, -114,60,47,116,105,116,108,101,62,10,32,32,32,32,60,99,101,110,116,101,114, -101,100,62,49,60,47,99,101,110,116,101,114,101,100,62,10,32,32,32,32,60, -111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,80,97,110,101, -108,34,32,110,97,109,101,61,34,82,79,79,84,95,80,65,78,69,76,34,62,10,32, -32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, -120,66,111,120,83,105,122,101,114,34,62,10,32,32,32,32,32,32,32,32,60,111, -98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122,101,114,105,116, -101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119, -120,65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,60, -98,111,114,100,101,114,62,53,60,47,98,111,114,100,101,114,62,10,32,32,32, -32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,66,111,120,83,105,122,101,114,34,62,10,32,32,32,32,32,32,32,32, -32,32,32,32,60,111,114,105,101,110,116,62,119,120,72,79,82,73,90,79,78, -84,65,76,60,47,111,114,105,101,110,116,62,10,32,32,32,32,32,32,32,32,32, -32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122, -101,114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,60,111,112,116,105,111,110,62,48,60,47,111, +112,116,105,111,110,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, 32,60,102,108,97,103,62,119,120,65,76,76,60,47,102,108,97,103,62,10,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,48, -60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,76,105, -115,116,66,111,120,34,32,110,97,109,101,61,34,73,68,67,95,76,73,83,84,34, -62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,115,116,121,108, -101,62,119,120,76,66,95,83,73,78,71,76,69,60,47,115,116,121,108,101,62, -10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,115,105,122,101,62, -51,48,48,44,51,53,48,60,47,115,105,122,101,62,10,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32, -32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32, -32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105, -122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,60,102,108,97,103,62,119,120,69,88,80,65,78,68,60,47,102,108,97,103, -62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114, -62,48,60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,111,120,83,105,122,101,114,34,62,10,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,60,111,114,105,101,110,116,62,119,120,86,69,82,84,73,67, -65,76,60,47,111,114,105,101,110,116,62,10,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115, -105,122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,65,76,76,60,47,102, -108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -60,98,111,114,100,101,114,62,48,60,47,98,111,114,100,101,114,62,10,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116, -32,99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34,32,110,97, -109,101,61,34,73,68,67,95,65,68,68,34,62,10,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,65,100,100,60, -47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, -61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,65,76,76, -60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114, +62,53,60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,66,105,116,109,97,112,66,117,116,116,111,110,34,32,110,97,109,101,61, +34,73,68,67,95,68,69,76,69,84,69,34,62,10,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,60,115,116,121,108,101,62,119,120,66,85,95,65,85, +84,79,68,82,65,87,60,47,115,116,121,108,101,62,10,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,60,116,111,111,108,116,105,112,62,68,101, +108,101,116,101,60,47,116,111,111,108,116,105,112,62,10,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,105,116,109,97,112,62,119, +120,45,114,101,115,111,117,114,99,101,115,46,99,112,112,36,105,99,111,110, +115,95,51,50,120,51,50,95,99,111,109,112,117,116,101,114,95,100,101,108, +101,116,101,46,112,110,103,60,47,98,105,116,109,97,112,62,10,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,100,101,102,97,117,108,116, +62,48,60,47,100,101,102,97,117,108,116,62,10,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32, +32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32, +32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122,101, +114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,111, +112,116,105,111,110,62,48,60,47,111,112,116,105,111,110,62,10,32,32,32, +32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,65,76,76,60,47, +102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114, +100,101,114,62,53,60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32, +32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,66,105,116,109,97,112,66,117,116,116,111,110,34,32,110,97,109,101,61, +34,119,120,73,68,95,67,65,78,67,69,76,34,62,10,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,60,115,116,121,108,101,62,119,120,66,85,95,65,85,84,79, +68,82,65,87,60,47,115,116,121,108,101,62,10,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,60,116,111,111,108,116,105,112,62,81,117,105,116,60,47,116, +111,111,108,116,105,112,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +60,98,105,116,109,97,112,62,119,120,45,114,101,115,111,117,114,99,101,115, +46,99,112,112,36,105,99,111,110,115,95,51,50,120,51,50,95,100,111,111,114, +95,105,110,46,112,110,103,60,47,98,105,116,109,97,112,62,10,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,60,100,101,102,97,117,108,116,62,48,60,47, +100,101,102,97,117,108,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60, +47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,60,47,111, +98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99, +116,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32, +32,60,47,111,98,106,101,99,116,62,10,32,32,60,47,111,98,106,101,99,116, +62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, +68,105,97,108,111,103,34,32,110,97,109,101,61,34,83,104,97,100,101,114, +77,97,110,97,103,101,114,68,108,103,34,62,10,32,32,32,32,60,115,116,121, +108,101,62,119,120,68,69,70,65,85,76,84,95,68,73,65,76,79,71,95,83,84,89, +76,69,124,119,120,83,84,65,89,95,79,78,95,84,79,80,60,47,115,116,121,108, +101,62,10,32,32,32,32,60,116,105,116,108,101,62,80,67,101,109,32,83,104, +97,100,101,114,32,77,97,110,97,103,101,114,60,47,116,105,116,108,101,62, +10,32,32,32,32,60,99,101,110,116,101,114,101,100,62,49,60,47,99,101,110, +116,101,114,101,100,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108, +97,115,115,61,34,119,120,80,97,110,101,108,34,32,110,97,109,101,61,34,82, +79,79,84,95,80,65,78,69,76,34,62,10,32,32,32,32,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,119,120,66,111,120,83,105,122,101,114, +34,62,10,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97, +115,115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32, +32,32,32,32,32,32,60,102,108,97,103,62,119,120,65,76,76,60,47,102,108,97, +103,62,10,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,53, +60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,60,111, +98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,111,120,83,105, +122,101,114,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,111,114,105, +101,110,116,62,119,120,72,79,82,73,90,79,78,84,65,76,60,47,111,114,105, +101,110,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,115,105,122,101,114,105,116,101,109,34, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119, +120,65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32, 32,32,32,60,98,111,114,100,101,114,62,48,60,47,98,111,114,100,101,114,62, -10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106, -101,99,116,32,99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34, -32,110,97,109,101,61,34,73,68,67,95,82,69,77,79,86,69,34,62,10,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,108, -62,82,101,109,111,118,101,60,47,108,97,98,101,108,62,10,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99, +10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32, +99,108,97,115,115,61,34,119,120,76,105,115,116,66,111,120,34,32,110,97, +109,101,61,34,73,68,67,95,76,73,83,84,34,62,10,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,60,115,116,121,108,101,62,119,120,76,66,95,83,73, +78,71,76,69,60,47,115,116,121,108,101,62,10,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,60,115,105,122,101,62,51,48,48,44,51,53,48,60,47,115, +105,122,101,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98, +106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106, +101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,115,105,122,101,114,105,116,101,109,34, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119, +120,69,88,80,65,78,68,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,60,98,111,114,100,101,114,62,48,60,47,98,111,114,100, +101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,119,120,66,111,120,83,105,122,101,114, +34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,114,105, +101,110,116,62,119,120,86,69,82,84,73,67,65,76,60,47,111,114,105,101,110, 116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106, -101,99,116,32,99,108,97,115,115,61,34,115,112,97,99,101,114,34,62,10,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,112,116,105,111, +101,99,116,32,99,108,97,115,115,61,34,115,105,122,101,114,105,116,101,109, +34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108, +97,103,62,119,120,65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,48,60, +47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,66,117,116,116,111,110,34,32,110,97,109,101,61,34,73,68,67,95,65,68, +68,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +60,108,97,98,101,108,62,65,100,100,60,47,108,97,98,101,108,62,10,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99, +116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98, +106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60, +111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122,101,114,105, +116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,60,102,108,97,103,62,119,120,65,76,76,60,47,102,108,97,103,62,10,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101, +114,62,48,60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, +61,34,119,120,66,117,116,116,111,110,34,32,110,97,109,101,61,34,73,68,67, +95,82,69,77,79,86,69,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,60,108,97,98,101,108,62,82,101,109,111,118,101,60,47, +108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,115,112,97,99,101,114,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,60,111,112,116,105,111,110,62,49,60,47,111,112,116,105,111, +110,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102, +108,97,103,62,119,120,69,88,80,65,78,68,60,47,102,108,97,103,62,10,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62, +10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99, +116,32,99,108,97,115,115,61,34,115,105,122,101,114,105,116,101,109,34,62, +10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97, +103,62,119,120,65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,48,60,47, +98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, +66,117,116,116,111,110,34,32,110,97,109,101,61,34,73,68,67,95,67,79,78, +70,73,71,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,60,108,97,98,101,108,62,67,111,110,102,105,103,117,114,101,46,46, +46,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97, +115,115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120, +65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,60,98,111,114,100,101,114,62,48,60,47,98,111,114,100, +101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60, +111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,117,116,116, +111,110,34,32,110,97,109,101,61,34,73,68,67,95,77,79,86,69,95,85,80,34, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108, +97,98,101,108,62,77,111,118,101,32,117,112,60,47,108,97,98,101,108,62,10, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106, +101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47, +111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122,101, +114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,60,102,108,97,103,62,119,120,65,76,76,60,47,102,108,97,103, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114, +100,101,114,62,48,60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108, +97,115,115,61,34,119,120,66,117,116,116,111,110,34,32,110,97,109,101,61, +34,73,68,67,95,77,79,86,69,95,68,79,87,78,34,62,10,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,77,111,118, +101,32,100,111,119,110,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,115,112,97,99,101,114,34,62,10,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,112,116,105,111, 110,62,49,60,47,111,112,116,105,111,110,62,10,32,32,32,32,32,32,32,32,32, 32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,69,88,80,65,78, 68,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, @@ -6645,135 +6810,91 @@ static unsigned char xml_res_file_24[] = { 60,98,111,114,100,101,114,62,48,60,47,98,111,114,100,101,114,62,10,32,32, 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116, 32,99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34,32,110,97, -109,101,61,34,73,68,67,95,67,79,78,70,73,71,34,62,10,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,67,111, -110,102,105,103,117,114,101,46,46,46,60,47,108,97,98,101,108,62,10,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99, -116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98, -106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60, -111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122,101,114,105, -116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,60,102,108,97,103,62,119,120,65,76,76,60,47,102,108,97,103,62,10,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101, -114,62,48,60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, -61,34,119,120,66,117,116,116,111,110,34,32,110,97,109,101,61,34,73,68,67, -95,77,79,86,69,95,85,80,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,60,108,97,98,101,108,62,77,111,118,101,32,117,112, -60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32, +109,101,61,34,73,68,67,95,65,80,80,76,89,34,62,10,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,65,112,112, +108,121,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,32,32,32, 32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115, -115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,65,76, -76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,60,98,111,114,100,101,114,62,48,60,47,98,111,114,100,101,114, -62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106, -101,99,116,32,99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34, -32,110,97,109,101,61,34,73,68,67,95,77,79,86,69,95,68,79,87,78,34,62,10, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98, -101,108,62,77,111,118,101,32,100,111,119,110,60,47,108,97,98,101,108,62, -10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106, -101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47, -111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,112,97,99,101, -114,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111, -112,116,105,111,110,62,49,60,47,111,112,116,105,111,110,62,10,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120, -69,88,80,65,78,68,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115, -115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,65,76, -76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,60,98,111,114,100,101,114,62,48,60,47,98,111,114,100,101,114, -62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106, -101,99,116,32,99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34, -32,110,97,109,101,61,34,73,68,67,95,65,80,80,76,89,34,62,10,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62, -65,112,112,108,121,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32, 32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116, -32,99,108,97,115,115,61,34,115,105,122,101,114,105,116,101,109,34,62,10, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103, -62,119,120,65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,48,60,47,98, -111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, -117,116,116,111,110,34,32,110,97,109,101,61,34,119,120,73,68,95,79,75,34, -62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108, -97,98,101,108,62,79,75,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,100,101,102,97,117,108,116, -62,49,60,47,100,101,102,97,117,108,116,62,10,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32, -99,108,97,115,115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62, -119,120,65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,48,60,47,98,111, -114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,117,116, -116,111,110,34,32,110,97,109,101,61,34,119,120,73,68,95,67,65,78,67,69, -76,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -60,108,97,98,101,108,62,67,97,110,99,101,108,60,47,108,97,98,101,108,62, -10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106, -101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47, -111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60, -47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,47, -111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,60,47,111,98, -106,101,99,116,62,10,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116, -62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60, -47,111,98,106,101,99,116,62,10,32,32,60,47,111,98,106,101,99,116,62,10, -32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,68,105, -97,108,111,103,34,32,110,97,109,101,61,34,67,111,110,102,105,114,109,82, -101,109,101,109,98,101,114,68,108,103,34,62,10,32,32,32,32,60,115,116,121, -108,101,62,119,120,68,69,70,65,85,76,84,95,68,73,65,76,79,71,95,83,84,89, -76,69,124,119,120,83,84,65,89,95,79,78,95,84,79,80,60,47,115,116,121,108, -101,62,10,32,32,32,32,60,116,105,116,108,101,62,80,67,101,109,60,47,116, -105,116,108,101,62,10,32,32,32,32,60,99,101,110,116,101,114,101,100,62, -49,60,47,99,101,110,116,101,114,101,100,62,10,32,32,32,32,60,111,98,106, -101,99,116,32,99,108,97,115,115,61,34,119,120,80,97,110,101,108,34,32,110, -97,109,101,61,34,82,79,79,84,95,80,65,78,69,76,34,62,10,32,32,32,32,32, -32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,111,120, -83,105,122,101,114,34,62,10,32,32,32,32,32,32,32,32,60,111,114,105,101, -110,116,62,119,120,86,69,82,84,73,67,65,76,60,47,111,114,105,101,110,116, -62,10,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115, -115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32, -32,32,32,32,60,111,112,116,105,111,110,62,49,60,47,111,112,116,105,111, -110,62,10,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,69, -88,80,65,78,68,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32, -60,98,111,114,100,101,114,62,53,60,47,98,111,114,100,101,114,62,10,32,32, -32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, -34,119,120,66,111,120,83,105,122,101,114,34,62,10,32,32,32,32,32,32,32, -32,32,32,32,32,60,111,114,105,101,110,116,62,119,120,72,79,82,73,90,79, -78,84,65,76,60,47,111,114,105,101,110,116,62,10,32,32,32,32,32,32,32,32, -32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105, -122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,60,111,112,116,105,111,110,62,48,60,47,111,112,116,105,111,110,62, -10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120, +32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108, +97,115,115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120, 65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,60,98,111,114,100,101,114,62,53,60,47,98,111,114,100,101,114,62,10, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99, -108,97,115,115,61,34,119,120,83,116,97,116,105,99,66,105,116,109,97,112, -34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,105,116, -109,97,112,32,115,116,111,99,107,95,105,100,61,34,119,120,65,82,84,95,81, -85,69,83,84,73,79,78,34,32,115,116,111,99,107,95,99,108,105,101,110,116, -61,34,119,120,65,82,84,95,67,77,78,95,68,73,65,76,79,71,34,47,62,10,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10, -32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32, +32,32,32,32,32,32,60,98,111,114,100,101,114,62,48,60,47,98,111,114,100, +101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60, +111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,117,116,116, +111,110,34,32,110,97,109,101,61,34,119,120,73,68,95,79,75,34,62,10,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101, +108,62,79,75,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,32,32,60,100,101,102,97,117,108,116,62,49,60,47, +100,101,102,97,117,108,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32, 32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97, 115,115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,60,111,112,116,105,111,110,62,48,60,47,111, -112,116,105,111,110,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60, -102,108,97,103,62,119,120,65,76,73,71,78,95,67,69,78,84,69,82,124,119,120, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120, 65,76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,60,98,111,114,100,101,114,62,53,60,47,98,111,114,100,101,114,62,10, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99, -108,97,115,115,61,34,119,120,83,116,97,116,105,99,84,101,120,116,34,32, -110,97,109,101,61,34,73,68,67,95,67,79,78,70,73,82,77,95,76,65,66,69,76, -34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101, +32,32,32,32,32,32,60,98,111,114,100,101,114,62,48,60,47,98,111,114,100, +101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60, +111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,117,116,116, +111,110,34,32,110,97,109,101,61,34,119,120,73,68,95,67,65,78,67,69,76,34, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108, +97,98,101,108,62,67,97,110,99,101,108,60,47,108,97,98,101,108,62,10,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101, +99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111, +98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47, +111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111, +98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106, +101,99,116,62,10,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62, +10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,47, +111,98,106,101,99,116,62,10,32,32,60,47,111,98,106,101,99,116,62,10,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,68,105,97, +108,111,103,34,32,110,97,109,101,61,34,67,111,110,102,105,114,109,82,101, +109,101,109,98,101,114,68,108,103,34,62,10,32,32,32,32,60,115,116,121,108, +101,62,119,120,68,69,70,65,85,76,84,95,68,73,65,76,79,71,95,83,84,89,76, +69,124,119,120,83,84,65,89,95,79,78,95,84,79,80,60,47,115,116,121,108,101, +62,10,32,32,32,32,60,116,105,116,108,101,62,80,67,101,109,60,47,116,105, +116,108,101,62,10,32,32,32,32,60,99,101,110,116,101,114,101,100,62,49,60, +47,99,101,110,116,101,114,101,100,62,10,32,32,32,32,60,111,98,106,101,99, +116,32,99,108,97,115,115,61,34,119,120,80,97,110,101,108,34,32,110,97,109, +101,61,34,82,79,79,84,95,80,65,78,69,76,34,62,10,32,32,32,32,32,32,60,111, +98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,111,120,83,105, +122,101,114,34,62,10,32,32,32,32,32,32,32,32,60,111,114,105,101,110,116, +62,119,120,86,69,82,84,73,67,65,76,60,47,111,114,105,101,110,116,62,10, +32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32, +32,32,60,111,112,116,105,111,110,62,49,60,47,111,112,116,105,111,110,62, +10,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,69,88,80, +65,78,68,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,60,98, +111,114,100,101,114,62,53,60,47,98,111,114,100,101,114,62,10,32,32,32,32, +32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,66,111,120,83,105,122,101,114,34,62,10,32,32,32,32,32,32,32,32,32,32, +32,32,60,111,114,105,101,110,116,62,119,120,72,79,82,73,90,79,78,84,65, +76,60,47,111,114,105,101,110,116,62,10,32,32,32,32,32,32,32,32,32,32,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122,101, +114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32, +60,111,112,116,105,111,110,62,48,60,47,111,112,116,105,111,110,62,10,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,65, +76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,60,98,111,114,100,101,114,62,53,60,47,98,111,114,100,101,114,62,10,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108, +97,115,115,61,34,119,120,83,116,97,116,105,99,66,105,116,109,97,112,34, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,105,116,109, +97,112,32,115,116,111,99,107,95,105,100,61,34,119,120,65,82,84,95,81,85, +69,83,84,73,79,78,34,32,115,116,111,99,107,95,99,108,105,101,110,116,61, +34,119,120,65,82,84,95,67,77,78,95,68,73,65,76,79,71,34,47,62,10,32,32, +32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32, +32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32, +32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,32,32,32,32, +32,32,32,32,32,32,32,32,60,111,112,116,105,111,110,62,48,60,47,111,112, +116,105,111,110,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102, +108,97,103,62,119,120,65,76,73,71,78,95,67,69,78,84,69,82,124,119,120,65, +76,76,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32, +32,60,98,111,114,100,101,114,62,53,60,47,98,111,114,100,101,114,62,10,32, +32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108, +97,115,115,61,34,119,120,83,116,97,116,105,99,84,101,120,116,34,32,110, +97,109,101,61,34,73,68,67,95,67,79,78,70,73,82,77,95,76,65,66,69,76,34, +62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101, 108,62,73,68,67,95,67,79,78,70,73,82,77,95,76,65,66,69,76,60,47,108,97, 98,101,108,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,119, 114,97,112,62,45,49,60,47,119,114,97,112,62,10,32,32,32,32,32,32,32,32, @@ -7283,8 +7404,9 @@ void InitXmlResource() XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$icons_32x32_widescreen.png"), xml_res_file_19, xml_res_size_19, wxT("image/png")); XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$icons_32x32_computer_add.png"), xml_res_file_20, xml_res_size_20, wxT("image/png")); XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$icons_32x32_computer_edit.png"), xml_res_file_21, xml_res_size_21, wxT("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$icons_32x32_computer_delete.png"), xml_res_file_22, xml_res_size_22, wxT("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$icons_32x32_door_in.png"), xml_res_file_23, xml_res_size_23, wxT("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$._pc.xrc"), xml_res_file_24, xml_res_size_24, wxT("text/xml")); + XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$icons_32x32_computer_go.png"), xml_res_file_22, xml_res_size_22, wxT("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$icons_32x32_computer_delete.png"), xml_res_file_23, xml_res_size_23, wxT("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$icons_32x32_door_in.png"), xml_res_file_24, xml_res_size_24, wxT("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$._pc.xrc"), xml_res_file_25, xml_res_size_25, wxT("text/xml")); wxXmlResource::Get()->Load(wxT("memory:XRC_resource/wx-resources.cpp$._pc.xrc")); } diff --git a/src/wx-utils.cc b/src/wx-utils.cc index 707349e..e633373 100644 --- a/src/wx-utils.cc +++ b/src/wx-utils.cc @@ -1,772 +1,777 @@ -#include "wx-utils.h" - -#include -#ifndef WX_PRECOMP -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include "wx-dialogbox.h" -#include "wx-app.h" -#include "wx-common.h" -#include "wx-status.h" - -extern "C" -{ -#include "thread.h" -} - -int confirm() -{ - if (emulation_state != EMULATION_STOPPED) { - return wx_messagebox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", WX_MB_OKCANCEL) == WX_IDOK; - } - return 1; -} - -int wx_messagebox(void* window, const char* message, const char* title = NULL, int style = 5) -{ - return wxMessageBox(message, title, style | wxCENTRE | wxSTAY_ON_TOP, (wxWindow*) window); -} - -void wx_simple_messagebox(const char* title, const char *format, ...) -{ - char message[2048]; - va_list ap; - va_start(ap, format); - vsnprintf(message, 2047, format, ap); - message[2047] = 0; - va_end(ap); - wx_messagebox(0, message, title, WX_MB_OK); -} - - -int wx_textentrydialog(void* window, const char* message, const char* title, const char* value, unsigned int min_length, unsigned int max_length, LONG_PARAM result) -{ - while (1) - { - wxTextEntryDialog dlg((wxWindow*)window, message, title, value); - if (max_length > 0) - dlg.SetMaxLength(max_length); - if (dlg.ShowModal() == wxID_OK) - { - wxString value = dlg.GetValue(); - if (value.Length() >= min_length) - { - strcpy((char*)result, value.mb_str()); - return TRUE; - } - } - else - return FALSE; - } - return FALSE; -} - -void wx_setwindowtitle(void* window, char* s) -{ - ((wxFrame*) window)->SetTitle(s); -} - -int wx_xrcid(const char* s) -{ - return XRCID(s); -} - -int wx_filedialog(void* window, const char* title, const char* path, - const char* extensions, const char* extension, int open, char* file) -{ - wxFileDialog dlg((wxWindow*) window, title, "", path, extensions, - open ? (wxFD_OPEN | wxFD_FILE_MUST_EXIST) : (wxFD_SAVE | wxFD_OVERWRITE_PROMPT)); - if (dlg.ShowModal() == wxID_OK) - { - wxString p = dlg.GetPath(); - wxFileName f(p); - if (!open && !f.HasExt() && extension) - { - wxString e = extension; - if (!p.EndsWith(".")) - p += "."; - p += extension; - strcpy(file, p.mb_str()); - } - else - strcpy(file, p.mb_str()); - return 0; - } - return 1; -} - -void wx_checkmenuitem(void* menu, int id, int checked) -{ - wxMenuItem* item = NULL; - if (((wxObject*)menu)->GetClassInfo()->IsKindOf(CLASSINFO(wxMenuBar))) - item = ((wxMenuBar*) menu)->FindItem(id); - else - item = ((wxMenu*) menu)->FindItem(id); - - if (item) - item->Check(checked); - else - std::cout << "Menu item not found: " << id << std::endl; -} - -void wx_enablemenuitem(void* menu, int id, int enable) -{ - wxMenuItem* item = NULL; - if (((wxObject*)menu)->GetClassInfo()->IsKindOf(CLASSINFO(wxMenuBar))) - item = ((wxMenuBar*) menu)->FindItem(id); - else - item = ((wxMenu*) menu)->FindItem(id); - - if (item) - item->Enable(enable); - else - std::cout << "Menu item not found: " << id << std::endl; -} - -void* wx_getsubmenu(void* menu, int id) -{ - wxMenuItem* m = ((wxMenu*) menu)->FindItem(id); - if (m) - return m->GetSubMenu(); - - return 0; -} - -void* wx_getnativemenu(void* menu) -{ -#ifdef _WIN32 - return ((wxMenu*)menu)->GetHMenu(); -#endif - return 0; -} - -void* wx_getnativewindow(void* window) -{ -#ifdef _WIN32 - return ((wxWindow*)window)->GetHWND(); -#endif - return 0; -} - -#ifdef _WIN32 -void wx_winsendmessage(void* window, int msg, INT_PARAM wParam, LONG_PARAM lParam) -{ - WinSendMessageEvent* event = new WinSendMessageEvent(wx_getnativewindow(window), msg, wParam, lParam); - wxQueueEvent((wxWindow*)window, event); -} -#endif - -void wx_appendmenu(void* sub_menu, int id, const char* title, enum wxItemKind type) -{ - ((wxMenu*) sub_menu)->Append(id, title, wxEmptyString, type); -} - - -void wx_enabletoolbaritem(void* toolbar, int id, int enable) -{ - ((wxToolBar*) toolbar)->EnableTool(id, enable); -} - -void* wx_getmenu(void* window) -{ - return ((Frame*) window)->GetMenu(); -} - -void* wx_getmenubar(void* window) -{ - return ((wxFrame*) window)->GetMenuBar(); -} - -void* wx_gettoolbar(void* window) -{ - return ((wxFrame*) window)->GetToolBar(); -} - -void* wx_getdlgitem(void* window, int id) -{ - return ((wxWindow*) window)->FindWindow(id); -} - -void wx_setdlgitemtext(void* window, int id, char* str) -{ - wxWindow* w = ((wxWindow*) window)->FindWindow(id); - if (w->GetClassInfo()->IsKindOf(CLASSINFO(wxTextCtrl))) - ((wxTextCtrl*) w)->SetValue(str); - else - ((wxStaticText*) w)->SetLabel(str); -} - -void wx_enablewindow(void* window, int enabled) -{ - ((wxWindow*) window)->Enable(enabled); -} - -void wx_showwindow(void* window, int show) -{ - wxCommandEvent* event = new wxCommandEvent(WX_SHOW_WINDOW_EVENT, wxID_ANY); - event->SetEventObject((wxWindow*)window); - event->SetInt(show); - wxQueueEvent((wxWindow*)window, event); -} - -int wx_iswindowvisible(void* window) -{ - return ((wxWindow*) window)->IsShown(); -} - -void wx_togglewindow(void* window) -{ - wx_showwindow(window, -1); -} - -void wx_callback(void* window, WX_CALLBACK callback, void* data) -{ - CallbackEvent* event = new CallbackEvent(callback, data); - wxQueueEvent((wxWindow*)window, event); -} - -void wx_enddialog(void* window, int ret_code) -{ - ((wxDialog*) window)->EndModal(ret_code); -} - -int wx_dlgdirlist(void* window, const char* path, int id, int static_path, int file_type) -{ - wxWindow* w = ((wxWindow*) window)->FindWindow(id); - if (w->GetClassInfo()->IsKindOf(CLASSINFO(wxListBox))) - { - wxListBox* list = (wxListBox*)w; - list->Clear(); - wxArrayString items; - wxString f = wxFindFirstFile(path); - while (!f.empty()) - { - wxFileName file(f); - items.Add(file.GetName()); - f = wxFindNextFile(); - } - items.Sort(); - list->Set(items); - return TRUE; - } - return FALSE; -} - -int wx_dlgdirselectex(void* window, LONG_PARAM path, int count, int id) -{ - wxWindow* w = ((wxWindow*) window)->FindWindow(id); - if (w->GetClassInfo()->IsKindOf(CLASSINFO(wxListBox))) - { - wxListBox* list = (wxListBox*)w; - strcpy((char*)path, (list->GetStringSelection() + ".").GetData().AsChar()); - return TRUE; - } - return FALSE; -} - -int wx_sendmessage(void* window, int type, INT_PARAM param1, LONG_PARAM param2) -{ - switch (type) - { - case WX_CB_ADDSTRING: - ((wxComboBox*) window)->Append((char*) param2); - break; - case WX_CB_SETCURSEL: - if (param1 >= 0 && param1 < (int)((wxComboBox*) window)->GetCount()) - ((wxComboBox*) window)->Select(param1); - break; - case WX_CB_GETCURSEL: - return ((wxComboBox*) window)->GetCurrentSelection(); - break; - case WX_CB_GETLBTEXT: - strcpy((char*) param2, ((wxComboBox*) window)->GetString(param1).mb_str()); - break; - case WX_CB_RESETCONTENT: - { -#ifndef __WXOSX_MAC__ - ((wxComboBox*) window)->SetValue(""); - ((wxComboBox*) window)->Clear(); -#else - /* Clear() does not work on OSX */ - wxComboBox* cb = (wxComboBox*) window; - int count = cb->GetCount(); - while (count--) - cb->Delete(0); -#endif - break; - } - case WX_BM_SETCHECK: - ((wxCheckBox*) window)->SetValue(param1); - break; - case WX_BM_GETCHECK: - return ((wxCheckBox*) window)->GetValue(); - break; - case WX_WM_SETTEXT: - { - if (((wxWindow*) window)->GetClassInfo()->IsKindOf(CLASSINFO(wxTextCtrl))) - ((wxTextCtrl*) window)->SetValue((char*) param2); - else - ((wxStaticText*) window)->SetLabel((char*) param2); - } - break; - case WX_WM_GETTEXT: - if (((wxWindow*) window)->GetClassInfo()->IsKindOf(CLASSINFO(wxTextCtrl))) - strcpy((char*) param2, ((wxTextCtrl*) window)->GetValue().mb_str()); - else - strcpy((char*) param2, ((wxStaticText*) window)->GetLabel().mb_str()); - break; - case WX_UDM_SETPOS: - ((wxSpinCtrl*) window)->SetValue(param2); - break; - case WX_UDM_GETPOS: - return ((wxSpinCtrl*) window)->GetValue(); - case WX_UDM_SETRANGE: - { - int min = (param2 >> 16) & 0xffff; - int max = param2 & 0xffff; - ((wxSpinCtrl*) window)->SetRange(min, max); - break; - } - case WX_UDM_SETINCR: - { - /* SetIncrement-method may not exist on all platforms */ -#ifdef __WXGTK__ - ((wxSpinCtrl*) window)->SetIncrement(param2); -#endif - break; - } - case WX_LB_GETCOUNT: - { - return ((wxListBox*) window)->GetCount(); - } - case WX_LB_GETCURSEL: - { - return ((wxListBox*) window)->GetSelection(); - } - case WX_LB_SETCURSEL: - { - ((wxListBox*) window)->SetSelection(param1); - break; - } - case WX_LB_GETTEXT: - { - strcpy((char*) param2, ((wxListBox*) window)->GetString(param1).mb_str()); - break; - } - case WX_LB_INSERTSTRING: - { - ((wxListBox*) window)->Insert((char*) param2, param1); - break; - } - case WX_LB_DELETESTRING: - { - ((wxListBox*) window)->Delete(param1); - break; - } - case WX_LB_RESETCONTENT: - { - ((wxListBox*) window)->Clear(); - break; - } - } - - ((wxWindow*)window)->Fit(); - - return 0; -} - -int wx_dialogbox(void* window, const char* name, int (*callback)(void* window, int message, INT_PARAM param1, LONG_PARAM param2)) -{ - PCemDialogBox dlg((wxWindow*) window, name, callback); - dlg.OnInit(); - dlg.Fit(); - int ret = dlg.ShowModal(); - dlg.Destroy(); - return ret; -} - -void wx_exit(void* window, int value) -{ - wxCommandEvent* event = new wxCommandEvent(WX_EXIT_EVENT, wxID_ANY); - event->SetEventObject((wxWindow*)window); - event->SetInt(value); - wxQueueEvent((wxWindow*)window, event); -} - -void wx_stop_emulation(void* window) -{ - wxCommandEvent* event = new wxCommandEvent(WX_STOP_EMULATION_EVENT, wxID_ANY); - event->SetEventObject((wxWindow*)window); - wxQueueEvent((wxWindow*)window, event); -} - -int wx_yield() -{ - return wxYield(); -} - -/* Timer stuff */ - -class PCemTimer : public wxTimer -{ -public: - PCemTimer(void (*fn)()) - { - this->fn = fn; - } - virtual ~PCemTimer() {}; - - void Notify() - { - fn(); - } -private: - void (*fn)(); -}; - -void* wx_createtimer(void (*fn)()) -{ - return new PCemTimer(fn); -} - -void wx_starttimer(void* timer, int milliseconds, int once) -{ - wxTimer* t = (wxTimer*)timer; - t->Start(milliseconds, once); -} - -void wx_stoptimer(void* timer) -{ - wxTimer* t = (wxTimer*)timer; - t->Stop(); -} - -void wx_destroytimer(void* timer) -{ - wx_stoptimer(timer); - delete (wxTimer*)timer; -} - -void wx_popupmenu(void* window, void* menu, int* x, int* y) -{ - PopupMenuEvent* event = new PopupMenuEvent((wxWindow*)window, (wxMenu*)menu, x, y); - wxQueueEvent((wxWindow*)window, event); -} - -void* wx_create_status_frame(void* window) -{ - StatusFrame* frame = new StatusFrame((wxWindow*)window); - return frame; -} - -void wx_destroy_status_frame(void* window) -{ - StatusFrame* frame = (StatusFrame*)window; - delete frame; -} - -void wx_setwindowposition(void* window, int x, int y) -{ - ((wxFrame*) window)->SetPosition(wxPoint(x, y)); -} - -void wx_setwindowsize(void* window, int width, int height) -{ - ((wxFrame*) window)->SetSize(wxSize(width, height)); -} - -void wx_show_status(void* window) -{ - wxWindow* status = ((wxWindow*)window)->FindWindowById(STATUS_WINDOW_ID); - if (!status) - { - StatusFrame* statusFrame = new StatusFrame((wxWindow*) window); - statusFrame->Show(); - } -} - -void wx_close_status(void* window) -{ - wxWindow* status = ((wxWindow*)window)->FindWindowById(STATUS_WINDOW_ID); - if (status) - { - status->Close(); - } -} - -void wx_get_home_directory(char* path) -{ - wxString home = wxFileName::GetHomeDir(); - if (!home.EndsWith(wxFileName::GetPathSeparator())) { - home.Append(wxFileName::GetPathSeparator()); - } - strcpy(path, home.mb_str()); -} - -int wx_create_directory(char* path) -{ - return wxFileName::Mkdir(path); -} - -int wx_setup(char* path) -{ - wxFileName p(path); - if (!p.DirExists()) - { - if (!p.Mkdir()) - return FALSE; - wxFileName configs(p); - configs.AppendDir("configs"); - if (!configs.DirExists() && !configs.Mkdir()) - return FALSE; - - wxFileName roms(p); - roms.AppendDir("roms"); - if (!roms.DirExists() && !roms.Mkdir()) - return FALSE; - - wxFileName nvr(p); - nvr.AppendDir("nvr"); - if (!nvr.DirExists() && !nvr.Mkdir()) - return FALSE; - - wxFileName screenshots(p); - screenshots.AppendDir("screenshots"); - if (!screenshots.DirExists() && !screenshots.Mkdir()) - return FALSE; - - wxFileName logs(p); - logs.AppendDir("logs"); - if (!logs.DirExists() && !logs.Mkdir()) - return FALSE; - } - - return TRUE; -} - -int wx_file_exists(char* path) -{ - wxFileName p(path); - return p.Exists(); -} - -int wx_dir_exists(char* path) -{ - wxFileName p(path); - return p.DirExists(); -} - -int wx_image_save(const char* path, const char* name, const char* format, unsigned char* rgba, int width, int height, int alpha) -{ - int x, y; - wxLogNull logNull; - wxImage image(width, height); - if (alpha) - { - unsigned char* rgb = (unsigned char*)malloc(width*height*3); - unsigned char* a = (unsigned char*)malloc(width*height); - for (x = 0; x < width; ++x) - { - for (y = 0; y < height; ++y) - { - rgb[(y*width+x)*3+0] = rgba[(y*width+x)*4+0]; - rgb[(y*width+x)*3+1] = rgba[(y*width+x)*4+1]; - rgb[(y*width+x)*3+2] = rgba[(y*width+x)*4+2]; - a[y*width+x] = rgba[(y*width+x)*4+3]; - } - } - image.SetData(rgb); - image.SetAlpha(a); - } - else - image.SetData(rgba, true); - - wxImageHandler* h; - wxString ext; - - if (!strcmp(format, IMAGE_TIFF)) - { - h = new wxTIFFHandler(); - ext = "tif"; - } - else if (!strcmp(format, IMAGE_BMP)) - { - h = new wxBMPHandler(); - ext = "bmp"; - } - else if (!strcmp(format, IMAGE_JPG)) - { - h = new wxJPEGHandler(); - ext = "jpg"; - } - else - { - h = new wxPNGHandler(); - ext = "png"; - } - - int res = 0; - if (h) - { - wxString p(path); - if (!p.EndsWith("/")) - p = p.Append("/"); - p = p.Append(name).Append(".").Append(ext); - - wxFileOutputStream stream(p); - res = h->SaveFile(&image, stream, false); - delete h; - } - - return res; -} - -void* wx_image_load(const char* path) -{ - wxLogNull logNull; /* removes sRGB-warnings on Windows */ - wxImage* image = new wxImage(path); - if (image->IsOk()) - return image; - delete image; - return 0; -} - -void wx_image_free(void* image) -{ - delete (wxImage*)image; -} - -void wx_image_rescale(void* image, int width, int height) -{ - ((wxImage*)image)->Rescale(width, height); -} - -void wx_image_get_size(void* image, int* width, int* height) -{ - *width = ((wxImage*)image)->GetWidth(); - *height = ((wxImage*)image)->GetHeight(); -} - -unsigned char* wx_image_get_data(void* image) -{ - return ((wxImage*)image)->GetData(); -} - -unsigned char* wx_image_get_alpha(void* image) -{ - return ((wxImage*)image)->GetAlpha(); -} - -/* wxFileConfig */ - -void* wx_config_load(const char* path) -{ - if (!wxFileExists(path)) - return 0; - wxFileInputStream stream(path); - if (stream.IsOk()) - return new wxFileConfig(stream); - return 0; -} -int wx_config_get_string(void* config, const char* name, char* dst, int size, const char* defVal) -{ - wxFileConfig* c = ((wxFileConfig*)config); - wxString val; - bool res = c->Read(name, &val, wxString(defVal)); - strncpy(dst, val.GetData().AsChar(), size-1); - dst[size-1] = 0; - return res; -} -int wx_config_get_int(void* config, const char* name, int* dst, int defVal) -{ - wxFileConfig* c = ((wxFileConfig*)config); - return c->Read(name, dst, defVal); -} - -int wx_config_get_float(void* config, const char* name, float* dst, float defVal) -{ - wxFileConfig* c = ((wxFileConfig*)config); - return c->Read(name, dst, defVal); - -} - -int wx_config_get_bool(void* config, const char* name, int* dst, int defVal) -{ - wxFileConfig* c = ((wxFileConfig*)config); - wxString val; - bool res = 1; - if (c->Read(name, &val)) - { - val.LowerCase(); - if (val.StartsWith("true")) - *dst = 1; - else if (val.StartsWith("false")) - *dst = 0; - else - res = 0; - } - if (!res) - res = c->Read(name, (bool*)dst, (bool)defVal); - - return res; -} - -int wx_config_has_entry(void* config, const char* name) -{ - wxFileConfig* c = ((wxFileConfig*)config); - return c->HasEntry(name); -} - -void wx_config_free(void* config) -{ - delete (wxFileConfig*)config; -} - -typedef struct progress_data_t { - WX_CALLBACK callback; - void* data; - int active; - int result; -} progress_data_t; - -static void progress_callback(void* data) -{ - progress_data_t* d = (progress_data_t*) data; - d->result = d->callback(d->data); - d->active = 0; -} - -int wx_progressdialogpulse(void* window, const char* title, const char* message, WX_CALLBACK callback, void* data) -{ - struct progress_data_t pdata; - pdata.callback = callback; - pdata.data = data; - pdata.active = 1; - pdata.result = 0; - - thread_t* t = thread_create(progress_callback, &pdata); - - wxProgressDialog dlg(title, message, 100, (wxWindow*)window, wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_AUTO_HIDE); - while (pdata.active) - { - dlg.Pulse(); - wxMilliSleep(50); - } - thread_kill(t); - - return pdata.result; -} - -void wx_date_format(char* s, const char* format) -{ - wxString res = wxDateTime::Now().Format(format); - strcpy(s, res.mb_str()); -} +#include "wx-utils.h" + +#include +#ifndef WX_PRECOMP +#include +#endif + +#include +#include +#include +#include +#include +#include + +#include "wx-dialogbox.h" +#include "wx-app.h" +#include "wx-common.h" +#include "wx-status.h" + +extern "C" +{ +#include "thread.h" +} + +int confirm() +{ + if (emulation_state != EMULATION_STOPPED) { + return wx_messagebox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", WX_MB_OKCANCEL) == WX_IDOK; + } + return 1; +} + +int wx_messagebox(void* window, const char* message, const char* title = NULL, int style = 5) +{ + return wxMessageBox(message, title, style | wxCENTRE | wxSTAY_ON_TOP, (wxWindow*) window); +} + +void wx_simple_messagebox(const char* title, const char *format, ...) +{ + char message[2048]; + va_list ap; + va_start(ap, format); + vsnprintf(message, 2047, format, ap); + message[2047] = 0; + va_end(ap); + wx_messagebox(0, message, title, WX_MB_OK); +} + + +int wx_textentrydialog(void* window, const char* message, const char* title, const char* value, unsigned int min_length, unsigned int max_length, LONG_PARAM result) +{ + while (1) + { + wxTextEntryDialog dlg((wxWindow*)window, message, title, value); + if (max_length > 0) + dlg.SetMaxLength(max_length); + if (dlg.ShowModal() == wxID_OK) + { + wxString value = dlg.GetValue(); + if (value.Length() >= min_length) + { + strcpy((char*)result, value.mb_str()); + return TRUE; + } + } + else + return FALSE; + } + return FALSE; +} + +void wx_setwindowtitle(void* window, char* s) +{ + ((wxFrame*) window)->SetTitle(s); +} + +int wx_xrcid(const char* s) +{ + return XRCID(s); +} + +int wx_filedialog(void* window, const char* title, const char* path, + const char* extensions, const char* extension, int open, char* file) +{ + wxFileDialog dlg((wxWindow*) window, title, "", path, extensions, + open ? (wxFD_OPEN | wxFD_FILE_MUST_EXIST) : (wxFD_SAVE | wxFD_OVERWRITE_PROMPT)); + if (dlg.ShowModal() == wxID_OK) + { + wxString p = dlg.GetPath(); + wxFileName f(p); + if (!open && !f.HasExt() && extension) + { + wxString e = extension; + if (!p.EndsWith(".")) + p += "."; + p += extension; + strcpy(file, p.mb_str()); + } + else + strcpy(file, p.mb_str()); + return 0; + } + return 1; +} + +void wx_checkmenuitem(void* menu, int id, int checked) +{ + wxMenuItem* item = NULL; + if (((wxObject*)menu)->GetClassInfo()->IsKindOf(CLASSINFO(wxMenuBar))) + item = ((wxMenuBar*) menu)->FindItem(id); + else + item = ((wxMenu*) menu)->FindItem(id); + + if (item) + item->Check(checked); + else + std::cout << "Menu item not found: " << id << std::endl; +} + +void wx_enablemenuitem(void* menu, int id, int enable) +{ + wxMenuItem* item = NULL; + if (((wxObject*)menu)->GetClassInfo()->IsKindOf(CLASSINFO(wxMenuBar))) + item = ((wxMenuBar*) menu)->FindItem(id); + else + item = ((wxMenu*) menu)->FindItem(id); + + if (item) + item->Enable(enable); + else + std::cout << "Menu item not found: " << id << std::endl; +} + +void* wx_getsubmenu(void* menu, int id) +{ + wxMenuItem* m = ((wxMenu*) menu)->FindItem(id); + if (m) + return m->GetSubMenu(); + + return 0; +} + +void* wx_getnativemenu(void* menu) +{ +#ifdef _WIN32 + return ((wxMenu*)menu)->GetHMenu(); +#endif + return 0; +} + +void* wx_getnativewindow(void* window) +{ +#ifdef _WIN32 + return ((wxWindow*)window)->GetHWND(); +#endif + return 0; +} + +#ifdef _WIN32 +void wx_winsendmessage(void* window, int msg, INT_PARAM wParam, LONG_PARAM lParam) +{ + WinSendMessageEvent* event = new WinSendMessageEvent(wx_getnativewindow(window), msg, wParam, lParam); + wxQueueEvent((wxWindow*)window, event); +} +#endif + +void wx_appendmenu(void* sub_menu, int id, const char* title, enum wxItemKind type) +{ + ((wxMenu*) sub_menu)->Append(id, title, wxEmptyString, type); +} + + +void wx_enabletoolbaritem(void* toolbar, int id, int enable) +{ + ((wxToolBar*) toolbar)->EnableTool(id, enable); +} + +void* wx_getmenu(void* window) +{ + return ((Frame*) window)->GetMenu(); +} + +void* wx_getmenubar(void* window) +{ + return ((wxFrame*) window)->GetMenuBar(); +} + +void* wx_gettoolbar(void* window) +{ + return ((wxFrame*) window)->GetToolBar(); +} + +void* wx_getdlgitem(void* window, int id) +{ + return ((wxWindow*) window)->FindWindow(id); +} + +void wx_setdlgitemtext(void* window, int id, char* str) +{ + wxWindow* w = ((wxWindow*) window)->FindWindow(id); + if (w->GetClassInfo()->IsKindOf(CLASSINFO(wxTextCtrl))) + ((wxTextCtrl*) w)->SetValue(str); + else + ((wxStaticText*) w)->SetLabel(str); +} + +void wx_enablewindow(void* window, int enabled) +{ + ((wxWindow*) window)->Enable(enabled); +} + +void wx_showwindow(void* window, int show) +{ + wxCommandEvent* event = new wxCommandEvent(WX_SHOW_WINDOW_EVENT, wxID_ANY); + event->SetEventObject((wxWindow*)window); + event->SetInt(show); + wxQueueEvent((wxWindow*)window, event); +} + +int wx_iswindowvisible(void* window) +{ + return ((wxWindow*) window)->IsShown(); +} + +void wx_togglewindow(void* window) +{ + wx_showwindow(window, -1); +} + +void wx_callback(void* window, WX_CALLBACK callback, void* data) +{ + CallbackEvent* event = new CallbackEvent(callback, data); + wxQueueEvent((wxWindow*)window, event); +} + +void wx_enddialog(void* window, int ret_code) +{ + ((wxDialog*) window)->EndModal(ret_code); +} + +int wx_dlgdirlist(void* window, const char* path, int id, int static_path, int file_type) +{ + wxWindow* w = ((wxWindow*) window)->FindWindow(id); + if (w->GetClassInfo()->IsKindOf(CLASSINFO(wxListBox))) + { + wxListBox* list = (wxListBox*)w; + list->Clear(); + wxArrayString items; + wxString f = wxFindFirstFile(path); + while (!f.empty()) + { + wxFileName file(f); + items.Add(file.GetName()); + f = wxFindNextFile(); + } + items.Sort(); + list->Set(items); + return TRUE; + } + return FALSE; +} + +int wx_dlgdirselectex(void* window, LONG_PARAM path, int count, int id) +{ + wxWindow* w = ((wxWindow*) window)->FindWindow(id); + if (w->GetClassInfo()->IsKindOf(CLASSINFO(wxListBox))) + { + wxListBox* list = (wxListBox*)w; + strcpy((char*)path, (list->GetStringSelection() + ".").GetData().AsChar()); + return TRUE; + } + return FALSE; +} + +int wx_sendmessage(void* window, int type, INT_PARAM param1, LONG_PARAM param2) +{ + switch (type) + { + case WX_CB_ADDSTRING: + ((wxComboBox*) window)->Append((char*) param2); + break; + case WX_CB_SETCURSEL: + if (param1 >= 0 && param1 < (int)((wxComboBox*) window)->GetCount()) + ((wxComboBox*) window)->Select(param1); + break; + case WX_CB_GETCURSEL: + return ((wxComboBox*) window)->GetCurrentSelection(); + break; + case WX_CB_GETLBTEXT: + strcpy((char*) param2, ((wxComboBox*) window)->GetString(param1).mb_str()); + break; + case WX_CB_RESETCONTENT: + { +#ifndef __WXOSX_MAC__ + ((wxComboBox*) window)->SetValue(""); + ((wxComboBox*) window)->Clear(); +#else + /* Clear() does not work on OSX */ + wxComboBox* cb = (wxComboBox*) window; + int count = cb->GetCount(); + while (count--) + cb->Delete(0); +#endif + break; + } + case WX_BM_SETCHECK: + ((wxCheckBox*) window)->SetValue(param1); + break; + case WX_BM_GETCHECK: + return ((wxCheckBox*) window)->GetValue(); + break; + case WX_WM_SETTEXT: + { + if (((wxWindow*) window)->GetClassInfo()->IsKindOf(CLASSINFO(wxTextCtrl))) + ((wxTextCtrl*) window)->SetValue((char*) param2); + else + ((wxStaticText*) window)->SetLabel((char*) param2); + } + break; + case WX_WM_GETTEXT: + if (((wxWindow*) window)->GetClassInfo()->IsKindOf(CLASSINFO(wxTextCtrl))) + strcpy((char*) param2, ((wxTextCtrl*) window)->GetValue().mb_str()); + else + strcpy((char*) param2, ((wxStaticText*) window)->GetLabel().mb_str()); + break; + case WX_UDM_SETPOS: + ((wxSpinCtrl*) window)->SetValue(param2); + break; + case WX_UDM_GETPOS: + return ((wxSpinCtrl*) window)->GetValue(); + case WX_UDM_SETRANGE: + { + int min = (param2 >> 16) & 0xffff; + int max = param2 & 0xffff; + ((wxSpinCtrl*) window)->SetRange(min, max); + break; + } + case WX_UDM_SETINCR: + { + /* SetIncrement-method may not exist on all platforms */ +#ifdef __WXGTK__ + ((wxSpinCtrl*) window)->SetIncrement(param2); +#endif + break; + } + case WX_LB_GETCOUNT: + { + return ((wxListBox*) window)->GetCount(); + } + case WX_LB_GETCURSEL: + { + return ((wxListBox*) window)->GetSelection(); + } + case WX_LB_SETCURSEL: + { + ((wxListBox*) window)->SetSelection(param1); + break; + } + case WX_LB_GETTEXT: + { + strcpy((char*) param2, ((wxListBox*) window)->GetString(param1).mb_str()); + break; + } + case WX_LB_INSERTSTRING: + { + ((wxListBox*) window)->Insert((char*) param2, param1); + break; + } + case WX_LB_DELETESTRING: + { + ((wxListBox*) window)->Delete(param1); + break; + } + case WX_LB_RESETCONTENT: + { + ((wxListBox*) window)->Clear(); + break; + } + } + + ((wxWindow*)window)->Fit(); + + return 0; +} + +int wx_dialogbox(void* window, const char* name, int (*callback)(void* window, int message, INT_PARAM param1, LONG_PARAM param2)) +{ + PCemDialogBox dlg((wxWindow*) window, name, callback); + dlg.OnInit(); + dlg.Fit(); + int ret = dlg.ShowModal(); + dlg.Destroy(); + return ret; +} + +void wx_exit(void* window, int value) +{ + wxCommandEvent* event = new wxCommandEvent(WX_EXIT_EVENT, wxID_ANY); + event->SetEventObject((wxWindow*)window); + event->SetInt(value); + wxQueueEvent((wxWindow*)window, event); +} + +void wx_stop_emulation(void* window) +{ + wxCommandEvent* event = new wxCommandEvent(WX_STOP_EMULATION_EVENT, wxID_ANY); + event->SetEventObject((wxWindow*)window); + wxQueueEvent((wxWindow*)window, event); +} + +int wx_yield() +{ + return wxYield(); +} + +/* Timer stuff */ + +class PCemTimer : public wxTimer +{ +public: + PCemTimer(void (*fn)()) + { + this->fn = fn; + } + virtual ~PCemTimer() {}; + + void Notify() + { + fn(); + } +private: + void (*fn)(); +}; + +void* wx_createtimer(void (*fn)()) +{ + return new PCemTimer(fn); +} + +void wx_starttimer(void* timer, int milliseconds, int once) +{ + wxTimer* t = (wxTimer*)timer; + t->Start(milliseconds, once); +} + +void wx_stoptimer(void* timer) +{ + wxTimer* t = (wxTimer*)timer; + t->Stop(); +} + +void wx_destroytimer(void* timer) +{ + wx_stoptimer(timer); + delete (wxTimer*)timer; +} + +void wx_popupmenu(void* window, void* menu, int* x, int* y) +{ + PopupMenuEvent* event = new PopupMenuEvent((wxWindow*)window, (wxMenu*)menu, x, y); + wxQueueEvent((wxWindow*)window, event); +} + +void* wx_create_status_frame(void* window) +{ + StatusFrame* frame = new StatusFrame((wxWindow*)window); + return frame; +} + +void wx_destroy_status_frame(void* window) +{ + StatusFrame* frame = (StatusFrame*)window; + delete frame; +} + +void wx_setwindowposition(void* window, int x, int y) +{ + ((wxFrame*) window)->SetPosition(wxPoint(x, y)); +} + +void wx_setwindowsize(void* window, int width, int height) +{ + ((wxFrame*) window)->SetSize(wxSize(width, height)); +} + +void wx_show_status(void* window) +{ + wxWindow* status = ((wxWindow*)window)->FindWindowById(STATUS_WINDOW_ID); + if (!status) + { + StatusFrame* statusFrame = new StatusFrame((wxWindow*) window); + statusFrame->Show(); + } +} + +void wx_close_status(void* window) +{ + wxWindow* status = ((wxWindow*)window)->FindWindowById(STATUS_WINDOW_ID); + if (status) + { + status->Close(); + } +} + +void wx_get_home_directory(char* path) +{ + wxString home = wxFileName::GetHomeDir(); + if (!home.EndsWith(wxFileName::GetPathSeparator())) { + home.Append(wxFileName::GetPathSeparator()); + } + strcpy(path, home.mb_str()); +} + +int wx_create_directory(char* path) +{ + return wxFileName::Mkdir(path); +} + +int wx_setup(char* path) +{ + wxFileName p(path); + if (!p.DirExists()) + { + if (!p.Mkdir()) + return FALSE; + wxFileName configs(p); + configs.AppendDir("configs"); + if (!configs.DirExists() && !configs.Mkdir()) + return FALSE; + + wxFileName roms(p); + roms.AppendDir("roms"); + if (!roms.DirExists() && !roms.Mkdir()) + return FALSE; + + wxFileName nvr(p); + nvr.AppendDir("nvr"); + if (!nvr.DirExists() && !nvr.Mkdir()) + return FALSE; + + wxFileName screenshots(p); + screenshots.AppendDir("screenshots"); + if (!screenshots.DirExists() && !screenshots.Mkdir()) + return FALSE; + + wxFileName logs(p); + logs.AppendDir("logs"); + if (!logs.DirExists() && !logs.Mkdir()) + return FALSE; + } + + return TRUE; +} + +int wx_file_exists(char* path) +{ + wxFileName p(path); + return p.Exists(); +} + +int wx_dir_exists(char* path) +{ + wxFileName p(path); + return p.DirExists(); +} + +int wx_copy_file(char* from, char* to, int overwrite) +{ + return wxCopyFile(from, to, overwrite); +} + +int wx_image_save(const char* path, const char* name, const char* format, unsigned char* rgba, int width, int height, int alpha) +{ + int x, y; + wxLogNull logNull; + wxImage image(width, height); + if (alpha) + { + unsigned char* rgb = (unsigned char*)malloc(width*height*3); + unsigned char* a = (unsigned char*)malloc(width*height); + for (x = 0; x < width; ++x) + { + for (y = 0; y < height; ++y) + { + rgb[(y*width+x)*3+0] = rgba[(y*width+x)*4+0]; + rgb[(y*width+x)*3+1] = rgba[(y*width+x)*4+1]; + rgb[(y*width+x)*3+2] = rgba[(y*width+x)*4+2]; + a[y*width+x] = rgba[(y*width+x)*4+3]; + } + } + image.SetData(rgb); + image.SetAlpha(a); + } + else + image.SetData(rgba, true); + + wxImageHandler* h; + wxString ext; + + if (!strcmp(format, IMAGE_TIFF)) + { + h = new wxTIFFHandler(); + ext = "tif"; + } + else if (!strcmp(format, IMAGE_BMP)) + { + h = new wxBMPHandler(); + ext = "bmp"; + } + else if (!strcmp(format, IMAGE_JPG)) + { + h = new wxJPEGHandler(); + ext = "jpg"; + } + else + { + h = new wxPNGHandler(); + ext = "png"; + } + + int res = 0; + if (h) + { + wxString p(path); + if (!p.EndsWith("/")) + p = p.Append("/"); + p = p.Append(name).Append(".").Append(ext); + + wxFileOutputStream stream(p); + res = h->SaveFile(&image, stream, false); + delete h; + } + + return res; +} + +void* wx_image_load(const char* path) +{ + wxLogNull logNull; /* removes sRGB-warnings on Windows */ + wxImage* image = new wxImage(path); + if (image->IsOk()) + return image; + delete image; + return 0; +} + +void wx_image_free(void* image) +{ + delete (wxImage*)image; +} + +void wx_image_rescale(void* image, int width, int height) +{ + ((wxImage*)image)->Rescale(width, height); +} + +void wx_image_get_size(void* image, int* width, int* height) +{ + *width = ((wxImage*)image)->GetWidth(); + *height = ((wxImage*)image)->GetHeight(); +} + +unsigned char* wx_image_get_data(void* image) +{ + return ((wxImage*)image)->GetData(); +} + +unsigned char* wx_image_get_alpha(void* image) +{ + return ((wxImage*)image)->GetAlpha(); +} + +/* wxFileConfig */ + +void* wx_config_load(const char* path) +{ + if (!wxFileExists(path)) + return 0; + wxFileInputStream stream(path); + if (stream.IsOk()) + return new wxFileConfig(stream); + return 0; +} +int wx_config_get_string(void* config, const char* name, char* dst, int size, const char* defVal) +{ + wxFileConfig* c = ((wxFileConfig*)config); + wxString val; + bool res = c->Read(name, &val, wxString(defVal)); + strncpy(dst, val.GetData().AsChar(), size-1); + dst[size-1] = 0; + return res; +} +int wx_config_get_int(void* config, const char* name, int* dst, int defVal) +{ + wxFileConfig* c = ((wxFileConfig*)config); + return c->Read(name, dst, defVal); +} + +int wx_config_get_float(void* config, const char* name, float* dst, float defVal) +{ + wxFileConfig* c = ((wxFileConfig*)config); + return c->Read(name, dst, defVal); + +} + +int wx_config_get_bool(void* config, const char* name, int* dst, int defVal) +{ + wxFileConfig* c = ((wxFileConfig*)config); + wxString val; + bool res = 1; + if (c->Read(name, &val)) + { + val.LowerCase(); + if (val.StartsWith("true")) + *dst = 1; + else if (val.StartsWith("false")) + *dst = 0; + else + res = 0; + } + if (!res) + res = c->Read(name, (bool*)dst, (bool)defVal); + + return res; +} + +int wx_config_has_entry(void* config, const char* name) +{ + wxFileConfig* c = ((wxFileConfig*)config); + return c->HasEntry(name); +} + +void wx_config_free(void* config) +{ + delete (wxFileConfig*)config; +} + +typedef struct progress_data_t { + WX_CALLBACK callback; + void* data; + int active; + int result; +} progress_data_t; + +static void progress_callback(void* data) +{ + progress_data_t* d = (progress_data_t*) data; + d->result = d->callback(d->data); + d->active = 0; +} + +int wx_progressdialogpulse(void* window, const char* title, const char* message, WX_CALLBACK callback, void* data) +{ + struct progress_data_t pdata; + pdata.callback = callback; + pdata.data = data; + pdata.active = 1; + pdata.result = 0; + + thread_t* t = thread_create(progress_callback, &pdata); + + wxProgressDialog dlg(title, message, 100, (wxWindow*)window, wxPD_APP_MODAL | wxPD_SMOOTH | wxPD_AUTO_HIDE); + while (pdata.active) + { + dlg.Pulse(); + wxMilliSleep(50); + } + thread_kill(t); + + return pdata.result; +} + +void wx_date_format(char* s, const char* format) +{ + wxString res = wxDateTime::Now().Format(format); + strcpy(s, res.mb_str()); +} diff --git a/src/wx-utils.h b/src/wx-utils.h index ab57a21..f06b055 100644 --- a/src/wx-utils.h +++ b/src/wx-utils.h @@ -77,6 +77,7 @@ extern "C" { int wx_setup(char* path); int wx_file_exists(char* path); int wx_dir_exists(char* path); + int wx_copy_file(char* from, char* to, int overwrite); void wx_date_format(char* s, const char* format);