From: <hez...@us...> - 2011-01-29 17:12:06
|
Revision: 11525 http://plplot.svn.sourceforge.net/plplot/?rev=11525&view=rev Author: hezekiahcarty Date: 2011-01-29 17:12:00 +0000 (Sat, 29 Jan 2011) Log Message: ----------- Use the proper PL_POSITION_* values for plcolorbar positioning This will likely be replaced by Alan's positioning fixes, but it compiles and functions for now. Modified Paths: -------------- trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2011-01-29 17:11:27 UTC (rev 11524) +++ trunk/include/plplot.h 2011-01-29 17:12:00 UTC (rev 11525) @@ -1230,20 +1230,16 @@ #define PL_LEGEND_ROW_MAJOR 128 // Flags for plcolorbar -#define PL_COLORBAR_LEFT 1 -#define PL_COLORBAR_RIGHT 2 -#define PL_COLORBAR_UPPER 4 -#define PL_COLORBAR_LOWER 8 -#define PL_COLORBAR_LABEL_LEFT 16 -#define PL_COLORBAR_LABEL_RIGHT 32 -#define PL_COLORBAR_LABEL_UPPER 64 -#define PL_COLORBAR_LABEL_LOWER 128 -#define PL_COLORBAR_IMAGE 256 -#define PL_COLORBAR_SHADE 512 -#define PL_COLORBAR_GRADIENT 1024 -#define PL_COLORBAR_CAP_LOW 2048 -#define PL_COLORBAR_CAP_HIGH 4096 -#define PL_COLORBAR_SHADE_LABEL 8192 +#define PL_COLORBAR_LABEL_LEFT 1 +#define PL_COLORBAR_LABEL_RIGHT 2 +#define PL_COLORBAR_LABEL_UPPER 4 +#define PL_COLORBAR_LABEL_LOWER 8 +#define PL_COLORBAR_IMAGE 16 +#define PL_COLORBAR_SHADE 32 +#define PL_COLORBAR_GRADIENT 64 +#define PL_COLORBAR_CAP_LOW 128 +#define PL_COLORBAR_CAP_HIGH 256 +#define PL_COLORBAR_SHADE_LABEL 512 // Routine for drawing discrete line, symbol, or cmap0 legends PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-01-29 17:11:27 UTC (rev 11524) +++ trunk/src/pllegend.c 2011-01-29 17:12:00 UTC (rev 11525) @@ -842,12 +842,12 @@ if ( opt & PL_COLORBAR_CAP_LOW ) { - if ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_RIGHT ) + if ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_RIGHT ) { // Draw the cap on the bottom - if ( opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_LEFT ) xs[0] = x; - else if ( opt_position & PL_COLORBAR_RIGHT ) + else if ( opt_position & PL_POSITION_RIGHT ) xs[0] = 1.0 - x - width; ys[0] = y; xs[2] = xs[0] + width; @@ -857,13 +857,13 @@ plfill( 3, xs, ys ); } - else if ( opt_position & PL_COLORBAR_UPPER || opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_UPPER || opt_position & PL_POSITION_LOWER ) { // Draw the cap on the left xs[0] = x; - if ( opt_position & PL_COLORBAR_UPPER ) + if ( opt_position & PL_POSITION_UPPER ) ys[0] = 1.0 - y - width; - else if ( opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_LOWER ) ys[0] = y; xs[2] = xs[0]; ys[2] = ys[0] + width; @@ -875,12 +875,12 @@ } else if ( opt & PL_COLORBAR_CAP_HIGH ) { - if ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_RIGHT ) + if ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_RIGHT ) { // Draw the cap on the top - if ( opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_LEFT ) xs[0] = x; - else if ( opt_position & PL_COLORBAR_RIGHT ) + else if ( opt_position & PL_POSITION_RIGHT ) xs[0] = 1.0 - x - width; ys[0] = y + length; xs[2] = xs[0] + width; @@ -890,13 +890,13 @@ plfill( 3, xs, ys ); } - else if ( opt_position & PL_COLORBAR_UPPER || opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_UPPER || opt_position & PL_POSITION_LOWER ) { // Draw the cap on the right xs[0] = x + length; - if ( opt_position & PL_COLORBAR_UPPER ) + if ( opt_position & PL_POSITION_UPPER ) ys[0] = 1.0 - y - width; - else if ( opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_LOWER ) ys[0] = y; xs[2] = xs[0]; ys[2] = ys[0] + width; @@ -979,7 +979,7 @@ PLFLT vx_min, vx_max, vy_min, vy_max; PLFLT wx_min, wx_max, wy_min, wy_max; // Build the proper viewport and window dimensions - if ( opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_LEFT ) { vx_min = x; vy_min = y; @@ -990,7 +990,7 @@ wx_max = 1.0; wy_max = max_value; } - else if ( opt_position & PL_COLORBAR_RIGHT ) + else if ( opt_position & PL_POSITION_RIGHT ) { vx_min = 1.0 - x - width; vy_min = y; @@ -1001,7 +1001,7 @@ wx_max = 1.0; wy_max = max_value; } - else if ( opt_position & PL_COLORBAR_UPPER ) + else if ( opt_position & PL_POSITION_UPPER ) { vx_min = x; vy_min = 1.0 - y - width; @@ -1012,7 +1012,7 @@ wx_max = max_value; wy_max = 1.0; } - else if ( opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_LOWER ) { vx_min = x; vy_min = y; @@ -1051,7 +1051,7 @@ // TODO: Determine a better way to specify the steps here? n_steps = plsc->ncol1; step_size = ( max_value - min_value ) / (PLFLT) n_steps; - if ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_RIGHT ) + if ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_RIGHT ) { ni = 2; nj = n_steps; @@ -1064,7 +1064,7 @@ } } } - else if ( opt_position & PL_COLORBAR_UPPER || opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_UPPER || opt_position & PL_POSITION_LOWER ) { ni = n_steps; nj = 2; @@ -1087,7 +1087,7 @@ { n_steps = n_colors; // Use the provided values in this case. - if ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_RIGHT ) + if ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_RIGHT ) { ni = 2; nj = n_steps; @@ -1100,7 +1100,7 @@ } } } - else if ( opt_position & PL_COLORBAR_UPPER || opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_UPPER || opt_position & PL_POSITION_LOWER ) { ni = n_steps; nj = 2; @@ -1146,7 +1146,7 @@ } } // Use the provided values. - if ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_RIGHT ) + if ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_RIGHT ) { grid.xg = grid_axis; grid.yg = values_ext; @@ -1163,7 +1163,7 @@ } } } - else if ( opt_position & PL_COLORBAR_UPPER || opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_UPPER || opt_position & PL_POSITION_LOWER ) { grid.xg = values_ext; grid.yg = grid_axis; @@ -1203,11 +1203,11 @@ xs[3] = wx_min; ys[3] = wy_max; PLFLT angle; - if ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_RIGHT ) + if ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_RIGHT ) { angle = 90.0; } - else if ( opt_position & PL_COLORBAR_UPPER || opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_UPPER || opt_position & PL_POSITION_LOWER ) { angle = 0.0; } @@ -1230,9 +1230,9 @@ { // Add an extra offset for the label so it does not bump in to the // cap. - if ( ( ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_RIGHT ) && + if ( ( ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_RIGHT ) && opt & PL_COLORBAR_LABEL_LOWER ) || - ( ( opt_position & PL_COLORBAR_UPPER || opt_position & PL_COLORBAR_LOWER ) && + ( ( opt_position & PL_POSITION_UPPER || opt_position & PL_POSITION_LOWER ) && opt & PL_COLORBAR_LABEL_LEFT ) ) { label_offset += 2.5; @@ -1244,9 +1244,9 @@ { // Add an extra offset for the label so it does not bump in to the // cap. - if ( ( ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_RIGHT ) && + if ( ( ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_RIGHT ) && opt & PL_COLORBAR_LABEL_UPPER ) || - ( ( opt_position & PL_COLORBAR_UPPER || opt_position & PL_COLORBAR_LOWER ) && + ( ( opt_position & PL_POSITION_UPPER || opt_position & PL_POSITION_LOWER ) && opt & PL_COLORBAR_LABEL_RIGHT ) ) { label_offset += 2.5; @@ -1272,7 +1272,7 @@ char perp; if ( opt & PL_COLORBAR_LABEL_LEFT ) { - if ( opt_position & PL_COLORBAR_RIGHT || opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_RIGHT || opt_position & PL_POSITION_LEFT ) { label_offset += 4.0; perp = '\0'; @@ -1287,7 +1287,7 @@ } else if ( opt & PL_COLORBAR_LABEL_RIGHT ) { - if ( opt_position & PL_COLORBAR_RIGHT || opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_RIGHT || opt_position & PL_POSITION_LEFT ) { label_offset += 4.0; perp = '\0'; @@ -1302,7 +1302,7 @@ } else if ( opt & PL_COLORBAR_LABEL_UPPER ) { - if ( opt_position & PL_COLORBAR_RIGHT || opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_RIGHT || opt_position & PL_POSITION_LEFT ) { label_offset += 1.5; perp = 'v'; @@ -1317,7 +1317,7 @@ } else if ( opt & PL_COLORBAR_LABEL_LOWER ) { - if ( opt_position & PL_COLORBAR_RIGHT || opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_RIGHT || opt_position & PL_POSITION_LEFT ) { label_offset += 1.5; perp = 'v'; @@ -1337,22 +1337,22 @@ // along an axis. if ( opt & PL_COLORBAR_SHADE && opt & PL_COLORBAR_SHADE_LABEL ) { - if ( opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_LEFT ) { snprintf( opt_string, max_opts, "nt%s", axis_opts ); label_box_custom( "", 0, NULL, opt_string, n_colors, values ); } - else if ( opt_position & PL_COLORBAR_RIGHT ) + else if ( opt_position & PL_POSITION_RIGHT ) { snprintf( opt_string, max_opts, "mt%s", axis_opts ); label_box_custom( "", 0, NULL, opt_string, n_colors, values ); } - else if ( opt_position & PL_COLORBAR_UPPER ) + else if ( opt_position & PL_POSITION_UPPER ) { snprintf( opt_string, max_opts, "mt%s", axis_opts ); label_box_custom( opt_string, n_colors, values, "", 0, NULL ); } - else if ( opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_LOWER ) { snprintf( opt_string, max_opts, "nt%s", axis_opts ); label_box_custom( opt_string, n_colors, values, "", 0, NULL ); @@ -1360,33 +1360,33 @@ } else { - if ( opt_position & PL_COLORBAR_LEFT || opt_position & PL_COLORBAR_LOWER ) + if ( opt_position & PL_POSITION_LEFT || opt_position & PL_POSITION_LOWER ) { tick_string = "n"; } - else if ( opt_position & PL_COLORBAR_RIGHT || opt_position & PL_COLORBAR_UPPER ) + else if ( opt_position & PL_POSITION_RIGHT || opt_position & PL_POSITION_UPPER ) { tick_string = "m"; } } // Draw the boxes, etc. - if ( opt_position & PL_COLORBAR_LEFT ) + if ( opt_position & PL_POSITION_LEFT ) { snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); plbox( "bc", ticks, sub_ticks, opt_string, ticks, sub_ticks ); } - else if ( opt_position & PL_COLORBAR_RIGHT ) + else if ( opt_position & PL_POSITION_RIGHT ) { snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); plbox( "bc", 0.0, 0, opt_string, ticks, sub_ticks ); } - else if ( opt_position & PL_COLORBAR_UPPER ) + else if ( opt_position & PL_POSITION_UPPER ) { snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); } - else if ( opt_position & PL_COLORBAR_LOWER ) + else if ( opt_position & PL_POSITION_LOWER ) { snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |