From: <hba...@us...> - 2010-09-04 12:56:30
|
Revision: 11159 http://plplot.svn.sourceforge.net/plplot/?rev=11159&view=rev Author: hbabcock Date: 2010-09-04 12:56:24 +0000 (Sat, 04 Sep 2010) Log Message: ----------- Add a stream_closed flag to plstrm. Once this is set the device driver dispatch functions become nops. It is initialized to FALSE when plinit is called. Modified Paths: -------------- trunk/include/plstrm.h trunk/src/plcore.c Modified: trunk/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2010-09-01 10:53:16 UTC (rev 11158) +++ trunk/include/plstrm.h 2010-09-04 12:56:24 UTC (rev 11159) @@ -87,6 +87,8 @@ * debug PLINT Generate debugging output * initialized PLINT Set if the stream has been initialized * dev_initialized PLINT Set if the device driver has been loaded + * stream_closed PLBOOL Set if the stream was closed or if there + * was some sort of error * *************************************************************************** * @@ -517,6 +519,7 @@ /* Misc control information */ PLINT ipls, level, verbose, debug, initialized, dev_initialized; + PLBOOL stream_closed; const char *program; /* Plot-wide coordinate transform */ Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-09-01 10:53:16 UTC (rev 11158) +++ trunk/src/plcore.c 2010-09-04 12:56:24 UTC (rev 11159) @@ -134,6 +134,7 @@ { char * save_locale; plsc->page_status = AT_EOP; + plsc->stream_closed = FALSE; save_locale = plsave_set_locale(); ( *plsc->dispatch_table->pl_init )( (struct PLStream_struct *) plsc ); @@ -168,7 +169,9 @@ if ( !skip_driver_eop ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_eop )( (struct PLStream_struct *) plsc ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_eop )( (struct PLStream_struct *) plsc ); + } plrestore_locale( save_locale ); } } @@ -198,7 +201,9 @@ if ( !skip_driver_bop ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_bop )( (struct PLStream_struct *) plsc ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_bop )( (struct PLStream_struct *) plsc ); + } plrestore_locale( save_locale ); } @@ -220,7 +225,9 @@ } save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_tidy )( (struct PLStream_struct *) plsc ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_tidy )( (struct PLStream_struct *) plsc ); + } plrestore_locale( save_locale ); if ( plsc->plbuf_write ) @@ -240,7 +247,9 @@ if ( plsc->plbuf_write ) plbuf_state( plsc, op ); save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_state )( (struct PLStream_struct *) plsc, op ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_state )( (struct PLStream_struct *) plsc, op ); + } plrestore_locale( save_locale ); } @@ -269,7 +278,9 @@ } save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, op, ptr ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, op, ptr ); + } plrestore_locale( save_locale ); } @@ -321,8 +332,10 @@ if ( plsc->dev_swin ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_SWIN, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_SWIN, NULL ); + } plrestore_locale( save_locale ); } } @@ -1213,8 +1226,10 @@ grline( short *x, short *y, PLINT npts ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_line )( (struct PLStream_struct *) plsc, - x[0], y[0], x[1], y[1] ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_line )( (struct PLStream_struct *) plsc, + x[0], y[0], x[1], y[1] ); + } plrestore_locale( save_locale ); } @@ -1222,8 +1237,10 @@ grpolyline( short *x, short *y, PLINT npts ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_polyline )( (struct PLStream_struct *) plsc, - x, y, npts ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_polyline )( (struct PLStream_struct *) plsc, + x, y, npts ); + } plrestore_locale( save_locale ); } @@ -1236,8 +1253,10 @@ plsc->dev_y = y; save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_FILL, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_FILL, NULL ); + } plrestore_locale( save_locale ); } @@ -1250,8 +1269,10 @@ plsc->dev_y = y; save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_GRADIENT, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_GRADIENT, NULL ); + } plrestore_locale( save_locale ); } @@ -1647,8 +1668,10 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_DI, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_DI, NULL ); + } plrestore_locale( save_locale ); } @@ -1733,8 +1756,10 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_DI, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_DI, NULL ); + } plrestore_locale( save_locale ); } @@ -1856,8 +1881,10 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_DI, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_DI, NULL ); + } plrestore_locale( save_locale ); } @@ -2040,8 +2067,10 @@ if ( plsc->dev_flush ) { char *save_locale = plsave_set_locale(); - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, - PLESC_FLUSH, NULL ); + if ( !plsc->stream_closed ){ + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + PLESC_FLUSH, NULL ); + } plrestore_locale( save_locale ); } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2010-09-10 22:41:40
|
Revision: 11165 http://plplot.svn.sourceforge.net/plplot/?rev=11165&view=rev Author: hezekiahcarty Date: 2010-09-10 22:41:34 +0000 (Fri, 10 Sep 2010) Log Message: ----------- Initial C implementation of pllegend This function allows one to draw basic line and point/symbol legends. It is based on the OCaml draw_legend function and somewhat generalized from that original version. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/CMakeLists.txt Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-10 22:31:48 UTC (rev 11164) +++ trunk/examples/c/x04c.c 2010-09-10 22:41:34 UTC (rev 11165) @@ -46,6 +46,10 @@ int i; static PLFLT freql[101], ampl[101], phase[101]; PLFLT f0, freq; + char *names[2]; + int colors[2]; + int label_colors[2]; + int symbols[2]; pladv( 0 ); @@ -100,7 +104,24 @@ plbox( "", 0.0, 0, "cmstv", 30.0, 3 ); plcol0( 3 ); plline( 101, freql, phase ); + plpoin( 101, freql, phase, 3 ); plcol0( 3 ); plmtex( "r", 5.0, 0.5, 0.5, "Phase shift (degrees)" ); + + // Draw a legend + names[0] = "Amplitude"; + names[1] = "Phase shift"; + colors[0] = 2; + colors[1] = 3; + label_colors[0] = 1; + label_colors[1] = 1; + pllegend( 1.0, 0.6, 0.95, 2, label_colors, names, colors, NULL ); + + // Draw the points legend + names[0] = ""; + names[1] = ""; + symbols[0] = -1; + symbols[1] = 3; + pllegend( 1.0, 0.6, 0.95, 2, label_colors, names, colors, symbols ); } } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-10 22:31:48 UTC (rev 11164) +++ trunk/include/plplot.h 2010-09-10 22:41:34 UTC (rev 11165) @@ -686,6 +686,7 @@ #define plinit c_plinit #define pljoin c_pljoin #define pllab c_pllab +#define pllegend c_pllegend #define pllightsource c_pllightsource #define plline c_plline #define plpath c_plpath @@ -1204,6 +1205,10 @@ PLDLLIMPEXP void c_pllab( const char *xlabel, const char *ylabel, const char *tlabel ); +/* Routine for drawing simple line or symbol legends */ +PLDLLIMPEXP void +c_pllegend( PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT *symbols ); + /* Sets position of the light source */ PLDLLIMPEXP void c_pllightsource( PLFLT x, PLFLT y, PLFLT z ); Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2010-09-10 22:31:48 UTC (rev 11164) +++ trunk/src/CMakeLists.txt 2010-09-10 22:41:34 UTC (rev 11165) @@ -55,6 +55,7 @@ plvect.c mt19937ar.c pltime.c + pllegend.c ) if(LTDL_WIN32) set(plplot${LIB_TAG}_LIB_SRCS ${plplot${LIB_TAG}_LIB_SRCS} ltdl_win32.c) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-11 16:32:34
|
Revision: 11167 http://plplot.svn.sourceforge.net/plplot/?rev=11167&view=rev Author: airwin Date: 2010-09-11 16:32:28 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Change experimental pllegend API to add an nsymbols parameter which controls the number of symbols plotted for a particular legend line. Change the 4th standard example to use this additional capability. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-11 04:44:06 UTC (rev 11166) +++ trunk/examples/c/x04c.c 2010-09-11 16:32:28 UTC (rev 11167) @@ -115,13 +115,13 @@ colors[1] = 3; label_colors[0] = 1; label_colors[1] = 1; - pllegend( 1.0, 0.6, 0.95, 2, label_colors, names, colors, NULL ); + pllegend( 1.0, 0.6, 0.95, 2, label_colors, names, colors, 0, NULL ); // Draw the points legend names[0] = ""; names[1] = ""; symbols[0] = -1; symbols[1] = 3; - pllegend( 1.0, 0.6, 0.95, 2, label_colors, names, colors, symbols ); + pllegend( 1.0, 0.6, 0.95, 2, label_colors, names, colors, 5, symbols ); } } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-11 04:44:06 UTC (rev 11166) +++ trunk/include/plplot.h 2010-09-11 16:32:28 UTC (rev 11167) @@ -1207,7 +1207,7 @@ /* Routine for drawing simple line or symbol legends */ PLDLLIMPEXP void -c_pllegend( PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT *symbols ); +c_pllegend( PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT nsymbols, PLINT *symbols ); /* Sets position of the light source */ PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-11 04:44:06 UTC (rev 11166) +++ trunk/src/pllegend.c 2010-09-11 16:32:28 UTC (rev 11167) @@ -63,15 +63,17 @@ #define normalized_to_world_x(nx) ((xmin) + (nx) * ((xmax) - (xmin))) #define normalized_to_world_y(ny) ((ymin) + (ny) * ((ymax) - (ymin))) -// pllegend - Draw a legend using lines or points -// line_length: How long should the lines be/how far apart are the points +// pllegend - Draw a legend using lines (nsymbols <=1 or symbols == NULL) or +// points/symbols. +// line_length: extent of lines or extent of nsymbols points/symbols // x, y: Normalized position of the legend in the plot window // n: Number of legend entries // text_colors: Color map 0 indices of the colors to use for label text // names: Name/label for each legend entry // colors: Line/point color for each legend entry -// symbols: Symbol to draw for each legend entry (NULL for lines) -void c_pllegend(PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT *symbols) { +// nsymbols: number of points/symbols to be drawn for each line_length +// symbols: Symbol to draw for each legend entry. +void c_pllegend(PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT nsymbols, PLINT *symbols) { // Active indexed drawing color PLINT old_col0; // Viewport world-coordinate limits @@ -85,8 +87,13 @@ // y-position of the current legend entry PLFLT ty; // Positions of the legend entries - PLFLT xs[2], ys[2]; - PLINT i; + PLFLT dxs, *xs, *ys; + PLINT i, j; + // ifline is true if lines are to be drawn, false if points/symbols are + // to be drawn. + int ifline = nsymbols <= 1 || symbols == NULL; + if(symbols == NULL) nsymbols = 2; + nsymbols = MAX(2, nsymbols); old_col0 = plsc->icol0; @@ -110,22 +117,29 @@ // Starting y position for legend entries ty = text_y_world - character_height; - xs[0] = line_x_world; - xs[1] = line_x_end_world; - ys[0] = ty; - ys[1] = ty; + if ( ( ( xs = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) || + ( ( ys = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) + { + plexit( "pllegend: Insufficient memory" ); + } + dxs = (line_x_end_world - line_x_world)/(double) (nsymbols-1); + for (j=0; j<nsymbols; j++) { + xs[j] = line_x_world + dxs*(double) j; + ys[j] = ty; + } + // Draw each legend entry for (i = 0; i < n; i++) { // Line for the legend plcol0(colors[i]); - if (symbols == NULL) { + if (ifline) { // Draw lines - plline(2, xs, ys); + plline(nsymbols, xs, ys); } else { // Draw symbols - plpoin(2, xs, ys, symbols[i]); + plpoin(nsymbols, xs, ys, symbols[i]); } // Label/name for the legend @@ -133,9 +147,12 @@ plptex(text_x_world, ty, 0.0, 0.0, 0.0, names[i]); // Move to the next position ty = ty - (1.5 * character_height); - ys[0] = ty; - ys[1] = ty; + for (j=0; j<nsymbols; j++) { + ys[j] = ty; + } } + free( xs ); + free( ys ); // Restore the previously active drawing color plcol0(old_col0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-12 17:38:44
|
Revision: 11172 http://plplot.svn.sourceforge.net/plplot/?rev=11172&view=rev Author: airwin Date: 2010-09-12 17:38:38 +0000 (Sun, 12 Sep 2010) Log Message: ----------- Restyle source code according to our (uncrustify 0.55) standards. Modified Paths: -------------- trunk/bindings/f77/plstubs.h trunk/bindings/tcl/tclAPI.c trunk/drivers/cairo.c trunk/drivers/wingcc.c trunk/drivers/xwin.c trunk/examples/c/x04c.c trunk/src/plcore.c trunk/src/plctrl.c trunk/src/pllegend.c Modified: trunk/bindings/f77/plstubs.h =================================================================== --- trunk/bindings/f77/plstubs.h 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/bindings/f77/plstubs.h 2010-09-12 17:38:38 UTC (rev 11172) @@ -92,12 +92,12 @@ #endif #endif -#if defined( WIN32 ) /* Windows 32-bit */ -#if defined( IVF ) /* Intel Visual Fortran */ +#if defined ( WIN32 ) /* Windows 32-bit */ +#if defined ( IVF ) /* Intel Visual Fortran */ #define STUB_LINKAGE STUB_IVF -#elif defined ( CVF ) /* MSVC/CVF */ +#elif defined ( CVF ) /* MSVC/CVF */ #define STUB_LINKAGE STUB_U -#elif defined ( MSDOS ) /* MS-DOS based */ +#elif defined ( MSDOS ) /* MS-DOS based */ #define STUB_LINKAGE STUB_FORTRAN #elif defined ( _MSC_VER ) #define STUB_LINKAGE STUB_STDCALL Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/bindings/tcl/tclAPI.c 2010-09-12 17:38:38 UTC (rev 11172) @@ -3345,8 +3345,8 @@ Tcl_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) { Tcl_Obj *objx, *objy; - int code; - double dx, dy; + int code; + double dx, dy; // Set Tcl x to x objx = Tcl_NewDoubleObj( x ); @@ -3419,13 +3419,13 @@ } else { - int len; + int len; const char *data = argc > 2 ? argv[2] : 0; tcl_xform_interp = interp; tcl_xform_procname = strdup( argv[1] ); - len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); + len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); tcl_xform_code = malloc( len ); sprintf( tcl_xform_code, tcl_xform_template, tcl_xform_procname ); Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/drivers/cairo.c 2010-09-12 17:38:38 UTC (rev 11172) @@ -418,7 +418,7 @@ void plD_line_cairo( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { - PLCairo *aStream; + PLCairo *aStream; aStream = (PLCairo *) pls->dev; @@ -447,7 +447,7 @@ void plD_polyline_cairo( PLStream *pls, short *xa, short *ya, PLINT npts ) { - PLCairo *aStream; + PLCairo *aStream; aStream = (PLCairo *) pls->dev; @@ -1274,7 +1274,7 @@ void filled_polygon( PLStream *pls, short *xa, short *ya, PLINT npts ) { int i; - PLCairo *aStream; + PLCairo *aStream; aStream = (PLCairo *) pls->dev; @@ -1772,7 +1772,7 @@ break; case ClientMessage: // plexit("X Window closed"); - pls->stream_closed = TRUE; + pls->stream_closed = TRUE; aStream->exit_event_loop = 1; break; case Expose: Modified: trunk/drivers/wingcc.c =================================================================== --- trunk/drivers/wingcc.c 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/drivers/wingcc.c 2010-09-12 17:38:38 UTC (rev 11172) @@ -28,8 +28,8 @@ #include <string.h> #include <windows.h> #ifdef _WIN64 -#define GWL_USERDATA GWLP_USERDATA -#define GCL_HCURSOR GCLP_HCURSOR +#define GWL_USERDATA GWLP_USERDATA +#define GCL_HCURSOR GCLP_HCURSOR #endif #include "plplotP.h" @@ -257,7 +257,7 @@ else { pls = (PLStream *) GetWindowLongPtr( hwnd, GWL_USERDATA ); /* Try to get the address to pls for this window */ - if ( pls ) /* If we got it, then we will initialise this windows plplot private data area */ + if ( pls ) /* If we got it, then we will initialise this windows plplot private data area */ { dev = (wingcc_Dev *) pls->dev; } Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/drivers/xwin.c 2010-09-12 17:38:38 UTC (rev 11172) @@ -1484,11 +1484,10 @@ if ( event->xclient.data.l[0] == XInternAtom( xwd->display, "WM_DELETE_WINDOW", False ) ) { - pls->nopause = TRUE; - pls->stream_closed = TRUE; - dev->exit_eventloop = TRUE; + pls->nopause = TRUE; + pls->stream_closed = TRUE; + dev->exit_eventloop = TRUE; // plexit( "" ); - } } Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/examples/c/x04c.c 2010-09-12 17:38:38 UTC (rev 11172) @@ -46,10 +46,10 @@ int i; static PLFLT freql[101], ampl[101], phase[101]; PLFLT f0, freq; - char *names[2]; - int colors[2]; - int label_colors[2]; - int symbols[2]; + char *names[2]; + int colors[2]; + int label_colors[2]; + int symbols[2]; pladv( 0 ); @@ -109,18 +109,18 @@ plmtex( "r", 5.0, 0.5, 0.5, "Phase shift (degrees)" ); // Draw a legend - names[0] = "Amplitude"; - names[1] = "Phase shift"; - colors[0] = 2; - colors[1] = 3; + names[0] = "Amplitude"; + names[1] = "Phase shift"; + colors[0] = 2; + colors[1] = 3; label_colors[0] = 1; label_colors[1] = 1; pllegend( 0.3, 0.1, 0.95, 2, label_colors, names, colors, 0, NULL ); // Draw the points legend - plssym(0., 3.); - names[0] = ""; - names[1] = ""; + plssym( 0., 3. ); + names[0] = ""; + names[1] = ""; symbols[0] = -1; symbols[1] = 3; pllegend( 0.3, 0.1, 0.95, 2, label_colors, names, colors, 5, symbols ); Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/src/plcore.c 2010-09-12 17:38:38 UTC (rev 11172) @@ -133,7 +133,7 @@ plP_init( void ) { char * save_locale; - plsc->page_status = AT_EOP; + plsc->page_status = AT_EOP; plsc->stream_closed = FALSE; save_locale = plsave_set_locale(); @@ -169,9 +169,10 @@ if ( !skip_driver_eop ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ - ( *plsc->dispatch_table->pl_eop )( (struct PLStream_struct *) plsc ); - } + if ( !plsc->stream_closed ) + { + ( *plsc->dispatch_table->pl_eop )( (struct PLStream_struct *) plsc ); + } plrestore_locale( save_locale ); } } @@ -201,9 +202,10 @@ if ( !skip_driver_bop ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ - ( *plsc->dispatch_table->pl_bop )( (struct PLStream_struct *) plsc ); - } + if ( !plsc->stream_closed ) + { + ( *plsc->dispatch_table->pl_bop )( (struct PLStream_struct *) plsc ); + } plrestore_locale( save_locale ); } @@ -225,7 +227,8 @@ } save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_tidy )( (struct PLStream_struct *) plsc ); } plrestore_locale( save_locale ); @@ -247,7 +250,8 @@ if ( plsc->plbuf_write ) plbuf_state( plsc, op ); save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_state )( (struct PLStream_struct *) plsc, op ); } plrestore_locale( save_locale ); @@ -278,7 +282,8 @@ } save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, op, ptr ); } plrestore_locale( save_locale ); @@ -332,7 +337,8 @@ if ( plsc->dev_swin ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, PLESC_SWIN, NULL ); } @@ -1226,7 +1232,8 @@ grline( short *x, short *y, PLINT npts ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_line )( (struct PLStream_struct *) plsc, x[0], y[0], x[1], y[1] ); } @@ -1237,7 +1244,8 @@ grpolyline( short *x, short *y, PLINT npts ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_polyline )( (struct PLStream_struct *) plsc, x, y, npts ); } @@ -1253,7 +1261,8 @@ plsc->dev_y = y; save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, PLESC_FILL, NULL ); } @@ -1269,7 +1278,8 @@ plsc->dev_y = y; save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, PLESC_GRADIENT, NULL ); } @@ -1668,10 +1678,11 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, PLESC_DI, NULL ); - } + } plrestore_locale( save_locale ); } @@ -1756,10 +1767,11 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ - ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, + if ( !plsc->stream_closed ) + { + ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, PLESC_DI, NULL ); - } + } plrestore_locale( save_locale ); } @@ -1881,10 +1893,11 @@ if ( plsc->dev_di ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, PLESC_DI, NULL ); - } + } plrestore_locale( save_locale ); } @@ -2067,10 +2080,11 @@ if ( plsc->dev_flush ) { char *save_locale = plsave_set_locale(); - if ( !plsc->stream_closed ){ + if ( !plsc->stream_closed ) + { ( *plsc->dispatch_table->pl_esc )( (struct PLStream_struct *) plsc, PLESC_FLUSH, NULL ); - } + } plrestore_locale( save_locale ); } else Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/src/plctrl.c 2010-09-12 17:38:38 UTC (rev 11172) @@ -1292,7 +1292,8 @@ for ( i = 0; i < *number_colors; i++ ) { - if (fgets( color_info, 30, fp ) == NULL) { + if ( fgets( color_info, 30, fp ) == NULL ) + { err = 1; break; } @@ -1472,8 +1473,9 @@ } } /* Check for new file format */ - if (fgets( color_info, 160, fp ) == NULL) { - snprintf( msgbuf, 1024, "Error reading cmap1 .pal file %s\n",filename); + if ( fgets( color_info, 160, fp ) == NULL ) + { + snprintf( msgbuf, 1024, "Error reading cmap1 .pal file %s\n", filename ); plwarn( msgbuf ); fclose( fp ); goto finish; @@ -1491,8 +1493,9 @@ plwarn( msgbuf ); rgb = TRUE; } - if (fgets( color_info, 160, fp ) == NULL) { - snprintf( msgbuf, 1024, "Error reading cmap1 .pal file %s\n",filename); + if ( fgets( color_info, 160, fp ) == NULL ) + { + snprintf( msgbuf, 1024, "Error reading cmap1 .pal file %s\n", filename ); plwarn( msgbuf ); fclose( fp ); goto finish; @@ -1523,8 +1526,9 @@ /* Old tk file format */ for ( i = 0; i < number_colors; i++ ) { - if (fgets( color_info, 160, fp ) == NULL) { - snprintf( msgbuf, 1024, "Error reading cmap1 .pal file %s\n",filename); + if ( fgets( color_info, 160, fp ) == NULL ) + { + snprintf( msgbuf, 1024, "Error reading cmap1 .pal file %s\n", filename ); plwarn( msgbuf ); fclose( fp ); goto finish; @@ -1569,8 +1573,9 @@ /* New floating point file version with support for alpha and rev values */ for ( i = 0; i < number_colors; i++ ) { - if (fgets( color_info, 160, fp ) == NULL) { - snprintf( msgbuf, 1024, "Error reading cmap1 .pal file %s\n",filename); + if ( fgets( color_info, 160, fp ) == NULL ) + { + snprintf( msgbuf, 1024, "Error reading cmap1 .pal file %s\n", filename ); plwarn( msgbuf ); fclose( fp ); goto finish; Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-12 00:17:06 UTC (rev 11171) +++ trunk/src/pllegend.c 2010-09-12 17:38:38 UTC (rev 11172) @@ -23,7 +23,8 @@ #include "plplotP.h" -PLFLT get_character_or_symbol_height(PLINT ifcharacter) { +PLFLT get_character_or_symbol_height( PLINT ifcharacter ) +{ // Character height in mm PLFLT default_mm, char_height_mm; // Normalized viewport limits @@ -40,16 +41,19 @@ PLFLT wxmin, wxmax, wymin, wymax; PLFLT world_y; - if(ifcharacter) { - plgchr(&default_mm, &char_height_mm); - } else { - default_mm = plsc->symdef; - char_height_mm = plsc->symht; + if ( ifcharacter ) + { + plgchr( &default_mm, &char_height_mm ); } - plgvpd(&vxmin, &vxmax, &vymin, &vymax); + else + { + default_mm = plsc->symdef; + char_height_mm = plsc->symht; + } + plgvpd( &vxmin, &vxmax, &vymin, &vymax ); vy = vymax - vymin; - plgspa(&mxmin, &mxmax, &mymin, &mymax); + plgspa( &mxmin, &mxmax, &mymin, &mymax ); mm_y = mymax - mymin; world_height_mm = mm_y * vy; @@ -59,16 +63,16 @@ // Normalized character height * World height (world) = // Character height (world) - plgvpw(&wxmin, &wxmax, &wymin, &wymax); + plgvpw( &wxmin, &wxmax, &wymin, &wymax ); world_y = wymax - wymin; - return(char_height_norm * world_y); + return ( char_height_norm * world_y ); } -#define normalized_to_world_x(nx) ((xmin) + (nx) * ((xmax) - (xmin))) -#define normalized_to_world_y(ny) ((ymin) + (ny) * ((ymax) - (ymin))) +#define normalized_to_world_x( nx ) ( ( xmin ) + ( nx ) * ( ( xmax ) - ( xmin ) ) ) +#define normalized_to_world_y( ny ) ( ( ymin ) + ( ny ) * ( ( ymax ) - ( ymin ) ) ) -// pllegend - Draw a legend using lines (nsymbols <=1 or symbols == NULL) or +// pllegend - Draw a legend using lines (nsymbols <=1 or symbols == NULL) or // points/symbols. // line_length: extent of lines or extent of nsymbols points/symbols // x, y: Normalized position of the legend in the plot window @@ -78,7 +82,8 @@ // colors: Line/point color for each legend entry // nsymbols: number of points/symbols to be drawn for each line_length // symbols: Symbol to draw for each legend entry. -void c_pllegend(PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT nsymbols, PLINT *symbols) { +void c_pllegend( PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT nsymbols, PLINT *symbols ) +{ // Active indexed drawing color PLINT old_col0; // Viewport world-coordinate limits @@ -97,83 +102,91 @@ // ifline is true if lines are to be drawn, false if points/symbols are // to be drawn. int ifline = nsymbols <= 1 || symbols == NULL; - if(symbols == NULL) nsymbols = 2; - nsymbols = MAX(2, nsymbols); + if ( symbols == NULL ) nsymbols = 2; + nsymbols = MAX( 2, nsymbols ); old_col0 = plsc->icol0; - plgvpw(&xmin, &xmax, &ymin, &ymax); + plgvpw( &xmin, &xmax, &ymin, &ymax ); // World coordinates for legend lines - line_x = x; - line_y = y; - line_x_end = line_x + line_length; - line_x_world = normalized_to_world_x(line_x); - line_y_world = normalized_to_world_y(line_y); - line_x_end_world = normalized_to_world_x(line_x_end); + line_x = x; + line_y = y; + line_x_end = line_x + line_length; + line_x_world = normalized_to_world_x( line_x ); + line_y_world = normalized_to_world_y( line_y ); + line_x_end_world = normalized_to_world_x( line_x_end ); // Get character height and width in world coordinates - character_height = get_character_or_symbol_height(1); - character_width = character_height*fabs((xmax-xmin)/(ymax-ymin)); + character_height = get_character_or_symbol_height( 1 ); + character_width = character_height * fabs( ( xmax - xmin ) / ( ymax - ymin ) ); // Get symbol width in world coordinates if symbols are plotted to // adjust ends of line of symbols. - if( ifline) { - symbol_width = 0.; - } else { - // AWI, no idea why must use 0.5 factor to get ends of symbol lines - // to line up approximately correctly with plotted legend lines. - // Factor should be unity. - symbol_width = 0.5*get_character_or_symbol_height(0)* - fabs((xmax-xmin)/(ymax-ymin)); + if ( ifline ) + { + symbol_width = 0.; } + else + { + // AWI, no idea why must use 0.5 factor to get ends of symbol lines + // to line up approximately correctly with plotted legend lines. + // Factor should be unity. + symbol_width = 0.5 * get_character_or_symbol_height( 0 ) * + fabs( ( xmax - xmin ) / ( ymax - ymin ) ); + } // Get world-coordinate positions of the start of the legend text - text_x = line_x_end; - text_y = line_y; - text_x_world = normalized_to_world_x(text_x) + character_width; - text_y_world = normalized_to_world_y(text_y); + text_x = line_x_end; + text_y = line_y; + text_x_world = normalized_to_world_x( text_x ) + character_width; + text_y_world = normalized_to_world_y( text_y ); // Starting y position for legend entries ty = text_y_world - character_height; if ( ( ( xs = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) || - ( ( ys = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) - { - plexit( "pllegend: Insufficient memory" ); - } + ( ( ys = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) + { + plexit( "pllegend: Insufficient memory" ); + } - dxs = (line_x_end_world - line_x_world - symbol_width)/(double) (nsymbols-1); - for (j=0; j<nsymbols; j++) { - xs[j] = line_x_world + 0.5*symbol_width + dxs*(double) j; - ys[j] = ty; + dxs = ( line_x_end_world - line_x_world - symbol_width ) / (double) ( nsymbols - 1 ); + for ( j = 0; j < nsymbols; j++ ) + { + xs[j] = line_x_world + 0.5 * symbol_width + dxs * (double) j; + ys[j] = ty; } // Draw each legend entry - for (i = 0; i < n; i++) { + for ( i = 0; i < n; i++ ) + { // Line for the legend - plcol0(colors[i]); - if (ifline) { + plcol0( colors[i] ); + if ( ifline ) + { // Draw lines - plline(nsymbols, xs, ys); + plline( nsymbols, xs, ys ); } - else { + else + { // Draw symbols - plpoin(nsymbols, xs, ys, symbols[i]); + plpoin( nsymbols, xs, ys, symbols[i] ); } // Label/name for the legend - plcol0(text_colors[i]); - plptex(text_x_world, ty, 0.0, 0.0, 0.0, names[i]); + plcol0( text_colors[i] ); + plptex( text_x_world, ty, 0.0, 0.0, 0.0, names[i] ); // Move to the next position - ty = ty - (1.5 * character_height); - for (j=0; j<nsymbols; j++) { - ys[j] = ty; - } + ty = ty - ( 1.5 * character_height ); + for ( j = 0; j < nsymbols; j++ ) + { + ys[j] = ty; + } } free( xs ); free( ys ); // Restore the previously active drawing color - plcol0(old_col0); + plcol0( old_col0 ); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-13 02:01:35
|
Revision: 11176 http://plplot.svn.sourceforge.net/plplot/?rev=11176&view=rev Author: airwin Date: 2010-09-13 02:01:25 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Style changes (mostly splitting one-line ifs, but one-line whiles, else ifs, and fors are also split up and trailing comments are sometimes also split into separate lines) caused by moving from uncrustify 0.55 to uncrustify 0.56. All these style changes have been tested by an installed examples test (both noninteractive and interactive) for shared libraries. Modified Paths: -------------- trunk/bindings/gnome2/lib/gcw-lib.c trunk/bindings/gnome2/lib/plplotcanvas.c trunk/bindings/octave/massage.c trunk/bindings/qt_gui/plqt.cpp trunk/bindings/tcl/tclAPI.c trunk/bindings/tk/plframe.c trunk/drivers/aqt.c trunk/drivers/cairo.c trunk/drivers/cgm.c trunk/drivers/dg300.c trunk/drivers/gcw.c trunk/drivers/gd.c trunk/drivers/ljiip.c trunk/drivers/pbm.c trunk/drivers/plplotcanvas-hacktext.c trunk/drivers/ps.c trunk/drivers/pstex.c trunk/drivers/qt.cpp trunk/drivers/tk.c trunk/drivers/tkwin.c trunk/drivers/wingcc.c trunk/drivers/wxwidgets.cpp trunk/drivers/wxwidgets_dc.cpp trunk/drivers/wxwidgets_gc.cpp trunk/drivers/xwin.c trunk/examples/c/plplotcanvas_animation.c trunk/examples/c/x01c.c trunk/examples/c/x07c.c trunk/examples/c/x17c.c trunk/examples/c/x20c.c trunk/examples/c/x27c.c trunk/examples/c++/x01.cc trunk/examples/c++/x07.cc trunk/examples/c++/x17.cc trunk/examples/c++/x20.cc trunk/examples/c++/x27.cc trunk/examples/d/x07d.d trunk/examples/d/x16d.d trunk/examples/d/x20d.d trunk/examples/d/x27d.d trunk/examples/d/x28d.d trunk/fonts/font01.c trunk/fonts/plhershey-unicode-gen.c trunk/include/gcw.h trunk/lib/nistcd/cd.c trunk/lib/nistcd/cdmulti.c trunk/lib/nistcd/cdsimple.c trunk/lib/nistcd/cdtest.c trunk/lib/nistcd/cdtext.c trunk/lib/nistcd/color16.c trunk/lib/nn/delaunay.h trunk/lib/nn/nnpi.c trunk/lib/qsastime/qsastime.c trunk/lib/qsastime/qsastime_extra.c trunk/lib/qsastime/tai-utc-gen.c trunk/src/mt19937ar.c trunk/src/pdfutils.c trunk/src/plargs.c trunk/src/plbuf.c trunk/src/plcont.c trunk/src/plcore.c trunk/src/plctrl.c trunk/src/plcvt.c trunk/src/pldeprecated.c trunk/src/plf2ops.c trunk/src/plfill.c trunk/src/plfreetype.c trunk/src/plgradient.c trunk/src/plgridd.c trunk/src/pllegend.c trunk/src/plline.c trunk/src/plmap.c trunk/src/plot3d.c trunk/src/plshade.c trunk/src/plstdio.c trunk/src/plsym.c trunk/src/plvect.c trunk/utils/plrender.c Modified: trunk/bindings/gnome2/lib/gcw-lib.c =================================================================== --- trunk/bindings/gnome2/lib/gcw-lib.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/bindings/gnome2/lib/gcw-lib.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -130,7 +130,8 @@ gcw_debug( "<gcw_init_canvas>\n" ); #endif - if ( !GNOME_IS_CANVAS( canvas ) ) plexit( "GCW driver: Canvas not found" ); + if ( !GNOME_IS_CANVAS( canvas ) ) + plexit( "GCW driver: Canvas not found" ); /* Add the canvas to the device */ dev->canvas = canvas; @@ -219,7 +220,7 @@ gcw_set_canvas_zoom( canvas, ZOOMSTEP ); else if ( flag == 0 ) /* Zoom out */ - { /* Don't zoom smaller than the original size: this causes GDK pixmap + { /* Don't zoom smaller than the original size: this causes GDK pixmap * errors. */ gnome_canvas_c2w( canvas, 1, 0, &curmag, &dum ); @@ -338,7 +339,8 @@ result = gtk_dialog_run( dialog ); gtk_widget_destroy( GTK_WIDGET( dialog ) ); - if ( result == GTK_RESPONSE_REJECT ) return; + if ( result == GTK_RESPONSE_REJECT ) + return; } /* Hide the file selection widget */ @@ -361,15 +363,24 @@ * */ n = strlen( fname ); - if ( strcasecmp( &fname[n - 3], "png" ) == 0 ) sprintf( devname, "png" ); - else if ( strcasecmp( &fname[n - 3], "gif" ) == 0 ) sprintf( devname, "gif" ); - else if ( strcasecmp( &fname[n - 3], "jpg" ) == 0 ) sprintf( devname, "jpg" ); - else if ( strcasecmp( &fname[n - 4], "jpeg" ) == 0 ) sprintf( devname, "jpeg" ); - else if ( strcasecmp( &fname[n - 2], "ps" ) == 0 ) sprintf( devname, "ps" ); - else if ( strcasecmp( &fname[n - 3], "psc" ) == 0 ) sprintf( devname, "psc" ); - else if ( strcasecmp( &fname[n - 4], "xwin" ) == 0 ) sprintf( devname, "xwin" ); - else if ( strcasecmp( &fname[n - 3], "gcw" ) == 0 ) sprintf( devname, "gcw" ); - else if ( strcasecmp( &fname[n - 2], "tk" ) == 0 ) sprintf( devname, "tk" ); + if ( strcasecmp( &fname[n - 3], "png" ) == 0 ) + sprintf( devname, "png" ); + else if ( strcasecmp( &fname[n - 3], "gif" ) == 0 ) + sprintf( devname, "gif" ); + else if ( strcasecmp( &fname[n - 3], "jpg" ) == 0 ) + sprintf( devname, "jpg" ); + else if ( strcasecmp( &fname[n - 4], "jpeg" ) == 0 ) + sprintf( devname, "jpeg" ); + else if ( strcasecmp( &fname[n - 2], "ps" ) == 0 ) + sprintf( devname, "ps" ); + else if ( strcasecmp( &fname[n - 3], "psc" ) == 0 ) + sprintf( devname, "psc" ); + else if ( strcasecmp( &fname[n - 4], "xwin" ) == 0 ) + sprintf( devname, "xwin" ); + else if ( strcasecmp( &fname[n - 3], "gcw" ) == 0 ) + sprintf( devname, "gcw" ); + else if ( strcasecmp( &fname[n - 2], "tk" ) == 0 ) + sprintf( devname, "tk" ); else { if ( dev->statusbar != NULL ) @@ -383,7 +394,8 @@ ); return; } - else plabort( "GCW driver <file_ok_sel>: File type not recognized" ); + else + plabort( "GCW driver <file_ok_sel>: File type not recognized" ); } /* Check that we are set up appropriately for device */ @@ -510,10 +522,14 @@ void key_release( GtkWidget *widget, GdkEventKey *event, gpointer data ) { - if ( event->keyval == '+' ) zoom( data, 2 ); - if ( event->keyval == '=' ) zoom( data, 1 ); - if ( event->keyval == '-' ) zoom( data, 0 ); - if ( event->keyval == 'q' ) destroy( widget, data ); + if ( event->keyval == '+' ) + zoom( data, 2 ); + if ( event->keyval == '=' ) + zoom( data, 1 ); + if ( event->keyval == '-' ) + zoom( data, 0 ); + if ( event->keyval == 'q' ) + destroy( widget, data ); } /********************** @@ -728,7 +744,8 @@ #endif /* Set the device size, if resizing is allowed. */ - if ( dev->allow_resize ) gcw_set_device_size( width, height ); + if ( dev->allow_resize ) + gcw_set_device_size( width, height ); width = dev->width; height = dev->height; @@ -764,7 +781,8 @@ /* Set up the background pixmap */ if ( dev->background == NULL || dev->allow_resize ) { - if ( GDK_IS_PIXMAP( dev->background ) ) g_object_unref( dev->background ); + if ( GDK_IS_PIXMAP( dev->background ) ) + g_object_unref( dev->background ); /* Why does this next *useless* command speed up the animation demo? * If we unref the allocated pixmaps, the benefit goes away!! */ @@ -792,7 +810,8 @@ GDK_GC_LINE_STYLE | GDK_GC_CAP_STYLE | GDK_GC_JOIN_STYLE ); } - else dev->gc = gdk_gc_new( dev->background ); + else + dev->gc = gdk_gc_new( dev->background ); } /* Clear the background pixmap */ @@ -801,7 +820,8 @@ /* Advance the page if we are allowing resizing. This ensures that * the physical coordinate system is set up correctly. */ - if ( dev->allow_resize ) pladv( 0 ); + if ( dev->allow_resize ) + pladv( 0 ); #ifdef DEBUG_GCW_1 gcw_debug( "</gcw_set_canvas_size>\n" ); @@ -868,8 +888,10 @@ #ifdef HAVE_FREETYPE - if ( use_text ) plsc->dev_text = 1; /* Allow text handling */ - else plsc->dev_text = 0; /* Disallow text handling */ + if ( use_text ) + plsc->dev_text = 1; /* Allow text handling */ + else + plsc->dev_text = 0; /* Disallow text handling */ #endif Modified: trunk/bindings/gnome2/lib/plplotcanvas.c =================================================================== --- trunk/bindings/gnome2/lib/plplotcanvas.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/bindings/gnome2/lib/plplotcanvas.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -68,7 +68,8 @@ plmkstrm( &Nstream ); self->Nstream = (gint) Nstream; } - else self->Nstream = 0; + else + self->Nstream = 0; } static void plplot_canvas_class_init( PlplotCanvasClass *klass ) Modified: trunk/bindings/octave/massage.c =================================================================== --- trunk/bindings/octave/massage.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/bindings/octave/massage.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -63,7 +63,8 @@ if ( ( p2 = strchr( b, '(' ) ) ) /* function ... = ...( */ { p1 = p2; - while ( *p1-- != ' ' ) ; + while ( *p1-- != ' ' ) + ; p1 += 2; if ( *( p1 + 1 ) == '_' ) /* c_... */ p1 += 2; Modified: trunk/bindings/qt_gui/plqt.cpp =================================================================== --- trunk/bindings/qt_gui/plqt.cpp 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/bindings/qt_gui/plqt.cpp 2010-09-13 02:01:25 UTC (rev 11176) @@ -92,7 +92,8 @@ void QtPLDriver::drawLine( short x1, short y1, short x2, short y2 ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QLineF line( (PLFLT) x1 * downscale, m_dHeight - (PLFLT) y1 * downscale, (PLFLT) x2 * downscale, @@ -104,7 +105,8 @@ void QtPLDriver::drawPolyline( short * x, short * y, PLINT npts ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QPointF * polyline = new QPointF[npts]; for ( int i = 0; i < npts; ++i ) { @@ -117,7 +119,8 @@ void QtPLDriver::drawPolygon( short * x, short * y, PLINT npts ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QPointF * polygon = new QPointF[npts]; for ( int i = 0; i < npts; ++i ) { @@ -156,9 +159,12 @@ } f.setFamily( "" ); // no family name, forcing Qt to find an appropriate font by itself - if ( fontStyle ) f.setItalic( true ); - if ( fontWeight ) f.setWeight( QFont::Bold ); - else f.setWeight( QFont::Normal ); + if ( fontStyle ) + f.setItalic( true ); + if ( fontWeight ) + f.setWeight( QFont::Bold ); + else + f.setWeight( QFont::Normal ); f.setUnderline( underlined ); f.setOverline( overlined ); @@ -321,7 +327,8 @@ void QtPLDriver::drawText( EscText* txt ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; /* Check that we got unicode, warning message and return if not */ if ( txt->unicode_array_len == 0 ) @@ -365,7 +372,8 @@ void QtPLDriver::setColor( int r, int g, int b, double alpha ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QPen p = m_painterP->pen(); p.setColor( QColor( r, g, b, (int) ( alpha * 255 ) ) ); @@ -381,7 +389,8 @@ unsigned char *r, unsigned char *g, unsigned char *b, PLFLT *alpha, PLINT ncol1 ) { - if ( !m_painterP->isActive() || ncol1 < 2 ) return; + if ( !m_painterP->isActive() || ncol1 < 2 ) + return; int i; qreal stop_arg; @@ -404,7 +413,8 @@ void QtPLDriver::setWidth( PLINT w ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QPen p = m_painterP->pen(); p.setWidth( w ); @@ -428,7 +438,8 @@ void QtPLDriver::setSolid() { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QPen p = m_painterP->pen(); p.setStyle( Qt::SolidLine ); @@ -478,7 +489,8 @@ void QtRasterDevice::setBackgroundColor( int r, int g, int b, double alpha ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QBrush brush( QColor( r, g, b, (int) ( alpha * 255 ) ) ); m_painterP->fillRect( 0, 0, width(), height(), brush ); @@ -516,7 +528,8 @@ void QtSVGDevice::setBackgroundColor( int r, int g, int b, double alpha ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QBrush brush( QColor( r, g, b, (int) ( alpha * 255 ) ) ); m_painterP->fillRect( 0, 0, width(), height(), brush ); @@ -577,7 +590,8 @@ void QtEPSDevice::setBackgroundColor( int r, int g, int b, double alpha ) { - if ( !m_painterP->isActive() ) return; + if ( !m_painterP->isActive() ) + return; QBrush brush( QColor( r, g, b, (int) ( alpha * 255 ) ) ); m_painterP->fillRect( 0, 0, width(), height(), brush ); @@ -887,7 +901,8 @@ void QtPLWidget::renderText( QPainter* p, struct TextStruct_* s, double x_fact, double x_offset, double y_fact, double y_offset ) { - if ( s->len <= 0 || s->len >= 500 ) return; + if ( s->len <= 0 || s->len >= 500 ) + return; QPicture picText = getTextPicture( s->fci, s->text, s->len, s->chrht * y_fact ); double picDpi = picText.logicalDpiY(); @@ -1079,10 +1094,14 @@ x1 = gin.pX + dx; y1 = gin.pY + dy; - if ( x1 < xmin ) dx = xmin - gin.pX; - if ( y1 < ymin ) dy = ymin - gin.pY; - if ( x1 > xmax ) dx = xmax - gin.pX; - if ( y1 > ymax ) dy = ymax - gin.pY; + if ( x1 < xmin ) + dx = xmin - gin.pX; + if ( y1 < ymin ) + dy = ymin - gin.pY; + if ( x1 > xmax ) + dx = xmax - gin.pX; + if ( y1 > ymax ) + dy = ymax - gin.pY; QCursor::setPos( p.x() + dx, p.y() + dy ); plGinInit( &gin ); @@ -1390,7 +1409,8 @@ void QtExtWidget::mouseMoveEvent( QMouseEvent* event ) { - if ( !cursorParameters.isTracking ) return; + if ( !cursorParameters.isTracking ) + return; double x_fact, y_fact, x_offset, y_offset; //Parameters to scale and center the plot on the widget @@ -1423,7 +1443,8 @@ void QtExtWidget::mouseReleaseEvent( QMouseEvent* event ) { - if ( !cursorParameters.isTracking ) return; + if ( !cursorParameters.isTracking ) + return; double x_fact, y_fact, x_offset, y_offset; //Parameters to scale and center the plot on the widget @@ -1461,7 +1482,8 @@ { QtPLWidget::paintEvent( event ); - if ( !cursorParameters.isTracking || cursorParameters.cursor_x < 0 ) return; + if ( !cursorParameters.isTracking || cursorParameters.cursor_x < 0 ) + return; QPainter p( this ); Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/bindings/tcl/tclAPI.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -76,8 +76,8 @@ typedef struct Command { - int ( *proc )(); /* Procedure to process command. */ - ClientData clientData; /* Arbitrary value to pass to proc. */ + int ( *proc )(); /* Procedure to process command. */ + ClientData clientData; /* Arbitrary value to pass to proc. */ int *deleteProc; /* Procedure to invoke when deleting * command. */ ClientData deleteData; /* Arbitrary value to pass to deleteProc @@ -410,7 +410,8 @@ #if 1 if ( Matrix_Init( interp ) != TCL_OK ) { - if ( debug ) fprintf( stderr, "error in matrix init\n" ); + if ( debug ) + fprintf( stderr, "error in matrix init\n" ); return TCL_ERROR; } #else @@ -424,7 +425,8 @@ #ifdef USE_MATRIX_STUBS if ( Matrix_InitStubs( interp, "0.1", 0 ) == NULL ) { - if ( debug ) fprintf( stderr, "error in matrix stubs init\n" ); + if ( debug ) + fprintf( stderr, "error in matrix stubs init\n" ); return TCL_ERROR; } #else @@ -441,7 +443,8 @@ /* if we are in the build tree, search there */ if ( plInBuildTree() ) { - if ( debug ) fprintf( stderr, "trying BUILD_DIR\n" ); + if ( debug ) + fprintf( stderr, "trying BUILD_DIR\n" ); libDir = BUILD_DIR "/bindings/tcl"; Tcl_SetVar( interp, "pllibrary", libDir, TCL_GLOBAL_ONLY ); if ( Tcl_Eval( interp, initScript ) != TCL_OK ) @@ -455,7 +458,8 @@ /* Tcl extension dir and/or PL_LIBRARY */ if ( libDir == NULL ) { - if ( debug ) fprintf( stderr, "trying init script\n" ); + if ( debug ) + fprintf( stderr, "trying init script\n" ); if ( Tcl_Eval( interp, initScript ) != TCL_OK ) { /* This unset is needed for Tcl < 8.4 support. */ @@ -471,7 +475,8 @@ /* Install directory */ if ( libDir == NULL ) { - if ( debug ) fprintf( stderr, "trying TCL_DIR\n" ); + if ( debug ) + fprintf( stderr, "trying TCL_DIR\n" ); libDir = TCL_DIR; Tcl_SetVar( interp, "pllibrary", libDir, TCL_GLOBAL_ONLY ); if ( Tcl_Eval( interp, initScript ) != TCL_OK ) @@ -487,7 +492,8 @@ /* Unix extension directory */ if ( libDir == NULL ) { - if ( debug ) fprintf( stderr, "trying extended init script\n" ); + if ( debug ) + fprintf( stderr, "trying extended init script\n" ); if ( Tcl_Eval( interp, initScriptExtended ) != TCL_OK ) { /* This unset is needed for Tcl < 8.4 support. */ @@ -503,10 +509,12 @@ if ( libDir == NULL ) { Tcl_DString ds; - if ( debug ) fprintf( stderr, "trying curdir\n" ); + if ( debug ) + fprintf( stderr, "trying curdir\n" ); if ( Tcl_Access( "plplot.tcl", 0 ) != 0 ) { - if ( debug ) fprintf( stderr, "couldn't find plplot.tcl in curdir\n" ); + if ( debug ) + fprintf( stderr, "couldn't find plplot.tcl in curdir\n" ); return TCL_ERROR; } @@ -514,7 +522,8 @@ libDir = Tcl_GetCwd( interp, &ds ); if ( libDir == NULL ) { - if ( debug ) fprintf( stderr, "couldn't get curdir\n" ); + if ( debug ) + fprintf( stderr, "couldn't get curdir\n" ); return TCL_ERROR; } libDir = plstrdup( libDir ); @@ -523,7 +532,8 @@ if ( Tcl_EvalFile( interp, "plplot.tcl" ) != TCL_OK ) { - if ( debug ) fprintf( stderr, "error evalling plplot.tcl\n" ); + if ( debug ) + fprintf( stderr, "error evalling plplot.tcl\n" ); return TCL_ERROR; } } @@ -531,7 +541,8 @@ if ( libDir == NULL ) { - if ( debug ) fprintf( stderr, "libdir NULL at end of search\n" ); + if ( debug ) + fprintf( stderr, "libdir NULL at end of search\n" ); return TCL_ERROR; } @@ -868,7 +879,8 @@ } matf = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matf == NULL ) return TCL_ERROR; + if ( matf == NULL ) + return TCL_ERROR; if ( matf->dim != 2 ) { @@ -933,7 +945,8 @@ } matclev = Tcl_GetMatrixPtr( interp, argv[0] ); - if ( matclev == NULL ) return TCL_ERROR; + if ( matclev == NULL ) + return TCL_ERROR; nclev = matclev->n[0]; if ( matclev->dim != 1 ) @@ -951,9 +964,11 @@ /* There is a pltr spec, parse it. */ pltrname = argv[0]; mattrx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( mattrx == NULL ) return TCL_ERROR; + if ( mattrx == NULL ) + return TCL_ERROR; mattry = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( mattry == NULL ) return TCL_ERROR; + if ( mattry == NULL ) + return TCL_ERROR; argc -= 3, argv += 3; } @@ -1202,7 +1217,8 @@ } matu = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matu == NULL ) return TCL_ERROR; + if ( matu == NULL ) + return TCL_ERROR; if ( matu->dim != 2 ) { @@ -1229,7 +1245,8 @@ } matv = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( matv == NULL ) return TCL_ERROR; + if ( matv == NULL ) + return TCL_ERROR; if ( matv->dim != 2 ) { @@ -1275,9 +1292,11 @@ /* There is a pltr spec, parse it. */ pltrname = argv[0]; mattrx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( mattrx == NULL ) return TCL_ERROR; + if ( mattrx == NULL ) + return TCL_ERROR; mattry = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( mattry == NULL ) return TCL_ERROR; + if ( mattry == NULL ) + return TCL_ERROR; argc -= 3, argv += 3; } @@ -1532,11 +1551,14 @@ opt = atoi( argv[6] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -1567,11 +1589,14 @@ opt = atoi( argv[4] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -1667,15 +1692,19 @@ opt = atoi( argv[6] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ matlev = Tcl_GetMatrixPtr( interp, argv[7] ); - if ( matlev == NULL ) return TCL_ERROR; + if ( matlev == NULL ) + return TCL_ERROR; if ( matx->type != TYPE_FLOAT || maty->type != TYPE_FLOAT || @@ -1711,14 +1740,18 @@ opt = atoi( argv[6] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ matlev = Tcl_GetMatrixPtr( interp, argv[7] ); - if ( matlev == NULL ) return TCL_ERROR; + if ( matlev == NULL ) + return TCL_ERROR; if ( matx->type != TYPE_FLOAT || maty->type != TYPE_FLOAT || @@ -1756,11 +1789,14 @@ clev = NULL; matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -1792,11 +1828,14 @@ clev = NULL; matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -1887,11 +1926,14 @@ side = atoi( argv[7] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -1923,11 +1965,14 @@ side = atoi( argv[5] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -2023,15 +2068,19 @@ opt = atoi( argv[6] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ matlev = Tcl_GetMatrixPtr( interp, argv[7] ); - if ( matlev == NULL ) return TCL_ERROR; + if ( matlev == NULL ) + return TCL_ERROR; if ( matx->type != TYPE_FLOAT || maty->type != TYPE_FLOAT || @@ -2067,14 +2116,18 @@ opt = atoi( argv[6] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ matlev = Tcl_GetMatrixPtr( interp, argv[7] ); - if ( matlev == NULL ) return TCL_ERROR; + if ( matlev == NULL ) + return TCL_ERROR; if ( matx->type != TYPE_FLOAT || maty->type != TYPE_FLOAT || @@ -2112,11 +2165,14 @@ clev = NULL; matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -2148,11 +2204,14 @@ clev = NULL; matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -2248,15 +2307,19 @@ opt = atoi( argv[6] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ matlev = Tcl_GetMatrixPtr( interp, argv[7] ); - if ( matlev == NULL ) return TCL_ERROR; + if ( matlev == NULL ) + return TCL_ERROR; if ( matx->type != TYPE_FLOAT || maty->type != TYPE_FLOAT || @@ -2292,14 +2355,18 @@ opt = atoi( argv[6] ); matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ matlev = Tcl_GetMatrixPtr( interp, argv[7] ); - if ( matlev == NULL ) return TCL_ERROR; + if ( matlev == NULL ) + return TCL_ERROR; if ( matx->type != TYPE_FLOAT || maty->type != TYPE_FLOAT || @@ -2337,11 +2404,14 @@ clev = NULL; matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -2373,11 +2443,14 @@ clev = NULL; matx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matx == NULL ) return TCL_ERROR; + if ( matx == NULL ) + return TCL_ERROR; maty = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( maty == NULL ) return TCL_ERROR; + if ( maty == NULL ) + return TCL_ERROR; matz = Tcl_GetMatrixPtr( interp, argv[3] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; matPtr = matz; /* For dumb indexer macro, grrrr. */ if ( matx->type != TYPE_FLOAT || @@ -2532,7 +2605,8 @@ } matz = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; if ( matz->dim != 2 ) { interp->result = "Must plot a 2-d matrix."; @@ -2577,9 +2651,11 @@ { pltrname = argv[0]; mattrx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( mattrx == NULL ) return TCL_ERROR; + if ( mattrx == NULL ) + return TCL_ERROR; mattry = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( mattry == NULL ) return TCL_ERROR; + if ( mattry == NULL ) + return TCL_ERROR; argc -= 3, argv += 3; } @@ -2848,7 +2924,8 @@ } matz = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( matz == NULL ) return TCL_ERROR; + if ( matz == NULL ) + return TCL_ERROR; if ( matz->dim != 2 ) { interp->result = "Must plot a 2-d matrix."; @@ -2878,7 +2955,8 @@ ymax = atof( argv[5] ); matclevel = Tcl_GetMatrixPtr( interp, argv[6] ); - if ( matclevel == NULL ) return TCL_ERROR; + if ( matclevel == NULL ) + return TCL_ERROR; nlevel = matclevel->n[0]; if ( matclevel->dim != 1 ) { @@ -2897,9 +2975,11 @@ { pltrname = argv[0]; mattrx = Tcl_GetMatrixPtr( interp, argv[1] ); - if ( mattrx == NULL ) return TCL_ERROR; + if ( mattrx == NULL ) + return TCL_ERROR; mattry = Tcl_GetMatrixPtr( interp, argv[2] ); - if ( mattry == NULL ) return TCL_ERROR; + if ( mattry == NULL ) + return TCL_ERROR; argc -= 3, argv += 3; } @@ -3125,10 +3205,10 @@ * x[], y[] are the coordinates to be plotted. \*--------------------------------------------------------------------------*/ -static const char *transform_name; /* Name of the procedure that transforms the +static const char *transform_name; /* Name of the procedure that transforms the * coordinates */ -static Tcl_Interp *tcl_interp; /* Pointer to the current interp */ -static int return_code; /* Saved return code */ +static Tcl_Interp *tcl_interp; /* Pointer to the current interp */ +static int return_code; /* Saved return code */ void mapform( PLINT n, PLFLT *x, PLFLT *y ) @@ -3160,7 +3240,8 @@ sprintf( cmd, "%cy", (char) 1 ); yPtr = Tcl_GetMatrixPtr( tcl_interp, cmd ); - if ( xPtr == NULL || yPtr == NULL ) return; /* Impossible, but still */ + if ( xPtr == NULL || yPtr == NULL ) + return; /* Impossible, but still */ for ( i = 0; i < n; i++ ) { Modified: trunk/bindings/tk/plframe.c =================================================================== --- trunk/bindings/tk/plframe.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/bindings/tk/plframe.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -1253,10 +1253,14 @@ x1 = x0 + dx; y1 = y0 + dy; - if ( x1 < xmin ) dx = xmin - x0; - if ( y1 < ymin ) dy = ymin - y0; - if ( x1 > xmax ) dx = xmax - x0; - if ( y1 > ymax ) dy = ymax - y0; + if ( x1 < xmin ) + dx = xmin - x0; + if ( y1 < ymin ) + dy = ymin - y0; + if ( x1 > xmax ) + dx = xmax - x0; + if ( y1 > ymax ) + dy = ymax - y0; /* Engage... */ Modified: trunk/drivers/aqt.c =================================================================== --- trunk/drivers/aqt.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/aqt.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -647,7 +647,8 @@ /* initialize the attributed string */ - for ( i = 0; i < MAX_STRING_LEN; i++ ) dummy[i] = 'i'; + for ( i = 0; i < MAX_STRING_LEN; i++ ) + dummy[i] = 'i'; dummy[MAX_STRING_LEN] = '\0'; str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithCString:dummy]]; Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/cairo.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -1273,7 +1273,7 @@ void filled_polygon( PLStream *pls, short *xa, short *ya, PLINT npts ) { - int i; + int i; PLCairo *aStream; aStream = (PLCairo *) pls->dev; @@ -2393,8 +2393,10 @@ aStream = stream_and_font_setup( pls, 0 ); /* Test byte order */ - if ( endianTest.testByte[0] == 1 ) aStream->bigendian = 0; - else aStream->bigendian = 1; + if ( endianTest.testByte[0] == 1 ) + aStream->bigendian = 0; + else + aStream->bigendian = 1; /* Check that user supplied us with some memory to draw in */ if ( pls->dev == NULL ) @@ -3056,7 +3058,8 @@ if ( aStream != NULL ) { - if ( aStream->hdc != NULL ) ReleaseDC( aStream->hwnd, aStream->hdc ); + if ( aStream->hdc != NULL ) + ReleaseDC( aStream->hwnd, aStream->hdc ); free_mem( pls->dev ); } } Modified: trunk/drivers/cgm.c =================================================================== --- trunk/drivers/cgm.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/cgm.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -227,7 +227,8 @@ if ( !pls->colorset ) pls->color = 1; /* Is a color device */ - if ( pls->width < 1 ) pls->width = 1; /* set a legal line width */ + if ( pls->width < 1 ) + pls->width = 1; /* set a legal line width */ /* Initialize family file info */ plFamInit( pls ); @@ -409,7 +410,8 @@ cdPolygon( dev->im_out, points, pls->dev_npts ); - if ( dev->force_edges == 1 ) cdSetEdgeVis( dev->im_out, 0 ); /* Turn edges off now */ + if ( dev->force_edges == 1 ) + cdSetEdgeVis( dev->im_out, 0 ); /* Turn edges off now */ free( points ); } @@ -429,15 +431,15 @@ cgm_Dev *dev = (cgm_Dev *) pls->dev; PLFLT tmp_colour_pos; - cdImageColorClear( dev->im_out ); /* UNDOCUMENTED FUNCTION TO RESET THE + cdImageColorClear( dev->im_out ); /* UNDOCUMENTED FUNCTION TO RESET THE * INTERNAL COLOUR TABLE OF THE * CD DRIVER. Seems to work and fix * the errors */ - if ( ncol0 > cdMaxColors / 2 ) /* Check for ridiculous number of colours */ - { /* in ncol0, and appropriately adjust the */ - plwarn( "Too many colours in cmap0." ); /* number, issuing a */ - ncol0 = cdMaxColors / 2; /* warning if it does */ + if ( ncol0 > cdMaxColors / 2 ) /* Check for ridiculous number of colours */ + { /* in ncol0, and appropriately adjust the */ + plwarn( "Too many colours in cmap0." ); /* number, issuing a */ + ncol0 = cdMaxColors / 2; /* warning if it does */ pls->ncol0 = ncol0; } @@ -746,7 +748,8 @@ { cdImageCgm( dev->im_out, pls->OutFile ); } - for ( i = 0; i < cdMaxColors; ++i ) dev->colour_index[i] = -1; + for ( i = 0; i < cdMaxColors; ++i ) + dev->colour_index[i] = -1; dev->fill_colour = dev->colour; /* initially set fill and line colour the same */ dev->last_fill_colour = -1; /* set to -1 = unallocated */ Modified: trunk/drivers/dg300.c =================================================================== --- trunk/drivers/dg300.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/dg300.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -68,7 +68,8 @@ printf( "\n\036\107\051\n" ); scanf( "%s", (char *) &termattr ); - while ( getchar() != '\n' ) ; + while ( getchar() != '\n' ) + ; if ( !strncmp( (char *) &termattr.ram[0], "0000", 4 ) ) { printf( "Please wait while graphics interpreter is downloaded.\n" ); @@ -129,7 +130,8 @@ { putchar( '\007' ); fflush( stdout ); - while ( getchar() != '\n' ) ; + while ( getchar() != '\n' ) + ; printf( "ERASE\n" ); } Modified: trunk/drivers/gcw.c =================================================================== --- trunk/drivers/gcw.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/gcw.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -209,7 +209,8 @@ { pls->dev_text = TRUE; pls->dev_unicode = TRUE; - if ( hrshsym ) pls->dev_hrshsym = 1; + if ( hrshsym ) + pls->dev_hrshsym = 1; /* Initialize freetype */ plD_FreeType_init( pls ); @@ -310,7 +311,8 @@ dev->allow_resize = FALSE; /* The size is set an should not be changed */ gcw_install_canvas( NULL ); } - else dev->allow_resize = TRUE; /* Resizing allowed for canvasses + else + dev->allow_resize = TRUE; /* Resizing allowed for canvasses * provided via PLESC_DEVINIT */ @@ -350,8 +352,10 @@ plexit( "GCW driver <plD_polyline_gcw>: Canvas not found" ); canvas = dev->canvas; - if ( dev->use_persistence ) group = dev->group_persistent; - else group = dev->group_hidden; + if ( dev->use_persistence ) + group = dev->group_persistent; + else + group = dev->group_hidden; if ( dev->use_pixmap && !dev->use_persistence ) /* Write to bg pixmap */ @@ -514,14 +518,17 @@ /* Ignore if there is no hidden group. This means BOP has not been * called yet. */ - if ( !GNOME_IS_CANVAS_GROUP( dev->group_hidden ) ) return; + if ( !GNOME_IS_CANVAS_GROUP( dev->group_hidden ) ) + return; #ifdef DEBUG_GCW_1 gcw_debug( "<plD_eop_gcw>\n" ); #endif - if ( dev->use_persistence ) group = dev->group_persistent; - else group = dev->group_hidden; + if ( dev->use_persistence ) + group = dev->group_persistent; + else + group = dev->group_hidden; /* Retrieve the device width and height of the canvas */ width = *(PLINT*) g_object_get_data( G_OBJECT( canvas ), "canvas-width" ); @@ -585,7 +592,8 @@ gnome_canvas_item_raise_to_top( GNOME_CANVAS_ITEM( dev->group_persistent ) ); /* Move the background to the back */ - if ( GNOME_IS_CANVAS_ITEM( item ) ) gnome_canvas_item_lower_to_bottom( item ); + if ( GNOME_IS_CANVAS_ITEM( item ) ) + gnome_canvas_item_lower_to_bottom( item ); /* Make the hidden group visible */ gnome_canvas_item_show( GNOME_CANVAS_ITEM( dev->group_hidden ) ); @@ -598,7 +606,8 @@ } /* Clear the background pixmap */ - if ( !dev->use_persistence && dev->pixmap_has_data ) gcw_clear_background(); + if ( !dev->use_persistence && dev->pixmap_has_data ) + gcw_clear_background(); /* Name the hidden group as visible */ dev->group_visible = dev->group_hidden; @@ -652,8 +661,10 @@ if ( !GNOME_IS_CANVAS( dev->canvas ) ) { - if ( pls->hack ) return; /* Wait for a canvas via DEVINIT */ - else gcw_install_canvas( NULL ); + if ( pls->hack ) + return; /* Wait for a canvas via DEVINIT */ + else + gcw_install_canvas( NULL ); } canvas = dev->canvas; @@ -664,9 +675,12 @@ /* Replay escape calls that come in before PLESC_DEVINIT. Some of them * required a Canvas that didn't exist yet. */ - if ( dev->plstate_width ) plD_state_gcw( pls, PLSTATE_WIDTH ); - if ( dev->plstate_color0 ) plD_state_gcw( pls, PLSTATE_COLOR0 ); - if ( dev->plstate_color1 ) plD_state_gcw( pls, PLSTATE_COLOR1 ); + if ( dev->plstate_width ) + plD_state_gcw( pls, PLSTATE_WIDTH ); + if ( dev->plstate_color0 ) + plD_state_gcw( pls, PLSTATE_COLOR0 ); + if ( dev->plstate_color1 ) + plD_state_gcw( pls, PLSTATE_COLOR1 ); dev->plstate_width = FALSE; dev->plstate_color0 = FALSE; dev->plstate_color1 = FALSE; @@ -748,13 +762,20 @@ char opname[20], msg[100]; #ifdef DEBUG_GCW_1 - if ( op == PLSTATE_WIDTH ) strcpy( opname, "PLSTATE_WIDTH" ); - else if ( op == PLSTATE_COLOR0 ) strcpy( opname, "PLSTATE_COLOR0" ); - else if ( op == PLSTATE_COLOR1 ) strcpy( opname, "PLSTATE_COLOR1" ); - else if ( op == PLSTATE_FILL ) strcpy( opname, "PLSTATE_FILL" ); - else if ( op == PLSTATE_CMAP0 ) strcpy( opname, "PLSTATE_CMAP0" ); - else if ( op == PLSTATE_CMAP1 ) strcpy( opname, "PLSTATE_CMAP1" ); - else strcpy( opname, "unknown" ); + if ( op == PLSTATE_WIDTH ) + strcpy( opname, "PLSTATE_WIDTH" ); + else if ( op == PLSTATE_COLOR0 ) + strcpy( opname, "PLSTATE_COLOR0" ); + else if ( op == PLSTATE_COLOR1 ) + strcpy( opname, "PLSTATE_COLOR1" ); + else if ( op == PLSTATE_FILL ) + strcpy( opname, "PLSTATE_FILL" ); + else if ( op == PLSTATE_CMAP0 ) + strcpy( opname, "PLSTATE_CMAP0" ); + else if ( op == PLSTATE_CMAP1 ) + strcpy( opname, "PLSTATE_CMAP1" ); + else + strcpy( opname, "unknown" ); snprintf( msg, 100, "<plD_state_gcw />: %s\n", opname ); gcw_debug( msg ); #endif @@ -772,25 +793,30 @@ GDK_JOIN_MITER ); } } - else dev->plstate_width = TRUE; + else + dev->plstate_width = TRUE; break; case PLSTATE_COLOR0: if ( GNOME_IS_CANVAS( dev->canvas ) ) { dev->color = plcolor_to_rgba( pls->cmap0[pls->icol0], 0xFF ); - if ( dev->use_pixmap ) gcw_set_gdk_color(); + if ( dev->use_pixmap ) + gcw_set_gdk_color(); } - else dev->plstate_color0 = TRUE; + else + dev->plstate_color0 = TRUE; break; case PLSTATE_COLOR1: if ( GNOME_IS_CANVAS( dev->canvas ) ) { dev->color = plcolor_to_rgba( pls->cmap1[pls->icol1], 0xFF ); - if ( dev->use_pixmap ) gcw_set_gdk_color(); + if ( dev->use_pixmap ) + gcw_set_gdk_color(); } - else dev->plstate_color1 = TRUE; + else + dev->plstate_color1 = TRUE; break; case PLSTATE_FILL: @@ -837,8 +863,10 @@ plexit( "GCW driver <fill_polygon>: Canvas not found" ); canvas = dev->canvas; - if ( dev->use_persistence ) group = dev->group_persistent; - else group = dev->group_hidden; + if ( dev->use_persistence ) + group = dev->group_persistent; + else + group = dev->group_hidden; if ( dev->use_pixmap && !dev->use_persistence ) /* Write to a pixmap */ @@ -981,8 +1009,10 @@ plexit( "GCW driver <proc_str>: Canvas not found" ); canvas = dev->canvas; - if ( dev->use_persistence ) group = dev->group_persistent; - else group = dev->group_hidden; + if ( dev->use_persistence ) + group = dev->group_persistent; + else + group = dev->group_hidden; /* Retrieve the escape character */ plgesc( &esc ); @@ -1063,16 +1093,20 @@ /* Move to lower sub/sup position */ case 'd': case 'D': - if ( up > 0. ) scale *= 1.25; /* Subscript scaling parameter */ - else scale *= 0.8; /* Subscript scaling parameter */ + if ( up > 0. ) + scale *= 1.25; /* Subscript scaling parameter */ + else + scale *= 0.8; /* Subscript scaling parameter */ up -= font_size / 2.; break; /* Move to higher sub/sup position */ case 'u': case 'U': - if ( up < 0. ) scale *= 1.25; /* Subscript scaling parameter */ - else scale *= 0.8; /* Subscript scaling parameter */ + if ( up < 0. ) + scale *= 1.25; /* Subscript scaling parameter */ + else + scale *= 0.8; /* Subscript scaling parameter */ up += font_size / 2.; break; @@ -1092,12 +1126,14 @@ break; } /* switch(text[i]) */ - if ( text[i] != '#' ) i++; /* Move ahead to the next character */ + if ( text[i] != '#' ) + i++; /* Move ahead to the next character */ } /* if(text[i] == esc) */ - } /* if(text[i] & PL_FCI_MARK) */ + } /* if(text[i] & PL_FCI_MARK) */ - if ( i == Ntext ) continue; /* End of string */ + if ( i == Ntext ) + continue; /* End of string */ /* Save the sub/sup position */ up_list[N] = up; @@ -1126,7 +1162,8 @@ /* Differentiate between ## and escape sequences */ if ( text[i] == esc ) { - if ( !( i > 0 && text[i - 1] == esc ) ) break; + if ( !( i > 0 && text[i - 1] == esc ) ) + break; } gnome_glyphlist_glyph( glyphlist, @@ -1143,7 +1180,8 @@ /* Keep track of the total string width so that we can justify it */ total_width += width[N]; - if ( N != 0 ) total_width += 2; /* Add a little extra space */ + if ( N != 0 ) + total_width += 2; /* Add a little extra space */ /* Create the canvas text item */ if ( !GNOME_IS_CANVAS_ITEM( @@ -1206,7 +1244,8 @@ /* Keep track of the position in the string */ sum_width += width[i]; - if ( i != N - 1 ) sum_width += 2; /* Add a little extra space */ + if ( i != N - 1 ) + sum_width += 2; /* Add a little extra space */ } #ifdef DEBUG_GCW_2 @@ -1229,12 +1268,18 @@ #ifdef DEBUG_GCW_1 char opname[20], msg[100]; - if ( op == PLESC_DEVINIT ) strcpy( opname, "PLESC_DEVINIT" ); - else if ( op == PLESC_CLEAR ) strcpy( opname, "PLESC_CLEAR" ); - else if ( op == PLESC_FILL ) strcpy( opname, "PLESC_FILL" ); - else if ( op == PLESC_HAS_TEXT ) strcpy( opname, "PLESC_HAS_TEXT" ); - else if ( op == PLESC_GRAPH ) strcpy( opname, "PLESC_GRAPH" ); - else strcpy( opname, "unknown" ); + if ( op == PLESC_DEVINIT ) + strcpy( opname, "PLESC_DEVINIT" ); + else if ( op == PLESC_CLEAR ) + strcpy( opname, "PLESC_CLEAR" ); + else if ( op == PLESC_FILL ) + strcpy( opname, "PLESC_FILL" ); + else if ( op == PLESC_HAS_TEXT ) + strcpy( opname, "PLESC_HAS_TEXT" ); + else if ( op == PLESC_GRAPH ) + strcpy( opname, "PLESC_GRAPH" ); + else + strcpy( opname, "unknown" ); snprintf( msg, 100, "<plD_esc_gcw />: %s\n", opname ); gcw_debug( msg ); #endif Modified: trunk/drivers/gd.c =================================================================== --- trunk/drivers/gd.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/gd.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -427,7 +427,8 @@ NCOLOURS = 16777216; } - if ( ( dev->palette == 0 ) && ( dev->optimise == 0 ) && ( smooth_line == 1 ) ) dev->smooth = 1; /* Allow smoothing of lines if we have a truecolour device */ + if ( ( dev->palette == 0 ) && ( dev->optimise == 0 ) && ( smooth_line == 1 ) ) + dev->smooth = 1; /* Allow smoothing of lines if we have a truecolour device */ #endif @@ -1080,8 +1081,10 @@ pls->page++; - if ( dev->black15 ) plD_black15_gd( pls ); - if ( dev->red15 ) plD_red15_gd( pls ); + if ( dev->black15 ) + plD_black15_gd( pls ); + if ( dev->red15 ) + plD_red15_gd( pls ); #if GD2_VERS >= 2 if ( ( ( ( ( dev->truecolour > 0 ) && ( dev->palette > 0 ) ) || /* In an EXTREMELY convaluted */ @@ -1256,7 +1259,8 @@ char *bbuf; bbuf = calloc( 256, (size_t) 1 ); /* Allocate a buffer to "check off" colours as they are used */ - if ( bbuf == NULL ) plexit( "plD_gd_optimise: Out of memory." ); + if ( bbuf == NULL ) + plexit( "plD_gd_optimise: Out of memory." ); for ( i = 0; i < ( pls->xlength - 1 ); i++ ) /* Walk through the image pixel by pixel */ { /* checking to see what colour it is */ @@ -1268,7 +1272,8 @@ for ( i = 0; i < 256; i++ ) /* next walk over the colours and deallocate */ { /* unused ones */ - if ( bbuf[i] == 0 ) gdImageColorDeallocate( dev->im_out, i ); + if ( bbuf[i] == 0 ) + gdImageColorDeallocate( dev->im_out, i ); } free( bbuf ); Modified: trunk/drivers/ljiip.c =================================================================== --- trunk/drivers/ljiip.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/ljiip.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -251,7 +251,8 @@ width = floor( 0.5 + width * ( tmp * tmp * tmp * ( 1.0 - 0.707107 ) + 0.707107 ) ); - if ( width < 1 ) width = 1; + if ( width < 1 ) + width = 1; if ( width > 1 ) { for ( i = 0; i < width; i++ ) @@ -392,7 +393,8 @@ /* find last non-zero byte */ last = BPROW - 1; - while ( last > 0 && p[last] == 0 ) last--; + while ( last > 0 && p[last] == 0 ) + last--; last++; /* translate to mode 2, save results in t_buf[] */ @@ -406,7 +408,8 @@ if ( i < last - 2 && ( c == p[i + 1] ) && ( c == p[i + 2] ) ) { j = i + 3; - while ( j < jmax && c == p[j] ) j++; + while ( j < jmax && c == p[j] ) + j++; t_buf[n++] = ( i - j + 1 ) & 0xff; t_buf[n++] = c; i = j; @@ -416,7 +419,8 @@ for ( j = i + 1; j < jmax; j++ ) { if ( j < last - 2 && ( p[j] == p[j + 1] ) && - ( p[j + 1] == p[j + 2] ) ) break; + ( p[j + 1] == p[j + 2] ) ) + break; } t_buf[n++] = j - i - 1; while ( i < j ) Modified: trunk/drivers/pbm.c =================================================================== --- trunk/drivers/pbm.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/pbm.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -179,12 +179,16 @@ plot( x, y, pls ); while ( e >= 0 ) { - if ( change == 1 ) x += s1; - else y += s2; + if ( change == 1 ) + x += s1; + else + y += s2; e = e - 2 * dx; } - if ( change == 1 ) y += s2; - else x += s1; + if ( change == 1 ) + y += s2; + else + x += s1; e = e + 2 * dy; } } Modified: trunk/drivers/plplotcanvas-hacktext.c =================================================================== --- trunk/drivers/plplotcanvas-hacktext.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/plplotcanvas-hacktext.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -577,7 +577,8 @@ ArtIRect ibox; art_drect_to_irect( &ibox, &gbbox ); gnome_canvas_request_redraw( hacktext->item.canvas, ibox.x0, ibox.y0, ibox.x1, ibox.y1 ); - if ( bbox ) art_irect_union( bbox, bbox, &ibox ); + if ( bbox ) + art_irect_union( bbox, bbox, &ibox ); } } Modified: trunk/drivers/ps.c =================================================================== --- trunk/drivers/ps.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/ps.c 2010-09-13 02:01:25 UTC (rev 11176) @@ -168,8 +168,10 @@ pls->xlength = 540; pls->ylength = 720; } - if ( pls->xdpi <= 0 ) pls->xdpi = 72.; - if ( pls->ydpi <= 0 ) pls->ydpi = 72.; + if ( pls->xdpi <= 0 ) + pls->xdpi = 72.; + if ( pls->ydpi <= 0 ) + pls->ydpi = 72.; pxlx = YPSSIZE / LPAGE_X; pxly = XPSSIZE / LPAGE_Y; @@ -178,7 +180,8 @@ { pls->dev_text = 1; /* want to draw text */ pls->dev_unicode = 1; /* want unicode */ - if ( hrshsym ) pls->dev_hrshsym = 1; /* want Hershey symbols */ + if ( hrshsym ) + pls->dev_hrshsym = 1; /* want Hershey symbols */ } pls->dev_fill0 = 1; /* Can do solid fills */ @@ -984,19 +987,24 @@ pldebug( "proc_str", "string-specified fci = 0x%x, font name = %s\n", fci, font ); continue; } - else switch ( *cur_strp++ ) + else + switch ( *cur_strp++ ) { case 'd': case 'D': - if ( up > 0. ) scale *= 1.25; /* Subscript scaling parameter */ - else scale *= 0.8; /* Subscript scaling parameter */ + if ( up > 0. ) + scale *= 1.25; /* Subscript scaling parameter */ + else + scale *= 0.8; /* Subscript scaling parameter */ up -= font_factor * ENLARGE * ft_ht / 2.; break; case 'u': case 'U': - if ( up < 0. ) scale *= 1.25; /* Subscript scaling parameter */ - else scale *= 0.8; /* Subscript scaling parameter */ + if ( up < 0. ) + scale *= 1.25; /* Subscript scaling parameter */ + else + scale *= 0.8; /* Subscript scaling parameter */ up += font_factor * ENLARGE * ft_ht / 2.; break; @@ -1022,7 +1030,8 @@ } *strp = '\0'; - if ( fabs( up ) < 0.001 ) up = 0.; /* Watch out for small differences */ + if ( fabs( up ) < 0.001 ) + up = 0.; /* Watch out for small differences */ /* Apply the scaling and the shear */ fprintf( OF, "/%s [%.3f %.3f %.3f %.3f 0 0] SF\n", @@ -1034,13 +1043,15 @@ /* if up/down escape sequences, save current point and adjust baseline; * take the shear into account */ - if ( up != 0. ) fprintf( OF, "gsave %.3f %.3f rmoveto\n", TRMFLT( up * tt[1] ), TRMFLT( up * tt[3] ) ); + if ( up != 0. ) + fprintf( OF, "gsave %.3f %.3f rmoveto\n", TRMFLT( up * tt[1] ), TRMFLT( up * tt[3] ) ); /* print the string */ fprintf( OF, "(%s) show\n", str ); /* back to baseline */ - if ( up != 0. ) fprintf( OF, "grestore (%s) stringwidth rmoveto\n", str ); + if ( up != 0. ) + fprintf( OF, "grestore (%s) stringwidth rmoveto\n", str ); } while ( *cur_strp ); fprintf( OF, "grestore\n" ); Modified: trunk/drivers/pstex.c =================================================================== --- trunk/drivers/pstex.c 2010-09-13 01:57:39 UTC (rev 11175) +++ trunk/drivers/pstex.c 2010-09-13 02:01:2... [truncated message content] |
From: <ai...@us...> - 2010-09-15 02:17:32
|
Revision: 11183 http://plplot.svn.sourceforge.net/plplot/?rev=11183&view=rev Author: airwin Date: 2010-09-15 02:17:25 +0000 (Wed, 15 Sep 2010) Log Message: ----------- Add opt argument to pllegend to control kind of legend. Use this argument to implement finer-grained control so that one call to pllegend suffices to create a line legend, a symbol legend, or both. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-15 02:13:51 UTC (rev 11182) +++ trunk/examples/c/x04c.c 2010-09-15 02:17:25 UTC (rev 11183) @@ -46,10 +46,10 @@ int i; static PLFLT freql[101], ampl[101], phase[101]; PLFLT f0, freq; - char *names[2]; - int colors[2]; - int label_colors[2]; - int symbols[2]; + char *text[2]; + PLINT text_colors[2]; + PLINT cmap0_colors[2]; + PLINT symbols[2]; pladv( 0 ); @@ -109,20 +109,15 @@ plmtex( "r", 5.0, 0.5, 0.5, "Phase shift (degrees)" ); // Draw a legend - names[0] = "Amplitude"; - names[1] = "Phase shift"; - colors[0] = 2; - colors[1] = 3; - label_colors[0] = 1; - label_colors[1] = 1; - pllegend( 0.3, 0.1, 0.95, 2, label_colors, names, colors, 0, NULL ); - - // Draw the points legend + text[0] = "Amplitude"; + text[1] = "Phase shift"; + text_colors[0] = 1; + text_colors[1] = 1; + cmap0_colors[0] = 2; + cmap0_colors[1] = 3; plssym( 0., 3. ); - names[0] = ""; - names[1] = ""; symbols[0] = -1; symbols[1] = 3; - pllegend( 0.3, 0.1, 0.95, 2, label_colors, names, colors, 5, symbols ); + pllegend( PL_LEGEND_LINE | PL_LEGEND_SYMBOL, 0.3, 0.1, 0.95, 2, text_colors, text, cmap0_colors, 5, symbols ); } } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-15 02:13:51 UTC (rev 11182) +++ trunk/include/plplot.h 2010-09-15 02:17:25 UTC (rev 11183) @@ -1205,9 +1205,19 @@ PLDLLIMPEXP void c_pllab( const char *xlabel, const char *ylabel, const char *tlabel ); -/* Routine for drawing simple line or symbol legends */ +/* Routine for drawing line, symbol, cmap0, or cmap1 legends */ + +// Flags for pllegend. +#define PL_LEGEND_LINE 1 +#define PL_LEGEND_SYMBOL 2 +#define PL_LEGEND_CMAP0 4 +#define PL_LEGEND_CMAP1 8 +#define PL_LEGEND_TEXT_LEFT 16 + PLDLLIMPEXP void -c_pllegend( PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT nsymbols, PLINT *symbols ); +c_pllegend( PLINT opt, PLFLT plot_width, PLFLT x, PLFLT y, PLINT nlegend, + PLINT *text_colors, char **text, PLINT *cmap0_colors, + PLINT nsymbols, PLINT *symbols ); /* Sets position of the light source */ PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-15 02:13:51 UTC (rev 11182) +++ trunk/src/pllegend.c 2010-09-15 02:17:25 UTC (rev 11183) @@ -74,117 +74,142 @@ // pllegend - Draw a legend using lines (nsymbols <=1 or symbols == NULL) or // points/symbols. -// line_length: extent of lines or extent of nsymbols points/symbols +// plot_width: width of plotted areas (lines, symbols, or colour boxes) in legend // x, y: Normalized position of the legend in the plot window -// n: Number of legend entries +// nlegend: Number of legend entries // text_colors: Color map 0 indices of the colors to use for label text -// names: Name/label for each legend entry -// colors: Line/point color for each legend entry -// nsymbols: number of points/symbols to be drawn for each line_length +// text: text string for each legend entry +// cmap0_colors: cmap0 color index for each legend entry +// nsymbols: number of points/symbols to be drawn for each plot_width // symbols: Symbol to draw for each legend entry. -void c_pllegend( PLFLT line_length, PLFLT x, PLFLT y, PLINT n, PLINT *text_colors, char **names, PLINT *colors, PLINT nsymbols, PLINT *symbols ) + +void +c_pllegend( PLINT opt, PLFLT plot_width, PLFLT x, PLFLT y, PLINT nlegend, + PLINT *text_colors, char **text, PLINT *cmap0_colors, + PLINT nsymbols, PLINT *symbols ) + { // Active indexed drawing color PLINT old_col0; // Viewport world-coordinate limits PLFLT xmin, xmax, ymin, ymax; // Legend position - PLFLT line_x, line_x_end, line_x_world, line_x_end_world; - PLFLT line_y, line_y_world; + PLFLT plot_x, plot_x_end, plot_x_world, plot_x_end_world; + PLFLT plot_y, plot_y_world; PLFLT text_x, text_y, text_x_world, text_y_world; // Character height (world coordinates) PLFLT character_height, character_width, symbol_width; // y-position of the current legend entry PLFLT ty; // Positions of the legend entries - PLFLT dxs, *xs, *ys; + PLFLT dxs, *xs, *ys, xl[2], yl[2]; PLINT i, j; - // ifline is true if lines are to be drawn, false if points/symbols are - // to be drawn. - int ifline = nsymbols <= 1 || symbols == NULL; - if ( symbols == NULL ) - nsymbols = 2; + // opt_plot is the kind of plot made for the legend. + PLINT opt_plot = opt & ( PL_LEGEND_LINE | PL_LEGEND_SYMBOL | + PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1 ); + // Sanity checks. + // Check opt_plot for a valid combination of kind of plots. + if ( !( ( opt_plot & ( PL_LEGEND_LINE | PL_LEGEND_SYMBOL ) ) || + opt_plot == PL_LEGEND_CMAP0 || opt_plot == PL_LEGEND_CMAP1 ) ) + { + plabort( "pllegend: invalid opt" ); + return; + } + + if ( ( symbols == NULL ) && ( opt & PL_LEGEND_SYMBOL ) ) + { + plabort( "pllegend: invalid combination of opt requesting a symbols style of legend while symbols are not properly defined." ); + return; + } nsymbols = MAX( 2, nsymbols ); old_col0 = plsc->icol0; plgvpw( &xmin, &xmax, &ymin, &ymax ); - // World coordinates for legend lines - line_x = x; - line_y = y; - line_x_end = line_x + line_length; - line_x_world = normalized_to_world_x( line_x ); - line_y_world = normalized_to_world_y( line_y ); - line_x_end_world = normalized_to_world_x( line_x_end ); + // World coordinates for legend plots + plot_x = x; + plot_y = y; + plot_x_end = plot_x + plot_width; + plot_x_world = normalized_to_world_x( plot_x ); + plot_y_world = normalized_to_world_y( plot_y ); + plot_x_end_world = normalized_to_world_x( plot_x_end ); // Get character height and width in world coordinates character_height = get_character_or_symbol_height( 1 ); character_width = character_height * fabs( ( xmax - xmin ) / ( ymax - ymin ) ); - // Get symbol width in world coordinates if symbols are plotted to - // adjust ends of line of symbols. - if ( ifline ) - { - symbol_width = 0.; - } - else - { - // AWI, no idea why must use 0.5 factor to get ends of symbol lines - // to line up approximately correctly with plotted legend lines. - // Factor should be unity. - symbol_width = 0.5 * get_character_or_symbol_height( 0 ) * - fabs( ( xmax - xmin ) / ( ymax - ymin ) ); - } // Get world-coordinate positions of the start of the legend text - text_x = line_x_end; - text_y = line_y; + text_x = plot_x_end; + text_y = plot_y; text_x_world = normalized_to_world_x( text_x ) + character_width; text_y_world = normalized_to_world_y( text_y ); // Starting y position for legend entries ty = text_y_world - character_height; - if ( ( ( xs = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) || - ( ( ys = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) + if ( opt & PL_LEGEND_LINE ) { - plexit( "pllegend: Insufficient memory" ); + xl[0] = plot_x_world; + xl[1] = plot_x_end_world; + yl[0] = ty; + yl[1] = ty; } - dxs = ( line_x_end_world - line_x_world - symbol_width ) / (double) ( nsymbols - 1 ); - for ( j = 0; j < nsymbols; j++ ) + if ( opt & PL_LEGEND_SYMBOL ) { - xs[j] = line_x_world + 0.5 * symbol_width + dxs * (double) j; - ys[j] = ty; - } - - // Draw each legend entry - for ( i = 0; i < n; i++ ) - { - // Line for the legend - plcol0( colors[i] ); - if ( ifline ) + if ( ( ( xs = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) || + ( ( ys = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) { - // Draw lines - plline( nsymbols, xs, ys ); + plexit( "pllegend: Insufficient memory" ); } - else + + // Get symbol width in world coordinates if symbols are plotted to + // adjust ends of line of symbols. + // AWI, no idea why must use 0.5 factor to get ends of symbol lines + // to line up approximately correctly with plotted legend lines. + // Factor should be unity. + symbol_width = 0.5 * get_character_or_symbol_height( 0 ) * + fabs( ( xmax - xmin ) / ( ymax - ymin ) ); + dxs = ( plot_x_end_world - plot_x_world - symbol_width ) / (double) ( nsymbols - 1 ); + for ( j = 0; j < nsymbols; j++ ) { - // Draw symbols - plpoin( nsymbols, xs, ys, symbols[i] ); + xs[j] = plot_x_world + 0.5 * symbol_width + dxs * (double) j; + ys[j] = ty; } + } + // Draw each legend entry + for ( i = 0; i < nlegend; i++ ) + { // Label/name for the legend plcol0( text_colors[i] ); - plptex( text_x_world, ty, 0.0, 0.0, 0.0, names[i] ); - // Move to the next position + plptex( text_x_world, ty, 0.0, 0.0, 0.0, text[i] ); + + // prepare for the next position ty = ty - ( 1.5 * character_height ); - for ( j = 0; j < nsymbols; j++ ) + plcol0( cmap0_colors[i] ); + if ( opt & PL_LEGEND_LINE ) { - ys[j] = ty; + plline( 2, xl, yl ); + // prepare for the next position + yl[0] = ty; + yl[1] = ty; } + if ( opt & PL_LEGEND_SYMBOL ) + { + plpoin( nsymbols, xs, ys, symbols[i] ); + // prepare for the next position + for ( j = 0; j < nsymbols; j++ ) + { + ys[j] = ty; + } + } } - free( xs ); - free( ys ); + if ( opt & PL_LEGEND_SYMBOL ) + { + free( xs ); + free( ys ); + } // Restore the previously active drawing color plcol0( old_col0 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-15 23:59:09
|
Revision: 11187 http://plplot.svn.sourceforge.net/plplot/?rev=11187&view=rev Author: airwin Date: 2010-09-15 23:59:02 +0000 (Wed, 15 Sep 2010) Log Message: ----------- Add line_style and line_width to line attributes that are plotted in legend. Thanks, Arjen, for this suggestion. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-15 23:57:11 UTC (rev 11186) +++ trunk/examples/c/x04c.c 2010-09-15 23:59:02 UTC (rev 11187) @@ -49,7 +49,7 @@ char *text[2]; PLINT text_colors[2]; PLINT cmap0_colors[2]; - PLINT symbols[2]; + PLINT line_style[2], line_width[2], symbols[2]; pladv( 0 ); @@ -115,9 +115,15 @@ text_colors[1] = 1; cmap0_colors[0] = 2; cmap0_colors[1] = 3; + line_style[0] = 1; + line_style[1] = 2; + line_width[0] = 8; + line_width[1] = 2; plssym( 0., 3. ); - symbols[0] = -1; + symbols[0] = 9; symbols[1] = 3; - pllegend( PL_LEGEND_LINE | PL_LEGEND_SYMBOL, 0.3, 0.1, 0.95, 2, text_colors, text, cmap0_colors, 5, symbols ); + pllegend( PL_LEGEND_LINE | PL_LEGEND_SYMBOL, 0.3, 0.1, 0.95, + 2, text_colors, text, cmap0_colors, line_style, + line_width, 5, symbols ); } } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-15 23:57:11 UTC (rev 11186) +++ trunk/include/plplot.h 2010-09-15 23:59:02 UTC (rev 11187) @@ -1217,6 +1217,7 @@ PLDLLIMPEXP void c_pllegend( PLINT opt, PLFLT plot_width, PLFLT x, PLFLT y, PLINT nlegend, PLINT *text_colors, char **text, PLINT *cmap0_colors, + PLINT *line_style, PLINT *line_width, PLINT nsymbols, PLINT *symbols ); /* Sets position of the light source */ Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-15 23:57:11 UTC (rev 11186) +++ trunk/src/pllegend.c 2010-09-15 23:59:02 UTC (rev 11187) @@ -86,11 +86,10 @@ void c_pllegend( PLINT opt, PLFLT plot_width, PLFLT x, PLFLT y, PLINT nlegend, PLINT *text_colors, char **text, PLINT *cmap0_colors, + PLINT *line_style, PLINT *line_width, PLINT nsymbols, PLINT *symbols ) { - // Active indexed drawing color - PLINT old_col0; // Viewport world-coordinate limits PLFLT xmin, xmax, ymin, ymax; // Legend position @@ -107,6 +106,9 @@ // opt_plot is the kind of plot made for the legend. PLINT opt_plot = opt & ( PL_LEGEND_LINE | PL_LEGEND_SYMBOL | PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1 ); + // Active attributes to be saved and restored afterward. + PLINT old_col0 = plsc->icol0, old_line_style = plsc->line_style, + old_line_width = plsc->width; // Sanity checks. // Check opt_plot for a valid combination of kind of plots. if ( !( ( opt_plot & ( PL_LEGEND_LINE | PL_LEGEND_SYMBOL ) ) || @@ -123,8 +125,6 @@ } nsymbols = MAX( 2, nsymbols ); - old_col0 = plsc->icol0; - plgvpw( &xmin, &xmax, &ymin, &ymax ); // World coordinates for legend plots @@ -144,6 +144,11 @@ text_x_world = normalized_to_world_x( text_x ) + character_width; text_y_world = normalized_to_world_y( text_y ); + // if (opt & PL_LEGEND_TEXT_LEFT) + { + // + } + // Starting y position for legend entries ty = text_y_world - character_height; @@ -190,10 +195,14 @@ plcol0( cmap0_colors[i] ); if ( opt & PL_LEGEND_LINE ) { + pllsty( line_style[i]) ; + plwid( line_width[i] ); plline( 2, xl, yl ); // prepare for the next position yl[0] = ty; yl[1] = ty; + pllsty( old_line_style ); + plwid( old_line_width ); } if ( opt & PL_LEGEND_SYMBOL ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-09-21 23:01:31
|
Revision: 11194 http://plplot.svn.sourceforge.net/plplot/?rev=11194&view=rev Author: hbabcock Date: 2010-09-21 23:01:24 +0000 (Tue, 21 Sep 2010) Log Message: ----------- Add Alpha value support for plotting in memory. Tested that this does not break the mem or memcairo drivers. Memcairo plotting with alpha values has not yet been tested. Modified Paths: -------------- trunk/drivers/cairo.c trunk/include/plplot.h trunk/include/plstrm.h trunk/src/plcore.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-09-18 23:04:08 UTC (rev 11193) +++ trunk/drivers/cairo.c 2010-09-21 23:01:24 UTC (rev 11194) @@ -2389,6 +2389,7 @@ pls->xlength = pls->phyxma; pls->ylength = pls->phyyma; + /* Setup the PLStream and the font lookup table */ aStream = stream_and_font_setup( pls, 0 ); @@ -2424,6 +2425,7 @@ /* 32 bit word order * cairo mem: Big endian: 0=A, 1=R, 2=G, 3=B * Little endian: 3=A, 2=R, 1=G, 0=B */ + if ( aStream->bigendian ) { for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) @@ -2431,8 +2433,14 @@ cairo_mem[1] = input_mem[0]; /* R */ cairo_mem[2] = input_mem[1]; /* G */ cairo_mem[3] = input_mem[2]; /* B */ - input_mem += 3; - cairo_mem += 4; + if ( pls->dev_mem_alpha ){ + cairo_mem[0] = input_mem[3]; + input_mem += 4; + } + else { + input_mem += 3; + } + cairo_mem += 4; } } else @@ -2442,8 +2450,14 @@ cairo_mem[2] = input_mem[0]; /* R */ cairo_mem[1] = input_mem[1]; /* G */ cairo_mem[0] = input_mem[2]; /* B */ - input_mem += 3; - cairo_mem += 4; + if ( pls->dev_mem_alpha ){ + cairo_mem[3] = input_mem[3]; + input_mem += 4; + } + else { + input_mem += 3; + } + cairo_mem += 4; } } @@ -2492,7 +2506,13 @@ memory[0] = cairo_surface_data[1]; /* R */ memory[1] = cairo_surface_data[2]; /* G */ memory[2] = cairo_surface_data[3]; /* B */ - memory += 3; + if ( pls->dev_mem_alpha ){ + memory[3] = cairo_surface_data[0]; + memory += 4; + } + else { + memory += 3; + } cairo_surface_data += 4; } } @@ -2503,7 +2523,13 @@ memory[0] = cairo_surface_data[2]; /* R */ memory[1] = cairo_surface_data[1]; /* G */ memory[2] = cairo_surface_data[0]; /* B */ - memory += 3; + if ( pls->dev_mem_alpha ){ + memory[3] = cairo_surface_data[3]; + memory += 4; + } + else { + memory += 3; + } cairo_surface_data += 4; } } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-18 23:04:08 UTC (rev 11193) +++ trunk/include/plplot.h 2010-09-21 23:01:24 UTC (rev 11194) @@ -751,6 +751,7 @@ #define plslabelfunc c_plslabelfunc #define plsmaj c_plsmaj #define plsmem c_plsmem +#define plsmema c_plsmema #define plsmin c_plsmin #define plsori c_plsori #define plspage c_plspage Modified: trunk/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2010-09-18 23:04:08 UTC (rev 11193) +++ trunk/include/plstrm.h 2010-09-21 23:01:24 UTC (rev 11194) @@ -187,6 +187,7 @@ * page PLINT Page count for output stream * linepos PLINT Line count for output stream * pdfs PDFstrm* PDF stream pointer + * dev_mem_alpha PLINT The user supplied memory buffer supports alpha values * * These are used by the escape function (for area fill, etc). * @@ -775,6 +776,7 @@ //CONSTANT SOVERSION FIX PLBOOL stream_closed; PLINT line_style; + PLINT dev_mem_alpha; } PLStream; /*--------------------------------------------------------------------------*\ Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-09-18 23:04:08 UTC (rev 11193) +++ trunk/src/plcore.c 2010-09-21 23:01:24 UTC (rev 11194) @@ -3456,9 +3456,20 @@ c_plsmem( PLINT maxx, PLINT maxy, void *plotmem ) { plsc->dev = plotmem; + plsc->dev_mem_alpha = 0; plP_setphy( 0, maxx, 0, maxy ); } +/* Same as plsmem, but the buffer is (Y, X, RGBA) */ + +void +c_plsmema( PLINT maxx, PLINT maxy, void *plotmem ) +{ + plsc->dev = plotmem; + plsc->dev_mem_alpha = 1; + plP_setphy( 0, maxx, 0, maxy ); +} + /* Get the current stream pointer */ void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-09-22 14:14:17
|
Revision: 11196 http://plplot.svn.sourceforge.net/plplot/?rev=11196&view=rev Author: hbabcock Date: 2010-09-22 14:14:07 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Add plsmema() support to the Python language bindings. Make the if statements in the memcairo driver more explicit. Modified Paths: -------------- trunk/bindings/swig-support/plplotcapi.i trunk/drivers/cairo.c Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2010-09-21 23:05:25 UTC (rev 11195) +++ trunk/bindings/swig-support/plplotcapi.i 2010-09-22 14:14:07 UTC (rev 11196) @@ -780,6 +780,10 @@ void plsmem(PLINT maxx, PLINT maxy, void *plotmem); +%feature("autodoc", "Similar to plsmem(), but supports alpha values.") plsmema; +void +plsmema(PLINT maxx, PLINT maxy, void *plotmem); + #endif %feature("autodoc", "Set up lengths of minor tick marks.") plsmin; Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-09-21 23:05:25 UTC (rev 11195) +++ trunk/drivers/cairo.c 2010-09-22 14:14:07 UTC (rev 11196) @@ -2433,7 +2433,7 @@ cairo_mem[1] = input_mem[0]; /* R */ cairo_mem[2] = input_mem[1]; /* G */ cairo_mem[3] = input_mem[2]; /* B */ - if ( pls->dev_mem_alpha ){ + if ( pls->dev_mem_alpha == 1){ cairo_mem[0] = input_mem[3]; input_mem += 4; } @@ -2450,7 +2450,7 @@ cairo_mem[2] = input_mem[0]; /* R */ cairo_mem[1] = input_mem[1]; /* G */ cairo_mem[0] = input_mem[2]; /* B */ - if ( pls->dev_mem_alpha ){ + if ( pls->dev_mem_alpha == 1){ cairo_mem[3] = input_mem[3]; input_mem += 4; } @@ -2506,7 +2506,7 @@ memory[0] = cairo_surface_data[1]; /* R */ memory[1] = cairo_surface_data[2]; /* G */ memory[2] = cairo_surface_data[3]; /* B */ - if ( pls->dev_mem_alpha ){ + if ( pls->dev_mem_alpha == 1){ memory[3] = cairo_surface_data[0]; memory += 4; } @@ -2523,7 +2523,7 @@ memory[0] = cairo_surface_data[2]; /* R */ memory[1] = cairo_surface_data[1]; /* G */ memory[2] = cairo_surface_data[0]; /* B */ - if ( pls->dev_mem_alpha ){ + if ( pls->dev_mem_alpha == 1){ memory[3] = cairo_surface_data[3]; memory += 4; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-09-22 14:40:40
|
Revision: 11198 http://plplot.svn.sourceforge.net/plplot/?rev=11198&view=rev Author: hbabcock Date: 2010-09-22 14:40:34 +0000 (Wed, 22 Sep 2010) Log Message: ----------- Turn the memcairo driver ON by default. Add a note about plsmema to the README.release file. Modified Paths: -------------- trunk/README.release trunk/cmake/modules/drivers-init.cmake Modified: trunk/README.release =================================================================== --- trunk/README.release 2010-09-22 14:28:41 UTC (rev 11197) +++ trunk/README.release 2010-09-22 14:40:34 UTC (rev 11198) @@ -188,6 +188,9 @@ 1. Changes relative to PLplot 5.9.6 (the previous development release) +1.1 Alpha value support for plotting in memory. + + 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed @@ -234,6 +237,7 @@ 2.40 Universal coordinate transform implemented 2.41 Support for arbitrary storage of 2D user data 2.42 Font improvements +2.42 Alpha value support for plotting in memory. 0. Tests made for release 5.9.7 @@ -244,7 +248,16 @@ 1. Changes relative to PLplot 5.9.6 (the previous development release) +1.1 Alpha value support for plotting in memory. +The function plsmema() was added to the PLplot API. This allows the user +to supply a RGBA formatted array that PLplot can use to do in memory +plotting with alpha value support. At present only the memcairo device +is capable of using RGBA formatted memory. The mem device, at least +for the time being, only supports RGB formatted memory and will exit +if the user attempts to give it RGBA formatted memory to plot in. + + 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed @@ -904,3 +917,11 @@ versa) whenever there is a glyph lookup failure in the Type1 font device drivers (ps and pdf). +2.42 Alpha value support for plotting in memory. + +The function plsmema() was added to the PLplot API. This allows the user +to supply a RGBA formatted array that PLplot can use to do in memory +plotting with alpha value support. At present only the memcairo device +is capable of using RGBA formatted memory. The mem device, at least +for the time being, only supports RGB formatted memory and will exit +if the user attempts to give it RGBA formatted memory to plot in. Modified: trunk/cmake/modules/drivers-init.cmake =================================================================== --- trunk/cmake/modules/drivers-init.cmake 2010-09-22 14:28:41 UTC (rev 11197) +++ trunk/cmake/modules/drivers-init.cmake 2010-09-22 14:40:34 UTC (rev 11198) @@ -127,9 +127,7 @@ set(DRIVERS_DEVICE_LIST "aqt:aqt:ON:I:OFF" - # memcairo does not work so turn it off by default. - # The remaining cairo devices work well so turn them on by default. - "memcairo:cairo:OFF:M:OFF" + "memcairo:cairo:ON:M:OFF" "extcairo:cairo:ON:E:OFF" "pdfcairo:cairo:ON:F:OFF" "pngcairo:cairo:ON:F:ON" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-09-23 17:28:34
|
Revision: 11203 http://plplot.svn.sourceforge.net/plplot/?rev=11203&view=rev Author: hbabcock Date: 2010-09-23 17:28:27 +0000 (Thu, 23 Sep 2010) Log Message: ----------- Add a Qt based memory plotting device (memqt) for symmetry purposes. This is the Qt equivalent of the memcairo device. A python example program, test_memqt.py is also added to demonstrate how to use it. Modified Paths: -------------- trunk/README.release trunk/cmake/modules/drivers-init.cmake trunk/drivers/qt.cpp trunk/examples/python/CMakeLists.txt trunk/include/drivers.h trunk/include/plDevs.h.cmake trunk/include/plcore.h trunk/include/qt.h Modified: trunk/README.release =================================================================== --- trunk/README.release 2010-09-22 22:16:18 UTC (rev 11202) +++ trunk/README.release 2010-09-23 17:28:27 UTC (rev 11203) @@ -189,6 +189,7 @@ 1. Changes relative to PLplot 5.9.6 (the previous development release) 1.1 Alpha value support for plotting in memory. +1.2 Add a Qt device for in memory plotting. 2. Changes relative to PLplot 5.8.0 (the previous stable release) @@ -238,6 +239,7 @@ 2.41 Support for arbitrary storage of 2D user data 2.42 Font improvements 2.42 Alpha value support for plotting in memory. +2.43 Add a Qt device for in memory plotting. 0. Tests made for release 5.9.7 @@ -257,7 +259,12 @@ for the time being, only supports RGB formatted memory and will exit if the user attempts to give it RGBA formatted memory to plot in. +1.2 Add a Qt device for in memory plotting. +A new device called memqt has been added for in memory plotting using +Qt. This device is the Qt equivalent of the memcairo device. + + 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed @@ -925,3 +932,8 @@ is capable of using RGBA formatted memory. The mem device, at least for the time being, only supports RGB formatted memory and will exit if the user attempts to give it RGBA formatted memory to plot in. + +2.43 Add a Qt device for in memory plotting. + +A new device called memqt has been added for in memory plotting using +Qt. This device is the Qt equivalent of the memcairo device. \ No newline at end of file Modified: trunk/cmake/modules/drivers-init.cmake =================================================================== --- trunk/cmake/modules/drivers-init.cmake 2010-09-22 22:16:18 UTC (rev 11202) +++ trunk/cmake/modules/drivers-init.cmake 2010-09-23 17:28:27 UTC (rev 11203) @@ -150,6 +150,7 @@ "ppmqt:qt:ON:F:ON" "tiffqt:qt:ON:F:ON" "extqt:qt:ON:E:OFF" + "memqt:qt:ON:E:OFF" # Currently does not validate at http://validator.w3.org/, but that appears # to be a result of the validator being unfamiliar with SVG-1.2 (a draft # SVG standard that has not been finalized yet) which is produced Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2010-09-22 22:16:18 UTC (rev 11202) +++ trunk/drivers/qt.cpp 2010-09-23 17:28:27 UTC (rev 11203) @@ -73,6 +73,9 @@ #if defined ( PLD_extqt ) "extqt:External Qt driver:0:qt:75:extqt\n" #endif +#if defined ( PLD_memqt ) + "memqt:Memory Qt driver:0:qt:76:memqt\n" +#endif ; } // extern "C" @@ -139,7 +142,7 @@ } // Declaration of the driver-specific interface functions -#if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) +#if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) || defined ( PLD_memqt ) void plD_init_rasterqt( PLStream * ); void plD_eop_rasterqt( PLStream * ); void plD_line_rasterqt( PLStream *, short, short, short, short ); @@ -229,8 +232,15 @@ void plD_bop_extqt( PLStream * ); #endif +#if defined ( PLD_memqt ) +void plD_dispatch_init_memqt( PLDispatchTable *pdt ); +void plD_init_memqt( PLStream * ); +void plD_bop_memqt( PLStream * ); +void plD_eop_memqt( PLStream * ); +#endif + ////////////////// Raster driver-specific definitions: class and interface functions ///////// -#if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) +#if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) || defined ( PLD_memqt ) void plD_init_rasterqt( PLStream * pls ) { double dpi; @@ -312,6 +322,7 @@ void plD_line_rasterqt( PLStream * pls, short x1a, short y1a, short x2a, short y2a ) { QtRasterDevice* widget = (QtRasterDevice*) pls->dev; + if ( widget != NULL && qt_family_check( pls ) ) { return; @@ -326,6 +337,7 @@ void plD_polyline_rasterqt( PLStream *pls, short *xa, short *ya, PLINT npts ) { QtRasterDevice * widget = (QtRasterDevice *) pls->dev; + if ( widget != NULL && qt_family_check( pls ) ) { return; @@ -1647,3 +1659,144 @@ widget->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } #endif + +#if defined ( PLD_memqt ) +void plD_dispatch_init_memqt( PLDispatchTable *pdt ) +{ +#ifndef ENABLE_DYNDRIVERS + pdt->pl_MenuStr = "Qt Memory Driver"; + pdt->pl_DevName = "memqt"; +#endif + pdt->pl_type = plDevType_FileOriented; + pdt->pl_seq = 76; + pdt->pl_init = (plD_init_fp) plD_init_memqt; + pdt->pl_line = (plD_line_fp) plD_line_rasterqt; + pdt->pl_polyline = (plD_polyline_fp) plD_polyline_rasterqt; + pdt->pl_eop = (plD_eop_fp) plD_eop_memqt; + pdt->pl_bop = (plD_bop_fp) plD_bop_memqt; + pdt->pl_tidy = (plD_tidy_fp) plD_tidy_rasterqt; + pdt->pl_state = (plD_state_fp) plD_state_rasterqt; + pdt->pl_esc = (plD_esc_fp) plD_esc_rasterqt; +} + +void plD_init_memqt( PLStream * pls ) +{ + int i; + double dpi; + unsigned char *qt_mem; + unsigned char *input_mem; + + vectorize = 0; + lines_aa = 1; + plParseDrvOpts( qt_options ); + + /* Stream setup */ + pls->color = 1; + pls->plbuf_write = 0; + pls->dev_fill0 = 1; + pls->dev_fill1 = 0; + pls->dev_gradient = 1; /* driver renders gradient */ + /* Let the PLplot core handle dashed lines since + * the driver results for this capability have a number of issues. + * pls->dev_dash=1; */ + pls->dev_dash = 0; + pls->dev_flush = 1; + /* Driver does not have a clear capability so use (good) PLplot core + * fallback for that instead. */ + pls->dev_clear = 0; + pls->termin = 0; + pls->page = 0; + pls->dev_text = 1; // want to draw text + pls->dev_unicode = 1; // want unicode + + // Needs to be true only because of multi-stream case + bool isMaster = initQtApp( true ); + + if ( pls->xdpi <= 0. ) + dpi = DEFAULT_DPI; + else + dpi = pls->xdpi; + + /* Set the plot size to the memory buffer size, on the off chance + * that they are different. */ + pls->xlength = pls->phyxma; + pls->ylength = pls->phyyma; + + /* Save a pointer to the user supplied memory */ + input_mem = (unsigned char *)pls->dev; + + /* Create a appropriately sized raster device */ + pls->dev = new QtRasterDevice( pls->xlength, pls->ylength ); + ( (QtRasterDevice *) pls->dev )->setPLStream( pls ); + ( (QtRasterDevice *) pls->dev )->memory = input_mem; + + if ( isMaster ) + handler.setMasterDevice( (QtRasterDevice*) ( pls->dev ) ); + + if ( pls->xlength > pls->ylength ) + ( (QtRasterDevice*) ( pls->dev ) )->downscale = (PLFLT) pls->xlength / (PLFLT) ( PIXELS_X - 1 ); + else + ( (QtRasterDevice*) ( pls->dev ) )->downscale = (PLFLT) pls->ylength / (PLFLT) PIXELS_Y; + + plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / ( (QtRasterDevice*) ( pls->dev ) )->downscale ), (PLINT) 0, (PLINT) ( pls->ylength / ( (QtRasterDevice*) ( pls->dev ) )->downscale ) ); + + plP_setpxl( dpi / 25.4 / ( (QtRasterDevice*) ( pls->dev ) )->downscale, dpi / 25.4 / ( (QtRasterDevice*) ( pls->dev ) )->downscale ); + + /* Copy the user supplied memory into the QImage. + This device assumes that the format of the QImage + is RGB32 (or ARGB). */ + + qt_mem = ( (QtRasterDevice *) pls->dev )->scanLine(0); + + for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) + { + qt_mem[2] = input_mem[0]; /* R */ + qt_mem[1] = input_mem[1]; /* G */ + qt_mem[0] = input_mem[2]; /* B */ + if ( pls->dev_mem_alpha == 1){ + qt_mem[3] = input_mem[3]; + input_mem += 4; + } + else { + input_mem += 3; + } + qt_mem += 4; + } + + ( (QtRasterDevice*) ( pls->dev ) )->setResolution( dpi ); + + /* This is set so the we'll always make it past the qt_family_check(). */ + pls->family = true; +} + +void plD_bop_memqt( PLStream *pls ) +{ + /* Do nothing to preserve user data */ +} + +void plD_eop_memqt( PLStream *pls ) +{ + int i; + unsigned char *memory; + unsigned char *qt_mem; + + memory = ( (QtRasterDevice *) pls->dev )->memory; + qt_mem = ( (QtRasterDevice *) pls->dev )->scanLine(0); + + for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) + { + memory[0] = qt_mem[2]; /* R */ + memory[1] = qt_mem[1]; /* G */ + memory[2] = qt_mem[0]; /* B */ + if ( pls->dev_mem_alpha == 1){ + memory[3] = qt_mem[3]; + memory += 4; + } + else { + memory += 3; + } + qt_mem += 4; + } +} + +#endif Modified: trunk/examples/python/CMakeLists.txt =================================================================== --- trunk/examples/python/CMakeLists.txt 2010-09-22 22:16:18 UTC (rev 11202) +++ trunk/examples/python/CMakeLists.txt 2010-09-23 17:28:27 UTC (rev 11203) @@ -88,6 +88,7 @@ test_hebrew_diacritic.py test_mem.py test_memcairo.py + test_memqt.py ) if(ENABLE_tk) Modified: trunk/include/drivers.h =================================================================== --- trunk/include/drivers.h 2010-09-22 22:16:18 UTC (rev 11202) +++ trunk/include/drivers.h 2010-09-23 17:28:27 UTC (rev 11203) @@ -108,6 +108,7 @@ PLDLLIMPEXP_DRIVER void plD_dispatch_init_pdfqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_qtwidget( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_extqt( PLDispatchTable *pdt ); +PLDLLIMPEXP_DRIVER void plD_dispatch_init_memqt( PLDispatchTable *pdt ); /* Prototypes for plot buffer calls. */ Modified: trunk/include/plDevs.h.cmake =================================================================== --- trunk/include/plDevs.h.cmake 2010-09-22 22:16:18 UTC (rev 11202) +++ trunk/include/plDevs.h.cmake 2010-09-23 17:28:27 UTC (rev 11203) @@ -96,5 +96,6 @@ #cmakedefine PLD_pdfqt #cmakedefine PLD_qtwidget #cmakedefine PLD_extqt +#cmakedefine PLD_memqt #endif /* __PLDEVS_H__ */ Modified: trunk/include/plcore.h =================================================================== --- trunk/include/plcore.h 2010-09-22 22:16:18 UTC (rev 11202) +++ trunk/include/plcore.h 2010-09-23 17:28:27 UTC (rev 11203) @@ -330,6 +330,9 @@ #if defined ( PLD_extqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_extqt, #endif +#if defined ( PLD_memqt ) && !defined ( ENABLE_DYNDRIVERS ) + plD_dispatch_init_memqt, +#endif NULL }; Modified: trunk/include/qt.h =================================================================== --- trunk/include/qt.h 2010-09-22 22:16:18 UTC (rev 11202) +++ trunk/include/qt.h 2010-09-23 17:28:27 UTC (rev 11203) @@ -180,6 +180,8 @@ setDotsPerMeterX( (int) ( ( dotsPerInch / 25.4 ) * 1000. ) ); setDotsPerMeterY( (int) ( ( dotsPerInch / 25.4 ) * 1000. ) ); } + /* used by the memqt driver */ + unsigned char *memory; protected: char format[5]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-23 18:47:07
|
Revision: 11205 http://plplot.svn.sourceforge.net/plplot/?rev=11205&view=rev Author: airwin Date: 2010-09-23 18:47:00 +0000 (Thu, 23 Sep 2010) Log Message: ----------- Remove all references to the retired gnome and gnome2 bindings and the retired gcw device and associated plplotcanvas applications from the documentation. Modified Paths: -------------- trunk/doc/docbook/src/advanced.xml trunk/doc/docbook/src/drivers.xml trunk/doc/docbook/src/gui.xml trunk/doc/docbook/src/libraries.xml trunk/examples/c/README.plplotcanvas Modified: trunk/doc/docbook/src/advanced.xml =================================================================== --- trunk/doc/docbook/src/advanced.xml 2010-09-23 17:30:18 UTC (rev 11204) +++ trunk/doc/docbook/src/advanced.xml 2010-09-23 18:47:00 UTC (rev 11205) @@ -175,8 +175,6 @@ <row><entry>Conex vt320/tek emulator</entry><entry>conex</entry><entry>tek.c</entry></row> <row><entry>DG300 Terminal</entry><entry>dg300</entry><entry>dg300.c</entry></row> <row><entry>NeXT display (unsupported)</entry><entry>nx</entry><entry>next.c</entry></row> - <row><entry>GNOME display</entry><entry>gnome</entry><entry>gnome.c</entry></row> - <row><entry>GNOME Canvas Widget / Display</entry><entry>gcw</entry><entry>gcw.c</entry></row> </tbody> </tgroup> </table> @@ -1696,7 +1694,7 @@ western-European languages) and much better display of characters on computer screens using anti-aliasing and hinting. Unicode fonts are obtained by specifying a command-line option of -drvopt text for - the devices (currently ps, psc, png, jpeg, gif, gcw, and wingcc) + the devices (currently ps, psc, png, jpeg, gif, and wingcc) where it has been implemented. </para> <para> Modified: trunk/doc/docbook/src/drivers.xml =================================================================== --- trunk/doc/docbook/src/drivers.xml 2010-09-23 17:30:18 UTC (rev 11204) +++ trunk/doc/docbook/src/drivers.xml 2010-09-23 18:47:00 UTC (rev 11205) @@ -90,216 +90,7 @@ </para> </sect1> - <!-- ================================================================== --> - <!-- GCW --> - - <sect1 id="gcw-driver"> - <title>The GCW Driver (Gnome 2)</title> - - <para> - The GCW driver draws plots into a tabbed Gnome window. The driver's - features and user interface are described in - <xref linkend="gcw-driver-basics" />. A specialized API allows - interaction with the driver, and this is described in - <xref linkend="gcw-driver-api" />. - </para> - - <!-- GCW Driver Basics --> - - <sect2 id="gcw-driver-basics"> - <title>GCW Driver Basics</title> - - <para> - The GCW driver plots each page into an individual tab within - a Gnome window. The user interface built into the window allows - a variety of actions. In particular, pages can be saved to files - with extensions .ps, .psc, .png, .jpg, and .gif, which correspond - to PLplot output driver devices described in - <xref linkend="output-drivers" />. - </para> - - <para> - The GCW driver supports anti-aliasing and is unicode enabled. - </para> - - <para> - There are a variety of hot keys that may be used in the user interface: - <itemizedlist> - <listitem><para>Arrows : Change page</para></listitem> - <listitem><para>+ : Zooms in</para></listitem> - <listitem><para>- : Zooms out</para></listitem> - <listitem><para>= : Zooms to 100%</para></listitem> - <listitem><para>q : Quits</para></listitem> - </itemizedlist> - </para> - - <para> - The available driver options (used with the - <parameter>-drvopt</parameter> command-line argument) are: - <itemizedlist> - <listitem><para> - text: Use TrueType fonts (0|1); default 1 - </para></listitem> - <listitem><para> - pixmap: Use pixmap for plotting lines and shades (0|1); - default 1 - </para></listitem> - <listitem><para> - hrshsym: Use Hershey symbol set (0|1); default 0 - </para></listitem> - </itemizedlist> - </para> - - <para> - The <parameter>text</parameter> option toggles between TrueType and - Hershey fonts. The Hershey fonts provide a reference implementation - for text representation in PLplot. - </para> - - <para> - The <parameter>hrshsym</parameter> option is used to indicate that - symbols should be drawn using the Hershey fonts. This is - useful when plots need to be saved to PostScript files, because - the Type I fonts used by the PS and PSC devices do not support all - Unicode symbols. - </para> - - <para> - Most of the command-line arguments described in - <xref linkend="arguments" /> are also supported. Some key arguments - for use with the GCW driver are: - <itemizedlist> - <listitem><para> - geometry geom: Sets page size, in pixels (e.g. -geometry 400x300) - </para></listitem> - <listitem><para> - nopixmap: Disables pixmap usage for plotting lines and shades - </para></listitem> - <listitem><para> - portrait: Sets portrait mode (both orientation and aspect ratio) - </para></listitem> - </itemizedlist> - </para> - - <para> - The <parameter>nopixmap</parameter> option disables the use of - the internal pixmap for drawing lines and shades, which will - normally appear somewhat pixelated. The - <parameter>nopixmap</parameter> option directs the driver to use - anti-aliased vector graphics instead, resulting in higher quality - plots but rendered at a slower speed. This option does not affect - the quality of plots saved from the GCW user interface. Note that - the TrueType fonts are always anti-aliased. - </para> - - </sect2> - - - <!-- GCW Driver API --> - - <sect2 id="gcw-driver-api"> - <title>GCW Driver API</title> - - <para> - The GCW driver provides an additional API that allows for a higher - degree of control by the user. The C API is described below, and - bindings to other languages are described in - *** NEEDS DOCUMENTATION ***. - </para> - - <para> - The function prototypes are defined in <filename>gcw.h</filename>. - Programs that need access to this API must be linked against the - libplplotgnome2d library rather than libplplotd. This is most easily - accomplished using pkg-config; i.e., - - <programlisting> - gcc x01c.c -o x01c `pkg-config --cflags --libs plplotd-gnome2` - </programlisting> - - You may need to remind pkg-config where to look for the - plplotd-gnome2 file installed by PLplot; e.g., - - <programlisting> - gcc x01c.c -o x01c `PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --cflags --libs plplotd-gnome2` - </programlisting> - </para> - - - <!-- gcw_use_text --> - - <sect3 id="gcw_use_text"> - <title><function>gcw_use_text</function>: Sets font usage.</title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function>void gcw_use_text</function></funcdef> - <paramdef><parameter>use_text</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Sets whether TrueType text or Hershey fonts are used. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>use_text</parameter> (<literal>PLINT</literal>, input) - </term> - <listitem><para> - 1 for TrueType fonts (default), 0 for Hershey fonts. - </para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - - <!-- gcw_use_pixmap --> - - <sect3 id="gcw_use_pixmap"> - <title><function>gcw_use_pixmap</function>Sets pixmap usage.</title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function>void gcw_use_pixmap</function></funcdef> - <paramdef><parameter>use_pixmap</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Sets whether lines and shades are drawn to a pixmap, - or instead as vector graphics. - </para> - - <para> - Lines and shade drawn to the pixmap may appear pixelated. - Vector graphics are fully anti-aliased, but are rendered at a - slower speed. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>use_pixmap</parameter> - (<literal>PLINT</literal>, input) - </term> - <listitem><para> - 1 to use pixmap (default), 0 for vector graphics instead. - </para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - </sect2> - </sect1> - - - - <!-- ================================================================== --> <!-- TK --> @@ -349,7 +140,7 @@ <para> The wxWidgets driver plots in a Frame provided by the wxWidgets library. The driver is quite complete but lacks many of the GUI - features of the TK or GCW drivers. All plots are available at once + features of the TK driver. All plots are available at once an one can switch between all plots by pressing Alt-n. The application can be quit with Alt-x. These functions are also available in the menu. After the last plot one will advance again Modified: trunk/doc/docbook/src/gui.xml =================================================================== --- trunk/doc/docbook/src/gui.xml 2010-09-23 17:30:18 UTC (rev 11204) +++ trunk/doc/docbook/src/gui.xml 2010-09-23 18:47:00 UTC (rev 11205) @@ -36,594 +36,11 @@ <title>Embedding Plots in Graphical User Interfaces</title> <para> - This chapter describes how to embed plots in graphical user interfaces. + This chapter should describe how to embed plots in graphical user + interfaces. <xref linkend="extended-wish" /> does that for Tk, but + embedding plots in GTK+ and Qt GUI's NEEDS DOCUMENTATION. Until + that GTK+ and QT4 documentation is prepared, look at + examples/c/README.cairo and examples/c++/README.qt_example for + some proof-of-concept examples. </para> - - - <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> - <!-- PLPLOTCANVAS --> - - <sect1 id="plplotcanvas"> - <title>The PlplotCanvas Widget for Gnome/GTK Applications</title> - - <para> - Plots can be embedded into Gnome/GTK applications by using the - PlplotCanvas widget. Information on the GTK toolkit is provided - at http://www.gtk.org/. PlplotCanvas is a subclass of the GnomeCanvas - (see http://developer.gnome.org/doc/API/2.0/libgnomecanvas/index.html), - and so includes all of its functionality. The specialized C API for - PlplotCanvas is described in - <xref linkend="plplotcanvas-api" />, and bindings to other languages - are described in *** NEEDS DOCUMENTATION ***. - </para> - - - <!-- PlplotCanvas Basics --> - - <sect2 id="plplotcanvas-basics"> - <title>PlplotCanvas Basics</title> - - <para> - The method declarations and data structures are defined in - <filename>plplotcanvas.h</filename>. Programs using the PlplotCanvas - widget must be linked against the - <filename>libplplotgnome2d</filename> library - rather than <filename>libplplotd</filename>. This is most easily - accomplished using pkg-config; i.e., - - <programlisting> - gcc plplotcanvas_demo.c -o plplotcanvas_demo `pkg-config --cflags --libs plplotd-gnome2` - </programlisting> - - You may need to remind pkg-config where to look for the - <filename>plplotd-gnome2.pc</filename> file installed by PLplot; e.g., - - <programlisting> - gcc plplotcanvas_demo.c -o plplotcanvas_demo `PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --cflags --libs plplotd-gnome2` - </programlisting> - </para> - - <para> - A specialized API is provided for PlplotCanvas and is described in - <xref linkend="plplotcanvas-api" />. The API provides methods - to create and manipulate PlplotCanvas widgets, in addition to - object-oriented analogues for each of the PLplot functions. - </para> - - <para> - Example programs are provided that demonstrate the use of the - PlplotCanvas widget in <xref linkend="plplotcanvas-examples" />. - </para> - - </sect2> - - - <!-- ================================================================== --> - - <sect2 id="plplotcanvas-api"> - <title>PlplotCanvas API</title> - - <para> - The PlplotCanvas methods are as follows. Because PlplotCanvas is a - GTK widget, GLib types (gint, gdouble, gboolean, etc) are sometimes - used rather than PLplot types (PLINT, PLFLT, etc). See - http://developer.gnome.org/doc/API/2.0/glib/index.html for more - information on GLib and GLib types. - </para> - - <!-- plplot_canvas_new --> - - <sect3 id="plplot_canvas_new"> - - <title> - <function>plplot_canvas_new</function>: Creates a new PlplotCanvas. - </title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function> - PlplotCanvas* plplot_canvas_new - </function></funcdef> - <paramdef><parameter>void</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Returns a pointer to a new PlplotCanvas widget. Methods that - apply to a PlplotCanvas are given next. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>void</parameter> - </term> - <listitem><para> - There are no arguments for this method. - </para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - - <!-- plplot_canvas_plfunc --> - - <sect3 id="plplot_canvas_plfunc"> - <title> - <function>plplot_canvas_plfunc</function>: PLplot function analogues. - </title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function>void plplot_canvas_plfunc</function></funcdef> - <paramdef><parameter>canvas</parameter></paramdef> - <paramdef><parameter>...</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - The PLplot functions have analogue methods named like - <function>plplot_canvas_plfunc</function>. For example, the - PLplot function &plline; maps to - <function>plplot_canvas_plline</function>. The - <function>plplot_canvas_plfunc</function> methods - should be used rather than the standard PLplot API when the - PlplotCanvas is used. - </para> - - <para> - Lines drawn to the canvas are not shown until the page is - advanced using <function>plplot_canvas_pladv</function>. The - plot will remain on the canvas until the next page advance. - </para> - - <para> - The PLplot &plinit; and &plgstrm; functions are not used with - PlplotCanvas because the <function>plplot_canvas_new</function> - function does the necessary initialization and returns an - object with a unique stream number. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>canvas</parameter> - (<literal>PlplotCanvas*</literal>, input) - </term> - <listitem><para>The canvas on which to operate.</para></listitem> - </varlistentry> - <varlistentry> - <term> - <parameter>...</parameter> - </term> - <listitem><para> - The list of arguments from the PLplot function analogue. The - same types used in the PLplot function are used here. - </para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - - <!-- plplot_canvas_dispose --> - - <sect3 id="plplot_canvas_dispose"> - <title> - <function>plplot_canvas_dispose</function>: Disposes the canvas. - </title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function>void plplot_canvas_dispose</function></funcdef> - <paramdef><parameter>canvas</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Disposes the Canvas. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>canvas</parameter> - (<literal>PlplotCanvas*</literal>, input) - </term> - <listitem><para>The canvas to dispose.</para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - - <!-- plplotcanvas_canvas_set_size --> - - <sect3 id ="plplot_canvas_set_size"> - <title> - <function>plplot_canvas_set_size</function>: Sets the canvas size. - </title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function> - void plplot_canvas_set_size - </function></funcdef> - <paramdef><parameter>canvas</parameter></paramdef> - <paramdef><parameter>width</parameter></paramdef> - <paramdef><parameter>height</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Sets the PlplotCanvas widget width and height. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>canvas</parameter> - (<literal>PlplotCanvas*</literal>, input) - </term> - <listitem><para>The PlplotCanvas to size.</para></listitem> - </varlistentry> - <varlistentry> - <term> - <parameter>width</parameter> (<literal>gint</literal>, input) - </term> - <listitem><para>The width, in pixels.</para></listitem> - </varlistentry> - <varlistentry> - <term> - <parameter>height</parameter> (<literal>gint</literal>, input) - </term> - <listitem><para>The height, in pixels.</para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - - <!-- plplot_canvas_use_text --> - - <sect3 id="plplot_canvas_use_text"> - <title> - <function>plplot_canvas_use_text</function>: Sets text handling. - </title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function>void plplot_canvas_use_text</function></funcdef> - <paramdef><parameter>canvas</parameter></paramdef> - <paramdef><parameter>use_text</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Sets whether TrueType text or Hershey fonts are used by the - PlplotCanvas widget. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>canvas</parameter> - (<literal>PlplotCanvas*</literal>, input) - </term> - <listitem><para>The PlplotCanvas to set.</para></listitem> - </varlistentry> - <varlistentry> - <term> - <parameter>use_text</parameter> - (<literal>gboolean</literal>, input) - </term> - <listitem><para> - TRUE for TrueType fonts (default), FALSE for Hershey fonts. - </para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - - <!-- plplot_canvas_use_pixmap --> - - <sect3 id="plplot_canvas_use_pixmap"> - <title> - <function>plplot_canvas_use_pixmap</function>: Sets pixmap usage. - </title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function>void plplot_canvas_use_pixmap</function></funcdef> - <paramdef><parameter>canvas</parameter></paramdef> - <paramdef><parameter>use_pixmap</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Sets whether lines and shades are drawn to a pixmap, - or instead as vector graphics. - </para> - - <para> - Lines and shade drawn to the pixmap are not anti-aliased, and so may - appear pixelated. Vector graphics are fully anti-aliased, but are - rendered at a slower speed. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>canvas</parameter> - (<literal>PlplotCanvas*</literal>, input) - </term> - <listitem><para>The PlplotCanvas to set.</para></listitem> - </varlistentry> - <varlistentry> - <term> - <parameter>use_pixmap</parameter> - (<literal>gboolean</literal>, input) - </term> - <listitem><para> - TRUE to use pixmap (default), FALSE for vector graphics instead. - </para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - - <!-- plplot_canvas_use_persistence --> - - <sect3 id="plplot_canvas_use_persistence"> - <title> - <function>plplot_canvas_use_persistence</function>: Sets persistence - of subsequent drawing operations. - </title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function> - void plplot_canvas_use_persistence - </function></funcdef> - <paramdef><parameter>canvas</parameter></paramdef> - <paramdef><parameter>use_persistence</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Sets whether the subsequent drawing commands are persistent, - or refreshed when the PLplot page is advanced. This feature - is useful for plot animations, because the axes can be persistent - rather than redrawn for each frame. - </para> - - <para> - Note that lines that are persistent are always anti-aliased and - drawn at the front. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>canvas</parameter> - (<literal>PlplotCanvas*</literal>, input) - </term> - <listitem><para>The PlplotCanvas to set.</para></listitem> - </varlistentry> - <varlistentry> - <term> - <parameter>use_persistence</parameter> - (<literal>gboolean</literal>, input) - </term> - <listitem><para> - TRUE for persistence, FALSE for erasing at new page (default). - </para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - - <!-- plplot_canvas_get_stream_number --> - - <sect3 id="plplot_canvas_get_stream_number"> - <title> - <function>plplot_canvas_get_stream_number</function>: Retrieves the - PLplot stream number. - </title> - - <para> - <funcsynopsis><funcprototype> - <funcdef><function> - PLINT plplot_canvas_get_stream_number - </function></funcdef> - <paramdef><parameter>canvas</parameter></paramdef> - </funcprototype></funcsynopsis> - </para> - - <para> - Returns the stream number for the given Canvas. Although the - concept of streams that exists in the standard PLplot API is not - used here, the stream number provides a unique ID number for - the given PlplotCanvas widget. - </para> - - <variablelist> - <varlistentry> - <term> - <parameter>canvas</parameter> - (<literal>PlplotCanvas*</literal>, input) - </term> - <listitem><para> - The canvas to retrieve the stream number from. - </para></listitem> - </varlistentry> - </variablelist> - - </sect3> - - </sect2> - - - - <!-- ================================================================== --> - - <sect2 id="plplotcanvas-examples"> - <title>PlplotCanvas Examples</title> - - <para> - - Two example programs are provided that demonstrate the use of the - PlplotCanvas widget. They are: - - <itemizedlist> - <listitem><para> - plplotcanvas_demo: Demonstrates the basic usage of the - PlplotCanvas to embed a plot in a Gnome application. - </para></listitem> - <listitem><para> - plplotcanvas_animation: Demonstrates advanced multi-threaded - dual-stream usage of the PlplotCanvas. - </para></listitem> - </itemizedlist> - </para> - - <para> - The code from plplotcanvas_demo.c is given below, and is explained - in what follows. - </para> - - - <programlisting> - - #include <plplotcanvas.h> - #include <gtk/gtk.h> - - /* The width and height of the plplot canvas widget */ - #define WIDTH 1000 /* 500 */ - #define HEIGHT 600 /* 300 */ - - /* Delete event callback */ - gint delete_event( GtkWidget *widget,GdkEvent *event,gpointer data ) { - return FALSE; - } - - /* Destroy event calback */ - void destroy(GtkWidget *widget,gpointer data) { - gtk_main_quit (); - } - - - int main(int argc,char *argv[] ) - { - - PlplotCanvas* canvas; - GtkWidget *window; - - /* Parse the options */ - plparseopts(&argc, argv, PL_PARSE_FULL); - - /* The data to plot */ - double x[11] = {0,1,2,3,4,5,6,7,8,9,10}; - double y[11] = {0,0.1,0.4,0.9,1.6,2.6,3.6,4.9,6.4,8.1,10}; - - /* Initialize gtk and the glib type system */ - gtk_init(&argc, &argv); - g_type_init(); - - /* Create the canvas and set its size; during the creation process, - * the gcw driver is loaded into plplot, and plinit() is invoked. - */ - canvas=plplot_canvas_new(TRUE); - plplot_canvas_set_size(canvas,WIDTH,HEIGHT); - - /* Create a new window and stuff the canvas into it */ - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_container_set_border_width(GTK_CONTAINER(window),10); - gtk_container_add(GTK_CONTAINER(window),GTK_WIDGET(canvas)); - - /* Connect the signal handlers to the window decorations */ - g_signal_connect(G_OBJECT(window),"delete_event", - G_CALLBACK(delete_event),NULL); - g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(destroy),NULL); - - /* Display everything */ - gtk_widget_show_all(window); - - /* Draw on the canvas with Plplot */ - plplot_canvas_pladv(canvas,0); /* Advance to first page */ - plplot_canvas_plcol0(canvas,15); /* Set color to black */ - plplot_canvas_plwid(canvas,2); /* Set the pen width */ - plplot_canvas_plvsta(canvas); /* Set the viewport */ - plplot_canvas_plwind(canvas,0.,10.,0.,10.); /* Set the window */ - plplot_canvas_plbox(canvas,"bcnst",0.,0,"bcnstv",0.,0); /* Set the box */ - plplot_canvas_pllab(canvas,"x-axis","y-axis","A Simple Plot"); /* Draw some labels */ - - /* Draw the line */ - plplot_canvas_plcol0(canvas,1); /* Set the pen color */ - plplot_canvas_plline(canvas,11,x,y); - - /* Advancing the page finalizes this plot */ - plplot_canvas_pladv(canvas,0); - - /* Start the gtk main loop */ - gtk_main(); - } - </programlisting> - - - <para> - So, what's going on here? After the preliminaries, the GTK and the - GLib type system are initialized by calls to - <function>gtk_init</function> and <function>g_type_init</function>. - A PlplotCanvas is created using - <function>plplot_canvas_new</function>, and it's size is set using - <function>plplot_canvas_set_size</function>. - </para> - - <para> - Next, a window is created (<function>gtk_window_new</function>), - the border is set (<function>gtk_set_border_width</function>), - and the canvas is stuffed into the window - (<function>gtk_container_add</function>). - </para> - - <para> - Callback functions are installed using - <function>g_signal_connect</function> so that the window - decorations respond. The window is set to display everything using - <function>gtk_widget_show_all</function>. - </para> - - <para> - Now come the PLplot analogue commands. First, the page using is - advanced using <function>plplot_canvas_pladv</function>. The pen - color and width are set with <function>plplot_canvas_plcol0</function> - and <function>plplot_canvas_plwid</function>,respectively. The PLplot - viewport, window, box and labels are created using - <function>plplot_canvas_plvpor</function>, - <function>plplot_canvas_plwind</function>, - <function>plplot_canvas_plbox</function> and - <function>plplot_canvas_pllab</function>, respectively. A line is - drawn on the canvas using <function>plplot_canvas_plline</function>, - the page is advanced with <function>plplot_canvas_pladv</function>. - </para> - - <para> - Finally, the GTK main loop is entered using - <function>gtk_main</function>, where it resides until the program - is exited. - </para> - - </sect2> - - </sect1> - - - <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --> - - </chapter> Modified: trunk/doc/docbook/src/libraries.xml =================================================================== --- trunk/doc/docbook/src/libraries.xml 2010-09-23 17:30:18 UTC (rev 11204) +++ trunk/doc/docbook/src/libraries.xml 2010-09-23 18:47:00 UTC (rev 11205) @@ -2,7 +2,7 @@ <!-- libraries.xml: "The PLplot Libraries" chapter -Copyright (C) 2009 Alan W. Irwin +Copyright (C) 2009, 2010 Alan W. Irwin Redistribution and use in source (XML DocBook) and "compiled" forms (HTML, PDF, PostScript, DVI, TeXinfo and so forth) with or without @@ -111,14 +111,6 @@ </row> <row> <entry> - GNOME2 GUI - </entry> - <entry> - libplplotgnome2 - </entry> - </row> - <row> - <entry> Tk GUI </entry> <entry> Modified: trunk/examples/c/README.plplotcanvas =================================================================== --- trunk/examples/c/README.plplotcanvas 2010-09-23 17:30:18 UTC (rev 11204) +++ trunk/examples/c/README.plplotcanvas 2010-09-23 18:47:00 UTC (rev 11205) @@ -2,6 +2,11 @@ PLPLOTCANVAS EXAMPLES ~~~~~~~~~~~~~~~~~~~~~ +N.B. gcw, gnome2, and pygcw have been retired since the 5.9.6 release. +See README.release in the top-level directory for the reasons for this +decision. Therefore, none of what follows (which depends upon gnome2) +will work any more. + The PlplotCanvas examples are: plplotcanvas_demo.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-25 20:30:30
|
Revision: 11210 http://plplot.svn.sourceforge.net/plplot/?rev=11210&view=rev Author: airwin Date: 2010-09-25 20:30:22 +0000 (Sat, 25 Sep 2010) Log Message: ----------- Complete rewrite of pllegend. The API now includes the following: Line, symbol, and cmap0 legends. Line and symbol are completely implemented and tested. cmap0 should be a complete API, but it is not implemented yet. A cmap1 API is still in the planning stages for pllegend. A (semitransparent) background option. Note, the extent of the background depends on the size of the character strings that are rendered so more work is required on plstrl and various device drivers before the background option gives properly aligned results for anything but the Hershey fonts. The text part of the legend has the following overall characteristics: text offset (between text and plot), scale (of vertical height of characters), (vertical) spacing, justification, and (cmap0) color index. Any particular legend index can have any combination of a line, a line of symbols, and/or a cmap0 box. The line characteristics are (cmap0) color index, line style index, and line width. The symbol characteristics are the number of symbols, the (cmap0) color index, and the scale (of vertical height of the symbol). The cmap0 box characteristics are height, (cmap0) color index, and fill pattern style. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-24 04:01:45 UTC (rev 11209) +++ trunk/examples/c/x04c.c 2010-09-25 20:30:22 UTC (rev 11210) @@ -47,9 +47,12 @@ static PLFLT freql[101], ampl[101], phase[101]; PLFLT f0, freq; char *text[2]; - PLINT text_colors[2]; - PLINT cmap0_colors[2]; - PLINT line_style[2], line_width[2], symbols[2]; + PLINT opt_array[2]; + PLINT line_colors[2]; + PLINT line_styles[2]; + PLINT line_widths[2]; + PLINT symbol_colors[2], symbols[2]; + PLFLT symbol_scales[2]; pladv( 0 ); @@ -109,21 +112,30 @@ plmtex( "r", 5.0, 0.5, 0.5, "Phase shift (degrees)" ); // Draw a legend - text[0] = "Amplitude"; - text[1] = "Phase shift"; - text_colors[0] = 1; - text_colors[1] = 1; - cmap0_colors[0] = 2; - cmap0_colors[1] = 3; - line_style[0] = 1; - line_style[1] = 2; - line_width[0] = 8; - line_width[1] = 2; - plssym( 0., 3. ); - symbols[0] = 9; - symbols[1] = 3; - pllegend( PL_LEGEND_LINE | PL_LEGEND_SYMBOL, 0.3, 0.1, 0.95, - 2, text_colors, text, cmap0_colors, line_style, - line_width, 5, symbols ); + opt_array[0] = PL_LEGEND_LINE; + opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; + text[0] = "Amplitude"; + text[1] = "Phase shift"; + line_colors[0] = 2; + line_colors[1] = 3; + line_styles[0] = 1; + line_styles[1] = 2; + line_widths[0] = 1; + line_widths[1] = 1; + symbol_colors[0] = 3; + symbol_colors[1] = 3; + symbol_scales[0] = 1.; + symbol_scales[1] = 1.; + symbols[0] = 9; + symbols[1] = 3; + plscol0a( 15, 255, 255, 255, 0.2 ); + pllegend( PL_LEGEND_BACKGROUND, 0.1, + 0.6, 0.95, 15, + opt_array, 2, + 1., 1.0, 2.0, + 0., 1, text, + line_colors, line_styles, line_widths, + 5, symbol_colors, symbol_scales, symbols, + 0., NULL, NULL ); } } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-24 04:01:45 UTC (rev 11209) +++ trunk/include/plplot.h 2010-09-25 20:30:22 UTC (rev 11210) @@ -1209,17 +1209,23 @@ /* Routine for drawing line, symbol, cmap0, or cmap1 legends */ // Flags for pllegend. -#define PL_LEGEND_LINE 1 -#define PL_LEGEND_SYMBOL 2 -#define PL_LEGEND_CMAP0 4 -#define PL_LEGEND_CMAP1 8 -#define PL_LEGEND_TEXT_LEFT 16 +#define PL_LEGEND_LINE 1 +#define PL_LEGEND_SYMBOL 2 +#define PL_LEGEND_CMAP0 4 +#define PL_LEGEND_CMAP1 8 +#define PL_LEGEND_TEXT_LEFT 16 +#define PL_LEGEND_BACKGROUND 32 PLDLLIMPEXP void -c_pllegend( PLINT opt, PLFLT plot_width, PLFLT x, PLFLT y, PLINT nlegend, - PLINT *text_colors, char **text, PLINT *cmap0_colors, - PLINT *line_style, PLINT *line_width, - PLINT nsymbols, PLINT *symbols ); +c_pllegend( PLINT opt, PLFLT plot_width, + PLFLT x, PLFLT y, PLINT bg_color, + PLINT *opt_array, PLINT nlegend, + PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, + PLINT text_justification, PLINT text_color, char **text, + PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, + PLINT nsymbols, PLINT *symbol_colors, + PLFLT *symbol_scales, PLINT *symbols, + PLFLT cmap0_height, PLINT *cmap0_colours, PLINT *cmap0_patterns ); /* Sets position of the light source */ PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-24 04:01:45 UTC (rev 11209) +++ trunk/src/pllegend.c 2010-09-25 20:30:22 UTC (rev 11210) @@ -1,8 +1,7 @@ /* pllegend() * - * Author: Hezekiah Carty 2010 - * * Copyright (C) 2010 Hezekiah M. Carty + * Copyright (C) 2010 Alan W. Irwin * * This file is part of PLplot. * @@ -23,24 +22,27 @@ #include "plplotP.h" -static PLFLT get_character_or_symbol_height( PLINT ifcharacter ) +static void get_world_per_mm( PLFLT *x_world_per_mm, PLFLT *y_world_per_mm ) { - // Character height in mm - PLFLT default_mm, char_height_mm; // Normalized viewport limits PLFLT vxmin, vxmax, vymin, vymax; - PLFLT vy; // Size of subpage in mm PLFLT mxmin, mxmax, mymin, mymax; - PLFLT mm_y; - // World height in mm - PLFLT world_height_mm; - // Normalized character height - PLFLT char_height_norm; - // Window dimensions + // Viewport limits in world coordinates PLFLT wxmin, wxmax, wymin, wymax; - PLFLT world_y; + plgvpd( &vxmin, &vxmax, &vymin, &vymax ); + plgspa( &mxmin, &mxmax, &mymin, &mymax ); + plgvpw( &wxmin, &wxmax, &wymin, &wymax ); + *x_world_per_mm = ( wxmax - wxmin ) / ( ( vxmax - vxmin ) * ( mxmax - mxmin ) ); + *y_world_per_mm = ( wymax - wymin ) / ( ( vymax - vymin ) * ( mymax - mymin ) ); +} +static PLFLT get_character_or_symbol_height( PLINT ifcharacter ) +{ + // Character height in mm + PLFLT default_mm, char_height_mm; + PLFLT x_world_per_mm, y_world_per_mm; + if ( ifcharacter ) { plgchr( &default_mm, &char_height_mm ); @@ -50,32 +52,25 @@ default_mm = plsc->symdef; char_height_mm = plsc->symht; } - plgvpd( &vxmin, &vxmax, &vymin, &vymax ); - vy = vymax - vymin; - - plgspa( &mxmin, &mxmax, &mymin, &mymax ); - mm_y = mymax - mymin; - - world_height_mm = mm_y * vy; - - // Character height (mm) / World height (mm) = Normalized char height - char_height_norm = char_height_mm / world_height_mm; - - // Normalized character height * World height (world) = - // Character height (world) - plgvpw( &wxmin, &wxmax, &wymin, &wymax ); - world_y = wymax - wymin; - - return ( char_height_norm * world_y ); + get_world_per_mm( &x_world_per_mm, &y_world_per_mm ); + return ( char_height_mm * y_world_per_mm ); } #define normalized_to_world_x( nx ) ( ( xmin ) + ( nx ) * ( ( xmax ) - ( xmin ) ) ) #define normalized_to_world_y( ny ) ( ( ymin ) + ( ny ) * ( ( ymax ) - ( ymin ) ) ) -// pllegend - Draw a legend using lines (nsymbols <=1 or symbols == NULL) or -// points/symbols. -// plot_width: width of plotted areas (lines, symbols, or colour boxes) in legend -// x, y: Normalized position of the legend in the plot window +// pllegend - Draw a legend using lines, symbols, cmap0 colours, or cmap1 +// colours. +// plot_width: width of plotted areas (lines, symbols, or coloured +// area) in legend. (Uses normalized viewport units). +// text_offset: offset of text area from plot area in units of character width. +// N.B. the total width of the legend is made up of plplot_width + +// text_offset (converted to normalized viewport coordinates) + width +// of the longest string. The latter quantity is calculated internally +// using plstrl and converted to normalized viewport coordinates. +// +// x, y: Normalized position of the upper-left corner of the +// legend in the viewport. // nlegend: Number of legend entries // text_colors: Color map 0 indices of the colors to use for label text // text: text string for each legend entry @@ -84,10 +79,15 @@ // symbols: Symbol to draw for each legend entry. void -c_pllegend( PLINT opt, PLFLT plot_width, PLFLT x, PLFLT y, PLINT nlegend, - PLINT *text_colors, char **text, PLINT *cmap0_colors, - PLINT *line_style, PLINT *line_width, - PLINT nsymbols, PLINT *symbols ) +c_pllegend( PLINT opt, PLFLT plot_width, + PLFLT x, PLFLT y, PLINT bg_color, + PLINT *opt_array, PLINT nlegend, + PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, + PLINT text_justification, PLINT text_color, char **text, + PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, + PLINT nsymbols, PLINT *symbol_colors, + PLFLT *symbol_scales, PLINT *symbols, + PLFLT cmap0_height, PLINT *cmap0_colours, PLINT *cmap0_patterns ) { // Viewport world-coordinate limits @@ -103,27 +103,33 @@ // Positions of the legend entries PLFLT dxs, *xs, *ys, xl[2], yl[2]; PLINT i, j; - // opt_plot is the kind of plot made for the legend. - PLINT opt_plot = opt & ( PL_LEGEND_LINE | PL_LEGEND_SYMBOL | - PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1 ); // Active attributes to be saved and restored afterward. - PLINT old_col0 = plsc->icol0, old_line_style = plsc->line_style, - old_line_width = plsc->width; - // Sanity checks. - // Check opt_plot for a valid combination of kind of plots. - if ( !( ( opt_plot & ( PL_LEGEND_LINE | PL_LEGEND_SYMBOL ) ) || - opt_plot == PL_LEGEND_CMAP0 || opt_plot == PL_LEGEND_CMAP1 ) ) + PLINT col0_save = plsc->icol0, line_style_save = plsc->line_style, + line_width_save = plsc->width; + PLFLT text_scale_save = plsc->chrht / plsc->chrdef, + symbol_scale_save = plsc->symht / plsc->symdef; + PLFLT x_world_per_mm, y_world_per_mm, text_width = 0.; + PLFLT total_width, total_height; + PLINT some_lines = 0, some_symbols = 0, some_cmap0s; + + plschr( 0., text_scale ); + + for ( i = 0; i < nlegend; i++ ) { - plabort( "pllegend: invalid opt" ); - return; + if ( opt_array[i] & PL_LEGEND_LINE ) + some_lines = 1; + if ( opt_array[i] & PL_LEGEND_SYMBOL ) + some_symbols = 1; + if ( opt_array[i] & PL_LEGEND_CMAP0 ) + some_cmap0s = 1; } - if ( ( symbols == NULL ) && ( opt & PL_LEGEND_SYMBOL ) ) + //sanity check + if ( ( opt & PL_LEGEND_CMAP1 ) && ( some_lines || some_symbols || some_cmap0s ) ) { - plabort( "pllegend: invalid combination of opt requesting a symbols style of legend while symbols are not properly defined." ); + plabort( "pllegend: invalid attempt to combine cmap1 legend with any other style of legend" ); return; } - nsymbols = MAX( 2, nsymbols ); plgvpw( &xmin, &xmax, &ymin, &ymax ); @@ -141,27 +147,56 @@ // Get world-coordinate positions of the start of the legend text text_x = plot_x_end; text_y = plot_y; - text_x_world = normalized_to_world_x( text_x ) + character_width; + text_x_world = normalized_to_world_x( text_x ) + + text_offset * character_width; text_y_world = normalized_to_world_y( text_y ); // if (opt & PL_LEGEND_TEXT_LEFT) { - // + // } + // Calculate maximum width of text area (first in mm, then converted + // to x world coordinates) including text_offset area. + for ( i = 0; i < nlegend; i++ ) + { + text_width = MAX( text_width, plstrl( text[i] ) ); + } + get_world_per_mm( &x_world_per_mm, &y_world_per_mm ); + text_width = x_world_per_mm * text_width + text_offset * character_width; + total_width = text_width + ( xmax - xmin ) * plot_width; + total_height = nlegend * text_spacing * character_height; - // Starting y position for legend entries - ty = text_y_world - character_height; + if ( opt & PL_LEGEND_BACKGROUND ) + { + PLINT pattern_save = plsc->patt; + PLFLT xbg[4] = { + plot_x_world, + plot_x_world, + plot_x_world + total_width, + plot_x_world + total_width, + }; + PLFLT ybg[4] = { + plot_y_world, + plot_y_world - total_height, + plot_y_world - total_height, + plot_y_world, + }; + plpsty( 0 ); + plcol0( bg_color ); + plfill( 4, xbg, ybg ); + plpsty( pattern_save ); + plcol0( col0_save ); + } - if ( opt & PL_LEGEND_LINE ) + if ( some_lines ) { xl[0] = plot_x_world; xl[1] = plot_x_end_world; - yl[0] = ty; - yl[1] = ty; } - if ( opt & PL_LEGEND_SYMBOL ) + if ( some_symbols ) { + nsymbols = MAX( 2, nsymbols ); if ( ( ( xs = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) || ( ( ys = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) { @@ -179,49 +214,51 @@ for ( j = 0; j < nsymbols; j++ ) { xs[j] = plot_x_world + 0.5 * symbol_width + dxs * (double) j; - ys[j] = ty; } } + ty = text_y_world + 0.5 * text_spacing * character_height; // Draw each legend entry for ( i = 0; i < nlegend; i++ ) { + // y position of text, lines, symbols, and/or centre of cmap0 box. + ty = ty - ( text_spacing * character_height ); // Label/name for the legend - plcol0( text_colors[i] ); + plcol0( text_color ); plptex( text_x_world, ty, 0.0, 0.0, 0.0, text[i] ); - // prepare for the next position - ty = ty - ( 1.5 * character_height ); - plcol0( cmap0_colors[i] ); - if ( opt & PL_LEGEND_LINE ) + if ( opt_array[i] & PL_LEGEND_LINE ) { - pllsty( line_style[i]) ; - plwid( line_width[i] ); - plline( 2, xl, yl ); - // prepare for the next position + plcol0( line_colors[i] ); + pllsty( line_styles[i] ); + plwid( line_widths[i] ); yl[0] = ty; yl[1] = ty; - pllsty( old_line_style ); - plwid( old_line_width ); + plline( 2, xl, yl ); + pllsty( line_style_save ); + plwid( line_width_save ); } - if ( opt & PL_LEGEND_SYMBOL ) + if ( opt_array[i] & PL_LEGEND_SYMBOL ) { - plpoin( nsymbols, xs, ys, symbols[i] ); - // prepare for the next position + plcol0( symbol_colors[i] ); + plssym( 0., symbol_scales[i] ); for ( j = 0; j < nsymbols; j++ ) { ys[j] = ty; } + plpoin( nsymbols, xs, ys, symbols[i] ); } } - if ( opt & PL_LEGEND_SYMBOL ) + if ( some_symbols ) { free( xs ); free( ys ); } - // Restore the previously active drawing color - plcol0( old_col0 ); + // Restore + plcol0( col0_save ); + plschr( 0., text_scale_save ); + plssym( 0., symbol_scale_save ); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-25 20:33:24
|
Revision: 11211 http://plplot.svn.sourceforge.net/plplot/?rev=11211&view=rev Author: airwin Date: 2010-09-25 20:33:17 +0000 (Sat, 25 Sep 2010) Log Message: ----------- Style recent changes. Modified Paths: -------------- trunk/drivers/cairo.c trunk/drivers/mem.c trunk/drivers/qt.cpp trunk/src/plarc.c trunk/src/plcore.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-09-25 20:30:22 UTC (rev 11210) +++ trunk/drivers/cairo.c 2010-09-25 20:33:17 UTC (rev 11211) @@ -2433,13 +2433,15 @@ cairo_mem[1] = input_mem[0]; /* R */ cairo_mem[2] = input_mem[1]; /* G */ cairo_mem[3] = input_mem[2]; /* B */ - if ( pls->dev_mem_alpha == 1){ - cairo_mem[0] = input_mem[3]; - input_mem += 4; - } - else { - input_mem += 3; - } + if ( pls->dev_mem_alpha == 1 ) + { + cairo_mem[0] = input_mem[3]; + input_mem += 4; + } + else + { + input_mem += 3; + } cairo_mem += 4; } } @@ -2450,13 +2452,15 @@ cairo_mem[2] = input_mem[0]; /* R */ cairo_mem[1] = input_mem[1]; /* G */ cairo_mem[0] = input_mem[2]; /* B */ - if ( pls->dev_mem_alpha == 1){ - cairo_mem[3] = input_mem[3]; - input_mem += 4; - } - else { - input_mem += 3; - } + if ( pls->dev_mem_alpha == 1 ) + { + cairo_mem[3] = input_mem[3]; + input_mem += 4; + } + else + { + input_mem += 3; + } cairo_mem += 4; } } @@ -2503,16 +2507,18 @@ { for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { - memory[0] = cairo_surface_data[1]; /* R */ - memory[1] = cairo_surface_data[2]; /* G */ - memory[2] = cairo_surface_data[3]; /* B */ - if ( pls->dev_mem_alpha == 1){ - memory[3] = cairo_surface_data[0]; - memory += 4; - } - else { - memory += 3; - } + memory[0] = cairo_surface_data[1]; /* R */ + memory[1] = cairo_surface_data[2]; /* G */ + memory[2] = cairo_surface_data[3]; /* B */ + if ( pls->dev_mem_alpha == 1 ) + { + memory[3] = cairo_surface_data[0]; + memory += 4; + } + else + { + memory += 3; + } cairo_surface_data += 4; } } @@ -2520,16 +2526,18 @@ { for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { - memory[0] = cairo_surface_data[2]; /* R */ - memory[1] = cairo_surface_data[1]; /* G */ - memory[2] = cairo_surface_data[0]; /* B */ - if ( pls->dev_mem_alpha == 1){ - memory[3] = cairo_surface_data[3]; - memory += 4; - } - else { - memory += 3; - } + memory[0] = cairo_surface_data[2]; /* R */ + memory[1] = cairo_surface_data[1]; /* G */ + memory[2] = cairo_surface_data[0]; /* B */ + if ( pls->dev_mem_alpha == 1 ) + { + memory[3] = cairo_surface_data[3]; + memory += 4; + } + else + { + memory += 3; + } cairo_surface_data += 4; } } Modified: trunk/drivers/mem.c =================================================================== --- trunk/drivers/mem.c 2010-09-25 20:30:22 UTC (rev 11210) +++ trunk/drivers/mem.c 2010-09-25 20:33:17 UTC (rev 11211) @@ -80,7 +80,7 @@ if ( pls->dev_mem_alpha == 1 ) { - plexit( "The mem driver does not support alpha values! Use plsmem!"); + plexit( "The mem driver does not support alpha values! Use plsmem!" ); } plP_setpxl( (PLFLT) 4, (PLFLT) 4 ); /* rough pixels/mm on *my* screen */ Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2010-09-25 20:30:22 UTC (rev 11210) +++ trunk/drivers/qt.cpp 2010-09-25 20:33:17 UTC (rev 11211) @@ -1681,8 +1681,8 @@ void plD_init_memqt( PLStream * pls ) { - int i; - double dpi; + int i; + double dpi; unsigned char *qt_mem; unsigned char *input_mem; @@ -1723,7 +1723,7 @@ pls->ylength = pls->phyyma; /* Save a pointer to the user supplied memory */ - input_mem = (unsigned char *)pls->dev; + input_mem = (unsigned char *) pls->dev; /* Create a appropriately sized raster device */ pls->dev = new QtRasterDevice( pls->xlength, pls->ylength ); @@ -1746,21 +1746,23 @@ This device assumes that the format of the QImage is RGB32 (or ARGB). */ - qt_mem = ( (QtRasterDevice *) pls->dev )->scanLine(0); + qt_mem = ( (QtRasterDevice *) pls->dev )->scanLine( 0 ); for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { qt_mem[2] = input_mem[0]; /* R */ qt_mem[1] = input_mem[1]; /* G */ qt_mem[0] = input_mem[2]; /* B */ - if ( pls->dev_mem_alpha == 1){ - qt_mem[3] = input_mem[3]; - input_mem += 4; - } - else { - input_mem += 3; - } - qt_mem += 4; + if ( pls->dev_mem_alpha == 1 ) + { + qt_mem[3] = input_mem[3]; + input_mem += 4; + } + else + { + input_mem += 3; + } + qt_mem += 4; } ( (QtRasterDevice*) ( pls->dev ) )->setResolution( dpi ); @@ -1781,21 +1783,23 @@ unsigned char *qt_mem; memory = ( (QtRasterDevice *) pls->dev )->memory; - qt_mem = ( (QtRasterDevice *) pls->dev )->scanLine(0); + qt_mem = ( (QtRasterDevice *) pls->dev )->scanLine( 0 ); for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { - memory[0] = qt_mem[2]; /* R */ - memory[1] = qt_mem[1]; /* G */ - memory[2] = qt_mem[0]; /* B */ - if ( pls->dev_mem_alpha == 1){ - memory[3] = qt_mem[3]; - memory += 4; - } - else { - memory += 3; - } - qt_mem += 4; + memory[0] = qt_mem[2]; /* R */ + memory[1] = qt_mem[1]; /* G */ + memory[2] = qt_mem[0]; /* B */ + if ( pls->dev_mem_alpha == 1 ) + { + memory[3] = qt_mem[3]; + memory += 4; + } + else + { + memory += 3; + } + qt_mem += 4; } } Modified: trunk/src/plarc.c =================================================================== --- trunk/src/plarc.c 2010-09-25 20:30:22 UTC (rev 11210) +++ trunk/src/plarc.c 2010-09-25 20:33:17 UTC (rev 11211) @@ -21,7 +21,7 @@ #include "plplotP.h" -#define CIRCLE_SEGMENTS ( PL_MAXPOLY - 1 ) +#define CIRCLE_SEGMENTS ( PL_MAXPOLY - 1 ) #define DEG_TO_RAD( x ) ( ( x ) * M_PI / 180.0 ) #define PLARC_POINT_X( x, a, b, theta ) ( ( x ) + ( ( a ) * cos( theta ) ) ) Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-09-25 20:30:22 UTC (rev 11210) +++ trunk/src/plcore.c 2010-09-25 20:33:17 UTC (rev 11211) @@ -3455,7 +3455,7 @@ void c_plsmem( PLINT maxx, PLINT maxy, void *plotmem ) { - plsc->dev = plotmem; + plsc->dev = plotmem; plsc->dev_mem_alpha = 0; plP_setphy( 0, maxx, 0, maxy ); } @@ -3465,7 +3465,7 @@ void c_plsmema( PLINT maxx, PLINT maxy, void *plotmem ) { - plsc->dev = plotmem; + plsc->dev = plotmem; plsc->dev_mem_alpha = 1; plP_setphy( 0, maxx, 0, maxy ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-25 21:11:12
|
Revision: 11212 http://plplot.svn.sourceforge.net/plplot/?rev=11212&view=rev Author: airwin Date: 2010-09-25 21:11:06 +0000 (Sat, 25 Sep 2010) Log Message: ----------- Really do have an indexed nsymbols (rather than overall) to specify the number of symbols per legend line. Tweak legend in example to make it look a bit better. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-25 20:33:17 UTC (rev 11211) +++ trunk/examples/c/x04c.c 2010-09-25 21:11:06 UTC (rev 11212) @@ -51,7 +51,7 @@ PLINT line_colors[2]; PLINT line_styles[2]; PLINT line_widths[2]; - PLINT symbol_colors[2], symbols[2]; + PLINT nsymbols[2], symbol_colors[2], symbols[2]; PLFLT symbol_scales[2]; pladv( 0 ); @@ -119,23 +119,25 @@ line_colors[0] = 2; line_colors[1] = 3; line_styles[0] = 1; - line_styles[1] = 2; + line_styles[1] = 1; line_widths[0] = 1; line_widths[1] = 1; symbol_colors[0] = 3; symbol_colors[1] = 3; - symbol_scales[0] = 1.; + symbol_scales[0] = 1.2; symbol_scales[1] = 1.; - symbols[0] = 9; + nsymbols[0] = 3; + nsymbols[1] = 4; + symbols[0] = 3; symbols[1] = 3; - plscol0a( 15, 255, 255, 255, 0.2 ); + plscol0a( 15, 128, 128, 128, 0.2 ); pllegend( PL_LEGEND_BACKGROUND, 0.1, 0.6, 0.95, 15, opt_array, 2, 1., 1.0, 2.0, 0., 1, text, line_colors, line_styles, line_widths, - 5, symbol_colors, symbol_scales, symbols, + nsymbols, symbol_colors, symbol_scales, symbols, 0., NULL, NULL ); } } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-25 20:33:17 UTC (rev 11211) +++ trunk/include/plplot.h 2010-09-25 21:11:06 UTC (rev 11212) @@ -1223,7 +1223,7 @@ PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLINT text_justification, PLINT text_color, char **text, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT nsymbols, PLINT *symbol_colors, + PLINT *nsymbols, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, PLFLT cmap0_height, PLINT *cmap0_colours, PLINT *cmap0_patterns ); Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-25 20:33:17 UTC (rev 11211) +++ trunk/src/pllegend.c 2010-09-25 21:11:06 UTC (rev 11212) @@ -85,7 +85,7 @@ PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLINT text_justification, PLINT text_color, char **text, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT nsymbols, PLINT *symbol_colors, + PLINT *nsymbols, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, PLFLT cmap0_height, PLINT *cmap0_colours, PLINT *cmap0_patterns ) @@ -110,7 +110,8 @@ symbol_scale_save = plsc->symht / plsc->symdef; PLFLT x_world_per_mm, y_world_per_mm, text_width = 0.; PLFLT total_width, total_height; - PLINT some_lines = 0, some_symbols = 0, some_cmap0s; + PLINT some_lines = 0, some_symbols = 0, some_cmap0s; + PLINT max_nsymbols = 0; plschr( 0., text_scale ); @@ -119,7 +120,10 @@ if ( opt_array[i] & PL_LEGEND_LINE ) some_lines = 1; if ( opt_array[i] & PL_LEGEND_SYMBOL ) + { + max_nsymbols = MAX( max_nsymbols, nsymbols[i] ); some_symbols = 1; + } if ( opt_array[i] & PL_LEGEND_CMAP0 ) some_cmap0s = 1; } @@ -196,9 +200,9 @@ if ( some_symbols ) { - nsymbols = MAX( 2, nsymbols ); - if ( ( ( xs = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) || - ( ( ys = (PLFLT *) malloc( nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) + max_nsymbols = MAX( 2, max_nsymbols ); + if ( ( ( xs = (PLFLT *) malloc( max_nsymbols * sizeof ( PLFLT ) ) ) == NULL ) || + ( ( ys = (PLFLT *) malloc( max_nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) { plexit( "pllegend: Insufficient memory" ); } @@ -210,11 +214,6 @@ // Factor should be unity. symbol_width = 0.5 * get_character_or_symbol_height( 0 ) * fabs( ( xmax - xmin ) / ( ymax - ymin ) ); - dxs = ( plot_x_end_world - plot_x_world - symbol_width ) / (double) ( nsymbols - 1 ); - for ( j = 0; j < nsymbols; j++ ) - { - xs[j] = plot_x_world + 0.5 * symbol_width + dxs * (double) j; - } } ty = text_y_world + 0.5 * text_spacing * character_height; @@ -242,11 +241,13 @@ { plcol0( symbol_colors[i] ); plssym( 0., symbol_scales[i] ); - for ( j = 0; j < nsymbols; j++ ) + dxs = ( plot_x_end_world - plot_x_world - symbol_width ) / (double) ( MAX( nsymbols[i], 2 ) - 1 ); + for ( j = 0; j < nsymbols[i]; j++ ) { + xs[j] = plot_x_world + 0.5 * symbol_width + dxs * (double) j; ys[j] = ty; } - plpoin( nsymbols, xs, ys, symbols[i] ); + plpoin( nsymbols[i], xs, ys, symbols[i] ); } } if ( some_symbols ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-26 00:56:33
|
Revision: 11216 http://plplot.svn.sourceforge.net/plplot/?rev=11216&view=rev Author: airwin Date: 2010-09-26 00:56:26 +0000 (Sun, 26 Sep 2010) Log Message: ----------- Put small left and right border change on legend to make better-looking background result. API change.... Implement separate text colours for each legend line and use that feature for the 4th example. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-25 23:28:07 UTC (rev 11215) +++ trunk/examples/c/x04c.c 2010-09-26 00:56:26 UTC (rev 11216) @@ -48,6 +48,7 @@ PLFLT f0, freq; char *text[2]; PLINT opt_array[2]; + PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; PLINT line_widths[2]; @@ -114,6 +115,8 @@ // Draw a legend opt_array[0] = PL_LEGEND_LINE; opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; + text_colors[0] = 2; + text_colors[1] = 3; text[0] = "Amplitude"; text[1] = "Phase shift"; line_colors[0] = 2; @@ -134,8 +137,8 @@ pllegend( PL_LEGEND_BACKGROUND, 0.1, 0.6, 0.95, 15, opt_array, 2, - 1., 1.0, 2.0, - 0., 1, text, + 1.0, 1.0, 2.0, + 0., text_colors, text, line_colors, line_styles, line_widths, nsymbols, symbol_colors, symbol_scales, symbols, 0., NULL, NULL ); Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-25 23:28:07 UTC (rev 11215) +++ trunk/include/plplot.h 2010-09-26 00:56:26 UTC (rev 11216) @@ -1221,7 +1221,7 @@ PLFLT x, PLFLT y, PLINT bg_color, PLINT *opt_array, PLINT nlegend, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, - PLINT text_justification, PLINT text_color, char **text, + PLINT text_justification, PLINT *text_colors, char **text, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, PLINT *nsymbols, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-25 23:28:07 UTC (rev 11215) +++ trunk/src/pllegend.c 2010-09-26 00:56:26 UTC (rev 11216) @@ -83,7 +83,7 @@ PLFLT x, PLFLT y, PLINT bg_color, PLINT *opt_array, PLINT nlegend, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, - PLINT text_justification, PLINT text_color, char **text, + PLINT text_justification, PLINT *text_colors, char **text, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, PLINT *nsymbols, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, @@ -109,7 +109,7 @@ PLFLT text_scale_save = plsc->chrht / plsc->chrdef, symbol_scale_save = plsc->symht / plsc->symdef; PLFLT x_world_per_mm, y_world_per_mm, text_width = 0.; - PLFLT total_width, total_height; + PLFLT total_width_border, total_width, total_height; PLINT some_lines = 0, some_symbols = 0, some_cmap0s; PLINT max_nsymbols = 0; @@ -166,9 +166,13 @@ text_width = MAX( text_width, plstrl( text[i] ) ); } get_world_per_mm( &x_world_per_mm, &y_world_per_mm ); - text_width = x_world_per_mm * text_width + text_offset * character_width; - total_width = text_width + ( xmax - xmin ) * plot_width; - total_height = nlegend * text_spacing * character_height; + text_width = x_world_per_mm * text_width + text_offset * character_width; + // make small border area where only the background is plotted + // for left and right of legend. 0.4 seems to be a reasonable factor + // that gives a good-looking result. + total_width_border = 0.4 * character_width; + total_width = 2. * total_width_border + text_width + ( xmax - xmin ) * plot_width; + total_height = nlegend * text_spacing * character_height; if ( opt & PL_LEGEND_BACKGROUND ) { @@ -192,6 +196,11 @@ plcol0( col0_save ); } + // adjust for border after background is drawn. + plot_x_world += total_width_border; + plot_x_end_world += total_width_border; + text_x_world += total_width_border; + if ( some_lines ) { xl[0] = plot_x_world; @@ -223,7 +232,7 @@ // y position of text, lines, symbols, and/or centre of cmap0 box. ty = ty - ( text_spacing * character_height ); // Label/name for the legend - plcol0( text_color ); + plcol0( text_colors[i] ); plptex( text_x_world, ty, 0.0, 0.0, 0.0, text[i] ); if ( opt_array[i] & PL_LEGEND_LINE ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-26 04:25:49
|
Revision: 11219 http://plplot.svn.sourceforge.net/plplot/?rev=11219&view=rev Author: airwin Date: 2010-09-26 04:25:42 +0000 (Sun, 26 Sep 2010) Log Message: ----------- API change: implement cmap0-style legends. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-26 02:24:06 UTC (rev 11218) +++ trunk/examples/c/x04c.c 2010-09-26 04:25:42 UTC (rev 11219) @@ -54,7 +54,8 @@ PLINT line_styles[2]; PLINT line_widths[2]; PLINT nsymbols[2], symbol_colors[2], symbols[2]; - PLFLT symbol_scales[2]; + PLINT cmap0_colors[2], cmap0_patterns[2]; + PLFLT symbol_scales[2], cmap0_scales[2]; pladv( 0 ); @@ -116,26 +117,32 @@ nlegend = 2; } // Draw a legend - opt_array[0] = PL_LEGEND_LINE; - opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; - text_colors[0] = 2; - text_colors[1] = 3; - text[0] = "Amplitude"; - text[1] = "Phase shift"; - line_colors[0] = 2; - line_colors[1] = 3; - line_styles[0] = 1; - line_styles[1] = 1; - line_widths[0] = 1; - line_widths[1] = 1; - symbol_colors[0] = 3; - symbol_colors[1] = 3; - symbol_scales[0] = 1.2; - symbol_scales[1] = 1.; - nsymbols[0] = 3; - nsymbols[1] = 4; - symbols[0] = 3; - symbols[1] = 3; + opt_array[0] = PL_LEGEND_LINE; + opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; + text_colors[0] = 2; + text_colors[1] = 3; + text[0] = "Amplitude"; + text[1] = "Phase shift"; + line_colors[0] = 2; + line_colors[1] = 3; + line_styles[0] = 1; + line_styles[1] = 1; + line_widths[0] = 1; + line_widths[1] = 1; + symbol_colors[0] = 2; + symbol_colors[1] = 3; + symbol_scales[0] = 1.2; + symbol_scales[1] = 1.; + nsymbols[0] = 3; + nsymbols[1] = 4; + symbols[0] = 3; + symbols[1] = 3; + cmap0_colors[0] = 2; + cmap0_colors[1] = 3; + cmap0_patterns[0] = 0; + cmap0_patterns[1] = 3; + cmap0_scales[0] = 0.5; + cmap0_scales[1] = 0.5; plscol0a( 15, 32, 32, 32, 0.90 ); pllegend( PL_LEGEND_BACKGROUND, 0.1, 0.6, 0.95, 15, @@ -144,5 +151,5 @@ 0., text_colors, text, line_colors, line_styles, line_widths, nsymbols, symbol_colors, symbol_scales, symbols, - 0., NULL, NULL ); + cmap0_colors, cmap0_patterns, cmap0_scales ); } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-26 02:24:06 UTC (rev 11218) +++ trunk/include/plplot.h 2010-09-26 04:25:42 UTC (rev 11219) @@ -1225,7 +1225,7 @@ PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, PLINT *nsymbols, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, - PLFLT cmap0_height, PLINT *cmap0_colours, PLINT *cmap0_patterns ); + PLINT *cmap0_colors, PLINT *cmap0_patterns, PLFLT *cmap0_scales ); /* Sets position of the light source */ PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-26 02:24:06 UTC (rev 11218) +++ trunk/src/pllegend.c 2010-09-26 04:25:42 UTC (rev 11219) @@ -87,7 +87,7 @@ PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, PLINT *nsymbols, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, - PLFLT cmap0_height, PLINT *cmap0_colours, PLINT *cmap0_patterns ) + PLINT *cmap0_colors, PLINT *cmap0_patterns, PLFLT *cmap0_scales ) { // Viewport world-coordinate limits @@ -99,13 +99,15 @@ // Character height (world coordinates) PLFLT character_height, character_width, symbol_width; // y-position of the current legend entry - PLFLT ty; + PLFLT ty, dty; // Positions of the legend entries - PLFLT dxs, *xs, *ys, xl[2], yl[2]; + PLFLT dxs, *xs, *ys, xl[2], yl[2], xcmap0[4], ycmap0[4]; PLINT i, j; // Active attributes to be saved and restored afterward. - PLINT col0_save = plsc->icol0, line_style_save = plsc->line_style, - line_width_save = plsc->width; + PLINT col0_save = plsc->icol0, + line_style_save = plsc->line_style, + line_width_save = plsc->width, + pattern_save = plsc->patt; PLFLT text_scale_save = plsc->chrht / plsc->chrdef, symbol_scale_save = plsc->symht / plsc->symdef; PLFLT x_world_per_mm, y_world_per_mm, text_width = 0.; @@ -172,8 +174,7 @@ if ( opt & PL_LEGEND_BACKGROUND ) { - PLINT pattern_save = plsc->patt; - PLFLT xbg[4] = { + PLFLT xbg[4] = { plot_x_world, plot_x_world, plot_x_world + total_width, @@ -188,7 +189,6 @@ plpsty( 0 ); plcol0( bg_color ); plfill( 4, xbg, ybg ); - plpsty( pattern_save ); plcol0( col0_save ); } @@ -204,6 +204,14 @@ plot_x_end_world += total_width_border; text_x_world += total_width_border; + if ( some_cmap0s ) + { + xcmap0[0] = plot_x_world; + xcmap0[1] = plot_x_world; + xcmap0[2] = plot_x_end_world; + xcmap0[3] = plot_x_end_world; + } + if ( some_lines ) { xl[0] = plot_x_world; @@ -228,16 +236,27 @@ fabs( ( xmax - xmin ) / ( ymax - ymin ) ); } - ty = text_y_world + 0.5 * text_spacing * character_height; + dty = text_spacing * character_height; + ty = text_y_world + 0.5 * dty; // Draw each legend entry for ( i = 0; i < nlegend; i++ ) { // y position of text, lines, symbols, and/or centre of cmap0 box. - ty = ty - ( text_spacing * character_height ); + ty = ty - dty; // Label/name for the legend plcol0( text_colors[i] ); plptex( text_x_world, ty, 0.0, 0.0, 0.0, text[i] ); + if ( opt_array[i] & PL_LEGEND_CMAP0 ) + { + plcol0( cmap0_colors[i] ); + plpsty( cmap0_patterns[i] ); + ycmap0[0] = ty + 0.5 * dty * cmap0_scales[i]; + ycmap0[1] = ty - 0.5 * dty * cmap0_scales[i]; + ycmap0[2] = ty - 0.5 * dty * cmap0_scales[i]; + ycmap0[3] = ty + 0.5 * dty * cmap0_scales[i]; + plfill( 4, xcmap0, ycmap0 ); + } if ( opt_array[i] & PL_LEGEND_LINE ) { plcol0( line_colors[i] ); @@ -249,6 +268,7 @@ pllsty( line_style_save ); plwid( line_width_save ); } + if ( opt_array[i] & PL_LEGEND_SYMBOL ) { plcol0( symbol_colors[i] ); @@ -272,6 +292,7 @@ plcol0( col0_save ); plschr( 0., text_scale_save ); plssym( 0., symbol_scale_save ); + plpsty( pattern_save ); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-26 14:59:30
|
Revision: 11220 http://plplot.svn.sourceforge.net/plplot/?rev=11220&view=rev Author: airwin Date: 2010-09-26 14:59:23 +0000 (Sun, 26 Sep 2010) Log Message: ----------- Add (discrete) cmap1 capability to pllegend. This completes my pllegend API changes (continuous cmap1 colorbar legends will be handled separately), but the pllegend API still needs review by others. pllegend ToDo. Internal (doxygen) and DocBook documentation and create temporary viewport internally that allows legends outside the external viewport. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-26 04:25:42 UTC (rev 11219) +++ trunk/examples/c/x04c.c 2010-09-26 14:59:23 UTC (rev 11220) @@ -54,8 +54,8 @@ PLINT line_styles[2]; PLINT line_widths[2]; PLINT nsymbols[2], symbol_colors[2], symbols[2]; - PLINT cmap0_colors[2], cmap0_patterns[2]; - PLFLT symbol_scales[2], cmap0_scales[2]; + PLINT cmap0_colors[2], cmap_patterns[2]; + PLFLT symbol_scales[2], cmap_scales[2], cmap1_colors[2]; pladv( 0 ); @@ -117,32 +117,34 @@ nlegend = 2; } // Draw a legend - opt_array[0] = PL_LEGEND_LINE; - opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; - text_colors[0] = 2; - text_colors[1] = 3; - text[0] = "Amplitude"; - text[1] = "Phase shift"; - line_colors[0] = 2; - line_colors[1] = 3; - line_styles[0] = 1; - line_styles[1] = 1; - line_widths[0] = 1; - line_widths[1] = 1; - symbol_colors[0] = 2; - symbol_colors[1] = 3; - symbol_scales[0] = 1.2; - symbol_scales[1] = 1.; - nsymbols[0] = 3; - nsymbols[1] = 4; - symbols[0] = 3; - symbols[1] = 3; - cmap0_colors[0] = 2; - cmap0_colors[1] = 3; - cmap0_patterns[0] = 0; - cmap0_patterns[1] = 3; - cmap0_scales[0] = 0.5; - cmap0_scales[1] = 0.5; + opt_array[0] = PL_LEGEND_LINE; + opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; + text_colors[0] = 2; + text_colors[1] = 3; + text[0] = "Amplitude"; + text[1] = "Phase shift"; + line_colors[0] = 2; + line_colors[1] = 3; + line_styles[0] = 1; + line_styles[1] = 1; + line_widths[0] = 1; + line_widths[1] = 1; + symbol_colors[0] = 2; + symbol_colors[1] = 3; + symbol_scales[0] = 1.2; + symbol_scales[1] = 1.; + nsymbols[0] = 3; + nsymbols[1] = 4; + symbols[0] = 3; + symbols[1] = 3; + cmap0_colors[0] = 2; + cmap0_colors[1] = 3; + cmap1_colors[0] = 0.; + cmap1_colors[1] = 1.; + cmap_patterns[0] = 0; + cmap_patterns[1] = 3; + cmap_scales[0] = 0.5; + cmap_scales[1] = 0.5; plscol0a( 15, 32, 32, 32, 0.90 ); pllegend( PL_LEGEND_BACKGROUND, 0.1, 0.6, 0.95, 15, @@ -151,5 +153,5 @@ 0., text_colors, text, line_colors, line_styles, line_widths, nsymbols, symbol_colors, symbol_scales, symbols, - cmap0_colors, cmap0_patterns, cmap0_scales ); + cmap0_colors, cmap1_colors, cmap_patterns, cmap_scales ); } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-26 04:25:42 UTC (rev 11219) +++ trunk/include/plplot.h 2010-09-26 14:59:23 UTC (rev 11220) @@ -1225,7 +1225,8 @@ PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, PLINT *nsymbols, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, - PLINT *cmap0_colors, PLINT *cmap0_patterns, PLFLT *cmap0_scales ); + PLINT *cmap0_colors, PLFLT * cmap1_colors, + PLINT *cmap_patterns, PLFLT *cmap_scales ); /* Sets position of the light source */ PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-26 04:25:42 UTC (rev 11219) +++ trunk/src/pllegend.c 2010-09-26 14:59:23 UTC (rev 11220) @@ -59,8 +59,8 @@ #define normalized_to_world_x( nx ) ( ( xmin ) + ( nx ) * ( ( xmax ) - ( xmin ) ) ) #define normalized_to_world_y( ny ) ( ( ymin ) + ( ny ) * ( ( ymax ) - ( ymin ) ) ) -// pllegend - Draw a legend using lines, symbols, cmap0 colours, or cmap1 -// colours. +// pllegend - Draw a legend using lines, symbols, cmap0 colors, or cmap1 +// colors. // plot_width: width of plotted areas (lines, symbols, or coloured // area) in legend. (Uses normalized viewport units). // text_offset: offset of text area from plot area in units of character width. @@ -87,7 +87,8 @@ PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, PLINT *nsymbols, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, - PLINT *cmap0_colors, PLINT *cmap0_patterns, PLFLT *cmap0_scales ) + PLINT *cmap0_colors, PLFLT *cmap1_colors, + PLINT *cmap_patterns, PLFLT *cmap_scales ) { // Viewport world-coordinate limits @@ -101,7 +102,7 @@ // y-position of the current legend entry PLFLT ty, dty; // Positions of the legend entries - PLFLT dxs, *xs, *ys, xl[2], yl[2], xcmap0[4], ycmap0[4]; + PLFLT dxs, *xs, *ys, xl[2], yl[2], xcmap[4], ycmap[4]; PLINT i, j; // Active attributes to be saved and restored afterward. PLINT col0_save = plsc->icol0, @@ -112,7 +113,7 @@ symbol_scale_save = plsc->symht / plsc->symdef; PLFLT x_world_per_mm, y_world_per_mm, text_width = 0.; PLFLT total_width_border, total_width, total_height; - PLINT some_lines = 0, some_symbols = 0, some_cmap0s; + PLINT some_lines = 0, some_symbols = 0, some_cmaps = 0; PLINT max_nsymbols = 0; plschr( 0., text_scale ); @@ -126,17 +127,10 @@ max_nsymbols = MAX( max_nsymbols, nsymbols[i] ); some_symbols = 1; } - if ( opt_array[i] & PL_LEGEND_CMAP0 ) - some_cmap0s = 1; + if ( opt_array[i] & ( PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1 ) ) + some_cmaps = 1; } - //sanity check - if ( ( opt & PL_LEGEND_CMAP1 ) && ( some_lines || some_symbols || some_cmap0s ) ) - { - plabort( "pllegend: invalid attempt to combine cmap1 legend with any other style of legend" ); - return; - } - plgvpw( &xmin, &xmax, &ymin, &ymax ); // World coordinates for legend plots @@ -204,12 +198,12 @@ plot_x_end_world += total_width_border; text_x_world += total_width_border; - if ( some_cmap0s ) + if ( some_cmaps ) { - xcmap0[0] = plot_x_world; - xcmap0[1] = plot_x_world; - xcmap0[2] = plot_x_end_world; - xcmap0[3] = plot_x_end_world; + xcmap[0] = plot_x_world; + xcmap[1] = plot_x_world; + xcmap[2] = plot_x_end_world; + xcmap[3] = plot_x_end_world; } if ( some_lines ) @@ -250,13 +244,23 @@ if ( opt_array[i] & PL_LEGEND_CMAP0 ) { plcol0( cmap0_colors[i] ); - plpsty( cmap0_patterns[i] ); - ycmap0[0] = ty + 0.5 * dty * cmap0_scales[i]; - ycmap0[1] = ty - 0.5 * dty * cmap0_scales[i]; - ycmap0[2] = ty - 0.5 * dty * cmap0_scales[i]; - ycmap0[3] = ty + 0.5 * dty * cmap0_scales[i]; - plfill( 4, xcmap0, ycmap0 ); + plpsty( cmap_patterns[i] ); + ycmap[0] = ty + 0.5 * dty * cmap_scales[i]; + ycmap[1] = ty - 0.5 * dty * cmap_scales[i]; + ycmap[2] = ty - 0.5 * dty * cmap_scales[i]; + ycmap[3] = ty + 0.5 * dty * cmap_scales[i]; + plfill( 4, xcmap, ycmap ); } + if ( opt_array[i] & PL_LEGEND_CMAP1 ) + { + plcol1( cmap1_colors[i] ); + plpsty( cmap_patterns[i] ); + ycmap[0] = ty + 0.5 * dty * cmap_scales[i]; + ycmap[1] = ty - 0.5 * dty * cmap_scales[i]; + ycmap[2] = ty - 0.5 * dty * cmap_scales[i]; + ycmap[3] = ty + 0.5 * dty * cmap_scales[i]; + plfill( 4, xcmap, ycmap ); + } if ( opt_array[i] & PL_LEGEND_LINE ) { plcol0( line_colors[i] ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-26 18:15:36
|
Revision: 11221 http://plplot.svn.sourceforge.net/plplot/?rev=11221&view=rev Author: airwin Date: 2010-09-26 18:15:29 +0000 (Sun, 26 Sep 2010) Log Message: ----------- Set viewport internally so legend gets clipped at sub-page boundaries. Change meaning of x, y position and plot_width to refer to normalized sub-page coordinates. Example 4 changed to be consistent with these new meanings. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-26 14:59:23 UTC (rev 11220) +++ trunk/examples/c/x04c.c 2010-09-26 18:15:29 UTC (rev 11221) @@ -146,8 +146,8 @@ cmap_scales[0] = 0.5; cmap_scales[1] = 0.5; plscol0a( 15, 32, 32, 32, 0.90 ); - pllegend( PL_LEGEND_BACKGROUND, 0.1, - 0.6, 0.95, 15, + pllegend( PL_LEGEND_BACKGROUND, 0.06, + 0.57, 0.85, 15, opt_array, nlegend, 1.0, 1.0, 2.0, 0., text_colors, text, Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-26 14:59:23 UTC (rev 11220) +++ trunk/src/pllegend.c 2010-09-26 18:15:29 UTC (rev 11221) @@ -111,11 +111,24 @@ pattern_save = plsc->patt; PLFLT text_scale_save = plsc->chrht / plsc->chrdef, symbol_scale_save = plsc->symht / plsc->symdef; + // Saved world coordinates of viewport. + PLFLT xwmin_save, xwmax_save, ywmin_save, ywmax_save; + // Saved normalized coordinates of viewport. + PLFLT xdmin_save, xdmax_save, ydmin_save, ydmax_save; + PLFLT x_world_per_mm, y_world_per_mm, text_width = 0.; PLFLT total_width_border, total_width, total_height; + PLINT some_lines = 0, some_symbols = 0, some_cmaps = 0; PLINT max_nsymbols = 0; + plgvpd( &xdmin_save, &xdmax_save, &ydmin_save, &ydmax_save ); + plgvpw( &xwmin_save, &xwmax_save, &ywmin_save, &ywmax_save ); + // viewport corresponds to sub-page so that all legends will + // be clipped at sub-page boundaries. + plvpor( 0., 1., 0., 1. ); + plwind( 0., 1., 0., 1. ); + plschr( 0., text_scale ); for ( i = 0; i < nlegend; i++ ) @@ -297,6 +310,8 @@ plschr( 0., text_scale_save ); plssym( 0., symbol_scale_save ); plpsty( pattern_save ); + plvpor( xdmin_save, xdmax_save, ydmin_save, ydmax_save ); + plwind( xwmin_save, xwmax_save, ywmin_save, ywmax_save ); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-28 05:59:06
|
Revision: 11229 http://plplot.svn.sourceforge.net/plplot/?rev=11229&view=rev Author: airwin Date: 2010-09-28 05:58:58 +0000 (Tue, 28 Sep 2010) Log Message: ----------- Complete doxygenation of pllegend.c. Rename and reorder certain arguments of pllegend into more rational form. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-28 05:55:31 UTC (rev 11228) +++ trunk/examples/c/x04c.c 2010-09-28 05:58:58 UTC (rev 11229) @@ -53,7 +53,7 @@ PLINT line_colors[2]; PLINT line_styles[2]; PLINT line_widths[2]; - PLINT nsymbols[2], symbol_colors[2], symbols[2]; + PLINT symbol_numbers[2], symbol_colors[2], symbols[2]; PLINT cmap0_colors[2], cmap_patterns[2]; PLFLT symbol_scales[2], cmap_scales[2], cmap1_colors[2]; @@ -117,41 +117,40 @@ nlegend = 2; } // Draw a legend - opt_array[0] = PL_LEGEND_LINE; - opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; - text_colors[0] = 2; - text_colors[1] = 3; - text[0] = "Amplitude"; - text[1] = "Phase shift"; - line_colors[0] = 2; - line_colors[1] = 3; - line_styles[0] = 1; - line_styles[1] = 1; - line_widths[0] = 1; - line_widths[1] = 1; - symbol_colors[0] = 2; - symbol_colors[1] = 3; - symbol_scales[0] = 1.2; - symbol_scales[1] = 1.; - nsymbols[0] = 3; - nsymbols[1] = 4; - symbols[0] = 3; - symbols[1] = 3; - cmap0_colors[0] = 2; - cmap0_colors[1] = 3; - cmap1_colors[0] = 0.; - cmap1_colors[1] = 1.; - cmap_patterns[0] = 0; - cmap_patterns[1] = 3; - cmap_scales[0] = 0.5; - cmap_scales[1] = 0.5; + opt_array[0] = PL_LEGEND_LINE; + opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; + text_colors[0] = 2; + text_colors[1] = 3; + text[0] = "Amplitude"; + text[1] = "Phase shift"; + line_colors[0] = 2; + line_colors[1] = 3; + line_styles[0] = 1; + line_styles[1] = 1; + line_widths[0] = 1; + line_widths[1] = 1; + symbol_colors[0] = 2; + symbol_colors[1] = 3; + symbol_scales[0] = 1.2; + symbol_scales[1] = 1.; + symbol_numbers[0] = 3; + symbol_numbers[1] = 4; + symbols[0] = 3; + symbols[1] = 3; + cmap0_colors[0] = 2; + cmap0_colors[1] = 3; + cmap1_colors[0] = 0.; + cmap1_colors[1] = 1.; + cmap_patterns[0] = 0; + cmap_patterns[1] = 3; + cmap_scales[0] = 0.5; + cmap_scales[1] = 0.5; plscol0a( 15, 32, 32, 32, 0.90 ); - pllegend( PL_LEGEND_BACKGROUND, 0.06, - 0.57, 0.85, 15, - opt_array, nlegend, + pllegend( PL_LEGEND_BACKGROUND, 0.57, 0.85, 0.06, 15, + nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, line_colors, line_styles, line_widths, - nsymbols, symbol_colors, symbol_scales, symbols, + symbol_numbers, symbol_colors, symbol_scales, symbols, cmap0_colors, cmap1_colors, cmap_patterns, cmap_scales ); } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-28 05:55:31 UTC (rev 11228) +++ trunk/include/plplot.h 2010-09-28 05:58:58 UTC (rev 11229) @@ -1217,13 +1217,12 @@ #define PL_LEGEND_BACKGROUND 32 PLDLLIMPEXP void -c_pllegend( PLINT opt, PLFLT plot_width, - PLFLT x, PLFLT y, PLINT bg_color, - PLINT *opt_array, PLINT nlegend, +c_pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, + PLINT nlegend, PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLINT text_justification, PLINT *text_colors, char **text, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT *nsymbols, PLINT *symbol_colors, + PLINT *symbol_numbers, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, PLINT *cmap0_colors, PLFLT * cmap1_colors, PLINT *cmap_patterns, PLFLT *cmap_scales ); Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-28 05:55:31 UTC (rev 11228) +++ trunk/src/pllegend.c 2010-09-28 05:58:58 UTC (rev 11229) @@ -75,42 +75,103 @@ return ( char_height_mm * y_world_per_mm ); } +//-------------------------------------------------------------------------- +//! Convert from normalized sub-page (or internal viewport) X +//! coordinate to X world coordinate. +//! +//! @param nx : normalized X coordinate +//! + #define normalized_to_world_x( nx ) ( ( xmin ) + ( nx ) * ( ( xmax ) - ( xmin ) ) ) + +//-------------------------------------------------------------------------- +//! Convert from normalized sub-page (or internal viewport) Y +//! coordinate to Y world coordinate. +//! +//! @param ny : normalized Y coordinate +//! + #define normalized_to_world_y( ny ) ( ( ymin ) + ( ny ) * ( ( ymax ) - ( ymin ) ) ) //-------------------------------------------------------------------------- -//! Plot discrete legend using lines, symbols, cmap0 colors, or cmap1 -//! colors. +//! Plot discrete legend using lines, symbols, cmap0 colors, and/or +//! cmap1 colors. //! -//! @param opt : ORed option flags PL_LEGEND_BACKGROUND and -//! PL_LEGEND_TEXT_LEFT controlling overall legend. -//! @param plot_width : width in normalized subpage units of plotted area -//! (lines, symbols, or coloured area) in legend. -//! @param text_offset : offset of text area from plot area in units -//! of character width. +//! @param opt : options controlling overall legend. If the +//! PL_LEGEND_BACKGROUND bit is set, plot a (semi-transparent) +//! background for the legend. If the PL_LEGEND_TEXT_LEFT bit is set, +//! put the text area on the left of the legend and the plotted area +//! on the right. Otherwise, put the text area on the right of the +//! legend and the plotted area on the left +//! @param x : normalized sub-page X position of the upper-left corner of the +//! legend +//! @param y : normalized sub-page Y position of the upper-left corner of the +//! legend +//! @param plot_width : width in normalized subpage units of the plot +//! area (where lines, symbols, and/or colored boxes are drawn in the +//! legend) +//! @param bg_color : cmap0 index of the background color for the legend +//! (PL_LEGEND_BACKGROUND) +//! @param nlegend : number of legend entries +//! @param opt_array : array of nlegend values of options to control +//! each individual plotted area corresponding to a legend entry. If +//! the PL_LEGEND_CMAP0, PL_LEGEND_CMAP1, PL_LEGEND_LINE, and/or +//! PL_LEGEND_SYMBOL bits are set, the plotted area corresponding to a +//! legend entry is specified with a colored box (with the color of +//! that box determined by either a cmap0 index or a cmap1 value); a +//! line; and/or a line of symbols +//! @param text_offset : offset of the text area from the plot area in +//! units of character width +//! @param text_scale : character height scale for text annotations +//! @param text_spacing : vertical spacing in units of the character +//! height from one legend entry to the next +//! @param text_justification : justification parameter used for text +//! justification. The most common values of text_justification are +//! 0., 0.5, or 1. corresponding to a text that is left justified, +//! centred, or right justified within the text area, but other values +//! are allowed as well. +//! @param text_colors : array of nlegend text colors (cmap0 indices). +//! @param text : array of nlegend text annotations +//! @param line_colors : array of nlegend line colors (cmap0 indices) +//! (PL_LEGEND_LINE) +//! @param line_styles : array of nlegend line styles (plsty indices) +//! (PL_LEGEND_LINE) +//! @param line_widths : array of nlegend line widths (PL_LEGEND_LINE) +//! @param symbol_numbers : array of nlegend numbers of symbols to be +//! drawn across the width of the plotted area (PL_LEGEND_SYMBOL) +//! @param symbol_colors : array of nlegend symbol colors (cmap0 +//! indices) (PL_LEGEND_SYMBOL) +//! @param symbol_scales : array of nlegend scale values for the +//! symbol height (PL_LEGEND_SYMBOL) +//! @param symbols : array of nlegend symbols (plpoin indices) +//! (PL_LEGEND_SYMBOL) +//! @param cmap0_colors : array of nlegend colors (cmap0 indices) for +//! the discrete colored boxes (PL_LEGEND_CMAP0) +//! @param cmap1_colors : array of nlegend colors (cmap1 values) for +//! the discrete colored boxes (PL_LEGEND_CMAP1) +//! @param cmap_patterns : array of nlegend patterns (plpsty indices) +//! for the discrete colored boxes (PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1) +//! @param cmap_scales : array of nlegend scales (units of fraction of +//! character height) for the height of the discrete colored boxes +//! (PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1) //! -// N.B. the total width of the legend is made up of plplot_width + -// text_offset (converted to normalized viewport coordinates) + width -// of the longest string. The latter quantity is calculated internally -// using plstrl and converted to normalized viewport coordinates. -// -// x, y: Normalized position of the upper-left corner of the -// legend in the viewport. -// nlegend: Number of legend entries -// text_colors: Color map 0 indices of the colors to use for label text -// text: text string for each legend entry -// cmap0_colors: cmap0 color index for each legend entry -// nsymbols: number of points/symbols to be drawn for each plot_width -// symbols: Symbol to draw for each legend entry. +//! N.B. the total width of the legend is made up of plplot_width + +//! text_offset (converted to normalized subpage coordinates) + width +//! of the longest text string. The latter quantity is calculated +//! internally and converted to normalized subpage coordinates. The +//! total height of the legend is nlegend * text_spacing * character +//! height, where the latter quantity is calculated internally and +//! converted to normalized subpage coordinates. The legend is clipped +//! at the edges of the current subpage. +//! void -c_pllegend( PLINT opt, PLFLT plot_width, - PLFLT x, PLFLT y, PLINT bg_color, - PLINT *opt_array, PLINT nlegend, +c_pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, + PLINT nlegend, PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLINT text_justification, PLINT *text_colors, char **text, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT *nsymbols, PLINT *symbol_colors, + PLINT *symbol_numbers, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, PLINT *cmap0_colors, PLFLT *cmap1_colors, PLINT *cmap_patterns, PLFLT *cmap_scales ) @@ -144,8 +205,8 @@ PLFLT x_world_per_mm, y_world_per_mm, text_width0 = 0., text_width; PLFLT total_width_border, total_width, total_height; - PLINT some_lines = 0, some_symbols = 0, some_cmaps = 0; - PLINT max_nsymbols = 0; + PLINT some_lines = 0, some_symbols = 0, some_cmaps = 0; + PLINT max_symbol_numbers = 0; plgvpd( &xdmin_save, &xdmax_save, &ydmin_save, &ydmax_save ); plgvpw( &xwmin_save, &xwmax_save, &ywmin_save, &ywmax_save ); @@ -162,8 +223,8 @@ some_lines = 1; if ( opt_array[i] & PL_LEGEND_SYMBOL ) { - max_nsymbols = MAX( max_nsymbols, nsymbols[i] ); - some_symbols = 1; + max_symbol_numbers = MAX( max_symbol_numbers, symbol_numbers[i] ); + some_symbols = 1; } if ( opt_array[i] & ( PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1 ) ) some_cmaps = 1; @@ -253,9 +314,9 @@ if ( some_symbols ) { - max_nsymbols = MAX( 2, max_nsymbols ); - if ( ( ( xs = (PLFLT *) malloc( max_nsymbols * sizeof ( PLFLT ) ) ) == NULL ) || - ( ( ys = (PLFLT *) malloc( max_nsymbols * sizeof ( PLFLT ) ) ) == NULL ) ) + max_symbol_numbers = MAX( 2, max_symbol_numbers ); + if ( ( ( xs = (PLFLT *) malloc( max_symbol_numbers * sizeof ( PLFLT ) ) ) == NULL ) || + ( ( ys = (PLFLT *) malloc( max_symbol_numbers * sizeof ( PLFLT ) ) ) == NULL ) ) { plexit( "pllegend: Insufficient memory" ); } @@ -316,13 +377,13 @@ { plcol0( symbol_colors[i] ); plssym( 0., symbol_scales[i] ); - dxs = ( plot_x_end_world - plot_x_world - symbol_width ) / (double) ( MAX( nsymbols[i], 2 ) - 1 ); - for ( j = 0; j < nsymbols[i]; j++ ) + dxs = ( plot_x_end_world - plot_x_world - symbol_width ) / (double) ( MAX( symbol_numbers[i], 2 ) - 1 ); + for ( j = 0; j < symbol_numbers[i]; j++ ) { xs[j] = plot_x_world + 0.5 * symbol_width + dxs * (double) j; ys[j] = ty; } - plpoin( nsymbols[i], xs, ys, symbols[i] ); + plpoin( symbol_numbers[i], xs, ys, symbols[i] ); } } if ( some_symbols ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-28 17:50:06
|
Revision: 11230 http://plplot.svn.sourceforge.net/plplot/?rev=11230&view=rev Author: airwin Date: 2010-09-28 17:49:52 +0000 (Tue, 28 Sep 2010) Log Message: ----------- PL_LEGEND_NONE #defined to indicate the plotted area of a particular legend entry should have nothing plotted. text_justification argument changed from PLINT to the correct PLFLT. Thanks to Hez for spotting these two issues. Modified Paths: -------------- trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-28 05:58:58 UTC (rev 11229) +++ trunk/include/plplot.h 2010-09-28 17:49:52 UTC (rev 11230) @@ -1209,6 +1209,7 @@ /* Routine for drawing line, symbol, cmap0, or cmap1 legends */ // Flags for pllegend. +#define PL_LEGEND_NONE 0 #define PL_LEGEND_LINE 1 #define PL_LEGEND_SYMBOL 2 #define PL_LEGEND_CMAP0 4 @@ -1220,7 +1221,7 @@ c_pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, PLINT nlegend, PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, - PLINT text_justification, PLINT *text_colors, char **text, + PLFLT text_justification, PLINT *text_colors, char **text, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, PLINT *symbol_numbers, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-28 05:58:58 UTC (rev 11229) +++ trunk/src/pllegend.c 2010-09-28 17:49:52 UTC (rev 11230) @@ -115,11 +115,11 @@ //! @param nlegend : number of legend entries //! @param opt_array : array of nlegend values of options to control //! each individual plotted area corresponding to a legend entry. If -//! the PL_LEGEND_CMAP0, PL_LEGEND_CMAP1, PL_LEGEND_LINE, and/or -//! PL_LEGEND_SYMBOL bits are set, the plotted area corresponding to a -//! legend entry is specified with a colored box (with the color of -//! that box determined by either a cmap0 index or a cmap1 value); a -//! line; and/or a line of symbols +//! the PL_LEGEND_NONE, PL_LEGEND_CMAP0, PL_LEGEND_CMAP1, +//! PL_LEGEND_LINE, and/or PL_LEGEND_SYMBOL bits are set, the plotted +//! area corresponding to a legend entry is specified with nothing; a +//! colored box (with the color of that box determined by either a +//! cmap0 index or a cmap1 value); a line; and/or a line of symbols //! @param text_offset : offset of the text area from the plot area in //! units of character width //! @param text_scale : character height scale for text annotations @@ -169,7 +169,7 @@ c_pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, PLINT nlegend, PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, - PLINT text_justification, PLINT *text_colors, char **text, + PLFLT text_justification, PLINT *text_colors, char **text, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, PLINT *symbol_numbers, PLINT *symbol_colors, PLFLT *symbol_scales, PLINT *symbols, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-10-01 21:12:21
|
Revision: 11238 http://plplot.svn.sourceforge.net/plplot/?rev=11238&view=rev Author: airwin Date: 2010-10-01 21:12:14 +0000 (Fri, 01 Oct 2010) Log Message: ----------- Use "const" attribute for all arrays in pllegend argument list since none of those array values are changed within pllegend. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/examples/c/x26c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-10-01 05:42:41 UTC (rev 11237) +++ trunk/examples/c/x04c.c 2010-10-01 21:12:14 UTC (rev 11238) @@ -144,7 +144,7 @@ pllegend( PL_LEGEND_BACKGROUND, 0.57, 0.85, 0.06, 15, nlegend, opt_array, 1.0, 1.0, 2.0, - 1., text_colors, text, + 1., text_colors, (const char **) text, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); Modified: trunk/examples/c/x26c.c =================================================================== --- trunk/examples/c/x26c.c 2010-10-01 05:42:41 UTC (rev 11237) +++ trunk/examples/c/x26c.c 2010-10-01 21:12:14 UTC (rev 11238) @@ -243,7 +243,7 @@ pllegend( PL_LEGEND_BACKGROUND, 0.57, 0.85, 0.06, 15, nlegend, opt_array, 1.0, 1.0, 2.0, - 1., text_colors, legend_text, + 1., text_colors, (const char **) legend_text, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-10-01 05:42:41 UTC (rev 11237) +++ trunk/include/plplot.h 2010-10-01 21:12:14 UTC (rev 11238) @@ -1218,13 +1218,16 @@ PLDLLIMPEXP void c_pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, - PLINT nlegend, PLINT *opt_array, + PLINT nlegend, const PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, - PLFLT text_justification, PLINT *text_colors, char **text, - PLINT *box_colors, PLINT *box_patterns, PLFLT *box_scales, - PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT *symbol_colors, PLFLT *symbol_scales, - PLINT *symbol_numbers, PLINT *symbols ); + PLFLT text_justification, + const PLINT *text_colors, const char **text, + const PLINT *box_colors, const PLINT *box_patterns, + const PLFLT *box_scales, + const PLINT *line_colors, const PLINT *line_styles, + const PLINT *line_widths, + const PLINT *symbol_colors, const PLFLT *symbol_scales, + const PLINT *symbol_numbers, const PLINT *symbols ); /* Sets position of the light source */ PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-10-01 05:42:41 UTC (rev 11237) +++ trunk/src/pllegend.c 2010-10-01 21:12:14 UTC (rev 11238) @@ -165,13 +165,16 @@ void c_pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, - PLINT nlegend, PLINT *opt_array, + PLINT nlegend, const PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, - PLFLT text_justification, PLINT *text_colors, char **text, - PLINT *box_colors, PLINT *box_patterns, PLFLT *box_scales, - PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT *symbol_colors, PLFLT *symbol_scales, - PLINT *symbol_numbers, PLINT *symbols ) + PLFLT text_justification, + const PLINT *text_colors, const char **text, + const PLINT *box_colors, const PLINT *box_patterns, + const PLFLT *box_scales, + const PLINT *line_colors, const PLINT *line_styles, + const PLINT *line_widths, + const PLINT *symbol_colors, const PLFLT *symbol_scales, + const PLINT *symbol_numbers, const PLINT *symbols ) { // Viewport world-coordinate limits This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-10-03 14:03:19
|
Revision: 11244 http://plplot.svn.sourceforge.net/plplot/?rev=11244&view=rev Author: hbabcock Date: 2010-10-03 14:03:11 +0000 (Sun, 03 Oct 2010) Log Message: ----------- Updated for the 5.9.8 release. Modified Paths: -------------- trunk/OLD-README.release trunk/README.release Modified: trunk/OLD-README.release =================================================================== --- trunk/OLD-README.release 2010-10-03 13:40:40 UTC (rev 11243) +++ trunk/OLD-README.release 2010-10-03 14:03:11 UTC (rev 11244) @@ -1,3 +1,969 @@ +PLplot Release 5.9.7 +~~~~~~~~~~~~~~~~~~~~ +This is a development release of PLplot. It represents the ongoing efforts +of the community to improve the PLplot plotting package. Development +releases in the 5.9.x series will be available every few months. The next +stable release will be 5.10.0. + + If you encounter a problem that is not already documented in the +PROBLEMS file or on our bugtracker, then please send bug reports to PLplot +developers via the mailing lists at +http://sourceforge.net/mail/?group_id=2915 (preferred) or on our bugtracker +at http://sourceforge.net/tracker/?group_id=2915&atid=102915. + + Please see the license under which this software is distributed +(LGPL), and the disclaimer of all warranties, given in the COPYING.LIB +file. + +Official Notices for Users. + +I. As of release 5.9.1 we have removed our previously deprecated +autotools-based build system. Instead, use the CMake-based build system +following the directions in the INSTALL file. + +II. As of release 5.9.1 we no longer support Octave-2.1.73 which has a +variety of run-time issues in our tests of the Octave examples on different +platforms. In contrast our tests show we get good run-time results with all +our Octave examples for Octave-3.0.1. Also, that is the recommended stable +version of Octave at http://www.gnu.org/software/octave/download.html so +that is the only version of Octave we support at this time. + +III. As of release 5.9.1 we have decided for consistency sake to change the +PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and +plsc->vpwyma and the results returned by plgvpw to reflect the exact window +limit values input by users using plwind. Previously to this change, the +stream variables and the values returned by plgvpw reflected the internal +slightly expanded range of window limits used by PLplot so that the user's +specified limits would be on the graph. Two users noted this slight +difference, and we agree with them it should not be there. Note that +internally, PLplot still uses the expanded ranges so most users results will +be identical. However, you may notice some small changes to your plot +results if you use these stream variables directly (only possible in C/C++) +or use plgvpw. + +IV. As of release 5.9.2 we have set HAVE_PTHREAD to ON by default for all +platforms other than Darwin. Darwin will follow later once it appears the +Apple version of X supports it. + +V. As of release 5.9.3 our build system requires CMake version 2.6.0 or +higher. + +VI. As of release 5.9.3 we have deprecated the gcw device driver and the +related gnome2 and pygcw bindings since these are essentially unmaintained. +For example, the gcw device and associated bindings still depends on the +plfreetype approach for accessing unicode fonts which has known issues +(inconsistent text offsets, inconvenient font setting capabilities, and +incorrect rendering of CTL languages). To avoid these issues we advise +using the xcairo device and the externally supplied XDrawable or Cairo +context associated with the xcairo device and the extcairo device (see +examples/c/README.cairo) instead. If you still absolutely must use -dev gcw +or the related gnome2 or pygcw bindings despite the known problems, then +they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or +ENABLE_pygcw to ON. +N.B. This announcement has been superseded by the subsequent retirement +of gcw, gnome2, and pygcw, see announcement XVII. + +VII. As of release 5.9.3 we have deprecated the gd device driver which +implements the png, jpeg, and gif devices. This device driver is +essentially unmaintained. For example, it still depends on the plfreetype +approach for accessing unicode fonts which has known issues (inconsistent +text offsets, inconvenient font setting capabilities, and incorrect +rendering of CTL languages). To avoid these issues for PNG format, we +advise using the pngcairo or pngqt devices. To avoid these issues for the +JPEG format, we advise using the jpgqt device. PNG is normally considered a +better raster format than GIF, but if you absolutely require GIF format, we +advise using the pngcairo or pngqt devices and then downgrading the results +to the GIF format using the ImageMagick "convert" application. For those +platforms where libgd (the dependency of the gd device driver) is accessible +while the required dependencies of the cairo and/or qt devices are not +accessible, you can still use these deprecated devices by setting PLD_png, +PLD_jpeg, or PLD_gif to ON. + +VIII. As of release 5.9.3 we have re-enabled the tk, itk, and itcl components +of PLplot by default that were disabled by default as of release 5.9.1 due +to segfaults. The cause of the segfaults was a bug (now fixed) in how +pthread support was implemented for the Tk-related components of PLplot. + +IX. As of release 5.9.4 we have deprecated the pbm device driver (containing +the pbm device) because glibc detects a catastrophic double free. + +X. As of release 5.9.5 we have removed pyqt3 access to PLplot and +replaced it by pyqt4 access to PLplot (see details below). + +XI. As of release 5.9.5 the only method of specifying a non-default compiler +(and associated compiler options) that we support is the environment +variable approach, e.g., + +export CC='gcc -g -fvisibility=hidden' +export CXX='g++ -g -fvisibility=hidden' +export FC='gfortran -g -fvisibility=hidden' + +All other CMake methods of specifying a non-default compiler and associated +compiler options will not be supported until CMake bug 9220 is fixed, see +discussion below of the soft-landing re-implementation for details. + +XII. As of release 5.9.5 we have retired the hpgl driver (containing the +hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp +device), the ljii driver (containing the ljii and ljiip devices), and the +tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, +tek4010f, versaterm, vlt, and xterm devices). Retirement means we have +removed the build options which would allow these devices to build and +install. Recent tests have shown a number of run-time issues (hpgl, +impress, and ljii) or build-time issues (tek) with these devices, and as far +as we know there is no more user interest in them. Therefore, we have +decided to retire these devices rather than fix them. + +XIII. As of release 5.9.6 we have retired the pbm driver containing the pbm +(actually portable pixmap) file device. This device is quite primitive and +poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font +fallback), falls back to ugly software fills, doesn't support alpha +transparency, etc. It also has a serious run-time issue with example 2 +(double free detected by glibc) which probably indicates some fundamental +issue with the 100 colours in cmap0 for that example. For those who really +need portable pixmap results, we suggest using the ImageMagick convert +programme, e.g., "convert examples/x24c01.pngqt test.ppm" or "convert +examples/x24c01.pngcairo test.ppm" to produce good-looking portable pixmap +results from our best png device results. + +XIV. As of release 5.9.6 we have retired the linuxvga driver +containing the linuxvga interactive device. This device is quite +primitive, difficult to test, and poorly maintained. It ignores +unicode fonts (i.e., uses the Hershey font fallback), falls back to +ugly software fills, doesn't support alpha transparency, etc. It is +Linux only, can only be run as root, and svgalib (the library used by +linuxsvga) is not supported by some mainstream (e.g., Intel) chipsets. +All of these characteristics make it difficult to even test this +device much less use it for anything serious. Finally, it has had a +well-known issue for years (incorrect colours) which has never been +fixed indicating nobody is interested in maintaining this device. + +XV. As of release 5.9.6 we have retired our platform support of djgpp +that used to reside in sys/dos/djgpp. The developer (Andrew Roach) +who used to maintain those support files for djgpp feels that the +djgpp platform is no longer actively developed, and he no longer uses +djgpp himself. + +XVI. As of release 5.9.6 plpoin results for ascii codes 92, 94, and 95 +are changed from centred dot, degree symbol, and centred dot glyphs to +the correct backslash, caret, and underscore glyphs that are +associated with those ascii indices. This change is consistent with +the documentation of plpoin and solves a long-standing issue with +backslash, caret, and underscore ascii characters in character strings +used for example by pl[mp]tex. Those who need access to a centred dot +with plpoin should use index 1. The degree symbol is no longer +accessible with plpoin, but it is available in ordinary text input to +PLplot as Hershey escape "#(718)", where 718 is the Hershey index of +the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the +unicode index for the degree symbol or direct UTF8 unicode string "°". + +XVII. As of release 5.9.6 we have retired the gcw device driver and +the related gnome2 and pygcw bindings since these are unmaintained and +there are good replacements. These components of PLplot were +deprecated as of release 5.9.3. A good replacement for the gcw device +is either the xcairo or qtwidget device. A good replacement for the +gnome2 bindings is the externally supplied XDrawable or Cairo context +associated with the xcairo device and the extcairo device (see +examples/c/README.cairo). A good replacement for pygcw is our new +pyqt4 bindings for PLplot. + +XVIII. As of release 5.9.6 we have deprecated support for the python +Numeric array extensions. Numeric is no longer maintained and users +of Numeric are advised to migrate to numpy. Numpy has been the standard +for PLplot for some time. If numpy is not present PLplot will now +disable python by default. If you still require Numeric support in the +short term then set USE_NUMERIC to ON in cmake. The PLplot support +for Numeric will be dropped in a future release. + +XVIV. It has come to our attention that the version of gdc supplied with +several recent versions of Ubuntu has a very serious bug on 64-bit +systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) +which causes several of the plplot D examples to crash. If this +affects you, you are recommended to disable the d bindings or switch to +an alternative d compiler (the Digital Mars compiler is reported to +be good). + +INDEX + +0. Tests made for release 5.9.7 + +1. Changes relative to PLplot 5.9.6 (the previous development release) + +1.1 Alpha value support for plotting in memory. +1.2 Add a Qt device for in memory plotting. +1.3 Add discrete legend capability. + + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +2.1 All autotools-related files have now been removed +2.2 Build system bug fixes +2.3 Build system improvements +2.4 Implement build-system infrastructure for installed Ada bindings and +examples +2.5 Code cleanup +2.6 Date / time labels for axes +2.7 Alpha value support +2.8 New PLplot functions +2.9 External libLASi library improvements affecting our psttf device +2.10 Improvements to the cairo driver family +2.11 wxWidgets driver improvements +2.12 pdf driver improvements +2.13 svg driver improvements +2.14 Ada language support +2.15 OCaml language support +2.16 Perl/PDL language support +2.17 Update to various language bindings +2.18 Update to various examples +2.19 Extension of our test framework +2.20 Rename test subdirectory to plplot_test +2.21 Website support files updated +2.22 Internal changes to function visibility +2.23 Dynamic driver support in Windows +2.24 Documentation updates +2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm +2.26 get-drv-info now changed to test-drv-info +2.27 Text clipping now enabled by default for the cairo devices +2.28 A powerful qt device driver has been implemented +2.29 The PLplot API is now accessible from Qt GUI applications +2.30 NaN / Inf support for some PLplot functions +2.31 Various bug fixes +2.32 Cairo driver improvements +2.33 PyQt changes +2.34 Color Palettes +2.35 Re-implementation of a "soft landing" when a bad/missing compiler is +detected +2.36 Make PLplot aware of LC_NUMERIC locale +2.37 Linear gradients have been implemented +2.38 Cairo Windows driver implemented +2.39 Custom axis labeling implemented +2.40 Universal coordinate transform implemented +2.41 Support for arbitrary storage of 2D user data +2.42 Font improvements +2.42 Alpha value support for plotting in memory. +2.43 Add a Qt device for in memory plotting. +2.44 Add discrete legend capability. + + +0. Tests made for release 5.9.7 + +See +http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot#Testing_Reports +for a summary table of all testing done for PLplot-5.9.7. + +1. Changes relative to PLplot 5.9.6 (the previous development release) + +1.1 Alpha value support for plotting in memory. + +The function plsmema() was added to the PLplot API. This allows the user +to supply a RGBA formatted array that PLplot can use to do in memory +plotting with alpha value support. At present only the memcairo device +is capable of using RGBA formatted memory. The mem device, at least +for the time being, only supports RGB formatted memory and will exit +if the user attempts to give it RGBA formatted memory to plot in. + +1.2 Add a Qt device for in memory plotting. + +A new device called memqt has been added for in memory plotting using +Qt. This device is the Qt equivalent of the memcairo device. + +1.3 Add discrete legend capability. + +A new routine called pllegend has been added to our core C API. +(N.B. This is an experimental API that may be subject to further +change as we gain more experience with it.) This routine creates a +discrete plot legend with a plotted box, line, and/or line of symbols +for each annotated legend entry. The arguments of pllegend provide +control over the location and size of the legend within the current +subpage as well as the location and characteristics of the elements +(most of which are optional) within that legend. The resulting legend +is clipped at the boundaries of the current subpage + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +2.1 All autotools-related files have now been removed + +CMake is now the only supported build system. It has been tested on +Linux / Unix, Mac OS-X and Windows platforms. + +2.2 Build system bug fixes + +Various fixes include the following: + +Ctest will now work correctly when the build tree path includes symlinks. + +Dependencies for swig generated files fixed so they are not rebuilt every +time make is called. + +Various dependency fixes to ensure that parallel builds (using make -j) +work under unix. + +2.3 Build system improvements + +We now transform link flag results delivered to the CMake environment by +pkg-config into the preferred CMake form of library information. The +practical effect of this improvement is that external libraries in +non-standard locations now have their rpath options set correctly for our +build system both for the build tree and the install tree so you don't have +to fiddle with LD_LIBRARY_PATH, etc. + +2.4 Implement build-system infrastructure for installed Ada bindings and +examples + +Install source files, library information files, and the plplotada library +associated with the Ada bindings. Configure and install the pkg-config file +for the plplotada library. Install the Ada examples and a configured Makefile +to build them in the install tree. + +2.5 Code cleanup + +The PLplot source code has been cleaned up to make consistent use of +(const char *) and (char *) throughout. Some API functions have changed +to use const char * instead of char * to make it clear that the strings +are not modified by the function. The C and C++ examples have been updated +consistent with this. These changes fix a large number of warnings +with gcc-4.2. Note: this should not require programs using PLplot to be +recompiled as it is not a binary API change. + +There has also been some cleanup of include files in the C++ examples +so the code will compile with the forthcoming gcc-4.3. + +2.6 Date / time labels for axes + +PLplot now allows date / time labels to be used on axes. A new option +('d') is available for the xopt and yopt arguments to plbox which +indicates that the axis should be interpreted as a date / time. Similarly +there is a new range of options for plenv to select date / time labels. +The time format is seconds since the epoch (usually 1 Jan 1970). This +format is commonly used on most systems. The C gmtime routine can be +used to calculate this for a given date and time. The format for the +labels is controlled using a new pltimefmt function, which takes a +format string. All formatting is done using the C strftime function. +See documentation for available options on your platform. Example 29 +demonstrates the new capabilities. + +N.B. Our reliance on C library POSIX time routines to (1) convert from +broken-down time to time-epoch, (2) to convert from time-epoch to +broken-down time, and (3) to format results with strftime have proved +problematic for non-C languages which have time routines of variable +quality. Also, it is not clear that even the POSIX time routines are +available on Windows. So we have plans afoot to implement high-quality +versions of (1), (2), and (3) with additional functions to get/set the epoch +in the PLplot core library itself. These routines should work on all C +platforms and should also be uniformly accessible for all our language +bindings. + +WARNING..... Therefore, assuming these plans are implemented, the present +part of our date/time PLplot API that uses POSIX time routines will be +changed. + +2.7 Alpha value support + +PLplot core has been modified to support a transparency or alpha value +channel for each color in color map 0 and 1. In addition a number of new +functions were added the PLplot API so that the user can both set and query +alpha values for color in the two color maps. These functions have the same +name as their non-alpha value equivalents, but with a an "a" added to the +end. Example 30 demonstrates some different ways to use these functions +and the effects of alpha values, at least for those drivers that support alpha +values. This change should have no effect on the device drivers that do not +currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and +aquaterm drivers support alpha values. There are some limitations with the gd +driver due to transparency support in the underlying libgd library. + +2.8 New PLplot functions + +An enhanced version of plimage, plimagefr has been added. This allows images +to be plotted using coordinate transformation, and also for the dynamic range +of the plotted values to be altered. Example 20 has been modified to +demonstrate this new functionality. + +To ensure consistent results in example 21 between different platforms and +language bindings PLplot now includes a small random number generator within +the library. plrandd will return a PLFLT random number in the range 0.0-1.0. +plseed will allow the random number generator to be seeded. + +2.9 External libLASi library improvements affecting our psttf device + +Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been +released at http://sourceforge.net/svn/?group_id=187113 . We recommend +using this latest version of libLASi for building PLplot and the psttf +device since this version of libLASi is more robust against glyph +information returned by pango/cairo/fontconfig that on rare occasions is not +suitable for use by libLASi. + +2.10 Improvements to the cairo driver family + +Jonathan Woithe improved the xcairo driver so that it can optionally be +used with an external user supplied X Drawable. This enables a nice +separation of graphing (PLplot) and window management (Gtk, etc..). Doug +Hunt fixed the bugs that broke the memcairo driver and it is now fully +functional. Additionally, a new extcairo driver was added that will plot +into a user supplied cairo context. + +2.11 wxWidgets driver improvements + +Complete reorganization of the driver code. A new backend was added, based +on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 +and later. This backend produces antialized output similar to the +AGG backend but has no dependency on the AGG library. The basic wxDC +backend and the wxGraphicsContext backend process the text output +on their own, which results in much nicer plots than with the standard +Hershey fonts and is much faster than using the freetype library. New +options were introduced in the wxWidgets driver: + - backend: Choose backend: (0) standard, (1) using AGG library, + (2) using wxGraphicsContext + - hrshsym: Use Hershey symbol set (hrshsym=0|1) + - text: Use own text routines (text=0|1) + - freetype: Use FreeType library (freetype=0|1) +The option "text" changed its meaning, since it enabled the FreeType library +support, while now the option enables the driver's own text routines. + +Some other features were added: + * the wxWidgets driver now correctly clears the background (or parts of it) + * transparency support was added + * the "locate mode" (already available in the xwin and tk driver) was + implemented, where graphics input events are processed and translated + to world coordinates + +2.12 pdf driver improvements + +The pdf driver (which is based on the haru library http://www.libharu.org) +processes the text output now on its own. So far only the Adobe Type1 +fonts are supported. TrueType font support will follow. Full unicode +support will follow after the haru library will support unicode strings. The +driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font +may be used only for symbols. Output can now be compressed, resulting in +much smaller file sizes. +Added new options: + - text: Use own text routines (text=0|1) + - compress: Compress pdf output (compress=0|1) + - hrshsym: Use Hershey symbol set (hrshsym=0|1) + - pagesize: Set page size (pagesize=A4|letter|A3|A5) + +2.13 svg driver improvements + +This device driver has had the following improvements: schema for generated +file now validates properly at http://validator.w3.org/ for the +automatically detected document type of SVG 1.1; -geometry option now works; +alpha channel transparency has been implemented; file familying for +multipage examples has been implemented; coordinate scaling has been +implemented so that full internal PLplot resolution is used; extraneous +whitespace and line endings that were being injected into text in error have +now been removed; and differential correction to string justification is now +applied. + +The result of these improvements is that our SVG device now gives the +best-looking results of all our devices. However, currently you must be +careful of which SVG viewer or editor you try because a number of them have +some bugs that need to be resolved. For example, there is a librsvg bug in +text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that +affects all svg use within GNOME as well as the ImageMagick "display" +application. However, at least the latest konqueror and firefox as well as +inkscape and scribus-ng (but not scribus!) give outstanding looking results +for files generated by our svg device driver. + +2.14 Ada language support + +We now have a complete Ada bindings implemented for PLplot. We also have a +complete set of our standard examples implemented in Ada which give results +that are identical with corresponding results for the C standard examples. +This is an excellent test of a large subset of the Ada bindings. We now +enable Ada by default for our users and request widespread testing of this +new feature. + +2.15 OCaml language support + +Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml +bindings implemented for PLplot. We also have a complete set of our standard +examples implemented in OCaml which give results that are identical with +corresponding results for the C standard examples. This is an excellent test +of a large subset of the OCaml bindings. We now enable OCaml by default for +our users and request widespread testing of this new feature. + +2.16 Perl/PDL language support + +Thanks to Doug Hunt's efforts the external Perl/PDL module, +PDL::Graphics::PLplot version 0.46 available at +http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date +to give access to recently added PLplot API. The instructions for how to +install this module on top of an official PDL release are given in +examples/perl/README.perldemos. Doug has also finished implementing a +complete set of standard examples in Perl/PDL which are part of PLplot and +which produce identical results to their C counterparts if the above updated +module has been installed. Our build system tests the version of +PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the +list of Perl/PDL examples that are run as part of our standard tests is +substantially reduced to avoid examples that use the new functionality. In +sum, if you use PDL::Graphics::PLplot version 0.46 or later the full +complement of PLplot commands is available to you from Perl/PDL, but +otherwise not. + +2.17 Updates to various language bindings + +A concerted effort has been made to bring all the language bindings up to +date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, +Perl/PDL, Python, and Tcl now all support the common PLplot API (with the +exception of the mapping functions which are not yet implemented for all +bindings due to technical issues.) This is a significant step forward for +those using languages other than C. + +2.18 Updates to various examples + +To help test the updates to the language bindings the examples have been +thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set +of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, +Python and Tcl are missing example 19 because of the issue with the mapping +functions. The examples have also been checked to ensure consistent results +between different language bindings. Currently there are still some minor +differences in the results for the tcl examples, probably due to rounding +errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for +proper support for NaNs. + +Also new is an option for the plplot_test.sh script to run the examples +using a debugging command. This is enabled using the --debug option. The +default it to use the valgrind memory checker. This has highlighted at +least one memory leaks in PLplot which have been fixed. It is not part +of the standard ctest tests because it can be _very_ slow for a complete +set of language bindings and device drivers. + +2.19 Extension of our test framework + +The standard test suite for PLplot now carries out a comparison of the +stdout output (especially important for example 31 which tests most of our +set and get functions) and PostScript output for different languages as a +check. Thanks to the addition of example 31, the inclusion of examples 14 +and 17 in the test suite and other recent extensions of the other +examples we now have rigourous testing in place for almost the entirety +of our common API. This extensive testing framework has already helped +us track down a number of bugs, and it should make it much easier for us +to maintain high quality for our ongoing PLplot releases. + +2.20 Rename test subdirectory to plplot_test + +This change was necessary to quit clashing with the "make test" target which +now works for the first time ever (by executing ctest). + +2.21 Website support files updated + +Our new website content is generated with PHP and uses CSS (cascaded style +sheets) to implement a consistent style. This new approach demanded lots of +changes in the website support files that are used to generate and upload +our website and which are automatically included with the release. + +2.22 Internal changes to function visibility + +The internal definitions of functions in PLplot have been significantly +tidied up to allow the use of the -fvisibility=hidden option with newer +versions of gcc. This prevents internal functions from being exported +to the user where possible. This extends the existing support for this +on windows. + +2.23 Dynamic driver support in Windows + +An interface based on the ltdl library function calls was established +which allows to open and close dynamic link libraries (DLL) during +run-time and call functions from these libraries. As a consequence +drivers can now be compiled into single DLLs separate from the core +PLplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now +ON by default for Windows if a shared PLplot library is built. + +2.24 Documentation updates + +The DocBook documentation has been updated to include many of the +C-specific functions (for example plAlloc2dGrid) which are not part +of the common API, but are used in the examples and may be helpful +for PLplot users. + +2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm + +CGM format is a long-established (since 1987) open standard for vector +graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). +PLplot has long had a cgm device driver which depended on the (mostly) +public domain libcd library that was distributed in the mid 90's by National +Institute of Standards and Technology (NIST) and which is still available +from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience +to our -dev cgm users, we have brought that +source code in house under lib/nistcd and now build libnistcd routinely +as part of our ordinary builds. The only changes we have made to the +cd1.3 source code is visibility changes in cd.h and swapping the sense of +the return codes for the test executables so that 0 is returned on success +and 1 on failure. If you want to test libnistcd on your platform, +please run + +make test_nistcd + +in the top-level build tree. (That tests runs all the test executables +that are built as part of cd1.3 and compares the results that are generated +with the *.cgm files that are supplied as part of cd1.3.) + +Two applications that convert and/or display CGM results on Linux are +ralcgm (which is called by the ImageMagick convert and display applications) +and uniconvertor. + +Some additional work on -dev cgm is required to implement antialiasing and +non-Hershey fonts, but both those should be possible using libnistcd according +to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. + +2.26 get-drv-info now changed to test-drv-info + +To make cross-building much easier for PLplot we now configure the *.rc +files that are used to describe our various dynamic devices rather than +generating the required *.rc files with get-drv-info. We have changed the +name of get-drv-info to test-drv-info. That name is more appropriate +because that executable has always tested dynamic loading of the driver +plug-ins as well as generating the *.rc files from the information gleaned +from that dynamic loading. Now, we simply run test-drv-info as an option +(defaults to ON unless cross-building is enabled) and compare the resulting +*.rc file with the one configured by cmake to be sure the dynamic device +has been built correctly. + +2.27 Text clipping now enabled by default for the cairo devices + +When correct text clipping was first implemented for cairo devices, it was +discovered that the libcairo library of that era (2007-08) did that clipping +quite inefficiently so text clipping was disabled by default. Recent tests +of text clipping for the cairo devices using libcairo 1.6.4 (released in +2008-04) shows text clipping is quite efficient now. Therefore, it is now +enabled by default. If you notice a significant slowdown for some libcairo +version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for +your cairo device plots (and accept the improperly clipped text results that +might occur with that option). Better yet, use libcairo 1.6.4 or later. + +2.28 A powerful qt device driver has been implemented + +Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt +device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, +jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an +elementary interactive device where, for now, the possible interactions +consist of resizing the window and right clicking with the mouse (or hitting +<return> to be consistent with other PLplot interactive devices) to control +paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, +pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified +in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable +pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, +svgqt are file devices whose overall sizes are specified in points (1/72 of +an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG +formatted files. The qt device driver is based on the powerful facilities +of Qt4 so all qt devices implement variable opacity (alpha channel) effects +(see example 30). The qt devices also use system unicode fonts, and deal +with CTL (complex text layout) languages automatically without any +intervention required by the user. (To show this, try qt device results +from examples 23 [mathematical symbols] and 24 [CTL languages].) + +Our exhaustive Linux testing of the qt devices (which consisted of detailed +comparisons for all our standard examples between qt device results and the +corresponding cairo device results) indicates this device driver is mature, +but testing on other platforms is requested to confirm that maturity. Qt-4.5 +(the version we used for most of our tests) has some essential SVG +functionality so we recommend that version (downloadable from +http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for +svgqt. One of our developers found that pdfqt was orders of magnitude +slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a +64 bit box. That problem was completely cured by moving to the downloadable +Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on +other platforms. One of our developers also found that all first pages of +examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. +From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we +assume this black first page for qtwidget problem also exists for Qt-4.4.3, +but we haven't tested that combination. + +In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, +but if you run into any difficulty with it please switch to Qt-4.5.x (once +Qt-4.5.x is installed all you have to do is to put the 4.5.x version of +qmake in your path, and cmake does the rest). If the problem persists for +Qt-4.5, then it is worth reporting a qt bug. + +2.29 The PLplot API is now accessible from Qt GUI applications + +This important new feature has been implemented by Alban Rochel of the QSAS +team as a spin-off of the qt device driver project using the extqt device +(which constitutes the tenth qt device). See examples/c++/README.qt_example +for a brief description of a simple Qt example which accesses the PLplot API +and which is built in the installed examples tree using the pkg-config +approach. Our build system has been enhanced to configure the necessary +plplotd-qt.pc file. + +2.30 NaN / Inf support for some PLplot functions + +Some PLplot now correctly handle Nan or Inf values in the data to be plotted. +Line plotting (plline etc) and image plotting (plimage, plimagefr) will +now ignore NaN / Inf values. Currently some of the contour plotting / 3-d +routines do not handle NaN / Inf values. This functionality will +depend on whether the language binding used supports NaN / Inf values. + +2.31 Various bug fixes + +Various bugs in the 5.9.3 release have been fixed including: + +- Include missing file needed for the aqt driver on Mac OS X +- Missing library version number for nistcd +- Fixes for the qt examples with dynamic drivers disabled +- Fixes to several tcl examples so they work with plserver +- Fix pkg-config files to work correctly with Debug / Release build types set +- Make fortran command line argument parsing work with shared libraries on Windows + +2.32 Cairo driver improvements + +Improvements to the cairo driver to give better results for bitmap +formats when used with anti-aliasing file viewers. + +2.33 PyQt changes + +Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot +(some of the functions in plplot_widgetmodule.c in bindings/python) and a +proof-of-concept example (prova.py and qplplot.py in examples/python), but +this code did not gain any developer interest and was therefore not +understood or maintained. Recently one of our core developers has +implemented a sip-generated pyqt4 interface to PLplot (controlled by +plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a +python extension module, and a good-looking pyqt4 example (pyqt4_example.py +in examples/python) that works well. Since this pyqt4 approach is +maintained by a PLplot developer it appears to have a good future, and we +have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot +interface and example completely. + +2.34 Color Palettes + +Support has been added to PLplot for user defined color palette files. +These files can be loaded at the command line using the -cmap0 or +-cmap1 commands, or via the API using the plspal0 and plspal1 commands. +The commands cmap0 / plspal0 are used to load cmap0 type files which +specify the colors in PLplot's color table 0. The commands cmap1 / +plspal1 are used to load cmap1 type files which specify PLplot's color +table 1. Examples of both types of files can be found in either the +plplot-source/data directory or the PLplot installed directory +(typically /usr/local/share/plplotx.y.z/ on Linux). + +2.35 Reimplementation of a "soft landing" when a bad/missing compiler is +detected + +The PLplot core library is written in C so our CMake-based build system will +error out if it doesn't detect a working C compiler. However all other +compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are +optional. If a working compiler is not available, we give a "soft landing" +(give a warning message, disable the optional component, and keep going). +The old implementation of the soft landing was not applied consistently (C++ +was unnecessarily mandatory before) and also caused problems for ccmake (a +CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end +to the cmake application) which incorrectly dropped languages as a result +even when there was a working compiler. + +We now have completely reimplemented the soft landing logic. The result +works well for cmake, ccmake, and cmake-gui. The one limitation of this new +method that we are aware of is it only recognizes either the default +compiler chosen by the generator or else a compiler specified by the +environment variable approach (see Official Notice XII above). Once CMake +bug 9220 has been fixed (so that the OPTIONAL signature of the +enable_language command actually works without erroring out), then our +soft-landing approach (which is a workaround for bug 9220) will be replaced +by the OPTIONAL signature of enable_language, and all CMake methods of +specifying compilers and compiler options will automatically be recognized +as a result. + +2.36 Make PLplot aware of LC_NUMERIC locale + +For POSIX-compliant systems, locale is set globally so any external +applications or libraries that use the PLplot library or any external +libraries used by the PLplot library or PLplot device drivers could +potentially change the LC_NUMERIC locale used by PLplot to anything those +external applications and libraries choose. The principal consequence of +such choice is the decimal separator could be a comma (for some locales) +rather than the period assumed for the "C" locale. For previous versions of +PLplot a comma decimal separator would have lead to a large number of +errors, but this issue is now addressed with a side benefit that our plots +now have the capability of displaying the comma (e.g., in axis labels) for +the decimal separator for those locales which require that. + +If you are not satisfied with the results for the default PLplot locale set +by external applications and libraries, then you can now choose the +LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line +option for PLplot (if you do not specify that option, a default locale is +chosen depending on applications and libraries external to PLplot (see +comments above), and (b) setting an environment variable (LC_ALL, +LC_NUMERIC, or LANG on Linux, for example) to some locale that has been +installed on your system. On Linux, to find what locales are installed, use +the "locale -a" option. The "C" locale is always installed, but usually +there is also a principal locale that works on a platform such as +en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build +and install any additional locale you desire. (For example, on Debian Linux +you do that by running "dpkg-reconfigure locales".) + +Normally, users will not use the -locale option since the period +decimal separator that you get for the normal LC_NUMERIC default "C" +locale used by external applications and libraries is fine for their needs. +However, if the resulting decimal separator is not what the user +wants, then they would do something like the following to (a) use a period +decimal separator for command-line input and plots: + +LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 + +or (b) use a comma decimal separator for command-line input and plots: + +LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 + +N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 +in the first case or -ori 0.5 in the second) the floating-point conversion +(using atof) is silently terminated at the wrong separator for the locale, +i.e., the fractional part of the number is silently dropped. This is +obviously not ideal, but on the other hand there are relatively few +floating-point command-line options for PLplot, and we also expect those who +use the -locale option to specifically ask for a given separator for plots +(e.g., axis labels) will then use it for command-line input of +floating-point values as well. + +Certain critical areas of the PLplot library (e.g., our colour palette file +reading routines and much of the code in our device drivers) absolutely +require a period for the decimal separator. We now protect those critical +areas by saving the normal PLplot LC_NUMERIC locale (established with the +above -locale option or by default by whatever is set by external +applications or libraries), setting the LC_NUMERIC "C" locale, executing the +critical code, then restoring back to the normal PLplot LC_NUMERIC locale. +Previous versions of PLplot did not have this protection of the critical +areas so were vulnerable to default LC_NUMERIC settings of external +applications that resulted in a comma decimal separator that did not work +correctly for the critical areas. + +2.37 Linear gradients have been implemented + +The new plgradient routine draws a linear gradient (based on the +current colour map 1) at a specified angle with the x axis for a +specified polygon. Standard examples 25 and 30 now demonstrate use of +plgradient. Some devices use a software fallback to render the +gradient. This fallback is implemented with plshades which uses a +series of rectangles to approximate the gradient. Tiny alignment +issues for those rectangles relative to the pixel grid may look +problematic for transparency gradients. To avoid that issue, we try +to use native gradient capability whenever that is possible for any of +our devices. Currently, this has been implemented for our svg, qt, +and cairo devices. The result is nice-looking smooth transparency +gradients for those devices, for, e.g., example 30, page 2. + +2.38 Cairo Windows driver implemented + +A cairo Windows driver has been implemented. This provides an +interactive cairo driver for Windows similar to xcairo on Linux. +Work to improve its functionality is ongoing. + +2.39 Custom axis labeling implemented + +Axis text labels can now be customized using the new plslabelfunc function. +This allows a user to specify what text should be draw at a given position +along a plot axis. Example 19 has been updated to illustrate this function's +use through labeling geographic coordinates in degrees North, South, East and +West. + +2.40 Universal coordinate transform implemented + +A custom coordinate transformation function can be set using plstransform. +This transformation function affects all subsequent plot function calls which +work with plot window coordinates. Testing and refinement of this support is +ongoing. + +2.41 Support for arbitrary storage of 2D user data + +This improvement courtesy of David MacMahon adds support for arbitrary +storage of 2D user data. This is very similar to the technique employed +by some existing functions (e.g. plfcont and plfshade) that use "evaluator" +functions to access 2D user data that is stored in an arbtrary format. +The new approach extends the concept of a user-supplied (or predefined) +"evaluator" function to a group of user-supplied (or predefined) "operator" +functions. The operator functions provide for various operations on the +arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, +minmax, and f2eval. + +To facilitate the passing of an entire family of operator functions (via +function pointers), a plf2ops_t structure is defined to contain a +pointer to each type of operator function. Predefined operator +functions are defined for several common 2D data storage techniques. +Variables (of type plf2ops_t) containing function pointers for these +operator functions are also defined. + +New variants of functions that accept 2D data are created. The new +variants accept the 2D data as two parameters: a pointer to a plf2ops_t +structure containing (pointers to) suitable operator functions and a +PLPointer to the actual 2D data store. Existing functions that accept +2D data are modified to simply pass their parameters to the +corresponding new variant of the function, along with a pointer to the +suitable predefined plf2ops_t stucture of operator function pointers. + +The list of functions for which new variants are created is: +c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, +c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and +c_plgriddata. The new variants are named the same as their +corresponding existing function except that the "c_" prefix is changed +to "plf" (e.g. the new variant of c_plmesh is called plfmesh). + +Adds plfvect declaration to plplot.h and changes the names (and only the +names) of some plfvect arguments to make them slightly clearer. In +order to maintain backwards API compatibility, this function and the +other existing functions that use "evaluator" functions are NOT changed +to use the new operator functions. + +Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. +Moves the definitions of pltr2f (already declared in plplot.h) from the +sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. +Removes pltr0f declaration from plplot.h. + +Changes x08c.c to demonstrate use of new support for arbitrary storage +of 2D data arrays. Shows how to do surface plots with the following +four types of 2D data arrays: + +1) PLFLT z[nx][ny]; +2) PLfGrid2 z; +3) PLFLT z[nx*ny]; /* row major order */ +4) PLFLT z[nx*ny]; /* column major order */ + +2.42 Font improvements + +We have added the underscore to the Hershey glyphs (thanks to David +MacMahon) and slightly rearranged the ascii index to the Hershey +indices so that plpoin now generates the complete set of printable +ascii characters in the correct order for the Hershey fonts (and therefore +the Type1 and TrueType fonts as well). + +We have improved how we access TrueType and Type1 fonts via the Hershey +font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex +commands). We have added considerably to the Hershey index to Unicode index +translation table both for the compact and extended Hershey indexing scheme, +and we have adopted the standard Unicode to Type1 index translation tables +from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. + +We have also dropped the momentary switch to symbol font that was +implemented in the PLplot core library. That switch was designed to partially +compensate for the lack of symbol glyphs in the standard Type1 fonts. That +was a bad design because it affected TrueType font devices as well as +the desired Type1 font devices. To replace this bad idea we now +change from Type1 standard fonts to the Type1 Symbol font (and vice +versa) whenever there is a glyph lookup failure in the Type1 font +device drivers (ps and pdf). + +2.42 Alpha value support for plotting in memory. + +The function plsmema() was added to the PLplot API. This allows the user +to supply a RGBA formatted array that PLplot can use to do in memory +plotting with alpha value support. At present only the memcairo device +is capable of using RGBA formatted memory. The mem device, at least +for the time being, only supports RGB formatted memory and will exit +if the user attempts to give it RGBA formatted memory to plot in. + +2.43 Add a Qt device for in memory plotting. + +A new device called memqt has been added for in memory plotting using +Qt. This device is the Qt equivalent of the memcairo device. + +2.44 Add discrete legend capability. + +A new routine called pllegend has been added to our core C API. +(N.B. This is an experimental API that may be subject to further +change as we gain more experience with it.) This routine creates a +discrete plot legend with a plotted box, line, and/or line of symbols +for each annotated legend entry. The arguments of pllegend provide +control over the location and size of the legend within the current +subpage as well as the location and characteristics of the elements +(most of which are optional) within that legend. The resulting legend +is clipped at the boundaries of the current subpage + + PLplot Release 5.9.6 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts Modified: trunk/README.release =================================================================== --- trunk/README.release 2010-10-03 13:40:40 UTC (rev 11243) +++ trunk/README.release 2010-10-03 14:03:11 UTC (rev 11244) @@ -1,4 +1,4 @@ -PLplot Release 5.9.7 +PLplot Release 5.9.8 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development @@ -184,15 +184,11 @@ INDEX -0. Tests made for release 5.9.7 +0. Tests made for release 5.9.8 -1. Changes relative to PLplot 5.9.6 (the previous development release) +1. Changes relative to PLplot 5.9.7 (the previous development release) -1.1 Alpha value support for plotting in memory. -1.2 Add a Qt device for in memory plotting. -1.3 Add discrete legend capability. - 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed @@ -244,40 +240,16 @@ 2.44 Add discrete legend capability. -0. Tests made for release 5.9.7 +0. Tests made for release 5.9.8 See http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot#Testing_Reports -for a summary table of all testing done for PLplot-5.9.7. +for a summary table of all testing done for PLplot-5.9.8. -1. Changes relative to PLplot 5.9.6 (the previous development release) -1.1 Alpha value support for plotting in memory. +1. Changes relative to PLplot 5.9.7 (the previous development release) -The function plsmema() was added to the PLplot API. This allows the user -to supply a RGBA formatted array that PLplot can use to do in memory -plotting with alpha value support. At present only the memcairo device -is capable of using RGBA formatted memory. The mem device, at least -for the time being, only supports RGB formatted memory and will exit -if the user attempts to give it RGBA formatted memory to plot in. -1.2 Add a Qt device for in memory plotting. - -A new device called memqt has been added for in memory plotting using -Qt. This device is the Qt equivalent of the memcairo device. - -1.3 Add discrete legend capability. - -A new routine called pllegend has been added to our core C API. -(N.B. This is an experimental API that may be subject to further -change as we gain more experience with it.) This routine creates a -discrete plot legend with a plotted box, line, and/or line of symbols -for each annotated legend entry. The arguments of pllegend provide -control over the location and size of the legend within the current -subpage as well as the location and characteristics of the elements -(most of which are optional) within that legend. The resulting legend -is clipped at the boundaries of the current subpage - 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-10-05 00:52:25
|
Revision: 11246 http://plplot.svn.sourceforge.net/plplot/?rev=11246&view=rev Author: airwin Date: 2010-10-05 00:52:18 +0000 (Tue, 05 Oct 2010) Log Message: ----------- Experimental propagation of pllegend to python bindings and examples (which give consistent results with their C counterparts). Modified Paths: -------------- trunk/bindings/python/plplotcmodule.i trunk/bindings/swig-support/plplotcapi.i trunk/examples/python/xw04.py trunk/examples/python/xw26.py Modified: trunk/bindings/python/plplotcmodule.i =================================================================== --- trunk/bindings/python/plplotcmodule.i 2010-10-03 14:05:42 UTC (rev 11245) +++ trunk/bindings/python/plplotcmodule.i 2010-10-05 00:52:18 UTC (rev 11246) @@ -457,6 +457,28 @@ free($1); } +/*************************** + special for pllegend, char ** ArrayCk +****************************/ +/* no count, but check consistency with previous */ +%typemap(in) char **ArrayCk (PyArrayObject* tmp) { + int i; + tmp = (PyArrayObject *)PyArray_ContiguousFromObject($input, NPY_STRING, 1, 1); + if(tmp == NULL) return NULL; + if(tmp->dimensions[0] != Alen) { + PyErr_SetString(PyExc_ValueError, "Vectors must be same length."); + return NULL; + } + $1 = (char **) malloc(sizeof(char*)*Alen); + for(i=0; i<Alen; i++) { + $1[i] = tmp->data + i*tmp->strides[0]; + if($1[i] == NULL) { + free($1); + return NULL; + } + } +} +%typemap(freearg) char **ArrayCk { Py_DECREF(tmp$argnum); free($1);} /*************************** String returning functions Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2010-10-03 14:05:42 UTC (rev 11245) +++ trunk/bindings/swig-support/plplotcapi.i 2010-10-05 00:52:18 UTC (rev 11246) @@ -95,6 +95,14 @@ #define PL_HIST_NOEXPAND 8 #define PL_HIST_NOEMPTY 16 +// Flags for pllegend. +#define PL_LEGEND_NONE 1 +#define PL_LEGEND_COLOR_BOX 2 +#define PL_LEGEND_LINE 4 +#define PL_LEGEND_SYMBOL 8 +#define PL_LEGEND_TEXT_LEFT 16 +#define PL_LEGEND_BACKGROUND 32 + /* Window parameter tags */ #define PLSWIN_DEVICE 1 /* device coordinates */ @@ -509,6 +517,19 @@ void pllab(const char *xlabel, const char *ylabel, const char *tlabel); +%feature("autodoc", "Create a discrete annotated legend using boxes, lines, and/or lines of symbols.") pllegend; +void +pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, + PLINT n, const PLINT *Array, + PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, + PLFLT text_justification, + const PLINT *ArrayCk, const char **ArrayCk, + const PLINT *ArrayCk, const PLINT *ArrayCk, + const PLFLT *ArrayCk, + const PLINT *ArrayCk, const PLINT *ArrayCk, + const PLINT *ArrayCk, + const PLINT *ArrayCk, const PLFLT *ArrayCk, + const PLINT *ArrayCk, const PLINT *ArrayCk ); %feature("autodoc", "Set position of the light source.") pllightsource; void pllightsource(PLFLT x, PLFLT y, PLFLT z); @@ -533,7 +554,7 @@ %feature("autodoc", "Plot a 3-d contoured mesh representation of the function z[x][y].") plmeshc; void plmeshc(PLFLT *ArrayX, PLFLT *ArrayY, PLFLT **MatrixCk, - PLINT nx, PLINT ny, PLINT opt, PLFLT *Array, PLINT n); + PLINT nx, PLINT ny, PLINT opt, PLFLT *Array, PLINT n); %feature("autodoc", "Create a new stream and makes it the default.") plmkstrm; void Modified: trunk/examples/python/xw04.py =================================================================== --- trunk/examples/python/xw04.py 2010-10-03 14:05:42 UTC (rev 11245) +++ trunk/examples/python/xw04.py 2010-10-05 00:52:18 UTC (rev 11246) @@ -1,6 +1,6 @@ # $Id$ -# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin +# Copyright (C) 2001-1010 Alan W. Irwin # Log plot demo. # @@ -57,7 +57,7 @@ print "error: type must be either 0 or 1" plcol0(2) plline(freql, ampl) - plcol0(1) + plcol0(2) plptex(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade") # Put labels on @@ -74,7 +74,59 @@ plbox("", 0.0, 0, "cmstv", 30.0, 3) plcol0(3) plline(freql, phase) + plpoin(freql, phase, 3) plcol0(3) plmtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)") + nlegend = 2 + else: + nlegend = 1 + # Draw a legend. + # Set up legend arrays with the correct size, type. + opt_array = zeros(nlegend, "int") + text_colors = zeros(nlegend, "int") + text = zeros(nlegend, "S20") + box_colors = zeros(nlegend, "int") + box_patterns = zeros(nlegend, "int") + box_scales = zeros(nlegend) + line_colors = zeros(nlegend, "int") + line_styles = zeros(nlegend, "int") + line_widths = zeros(nlegend, "int") + symbol_colors = zeros(nlegend, "int") + symbol_scales = zeros(nlegend) + symbol_numbers = zeros(nlegend, "int") + symbols = zeros(nlegend, "int") + # Only specify legend data that are required according to the + # value of opt_array for that entry. + + # Data for first legend entry. + opt_array[0] = PL_LEGEND_LINE + text_colors[0] = 2 + text[0] = "Amplitude" + line_colors[0] = 2 + line_styles[0] = 1 + line_widths[0] = 1 + + # Data for second legend entry. + if nlegend > 1: + opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL + text_colors[1] = 3 + text[1] = "Phase shift" + line_colors[1] = 3 + line_styles[1] = 1 + line_widths[1] = 1 + symbol_colors[1] = 3 + symbol_scales[1] = 1. + symbol_numbers[1] = 4 + symbols[1] = 3 + + plscol0a( 15, 32, 32, 32, 0.90 ) + pllegend( PL_LEGEND_BACKGROUND, 0.57, 0.85, 0.06, 15, + opt_array, + 1.0, 1.0, 2.0, + 1., text_colors, text, + box_colors, box_patterns, box_scales, + line_colors, line_styles, line_widths, + symbol_colors, symbol_scales, symbol_numbers, symbols ) + main() Modified: trunk/examples/python/xw26.py =================================================================== --- trunk/examples/python/xw26.py 2010-10-03 14:05:42 UTC (rev 11245) +++ trunk/examples/python/xw26.py 2010-10-05 00:52:18 UTC (rev 11246) @@ -1,6 +1,6 @@ # -*- coding: utf-8; -*- # $Id$ -# Copyright (C) 2006 Alan W. Irwin +# Copyright (C) 2006-2010 Alan W. Irwin # Multi-lingual version of the first page of example 4. @@ -73,6 +73,12 @@ "Phase shift (degrees)",\ "Фазовый сдвиг (градусы)",\ ] + # Short rearranged versions of y_label and alty_label. + legend_text = [\ + [ "Amplitude", "Phase shift"],\ + [ "Амплитуда", "Фазовый сдвиг" ],\ + ] + title_label = [\ "Single Pole Low-Pass Filter",\ "Однополюсный Низко-Частотный Фильтр",\ @@ -93,13 +99,13 @@ for i in range(nlang): plot1(0, x_label[i], y_label[i], alty_label[i], \ - title_label[i], line_label[i]) + title_label[i], line_label[i], legend_text[i]) # Restore defaults plfont(1) #plcol0(1) -def plot1(type, x_label, y_label, alty_label, title_label, line_label): +def plot1(type, x_label, y_label, alty_label, title_label, line_label, legend_text): pladv(0) f0 = 1.0 @@ -119,7 +125,7 @@ print "error: type must be either 0 or 1" plcol0(2) plline(freql, ampl) - plcol0(1) + plcol0(2) plptex(1.6, -30.0, 1.0, -20.0, 0.5, line_label) # Put labels on @@ -136,7 +142,62 @@ plbox("", 0.0, 0, "cmstv", 30.0, 3) plcol0(3) plline(freql, phase) + plpoin(freql, phase, 3) plcol0(3) plmtex("r", 5.0, 0.5, 0.5, alty_label) + nlegend = 2 + else: + nlegend = 1 + # Draw a legend. + # Set up legend arrays with the correct size, type. + # legend_text is already supplied by argument. + opt_array = zeros(nlegend, "int") + # Be generous with size of string since raw UTF-8 is involved. + text = zeros(nlegend, "S100") + text_colors = zeros(nlegend, "int") + box_colors = zeros(nlegend, "int") + box_patterns = zeros(nlegend, "int") + box_scales = zeros(nlegend) + line_colors = zeros(nlegend, "int") + line_styles = zeros(nlegend, "int") + line_widths = zeros(nlegend, "int") + symbol_colors = zeros(nlegend, "int") + symbol_scales = zeros(nlegend) + symbol_numbers = zeros(nlegend, "int") + symbols = zeros(nlegend, "int") + # Only specify legend data that are required according to the + # value of opt_array for that entry. + + # Data for first legend entry. + opt_array[0] = PL_LEGEND_LINE + text_colors[0] = 2 + text[0] = legend_text[0] + line_colors[0] = 2 + line_styles[0] = 1 + line_widths[0] = 1 + + # Data for second legend entry. + if nlegend > 1: + opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL + text_colors[1] = 3 + text[1] = legend_text[1] + line_colors[1] = 3 + line_styles[1] = 1 + line_widths[1] = 1 + symbol_colors[1] = 3 + symbol_scales[1] = 1. + symbol_numbers[1] = 4 + symbols[1] = 3 + + plscol0a( 15, 32, 32, 32, 0.90 ) + pllegend( PL_LEGEND_BACKGROUND, 0.57, 0.85, 0.06, 15, + opt_array, + 1.0, 1.0, 2.0, + 1., text_colors, text, + box_colors, box_patterns, box_scales, + line_colors, line_styles, line_widths, + symbol_colors, symbol_scales, symbol_numbers, symbols ) + + main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2010-10-10 21:17:18
|
Revision: 11255 http://plplot.svn.sourceforge.net/plplot/?rev=11255&view=rev Author: hbabcock Date: 2010-10-10 21:17:11 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Add a string length calculation option to PLplot core and the cairo driver. If a driver can calculate the length of a string it should set pls->has_string_length. Then, when asked to render a string it should check pls->get_string_length. If pls->get_string_length is set then it should return the length of the string instead of rendering it. Currently set to return the length in pixels. Modified Paths: -------------- trunk/drivers/cairo.c trunk/include/plstrm.h Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-10-10 18:12:08 UTC (rev 11254) +++ trunk/drivers/cairo.c 2010-10-10 21:17:11 UTC (rev 11255) @@ -694,6 +694,13 @@ pango_layout_set_markup( layout, aStream->pangoMarkupString, -1 ); pango_layout_get_pixel_size( layout, &textXExtent, &textYExtent ); + /* If asked, set the string length and return */ + if (pls->get_string_length) + { + pls->string_length = textXExtent; + return; + } + /* Set font aliasing */ context = pango_layout_get_context( layout ); cairoFontOptions = cairo_font_options_create(); @@ -1139,8 +1146,8 @@ pls->dev_gradient = 1; /* driver renders gradient */ pls->dev_arc = 1; /* Supports driver-level arcs */ pls->plbuf_write = interactive; /* Activate plot buffer */ + pls->has_string_length = 1; /* Driver supports string length calculations */ - if ( pls->xlength <= 0 || pls->ylength <= 0 ) { pls->xlength = PLCAIRO_DEFAULT_X; Modified: trunk/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2010-10-10 18:12:08 UTC (rev 11254) +++ trunk/include/plstrm.h 2010-10-10 21:17:11 UTC (rev 11255) @@ -187,7 +187,11 @@ * page PLINT Page count for output stream * linepos PLINT Line count for output stream * pdfs PDFstrm* PDF stream pointer - * dev_mem_alpha PLINT The user supplied memory buffer supports alpha values + * dev_mem_alpha PLINT The user supplied memory buffer supports alpha values + * has_string_length PLINT The driver can calculate the lengths of strings + * string_length PLINT Set to the length of the current string by the driver + * get_string_length PLINT Tells the driver to calculate the length of the string + * but not to render it. * * These are used by the escape function (for area fill, etc). * @@ -777,6 +781,9 @@ PLBOOL stream_closed; PLINT line_style; PLINT dev_mem_alpha; + PLINT has_string_length; + PLINT string_length; + PLINT get_string_length; } PLStream; /*--------------------------------------------------------------------------*\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |