IconEdit 0.49: draw bar tool (filled rectangle)
git-svn-id: svn://kolibrios.org@7259 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0096ee123b
commit
5959be0518
Binary file not shown.
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
@ -14,22 +14,24 @@
|
|||
|
||||
/* === TRANSLATIONS === */
|
||||
|
||||
#define T_WTITLE "EasyShot v1.0"
|
||||
#define T_WTITLE "EasyShot v1.1"
|
||||
|
||||
#ifdef LANG_RUS
|
||||
?define T_TAKE_SCREENSHOT " ‘¤¥« âì áªà¨è®â"
|
||||
?define T_SETTINGS "<EFBFBD> áâனª¨"
|
||||
?define T_EDITBOX_FRAME " <20>ãâì á®åà ¥¨ï áªà¨è®â "
|
||||
?define T_DELAY "‡ ¤¥à¦ª ¢ ᥪ㤠å"
|
||||
?define T_MINIMIZE "‘¢¥àãâì ®ª® ¯à¨ ᨬª¥"
|
||||
?define T_CONTINUOUS_SHOOTING "Continuous shooting"
|
||||
?define T_DELAY "‡ ¤¥à¦ª ¢ ᥪ㤠å"
|
||||
?define T_NO_DIR "'<27> ¯ª ¥ áãé¥áâ¢ã¥â!' -E"
|
||||
?define T_SET_PATH "‡ ¤ âì"
|
||||
#else
|
||||
?define T_TAKE_SCREENSHOT " Take a screenshot"
|
||||
?define T_SETTINGS "Settings"
|
||||
?define T_EDITBOX_FRAME " Save path "
|
||||
?define T_DELAY "Delay in seconds"
|
||||
?define T_MINIMIZE "Minimize window"
|
||||
?define T_CONTINUOUS_SHOOTING "Continuous shooting"
|
||||
?define T_DELAY "Delay in seconds"
|
||||
?define T_NO_DIR "'Directory does not exists!' -E"
|
||||
?define T_SET_PATH "Set"
|
||||
#endif
|
||||
|
@ -58,6 +60,7 @@ edit_box edit_save = {250,25,100,0xffffff,0x94AECE,0xFFFfff,0xffffff,
|
|||
|
||||
more_less_box delay = { 1, 0, 64, T_DELAY };
|
||||
checkbox minimize = { T_MINIMIZE, true };
|
||||
checkbox continuous_shooting = { T_CONTINUOUS_SHOOTING, true };
|
||||
|
||||
|
||||
opendialog open_folder_dialog =
|
||||
|
@ -128,7 +131,7 @@ void main()
|
|||
void DrawMainContent()
|
||||
{
|
||||
int take_scr_btn_width;
|
||||
take_scr_btn_width = DrawIconButton(PD, PD, BTN_MAKE_SCREENSHOT, T_TAKE_SCREENSHOT, 44);
|
||||
take_scr_btn_width = DrawIconButton(PD, PD, BTN_MAKE_SCREENSHOT, T_TAKE_SCREENSHOT, 45);
|
||||
DrawIconButton(PD+take_scr_btn_width, PD, BTN_SETTINGS, " ", 10);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ pipet aside color view
|
|||
// //
|
||||
//===================================================//
|
||||
|
||||
#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 @@ enum {
|
|||
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 @@ void main()
|
|||
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 @@ void main()
|
|||
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 @@ void DrawLeftPanel()
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ struct Tool {
|
|||
|
||||
int previousTool = -1;
|
||||
int currentTool = -1;
|
||||
Tool tools[6];
|
||||
Tool tools[7];
|
||||
|
||||
enum {
|
||||
TOOL_NONE = -1,
|
||||
|
@ -22,6 +22,7 @@ enum {
|
|||
TOOL_FILL,
|
||||
TOOL_LINE,
|
||||
TOOL_RECT,
|
||||
TOOL_BAR,
|
||||
TOOL_SELECT
|
||||
};
|
||||
#include "tools/pencil.h";
|
||||
|
@ -33,35 +34,41 @@ enum {
|
|||
|
||||
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 @@ void setCurrentTool(int index) {
|
|||
DrawCanvas();
|
||||
}
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// FUNTIONS //
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ int mouseY_last;
|
|||
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,21 +52,21 @@ void SimpleFigureTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
|
|||
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,24 +84,21 @@ void SimpleFigureTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
|
|||
}
|
||||
|
||||
void SimpleFigureTool_onCanvasDraw() {
|
||||
if ((figTool.startX >= 0)
|
||||
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 @@ void DrawRectangleIcon(int x1, int y1, int x2, int y2, dword color, int target)
|
|||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue