-
Notifications
You must be signed in to change notification settings - Fork 3
/
mddo.c
144 lines (131 loc) · 3.73 KB
/
mddo.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
* CFLIB, a GEM library for ATARI/TOS
* Copyright (C) 1999, 2000 Christian Felsch
*
* Modified for FreeMiNT CVS by Frank Naumann <fnaumann@freemint.de>
*
* 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"
_WORD do_mdial(MDIAL *dial)
{
_WORD msg[8], mx, my, mbutton, kstate, kreturn, breturn, event, ret;
_WORD cont, b, doppel = FALSE;
ret = -1;
if (dial != NULL)
{
cont = TRUE;
while (cont)
{
event = evnt_multi(MU_MESAG | MU_BUTTON | MU_KEYBD,
2, 1, 1,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
msg,
#if defined(__PUREC__) && !defined(_GEMLIB_COMPATIBLE)
0, 0,
#else
0,
#endif
&mx, &my, &mbutton, &kstate, &kreturn, &breturn);
if (event & MU_MESAG)
{
switch (msg[0])
{
case WM_REDRAW:
case WM_MOVED:
case WM_SIZED:
handle_mdial_msg(msg);
break;
case WM_TOPPED:
#if 0
if (msg[3] != dial->win_handle)
Bconout(2, 7);
#endif
/* fall through */
case WM_NEWTOP:
case WM_ONTOP:
/* immer den Dialog toppen! */
wind_set(dial->win_handle, WF_TOP, 0, 0, 0, 0);
break;
case WM_BOTTOMED:
case WF_M_BACKDROP: /* WM_M_BACKDROPED MagiC 2.x */
Bconout(2, 7);
break;
case WM_SHADED:
case WM_UNSHADED:
dial->is_shaded = !dial->is_shaded;
break;
case AP_TERM: /* sofort verlassen */
event = 0;
cont = FALSE;
dial->next_obj = -1;
break;
}
}
if ((event & MU_KEYBD) && (!dial->is_shaded))
{
cont = cf_form_keybd(dial->tree, dial->edit_obj, kstate, &kreturn, &dial->next_obj);
if (cont) /* kein Exit-Obj ausgeloest */
{
if (dial->next_obj != dial->edit_obj && (dial->tree[dial->next_obj].ob_flags & OF_EDITABLE))
{
/* kein Exit-Obj aber neues Edit-Obj */
objc_edit(dial->tree, dial->edit_obj, 0, &dial->edit_idx, ED_END);
dial->edit_obj = dial->next_obj;
dial->edit_idx = -1;
objc_edit(dial->tree, dial->edit_obj, 0, &dial->edit_idx, ED_INIT);
}
if (kreturn)
cf_objc_edit(dial->tree, dial->edit_obj, kreturn, &dial->edit_idx, ED_CHAR, kstate, &b);
}
}
if (event & MU_BUTTON)
{
dial->next_obj = cf_objc_find(dial->tree, ROOT, MAX_DEPTH, mx, my);
if (dial->next_obj == -1)
{
Bconout(2, 7);
dial->next_obj = 0;
}
else
{
doppel = (breturn == 2);
cont = form_button(dial->tree, dial->next_obj, mbutton, &dial->next_obj);
if (cont && (dial->tree[dial->next_obj].ob_flags & OF_EDITABLE))
{
/* kein Exit-Obj aber neues Edit-Obj */
objc_edit(dial->tree, dial->edit_obj, 0, &dial->edit_idx, ED_END);
dial->edit_obj = dial->next_obj;
/* FIXME: ED_CRSR = ?, Guido. */
if (gl_magx)
objc_edit(dial->tree, dial->edit_obj, mx, &dial->edit_idx, ED_CRSR);
else
objc_edit(dial->tree, dial->edit_obj, 0, &dial->edit_idx, ED_INIT);
}
}
}
}
ret = dial->next_obj;
}
if (doppel)
ret |= 0x8000; /* bit 15 fuer Doppelklick */
return ret;
}