Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7258 → Rev 7259

/programs/cmm/iconedit/colors_mas.h
6,8 → 6,8
// //
//////////////////////////////////////////////////////////////////////////////////////
 
//The 'draw[]' in the array which holds the states should we draw a pixel or not.
//Is need to decrese redraw when using some tools like line, rectangle and selection.
//The 'draw[]' is the array which holds the states should we draw a pixel or not.
//Is need to decrease redraw when using some tools like line, rectangle and selection.
 
struct _pixel_state
{
/programs/cmm/iconedit/iconedit.c
31,7 → 31,7
// //
//===================================================//
 
#define T_TITLE "Icon Editor 0.48 Alpha"
#define T_TITLE "Icon Editor 0.49 Alpha"
 
#define TOOLBAR_H 24+8
#define PANEL_LEFT_W 16+5+5+3+3
80,7 → 80,9
BTN_FILL,
BTN_LINE,
BTN_RECT,
BTN_BAR,
BTN_SELECT,
BTN_SCREEN,
BTN_ZOOM_IN,
BTN_ZOOM_OUT,
BTNS_PALETTE_COLOR_MAS = 100,
254,11 → 256,9
break;
case BTN_PICK:
setCurrentTool(TOOL_PIPETTE);
//EventPickActivate();
break;
case BTN_FILL:
setCurrentTool(TOOL_FILL);
//EventFillActivate();
break;
case BTN_LINE:
setCurrentTool(TOOL_LINE);
266,6 → 266,9
case BTN_RECT:
setCurrentTool(TOOL_RECT);
break;
case BTN_BAR:
setCurrentTool(TOOL_BAR);
break;
case BTN_SELECT:
setCurrentTool(TOOL_SELECT);
break;
372,7 → 375,9
DrawLeftPanelButton(BTN_FILL, ty.inc(TB_ICON_PADDING), 40);
DrawLeftPanelButton(BTN_LINE, ty.inc(TB_ICON_PADDING), 41);
DrawLeftPanelButton(BTN_RECT, ty.inc(TB_ICON_PADDING), 42);
DrawLeftPanelButton(BTN_SELECT, ty.inc(TB_ICON_PADDING), 43);
DrawLeftPanelButton(BTN_BAR, ty.inc(TB_ICON_PADDING), 43);
DrawLeftPanelButton(BTN_SELECT, ty.inc(TB_ICON_PADDING), 44);
//DrawLeftPanelButton(BTN_SCREEN, ty.inc(TB_ICON_PADDING), 45);
DrawRectangle3D(5, currentTool*TB_ICON_PADDING+right_bar.y, 16+3+2, 16+3+2, 0x333333, 0x777777);
}
 
/programs/cmm/iconedit/tools/simple_figure.h
23,6 → 23,8
bool first_click_in_canvas = false;
 
void SimpleFigureTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
int x1, y1, x2, y2;
 
if (mouse.down) && (canvas.hovered()) first_click_in_canvas = true;
if (first_click_in_canvas)
{
50,22 → 52,22
if (mouse.up) {
if ((figTool.startX >= 0)
&& (figTool.startY >= 0)) {
 
x1 = figTool.startX - canvas.x/zoom.value;
y1 = figTool.startY - canvas.y/zoom.value;
x2 = mouseX - canvas.x/zoom.value;
y2 = mouseY - canvas.y/zoom.value;
 
// Draw line from start position to current position
if (currentTool == TOOL_LINE) {
DrawLineIcon(figTool.startX - canvas.x/zoom.value,
figTool.startY - canvas.y/zoom.value,
mouseX - canvas.x/zoom.value,
mouseY - canvas.y/zoom.value,
tool_color,
TOIMAGE);
DrawLineIcon(x1, y1, x2, y2, tool_color, TOIMAGE);
}
else if (currentTool == TOOL_RECT) {
DrawRectangleIcon(figTool.startX - canvas.x/zoom.value,
figTool.startY - canvas.y/zoom.value,
mouseX - canvas.x/zoom.value,
mouseY - canvas.y/zoom.value, tool_color,
TOIMAGE);
DrawRectangleIcon(x1, y1, x2, y2, tool_color, TOIMAGE);
}
else if (currentTool == TOOL_BAR) {
DrawBarIcon(x1, y1, x2, y2, tool_color, TOIMAGE);
}
 
DrawCanvas();
 
82,25 → 84,22
}
 
void SimpleFigureTool_onCanvasDraw() {
int x1, y1, x2, y2;
if ((figTool.startX >= 0)
&& (figTool.startY >= 0) && (mouse.key)) {
if (currentTool == TOOL_LINE) {
DrawLineIcon(figTool.startX - canvas.x/zoom.value,
figTool.startY - canvas.y/zoom.value,
mouseX_last - canvas.x/zoom.value,
mouseY_last - canvas.y/zoom.value,
tool_color,
TOCANVAS);
}
else if (currentTool == TOOL_RECT) {
DrawRectangleIcon(figTool.startX - canvas.x/zoom.value,
figTool.startY - canvas.y/zoom.value,
mouseX_last - canvas.x/zoom.value,
mouseY_last - canvas.y/zoom.value,
tool_color,
TOCANVAS);
}
 
x1 = figTool.startX - canvas.x/zoom.value;
y1 = figTool.startY - canvas.y/zoom.value;
x2 = mouseX_last - canvas.x/zoom.value;
y2 = mouseY_last - canvas.y/zoom.value;
 
if (currentTool == TOOL_LINE)
DrawLineIcon(x1, y1, x2, y2, tool_color, TOCANVAS);
else if (currentTool == TOOL_RECT)
DrawRectangleIcon(x1, y1, x2, y2, tool_color, TOCANVAS);
else if (currentTool == TOOL_BAR)
DrawBarIcon(x1, y1, x2, y2, tool_color, TOCANVAS);
 
figTool.lastTempPosX = mouseX_last - canvas.x/zoom.value;
figTool.lastTempPosY = mouseY_last - canvas.y/zoom.value;
}
178,3 → 177,15
DrawLineIcon(x1, y2, x1, y1, color, target);
}
 
void DrawBarIcon(int x1, int y1, int x2, int y2, dword color, int target) {
signed signY;
if (y1 < y2)
signY = 1;
else
signY = -1;
 
while (y1 != y2+signY) {
DrawLineIcon(x1, y1, x2, y1, color, target);
y1 += signY;
}
}
/programs/cmm/iconedit/tools.h
13,7 → 13,7
 
int previousTool = -1;
int currentTool = -1;
Tool tools[6];
Tool tools[7];
 
enum {
TOOL_NONE = -1,
22,6 → 22,7
TOOL_FILL,
TOOL_LINE,
TOOL_RECT,
TOOL_BAR,
TOOL_SELECT
};
#include "tools/pencil.h";
33,35 → 34,41
 
void initTools()
{
tools[0].id = TOOL_PENCIL;
tools[0].onMouseEvent = #PencilTool_onMouseEvent;
tools[0].deactivate = #PencilTool_reset;
tools[TOOL_PENCIL].id = TOOL_PENCIL;
tools[TOOL_PENCIL].onMouseEvent = #PencilTool_onMouseEvent;
tools[TOOL_PENCIL].deactivate = #PencilTool_reset;
tools[1].id = TOOL_PIPETTE;
tools[1].activate = #PipetteTool_activate;
tools[1].onMouseEvent = #PipetteTool_onMouseEvent;
tools[TOOL_PIPETTE].id = TOOL_PIPETTE;
tools[TOOL_PIPETTE].activate = #PipetteTool_activate;
tools[TOOL_PIPETTE].onMouseEvent = #PipetteTool_onMouseEvent;
tools[2].id = TOOL_FILL;
tools[2].onMouseEvent = #FillTool_onMouseEvent;
tools[TOOL_FILL].id = TOOL_FILL;
tools[TOOL_FILL].onMouseEvent = #FillTool_onMouseEvent;
tools[3].id = TOOL_LINE;
tools[3].activate = #SimpleFigureTool_Reset;
tools[3].deactivate = #SimpleFigureTool_Reset;
tools[3].onMouseEvent = #SimpleFigureTool_onMouseEvent;
tools[3].onCanvasDraw = #SimpleFigureTool_onCanvasDraw;
tools[TOOL_LINE].id = TOOL_LINE;
tools[TOOL_LINE].activate = #SimpleFigureTool_Reset;
tools[TOOL_LINE].deactivate = #SimpleFigureTool_Reset;
tools[TOOL_LINE].onMouseEvent = #SimpleFigureTool_onMouseEvent;
tools[TOOL_LINE].onCanvasDraw = #SimpleFigureTool_onCanvasDraw;
tools[4].id = TOOL_RECT;
tools[4].activate = #SimpleFigureTool_Reset;
tools[4].deactivate = #SimpleFigureTool_Reset;
tools[4].onMouseEvent = #SimpleFigureTool_onMouseEvent;
tools[4].onCanvasDraw = #SimpleFigureTool_onCanvasDraw;
tools[TOOL_RECT].id = TOOL_RECT;
tools[TOOL_RECT].activate = #SimpleFigureTool_Reset;
tools[TOOL_RECT].deactivate = #SimpleFigureTool_Reset;
tools[TOOL_RECT].onMouseEvent = #SimpleFigureTool_onMouseEvent;
tools[TOOL_RECT].onCanvasDraw = #SimpleFigureTool_onCanvasDraw;
 
tools[5].id = TOOL_SELECT;
tools[5].activate = #SelectTool_activate;
tools[5].deactivate = #SelectTool_deactivate;
tools[5].onMouseEvent = #SelectTool_onMouseEvent;
tools[5].onCanvasDraw = #SelectTool_onCanvasDraw;
tools[5].onKeyEvent = #SelectTool_onKeyEvent;
tools[TOOL_BAR].id = TOOL_BAR;
tools[TOOL_BAR].activate = #SimpleFigureTool_Reset;
tools[TOOL_BAR].deactivate = #SimpleFigureTool_Reset;
tools[TOOL_BAR].onMouseEvent = #SimpleFigureTool_onMouseEvent;
tools[TOOL_BAR].onCanvasDraw = #SimpleFigureTool_onCanvasDraw;
 
tools[TOOL_SELECT].id = TOOL_SELECT;
tools[TOOL_SELECT].activate = #SelectTool_activate;
tools[TOOL_SELECT].deactivate = #SelectTool_deactivate;
tools[TOOL_SELECT].onMouseEvent = #SelectTool_onMouseEvent;
tools[TOOL_SELECT].onCanvasDraw = #SelectTool_onCanvasDraw;
tools[TOOL_SELECT].onKeyEvent = #SelectTool_onKeyEvent;
}
 
 
85,9 → 92,3
DrawCanvas();
}
 
//===================================================//
// //
// FUNTIONS //
// //
//===================================================//