/programs/cmm/iconedit/actions_history.h |
---|
1,4 → 1,3 |
// Actions history |
#define MAX_ACTIONS_COUNT 15 |
24,8 → 23,10 |
head = tail = 0; |
currentIndex = -1; |
for (i = 0; i < MAX_ACTIONS_COUNT; i++) |
for (i = 0; i < MAX_ACTIONS_COUNT; i++) { |
stack[i] = free(stack[i]); |
stack[i] = malloc(image.columns * image.rows * 4); |
} |
saveCurrentState(); |
} |
/programs/cmm/iconedit/canvas_resize.h |
---|
0,0 → 1,96 |
child_window Window_CanvasReSize = {#CanvasReSize_Thread}; |
//===================================================// |
// // |
// CODE // |
// // |
//===================================================// |
char text_columns[4]; |
char text_rows[4]; |
edit_box edit_columns = {60,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, |
0x10000000,sizeof(text_columns)-1,#text_columns,0, 1000000000000010b}; |
edit_box edit_rows = {60,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, |
0x10000000,sizeof(text_rows)-1,#text_rows,0, 1000000000000000b}; |
#define BTN_APPLY 10 |
void CanvasReSize_Thread() |
{ |
int id, butw; |
sprintf(#text_columns, "%i", image.columns); |
sprintf(#text_rows, "%i", image.rows); |
edit_columns.size = edit_columns.pos = edit_columns.shift = edit_columns.shift_old = strlen(#text_columns); |
edit_rows.size = edit_rows.pos = edit_rows.shift = edit_rows.shift_old = strlen(#text_rows); |
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
loop() switch(WaitEvent()) |
{ |
case evMouse: |
edit_box_mouse stdcall (#edit_columns); |
edit_box_mouse stdcall (#edit_rows); |
break; |
case evKey: |
GetKeys(); |
if (SCAN_CODE_ESC == key_scancode) ExitProcess(); |
if (SCAN_CODE_ENTER == key_scancode) EventApplyClick(); |
if (SCAN_CODE_TAB == key_scancode) EventTabClick(); |
EAX= key_ascii << 8; |
edit_box_key stdcall (#edit_columns); |
edit_box_key stdcall (#edit_rows); |
break; |
case evButton: |
id = GetButtonID(); |
if (CLOSE_BTN == id) ExitProcess(); |
if (BTN_APPLY == id) EventApplyClick(); |
break; |
case evReDraw: |
DefineAndDrawWindow(Form.left+canvas.x + 100, Form.top+skin_height+canvas.y+40, |
200, 170, 0x34, system.color.work, "Canvas", 0); |
WriteText(20, 20, 0x90, system.color.work_text, "Width"); |
WriteText(20, 60, 0x90, system.color.work_text, "Height"); |
DrawStandartCaptButton(20, 100, BTN_APPLY, "OK"); |
DrawEditBoxes(); |
} |
} |
void DrawEditBoxes() |
{ |
DrawEditBoxPos(20+70, 20-4, #edit_columns); |
DrawEditBoxPos(20+70, 60-4, #edit_rows); |
} |
//===================================================// |
// // |
// EVENTS // |
// // |
//===================================================// |
void EventApplyClick() |
{ |
int new_rows = atoi(#text_rows); |
int new_columns = atoi(#text_columns); |
if (new_columns>MAX_CELL_SIZE) || (new_rows>MAX_CELL_SIZE) { |
notify("'Maximum icon size exceeded!\nPlease, try something less or equal to 256x256.' -E"); |
return; |
} |
image.create(new_rows, new_columns); |
actionsHistory.init(); |
ActivateWindow(GetProcessSlot(Form.ID)); |
ExitProcess(); |
} |
void EventTabClick() |
{ |
if (edit_columns.flags & 0b10) { edit_columns.flags -= 0b10; edit_rows.flags += 0b10; } |
else { edit_columns.flags += 0b10; edit_rows.flags -= 0b10; } |
DrawEditBoxes(); |
} |
/programs/cmm/iconedit/cursors/bar.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/cmm/iconedit/cursors/fill.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/cmm/iconedit/cursors/line.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/cmm/iconedit/cursors/pipette.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/cmm/iconedit/cursors/rectangle.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/cmm/iconedit/cursors/select.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/cmm/iconedit/iconedit.c |
---|
32,7 → 32,7 |
// // |
//===================================================// |
#define T_TITLE "Icon Editor 0.54.2 Alpha" |
#define T_TITLE "Icon Editor 0.55 Alpha" |
#define TOPBAR_H 24+8 |
#define LEFTBAR_W 16+5+5+3+3 |
86,6 → 86,7 |
BTN_SCREEN_COPY, |
BTN_ZOOM_IN, |
BTN_ZOOM_OUT, |
BTN_CANVAS_RESIZE, |
BTNS_PALETTE_COLOR_MAS = 100, |
BTNS_LAST_USED_COLORS = 400 |
}; |
131,6 → 132,7 |
_ActionsHistory actionsHistory; |
#include "tools.h" |
#include "canvas_resize.h" |
//===================================================// |
// // |
188,6 → 190,7 |
loop() switch(WaitEvent()) |
{ |
case evMouse: |
if (Window_CanvasReSize.thread_exists()) break; |
mouse.get(); |
if (mouse.lkm) tool_color = color1; |
233,6 → 236,7 |
break; |
case evButton: |
if (Window_CanvasReSize.thread_exists()) break; |
btn = GetButtonID(); |
if (zoom.click(btn)) DrawEditArea(); |
240,7 → 244,7 |
switch(btn) |
{ |
case BTN_NEW: |
EventCleanCanvas(); |
EventCreateNewIcon(); |
break; |
case BTN_OPEN: |
RunProgram("/sys/lod", sprintf(#param, "*png* %s",#program_path)); |
293,6 → 297,9 |
case BTN_SCREEN_COPY: |
setCurrentTool(TOOL_SCREEN_COPY); |
break; |
case BTN_CANVAS_RESIZE: |
notify("Sorry, not implemented yet."); |
break; |
case CLOSE_BTN: |
EventExitIconEdit(); |
break; |
305,6 → 312,8 |
if (currentTool != TOOL_NONE) && (tools[currentTool].onKeyEvent != 0) |
tools[currentTool].onKeyEvent(key_scancode); |
if (key_scancode == SCAN_CODE_DEL) EventCleanCanvas(); |
if (key_scancode == SCAN_CODE_KEY_P) setCurrentTool(TOOL_PENCIL); |
if (key_scancode == SCAN_CODE_KEY_I) setCurrentTool(TOOL_PIPETTE); |
if (key_scancode == SCAN_CODE_KEY_F) setCurrentTool(TOOL_FILL); |
324,6 → 333,7 |
break; |
case evReDraw: |
Window_CanvasReSize.thread_exists(); |
draw_window(); |
break; |
} |
352,8 → 362,16 |
{ |
zoom.draw(wrapper.x, wrapper.y + wrapper.h + 6); |
sprintf(#param,"Canvas: %ix%i", image.rows, image.columns); |
WriteText(wrapper.x+wrapper.w-calc(strlen(#param)*8), zoom.y+2, 0x90, system.color.work_text, #param); |
DrawCaptButton( |
wrapper.x+wrapper.w-calc(strlen(#param)*8) +6 - 1, |
zoom.y, |
calc(strlen(#param)*8)-6, |
18, |
BTN_CANVAS_RESIZE, |
system.color.work_button, |
system.color.work_button_text, |
sprintf(#param,"%i x %i", image.rows, image.columns) |
); |
} |
void draw_window() |
391,20 → 409,18 |
DrawEditArea(); |
//BG under LeftBar |
DrawBar(0, TOPBAR_H, LEFTBAR_W-1, Form.cheight - TOPBAR_H, system.color.work); |
//BG under RightBar |
DrawLeftPanel(); |
DrawBar(wrapper.x+wrapper.w, TOPBAR_H, Form.cwidth-wrapper.x-wrapper.w, |
Form.cheight - TOPBAR_H, system.color.work); |
//BG under StatusBar |
DrawActiveColor(right_bar.y); |
DrawColorPallets(); |
DrawPreview(); |
DrawBar(LEFTBAR_W-1, wrapper.y + wrapper.h, wrapper.w+1, |
Form.cheight - wrapper.y - wrapper.h, system.color.work); |
DrawLeftPanel(); |
DrawActiveColor(right_bar.y); |
DrawColorPallets(); |
DrawStatusBar(); |
DrawPreview(); |
} |
void DrawLeftPanel() |
608,6 → 624,12 |
// // |
//===================================================// |
void EventCreateNewIcon() |
{ |
EventSaveIconToFile(); |
Window_CanvasReSize.create(); |
} |
void EventSaveIconToFile() |
{ |
int i=0; |
623,8 → 645,8 |
void EventCleanCanvas() |
{ |
EventSaveIconToFile(); |
image.create(32, 32); |
image.create(image.rows, image.columns); |
actionsHistory.saveCurrentState(); |
DrawCanvas(); |
} |