void nag_about(int time) { OBJECT *dlog; short x,y,w,h; #ifdef DEMO Crsrc_gaddr(R_TREE,NAG_SCREEN,&dlog); set_tedinfo(dlog,Please_Wait_Butt,"Please Wait"); form_center(dlog,&x,&y,&w,&h); form_dial(FMD_START,0,0,0,0,x,y,w,h); objc_draw(dlog,0,10,x,y,w,h); /*pause for supplied time_value*/ set_tedinfo(dlog,Please_Wait_Butt," OK "); objc_draw(dlog,0,10,x,y,w,h); /* handle form */ handle_dialog(dlog,0,0); set_tedinfo(dlog,Please_Wait_Butt,"Please Wait"); form_dial(FMD_FINISH,0,0,0,0,x,y,w,h); #endif }
open_dial(int flag) { static int x,y,w,h; if ((!_AccFlag) || (para.multi==MULTINE)){ if(flag) { strcpy((char *)transfer[BLOCKNUM].ob_spec,"0001"); strcpy((char *)transfer[STATUS].ob_spec,"---"); strcpy((char *)transfer[RETRIES].ob_spec,"0001"); form_center(transfer,&x,&y,&w,&h); form_dial(0,0,0,0,0,x,y,w,h); objc_draw(transfer,0,8,x,y,w,h); } else form_dial(3,0,0,0,0,x,y,w,h); } else { if (flag) { wind_up(0); strcpy(msg,"0001 01 ---"); v_gtext(handle,640-12*8,13,msg); } else wind_up(1); was_full=0;Bconout(2,7); } }
/* ** Description ** Show information about oAESis ** ** 1999-01-10 CG ** 1999-01-11 CG */ static void show_information (void) { OBJECT * information; int x; int y; int w; int h; /* Get address if information resource */ rsrc_gaddr (R_TREE, INFORM, &information); /* Fix version number :-) */ sprintf(information[INFOVERSION].ob_spec.tedinfo->te_ptext, OAESIS_VERSION); /* Calculate area of resource */ form_center (information, &x, &y, &w, &h); /* Reserve area for dialog */ form_dial (FMD_START, x, y, w, h, x, y, w, h); /* Draw dialog */ objc_draw (information, 0, 9, x, y, w, h); /* Let the user handle the dialog */ form_do (information, 0); /* Free area used by dialog */ form_dial (FMD_FINISH, x, y, w, h, x, y, w, h); /* Restore ok button */ information[INFOOK].ob_state &= ~SELECTED; }
/*************************** * restore ttf-gdos to its previous config */ static void tidy_up( void ) { register uint16 n = pInfo->nr_wkstns; register WORKSTN_RECORD *pw = pInfo->workstn_table; char *const gempath = ((void**)pInfo)[-1]; register int i = gem_font_count; int xdial,ydial,wdial,hdial; /* co-ords for dialog box */ int x,y,w,h; form_center (&rs_object,&xdial,&ydial,&wdial,&hdial); x=y=w=h=0; form_dial (FMD_START,x,y,w,h,xdial,ydial,wdial,hdial); /* reserve room */ sprintf( usr_msg, "please wait ..." ); objc_draw( &rs_object, 0, 2, xdial, ydial, wdial, hdial ); /* draw the dialog box */ for( ; n>0; n--, pw++ ) { /* printf( "wkstn %d, %s, 1st font is %d, nr is %d\n", pw->id, &pw->driver_name, pw->nr_gemfonts, pw->first_font ); */ pw->nr_gemfonts = save[pw->id].nr_gemfonts; pw->first_font = save[pw->id].first_font; } /* for */ for( ; i>=0; i-- ) { FONT_FILE_NAME( gempath+pInfo->len_gem_path, i ); remove( gempath ); } /* for */ form_dial( FMD_FINISH, x, y, w, h, xdial, ydial, wdial, hdial ); /* release its room */ } /* tidy_up() */
void gem_prgm() { OBJECT *tree; int box_x, box_y, box_w, box_h, button, end = FALSE; int work_in[11], work_out[57], count, dummy; for (count = 0; count < 10; count++) work_in[count] = 1; work_in[10] = 2; vdi_handle = graf_handle (& dummy, & dummy, & dummy, & dummy); v_opnvwk (work_in, & vdi_handle, work_out); vq_extnd (vdi_handle, 1, work_out); planes = work_out[4]; rsrc_gaddr (R_TREE, LOGCTRL, & tree); form_center (tree, & box_x, & box_y, & box_w, & box_h); form_dial (FMD_START, 0,0,0,0, box_x, box_y, box_w, box_h); objc_draw (tree, ROOT, MAX_DEPTH, box_x, box_y, box_w, box_h); do { button = form_do (tree, 0) & 0x7fffu; evnt_timer (60, 0); tree[button].ob_state &= ~SELECTED; objc_draw (tree, button, 1, box_x, box_y, box_w, box_h); switch (button) { case FILENAM : modify_fname(); objc_draw (tree, ROOT, MAX_DEPTH, box_x, box_y, box_w, box_h); break; case CLIENT : case MODULE : form_dial (FMD_FINISH, 0,0,0,0, box_x, box_y, box_w, box_h); do_dialog ((button == CLIENT) ? CLI_API : MOD_API); form_dial (FMD_START, 0,0,0,0, box_x, box_y, box_w, box_h); objc_draw (tree, ROOT, MAX_DEPTH, box_x, box_y, box_w, box_h); break; case TERM : if (form_alert (1, "[2][ | Remove LogSTinG and | leave LogCTRL ?][ Yes | No ]") == 1) { if ((long) (*sting_drivers->get_dftab) ("LOGSTING : REMOVE") == 'OkOk') end = TRUE; else form_alert (1, "[1][ | Could not remove LogSTinG ! ][ Hmmm ]"); } break; case FIX : if (form_alert (1, "[2][ | Activate new settings ? ][ Yes | No ]") == 1) do_settings(); break; case CANCEL : if (form_alert (1, "[2][ | Leave LogCTRL ? ][ Yes | No ]") == 1) end = TRUE; break; } } while (! end); form_dial (FMD_FINISH, 0,0,0,0, box_x, box_y, box_w, box_h); v_clsvwk (vdi_handle); }
/* ------------------------------------------------------------------ */ static void choose_font(void) { OBJECT *loading; int cx, cy, cw, ch; bool is_prn; is_prn = (form_alert( 1, "[0][select device][screen|printer]" )==2); dprintf(( "\033Hselected %s workstation\n", is_prn? "printer": "screen" )); if( init_wkstn( is_prn ) ) { graf_mouse(BUSY_BEE, 0); dprintf(( "ready to load fonts ... " )); dgetchar(); rsrc_gaddr( R_TREE, LDGFONTS, &loading ); form_center( loading, &cx, &cy, &cw, &ch); form_dial(FMD_START, 0, 0, 0, 0, cx, cy, cw, ch); objc_draw( loading, ROOT, MAX_DEPTH, cx, cy, cw, ch); (void)vst_load_fonts(handle, 0); form_dial( FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch ); dprintf(( "\033Hdone\nnow getting font names ..." )); dgetchar(); if( get_fontnames( *(tGemFont **)(&_contrl[10]) ) ) { dprintf(( "done\n" )); dgetchar(); graf_mouse(ARROW, 0); while( select_font( is_prn ) ) { if( iSelected == NO_INDEX ) { form_alert( 1, "[1][You must choose|a font to dump][Try Again]" ); } else if( gem_file_name[0] == '\0' ) { form_alert( 1, "[1][You must choose a|" "gem font file name][Try Again]" ); } else { dump_font(); gem_file_name[0] = '\0'; /* reset entries for next round */ iSelected = NO_INDEX; } /* if */ } /* while */ } /* if */ vst_unload_fonts(handle, 0); free(name_table); dprintf(( "\033Hclosing %s workstation ...", is_prn? "printer": "screen" )); if( is_prn ) v_clswk(handle); else v_clsvwk(handle); } else form_alert(1, "[3][Can't open workstation][OK]"); } /* choose_font() */
/*! Modifies objects on desk */ void objets_desk(void) { OBJECT *adr; adr = win[GRAND_FORM].w_cont.w_form.w_tree; set_text(adr_desk, BU_TXT1, get_text(adr, GF_PU1)); set_text(adr_desk, BU_TXT2, get_text(adr, GF_PU2)); form_dial(FMD_FINISH, 0, 0, 0, 0, adr_desk[BU_TXT1 - 1].ob_x, adr_desk[BU_TXT1 - 1].ob_y + bureau.yd, adr_desk[BU_TXT1 - 1].ob_width, adr_desk[BU_TXT1 - 1].ob_height); adr_desk[BU_ICN].ob_spec.iconblk->ib_pdata = adr[GF_ICN].ob_spec.bitblk->bi_pdata; form_dial(FMD_FINISH, 0, 0, 0, 0, adr_desk[BU_ICN].ob_x, adr_desk[BU_ICN].ob_y + bureau.yd, adr_desk[BU_ICN].ob_width, adr_desk[BU_ICN].ob_height); } /* endof objets_desk() */
static void GEM_LockScreen(_THIS) { if (!GEM_locked) { /* Lock AES */ wind_update(BEG_UPDATE); wind_update(BEG_MCTRL); /* Reserve memory space, used to be sure of compatibility */ form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h); /* Save menu bar */ if (GEM_menubar) { MFDB mfdb_src; short blitcoords[8]; mfdb_src.fd_addr=GEM_menubar; mfdb_src.fd_w=GEM_desk_w; mfdb_src.fd_h=GEM_desk_y; mfdb_src.fd_wdwidth=GEM_desk_w>>4; mfdb_src.fd_nplanes=VDI_bpp; mfdb_src.fd_stand= mfdb_src.fd_r1= mfdb_src.fd_r2= mfdb_src.fd_r3= 0; blitcoords[0] = blitcoords[4] = 0; blitcoords[1] = blitcoords[5] = 0; blitcoords[2] = blitcoords[6] = GEM_desk_w-1; blitcoords[3] = blitcoords[7] = GEM_desk_y-1; vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &VDI_dst_mfdb, &mfdb_src); } GEM_locked=SDL_TRUE; }
/*! place image on the desk */ void set_bimg(void) { if(img_attach(&bimg, BIMAGE, BUREAU, BU_IMG, TRUE, TRUE)) { adr_desk[BU_IMG].ob_flags &= ~HIDETREE; /* object to draw */ form_dial(FMD_FINISH, ZERO, ZERO, ZERO, ZERO, bureau.xd, bureau.yd, bureau.wd, bureau.hd); } /* desk image found */ } /* end of set_bimg */
/*! modify pattern on desk */ void trame_desk(void) { OBJECT *adr; adr = win[PETIT_FORM].w_cont.w_form.w_tree; adr_desk->ob_spec.obspec.fillpattern = adr[PF_TRAME].ob_spec.obspec.fillpattern; adr_desk->ob_spec.obspec.interiorcol = adr[PF_COLOR].ob_spec.obspec.interiorcol; form_dial(FMD_FINISH, 0, 0, 0, 0, bureau.xd, bureau.yd, bureau.wd, bureau.hd); } /* endof trame_desk() */
/******************************************************************************* _fselect ******************************************************************************** int _fselect(char *pfname,char *pname,char *fname,char *ext,char *title) Funktion: Ruft den FileSelector in komfortabler Art und Weise auf. Dabei kann man alle Parts (Filename, Pathname, etc.) einzeln �bergeben. Man kann aber auch Pathname und den kompletten Namen in `pfname' �bergeben. Diese Routine sucht sich schon das, was ihr fehlt in bestimmten Grenzen selbst heraus. Diese Funktion unterst�tzt den FSEL-Cookie und l�uft auch ohne Selectric. Parameter: *pfname Enth�lt abschlie�end den fertigen Pfad, den man sofort in ein `open' einsetzen kann. *pname Der Startpfad (ohne Wildcards!). *fname Ein voreingestellte Filenamen. *ext Eine Extension. *title Einen Boxtitel. Dabei wird a) die TOS-Version als auch der FSEL-Cookie �berpr�ft. Return: Der Button mit dem der Selector verlassen wurde. Bemerkung: Beim Aufruf aus Accessories nicht vergessen ein BEG/END_UPDATE um diesen Aufruf zu legen!!!!!!!!!! Die meisten File-Selector Clones (incl. Selectric) machen das eh, nicht aber das Original ... *******************************************************************************/ int _fselect(char *pfname,char *pname,char *fname,char *ext,char *title) { int but; char *p; if (!fname[0]) { p=strrchr(pfname,'\\'); if (p) strcpy(fname,p+1); else strcpy(fname,pfname); } if (!pname[0]) { p=strrchr(pfname,'\\'); if (p) { p[1]='\0'; strcpy(pname,pfname); } } else if (pname[strlen(pname)-1] != '\\') strcat(pname,"\\"); strcat(pname,ext); wind_update(BEG_MCTRL); form_dial(FMD_START,0,0,0,0,glb.aes.desk.x,glb.aes.desk.y,glb.aes.desk.w,glb.aes.desk.h); if (_fsel_check() || (_vTOS() >= 0x0104)) fsel_exinput(pname,fname,&but,title); else fsel_input(pname,fname,&but); form_dial(FMD_FINISH,0,0,0,0,glb.aes.desk.x,glb.aes.desk.y,glb.aes.desk.w,glb.aes.desk.h); _clearAesBuffer(); wind_update(END_MCTRL); p=strrchr(pname,'\\'); if (p) *p='\0'; strcpy(pfname,pname); strcat(pfname,"\\"); strcat(pfname,fname); return but; }
void std_input(char *title, char *text, char *txt_cancel) { int x, y, w, h ; int button ; if ( stdinput == NULL ) stdinput_fix() ; if ( txt_cancel != NULL ) strcpy( stdinput[INPUT_CANCEL].ob_spec.free_string, txt_cancel ) ; write_text(stdinput, INPUT_TEXT, "") ; write_text(stdinput, INPUT_TITLE, title) ; form_center(stdinput, &x, &y, &w, &h) ; form_dial(0, x, y, w, h, x, y, w, h) ; objc_draw(stdinput, 0, 200, x, y, w, h) ; button = form_do(stdinput, INPUT_TEXT) ; deselect(stdinput, button) ; form_dial(3, x, y, w, h, x, y, w, h) ; if (button == INPUT_OK) read_text(stdinput, INPUT_TEXT, text) ; else text[0] = 0 ; }
int main(void) { int x,y,w,h; int vid; int work_in[] = {1,7,1,1,1,1,1,1,1,1,2}; int work_out[57]; OBJECT * dial; appl_init(); vid = graf_handle(&vid,&vid,&vid,&vid); v_opnvwk(work_in,&vid,work_out); if(rsrc_load("test2rsc.rsc")) { 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); own_form_do(dial,0); form_dial(FMD_FINISH,0,0,0,0,x,y,w,h); rsrc_free(); } else { form_alert(1,"[1][Couldn't load resource file!][Bummer!]"); } v_clsvwk(vid); appl_exit(); return 0; }
static void GEM_UnlockScreen(_THIS) { if (GEM_locked) { /* Restore screen memory, and send REDRAW to all apps */ form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h); /* Unlock AES */ wind_update(END_MCTRL); wind_update(END_UPDATE); GEM_locked=SDL_FALSE; } }
static void GEM_LockScreen(_THIS) { if (!GEM_locked) { /* Reserve memory space, used to be sure of compatibility */ form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h); /* Lock AES */ wind_update(BEG_UPDATE); wind_update(BEG_MCTRL); GEM_locked=SDL_TRUE; } }
/*! desk events */ void event_desk(void) { int old_x, old_y, new_x, new_y, dummy; evnt_timer(70, 0); /* timer delay */ graf_mkstate(&dummy, &dummy, &mk, &dummy); if((object == BU_ICN) &&(mk == 1)) { /* icon still cliked -> move */ old_x = adr_desk[object].ob_x; old_y = adr_desk[object].ob_y; graf_dragbox(adr_desk[object].ob_width, adr_desk[object].ob_height, adr_desk[object].ob_x + bureau.xd, adr_desk[object].ob_y + bureau.yd, bureau.xd, bureau.yd, bureau.wd, bureau.hd, &new_x, &new_y); adr_desk[object].ob_x = new_x - bureau.xd; adr_desk[object].ob_y = new_y - bureau.yd; form_dial(FMD_FINISH, 0, 0, 0, 0, old_x + bureau.xd, old_y + bureau.yd, adr_desk[object].ob_width, adr_desk[object].ob_height); form_dial(FMD_FINISH, 0, 0, 0, 0, adr_desk[object].ob_x + bureau.xd, adr_desk[object].ob_y + bureau.yd, adr_desk[object].ob_width, adr_desk[object].ob_height); } else if(((object == BU_BOXTXT) ||(object == BU_TXT1) ||(object == BU_TXT2)) &&(mk == 1)) { /* text stiil cliked -> move */ old_x = adr_desk[BU_BOXTXT].ob_x; old_y = adr_desk[BU_BOXTXT].ob_y; graf_dragbox(adr_desk[BU_BOXTXT].ob_width, adr_desk[BU_BOXTXT].ob_height, adr_desk[BU_BOXTXT].ob_x + bureau.xd, adr_desk[BU_BOXTXT].ob_y + bureau.yd, bureau.xd, bureau.yd, bureau.wd, bureau.hd, &new_x, &new_y); adr_desk[BU_BOXTXT].ob_x = new_x - bureau.xd; adr_desk[BU_BOXTXT].ob_y = new_y - bureau.yd; form_dial(FMD_FINISH, 0, 0, 0, 0, old_x + bureau.xd - 3, old_y + bureau.yd - 3, adr_desk[BU_BOXTXT].ob_width + 6, adr_desk[BU_BOXTXT].ob_height + 6); form_dial(FMD_FINISH, 0, 0, 0, 0, adr_desk[BU_BOXTXT].ob_x + bureau.xd - 3, adr_desk[BU_BOXTXT].ob_y + bureau.yd - 3, adr_desk[BU_BOXTXT].ob_width + 6, adr_desk[BU_BOXTXT].ob_height + 6); } else if(((object == ZERO) ||(object == BU_IMG)) && (adr_desk[BU_ICN].ob_state & SELECTED) &&(mk == 0)) { /* desk clicked -> deselect */ adr_desk[BU_ICN].ob_state &= ~SELECTED; form_dial(FMD_FINISH, 0, 0, 0, 0, adr_desk[BU_ICN].ob_x + bureau.xd, adr_desk[BU_ICN].ob_y + bureau.yd, adr_desk[BU_ICN].ob_width, adr_desk[BU_ICN].ob_height); } else if((object == BU_ICN) && NOT(adr_desk[BU_ICN].ob_state & SELECTED) && (mk == 0)) { /* simple click icon -> select */ adr_desk[BU_ICN].ob_state |= SELECTED; form_dial(FMD_FINISH, 0, 0, 0, 0, adr_desk[BU_ICN].ob_x + bureau.xd, adr_desk[BU_ICN].ob_y + bureau.yd, adr_desk[BU_ICN].ob_width, adr_desk[BU_ICN].ob_height); } } /* end of event_desk() */
void deinit_popup(POPUP_DATA *pop) { int counter=NOLL; form_dial(FMD_FINISH,0,0,0,0,poptree[ROOT].ob_x-5,poptree[ROOT].ob_y-5,poptree[ROOT].ob_width+10,poptree[ROOT].ob_height+10); wind_update(END_MCTRL); wind_update(END_UPDATE); /******************************************************************/ /* Change the 0 terminated strings back to '|' terminated */ /******************************************************************/ while(counter<pop->size) { if(pop->string[counter]==NOLL) pop->string[counter]='|'; counter++; } }
/*----------------------------------------------------------------------------------------*/ int16 icn_popup( int16 ptree, int16 obj, int16 x_off, int16 y_off ) { OBJECT *tree; GRECT rect, desk, rect1, rect2; GRECT kl_rect = {0,0,0,0}; int16 item, founditem, olditem; int16 first_child, last_child; int16 event, ret; UWORD uret; int16 bclicks, bmask, bstate; BOOL leave, found; EVNTDATA ev; rsrc_gaddr(R_TREE, ptree, &tree); first_child = (tree[obj].ob_head); last_child = (tree[obj].ob_tail); olditem = -1; while(last_child != -1) { olditem = last_child; last_child = (tree[last_child].ob_tail); } last_child = olditem; tree[R_TREE].ob_x = 0; /* Anpassen des Parent-Objekts */ tree[R_TREE].ob_y = 0; tree[obj].ob_x = x_off; /* Anpassen der Popup-Box */ tree[obj].ob_y = y_off; wind_get(0,WF_WORKXYWH, &desk.g_x, &desk.g_y, &desk.g_w, &desk.g_h); /* Das POPUP darf nicht ausserhalb des Bildschirms erscheinen) */ if( (tree[obj].ob_x + tree[obj].ob_width) > (desk.g_x + desk.g_w) ) tree[obj].ob_x = (desk.g_x + desk.g_w - tree[obj].ob_width); if( (tree[obj].ob_y + tree[obj].ob_height) > (desk.g_y + desk.g_h) ) tree[obj].ob_y = (desk.g_y + desk.g_h - tree[obj].ob_height); if(tree[obj].ob_x < 0) tree[obj].ob_x = desk.g_x; if(tree[obj].ob_y < 0) tree[obj].ob_y = desk.g_y; rect.g_x = tree[obj].ob_x - 8; rect.g_y = tree[obj].ob_y - 8; rect.g_w = tree[obj].ob_width + 16; rect.g_h = tree[obj].ob_height + 16; form_dial(FMD_START, &kl_rect, &rect); graf_mkstate( &ev ); olditem = NIL; founditem = item = objc_find(tree, obj, 1, ev.x, ev.y); /* In Men� ? */ if (item != NIL) if ((tree[item].ob_state & DISABLED) || !(tree[item].ob_flags & SELECTABLE)) item = NIL; if (item != NIL) tree[item].ob_state |= SELECTED; objc_draw(tree, obj, MAX_DEPTH, &rect); wind_update(BEG_MCTRL); /* Ich will die Kontrolle */ do { if (founditem != NIL) /* In Men�eintrag */ { leave = TRUE; objc_rect (tree, founditem, &rect1); } else /* Au�erhalb Pop-Up-Men� */ { leave = FALSE; objc_rect (tree, obj, &rect1); } graf_mkstate( &ev ); if( !((ev.bstate) & 3) ) bclicks = 258; else bclicks = 0; bmask = 3; bstate = 0; event = evnt_multi ( MU_KEYBD | MU_BUTTON | MU_M1, bclicks, bmask, bstate, leave, &rect1, 0, &kl_rect, NULL, 0, &ev, (int16 *)&uret, (int16 *)&ret); olditem = item; if(!(event & MU_KEYBD)) { founditem = item = objc_find (tree, obj, 1, ev.x, ev.y); if (item != NIL) { if ((tree[item].ob_state & DISABLED) || !(tree[item].ob_flags & SELECTABLE)) item = NIL; } } else { if((uret >> 8) == 80) /* Pfeil runter */ { found = FALSE; while(!found) { item++; if((item < first_child) || (item > last_child)) { item = first_child; } if ((tree[item].ob_flags & SELECTABLE)) { if( tree[item].ob_state & DISABLED ) found = FALSE; else found = TRUE; } } } if((uret >> 8) == 72) /* Pfeil rauf */ { found = FALSE; while(!found) { item--; if((item < first_child) || (item > last_child)) { item = last_child; } if ((tree[item].ob_flags & SELECTABLE)) { if( tree[item].ob_state & DISABLED ) found = FALSE; else found = TRUE; } } } if(((uret >> 8) == 28)||((uret >> 8) == 114)) /* Enter/Return */ event = MU_BUTTON; if(((uret >> 8) == 01)||((uret >> 8) == 97)) /* Esc/UNDO */ { item = NIL; event = MU_BUTTON; } } if (olditem != item) { if (olditem != NIL) { if(tree[olditem].ob_state & SELECTED) tree[olditem].ob_state &= ~SELECTED; else tree[olditem].ob_state |= SELECTED; objc_rect(tree, olditem, &rect2); objc_draw(tree, obj, MAX_DEPTH, &rect2); } if (item != NIL) { if(tree[item].ob_state & SELECTED) tree[item].ob_state &= ~SELECTED; else tree[item].ob_state |= SELECTED; objc_rect(tree, item, &rect2); objc_draw(tree, obj, MAX_DEPTH, &rect2); } } } while (! (event & MU_BUTTON)); wind_update(END_MCTRL); form_dial(FMD_FINISH, &kl_rect, &rect); if (item != NIL) tree[item].ob_state &= ~SELECTED; graf_mkstate( &ev ); bclicks = 0; if (~ev.bstate & bmask) evnt_button (bclicks, bmask, 0x00, &ev); /* Warte auf Mausknopf */ return(item); }
/* ----------------- */ show_font() { int off, key, w, h, ww, wh, dummy; register int i, hg, eo; OBJECT *show_form; int sx, sy, sw, sh, c_xy[4], eff = NORMAL, f_sld; int sk = 0; menu_bar(menu_adr, FALSE); store_char(); inst_font(&show_head); vsf_interior(vdi_handle, 0); for (i = 0; i < 14 && show_head.skewmask != skew[i]; i++); if (i < 14) sk = i; else sk = 6; rsrc_gaddr(ROOT, SHW_FLD, &show_form); form_center(show_form, &sx, &sy, &sw, &sh); strcpy(show_form[SHW_NAM].ob_spec, font_back[FONTNAME].ob_spec); strcpy(show_form[SHW_DEF].ob_spec, font_back[CHAR_DEF].ob_spec); show_form[BOLD].ob_state &= ~SELECTED; show_form[ITALIC].ob_state &= ~SELECTED; show_form[LIGHT].ob_state &= ~SELECTED; show_form[OUTL].ob_state &= ~SELECTED; show_form[UNDERL].ob_state &= ~SELECTED; show_form[KR_UP].ob_state |= DISABLED; show_form[KR_DWN].ob_state |= DISABLED; show_form[UL_UP].ob_state |= DISABLED; show_form[UL_DWN].ob_state |= DISABLED; hg = show_head.top * 2; make_rasc((long)hg, 100L, ((TEDINFO *)show_form[SHW_TG].ob_spec)->te_ptext); off = akt_char; set_aktshw(&f_sld, off, show_form); make_rasc((long)show_head.formheight, 10L, show_form[SHW_HGHT].ob_spec); objc_draw(show_form, ROOT, MAX_DEPTH, sx, sy, sw, sh); objc_offset(show_form, SHW_WIND, &c_xy[0], &c_xy[1]); c_xy[2] = c_xy[0] + show_form[SHW_WIND].ob_width - 1; c_xy[3] = c_xy[1] + show_form[SHW_WIND].ob_height - 1; do { make_fontscreen(off, hg, c_xy, eff); eo = form_do(show_form, 0) & 0x7FFF; if (!(show_form[eo].ob_state & DISABLED)) switch(eo) { case BOLD: if (show_form[BOLD].ob_state & SELECTED) eff |= 1; else eff &= ~1; break; case LIGHT: if (show_form[LIGHT].ob_state & SELECTED) eff |= 2; else eff &= ~2; break; case ITALIC: if (show_form[ITALIC].ob_state & SELECTED) { eff |= 4; show_form[KR_UP].ob_state &= ~DISABLED; show_form[KR_DWN].ob_state &= ~DISABLED; } else { eff &= ~4; show_form[KR_UP].ob_state |= DISABLED; show_form[KR_DWN].ob_state |= DISABLED; } objc_draw(show_form, SHW_PARA, MAX_DEPTH, sx, sy, sw, sh); break; case UNDERL: if (show_form[UNDERL].ob_state & SELECTED) { eff |= 8; show_form[UL_UP].ob_state &= ~DISABLED; show_form[UL_DWN].ob_state &= ~DISABLED; } else { eff &= ~8; show_form[UL_UP].ob_state |= DISABLED; show_form[UL_DWN].ob_state |= DISABLED; } objc_draw(show_form, SHW_PARA, MAX_DEPTH, sx, sy, sw, sh); break; case OUTL: if (show_form[OUTL].ob_state & SELECTED) eff |= 16; else eff &= ~16; break; case TG_UP: if (hg < show_head.top * 2) do { hg++; }while(hg == show_head.top); make_rasc((long)hg, 100L, ((TEDINFO *)show_form[SHW_TG].ob_spec)->te_ptext); objc_draw(show_form, SHW_TG, MAX_DEPTH, sx, sy, sw, sh); break; case TG_DWN: if (hg > 3) do { hg--; }while(hg == show_head.top); make_rasc((long)hg, 100L, ((TEDINFO *)show_form[SHW_TG].ob_spec)->te_ptext); objc_draw(show_form, SHW_TG, MAX_DEPTH, sx, sy, sw, sh); break; case UL_DWN: if (show_head.underlinemask < 10) show_head.underlinemask++; break; case UL_UP: if (show_head.underlinemask > 0) show_head.underlinemask--; break; case KR_DWN: if (sk < 13) show_head.skewmask = skew[++sk]; break; case KR_UP: if (sk > 0) show_head.skewmask = skew[--sk]; break; case SHW_UP: if (off > 0) off--; set_aktshw(&f_sld, off, show_form); objc_draw(show_form, SHW_CBKG, MAX_DEPTH, sx, sy, sw, sh); objc_draw(show_form, SHW_INFO, MAX_DEPTH, sx, sy, sw, sh); break; case SHW_DWN: if (off < 255) off++; set_aktshw(&f_sld, off, show_form); objc_draw(show_form, SHW_CBKG, MAX_DEPTH, sx, sy, sw, sh); objc_draw(show_form, SHW_INFO, MAX_DEPTH, sx, sy, sw, sh); break; default: show_form[eo].ob_state &= ~SELECTED; } }while(eo != SHW_END); deinst_font(); menu_bar(menu_adr, TRUE); objc_change(font_back, MARKER, 0, fx, fy, fw, fh, NORMAL, TRUE); form_dial(FMD_FINISH, 0, 0, 0, 0, sx, sy, sw, sh); show_character(); show_ccharacter(); draw_edit(); objc_change(font_back, MARKER, 0, fx, fy, fw, fh, SELECTED, TRUE); }
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(); }
/* MAIN() * ================================================================ */ VOID main( VOID ) { OBJECT *tree; WORD i; WORD button; GRECT box; GRECT xrect; WORD tempx; GRECT rect; MRETS mk; WORD ptitle, pitem, pmenu; OBJECT *ptree; BOOLEAN flag; BOOLEAN done; WORD dummy; WORD xvalue; appl_init(); phys_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox ); graf_mouse( ARROW, 0L ); rsrc_load( "TEST.RSC" ); rsrc_gaddr( 0, MENU1, &ad_tree ); rsrc_gaddr( 0, BIGBOX, &ad_box ); rsrc_gaddr( 0, COUNTRY, &ad_country ); rsrc_gaddr( 0, OTHER, &ad_other ); rsrc_gaddr( 0, MENUBAR, &ad_menubar ); rsrc_gaddr( 0, TREE6, &ad_extra ); ad_other[ ROOT ].ob_x = ad_other[ ROOT ].ob_y = 0; #if 0 /* test setting delay and height variables */ TData.Delay = 100L; TData.Drag = 10000L; TData.Delay = 250L; TData.Speed = 0L; TData.Height = 16; menu_settings( 1, &TData ); #endif /* test attaching submenus */ Menu.mn_tree = ad_country; Menu.mn_menu = ROOT; Menu.mn_item = Cur2; Menu.mn_scroll = TRUE; menu_attach( 1, ad_tree, DELETE, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = DISNEY; Menu.mn_item = MICKEY; Menu.mn_scroll = FALSE; menu_attach( 1, ad_tree, FLOPPY, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = MODEM; Menu.mn_item = Cur3; Menu.mn_scroll = FALSE; menu_attach( 1, ad_country, 5, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = DISNEY; Menu.mn_item = MICKEY; Menu.mn_scroll = FALSE; menu_attach( 1, ad_country, 1, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = DISNEY; Menu.mn_item = MICKEY; Menu.mn_scroll = FALSE; menu_attach( 1, ad_country, ARKANSAS, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = QUOTES; Menu.mn_item = Cur4; Menu.mn_scroll = FALSE; menu_attach( 1, ad_other, 5, &Menu ); Menu.mn_tree = ad_country; Menu.mn_menu = ROOT; Menu.mn_item = Cur2; Menu.mn_scroll = TRUE; menu_attach( 1, ad_menubar, PASTE, &Menu ); Menu.mn_tree = ad_country; Menu.mn_menu = ROOT; Menu.mn_item = Cur2; Menu.mn_scroll = TRUE; menu_attach( 1, ad_menubar, FNEW, &Menu ); menu_icheck( ad_tree, Cur1, 1 ); menu_icheck( ad_country, Cur2, 1 ); menu_icheck( ad_other, Cur3, 1 ); menu_icheck( ad_other, Cur4, 1 ); menu_icheck( ad_other, Cur5, 1 ); ActiveTree( ad_box ); form_center( ad_box, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h ); ObX( ROOT ) = rect.g_x; xrect = ObRect( TITLE1 ); objc_offset( ad_box, TITLE1, &xrect.g_x, &xrect.g_y ); tempx = xrect.g_x; xrect.g_x = (( xrect.g_x + 7 )/8 ) * 8; rect.g_x = rect.g_x + ( xrect.g_x - tempx ); ObX( ROOT ) = rect.g_x; rect.g_x -= 3; form_dial( FMD_START, rect.g_x, rect.g_y, rect.g_w, rect.g_h, rect.g_x, rect.g_y, rect.g_w, rect.g_h ); objc_draw( ad_box, ROOT, MAX_DEPTH, rect.g_x, rect.g_y, rect.g_w, rect.g_h ); do { ActiveTree( ad_box ); button = form_do( ad_box, 0L ); switch( button ) { case TITLE1: box = ObRect( TITLE1 ); objc_offset( ad_box, TITLE1, &box.g_x, &box.g_y ); Menu.mn_tree = ad_tree; Menu.mn_menu = ROOT; Menu.mn_item = Cur1; Menu.mn_scroll = FALSE; flag = menu_popup( &Menu, box.g_x, box.g_y, &MData ); if( flag ) MenuCheck( MData.mn_tree, MData.mn_menu, MData.mn_item ); break; case TITLE2: box = ObRect( TITLE2 ); objc_offset( ad_box, TITLE2, &box.g_x, &box.g_y ); Menu.mn_tree = ad_country; Menu.mn_menu = ROOT; Menu.mn_item = Cur2; Menu.mn_scroll = TRUE; flag = menu_popup( &Menu, box.g_x, box.g_y, &MData ); if( flag ) MenuCheck( MData.mn_tree, MData.mn_menu, MData.mn_item ); break; case TITLE3: box = ObRect( TITLE3 ); objc_offset( ad_box, TITLE3, &box.g_x, &box.g_y ); Menu.mn_tree = ad_other; Menu.mn_menu = MODEM; Menu.mn_item = Cur3; Menu.mn_scroll = FALSE; flag = menu_popup( &Menu, box.g_x, box.g_y, &MData ); if( flag ) MenuCheck( MData.mn_tree, MData.mn_menu, MData.mn_item ); break; case TITLE4: box = ObRect( TITLE4 ); objc_offset( ad_box, TITLE4, &box.g_x, &box.g_y ); Menu.mn_tree = ad_other; Menu.mn_menu = QUOTES; Menu.mn_item = Cur4; Menu.mn_scroll = FALSE; flag = menu_popup( &Menu, box.g_x, box.g_y, &MData ); if( flag ) MenuCheck( MData.mn_tree, MData.mn_menu, MData.mn_item ); break; default: break; } }while( button != XEXIT ); form_dial( FMD_FINISH, rect.g_x, rect.g_y, rect.g_w, rect.g_h, rect.g_x, rect.g_y, rect.g_w, rect.g_h ); evnt_button( 1, 1, 0, &dummy, &dummy, &dummy, &dummy ); /* display menubar stuff here */ ActiveTree( ad_menubar ); menu_bar( ad_menubar, TRUE ); do { evnt_mesag( msg ); if( msg[0] == MN_SELECTED ) { /* msg[7] is the parent of FQUIT - which the user can't know */ ptr = &msg[5]; if( ( *ptr == ad_menubar ) && ( msg[4] == FQUIT ) ) { button = form_alert( 1, "[1][ | EXIT PROGRAM? ][OK|Cancel]"); if( button == 1 ) done = TRUE; } else MenuCheck( *ptr, msg[7], msg[4] ); menu_tnormal( ad_menubar, msg[3], TRUE ); } }while( !done ); menu_bar( ad_menubar, FALSE ); rsrc_free(); graf_mouse( ARROW, 0L ); appl_exit(); }
static bool select_font( bool is_prn ) { int button, cx, cy, cw, ch, mousey, slidey, dum; int index, i, double_click; long pos; static int top = 0; /* first name set to the top */ wind_update(BEG_UPDATE); set_slider_size(); /* set slider size and position, like a GEM window */ set_slider_pos(top); ((TEDINFO *)chooser[CHACTION].ob_spec)->te_ptext = " Choose GDOS font "; ((TEDINFO *)chooser[CHTITLE].ob_spec)->te_ptext = is_prn? " Printer font list: ": " Screen font list: "; ((TEDINFO *)chooser[GEMFNAME].ob_spec)->te_ptext = gem_file_name; ((TEDINFO *)chooser[GEMFNAME].ob_spec)->te_txtlen = sizeof(gem_file_name); form_center(chooser, &cx, &cy, &cw, &ch); form_dial(FMD_START, 0, 0, 0, 0, cx, cy, cw, ch); objc_draw(chooser, ROOT, MAX_DEPTH, cx, cy, cw, ch); /* ** the chooser can show up to MAX_NAMES names. If there are fewer than this, ** the empty slots are disabled by clearing the TOUCHEXIT flags */ for( i=0; i<MAX_NAMES; i++ ) { if( i<nr_names ) { chooser[NAME1+i].ob_flags |= TOUCHEXIT; } else { chooser[NAME1+i].ob_flags &= ~TOUCHEXIT; } /* if */ } /* for */ show_names( top ); /* display the font names */ /** the main loop **/ do { button =form_do( chooser, GEMFNAME ); dprintf(( "\033Hbutton is %x\n", button)); dgetchar(); if(button&0x8000) { /* double click */ double_click = TRUE; button &= 0x7fff; } else double_click = FALSE; if(button ==DNARR) { if((top+MAX_NAMES)<nr_names) { top++; /* next name in the list */ show_names( top ); set_slider_pos(top); objc_draw(chooser, SLIDEBAR, MAX_DEPTH, cx, cy, cw, ch); } } else if(button ==UPARR) { if(top>0) { top--; show_names( top ); set_slider_pos(top); objc_draw(chooser, SLIDEBAR, MAX_DEPTH, cx, cy, cw, ch); } } else if(button ==SLIDEBAR && nr_names>MAX_NAMES) { /* handle clicks on the slidebar */ graf_mkstate(&dum, &mousey, &dum, &dum); /* where is the mouse - above or below the slider? */ objc_offset(chooser, SLIDER, &dum, &slidey); if(mousey<slidey) { /* mouse is above the slider */ top-=MAX_NAMES; /* move up one page of names */ if(top<0) top =0; } else { top+=MAX_NAMES; if(top>(nr_names-MAX_NAMES)) top =nr_names-MAX_NAMES; } /* if */ show_names( top ); set_slider_pos(top); objc_draw(chooser, SLIDEBAR, MAX_DEPTH, cx, cy, cw, ch); } else if(button ==SLIDER && nr_names>MAX_NAMES) { /* handle the slider */ pos =graf_slidebox(chooser, SLIDEBAR, SLIDER, 1); /* the position the user wants */ chooser[SLIDER].ob_y =pos*(long)(chooser[SLIDEBAR].ob_height-chooser[SLIDER].ob_height)/1000; top =pos*(nr_names-MAX_NAMES)/1000; if(top<0) top =0; if(top>(nr_names-MAX_NAMES)) top =nr_names-MAX_NAMES; show_names( top ); objc_draw(chooser, SLIDEBAR, MAX_DEPTH, cx, cy, cw, ch); } else if(button>=NAME1 && button<=NAME8) { /*** the user has clicked on a font name ***/ index = top+button-NAME1; dprintf(( "\033Hindex is %d\n", index)); dgetchar(); if( iSelected == index ) { /* the name is already selected */ assert( iSelected >=0 ); assert( iSelected < nr_names ); iSelected = NO_INDEX; /* deselect it */ highlight(button); /* remove the highlight from the name */ } else { /* is the currently selected font name displayed in the box? */ if( iSelected!=NO_INDEX && (iSelected+NAME1-top)>=NAME1 && (iSelected+NAME1-top)<=NAME8 ) { highlight( iSelected+NAME1-top ); /* remove highlight */ } /* if */ iSelected = index; /* set the index for the new selection */ highlight(button); /* and highlight it */ } /* if */ if(double_click) button =CHOOSEOK; /* if double clicked on a name, exit immediately */ } /* if */ assert( iSelected == NO_INDEX || iSelected >=0 ); assert( iSelected == NO_INDEX || iSelected < nr_names ); } while(button!=CHOOSEOK && button!=CHOOSECA); /** returned from form, process user actions **/ dprintf(( "\033HiSelected is %d\n", iSelected)); dgetchar(); dprintf(( "selected name is %s\n", name_table[iSelected].name )); dprintf(( "gem file name is %s\n", ((TEDINFO *)chooser[GEMFNAME].ob_spec)->te_ptext )); dprintf(( "%s format%s\n", chooser[MOT].ob_state&SELECTED ? "motorola" : "intel", chooser[WIDONLY].ob_state&SELECTED ? ", width tables only" : "" )); dgetchar(); assert( (chooser[MOT].ob_state & SELECTED) != (chooser[INTEL].ob_state&SELECTED) ); fMot = (chooser[MOT].ob_state & SELECTED) != 0; fWidOnly = (chooser[WIDONLY].ob_state & SELECTED) != 0; chooser[button].ob_state &= ~SELECTED; form_dial( FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch ); wind_update( END_UPDATE ); return button==CHOOSEOK; } /* select_font() */
static void dump_font() { const tGemFont *const pgf = name_table[iSelected].pFont; const uint16 nr_entries = pgf->last_ade - pgf->first_ade + 1; const uint32 size_wid = (nr_entries+1) * sizeof(uint16); uint32 size_hor; register tGemFont *phdr; FILE *fp; int16 dummy; int16 clip_array[4] = { 0, 0, 100, 100 }; OBJECT *generating; int cx, cy, cw, ch; char *err_str; dprintf(( "\033Hgenerating fonts ... " )); dgetchar(); rsrc_gaddr( R_TREE, GENFONTS, &generating ); form_center( generating, &cx, &cy, &cw, &ch); form_dial(FMD_START, 0, 0, 0, 0, cx, cy, cw, ch); objc_draw( generating, ROOT, MAX_DEPTH, cx, cy, cw, ch); vst_font( handle, pgf->font_id ); vst_point( handle, pgf->size, &dummy, &dummy, &dummy, &dummy ); assert( (pgf->flags&MOT_FLAG) != 0 ); size_hor = pgf->flags&HOR_FLAG ? nr_entries : 0; phdr = (tGemFont*)malloc( sizeof(tGemFont) + size_wid ); if( phdr == NULL ) { err_str = "[3][Not enough memory|to convert font][OK]"; goto error0; } /* if */ *phdr = *pgf; /* copy header data */ phdr->h_table = (int8*)sizeof(tGemFont); phdr->off_table = (int16*)((uint32)phdr->h_table + size_hor); phdr->dat_table = (int8*)((uint32)phdr->off_table + size_wid); memcpy( phdr+1, pgf->off_table, size_wid ); if( !fMot ) { register int16 *char_tbl = (int16*)(phdr+1); register uint16 i; for (i = nr_entries+1; i > 0; i--) { Swapw(*char_tbl); char_tbl++; } /* for */ /* swap header words and longs */ phdr->flags &= ~MOT_FLAG; Swapw(phdr->font_id); Swapw(phdr->size); Swapw(phdr->first_ade); Swapw(phdr->last_ade); Swapw(phdr->top); Swapw(phdr->ascent); Swapw(phdr->half); Swapw(phdr->descent); Swapw(phdr->bottom); Swapw(phdr->max_char_width); Swapw(phdr->max_cell_width); Swapw(phdr->left_offset); Swapw(phdr->right_offset); Swapw(phdr->thicken); Swapw(phdr->ul_size); Swapw(phdr->lighten); Swapw(phdr->skew); Swapw(phdr->flags); Swapl(phdr->h_table); Swapl(phdr->off_table); Swapl(phdr->dat_table); Swapw(phdr->form_width); Swapw(phdr->form_height); } /* if */ fp = fopen( gem_file_name, "wb" ); if( fp == NULL ) { err_str = "[3][can't open gem font file][OK]"; goto error1; } /* if */ /** write the font header **/ assert( phdr != NULL ); if( fwrite( phdr, sizeof( *phdr), 1, fp ) != 1 ) { goto error2; } /* if */ if( size_hor != 0 ) { /** write horizontal offset table **/ assert( pgf->h_table != NULL ); if( fwrite( pgf->h_table, nr_entries, 1, fp ) != 1 ) { goto error2; } /* if */ } /* if */ /** write the character offset table **/ if( fwrite( phdr+1, size_wid, 1, fp ) != 1 ) { goto error2; } /* if */ if( !fWidOnly ) { /** write the character data table **/ int q; unsigned char char_array[2] = { '\0', '\0' }; dprintf(( "\033Hgenerating character data\n" )); dgetchar(); vs_clip( handle, 1, clip_array ); for( q=nr_entries, *char_array=pgf->first_ade; q>0; q--, (*char_array)++ ) { v_gtext( handle, 200, 200, char_array ); } /* for */ vs_clip( handle, 0, clip_array ); assert( pgf->dat_table != NULL ); if( fwrite( pgf->dat_table, pgf->form_width, pgf->form_height, fp ) != pgf->form_height ) { goto error2; } /* if */ } /* if */ fclose( fp ); free( phdr ); form_dial( FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch ); return; error2: fclose( fp ); err_str = "[3][can't write to|gem font file][OK]"; error1: free( phdr ); error0: form_dial( FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch ); form_alert(1, err_str ); } /* dump_font() */
/* SetNewDialog() * ================================================================ */ void SetNewDialog( OBJECT *newtree ) { OBJECT *oldtree; GRECT old; oldtree = ad_tree; ActiveTree( ad_tree ); old.g_x = ObX( ROOT ); old.g_y = ObY( ROOT ); old.g_w = ObW( ROOT ); old.g_h = ObH( ROOT ); ad_tree = newtree; ActiveTree( ad_tree ); /* If the window has never been moved, center it */ if( !gl_move ) FormCenter( ad_tree, &gl_work ); ObX( ROOT ) = gl_work.g_x; ObY( ROOT ) = gl_work.g_y; gl_work.g_w = ObW( ROOT ); gl_work.g_h = ObH( ROOT ); 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_set( wid, WF_CURRXYWH, gl_curr.g_x, gl_curr.g_y, gl_curr.g_w, gl_curr.g_h ); if( gl_gdos == XFSM ) wind_set( wid, WF_NAME, wfsm ); else wind_set( wid, WF_NAME, wfont ); /* Don't send a redraw message IF we are using an AES >= 4.0 */ if( 1 /*AES_Version < 0x0400*/ ) { /* Send a redraw message if this is the same dialog box */ /* This is good for the insert disk dialog box */ /* Also send a message if the new dialog box is smaller than or * equal to the previous one, to generate a redraw. */ if((oldtree == newtree)||((old.g_w>=ObW(ROOT))|| (old.g_h>=ObH( ROOT )) )) { form_dial( FMD_FINISH, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h ); } } else { /* But, if its the same tree, force a redraw...*/ if( oldtree == newtree ) { form_dial( FMD_FINISH, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h, gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h ); } } }
/******************************************************* * load fonts for device * get font chain and dump fonts (width table only) in current directory */ static void dump_gem_fonts( int16 dev_nr ) { const tGemFont *pgf; /* pointer to the font chain */ int16 handle; char *err_msg; register tGemFont *phdr; /* pointer to font we are making */ char *const gempath = ((void**)pInfo)[-1]; FILE *fp; int xdial,ydial,wdial,hdial; /* co-ords for dialog box */ int x,y,w,h; handle = init_wkstn( dev_nr ); /* open the workstation */ if( handle == 0 ) { sprintf( err_string, "[3][can't connect to %s][skip]", dev_nr>10? "printer": "screen" ); form_alert(1, err_string ); return; } /* if */ if( vst_load_fonts( handle, 0 ) == 0 ) { sprintf( err_string, "[3][can't find fonts for %s][skip]", dev_nr>10? "printer": "screen" ); goto error0; } /* if */ pgf = *(tGemFont **)(&_contrl[10]); /* get pointer to font chain */ save[dev_nr].pw->first_font = gem_font_count; /****************** * loop thru font chain, * writing a new font file for each font found in the chain * count the fonts so we can assign them to the workstations * this can take quite a while, so report progress as we go */ form_center (&rs_object,&xdial,&ydial,&wdial,&hdial); x=y=w=h=0; form_dial (FMD_START,x,y,w,h,xdial,ydial,wdial,hdial); /* reserve room */ for( ; pgf!=NULL; pgf=pgf->next_font ) { const uint16 nr_entries = pgf->last_ade - pgf->first_ade + 1; const uint32 size_wid = (nr_entries+1) * sizeof(int16); /* sizeof(*(tGemFont*)->off_table) */ register int16 *char_tbl; register uint16 i; /* printf( "line %d, %.32s, %d points\n", (int)__LINE__, pgf->name, pgf->size ); */ sprintf( usr_msg, "storing gem fonts: %d", gem_font_count ); objc_draw( &rs_object, 0, 2, xdial, ydial, wdial, hdial ); /* draw the dialog box */ phdr = (tGemFont*)malloc( sizeof(tGemFont) + size_wid ); if( phdr == NULL ) { err_msg = "[3][Not enough memory|to dump font][OK]"; goto error1; } /* if */ *phdr = *pgf; /* copy header data */ phdr->off_table = (int16*)sizeof(tGemFont); memcpy( phdr+1, pgf->off_table, size_wid ); phdr->dat_table = 0L; /** convert font to intel format before dumping **/ for( i = nr_entries+1, char_tbl = (int16*)(phdr+1); i > 0; i--, char_tbl++ ) { Swapw(*char_tbl); } /* for */ /* swap header words and longs */ phdr->flags &= ~MOT_FLAG; Swapw(phdr->font_id); Swapw(phdr->size); Swapw(phdr->first_ade); Swapw(phdr->last_ade); Swapw(phdr->top); Swapw(phdr->ascent); Swapw(phdr->half); Swapw(phdr->descent); Swapw(phdr->bottom); Swapw(phdr->max_char_width); Swapw(phdr->max_cell_width); Swapw(phdr->left_offset); Swapw(phdr->right_offset); Swapw(phdr->thicken); Swapw(phdr->ul_size); Swapw(phdr->lighten); Swapw(phdr->skew); Swapw(phdr->flags); Swapl(phdr->h_table); Swapl(phdr->off_table); Swapl(phdr->dat_table); Swapw(phdr->form_width); Swapw(phdr->form_height); /* printf( "line %dn", (int)__LINE__); getchar(); */ FONT_FILE_NAME( gempath+pInfo->len_gem_path, gem_font_count ); fp = fopen( gempath, "wb" ); if( fp == NULL ) { err_msg = "[3][can't open gem font file|%s][OK]"; goto error2; } /* if */ /** write the font header **/ if( fwrite( phdr, sizeof( *phdr), 1, fp ) != 1 ) { goto error3; } /* if */ /** write the character offset table **/ if( fwrite( phdr+1, size_wid, 1, fp ) != 1 ) { goto error3; } /* if */ fclose( fp ); free( phdr ); gem_font_count++; } /* for */ save[dev_nr].pw->nr_gemfonts = gem_font_count - save[dev_nr].pw->first_font; (void)vst_unload_fonts( handle, 0 ); if( dev_nr>10 ) v_clswk(handle); else v_clsvwk(handle); form_dial( FMD_FINISH, x, y, w, h, xdial, ydial, wdial, hdial ); /* release its room */ return; error3: fclose(fp); err_msg = "[3][can't write to gem font file|%s][OK]"; error2: sprintf( err_string, err_msg, strerror(errno) ); free( phdr ); error1: form_dial( FMD_FINISH, x, y, w, h, xdial, ydial, wdial, hdial ); /* release its room */ error0: (void)vst_unload_fonts( handle, 0 ); if( dev_nr>10 ) v_clswk(handle); else v_clsvwk(handle); form_alert(1, err_string ); } /* dump_gem_fonts() */
void init_popup(POPUP_DATA *pop) { int counter=0; pop->pointer1=pop->pointer2=pop->string; /******************************************************************/ /* Change the '|' terminated strings to 0 terminated and count */ /* How many strings */ /******************************************************************/ while(pop->string[pop->size]!=NOLL) { if(pop->string[pop->size]=='|') { counter++; pop->string[pop->size]=NOLL; } pop->size++; } pop->d_antal=counter /*-1*/; if(pop->d_antal<pop->s_antal) pop->s_antal=pop->d_antal; if(exist_3d) { long temp; poptree=POPUP_3D; temp=(long)poptree[ROOT].ob_spec; temp&=0xff00ffff; temp|=0x00020000; poptree[ROOT].ob_spec=temp; } else poptree=POPUP_MONO; poptree[P_TITLE_TEXT].ob_spec=pop->string; b_place(pop->tree,pop->object,xy); poptree[ROOT].ob_x=pop->tree[pop->object].ob_x; if(pop->object!=ROOT) poptree[ROOT].ob_x+=pop->tree[ROOT].ob_x; poptree[ROOT].ob_width=xy[W]; if(pop->s_antal==pop->d_antal) { poptree[POPUP_UP].ob_flags|=HIDETREE; poptree[POPUP_DOWN].ob_flags|=HIDETREE; poptree[POPUP_SLIDE_BACK].ob_flags|=HIDETREE; } else { poptree[ROOT].ob_width+=poptree[POPUP_UP_IMG].ob_width+3; poptree[POPUP_UP].ob_flags&=~HIDETREE; poptree[POPUP_DOWN].ob_flags&=~HIDETREE; poptree[POPUP_SLIDE_BACK].ob_flags&=~HIDETREE; } poptree[POPUP_TITLE].ob_x=0; poptree[POPUP_TITLE].ob_y=0; poptree[POPUP_TITLE].ob_height=font_height+2; poptree[POPUP_TITLE].ob_width=poptree[ROOT].ob_width; poptree[POPUP_TITLE].ob_spec=(void *)0x00FF0000; poptree[ROOT].ob_height=poptree[POPUP_TITLE].ob_height+2+pop->s_antal*font_height; poptree[P_TITLE_TEXT].ob_x=poptree[POPUP_TITLE].ob_x; poptree[P_TITLE_TEXT].ob_y=poptree[POPUP_TITLE].ob_y; poptree[P_TITLE_TEXT].ob_height=poptree[POPUP_TITLE].ob_height; poptree[P_TITLE_TEXT].ob_width=poptree[POPUP_TITLE].ob_width; poptree[POPUP_UP].ob_x=poptree[ROOT].ob_width-poptree[POPUP_UP_IMG].ob_width-2; poptree[POPUP_UP].ob_y=poptree[POPUP_TITLE].ob_height+4; poptree[POPUP_UP].ob_width=poptree[POPUP_UP_IMG].ob_width; poptree[POPUP_UP].ob_height=poptree[POPUP_UP_IMG].ob_height; poptree[POPUP_UP_IMG].ob_x=0; poptree[POPUP_UP_IMG].ob_y=0; poptree[POPUP_DOWN].ob_x=poptree[POPUP_UP].ob_x; poptree[POPUP_DOWN].ob_y=poptree[ROOT].ob_height-poptree[POPUP_DOWN_IMG].ob_height-2; poptree[POPUP_DOWN].ob_width=poptree[POPUP_DOWN_IMG].ob_width; poptree[POPUP_DOWN].ob_height=poptree[POPUP_DOWN_IMG].ob_height; poptree[POPUP_DOWN_IMG].ob_x=0; poptree[POPUP_DOWN_IMG].ob_y=0; poptree[POPUP_SLIDE_BACK].ob_x=poptree[POPUP_UP].ob_x; poptree[POPUP_SLIDE_BACK].ob_y=poptree[POPUP_UP].ob_y+poptree[POPUP_UP].ob_height+4; poptree[POPUP_SLIDE_BACK].ob_width=poptree[POPUP_DOWN].ob_width; poptree[POPUP_SLIDE_BACK].ob_height=poptree[POPUP_DOWN].ob_y-poptree[POPUP_SLIDE_BACK].ob_y; poptree[POPUP_SLIDE].ob_x=0; poptree[POPUP_SLIDE].ob_y=0; /* Nedanst†ende rad skall ber„knas fram */ poptree[POPUP_SLIDE].ob_height=poptree[POPUP_SLIDE_BACK].ob_height-16; poptree[POPUP_SLIDE].ob_width=poptree[POPUP_SLIDE_BACK].ob_width; for(counter=P_CHOOSE0; counter<=P_CHOOSE19; counter++) { poptree[counter].ob_type=G_STRING; poptree[counter].ob_state=NOLL; poptree[counter].ob_flags=NOLL; poptree[counter].ob_x=1; poptree[counter].ob_y=poptree[POPUP_TITLE].ob_height+2+(counter-P_CHOOSE0)*font_height; poptree[counter].ob_height=16; if(pop->s_antal>=pop->d_antal) poptree[counter].ob_width=poptree[ROOT].ob_width-2; else poptree[counter].ob_width=poptree[POPUP_DOWN].ob_x-6; poptree[counter].ob_flags&=~HIDETREE; } counter=P_CHOOSE0+pop->s_antal; while(counter<=P_CHOOSE19) poptree[counter++].ob_flags|=HIDETREE; if(pop->select>FAIL) { while((pop->offset+pop->s_antal<pop->d_antal)&&(pop->offset<pop->select)) { for( ; *pop->pointer1!=0; pop->pointer1++); pop->pointer1++; pop->offset++; } } else { for( ; *pop->pointer1!=0; pop->pointer1++); pop->pointer1++; pop->offset++; } pop->pointer2=pop->pointer1; pop->pointer1-=2; if(*pop->pointer2=='-') { poptree[P_CHOOSE0].ob_state|=DISABLED; pop->pointer2++; } (char *)poptree[P_CHOOSE0].ob_spec=pop->pointer2; for(counter=1; counter<pop->s_antal; counter++) { for(;*pop->pointer2!='\0';pop->pointer2++); pop->pointer2++; if(strcmp(pop->pointer2,"-")) { if(*pop->pointer2=='-') { poptree[P_CHOOSE0+counter].ob_state|=DISABLED; pop->pointer2++; } (char *)poptree[P_CHOOSE0+counter].ob_spec=pop->pointer2; } else { poptree[P_CHOOSE0+counter].ob_type=G_BOX; poptree[P_CHOOSE0+counter].ob_x+=font_width/2; poptree[P_CHOOSE0+counter].ob_width-=font_width; if(exist_3d) { poptree[P_CHOOSE0+counter].ob_flags=FL3DACT; poptree[P_CHOOSE0+counter].ob_spec=(void *)0x00FF0000; poptree[P_CHOOSE0+counter].ob_state=SELECTED; poptree[P_CHOOSE0+counter].ob_height=1; poptree[P_CHOOSE0+counter].ob_y+=font_height/2; } else { poptree[P_CHOOSE0+counter].ob_height=2; poptree[P_CHOOSE0+counter].ob_y+=font_height/2-1; poptree[P_CHOOSE0+counter].ob_spec=(void *)0x1071; } } } pop->number=pop->select-pop->offset; poptree[ROOT].ob_y=pop->tree[pop->object].ob_y-poptree[POPUP_TITLE].ob_height-2-font_height*(pop->select-pop->offset); if(pop->object!=ROOT) poptree[ROOT].ob_y+=pop->tree[ROOT].ob_y; if(poptree[ROOT].ob_x+poptree[ROOT].ob_width>screenx+screenw) poptree[ROOT].ob_x=screenx+screenw-poptree[ROOT].ob_width; while(poptree[ROOT].ob_y<screeny) poptree[ROOT].ob_y+=font_height; if(pop->number!=FAIL) poptree[P_CHOOSE0+pop->number].ob_state|=SELECTED; while(poptree[ROOT].ob_y+poptree[ROOT].ob_height>screeny+screenh) poptree[ROOT].ob_y-=font_height; if(pop->number!=FAIL) { pop->x=poptree[P_CHOOSE0+pop->number].ob_x; pop->y=poptree[P_CHOOSE0+pop->number].ob_y; pop->w=poptree[P_CHOOSE0+pop->number].ob_width; pop->h=poptree[P_CHOOSE0+pop->number].ob_height; } else { pop->x=poptree[P_CHOOSE0].ob_x; pop->y=poptree[P_CHOOSE0].ob_y; pop->w=poptree[P_CHOOSE0].ob_width; pop->h=poptree[P_CHOOSE0].ob_height; } wind_update(BEG_UPDATE); wind_update(BEG_MCTRL); form_dial(FMD_START,0,0,0,0,poptree[ROOT].ob_x-5,poptree[ROOT].ob_y-5,poptree[ROOT].ob_width+10,poptree[ROOT].ob_height+10); objc_draw(poptree,ROOT,MAX_DEPTH,screenx,screeny,screenw,screenh); }
/* show configuration dial, return 1 to cancel installation */ int configure( void ) { OBJECT *tree = rs_object; int quit = 0; int x, y, w, h, ox, oy; MRETS mk; int savelinear, saveudset, savetime, saveptime; if( ma_info == &start ) /* ma_info points at our start */ ObString(OK) = (char *)(rs_frstr[INSTRING]); /* set accel buttons */ savelinear = ma_info->linear; set_accelbox( savelinear ); /* set screensave buttons */ saveudset = ma_info->udset; set_screenbox( saveudset ); savetime = (ma_info->timeout)/3600; sl_x( SAVEBOX, savetime, SAVE_MIN, SAVE_MAX ); /* set modem switch */ if( ma_info->watch ) { Select(MODEM); } else { Deselect(MODEM); } /* set stacy options box */ if( ma_info->stacy ) { ObFlags( SWITCH ) = ObFlags( LITE ) = TOUCHEXIT; if( ma_info->stacmask & SH_SCREEN ) Select( SWITCH ); if( ma_info->stacmask & SH_LIGHT ) Select( LITE ); } else { ObFlags(SWITCH) = ObFlags(LITE) = NONE; ObState(SWITCH) = ObState(LITE) = DISABLED; /* deselects */ } /* set up park box */ Supexec((long(*)())get_parktime); if( parktime >= 0 ) parktime = ma_info->savepark; saveptime = parktime; if( saveptime == 0 ) saveptime = 1; set_parkbox(); if( parktime >= 0 ) sl_x( PARKBOX, parktime, PARK_MIN, PARK_MAX ); /* set appropriate icons */ graf_handle( &x, &y, &w, &h ); if( y < 16 ) { /* if char cell is < 16 pixels high, use 8 pixel icons */ ObSpec(IACCOFF).bitblk = (BITBLK *)(rs_frimg[ACCOFF8]); ObSpec(IACCSLOW).bitblk = (BITBLK *)(rs_frimg[ACCSLOW8]); ObSpec(IACCFAST).bitblk = (BITBLK *)(rs_frimg[ACCFAST8]); ObSpec(ISCREEN).bitblk = (BITBLK *)(rs_frimg[SCREEN8]); ObSpec(SAVEUP).bitblk = (BITBLK *)(rs_frimg[TIMEHI8]); ObSpec(SAVEDOWN).bitblk = (BITBLK *)(rs_frimg[TIMELO8]); ObSpec(IMODEM).bitblk = (BITBLK *)(rs_frimg[MODEM8]); ObSpec(IPARK).bitblk = (BITBLK *)(rs_frimg[PARK8]); ObSpec(PARKUP).bitblk = (BITBLK *)(rs_frimg[TIMEHI8]); ObSpec(PARKDOWN).bitblk = (BITBLK *)(rs_frimg[TIMELO8]); ObSpec(ILITE).bitblk = (BITBLK *)(rs_frimg[LITE8]); ObSpec(ISWITCH).bitblk = (BITBLK *)(rs_frimg[SCREEN8]); } form_center( rs_object, &x, &y, &w, &h ); form_dial( FMD_START, 0, 0, 0, 0, x, y, w, h ); form_dial( FMD_GROW, 0, 0, 0, 0, x, y, w, h ); objc_draw( tree, 0, MAX_DEPTH, x, y, w, h ); graf_mouse( ARROW, 0L ); do { switch( form_do( rs_object, 0 ) & 0x7fff ) { case LITE: if( IsSelected(LITE) ) { /* deselecting */ /* don't allow user to select screensave without litesave */ Deselect(SWITCH); Deselect(LITE); } else { Select(LITE); } Objc_draw( tree, STACOPTS, MAX_DEPTH, NULL ); break; case SWITCH: if( IsSelected(SWITCH) ) { /* deselecting */ Deselect(SWITCH); } else { /* don't allow user to select screensave without litesave */ Select(LITE); Select(SWITCH); } Objc_draw( tree, STACOPTS, MAX_DEPTH, NULL ); break; case SCREEN: /* floggle the bit */ ma_info->udset ^= 1; ma_info->updown = ma_info->udset; set_screenbox( ma_info->udset ); Objc_draw( tree, SCRNSECT, MAX_DEPTH, NULL); break; case ACCOFF: ma_info->linear = -1; break; case ACCSLOW: ma_info->linear = 1; break; case ACCFAST: ma_info->linear = 0; break; case SAVEUP: sl_arrow( SAVEBOX, SAVEUP, 1, SAVE_MIN, SAVE_MAX, &savetime ); break; case SAVEDOWN: sl_arrow( SAVEBOX, SAVEDOWN, -1, SAVE_MIN, SAVE_MAX, &savetime ); break; case SAVESLID: sl_drag( SAVEBOX, SAVE_MIN, SAVE_MAX, &savetime ); break; case SAVEBOX: Graf_mkstate( &mk ); objc_offset( tree, SAVESLID, &ox, &oy ); if( mk.x < ox ) oy = -SAVE_PAGE; else oy = SAVE_PAGE; sl_arrow( SAVEBOX, -1, oy, SAVE_MIN, SAVE_MAX, &savetime ); break; case PARK: if( IsSelected( PARK ) ) { /* deselecting */ saveptime = parktime; parktime = 0; } else { parktime = saveptime; sl_x( PARKBOX, parktime, PARK_MIN, PARK_MAX ); } set_parkbox(); Objc_draw( tree, PARKSECT, MAX_DEPTH, NULL ); break; case PARKUP: sl_arrow( PARKBOX, PARKUP, 1, PARK_MIN, PARK_MAX, &parktime ); break; case PARKDOWN: sl_arrow( PARKBOX, PARKDOWN, -1, PARK_MIN, PARK_MAX, &parktime ); break; case PARKSLID: sl_drag( PARKBOX, PARK_MIN, PARK_MAX, &parktime ); break; case PARKBOX: Graf_mkstate( &mk ); objc_offset( tree, PARKSLID, &ox, &oy ); if( mk.x < ox ) oy = -PARK_PAGE; else oy = PARK_PAGE; sl_arrow( PARKBOX, -1, oy, PARK_MIN, PARK_MAX, &parktime ); break; case SAVE: save_conf( savetime ); rs_object[SAVE].ob_state = NORMAL; Objc_draw( tree, ROOT, MAX_DEPTH, NULL ); break; case OK: quit = OK; break; case CANCEL: quit = CANCEL; break; } /* delay after touchexit objects */ wait_bup(); } while (!quit); form_dial( FMD_SHRINK, 0, 0, 0, 0, x, y, w, h ); form_dial( FMD_FINISH, 0, 0, 0, 0, x, y, w, h ); if( quit == CANCEL ) { ma_info->updown = ma_info->udset = saveudset; ma_info->linear = savelinear; } else { if( IsSelected(MODEM) ) ma_info->watch = 1; else ma_info->watch = 0; if( ma_info->stacy ) { if( IsSelected(SWITCH) ) { ma_info->stacmask |= SH_SCREEN; } else { ma_info->stacmask &= ~SH_SCREEN; } if( IsSelected(LITE) ) { ma_info->stacmask |= SH_LIGHT; } else { ma_info->stacmask &= ~SH_LIGHT; } } ma_info->timeout = savetime * 3600; ma_info->savepark = parktime; Supexec((long(*)())set_ptime); } return (quit == CANCEL); }
void autre_type(WINDFORM_VAR wind,int pop) { int x,y,w,h; int retour,a,n; int n_case,pos=0,select=-1; int k,ys,ys1,pos1=0,yob,dummy; char s[10]; C_OBJ **liste=NULL,*sel=NULL; n_case=AUT_END-AUT_START; n=liste_type(&liste); if(n>0) { for(a=0; a<n; a++) adr_autre_type[AUT_START+a].ob_state &=~SELECTED; /* d‚selectionne tous les items */ strcpy(((TEDINFO *)((adr_autre_type[AUT_NOM]).ob_spec))->te_ptext,""); /* efface le nom de l'object selectionn‚e */ if(n<n_case) /* Remplit les lignes */ { for(a=0; a<n; a++) strcpy(((TEDINFO *)((adr_autre_type[AUT_START+a]).ob_spec))->te_ptext,(*(liste+a))->spec.type.tt_nom); adr_autre_type[AUT_SLID].ob_height=adr_autre_type[AUT_LIFT].ob_height; } else { for(a=0; a<=n_case; a++) strcpy(((TEDINFO *)((adr_autre_type[AUT_START+a]).ob_spec))->te_ptext,(*(liste+a))->spec.type.tt_nom); adr_autre_type[AUT_SLID].ob_height=(int)((long)(n_case*adr_autre_type[AUT_LIFT].ob_height)/n); } adr_autre_type[AUT_SLID].ob_y=0; form_center (adr_autre_type, &x, &y, &w, &h); form_dial (FMD_START, 0, 0, 0, 0, x, y, w, h); objc_draw (adr_autre_type, 0, MAX_DEPTH, x, y, w, h); do { retour = form_do (adr_autre_type, 0); if (retour>=AUT_START && retour<=AUT_END) /* si on a cliquer sur une ligne */ { if(retour-AUT_START<n) { strcpy(((TEDINFO *)((adr_autre_type[AUT_NOM]).ob_spec))->te_ptext, ((TEDINFO *)((adr_autre_type[retour]).ob_spec))->te_ptext); sel=(*(liste+pos+(retour-AUT_START))); /* Object selectionn‚e */ objc_draw (adr_autre_type, AUT_NOM, 1, x, y, w, h); select=pos+retour-AUT_START; } } else if(retour==AUT_DOWN) /* Fleche ver le bas */ { pos++; if(pos>=n-n_case) pos--; else autre_type_affiche(liste,n,n_case,pos,x,y,w,h,select); } else if(retour==AUT_UP) /* FlŠche vers le haut */ { pos--; if(pos<0) pos++; else autre_type_affiche(liste,n,n_case,pos,x,y,w,h,select); } else if (retour==AUT_SLID) /* Sliders */ { graf_mkstate ( &dummy, &ys1,&k,&dummy ); yob=adr_autre_type[AUT_SLID].ob_y; do { graf_mkstate ( &dummy, &ys,&k,&dummy ); /* coord de la souris */ adr_autre_type[AUT_SLID].ob_y =yob+(ys-ys1); pos=adr_autre_type[AUT_SLID].ob_y*(n-n_case)/(adr_autre_type[AUT_LIFT].ob_height-adr_autre_type[AUT_SLID].ob_height); if (pos>=n-n_case) pos=n-n_case-1; if (pos<0) pos=0; if(pos!=pos1) { autre_type_affiche(liste,n,n_case,pos,x,y,w,h,select); pos1=pos; } }while(k==1); } else if (retour==AUT_LIFT) /* Ascenseur */ { objc_offset(adr_autre_type,AUT_LIFT,&dummy,&ys); graf_mkstate ( &dummy, &ys1,&dummy,&dummy ); if (ys1-ys>adr_autre_type[AUT_SLID].ob_y) { pos+=n_case; if(pos>=n-n_case) pos=n-n_case-1; autre_type_affiche(liste,n,n_case,pos,x,y,w,h,select); } else { pos-=n_case; if(pos<0) pos=0; autre_type_affiche(liste,n,n_case,pos,x,y,w,h,select); } } else if (retour & 0x8000) { retour &= ~0x8000; if (retour>=AUT_START && retour<=AUT_END) /* si on a cliquer sur une ligne */ { if(retour-AUT_START<n) { strcpy(((TEDINFO *)((adr_autre_type[AUT_NOM]).ob_spec))->te_ptext, ((TEDINFO *)((adr_autre_type[retour]).ob_spec))->te_ptext); sel=(*(liste+pos+(retour-AUT_START))); /* Object selectionn‚e */ objc_draw (adr_autre_type, AUT_NOM, 1, x, y, w, h); retour=-1; } } } }while (retour!=AUT_CON && retour!=-1); form_dial (FMD_FINISH, 0, 0, 0, 0, x, y, w, h); objc_change (adr_autre_type, retour, 0, x, y, w, h, 0, 0); FREE(liste); } strcpy(s," "); strncat(s,((TEDINFO *)((adr_autre_type[AUT_NOM]).ob_spec))->te_ptext,6); strcpy(((TEDINFO *)((wind.adr_form[pop]).ob_spec))->te_ptext ,s); ((TEDINFO *)((wind.adr_form[pop]).ob_spec))->te_ptmplt=sel; /* Sauve l'objet s‚lectionne directement dans la ressource ==> laisser au moins 4 caractŠres dans le masque du pop up */ /* printf(">>%s\n",((C_OBJ*)(((TEDINFO *)((wind.adr_form[pop]).ob_spec))->te_ptmplt))->spec.type.tt_nom );*/ }