void broadcast_olenew(void) { int answ[8]; answ[0] = OLE_NEW; answ[1] = ap_id; answ[2] = 0; answ[3] = OLGAFLAGS; answ[4] = OLGAPROTOCOL; answ[5] = 0; answ[6] = 0; answ[7] = OLGAVERSION; if (broadcast) { shel_write(7,0,0,(char *)answ,NULL); } else if (search) { char fname[9]; int type, apid, moreapps = appl_search(0,fname,&type,&apid); while (moreapps) { if ((type != 1) && (apid != ap_id)) appl_write(apid,16,answ); moreapps = appl_search(1,fname,&type,&apid); } } }
int _hndlmessage(int *message, boolean allow_exit) { if ( ( message[0] >= AV_PROTOKOLL && message[0] <= VA_HIGH /* HR 060203 */ ) || ( message[0] >= FONT_CHANGED && message[0] <= FONT_ACK ) ) handle_av_protocol(message); else { switch (message[0]) { case AP_TERM: if (allow_exit) quit = TRUE; else { static int ap_tfail[8] = { AP_TFAIL, 0 }; shel_write(10, 0, 0, (char *) ap_tfail, NULL); } break; case SH_WDRAW: wd_update_drv(message[3]); break; } } return 0; }
void init_manager(void) { #ifdef DEBUG printf(DEBUG_ACTIVATED); #endif _GemParBlk.global[0]=0; ap_id = appl_init(); if (!_GemParBlk.global[0]) exit(0); if (ap_id < 0) exit(0); if (!_app) wind_update(BEG_UPDATE); Pdomain(1); check_cookies(); if (_GemParBlk.global[1] != 1) multitask = 1; if ((_GemParBlk.global[0] >= 0x0400) && (multitask)) multitos = 1; allocmode = GLOBAL; if (_app) allocmode |= 3; read_name(); check_info(); if ((!_app) || ((multitos) && (!magix))) { menu_id = menu_register(ap_id,STRING_MENUENTRY); if (menu_id < 0) { if (!_app) wind_update(END_UPDATE); if (multitos) { appl_exit(); exit(0); } else { while (1) evnt_timer(0,1); } } } find_inf(); if (!_app) wind_update(END_UPDATE); Psignal(SIGTERM,sig_handler); Psignal(SIGQUIT,sig_handler); if (!multitask) { char s[256]; strcpy(s,"[0][OLGA v"); strcat(s,OLGAVERSIONSTR); strcat(s," Rev "); strcat(s,OLGAREVISION); strcat(s," ("); strcat(s,OLGADATE); strcat(s,") | |"); strcat(s,MESSAGE_MULTITASKING); form_alert(1,s); if (_app) { #ifdef DEBUG printf(DEBUG_DEACTIVATED); #endif appl_exit(); exit(0); } } if (shutdown) shel_write(9,1,0,NULL,NULL); broadcast_olenew(); }
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 get_set_video (int set){ /* 0=get, 1=set, 2=set & change rez */ long #ifdef _OVSCAN s, /* sup.stack p. */ #endif logb, /* logical screen base */ phyb; /* physical screen base */ #ifdef _OVSCAN char *acia; static int ov_max_h, ov_max_w; int std_x[4] = {320,640,1280,0}; int std_y[4] = {200,400,800,0}; int idi; #endif /* Where is the screen ? */ logb = xbios(3); /* Logbase(); */ phyb = xbios(2); /* Physbase(); */ if ( set == 0 ){ /* get data */ /* Find about video hardware (shifter; will be 0xffffffff without cookie */ vdo = find_cookie( '_VDO' ); /* Try to find out about a couple of overscan types */ #ifdef _OVSCAN if ( ( (over = find_cookie('OVER')) != - 1 ) || ( (over = find_cookie('Lace')) != - 1 ) ) { ovrstat = 0; for ( idi = 0; idi < 3; idi++ ) if ( max_h > std_y[idi] && max_h < std_y[idi + 1] ) { ov_max_w = max_w; ov_max_h = max_h; ovrstat = 1; break; } if ( ovrstat != 0 ) options.V2_2.vprefs |= VO_OVSCAN; else options.V2_2.vprefs &= ~VO_OVSCAN; } else over = 0xffffffffL; #endif /* Get current blitter state; insert into options */ if ( get_tosversion() >= 0x104 ) bltstat = Blitmode(-1); /* Function known only to tos >= 1.4 ? */ else bltstat = 0; if ( bltstat & 0x0001 ) options.V2_2.vprefs |= VO_BLITTER; else options.V2_2.vprefs &= ~VO_BLITTER; /* Which is the current standard resolution ? */ currez = xbios(4); /* Getrez() */ options.V2_2.vrez = currez; } else /* set data */ { /* Set blitter, if present */ if ( bltstat & 0x0002 ) { if ( options.V2_2.vprefs & VO_BLITTER ) bltstat |= 0x0001; else bltstat &= ~0x0001; bltstat = Blitmode ( bltstat ); } #ifdef _OVSCAN /* * Set overscan (Lacescan, in fact) * that which is below is ok but not enough !!!! * therefore disabled for the time being */ if ( (over != 0xffffffffL ) && ( (vprefsold^options.V2_2.vprefs) && VO_OVSCAN) ) { menu_bar ( menu, 0 ); s = Super (0L ); (long)acia = 0xFFFC00L; /* address of the acia chip reg HR 240203 (long) */ if ( options.V2_2.vprefs & VO_OVSCAN ) { *acia = 0xD6; /* value for the acia reg- switch overscan ON */ ovrstat = 1; max_h = ov_max_h; max_w = ov_max_w; } else { *acia = 0x96; /* value for the acia reg- switch overscan OFF */ ovrstat = 0; max_w = std_x[idi]; max_h = std_y[idi]; } /* * An attempt to change resolution (to the same one) will * provoke Lacescan to adapt */ xbios(5, logb, phyb, currez); /* Setscreen (logb,phyb,currez); */ Super ( (void *) s ); wind_set(0, WF_NEWDESK, desktop, 0); /* * For some reason desktop doesn't get redrawn correctly here * after overstat switch unless menu_bar is called TWICE * (possibly at first call it is too long and corrupts * part of the screen?) */ menu_bar(menu, 1); dsk_draw(); menu_bar(menu, 1); /* wd_attrib(); */ wd_fields(); /* HR 050303 */ } #endif /* Change resolution */ /* xbios(...) produces slightly smaller code */ if ( set > 1 ) { /* * This will actually (almost) reset the computer */ shel_write( 5, currez + 2, 0, NULL, NULL ); /* DjV 007 110203 */ /* DjV 007 290103: is no good, so disabled for the time being */ xbios(5, logb, phyb, currez); /* Setscreen (logb,phyb,currez); */ } } }
static WORD do_optnmenu(WORD item) { WORD done, rebld, curr; WORD newres, newmode; done = FALSE; rebld = FALSE; curr = win_isel(G.g_screen, G.g_croot, 0); switch(item) { case IDSKITEM: rebld = ins_devices(); if (rebld) { app_blddesk(); do_wredraw(0, G.g_xdesk, G.g_ydesk, G.g_wdesk, G.g_hdesk); } break; case IAPPITEM: curr = 0; while( (curr = win_isel(G.g_screen, G.g_croot, curr)) ) { WORD change; change = ins_app(curr); if (change < 0) /* user cancelled */ break; if (change > 0) /* install or remove */ rebld++; } if (rebld) desk_all(FALSE); break; case IICNITEM: rebld = ins_icon(curr); if (rebld > 0) { app_blddesk(); do_wredraw(0, G.g_xdesk, G.g_ydesk, G.g_wdesk, G.g_hdesk); } #if CONF_WITH_WINDOW_ICONS else if (rebld < 0) { win_bdall(); win_shwall(); } #endif break; case RICNITEM: if (curr) rebld = rmv_icon(curr); if (rebld) { app_blddesk(); do_wredraw(0, G.g_xdesk, G.g_ydesk, G.g_wdesk, G.g_hdesk); } break; case PREFITEM: if (inf_pref()) desk_all(FALSE); break; case SAVEITEM: desk_wait(TRUE); cnx_put(); app_save(TRUE); desk_wait(FALSE); break; case RESITEM: rebld = change_resolution(&newres,&newmode); if (rebld == 1) { if (FALSE) { /* Dummy case for conditional compilation */ } #if CONF_WITH_VIDEL else if (newres == FALCON_REZ) shel_write(5,newmode,1,NULL,NULL); #endif #if CONF_WITH_ATARI_VIDEO else shel_write(5,newres+2,0,NULL,NULL); #endif done = TRUE; } break; } return done; }
void main(void) { WORD x,y,w,h; WORD mx,my,button,kstate,clicks; MFDB mfdbs,mfdbd; WORD xyarray[8],vid; WORD work_in[] = {1,7,1,1,1,1,1,1,1,1,2}; WORD work_out[57]; OBJECT *dial; char path[200],file[30]; appl_init(); strcpy(path,"C:\\*"); strcpy(file,"noname.inf"); vid = graf_handle(&vid,&vid,&vid,&vid); v_opnvwk(work_in,&vid,work_out); /* for(x = 0; x < 25; x++) form_error(x); */ /* fsel_input(path,file,&button); */ form_alert(3,"[2][Test av|form_alert.|Windoze rulez...|...___NOOOT!___][Ja|Kanske|Nej]"); if(rsrc_load("test2rsc.rsc")) { int co; int i; rsrc_gaddr(R_TREE,TESTDIAL,&dial); form_center(dial,&x,&y,&w,&h); form_dial(FMD_START,0,0,0,0,x,y,w,h); objc_draw(dial,0,9,x,y,w,h); form_do(dial,0); form_dial(FMD_FINISH,0,0,0,0,x,y,w,h); i = 0; objc_delete(dial,11); while(1) { fprintf(stderr,"%3d next=%3d head=%3d tail=%3d\r\n", i,dial[i].ob_next,dial[i].ob_head,dial[i].ob_tail); if(dial[i].ob_flags & LASTOB) { break; }; i++; }; getchar(); rsrc_free(); } else { form_alert(1,"[1][Couldn't load resource file!][Bummer!]"); }; v_clsvwk(vid); fprintf(stderr,"environ size=%d",shel_write(SWM_ENVIRON,ENVIRON_SIZE,0,NULL,NULL)); appl_exit(); }