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; }
void coup_mu_button( short m_x, short m_y, short breturn ) { short obj_x, obj_y ; /* object x and y return values */ short no_exit ; char names[60] ; /* string in which to format names */ coup_form.next_object = objc_find( coup_form.fm_ptr, ROOT, MAX_DEPTH, m_x, m_y ) ; if( coup_form.next_object == NIL ) { Bconout( 2, '\a' ) ; objc_edit( coup_form.fm_ptr, coup_form.edit_object, 0, &(coup_form.cursor_position), ED_END ) ; coup_form.edit_object = 0 ; } else { no_exit = form_button( coup_form.fm_ptr, coup_form.next_object, breturn, &(coup_form.next_object) ) ; if( !no_exit ) { coup_form.next_object &= ~DOUBLE_CLICK ; /* deselect object if it an exit button */ if( coup_form.fm_ptr[coup_form.next_object].ob_flags & EXIT ) coup_form.fm_ptr[coup_form.next_object].ob_state &= ~SELECTED ; switch( coup_form.next_object ) { case C_CANCEL : close_couple() ; break ; case C_OK : save_couple( edit_coup_ref, edit_coup_block, edit_coup_cptr ) ; close_couple() ; break ; case C_DELETE : if( q_del_coup( edit_coup_ref, edit_coup_block, edit_coup_cptr ) ) close_couple() ; else objc_draw( coup_form.fm_ptr, C_DELETE, MAX_DEPTH, ELTS( coup_form.fm_box ) ) ; break ; case C_HELP : help( marriage_help ) ; objc_draw( coup_form.fm_ptr, C_HELP, 0, ELTS( coup_form.fm_box ) ) ; break ; case MALE : if( male = get_person_reference( NULL, FALSE ) ) { names_only( male, names, 40, FALSE ) ; strcpy( c_form_addrs.male, names ) ; objc_draw( coup_form.fm_ptr, MALE, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; sprintf( c_form_addrs.m_ref, "%10d", male ) ; objc_draw( coup_form.fm_ptr, M_REF, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case FEMALE : if( female = get_person_reference( NULL, FALSE ) ) { names_only( female, names, 40, FALSE ) ; strcpy( c_form_addrs.female, names ) ; objc_draw( coup_form.fm_ptr, FEMALE, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; sprintf( c_form_addrs.f_ref, "%10d", female ) ; objc_draw( coup_form.fm_ptr, F_REF, 0, (int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case WED_QUALIFIER : popup_date_qualifier( c_form_addrs.wed_qual, coup_form.fm_ptr, WED_QUALIFIER ) ; break ; case C_SOURCE : wind_form_do( &co_src_form, WF_SOURCE ) ; break ; case C_DIVORCE : wind_form_do( &divorce_form, DI_DATE ) ; break ; case PROG0 : case PROG1 : case PROG2 : case PROG3 : case PROG4 : case PROG5 : case PROG6 : case PROG7 : case PROG8 : case PROG9 : select_progeny( coup_form.next_object - PROG0, coup_form.fm_box ) ; break ; case C_SLIDER : prog_oset = move_slide( coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; prog_oset = 30 * prog_oset / 1000 ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; break ; case C_UP : if( prog_oset > 0 ) { prog_oset-- ; set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case C_DOWN : if( prog_oset < 30 ) { prog_oset++ ; set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; } break ; case C_SLIDERANGE : objc_offset( coup_form.fm_ptr, C_SLIDER, &obj_x, &obj_y ) ; if( m_y > obj_y ) { prog_oset += 9 ; if( prog_oset > 30 ) prog_oset = 30 ; } else { prog_oset -= 9 ; if( prog_oset < 0 ) prog_oset = 0 ; } set_slide( prog_oset, 30, coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ; update_progeny() ; objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH, (int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y, (int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ; break ; default : #ifndef NDEBUG report( 0x300 + coup_form.next_object ) ; #endif break ; } } } change_edit_object( &coup_form, MU_BUTTON ) ; }
/* --------------------- | 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); }
/* ***enhanced form-do main function*** */ short wdial_formdo(int dwhndl, OBJECT *tree, short strt_fld, void (*msghndlr)(int msgbf[]), long msec, void (*tmrhndlr)()) { int edit_obj; int next_obj; register int which; int events=MU_KEYBD|MU_BUTTON|MU_MESAG; int cont; int idx; short kshift, kcode; int mx, my, mb, br; int obx, oby, obw, obh; /* Koordinaten des Dialogs */ int msgbuf[8]; if(msec>=0) events|=MU_TIMER; next_obj=fm_inifld(tree, strt_fld); edit_obj=0; cont=TRUE; while(cont && !endeflag) { if( (next_obj!=0) && (edit_obj!=next_obj) ) { edit_obj=next_obj; next_obj=0; objc_edit(tree, edit_obj, 0, idx, ED_INIT, &idx); } which=evnt_multi(events, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msgbuf, (short)msec,(short)(msec>>16), &mx, &my, &mb, &kshift, &kcode, &br); if(which & MU_MESAG) { if(msgbuf[3]==dwhndl && msgbuf[0]>=WM_REDRAW && msgbuf[0]<=WM_NEWTOP) { switch(msgbuf[0]) { case WM_REDRAW: wdial_redraw(dwhndl, tree, (GRECT *)(&msgbuf[4])); if(edit_obj) objc_edit(tree, edit_obj, 0, idx, ED_INIT, &idx); break; case WM_TOPPED: wind_set(dwhndl, WF_TOP, 0L, 0L); break; case WM_MOVED: wind_set(dwhndl, WF_CURRXYWH, msgbuf[4], msgbuf[5], msgbuf[6], msgbuf[7]); wind_calc(WC_WORK, NAME|MOVER, msgbuf[4], msgbuf[5], msgbuf[6], msgbuf[7], &obx, &oby, &obw, &obh); tree[ROOT].ob_x=obx; tree[ROOT].ob_y=oby; break; } } else if( msghndlr ) msghndlr(msgbuf); } if( (which & MU_TIMER) && tmrhndlr ) tmrhndlr(); if(which & MU_KEYBD) { cont=form_keybd(tree, edit_obj, next_obj, kcode, &next_obj, &kcode); if(kcode) objc_edit(tree, edit_obj, kcode, idx, ED_CHAR, &idx); } if(which & MU_BUTTON) { next_obj=objc_find(tree, ROOT, MAX_DEPTH, mx, my); if(next_obj == NO_OBJECT) /* outside of object? */ next_obj=0; else cont=form_button(tree, next_obj, br, &next_obj); } if( /*(which & (MU_BUTTON|MU_KEYBD)) &&*/ edit_obj!=0 && ((!cont) || (next_obj!=0 && next_obj!=edit_obj)) ) { objc_edit(tree, edit_obj, 0, idx, ED_END, &idx); } } return( next_obj ); }
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; }