/programs/cmm/Calypte/Calypte.c |
---|
24,7 → 24,6 |
#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" |
/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" |
/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 |
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 |
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; |
/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" |
/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" |
/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 |
{ |
/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 <Photo> 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 |
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 |
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 |
case BTN_CROP: |
EventCrop(); |
break; |
case BTN_IMAGE_MENU: |
EventShowImageMenu(); |
break; |
case CLOSE_BTN: |
EventExitIconEdit(); |
break; |
400,6 → 410,7 |
case evReDraw: |
Window_CanvasReSize.thread_exists(); |
EventCheckMenuItemSelected(); |
DrawWindow(); |
break; |
} |
416,6 → 427,20 |
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; |
476,6 → 501,10 |
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(); |
DrawBar(0, TOPBAR_H, LEFTBAR_W-1, Form.cheight - TOPBAR_H, system.color.work); |
713,7 → 742,7 |
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 EventOpenIcon() |
{ |
//notify(T_NOTIFY_OPEN); |
RunProgram("/sys/lod", sprintf(#param, "*png* %s",#program_path)); |
} |
818,10 → 846,55 |
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<max; cur++) { |
unic = true; |
for (prev=0; prev<cur; prev++) { |
if (image.mas[prev] == image.mas[cur]) {unic=false; break;} |
} |
if (unic) resi++; |
} |
notify( sprintf(#res_str, "'Image has %i unique colors.' -I", resi) ); |
} |
void EventReplaceImageColors(dword c1, c2) |
{ |
int max = image.rows*image.columns; |
int cur; |
for (cur=0; cur<max; cur++) { |
if (image.mas[cur] == color1) image.mas[cur] = color2; |
} |
} |
stop: |
char test_icon_stak[4096]; |
/programs/cmm/lib/menu.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/lib/gui/menu.h |
---|
0,0 → 1,82 |
#ifndef INCLUDE_MENU_H |
#define INCLUDE_MENU_H |
#include "../lib/list_box.h" |
:dword menu_process_id; |
:struct _menu |
{ |
dword appear_x, appear_y, text, identifier, selected; |
llist list; |
void show(); |
char stak[4096]; |
} menu; |
void _menu::show(dword _appear_x, _appear_y, _menu_width, _text, _identifier) |
{ |
#define ITEM_H 21 |
appear_x = _appear_x; |
appear_y = _appear_y; |
text = _text; |
identifier = _identifier; |
list.cur_y = -1; |
list.ClearList(); |
list.count = chrnum(text, '\n')+1; |
list.SetSizes(2,2,_menu_width,list.count*ITEM_H,ITEM_H); |
menu_process_id = CreateThread(#_menu_thread,#stak+4092); |
} |
:void _menu_thread() |
{ |
proc_info MenuForm; |
SetEventMask(100111b); |
loop() switch(WaitEvent()) |
{ |
case evMouse: |
GetProcessInfo(#MenuForm, SelfInfo); |
if (!CheckActiveProcess(MenuForm.ID)) _menu_no_item_click(); |
mouse.get(); |
if (menu.list.ProcessMouse(mouse.x, mouse.y)) _menu_draw_list(); |
if (mouse.lkm)&&(mouse.up) _menu_item_click(); |
break; |
case evKey: |
GetKeys(); |
if (key_scancode==SCAN_CODE_ESC) _menu_no_item_click(); |
if (key_scancode==SCAN_CODE_ENTER) _menu_item_click(); |
if (menu.list.ProcessKey(key_scancode)) _menu_draw_list(); |
break; |
case evReDraw: |
DefineAndDrawWindow(menu.appear_x,menu.appear_y,menu.list.w+2,menu.list.h+4,0x01, 0, 0, 0x01fffFFF); |
DrawPopup(0,0,menu.list.w,menu.list.h+3,0, 0xE4DFE1,0x9098B0); |
_menu_draw_list(); |
} |
} |
:void _menu_draw_list() |
{ |
int N, bgcol; |
for (N=0; N<menu.list.count; N++;) |
{ |
if (N==menu.list.cur_y) bgcol=0xFFFfff; else bgcol=0xE4DFE1; |
DrawBar(menu.list.x, N*menu.list.item_h+menu.list.y, menu.list.w-3, menu.list.item_h, bgcol); |
} |
WriteTextLines(13, menu.list.item_h-8/2+menu.list.y, 0x80, 0, menu.text, menu.list.item_h); |
if (menu.selected) WriteText(5, menu.selected-1*menu.list.item_h+8, 0x80, 0xEE0000, "\x10"); |
} |
:void _menu_item_click() |
{ |
menu.list.cur_y = menu.identifier + menu.list.cur_y; |
KillProcess(menu_process_id); |
} |
:void _menu_no_item_click() |
{ |
menu.list.cur_y = 0; |
KillProcess(menu_process_id); |
} |
#endif |
/programs/cmm/lib/gui.h |
---|
22,6 → 22,7 |
#include "../lib/gui/checkbox.h" |
#include "../lib/gui/child_window.h" |
#include "../lib/gui/text_view_area.h" |
#include "../lib/gui/menu.h" |
:int last_free_button_id = 1000; |
:int GetFreeButtonId() |
/programs/cmm/lib/list_box.h |
---|
1,4 → 1,3 |
//list_box |
#ifndef INCLUDE_LIST_BOX_H |
#define INCLUDE_LIST_BOX_H |
/programs/cmm/lib/obj/box_lib.h |
---|
93,7 → 93,7 |
#define ed_mouse_on 100000000b |
#define ed_mous_adn_b 100011000b |
#define ed_always_focus 100000000000000b |
#define ed_figure_only 1000000000000000b //symbols only |
#define ed_figure_only 1000000000000000b //numbers only |
#define ed_shift_cl 1111111111100011b |
#define ed_shift_mcl 1111111111111011b |
#define ed_shift_off 1111111111111011b |
/programs/cmm/txtread/txtread.c |
---|
3,7 → 3,6 |
#include "../lib/io.h" |
#include "../lib/gui.h" |
#include "../lib/list_box.h" |
#include "../lib/menu.h" |
#include "../lib/kfont.h" |
#include "../lib/obj/box_lib.h" |