*** arc.c.orig Sat May 20 18:53:13 2000 --- arc.c Sat May 20 18:53:13 2000 *************** *** 871,877 **** } *rotated_n = 0; ! *rotated_vlist = (XPoint*)malloc((num_vs+3)*sizeof(XPoint)); ! pv = (IntPoint*)malloc((num_vs+3)*sizeof(IntPoint)); if (*rotated_vlist == NULL || pv == NULL) FailAllocMessage(); cur_index = 0; --- 871,879 ---- } *rotated_n = 0; ! *rotated_vlist = (XPoint*)malloc((num_vs+5)*sizeof(XPoint)); ! pv = (IntPoint*)malloc((num_vs+5)*sizeof(IntPoint)); if (*rotated_vlist == NULL || pv == NULL) FailAllocMessage(); + memset(*rotated_vlist, 0, (num_vs+5)*sizeof(XPoint)); + memset(pv, 0, (num_vs+5)*sizeof(IntPoint)); cur_index = 0; *************** *** 881,885 **** /* the quadrant being considered is angle-angle90 to angle */ double angle_in_quadrant; /* 0 < angle_in_quadrant <= 90.0 degrees */ ! int count; double sin_val, cos_val; --- 883,887 ---- /* the quadrant being considered is angle-angle90 to angle */ double angle_in_quadrant; /* 0 < angle_in_quadrant <= 90.0 degrees */ ! int count=(-1); double sin_val, cos_val; *************** *** 998,1001 **** --- 1000,1004 ---- sv = (XPoint*)malloc((num_vs+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); + memset(sv, 0, (num_vs+1)*sizeof(XPoint)); sv[0].x = (short)(OFFSET_X(first_pt.x)); sv[0].y = (short)(OFFSET_Y(first_pt.y)); *************** *** 1012,1015 **** --- 1015,1019 ---- if (new_sv == NULL) FailAllocMessage(); + memset(new_sv, 0, (sn+3)*sizeof(XPoint)); for (i=0; i < sn; i++) { new_sv[i].x = sv[i].x; *** color.c.orig Sat May 20 18:53:13 2000 --- color.c Sat May 20 18:53:14 2000 *************** *** 587,593 **** sprintf(buf, "Color%1d", i); if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, buf)) != NULL) { ! strcpy(colorMenuItems[i], c_ptr); } else if (i < MAXCOLORS) { ! strcpy(colorMenuItems[i], defaultColorMenuItems[i]); } else { fprintf(stderr, TgLoadString(STID_CANNOT_GET_X_DEFAULT), --- 587,594 ---- sprintf(buf, "Color%1d", i); if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, buf)) != NULL) { ! UtilStrCpyN(colorMenuItems[i], COLORSTRLEN, c_ptr); } else if (i < MAXCOLORS) { ! UtilStrCpyN(colorMenuItems[i], COLORSTRLEN, ! defaultColorMenuItems[i]); } else { fprintf(stderr, TgLoadString(STID_CANNOT_GET_X_DEFAULT), *************** *** 596,599 **** --- 597,601 ---- exit(-1); } + UtilTrimBlanks(colorMenuItems[i]); colorLayerOn[i] = TRUE; } *** drawing.c.orig Sat May 20 18:53:14 2000 --- drawing.c Sat May 20 18:53:14 2000 *************** *** 538,542 **** char *psz_arg; { ! if (p_ev->type == KeyPress || p_ev->type == KeyRelease) { XKeyEvent *key_ev=(&(p_ev->xkey)); KeySym key_sym=(KeySym)0; --- 538,542 ---- char *psz_arg; { ! if (p_ev->type == KeyPress) { XKeyEvent *key_ev=(&(p_ev->xkey)); KeySym key_sym=(KeySym)0; *************** *** 2553,2556 **** --- 2553,2558 ---- } else if (strcmp(name, "ToggleShowMeasurementInTooltip()") == 0) { ToggleShowMeasurementInTooltip(); + } else if (strcmp(name, "ToggleAutoEPSPreviewBitmap()") == 0) { + ToggleAutoEPSPreviewBitmap(); } } *** eps.c.orig Sat May 20 18:53:15 2000 --- eps.c Sat May 20 18:53:15 2000 *************** *** 71,74 **** --- 71,76 ---- char defaultEPSScalingStr[80]; + int autoEPSPreviewBitmap=FALSE; + static struct EPSLineRec *topLine=NULL, *botLine=NULL; static int numLines=0; *************** *** 76,79 **** --- 78,82 ---- static char tiffToXbmCmd[MAXSTRING+1]; static int tiffToXbmCmdInitialized=FALSE; + static char psToXbmCmd[MAXSTRING+1]; /* do not translate -- program constants */ *************** *** 82,85 **** --- 85,90 ---- static char defTiffToXbmCmd[]="tifftopnm %s | pgmtopbm | pbmtoxbm"; + static char defPsToXbmCmd[] = + "gs -q -dNOPAUSE -sDEVICE=pbm -sOutputFile=- -- \"%s\" | pbmtoxbm"; void InitEPS() *************** *** 126,129 **** --- 131,155 ---- } } + /* do not translate -- program constants */ + strcpy(psToXbmCmd, defPsToXbmCmd); + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PsToXbm")) != NULL) { + int count=0; + + strcpy(psToXbmCmd, c_ptr); + for (c_ptr=strstr(psToXbmCmd,"%s"); c_ptr!=NULL; + c_ptr=strstr(++c_ptr,"%s")) { + count++; + } + if (count != 1) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR), + TOOL_NAME, "PsToXbm", psToXbmCmd, defPsToXbmCmd); + strcpy(psToXbmCmd, defPsToXbmCmd); + } + } + autoEPSPreviewBitmap = FALSE; + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"AutoEPSPreviewBitmap")) != + NULL && UtilStrICmp(c_ptr, "true") == 0) { + autoEPSPreviewBitmap = TRUE; + } } *************** *** 668,671 **** --- 694,807 ---- static + int ConvertPsToXbm(pszPsPath, pszXbmPath) + char *pszPsPath, *pszXbmPath; + { + FILE *pFile=NULL, *pPipe=NULL; + char *pszCmd=NULL, szBuf[MAXSTRING]; + int bytes_read=0; + + sprintf(pszXbmPath, "%sTgifXXXXXX", TMP_DIR); + mktemp(pszXbmPath); + unlink(pszXbmPath); + pszCmd = (char*)malloc( + (strlen(psToXbmCmd)+strlen(pszPsPath)+10)*sizeof(char)); + if (pszCmd == NULL) { + FailAllocMessage(); + return FALSE; + } + if ((pFile=fopen(pszXbmPath,"w")) == NULL) { + sprintf(gszMsgBox, TgLoadString(STID_CANNOT_OPEN_FILE_FOR_WRITING), + pszXbmPath); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + free(pszCmd); + return FALSE; + } + sprintf(pszCmd, psToXbmCmd, pszPsPath); + sprintf(gszMsgBox, TgLoadCachedString(CSTID_EXECUTING_GIVEN_PROGRAM), + pszCmd); + SetStringStatus(gszMsgBox); + XSync(mainDisplay, False); + if ((pPipe=(FILE*)popen(pszCmd,"r")) == NULL) { + sprintf(gszMsgBox, TgLoadString(STID_FAIL_TO_EXECUTE_CMD), pszCmd); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + free(pszCmd); + fclose(pFile); + unlink(pszXbmPath); + return FALSE; + } + writeFileFailed = FALSE; + while ((bytes_read=fread(szBuf, sizeof(char), sizeof(szBuf), pPipe)) > 0) { + if ((int)fwrite(szBuf, sizeof(char), bytes_read, pFile) <= 0) { + writeFileFailed = TRUE; + break; + } + } + pclose(pPipe); + SetStringStatus(TgLoadCachedString(CSTID_DOTS_DONE)); + free(pszCmd); + fclose(pFile); + if (writeFileFailed) { + FailToWriteFileMessage(pszXbmPath); + unlink(pszXbmPath); + return FALSE; + } + return TRUE; + } + + static + int AutoGeneratePreviewBitmap(pszPsPath, pBitmap, pImage, pnImageW, pnImageH) + char *pszPsPath; + Pixmap *pBitmap; + XImage **pImage; + int *pnImageW, *pnImageH; + { + char xbm_fname[MAXPATHLENGTH+1]; + unsigned int tmp_w=0, tmp_h=0; + int rc=0, x_hot=0, y_hot=0, empty_image=FALSE, dont_free_orig_bitmap=FALSE; + Pixmap orig_bitmap=None, bitmap=None; + XImage *image=NULL; + + SetWatchCursor(drawWindow); + SetWatchCursor(mainWindow); + SaveStatusStrings(); + rc = ConvertPsToXbm(pszPsPath, xbm_fname); + RestoreStatusStrings(); + SetDefaultCursor(mainWindow); + ShowCursor(); + if (!rc) { + return FALSE; + } + SetWatchCursor(drawWindow); + SetWatchCursor(mainWindow); + rc = XReadBitmapFile(mainDisplay, mainWindow, xbm_fname, &tmp_w, &tmp_h, + &orig_bitmap, &x_hot, &y_hot); + SetDefaultCursor(mainWindow); + ShowCursor(); + unlink(xbm_fname); + if (rc != BitmapSuccess) { + sprintf(gszMsgBox, TgLoadString(STID_CANT_GEN_PREVIEW_FOR_PS), + pszPsPath); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + return FALSE; + } + *pnImageW = (int)tmp_w; + *pnImageH = (int)tmp_h; + rc = AutoTrimBitmap(orig_bitmap, pnImageW, pnImageH, pBitmap, pImage, + &empty_image, &dont_free_orig_bitmap); + if (!dont_free_orig_bitmap) { + XFreePixmap(mainDisplay, orig_bitmap); + } + if (!rc) { + if (empty_image) { + sprintf(gszMsgBox, TgLoadString(STID_CANT_GEN_PREVIEW_FOR_EMPTY_PS), + pszPsPath); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + } + return FALSE; + } + return rc; + } + + static int DoMyReadEPSFile(file_name, pn_image_w, pn_image_h, p_bitmap, p_image, pn_num_lines, ppsz_epsflines, pn_epsf_level, pf_llx, pf_lly, *************** *** 919,922 **** --- 1055,1064 ---- MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } + if (autoEPSPreviewBitmap && image == NULL && bitmap == None && + !preview_found && !(*tiff_eps_fname != '\0' && tiff_preview_ok)) { + if (AutoGeneratePreviewBitmap(real_fname, &bitmap, &image, + &image_w, &image_h)) { + } + } if (stat(real_fname, &stat_buf) == 0) { strcpy(loc_time, ctime (&(stat_buf.st_mtime))); *** file.c.orig Sat May 20 18:53:16 2000 --- file.c Sat May 20 18:53:16 2000 *************** *** 5236,5240 **** } if (whereToPrint == XBM_FILE || whereToPrint == GIF_FILE || ! whereToPrint == HTML_FILE || whereToPrint == PNG_FILE) { if (topObj == NULL) { sprintf(gszMsgBox, TgLoadString(STID_NO_OBJ_TO_EXPORT)); --- 5236,5241 ---- } if (whereToPrint == XBM_FILE || whereToPrint == GIF_FILE || ! whereToPrint == HTML_FILE || whereToPrint == PNG_FILE || ! whereToPrint == JPEG_FILE) { if (topObj == NULL) { sprintf(gszMsgBox, TgLoadString(STID_NO_OBJ_TO_EXPORT)); *************** *** 5252,5256 **** } if (whereToPrint == GIF_FILE || whereToPrint == HTML_FILE || ! whereToPrint == PNG_FILE) { colorDump = TRUE; } --- 5253,5257 ---- } if (whereToPrint == GIF_FILE || whereToPrint == HTML_FILE || ! whereToPrint == PNG_FILE || whereToPrint == JPEG_FILE) { colorDump = TRUE; } *************** *** 7245,7248 **** --- 7246,7250 ---- case TIFFEPSI_FILE: case PNG_FILE: + case JPEG_FILE: allow_print_pages = FALSE; break; *** grid.c.orig Sat May 20 18:53:18 2000 --- grid.c Sat May 20 18:53:18 2000 *************** *** 546,549 **** --- 546,550 ---- break; case PNG_FILE: Msg(TgLoadString(STID_WILL_EXPORT_PNG_FILE)); break; + case JPEG_FILE: Msg(TgLoadString(STID_WILL_EXPORT_JPEG_FILE)); break; } } *** import.c.orig Sat May 20 18:53:18 2000 --- import.c Sat May 20 18:53:18 2000 *************** *** 2466,2468 **** --- 2466,2506 ---- } return menu; + } + + void ToggleAutoEPSPreviewBitmap() + { + autoEPSPreviewBitmap = !autoEPSPreviewBitmap; + sprintf(gszMsgBox, TgLoadString(autoEPSPreviewBitmap ? + STID_WILL_AUTO_GEN_PREVIEW_BITMAP : STID_WONT_AUTO_GEN_PREVIEW_BITMAP), + TOOL_NAME); + Msg(gszMsgBox); + } + + int RefreshImportMenu(menu) + TgMenu *menu; + { + int ok=TRUE; + + /* Auto EPS Preview Bitmap */ + ok &= TgSetMenuItemCheckById(menu, CMDID_TOGGLEAUTOEPSPREVIEWBITMAP, + autoEPSPreviewBitmap); + + return ok; + } + + TgMenu *CreateImportMenu(parent_menu, x, y, menu_info, status_str_xlated) + TgMenu *parent_menu; + int x, y; + TgMenuInfo *menu_info; + int status_str_xlated; /* ignored, always 0 */ + { + TgMenu *menu=TgCreateMenuFromMenuInfo(parent_menu, x, y, menu_info, FALSE); + + if (menu != NULL) { + if (!RefreshImportMenu(menu)) { + return TgDestroyMenu(menu, TRUE); + } + menu->refresh_proc = ((RefreshMenuFunc*)RefreshImportMenu); + } + return menu; } *** mainloop.c.orig Sat May 20 18:53:19 2000 --- mainloop.c Sat May 20 18:53:19 2000 *************** *** 1378,1382 **** if (has_ch > 0) s[has_ch] = '\0'; TranslateKeys(s, &key_sym); ! if (esc_to_abort && has_ch && s[0] == '\033') { if (pf_abort_callback == NULL || (pf_abort_callback)(p_void)) { return TRUE; --- 1378,1382 ---- if (has_ch > 0) s[has_ch] = '\0'; TranslateKeys(s, &key_sym); ! if (esc_to_abort && CharIsESC(key_ev, s, key_sym, &has_ch)) { if (pf_abort_callback == NULL || (pf_abort_callback)(p_void)) { return TRUE; *** menuinfo.c.orig Sat May 20 18:53:20 2000 --- menuinfo.c Sat May 20 18:53:20 2000 *************** *** 504,508 **** { N_("Import X Pixmap..."), "Alt+Cntrl+,", N_("Embed/Import an X11 pixmap file"), NULL, CMDID_IMPORTXPIXMAP }, ! { N_("Import EPS File..."), "Alt+(", N_("Link to an PS/EPS file"), NULL, CMDID_IMPORTEPSFILE }, { N_("Import GIF File..."), NULL, N_("Embed/Import a GIF file"), NULL, --- 504,508 ---- { N_("Import X Pixmap..."), "Alt+Cntrl+,", N_("Embed/Import an X11 pixmap file"), NULL, CMDID_IMPORTXPIXMAP }, ! { N_("Import EPS File..."), "Alt+(", N_("Link to a PS/EPS file"), NULL, CMDID_IMPORTEPSFILE }, { N_("Import GIF File..."), NULL, N_("Embed/Import a GIF file"), NULL, *************** *** 515,521 **** NULL, CMDID_IMPORTOTHERFILE }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, ! { N_("Embed EPS File..."), NULL, N_("Embed/Import an PS/EPS file"), NULL, CMDID_EMBEDEPSFILE }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, { N_("Browse"), TGMUITEM_SUBMENU, N_("Browse submenu >>>"), &browseMenuInfo, INVALID }, --- 515,525 ---- NULL, CMDID_IMPORTOTHERFILE }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, ! { N_("Embed EPS File..."), NULL, N_("Embed/Import a PS/EPS file"), NULL, CMDID_EMBEDEPSFILE }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, + { N_("Auto EPS Preview Bitmap"), NULL, + N_("Auto-generate a preview bitmap for a PS/EPS file when embedding/importing it (if it does not have one already)."), NULL, + CMDID_TOGGLEAUTOEPSPREVIEWBITMAP }, + { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, { N_("Browse"), TGMUITEM_SUBMENU, N_("Browse submenu >>>"), &browseMenuInfo, INVALID }, *************** *** 525,529 **** }; static TgMenuInfo importMenuInfo={ TGMUTYPE_TEXT, importMenuItemInfo, ! TgCreateMenuFromMenuInfo }; static TgMenuItemInfo domainMenuItemInfo[] = { --- 529,533 ---- }; static TgMenuInfo importMenuInfo={ TGMUTYPE_TEXT, importMenuItemInfo, ! CreateImportMenu }; static TgMenuItemInfo domainMenuItemInfo[] = { *** msg.c.orig Sat May 20 18:53:20 2000 --- msg.c Sat May 20 18:53:20 2000 *************** *** 1530,1533 **** --- 1530,1537 ---- cmdLineColor = TRUE; cmdLineOpenDisplay = TRUE; + } else if (strcmp(*argv,"-jpeg") == 0) { + cmdLineWhereToPrint = JPEG_FILE; + cmdLineColor = TRUE; + cmdLineOpenDisplay = TRUE; } else if (strcmp(*argv,"-xpm") == 0) { cmdLineWhereToPrint = XBM_FILE; *** page.c.orig Sat May 20 18:53:21 2000 --- page.c Sat May 20 18:53:21 2000 *************** *** 1111,1114 **** --- 1111,1115 ---- case HTML_FILE: case PNG_FILE: + case JPEG_FILE: sprintf(gszMsgBox, TgLoadString(STID_CANT_PRINTONEPAGE_IN_FORMAT), GetExportName(whereToPrint, EXPORT_THIS)); *************** *** 1481,1484 **** --- 1482,1486 ---- case TIFFEPSI_FILE: case PNG_FILE: + case JPEG_FILE: sprintf(gszMsgBox, TgLoadString(STID_CANT_PRINT_PAGES_IN_FORMAT), GetExportName(whereToPrint, EXPORT_THIS)); *** raster.c.orig Sat May 20 18:53:22 2000 --- raster.c Sat May 20 18:53:22 2000 *************** *** 226,229 **** --- 226,230 ---- #include "xbm/tiffepsi.xbm" #include "xbm/png.xbm" + #include "xbm/jpeg.xbm" #include "xbm/file.xbm" *************** *** 942,945 **** --- 943,948 ---- whereToPrintPixmap[PNG_FILE] = XCreateBitmapFromData(mainDisplay, mainWindow, (char *)png_bits, png_width, png_height); + whereToPrintPixmap[JPEG_FILE] = XCreateBitmapFromData(mainDisplay, + mainWindow, (char *)jpeg_bits, jpeg_width, jpeg_height); shortLineTypePixmap[0] = XCreateBitmapFromData(mainDisplay, mainWindow, *** setup.c.orig Sat May 20 18:53:22 2000 --- setup.c Sat May 20 18:53:22 2000 *************** *** 919,922 **** --- 919,924 ---- } else if (UtilStrICmp(c_ptr, "PNG") == 0) { whereToPrint = PNG_FILE; + } else if (UtilStrICmp(c_ptr, "JPEG") == 0) { + whereToPrint = JPEG_FILE; } else { fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR), *** shortcut.c.orig Sat May 20 18:53:23 2000 --- shortcut.c Sat May 20 18:53:23 2000 *************** *** 386,389 **** --- 386,391 ---- CMDID_TOGGLESHOWMEASUREMENTINTT }, { '\0', 0, "ImportJPEGFile()", 0, CMDID_IMPORTJPEGFILE }, + { '\0', 0, "ToggleAutoEPSPreviewBitmap()", 0, + CMDID_TOGGLEAUTOEPSPREVIEWBITMAP }, { '\0', 0, "", 0, 0 } }; *** spline.c.orig Sat May 20 18:53:24 2000 --- spline.c Sat May 20 18:53:24 2000 *************** *** 210,213 **** --- 210,214 ---- return splineVs; } + memset(splineVs, 0, (NumVs+1)*sizeof(XPoint)); splineVs[0].x = ZOOMED_SIZE(Vs[0].x-x_off); splineVs[0].y = ZOOMED_SIZE(Vs[0].y-y_off); *************** *** 229,232 **** --- 230,234 ---- return splineVs; } + memset(splineVs, 0, (max_n+1)*sizeof(XPoint)); splineVs[0].x = mx1; splineVs[0].y = my1; *************** *** 248,251 **** --- 250,254 ---- return splineVs; } + memset(splineVs, 0, (max_n+1)*sizeof(XPoint)); splineVs[0].x = mx1; splineVs[0].y = my1; *************** *** 314,318 **** return NULL; } ! for (i=0; i < segments; i++) msptr[i].vlist = NULL; start_index = 0; seg_index = 0; --- 317,322 ---- return NULL; } ! memset(msptr, 0, segments*sizeof(struct MultiSplineRec)); ! start_index = 0; seg_index = 0; *************** *** 329,332 **** --- 333,337 ---- splineVs = (XPoint *)malloc((total+2)*sizeof(XPoint)); if (splineVs == NULL) FailAllocMessage(); + memset(splineVs, 0, (total+2)*sizeof(XPoint)); xpptr = splineVs; for (i=0; i < segments; i++) { *************** *** 365,368 **** --- 370,374 ---- return splineVs; } + memset(splineVs, 0, 5*sizeof(XPoint)); splineVs[0].x = ZOOMED_SIZE(Vs[0].x-x_off); splineVs[0].y = ZOOMED_SIZE(Vs[0].y-y_off); *************** *** 385,388 **** --- 391,395 ---- return splineVs; } + memset(splineVs, 0, (max_n+1)*sizeof(XPoint)); splineVs[0].x = mx4; splineVs[0].y = my4; *************** *** 424,427 **** --- 431,435 ---- return splineVs; } + memset(splineVs, 0, 5*sizeof(XPoint)); x = ZOOMED_DOUBLE_SIZE(Vs[0].x-dx_off); y = ZOOMED_DOUBLE_SIZE(Vs[0].y-dy_off); *************** *** 451,454 **** --- 459,463 ---- return NULL; } + memset(splineDoubleVs, 0, (max_n+1)*sizeof(DoublePoint)); splineDoubleVs[0].x = mx4; splineDoubleVs[0].y = my4; *************** *** 472,475 **** --- 481,485 ---- return NULL; } + memset(splineVs, 0, ((*N)+2)*sizeof(XPoint)); for (i=0; i < *N; i++) { splineVs[i].x = round(splineDoubleVs[i].x); *************** *** 513,517 **** sizeof(struct MultiSplineRec)); if (msptr == NULL) FailAllocMessage(); ! for (i=0; i < num_hinge_points; i++) msptr[i].vlist = NULL; for (i=0; i < NumVs; i++) { --- 523,527 ---- sizeof(struct MultiSplineRec)); if (msptr == NULL) FailAllocMessage(); ! memset(msptr, 0, num_hinge_points*sizeof(struct MultiSplineRec)); for (i=0; i < NumVs; i++) { *************** *** 522,525 **** --- 532,536 ---- tmp_vs = (IntPoint*)malloc((NumVs+1)*sizeof(IntPoint)); if (tmp_vs == NULL) FailAllocMessage(); + memset(tmp_vs, 0, (NumVs+1)*sizeof(IntPoint)); start_index = i; seg_index = 0; *************** *** 550,553 **** --- 561,565 ---- splineVs = (XPoint*)malloc((total+2)*sizeof(XPoint)); if (splineVs == NULL) FailAllocMessage(); + memset(splineVs, 0, (total+2)*sizeof(XPoint)); xpptr = splineVs; for (i=0; i < num_hinge_points; i++) { *************** *** 593,599 **** --- 605,613 ---- mtxInfo.mtx = (double**)malloc(NumPts*sizeof(double*)); if (mtxInfo.mtx == NULL) FailAllocMessage(); + memset(mtxInfo.mtx, 0, NumPts*sizeof(double*)); for (i=0; i < NumPts; i++) { mtxInfo.mtx[i] = (double*)malloc(3*sizeof(double)); if (mtxInfo.mtx[i] == NULL) FailAllocMessage(); + memset(mtxInfo.mtx[i], 0, 3*sizeof(double)); } mtxInfo.mtx[0][0] = mtxInfo.mtx[NumPts-1][2] = (double)0.0; *************** *** 638,647 **** register int i; ! free(mtxInfo.x); mtxInfo.x = NULL; ! free(mtxInfo.y); mtxInfo.y = NULL; ! free(mtxInfo.dx); mtxInfo.dx = NULL; ! free(mtxInfo.dy); mtxInfo.dy = NULL; ! for (i=0; i < NumPts; i++) free(mtxInfo.mtx[i]); ! free(mtxInfo.mtx); mtxInfo.mtx = NULL; } --- 652,666 ---- register int i; ! if (mtxInfo.x != NULL) free(mtxInfo.x); ! if (mtxInfo.y != NULL) free(mtxInfo.y); ! if (mtxInfo.dx != NULL) free(mtxInfo.dx); ! if (mtxInfo.dy != NULL) free(mtxInfo.dy); ! if (mtxInfo.mtx != NULL) { ! for (i=0; i < NumPts; i++) { ! if (mtxInfo.mtx[i] != NULL) free(mtxInfo.mtx[i]); ! } ! free(mtxInfo.mtx); ! } ! memset(&mtxInfo, 0, sizeof(struct MtxRec)); } *************** *** 658,661 **** --- 677,682 ---- v = (IntPoint*)malloc((((NumPts-2)<<1)+2)*sizeof(IntPoint)); if (v == NULL) FailAllocMessage(); + memset(v, 0, (((NumPts-2)<<1)+2)*sizeof(IntPoint)); + v[index].x = (int)(mtxInfo.x[0]); v[index].y = (int)(mtxInfo.y[0]); *************** *** 703,706 **** --- 724,728 ---- *CntrlVs = (IntPoint*)malloc((NumVs+1)*sizeof(IntPoint)); if (*CntrlVs == NULL) FailAllocMessage(); + memset(*CntrlVs, 0, (NumVs+1)*sizeof(IntPoint)); splineVs = (XPoint*)malloc((NumVs+1)*sizeof(XPoint)); if (splineVs == NULL) { *************** *** 709,712 **** --- 731,735 ---- return splineVs; } + memset(splineVs, 0, (NumVs+1)*sizeof(XPoint)); splineVs[0].x = ZOOMED_SIZE(Vs[0].x-x_off); splineVs[0].y = ZOOMED_SIZE(Vs[0].y-y_off); *************** *** 751,757 **** --- 774,782 ---- mtxInfo.mtx = (double**)malloc(NumPts*sizeof(double*)); if (mtxInfo.mtx == NULL) FailAllocMessage(); + memset(mtxInfo.mtx, 0, NumPts*sizeof(double*)); for (i=0; i < NumPts; i++) { mtxInfo.mtx[i] = (double*)malloc(4*sizeof(double)); if (mtxInfo.mtx[i] == NULL) FailAllocMessage(); + memset(mtxInfo.mtx[i], 0, 4*sizeof(double)); } mtxInfo.mtx[0][0] = mtxInfo.mtx[NumPts-1][2] = (double)1.0; *************** *** 805,811 **** --- 830,838 ---- mtxInfo.mtx = (double**)malloc(NumPts*sizeof(double*)); if (mtxInfo.mtx == NULL) FailAllocMessage(); + memset(mtxInfo.mtx, 0, NumPts*sizeof(double*)); for (i=0; i < NumPts; i++) { mtxInfo.mtx[i] = (double*)malloc(4*sizeof(double)); if (mtxInfo.mtx[i] == NULL) FailAllocMessage(); + memset(mtxInfo.mtx[i], 0, 4*sizeof(double)); } mtxInfo.mtx[0][0] = mtxInfo.mtx[NumPts-1][2] = (double)1.0; *************** *** 966,969 **** --- 993,997 ---- v = (IntPoint*)malloc(((NumPts<<1)+2)*sizeof(IntPoint)); if (v == NULL) FailAllocMessage(); + memset(v, 0, ((NumPts<<1)+2)*sizeof(IntPoint)); for (i=0; ijpg filter) file."), + /* STID_NETPBM_JPEG_VST_HOME_PAGE */ + N_("(These programs are part of the netpbm and jpeg packages. Please visit %s's home page at regarding where to obtain netpbm and jpeg.)"), + /* STID_CANT_GEN_PREVIEW_FOR_PS */ + N_("Cannot auto-generate a preview bitmap for '%s'."), + /* STID_CANT_GEN_PREVIEW_FOR_EMPTY_PS */ + N_("The auto-generate preview bitmap for '%s' is empty. Auto-generation skipped."), + /* STID_WILL_AUTO_GEN_PREVIEW_BITMAP */ + N_("Will auto-generate a preview bitmap when importing/embedding a PS/EPS file."), + /* STID_WONT_AUTO_GEN_PREVIEW_BITMAP */ + N_("Will not auto-generate a preview bitmap when importing/embedding a PS/EPS file."), NULL }; *************** *** 3814,3817 **** --- 3826,3831 ---- { N_("Set printing mode to generate PDF files"), NULL, NULL }, { N_("Set printing mode to generate DOS/Windows EPSI files"), NULL, NULL }, + { N_("Set printing mode to generate PNG files"), NULL, NULL }, + { N_("Set printing mode to generate JPEG files"), NULL, NULL }, { N_("Set printing mode to generate %s files"), NULL, NULL }, { NULL, NULL, NULL } *** tgif_dbg.c.orig Sat May 20 18:53:25 2000 --- tgif_dbg.c Sat May 20 18:53:25 2000 *************** *** 390,393 **** --- 390,420 ---- } + int Tgif_XReadBitmapFile(display, d, filename, width_return, height_return, + bitmap_return, x_hot_return, y_hot_return) + Display *display; + Drawable d; + _Xconst char *filename; + unsigned int *width_return; + unsigned int *height_return; + Pixmap *bitmap_return; + int *x_hot_return, *y_hot_return; + { + int rc=XReadBitmapFile(display, d, filename, width_return, height_return, + bitmap_return, x_hot_return, y_hot_return); + + if (gpTraceFile != NULL) { + if (++gnCreatePixmapCount == gnCreatePixmapTrigger) { + got_trigger(1); + } + fprintf(gpTraceFile, "p: %6d 0x%08x %d\n", + gnCreatePixmapCount, + (bitmap_return==NULL || rc != BitmapSuccess) ? 0 : + (unsigned int)(*bitmap_return), + (width_return==NULL || height_return==NULL) ? 0 : + (int)((*width_return)*(*height_return))); + } + return rc; + } + void Tgif_XFreePixmap(display, pixmap) Display *display; *** xbitmap.c.orig Sat May 20 18:53:26 2000 --- xbitmap.c Sat May 20 18:53:26 2000 *************** *** 121,124 **** --- 121,125 ---- static char xpmToGifCmd[MAXSTRING+1]; static char xpmToPngCmd[MAXSTRING+1]; + static char xpmToJpegCmd[MAXSTRING+1]; static char xpmDeckToGifAnimCmd[MAXSTRING+1]; static char imageMapFileExtension[MAXSTRING+1]; *************** *** 126,129 **** --- 127,131 ---- static char gifFileExtension[MAXSTRING+1]; static char pngFileExtension[MAXSTRING+1]; + static char jpegFileExtension[MAXSTRING+1]; static int imageMapFileFormat=IMF_FORMAT_NCSA; static int useXPmVersion1ForImageMap=TRUE; *************** *** 884,887 **** --- 886,954 ---- } + int AutoTrimBitmap(OrigBitmap, pnImageW, pnImageH, pBitmap, pImage, + pnEmptyImage, pnDontFreeOrigBitmap) + Pixmap OrigBitmap, *pBitmap; + int *pnImageW, *pnImageH, *pnEmptyImage, *pnDontFreeOrigBitmap; + XImage **pImage; + { + int i=0, orig_w=(*pnImageW), orig_h=(*pnImageH); + int top=orig_h, left=orig_w, bottom=(-1), right=(-1); + XImage *image=NULL; + + *pnEmptyImage = *pnDontFreeOrigBitmap = FALSE; + + SetWatchCursor(drawWindow); + SetWatchCursor(mainWindow); + image = XGetImage(mainDisplay, OrigBitmap, 0, 0, orig_w, orig_h, 1, ZPixmap); + + if (image == NULL) { + MsgBox(TgLoadString(STID_XGETIMAGE_MAY_RUN_OUT_VMEM), TOOL_NAME, + INFO_MB); + SetDefaultCursor(mainWindow); + SetDefaultCursor(drawWindow); + return FALSE; + } + for (i=0; i < orig_h; i++) { + int j=0; + + for (j=0; j < orig_w; j++) { + if (XGetPixel(image, j, i) != 0) { + if (i < top) top = i; + if (i > bottom) bottom = i; + if (j < left) left = j; + if (j > right) right = j; + } + } + } + SetDefaultCursor(mainWindow); + SetDefaultCursor(drawWindow); + + if (top == orig_h && left == orig_w && bottom == (-1) && right == (-1)) { + /* no image */ + *pnEmptyImage = TRUE; + XDestroyImage(image); + return FALSE; + } else if (top == 0 && left == 0 && bottom == orig_w-1 && + right == orig_h-1) { + *pnImageW = orig_w; + *pnImageH = orig_h; + *pBitmap = OrigBitmap; + *pImage = image; + *pnDontFreeOrigBitmap = TRUE; + } else { + /* trim */ + int rc=0; + + *pnImageW = right-left+1; + *pnImageH = bottom-top+1; + rc = ExtractBitmap(OrigBitmap, image, left, top, *pnImageW, *pnImageH, + pBitmap, pImage); + XDestroyImage(image); + + return rc; + } + return TRUE; + } + static void InvertXBmObject(ObjPtr) *************** *** 1840,1843 **** --- 1907,1911 ---- static char defXpmToGif[]="xpmtoppm %s | ppmtogif"; static char defXpmToPng[]="xpmtoppm %s | pnmtopng"; + static char defXpmToJpeg[]="xpmtoppm %s | cjpeg"; static char defXpmDeckToGifAnim[]="gifsicle -lforever --delay 10"; *************** *** 1872,1880 **** strcpy(xpmToGifCmd, defXpmToGif); } if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"GifFileExtension")) != NULL) { strcpy(gifFileExtension, c_ptr); - } else { - strcpy(gifFileExtension, "gif"); } if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"XpmToPng")) != NULL) { int count=0; --- 1940,1948 ---- strcpy(xpmToGifCmd, defXpmToGif); } + strcpy(gifFileExtension, "gif"); if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"GifFileExtension")) != NULL) { strcpy(gifFileExtension, c_ptr); } + strcpy(xpmToPngCmd, defXpmToPng); if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"XpmToPng")) != NULL) { int count=0; *************** *** 1892,1903 **** strcpy(xpmToPngCmd, defXpmToPng); } - } else { - strcpy(xpmToPngCmd, defXpmToPng); } if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PngFileExtension")) != NULL) { strcpy(pngFileExtension, c_ptr); - } else { - strcpy(pngFileExtension, "png"); } useXPmVersion1ForImageMap = TRUE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME, --- 1960,1989 ---- strcpy(xpmToPngCmd, defXpmToPng); } } + strcpy(pngFileExtension, "png"); if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PngFileExtension")) != NULL) { strcpy(pngFileExtension, c_ptr); } + strcpy(xpmToJpegCmd, defXpmToJpeg); + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"XpmToJpeg")) != NULL) { + int count=0; + + strcpy(xpmToJpegCmd, c_ptr); + UtilTrimBlanks(xpmToJpegCmd); + for (c_ptr=strstr(xpmToJpegCmd,"%s"); c_ptr!=NULL; + c_ptr=strstr(++c_ptr,"%s")) { + count++; + } + if (count != 1) { + sprintf(gszMsgBox, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR), + TOOL_NAME, "XpmToJpeg", xpmToJpegCmd, defXpmToJpeg); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + strcpy(xpmToJpegCmd, defXpmToJpeg); + } + } + strcpy(jpegFileExtension, "jpeg"); + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"JpegFileExtension")) != NULL) { + strcpy(jpegFileExtension, c_ptr); + } useXPmVersion1ForImageMap = TRUE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME, *************** *** 2322,2325 **** --- 2408,2425 ---- } break; + case JPEG_FILE: + sprintf(cmd, xpmToJpegCmd, xpm_fname); + + *netpbm_msg = '\0'; + if (strncmp(cmd, "xpmtop", 6) == 0) { + sprintf(netpbm_msg, TgLoadString(STID_NETPBM_JPEG_VST_HOME_PAGE), + TOOL_NAME, homePageURL); + } + if (!FindProgramInPath(cmd, netpbm_msg)) { + fclose(gif_fp); + unlink(gif_fname); + return FALSE; + } + break; } sprintf(gszMsgBox, TgLoadCachedString(CSTID_EXECUTING_GIVEN_PROGRAM), cmd); *************** *** 2571,2574 **** --- 2671,2679 ---- *pngFileExtension == '\0' ? "" : ".", pngFileExtension); break; + case JPEG_FILE: + *map_fname = '\0'; + sprintf(gif_fname, "%s%s%s", XpmFileName, + *jpegFileExtension == '\0' ? "" : ".", jpegFileExtension); + break; } XpmFileName[len-xpm_ext_len] = '.'; *************** *** 2654,2657 **** --- 2759,2763 ---- case PNG_FILE: break; + case JPEG_FILE: break; } } *************** *** 2921,2925 **** if (whereToPrint==GIF_FILE || whereToPrint==HTML_FILE || ! whereToPrint==PNG_FILE) { if (useXPmVersion1ForImageMap) { xpmOutputVersion = 1; --- 3027,3031 ---- if (whereToPrint==GIF_FILE || whereToPrint==HTML_FILE || ! whereToPrint==PNG_FILE || whereToPrint==JPEG_FILE) { if (useXPmVersion1ForImageMap) { xpmOutputVersion = 1; *************** *** 3348,3352 **** } if (colorDump && (whereToPrint==GIF_FILE || whereToPrint==HTML_FILE || ! whereToPrint==PNG_FILE)) { Msg(TgLoadCachedString(CSTID_GENERATING_IMAGEMAP_FILE_DOTS)); SaveStatusStrings(); --- 3454,3458 ---- } if (colorDump && (whereToPrint==GIF_FILE || whereToPrint==HTML_FILE || ! whereToPrint==PNG_FILE || whereToPrint==JPEG_FILE)) { Msg(TgLoadCachedString(CSTID_GENERATING_IMAGEMAP_FILE_DOTS)); SaveStatusStrings(); *** xprtfltr.c.orig Sat May 20 18:53:28 2000 --- xprtfltr.c Sat May 20 18:53:28 2000 *************** *** 347,351 **** static char *gpszColorExportName[MAXDEFWHERETOPRINT] = { "Printer", "EPS", "PS", "XPM", "ASCII", "EPSI", "GIF/ISMAP", "HTML/USEMAP", ! "PDF", "TiffEPSI", "PNG" }; --- 347,351 ---- static char *gpszColorExportName[MAXDEFWHERETOPRINT] = { "Printer", "EPS", "PS", "XPM", "ASCII", "EPSI", "GIF/ISMAP", "HTML/USEMAP", ! "PDF", "TiffEPSI", "PNG", "JPEG" }; *************** *** 352,356 **** static char *gpszBWExportName[MAXDEFWHERETOPRINT] = { "Printer", "EPS", "PS", "XBM", "ASCII", "EPSI", "GIF/ISMAP", "HTML/USEMAP", ! "PDF", "TiffEPSI", "PNG" }; --- 352,356 ---- static char *gpszBWExportName[MAXDEFWHERETOPRINT] = { "Printer", "EPS", "PS", "XBM", "ASCII", "EPSI", "GIF/ISMAP", "HTML/USEMAP", ! "PDF", "TiffEPSI", "PNG", "JPEG" }; *************** *** 357,361 **** static char *gpszColorExportExt[MAXDEFWHERETOPRINT] = { NULL, EPSF_FILE_EXT, PS_FILE_EXT, XPM_FILE_EXT, TEXT_FILE_EXT, ! EPSF_FILE_EXT, "gif", "html", "pdf", EPSF_FILE_EXT, "png" }; --- 357,361 ---- static char *gpszColorExportExt[MAXDEFWHERETOPRINT] = { NULL, EPSF_FILE_EXT, PS_FILE_EXT, XPM_FILE_EXT, TEXT_FILE_EXT, ! EPSF_FILE_EXT, "gif", "html", "pdf", EPSF_FILE_EXT, "png", "jpg" }; *************** *** 362,366 **** static char *gpszBWExportExt[MAXDEFWHERETOPRINT] = { NULL, EPSF_FILE_EXT, PS_FILE_EXT, XBM_FILE_EXT, TEXT_FILE_EXT, ! EPSF_FILE_EXT, "gif", "html", "pdf", EPSF_FILE_EXT, "png" }; --- 362,366 ---- static char *gpszBWExportExt[MAXDEFWHERETOPRINT] = { NULL, EPSF_FILE_EXT, PS_FILE_EXT, XBM_FILE_EXT, TEXT_FILE_EXT, ! EPSF_FILE_EXT, "gif", "html", "pdf", EPSF_FILE_EXT, "png", "jpg" }; *** eps.e.orig Sat May 20 18:53:29 2000 --- eps.e Sat May 20 18:53:29 2000 *************** *** 38,41 **** --- 38,43 ---- extern char defaultEPSScalingStr[]; + extern int autoEPSPreviewBitmap; + #ifdef _INCLUDE_FROM_EPS_C_ #undef extern *** import.e.orig Sat May 20 18:53:29 2000 --- import.e Sat May 20 18:53:29 2000 *************** *** 77,80 **** --- 77,84 ---- TgMenuInfo*, int status_str_xlated)); + extern void ToggleAutoEPSPreviewBitmap ARGS_DECL((void)); + extern int RefreshImportMenu ARGS_DECL((TgMenu*)); + extern TgMenu *CreateImportMenu ARGS_DECL((TgMenu*, int X, int Y, TgMenuInfo*, + int status_str_xlated)); #ifdef _INCLUDE_FROM_IMPORT_C_ *** strtbl.e.orig Sat May 20 18:53:30 2000 --- strtbl.e Sat May 20 18:53:30 2000 *************** *** 1557,1562 **** #define STID_CANNOT_IMPORT_GIVEN_JPEG 2279 #define STID_GIVEN_JPEG_SIZE_FILE_IMPORTED 2280 ! #define MAXNONCACHEDSTIDS 2281 extern struct MouseStatusStrRec colorMouseStatus[]; --- 1557,1568 ---- #define STID_CANNOT_IMPORT_GIVEN_JPEG 2279 #define STID_GIVEN_JPEG_SIZE_FILE_IMPORTED 2280 + #define STID_WILL_EXPORT_JPEG_FILE 2281 + #define STID_NETPBM_JPEG_VST_HOME_PAGE 2282 + #define STID_CANT_GEN_PREVIEW_FOR_PS 2283 + #define STID_CANT_GEN_PREVIEW_FOR_EMPTY_PS 2284 + #define STID_WILL_AUTO_GEN_PREVIEW_BITMAP 2285 + #define STID_WONT_AUTO_GEN_PREVIEW_BITMAP 2286 ! #define MAXNONCACHEDSTIDS 2287 extern struct MouseStatusStrRec colorMouseStatus[]; *** xbitmap.e.orig Sat May 20 18:53:31 2000 --- xbitmap.e Sat May 20 18:53:31 2000 *************** *** 70,73 **** --- 70,77 ---- int X, int Y, int W, int H, Pixmap *Bitmap, XImage **Image)); + extern int AutoTrimBitmap ARGS_DECL((Pixmap OrigBitmap, int *pnImageW, + int *pnImageH, Pixmap *Bitmap, + XImage **Image, int *pnEmptyImage, + int *pnDontFreeOrigBitmap)); extern void InvertXBitmaps ARGS_DECL((void)); extern void ParseCutSpec ARGS_DECL((char *Spec, int ImageW, int ImageH, *** cmdids.h.orig Sat May 20 18:53:31 2000 --- cmdids.h Sat May 20 18:53:31 2000 *************** *** 383,388 **** #define CMDID_TOGGLESHOWMEASUREMENTINTT 430 #define CMDID_IMPORTJPEGFILE 431 ! #define MAXCMDIDS 432 #endif /*_CMDIDS_H_*/ --- 383,389 ---- #define CMDID_TOGGLESHOWMEASUREMENTINTT 430 #define CMDID_IMPORTJPEGFILE 431 + #define CMDID_TOGGLEAUTOEPSPREVIEWBITMAP 432 ! #define MAXCMDIDS 433 #endif /*_CMDIDS_H_*/ *** const.h.orig Sat May 20 18:53:32 2000 --- const.h Sat May 20 18:53:32 2000 *************** *** 464,469 **** #define TIFFEPSI_FILE 9 #define PNG_FILE 10 ! #define MAXDEFWHERETOPRINT 11 /* measurement */ --- 464,470 ---- #define TIFFEPSI_FILE 9 #define PNG_FILE 10 + #define JPEG_FILE 11 ! #define MAXDEFWHERETOPRINT 12 /* measurement */ *** patchlvl.h.orig Sat May 20 18:53:32 2000 --- patchlvl.h Sat May 20 18:53:32 2000 *************** *** 35,39 **** #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 33 #endif /*_TGIF_PATCHLEVEL_H_*/ --- 35,39 ---- #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 34 #endif /*_TGIF_PATCHLEVEL_H_*/ *** tgif_dbg.h.orig Sat May 20 18:53:33 2000 --- tgif_dbg.h Sat May 20 18:53:33 2000 *************** *** 69,72 **** --- 69,74 ---- extern Pixmap Tgif_XCreateBitmapFromData ARGS_DECL((Display*, Drawable, _Xconst char*, unsigned int, unsigned int)); + extern int Tgif_XReadBitmapFile ARGS_DECL((Display*, Drawable, + _Xconst char*, unsigned int *, unsigned int *, Pixmap*, int*, int*)); extern void Tgif_XFreePixmap ARGS_DECL((Display*, Pixmap)); *************** *** 117,120 **** --- 119,123 ---- #define XCreatePixmap Tgif_XCreatePixmap #define XCreateBitmapFromData Tgif_XCreateBitmapFromData + #define XReadBitmapFile Tgif_XReadBitmapFile #define XFreePixmap Tgif_XFreePixmap *** Imakefile.orig Sat May 20 18:53:33 2000 --- Imakefile Sat May 20 18:53:33 2000 *************** *** 54,58 **** $(MOREDEFINES) ! TGIFVERSION = 4.1.33 XCOMM Things to try to add to the DEFINES line above: --- 54,58 ---- $(MOREDEFINES) ! TGIFVERSION = 4.1.34 XCOMM Things to try to add to the DEFINES line above: *** tgif.man.orig Sat May 20 18:53:34 2000 --- tgif.man Sat May 20 18:53:34 2000 *************** *** 9,13 **** .\" .\" ! .TH tgif n "Version 4.1 Patchlevel 31 and Above" "Tgif" .\" .SH NAME --- 9,13 ---- .\" .\" ! .TH tgif n "Version 4.1 Patchlevel 34 and Above" "Tgif" .\" .SH NAME *************** *** 52,55 **** --- 52,56 ---- [\fB-gif\fR] [\fB-png\fR] + [\fB-jpeg\fR] [\fB-xpm\fR] [\fB-xbm\fR] *************** *** 90,95 **** and pipes them to lpr(1) if none of the \fB-eps\fR, \fB-p\fR, \fB-epsi\fR, \fB-tiffepsi\fR, ! \fB-gif\fR, \fB-png\fR, \fB-xpm\fR, \fB-xbm\fR, \fB-html\fR, \fB-pdf\fR, ! \fB-ps\fR, \fB-f\fR, or \fB-text\fR options are specified. This form of \fIprinting\fR is tgif's way of \fIexporting\fR a tgif file to another format. In this case, --- 91,96 ---- and pipes them to lpr(1) if none of the \fB-eps\fR, \fB-p\fR, \fB-epsi\fR, \fB-tiffepsi\fR, ! \fB-gif\fR, \fB-png\fR, \fB-jpeg\fR, \fB-xpm\fR, \fB-xbm\fR, \fB-html\fR, ! \fB-pdf\fR, \fB-ps\fR, \fB-f\fR, or \fB-text\fR options are specified. This form of \fIprinting\fR is tgif's way of \fIexporting\fR a tgif file to another format. In this case, *************** *** 204,210 **** .B -png Generates a PNG file in \fIfile.png\fR. - Please see the notes for Tgif.PngToXpm in the X DEFAULTS section below. Tgif aborts if a valid display is not accessible. .TP .B -xpm Generates an X11 pixmap (XPM) file in \fIfile.xpm\fR. --- 205,214 ---- .B -png Generates a PNG file in \fIfile.png\fR. Tgif aborts if a valid display is not accessible. .TP + .B -jpeg + Generates a JPEG file in \fIfile.jpg\fR. + Tgif aborts if a valid display is not accessible. + .TP .B -xpm Generates an X11 pixmap (XPM) file in \fIfile.xpm\fR. *************** *** 3572,3577 **** .PP .TP ! .I Tgif.WhereToPrint: [Printer,EPS,PS,Bitmap,Text,EPSI,GIF,HTML,PDF,WinEPSI,PNG] This specifies the initial print/export destination/format. The default is EPS. .TP --- 3576,3583 ---- .PP .TP ! .I Tgif.WhereToPrint: STRING This specifies the initial print/export destination/format. + STRING can be Printer, EPS, PS, Bitmap, Text, EPSI, GIF, HTML, PDF, WinEPSI, + PNG, or JPEG. The default is EPS. .TP *************** *** 4656,4660 **** The STRING specifies a command used to convert a JPEG file to an XPM file. The STRING \fImust\fR contain a \fI%s\fR substring to be replaced by the ! full path name of the PNG file. The default is "djpeg -gif -color 222 %s | giftopnm | ppmtoxpm". .TP --- 4662,4666 ---- The STRING specifies a command used to convert a JPEG file to an XPM file. The STRING \fImust\fR contain a \fI%s\fR substring to be replaced by the ! full path name of the JPEG file. The default is "djpeg -gif -color 222 %s | giftopnm | ppmtoxpm". .TP *************** *** 4669,4672 **** --- 4675,4688 ---- The default is "png" (lower case). .TP + .I Tgif.XpmToJpeg: STRING + The STRING specifies a command used to convert an XPM file to a JPEG file. + The STRING \fImust\fR contain a \fI%s\fR substring to be replaced by the + full path name of the XPM file. + The default is "xpmtoppm %s | cjpeg". + .TP + .I Tgif.JpegFileExtension: STRING + The STRING specifies the file extension for a JPEG file. + The default is "jpg" (lower case). + .TP .I Tgif.ProducedBy: STRING When printing/exporting PS/EPS files, STRING will appear in a %%ProducedBy *************** *** 4743,4746 **** --- 4759,4775 ---- wrap around automatically. The default is false. + .TP + .I Tgif.AutoEPSPreviewBitmap: [true,false] + If set to ``true'', when importing a PS/EPS file, tgif will automatically + generate a preview bitmap if the file does not already contain one. + The default is false. + .TP + .I Tgif.PsToXbm: STRING + The STRING specifies a command used to convert a PS file to a XBM file. + The STRING \fImust\fR contain a single \fI%s\fR substrings to be replaced by the + full path name of the PS file. Please note that the above command usually + generates a bitmap that's much larger than image in the file. Tgif + automatically trims out the blank space similar to the way pbmtoepsi works. + The default is "gs -q -dNOPAUSE -sDEVICE=pbm -sOutputFile=- -- "%s" | pbmtoxbm". .\" .\" add new X defaults here *** HISTORY.orig Sat May 20 18:53:35 2000 --- HISTORY Sat May 20 18:53:35 2000 *************** *** 1,2 **** --- 1,23 ---- + -----------------------> tgif-4.1.33 => tgif-4.1.34 <----------------------- + 1) Fix a crashing bug in drawing linearly transformed arc objects. Apparently, + this bug has been around for a long time. Thanks to Hari Radhakrishnan + for pointing out the problem. + 2) Support the JPEG export format. Add new X defaults, Tgif.XpmToJpeg and + Tgif.JpegFileExtension. The default value them are "xpmtoppm %s | cjpeg" + and "jpg", respectively. + 3) Add a new X default, Tgif.AutoEPSPreviewBitmap, to enable the automatic + generation of a preview bitmap when importing a PS/EPS file, if the file + does not contain a preview bitmap. (This can be turned on and off from the + Import Submenu of the File Menu.) The feature also uses a new X default, + Tgif.PsToXbm, so that the default PS/EPS to XBM filter can be overridden. + The default value for Tgif.PsToXbm is: + + gs -q -dNOPAUSE -sDEVICE=pbm -sOutputFile=- -- "%s" | pbmtoxbm + + Please note that the above command usually generates a bitmap that's + much larger than image in the file. Tgif automatically trims out the + blank space similar to the way pbmtoepsi works. Thanks to Ed Vigmond + for the suggestion. + -----------------------> tgif-4.1.32 => tgif-4.1.33 <----------------------- 1) Fix a bug that was introduced in tgif-4.1.30 (see item 3 of *** xbm/jpeg.xbm.orig Sat May 20 18:53:36 2000 --- xbm/jpeg.xbm Sat May 20 18:53:36 2000 *************** *** 0 **** --- 1,15 ---- + /* + * @(#)$Header: /mm/src/tgif/v4/xbm/RCS/jpeg.xbm,v 4.0 2000/05/10 17:28:30 william Exp $ + */ + #define jpeg_width 32 + #define jpeg_height 20 + #define jpeg_x_hot 0 + #define jpeg_y_hot 0 + static unsigned char jpeg_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x7f, 0x00, 0x20, 0x00, 0xc0, 0x00, + 0x20, 0x00, 0x40, 0x01, 0x20, 0x00, 0x40, 0x02, 0x20, 0x00, 0x40, 0x04, + 0x20, 0x00, 0xc0, 0x0f, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, + 0x20, 0x77, 0x9e, 0x09, 0x20, 0x92, 0x42, 0x0a, 0x20, 0x92, 0x42, 0x08, + 0x20, 0x72, 0x4e, 0x0b, 0x20, 0x12, 0x42, 0x0a, 0xa0, 0x12, 0x42, 0x0a, + 0x20, 0x11, 0x9e, 0x09, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, + 0xe0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00}; *** tgif.Xdefaults.orig Sat May 20 18:53:36 2000 --- tgif.Xdefaults Sat May 20 18:53:36 2000 *************** *** 464,465 **** --- 464,472 ---- ! !Tgif.AutoWrapMenubar: false + ! + ! Added in version 4.1.34 + ! + !Tgif.XpmToJpeg: xpmtoppm %s | cjpeg + !Tgif.JpegFileExtension: jpg + !Tgif.AutoEPSPreviewBitmap: false + !Tgif.PsToXbm: gs -q -dNOPAUSE -sDEVICE=pbm -sOutputFile=- -- "%s" | pbmtoxbm