/* * Update and draw (if requested) a specified slider */ void update_slid(int direction, int base, int slider, int value, int min, int max, int draw) { GRECT obrect; /* location of slider */ obrect = ObRect(slider); objc_offset(tree, slider, &obrect.g_x, &obrect.g_y); curslid = slider; if (direction == VERTICAL) (*xcpb->Sl_y)(tree, base, slider, value, min, max, slidtext); else (*xcpb->Sl_x)(tree, base, slider, value, min, max, slidtext); if (draw) { /* if requested to draw, draw the slider */ obrect.g_x--; /* account for outline */ obrect.g_y--; obrect.g_w += 2; obrect.g_h += 2; Objc_draw(tree, base, MAX_DEPTH, &obrect); /* undraw old */ objc_offset(tree, slider, &obrect.g_x, &obrect.g_y); obrect.g_x--; /* account for outline */ obrect.g_y--; Objc_draw(tree, base, MAX_DEPTH, &obrect); /* draw new */ } }
void button_center(GEM_WINDOW *wnd, OBJECT *adr_print, int axis, int click) { int xc, yc ; if (axis == 0) { if (!click) deselect(adr_print, PRINT_CENTREX) ; inv_select(adr_print, PRINT_CENTREX) ; if (!selected(adr_print, PRINT_CENTREX) && click) return ; if (adr_print[PRINT_IMAGE].ob_width < adr_print[PRINT_PAGE].ob_width) { adr_print[PRINT_IMAGE].ob_x = (adr_print[PRINT_PAGE].ob_width-adr_print[PRINT_IMAGE].ob_width)/2 ; objc_offset( adr_print, PRINT_PAGE, &xc, &yc) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_PAGE ) ; } } else { if (!click) deselect(adr_print, PRINT_CENTREY) ; inv_select(adr_print, PRINT_CENTREY) ; if (!selected(adr_print, PRINT_CENTREY) && click) return ; if (adr_print[PRINT_IMAGE].ob_height < adr_print[PRINT_PAGE].ob_height) { adr_print[PRINT_IMAGE].ob_y = (adr_print[PRINT_PAGE].ob_height-adr_print[PRINT_IMAGE].ob_height)/2 ; objc_offset(adr_print, PRINT_PAGE, &xc, &yc) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_PAGE ) ; } } }
/* sl_arrow() *========================================================================== * Handle both horizontal and vertical arrow buttons * * IN: OBJECT *tree: object tree * int base: base of slider object * int slider: slider object - this must be child of base * int obj: Arrow object clicked on * int txtobj: txt object for numbers. -1 if there is none. * Does not have to be a child of base. * int inc: increment by this amount * int min: min item number * int max: max item number * int *numvar: current value * int direction: Horizontal or vertical * void (*foo)(): Drawing routine passed in. * * OUT: void */ void sl_arrow( OBJECT *tree, int base, int slider, int obj, int inc, int min, int max, int *numvar, int direction, void (*foo)() ) { MRETS mk; int newvalue, oldvalue; GRECT slidrect; MRETS m; slidrect = ObRect( slider ); objc_offset( tree, slider, &slidrect.g_x, &slidrect.g_y ); /* account for outlines */ slidrect.g_x--; slidrect.g_y--; slidrect.g_w += 2; slidrect.g_h += 2; if( obj > 0 ) select( tree, obj ); oldvalue = *numvar; do { newvalue = *numvar + inc; if( max > min ) { if( newvalue < min ) newvalue = min; else if( newvalue > max ) newvalue = max; } else { if( newvalue > min ) newvalue = min; else if( newvalue < max ) newvalue = max; } /* if in bounds, change the slider thumb */ if( newvalue != oldvalue ) { oldvalue = newvalue; *numvar = newvalue; if( direction == HORIZONTAL ) sl_x( tree, base, slider, newvalue, min, max, foo ); else sl_y( tree, base, slider, newvalue, min, max, foo ); /* undraw old */ Objc_draw( tree, base, 3 , &slidrect ); /* was 0 */ /* draw new */ objc_offset( tree, slider, &slidrect.g_x, &slidrect.g_y ); slidrect.g_x--; slidrect.g_y--; Objc_draw( tree, base, 3 , &slidrect ); } Graf_mkstate( &mk ); } while( mk.buttons != 0 ); if( obj > 0 ) deselect( tree, obj ); Objc_draw( tree, base, MAX_DEPTH, &slidrect ); Evnt_button( 1, 1, 0, &m ); }
/* Pop_Handle() *========================================================================== * Setup strings for popup menu and execute... */ int Pop_Handle( int button, char *items[], int num_items, int *default_item, int font_size, int width ) { GRECT butn, world; int i; int obj; long max = 0L; OBJECT *tree = (OBJECT *)rs_trindex[ RS232 ]; int small = FALSE; Check_Port_Change(); butn = ObRect( button ); objc_offset( tree, button, &butn.g_x, &butn.g_y ); world = ObRect( ROOT ); objc_offset( tree, ROOT, &world.g_x, &world.g_y ); for( i = 0; i < num_items; i++ ) { if( strlen( items[i] ) > max ) max = strlen( items[i] ); } if( max <= 3L ) small = TRUE; for( i = 0; i < num_items; i++ ) { if( small ) strcpy( &blanks[i][0], " " ); else strcpy( &blanks[i][0], " "); /* get 2 blank spaces */ strcat( &blanks[i][0], items[ i ]); /* copy the string */ do { strcat( &blanks[i][0], " "); }while( strlen( &blanks[i][0] ) < width ); blank[i] = &blanks[i][0]; } obj = (*xcpb->Popup)( blank, num_items, *default_item, font_size, &butn, &world ); if( obj != -1 ) *default_item = obj; TedText( button ) = items[ *default_item ]; Objc_draw( tree, button, 0, NULL ); /* Other than the serial port mask selector... * we will slam the new setting into the hardware at the * current mask for the tt and into PORT_A for the ST */ if( button != PORT ) Set_Rsconf( cur_port ); return( obj ); }
void sl_drag( int base, int min, int max, int *numvar ) { OBJECT *tree = rs_object; int slider = ObHead(base); int newvalue, xoffset, slidx, lastvalue; MRETS mk; GRECT baserect, slidrect; newvalue = *numvar; /* get slider extent */ baserect = ObRect( base ); objc_offset( tree, base, &baserect.g_x, &baserect.g_y ); /* get slide box extent */ slidrect = ObRect( slider ); objc_offset( tree, slider, &slidrect.g_x, &slidrect.g_y ); /* find mouse offset into slide box */ Graf_mkstate( &mk ); xoffset = mk.x - (slidrect.g_x + (slidrect.g_w / 2)); /* adjust box w/h for clip */ slidrect.g_x--; slidrect.g_y--; slidrect.g_w += 2; slidrect.g_h += 2; lastvalue = min-1; while( mk.buttons != 0 ) { /* get current slide box X coordinate */ slidx = mk.x - xoffset; /* translate it to a value */ if( slidx < baserect.g_x + ObW(slider)/2 ) newvalue = min; else if( slidx > baserect.g_x + baserect.g_w - ObW(slider)/2 ) newvalue = max; else { newvalue = min + (int)( ( (long)(max-min) * (long)(slidx-baserect.g_x-ObW(slider)/2) * 1000L ) / ((long)(baserect.g_w - ObW(slider)) * 1000L) ); } if( newvalue != lastvalue ) { lastvalue = newvalue; /* update the value, and draw the slidebox */ sl_x( base, newvalue, min, max ); /* undraw old */ Objc_draw( tree, base, 2, &slidrect ); objc_offset( tree, slider, &slidrect.g_x, &slidrect.g_y ); slidrect.g_x--; slidrect.g_y--; /* draw new */ Objc_draw( tree, slider, 2, &slidrect ); } Graf_mkstate( &mk ); } *numvar = newvalue; }
/* sl_dragy() *========================================================================== * Handle dragging the slider vertically */ void sl_dragy( OBJECT *tree, int base, int slider, int min, int max, int *numvar, void (*foo)() ) { int newvalue, yoffset, slidy, lastvalue; MRETS mk; GRECT baserect, slidrect; /* get slider extent */ baserect = ObRect( base ); objc_offset( tree, base, &baserect.g_x, &baserect.g_y ); /* get slide box extent */ slidrect = ObRect( slider ); objc_offset( tree, slider, &slidrect.g_x, &slidrect.g_y ); /* find mouse offset into slide box */ Graf_mkstate( &mk ); yoffset = mk.y - (slidrect.g_y + (slidrect.g_h / 2)); /* adjust box w/h for clip */ slidrect.g_x--; slidrect.g_y--; slidrect.g_w += 2; slidrect.g_h += 2; lastvalue = min-1; while( mk.buttons ) { /* get current slide box Y coordinate */ slidy = mk.y - yoffset; /* translate it to a value */ if( slidy < baserect.g_y + ObH(slider)/2 ) newvalue = max; else if( slidy > baserect.g_y + baserect.g_h - ObH(slider)/2 ) newvalue = min; else{ newvalue = Calc_Value( slidy, baserect.g_y, baserect.g_h, ObH( slider ), max, min ); } if( newvalue != lastvalue ) { lastvalue = newvalue; /* update the value, and draw the slidebox */ *numvar = newvalue; sl_y( tree, base, slider, newvalue, min, max, foo ); /* undraw old */ Objc_draw( tree, base, 2, &slidrect ); objc_offset( tree, slider, &slidrect.g_x, &slidrect.g_y ); slidrect.g_x--; slidrect.g_y--; /* draw new */ Objc_draw( tree, base , MAX_DEPTH, &slidrect ); } Graf_mkstate( &mk ); } }
/* -------------------------- | Move Micro-wire slider | -------------------------- */ void mw_move(int inx) { int obj_y, obj_y2, obj_x; int mx, my, mk, ks; int obj_h; int red, dummy; objc_offset(setmw_dia.tree, mw_sld[inx], &dummy, &obj_y); obj_h = setmw_dia.tree[mw_sld[inx]].ob_height; graf_mkstate(&mx, &my, &mk, &ks); mk = 1; do { if (mk == 1 && my < obj_y || my >= obj_y + obj_h) { red = 0; if (my > obj_y && mw_data[inx]) { mw_data[inx]--; red = 1; } if (my < obj_y && mw_data[inx] < mw_sldd[inx]) { mw_data[inx]++; red = 1; } if (red) { set_mwsld(inx); objc_offset(setmw_dia.tree, mw_sld[inx], &obj_x, &obj_y2); if (obj_y2 < obj_y) dialog_redraw(setmw_dia.w_handle, ROOT, obj_x, obj_y2, setmw_dia.tree[mw_sld[inx]].ob_width + 4, setmw_dia.tree[mw_sld[inx]].ob_height + 4 + obj_y - obj_y2); else dialog_redraw(setmw_dia.w_handle, ROOT, obj_x, obj_y, setmw_dia.tree[mw_sld[inx]].ob_width + 4, setmw_dia.tree[mw_sld[inx]].ob_height + 4 + obj_y2 - obj_y); obj_y = obj_y2; } } graf_mkstate(&mx, &my, &mk, &ks); }while(mk == 1); }
/* Pop_Handle() *========================================================================== * Set up the text strings for pop_handle, and then show popup menu */ int Pop_Handle( int button, char *items[], int num_items, int *default_item, int font_size, int width ) { GRECT butn, world; int i; int obj; long max = 0L; OBJECT *tree = (OBJECT *)rs_trindex[ PRINTER ]; int small = FALSE; butn = ObRect( button ); objc_offset( tree, button, &butn.g_x, &butn.g_y ); world = ObRect( ROOT ); objc_offset( tree, ROOT, &world.g_x, &world.g_y ); for( i = 0; i < num_items; i++ ) { if( strlen( items[i] ) > max ) max = strlen( items[i] ); } if( max <= 3 ) small = TRUE; for( i = 0; i < num_items; i++ ) { if( small ) strcpy( &blanks[i][0], " " ); else strcpy( &blanks[i][0], " "); /* get 2 blank spaces */ strcat( &blanks[i][0], items[ i ]); /* copy the string */ do { strcat( &blanks[i][0], " "); }while( strlen( &blanks[i][0] ) < width ); blank[i] = &blanks[i][0]; } obj = (*xcpb->Popup)( blank, num_items, *default_item, font_size, &butn, &world ); if( obj != -1 ) *default_item = obj; TedText( button ) = items[ *default_item ]; Objc_draw( tree, button, 0, NULL ); /* When an item is set ( that isn't the save function ) * Immediately slam the hardware. * Don't worry tho, Cancel and ACC_CLOSE will restore if necessary */ if( button != PSAVE ) Set_Printer( &cur_value ); return( obj ); }
void sl_arrow( int base, int obj, int inc, int min, int max, int *numvar ) { OBJECT *tree = rs_object; int slider = ObHead(base); MRETS mk; int newvalue, oldvalue, delay = SL_MAX_DELAY; GRECT slidrect; slidrect = ObRect( slider ); objc_offset( tree, slider, &slidrect.g_x, &slidrect.g_y ); /* account for outlines */ slidrect.g_x--; slidrect.g_y--; slidrect.g_w += 2; slidrect.g_h += 2; if( obj > 0 ) select( tree, obj ); oldvalue = *numvar; do { newvalue = *numvar + inc; if( newvalue < min ) newvalue = min; else if( newvalue > max ) newvalue = max; /* if in bounds, change the slider thumb */ if( newvalue != oldvalue ) { oldvalue = newvalue; *numvar = newvalue; sl_x( base, newvalue, min, max ); /* undraw old */ Objc_draw( tree, base, 0, &slidrect ); /* draw new */ objc_offset( tree, slider, &slidrect.g_x, &slidrect.g_y ); slidrect.g_x--; slidrect.g_y--; Objc_draw( tree, base, MAX_DEPTH, &slidrect ); evnt_timer( delay, 0 ); if( delay > SL_MIN_DELAY ) delay -= SL_INC; } Graf_mkstate( &mk ); } while( mk.buttons != 0 ); if( obj > 0 ) deselect( tree, obj ); Objc_draw( tree, base, MAX_DEPTH, &slidrect ); }
/* set_active_slot() *========================================================================== * Make the new slot the active slot. If the slot is already active, don't * do anything. * * IN: int obj: object of new active slot * OUT: void: * * GLOBAL: int active_slot: non-zero if a slot is active. * Tells which slot object is active * SLOTS slots[]: Slot array structure */ void set_active_slot( int obj ) { OBJECT *tree = ( OBJECT *)rs_trindex[ XCONTROL ]; int item; GRECT rect; item = ( obj - SLOT0 ) >> 2; if( slots[ item ].sptr ) { set_xopt_items( XOPT_YESCPX ); active_slot = item; Select( slots[ active_slot ].obj ); #if 0 if(( AES_Version >= 0x0320 ) && ( gl_ncolors > LWHITE )) { rect = ObRect( slots[ active_slot ].obj ); objc_offset( tree, slots[ active_slot ].obj, &rect.g_x, &rect.g_y ); rect.g_x -= 1; rect.g_y -= 1; rect.g_w += 2; rect.g_h += 2; Objc_draw( tree, SLOTBASE, MAX_DEPTH, &rect ); } else #endif Objc_draw( tree, slots[ active_slot ].base, MAX_DEPTH, NULL ); } }
VOID act_allchg(WORD ex_obj, GRECT *pt, WORD chgvalue, WORD dochg) { WORD obj, newstate; GRECT o; for(obj=F1NAME; obj!=SPOLBOX; obj=the_spol[obj].ob_next) { if ( (obj != ex_obj) && (gl_sppfn[obj - F1NAME] != NULL) ) { objc_offset((OBJECT FAR *)ad_spol, obj, &o.g_x, &o.g_y); o.g_w = the_spol[obj].ob_width; o.g_h = the_spol[obj].ob_height; if ( rc_intersect(pt, &o) ) { /* make change */ newstate = the_spol[obj].ob_state; if ( dochg ) newstate |= chgvalue; else newstate &= ~chgvalue; if (newstate != the_spol[obj].ob_state) spol_chg(obj, newstate); } } } }
/* Make_Hot_Spots() *========================================================================== * Create the # Hot spot rectangles required for scrolling through the * filenames. They are in this order: * * ______________________ * | | ZONE 0 ( Above ) * | | * +--------------------+ * | | ZONE 1 ( LINE0 ) * | | * +--------------------+ * | | ZONE 2 ( LINE1 ) * | | * +--------------------+ * | | ZONE 3 ( LINE2 ) * | | * +--------------------+ * | | ZONE 4 ( LINE3 ) * | | * +--------------------+ * | | ZONE 5 ( LINE4 ) * | | * +--------------------+ * | | ZONE 6 ( LINE5 ) * | | * +--------------------+ * | | ZONE 7 ( BELOW ) * | | * ---------------------- * * NOTE: The widths of the zones are the width of the screen. * IN: int top_object: LINE0 */ void Make_Hot_Spots( int top_object ) { int i; int obj; GRECT rect; for( i = 1; i <= MAX_SLITS; i++ ) { obj = top_object + i - 1; hot_spot[ i ] = ObRect( obj ); objc_offset( tree, obj, &hot_spot[i].g_x, &hot_spot[i].g_y ); hot_spot[ i ].g_w = desk.g_w; hot_spot[ i ].g_x = desk.g_x; } rect = desk; rect.g_y = 0; rect.g_h = desk.g_y + desk.g_h; hot_spot[0] = hot_spot[7] = rect; hot_spot[ 0 ].g_h = hot_spot[ 1 ].g_y; hot_spot[ 7 ].g_y = hot_spot[ 6 ].g_y + hot_spot[ 6 ].g_h; hot_spot[ 7 ].g_h = rect.g_h - hot_spot[ 7 ].g_y + 1; /* Now, adjust the rectangles clipped to the desktop */ for( i = 0; i < 8; i++ ) rc_intersect( &rect, &hot_spot[ i ] ); }
static void do_popup( WINDOW *win, int index, int mode, void *data) { struct ssl_info_draw_param * dp = (struct ssl_info_draw_param *)data; char * items[dp->num_certs]; short x, y; unsigned int i; int dispw; LOG(("do_popup: num certs: %d", dp->num_certs)); for( i = 0; i<dp->num_certs; i++) { items[i] = malloc( 48 ); strncpy(items[i], (char*)&dp->cert_infos_n[i].issuer, 46 ); } objc_offset( FORM(win), index, &x, &y ); dp->current = MenuPopUp( items, x, y, dp->num_certs, MIN( 3, dp->num_certs), 0, P_LIST + P_WNDW + P_CHCK ); ObjcChange( OC_FORM, win, index, NORMAL, TRUE ); dp->cols = cert_display_width( &dp->cert_infos_n[dp->current] ); dp->rows = 8; dp->scrollx = 0; dp->scrolly = 0; /* Send (!) redraw ( OC_MSG ) */ ObjcDrawParent( OC_FORM, FORM(win), VERIFY_BOX_DETAILS, 1, 7 | OC_MSG ); for( i = 0; i<dp->num_certs; i++) { free( items[i] ); } }
static int OnObjectNotify(void *w, int obj) { GEM_WINDOW *wnd = (GEM_WINDOW *) w ; WEXTENSION_LDVDETAIL *wext = wnd->DlgData->UserData ; WDLG_LDVDETAIL *wdlg = wnd->Extension ; OBJECT *bobj = wnd->DlgData->BaseObject ; int i, off_x, off_y, code = -1 ; switch( obj ) { case LDVD_NPLANES : objc_offset( bobj, obj, &off_x, &off_y ) ; i = popup_formdo( &wdlg->popup_nplanes, off_x, off_y, wext->inplanes, -1 ) ; if ( i > 0 ) wext->inplanes = i ; write_text( bobj, obj, wdlg->popup_nplanes[wext->inplanes].ob_spec.free_string ) ; setup_details( wnd, 1 ) ; deselect( bobj, obj ) ; xobjc_draw( wnd->window_handle, bobj, obj ) ; break ; case LDVD_CLOSE : code = IDCANCEL ; break ; } if ( code == IDOK ) { } return( code ) ; }
/* * Highlight or de-highlight a color box */ void outline(int obj, int flag) { int color; GRECT obrect; if (flag == HILITE) color = 1; /* highlight box with foreground color */ else color = 0; /* de-light box with background color */ wind_update(TRUE); HIDE_MOUSE; vsl_color(vhandle, color); obrect = ObRect(obj); objc_offset(tree, obj, &obrect.g_x, &obrect.g_y); pxyarray[0] = pxyarray[2] = pxyarray[8] = obrect.g_x - 2; pxyarray[1] = pxyarray[7] = pxyarray[9] = obrect.g_y - 2; pxyarray[3] = pxyarray[5] = obrect.g_y + obrect.g_h + 1; pxyarray[4] = pxyarray[6] = obrect.g_x + obrect.g_w + 1; v_pline(vhandle, 5, pxyarray); pxyarray[0] = pxyarray[2] = pxyarray[8] = obrect.g_x - 3; pxyarray[1] = pxyarray[7] = pxyarray[9] = obrect.g_y - 3; pxyarray[3] = pxyarray[5] = obrect.g_y + obrect.g_h + 2; pxyarray[4] = pxyarray[6] = obrect.g_x + obrect.g_w + 2; v_pline(vhandle, 5, pxyarray); SHOW_MOUSE; wind_update(FALSE); }
static void do_bar(OBJECT *tree, SLIDER *sl, XDINFO *info) { int my, oy, dummy, old, max; graf_mkstate(&dummy, &my, &dummy, &dummy); objc_offset(tree, sl->slider, &dummy, &oy); do { old = sl->line; if (my < oy) { sl->line -= sl->lines; if (sl->line < 0) sl->line = 0; } else { sl->line += sl->lines; max = sl->n - sl->lines; if (sl->line > max) sl->line = max; } if (sl->line != old) { sl_set_slider(tree, sl, info); sl->set_selector(sl, TRUE, info); } } while (xe_button_state() & 0x1); }
/* * Draw the color boxes */ void draw_boxes(void) { GRECT obrect; int obj, objcol; int lastbox; wind_update(TRUE); HIDE_MOUSE; if (numcol < MAX_COL_SHOWN) /* init last box to be drawn */ lastbox = headbox + numcol - 1; else lastbox = headbox + MAX_COL_SHOWN - 1; vsf_interior(vhandle, SOLID); /* fill with SOLID pattern */ for (obj = headbox, objcol = headcol; obj <= lastbox; obj++, objcol++) { vsf_color(vhandle, objcol); /* fill with color of obj */ obrect = ObRect(obj); objc_offset(tree, obj, &obrect.g_x, &obrect.g_y); pxyarray[0] = obrect.g_x; pxyarray[1] = obrect.g_y; pxyarray[2] = obrect.g_x + obrect.g_w - 1; pxyarray[3] = obrect.g_y + obrect.g_h - 1; v_bar(vhandle, pxyarray); } SHOW_MOUSE; wind_update(FALSE); }
/**************************************************************** * * * affiche une boŒte de dialogue des caractŠres ASCII * * * ****************************************************************/ boolean m_ascii_box_proc(t_dialog *dialog, int exit) { int mx, my, bx, dummy; char car; switch (exit) { case ASCII_OK: return TRUE; default: mouse(&mx, &my); /* position de la premiŠre ligne */ objc_offset(dialog -> tree, ASCII_LIGNE_1, &bx, &dummy); /* d‚termination du caractŠre */ car = (char)((exit - ASCII_LIGNE_1)*32 + (mx - bx)/8); if (car == 0) car = ' '; sprintf(dialog -> tree[ASCII_CARACTERE].ob_spec.tedinfo -> te_ptext, "%c, x%02X, %3d", car, car, car); ob_draw(dialog -> info, ASCII_CARACTERE); break; } return FALSE; } /* m_ascii_box_proc */
/* * Adjust color of selected color pen with * RGB gun values requested. * * Force the redraw of the currently selected pen box. */ void adjcol( void ) { GRECT obrect; WORD clip[4]; (curnew+curcol)->rint = curscrn[R]; (curnew+curcol)->gint = curscrn[G]; (curnew+curcol)->bint = curscrn[B]; slidtext(); open_vwork(); rc_2xy( &desk, clip ); vs_clip( vhandle, 1, ( int *)clip ); vs_color(vhandle, curcol, (int *)(curnew+curcol) ); /* cjg - force a redraw fo the curbox */ vsf_color( vhandle, curcol ); /* fill with color of obj */ obrect = ObRect( curbox ); objc_offset(tree, curbox, &obrect.g_x, &obrect.g_y); pxyarray[0] = obrect.g_x; pxyarray[1] = obrect.g_y; pxyarray[2] = obrect.g_x + obrect.g_w - 1; pxyarray[3] = obrect.g_y + obrect.g_h - 1; v_bar(vhandle, pxyarray); close_vwork(); *( curdirt+curcol ) = touch_bnk = DIRTY; }
/* ob_actxywh */ VOID ob_actxywh(LONG tree, WORD obj, GRECT *p) { /* get x,y,w,h for specified object */ objc_offset((OBJECT FAR *)tree, obj, &p->g_x, &p->g_y); p->g_w = LWGET(OB_WIDTH(obj)); p->g_h = LWGET(OB_HEIGHT(obj)); } /* ob_actxywh */
/* Pop_Handle() *========================================================================== * Setup strings for popup menu and execute... */ int Pop_Handle( int button, char *items[], int num_items, int *default_item, int font_size, int width ) { GRECT butn, world; int i; int obj; long max = 0L; OBJECT *tree = (OBJECT *)rs_trindex[ GENERAL ]; int small = FALSE; butn = ObRect( button ); objc_offset( tree, button, &butn.g_x, &butn.g_y ); world = ObRect( ROOT ); objc_offset( tree, ROOT, &world.g_x, &world.g_y ); for( i = 0; i < num_items; i++ ) { if( strlen( items[i] ) > max ) max = strlen( items[i] ); } if( max <= 3L ) small = TRUE; for( i = 0; i < num_items; i++ ) { if( small ) strcpy( &blanks[i][0], " " ); else strcpy( &blanks[i][0], " "); /* get 2 blank spaces */ strcat( &blanks[i][0], items[ i ]); /* copy the string */ do { strcat( &blanks[i][0], " "); }while( strlen( &blanks[i][0] ) < width ); blank[i] = &blanks[i][0]; } obj = (*xcpb->Popup)( blank, num_items, *default_item, font_size, &butn, &world ); if( obj != -1 ) *default_item = obj; return( obj ); }
/* * Draw a button */ void draw_button(int button) { GRECT obrect; obrect = ObRect(button); objc_offset(tree, button, &obrect.g_x, &obrect.g_y); Objc_draw(tree, button, 1, &obrect); }
VOID spol_chg(WORD curr_ob, WORD newstate) { WORD x, y, w, h; objc_offset((OBJECT FAR *)ad_spol, curr_ob, &x, &y); w = the_spol[curr_ob].ob_width; h = the_spol[curr_ob].ob_height; objc_change((OBJECT FAR *)ad_spol, curr_ob, 0, x, y, w, h, newstate, TRUE); }
/* open_window() *========================================================================== * Open the Xcontrol window * * IN: VOID * OUT: BOOLEAN: TRUE if window opening was success * * GLOBAL: WINFO w: window structure */ BOOLEAN open_window( void ) { OBJECT *tree = ( OBJECT *)rs_trindex[ XCONTROL ]; clear_xconfig(); #if 0 /* cjg - re-init window width and height every time we open */ w.work.g_w = WIND_WIDTH; w.work.g_h = WIND_HEIGHT; /* Convert to 3D if possible - ONLY if AES 0x0330 or Greater */ if( AES_Version >= 0x0330 ) w.work.g_h = WIND_HEIGHT + 3; #endif if( (w.id = Wind_create( w.kind, &desk )) < 0 ) { w.id = NO_WINDOW; return( FALSE ); } wind_set( w.id, WF_NAME, w.name ); /* cjg - re-init window width and height every time we open */ w.work.g_w = WIND_WIDTH; w.work.g_h = WIND_HEIGHT; /* Convert to 3D if possible - ONLY if AES 0x0330 or Greater */ if( AES_Version >= 0x0330 ) w.work.g_h = WIND_HEIGHT + 4; Wind_calc( 0, w.kind, &w.work, &w.r ); w.r.g_x = max( desk.g_x, (desk.g_w - w.r.g_w )/2 ); w.r.g_y = max( desk.g_y, (desk.g_h - w.r.g_h )/2 ); Wind_calc( 1, w.kind, &w.r, &w.work ); /* ObX( XCONTROL ) = w.work.g_x; ObY( XCONTROL ) = w.work.g_y; objc_offset( tree, XBASE, &w.phy.g_x, &w.phy.g_y ); */ GrowShrinkBox( GROWBOX ); Wind_open( w.id, &w.r ); Wind_get( w.id, WF_WORKXYWH, ( WARGS *)&w.work ); Wind_get( w.id, WF_CURRXYWH, ( WARGS *)&w.r ); ObX( XCONTROL ) = w.work.g_x; ObY( XCONTROL ) = w.work.g_y; objc_offset( tree, XBASE, &w.phy.g_x, &w.phy.g_y ); return( TRUE ); }
void show_pencil(OBJECT *obj, WEXTENSION_PENCIL *wext) { PARMBLK parmblk ; objc_offset(obj, PINCEAU_BOX, &parmblk.pb_x, &parmblk.pb_y) ; parmblk.pb_w = obj[PINCEAU_BOX].ob_width ; parmblk.pb_h = obj[PINCEAU_BOX].ob_height ; parmblk.pb_parm = (long) wext ; draw_pencil( &parmblk ) ; }
/**************************************************************** * * * affiche une boŒte de dialogue des caractŠres ASCII * * * ****************************************************************/ char m_ascii_box(char car, int modal) { DIAINFO *info; int exit, dc; int mx, my, bx, dummy; sprintf(Dialog[ASCII].tree[ASCII_CARACTERE].ob_spec.tedinfo -> te_ptext, "%c, x%02X, %3d", car, car, car); if (modal) { info = open_dialog(Dialog[ASCII].tree, NULL, NULL, NULL, TRUE, TRUE, AUTO_DIAL|MODAL|NO_ICONIFY, 0, NULL, NULL); do { exit = X_Form_Do(NULL); /* enlŠve le flag double clic */ dc = exit & DOUBLE_CLICK; exit &= NO_CLICK; if (exit == ASCII_OK) break; mouse(&mx, &my); /* position de la premiŠre ligne */ objc_offset(Dialog[ASCII].tree, ASCII_LIGNE_1, &bx, &dummy); /* d‚termination du caractŠre */ car = (char)((exit - ASCII_LIGNE_1)*32 + (mx - bx)/8); if (car == 0) car = ' '; sprintf(Dialog[ASCII].tree[ASCII_CARACTERE].ob_spec.tedinfo -> te_ptext, "%c, x%02X, %3d", car, car, car); ob_draw(info, ASCII_CARACTERE); if (dc) /* on sort aussi avec un double clic */ break; } while (TRUE); if (exit!=W_ABANDON && exit!=W_CLOSED) { exit &= 0x7fff; ob_undostate(Dialog[ASCII].tree, exit, SELECTED); } close_dialog(info, TRUE); } else { Dialog[ASCII].proc = m_ascii_box_proc; my_open_dialog(&Dialog[ASCII], AUTO_DIAL, FAIL); } return car; } /* m_ascii_box */
bool gemtk_obj_is_inside(OBJECT * tree, short obj, GRECT *area) { GRECT obj_screen; bool ret = false; objc_offset(tree, obj, &obj_screen.g_x, &obj_screen.g_y); obj_screen.g_w = tree[obj].ob_width; obj_screen.g_h = tree[obj].ob_height; ret = RC_WITHIN(&obj_screen, area); return(ret); }
void RedrawBase( OBJECT *tree, int obj ) { GRECT rect; rect = ObRect( obj ); objc_offset( tree, obj, &rect.g_x, &rect.g_y ); rect.g_x -= 1; rect.g_y -= 1; rect.g_w += 2; rect.g_h += 2; Objc_draw( tree, ROOT, MAX_DEPTH, &rect ); }
/* XSelect() * ===================================================================== */ void XSelect( OBJECT *tree, int button ) { GRECT rect; Select( button ); rect = ObRect( button ); objc_offset( tree, button, &rect.g_x, &rect.g_y ); rect.g_x -= 5; rect.g_y -= 5; rect.g_w += 10; rect.g_h += 10; Objc_draw( tree, button, MAX_DEPTH, &rect ); }
void XDeselect( OBJECT *tree, int button ) { GRECT rect; Deselect( button ); rect = ObRect( button ); objc_offset( tree, button, &rect.g_x, &rect.g_y ); rect.g_x -= 2; rect.g_y -= 2; rect.g_w += 4; rect.g_h += 4; ObjcDraw( tree, button, MAX_DEPTH, &rect ); }