ImageEdit: work in progress

git-svn-id: svn://kolibrios.org@9597 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2022-01-08 19:52:20 +00:00
parent d747c5fb18
commit a689de57c5
29 changed files with 191 additions and 133 deletions

View File

@ -103,7 +103,7 @@ void main()
void draw_window() void draw_window()
{ {
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-WINW/2, 100, WINW, WINH+skin_height, 0x34, sc.work, WINDOW_TITLE_TEXT,0); DefineAndDrawWindow(screen.w-WINW/2, 100, WINW, WINH+skin_height, 0x34, sc.work, WINDOW_TITLE_TEXT,0);
WriteTextB(CONX+2,SCRY+2,0x81,MixColors(sc.work, 0xB92234,220),CONTENT_HEADER_TEXT); WriteTextB(CONX+2,SCRY+2,0x81,MixColors(sc.work, 0xB92234,220),CONTENT_HEADER_TEXT);
WriteTextB(CONX,SCRY,0x81,0xB92234,CONTENT_HEADER_TEXT); WriteTextB(CONX,SCRY,0x81,0xB92234,CONTENT_HEADER_TEXT);
draw_screen(); draw_screen();

View File

@ -124,7 +124,7 @@ void main()
void draw_window() void draw_window()
{ {
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-WIN_W-9/2,80,WIN_W+9,WIN_H+4+skin_height,0x74,sc.work,WINDOW_HEADER,0); DefineAndDrawWindow(screen.w-WIN_W-9/2,80,WIN_W+9,WIN_H+4+skin_height,0x74,sc.work,WINDOW_HEADER,0);
DrawBar(0, 0, WIN_W, PANEL_H-2, sc.work); //top DrawBar(0, 0, WIN_W, PANEL_H-2, sc.work); //top
DrawBar(0, PANEL_H-2, LP-2, WIN_H-PANEL_H-LP+4, EDX); //left DrawBar(0, PANEL_H-2, LP-2, WIN_H-PANEL_H-LP+4, EDX); //left

View File

@ -128,7 +128,7 @@ void main()
case evReDraw: case evReDraw:
sc.get(); sc.get();
DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, sc.work, WINDOW_TITLE, 0); DefineAndDrawWindow(130, 150, 465, 398 + skin_h, 0x34, sc.work, WINDOW_TITLE, 0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window&ROLLED_UP) break; if (Form.status_window&ROLLED_UP) break;
DrawWindowContent(); DrawWindowContent();

View File

@ -94,7 +94,7 @@ void DrawWindow()
sc.get(); sc.get();
pb.frame_color = sc.work_dark; pb.frame_color = sc.work_dark;
DefineAndDrawWindow(110 + random(300), 100 + random(300), WIN_W+9, DefineAndDrawWindow(110 + random(300), 100 + random(300), WIN_W+9,
WIN_H + 5 + skin_height, 0x34, sc.work, DL_WINDOW_HEADER, 0); WIN_H + 5 + skin_h, 0x34, sc.work, DL_WINDOW_HEADER, 0);
#define BUT_Y 58; #define BUT_Y 58;
//autoclose.draw(WIN_W-135, BUT_Y+6); //autoclose.draw(WIN_W-135, BUT_Y+6);

View File

@ -547,7 +547,7 @@ void draw_window()
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
SetAppColors(); SetAppColors();
if (efm) { if (efm) {
if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; } if (screen.w > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; }
DrawBar(0, 4, Form.cwidth, SELECTY-5, sc.work); DrawBar(0, 4, Form.cwidth, SELECTY-5, sc.work);
DrawBar(0, SELECTY+KFM2_DEVH+1, Form.cwidth, 3, sc.work); DrawBar(0, SELECTY+KFM2_DEVH+1, Form.cwidth, 3, sc.work);
DrawBar(0, SELECTY-1, 1, KFM2_DEVH+2, sc.work); DrawBar(0, SELECTY-1, 1, KFM2_DEVH+2, sc.work);

View File

@ -33,7 +33,7 @@ void about_dialog()
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left+Form.width/2,Form.top+Form.height/2-114,300,300+skin_height,0x34,sc.work,T_ABOUT,0); DefineAndDrawWindow(Form.left+Form.width/2,Form.top+Form.height/2-114,300,300+skin_h,0x34,sc.work,T_ABOUT,0);
GetProcessInfo(#about_form, SelfInfo); GetProcessInfo(#about_form, SelfInfo);
if (about_form.status_window>2) break; if (about_form.status_window>2) break;
logo_pal[0] = sc.work; logo_pal[0] = sc.work;

View File

@ -82,7 +82,7 @@ void DisplayOperationForm(int operation_flag)
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left+Form.width-200, Form.top+90, COPYFORM_W+9, DefineAndDrawWindow(Form.left+Form.width-200, Form.top+90, COPYFORM_W+9,
skin_height+COPYFORM_H, 0x34, sc.work, title, 0); skin_h+COPYFORM_H, 0x34, sc.work, title, 0);
GetProcessInfo(#Dialog_Form, SelfInfo); GetProcessInfo(#Dialog_Form, SelfInfo);
DrawCaptButton(COPYFORM_W-PR_LEFT-101, PR_TOP+PR_H+6, 100,26, BTN_ABORT, sc.button, sc.button_text, T_COPY_ABORT); DrawCaptButton(COPYFORM_W-PR_LEFT-101, PR_TOP+PR_H+6, 100,26, BTN_ABORT, sc.button, sc.button_text, T_COPY_ABORT);
@ -115,8 +115,8 @@ void Operation_Draw_Progress(dword filename) {
if (old_state != copy_state) { if (old_state != copy_state) {
old_state = copy_state; old_state = copy_state;
if (copy_state == FILE_EXISTS) MoveSize(OLD,OLD,OLD,skin_height+COPYFORM_H+70); if (copy_state == FILE_EXISTS) MoveSize(OLD,OLD,OLD,skin_h+COPYFORM_H+70);
if (copy_state == FILE_DEFAULT) MoveSize(OLD,OLD,OLD,skin_height+COPYFORM_H); if (copy_state == FILE_DEFAULT) MoveSize(OLD,OLD,OLD,skin_h+COPYFORM_H);
} }
DisplayOperationForm(REDRAW_FLAG); DisplayOperationForm(REDRAW_FLAG);

View File

@ -230,7 +230,7 @@ void DrawPropertiesWindow()
if (chrnum(path, '/')>1) || (streq(path, "/kolibrios")) || (streq(path, "/sys")) show_date = true; if (chrnum(path, '/')>1) || (streq(path, "/kolibrios")) || (streq(path, "/sys")) show_date = true;
if (getSelectedCount()) show_date = false; if (getSelectedCount()) show_date = false;
DefineAndDrawWindow(Form.left + 150,150,315,show_date*60+300+skin_height,0x34,sc.work,WINDOW_TITLE_PROPERTIES,0); DefineAndDrawWindow(Form.left + 150,150,315,show_date*60+300+skin_h,0x34,sc.work,WINDOW_TITLE_PROPERTIES,0);
GetProcessInfo(#pform, SelfInfo); GetProcessInfo(#pform, SelfInfo);
DrawStandartCaptButton(pform.cwidth - 96, pform.cheight-34, B_CLOSE, T_CLOSE); DrawStandartCaptButton(pform.cwidth - 96, pform.cheight-34, B_CLOSE, T_CLOSE);

View File

@ -73,7 +73,7 @@ void settings_dialog()
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400, DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400,
-efm*42+345+skin_height,0x34,sc.work,TITLE_SETT,0); -efm*42+345+skin_h,0x34,sc.work,TITLE_SETT,0);
GetProcessInfo(#Settings, SelfInfo); GetProcessInfo(#Settings, SelfInfo);
DrawSettingsCheckBoxes(); DrawSettingsCheckBoxes();
} }

View File

@ -44,7 +44,7 @@ inline GetRevisionNumber()
void draw_window() void draw_window()
{ {
sc.get(); sc.get();
DefineUnDragableWindow(screen.width-WIN_W-15, GetClientHeight()-WIN_H-15, WIN_W-1, WIN_H-1); DefineUnDragableWindow(screen.w-WIN_W-15, GetClientHeight()-WIN_H-15, WIN_W-1, WIN_H-1);
DrawBar(0,0,WIN_W,WIN_H,0x414155); DrawBar(0,0,WIN_W,WIN_H,0x414155);
DrawWideRectangle(0,0,WIN_W,WIN_H, 3, 0x5555FF); DrawWideRectangle(0,0,WIN_W,WIN_H, 3, 0x5555FF);
WriteText(15, 20, 0x81, 0xFFFF55, " REV 7321 "); WriteText(15, 20, 0x81, 0xFFFF55, " REV 7321 ");

View File

@ -45,7 +45,7 @@ int id;
break; break;
case evReDraw: case evReDraw:
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-fw/2,screen.height-fh/2,fw,fh+skin_height,0x33,0xE0DFE3,"Rainbow (rgb test)",0); DefineAndDrawWindow(screen.w-fw/2,screen.h-fh/2,fw,fh+skin_h,0x33,0xE0DFE3,"Rainbow (rgb test)",0);
_PutImage(0,0,256,256,#image); _PutImage(0,0,256,256,#image);
DrawCaptButton(280,20, 110,30,DRAW1_BTN,sc.button,sc.button_text,"Draw 1"); DrawCaptButton(280,20, 110,30,DRAW1_BTN,sc.button,sc.button_text,"Draw 1");
DrawCaptButton(280,60, 110,30,DRAW2_BTN,sc.button,sc.button_text,"Draw 2"); DrawCaptButton(280,60, 110,30,DRAW2_BTN,sc.button,sc.button_text,"Draw 2");

View File

@ -53,7 +53,7 @@ void CanvasReSize_Thread()
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left+canvas.x + 100, Form.top+skin_height+canvas.y+40, DefineAndDrawWindow(Form.left+canvas.x + 100, Form.top+skin_h+canvas.y+40,
200, 170, 0x34, sc.work, "Canvas", 0); 200, 170, 0x34, sc.work, "Canvas", 0);
WriteText(20, 20, 0x90, sc.work_text, "Width"); WriteText(20, 20, 0x90, sc.work_text, "Width");
WriteText(20, 60, 0x90, sc.work_text, "Height"); WriteText(20, 60, 0x90, sc.work_text, "Height");

View File

@ -597,7 +597,7 @@ void DrawPreview()
dword GetPixelUnderMouse() dword GetPixelUnderMouse()
{ {
return GetPixelColorFromScreen(mouse.x + Form.left + 5, mouse.y + Form.top + skin_height); return GetPixelColorFromScreen(mouse.x + Form.left + 5, mouse.y + Form.top + skin_h);
} }
int preview_size = 128; int preview_size = 128;
@ -629,7 +629,7 @@ void ShowWindow_TestIcon()
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left+100, Form.top+100, preview_size*2+9, DefineAndDrawWindow(Form.left+100, Form.top+100, preview_size*2+9,
preview_size*2+skin_height+4, 0x74, NULL, T_TEST_ICON, 0); preview_size*2+skin_h+4, 0x74, NULL, T_TEST_ICON, 0);
DrawImageWithBg(0, 0, 0x000000); DrawImageWithBg(0, 0, 0x000000);
DrawImageWithBg(1, 0, 0xFFFfff); DrawImageWithBg(1, 0, 0xFFFfff);
DrawImageWithBg(0, 1, GetPixelColorFromScreen(0, 0)); DrawImageWithBg(0, 1, GetPixelColorFromScreen(0, 0));

View File

@ -10,12 +10,12 @@ void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
int x, y; int x, y;
x = mouse.x + Form.left + 5 - calc(image.columns/2); x = mouse.x + Form.left + 5 - calc(image.columns/2);
y = mouse.y + Form.top + skin_height - calc(image.rows/2); y = mouse.y + Form.top + skin_h - calc(image.rows/2);
CopyScreen( CopyScreen(
screen_copy, screen_copy,
math.in(x, 0, screen.width - image.columns), math.in(x, 0, screen.w - image.columns),
math.in(y, 0, screen.height - image.rows), math.in(y, 0, screen.h - image.rows),
image.columns, image.columns,
image.rows image.rows
); );

View File

@ -21,9 +21,10 @@
// // // //
//===================================================// //===================================================//
#define PAD 12 #define PAD 13
#define TOOLBAR_ITEM_H PAD+PAD #define TOOLBAR_ITEM_H PAD+PAD
#define TOOLBAR_W 110 #define TOOLBAR_W 132
#define STATUSBAR_H 20
#define ISIZE 18 #define ISIZE 18
block canvas = { TOOLBAR_W + PAD + PAD, 0, NULL, NULL }; block canvas = { TOOLBAR_W + PAD + PAD, 0, NULL, NULL };
@ -33,7 +34,6 @@ EVENTS key;
proc_info Form; proc_info Form;
dword semi_white; dword semi_white;
bool bg_dark=false;
char default_dir[4096] = "/sys"; char default_dir[4096] = "/sys";
od_filter filter2 = { 69, "BMP\0GIF\0ICO\0CUR\0JPEG\0JPG\0PNG\0PNM\0TGA\0TIFF\0TIF\0WBMP\0XBM\0XCF\Z80\0\0" }; od_filter filter2 = { 69, "BMP\0GIF\0ICO\0CUR\0JPEG\0JPG\0PNG\0PNM\0TGA\0TIFF\0TIF\0WBMP\0XBM\0XCF\Z80\0\0" };
@ -43,19 +43,22 @@ libimg_image main_image;
char win_title[256] = "ImageEdit"; char win_title[256] = "ImageEdit";
scroll_bar scroll_v = { 15,NULL,NULL,NULL,15,2,NULL,0,0,0xeeeeee,0xBBBbbb,0xeeeeee}; scroll_bar scroll_v = { 15,NULL,NULL,NULL,15,2,NULL,0,0,0xeeeeee,0xBBDDFF,0xeeeeee};
scroll_bar scroll_h = { NULL,NULL,15,NULL,15,2,NULL,0,0,0xeeeeee,0xBBBbbb,0xeeeeee}; scroll_bar scroll_h = { NULL,NULL,15,NULL,15,2,NULL,0,0,0xeeeeee,0xBBDDFF,0xeeeeee};
/* enum { SAVE_AS_PNG=1, SAVE_AS_BMP=2, SAVE_AS_RAW=4 };
struct scroll_bar int saving_type=SAVE_AS_PNG;
{
word size_x, start_x, size_y, start_y; char* libimg_bpp[] = { "8pal", "24", "32", "15", "16",
dword btn_height, type, max_area, cur_area, position, "mono", "8gray", "2pal", "4pal", "8pal" };
bckg_col, frnt_col, line_col, redraw;
word delta, delta2, r_size_x, r_start_x, r_size_y, r_start_y; enum {
dword m_pos, m_pos_2, m_keys, run_size, position2, work_size, all_redraw, ar_offset; TOOL_CROP=1,
TOOL_RESIZE=2,
TOOL_COLOR_DEPTH=4,
TOOL_FLIP_ROTATE=8
}; };
*/ int active_tool = NULL;
//===================================================// //===================================================//
// // // //
@ -66,8 +69,7 @@ struct scroll_bar
void init_ui() void init_ui()
{ {
sc.get(); sc.get();
semi_white = MixColors(sc.work, 0xFFFfff, bg_dark*90 + 96); semi_white = MixColors(sc.work, 0xFFFfff, skin_is_dark()*90 + 96);
bg_dark = skin_is_dark();
icons18.load("/sys/icons16.png"); icons18.load("/sys/icons16.png");
icons18.replace_color(0xffFFFfff, semi_white); icons18.replace_color(0xffFFFfff, semi_white);
icons18.replace_color(0xffCACBD6, MixColors(sc.work, 0, 200)); icons18.replace_color(0xffCACBD6, MixColors(sc.work, 0, 200));
@ -92,6 +94,14 @@ void main()
scrollbar_v_mouse stdcall(#scroll_v); scrollbar_v_mouse stdcall(#scroll_v);
scrollbar_h_mouse stdcall(#scroll_h); scrollbar_h_mouse stdcall(#scroll_h);
if (scroll_v.delta) || (scroll_h.delta) draw_canvas(); if (scroll_v.delta) || (scroll_h.delta) draw_canvas();
if (EAX = mouse.vert) {
if (EAX<10) event_scroll_canvas(SCAN_CODE_DOWN);
else event_scroll_canvas(SCAN_CODE_UP);
} if (EAX = mouse.hor) {
debugval("mouse.hor", mouse.hor);
if (EAX<10) event_scroll_canvas(SCAN_CODE_RIGHT);
else event_scroll_canvas(SCAN_CODE_LEFT);
}
break; break;
case evButton: case evButton:
@ -102,14 +112,11 @@ void main()
case evKey: case evKey:
GetKeys(); GetKeys();
if (key_scancode == SCAN_CODE_DOWN) { if (key_scancode == SCAN_CODE_DOWN) event_scroll_canvas(SCAN_CODE_DOWN);
scroll_v.position = math.min(scroll_v.position+25, scroll_v.max_area - scroll_v.cur_area); if (key_scancode == SCAN_CODE_UP) event_scroll_canvas(SCAN_CODE_UP);
draw_canvas(); if (key_scancode == SCAN_CODE_LEFT) event_scroll_canvas(SCAN_CODE_LEFT);
} if (key_scancode == SCAN_CODE_RIGHT) event_scroll_canvas(SCAN_CODE_RIGHT);
if (key_scancode == SCAN_CODE_UP) { key.press(key_scancode);
scroll_v.position = math.max(scroll_v.position-25, 0);
draw_canvas();
}
break; break;
case evReDraw: case evReDraw:
@ -121,7 +128,11 @@ void main()
void draw_window() void draw_window()
{ {
incn tx; incn tx;
DefineAndDrawWindow(random(100)+40, 40+random(100), screen.width/3*2, screen.height/3*2, 0x73, NULL, #win_title, 0); char save_as_type[32];
sc.get();
Form.width = screen.w/6*5;
Form.height = screen.h/6*5;
DefineAndDrawWindow(screen.w-Form.width/2, screen.h-Form.height/2, Form.width, Form.height, 0x73, NULL, #win_title, 0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window&ROLLED_UP) return; if (Form.status_window&ROLLED_UP) return;
if (Form.width < 560) { MoveSize(OLD,OLD,560,OLD); return; } if (Form.width < 560) { MoveSize(OLD,OLD,560,OLD); return; }
@ -132,75 +143,83 @@ void draw_window()
DrawBar(0, 0, canvas.x, Form.cheight, sc.work); DrawBar(0, 0, canvas.x, Form.cheight, sc.work);
canvas.w = Form.cwidth - canvas.x; canvas.w = Form.cwidth - canvas.x;
canvas.h = Form.cheight; canvas.h = Form.cheight - STATUSBAR_H;
if (main_image.h > canvas.h) canvas.w -= scroll_v.size_x + 1; if (main_image.h > canvas.h) canvas.w -= scroll_v.size_x + 1;
if (main_image.w > canvas.w) canvas.h -= scroll_h.size_y + 1; if (main_image.w > canvas.w) canvas.h -= scroll_h.size_y + 1;
DrawBar(canvas.x, 0, 1, canvas.h, sc.work_graph); DrawBar(canvas.x, 0, 1, canvas.h, sc.work_text);
if (main_image.h > canvas.h) && (main_image.w > canvas.w) { if (main_image.h > canvas.h) && (main_image.w > canvas.w) {
DrawBar(canvas.x+canvas.w, canvas.y+canvas.h, scroll_v.size_x+1, scroll_h.size_y+1, sc.work); DrawBar(canvas.x+canvas.w, canvas.y+canvas.h, scroll_v.size_x+1, scroll_h.size_y+1, sc.work);
} }
scroll_v.all_redraw = scroll_h.all_redraw = 1; scroll_v.all_redraw = scroll_h.all_redraw = 1;
scroll_v.bckg_col = scroll_h.bckg_col = MixColors(sc.work, 0xBBBbbb, 80); if (skin_is_dark())
scroll_v.frnt_col = scroll_h.frnt_col = MixColors(sc.work,0xFFFfff,120); {
scroll_v.line_col = scroll_h.line_col = sc.work_graph; scroll_v.bckg_col = scroll_h.bckg_col = sc.work_light;
scroll_v.frnt_col = scroll_h.frnt_col = sc.button;
scroll_v.line_col = scroll_h.line_col = sc.button_text;
}
scroll_v.line_col = scroll_h.line_col = sc.work_text;
#define GAP_S 24+7 #define GAP_S TOOLBAR_ITEM_H+8
#define GAP_B 24+23 #define GAP_B TOOLBAR_ITEM_H+23
tx.set(PAD-GAP_S); tx.set(PAD-GAP_S);
//draw_icon(10, ECTRL + SCAN_CODE_KEY_N, PAD, tx.inc(GAP_S), 02, "Create image"); //draw_tool_btn(10, ECTRL + SCAN_CODE_KEY_N, PAD, tx.inc(GAP_S), 02, "Create image", false);
draw_icon(#event_open, ECTRL + SCAN_CODE_KEY_O, PAD, tx.inc(GAP_S), 00, "Open image"); draw_tool_btn(#event_open, ECTRL + SCAN_CODE_KEY_O, PAD, tx.inc(GAP_S), 00, "Open image", false);
//draw_icon(13, ECTRL + SCAN_CODE_LEFT, PAD, tx.inc(GAP_B), 30); //draw_tool_btn(13, ECTRL + SCAN_CODE_LEFT, PAD, tx.inc(GAP_B), 30, false);
//draw_icon(14, ECTRL + SCAN_CODE_RIGHT, PAD, tx.inc(GAP_S), 31); //draw_tool_btn(14, ECTRL + SCAN_CODE_RIGHT, PAD, tx.inc(GAP_S), 31, false);
//draw_icon(15, ECTRL + SCAN_CODE_UP, PAD, tx.inc(GAP_S), 32); //draw_tool_btn(15, ECTRL + SCAN_CODE_UP, PAD, tx.inc(GAP_S), 32, false);
//draw_icon(16, ECTRL + SCAN_CODE_DOWN, PAD, tx.inc(GAP_S), 33); //draw_tool_btn(16, ECTRL + SCAN_CODE_DOWN, PAD, tx.inc(GAP_S), 33, false);
//draw_icon(#event_save, ECTRL + SCAN_CODE_KEY_S, PAD, tx.inc(GAP_B), 05, "Save file"); draw_tool_btn(#event_save, ECTRL + SCAN_CODE_KEY_S, PAD, tx.inc(GAP_B), 05, "Save file", false);
//draw_icon(12, 0, PAD, tx.inc(GAP_B), 05, "PNG"); draw_tool_btn(#event_save_png, 0, PAD, tx.inc(GAP_S), -1, "PNG", saving_type & SAVE_AS_PNG);
//draw_icon(12, 0, PAD, tx.inc(GAP_S), 05, "BMP"); draw_tool_btn(#event_save_bmp, 0, PAD*2+34, tx.n, -1, "BMP", saving_type & SAVE_AS_BMP);
//draw_icon(12, 0, PAD, tx.inc(GAP_S), 05, "RAW"); draw_tool_btn(#event_save_raw, 0, PAD*3+68, tx.n, -1, "RAW", saving_type & SAVE_AS_RAW);
draw_icon(#event_save, ECTRL + SCAN_CODE_KEY_S, PAD, tx.inc(GAP_S), 05, "Save as PNG");
draw_icon(0, 0, PAD, tx.inc(GAP_B), 46, "Crop"); draw_tool_btn(#event_activate_crop, 0, PAD, tx.inc(GAP_B), 46, "Crop", active_tool & TOOL_CROP);
draw_icon(0, 0, PAD, tx.inc(GAP_S), 06, "Resize"); draw_tool_btn(#event_activate_resize,0, PAD, tx.inc(GAP_S), 06, "Resize", active_tool & TOOL_RESIZE);
draw_icon(0, 0, PAD, tx.inc(GAP_S), 52, "Color depth"); draw_tool_btn(#event_activate_depth, 0, PAD, tx.inc(GAP_S), 52, "Color depth", active_tool & TOOL_COLOR_DEPTH);
draw_icon(#event_flip_hor, ECTRL + SCAN_CODE_KEY_H, PAD, tx.inc(GAP_S), 34, NULL); draw_tool_btn(#event_activate_flprot,0, PAD, tx.inc(GAP_S), 36, "Flip/Rotate", active_tool & TOOL_FLIP_ROTATE);
draw_icon(#event_flip_ver, ECTRL + SCAN_CODE_KEY_V, PAD*4+3, tx.n, 35, NULL); //draw_tool_btn(#event_flip_hor, ECTRL + SCAN_CODE_KEY_H, PAD, tx.inc(GAP_S), 34, NULL, false);
draw_icon(#event_rotate, ECTRL + SCAN_CODE_KEY_R, PAD*7+6, tx.n, 36, NULL); //draw_tool_btn(#event_flip_ver, ECTRL + SCAN_CODE_KEY_V, PAD*2+34, tx.n, 35, NULL, false);
//draw_tool_btn(#event_rotate, ECTRL + SCAN_CODE_KEY_R, PAD*3+68, tx.n, 36, NULL, false);
draw_image_info(tx.inc(GAP_B)); draw_status_bar();
draw_canvas(); draw_canvas();
} }
char* libimg_bpp[] = { "8 pal", "24", "32", "15", "16", void draw_status_bar()
"1 mono", "8 gray", "2 pal", "4 pal", "8 pal" };
void draw_image_info(int _y)
{ {
WriteText(PAD, _y, 0x90, sc.work_text, "Properties"); char img_info[24];
DrawBar(PAD, _y+14, TOOLBAR_W, 1, sc.work_graph); //draw_image_info
WriteText(PAD, _y+22, 0x90, sc.work_text, "Width:"); sprintf(#img_info, "%ix%i@%s", main_image.w, main_image.h, libimg_bpp[main_image.type-1]);
WriteText(PAD, _y+42, 0x90, sc.work_text, "Heigh:"); DrawBar(canvas.x, Form.cheight - STATUSBAR_H, Form.cwidth - canvas.x, STATUSBAR_H, sc.work);
WriteText(PAD, _y+62, 0x90, sc.work_text, "Depth:"); WriteText(canvas.x, Form.cheight - STATUSBAR_H + 2, 0x90, sc.work_text, #img_info);
WriteText(PAD+60, _y+22, 0x90, sc.work_text, itoa(main_image.w));
WriteText(PAD+60, _y+42, 0x90, sc.work_text, itoa(main_image.h));
WriteText(PAD+60, _y+62, 0x90, sc.work_text, libimg_bpp[main_image.type-1]);
} }
void draw_icon(dword _event, _key, _x, _y, _icon_n, _text) void draw_tool_btn(dword _event, _hotkey, _x, _y, _icon_n, _text, _active)
{ {
int w; int w = TOOLBAR_W;
if (_text) w = TOOLBAR_W; else w = PAD + PAD + 8; if (!_text) w = PAD + PAD + 12;
DrawBar(_x, _y, w, TOOLBAR_ITEM_H+1, semi_white); if (_icon_n==-1) w = strlen(_text) * 8 + 14;
if (_active) EDX = sc.button; else EDX = semi_white;
DrawBar(_x, _y, w, TOOLBAR_ITEM_H+1, EDX);
PutPixel(_x,_y,sc.work); PutPixel(_x,_y,sc.work);
PutPixel(_x,_y+TOOLBAR_ITEM_H,sc.work); PutPixel(_x,_y+TOOLBAR_ITEM_H,sc.work);
PutPixel(_x+w-1,_y,sc.work); PutPixel(_x+w-1,_y,sc.work);
PutPixel(_x+w-1,_y+TOOLBAR_ITEM_H,sc.work); PutPixel(_x+w-1,_y+TOOLBAR_ITEM_H,sc.work);
if (_event) DefineHiddenButton(_x, _y, w, TOOLBAR_ITEM_H, button.add(_event)); if (_event) DefineHiddenButton(_x, _y, w, TOOLBAR_ITEM_H, button.add(_event));
if (_text) WriteText(_x+PAD+ISIZE+2, _y+9, 0x80, sc.work_text, _text); if (_hotkey) key.add_n(_hotkey, _event);
img_draw stdcall(icons18.image, _x+7, _y+3, ISIZE, ISIZE, 0, _icon_n*ISIZE); if (_icon_n!=-1) {
img_draw stdcall(icons18.image, _x+7, _y+4, ISIZE, ISIZE, 0, _icon_n*ISIZE);
_x += PAD+ISIZE+2;
} else {
_x += 7;
}
if (_text) {
if (_active) EDX = sc.button_text; else EDX = sc.work_text;
WriteText(_x, _y+6, 0x90, EDX, _text);
}
} }
void draw_scroll_v() void draw_scroll_v()
@ -289,17 +308,56 @@ void event_rotate()
draw_window(); draw_window();
} }
void event_save_png() { saving_type = SAVE_AS_PNG; draw_window(); }
void event_save_bmp() { saving_type = SAVE_AS_BMP; draw_window(); }
void event_save_raw() { saving_type = SAVE_AS_RAW; draw_window(); }
void event_activate_crop() { active_tool = TOOL_CROP; draw_window(); }
void event_activate_resize() { active_tool = TOOL_RESIZE; draw_window(); }
void event_activate_depth() { active_tool = TOOL_COLOR_DEPTH; draw_window(); }
void event_activate_flprot() { active_tool = TOOL_FLIP_ROTATE; draw_window(); }
void event_save() void event_save()
{ {
o_dialog.type = 1; //save file o_dialog.type = 1; //save file
strcpy(#filename_area, "image.png"); switch (saving_type) {
OpenDialog_start stdcall (#o_dialog); case SAVE_AS_PNG:
if (o_dialog.status) { strcpy(#filename_area, "image.png");
update_title(#openfile_path); OpenDialog_start stdcall (#o_dialog);
img_to_rgb stdcall (main_image.image); if (o_dialog.status) {
save_image(main_image.imgsrc, main_image.w, main_image.h, #openfile_path); update_title(#openfile_path);
img_to_rgb stdcall (main_image.image);
save_image(main_image.imgsrc, main_image.w, main_image.h, #openfile_path);
}
break;
case SAVE_AS_BMP:
notify("Not implemented yet.");
break;
case SAVE_AS_RAW:
notify("Not implemented yet.");
break;
} }
} }
void event_scroll_canvas(int _direction)
{
switch(_direction) {
case SCAN_CODE_DOWN:
scroll_v.position = math.min(scroll_v.position+25,
scroll_v.max_area - scroll_v.cur_area);
break;
case SCAN_CODE_UP:
scroll_v.position = math.max(scroll_v.position-25, 0);
break;
case SCAN_CODE_RIGHT:
scroll_h.position = math.min(scroll_h.position+25,
scroll_h.max_area - scroll_h.cur_area);
break;
case SCAN_CODE_LEFT:
scroll_h.position = math.max(scroll_h.position-25, 0);
}
draw_canvas();
}
stop: stop:

View File

@ -42,7 +42,7 @@ void main()
case evReDraw: case evReDraw:
sc.get(); sc.get();
DefineAndDrawWindow(215,100,WIN_W+9,WIN_H+skin_height+5,0x74,0xFFFFFF,#title,0); DefineAndDrawWindow(215,100,WIN_W+9,WIN_H+skin_h+5,0x74,0xFFFFFF,#title,0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window&ROLLED_UP) break; if (Form.status_window&ROLLED_UP) break;
_DRAW_WINDOW_CONTENT: _DRAW_WINDOW_CONTENT:

View File

@ -18,7 +18,7 @@
} }
ESDWORD[shared_mem ] = _selected; ESDWORD[shared_mem ] = _selected;
ESDWORD[shared_mem + 4] = _x + Form.left + 5; ESDWORD[shared_mem + 4] = _x + Form.left + 5;
ESDWORD[shared_mem + 8] = _y + Form.top + skin_height; ESDWORD[shared_mem + 8] = _y + Form.top + skin_h;
ESDWORD[shared_mem + 12] = _position; ESDWORD[shared_mem + 12] = _position;
menu_process_id = RunProgram("/sys/develop/menu", _text1); menu_process_id = RunProgram("/sys/develop/menu", _text1);
} }

View File

@ -492,7 +492,7 @@ inline fastcall dword SetWindowLayerBehaviour(EDX, ESI)
:dword GetPixelColorFromScreen(dword _x, _y) :dword GetPixelColorFromScreen(dword _x, _y)
{ {
EAX = 35; EAX = 35;
EBX = _y * screen.width + _x; EBX = _y * screen.w + _x;
$int 64 $int 64
} }
@ -606,8 +606,8 @@ inline fastcall void PutPixel( EBX,ECX,EDX)
{ {
z1 = Form1.left + mouse.x - tmp_x; z1 = Form1.left + mouse.x - tmp_x;
z2 = Form1.top + mouse.y - tmp_y; z2 = Form1.top + mouse.y - tmp_y;
if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form1.width-10)z1=screen.width-Form1.width; if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.w-Form1.width-10)z1=screen.w-Form1.width;
if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form1.height-10)z2=screen.height-Form1.height; if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.h-Form1.height-10)z2=screen.h-Form1.height;
MoveSize(z1 , z2, OLD, OLD); MoveSize(z1 , z2, OLD, OLD);
draw_window(); draw_window();
} }
@ -651,19 +651,19 @@ inline fastcall dword GetStartTime()
:struct _screen :struct _screen
{ {
dword width,height; dword w,h;
} screen; } screen;
:byte skin_height; :byte skin_h;
dword __generator; // random number generator init dword __generator; // random number generator init
//The initialization of the initial data before running //The initialization of the initial data before running
:void ______INIT______() :void ______INIT______()
{ {
skin_height = @GetSkinHeight(); skin_h = @GetSkinHeight();
screen.width = @GetScreenWidth()+1; screen.w = @GetScreenWidth()+1;
screen.height = @GetScreenHeight()+1; screen.h = @GetScreenHeight()+1;
__generator = @GetStartTime(); __generator = @GetStartTime();
mem_init(); mem_init();
main(); main();

View File

@ -184,7 +184,7 @@
$mov ebx, eax $mov ebx, eax
$shr eax, 16 $shr eax, 16
$and ebx,0x0000FFFF $and ebx,0x0000FFFF
//hor = EAX; hor = EAX;
vert = EBX; vert = EBX;
} }

View File

@ -134,8 +134,8 @@ void DrawWindow()
unsigned i; unsigned i;
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-400, screen.height/3, 280, DefineAndDrawWindow(screen.w-400, screen.h/3, 280,
skin_height + 50+PD+PD, 0x34, sc.work, "EasyShot",0); skin_h + 50+PD+PD, 0x34, sc.work, "EasyShot",0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (!recording) { if (!recording) {
@ -165,7 +165,7 @@ void DrawStatusBar(char *s)
dword ScreenshotBuf() dword ScreenshotBuf()
{ {
static dword screenshot; static dword screenshot;
if (!screenshot) screenshot = malloc(screen.width * screen.height * 3); if (!screenshot) screenshot = malloc(screen.w * screen.h * 3);
return screenshot; return screenshot;
} }
@ -193,8 +193,8 @@ bool GetSavingPath()
void MakeScreenshot() void MakeScreenshot()
{ {
if (I_Path = GetSavingPath()) { if (I_Path = GetSavingPath()) {
CopyScreen(ScreenshotBuf(), 0, 0, screen.width, screen.height); CopyScreen(ScreenshotBuf(), 0, 0, screen.w, screen.h);
I_Param = save_image(ScreenshotBuf(), screen.width, screen.height, I_Path); I_Param = save_image(ScreenshotBuf(), screen.w, screen.h, I_Path);
if (!I_Param) I_Param = I_Path; if (!I_Param) I_Param = I_Path;
DrawStatusBar(I_Param); DrawStatusBar(I_Param);
} else { } else {
@ -227,7 +227,7 @@ void EventSettingsClick()
{ {
show_settings ^= 1; show_settings ^= 1;
@MoveSize(OLD, OLD, show_settings*65 + 280, @MoveSize(OLD, OLD, show_settings*65 + 280,
show_settings*110 + skin_height + PD+PD+50); show_settings*110 + skin_h + PD+PD+50);
} }
void EventChooseSavePathClick() void EventChooseSavePathClick()

View File

@ -67,8 +67,8 @@ void main()
void draw_window() void draw_window()
{ {
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-WINW/2,screen.height-WINH/2, DefineAndDrawWindow(screen.w-WINW/2,screen.h-WINH/2,
WINW+9,WINH+skin_height,0x34,sc.work,"KolibriN10",0); WINW+9,WINH+skin_h,0x34,sc.work,"KolibriN10",0);
DrawLogo(); DrawLogo();
if (install_complete) DrawInstallComplete(); else DrawIntro(); if (install_complete) DrawInstallComplete(); else DrawIntro();
} }

View File

@ -101,8 +101,8 @@ void main()
void draw_window() void draw_window()
{ {
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-WINW/2,screen.height-WINH/2, DefineAndDrawWindow(screen.w-WINW/2,screen.h-WINH/2,
WINW+9,WINH+skin_height,0x34,sc.work,T_WINDOW_TITLE,0); WINW+9,WINH+skin_h,0x34,sc.work,T_WINDOW_TITLE,0);
WriteText(30, 20, 0x91, 0xEC008C, T_TITLE_H1); WriteText(30, 20, 0x91, 0xEC008C, T_TITLE_H1);
if (!install_complete) { if (!install_complete) {
if (GetProcessSlot(unimg_id)) { if (GetProcessSlot(unimg_id)) {

View File

@ -74,11 +74,11 @@ void main()
list.y = 32; list.y = 32;
DrawList(); DrawList();
window_height = row+1*list.item_h + list_pos + skin_height + 15; window_height = row+1*list.item_h + list_pos + skin_h + 15;
if (window_height>screen.height) { if (window_height>screen.h) {
window_width = screen.width; window_width = screen.w;
list.item_h -= 5; list.item_h -= 5;
window_height = row+1*list.item_h + list_pos + skin_height + 15; window_height = row+1*list.item_h + list_pos + skin_h + 15;
small_screen = true; small_screen = true;
} }
@ -100,7 +100,7 @@ void main()
case evReDraw: case evReDraw:
SetAppColors(); SetAppColors();
DefineAndDrawWindow(screen.width-window_width/2,screen.height-window_height/2,window_width,window_height,0x74,sc.work,"",0); DefineAndDrawWindow(screen.w-window_width/2,screen.h-window_height/2,window_width,window_height,0x74,sc.work,"",0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window&ROLLED_UP) { if (Form.status_window&ROLLED_UP) {
DrawTitle(#window_title); DrawTitle(#window_title);

View File

@ -99,7 +99,7 @@ void main() {
case evReDraw: case evReDraw:
sc.get(); sc.get();
DefineAndDrawWindow(430, 150, 460, 343+skin_height,0x34,sc.work,WINDOW_TITLE,0); DefineAndDrawWindow(430, 150, 460, 343+skin_h,0x34,sc.work,WINDOW_TITLE,0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window&ROLLED_UP) break; if (Form.status_window&ROLLED_UP) break;
mouse_frame.w = - FRAME_X * 2 + Form.cwidth; mouse_frame.w = - FRAME_X * 2 + Form.cwidth;

View File

@ -148,7 +148,7 @@ void main()
} }
if(mouse.key&MOUSE_LEFT) && (mouse.x<14) if(mouse.key&MOUSE_LEFT) && (mouse.x<14)
&& (window_mode == WINDOW_MODE_SMALL) EventDragWindow(); && (window_mode == WINDOW_MODE_SMALL) EventDragWindow();
if (mouse.down) && (mouse.y>skin_height) && (mouse.key&MOUSE_RIGHT) EventShowAbout(); if (mouse.down) && (mouse.y>skin_h) && (mouse.key&MOUSE_RIGHT) EventShowAbout();
break; break;
case evButton: case evButton:
switch(@GetButtonID()) { switch(@GetButtonID()) {

View File

@ -12,7 +12,7 @@ int line_end;
list.count=0; list.count=0;
selection.cancel(); selection.cancel();
if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.height); if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.h);
lines.drop(); lines.drop();
lines.add(textbuf.p); lines.add(textbuf.p);

View File

@ -160,7 +160,7 @@ void main()
void draw_window() void draw_window()
{ {
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-600/2,100,640,600,0x73,sc.work,T_WINDOW_HEADER,0); DefineAndDrawWindow(screen.w-600/2,100,640,600,0x73,sc.work,T_WINDOW_HEADER,0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
IF (Form.status_window&ROLLED_UP) return; IF (Form.status_window&ROLLED_UP) return;
if (Form.width < 270) { MoveSize(OLD,OLD,270,OLD); return; } if (Form.width < 270) { MoveSize(OLD,OLD,270,OLD); return; }

View File

@ -400,7 +400,7 @@ void EventShowTinfo()
void ReadIni() void ReadIni()
{ {
Form.left = ini.GetInt("x", screen.width/2 - 350); Form.left = ini.GetInt("x", screen.w/2 - 350);
Form.top = ini.GetInt("y", 100); Form.top = ini.GetInt("y", 100);
Form.width = ini.GetInt("w", 700); Form.width = ini.GetInt("w", 700);
Form.height = ini.GetInt("h", 490); Form.height = ini.GetInt("h", 490);

View File

@ -188,20 +188,20 @@ void DrawProcessList()
void SetAttachement() void SetAttachement()
{ {
if (attachement==ATTACHEMENT_LEFT) { if (attachement==ATTACHEMENT_LEFT) {
DefineUnDragableWindow(0, 0, CELLW-1, screen.height); DefineUnDragableWindow(0, 0, CELLW-1, screen.h);
SetClientScreenArea(CELLW, screen.width-CELLW, 0, screen.height); SetClientScreenArea(CELLW, screen.w-CELLW, 0, screen.h);
} }
if (attachement==ATTACHEMENT_RIGHT) { if (attachement==ATTACHEMENT_RIGHT) {
DefineUnDragableWindow(screen.width - CELLW, 0, CELLW, screen.height); DefineUnDragableWindow(screen.w - CELLW, 0, CELLW, screen.h);
SetClientScreenArea(0, screen.width-CELLW, 0, screen.height); SetClientScreenArea(0, screen.w-CELLW, 0, screen.h);
} }
if (attachement==ATTACHEMENT_TOP) { if (attachement==ATTACHEMENT_TOP) {
DefineUnDragableWindow(0, 0, screen.width, CELLH-1); DefineUnDragableWindow(0, 0, screen.w, CELLH-1);
SetClientScreenArea(0, 0, CELLH, screen.height); SetClientScreenArea(0, 0, CELLH, screen.h);
} }
if (attachement==ATTACHEMENT_BOTTOM) { if (attachement==ATTACHEMENT_BOTTOM) {
DefineUnDragableWindow(0, screen.height, screen.width, CELLH); DefineUnDragableWindow(0, screen.h, screen.w, CELLH);
SetClientScreenArea(0, 0, 0, screen.height - CELLH); SetClientScreenArea(0, 0, 0, screen.h - CELLH);
} }
} }