Add support for splitting the key index over multiple pages in hp2ps
Multipage support can be requested with the -M command-line flag
or inferred if the number of bands requested is greater than 20
(the limit on the number of bands displayed has been removed)
Please include this change in the 6.6 branch as well as HEAD
extern floatish _thresh_;
#define TWENTY _twenty_ /* show top 20 bands, grouping excess */
extern floatish _thresh_;
#define TWENTY _twenty_ /* show top 20 bands, grouping excess */
-#define DEFAULT_TWENTY 20 /* this is default and absolute maximum */
+#define DEFAULT_TWENTY 20 /* this is default and maximum per page */
extern int _twenty_;
#define LARGE_FONT 12 /* Helvetica 12pt */
extern int _twenty_;
#define LARGE_FONT 12 /* Helvetica 12pt */
titleheight = TITLE_HEIGHT;
}
titleheight = TITLE_HEIGHT;
}
- graphwidth = titlewidth - graphx0 - (TWENTY ? KeyWidth() : 0);
+ boolish keyOnGraph = !multipageflag && TWENTY != 0;
+ graphwidth = titlewidth - graphx0 - (keyOnGraph ? KeyWidth() : 0);
graphheight = borderheight - titleheight - (2 * borderspace) - graphy0;
}
graphheight = borderheight - titleheight - (2 * borderspace) - graphy0;
}
printf(" -ef[in|mm|pt] produce Encapsulated PostScript f units wide (f > 2 inches)\n");
printf(" -g produce output suitable for GHOSTSCRIPT previever\n");
printf(" -i[+|-] sort by identifier string (-i+ gives greatest on top) \n");
printf(" -ef[in|mm|pt] produce Encapsulated PostScript f units wide (f > 2 inches)\n");
printf(" -g produce output suitable for GHOSTSCRIPT previever\n");
printf(" -i[+|-] sort by identifier string (-i+ gives greatest on top) \n");
+ printf(" -M multi-page output (key separate from graph)\n");
printf(" -mn print maximum of n bands (default & max 20)\n");
printf(" -m0 removes the band limit altogether\n");
printf(" -p use previous scaling, shading and ordering\n");
printf(" -mn print maximum of n bands (default & max 20)\n");
printf(" -m0 removes the band limit altogether\n");
printf(" -p use previous scaling, shading and ordering\n");
#include "Dimensions.h"
#include "HpFile.h"
#include "Shade.h"
#include "Dimensions.h"
#include "HpFile.h"
#include "Shade.h"
/* own stuff */
#include "Key.h"
/* own stuff */
#include "Key.h"
for (i = 0; i < nidents; i++) /* count identifiers */
;
for (i = 0; i < nidents; i++) /* count identifiers */
;
- c = graphy0;
- dc = graphheight / (floatish) (i + 1);
+ c = multipageflag ? 0 : graphy0;
+ dc = graphheight / (floatish) ((i <= 20) ? (i + 1) : 20);
for (i = 0; i < nidents; i++) {
c += dc;
KeyEntry(c, identtable[i]->name, ShadeOf(identtable[i]->name));
for (i = 0; i < nidents; i++) {
c += dc;
KeyEntry(c, identtable[i]->name, ShadeOf(identtable[i]->name));
+ // if we have spit out 20 entries and we're going to output more
+ // advance the page
+ if (i % DEFAULT_TWENTY == (DEFAULT_TWENTY - 1) && i != nidents - 1) {
+ c = 0;
+ NextPage();
+ }
namebase = centreline - (floatish) (NORMAL_FONT / 2);
keyboxbase = centreline - ((floatish) KEY_BOX_WIDTH / 2.0);
namebase = centreline - (floatish) (NORMAL_FONT / 2);
keyboxbase = centreline - ((floatish) KEY_BOX_WIDTH / 2.0);
- kstart = graphx0 + graphwidth;
+ kstart = graphx0 + (multipageflag ? 0 : graphwidth);
fprintf(psfp, "%f %f moveto\n", kstart + borderspace, keyboxbase);
fprintf(psfp, "0 %d rlineto\n", KEY_BOX_WIDTH);
fprintf(psfp, "%f %f moveto\n", kstart + borderspace, keyboxbase);
fprintf(psfp, "0 %d rlineto\n", KEY_BOX_WIDTH);
#include "Utilities.h"
boolish pflag = 0; /* read auxiliary file */
#include "Utilities.h"
boolish pflag = 0; /* read auxiliary file */
-boolish eflag = 0; /* scaled EPSF */
+boolish eflag = 0; /* scaled EPSF */
boolish dflag = 0; /* sort by standard deviation */
int iflag = 0; /* sort by identifier (3-way flag) */
boolish gflag = 0; /* output suitable for previewer */
boolish dflag = 0; /* sort by standard deviation */
int iflag = 0; /* sort by identifier (3-way flag) */
boolish gflag = 0; /* output suitable for previewer */
boolish cflag = 0; /* colour output */
boolish filter; /* true when running as a filter */
boolish cflag = 0; /* colour output */
boolish filter; /* true when running as a filter */
+boolish multipageflag = 0; /* true when the output should be 2 pages - key and profile */
static floatish WidthInPoints PROTO((char *)); /* forward */
static FILE *Fp PROTO((char *, char **, char *, char *)); /* forward */
static floatish WidthInPoints PROTO((char *)); /* forward */
static FILE *Fp PROTO((char *, char **, char *, char *)); /* forward */
case 'm':
mflag++;
TWENTY = atoi(*argv + 1);
case 'm':
mflag++;
TWENTY = atoi(*argv + 1);
- if (TWENTY > DEFAULT_TWENTY)
- Usage(*argv-1);
+ // only 20 keys fit on a page
+ if (TWENTY > DEFAULT_TWENTY)
+ multipageflag++;
+ case 'M':
+ multipageflag++;
+ goto nextarg;
case 't':
tflag++;
THRESHOLD_PERCENT = (floatish) atof(*argv + 1);
case 't':
tflag++;
THRESHOLD_PERCENT = (floatish) atof(*argv + 1);
if (pflag) Reorder(); /* ReOrders on aux file */
if (pflag) Reorder(); /* ReOrders on aux file */
- if (TWENTY) TopTwenty(); /* Selects top twenty (mflag) */
+ /* Selects top bands (mflag) - can be more than 20 now */
+ if (TWENTY != 0) TopTwenty();
extern boolish tflag;
extern boolish cflag;
extern boolish tflag;
extern boolish cflag;
+extern boolish multipageflag;
+
extern char *programname;
extern char *hpfile;
extern char *programname;
extern char *hpfile;
static void BigTitleText PROTO((void)); /* forward */
static void TitleText PROTO((void)); /* forward */
static void BigTitleText PROTO((void)); /* forward */
static void TitleText PROTO((void)); /* forward */
+static void DoTitleAndBox()
- Prologue();
- Variables();
BorderOutlineBox();
if (bflag) {
BorderOutlineBox();
if (bflag) {
TitleOutlineBox();
TitleText();
}
TitleOutlineBox();
TitleText();
}
+}
+
+static void Landscape PROTO((void)); /* forward */
+static void Portrait PROTO((void)); /* forward */
+
+void NextPage() {
+ fprintf(psfp, "showpage\n");
+ if (gflag) Portrait(); else Landscape();
+ DoTitleAndBox();
+}
+
+void
+PutPsFile()
+{
+ Prologue();
+ Variables();
+ DoTitleAndBox();
+
+ if (multipageflag) {
+ Key(); // print multi-page key even if there are more than 20 bands
+ NextPage();
+ }
+
+ if (!multipageflag && (TWENTY != 0)) Key();
static void StandardSpecialComments PROTO((void)); /* forward */
static void EPSFSpecialComments PROTO((floatish)); /* forward */
static void StandardSpecialComments PROTO((void)); /* forward */
static void EPSFSpecialComments PROTO((floatish)); /* forward */
-static void Landscape PROTO((void)); /* forward */
-static void Portrait PROTO((void)); /* forward */
static void Scaling PROTO((floatish)); /* forward */
static void
static void Scaling PROTO((floatish)); /* forward */
static void
#define PS_FILE_H
void PutPsFile PROTO((void));
#define PS_FILE_H
void PutPsFile PROTO((void));
+void NextPage PROTO((void)); // for Key.c