/* do_main() * ================================================================ */ void do_main( void ) { int result; do { /* Do Introduction Dialog Box */ intro_dialog(); result = TRUE; /* Do Assign.SYS Dialog Box */ if( result ) result = assign_dialog(); /* Do APath Dialog Box */ if( result ) result = path_dialog(); /* Do EXTEND.SYS Dialog Box */ if( result ) result = extend_dialog(); /* Do EPATH Dialog Box */ if( result ) result = epath_dialog(); /* Do Driver Dialog Box */ if( result ) result = driver_dialog(); #if 0 /* Do Fonts Dialog Box */ if( result ) result = fonts_dialog(); /* Do Application Dialog Box */ if( result ) result = apps_dialog(); #endif /* Do Start Dialog Box */ if( result ) result = DoStart(); /* Go To main loop */ if( result ) DoInstall(); }while( !result ); /* Display Complete */ if( vq_gdos() ) DoGDOS(); /* Display warning of a previously loaded GDOS */ else DoComplete(); /* Standard reboot exit message */ }
void main( void ) { void *sav_ssp = Super(0); register tCOOKIE *p = *(tCOOKIE **)_p_cookies; /** look for FSMC cookie ... **/ if( p != NULL ) { while( p->id != 0L ) { if( p->id == 0x46534D43 /* 'FSMC' */ ) { pgdos_info = p->arg; break; } /* if */ p++; } /* while */ } /* if */ Super(sav_ssp); /** set up acc ... */ ap_id = appl_init(); if( ap_id < 0 ) { Cconws( "chq: can't initialise\r\n" ); die(); } /* if */ if( !vq_gdos() ) { form_alert( 1, "[1][chq: GDOS not present][Too Bad]" ); die(); } /* if */ if( pgdos_info == NULL ) { form_alert( 1, "[1][chq: can't control|" "printer quality|" "with this GDOS][Too Bad]" ); die(); } /* if */ menu_id = menu_register( ap_id, acc_name ); if( menu_id < 0 ) { form_alert( 1, "[1][chq: can't start accessory][Too Bad]" ); die(); } /* if */ /* Cconws( "chq $Revision: 1.1 $ ready to roll !!!\r\n" ); */ /** main accessory loop ... ** wait to be activated, then set quality flag **/ while( 1 ) { event = evnt_mesag( msg_buff ); /* wait .. */ /** if the message is for us, set the printer quality **/ if( (msg_buff[0] == AC_OPEN) && (msg_buff[4] == menu_id) ) { register int qual_flag; switch( form_alert( 1, "[0][select print quality][default|draft|final]" ) ) { case 3: qual_flag = 1; /* final button */ break; case 2: qual_flag = 0; /* draft button */ break; default: qual_flag = -1; /* default button */ } /* switch */ pgdos_info->values[1] = qual_flag; } /* if */ } /* while */ } /* main() */
int main(void) { int error; #if _MINT_ /* HR 151102 */ have_ssystem = Ssystem(-1, 0, 0) == 0; /* HR 151102: use Ssystem where possible */ mint = (find_cookie('MiNT') == -1) ? FALSE : TRUE; magx = (find_cookie('MagX') == -1) ? FALSE : TRUE; /* HR 151102 */ geneva = (find_cookie('Gnva') == -1) ? FALSE : TRUE; /* DjV 035 080203 */ mint |= magx; /* Quick & dirty */ if (mint) { Psigsetmask(0x7FFFE14EL); Pdomain(1); } #endif x_init(); if ((ap_id = appl_init()) < 0) return -1; if (_GemParBlk.glob.version >= 0x400) { shel_write(9, 1, 0, NULL, NULL); menu_register(ap_id, " Tera Desktop"); } if (rsrc_load(RSRCNAME) == 0) form_alert(1, msg_resnfnd); else { if ((error = init_xdialog(&vdi_handle, malloc, free, "Tera Desktop", 1, &nfonts)) < 0) xform_error(error); else { init_vdi(); rsc_init(); if (((max_w / screen_info.fnt_w) < 40) || ((max_h / screen_info.fnt_h) < 25)) alert_printf(1, MRESTLOW); else { if ((error = alloc_global_memory()) == 0) { if (exec_deskbat() == FALSE) { if (load_icons() == FALSE) { if (init() == FALSE) { graf_mouse(ARROW, NULL); evntloop(); wd_del_all(); menu_bar(menu, 0); xw_close_desk(); } free_icons(); /* HR 151102 */ wind_set(0, WF_NEWDESK, NULL, 0); dsk_draw(); } } Mfree(global_memory); } else xform_error(error); } if (vq_gdos() != 0) vst_unload_fonts(vdi_handle, 0); exit_xdialog(); } rsrc_free(); } /* DjV 013 030103 100203 ---vvv--- */ /* * The following section handles system shutdown and resolution change * If a resolution change is required, shutdown is performed first * If only shutdown s required, system will reset at the end. */ /* appl_exit(); */ if ( chrez || shutdown ) /* If change resolution or shutdown ... */ { /* Tell all applications which would understand it to end */ quit = shel_write ( 4, 2, 0, NULL, NULL ); /* complete shutdown */ evnt_timer( 3000, 0 ); /* Wait a bit? */ /* /* * In Mint, must tell all proceseses to terminate nicely ? * but this is only in this group ? What to do? */ Pkill(0, SIGTERM); evnt_timer(3000, 0); /* Wait a bit? */ */ /* * After all applications have hopefully been closed, * change the screen resolution if needed; * else- reset the computer */ if ( chrez ) get_set_video(2); #if 1 else #if _MINT_ if (!mint) /* HR 230203: Dont reset under MiNT or MagiC !!!!! */ #endif { /* Perform a reset here */ #if 0 /* with warnings */ long *m; /* to memory locations */ long rv; /* reset vector */ Super ( 0L ); /* Supervisor; old stack won't be needed again */ *(m = 0x420L) = 0L; /* memctrl */ *(m = 0x43aL) = 0L; /* memval2 */ *(m = 0x426L) = 0L; /* resvalid */ m = *( m = 0x4f2 ); /* to start of OS */ rv = *(m + 4); /* to routine that handles the reset */ Supexec(rv); /* execute it */ #else /* HR: without warnings */ long (*rv)(); /* reset vector */ Super ( 0L ); /* Supervisor; old stack won't be needed again */ memctrl = 0L; memval2 = 0L; resvalid = 0L; (long)rv = *((long *)os_start + 4); /* routine that handles the reset */ Supexec(rv); /* execute it */ #endif } #endif }
void small_scale_draw(ALWINDOW *alw, CURRENT_STATUS *cs) { register int loop1,loop2; int cf; short coord[4]; register int curx,cury; int inc_res; int half_fret_height=frets_height/2,half_fret_length=frets_length/2; register int circle_radius; int h,saveh; int tadd; short ch,cw,clh,clw,maxcw; char albuff[10]; char info_buffer[120]; int combination_note,note_val; int frets_x_offset_and_frets_length; int half_fret_height_and_frets_y_offset; int frets_height_and_frets_y_offset; int frets_length_times_loop2; int frets_height_times_7; short tatts[10]; /* text attributes */ NOTE *np; #ifdef PRINTER_TEST /* gdos test stuff*/ short work_in[11],work_out[57],thandle,lop; #endif #define draw(X1,Y1,X2,Y2); coord[0]=X1;coord[1]=Y1;coord[2]=X2;coord[3]=Y2;v_pline(handle,2,coord); #ifdef PRINTER_TEST if(vq_gdos()==0) fatal_error("GDOS NOT LOADED!"); #endif #ifndef PRINTER_TEST if(scale_name_flag && !key_name_flag) { sprintf(info_buffer," %s",cs->current_scale->name); wind_info(scale_window.handle,info_buffer); } else { if(!scale_name_flag && key_name_flag) { sprintf(info_buffer," %s",cs->key->note_name); wind_info(scale_window.handle,info_buffer); } else { if(scale_name_flag && key_name_flag) { sprintf(info_buffer," %s in %s",cs->current_scale->name,cs->key->note_name); wind_info(scale_window.handle,info_buffer); } else { sprintf(info_buffer," "); wind_info(scale_window.handle,info_buffer); } } } #endif scale_offsets(alw,&frets_x_offset,&frets_y_offset); frets_y_offset=frets_y_offset+big_y_offset; frets_height_and_frets_y_offset=frets_height+frets_y_offset; frets_x_offset_and_frets_length=frets_length+frets_x_offset; half_fret_height_and_frets_y_offset=half_fret_height+frets_y_offset; #ifndef PRINTER_TEST h=0;cw=0;ch=0;maxcw=0; while(cw<((frets_length/2)-2) && h<99) { if(cw>maxcw) saveh=h; h++; vst_height(handle,h,&cw,&ch,&clw,&clh); } set_hor(); if(h>=99) vst_height(handle,saveh,&cw,&ch,&clw,&clh); #endif #ifdef PRINTER_TEST clh=0; #endif vqt_attributes(handle,tatts); frets_height_times_7=7*frets_height; total_y_dist=clh+(frets_height_times_7); set_ver(total_y_dist); if(frets_length>frets_height) circle_radius=(frets_height/2)-1-2; else circle_radius=(frets_length/2)-1-2; curx=0; #ifdef PRINTER_TEST work_in[0]=21; /*printer ?*/ for(lop=1;lop<10;lop++) work_in[lop]=1; work_in[10]=2; for(lop=21;lop<31;lop++) { work_in[0]=lop; v_opnwk(work_in,&handle,work_out); if(handle) { error("GOT A PRINTER HANDLE"); lop=32; } else error("NOT GOT A PRINTER HANDLE"); } #endif wclip(alw); graf_mouse(M_OFF,NULL); for(loop2=0;loop2<global_frets && loop2+start_fret<global_frets;loop2++) { frets_length_times_loop2=frets_length*loop2; for(loop1=0;loop1<6;loop1++) { if(curx<desk_x+frets_height) { cf=loop2+start_fret; curx=/*alw->wx+*/(frets_length_times_loop2); cury=/*alw->wy+*/(loop1*frets_height); if(cf!=0) { draw(curx+frets_x_offset,cury+half_fret_height_and_frets_y_offset, curx+frets_x_offset_and_frets_length,cury+half_fret_height_and_frets_y_offset); } switch(loop1) { case 0: draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset+half_fret_height, curx+frets_x_offset_and_frets_length,cury+frets_height_and_frets_y_offset); break; case 5: draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset, curx+frets_x_offset_and_frets_length,cury+half_fret_height_and_frets_y_offset); break; default: draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset, curx+frets_x_offset_and_frets_length,cury+frets_height_and_frets_y_offset); } #ifndef PRINTER_TEST if(numbers_flag==1) { if(cf==first_fret || (((inc_res=cf%fret_inc)==0) && cf>first_fret)) { if((tadd=clh-frets_height)>0) { sprintf(albuff,"%d",cf); if(strlen(albuff)==1) v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-(tatts[6]/2),frets_y_offset+(frets_height_times_7)+tadd,albuff); else v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6],frets_y_offset+(frets_height_times_7)+tadd,albuff); } else { sprintf(albuff,"%d",cf); if(strlen(albuff)==1) v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-(tatts[6]/2),frets_y_offset+(frets_height_times_7),albuff); else v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6], frets_y_offset+(frets_height_times_7),albuff); } } } #endif if(text_notes==1) { combination_note=0; if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE) { combination_note=1; note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE; } else { note_val=cs->display_fretboard[loop1][cf]; } switch(note_val) { case NO_NOTE: break; case NORMAL_NOTE: if(combination_note) vst_effects(handle,0|UNDERLINED); else vst_effects(handle,0); break; case FILLED_NOTE: if(combination_note) vst_effects(handle,OUTLINE|UNDERLINED); else vst_effects(handle,OUTLINE); break; case RELATIVE_NOTE: vst_effects(handle,SHADED|UNDERLINED); break; } /* draw as text */ if(cs->display_fretboard[loop1][cf]!=NO_NOTE) { np=cs->current_fretboard[loop1][cf]; sprintf(albuff,"%s",np->note_name); if(strlen(albuff)==1) v_gtext(handle,frets_x_offset+frets_length_times_loop2+half_fret_length-(tatts[6]/2), cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff); else v_gtext(handle,/*curx+frets_x_offset*/frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6], cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff); } vst_effects(handle,0); } else { combination_note=0; if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE) { combination_note=1; note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE; } else { note_val=cs->display_fretboard[loop1][cf]; } if(combination_note) { vsf_color(handle,BLACK); vsf_interior(handle,FIS_HOLLOW); vsf_style(handle,0); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius+2); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); } switch(note_val) { case NO_NOTE: break; case NORMAL_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,2); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height_and_frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break; case FILLED_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,FIS_SOLID); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height_and_frets_y_offset, circle_radius); vsf_color(handle,BLACK); break; case RELATIVE_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,FIS_HOLLOW); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height_and_frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break; /* case COMMON_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,4); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height_and_frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break;*/ } } } } } graf_mouse(M_ON,NULL); #ifdef PRINTER_TEST v_clswk(handle); #endif }