Home » Archimedes archive » Archimedes World » archimedes_world_volume_14_issue_12_scp.adf » !AcornAns_AcornAns » !Brolly/c/mdbx
!Brolly/c/mdbx
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Archimedes World » archimedes_world_volume_14_issue_12_scp.adf » !AcornAns_AcornAns |
Filename: | !Brolly/c/mdbx |
Read OK: | ✔ |
File size: | 18A1 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "kernel.h" #include "dbox.h" #include "help.h" #include "wimpt.h" #include "werr.h" #include "wimp_misc.h" #include "mdbx.h" #include "swis.h" void mdbx_setfield(wimp_w w, wimp_i i, char *text) { wimp_icon info; wimp_caretstr crt; if (wimp_get_icon_info(w, i, &info)) return; if ((info.flags & (wimp_ITEXT | wimp_INDIRECT)) != (wimp_ITEXT | wimp_INDIRECT)) return; memset( strncpy(info.data.indirecttext.buffer, text, info.data.indirecttext.bufflen) +info.data.indirecttext.bufflen-1, 0, 1 ); wimpt_noerr(wimp_get_caret_pos(&crt)); if (crt.w==w && crt.i==i) { crt.height=-1; crt.index=-1; wimpt_noerr(wimp_set_caret_pos(&crt)); } wimpt_noerr(wimp_set_icon_state(w, i, 0, 0)); return; } void mdbx_getfield(wimp_w w, wimp_i i, char *buf, int size) { wimp_icon info; memset(buf, 0, 1); if (wimp_get_icon_info(w, i, &info)) return; if ((info.flags & wimp_ITEXT) != wimp_ITEXT) return; if (info.flags & wimp_INDIRECT) { strncpy(buf, info.data.indirecttext.buffer, size); } else { strncpy(buf, info.data.text, size); } return; } void mdbx_setnumeric(wimp_w w, wimp_i i, int v) { char buf[256]; sprintf(buf, "%i\0", v); mdbx_setfield(w, i, buf); return; } /*--- return false if field empty ---*/ BOOL mdbx_getnumeric(wimp_w w, wimp_i i, int *v) { char buf[256], *buff_end; mdbx_getfield(w, i, buf, 256); *v = (int)strtol(buf, &buff_end, 10); return (buf==buff_end) ? FALSE : TRUE; } void mdbx_setdouble(wimp_w w, wimp_i i, double v) { char buf[256]; sprintf(buf, "%g\0", v); mdbx_setfield(w, i, buf); return; } BOOL mdbx_getdouble(wimp_w w, wimp_i i, double *v) { char buf[256], *buff_end; mdbx_getfield(w, i, buf, 256); *v = strtod(buf, &buff_end); return (buf==buff_end) ? FALSE : TRUE; } void mdbx_fadefield(wimp_w w, wimp_i i) { wimpt_complain(wimp_set_icon_state(w, i, wimp_INOSELECT, wimp_INOSELECT)); } void mdbx_unfadefield(wimp_w w, wimp_i i) { wimpt_complain(wimp_set_icon_state(w, i, 0, wimp_INOSELECT)); } /*get double from field; if in limits, update vble, else update field*/ void mdbx_updatedouble(wimp_w w, wimp_i i, double *r, double min, double max, char *c) { double result; if (mdbx_getdouble(w, i, &result)) if (result>=min && result<=max) {*r=result; return;} if (c) werr(0,"Parameter out of range '%s' must lie between %g & %g", c, min, max); mdbx_setdouble(w, i, *r); return; } /* read field, & if new text is different, set field*/ void mdbx_updatefield(wimp_w w, wimp_i i, char *text) { char buf[256]; mdbx_getfield(w, i, buf, 256); if (strncmp(buf, text, 256)) mdbx_setfield(w, i, text); } #define mdbxquery_FYes 0 /* action */ #define mdbxquery_FMsg 1 /* string output */ #define mdbxquery_FNo 2 /* action */ #define mdbxquery_FAlt 3 /* action */ static dbox q = 0; static int last_option = 0; /* * The following is a modified Acorn RISC_OSLib fn; I changed it to select the chosen icon (not otherwise * done, if the choice was via a key press), automatically after dbox_fillin returns; this gives an * immediate feedback confirming the user's choice. * * This also seems to give a particularly satisfying feel when slabbed icons are being used. * * Michael Rozdoba, 28/3/93. * * 4/4/93 - added support for interactive help * also, allow caller specified strings for action buttons * plus wimp bug work-around to handle cases where exit follows shortly in response to this dbox * this also involves restricting the ptr to the dbox (to tidy up a few possible loose ends, * ie potential inconsistent program behaviour of a minor nature, which is more likely to arise * otherwise). * 6/4/93 - allow choice between 2 & 3 option dialogue. * */ mdbxquery_REPLY mdbx_query(char *question, char *yes, char *no, char *alt, int options) { dbox_field answer; dbox_field select; char box_name[]="query "; if (options!=3) options=2; if (last_option!=options && q) { dbox_dispose(&q); q=0; } last_option=options; box_name[strlen(box_name)-1]='0'+options; if (q == 0) q = dbox_new(box_name); if (q == 0) return mdbxquery_CANCEL; /* out of space */ if (question == 0 || question[0] == 0) return mdbxquery_CANCEL; dbox_raw_eventhandler(q, help_dboxrawevents, "QUERY"); dbox_setfield(q, mdbxquery_FMsg, question); dbox_setfield(q, mdbxquery_FYes, yes); dbox_setfield(q, mdbxquery_FNo, no); if (options==3) dbox_setfield(q, mdbxquery_FAlt, alt); dbox_show(q); pointer_restrict(dbox_syshandle(q)); /* nb this cuts down the chance of event_process calling program code which might not behave quite as it * should (as we will have modified event_mask), during the wait for mouse button release; without this, * ptr enter/leave events on windows may be generated after we have tampered with event_mask (this * wouldn't likely do anything any more serious than, spoiling the consistent behaviour of the program, * ie larely cosmetic anyway). */ answer = dbox_fillin(q); select = (answer==mdbxquery_FYes || answer==mdbxquery_FNo || answer==mdbxquery_FAlt) ? answer : mdbxquery_FNo; wimpt_complain(wimp_set_icon_state(dbox_syshandle(q), select, wimp_ISELECTED, wimp_ISELECTED)); { /* this seems to get around wimp bug which acorn's work around usually won't solve if applied after * the window is hidden, ie after this function returns */ _kernel_swi_regs r; wimp_emask old_mask=event_getmask(); event_setmask(0); /*-- set event mask to 0 --*/ do /*-- read mouse state until buttons are released --*/ { _kernel_swi(OS_Mouse,&r,&r); event_process(); /*-- give wimp chance to sort itself out --*/ } while(r.r[2] != 0); event_setmask(old_mask); } pointer_restrict((wimp_w)-1); dbox_hide(q); wimpt_complain(wimp_set_icon_state(dbox_syshandle(q), select, 0, wimp_ISELECTED)); dbox_dispose(&q); q=0; switch (answer) { case mdbxquery_FYes: return mdbxquery_YES; case mdbxquery_FNo : return mdbxquery_NO; case mdbxquery_FAlt: return mdbxquery_ALT; default : return mdbxquery_CANCEL; } }
00000000 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e |#include <stdio.| 00000010 68 3e 0a 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 |h>.#include <std| 00000020 6c 69 62 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20 |lib.h>.#include | 00000030 3c 73 74 72 69 6e 67 2e 68 3e 0a 0a 23 69 6e 63 |<string.h>..#inc| 00000040 6c 75 64 65 20 22 6b 65 72 6e 65 6c 2e 68 22 0a |lude "kernel.h".| 00000050 23 69 6e 63 6c 75 64 65 20 22 64 62 6f 78 2e 68 |#include "dbox.h| 00000060 22 0a 23 69 6e 63 6c 75 64 65 20 22 68 65 6c 70 |".#include "help| 00000070 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 22 77 69 |.h".#include "wi| 00000080 6d 70 74 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 |mpt.h".#include | 00000090 22 77 65 72 72 2e 68 22 0a 0a 23 69 6e 63 6c 75 |"werr.h"..#inclu| 000000a0 64 65 20 22 77 69 6d 70 5f 6d 69 73 63 2e 68 22 |de "wimp_misc.h"| 000000b0 0a 23 69 6e 63 6c 75 64 65 20 22 6d 64 62 78 2e |.#include "mdbx.| 000000c0 68 22 0a 23 69 6e 63 6c 75 64 65 20 22 73 77 69 |h".#include "swi| 000000d0 73 2e 68 22 0a 0a 76 6f 69 64 20 6d 64 62 78 5f |s.h"..void mdbx_| 000000e0 73 65 74 66 69 65 6c 64 28 77 69 6d 70 5f 77 20 |setfield(wimp_w | 000000f0 77 2c 20 77 69 6d 70 5f 69 20 69 2c 20 63 68 61 |w, wimp_i i, cha| 00000100 72 20 2a 74 65 78 74 29 0a 7b 0a 20 20 77 69 6d |r *text).{. wim| 00000110 70 5f 69 63 6f 6e 20 69 6e 66 6f 3b 0a 20 20 77 |p_icon info;. w| 00000120 69 6d 70 5f 63 61 72 65 74 73 74 72 20 63 72 74 |imp_caretstr crt| 00000130 3b 0a 20 20 69 66 20 28 77 69 6d 70 5f 67 65 74 |;. if (wimp_get| 00000140 5f 69 63 6f 6e 5f 69 6e 66 6f 28 77 2c 20 69 2c |_icon_info(w, i,| 00000150 20 26 69 6e 66 6f 29 29 20 72 65 74 75 72 6e 3b | &info)) return;| 00000160 0a 20 20 69 66 20 28 28 69 6e 66 6f 2e 66 6c 61 |. if ((info.fla| 00000170 67 73 20 26 20 28 77 69 6d 70 5f 49 54 45 58 54 |gs & (wimp_ITEXT| 00000180 20 7c 20 77 69 6d 70 5f 49 4e 44 49 52 45 43 54 | | wimp_INDIRECT| 00000190 29 29 20 21 3d 20 28 77 69 6d 70 5f 49 54 45 58 |)) != (wimp_ITEX| 000001a0 54 20 7c 20 77 69 6d 70 5f 49 4e 44 49 52 45 43 |T | wimp_INDIREC| 000001b0 54 29 29 20 72 65 74 75 72 6e 3b 0a 20 20 6d 65 |T)) return;. me| 000001c0 6d 73 65 74 28 0a 20 20 20 20 73 74 72 6e 63 70 |mset(. strncp| 000001d0 79 28 69 6e 66 6f 2e 64 61 74 61 2e 69 6e 64 69 |y(info.data.indi| 000001e0 72 65 63 74 74 65 78 74 2e 62 75 66 66 65 72 2c |recttext.buffer,| 000001f0 20 74 65 78 74 2c 20 69 6e 66 6f 2e 64 61 74 61 | text, info.data| 00000200 2e 69 6e 64 69 72 65 63 74 74 65 78 74 2e 62 75 |.indirecttext.bu| 00000210 66 66 6c 65 6e 29 0a 20 20 20 20 2b 69 6e 66 6f |fflen). +info| 00000220 2e 64 61 74 61 2e 69 6e 64 69 72 65 63 74 74 65 |.data.indirectte| 00000230 78 74 2e 62 75 66 66 6c 65 6e 2d 31 2c 20 30 2c |xt.bufflen-1, 0,| 00000240 20 31 0a 20 20 29 3b 0a 20 20 77 69 6d 70 74 5f | 1. );. wimpt_| 00000250 6e 6f 65 72 72 28 77 69 6d 70 5f 67 65 74 5f 63 |noerr(wimp_get_c| 00000260 61 72 65 74 5f 70 6f 73 28 26 63 72 74 29 29 3b |aret_pos(&crt));| 00000270 0a 20 20 69 66 20 28 63 72 74 2e 77 3d 3d 77 20 |. if (crt.w==w | 00000280 26 26 20 63 72 74 2e 69 3d 3d 69 29 0a 20 20 7b |&& crt.i==i). {| 00000290 0a 20 20 20 20 63 72 74 2e 68 65 69 67 68 74 3d |. crt.height=| 000002a0 2d 31 3b 0a 20 20 20 20 63 72 74 2e 69 6e 64 65 |-1;. crt.inde| 000002b0 78 3d 2d 31 3b 0a 20 20 20 20 77 69 6d 70 74 5f |x=-1;. wimpt_| 000002c0 6e 6f 65 72 72 28 77 69 6d 70 5f 73 65 74 5f 63 |noerr(wimp_set_c| 000002d0 61 72 65 74 5f 70 6f 73 28 26 63 72 74 29 29 3b |aret_pos(&crt));| 000002e0 0a 20 20 7d 0a 20 20 77 69 6d 70 74 5f 6e 6f 65 |. }. wimpt_noe| 000002f0 72 72 28 77 69 6d 70 5f 73 65 74 5f 69 63 6f 6e |rr(wimp_set_icon| 00000300 5f 73 74 61 74 65 28 77 2c 20 69 2c 20 30 2c 20 |_state(w, i, 0, | 00000310 30 29 29 3b 0a 20 20 72 65 74 75 72 6e 3b 0a 7d |0));. return;.}| 00000320 0a 0a 76 6f 69 64 20 6d 64 62 78 5f 67 65 74 66 |..void mdbx_getf| 00000330 69 65 6c 64 28 77 69 6d 70 5f 77 20 77 2c 20 77 |ield(wimp_w w, w| 00000340 69 6d 70 5f 69 20 69 2c 20 63 68 61 72 20 2a 62 |imp_i i, char *b| 00000350 75 66 2c 20 69 6e 74 20 73 69 7a 65 29 0a 7b 0a |uf, int size).{.| 00000360 20 20 77 69 6d 70 5f 69 63 6f 6e 20 69 6e 66 6f | wimp_icon info| 00000370 3b 0a 20 20 6d 65 6d 73 65 74 28 62 75 66 2c 20 |;. memset(buf, | 00000380 30 2c 20 31 29 3b 0a 20 20 69 66 20 28 77 69 6d |0, 1);. if (wim| 00000390 70 5f 67 65 74 5f 69 63 6f 6e 5f 69 6e 66 6f 28 |p_get_icon_info(| 000003a0 77 2c 20 69 2c 20 26 69 6e 66 6f 29 29 20 72 65 |w, i, &info)) re| 000003b0 74 75 72 6e 3b 0a 20 20 69 66 20 28 28 69 6e 66 |turn;. if ((inf| 000003c0 6f 2e 66 6c 61 67 73 20 26 20 77 69 6d 70 5f 49 |o.flags & wimp_I| 000003d0 54 45 58 54 29 20 21 3d 20 77 69 6d 70 5f 49 54 |TEXT) != wimp_IT| 000003e0 45 58 54 29 20 72 65 74 75 72 6e 3b 0a 20 20 69 |EXT) return;. i| 000003f0 66 20 28 69 6e 66 6f 2e 66 6c 61 67 73 20 26 20 |f (info.flags & | 00000400 77 69 6d 70 5f 49 4e 44 49 52 45 43 54 29 0a 20 |wimp_INDIRECT). | 00000410 20 7b 0a 20 20 20 20 73 74 72 6e 63 70 79 28 62 | {. strncpy(b| 00000420 75 66 2c 20 69 6e 66 6f 2e 64 61 74 61 2e 69 6e |uf, info.data.in| 00000430 64 69 72 65 63 74 74 65 78 74 2e 62 75 66 66 65 |directtext.buffe| 00000440 72 2c 20 73 69 7a 65 29 3b 0a 20 20 7d 0a 20 20 |r, size);. }. | 00000450 65 6c 73 65 0a 20 20 7b 0a 20 20 20 20 73 74 72 |else. {. str| 00000460 6e 63 70 79 28 62 75 66 2c 20 69 6e 66 6f 2e 64 |ncpy(buf, info.d| 00000470 61 74 61 2e 74 65 78 74 2c 20 73 69 7a 65 29 3b |ata.text, size);| 00000480 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 3b 0a 7d |. }. return;.}| 00000490 0a 0a 76 6f 69 64 20 6d 64 62 78 5f 73 65 74 6e |..void mdbx_setn| 000004a0 75 6d 65 72 69 63 28 77 69 6d 70 5f 77 20 77 2c |umeric(wimp_w w,| 000004b0 20 77 69 6d 70 5f 69 20 69 2c 20 69 6e 74 20 76 | wimp_i i, int v| 000004c0 29 0a 7b 0a 20 20 63 68 61 72 20 62 75 66 5b 32 |).{. char buf[2| 000004d0 35 36 5d 3b 0a 20 20 73 70 72 69 6e 74 66 28 62 |56];. sprintf(b| 000004e0 75 66 2c 20 22 25 69 5c 30 22 2c 20 76 29 3b 0a |uf, "%i\0", v);.| 000004f0 20 20 6d 64 62 78 5f 73 65 74 66 69 65 6c 64 28 | mdbx_setfield(| 00000500 77 2c 20 69 2c 20 62 75 66 29 3b 0a 20 20 72 65 |w, i, buf);. re| 00000510 74 75 72 6e 3b 0a 7d 0a 0a 2f 2a 2d 2d 2d 20 72 |turn;.}../*--- r| 00000520 65 74 75 72 6e 20 66 61 6c 73 65 20 69 66 20 66 |eturn false if f| 00000530 69 65 6c 64 20 65 6d 70 74 79 20 2d 2d 2d 2a 2f |ield empty ---*/| 00000540 0a 42 4f 4f 4c 20 6d 64 62 78 5f 67 65 74 6e 75 |.BOOL mdbx_getnu| 00000550 6d 65 72 69 63 28 77 69 6d 70 5f 77 20 77 2c 20 |meric(wimp_w w, | 00000560 77 69 6d 70 5f 69 20 69 2c 20 69 6e 74 20 2a 76 |wimp_i i, int *v| 00000570 29 0a 7b 0a 20 20 63 68 61 72 20 62 75 66 5b 32 |).{. char buf[2| 00000580 35 36 5d 2c 20 2a 62 75 66 66 5f 65 6e 64 3b 0a |56], *buff_end;.| 00000590 20 20 6d 64 62 78 5f 67 65 74 66 69 65 6c 64 28 | mdbx_getfield(| 000005a0 77 2c 20 69 2c 20 62 75 66 2c 20 32 35 36 29 3b |w, i, buf, 256);| 000005b0 0a 20 20 2a 76 20 3d 20 28 69 6e 74 29 73 74 72 |. *v = (int)str| 000005c0 74 6f 6c 28 62 75 66 2c 20 26 62 75 66 66 5f 65 |tol(buf, &buff_e| 000005d0 6e 64 2c 20 31 30 29 3b 0a 20 20 72 65 74 75 72 |nd, 10);. retur| 000005e0 6e 20 28 62 75 66 3d 3d 62 75 66 66 5f 65 6e 64 |n (buf==buff_end| 000005f0 29 20 3f 20 46 41 4c 53 45 20 3a 20 54 52 55 45 |) ? FALSE : TRUE| 00000600 3b 0a 7d 0a 0a 76 6f 69 64 20 6d 64 62 78 5f 73 |;.}..void mdbx_s| 00000610 65 74 64 6f 75 62 6c 65 28 77 69 6d 70 5f 77 20 |etdouble(wimp_w | 00000620 77 2c 20 77 69 6d 70 5f 69 20 69 2c 20 64 6f 75 |w, wimp_i i, dou| 00000630 62 6c 65 20 76 29 0a 7b 0a 20 20 63 68 61 72 20 |ble v).{. char | 00000640 62 75 66 5b 32 35 36 5d 3b 0a 20 20 73 70 72 69 |buf[256];. spri| 00000650 6e 74 66 28 62 75 66 2c 20 22 25 67 5c 30 22 2c |ntf(buf, "%g\0",| 00000660 20 76 29 3b 0a 20 20 6d 64 62 78 5f 73 65 74 66 | v);. mdbx_setf| 00000670 69 65 6c 64 28 77 2c 20 69 2c 20 62 75 66 29 3b |ield(w, i, buf);| 00000680 0a 20 20 72 65 74 75 72 6e 3b 0a 7d 0a 0a 42 4f |. return;.}..BO| 00000690 4f 4c 20 6d 64 62 78 5f 67 65 74 64 6f 75 62 6c |OL mdbx_getdoubl| 000006a0 65 28 77 69 6d 70 5f 77 20 77 2c 20 77 69 6d 70 |e(wimp_w w, wimp| 000006b0 5f 69 20 69 2c 20 64 6f 75 62 6c 65 20 2a 76 29 |_i i, double *v)| 000006c0 0a 7b 0a 20 20 63 68 61 72 20 62 75 66 5b 32 35 |.{. char buf[25| 000006d0 36 5d 2c 20 2a 62 75 66 66 5f 65 6e 64 3b 0a 20 |6], *buff_end;. | 000006e0 20 6d 64 62 78 5f 67 65 74 66 69 65 6c 64 28 77 | mdbx_getfield(w| 000006f0 2c 20 69 2c 20 62 75 66 2c 20 32 35 36 29 3b 0a |, i, buf, 256);.| 00000700 20 20 2a 76 20 3d 20 73 74 72 74 6f 64 28 62 75 | *v = strtod(bu| 00000710 66 2c 20 26 62 75 66 66 5f 65 6e 64 29 3b 0a 20 |f, &buff_end);. | 00000720 20 72 65 74 75 72 6e 20 28 62 75 66 3d 3d 62 75 | return (buf==bu| 00000730 66 66 5f 65 6e 64 29 20 3f 20 46 41 4c 53 45 20 |ff_end) ? FALSE | 00000740 3a 20 54 52 55 45 3b 0a 7d 0a 0a 76 6f 69 64 20 |: TRUE;.}..void | 00000750 6d 64 62 78 5f 66 61 64 65 66 69 65 6c 64 28 77 |mdbx_fadefield(w| 00000760 69 6d 70 5f 77 20 77 2c 20 77 69 6d 70 5f 69 20 |imp_w w, wimp_i | 00000770 69 29 0a 7b 0a 20 20 77 69 6d 70 74 5f 63 6f 6d |i).{. wimpt_com| 00000780 70 6c 61 69 6e 28 77 69 6d 70 5f 73 65 74 5f 69 |plain(wimp_set_i| 00000790 63 6f 6e 5f 73 74 61 74 65 28 77 2c 20 69 2c 20 |con_state(w, i, | 000007a0 77 69 6d 70 5f 49 4e 4f 53 45 4c 45 43 54 2c 20 |wimp_INOSELECT, | 000007b0 77 69 6d 70 5f 49 4e 4f 53 45 4c 45 43 54 29 29 |wimp_INOSELECT))| 000007c0 3b 0a 7d 0a 0a 76 6f 69 64 20 6d 64 62 78 5f 75 |;.}..void mdbx_u| 000007d0 6e 66 61 64 65 66 69 65 6c 64 28 77 69 6d 70 5f |nfadefield(wimp_| 000007e0 77 20 77 2c 20 77 69 6d 70 5f 69 20 69 29 0a 7b |w w, wimp_i i).{| 000007f0 0a 20 20 77 69 6d 70 74 5f 63 6f 6d 70 6c 61 69 |. wimpt_complai| 00000800 6e 28 77 69 6d 70 5f 73 65 74 5f 69 63 6f 6e 5f |n(wimp_set_icon_| 00000810 73 74 61 74 65 28 77 2c 20 69 2c 20 30 2c 20 77 |state(w, i, 0, w| 00000820 69 6d 70 5f 49 4e 4f 53 45 4c 45 43 54 29 29 3b |imp_INOSELECT));| 00000830 0a 7d 0a 0a 2f 2a 67 65 74 20 64 6f 75 62 6c 65 |.}../*get double| 00000840 20 66 72 6f 6d 20 66 69 65 6c 64 3b 20 69 66 20 | from field; if | 00000850 69 6e 20 6c 69 6d 69 74 73 2c 20 75 70 64 61 74 |in limits, updat| 00000860 65 20 76 62 6c 65 2c 20 65 6c 73 65 20 75 70 64 |e vble, else upd| 00000870 61 74 65 20 66 69 65 6c 64 2a 2f 0a 76 6f 69 64 |ate field*/.void| 00000880 20 6d 64 62 78 5f 75 70 64 61 74 65 64 6f 75 62 | mdbx_updatedoub| 00000890 6c 65 28 77 69 6d 70 5f 77 20 77 2c 20 77 69 6d |le(wimp_w w, wim| 000008a0 70 5f 69 20 69 2c 20 64 6f 75 62 6c 65 20 2a 72 |p_i i, double *r| 000008b0 2c 20 64 6f 75 62 6c 65 20 6d 69 6e 2c 20 64 6f |, double min, do| 000008c0 75 62 6c 65 20 6d 61 78 2c 20 63 68 61 72 20 2a |uble max, char *| 000008d0 63 29 0a 7b 0a 20 20 64 6f 75 62 6c 65 20 72 65 |c).{. double re| 000008e0 73 75 6c 74 3b 0a 20 20 69 66 20 28 6d 64 62 78 |sult;. if (mdbx| 000008f0 5f 67 65 74 64 6f 75 62 6c 65 28 77 2c 20 69 2c |_getdouble(w, i,| 00000900 20 26 72 65 73 75 6c 74 29 29 0a 20 20 20 20 69 | &result)). i| 00000910 66 20 28 72 65 73 75 6c 74 3e 3d 6d 69 6e 20 26 |f (result>=min &| 00000920 26 20 72 65 73 75 6c 74 3c 3d 6d 61 78 29 20 7b |& result<=max) {| 00000930 2a 72 3d 72 65 73 75 6c 74 3b 20 72 65 74 75 72 |*r=result; retur| 00000940 6e 3b 7d 0a 20 20 69 66 20 28 63 29 20 77 65 72 |n;}. if (c) wer| 00000950 72 28 30 2c 22 50 61 72 61 6d 65 74 65 72 20 6f |r(0,"Parameter o| 00000960 75 74 20 6f 66 20 72 61 6e 67 65 20 27 25 73 27 |ut of range '%s'| 00000970 20 6d 75 73 74 20 6c 69 65 20 62 65 74 77 65 65 | must lie betwee| 00000980 6e 20 25 67 20 26 20 25 67 22 2c 20 63 2c 20 6d |n %g & %g", c, m| 00000990 69 6e 2c 20 6d 61 78 29 3b 0a 20 20 6d 64 62 78 |in, max);. mdbx| 000009a0 5f 73 65 74 64 6f 75 62 6c 65 28 77 2c 20 69 2c |_setdouble(w, i,| 000009b0 20 2a 72 29 3b 0a 20 20 72 65 74 75 72 6e 3b 0a | *r);. return;.| 000009c0 7d 0a 0a 2f 2a 20 72 65 61 64 20 66 69 65 6c 64 |}../* read field| 000009d0 2c 20 26 20 69 66 20 6e 65 77 20 74 65 78 74 20 |, & if new text | 000009e0 69 73 20 64 69 66 66 65 72 65 6e 74 2c 20 73 65 |is different, se| 000009f0 74 20 66 69 65 6c 64 2a 2f 0a 76 6f 69 64 20 6d |t field*/.void m| 00000a00 64 62 78 5f 75 70 64 61 74 65 66 69 65 6c 64 28 |dbx_updatefield(| 00000a10 77 69 6d 70 5f 77 20 77 2c 20 77 69 6d 70 5f 69 |wimp_w w, wimp_i| 00000a20 20 69 2c 20 63 68 61 72 20 2a 74 65 78 74 29 0a | i, char *text).| 00000a30 7b 0a 20 20 63 68 61 72 20 62 75 66 5b 32 35 36 |{. char buf[256| 00000a40 5d 3b 0a 20 20 6d 64 62 78 5f 67 65 74 66 69 65 |];. mdbx_getfie| 00000a50 6c 64 28 77 2c 20 69 2c 20 62 75 66 2c 20 32 35 |ld(w, i, buf, 25| 00000a60 36 29 3b 0a 20 20 69 66 20 28 73 74 72 6e 63 6d |6);. if (strncm| 00000a70 70 28 62 75 66 2c 20 74 65 78 74 2c 20 32 35 36 |p(buf, text, 256| 00000a80 29 29 20 6d 64 62 78 5f 73 65 74 66 69 65 6c 64 |)) mdbx_setfield| 00000a90 28 77 2c 20 69 2c 20 74 65 78 74 29 3b 0a 7d 0a |(w, i, text);.}.| 00000aa0 0a 23 64 65 66 69 6e 65 20 6d 64 62 78 71 75 65 |.#define mdbxque| 00000ab0 72 79 5f 46 59 65 73 20 30 20 20 2f 2a 20 61 63 |ry_FYes 0 /* ac| 00000ac0 74 69 6f 6e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 |tion */.#define | 00000ad0 6d 64 62 78 71 75 65 72 79 5f 46 4d 73 67 20 31 |mdbxquery_FMsg 1| 00000ae0 20 20 2f 2a 20 73 74 72 69 6e 67 20 6f 75 74 70 | /* string outp| 00000af0 75 74 20 2a 2f 0a 23 64 65 66 69 6e 65 20 6d 64 |ut */.#define md| 00000b00 62 78 71 75 65 72 79 5f 46 4e 6f 20 20 32 20 20 |bxquery_FNo 2 | 00000b10 2f 2a 20 61 63 74 69 6f 6e 20 2a 2f 0a 23 64 65 |/* action */.#de| 00000b20 66 69 6e 65 20 6d 64 62 78 71 75 65 72 79 5f 46 |fine mdbxquery_F| 00000b30 41 6c 74 20 33 20 20 2f 2a 20 61 63 74 69 6f 6e |Alt 3 /* action| 00000b40 20 2a 2f 0a 0a 73 74 61 74 69 63 20 64 62 6f 78 | */..static dbox| 00000b50 20 71 20 3d 20 30 3b 0a 73 74 61 74 69 63 20 69 | q = 0;.static i| 00000b60 6e 74 20 6c 61 73 74 5f 6f 70 74 69 6f 6e 20 3d |nt last_option =| 00000b70 20 30 3b 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 | 0;../*. * The f| 00000b80 6f 6c 6c 6f 77 69 6e 67 20 69 73 20 61 20 6d 6f |ollowing is a mo| 00000b90 64 69 66 69 65 64 20 41 63 6f 72 6e 20 52 49 53 |dified Acorn RIS| 00000ba0 43 5f 4f 53 4c 69 62 20 66 6e 3b 20 49 20 63 68 |C_OSLib fn; I ch| 00000bb0 61 6e 67 65 64 20 69 74 20 74 6f 20 73 65 6c 65 |anged it to sele| 00000bc0 63 74 20 74 68 65 20 63 68 6f 73 65 6e 20 69 63 |ct the chosen ic| 00000bd0 6f 6e 20 28 6e 6f 74 20 6f 74 68 65 72 77 69 73 |on (not otherwis| 00000be0 65 0a 20 2a 20 64 6f 6e 65 2c 20 69 66 20 74 68 |e. * done, if th| 00000bf0 65 20 63 68 6f 69 63 65 20 77 61 73 20 76 69 61 |e choice was via| 00000c00 20 61 20 6b 65 79 20 70 72 65 73 73 29 2c 20 61 | a key press), a| 00000c10 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 61 66 74 |utomatically aft| 00000c20 65 72 20 64 62 6f 78 5f 66 69 6c 6c 69 6e 20 72 |er dbox_fillin r| 00000c30 65 74 75 72 6e 73 3b 20 74 68 69 73 20 67 69 76 |eturns; this giv| 00000c40 65 73 20 61 6e 0a 20 2a 20 69 6d 6d 65 64 69 61 |es an. * immedia| 00000c50 74 65 20 66 65 65 64 62 61 63 6b 20 63 6f 6e 66 |te feedback conf| 00000c60 69 72 6d 69 6e 67 20 74 68 65 20 75 73 65 72 27 |irming the user'| 00000c70 73 20 63 68 6f 69 63 65 2e 0a 20 2a 0a 20 2a 20 |s choice.. *. * | 00000c80 54 68 69 73 20 61 6c 73 6f 20 73 65 65 6d 73 20 |This also seems | 00000c90 74 6f 20 67 69 76 65 20 61 20 70 61 72 74 69 63 |to give a partic| 00000ca0 75 6c 61 72 6c 79 20 73 61 74 69 73 66 79 69 6e |ularly satisfyin| 00000cb0 67 20 66 65 65 6c 20 77 68 65 6e 20 73 6c 61 62 |g feel when slab| 00000cc0 62 65 64 20 69 63 6f 6e 73 20 61 72 65 20 62 65 |bed icons are be| 00000cd0 69 6e 67 20 75 73 65 64 2e 0a 20 2a 0a 20 2a 20 |ing used.. *. * | 00000ce0 4d 69 63 68 61 65 6c 20 52 6f 7a 64 6f 62 61 2c |Michael Rozdoba,| 00000cf0 20 32 38 2f 33 2f 39 33 2e 0a 20 2a 0a 20 2a 20 | 28/3/93.. *. * | 00000d00 34 2f 34 2f 39 33 20 2d 20 61 64 64 65 64 20 73 |4/4/93 - added s| 00000d10 75 70 70 6f 72 74 20 66 6f 72 20 69 6e 74 65 72 |upport for inter| 00000d20 61 63 74 69 76 65 20 68 65 6c 70 0a 20 2a 20 20 |active help. * | 00000d30 20 20 20 20 20 20 20 20 61 6c 73 6f 2c 20 61 6c | also, al| 00000d40 6c 6f 77 20 63 61 6c 6c 65 72 20 73 70 65 63 69 |low caller speci| 00000d50 66 69 65 64 20 73 74 72 69 6e 67 73 20 66 6f 72 |fied strings for| 00000d60 20 61 63 74 69 6f 6e 20 62 75 74 74 6f 6e 73 0a | action buttons.| 00000d70 20 2a 20 20 20 20 20 20 20 20 20 20 70 6c 75 73 | * plus| 00000d80 20 77 69 6d 70 20 62 75 67 20 77 6f 72 6b 2d 61 | wimp bug work-a| 00000d90 72 6f 75 6e 64 20 74 6f 20 68 61 6e 64 6c 65 20 |round to handle | 00000da0 63 61 73 65 73 20 77 68 65 72 65 20 65 78 69 74 |cases where exit| 00000db0 20 66 6f 6c 6c 6f 77 73 20 73 68 6f 72 74 6c 79 | follows shortly| 00000dc0 20 69 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 | in response to | 00000dd0 74 68 69 73 20 64 62 6f 78 0a 20 2a 20 20 20 20 |this dbox. * | 00000de0 20 20 20 20 20 20 74 68 69 73 20 61 6c 73 6f 20 | this also | 00000df0 69 6e 76 6f 6c 76 65 73 20 72 65 73 74 72 69 63 |involves restric| 00000e00 74 69 6e 67 20 74 68 65 20 70 74 72 20 74 6f 20 |ting the ptr to | 00000e10 74 68 65 20 64 62 6f 78 20 28 74 6f 20 74 69 64 |the dbox (to tid| 00000e20 79 20 75 70 20 61 20 66 65 77 20 70 6f 73 73 69 |y up a few possi| 00000e30 62 6c 65 20 6c 6f 6f 73 65 20 65 6e 64 73 2c 0a |ble loose ends,.| 00000e40 20 2a 20 20 20 20 20 20 20 20 20 20 69 65 20 70 | * ie p| 00000e50 6f 74 65 6e 74 69 61 6c 20 69 6e 63 6f 6e 73 69 |otential inconsi| 00000e60 73 74 65 6e 74 20 70 72 6f 67 72 61 6d 20 62 65 |stent program be| 00000e70 68 61 76 69 6f 75 72 20 6f 66 20 61 20 6d 69 6e |haviour of a min| 00000e80 6f 72 20 6e 61 74 75 72 65 2c 20 77 68 69 63 68 |or nature, which| 00000e90 20 69 73 20 6d 6f 72 65 20 6c 69 6b 65 6c 79 20 | is more likely | 00000ea0 74 6f 20 61 72 69 73 65 0a 20 2a 20 20 20 20 20 |to arise. * | 00000eb0 20 20 20 20 20 6f 74 68 65 72 77 69 73 65 29 2e | otherwise).| 00000ec0 0a 20 2a 20 36 2f 34 2f 39 33 20 2d 20 61 6c 6c |. * 6/4/93 - all| 00000ed0 6f 77 20 63 68 6f 69 63 65 20 62 65 74 77 65 65 |ow choice betwee| 00000ee0 6e 20 32 20 26 20 33 20 6f 70 74 69 6f 6e 20 64 |n 2 & 3 option d| 00000ef0 69 61 6c 6f 67 75 65 2e 0a 20 2a 0a 20 2a 2f 0a |ialogue.. *. */.| 00000f00 0a 6d 64 62 78 71 75 65 72 79 5f 52 45 50 4c 59 |.mdbxquery_REPLY| 00000f10 20 6d 64 62 78 5f 71 75 65 72 79 28 63 68 61 72 | mdbx_query(char| 00000f20 20 2a 71 75 65 73 74 69 6f 6e 2c 20 63 68 61 72 | *question, char| 00000f30 20 2a 79 65 73 2c 20 63 68 61 72 20 2a 6e 6f 2c | *yes, char *no,| 00000f40 20 63 68 61 72 20 2a 61 6c 74 2c 20 69 6e 74 20 | char *alt, int | 00000f50 6f 70 74 69 6f 6e 73 29 0a 7b 0a 20 20 20 64 62 |options).{. db| 00000f60 6f 78 5f 66 69 65 6c 64 20 61 6e 73 77 65 72 3b |ox_field answer;| 00000f70 0a 20 20 20 64 62 6f 78 5f 66 69 65 6c 64 20 73 |. dbox_field s| 00000f80 65 6c 65 63 74 3b 0a 20 20 20 63 68 61 72 20 62 |elect;. char b| 00000f90 6f 78 5f 6e 61 6d 65 5b 5d 3d 22 71 75 65 72 79 |ox_name[]="query| 00000fa0 20 22 3b 0a 20 20 20 69 66 20 28 6f 70 74 69 6f | ";. if (optio| 00000fb0 6e 73 21 3d 33 29 20 6f 70 74 69 6f 6e 73 3d 32 |ns!=3) options=2| 00000fc0 3b 0a 20 20 20 69 66 20 28 6c 61 73 74 5f 6f 70 |;. if (last_op| 00000fd0 74 69 6f 6e 21 3d 6f 70 74 69 6f 6e 73 20 26 26 |tion!=options &&| 00000fe0 20 71 29 20 7b 0a 20 20 20 20 20 64 62 6f 78 5f | q) {. dbox_| 00000ff0 64 69 73 70 6f 73 65 28 26 71 29 3b 0a 20 20 20 |dispose(&q);. | 00001000 20 20 71 3d 30 3b 0a 20 20 20 7d 0a 20 20 20 6c | q=0;. }. l| 00001010 61 73 74 5f 6f 70 74 69 6f 6e 3d 6f 70 74 69 6f |ast_option=optio| 00001020 6e 73 3b 0a 20 20 20 62 6f 78 5f 6e 61 6d 65 5b |ns;. box_name[| 00001030 73 74 72 6c 65 6e 28 62 6f 78 5f 6e 61 6d 65 29 |strlen(box_name)| 00001040 2d 31 5d 3d 27 30 27 2b 6f 70 74 69 6f 6e 73 3b |-1]='0'+options;| 00001050 0a 20 20 20 69 66 20 28 71 20 3d 3d 20 30 29 20 |. if (q == 0) | 00001060 71 20 3d 20 64 62 6f 78 5f 6e 65 77 28 62 6f 78 |q = dbox_new(box| 00001070 5f 6e 61 6d 65 29 3b 0a 20 20 20 69 66 20 28 71 |_name);. if (q| 00001080 20 3d 3d 20 30 29 20 72 65 74 75 72 6e 20 6d 64 | == 0) return md| 00001090 62 78 71 75 65 72 79 5f 43 41 4e 43 45 4c 3b 20 |bxquery_CANCEL; | 000010a0 2f 2a 20 6f 75 74 20 6f 66 20 73 70 61 63 65 20 |/* out of space | 000010b0 2a 2f 0a 20 20 20 69 66 20 28 71 75 65 73 74 69 |*/. if (questi| 000010c0 6f 6e 20 3d 3d 20 30 20 7c 7c 20 71 75 65 73 74 |on == 0 || quest| 000010d0 69 6f 6e 5b 30 5d 20 3d 3d 20 30 29 20 72 65 74 |ion[0] == 0) ret| 000010e0 75 72 6e 20 6d 64 62 78 71 75 65 72 79 5f 43 41 |urn mdbxquery_CA| 000010f0 4e 43 45 4c 3b 0a 20 20 20 64 62 6f 78 5f 72 61 |NCEL;. dbox_ra| 00001100 77 5f 65 76 65 6e 74 68 61 6e 64 6c 65 72 28 71 |w_eventhandler(q| 00001110 2c 20 68 65 6c 70 5f 64 62 6f 78 72 61 77 65 76 |, help_dboxrawev| 00001120 65 6e 74 73 2c 20 22 51 55 45 52 59 22 29 3b 0a |ents, "QUERY");.| 00001130 20 20 20 64 62 6f 78 5f 73 65 74 66 69 65 6c 64 | dbox_setfield| 00001140 28 71 2c 20 6d 64 62 78 71 75 65 72 79 5f 46 4d |(q, mdbxquery_FM| 00001150 73 67 2c 20 71 75 65 73 74 69 6f 6e 29 3b 0a 20 |sg, question);. | 00001160 20 20 64 62 6f 78 5f 73 65 74 66 69 65 6c 64 28 | dbox_setfield(| 00001170 71 2c 20 6d 64 62 78 71 75 65 72 79 5f 46 59 65 |q, mdbxquery_FYe| 00001180 73 2c 20 79 65 73 29 3b 0a 20 20 20 64 62 6f 78 |s, yes);. dbox| 00001190 5f 73 65 74 66 69 65 6c 64 28 71 2c 20 6d 64 62 |_setfield(q, mdb| 000011a0 78 71 75 65 72 79 5f 46 4e 6f 2c 20 6e 6f 29 3b |xquery_FNo, no);| 000011b0 0a 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 3d |. if (options=| 000011c0 3d 33 29 20 64 62 6f 78 5f 73 65 74 66 69 65 6c |=3) dbox_setfiel| 000011d0 64 28 71 2c 20 6d 64 62 78 71 75 65 72 79 5f 46 |d(q, mdbxquery_F| 000011e0 41 6c 74 2c 20 61 6c 74 29 3b 0a 20 20 20 64 62 |Alt, alt);. db| 000011f0 6f 78 5f 73 68 6f 77 28 71 29 3b 0a 20 20 20 70 |ox_show(q);. p| 00001200 6f 69 6e 74 65 72 5f 72 65 73 74 72 69 63 74 28 |ointer_restrict(| 00001210 64 62 6f 78 5f 73 79 73 68 61 6e 64 6c 65 28 71 |dbox_syshandle(q| 00001220 29 29 3b 0a 20 20 20 2f 2a 20 6e 62 20 74 68 69 |));. /* nb thi| 00001230 73 20 63 75 74 73 20 64 6f 77 6e 20 74 68 65 20 |s cuts down the | 00001240 63 68 61 6e 63 65 20 6f 66 20 65 76 65 6e 74 5f |chance of event_| 00001250 70 72 6f 63 65 73 73 20 63 61 6c 6c 69 6e 67 20 |process calling | 00001260 70 72 6f 67 72 61 6d 20 63 6f 64 65 20 77 68 69 |program code whi| 00001270 63 68 20 6d 69 67 68 74 20 6e 6f 74 20 62 65 68 |ch might not beh| 00001280 61 76 65 20 71 75 69 74 65 20 61 73 20 69 74 0a |ave quite as it.| 00001290 20 20 20 20 2a 20 73 68 6f 75 6c 64 20 28 61 73 | * should (as| 000012a0 20 77 65 20 77 69 6c 6c 20 68 61 76 65 20 6d 6f | we will have mo| 000012b0 64 69 66 69 65 64 20 65 76 65 6e 74 5f 6d 61 73 |dified event_mas| 000012c0 6b 29 2c 20 64 75 72 69 6e 67 20 74 68 65 20 77 |k), during the w| 000012d0 61 69 74 20 66 6f 72 20 6d 6f 75 73 65 20 62 75 |ait for mouse bu| 000012e0 74 74 6f 6e 20 72 65 6c 65 61 73 65 3b 20 77 69 |tton release; wi| 000012f0 74 68 6f 75 74 20 74 68 69 73 2c 0a 20 20 20 20 |thout this,. | 00001300 2a 20 70 74 72 20 65 6e 74 65 72 2f 6c 65 61 76 |* ptr enter/leav| 00001310 65 20 65 76 65 6e 74 73 20 6f 6e 20 77 69 6e 64 |e events on wind| 00001320 6f 77 73 20 6d 61 79 20 62 65 20 67 65 6e 65 72 |ows may be gener| 00001330 61 74 65 64 20 61 66 74 65 72 20 77 65 20 68 61 |ated after we ha| 00001340 76 65 20 74 61 6d 70 65 72 65 64 20 77 69 74 68 |ve tampered with| 00001350 20 65 76 65 6e 74 5f 6d 61 73 6b 20 28 74 68 69 | event_mask (thi| 00001360 73 0a 20 20 20 20 2a 20 77 6f 75 6c 64 6e 27 74 |s. * wouldn't| 00001370 20 6c 69 6b 65 6c 79 20 64 6f 20 61 6e 79 74 68 | likely do anyth| 00001380 69 6e 67 20 61 6e 79 20 6d 6f 72 65 20 73 65 72 |ing any more ser| 00001390 69 6f 75 73 20 74 68 61 6e 2c 20 73 70 6f 69 6c |ious than, spoil| 000013a0 69 6e 67 20 74 68 65 20 63 6f 6e 73 69 73 74 65 |ing the consiste| 000013b0 6e 74 20 62 65 68 61 76 69 6f 75 72 20 6f 66 20 |nt behaviour of | 000013c0 74 68 65 20 70 72 6f 67 72 61 6d 2c 0a 20 20 20 |the program,. | 000013d0 20 2a 20 69 65 20 6c 61 72 65 6c 79 20 63 6f 73 | * ie larely cos| 000013e0 6d 65 74 69 63 20 61 6e 79 77 61 79 29 2e 0a 20 |metic anyway).. | 000013f0 20 20 20 2a 2f 0a 20 20 20 61 6e 73 77 65 72 20 | */. answer | 00001400 3d 20 64 62 6f 78 5f 66 69 6c 6c 69 6e 28 71 29 |= dbox_fillin(q)| 00001410 3b 0a 20 20 20 73 65 6c 65 63 74 20 3d 20 28 61 |;. select = (a| 00001420 6e 73 77 65 72 3d 3d 6d 64 62 78 71 75 65 72 79 |nswer==mdbxquery| 00001430 5f 46 59 65 73 20 7c 7c 20 61 6e 73 77 65 72 3d |_FYes || answer=| 00001440 3d 6d 64 62 78 71 75 65 72 79 5f 46 4e 6f 20 7c |=mdbxquery_FNo || 00001450 7c 20 61 6e 73 77 65 72 3d 3d 6d 64 62 78 71 75 || answer==mdbxqu| 00001460 65 72 79 5f 46 41 6c 74 29 20 3f 20 61 6e 73 77 |ery_FAlt) ? answ| 00001470 65 72 20 3a 20 6d 64 62 78 71 75 65 72 79 5f 46 |er : mdbxquery_F| 00001480 4e 6f 3b 0a 20 20 20 77 69 6d 70 74 5f 63 6f 6d |No;. wimpt_com| 00001490 70 6c 61 69 6e 28 77 69 6d 70 5f 73 65 74 5f 69 |plain(wimp_set_i| 000014a0 63 6f 6e 5f 73 74 61 74 65 28 64 62 6f 78 5f 73 |con_state(dbox_s| 000014b0 79 73 68 61 6e 64 6c 65 28 71 29 2c 20 73 65 6c |yshandle(q), sel| 000014c0 65 63 74 2c 20 77 69 6d 70 5f 49 53 45 4c 45 43 |ect, wimp_ISELEC| 000014d0 54 45 44 2c 20 77 69 6d 70 5f 49 53 45 4c 45 43 |TED, wimp_ISELEC| 000014e0 54 45 44 29 29 3b 0a 20 20 20 7b 0a 20 20 20 2f |TED));. {. /| 000014f0 2a 20 74 68 69 73 20 73 65 65 6d 73 20 74 6f 20 |* this seems to | 00001500 67 65 74 20 61 72 6f 75 6e 64 20 77 69 6d 70 20 |get around wimp | 00001510 62 75 67 20 77 68 69 63 68 20 61 63 6f 72 6e 27 |bug which acorn'| 00001520 73 20 77 6f 72 6b 20 61 72 6f 75 6e 64 20 75 73 |s work around us| 00001530 75 61 6c 6c 79 20 77 6f 6e 27 74 20 73 6f 6c 76 |ually won't solv| 00001540 65 20 69 66 20 61 70 70 6c 69 65 64 20 61 66 74 |e if applied aft| 00001550 65 72 0a 20 20 20 20 2a 20 74 68 65 20 77 69 6e |er. * the win| 00001560 64 6f 77 20 69 73 20 68 69 64 64 65 6e 2c 20 69 |dow is hidden, i| 00001570 65 20 61 66 74 65 72 20 74 68 69 73 20 66 75 6e |e after this fun| 00001580 63 74 69 6f 6e 20 72 65 74 75 72 6e 73 0a 20 20 |ction returns. | 00001590 20 20 2a 2f 0a 20 20 20 20 20 5f 6b 65 72 6e 65 | */. _kerne| 000015a0 6c 5f 73 77 69 5f 72 65 67 73 20 72 3b 0a 20 20 |l_swi_regs r;. | 000015b0 20 20 20 77 69 6d 70 5f 65 6d 61 73 6b 20 6f 6c | wimp_emask ol| 000015c0 64 5f 6d 61 73 6b 3d 65 76 65 6e 74 5f 67 65 74 |d_mask=event_get| 000015d0 6d 61 73 6b 28 29 3b 0a 20 20 20 20 20 65 76 65 |mask();. eve| 000015e0 6e 74 5f 73 65 74 6d 61 73 6b 28 30 29 3b 20 2f |nt_setmask(0); /| 000015f0 2a 2d 2d 20 73 65 74 20 65 76 65 6e 74 20 6d 61 |*-- set event ma| 00001600 73 6b 20 74 6f 20 30 20 20 20 20 20 20 20 20 20 |sk to 0 | 00001610 20 20 20 20 20 20 20 20 2d 2d 2a 2f 0a 20 20 20 | --*/. | 00001620 20 20 64 6f 20 2f 2a 2d 2d 20 72 65 61 64 20 6d | do /*-- read m| 00001630 6f 75 73 65 20 73 74 61 74 65 20 75 6e 74 69 6c |ouse state until| 00001640 20 62 75 74 74 6f 6e 73 20 61 72 65 20 72 65 6c | buttons are rel| 00001650 65 61 73 65 64 20 2d 2d 2a 2f 0a 20 20 20 20 20 |eased --*/. | 00001660 7b 0a 20 20 20 20 20 20 20 5f 6b 65 72 6e 65 6c |{. _kernel| 00001670 5f 73 77 69 28 4f 53 5f 4d 6f 75 73 65 2c 26 72 |_swi(OS_Mouse,&r| 00001680 2c 26 72 29 3b 0a 20 20 20 20 20 20 20 65 76 65 |,&r);. eve| 00001690 6e 74 5f 70 72 6f 63 65 73 73 28 29 3b 20 20 2f |nt_process(); /| 000016a0 2a 2d 2d 20 67 69 76 65 20 77 69 6d 70 20 63 68 |*-- give wimp ch| 000016b0 61 6e 63 65 20 74 6f 20 73 6f 72 74 20 69 74 73 |ance to sort its| 000016c0 65 6c 66 20 6f 75 74 20 2d 2d 2a 2f 0a 20 20 20 |elf out --*/. | 000016d0 20 20 7d 20 77 68 69 6c 65 28 72 2e 72 5b 32 5d | } while(r.r[2]| 000016e0 20 21 3d 20 30 29 3b 0a 20 20 20 20 20 65 76 65 | != 0);. eve| 000016f0 6e 74 5f 73 65 74 6d 61 73 6b 28 6f 6c 64 5f 6d |nt_setmask(old_m| 00001700 61 73 6b 29 3b 0a 20 20 20 7d 0a 20 20 20 70 6f |ask);. }. po| 00001710 69 6e 74 65 72 5f 72 65 73 74 72 69 63 74 28 28 |inter_restrict((| 00001720 77 69 6d 70 5f 77 29 2d 31 29 3b 0a 20 20 20 64 |wimp_w)-1);. d| 00001730 62 6f 78 5f 68 69 64 65 28 71 29 3b 0a 20 20 20 |box_hide(q);. | 00001740 77 69 6d 70 74 5f 63 6f 6d 70 6c 61 69 6e 28 77 |wimpt_complain(w| 00001750 69 6d 70 5f 73 65 74 5f 69 63 6f 6e 5f 73 74 61 |imp_set_icon_sta| 00001760 74 65 28 64 62 6f 78 5f 73 79 73 68 61 6e 64 6c |te(dbox_syshandl| 00001770 65 28 71 29 2c 20 73 65 6c 65 63 74 2c 20 30 2c |e(q), select, 0,| 00001780 20 77 69 6d 70 5f 49 53 45 4c 45 43 54 45 44 29 | wimp_ISELECTED)| 00001790 29 3b 0a 20 20 20 64 62 6f 78 5f 64 69 73 70 6f |);. dbox_dispo| 000017a0 73 65 28 26 71 29 3b 0a 20 20 20 71 3d 30 3b 0a |se(&q);. q=0;.| 000017b0 20 20 20 73 77 69 74 63 68 20 28 61 6e 73 77 65 | switch (answe| 000017c0 72 29 0a 20 20 20 20 20 7b 0a 20 20 20 20 20 20 |r). {. | 000017d0 20 20 63 61 73 65 20 6d 64 62 78 71 75 65 72 79 | case mdbxquery| 000017e0 5f 46 59 65 73 3a 20 72 65 74 75 72 6e 20 6d 64 |_FYes: return md| 000017f0 62 78 71 75 65 72 79 5f 59 45 53 3b 0a 20 20 20 |bxquery_YES;. | 00001800 20 20 20 20 20 63 61 73 65 20 6d 64 62 78 71 75 | case mdbxqu| 00001810 65 72 79 5f 46 4e 6f 20 3a 20 72 65 74 75 72 6e |ery_FNo : return| 00001820 20 6d 64 62 78 71 75 65 72 79 5f 4e 4f 3b 0a 20 | mdbxquery_NO;. | 00001830 20 20 20 20 20 20 20 63 61 73 65 20 6d 64 62 78 | case mdbx| 00001840 71 75 65 72 79 5f 46 41 6c 74 3a 20 72 65 74 75 |query_FAlt: retu| 00001850 72 6e 20 6d 64 62 78 71 75 65 72 79 5f 41 4c 54 |rn mdbxquery_ALT| 00001860 3b 0a 20 20 20 20 20 20 20 20 64 65 66 61 75 6c |;. defaul| 00001870 74 20 20 20 20 20 20 20 20 20 20 20 20 3a 20 72 |t : r| 00001880 65 74 75 72 6e 20 6d 64 62 78 71 75 65 72 79 5f |eturn mdbxquery_| 00001890 43 41 4e 43 45 4c 3b 0a 20 20 20 20 20 7d 0a 7d |CANCEL;. }.}| 000018a0 0a |.| 000018a1