diff --git a/data/common/games/sstartrek/Readme.txt b/data/common/games/sstartrek/sst.doc similarity index 100% rename from data/common/games/sstartrek/Readme.txt rename to data/common/games/sstartrek/sst.doc diff --git a/programs/cmm/Calypte/Calypte.c b/programs/cmm/Calypte/Calypte.c index 5670fe079a..b52abe2690 100644 --- a/programs/cmm/Calypte/Calypte.c +++ b/programs/cmm/Calypte/Calypte.c @@ -24,7 +24,6 @@ TODO #include "../lib/fs.h" #include "../lib/gui.h" #include "../lib/list_box.h" -#include "../lib/menu.h" #include "../lib/collection.h" #include "../lib/obj/iconv.h" diff --git a/programs/cmm/aelia/aelia.c b/programs/cmm/aelia/aelia.c index f0866ca8a7..87d75dd395 100644 --- a/programs/cmm/aelia/aelia.c +++ b/programs/cmm/aelia/aelia.c @@ -4,7 +4,6 @@ #include "../lib/io.h" #include "../lib/gui.h" #include "../lib/list_box.h" -#include "../lib/menu.h" #include "../lib/obj/box_lib.h" #include "../lib/obj/libini.h" diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index 5de359deea..47cb70831b 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -10,7 +10,6 @@ #include "..\lib\strings.h" #include "..\lib\io.h" #include "..\lib\list_box.h" -#include "..\lib\menu.h" #include "..\lib\gui.h" #include "..\lib\obj\box_lib.h" @@ -30,11 +29,13 @@ ?define T_SKINS "⨫ " ?define T_WALLPAPERS "" ?define T_SELECT_FOLDER " " + ?define MENU_LIST " 䠩 Enter\n 䠩 Del" #else ?define WINDOW_HEADER "Appearance" ?define T_SKINS "Skins" ?define T_WALLPAPERS "Wallpapers" ?define T_SELECT_FOLDER "Select wallpapers" + ?define MENU_LIST "Open file Enter\nDelete file Del" #endif #define PANEL_H 40 @@ -69,8 +70,6 @@ char st_str[16]; edit_box edit_st = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, 0x10000000,sizeof(st_str),#st_str,0, 0b}; -#define MENU_LIST "Open file Enter\nDelete Del" - char default_dir[] = "/rd/1"; od_filter filter2 = { 8, "TXT\0\0" }; @@ -107,7 +106,7 @@ void main() select_list.ProcessMouse(mouse.x, mouse.y); SelectList_Draw(); EventSetNewCurrent(); - menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 185, MENU_LIST, 10); + menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 146, MENU_LIST, 10); } break; diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 764547c39e..b10df33455 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -13,7 +13,6 @@ #include "..\lib\list_box.h" #include "..\lib\cursor.h" #include "..\lib\collection.h" -#include "..\lib\menu.h" #include "..\lib\random.h" #include "..\lib\clipboard.h" diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 9a7d34deda..f8cebf628b 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -18,7 +18,6 @@ #include "../lib/random.h" #include "../lib/kfont.h" #include "../lib/collection.h" -#include "../lib/menu.h" #include "../lib/copyf.h" #include "../lib/obj/libini.h" diff --git a/programs/cmm/examples/menu.c b/programs/cmm/examples/menu.c index 65edefbf6d..dd084ef992 100644 --- a/programs/cmm/examples/menu.c +++ b/programs/cmm/examples/menu.c @@ -3,7 +3,6 @@ #include "../lib/io.h" #include "../lib/list_box.h" #include "../lib/gui.h" -#include "../lib/menu.h" struct _object { diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index 4221340505..4835c7efc3 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -10,6 +10,7 @@ #include "../lib/random.h" #include "../lib/mem.h" #include "../lib/cursor.h" +#include "../lib/list_box.h" #include "../lib/obj/libimg.h" #include "../lib/obj/box_lib.h" @@ -30,18 +31,22 @@ //===================================================// #ifdef LANG_RUS -#define T_NOTIFY_OPEN "'IconEdit -‚ ¤ ­­ë© ¬®¬¥­â IconEdit ¬®¦¥â ®âªà뢠âì ⮫쪮 ¨ª®­ª¨, ᮧ¤ ­­ë¥ ¢ á ¬®¬ । ªâ®à¥. -…᫨ ­ã¦­® ®âªàëâì ¤à㣮¥ ¨§®¡à ¦¥­¨¥, ¢®á¯®«ì§ã©â¥áì ¨­áâà㬥­â®¬ <”®â® ¯¯ à â> -¤«ï § å¢ â  ª à⨭ª¨ á íªà ­ .' -Wt" +char image_menu_items[] = +"⢮ ᯮ짮 梥⮢ + 梥 1 2"; +?define T_MENU_IMAGE "" +?define T_TEST_ICON "஢ " +?define T_TITLE "Icon Editor 0.59 Alpha" #else -#define T_NOTIFY_OPEN "'IconEdit -You can open only files created in IconEdit for now! -In other case please use tool to get an image from screen.' -Wt" +char image_menu_items[] = +"Count colors used +Replace all colors equal to 1 by 2"; +?define T_MENU_IMAGE "Icon" +?define T_TEST_ICON "Test Icon" +?define T_TITLE " 0.59 Alpha" #endif -#define T_TITLE "Icon Editor 0.58 Alpha" #define TOPBAR_H 24+8 #define LEFTBAR_W 16+5+5+3+3 @@ -57,6 +62,7 @@ In other case please use tool to get an image from screen.' -Wt" block canvas = { NULL, NULL, NULL, NULL }; block wrapper = { LEFTBAR_W, TOPBAR_H, NULL, NULL }; block right_bar = { NULL, 10+TOPBAR_H, RIGHT_BAR_W+10, NULL }; +block image_menu_btn = { NULL, 4, NULL, 22 }; dword linear_gradient[RIGHT_BAR_W]; block b_color_gradient = {NULL, 40+TOPBAR_H, RIGHT_BAR_W, 25}; @@ -100,6 +106,7 @@ enum { BTN_ZOOM_OUT, BTN_CANVAS_RESIZE, BTN_CROP, + BTN_IMAGE_MENU, BTNS_PALETTE_COLOR_MAS = 100, BTNS_LAST_USED_COLORS = 400 }; @@ -333,6 +340,9 @@ void main() case BTN_CROP: EventCrop(); break; + case BTN_IMAGE_MENU: + EventShowImageMenu(); + break; case CLOSE_BTN: EventExitIconEdit(); break; @@ -400,6 +410,7 @@ void main() case evReDraw: Window_CanvasReSize.thread_exists(); + EventCheckMenuItemSelected(); DrawWindow(); break; } @@ -416,6 +427,20 @@ void DrawTopPanelButton(dword _id, _x, _icon_n) img_draw stdcall(top_icons.image, _x+3, 7, 16, 16, 0, _icon_n*16); } +int DrawFlatPanelButton(dword _id, _x, _y, _text) +{ + #define P 10 + int w = strlen(_text)*6 + P + P; + DrawBar(_x, _y, w, 22, semi_white); + PutPixel(_x,_y,system.color.work); + PutPixel(_x,_y+21,system.color.work); + PutPixel(_x+w-1,_y,system.color.work); + PutPixel(_x+w-1,_y+21,system.color.work); + DefineHiddenButton(_x, _y, w, 21, _id); + WriteText(_x+P, _y+7, 0x80, system.color.work_text, _text); + return w; +} + void DrawLeftPanelButton(dword _id, _y, _icon_n) { int x = 5; @@ -475,6 +500,10 @@ void DrawWindow() DrawTopPanelButton(BTN_TEST_ICON, tx.inc(GAP+BLOCK_SPACE), 12); DrawTopPanelButton(BTN_CROP, tx.inc(GAP+BLOCK_SPACE), 46); + + image_menu_btn.x = tx.n; + image_menu_btn.w = DrawFlatPanelButton(BTN_IMAGE_MENU, image_menu_btn.x, image_menu_btn.y, T_MENU_IMAGE); + //tx.inc(image_menu_btn.w + BLOCK_SPACE); DrawEditArea(); @@ -713,7 +742,7 @@ void ShowWindow_TestIcon() case evReDraw: DefineAndDrawWindow(Form.left+100, Form.top+100, preview_size*2+9, - preview_size*2+skin_height+4, 0x74, NULL, "Test Icon", 0); + preview_size*2+skin_height+4, 0x74, NULL, T_TEST_ICON, 0); DrawImageWithBg(0, 0, 0x000000); DrawImageWithBg(1, 0, 0xFFFfff); DrawImageWithBg(0, 1, GetPixelColorFromScreen(0, 0)); @@ -736,7 +765,6 @@ void EventCreateNewIcon() void EventOpenIcon() { - //notify(T_NOTIFY_OPEN); RunProgram("/sys/lod", sprintf(#param, "*png* %s",#program_path)); } @@ -818,7 +846,52 @@ void EventCrop() DrawWindow(); } else { - notify("'You need to select something before usnig crop tool.' -W"); + notify("'You need to select something before using crop tool.' -W"); + } +} + +void EventShowImageMenu() +{ + menu.selected = 0; + menu.show(Form.left+5 + image_menu_btn.x, + Form.top+skin_height + image_menu_btn.y + image_menu_btn.h, + 240, + #image_menu_items, + 20); +} + +void EventCheckMenuItemSelected() +{ + if (menu.list.cur_y) { + if (20 == menu.list.cur_y) EventCountColorsUsed(); + if (21 == menu.list.cur_y) EventReplaceImageColors(color1, color2); + menu.list.cur_y = 0; + } +} + +void EventCountColorsUsed() +{ + char res_str[64]; + int cur, prev; + int max = image.rows*image.columns; + int resi=0; + bool unic; + for (cur=0; cur