-
Notifications
You must be signed in to change notification settings - Fork 3
/
mdmesag.c
105 lines (93 loc) · 2.35 KB
/
mdmesag.c
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* CFLIB, a GEM library for ATARI/TOS
* Copyright (C) 1999, 2000 Christian Felsch
*
* Modified for FreeMiNT CVS by Frank Naumann <[email protected]>
*
* Please send suggestions, patches or bug reports to me or
* the MiNT mailing list.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "mdial.h"
/* FIXME: identical to wdial_draw_cursor? */
void redraw_mdial_cursor(MDIAL *dial)
{
if (dial->edit_obj > 0)
{
GRECT r;
objc_edit(dial->tree, dial->edit_obj, 0, &dial->edit_idx, ED_INIT);
get_objframe(dial->tree, dial->edit_obj, &r);
redraw_mdial(dial, ROOT, MAX_DEPTH, r.g_x, r.g_y - 3, r.g_w + 1, r.g_h + 6);
objc_edit(dial->tree, dial->edit_obj, 0, &dial->edit_idx, ED_INIT);
}
}
static void move_dial(MDIAL *dial, _WORD x, _WORD y)
{
GRECT r;
wind_get_grect(dial->win_handle, WF_CURRXYWH, &r);
r.g_x = x;
r.g_y = y;
wind_set_grect(dial->win_handle, WF_CURRXYWH, &r);
wind_get_grect(dial->win_handle, WF_WORKXYWH, &r);
dial->tree[0].ob_x = r.g_x;
dial->tree[0].ob_y = r.g_y - dial->delta_y;
}
static _WORD handle_msg(_WORD *msg)
{
MDIAL *md;
_WORD ret = FALSE;
md = __mdial_md_list;
while (md)
{
if (msg[3] == md->win_handle)
break;
md = md->next;
}
if (md)
{
switch (msg[0])
{
case WM_REDRAW:
redraw_mdial(md, ROOT, MAX_DEPTH, msg[4], msg[5], msg[6], msg[7]);
redraw_mdial_cursor(md);
ret = TRUE;
break;
case WM_MOVED:
move_dial(md, msg[4], msg[5]);
ret = TRUE;
break;
}
}
return ret;
}
void handle_mdial_msg(_WORD *msg)
{
if (!handle_msg(msg) && __mdial_win_cb)
{
switch (msg[0])
{
case WM_REDRAW:
case WM_MOVED:
case WM_SIZED:
__mdial_win_cb(msg);
break;
default:
;
}
}
}