void progress_init( const char * title_msg, long max ) { rsrc_gaddr( 0, PROC_BOX, &progress_tree ); progress_tree[PB_PROGBAR].ob_width = 0; progress_tree[PB_CANCEL].ob_state &= ~SELECTED; strcpy( ObjcString( progress_tree, PB_ELATIME, NULL ), "--:--" ); strcpy( ObjcString( progress_tree, PB_REMTIME, NULL ), "--:--" ); ObjcString( progress_tree, PB_STATUS, "" ); if( preferences.pref_flags.multitask ) { progress_tree[0].ob_state &= ~OUTLINED; progress_tree[PB_CANCEL].ob_flags &= ~HIDETREE; progress_tree[PB_ESC].ob_flags |= HIDETREE; progress_win = FormWindBegin( progress_tree, get_string( title_msg ) ); } else { /* MouseWork(); */ graf_mouse( BUSYBEE, NULL ); progress_tree[0].ob_state |= OUTLINED; progress_tree[PB_CANCEL].ob_flags |= HIDETREE; progress_tree[PB_ESC].ob_flags &= ~HIDETREE; FormBegin( progress_tree, NULL ); } progress_exitflag = 0; progress_max = max; progress_count = 0; progress_info = NULL; progress_start_time = 0; progress_next_refresh = 0; }
bool verify_ssl_form_do( const char * url, const struct ssl_cert_info * cert_infos_n , unsigned long num_certs ) { OBJECT *tree; WINDOW * form; bool bres = false; bool cont = true; int res = 0; dp.cert_infos_n = (struct ssl_cert_info *)cert_infos_n; dp.num_certs = num_certs; dp.scrollx = 0; dp.scrolly = 0; dp.current = 0; dp.cols = cert_display_width( &dp.cert_infos_n[dp.current] ); dp.rows = 8; dp.tree = tree; RsrcGaddr (h_gem_rsrc , R_TREE, VERIFY, &tree); ObjcString( tree, VERIFY_LBL_HOST, (char*)url ); ObjcChange( OC_OBJC, tree, VERIFY_BT_ACCEPT, 0, 0 ); ObjcChange( OC_OBJC, tree, VERIFY_BT_REJECT, 0, 0 ); form = FormWindBegin( tree, (char*)"SSL Verify failed" ); EvntDataAdd( form, WM_REDRAW, cert_info_draw, (void*)&dp, EV_BOT ); /* this results in some extended objects which can not be freed: :( */ /* RsrcUserDraw( OC_FORM, tree, VERIFY_BOX_DETAILS, cert_info_draw,(void*)&dp ) ; */ ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp ); /* ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp ); ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp ); */ while( cont ) { res = FormWindDo( MU_MESAG ); cont = false; switch( res ){ case VERIFY_BT_ACCEPT: bres = true; break; case VERIFY_BT_NEXT_CERT: /* select box clicked or dragged... */ cont = true; break; case VERIFY_BT_REJECT: bres = false; break; case VERIFY_BT_SCROLL_D: cont = true; dp.scrolly += 1; ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG ); break; case VERIFY_BT_SCROLL_U: cont = true; dp.scrolly -= 1; ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG ); break; case VERIFY_BT_SCROLL_R: LOG(( "scroll r!" )); cont = true; dp.scrollx += 1; if( dp.scrollx > (dp.cols - (272 / 8 )) ) dp.scrollx -= 1; ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG); break; case VERIFY_BT_SCROLL_L: cont = true; dp.scrollx -= 1; if( dp.scrollx < 0 ) dp.scrollx = 0; ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG ); break; default: break; } } FormWindEnd( ); return( bres ); }