/* * Top level; * we get control from the desktop. */ main() { pnf = 0; /* set the flag to it isn't partition yet */ appl_init(); phys_handle=graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle=wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk); hidden = FALSE; butdown = TRUE; /* doing a checking see if the cache in the system */ cachexst = (char) chkcache(); rsrc_load(RESOURCEFILE); /* Get all addresses of dialogues from resource file */ getalladdr(); needscan = TRUE; if (domulti() != 11) reboot(); wind_delete(wi_handle); v_clsvwk(handle); appl_exit(); }
/* 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 ); }
/* ***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); }
void atari_global_history_init(void) { if (atari_global_history.init == false) { if( atari_global_history.window == NULL ) { int flags = ATARI_TREEVIEW_WIDGETS; short handle = -1; OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_HISTORY); assert( tree ); handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h); atari_global_history.window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL); if( atari_global_history.window == NULL ) { gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, "Failed to allocate History"); return; } wind_set_str(handle, WF_NAME, (char*)messages_get("History")); gemtk_wm_set_toolbar(atari_global_history.window, tree, 0, 0); gemtk_wm_unlink(atari_global_history.window); atari_global_history.tv = atari_treeview_create( atari_global_history.window, &atari_global_history_treeview_callbacks, NULL, flags); if (atari_global_history.tv == NULL) { /* handle it properly, clean up previous allocs */ NSLOG(netsurf, INFO, "Failed to allocate treeview"); return; } } } atari_global_history.init = true; }
/* * Allocate a window node */ WNODE *win_alloc(WORD obid) { WNODE *pw; WORD wob; GRECT *pt; if (G.g_wcnt == NUM_WNODES) return ((WNODE *) NULL); pt = (GRECT *) &G.g_cnxsave.cs_wnode[G.g_wcnt].x_save; wob = obj_walloc(pt->g_x, pt->g_y, pt->g_w, pt->g_h); if (wob) { G.g_wcnt++; pw = &G.g_wlist[wob-2]; pw->w_flags = 0x0; pw->w_obid = obid; /* DESKTOP v1.2 */ pw->w_root = wob; pw->w_cvrow = 0x0; pw->w_pncol = (pt->g_w - gl_wchar) / G.g_iwspc; pw->w_pnrow = (pt->g_h - gl_hchar) / G.g_ihspc; pw->w_vnrow = 0x0; pw->w_id = wind_create(WINDOW_STYLE, G.g_xdesk, G.g_ydesk, G.g_wdesk, G.g_hdesk); if (pw->w_id != -1) { return pw; } win_free(pw); /* decrement G.g_wcnt & call obj_wfree() */ } return NULL; }
/* open window and enter event loop */ void start_program (void) { struct win_data wd; int fullx, fully, fullw, fullh; graf_mouse (ARROW, 0L); /* ensure mouse is an arrow */ /* 1. set up and open our window */ wind_get (0, WF_WORKXYWH, &fullx, &fully, &fullw, &fullh); wd.handle = wind_create (NAME|CLOSER, fullx, fully, fullw, fullh); wind_set (wd.handle, WF_NAME, "Example: Version 1", 0, 0); wind_open (wd.handle, fullx, fully, 300, 200); /* create any application-specific data: the string to show, in this case */ wd.text = "Hello"; /* display content in window */ draw_example (app_handle, &wd); /* 2. process events for our window */ event_loop (&wd); /* 3. close and remove our window */ wind_close (wd.handle); wind_delete (wd.handle); }
WINDOW *xw_create(int type, WD_FUNC *functions, int flags, RECT *msize, size_t wd_struct_size, OBJECT *menu, int *error) { WINDOW *w; if ((w = xw_add(wd_struct_size, menu)) == NULL) { *error = XDNSMEM; return NULL; } if ((w->xw_handle = wind_create(flags, msize->x, msize->y, msize->w, msize->h)) < 0) { (*xd_free)(w); *error = XDNMWINDOWS; return NULL; } w->xw_type = type; w->xw_opened = FALSE; w->xw_flags = flags; w->xw_func = functions; if (windows != NULL) windows->xw_prev = w; w->xw_prev = NULL; w->xw_next = windows; windows = w; *error = 0; return w; }
/* * Top level; * we get control from the desktop. */ main() { pnf = 0; /* set the flag to it isn't partition yet */ appl_init(); phys_handle=graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle=wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk); hidden = FALSE; butdown = TRUE; /* doing a checking see if the cache in the system */ cachexst = (char) chkcache(); /* check the existence of the BLiTTER */ blitxst = chkblit(); if (!rsrc_load(RESOURCEFILE)) { errs("[2][|", RESOURCEFILE, "][ EXIT ]"); goto punt; } /* Get all addresses of dialogues from resource file */ if (getalladdr() != OK) { errs("[2][|", RESOURCEFILE, "][ EXIT ]"); goto punt; } needscan = TRUE; redomul: ARROW_MOUSE; /* display menu bar */ menu_bar(menuobj, 1); running = TRUE; while (running) { domulti(); } /* * If nothing has been done to the hard disks * then just get out, back to the desktop. * Otherwise reboot the system. */ menu_bar(menuobj, 0); /* erase menu bar */ punt: wind_delete(wi_handle); v_clsvwk(handle); appl_exit(); }
/*---------------------------------------------------*/ void open_w() { wid=wind_create(NAME|MOVER|CLOSER| (_GemParBlk.global[0]>0x400?SMALLER:0),0,0,cw,ch); if (wid<0) {open_f=0;return;} if (wind_open(wid,cx,cy,cw,ch)) open_f=1; wind_set(wid,WF_NAME,(long) windowname); wind_set(wid,24,1); }
/* * Top level; * we get control from the desktop. * */ main() { long *cookptr; /* pointer to AHDI cookie */ running = TRUE; appl_init(); phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle = wind_create(WI_KIND, xdesk, ydesk, wdesk, hdesk); hidden = FALSE; butdown = TRUE; if (!rsrc_load(RESOURCEFILE)) { errs("[2][", RESOURCEFILE, "][ OK ]"); goto punt; } graf_mouse(ARROW, 0L); /* display menu bar */ if (getalladdr() == ERROR) { errs("[2][", RESOURCEFILE, "][ OK ]"); goto punt; } ostack = Super(NULL); /* Superuser mode for low memory access */ pun = (int *)(*(long *)PUNPTR); Super(ostack); /* back to User mode */ if (!pun || !(*pun)) { /* if no unit exists */ err(noavdrv); /* return error */ goto punt; } cookptr = (long *)((char *)pun + 2 + 16 + 16*4); if (*cookptr != AHDI || cookptr != *(long *)(cookptr + 1)) vernum = 0L; else vernum = (int *)(cookptr + 2); menu_bar(menubar, 1); /* put up menu bar */ while (running) domulti(); menu_bar(menubar, 0); /* erase menu bar */ punt: wind_delete(wi_handle); /* close window on screen */ v_clsvwk(handle); /* close virtual workstation */ appl_exit(); /* exit application HDX */ Pterm(0); /* terminate process */ }
main() { int gr_mkmx, gr_mkmy; int gr_mkmstate, gr_mkkstate; int tmpx, tmpy; int tmpx1, tmpy1; int tmpx2, tmpy2; int index, rgb_in[3]; int draw; appl_init(); phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle = wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk); graf_mouse(3, 0x0L); vswr_mode(handle, 3); graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); while(!(0x0002&gr_mkmstate)) { graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); if (0x0001&gr_mkmstate) { tmpy = gr_mkmy; tmpx = gr_mkmx; graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); graf_mouse(M_OFF, 0x0L); tmpy1 = gr_mkmy; tmpx1 = gr_mkmx; drawframe(tmpx, tmpy, tmpx1, tmpy1); graf_mouse(M_ON, 0x0L); while (0x0001&gr_mkmstate) { graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); if (((tmpx1 != gr_mkmx) || (tmpy1 != gr_mkmy)) && (0x0001&gr_mkmstate)) { graf_mouse(M_OFF, 0x0L); drawframe(tmpx, tmpy, tmpx1, tmpy1); drawframe(tmpx, tmpy, gr_mkmx, gr_mkmy); graf_mouse(M_ON, 0x0L); tmpy1 = gr_mkmy; tmpx1 = gr_mkmx; } } graf_mouse(M_OFF, 0x0L); drawframe(tmpx, tmpy, tmpx1, tmpy1); graf_mouse(M_ON, 0x0L); } } wind_delete(wi_handle); v_clsvwk(handle); appl_exit(); }
/* ***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); }
OUTPUT_WINDOW* setup_output_window(short workstation) { OUTPUT_WINDOW *window = calloc(1, sizeof(OUTPUT_WINDOW)); window->obj_tree_length = 2; window->obj_tree = calloc(window->obj_tree_length, sizeof(OBJECT)); window->workstation = workstation; window->text = "Llama llama llama\nllama duck\nllama llama llama llama llama llama\nHOLLLLLLAAAAAAAAAAAAAAAAAAAAAAAAAA"; short x_loc; short y_loc; short height; short width; wind_get(0, WF_CURRXYWH, &x_loc, &y_loc, &width, &height); window->handle = wind_create(NAME, x_loc, y_loc, width, height); wind_open(window->handle, x_loc + 10, y_loc + 10, width / 2, height / 2); OBJECT *box = &window->obj_tree[0]; box->ob_next = -1; box->ob_head = -1; box->ob_tail = -1; box->ob_type = G_BOX; wind_get(window->handle, WF_WORKXYWH, &box->ob_x, &box->ob_y, &box->ob_width, &box->ob_height); //Add our own multiline handling block OBJECT *text = &window->obj_tree[1]; text->ob_next = -1; text->ob_head = -1; text->ob_tail = -1; USERBLK *user_block = malloc(sizeof(USERBLK)); user_block->ub_code = &draw_multiline; user_block->ub_parm = (int)window; objc_add(window->obj_tree, 0, 1); text->ob_type = G_USERDEF; text->ob_width = box->ob_width - 1; //adjust for border text->ob_height = box->ob_height - 1; text->ob_spec.userblk = user_block; wind_set_str(window->handle, WF_NAME, "Twitter"); return window; }
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(); }
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; }
static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin, struct sslcert_session_data *ssl_d) { assert(cvwin->init == false); assert(cvwin->window == NULL); assert(cvwin->tv == NULL); int flags = ATARI_TREEVIEW_WIDGETS; short handle = -1; OBJECT * tree = gemtk_obj_get_tree(TOOLBAR_SSL_CERT); assert( tree ); handle = wind_create(flags, 0, 0, desk_area.g_w, desk_area.g_h); cvwin->window = gemtk_wm_add(handle, GEMTK_WM_FLAG_DEFAULTS, NULL); if (cvwin->window == NULL ) { gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, "Failed to allocate Treeview:\nCertviewer"); return; } wind_set_str(handle, WF_NAME, (char*)"SSL Certificate"); gemtk_wm_set_toolbar(cvwin->window, tree, 0, 0); gemtk_wm_unlink(cvwin->window); cvwin->ssl_session_data = ssl_d; cvwin->tv = atari_treeview_create(cvwin->window, &atari_sslcert_viewer_treeview_callbacks, cvwin, flags); if (cvwin->tv == NULL) { /* handle it properly, clean up previous allocs */ NSLOG(netsurf, INFO, "Failed to allocate treeview"); return; } cvwin->init = true; }
/* * Top level; * we get control from the desktop. */ main() { pnf = 0; /* set the flag to it isn't partition yet */ appl_init(); phys_handle=graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle=wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk); hidden = FALSE; butdown = TRUE; /* doing a checking see if the cache in the system */ cachexst = (char) chkcache(); if (!rsrc_load(RESOURCEFILE)) { errs("[2][|", RESOURCEFILE, "][ EXIT ]"); goto punt; } /* Get all addresses of dialogues from resource file */ if (getalladdr() != OK) { errs("[2][|", RESOURCEFILE, "][ EXIT ]"); goto punt; } /* * Get maximum partition size from * wincap "@@" entry. */ /* if (wgetent("Parameters", "@@") == OK) { if (wgetnum("ms", &mxpsiz) != OK) mxpsiz = MAXPSIZ; } else { goto punt; } */ needscan = TRUE; redomul: ARROW_MOUSE; /* display menu bar */ menu_bar(menuobj, 1); running = TRUE; while (running) { domulti(); } /* * If nothing has been done to the hard disks * then just get out, back to the desktop. * Otherwise reboot the system. */ menu_bar(menuobj, 0); /* erase menu bar */ punt: /* * If we have to reboot, * tell the user and then do it. * */ if (rebootp) { if (form_alert(2, autoboot) == 1) { reboot(); } else { goto redomul; } } wind_delete(wi_handle); v_clsvwk(handle); appl_exit(); }
/* ***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); }
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 {
void slideshow() { VEIL *tv; LEDP *led; int i,j,k,l; typedef int t_rgb[3]; t_rgb *col; int pal; long len; int wha,wx,wy,ww,wh; wind_update(BEG_MCTRL); graf_mouse(M_OFF,NULL); time(&t2); shift=(int)Kbshift(-1); if (glb.opt.deskfull) { wx=glb.aes.desk.x; wy=glb.aes.desk.y; ww=glb.aes.desk.w; wh=glb.aes.desk.h; } else { wx=0; wy=0; ww=1+glb.vdi.wscr; wh=1+glb.vdi.hscr; } wha=wind_create(0,0,0,1+glb.vdi.wscr,1+glb.vdi.hscr); if (wha<=0) { form_alert(1,glb.rsc.head.frstr[NOWIN]); graf_mouse(M_ON,NULL); graf_mouse(ARROW,NULL); wind_update(END_MCTRL); return; } _menuBar(glb.aes.tree.menu,FALSE); wind_open(wha,wx,wy,ww,wh); wind_get(wha,WF_CURRXYWH,&wx,&wy,&ww,&wh); if (glb.opt.is_tv && glb.opt.sl_tv) { tv=(VEIL *)_cookie('VeiL'); j=(int)tv->stop; tv->stop=0xFF; } if (glb.opt.is_led && glb.opt.sl_led) { led=(LEDP *)_cookie('LEDP'); k=led->active; led->active&=~1; } len=(long)glb.vdi.out[13]*(long)sizeof(t_rgb); pal=_mAlloc(len,FALSE); glb.opt.mask=0; if (pal!=NO_MEMORY) { col=(t_rgb *)glb.mem.adr[pal]; for (i=0;i<glb.vdi.out[13];i++) vq_color(glb.vdi.ha,i,1,(int *)col[i]); } glb.div.slide=TRUE; l=Balaie_Path(glb.opt.sl_path,wx,wy,ww,wh); if (!l && glb.opt.sl_loop && num>0) do { l=Balaie_Path(glb.opt.sl_path,wx,wy,ww,wh); } while (!l); glb.div.slide=FALSE; updFreeMem(); if (pal!=NO_MEMORY) { col=(t_rgb *)glb.mem.adr[pal]; for (i=0;i<glb.vdi.out[13];i++) vs_color(glb.vdi.ha,i,(int *)col[i]); _mFree(pal); } if (glb.opt.is_tv && glb.opt.sl_tv) { tv=(VEIL *)_cookie('VeiL'); tv->stop=j; } if (glb.opt.is_led && glb.opt.sl_led) { led=(LEDP *)_cookie('LEDP'); led->active=k; } wind_close(wha); wind_delete(wha); _menuBar(glb.aes.tree.menu,TRUE); graf_mouse(M_ON,NULL); graf_mouse(ARROW,NULL); wind_update(END_MCTRL); }
short main(int argc, char *argv[]) { MFDB dest; short my_AppId, x, y, w, h; short work_in[11] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2}; short work_out[57], msg[16], w_id1; short open_windows = 1, dummy; short wx, wy, ww, wh, clip[4], pnt[4]; char win1_name[20]; unsigned short logo_trnfrm[LOGO_DATASIZE]; GRECT dirty, walk; short e = 0, evx, evy, a, kc_shstate, kc_key, click_count; my_AppId = appl_init(); my_handle = graf_handle(&x, &y, &w, &h); /* Open a virtual workstation */ v_opnvwk(work_in, &my_handle, work_out); logo_bm.fd_w = LOGO_W; logo_bm.fd_h = LOGO_H; logo_bm.fd_wdwidth = 12; logo_bm.fd_nplanes = 4; logo_bm.fd_stand = 1; dest = logo_bm; dest.fd_stand = 0; logo_bm.fd_addr = (void *)x_logo; dest.fd_addr = (void *)logo_trnfrm; vr_trnfm(my_handle, &logo_bm, &dest); logo_bm.fd_addr = (void *)logo_trnfrm; w_id1 = wind_create(NAME|CLOSE|MOVER, 0, 0, LOGO_W + 40, LOGO_H + 40); if (argc > 1) sprintf(win1_name,"%s", argv[1]); else sprintf(win1_name,"Welcome to...", argv[1]); wind_set(w_id1, WF_NAME, ADDR(win1_name)); x = (work_out[0] - (LOGO_W + 40)) / 2; y = (work_out[1] - (LOGO_H + 40)) / 2; wind_open(w_id1, x, y, LOGO_W + 40, LOGO_H + 40); while((open_windows) && (!(e & MU_TIMER))) { e = evnt_multi(MU_MESAG|MU_TIMER, 258, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 15000, 0, &evx, &evy, &a, &kc_shstate, &kc_key, &click_count); if (e & MU_MESAG) { dummy = msg[0]; switch(dummy) { case WM_CLOSED: /* Did someone close one of our windows? */ wind_close(msg[3]); open_windows--; break; case WM_MOVED: wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]); break; case WM_REDRAW: dirty.g_x = msg[4]; dirty.g_y = msg[5]; dirty.g_w = msg[6]; dirty.g_h = msg[7]; wind_update(BEG_UPDATE); wind_get(msg[3], WF_WORKXYWH, &wx, &wy, &ww, &wh); walk.g_x = wx; walk.g_y = wy; walk.g_w = ww; walk.g_h = wh; pnt[0] = wx; pnt[1] = wy; pnt[2] = wx + ww; pnt[3] = wy + wh; wind_get(msg[3], WF_FIRSTXYWH, &x, &y, &w, &h); rc_intersect(&walk, &dirty); graf_mouse(M_OFF, NULL); while(h) { walk.g_x = x; walk.g_y = y; walk.g_w = w; walk.g_h = h; if (rc_intersect(&dirty, &walk)) { clip[0] = walk.g_x; clip[1] = walk.g_y; clip[2] = walk.g_x + walk.g_w; clip[3] = walk.g_y + walk.g_h; vs_clip(my_handle, 1, clip); vsf_color(my_handle, LWHITE); v_bar(my_handle, pnt); display_bitmap(wx, wy); } wind_get(msg[3], WF_NEXTXYWH, &x, &y, &w, &h); } vs_clip(my_handle, 0, clip); graf_mouse(M_ON, NULL); wind_update(END_UPDATE); break; case WM_TOPPED: wind_set(msg[3], WF_TOP, 0, 0, 0, 0); break; case WM_BOTTOMED: wind_set(msg[3], WF_BOTTOM, 0, 0, 0, 0); break; } } } v_clsvwk(my_handle); appl_exit(); return 0; }
main() { int gr_mkmx, gr_mkmy; int gr_mkmstate, gr_mkkstate; int tmpx, tmpy; int tmpx1, tmpy1; int tmpx2, tmpy2; int index, rgb_in[3]; int draw; appl_init(); phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle = wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk); graf_mouse(3, 0x0L); graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); tmpx = gr_mkmx; tmpy = gr_mkmy; vswr_mode(handle, 3); v_enter_cur(handle); v_exit_cur(handle); graf_mouse(M_OFF, 0x0L); drawicon(gr_mkmx,gr_mkmy); graf_mouse(M_ON, 0x0L); drawicon(gr_mkmx+65,gr_mkmy); drawicon(gr_mkmx+65,gr_mkmy+65); drawicon(gr_mkmx+130,gr_mkmy); drawicon(gr_mkmx+130,gr_mkmy+130); drawicon(gr_mkmx+195,gr_mkmy); drawicon(gr_mkmx+195,gr_mkmy+195); drawicon(gr_mkmx+260,gr_mkmy); drawicon(gr_mkmx+260,gr_mkmy+260); drawicon(gr_mkmx+325,gr_mkmy); drawicon(gr_mkmx+325,gr_mkmy+325); drawicon(gr_mkmx+390,gr_mkmy); drawicon(gr_mkmx,gr_mkmy+65); drawicon(gr_mkmx+130,gr_mkmy+65); drawicon(gr_mkmx+195,gr_mkmy+65); drawicon(gr_mkmx+260,gr_mkmy+65); drawicon(gr_mkmx+325,gr_mkmy+65); drawicon(gr_mkmx+390,gr_mkmy+65); drawicon(gr_mkmx,gr_mkmy+130); drawicon(gr_mkmx+65,gr_mkmy+130); drawicon(gr_mkmx+195,gr_mkmy+130); drawicon(gr_mkmx+260,gr_mkmy+130); drawicon(gr_mkmx+325,gr_mkmy+130); drawicon(gr_mkmx+390,gr_mkmy+130); drawicon(gr_mkmx,gr_mkmy+195); drawicon(gr_mkmx+65,gr_mkmy+195); drawicon(gr_mkmx+130,gr_mkmy+195); drawicon(gr_mkmx+260,gr_mkmy+195); drawicon(gr_mkmx+325,gr_mkmy+195); drawicon(gr_mkmx+390,gr_mkmy+195); drawicon(gr_mkmx,gr_mkmy+260); drawicon(gr_mkmx+65,gr_mkmy+260); drawicon(gr_mkmx+130,gr_mkmy+260); drawicon(gr_mkmx+195,gr_mkmy+260); drawicon(gr_mkmx+325,gr_mkmy+260); drawicon(gr_mkmx+390,gr_mkmy+260); drawicon(gr_mkmx,gr_mkmy+325); drawicon(gr_mkmx+65,gr_mkmy+325); drawicon(gr_mkmx+130,gr_mkmy+325); drawicon(gr_mkmx+195,gr_mkmy+325); drawicon(gr_mkmx+260,gr_mkmy+325); drawicon(gr_mkmx+390,gr_mkmy+325); while(!(0x0002&gr_mkmstate)) { graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); tmpx1 = gr_mkmx; tmpy1 = gr_mkmy; tmpx2 = gr_mkmx; tmpy2 = gr_mkmy; graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); while (((tmpx1 != gr_mkmx) || (tmpy1 != gr_mkmy)) && ((abs(tmpx1, tmpx2) < 6) || (abs(tmpy1, tmpy2) < 6)) && (0x0001&gr_mkmstate)) { graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); tmpx1 = gr_mkmx; tmpy1 = gr_mkmy; graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); draw = 1; } if (draw) { /* v_enter_cur(handle); graf_mouse(M_OFF, 0x0L); graf_mouse(M_ON, 0x0L); */ v_exit_cur(handle); drawicon(gr_mkmx,gr_mkmy); drawicon(gr_mkmx+65,gr_mkmy); drawicon(gr_mkmx+65,gr_mkmy+65); drawicon(gr_mkmx+130,gr_mkmy); drawicon(gr_mkmx+130,gr_mkmy+130); drawicon(gr_mkmx+195,gr_mkmy); drawicon(gr_mkmx+195,gr_mkmy+195); drawicon(gr_mkmx+260,gr_mkmy); drawicon(gr_mkmx+260,gr_mkmy+260); drawicon(gr_mkmx+325,gr_mkmy); drawicon(gr_mkmx+325,gr_mkmy+325); drawicon(gr_mkmx+390,gr_mkmy); drawicon(gr_mkmx,gr_mkmy+65); drawicon(gr_mkmx+130,gr_mkmy+65); drawicon(gr_mkmx+195,gr_mkmy+65); drawicon(gr_mkmx+260,gr_mkmy+65); drawicon(gr_mkmx+325,gr_mkmy+65); drawicon(gr_mkmx+390,gr_mkmy+65); drawicon(gr_mkmx,gr_mkmy+130); drawicon(gr_mkmx+65,gr_mkmy+130); drawicon(gr_mkmx+195,gr_mkmy+130); drawicon(gr_mkmx+260,gr_mkmy+130); drawicon(gr_mkmx+325,gr_mkmy+130); drawicon(gr_mkmx+390,gr_mkmy+130); drawicon(gr_mkmx,gr_mkmy+195); drawicon(gr_mkmx+65,gr_mkmy+195); drawicon(gr_mkmx+130,gr_mkmy+195); drawicon(gr_mkmx+260,gr_mkmy+195); drawicon(gr_mkmx+325,gr_mkmy+195); drawicon(gr_mkmx+390,gr_mkmy+195); drawicon(gr_mkmx,gr_mkmy+260); drawicon(gr_mkmx+65,gr_mkmy+260); drawicon(gr_mkmx+130,gr_mkmy+260); drawicon(gr_mkmx+195,gr_mkmy+260); drawicon(gr_mkmx+325,gr_mkmy+260); drawicon(gr_mkmx+390,gr_mkmy+260); drawicon(gr_mkmx,gr_mkmy+325); drawicon(gr_mkmx+65,gr_mkmy+325); drawicon(gr_mkmx+130,gr_mkmy+325); drawicon(gr_mkmx+195,gr_mkmy+325); drawicon(gr_mkmx+260,gr_mkmy+325); drawicon(gr_mkmx+390,gr_mkmy+325); draw = 0; } } wind_delete(wi_handle); v_clsvwk(handle); appl_exit(); }