Path: utzoo!attcan!uunet!dptechno!dave From: dave@dptechno.UUCP (Dave Lee) Newsgroups: comp.unix.i386 Subject: Re: curses and line graphics Message-ID: <544@dptechno.UUCP> Date: 25 Jul 90 16:44:26 GMT References: <426@sigma21.oz> Reply-To: dave@dptechno.UUCP (Dave Lee) Organization: D.P. Technology Corp. Camarillo California Lines: 84 In article <426@sigma21.oz> peter@sigma21.oz (Peter Farrell) writes: > >I wrote my own box routine. It uses the ACS_ defined characters. This >time the trivial test prog sends the 'enacs' string up front and >everything in the window is displayed using the graphics set. > >Frustration. Does anyone know how to draw boxes within curses windows? > The following will draw boxes within curses enviroment This works well for all versions of curses I have used. ------------------------ CUT HERE --------------------------------------- #include static int initbox = 0; static int UL,UR,LL,LR,HOR,VER; extern char *TermType ; /* From other file -- only for kludge */ static InitBox() { #ifdef ACS_ULCORNER UL = ACS_ULCORNER; UR = ACS_URCORNER; LL = ACS_LLCORNER; LR = ACS_LRCORNER; HOR = ACS_HLINE ; VER = ACS_VLINE ; #else /* KLUDGE FOR SYSTEMS WITHOUT ACS_xxxx */ /* MAY ADD OTHER KLUDGES FOR SPECIFIC TERMINALS HERE */ /* EXAMPLE : */ if(strcmp( TermType , "wy50" ) == 0 ){ UL = 'R' | A_ALTCHARSET ; LL = 'Q' | A_ALTCHARSET ; UR = 'S' | A_ALTCHARSET ; LR = 'U' | A_ALTCHARSET ; HOR = 'Z' | A_ALTCHARSET ; VER = 'V' | A_ALTCHARSET ; } else { UL = '+' ; UR = '+' ; LL = '+' ; LR = '+' ; HOR = '-' ; VER = '|' ; } #endif initbox = 1; } /*** Box window "w" starting with upper left at x,y for width,height size */ Box( w ,x,y,width,height) WINDOW *w; { int i; if( ! initbox ) InitBox(); wmove( w , y , x ); waddch( w , UL ); for( i = 0 ; i < width-2 ; i++ ) waddch( w , HOR ); waddch( w , UR ); for( i = 1 ; i < height ; i++ ){ mvwaddch( w ,i+y,x, VER ); mvwaddch( w , i + y , x + width - 1 , VER ); } wmove( w , y + height - 1 , x ); waddch( w , LL ); for( i = 0 ; i < width-2 ; i++ ) waddch( w , HOR ); waddch( w , LR ); } ----------------- CUT HERE ------------------------------ -- Dave Lee uunet!dptechno!dave