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 */
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;
}
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");
#include "Dimensions.h"
#include "HpFile.h"
#include "Shade.h"
+#include "PsFile.h"
/* own stuff */
#include "Key.h"
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));
+ // 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);
- 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);
#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 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 */
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++;
goto nextarg;
+ case 'M':
+ multipageflag++;
+ goto nextarg;
case 't':
tflag++;
THRESHOLD_PERCENT = (floatish) atof(*argv + 1);
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();
Dimensions();
extern boolish tflag;
extern boolish cflag;
+extern boolish multipageflag;
+
extern char *programname;
extern char *hpfile;
static void BigTitleText PROTO((void)); /* forward */
static void TitleText PROTO((void)); /* forward */
-void
-PutPsFile()
+static void DoTitleAndBox()
{
- Prologue();
- Variables();
BorderOutlineBox();
if (bflag) {
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();
CurvesInit();
+ DoTitleAndBox();
+
+ if (multipageflag) {
+ Key(); // print multi-page key even if there are more than 20 bands
+ NextPage();
+ }
+
Axes();
- if (TWENTY) Key();
+ if (!multipageflag && (TWENTY != 0)) Key();
Curves();
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
#define PS_FILE_H
void PutPsFile PROTO((void));
+void NextPage PROTO((void)); // for Key.c
#endif /* PS_FILE_H */