IconEdit 0.51: tools cursor support
git-svn-id: svn://kolibrios.org@7262 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
db0198fa2d
commit
2c8b040e97
Binary file not shown.
After Width: | Height: | Size: 766 B |
Binary file not shown.
After Width: | Height: | Size: 766 B |
Binary file not shown.
After Width: | Height: | Size: 766 B |
|
@ -16,6 +16,7 @@ pipet aside color view
|
|||
#include "../lib/gui.h"
|
||||
#include "../lib/random.h"
|
||||
#include "../lib/mem.h"
|
||||
#include "../lib/cursor.h"
|
||||
|
||||
#include "../lib/obj/libimg.h"
|
||||
#include "../lib/obj/box_lib.h"
|
||||
|
@ -31,7 +32,7 @@ pipet aside color view
|
|||
// //
|
||||
//===================================================//
|
||||
|
||||
#define T_TITLE "Icon Editor 0.50 Alpha"
|
||||
#define T_TITLE "Icon Editor 0.51 Alpha"
|
||||
|
||||
#define TOOLBAR_H 24+8
|
||||
#define PANEL_LEFT_W 16+5+5+3+3
|
||||
|
@ -114,6 +115,15 @@ dword last_used_colors[13*2] = {
|
|||
0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF
|
||||
};
|
||||
|
||||
CustomCursor Cursor;
|
||||
dword CursorBar = FROM "cursors/bar.cur";
|
||||
dword CursorFill = FROM "cursors/fill.cur";
|
||||
dword CursorLine = FROM "cursors/line.cur";
|
||||
dword CursorPencil = FROM "cursors/pencil.cur";
|
||||
dword CursorPipette = FROM "cursors/pipette.cur";
|
||||
dword CursorRectangle = FROM "cursors/rectangle.cur";
|
||||
dword CursorSelect = FROM "cursors/select.cur";
|
||||
|
||||
_image image;
|
||||
|
||||
#include "actions_history.h"
|
||||
|
@ -200,6 +210,9 @@ void main()
|
|||
DrawEditArea();
|
||||
}
|
||||
|
||||
if (wrapper.hovered()) SetCursor();
|
||||
else Cursor.Restore();
|
||||
|
||||
if (mouse.down) {
|
||||
if (b_color_gradient.hovered())
|
||||
|| (b_last_colors.hovered())
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
struct Tool {
|
||||
int id;
|
||||
dword cursor;
|
||||
void (*activate)();
|
||||
void (*deactivate)();
|
||||
void (*onMouseEvent)(int x, int y, int lkm, int pkm);
|
||||
|
@ -37,35 +38,42 @@ enum {
|
|||
void initTools()
|
||||
{
|
||||
tools[TOOL_PENCIL].id = TOOL_PENCIL;
|
||||
tools[TOOL_PENCIL].cursor = #CursorPencil;
|
||||
tools[TOOL_PENCIL].onMouseEvent = #PencilTool_onMouseEvent;
|
||||
tools[TOOL_PENCIL].deactivate = #PencilTool_reset;
|
||||
|
||||
tools[TOOL_PIPETTE].id = TOOL_PIPETTE;
|
||||
tools[TOOL_PIPETTE].cursor = #CursorPipette;
|
||||
tools[TOOL_PIPETTE].activate = #PipetteTool_activate;
|
||||
tools[TOOL_PIPETTE].onMouseEvent = #PipetteTool_onMouseEvent;
|
||||
|
||||
tools[TOOL_FILL].id = TOOL_FILL;
|
||||
tools[TOOL_FILL].cursor = #CursorFill;
|
||||
tools[TOOL_FILL].onMouseEvent = #FillTool_onMouseEvent;
|
||||
|
||||
tools[TOOL_LINE].id = TOOL_LINE;
|
||||
tools[TOOL_LINE].cursor = #CursorLine;
|
||||
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[TOOL_RECT].id = TOOL_RECT;
|
||||
tools[TOOL_RECT].cursor = #CursorRectangle;
|
||||
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[TOOL_BAR].id = TOOL_BAR;
|
||||
tools[TOOL_BAR].cursor = #CursorBar;
|
||||
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].cursor = #CursorSelect;
|
||||
tools[TOOL_SELECT].activate = #SelectTool_activate;
|
||||
tools[TOOL_SELECT].deactivate = #SelectTool_deactivate;
|
||||
tools[TOOL_SELECT].onMouseEvent = #SelectTool_onMouseEvent;
|
||||
|
@ -73,6 +81,7 @@ void initTools()
|
|||
tools[TOOL_SELECT].onKeyEvent = #SelectTool_onKeyEvent;
|
||||
|
||||
tools[TOOL_SCREEN_COPY].id = TOOL_SCREEN_COPY;
|
||||
tools[TOOL_SCREEN_COPY].cursor = NULL;
|
||||
tools[TOOL_SCREEN_COPY].activate = #ScreenCopy_activate;
|
||||
tools[TOOL_SCREEN_COPY].onMouseEvent = #ScreenCopy_onMouseEvent;
|
||||
}
|
||||
|
@ -94,7 +103,16 @@ void setCurrentTool(int index) {
|
|||
if ((index != TOOL_NONE) && (tools[index].activate != 0))
|
||||
tools[index].activate();
|
||||
|
||||
Cursor.Restore();
|
||||
if (wrapper.hovered()) SetCursor();
|
||||
DrawLeftPanel();
|
||||
DrawCanvas();
|
||||
}
|
||||
|
||||
void SetCursor()
|
||||
{
|
||||
if (tools[currentTool].cursor) && (!Cursor.CursorPointer) {
|
||||
Cursor.Load(tools[currentTool].cursor);
|
||||
Cursor.Set();
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ void PipetteTool_activate() {
|
|||
}
|
||||
|
||||
void PipetteTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
|
||||
//if (!canvas.hovered()) return; //TODO: option "Restrict pipette to canvas area"
|
||||
if (!canvas.hovered()) return; //TODO: option "Restrict pipette to canvas area"
|
||||
tool_color = GetPixelUnderMouse();
|
||||
DrawBar(Form.cwidth-30, 5, 20, 20, tool_color);
|
||||
|
||||
|
|
|
@ -37,10 +37,12 @@ dword CustomCursor::Set()
|
|||
|
||||
dword CustomCursor::Restore()
|
||||
{
|
||||
if (!CursorPointer) return;
|
||||
EAX = 37;
|
||||
EBX = 5;
|
||||
ECX = 0;
|
||||
$int 0x40
|
||||
CursorPointer = 0;
|
||||
}
|
||||
|
||||
void CustomCursor::Delete()
|
||||
|
|
Loading…
Reference in New Issue