static bool idle(void) { EVENT ev; int events; if (full_event()) return FALSE; events = MU_KEYBD | MU_BUTTON | MU_MESAG | MU_TIMER; if (mouse_sleeps()) events |= MU_M1; ev.which = evnt_multi(events, 0x102, 3, 0, 1, old_mx, old_my, 1, 1, 0, 0, 0, 0, 0, ev.msg, 0L, &ev.m_x, &ev.m_y, &ev.bstate, &ev.kstate, &ev.kreturn, &ev.breturn); old_mx = ev.m_x; old_my = ev.m_y; if (ev.which != MU_TIMER) { ev.which &= (~MU_TIMER); if (ev.which == MU_M1) wake_mouse(); else add_event(&ev); return TRUE; } return FALSE; }
/* ** Description ** Wait for events and update windows */ static void updatewait(void) { WORD quit = FALSE; int ant_klick; WORD buffert[16]; WORD happ; int knapplage; int tangent,tanglage; int x,y; while(!quit) { happ = evnt_multi(MU_KEYBD | MU_MESAG, 0,0,0,0,0,0,0,0,0,0,0,0,0, buffert,0,&x,&y,&knapplage,&tanglage, &tangent,&ant_klick); if (happ & MU_MESAG) { if (buffert[0] == MN_SELECTED) { quit = handle_menu(buffert); } } else if((happ & MU_KEYBD) && ((tangent & 0xff) == 'q')) { quit = TRUE; } } }
/* No form window is open */ void bg_event_loop() { int x,y,kstate,key,clicks,event,state; int pipe[8]; #ifdef DEBUG form_alert(1,"[1][ACC bg][Ok]"); #endif do { event = evnt_multi( MU_MESAG | MU_TIMER, 2, 0x1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pipe, time_slice, 0, &x, &y, &state, &kstate, &key, &clicks ); if (event & MU_TIMER) if (replay) { if(first_init) checkhang(); load(1); update_time(); } if (event & MU_MESAG) { handle_message(pipe); /* no window to handle */ } } while ((fgbg==BG) && !closed_acc); }
void end_aktion (void) { if (akt_handle > 0) { int msg[8], d, event = 0; wind_close(akt_handle); wind_delete(akt_handle); akt_handle = -1; /* * Alle auflaufenden Redraw-Messages abarbeiten, damit * alle Fenster sauber sind, wenn der Dialog beendet ist. */ while (event != MU_TIMER) { event = evnt_multi(MU_MESAG|MU_TIMER, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 1, &d, &d, &d, &d, &d, &d); if ((event & MU_MESAG) && (msg[0] == WM_REDRAW)) handle_msg(msg); } /* Men� wieder an */ enable_menu(); } }
void handle_events(OUTPUT_WINDOW *window) { short int mx, my, button, keystate, dummy; unsigned short int key; short int breturn; short int top_wind; /* Top window handle */ short int type = 0, out = 0; short int time_remaining = 1000; short int base_clip[4]; short messages[16]; while (out != 1) { type = 0; while (!(type & MU_KEYBD) && !(type & MU_MESAG) && !(type & MU_BUTTON) && !(type & MU_TIMER)) { type = evnt_multi( (MU_KEYBD | MU_MESAG | MU_BUTTON | MU_TIMER), 0x182, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, messages, time_remaining, &mx, &my, &button, &keystate, &key, &breturn); } /*wind_get(win_handle, WF_TOP, &top_wind, &dummy, &dummy, &dummy); if (top_wind != win_handle) { if (game_state == ACTIVE) game_state == FROZEN; } // Base clip region is the screen base_clip[0] = base_clip[1] = 0; base_clip[2] = SCw - 1; base_clip[3] = SCh - 1; vs_clip(handle, 1, base_clip);*/ wind_update(BEG_UPDATE); if (type & MU_KEYBD) { switch(key) { case 0x011B: /* Esc Pause Game */ out = 1; break; default: break; } type &= ~MU_KEYBD; } if (type & MU_MESAG) { out = message_handler(messages, window); type &= ~MU_MESAG; } wind_update(END_UPDATE); } return; }
/* * Get a single event, process it, and return. * */ domulti(){ int event; event = evnt_multi(MU_MESAG, 1,1,butdown, 0,0,0,0,0, 0,0,0,0,0, msgbuff,0,0,&mx,&my,&ret,&ret,&keycode,&ret); if (event & MU_MESAG) switch (msgbuff[0]) { case WM_REDRAW: do_redraw(msgbuff[4],msgbuff[5],msgbuff[6],msgbuff[7]); break; case WM_NEWTOP: case WM_TOPPED: wind_set(wi_handle, WF_TOP, 0, 0, 0, 0); break; case WM_CLOSED: running = FALSE; break; case MN_SELECTED: graf_mouse(HOURGLASS, 0L); switch(msgbuff[3]) { case MNDESK: if(msgbuff[4] == DEABOUT) { strcpy((about[ABVERSN].ob_spec)->te_ptext, "6.00"); about[ABOK].ob_state = NORMAL; execform(about); } break; /* "cannot happen" */ case MNFILE: switch (msgbuff[4]) { case FIQUIT: /* [QUIT] item */ running = 0; break; case FIINST: /* [INSTALL] item */ install(); break; case FIUNINST: /* [UNINSTALL] item */ uninstall(); break; } break; } menu_tnormal(menubar, msgbuff[3], 1); /* back to normal */ graf_mouse(ARROW, 0L); /* restore mouse */ break; } }
static void next_action(EVENT *ev) { int events; again: if (get_event(ev)) /* Event aus der Schlange */ { old_mx = ev->m_x; old_my = ev->m_y; if (makro_play) { if (ev->which != MU_KEYBD) { end_play(); return; } else if (ev->kreturn == 0x011B) { end_play(); goto again; } } else return; } if (from_makro(&ev->kstate, &ev->kreturn)) /* Event vom Makro */ { ev->which = MU_KEYBD; return; } /* auf Event warten */ events = MU_KEYBD | MU_BUTTON | MU_MESAG | MU_TIMER; if (mouse_sleeps()) events |= MU_M1; if (winlist_top() == NULL) events &= (~MU_TIMER); ev->which = evnt_multi(events, 0x102, 3, 0, 1, old_mx, old_my, 1, 1, 0, 0, 0, 0, 0, ev->msg, TIMER_INTERVALL, &ev->m_x, &ev->m_y, &ev->bstate, &ev->kstate, &ev->kreturn, &ev->breturn); old_mx = ev->m_x; old_my = ev->m_y; }
static WORD own_form_do(OBJECT *tree,WORD editobj) { int ant_klick; WORD buffert[16]; WORD happ; int knapplage; int tangent; int tanglage; int x; int y; int newobj; while(1) { happ = evnt_multi(MU_KEYBD | MU_BUTTON,2,LEFT_BUTTON,LEFT_BUTTON, 0,0,0,0,0,0, 0,0,0,0,buffert,0,&x,&y,&knapplage,&tanglage, &tangent,&ant_klick); if((happ & MU_KEYBD) && (tangent == 0x1071)) { break; } if(happ & MU_KEYBD) { fprintf(stderr,"kc=%04x\r\n",tangent); } if(happ & MU_BUTTON) { WORD object = objc_find(tree,0,9,x,y); if(object != -1) { fprintf(stderr,"form_button()=%d", form_button(tree,object,ant_klick,&newobj)); fprintf(stderr," newobj=%d\r\n",newobj); } } } return 0; }
/* rub_wait() *========================================================================== * Wait for mouse button event or mouse rectangle event... * * IN: GRECT *obj: - GRECT for rect hot spot * int dir: - Direction looking for * 0 = entry 1 = exit * int state: - button state looking for * * OUT: returns 0 if button event occurred */ int rub_wait( GRECT *obj, int dir, int state ) { int which, kr; int mb, ks, br; int mx, my; wind_update( BEG_MCTRL ); which = evnt_multi( EVNT_MASK,0x01, 0x01, state, dir, obj->g_x, obj->g_y, obj->g_w, obj->g_h, 0,0,0,0,0, 0L, 0,0, &mx, &my, &mb, &ks, &kr, &br); wind_update( END_MCTRL ); return( which & MU_BUTTON ); }
void iconize(WIND w) { char *s, name[9]; ICONWIND iw; WORD e, i, msg[8]; s = strrchr(w->name, '\\'); if (!s) s = w->name; strncpy(name, s+1, 8); name[8] = '\0'; if ((s = strchr(name, '.')) || (s = strchr(name, ' '))) *s = 0; i = iw_new(wsid, w->rwind.g_x, w->rwind.g_y, name, viewfile, BLACK, WHITE, w); if (i > 0) { iw = (ICONWIND)w_lookup(i); iw->w.do_button = iw_button; w_closed(w, msg); w->info[0] = 0; wind_sstr(w->id, WF_INFO, w->info); for(;;) { e = evnt_multi(MU_MESAG|MU_TIMER, 0,0,0, 0,0,0,0,0, 0,0,0,0,0, msg, 100,0, &i, &i, &i, &i, &i, &i); if (e & MU_MESAG) do_msg(msg); else if ((e & MU_TIMER) && wind_update(TRY_UPDATE)) break; } wind_update(END_UPDATE); graf_mouse(M_OFF, NULL); iw_drag(iw, 0, 0); graf_mouse(M_ON, NULL); wind_open(iw->w.id, iw->w.rwind.g_x, iw->w.rwind.g_y, iw->w.rwind.g_w, iw->w.rwind.g_h); } }
void iw_drag(ICONWIND iw, WORD xoff, WORD yoff) { UWORD e; WORD mx, my, mb, i; wind_update(BEG_MCTRL); graf_mkstate(&mx, &my, &mb, &i); do { iw->w.rwind.g_x = min(max(mx + xoff, desk.g_x), desk.g_x + desk.g_w - iw->w.rwind.g_w); iw->w.rwind.g_y = min(max(my + yoff, desk.g_y), desk.g_y + desk.g_h - iw->w.rwind.g_h); iw_xdraw(iw); e = evnt_multi(MU_BUTTON|MU_M1, 1,1,!mb, 1,mx,my,1,1, 0,0,0,0,0, NULL, 0,0, &mx, &my, &i, &i, &i, &i); iw_xdraw(iw); } while (!(e & MU_BUTTON)); wind_update(END_MCTRL); iw->w.sizecalc(&iw->w, &iw->w.rwind); }
main() { gem_init(); v_gtext (handle, 0, 14, "Tapez une touche. Si vous n'avez pas tap‚ de touche dans"); v_gtext (handle, 0, 30, "3 secondes, le programme "); v_gtext (handle, 0, 46, "s'arrˆtera."); which = evnt_multi (33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0L, 3000, 0, &dummy, &dummy, &dummy, &dummy, &touche, &dummy); if (which == 1) v_gtext (handle, 0, 80, "Taper une touche pour quitter"); else v_gtext (handle, 0, 80, "Arrˆt dans 3 secondes"); Crawcin(); /* Attendre touche */ gem_exit(); }
/* Routine to flush keyboard. */ flush_kbd() { /* while (Bconstat(CON)) Bconin(CON);*/ int tmp_buff[8]; int event; int dummy; for(;;) /* used to bleed off unwanted messages...*/ { event = evnt_multi((MU_KEYBD|MU_TIMER), 0,0,0, 0,0,0,0,0, 0,0,0,0,0, tmp_buff, 0,0, /* timer == 0 */ &dummy,&dummy, &dummy,&dummy, &dummy,&dummy); if(event == MU_TIMER) break; } }
bool check_for_abbruch(void) { EVENT ev; int events; if (full_event()) events = MU_KEYBD | MU_TIMER; else { events = MU_KEYBD | MU_BUTTON | MU_MESAG | MU_TIMER; if (mouse_sleeps()) events |= MU_M1; } ev.which = evnt_multi(events, 0x102, 3, 0, 1, old_mx, old_my, 1, 1, 0, 0, 0, 0, 0, ev.msg, 0L, &ev.m_x, &ev.m_y, &ev.bstate, &ev.kstate, &ev.kreturn, &ev.breturn); old_mx = ev.m_x; old_my = ev.m_y; if (ev.which != MU_TIMER) { ev.which &= (~MU_TIMER); if (ev.which == MU_M1) { wake_mouse(); return FALSE; } if (ev.which & MU_KEYBD) /* andere Tasten schlucken */ return (ev.kreturn == 0x011B); add_event(&ev); } return FALSE; }
/* ---------------- */ void main(void) { register int which; register long calc; int w1, w2, w3, w4; int wfx, wfy, wfw, wfh; install_prg(); do { menu_on(); which = evnt_multi(MU_KEYBD|MU_MESAG|MU_BUTTON|MU_TIMER, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 50, 0, &mousex, &mousey, &mousek, &keyst, &key, &clicks); if (which & MU_TIMER) { if (mousex != old_mx || mousey != old_my) mouse_on(); if (akt_id > -1) do_slider_calc(); } if (which & MU_MESAG) { if ( msg[0] == MN_SELECTED ) mn_action(); else switch( msg[0] ) { case WM_REDRAW: redraw(msg[3], msg[4], msg[5], msg[6], msg[7]); break; case WM_CLOSED: erase_wind(msg[3]); wind_get(0, WF_TOP, &w1, &w2, &w3, &w4); akt_id = get_whandle(w1); get_eline(); break; case WM_FULLED: wind_get(msg[3], WF_CURRXYWH, &w1, &w2, &w3, &w4); wind_get(msg[3], WF_FULLXYWH, &wfx, &wfy, &wfw, &wfh); if (w1 == wfx && w2 == wfy && w3 == wfw && w4 == wfh) wind_get(msg[3], WF_PREVXYWH, &wfx, &wfy, &wfw, &wfh); wind_set(msg[3], WF_CURRXYWH, wfx, wfy, wfw, wfh); w_koor[akt_id][0] = wfx; w_koor[akt_id][1] = wfy; w_koor[akt_id][2] = wfw; w_koor[akt_id][3] = wfh; break; case WM_ARROWED: switch(msg[4]) { case 0: /* Seite nach oben */ beg_pgup(); break; case 1: /* Seite nach unten */ beg_pgdwn(); break; case 2: /* Zeile nach oben */ beg_oneup(); break; case 3: /* Zeile nach unten */ beg_onedown(); break; } break; case WM_HSLID: break; case WM_VSLID: go_vpos(msg[4]); break; case WM_SIZED: wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]); w_koor[akt_id][2] = msg[6]; w_koor[akt_id][3] = msg[7]; break; case WM_MOVED: wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]); w_koor[akt_id][0] = msg[4]; w_koor[akt_id][1] = msg[5]; break; case WM_TOPPED: case WM_NEWTOP: akt_id = get_whandle(msg[3]); wind_set(msg[3], WF_TOP, 0, 0, 0, 0); get_eline(); break; } } if (which & MU_KEYBD) key_mesag(); if ((which & MU_BUTTON) && akt_id > -1) button_mesag(); }while(!exit_flg); leave_prg(); }
void GEM_PumpEvents(_THIS) { short mousex, mousey, mouseb, dummy; short kstate, prevkc, prevks; int i; SDL_keysym keysym; memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard)); prevkc = prevks = 0; for (;;) { int quit, resultat; short buffer[8], kc; quit = 0; resultat = evnt_multi( MU_MESAG|MU_TIMER|MU_KEYBD, 0,0,0, 0,0,0,0,0, 0,0,0,0,0, buffer, 10, &dummy,&dummy,&dummy,&kstate,&kc,&dummy ); /* Message event ? */ if (resultat & MU_MESAG) quit = do_messages(this, buffer); /* Keyboard event ? */ if (resultat & MU_KEYBD) { if ((prevkc != kc) || (prevks != kstate)) { do_keyboard(kc,kstate); } else { /* Avoid looping, if repeating same key */ break; } } /* Timer event ? */ if ((resultat & MU_TIMER) || quit) break; } /* Update mouse */ graf_mkstate(&mousex, &mousey, &mouseb, &kstate); do_mouse(this, mousex, mousey, mouseb, kstate); /* Now generate keyboard events */ for (i=0; i<ATARIBIOS_MAXKEYS; i++) { /* Key pressed ? */ if (gem_currentkeyboard[i] && !gem_previouskeyboard[i]) SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, gem_currentascii[i], &keysym)); /* Key unpressed ? */ if (gem_previouskeyboard[i] && !gem_currentkeyboard[i]) SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, gem_currentascii[i], &keysym)); } memcpy(gem_previouskeyboard,gem_currentkeyboard,sizeof(gem_previouskeyboard)); }
/*---------------------------------------------------*/ void event_handler() { int dummy,ev_bkstate,ev_bkreturn,ev_bbutton,ev_breturn,ev_bmx,ev_bmy; int mbuff[8]/*,xs[4]*/; int mwhich,obn; int col,ba; while(1) { mwhich=evnt_multi(MU_KEYBD|MU_BUTTON|MU_MESAG,1,1, 1,0,0, 0,0,0, 0,0,0,0, 0,mbuff,0, 0,&ev_bmx,&ev_bmy, &ev_bbutton,&ev_bkstate, &ev_bkreturn,&ev_breturn); if (mwhich&MU_KEYBD); if (mwhich&MU_BUTTON) { obn=objc_find(rs_object,0,10,ev_bmx,ev_bmy); if ((obn==SAVE)&!(rs_object[SAVE].ob_state&DISABLED)) { rs_object[SAVE].ob_state=SELECTED; redraw(SAVE); save(); rs_object[SAVE].ob_state=0; redraw(SAVE); } else if ((obn==SAVER)&!(rs_object[SAVER].ob_state&DISABLED)) { saver_flag=!saver_flag; rs_object[SAVER].ob_state=SELECTED*saver_flag; redraw(SAVER); get_modes(saver_flag,-3); /* Saver setzten */ } else { col=(obn-COL2R1)/5; ba=obn-5*col-COL2R1; if ((col>=0)&&(col<5)&&(ba>=0)&&(ba<=2)&& !(rs_object[COL2R1+5*col+ba].ob_state&DISABLED)) { radio(COL2R1+5*col+ba,COL2R1+5*col,COL2R1+5*col+2); if (ba==2) { get_modes(col,0); } else { get_modes(col,1+ba); } redraw(COL2BOX+5*col); } } (void)evnt_button(1,1,0,&dummy,&dummy,&dummy,&dummy); } if (mwhich&MU_MESAG) { if (mbuff[0]==WM_REDRAW) { get_conf(); redraw(TREE1); } if (mbuff[0]==WM_MOVED) { wind_set(wid,WF_CURRXYWH, mbuff[4],mbuff[5],mbuff[6],mbuff[7]); (void)wind_get(wid,WF_WORKXYWH, &rs_object[TREE1].ob_x,&rs_object[TREE1].ob_y, &dummy,&dummy); } if ((mbuff[0]==WM_TOPPED)||(mbuff[0]==WM_NEWTOP)) wind_set(wid,WF_TOP); if (mbuff[0]==WM_CLOSED) quit_all(); if ((mbuff[0]==AC_OPEN)&&(!open_f)) { open_w(); } if ((mbuff[0]==AC_CLOSE)&(open_f)) { open_f=0; } if ((mbuff[0]==WM_ICONIFY)||(mbuff[0]==WM_ALLICONIFY)) { wind_set(wid,WF_ICONIFY,mbuff[4],mbuff[5],82,32+24); } if ((mbuff[0]==WM_UNICONIFY)) { wind_set(wid,WF_UNICONIFY,mbuff[4],mbuff[5],mbuff[6],mbuff[7]); } } } }
int aform_do(OBJECT *db,int start, int *cured, int movob) { int edob,nob,which,cont; int idx,mx,my,mb,ks,kr,br; nob=init_field(db,start); edob=0; cont=TRUE; wind_update(BEG_UPDATE); wind_update(BEG_MCTRL); while (cont) { if ( nob ne 0 and edob ne nob ) { edob=nob; nob=0; objc_edit(db,edob,0,&idx,ED_INIT); } which=evnt_multi( MU_KEYBD|MU_BUTTON, 2,1,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0, &mx,&my,&mb, &ks,&kr,&br); if (which & MU_KEYBD) { cont=form_keybd(db,edob,nob,kr,&nob,&kr); if (kr) objc_edit(db,edob,kr,&idx,ED_CHAR); } if (which & MU_BUTTON) { nob=objc_find(db,0,MAX_DEPTH,mx,my); if (nob eq -1) { ping; nob=0; othw cont = (movob and nob eq movob) ? FALSE : form_button(db,nob,br,&nob); } } if (!cont or (nob ne 0 and nob ne edob) ) objc_edit(db,edob,0,&idx,ED_END); } wind_update(END_MCTRL); wind_update(END_UPDATE); if (cured) *cured=edob; return nob; }
short main(int argc, char *argv[]) { MFDB dest; short my_AppId, x, y, w, h; short work_in[11] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2}; short work_out[57], msg[16], w_id1; short open_windows = 1, dummy; short wx, wy, ww, wh, clip[4], pnt[4]; char win1_name[20]; unsigned short logo_trnfrm[LOGO_DATASIZE]; GRECT dirty, walk; short e = 0, evx, evy, a, kc_shstate, kc_key, click_count; my_AppId = appl_init(); my_handle = graf_handle(&x, &y, &w, &h); /* Open a virtual workstation */ v_opnvwk(work_in, &my_handle, work_out); logo_bm.fd_w = LOGO_W; logo_bm.fd_h = LOGO_H; logo_bm.fd_wdwidth = 12; logo_bm.fd_nplanes = 4; logo_bm.fd_stand = 1; dest = logo_bm; dest.fd_stand = 0; logo_bm.fd_addr = (void *)x_logo; dest.fd_addr = (void *)logo_trnfrm; vr_trnfm(my_handle, &logo_bm, &dest); logo_bm.fd_addr = (void *)logo_trnfrm; w_id1 = wind_create(NAME|CLOSE|MOVER, 0, 0, LOGO_W + 40, LOGO_H + 40); if (argc > 1) sprintf(win1_name,"%s", argv[1]); else sprintf(win1_name,"Welcome to...", argv[1]); wind_set(w_id1, WF_NAME, ADDR(win1_name)); x = (work_out[0] - (LOGO_W + 40)) / 2; y = (work_out[1] - (LOGO_H + 40)) / 2; wind_open(w_id1, x, y, LOGO_W + 40, LOGO_H + 40); while((open_windows) && (!(e & MU_TIMER))) { e = evnt_multi(MU_MESAG|MU_TIMER, 258, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 15000, 0, &evx, &evy, &a, &kc_shstate, &kc_key, &click_count); if (e & MU_MESAG) { dummy = msg[0]; switch(dummy) { case WM_CLOSED: /* Did someone close one of our windows? */ wind_close(msg[3]); open_windows--; break; case WM_MOVED: wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]); break; case WM_REDRAW: dirty.g_x = msg[4]; dirty.g_y = msg[5]; dirty.g_w = msg[6]; dirty.g_h = msg[7]; wind_update(BEG_UPDATE); wind_get(msg[3], WF_WORKXYWH, &wx, &wy, &ww, &wh); walk.g_x = wx; walk.g_y = wy; walk.g_w = ww; walk.g_h = wh; pnt[0] = wx; pnt[1] = wy; pnt[2] = wx + ww; pnt[3] = wy + wh; wind_get(msg[3], WF_FIRSTXYWH, &x, &y, &w, &h); rc_intersect(&walk, &dirty); graf_mouse(M_OFF, NULL); while(h) { walk.g_x = x; walk.g_y = y; walk.g_w = w; walk.g_h = h; if (rc_intersect(&dirty, &walk)) { clip[0] = walk.g_x; clip[1] = walk.g_y; clip[2] = walk.g_x + walk.g_w; clip[3] = walk.g_y + walk.g_h; vs_clip(my_handle, 1, clip); vsf_color(my_handle, LWHITE); v_bar(my_handle, pnt); display_bitmap(wx, wy); } wind_get(msg[3], WF_NEXTXYWH, &x, &y, &w, &h); } vs_clip(my_handle, 0, clip); graf_mouse(M_ON, NULL); wind_update(END_UPDATE); break; case WM_TOPPED: wind_set(msg[3], WF_TOP, 0, 0, 0, 0); break; case WM_BOTTOMED: wind_set(msg[3], WF_BOTTOM, 0, 0, 0, 0); break; } } } v_clsvwk(my_handle); appl_exit(); return 0; }
int16 main(void) { GRECT n = {0,0,0,0}; GRECT r1; EVNTDATA ev; int16 bclicks, bmask, bstate; boolean leave; quit = FALSE; debug_init("MControl", null, NULL); init_app("mcontrol.rsc"); init_rsrc(); init_conf(); init_dial(); init_comm(); init_beta(); /* Callback f�r modale Fensterdialoge, Fenster-Alerts usw. */ set_mdial_wincb(handle_msg); graf_mkstate( &ev ); wdial_hover( ev.x, ev.y, &r1, &leave ); while (!quit) { mbutton = 0; if( !((ev.bstate) & 3) ) bclicks = 258; else bclicks = 0; bmask = 3; bstate = 0; event = evnt_multi( MU_BUTTON|MU_M1|MU_MESAG|MU_KEYBD, bclicks, bmask, bstate, leave, &r1, 0, &n, msg, 0l, &ev, &kreturn, &mclick ); msx = ev.x; msy = ev.y; mbutton = ev.bstate; kstate = ev.kstate; if (event & MU_MESAG) { if( msg[0] == WM_MOVED ) wdial_hover( msx, msy, &r1, &leave ); handle_msg(msg); } if (event & MU_BUTTON) { if( mbutton == 2 ) menu_context( msx, msy ); else if (!click_wdial(mclick, msx, msy, kstate, mbutton)) ; } if (event & MU_M1) wdial_hover( msx, msy, &r1, &leave ); if (event & MU_KEYBD) { int16 title, item; if (is_menu_key(kreturn, kstate, &title, &item)) handle_menu(title, item); else { key_wdial(kreturn, kstate); key_sdial(kreturn, kstate); } } } exit_comm(); exit_dial(); exit_rsrc(); debug_exit(); exit_app(0); return 0; }
/* Form window open */ void fg_event_loop() { int x,y,kstate,key,clicks,event,state; int pipe[8],obj_id; int fgexit=0,tmph,th; wind_open(windforms[WIND_CTRL].whandle, windforms[WIND_CTRL].wind.x,windforms[WIND_CTRL].wind.y, windforms[WIND_CTRL].wind.w,windforms[WIND_CTRL].wind.h); windforms[WIND_CTRL].wind_open=1; #ifdef DEBUG form_alert(1,"[1][ACC fg][Ok]"); #endif do { event = evnt_multi( MU_MESAG | MU_TIMER | MU_BUTTON | MU_KEYBD, 1, 0x3, 0x1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pipe, time_slice, 0, &x, &y, &state, &kstate, &key, &clicks ); if (event & MU_TIMER) if (replay) { if(first_init) checkhang(); load(1); update_time(); } if(event & MU_KEYBD) { obj_id=key2button(key); if(obj_id < 0) { switch(-obj_id) { case CLOSE_WIND: wind_get(0, WF_TOP, &pipe[3]); pipe[0]=WM_CLOSED; fgexit=handle_message(pipe); break; case SWITCH_WIND: wind_get(0, WF_TOP, &tmph); /* find handle of next open window */ th=tmph; while(((th=find_windform(th)+1)%N_WINDS)!=tmph) { if(windforms[th].wind_open) { wind_set(windforms[th].whandle,WF_TOP); break; } } default: break; } } else do_formstuff(obj_id); } if(!fgexit) { if (event & MU_MESAG) fgexit=handle_message(pipe); if (event & MU_BUTTON) { if(replay || replay_pause) { windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_flags |= KEEPSELECT; windforms[WIND_CTRL].formtree[CTRL_FF].ob_flags |= KEEPSELECT; } else { windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_flags &= ~KEEPSELECT; windforms[WIND_CTRL].formtree[CTRL_FF].ob_flags &= ~KEEPSELECT; } if(wind_find(x,y) == windforms[WIND_CTRL].whandle) if(ev2_loop(&windforms[WIND_CTRL],x,y)) event=0; } } if(_app) quit=fgexit; else if(fgexit) fgbg=BG; } while ((replay || fgbg==FG) && !fgexit); }
cz1pars() { FDB savefdb; int mousex,mousey,mstate,i,kstate; int done=0; int mbefore=0; int key,event; /* grab mouse control off of AES */ wind_update(3); /* turn clipping off during all of module 7 */ vs_clip(gl_hand,0,&dummy); /* save screen which will lie under cz1pars window */ savefdb.fd_addr= saveptr; savefdb.fd_w= 640; savefdb.fd_h= 200*rez; savefdb.fd_wdwidth= 40; savefdb.fd_stand= 0; if (rez==1) savefdb.fd_nplanes= 2; else savefdb.fd_nplanes= 1; xyarray[0]= cz1_xy[0]; xyarray[1]= rez*cz1_xy[1]; xyarray[2]= cz1_xy[2]; xyarray[3]= rez*cz1_xy[7]; xyarray[4]= 0; xyarray[5]= 0; xyarray[6]= cz1_xy[2]-cz1_xy[0]; xyarray[7]= rez*(cz1_xy[7]-cz1_xy[1]); v_hide_c(gl_hand); if (saveptr) vro_cpyfm(gl_hand,3,xyarray,&scrfdb,&savefdb); v_show_c(gl_hand,0); graf_growbox((cz1_xy[0]+cz1_xy[2])/2,rez*(cz1_xy[1]+cz1_xy[5])/2,1,1, cz1_xy[0],cz1_xy[1], cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1); cz1_wind(); /* put up cz1pars window */ /* executive loop */ while (!done) { vq_mouse(gl_hand,&mstate,&mousex,&mousey); kstate=Kbshift(0xffff); if ((mstate&3)&&!mbefore) done= do_cz1(mousex,mousey,mstate,kstate); event= evnt_multi(MU_TIMER|MU_KEYBD,0,0,0,0,0,0,0,0,0,0,0,0,0, &dummy,1,0,&mousex,&mousey,&dummy,&dummy,&key,&dummy); if ((event & MU_KEYBD)&&(key==0x6100)) cz1_undo(mousex,mousey); mbefore=mstate; } vs_clip(gl_hand,0,&dummy); /* turn clipping off (clobbered by redraw */ /* restore the screen */ xyarray[0]= 0; xyarray[1]= 0; xyarray[2]= cz1_xy[2]-cz1_xy[0]; xyarray[3]= rez*(cz1_xy[7]-cz1_xy[1]); xyarray[4]= cz1_xy[0]; xyarray[5]= rez*cz1_xy[1]; xyarray[6]= cz1_xy[2]; xyarray[7]= rez*cz1_xy[7]; if (saveptr) { v_hide_c(gl_hand); vro_cpyfm(gl_hand,3,xyarray,&savefdb,&scrfdb); v_show_c(gl_hand,0); } else redraw(ws_hand,cz1_xy[0],rez*cz1_xy[1], cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1); graf_shrinkbox((cz1_xy[0]+cz1_xy[2])/2,rez*(cz1_xy[1]+cz1_xy[5])/2,1,1, cz1_xy[0],cz1_xy[1], cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1); /* return mouse control to AES */ wind_update(2); } /* end cz1pars() */
int popup(char *string,int selected, OBJECT *tree,int object,char *choice) { POPUP_DATA pop; EVENT_DATA evnt; int dummy; pop.select=selected; pop.s_antal=20; pop.d_antal=0; pop.number=0; pop.size=0; pop.tree=tree; pop.object=object; pop.string=string; pop.offset=-1; if(string==NULL) return(selected); init_popup(&pop); evnt.check=NOLL; evnt.end=FALSE; if(choice!=NULL) strcpy(choice,poptree[pop.number+P_CHOOSE0].ob_spec); do { if(evnt.check==NOLL) evnt.check=evnt_multi(MU_KEYBD|MU_BUTTON,258,MO_LEFT|MO_RIGHT,0,0,0,0,0,0,0,0,0,0,0,0,0,0,&evnt.mo_x,&evnt.mo_y,&evnt.mo_b,&evnt.k_s,&evnt.key,&evnt.m_r); if((evnt.check&MU_BUTTON)&&(evnt.mo_b==MO_LEFT)) { evnt.d1=objc_find(poptree,ROOT,MAX_DEPTH,evnt.mo_x,evnt.mo_y); if((evnt.mo_x<poptree[ROOT].ob_x)||(evnt.mo_x>poptree[ROOT].ob_x+poptree[ROOT].ob_width)||(evnt.mo_y<poptree[ROOT].ob_y)||(evnt.mo_y>poptree[ROOT].ob_y+poptree[ROOT].ob_height)) { evnt.end=TRUE; evnt.check&=~MU_BUTTON; } else if((evnt.d1>=P_CHOOSE0)&&(evnt.d1<=P_CHOOSE19)&&(poptree[evnt.d1].ob_type==G_STRING)&&(!(poptree[evnt.d1].ob_state&DISABLED))) { if((pop.number!=FAIL)&&(pop.number!=evnt.d1-P_CHOOSE0)) { objc_change(poptree,pop.number+P_CHOOSE0,0,screenx,screeny,screenw,screenh,NOLL,TRUE); objc_change(poptree,evnt.d1,0,screenx,screeny,screenw,screenh,SELECTED,TRUE); } else if(pop.number==FAIL) { objc_change(poptree,evnt.d1,0,screenx,screeny,screenw,screenh,SELECTED,TRUE); } pop.number=evnt.d1-P_CHOOSE0; pop.select=pop.offset+pop.number; objc_offset(poptree,pop.number+P_CHOOSE0,&evnt.xy[X],&evnt.xy[Y]); evnt.xy[W]=poptree[pop.number+P_CHOOSE0].ob_width; evnt.xy[H]=poptree[pop.number+P_CHOOSE0].ob_height; dummy=evnt_multi(MU_BUTTON|MU_M1,1,MO_LEFT,MO_NO_BUTT,1,evnt.xy[X],evnt.xy[Y],evnt.xy[W],evnt.xy[H],0,0,0,0,0,0,0,0,&evnt.mo_x,&evnt.mo_y,&evnt.mo_b,&evnt.k_s,&evnt.key,&evnt.m_r); if(dummy&MU_BUTTON) { selected=pop.offset+pop.number; if(choice!=NULL) strcpy(choice,poptree[pop.number+P_CHOOSE0].ob_spec); evnt.end=TRUE; } } else { switch(evnt.d1) { break; case POPUP_UP: case POPUP_UP_IMG: if(pop.offset>0) { if(!(poptree[POPUP_UP].ob_state&SELECTED)) { poptree[POPUP_UP].ob_state|=SELECTED; objc_draw(poptree,POPUP_UP,1,screenx,screeny,screenw,screenh); } pop.offset--; if(pop.number!=FAIL) { poptree[pop.number+++P_CHOOSE0].ob_state=NOLL; if(pop.number>P_CHOOSE19-P_CHOOSE0) pop.number=FAIL; } if(pop.number==FAIL) { if((pop.select-pop.offset>FAIL)&&(pop.select-pop.offset<9)) pop.number=pop.select-pop.offset; } if(pop.number!=FAIL) poptree[pop.number+P_CHOOSE0].ob_state=SELECTED; for(dummy=P_CHOOSE19; dummy>P_CHOOSE0; dummy--) poptree[dummy].ob_spec=poptree[dummy-1].ob_spec; for(;*pop.pointer1!='\0';pop.pointer1--); pop.pointer1--; poptree[P_CHOOSE0].ob_spec=pop.pointer1+2; pop.pointer2=(char *)poptree[P_CHOOSE19].ob_spec; dummy=poptree[ROOT].ob_y; objc_draw(poptree,ROOT,MAX_DEPTH,poptree[ROOT].ob_x,dummy+poptree[P_CHOOSE0].ob_y,poptree[P_CHOOSE0].ob_width+1,dummy+poptree[P_CHOOSE19].ob_y+poptree[P_CHOOSE19].ob_height); dummy=evnt_multi(MU_BUTTON|MU_M1|MU_TIMER,1,MO_LEFT,MO_NO_BUTT,1,evnt.xy[X],evnt.xy[Y],evnt.xy[W],evnt.xy[H],0,0,0,0,0,0,0,100,&evnt.mo_x,&evnt.mo_y,&evnt.mo_b,&evnt.k_s,&evnt.key,&evnt.m_r); if(dummy&(MU_BUTTON|MU_M1)) { poptree[POPUP_UP].ob_state&=~SELECTED; objc_draw(poptree,POPUP_UP,1,screenx,screeny,screenw,screenh); } } break; case POPUP_DOWN: case POPUP_DOWN_IMG: if(pop.offset+pop.s_antal<pop.d_antal) { pop.offset++; if(pop.number!=FAIL) poptree[pop.number--+P_CHOOSE0].ob_state=NOLL; if(pop.number==FAIL) { if((pop.select-pop.offset>FAIL)&&(pop.select-pop.offset<9)) pop.number=pop.select-pop.offset; } if(pop.number!=FAIL) poptree[pop.number+P_CHOOSE0].ob_state=SELECTED; for(dummy=P_CHOOSE0; dummy<P_CHOOSE19; dummy++) poptree[dummy].ob_spec=poptree[dummy+1].ob_spec; for(;*pop.pointer2!='\0';pop.pointer2++); pop.pointer2++; poptree[P_CHOOSE19].ob_spec=pop.pointer2; pop.pointer1=(char *)poptree[P_CHOOSE0].ob_spec-2; dummy=poptree[ROOT].ob_y; objc_draw(poptree,ROOT,MAX_DEPTH,poptree[ROOT].ob_x,dummy+poptree[P_CHOOSE0].ob_y,poptree[P_CHOOSE0].ob_width+1,dummy+poptree[P_CHOOSE19].ob_y+poptree[P_CHOOSE19].ob_height); } break; default: break; } evnt.check&=~MU_BUTTON; } } else if((evnt.check&MU_BUTTON)&&(evnt.mo_b|MO_RIGHT)) { evnt.end=TRUE; evnt.check&=~MU_BUTTON; } else if(evnt.check&MU_KEYBD) { evnt.end=TRUE; evnt.check&=~MU_KEYBD; } } while(!evnt.end); deinit_popup(&pop); return(selected); }
/* --------------------- | Form-do in window | --------------------- */ int win_formdo(OBJECT *tree, int start_fld, int wind_id) { int edit_obj; int next_obj; int which, cont; int idx; int mx, my, mb, ks, kr, br, msg[8]; int x, y, w, h; if (start_fld != -1) next_obj = fm_inifld(tree, start_fld); else next_obj = 0; edit_obj = 0; cont = TRUE; while(cont) { if (next_obj && edit_obj != next_obj) { edit_obj = next_obj; next_obj = 0; objc_edit(tree, edit_obj, 0, &idx, ED_INIT); } if (start_fld == -1) which = evnt_multi(MU_MESAG|MU_TIMER|MU_KEYBD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 100, 0, &mx, &my, &mb, &ks, &kr, &br); else which = evnt_multi(MU_KEYBD|MU_BUTTON|MU_MESAG, 0x02, 0x01, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 0, 0, &mx, &my, &mb, &ks, &kr, &br); if (which & MU_KEYBD) { wind_update(BEG_UPDATE); cont = form_keybd(tree, edit_obj, next_obj, kr, &next_obj, &kr); if (kr) objc_edit(tree, edit_obj, kr, &idx, ED_CHAR); wind_update(END_UPDATE); } if (which & MU_BUTTON) { wind_update(BEG_UPDATE); next_obj = objc_find(tree, ROOT, MAX_DEPTH, mx, my); if (next_obj == NIL) { Cconout(0x7); next_obj = 0; } else cont = form_button(tree, next_obj, br, &next_obj); wind_update(END_UPDATE); } if (which & MU_MESAG) { switch(msg[0]) { case WM_REDRAW: red_x = msg[4]; red_y = msg[5]; red_w = msg[6]; red_h = msg[7]; if (msg[3] == wind_id) { if (edit_obj) objc_edit(tree, edit_obj, 0, &idx, ED_END); dialog_window(wind_id, tree, RDW_DIA, ROOT); if (edit_obj) objc_edit(tree, edit_obj, 0, &idx, ED_INIT); } else { sample_redraw(msg[3]); seqs_redraw(msg[3]); } break; case WM_MOVED: if (msg[3] == wind_id) { wind_set(wind_id, WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]); wind_get(wind_id, WF_WORKXYWH, &x, &y, &w, &h); tree[ROOT].ob_x = x; tree[ROOT].ob_y = y; } break; } } if (!cont || (next_obj && next_obj != edit_obj)) objc_edit(tree, edit_obj, 0, &idx, ED_END); if (start_fld == -1 && which == MU_TIMER) break; if (start_fld == -1 && which == MU_KEYBD) break; } if (start_fld == -1) return ((kr & 0xFF) == 0x1B); else return(next_obj); }
static void waitRequests(void) { int16 cnId, state; int16 nInQueue; int toggle, proceed=1; do { /* listen again */ if( (cnId = TCP_open(0, LPR_LOC_PORT, 0, tcpBuffSize)) <= 0 ) { uiPrintf(uiH, uiPrERR, "waitRequests|TCP_open"); return; } if ( (state = TCP_wait_state(cnId, TLISTEN, 30)) < 0 ) { uiPrintf(uiH, uiPrERR, "waitRequests|%s", get_err_text(state)); return; } toggle = 10; /* every ten waits look also for an AES message */ while ( (nInQueue = CNbyte_count(cnId)) != E_EOF ) { /* poll for input */ /* listening or no data yet cause us to wait */ if (nInQueue == E_LISTEN || nInQueue == 0 || nInQueue == E_NODATA) { if (--toggle>0) { uiYield(uiH, YIELDMS); } else { WORD msgbuff[8]; WORD event; /* Ergebnis mit Ereignissen */ WORD mx, my, /* Mauskoordinaten */ mbutton, /* Mausknopf */ mkstate, /* keyb shift status for mouse button */ mclicks; /* Anzahl Mausklicks */ UWORD keycode; /* scancode + asciicode */ toggle=10; event = evnt_multi( MU_MESAG | MU_TIMER, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msgbuff, YIELDMS, 0, &mx, &my, &mbutton, &mkstate, &keycode, &mclicks); if ( (event & MU_MESAG) && msgbuff[0] == AP_TERM ) { proceed=0; /* no more new connections */ break; /* end listening */ } } } else { if (nInQueue > 0) { /* otherwise there is valid data */ NDB* ndb; if ( (ndb = CNget_NDB(cnId)) != NULL ) { dispatchD(cnId, ndb); } else { uiPrintf(uiH, uiPrERR, "waitRequests|get_NDB"); break; } } else { /* catch other errors */ uiPrintf(uiH, uiPrERR, "waitRequests|%s", get_err_text(nInQueue)); break; } /* if valid data */ } /* if any data */ } /* while wait for a request */ TCP_close(cnId, TIMEOUT, NULL); /* disconnect */ } while (proceed); /* while new connection shall be done */ } /* waitRequests */
/**************************************************************** * * * cherche une chaŒne * * * ****************************************************************/ void search_secteur(windowptr thewin, boolean diff_majmin, boolean start_to_end) { char *buffer, *buffer_frontiere; OBJECT *search = Dialog[WAIT].tree; int taille, start; long secteur = thewin -> fonction.secteur.secteur, max = thewin -> fonction.secteur.max; int width, i; char *secteur_text; char pattern[SEARCH_PATTERN_SIZE]; long offset; int size_buff_sect; int dummy; #ifndef TEST_VERSION if (thewin -> fonction.secteur.dirty && write_secteur(thewin, MENU_DEPLACEMENT)) return; #endif thewin -> fonction.secteur.dirty = FALSE; /* attend la fin des redessins */ Event_Timer(0, 0, TRUE); search[WAIT_MESSAGE].ob_spec.free_string = Messages(SEARCH_2); search[WAIT_INFO].ob_spec.tedinfo -> te_ptext = Messages(REORG_14); width = search[SLIDE_PERE].ob_width -3; search[SLIDE_FILS].ob_width = (int)((long)width * secteur / max) +3; secteur_text = search[INDICATEUR_WAIT].ob_spec.tedinfo -> te_ptext; sprintf(secteur_text, "%ld", secteur); sprintf(search[MAX_WAIT].ob_spec.free_string, "/%ld", max); my_open_dialog(&Dialog[WAIT], AUTO_DIAL|NO_ICONIFY|MODAL, FAIL); /* attend la fin des redessins */ Event_Timer(0, 0, TRUE); /* allocation des buffers, on d‚passe un peu … cause de l'approximation de la taille dans and_buffer() */ buffer = malloc(20L+ 512L * (thewin -> fonction.secteur.device < 2 ? SIZEBUFFLOP : SIZEBUFHARD)); if (buffer == NULL) { error_msg(Z_NOT_ENOUGH_MEMORY); return; } if ((buffer_frontiere = malloc(20L+ SEARCH_PATTERN_SIZE*2L + 16L)) == NULL) { free(buffer); error_msg(Z_NOT_ENOUGH_MEMORY); return; } /* mise … z‚ro */ memset(buffer_frontiere, 0, 20L+ SEARCH_PATTERN_SIZE*2L + 16L); /* pr‚pare le pattern */ if (diff_majmin) for (i=0; i<SearchLength; i++) pattern[i] = SearchString[i]; else for (i=0; i<SearchLength; i++) pattern[i] = SearchString[i] & ~('a'-'A'); /* octet de d‚part */ start = thewin -> fonction.secteur.curseur_x < 0 ? thewin -> fonction.secteur.page *512 : thewin -> fonction.secteur.page *512 + thewin -> fonction.secteur.curseur_y*32 + thewin -> fonction.secteur.curseur_x/2 +1; /* recherche d'abord dans le secteur en m‚moire */ memcpy(buffer, thewin -> fonction.secteur.secteurBin, thewin -> fonction.secteur.sector_size*512L); if ((offset = search_pattern(buffer + start, thewin -> fonction.secteur.sector_size*512L - start, pattern, diff_majmin, start_to_end)) >= 0) { my_close_dialog(&Dialog[WAIT]); free(buffer_frontiere); free(buffer); search_found(thewin, secteur, offset + start); return; } /* remplis de n'importe quoi sauf du motif recherch‚ */ memset(buffer_frontiere, SearchString[0] ^ 0xAA, (long)SEARCH_PATTERN_SIZE); /* nombre max de secteurs … lire */ size_buff_sect = (thewin -> fonction.secteur.device < 2 ? SIZEBUFFLOP : SIZEBUFHARD) / thewin -> fonction.secteur.sector_size; /* taille du bloc … lire */ if (max - secteur > (long)size_buff_sect) taille = size_buff_sect; else taille = (int)(max - secteur); while (taille > 0) { /* charge le buffer */ if ((taille = load_buffer(thewin, buffer, secteur, taille, start_to_end)) < 0) { /* erreur */ my_close_dialog(&Dialog[WAIT]); free(buffer); return; } /* recherche sur la frontiŠre */ memcpy(buffer_frontiere + SEARCH_PATTERN_SIZE, buffer, (long)SEARCH_PATTERN_SIZE); if ((offset = search_pattern(buffer_frontiere, SEARCH_PATTERN_SIZE, pattern, diff_majmin, start_to_end)) >= 0) { my_close_dialog(&Dialog[WAIT]); free(buffer_frontiere); free(buffer); search_found(thewin, secteur-taille, offset + (thewin -> fonction.secteur.device < 2 ? SIZEBUFFLOP*512L - SEARCH_PATTERN_SIZE : SIZEBUFHARD*512L - SEARCH_PATTERN_SIZE)); return; } /* recherche en cours */ if ((offset = search_pattern(buffer+start, taille * thewin -> fonction.secteur.sector_size * 512L - start, pattern, diff_majmin, start_to_end)) >= 0) { my_close_dialog(&Dialog[WAIT]); free(buffer_frontiere); free(buffer); search_found(thewin, secteur, offset+start); return; } /* on n'a un d‚calage que la premiŠre fois */ start = 0; /* copie la fin du bloc pour la frontiŠre */ memcpy(buffer_frontiere, buffer + (thewin -> fonction.secteur.device < 2 ? SIZEBUFFLOP*512L - SEARCH_PATTERN_SIZE : SIZEBUFHARD*512L - SEARCH_PATTERN_SIZE), (long)SEARCH_PATTERN_SIZE); /* on avance */ secteur += taille; /* taille du bloc … lire */ if (max - secteur > (long)size_buff_sect) taille = size_buff_sect; else taille = (int)(max - secteur); /* test les boutons */ if (evnt_multi(MU_TIMER | MU_BUTTON, 256+1, 3, 0, /* button */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* mouse */ NULL, /* message */ 1, 0, /* timer */ &dummy, &dummy, &dummy, &dummy, &dummy, &dummy) == MU_BUTTON && my_alert(1, 2, X_ICN_QUESTION, Messages(SEARCH_3), Messages(BOOT_32)) == 0) { /* on n'a pas trouv‚ mais on s'arrˆte */ my_close_dialog(&Dialog[WAIT]); free(buffer_frontiere); free(buffer); search_found(thewin, secteur, -1L); return; } /* met … jour la barre */ search[SLIDE_FILS].ob_width = (int)((long)width * secteur / max) +3; ob_draw(Dialog[WAIT].info, SLIDE_FILS); /* met … jour le compteur */ sprintf(secteur_text, "%ld", secteur); ob_draw(Dialog[WAIT].info, INDICATEUR_WAIT); /* attend la fin des redessins */ Event_Timer(0, 0, TRUE); } free(buffer_frontiere); free(buffer); my_close_dialog(&Dialog[WAIT]); /* un petit bruit */ if (Sound) Cconout(7); } /* search_secteur */
int ev2_loop(WINDFORM *wind,int mx,int my) { int x,y,kstate,key,clicks,event,state,org_state; int obj_id,ev2exit,fgexit=0; int pipe[8]; CORDS t; if((obj_id=objc_find(wind->formtree,CTRL_FIRST,1,mx,my))>=0) { if(wind->formtree[obj_id].ob_flags & SELECTABLE) { org_state=wind->formtree[obj_id].ob_state & SELECTED; toggle_object(wind,obj_id,TOGGLE); objc_offset(wind->formtree,obj_id,&t.x,&t.y); t.w=wind->formtree[obj_id].ob_width; t.h=wind->formtree[obj_id].ob_height; ev2exit=0; do { event = evnt_multi( MU_MESAG | MU_TIMER | MU_BUTTON | MU_M1 | MU_M2, 1, 0x1, 0x0, 0, t.x, t.y, t.w, t.h, 1, t.x, t.y, t.w, t.h, pipe, time_slice, 0, &x, &y, &state, &kstate, &key, &clicks ); if (event & MU_TIMER) if (replay) { if(first_init) checkhang(); load(1); update_time(); } if (event & MU_MESAG) fgexit=handle_message(pipe); if (event & MU_M1) /* Enter area */ { if(org_state==(wind->formtree[obj_id].ob_state & SELECTED)) toggle_object(wind,obj_id,TOGGLE); } if (event & MU_M2) /* Leave area */ { if(org_state!=(wind->formtree[obj_id].ob_state & SELECTED)) toggle_object(wind,obj_id,TOGGLE); } if (event & MU_BUTTON) { if(obj_id==objc_find(wind->formtree,CTRL_FIRST,1,x,y)) { if(wind->formtree[obj_id].ob_flags & KEEPSELECT) { if(org_state && (wind->formtree[obj_id].ob_state & SELECTED)) toggle_object(wind,obj_id,SET_NORMAL); if(!org_state && !(wind->formtree[obj_id].ob_state & SELECTED)) toggle_object(wind,obj_id,SET_SELECTED); } else if(wind->formtree[obj_id].ob_state & SELECTED) toggle_object(wind,obj_id,SET_NORMAL); fgexit=do_formstuff(obj_id); } else { objc_change(wind->formtree,obj_id,0,wind->form.x, wind->form.y,wind->form.w,wind->form.h,org_state,0); update_objects(wind,obj_id,1,0); } ev2exit=1; } } while (((replay || fgbg==FG) && !fgexit) && !ev2exit); event=0; return 1; } } return 0; }
bool do_aktion(char *str, long value) { int msg[8], kreturn, d, event; long max_len, help; GRECT r; bool ret = TRUE; /* zun�chst Box updaten */ if (str[0] != EOS) { set_string(aktion, ATEXT, str); get_objframe(aktion, ATEXT, &r); redraw(ROOT, MAX_DEPTH, r.g_x, r.g_y, r.g_w, r.g_h); } max_len = aktion[ABOX1].ob_width; help = max((max_len * value) / max_value,1); help = min(max_len, help); if (aktion[ABOX2].ob_width != help) { aktion[ABOX2].ob_width = (int) help; get_objframe(aktion, ABOX2, &r); redraw(ABOX2, 0, r.g_x, r.g_y, r.g_w, r.g_h); } /* nachschauen, ob es irgendwelche GEM-Events gibt */ do { event = evnt_multi(MU_MESAG|MU_KEYBD|MU_TIMER, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 1, &d, &d, &d, &d, &kreturn, &d); if (event & MU_MESAG) { switch (msg[0]) { case WM_REDRAW : if (msg[3] == akt_handle) redraw(ROOT, MAX_DEPTH, msg[4], msg[5], msg[6], msg[7]); else handle_msg(msg); break; case WM_MOVED : if (msg[3] == akt_handle) move(msg[4], msg[5]); else handle_msg(msg); break; case WM_TOPPED : case WM_NEWTOP : case WM_ONTOP : wind_set(akt_handle, WF_TOP, 0, 0, 0, 0); break; case WM_SIZED: case WM_BOTTOMED: /* ignore */ break; case AP_TERM : ret = FALSE; break; } } if (event & MU_KEYBD) { if (interupt && kreturn == 0x011B) /* ESC */ ret = FALSE; } } while (event & MU_MESAG); /* alle Messages auswerten */ return ret; }
/* * Get a single event, process it, and return. * */ domulti(){ int event; event = evnt_multi(MU_MESAG, 1,1,butdown, 0,0,0,0,0, 0,0,0,0,0, msgbuff,0,0,&mx,&my,&ret,&ret,&keycode,&ret); if (event & MU_MESAG) { wind_update(TRUE); switch (msgbuff[0]) { case WM_REDRAW: do_redraw(msgbuff[4],msgbuff[5],msgbuff[6],msgbuff[7]); break; case MN_SELECTED: BEE_MOUSE; switch(msgbuff[3]) { case MNDISK: switch (msgbuff[4]) { case DIFORM: if ((needscan) && (rescan(0,0) == ERROR)) { break; /* don't report medium changed */ } tformat = TRUE; needscan = FALSE; dodiform(); tformat = FALSE; break; case DIPART: if ((needscan)&&(rescan(0,0) == ERROR)) { break; /* don't report medium changed */ } needscan = FALSE; dodipart(-1, NULL, NULL); break; case DIZERO: if (pnf) { err(needboot); } else { if ((needscan)&&(rescan(0,1) == ERROR)) { break; /* don't report medium changed */ } needscan = FALSE; dodizero(); } break; case DIMARK: if (pnf) { err(needboot); } else { if ((needscan)&&(rescan(0,1) == ERROR)) { break; /* don't report medium changed */ } needscan = FALSE; dodimark(); } break; case DISHIP: if ((needscan)&&(rescan(0,0) == ERROR)) { break; /* don't report medium changed */ } needscan = FALSE; dodiship(); break; default: break; } break; case MNFILE: switch (msgbuff[4]) { case FIQUIT: running = 0; break; default: break; } break; case MNDESK: if(msgbuff[4] == DEABOUT) { strcpy(abtdial[ABVERSN].ob_spec, "Version 3.5"); abtdial[ABOK].ob_state = NORMAL; execform(abtdial); } break; /* "cannot happen" */ } menu_tnormal(menuobj, msgbuff[3], 1); /* back to normal */ ARROW_MOUSE; break; case WM_NEWTOP: case WM_TOPPED: wind_set(wi_handle, WF_TOP, 0, 0, 0, 0); break; case WM_CLOSED: running = FALSE; break; default: break; } wind_update(FALSE); } }
int main( void ) { char pathbuf[128]; char fname[33]; int result; int button,sortmode; int nfiles; char *pattern; void *fsel_dialog; int whdl; EVNT evnt; if ((appl_init()) < 0) Pterm(-1); /* Aufruf */ /* ------ */ strcpy(fname, "initname"); strcpy(pathbuf, "E:\\BIN\\"); if (1 == form_alert(1, "[2][Modus ?][Fenster|Dialog]")) { fsel_dialog = fslx_open( " Titel ", -1,-1, &whdl, pathbuf, 128, fname, 33, "*.PRG,*.APP\0" "*.TOS,*.TTP\0" "*\0", 0L, /* kein Filter */ "C:\\\0" "U:\\BIN\\\0" "U:\\DEV\\\0", SORTBYNAME, GETMULTI ); if (fsel_dialog) { do { evnt.mwhich = evnt_multi( MU_KEYBD+MU_BUTTON+MU_MESAG, 2,1,1, 0,0,0,0,0, 0,0,0,0,0, evnt.msg, 0,0, &evnt.mx, &evnt.my, &evnt.mbutton, &evnt.kstate, &evnt.key, &evnt.mclicks); result = fslx_evnt( fsel_dialog, &evnt, pathbuf, fname, &button, &nfiles, &sortmode, &pattern); } while(result); } } else { sortmode = SORTBYNAME; fsel_dialog = fslx_do( "mein Titel", pathbuf, 128, fname, 33, "*.PRG,*.APP\0" "*.TOS,*.TTP\0" "*\0", 0L, /* kein Filter */ "C:\\\0" "U:\\BIN\\\0" "U:\\DEV\\\0", &sortmode, 0, &button, &nfiles, &pattern ); } if (fsel_dialog) fslx_close(fsel_dialog); appl_exit(); return(0); }