blob: 97f335c150410cce6e3f8050465008862e072690 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <assert.h>
#include "tools.h"
#include "types.h"
#include "action.h"
#include "canvas.h"
#include "ui.h"
uint8 tool_cur;
static uint8 prev_tool;
/* TODO: Move to config.h */
uint8 tool_array[] = {
TOOL_TYPE_PENCIL,
TOOL_TYPE_ERASER,
TOOL_TYPE_FILL,
TOOL_TYPE_CPICKER,
TOOL_TYPE_ZOOMOUT,
TOOL_TYPE_ZOOMIN,
TOOL_TYPE_UNDO,
TOOL_TYPE_CLOWN,
TOOL_TYPE_REDO,
};
void
tool_change(uint8 t)
{
if (t != tool_cur) {
canvas_mousel_up(cur_canvas);
assert(t < tool_array_size());
t = (t < tool_array_size()) ? t : tool_array_size() - 1;
tool_cur = t;
ui_redraw_panel(UI_PANELTYPE_BUTTONS);
}
}
uint8
tool_array_size()
{
return (sizeof tool_array / sizeof *tool_array);
}
|