/* cpx_call() * ====================================================================== * Called ONLY when the CPX is being executed. Note that it is CPX_INIT() * that returned the ptr to cpx_call(). * CPX_CALL() is the entry point to displaying and manipulating the * dialog box. * * IN: GRECT *rect: Ptr to a GRECT that describes the current work * area of the XControl window. * * OUT: * FALSE: The CPX has exited and no more messages are * needed. XControl will either return to its * main menu or close its windows. * This is used by XForm_do() type CPXs. * * TRUE: The CPX requests that XCONTROL continue to * send AES messages. This is used by Call-type CPXs. */ BOOLEAN cpx_call( GRECT *rect ) { int button; int quit = 0; WORD msg[8], clip[4]; BOOLEAN dclick; MRETS mk; WORD newvalue; ActiveTree( ad_tree ); WindGet(0, WF_WORKXYWH, &desk ); /* set clipping to */ rc_2xy( &desk, clip ); /* Desktop space */ ObX( ROOT ) = rect->g_x; ObY( ROOT ) = rect->g_y; ObjcDraw( tree, ROOT, MAX_DEPTH,NULL ); do { dclick = FALSE; button = (*xcpb->Xform_do)( tree, M5SLIDER, msg ); if(( button != -1 ) && ( button & 0x8000 ) ) { dclick = TRUE; button &= 0x7fff; } switch( button ) { case MOK: CurData[4].value = atoi( TedText( M5SLIDER ) ); CurData[4].value = min( CurData[4].value, CurData[4].xmax ); CurData[4].value = max( CurData[4].value, CurData[4].xmin ); SetHardWare(); case MCANCEL: quit = TRUE; Deselect( button ); break; case MRELOAD: /* reload the stored values */ GetValues(); initialize(); RedrawSliders(); deselect( tree, button ); break; case MSAVE: /* save the current values */ if ((*xcpb->XGen_Alert)(SAVE_DEFAULTS) == TRUE) { CurData[4].value = atoi( TedText( M5SLIDER ) ); CurData[4].value = min( CurData[4].value, CurData[4].xmax ); CurData[4].value = max( CurData[4].value, CurData[4].xmin ); PutValues(); (*xcpb->CPX_Save)((void *)&saved, 10L ); PushValues(); } deselect( tree, button ); break; /* DISPLAY DELAY */ case M1TITLE: if( dclick ) form_alert( 1, alert1 ); break; case M1LEFT: Do_Left( M1BASE, M1SLIDER, M1LEFT, 0 ); break; case M1RIGHT: Do_Right( M1BASE, M1SLIDER, M1RIGHT, 0 ); break; case M1SLIDER: Do_Slider( M1BASE, M1SLIDER, 0 ); break; case M1BASE: Do_Base( M1BASE, M1SLIDER, 0 ); break; /* DRAG DELAY */ case M2TITLE: if( dclick ) form_alert( 1, alert2 ); break; case M2LEFT: Do_Left( M2BASE, M2SLIDER, M2LEFT, 1 ); break; case M2RIGHT: Do_Right( M2BASE, M2SLIDER, M2RIGHT, 1 ); break; case M2SLIDER: Do_Slider( M2BASE, M2SLIDER, 1 ); break; case M2BASE: Do_Base( M2BASE, M2SLIDER, 1 ); break; /* RESPONSE DELAY */ case M3TITLE: if( dclick ) form_alert( 1, alert3 ); break; case M3LEFT: Do_Left( M3BASE, M3SLIDER, M3LEFT, 2 ); break; case M3RIGHT: Do_Right( M3BASE, M3SLIDER, M3RIGHT, 2 ); break; case M3SLIDER: Do_Slider( M3BASE, M3SLIDER, 2 ); break; case M3BASE: Do_Base( M3BASE, M3SLIDER, 2 ); break; /* SCROLL DELAY */ case M4TITLE: if( dclick ) form_alert( 1, alert4 ); break; case M4LEFT: Do_Left( M4BASE, M4SLIDER, M4LEFT, 3 ); break; case M4RIGHT: Do_Right( M4BASE, M4SLIDER, M4RIGHT, 3 ); break; case M4SLIDER: Do_Slider( M4BASE, M4SLIDER, 3 ); break; case M4BASE: Do_Base( M4BASE, M4SLIDER, 3 ); break; /* MENU HEIGHT */ case M5TITLE: if( dclick ) form_alert( 1, alert5 ); break; case M5UP: newvalue = atoi( TedText( M5SLIDER ) ); CurData[4].value = min( newvalue, CurData[4].xmax ); CurData[4].value = max( newvalue, CurData[4].xmin ); if( CurData[4].value < CurData[4].xmax ) { select( tree, M5UP ); PushValues(); do { CurData[4].value += 1; CurData[4].value = min( CurData[4].value, CurData[4].xmax ); sprintf( CurData[4].text, "%3d", CurData[4].value ); TedText( M5SLIDER ) = CurData[4].text; ObjcDraw( ad_tree, M5SLIDER, MAX_DEPTH, NULL ); if( CurData[4].value >= CurData[4].xmax ) break; Graf_mkstate( &mk ); }while( mk.buttons ); deselect( tree, M5UP ); } break; case M5DOWN: newvalue = atoi( TedText( M5SLIDER ) ); CurData[4].value = min( newvalue, CurData[4].xmax ); CurData[4].value = max( newvalue, CurData[4].xmin ); if( CurData[4].value > CurData[4].xmin ) { select( tree, M5DOWN ); PushValues(); do { CurData[4].value -= 1; CurData[4].value = max( CurData[4].value, CurData[4].xmin ); sprintf( CurData[4].text, "%3d", CurData[4].value ); TedText( M5SLIDER ) = CurData[4].text; ObjcDraw( ad_tree, M5SLIDER, MAX_DEPTH, NULL ); if( CurData[4].value <= CurData[4].xmin ) break; Graf_mkstate( &mk ); }while( mk.buttons ); deselect( tree, M5DOWN ); } break; default: if( button == -1 ) { switch( msg[0] ) { case WM_REDRAW: /* redraw the cpx */ break; case AC_CLOSE: /* treated like a cancel */ quit = TRUE; break; case WM_CLOSED: /* treated like an OK */ CurData[4].value = atoi( TedText( M5SLIDER ) ); CurData[4].value = min( CurData[4].value, CurData[4].xmax ); CurData[4].value = max( CurData[4].value, CurData[4].xmin ); SetHardWare(); quit = TRUE; break; case CT_KEY: do_keys( msg[3] ); break; default: break; } } break; } }while( !quit); return( FALSE ); }
/* cpx_call() * ====================================================================== * Called ONLY when the CPX is being executed. Note that it is CPX_INIT() * that returned the ptr to cpx_call(). * CPX_CALL() is the entry point to displaying and manipulating the * dialog box. * * IN: GRECT *rect: Ptr to a GRECT that describes the current work * area of the XControl window. * * OUT: * FALSE: The CPX has exited and no more messages are * needed. XControl will either return to its * main menu or close its windows. * This is used by XForm_do() type CPXs. * * TRUE: The CPX requests that XCONTROL continue to * send AES messages. This is used by Call-type CPXs. */ BOOLEAN cpx_call( GRECT *rect ) { int button; int quit = 0; WORD msg[8], clip[4]; MRETS mk; int ox, oy; BOOLEAN dclick; int CurPen; GRECT orect; ActiveTree( ad_tree ); WindGet(0, WF_WORKXYWH, &desk ); /* set clipping to */ rc_2xy( &desk, clip ); /* Desktop space */ open_vwork(); vs_clip( vhandle, 1, ( int *)clip ); ObX( ROOT ) = rect->g_x; ObY( ROOT ) = rect->g_y; ObjcDraw( tree, ROOT, MAX_DEPTH, NULL ); draw_boxes(); /* draw the color boxes */ outline( curbox, HILITE ); /* show selected box */ close_vwork(); do { dclick = FALSE; button = (*xcpb->Xform_do)( tree, 0, msg ); if(( button != -1 ) && ( button & 0x8000 ) ) { dclick = TRUE; button &= 0x7fff; } switch( button ) { case CCANCEL: cnclchgs(); /* cancel all changes made */ case C*K: quit = TRUE; Deselect( button ); break; case CRELOAD: /* reload saved user-preference */ if( saved ) init(&usr_vals); else init(&def_vals); update_rgb(1); /* update RGB on screen */ /* Redraw the boxes deliberately */ open_vwork(); rc_2xy( &desk, clip ); /* Desktop space */ vs_clip( vhandle, 1, ( int *)clip ); draw_boxes(); /* draw the color boxes */ close_vwork(); XDeselect( tree, button ); break; case CSAVE: /* save current values */ if ((*xcpb->XGen_Alert)(SAVE_DEFAULTS) == TRUE) { (*xcpb->MFsave)(MFSAVE, &orig_mf); if( AES_Version >= 0x0320 ) graf_mouse( BUSYBEE, 0L ); savergb(); /* save color info */ /* update RGBs */ cpyrgb((RGB *)&oldrgb, (RGB *)&newrgb, numcol ); /* save current data to file */ saved = 1; (*xcpb->CPX_Save)((void *)&saved, sizeof(DEFAULTS)+2); (*xcpb->MFsave)(MFRESTORE, &orig_mf); } XDeselect( tree, button ); break; case CUP: (*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, CUP, -1, col_max, col_min, &curcol, VERTICAL, nxtrow); break; case CDOWN: (*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, CDOWN, 1, col_max, col_min, &curcol, VERTICAL, nxtrow); break; case CSLIDE: if( dclick ) /* if double-click */ { ActiveTree( ad_tree ); orect = ObRect( CSLIDE ); objc_offset( ad_tree, CSLIDE, &orect.g_x, &orect.g_y ); ActiveTree( ad_slide1 ); ObX( CTSLIDE ) = ObX( EXIT1 ) = ( orect.g_x - 2 ); ObY( CTSLIDE ) = ObY( EXIT1 ) = ( orect.g_y - 2 ); ObW( CTSLIDE ) = ( orect.g_w + 3 ); ObH( CTSLIDE ) = ( orect.g_h + 4 ); myitoa( curcol, &PenNum[0] ); TedText( CTSLIDE ) = PenNum; ObjcDraw( ad_slide1, CTSLIDE, 0, NULL ); form_do( ad_slide1, CTSLIDE ); if( strlen( TedText( CTSLIDE ) ) ) { CurPen = atoi( TedText( CTSLIDE ) ); CurPen = min( CurPen, col_max ); CurPen = max( CurPen, col_min ); curcol = CurPen; Deselect( CTSLIDE ); Deselect( EXIT1 ); ActiveTree( ad_tree ); ObjcDraw( ad_tree, CSLIDE, MAX_DEPTH, NULL ); headcol = ( curcol / COL_PER_BNK )* COL_PER_BNK; open_vwork(); rc_2xy( &desk, clip ); vs_clip( vhandle, 1, ( int *)clip ); draw_boxes(); close_vwork(); nxtgrp(); update_slid( CBASE, CSLIDE, curcol, col_max, col_min, 1 ); } else { Deselect( CTSLIDE ); Deselect( EXIT1 ); ActiveTree( ad_tree ); ObjcDraw( ad_tree, CSLIDE, MAX_DEPTH, NULL ); } EvntButton( 1, 1, 0, &mk ); } else { (*xcpb->MFsave)(MFSAVE, &orig_mf); if( AES_Version >= 0x0320 ) graf_mouse( FLAT_HAND, 0L ); if(( AES_Version >= 0x0330 ) && ( numcol > LWHITE ) ) XSelect( tree, CSLIDE ); (*xcpb->Sl_dragy)(tree, CBASE, CSLIDE, col_max, col_min, &curcol, nxtgrp); if(( AES_Version >= 0x0330 ) && ( numcol > LWHITE ) ) XDeselect( tree, CSLIDE ); (*xcpb->MFsave)(MFRESTORE, &orig_mf); } break; case CBASE: Graf_mkstate(&mk); objc_offset(tree, CSLIDE, &ox, &oy); if(mk.y < oy) oy = -col_page; else oy = col_page; curslid = CSLIDE; (*xcpb->Sl_arrow)(tree, CBASE, CSLIDE, -1, oy, col_max, col_min, &curcol, VERTICAL, nxtpage); break; case RUP: Do_Up( RBASE, RSLIDE, RUP, R ); break; case RDOWN: Do_Down( RBASE, RSLIDE, RDOWN, R ); break; case RSLIDE: Do_Slider( RBASE, RSLIDE, R, dclick ); break; case RBASE: Do_Base( RBASE, RSLIDE, R ); break; case GUP: Do_Up( GBASE, GSLIDE, GUP, G ); break; case GDOWN: Do_Down( GBASE, GSLIDE, GDOWN, G ); break; case GSLIDE: Do_Slider( GBASE, GSLIDE, G, dclick ); break; case GBASE: Do_Base( GBASE, GSLIDE, G ); break; case BUP: Do_Up( BBASE, BSLIDE, BUP, B ); break; case BDOWN: Do_Down( BBASE, BSLIDE, BDOWN, B ); break; case BSLIDE: Do_Slider( BBASE, BSLIDE, B, dclick ); break; case BBASE: Do_Base( BBASE, BSLIDE, B ); break; case TWO01: /* for ST High rez */ case TWO02: case FOUR01: /* for ST Medium rez */ case FOUR02: case FOUR03: case FOUR04: case BOX0: /* for all other rez */ case BOX1: case BOX2: case BOX3: case BOX4: case BOX5: case BOX6: case BOX7: case BOX8: case BOX9: case BOX10: case BOX11: case BOX12: case BOX13: case BOX14: case BOX15: if( button != curbox) /* select requested color */ { curcol = button - headbox + headcol; nxt_to_show(0); update_slid( CBASE, CSLIDE, curcol, col_max, col_min, 1 ); } break; default: if( button == -1 ) { switch( msg[0] ) { case WM_REDRAW: /* redraw the cpx */ do_redraw((GRECT *)&msg[4], (int *)clip); break; case AC_CLOSE: /* treated like a cancel */ cnclchgs(); /* cancel changes made */ case WM_CLOSED: quit = TRUE; /* treated like an OK */ break; case CT_KEY: switch( msg[3] ) /* check which key is returned */ { case UNDO: /* if Undo key */ cnclbnk(); /* cancel color changes */ update_rgb(1); /* update RGB on screen */ /* Redraw the boxes deliberately */ open_vwork(); rc_2xy( &desk, clip ); /* Desktop space */ vs_clip( vhandle, 1, ( int *)clip ); draw_boxes(); /* draw the color boxes */ close_vwork(); break; case HOME: /* if Clr Home key */ init(&def_vals); /* init to system defs */ update_rgb(1); /* update RGB on screen */ setup_bnk = CLEAN;/*cjg*/ visit_bnk(); /*cjg*/ /* Redraw the boxes deliberately */ open_vwork(); rc_2xy( &desk, clip ); /* Desktop space */ vs_clip( vhandle, 1, ( int *)clip ); draw_boxes(); /* draw the color boxes */ close_vwork(); break; } break; default: break; } } break; } }while( !quit); return( FALSE ); }
static void __CDECL cert_info_draw( WINDOW * win, short buf[8], void * data) { struct ssl_info_draw_param * dp = (struct ssl_info_draw_param *)data; GRECT work; short pxy[4]; int maxchars; short d, cbh, cbw; int i = 0; short x,y,w,h; int px_ypos, px_xpos; char * line = malloc(512); if( line == NULL ) return; LOG(("Cert info draw, win: %p, data: %p, scrollx: %d", win, data, dp->scrollx )); WindGet( win, WF_WORKXYWH, &x, &y, &w, &h ); /*using static values here, as RsrcUserDraw has mem leaks & a very small stack */ pxy[0] = work.g_x = x + 8; pxy[1] = work.g_y = y + 80; pxy[2] = x + 8 + 272; pxy[3] = y + 80 + 176; work.g_w = 272; work.g_h = 176; maxchars = (work.g_w / 8)+1; vs_clip( atari_plot_vdi_handle, 1,(short*) &pxy ); vswr_mode( atari_plot_vdi_handle, MD_REPLACE ); vsf_interior( atari_plot_vdi_handle, 1 ); vsf_color( atari_plot_vdi_handle, LWHITE ); v_bar( atari_plot_vdi_handle, (short*)&pxy ); vst_height( atari_plot_vdi_handle, 16, &d, &d, &cbw, &cbh ); vst_alignment(atari_plot_vdi_handle, 0, 5, &d, &d ); vst_color( atari_plot_vdi_handle, BLACK ); vst_effects( atari_plot_vdi_handle, 0 ); px_ypos = px_xpos = 0; for(i=0; i<CERT_INF_LINES; i++ ) { switch( i ) { case 0: sprintf(line, "Cert Version: %d", dp->cert_infos_n[dp->current].version ); break; case 1: sprintf(line, "Invalid before: %s", &dp->cert_infos_n[dp->current].not_before ); break; case 2: sprintf(line, "Invalid after: %s", &dp->cert_infos_n[dp->current].not_after ); break; case 3: sprintf(line, "Signature type: %d", dp->cert_infos_n[dp->current].sig_type ); break; case 4: sprintf(line, "Serial: %d", dp->cert_infos_n[dp->current].serial ); break; case 5: sprintf(line, "Issuer: %s", &dp->cert_infos_n[dp->current].issuer ); break; case 6: sprintf(line, "Subject: %s", &dp->cert_infos_n[dp->current].subject ); break; case 7: sprintf(line, "Cert type: %d", dp->cert_infos_n[dp->current].cert_type ); break; default: break; } if( (int)strlen(line) > dp->scrollx ) { if( dp->scrollx + maxchars < 511 && ( (signed int)strlen(line) - dp->scrollx) > maxchars ) line[dp->scrollx + maxchars] = 0; v_gtext(atari_plot_vdi_handle, work.g_x + 1, work.g_y + px_ypos, &line[dp->scrollx]); } px_ypos += cbh; } vst_alignment(atari_plot_vdi_handle, 0, 0, &d, &d ); vs_clip( atari_plot_vdi_handle, 0, (short*)&pxy ); free( line ); }