ic->showheader = 1;
ic->showedge = 1;
ic->showlegend = 1;
+ ic->altdate = 0;
+ ic->headertext[0] = '\0';
}
void drawimage(IMAGECONTENT *ic)
gdImageRectangle(ic->im, 0, 0, width-1, height-1, ic->cedge);
}
- /* titlebox, title, date */
+ /* titlebox with title */
if (ic->showheader) {
- if (ic->showedge) {
- gdImageFilledRectangle(ic->im, 3, 3, width-4, 24, ic->cheader);
- gdImageString(ic->im, gdFontGetGiant(), 12, 6, (unsigned char*)title, ic->cheadertitle);
- gdImageString(ic->im, gdFontGetTiny(), width-(strlen(datestring)*gdFontGetTiny()->w+12), 10, (unsigned char*)datestring, ic->cheaderdate);
- } else {
- gdImageFilledRectangle(ic->im, 2, 2, width-3, 24, ic->cheader);
- gdImageString(ic->im, gdFontGetGiant(), 12, 5, (unsigned char*)title, ic->cheadertitle);
- gdImageString(ic->im, gdFontGetTiny(), width-(strlen(datestring)*gdFontGetTiny()->w+12), 9, (unsigned char*)datestring, ic->cheaderdate);
- }
- } else {
- if (ic->showedge) {
- gdImageString(ic->im, gdFontGetTiny(), 6, height-13, (unsigned char*)datestring, ic->cvnstat);
- } else {
- gdImageString(ic->im, gdFontGetTiny(), 5, height-12, (unsigned char*)datestring, ic->cvnstat);
- }
+ gdImageFilledRectangle(ic->im, 2+ic->showedge, 2+ic->showedge, width-3-ic->showedge, 24, ic->cheader);
+ gdImageString(ic->im, gdFontGetGiant(), 12, 5+ic->showedge, (unsigned char*)title, ic->cheadertitle);
}
- /* generator */
- if (ic->showedge) {
- gdImageString(ic->im, gdFontGetTiny(), width-115, height-13, (unsigned char*)"vnStat / Teemu Toivola", ic->cvnstat);
+ /* date */
+ if (!ic->showheader || ic->altdate) {
+ gdImageString(ic->im, gdFontGetTiny(), 5+ic->showedge, height-12-ic->showedge, (unsigned char*)datestring, ic->cvnstat);
} else {
- gdImageString(ic->im, gdFontGetTiny(), width-114, height-12, (unsigned char*)"vnStat / Teemu Toivola", ic->cvnstat);
+ gdImageString(ic->im, gdFontGetTiny(), width-(strlen(datestring)*gdFontGetTiny()->w+12), 9+ic->showedge, (unsigned char*)datestring, ic->cheaderdate);
}
+
+ /* generator */
+ gdImageString(ic->im, gdFontGetTiny(), width-114-ic->showedge, height-12-ic->showedge, (unsigned char*)"vnStat / Teemu Toivola", ic->cvnstat);
}
void drawlegend(IMAGECONTENT *ic, int x, int y)
colorinit(ic);
- if (strcmp(data.nick, data.interface)==0) {
- snprintf(buffer, 512, "%s", data.interface);
+ if (strlen(ic->headertext)) {
+ strncpy_nt(buffer, ic->headertext, 65);
} else {
- snprintf(buffer, 512, "%s (%s)", data.nick, data.interface);
+ if (strcmp(data.nick, data.interface)==0) {
+ snprintf(buffer, 512, "%s", data.interface);
+ } else {
+ snprintf(buffer, 512, "%s (%s)", data.nick, data.interface);
+ }
}
layoutinit(ic, buffer, width, height);
/* config has already been parsed earlier so nothing to do here */
currentarg++;
continue;
+ } else if ((strcmp(argv[currentarg],"--headertext"))==0) {
+ if (currentarg+1<argc) {
+ strncpy_nt(ic.headertext, argv[currentarg+1], 65);
+ if (debug)
+ printf("Header text: \"%s\"\n", ic.headertext);
+ currentarg++;
+ continue;
+ } else {
+ printf("Error: Text string parameter for --headertext missing.\n");
+ return 1;
+ }
+ } else if (strcmp(argv[currentarg],"--altdate")==0) {
+ ic.altdate = 1;
} else if ((strcmp(argv[currentarg],"-D")==0) || (strcmp(argv[currentarg],"--debug"))==0) {
debug = 1;
} else if ((strcmp(argv[currentarg],"-d")==0) || (strcmp(argv[currentarg],"--days"))==0) {
printf(" --style select output style (0-3)\n");
printf(" --locale set locale\n");
printf(" --config select config file\n");
+ printf(" --altdate use alternative date location\n");
+ printf(" --headertext specify header text string\n");
printf(" --transparent toggle background transparency\n\n");
printf("See also \"man vnstati\".\n");
}