void handle_new_size(MFDB *original, GEM_WINDOW *gwnd) { VXIMAGE *vimage ; int xe, ye, wxe, whe ; int xo, yo, wo, ho ; int ww, wh, dummy ; if ( gwnd == NULL) return ; vimage = (VXIMAGE *) gwnd->Extension ; if ( ( original->fd_w == vimage->raster.fd_w ) && ( original->fd_h == vimage->raster.fd_h ) ) return ; wind_calc( WC_WORK, gwnd->window_kind, xopen, yopen, wdesk-(xopen-xdesk), hdesk-(yopen-ydesk), &xe, &ye, &wxe, &whe ) ; if ( wxe >= vimage->raster.fd_w ) wxe = vimage->raster.fd_w-1 ; if ( whe >= vimage->raster.fd_h ) whe = vimage->raster.fd_h-1 ; wind_calc( WC_BORDER, gwnd->window_kind, xe, ye, wxe, whe, &xo, &yo, &wo, &ho ) ; if ( gwnd->is_icon ) GWOnUnIconify( gwnd, gwnd->xywh_bicon ) ; else GWSetCurrXYWH( gwnd, xo, yo, wo, ho ) ; gwnd->GetWorkXYWH( gwnd, &dummy, &dummy, &wo, &ho ) ; ww = (int) ( 1000.0*(double)wo / (double)vimage->raster.fd_w ) ; wh = (int) ( 1000.0*(double)ho / (double)vimage->raster.fd_h ) ; GWSetHSlider( gwnd, 1 ) ; GWSetVSlider( gwnd, 1 ) ; GWSetHSliderSize( gwnd, ww ) ; GWSetVSliderSize( gwnd, wh ) ; set_modif( gwnd ) ; update_view( gwnd ) ; update_zview( gwnd ) ; GWRePaint( gwnd ) ; }
static int OnRestoreFulled(void *wnd) { GEM_WINDOW *gwnd = (GEM_WINDOW *) wnd ; HEX_DUMP *hex_dump = (HEX_DUMP *) gwnd->Extension ; long old_xcursor, old_ycursor, old_ystart ; int xywh[4], cxywh[4] ; old_xcursor = hex_dump->xcursor ; old_ycursor = hex_dump->ycursor ; old_ystart = hex_dump->ystart ; ShowCursor( gwnd, 0 ) ; wind_get( gwnd->window_handle, WF_PREVXYWH, &cxywh[0], &cxywh[1], &cxywh[2], &cxywh[3] ) ; wind_calc( WC_WORK, gwnd->window_kind, cxywh[0], cxywh[1], cxywh[2], cxywh[3], &xywh[0], &xywh[1], &xywh[2], &xywh[3] ) ; xywh[3] = SetupNbLines( hex_dump, xywh[3] ) ; CheckValid( hex_dump ) ; if ( ( old_xcursor != hex_dump->xcursor ) || ( old_ycursor != hex_dump->ycursor ) ) SmartInfos( gwnd ) ; if ( old_ystart != hex_dump->ystart ) SmartRePaint( gwnd, old_ystart ) ; wind_calc( WC_BORDER, gwnd->window_kind, xywh[0], xywh[1], xywh[2], xywh[3], &cxywh[0], &cxywh[1], &cxywh[2], &cxywh[3] ) ; GWOnRestoreFulled( wnd, cxywh ) ; UpdateVSlider( gwnd ) ; return( GW_EVTSTOPROUTING ) ; }
/* ***Fenster �ffnen*** */ int open_window(void) { wind_calc(WC_WORK, SWIGADGETS, deskx, desky, deskw, deskh, &wi.g_x, &wi.g_y, &wi.g_w, &wi.g_h); wi.g_w=wi.g_w&0xFFF0; wi.g_h=wi.g_h&0xFFF0; wind_calc(WC_BORDER, SWIGADGETS, wi.g_x, wi.g_y, wi.g_w, wi.g_h, &wi.g_x, &wi.g_y, &wi.g_w, &wi.g_h); wihndl=wind_create(SWIGADGETS, deskx, desky, wi.g_w, wi.g_h); if(wihndl<0) { form_alert(1, "[3][Could not create|the windows!][Cancel]"); return(-1); } wind_set(wihndl, WF_NAME, "STED", 0L); wind_set(wihndl, WF_INFO, " Spielfeld editieren", 0L); wind_calc(WC_BORDER, SWIGADGETS, 32, 32, rww<<4, rwh<<4, &wi.g_x, &wi.g_y, &wi.g_w, &wi.g_h); wi.g_x=deskx+(deskw-wi.g_w)/2; wi.g_y=desky+(deskh-wi.g_h)/2; if(aesversion>=0x0300) { wind_set(wihndl, WF_BEVENT, 1, 0, 0L); } /* Fenster �ffnen: */ wind_open(wihndl, wi.g_x, wi.g_y, wi.g_w, wi.g_h); wind_get(wihndl, WF_WORKXYWH, &wi.g_x, &wi.g_y, &wi.g_w, &wi.g_h); return(0); }
/* open_window() *========================================================================== * Open the Xcontrol window * * IN: VOID * OUT: BOOLEAN: TRUE if window opening was success * * GLOBAL: WINFO w: window structure */ void open_window( void ) { 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; #if 0 /* Convert to 3D if possible - ONLY if AES 0x0330 or Greater */ if( AES_Version >= 0x0330 ) w.work.g_h = WIND_HEIGHT + 4; #endif wind_calc( 0, w.kind, w.work.g_x, w.work.g_y, w.work.g_w, w.work.g_h, &w.r.g_x, &w.r.g_y, &w.r.g_w, &w.r.g_h ); 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.g_x, w.r.g_y, w.r.g_w, w.r.g_h, &w.work.g_x, &w.work.g_y, &w.work.g_w, &w.work.g_h ); GrowShrinkBox( GROWBOX ); Wind_open( w.id, &w.r ); wind_get( w.id, WF_WORKXYWH, &w.work.g_x,&w.work.g_y,&w.work.g_w,&w.work.g_h ); wind_get( w.id, WF_CURRXYWH, &w.r.g_x,&w.r.g_y,&w.r.g_w,&w.r.g_h ); ObX( FRONT ) = w.work.g_x; ObY( FRONT ) = w.work.g_y; }
static void OnSize(void *wnd, int xywh[4]) { GEM_WINDOW *gwnd = (GEM_WINDOW *) wnd ; HEX_DUMP *hex_dump = (HEX_DUMP *) gwnd->Extension ; long old_xcursor, old_ycursor, old_ystart ; int x, y, w, h, w_max ; old_xcursor = hex_dump->xcursor ; old_ycursor = hex_dump->ycursor ; old_ystart = hex_dump->ystart ; GWGetCurrXYWH( gwnd, &x, &y, &w, &h ) ; wind_calc( WC_WORK, gwnd->window_kind, xywh[0], xywh[1], xywh[2], xywh[3], &x, &y, &w, &h ) ; w_max = hex_dump->nb_char_on_line * hex_dump->w_char ; h = SetupNbLines( hex_dump, h ) ; CheckValid( hex_dump ) ; if ( ( old_xcursor != hex_dump->xcursor ) || ( old_ycursor != hex_dump->ycursor ) ) SmartInfos( gwnd ) ; if ( old_ystart != hex_dump->ystart ) SmartRePaint( gwnd, old_ystart ) ; if ( w > w_max ) w = w_max ; wind_calc( WC_BORDER, gwnd->window_kind, x, y, w, h, &xywh[0], &xywh[1], &xywh[2], &xywh[3] ) ; GWOnSize( wnd, xywh ) ; UpdateVSlider( gwnd ) ; }
static int OnFulled(void *wnd) { GEM_WINDOW *gwnd = (GEM_WINDOW *) wnd ; HEX_DUMP *hex_dump = (HEX_DUMP *) gwnd->Extension ; long old_xcursor, old_ycursor, old_ystart ; int xywh[4], cxywh[4] ; int w_max ; old_xcursor = hex_dump->xcursor ; old_ycursor = hex_dump->ycursor ; old_ystart = hex_dump->ystart ; cxywh[0] = xdesk ; cxywh[1] = ydesk ; cxywh[2] = wdesk ; cxywh[3] = hdesk ; wind_calc( WC_WORK, gwnd->window_kind, cxywh[0], cxywh[1], cxywh[2], cxywh[3], &xywh[0], &xywh[1], &xywh[2], &xywh[3] ) ; xywh[3] = SetupNbLines( hex_dump, xywh[3] ) ; CheckValid( hex_dump ) ; if ( ( old_xcursor != hex_dump->xcursor ) || ( old_ycursor != hex_dump->ycursor ) ) SmartInfos( gwnd ) ; if ( old_ystart != hex_dump->ystart ) SmartRePaint( gwnd, old_ystart ) ; w_max = hex_dump->nb_char_on_line * hex_dump->w_char ; if ( xywh[2] > w_max ) xywh[2] = w_max ; wind_calc( WC_BORDER, gwnd->window_kind, xywh[0], xywh[1], xywh[2], xywh[3], &cxywh[0], &cxywh[1], &cxywh[2], &cxywh[3] ) ; GWOnFulled( wnd, cxywh ) ; UpdateVSlider( gwnd ) ; return( 0 ) ; }
void coup_mu_mesag( const short *message ) { GRECT *rect ; short dummy ; switch( message[0] ) { case WM_REDRAW : form_redraw( message, &coup_form ) ; break ; case WM_MOVED : rect = (GRECT *) &(message[4]) ; wind_set( coup_form.fm_handle, WF_CURRXYWH, PTRS( rect ) ) ; coup_form.fm_box = *rect ; wind_calc( WC_WORK, wind_form_kind, ELTS( coup_form.fm_box ), &coup_form.fm_ptr[ROOT].ob_x, &coup_form.fm_ptr[ROOT].ob_y, &dummy, &dummy ) ; break ; case WM_TOPPED : if( message[3] == coup_form.fm_handle ) wind_set( coup_form.fm_handle, WF_TOP ) ; break ; case WM_BOTTOM : wind_set( coup_form.fm_handle, WF_BOTTOM ) ; break ; case WM_CLOSED : save_couple( edit_coup_ref, edit_coup_block, edit_coup_cptr ) ; close_couple() ; break ; case WM_ALLICONIFY : iconify_all( coup_form.fm_box.g_x ) ; break ; case WM_ICONIFY : wind_set( coup_form.fm_handle, WF_UNICONIFYXYWH, ELTS( coup_form.fm_box ) ) ; coup_form.fm_box = *(GRECT *)&message[4] ; coup_form.iconified = TRUE ; wind_set( coup_form.fm_handle, WF_ICONIFY, ELTS( coup_form.fm_box ) ) ; wind_title( coup_form.fm_handle, coup_form.icon_title ) ; send_redraw_message( &coup_form.fm_box, coup_form.fm_handle ) ; break ; case WM_UNICONIFY : wind_get( coup_form.fm_handle, WF_UNICONIFY, REFS( coup_form.fm_box ) ) ; wind_calc( WC_WORK, wind_form_kind, ELTS( coup_form.fm_box ), &coup_form.fm_ptr[ROOT].ob_x, &coup_form.fm_ptr[ROOT].ob_y, &dummy, &dummy ) ; wind_set( coup_form.fm_handle, WF_UNICONIFY, ELTS( coup_form.fm_box ) ) ; wind_title( coup_form.fm_handle, coup_form.title_str ) ; coup_form.iconified = FALSE ; break ; default : break ; } }
void OnMoveRTZoom(void *wind, int xywh[4]) { GEM_WINDOW *wnd = (GEM_WINDOW *) wind ; int mask = 0xFFFF ; int x, y, w, h ; if ( config.rt_optimizepos ) mask = 0xFFF0 ; wind_calc( WC_WORK, NAME | MOVER, xywh[0], xywh[1], xywh[2], xywh[3], &x, &y, &w, &h ) ; x &= mask ; wind_calc( WC_BORDER, NAME | MOVER, x, y, w, h, &xywh[0], &xywh[1], &xywh[2], &xywh[3] ) ; wind_set( wnd->window_handle, WF_CURRXYWH, xywh[0], xywh[1], xywh[2], xywh[3] ) ; wind_get( wnd->window_handle, WF_WORKXYWH, &rtx, &rty, &rtw, &rth ) ; }
/* SetIntroWindow() * ================================================================ * RETURN: if < 0, error */ int SetIntroWindow( void ) { /* Open the Intro window */ ad_tree = ad_intro; ActiveTree( ad_tree ); FormCenter( ad_tree, &gl_work ); ObX( ROOT ) = gl_work.g_x; ObY( ROOT ) = gl_work.g_y; wid = wind_create( MOVER | NAME | CLOSE, gl_full.g_x, gl_full.g_y, gl_full.g_w, gl_full.g_h ); if( wid > 0 ) { wind_set( wid, WF_NAME, wtitle ); wind_calc( WC_BORDER, MOVER | NAME | CLOSE, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h, &gl_curr.g_x, &gl_curr.g_y, &gl_curr.g_w, &gl_curr.g_h ); wind_open( wid, gl_curr.g_x, gl_curr.g_y, gl_curr.g_w, gl_curr.g_h ); } else form_alert( 1, nowin ); return( wid ); }
void xw_calc(int w_ctype, int w_flags, RECT *input, RECT *output, OBJECT *menu) { int bar, boxes, height; wind_calc(w_ctype, w_flags, input->x, input->y, input->w, input->h, &output->x, &output->y, &output->w, &output->h); if (menu != NULL) { xw_find_objects(menu, &bar, &boxes); height = menu[bar].ob_height + 1; if (w_ctype == WC_WORK) { output->y += height; output->h -= height; } else { output->y -= height; output->h += height; } } }
int init_rtwindow(void) { char name[50] ; int err = 0 ; if ( WndRTZoom ) WndRTZoom->OnClose( WndRTZoom ) ; ; WndRTZoom = RTZoomCreateWindow() ; if ( WndRTZoom ) { int mask = 0xFFFF ; int x, y, w, h ; if ( config.rt_optimizepos ) mask = 0xFFF0 ; wind_calc( WC_BORDER, ATTR_WRTZOOM, ( Xmax-config.rt_width ) & mask, Ymax - config.rt_height, config.rt_width, config.rt_height, &x, &y, &w, &h ) ; WndRTZoom->OnDraw = OnDrawRTZoom ; WndRTZoom->OnMove = OnMoveRTZoom ; WndRTZoom->OnClose = OnCloseRTZoom ; WndRTZoom->OnRButtonDown = OnRButtonDownRTZoom ; GWOpenWindow( WndRTZoom, x, y, w, h ) ; sprintf( name, msg[MSG_TITRERTZOOM], config.rt_zoomlevel ) ; GWSetWindowCaption( WndRTZoom, name ) ; wind_get( WndRTZoom->window_handle, WF_WORKXYWH, &rtx, &rty, &rtw, &rth ) ; } else err = -3 ; return( err ) ; }
/* ***Grafik laden und vorbereiten*** */ long initgraf(void) { char alerttxt[64]; int xy[4]; /* Offscreen vorbereiten: */ wind_calc(WC_WORK, SWIGADGETS, deskx, desky, deskw, deskh, &xy[0], &xy[1], &xy[2], &xy[3]); offscr.fd_addr=(void *)Malloc((long)(xy[2]+7)/8*xy[3]*bipp); /* Get memory */ if((long)offscr.fd_addr<=0L) { return((long)offscr.fd_addr); } offscr.fd_w=xy[2]; offscr.fd_h=xy[3]; offscr.fd_wdwidth=(xy[2]+15)>>4; offscr.fd_stand=0; offscr.fd_nplanes=bipp; /* Bodengrafik laden und vorbereiten: */ bdnname[15]='0'+bipp; if( loadpic(bdnname, &bodenfdb) ) return(-1); /* Einheitengrafik laden und vorbereiten: */ einhname[17]='0'+bipp; if( loadpic(einhname, &einhfdb) ) return(-1); return(0); }
void fg_init(WINDFORM *wind) { form_center(wind->formtree,&wind->form.x,&wind->form.y, &wind->form.w,&wind->form.h); wind_calc(WC_BORDER,wind->windkind,wind->form.x,wind->form.y, wind->form.w,wind->form.h,&wind->wind.x,&wind->wind.y, &wind->wind.w,&wind->wind.h); wind->whandle=wind_create(wind->windkind,wind->wind.x,wind->wind.y, wind->wind.w,wind->wind.h); wind_set(wind->whandle,WF_NAME,wind->wind_title); if(wind == &windforms[WIND_CTRL]) wind_set(wind->whandle,WF_BEVENT,1,0,0,0); /* untoppable */ wind_calc(WC_WORK,wind->windkind,wind->wind.x,wind->wind.y, wind->wind.w,wind->wind.h,&wind->form.x,&wind->form.y, &wind->form.w,&wind->form.h); wind->formtree[wind->firstobj].ob_x=wind->form.x; wind->formtree[wind->firstobj].ob_y=wind->form.y; wind->formtree[wind->firstobj].ob_width=wind->form.w; wind->formtree[wind->firstobj].ob_height=wind->form.h; }
/* ***Fenster anmelden + Dialog zeichnen*** */ int wdial_init(OBJECT *tree, char *title) { short wx, wy, ww, wh; int dwhndl; form_center(tree, &wx, &wy, &ww, &wh); /* Gr��e holen */ wind_calc(WC_BORDER, NAME|MOVER, wx, wy, ww, wh, &wx, &wy, &ww, &wh); dwhndl=wind_create(NAME|MOVER, wx, wy, ww, wh); /* Fenster anmelden */ if(dwhndl<0) return(NULL); wind_set(dwhndl, WF_NAME, title); /* Name setzen */ wind_open(dwhndl, wx, wy, ww, wh); /* Fenster �ffnen */ objc_draw(tree, ROOT, MAX_DEPTH, wx, wy, ww, wh); /* Dialog zeichnen */ return(dwhndl); }
/*---------------------------------------------------*/ void init() { int n,xs,ys; int bootdev; long old_stack; ap_id=appl_init(); if (!_app) (void)menu_register(ap_id," BlowUP030"); if (ap_id==-1) { puts("ERROR: ap_id=-1 !"); exit(1); } for (n=0;n<rs_numobs;n++) /*rsrc_obfix(rs_object,n);*/ { rs_object[n].ob_x=(rs_object[n].ob_x&255)*8+ (rs_object[n].ob_x>>8); rs_object[n].ob_y=(rs_object[n].ob_y&255)*16+ (rs_object[n].ob_y>>8); rs_object[n].ob_width=(rs_object[n].ob_width&255)*8+ (rs_object[n].ob_width>>8); rs_object[n].ob_height=(rs_object[n].ob_height&255)*16+ (rs_object[n].ob_height>>8); } wind_calc(WC_BORDER,NAME|MOVER|CLOSER,0,0,rs_object[TREE1].ob_width,rs_object[TREE1].ob_height, &xs,&ys,&cw,&ch); open_f=0; if (_app) { open_w(); if (!open_f) quit_all(); } get_conf(); if (mon_type()==0) rs_object[SAVER].ob_state|=DISABLED; (void)graf_mouse(ARROW,0); old_stack=Super(0L); bootdev=*(int*)(0x446); boot_prg_name[0]=(char)(bootdev+65); (void)Super((void*)old_stack); }
void w_moved(int w_handle, int x, int y, int w, int h) { WINDOW_DESCR *wd; wd = get_window_descr(w_handle); if (wd != NULL) { #ifdef WND_DEBUG wnd_report("wind_calc"); #endif wind_calc(WC_WORK, wd->flags, x, y, w, h, &x, &y, &w, &h); w = (w < wd->xsize) ? w : wd->xsize; h = (h < wd->ysize) ? h : wd->ysize; align_window(wd, x, y, w, h); #ifdef WND_DEBUG sprintf(wdbg_tmpbuf, "moved window %1d", wd->handle); wnd_report(wdbg_tmpbuf); #endif } }
main() { gem_init(); whandle = wind_create (4095, 20, 20, 280, 150); /* 4095 = tous les organes de commande */ if (whandle < 0) form_alert (1, "[3][D‚sol‚!|Il ne reste plus de handle fenˆtre libre!][OK]" ); else { wind_open (whandle, 20, 20, 280, 150); /* Calcul de la zone de travail */ wind_calc (1, 4095, 20, 20, 280, 150, &x, &y, &w, &h); /* Conversion de hauteur/largeur du deuxiŠme angle (x2/y2) */ pxyarray[0] = x; pxyarray[1] = y; pxyarray[2] = x+w-1; pxyarray[3] = y+h-1; /* Effacer la zone de travail */ vsf_interior (handle, 0); /* Remplir avec couleur du fond */ vsf_perimeter (handle, 0); /* Pas de cadre */ v_bar (handle, pxyarray); vsf_perimeter (handle, 1); /* R‚activer le cadre */ Crawcin(); /* Attendre appui touche */ wind_close (whandle); wind_delete (whandle); } gem_exit(); }
/* ------------------------- | Dialog window handler | ------------------------- */ int dialog_window(int wind_id, OBJECT *dialog, int action, int ext) { int x, y, w, h, s; int w_x, w_y, w_w, w_h; int hndl, sel; switch(action) { case CLS_DIA: wind_close(wind_id); wind_delete(wind_id); break; case OPN_DIA: form_center(dialog, &x, &y, &w, &h); wind_calc(WC_BORDER, MOVER|NAME, x, y, w, h, &w_x, &w_y, &w_w, &w_h); hndl = open_window(MOVER|NAME, w_x, w_y, w_w, w_h, ""); return hndl; case RDW_DIA: s = first_rect(wind_id, 0); while(s) { objc_draw(dialog, ext, MAX_DEPTH, r_xy[0], r_xy[1], r_xy[2], r_xy[3]); s = next_rect(wind_id, 0); } break; case ACT_DIA: sel = win_formdo(dialog, ext, wind_id); if (dialog[sel].ob_flags & EXIT) dialog[sel].ob_state &= ~SELECTED; return sel; } return 0; }
GEM_WINDOW *CreateImgBrowser(char *filename) { GEM_WINDOW *wnd ; OBJECT *bobj ; DLGDATA dlg_data ; WBROWSER *wb ; int xo, yo, wo, ho, dummy ; memset( &dlg_data, 0, sizeof(DLGDATA) ) ; dlg_data.RsrcId = FORM_IMGBROWSER ; dlg_data.ExtensionSize = sizeof(WBROWSER) ; dlg_data.UserData = calloc( 1, sizeof(CMD_BROWSER) ) ; dlg_data.OnInitDialog = OnInitDialogIBrowser ; dlg_data.OnObjectNotify = OnObjectNotifyIBrowser ; dlg_data.OnCloseDialog = OnCloseIBrowser ; dlg_data.WKind = SMALLER ; strcpy( dlg_data.ClassName, "Image Browser" ) ; wnd = GWCreateWindowCmdBar( &dlg_data ) ; if ( wnd == NULL ) { free( dlg_data.UserData ) ; return( NULL ) ; } bobj = wnd->DlgData->BaseObject ; wb = wnd->Extension ; wnd->OnDraw = OnDrawIBrowser ; wnd->GetWorkXYWH = GetWorkXYWHIBrowser ; wnd->OnTxtBubble = OnTxtBubbleIBrowser ; wnd->ProgPc = ProgPcIBrowser ; wnd->OnLButtonDown = OnLButtonDownIBrowser ; wnd->OnMouseMove = OnMouseMoveIBrowser ; wnd->OnKeyPressed = OnKeyPressedIBrowser ; wnd->OnTopped = OnToppedIBrowser ; wnd->flags |= FLG_MUSTCLIP ; GWSetWndRscIcon( wnd, FORM_ICONS, ICN_IBROWSER ) ; if ( filename ) { strcpy( wb->nom, filename ) ; DisplayImg( wnd, 1, 1 ) ; } else { /* Fenetre sans fichier image */ open_where( wnd->window_kind, bobj[0].ob_width, bobj[0].ob_height, &xo, &yo, &wo, &ho ) ; wind_calc( WC_WORK, wnd->window_handle, xo, yo, wo,ho, &bobj[0].ob_x, &bobj[0].ob_y, &dummy, &dummy ) ; GWOpenWindow( wnd, xo, yo, wo, ho ) ; GWSetWindowCaption( wnd, "Image Browser" ) ; update_nav( wnd ) ; if ( haute_resolution ) { xopen = xo ; yopen = ydesk + ho ; } else { xopen = xdesk ; yopen += ho ; } } return( wnd ) ; }
GEM_WINDOW *CreateHexDump(char *filename) { HEX_DUMP tmp_hex_dump ; GEM_WINDOW *gwnd ; long i, size, modulo ; int xywh[4], cxywh[4] ; int wkind ; char buf[300] ; unsigned char *c ; wkind = NAME|CLOSER|FULLER|MOVER|INFO|SIZER|UPARROW|DNARROW|VSLIDE ; if ( !config.w_info ) wkind &= ~INFO ; wkind |= SMALLER ; gwnd = GWCreateWindow( wkind, sizeof(HEX_DUMP), HEXDUMP_CLASSNAME ) ; if ( gwnd ) { HEX_DUMP *hex_dump = (HEX_DUMP *) gwnd->Extension ; FILE *stream ; long len, alloc_size ; int w, h, xo, yo, wo, ho ; strcpy( hex_dump->filename, filename ) ; stream = fopen( filename, "rb" ) ; if ( stream == NULL ) { GWDestroyWindow( gwnd ) ; form_stop(1, msg[MSG_FILENOTEXIST]) ; return( NULL ) ; } hex_dump->len = filelength( fileno( stream ) ) ; for ( len = hex_dump->len, w = 0; w < 8; w++, len >>= 4, hex_dump->nb_digits++ ) if ( len == 0 ) break ; BuildFormatLine( hex_dump, DT_MIXED ) ; alloc_size = hex_dump->len ; modulo = alloc_size % hex_dump->nb_raw_bytes_on_line ; if ( modulo ) alloc_size += hex_dump->nb_raw_bytes_on_line ; hex_dump->raw_data = (unsigned char *) malloc( alloc_size ) ; if ( hex_dump->raw_data == NULL ) { fclose( stream ) ; GWDestroyWindow( gwnd ) ; form_error( 8 ) ; return( NULL ) ; } if ( modulo ) { modulo = hex_dump->nb_raw_bytes_on_line - modulo ; memset( &hex_dump->raw_data[hex_dump->len], ' ', modulo ) ; hex_dump->modulo = modulo ; } hex_dump->ttype.hcar = 13 ; hex_dump->ttype.angle = 0 ; hex_dump->ttype.font = 1 ; hex_dump->ttype.color = 1 ; hex_dump->ttype.attribute = 0 ; hex_dump->ttype.hdisp = 0 ; hex_dump->ttype.vdisp = 5 ; set_texttype( &hex_dump->ttype ) ; hex_dump->w_char = hex_dump->ttype.wcell ; hex_dump->h_char = hex_dump->ttype.hcell ; hex_dump->interline = 0 ; hex_dump->total_nb_char_on_line = hex_dump->nb_char_on_line ; hex_dump->total_nb_lines = hex_dump->len / (long)hex_dump->nb_raw_bytes_on_line ; if ( hex_dump->len % hex_dump->nb_char_on_line ) hex_dump->total_nb_lines++ ; c = hex_dump->raw_data ; sprintf( buf, hex_dump->fmt, 0L, c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15] ) ; hex_dump->nb_bytes_for_hexa_dump = (int) strlen( buf ) ; BuildFormatLine( hex_dump, DT_MIXED ) ; w = hex_dump->nb_char_on_line * hex_dump->w_char ; h = (int) ((90L * (long)(Ymax-yopen)) / 100L) ; h = SetupNbLines( hex_dump, h ) ; cxywh[0] = xdesk ; cxywh[1] = ydesk ; cxywh[2] = wdesk ; cxywh[3] = hdesk ; wind_calc( WC_WORK, gwnd->window_kind, cxywh[0], cxywh[1], cxywh[2], cxywh[3], &xywh[0], &xywh[1], &xywh[2], &xywh[3] ) ; memcpy( &tmp_hex_dump, hex_dump, sizeof(HEX_DUMP) ) ; SetupNbLines( &tmp_hex_dump, xywh[3] ) ; hex_dump->nb_max_lines_on_window = tmp_hex_dump.nb_lines_on_window ; size = (sizeof(char*) + (long)hex_dump->total_nb_char_on_line + 1L) * hex_dump->nb_max_lines_on_window ; hex_dump->formatted_txt = (unsigned char**) calloc( 1, size ) ; if ( hex_dump->formatted_txt == NULL ) { free( hex_dump->raw_data ) ; GWDestroyWindow( gwnd ) ; form_error( 8 ) ; return( NULL ) ; } open_where( gwnd->window_kind, w, h, &xo, &yo, &wo, &ho ) ; if ( GWOpenWindow( gwnd, xo, yo, wo, ho ) != 0 ) { free( hex_dump->formatted_txt ) ; free( hex_dump->raw_data ) ; GWDestroyWindow( gwnd ) ; form_stop(1, msg[MSG_NOMOREWINDOW]) ; return( NULL ) ; } AttachHexDumpToWindow( gwnd ) ; if ( hex_dump->len > 512L*1024L ) { size_t offset = 0 ; size_t packet_size = 64L*1024L ; int pc ; while ( !feof( stream) && ( offset < hex_dump->len ) ) { offset += fread( &hex_dump->raw_data[offset], sizeof(char), packet_size, stream ) ; pc = (int) (( 100L * offset ) / hex_dump->len) ; gwnd->ProgPc( gwnd, pc, "" ) ; } GWSetWindowInfo( gwnd, "" ) ; } else fread( hex_dump->raw_data, hex_dump->len, 1, stream ) ; fclose( stream ) ; c = (unsigned char*) hex_dump->formatted_txt + hex_dump->nb_max_lines_on_window * sizeof(char*) ; hex_dump->ystart_fmt = 0 ; for ( i = hex_dump->ystart_fmt; i < hex_dump->ystart_fmt + hex_dump->nb_max_lines_on_window; i++, c += 1L + hex_dump->total_nb_char_on_line ) { hex_dump->formatted_txt[i] = c ; FormatLine( hex_dump, i ) ; } /* CreateTestFile( "I:\\DUMP.HEX" ) ;*/ } return( gwnd ) ; }
SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags) { int maxwidth, maxheight; Uint32 modeflags, screensize; SDL_bool use_shadow; GEM_FreeBuffers(this); /*--- Verify if asked mode can be used ---*/ if (flags & SDL_FULLSCREEN) { maxwidth=VDI_w; maxheight=VDI_h; } else { /* Windowed mode */ maxwidth=GEM_desk_w; maxheight=GEM_desk_h; } if ((maxwidth < width) || (maxheight < height) || (VDI_bpp != bpp)) { SDL_SetError("Couldn't find requested mode in list"); return(NULL); } /*--- Allocate the new pixel format for the screen ---*/ if ( ! SDL_ReallocFormat(current, VDI_bpp, VDI_redmask, VDI_greenmask, VDI_bluemask, VDI_alphamask) ) { SDL_SetError("Couldn't allocate new pixel format for requested mode"); return(NULL); } /*--- Allocate shadow buffer if needed ---*/ use_shadow=SDL_FALSE; if (flags & SDL_FULLSCREEN) { if (!VDI_screen) { /* No access to real framebuffer, use shadow surface */ use_shadow=SDL_TRUE; } else { if (VDI_format==VDI_FORMAT_INTER) { /* Real framebuffer, interleaved bitplanes, use shadow surface */ use_shadow=SDL_TRUE; } else if (flags & SDL_DOUBLEBUF) { /* Real framebuffer, double-buffered, use shadow surface */ use_shadow=SDL_TRUE; modeflags |= SDL_DOUBLEBUF; } } } else { /* Windowed mode, always with shadow surface */ use_shadow=SDL_TRUE; } if (use_shadow) { screensize = width * height * VDI_pixelsize; GEM_buffer = Atari_SysMalloc(screensize, MX_PREFTTRAM); if (GEM_buffer==NULL) { fprintf(stderr,"Unable to allocate shadow buffer\n"); return NULL; } memset(GEM_buffer, 0, screensize); } /*--- Initialize screen ---*/ modeflags = 0; if (VDI_bpp == 8) { modeflags |= SDL_HWPALETTE; } if (flags & SDL_FULLSCREEN) { GEM_LockScreen(this); GEM_ClearScreen(this); modeflags |= SDL_FULLSCREEN; if (VDI_screen && (VDI_format==VDI_FORMAT_PACK) && !use_shadow) { modeflags |= SDL_HWSURFACE; } else { modeflags |= SDL_SWSURFACE; } } else { int posx,posy; short x2,y2,w2,h2; GEM_UnlockScreen(this); /* Center our window */ posx = GEM_desk_x; posy = GEM_desk_y; if (width<GEM_desk_w) posx += (GEM_desk_w - width) >> 1; if (height<GEM_desk_h) posy += (GEM_desk_h - height) >> 1; /* Calculate our window size and position */ if (!(flags & SDL_NOFRAME)) { GEM_win_type=NAME|MOVER|CLOSER|SMALLER; if (flags & SDL_RESIZABLE) { GEM_win_type |= FULLER|SIZER; modeflags |= SDL_RESIZABLE; } } else { GEM_win_type=0; modeflags |= SDL_NOFRAME; } if (!wind_calc(0, GEM_win_type, posx, posy, width, height, &x2, &y2, &w2, &h2)) { GEM_FreeBuffers(this); fprintf(stderr,"Can not calculate window attributes\n"); return NULL; } /* Create window */ GEM_handle=wind_create(GEM_win_type, x2, y2, w2, h2); if (GEM_handle<0) { GEM_FreeBuffers(this); fprintf(stderr,"Can not create window\n"); return NULL; } /* Setup window name */ wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0); /* Open the window */ wind_open(GEM_handle,x2,y2,w2,h2); modeflags |= SDL_SWSURFACE; } /* Set up the new mode framebuffer */ current->flags = modeflags; current->w = width; current->h = height; if (use_shadow) { current->pixels = GEM_buffer; current->pitch = width * (VDI_bpp >> 3); } else {
int handle_message(int pipe[8]) { static int first_open=0; int wnr,error; /* ,avmsg[8]; */ char *vamsg,*o; #ifdef DEBUG char tmp[128]; #endif switch (pipe[0]) { case AC_OPEN: if (pipe[4] == acc_id) { if(first_open) { if(windforms[WIND_CTRL].wind_open) wind_set(windforms[WIND_CTRL].whandle,WF_TOP); else fgbg=FG; } else { fg_init(&windforms[WIND_CTRL]); fgbg=FG; first_open=1; } } #ifdef DEBUG form_alert(1,"[1][Got AC_OPEN][Ok]"); #endif break; case AC_CLOSE: /* if (pipe[4] == acc_id) */ { #ifdef DEBUG sprintf(tmp,"[1][Got AC_CLOSE|ACC id: %d|pipe4: %d][Ok]",acc_id,pipe[4]); form_alert(1,tmp); #endif if(windforms[WIND_CTRL].wind_open) { wind_close(windforms[WIND_CTRL].whandle); wind_delete(windforms[WIND_CTRL].whandle); windforms[WIND_CTRL].wind_open=0; } if(windforms[WIND_INFO].wind_open) { wind_close(windforms[WIND_INFO].whandle); wind_delete(windforms[WIND_INFO].whandle); windforms[WIND_INFO].wind_open=0; } #ifdef DEBUG sprintf(tmp,"[1][Filepos: %ld][Ok]",filepos); form_alert(1,tmp); #endif file_was_open=file_open; if(file_open) close_file(fd); closed_acc=1; return 1; } /* break; */ case AP_TERM: quit=1; return 1; /* switch(pipe[5]) { case AP_RESCHG: printf("Got AP_RESCHG!\n"); break; case AP_TERM: printf("Got AP_TERM!"); break; default: printf("Got unknown AP_TERM!"); } */ /* break; */ case RESCHG_COMPLETED: /* printf("Got RESCHG_COMPLETED!"); */ break; case WM_REDRAW: if((wnr=find_windform(pipe[3]))>=0) update_objects(&windforms[wnr],windforms[wnr].firstobj, windforms[wnr].objdepth,pipe); break; case WM_MOVED: if((wnr=find_windform(pipe[3]))>=0) { wind_set(windforms[wnr].whandle,WF_CURRXYWH,pipe[4],pipe[5],pipe[6],pipe[7]); windforms[wnr].wind.x=pipe[4]; windforms[wnr].wind.y=pipe[5]; windforms[wnr].wind.w=pipe[6]; windforms[wnr].wind.h=pipe[7]; wind_calc(WC_WORK,windforms[wnr].windkind, windforms[wnr].wind.x,windforms[wnr].wind.y, windforms[wnr].wind.w,windforms[wnr].wind.h, &windforms[wnr].form.x,&windforms[wnr].form.y, &windforms[wnr].form.w,&windforms[wnr].form.h); windforms[wnr].formtree[windforms[wnr].firstobj].ob_x=windforms[wnr].form.x; windforms[wnr].formtree[windforms[wnr].firstobj].ob_y=windforms[wnr].form.y; windforms[wnr].formtree[windforms[wnr].firstobj].ob_width=windforms[wnr].form.w; windforms[wnr].formtree[windforms[wnr].firstobj].ob_height=windforms[wnr].form.h; if(replay) update_time(); } break; case WM_CLOSED: if((wnr=find_windform(pipe[3]))>=0) { wind_close(windforms[wnr].whandle); windforms[wnr].wind_open=0; if(wnr==WIND_CTRL) { if(windforms[WIND_INFO].wind_open) { wind_close(windforms[WIND_INFO].whandle); windforms[WIND_INFO].wind_open=0; } return 1; } else wind_delete(windforms[wnr].whandle); } break; case WM_TOPPED: if((wnr=find_windform(pipe[3]))>=0) wind_set(pipe[3],WF_TOP); break; case AP_DRAGDROP: if(wind_find(pipe[4],pipe[5]) == windforms[WIND_CTRL].whandle) { if(do_dragdrop(pipe,DD_OK)) { exit_replay(); if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED) toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL); Dsp_Hf1(0); if(windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_state & SELECTED) toggle_object(&windforms[WIND_CTRL],CTRL_PAUSE,SET_NORMAL); replay_pause=0; filepos=0; fd=reopen_file(); filesize=Fseek(0L,fd,2); Fseek(0L,fd,0); if((error=getmp2info(fd))==MP2_NOERR) { update_time(); setfilename(filename); if(!(pipe[6] & K_ALT)) init_replay(); } else { exit_replay(); show_mp2_error(error); close_file(fd); strcpy(windforms[WIND_CTRL].wind_title,"MPEG"); wind_set(windforms[WIND_CTRL].whandle,WF_NAME, windforms[WIND_CTRL].wind_title); setfilename("MPEGFILE"); } } } else { do_dragdrop(pipe,DD_NAK); } break; case VA_START: vamsg=*((char **)&pipe[3]); strcpy(path,vamsg); /* This *should* be sent to the application which sent the VA_START msg, but it seems to hang Thing doing it. */ /* avmsg[0]=AV_STARTED; avmsg[1]=app_id; avmsg[2]=0; avmsg[3]=pipe[3]; avmsg[4]=pipe[4]; appl_write(pipe[1],5*2,avmsg); */ if((o=strchr(path,' '))!=NULL) o[0]='\0'; o=strrchr(path,'\\'); strcpy(filename,&o[1]); o=strrchr(path,'\\'); strncpy(o,"\\*.MP?",6); o[6] = '\0'; exit_replay(); if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED) toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL); Dsp_Hf1(0); if(windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_state & SELECTED) toggle_object(&windforms[WIND_CTRL],CTRL_PAUSE,SET_NORMAL); replay_pause=0; filepos=0; fd=reopen_file(); filesize=Fseek(0L,fd,2); Fseek(0L,fd,0); if((error=getmp2info(fd))==MP2_NOERR) { update_time(); setfilename(filename); init_replay(); } else { exit_replay(); show_mp2_error(error); close_file(fd); strcpy(windforms[WIND_CTRL].wind_title,"MPEG"); wind_set(windforms[WIND_CTRL].whandle,WF_NAME, windforms[WIND_CTRL].wind_title); setfilename("MPEGFILE"); } break; default: #ifdef DEBUG sprintf(tmp,"[1][Unimplemented| message: %d][Ok]",pipe[0]); form_alert(1,tmp); #endif break; } return 0; }
/* ***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 ); }
/* ***PopUp darstellen*** */ short wdial_popup(OBJECT *ptree, short *pitem, short popupx, short popupy, void (*msghndlr)(int msgbf[]), unsigned long msec, void (*tmrhndlr)()) { int mpopupret, pwhndl; int dx, dy, dw, dh; int newitem=-1, olditem=-1; int msgbuf[8]; int which; int mx, my, mb, br; wind_get(0, WF_WORKXYWH, &dx, &dy, &dw, &dh); /* Desktopgr��e */ if(popupx+ptree->ob_width > dx+dw) popupx=dx+dw-ptree->ob_width; if(popupx<dx) popupx=dx; ptree->ob_x=popupx; if(*pitem > 0) popupy-=ptree[*pitem].ob_y; if(popupy+ptree->ob_height > dy+dh) popupy=dy+dh-ptree->ob_height; if(popupy<dy) popupy=dy; ptree->ob_y=popupy; wind_calc(WC_BORDER, 0, ptree->ob_x, ptree->ob_y, ptree->ob_width, ptree->ob_height, &dx, &dy, &dw, &dh); pwhndl=wind_create(0, dx, dy, dw, dh); /* Fenster anmelden */ if(pwhndl<0) return(FALSE); wind_open(pwhndl, dx, dy, dw, dh); /* Fenster �ffnen */ /*objc_draw(ptree, 0, 1, dx, dy, dw, dh); ->Durch WM_REDRAW zeichnen lassen*/ do graf_mkstate(&mx, &my, &mb, &dx); while(mb); /* Maustasten vorher loslassen */ do { which=evnt_multi(MU_MESAG|MU_BUTTON|MU_TIMER, 1,1,1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msgbuf, (short)msec,(short)(msec>>16), &mx, &my, &mb, &dx, &dx, &br); if(which&MU_MESAG) { if(msgbuf[3]==pwhndl && msgbuf[0]>=WM_REDRAW && msgbuf[0]<=WM_NEWTOP) { switch(msgbuf[0]) { case WM_REDRAW: wdial_redraw(pwhndl, ptree, (GRECT *)(&msgbuf[4])); break; case WM_TOPPED: wind_set(pwhndl, WF_TOP, 0L, 0L); break; } } else if( msghndlr ) msghndlr(msgbuf); } if(which&MU_TIMER) { newitem=objc_find(ptree, 0, 1, mx, my); if(newitem>0 && newitem!=olditem) { if( (ptree[newitem].ob_flags&TOUCHEXIT) && !(ptree[newitem].ob_state&DISABLED) ) { GRECT prct; ptree[olditem].ob_state&=~SELECTED; ptree[newitem].ob_state|=SELECTED; prct.g_x=ptree->ob_x+ptree[olditem].ob_x; prct.g_y=ptree->ob_y+ptree[olditem].ob_y; prct.g_w=ptree[olditem].ob_width; prct.g_h=ptree[olditem].ob_height; wdial_redraw(pwhndl, ptree, &prct); prct.g_x=ptree->ob_x+ptree[newitem].ob_x; prct.g_y=ptree->ob_y+ptree[newitem].ob_y; prct.g_w=ptree[newitem].ob_width; prct.g_h=ptree[newitem].ob_height; wdial_redraw(pwhndl, ptree, &prct); olditem=newitem; } else newitem=olditem; } else newitem=olditem; if( tmrhndlr ) tmrhndlr(); } } while(mb!=1); /* Bis Maustaste gedr�ckt */ newitem=objc_find(ptree, 0, 1, mx, my); if(newitem>0 && (ptree[newitem].ob_flags&TOUCHEXIT) && !(ptree[newitem].ob_state&DISABLED) ) { *pitem=newitem; mpopupret=TRUE; } else { mpopupret=FALSE; } if(olditem>0) ptree[olditem].ob_state&=~SELECTED; wind_close(pwhndl); wind_delete(pwhndl); /* Fenster schliessen */ return(mpopupret); }
void adapt_display(GEM_WINDOW *wnd) { WBROWSER *wb = wnd->Extension ; OBJECT *bobj = wnd->DlgData->BaseObject ; CMD_BROWSER *wdlg = wnd->DlgData->UserData ; long l ; int i, w, h ; int xo, yo, wo, ho ; int xco, yco, wco, hco ; if ( wb->fimg_list == NULL ) return ; wb->x1 = wb->y1 = 0 ; /* Calcul du facteur de zoom */ if ( wb->pczoom < 0 ) { wind_calc( WC_WORK, wnd->window_handle, xdesk, ydesk, wdesk, hdesk, &xo, &yo, &w, &h ) ; l = (long) w ; i = (int) ( (l * 100L) / wb->raster.fd_w ) ; l = (long) (h - bobj[0].ob_height) ; wb->pczoom = (int) ( (l * 100L) / wb->raster.fd_h ) ; if ( wb->pczoom > i ) wb->pczoom = i ; if ( wb->pczoom > 100 ) wb->pczoom = 100 ; } wb->img_valid = 0 ; if ( wb->zoom.fd_addr ) free( wb->zoom.fd_addr ) ; wb->zoom.fd_addr = NULL ; if ( wb->pczoom != 100 ) { float ratio ; ratio = (float)wb->pczoom / 100.0 ; wb->zoom.fd_w = (int) ( 0.5 + (float)wb->raster.fd_w * ratio ) ; wb->zoom.fd_h = (int) ( 0.5 + (float)wb->raster.fd_h * ratio ) ; /* if ( raster_pczoom( &wb->raster, &wb->zoom, wb->pczoom, wb->pczoom, wnd ) != 0 )*/ if ( RasterZoom( &wb->raster, &wb->zoom, wnd ) != 0 ) { wb->pczoom = 100 ; wb->pzoom_index = SEL_100PC ; } } if ( wb->pczoom == 100 ) { w = wb->inf_img.largeur ; h = wb->raster.fd_h + bobj[0].ob_height ; } else { w = wb->zoom.fd_w ; h = wb->zoom.fd_h + bobj[0].ob_height ; } if ( w < wb->mini_w ) w = wb->mini_w ; else bobj[0].ob_width = w ; open_where( wnd->window_kind, w, h, &xo, &yo, &wo, &ho ) ; GWGetCurrXYWH( wnd, &xco, &yco, &wco, &hco ) ; if ( ( xco + wo > Xmax ) || ( yco + ho > Ymax ) ) GWSetCurrXYWH( wnd, xo, yo, wo, ho ) ; else GWSetCurrXYWH( wnd, xco, yco, wo, ho ) ; GWGetWorkXYWH( wnd, &bobj[0].ob_x, &bobj[0].ob_y, &w, &h ) ; GWInvalidate( wnd ) ; wb->img_valid = 1 ; write_text( bobj, IMGB_TEXT, "" ) ; xobjc_draw( wnd->window_handle, bobj, IMGB_TEXT ) ; if ( wb->pzoom_index > 1 ) write_text( bobj, IMGB_SCALE, wdlg->popup_zoom[1+wb->pzoom_index].ob_spec.free_string ) ; else write_text( bobj, IMGB_SCALE, wdlg->popup_zoom[1].ob_spec.free_string ) ; /* AUTO */ xobjc_draw( wnd->window_handle, bobj, IMGB_SCALE ) ; }
/* SetNewDialog() * ================================================================ */ void SetNewDialog( OBJECT *newtree ) { OBJECT *oldtree; GRECT old; oldtree = ad_tree; ActiveTree( ad_tree ); old.g_x = ObX( ROOT ); old.g_y = ObY( ROOT ); old.g_w = ObW( ROOT ); old.g_h = ObH( ROOT ); ad_tree = newtree; ActiveTree( ad_tree ); /* If the window has never been moved, center it */ if( !gl_move ) FormCenter( ad_tree, &gl_work ); ObX( ROOT ) = gl_work.g_x; ObY( ROOT ) = gl_work.g_y; gl_work.g_w = ObW( ROOT ); gl_work.g_h = ObH( ROOT ); wind_calc( WC_BORDER, MOVER | NAME | CLOSE, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h, &gl_curr.g_x, &gl_curr.g_y, &gl_curr.g_w, &gl_curr.g_h ); wind_set( wid, WF_CURRXYWH, gl_curr.g_x, gl_curr.g_y, gl_curr.g_w, gl_curr.g_h ); if( gl_gdos == XFSM ) wind_set( wid, WF_NAME, wfsm ); else wind_set( wid, WF_NAME, wfont ); /* Don't send a redraw message IF we are using an AES >= 4.0 */ if( 1 /*AES_Version < 0x0400*/ ) { /* Send a redraw message if this is the same dialog box */ /* This is good for the insert disk dialog box */ /* Also send a message if the new dialog box is smaller than or * equal to the previous one, to generate a redraw. */ if((oldtree == newtree)||((old.g_w>=ObW(ROOT))|| (old.g_h>=ObH( ROOT )) )) { form_dial( FMD_FINISH, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h ); } } else { /* But, if its the same tree, force a redraw...*/ if( oldtree == newtree ) { form_dial( FMD_FINISH, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h ); } } }