*** align.c.orig Sun May 12 04:20:50 1996 --- align.c Sun May 12 04:20:51 1996 *************** *** 30,34 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/align.c,v 3.0 1996/05/06 16:03:27 william Exp $"; #endif --- 30,34 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/align.c,v 3.1 1996/05/12 05:17:25 william Exp $"; #endif *************** *** 1415,1419 **** struct ObjRec *other_obj, *poly_obj; IntPoint *v; ! int cx, cy, x1, y1, xn, yn, d1, dn, num_pts, index; if (curChoice != NOTHING) return; --- 1415,1419 ---- struct ObjRec *other_obj, *poly_obj; IntPoint *v; ! int cx, cy, x1, y1, xn, yn, d1, dn, num_pts, index, x, y, tmp_x, tmp_y; if (curChoice != NOTHING) return; *************** *** 1442,1453 **** num_pts = poly_obj->detail.p->n; v = poly_obj->detail.p->vlist; ! x1 = v[0].x; ! y1 = v[0].y; ! xn = v[num_pts-1].x; ! yn = v[num_pts-1].y; d1 = (x1-cx)*(x1-cx)+(y1-cy)*(y1-cy); dn = (xn-cx)*(xn-cx)+(yn-cy)*(yn-cy); ! index = (d1 <= dn) ? 0 : num_pts-1; ! if (cx != v[index].x || cy != v[index].y) { int ltx=0, lty=0, rbx=0, rby=0; --- 1442,1472 ---- num_pts = poly_obj->detail.p->n; v = poly_obj->detail.p->vlist; ! if (poly_obj->ctm == NULL) { ! x1 = v[0].x; ! y1 = v[0].y; ! xn = v[num_pts-1].x; ! yn = v[num_pts-1].y; ! } else { ! TransformPointThroughCTM(v[0].x-poly_obj->x, v[0].y-poly_obj->y, ! poly_obj->ctm, &tmp_x, &tmp_y); ! x1 = tmp_x+poly_obj->x; ! y1 = tmp_y+poly_obj->y; ! TransformPointThroughCTM(v[num_pts-1].x-poly_obj->x, ! v[num_pts-1].y-poly_obj->y, poly_obj->ctm, &tmp_x, &tmp_y); ! xn = tmp_x+poly_obj->x; ! yn = tmp_y+poly_obj->y; ! } d1 = (x1-cx)*(x1-cx)+(y1-cy)*(y1-cy); dn = (xn-cx)*(xn-cx)+(yn-cy)*(yn-cy); ! if (d1 <= dn) { ! index = 0; ! x = x1; ! y = y1; ! } else { ! index = num_pts-1; ! x = xn; ! y = yn; ! } ! if (cx != x || cy != y) { int ltx=0, lty=0, rbx=0, rby=0; *************** *** 1454,1459 **** HighLightReverse(); PrepareToReplaceAnObj(poly_obj); ! v[index].x = cx; ! v[index].y = cy; AdjObjSplineVs(poly_obj); if (poly_obj->detail.p->curved != LT_INTSPLINE) { --- 1473,1485 ---- HighLightReverse(); PrepareToReplaceAnObj(poly_obj); ! if (poly_obj->ctm == NULL) { ! v[index].x = cx; ! v[index].y = cy; ! } else { ! ReverseTransformPointThroughCTM(cx-poly_obj->x, cy-poly_obj->y, ! poly_obj->ctm, &tmp_x, &tmp_y); ! v[index].x = tmp_x+poly_obj->x; ! v[index].y = tmp_y+poly_obj->y; ! } AdjObjSplineVs(poly_obj); if (poly_obj->detail.p->curved != LT_INTSPLINE) { *** edit.c.orig Sun May 12 04:20:56 1996 --- edit.c Sun May 12 04:20:57 1996 *************** *** 30,34 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/edit.c,v 3.0 1996/05/06 16:04:43 william Exp $"; #endif --- 30,34 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/edit.c,v 3.1 1996/05/12 05:17:27 william Exp $"; #endif *************** *** 2967,2970 **** --- 2967,3020 ---- } HighLightForward(); + } + + void RotateAllSelObj(angle_spec) + double angle_spec; + { + int arc_count=0, pivot_x=0, pivot_y=0, ltx, lty, rbx, rby; + struct SelRec *sel_ptr; + struct ObjRec *arc_obj=NULL; + + if (curChoice != NOTHING || topSel == NULL) { + MsgBox("No objects selected.", TOOL_NAME, INFO_MB); + return; + } + for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { + if (sel_ptr->obj->type == OBJ_ARC) { + arc_obj = sel_ptr->obj; + arc_count++; + } + } + if (arc_count == 1) { + if (arc_obj->ctm == NULL) { + pivot_x = arc_obj->detail.a->xc; + pivot_y = arc_obj->detail.a->yc; + } else { + struct ArcRec *arc_ptr=arc_obj->detail.a; + int x, y; + + TransformPointThroughCTM(arc_ptr->xc-arc_obj->x, + arc_ptr->yc-arc_obj->y, arc_obj->ctm, &x, &y); + pivot_x = x + arc_obj->x; + pivot_y = y + arc_obj->y; + } + } else { + pivot_x = (selObjLtX+selObjRbX)>>1; + pivot_y = (selObjLtY+selObjRbY)>>1; + } + if (fabs(angle_spec) < (1.0e-5)) return; + + ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY; + HighLightReverse(); + PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); + FinishPreciseRotate(angle_spec, pivot_x, pivot_y); + RecordCmd(CMD_REPLACE, NULL, topSel, botSel, numObjSelected); + UpdSelBBox(); + RedrawAreas(botObj, ltx-GRID_ABS_SIZE(1), lty-GRID_ABS_SIZE(1), + rbx+GRID_ABS_SIZE(1), rby+GRID_ABS_SIZE(1), + selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), + selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); + SetFileModified(TRUE); + justDupped = FALSE; } *** exec.c.orig Sun May 12 04:21:04 1996 --- exec.c Sun May 12 04:21:05 1996 *************** *** 30,34 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/exec.c,v 3.0 1996/05/06 16:04:54 william Exp $"; #endif --- 30,34 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/exec.c,v 3.1 1996/05/12 05:17:32 william Exp $"; #endif *************** *** 64,67 **** --- 64,68 ---- #include "drawing.e" #include "dup.e" + #include "edit.e" #include "eps.e" #ifndef _NO_EXTERN *************** *** 232,235 **** --- 233,237 ---- void ExecSetFileNotModified ARGS_DECL((void)); int ExecNewId ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecRotateSelObj ARGS_DECL((char**, struct ObjRec *, char*)); static *************** *** 311,314 **** --- 313,317 ---- { (void*)ExecSetFileNotModified, "set_file_not_modified", 0, 0}, { (void*)ExecNewId, "new_id", 1, 0}, + { (void*)ExecRotateSelObj, "rotate_selected_obj", 1, 0}, { NULL, NULL, 0, 0 } }; *************** *** 4429,4432 **** --- 4432,4466 ---- sprintf(buf, "%1d", objId++); ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, buf); + return TRUE; + } + + int ExecRotateSelObj(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* rotate_selected_obj(angle); */ + { + char *expr=argv[0]; + struct VRec v; + double d_val=(double)0.0; + + UtilRemoveQuotes(expr); + if (topSel == NULL) return BadSelectedObj(orig_cmd); + + if (!EvalExpr(expr, &v)) return FALSE; + + switch (v.vtype) { + case INT_VAL: d_val = (double)v.val.i; break; + case DBL_VAL: d_val = (double)v.val.d; break; + case NULL_VAL: + case STR_VAL: + sprintf(gszMsgBox, "%s '%s' %s '%s' %s.", + "Invalid evaluation", expr, + "(numeric value expected) when executing the", + orig_cmd, "command"); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + if (v.vtype == STR_VAL && v.val.s != NULL) free(v.val.s); + return FALSE; + } + RotateAllSelObj(d_val); return TRUE; } *** font.c.orig Sun May 12 04:21:11 1996 --- font.c Sun May 12 04:21:12 1996 *************** *** 30,34 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/font.c,v 3.0 1996/05/06 16:05:09 william Exp $"; #endif --- 30,34 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/font.c,v 3.1 1996/05/12 08:08:26 william Exp $"; #endif *************** *** 1390,1393 **** --- 1390,1415 ---- } + static + int AdjTransformedTextBBox(ObjPtr) + struct ObjRec *ObjPtr; + /* a transformed text object has just changed it's font */ + /* property, so its bounding box needs to be adjusted */ + /* a transformed text object has just changed it's font */ + { + struct XfrmMtrxRec *ctm=ObjPtr->ctm; + + if (ctm == NULL) return UpdTextBBox(ObjPtr); + ObjPtr->ctm = NULL; + if (!UpdTextBBox(ObjPtr)) { + ObjPtr->ctm = ctm; + return FALSE; + } + SetCTM(ObjPtr, ctm); + UpdTextBBox(ObjPtr); + AdjObjSplineVs(ObjPtr); + AdjObjBBox(ObjPtr); + return TRUE; + } + int ChangeObjTextStyle(ObjPtr, StyleIndex) register struct ObjRec *ObjPtr; *************** *** 1401,1405 **** if (ObjPtr->detail.t->style != StyleIndex) { ObjPtr->detail.t->style = StyleIndex; ! if (UpdTextBBox(ObjPtr) == FALSE) { Msg("Invalid vertical spacing for a text object."); Msg(" That object's vertical spacing reset to 0."); --- 1423,1427 ---- if (ObjPtr->detail.t->style != StyleIndex) { ObjPtr->detail.t->style = StyleIndex; ! if (AdjTransformedTextBBox(ObjPtr) == FALSE) { Msg("Invalid vertical spacing for a text object."); Msg(" That object's vertical spacing reset to 0."); *************** *** 1647,1651 **** ObjPtr->detail.t->read_only = FALSE; changingFontSizeFromRead = FALSE; ! rc = UpdTextBBox(ObjPtr); changingFontSizeFromRead = TRUE; switch (rc) { --- 1669,1673 ---- ObjPtr->detail.t->read_only = FALSE; changingFontSizeFromRead = FALSE; ! rc = AdjTransformedTextBBox(ObjPtr); changingFontSizeFromRead = TRUE; switch (rc) { *************** *** 1832,1836 **** ObjPtr->detail.t->font = FontIndex; changingFontSizeFromRead = FALSE; ! rc = UpdTextBBox(ObjPtr); changingFontSizeFromRead = TRUE; switch (rc) { --- 1854,1858 ---- ObjPtr->detail.t->font = FontIndex; changingFontSizeFromRead = FALSE; ! rc = AdjTransformedTextBBox(ObjPtr); changingFontSizeFromRead = TRUE; switch (rc) { *************** *** 1985,1989 **** saved_v_space = ObjPtr->detail.t->v_space; ObjPtr->detail.t->v_space = VSpace; ! if (UpdTextBBox(ObjPtr) == FALSE) { Msg("Invalid vertical spacing for a text object."); Msg("Vertical spacing for that object not changed."); --- 2007,2011 ---- saved_v_space = ObjPtr->detail.t->v_space; ObjPtr->detail.t->v_space = VSpace; ! if (AdjTransformedTextBBox(ObjPtr) == FALSE) { Msg("Invalid vertical spacing for a text object."); Msg("Vertical spacing for that object not changed."); *** import.c.orig Sun May 12 04:21:16 1996 --- import.c Sun May 12 04:21:17 1996 *************** *** 30,34 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/import.c,v 3.0 1996/05/06 16:05:40 william Exp $"; #endif --- 30,34 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/import.c,v 3.1 1996/05/12 05:17:23 william Exp $"; #endif *************** *** 752,756 **** void ImportGIFFile() { ! char file_name[MAXPATHLENGTH+1], szBuf[MAXPATHLENGTH+1], *rest; char szGifPath[MAXPATHLENGTH+1]; int rc, ncolors, chars_per_pixel, *pixels, short_name; --- 752,756 ---- void ImportGIFFile() { ! char file_name[MAXPATHLENGTH+1], *rest; char szGifPath[MAXPATHLENGTH+1]; int rc, ncolors, chars_per_pixel, *pixels, short_name; *************** *** 806,815 **** if ((short_name=IsPrefix(bootDir, szGifPath, &rest))) ++rest; if (rc != BitmapSuccess) { ! if (short_name) { ! sprintf(szBuf, "Cannot import GIF file '%s'.", rest); ! } else { ! sprintf(szBuf, "Cannot import GIF file '%s'.", szGifPath); ! } ! MsgBox(szBuf, TOOL_NAME, INFO_MB); importingFile = FALSE; unlink(file_name); --- 806,812 ---- if ((short_name=IsPrefix(bootDir, szGifPath, &rest))) ++rest; if (rc != BitmapSuccess) { ! sprintf(gszMsgBox, "Cannot import GIFs file '%s'.", ! (short_name ? rest : szGifPath)); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); importingFile = FALSE; unlink(file_name); *************** *** 833,843 **** if (short_name) { ! sprintf(szBuf, "GIF file (%1dx%1d) '%s' imported.", image_w, image_h, rest); } else { ! sprintf(szBuf, "GIF file (%1dx%1d) '%s' imported.", image_w, image_h, szGifPath); } ! Msg(szBuf); importingFile = FALSE; } --- 830,840 ---- if (short_name) { ! sprintf(gszMsgBox, "GIF file (%1dx%1d) '%s' imported.", image_w, image_h, rest); } else { ! sprintf(gszMsgBox, "GIF file (%1dx%1d) '%s' imported.", image_w, image_h, szGifPath); } ! Msg(gszMsgBox); importingFile = FALSE; } *************** *** 1047,1052 **** if ((short_name=IsPrefix(bootDir, szOtherPath, &rest))) ++rest; if (rc != BitmapSuccess) { ! sprintf(gszMsgBox, "Cannot import GIF file '%s'.", ! (short_name ? rest : szOtherPath)); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); importingFile = FALSE; --- 1044,1049 ---- if ((short_name=IsPrefix(bootDir, szOtherPath, &rest))) ++rest; if (rc != BitmapSuccess) { ! sprintf(gszMsgBox, "Cannot import %s file '%s'.", ! pii->name, (short_name ? rest : szOtherPath)); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); importingFile = FALSE; *************** *** 1465,1470 **** if ((short_name=IsPrefix(bootDir, szOtherPath, &rest))) ++rest; if (rc != BitmapSuccess) { ! sprintf(gszMsgBox, "Cannot import GIF file '%s'.", ! (short_name ? rest : szOtherPath)); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); importingFile = FALSE; --- 1462,1467 ---- if ((short_name=IsPrefix(bootDir, szOtherPath, &rest))) ++rest; if (rc != BitmapSuccess) { ! sprintf(gszMsgBox, "Cannot import %s file '%s'.", ! pii->name, (short_name ? rest : szOtherPath)); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); importingFile = FALSE; *** obj.c.orig Sun May 12 04:21:21 1996 --- obj.c Sun May 12 04:21:22 1996 *************** *** 30,34 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/obj.c,v 3.0 1996/05/06 16:06:24 william Exp $"; #endif --- 30,34 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/obj.c,v 3.1 1996/05/12 05:17:21 william Exp $"; #endif *************** *** 717,721 **** case OBJ_XPM: break; case OBJ_OVAL: InvalidateObjCache(ObjPtr); break; ! case OBJ_TEXT: InvalidateObjCache(ObjPtr); break; case OBJ_RCBOX: InvalidateObjCache(ObjPtr); break; case OBJ_ARC: InvalidateObjCache(ObjPtr); AdjArcCache(ObjPtr); break; --- 717,721 ---- case OBJ_XPM: break; case OBJ_OVAL: InvalidateObjCache(ObjPtr); break; ! case OBJ_TEXT: break; case OBJ_RCBOX: InvalidateObjCache(ObjPtr); break; case OBJ_ARC: InvalidateObjCache(ObjPtr); AdjArcCache(ObjPtr); break; *** stretch.c.orig Sun May 12 04:21:27 1996 --- stretch.c Sun May 12 04:21:28 1996 *************** *** 30,34 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/stretch.c,v 3.0 1996/05/06 16:12:00 william Exp $"; #endif --- 30,34 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/stretch.c,v 3.1 1996/05/12 08:08:26 william Exp $"; #endif *************** *** 3244,3247 **** --- 3244,3257 ---- static + void FormatAngleForRotate(buf, angle) + char *buf; + int angle; + { + float fval=(float)(((float)angle)/((float)64.0)); + + sprintf(buf, "degree=%.2f", fval); + } + + static void RotateSel (XGridOff, YGridOff, ObjPtr, Corner) int XGridOff, YGridOff, Corner; *************** *** 3381,3385 **** grid_x = moveX; grid_y = moveY; ! sprintf (buf, "degree=0"); StartShowMeasureCursor (grid_x, grid_y, buf, TRUE); XGrabPointer (mainDisplay, drawWindow, False, --- 3391,3395 ---- grid_x = moveX; grid_y = moveY; ! FormatAngleForRotate(buf, 0); StartShowMeasureCursor (grid_x, grid_y, buf, TRUE); XGrabPointer (mainDisplay, drawWindow, False, *************** *** 3400,3404 **** XSync (mainDisplay, False); rotating = FALSE; ! sprintf (buf, "degree=%1d", abs(d_angle>>6)); EndShowMeasureCursor (grid_x, grid_y, buf, TRUE); if (ObjPtr->type==OBJ_POLY || ObjPtr->type==OBJ_POLYGON) --- 3410,3414 ---- XSync (mainDisplay, False); rotating = FALSE; ! FormatAngleForRotate(buf, d_angle); EndShowMeasureCursor (grid_x, grid_y, buf, TRUE); if (ObjPtr->type==OBJ_POLY || ObjPtr->type==OBJ_POLYGON) *************** *** 3413,3417 **** else if (input.type == MotionNotify) { ! sprintf (buf, "degree=%1d", abs(d_angle>>6)); ShowMeasureCursor (grid_x, grid_y, buf, TRUE); if (ObjPtr->type==OBJ_POLY || ObjPtr->type==OBJ_POLYGON) --- 3423,3427 ---- else if (input.type == MotionNotify) { ! FormatAngleForRotate(buf, d_angle); ShowMeasureCursor (grid_x, grid_y, buf, TRUE); if (ObjPtr->type==OBJ_POLY || ObjPtr->type==OBJ_POLYGON) *************** *** 3455,3459 **** CoordModeOrigin); } ! sprintf (buf, "degree=%1d", abs(d_angle>>6)); ShowMeasureCursor (grid_x, grid_y, buf, TRUE); while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &ev)) ; --- 3465,3469 ---- CoordModeOrigin); } ! FormatAngleForRotate(buf, d_angle); ShowMeasureCursor (grid_x, grid_y, buf, TRUE); while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &ev)) ; *** xbitmap.c.orig Sun May 12 04:21:34 1996 --- xbitmap.c Sun May 12 04:21:35 1996 *************** *** 30,34 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/xbitmap.c,v 3.1 1996/05/10 06:33:36 william Exp $"; #endif --- 30,34 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/xbitmap.c,v 3.2 1996/05/12 08:08:26 william Exp $"; #endif *************** *** 3174,3177 **** --- 3174,3290 ---- #define GETVALUE(val,name) ScanValue("%d", &(val), name, "xbitmap") + static + int ReadTransformAndAdjustForXBm(FP, ObjPtr, xbm_ptr, transformed, rotate, flip) + FILE *FP; + struct ObjRec **ObjPtr; + struct XBmRec *xbm_ptr; + int transformed, rotate, flip; + { + if (fileVersion >= 33 && transformed) + { + char inbuf[MAXSTRING]; + struct XfrmMtrxRec *ctm=NULL; + int real_x=0, real_y=0; + struct BBRec orig_obbox; + + fgets(inbuf, MAXSTRING, FP); + scanLineNum++; + InitScan(inbuf, "\t\n, "); + + ctm = (struct XfrmMtrxRec *)malloc(sizeof(struct XfrmMtrxRec)); + if (ctm == NULL) FailAllocMessage(); + if (GETVALUE(real_x, "real_x") == INVALID || + GETVALUE(real_y, "real_y") == INVALID || + GETVALUE(orig_obbox.ltx, "orig_obbox.ltx") == INVALID || + GETVALUE(orig_obbox.lty, "orig_obbox.lty") == INVALID || + GETVALUE(orig_obbox.rbx, "orig_obbox.rbx") == INVALID || + GETVALUE(orig_obbox.rby, "orig_obbox.rby") == INVALID || + GETVALUE(ctm->m[CTM_SX], "CTM_SX") == INVALID || + GETVALUE(ctm->m[CTM_SIN], "CTM_SIN") == INVALID || + GETVALUE(ctm->m[CTM_MSIN], "CTM_MSIN") == INVALID || + GETVALUE(ctm->m[CTM_SY], "CTM_SY") == INVALID || + GETVALUE(ctm->m[CTM_TX], "CTM_TX") == INVALID || + GETVALUE(ctm->m[CTM_TY], "CTM_TY") == INVALID) { + return; + } + (*ObjPtr)->ctm = ctm; + if (ctm != NULL) { + memcpy(&(*ObjPtr)->orig_obbox, &orig_obbox, sizeof(struct BBRec)); + (*ObjPtr)->x = real_x; + (*ObjPtr)->y = real_y; + GetTransformedOBBoxOffsetVs(*ObjPtr, (*ObjPtr)->rotated_obbox); + } + } + if (fileVersion < 33 && (rotate != ROTATE0 || flip != NO_FLIP)) { + int ltx, lty; + + if (rotate == ROTATE90 || rotate == ROTATE270) { + int h=(*ObjPtr)->obbox.rbx-(*ObjPtr)->obbox.ltx; + int w=(*ObjPtr)->obbox.rby-(*ObjPtr)->obbox.lty; + + (*ObjPtr)->obbox.rby = (*ObjPtr)->obbox.lty + h; + (*ObjPtr)->obbox.rbx = (*ObjPtr)->obbox.ltx + w; + } + ltx = ((*ObjPtr)->obbox.ltx); + lty = ((*ObjPtr)->obbox.lty); + SetRotatePivotByObject(*ObjPtr); + + if (flip & HORI_EVEN) { + ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); + } + if (flip & VERT_EVEN) { + ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); + } + if (rotate == ROTATE0) { + if (flip & (HORI_ODD | VERT_ODD)) { + RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); + if (flip & HORI_ODD) { + ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); + } + if (flip & VERT_ODD) { + ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); + } + RotateObj(*ObjPtr, CORNER_LT, COUNTER90, <x, <y); + } + } else { + switch (rotate) { + case ROTATE90: + RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); + if (flip & HORI_ODD) { + ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); + } + if (flip & VERT_ODD) { + ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); + } + break; + case ROTATE180: + RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); + if (flip & HORI_ODD) { + ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); + } + if (flip & VERT_ODD) { + ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); + } + RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); + break; + case ROTATE270: + RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); + if (flip & HORI_ODD) { + ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); + } + if (flip & VERT_ODD) { + ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); + } + RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); + RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); + break; + } + } + xbm_ptr->rotate = ROTATE0; + xbm_ptr->flip = NO_FLIP; + } + return TRUE; + } + void ReadXBmObj (FP, Inbuf, ObjPtr) FILE * FP; *************** *** 3187,3191 **** int no_bitmap=FALSE, llx=0, lly=0, urx=0, ury=0; int locked=FALSE, save_epsf=FALSE, compressed=FALSE; ! int num_epsf_lines=0, real_x=0, real_y=0; int transformed=FALSE, invisible=FALSE; Pixmap bitmap; --- 3300,3304 ---- int no_bitmap=FALSE, llx=0, lly=0, urx=0, ury=0; int locked=FALSE, save_epsf=FALSE, compressed=FALSE; ! int num_epsf_lines=0, transform_read=FALSE; int transformed=FALSE, invisible=FALSE; Pixmap bitmap; *************** *** 3193,3198 **** char * xbm_data, write_date[32], * filename; XImage * image; - struct XfrmMtrxRec *ctm=NULL; - struct BBRec orig_obbox; *ObjPtr = NULL; --- 3306,3309 ---- *************** *** 3558,3561 **** --- 3669,3677 ---- if (!PRTGIF) { + transform_read = TRUE; + if (!ReadTransformAndAdjustForXBm(FP, ObjPtr, xbm_ptr, transformed, + rotate, flip)) { + return; + } if (MyReadEPSFile(xbm_ptr->filename, &image_w, &image_h, &(xbm_ptr->bitmap), &(xbm_ptr->image), *************** *** 3641,3739 **** } } ! if (fileVersion >= 33 && transformed) ! { ! fgets(inbuf, MAXSTRING, FP); ! scanLineNum++; ! InitScan(inbuf, "\t\n, "); ! ! ctm = (struct XfrmMtrxRec *)malloc(sizeof(struct XfrmMtrxRec)); ! if (ctm == NULL) FailAllocMessage(); ! if (GETVALUE(real_x, "real_x") == INVALID || ! GETVALUE(real_y, "real_y") == INVALID || ! GETVALUE(orig_obbox.ltx, "orig_obbox.ltx") == INVALID || ! GETVALUE(orig_obbox.lty, "orig_obbox.lty") == INVALID || ! GETVALUE(orig_obbox.rbx, "orig_obbox.rbx") == INVALID || ! GETVALUE(orig_obbox.rby, "orig_obbox.rby") == INVALID || ! GETVALUE(ctm->m[CTM_SX], "CTM_SX") == INVALID || ! GETVALUE(ctm->m[CTM_SIN], "CTM_SIN") == INVALID || ! GETVALUE(ctm->m[CTM_MSIN], "CTM_MSIN") == INVALID || ! GETVALUE(ctm->m[CTM_SY], "CTM_SY") == INVALID || ! GETVALUE(ctm->m[CTM_TX], "CTM_TX") == INVALID || ! GETVALUE(ctm->m[CTM_TY], "CTM_TY") == INVALID) { ! return; ! } ! (*ObjPtr)->ctm = ctm; ! if (ctm != NULL) { ! memcpy(&(*ObjPtr)->orig_obbox, &orig_obbox, sizeof(struct BBRec)); ! (*ObjPtr)->x = real_x; ! (*ObjPtr)->y = real_y; ! GetTransformedOBBoxOffsetVs(*ObjPtr, (*ObjPtr)->rotated_obbox); ! } ! } ! if (fileVersion < 33 && (rotate != ROTATE0 || flip != NO_FLIP)) { ! if (rotate == ROTATE90 || rotate == ROTATE270) { ! int h=(*ObjPtr)->obbox.rbx-(*ObjPtr)->obbox.ltx; ! int w=(*ObjPtr)->obbox.rby-(*ObjPtr)->obbox.lty; ! ! (*ObjPtr)->obbox.rby = (*ObjPtr)->obbox.lty + h; ! (*ObjPtr)->obbox.rbx = (*ObjPtr)->obbox.ltx + w; ! } ! ltx = ((*ObjPtr)->obbox.ltx); ! lty = ((*ObjPtr)->obbox.lty); ! SetRotatePivotByObject(*ObjPtr); ! ! if (flip & HORI_EVEN) { ! ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); ! } ! if (flip & VERT_EVEN) { ! ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); ! } ! if (rotate == ROTATE0) { ! if (flip & (HORI_ODD | VERT_ODD)) { ! RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); ! if (flip & HORI_ODD) { ! ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); ! } ! if (flip & VERT_ODD) { ! ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); ! } ! RotateObj(*ObjPtr, CORNER_LT, COUNTER90, <x, <y); ! } ! } else { ! switch (rotate) { ! case ROTATE90: ! RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); ! if (flip & HORI_ODD) { ! ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); ! } ! if (flip & VERT_ODD) { ! ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); ! } ! break; ! case ROTATE180: ! RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); ! if (flip & HORI_ODD) { ! ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); ! } ! if (flip & VERT_ODD) { ! ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); ! } ! RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); ! break; ! case ROTATE270: ! RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); ! if (flip & HORI_ODD) { ! ShearObj(*ObjPtr, CORNER_LEFT, 0, 0, -1000, 1000, <x, <y); ! } ! if (flip & VERT_ODD) { ! ShearObj(*ObjPtr, CORNER_TOP, 0, 0, 1000, -1000, <x, <y); ! } ! RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); ! RotateObj(*ObjPtr, CORNER_LT, CLOCKWISE90, <x, <y); ! break; ! } ! } ! xbm_ptr->rotate = ROTATE0; ! xbm_ptr->flip = NO_FLIP; } if (xbm_ptr->rotate != ROTATE0) { --- 3757,3763 ---- } } ! if (!transform_read && !ReadTransformAndAdjustForXBm(FP, ObjPtr, xbm_ptr, ! transformed, rotate, flip)) { ! return; } if (xbm_ptr->rotate != ROTATE0) { *** edit.e.orig Sun May 12 04:21:40 1996 --- edit.e Sun May 12 04:21:41 1996 *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/edit.e,v 3.0 1996/05/06 16:04:46 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/edit.e,v 3.1 1996/05/12 05:17:30 william Exp $ */ *************** *** 49,52 **** --- 49,53 ---- extern void LayoutOnArc ARGS_DECL((void)); extern void PreciseRotate ARGS_DECL((void)); + extern void RotateAllSelObj ARGS_DECL((double degrees)); extern void GetBoundingBox ARGS_DECL((void)); extern void EditSubMenu ARGS_DECL((int Index)); *** patchlvl.h.orig Sun May 12 04:21:44 1996 --- patchlvl.h Sun May 12 04:21:44 1996 *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/patchlvl.h,v 3.2 1996/05/11 05:40:40 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/patchlvl.h,v 3.3 1996/05/12 05:17:19 william Exp $ */ *************** *** 34,38 **** #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 2 #endif /*_TGIF_PATCHLEVEL_H_*/ --- 34,38 ---- #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 3 #endif /*_TGIF_PATCHLEVEL_H_*/ *** Imakefile.orig Sun May 12 04:21:48 1996 --- Imakefile Sun May 12 04:21:49 1996 *************** *** 36,40 **** XCOMM PERFORMANCE OF THIS SOFTWARE. XCOMM ! XCOMM @(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/Imakefile,v 3.2 1996/05/11 05:40:24 william Exp $ XCOMM --- 36,40 ---- XCOMM PERFORMANCE OF THIS SOFTWARE. XCOMM ! XCOMM @(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/Imakefile,v 3.3 1996/05/12 05:17:18 william Exp $ XCOMM *************** *** 45,49 **** XCOMM EXTRA_LDOPTIONS = ! TGIFVERSION = 3.0-p2 PROGRAMS = tgif prtgif XCOMM frontend11.o testdrive XCOMM CDEBUGFLAGS= -g --- 45,49 ---- XCOMM EXTRA_LDOPTIONS = ! TGIFVERSION = 3.0-p3 PROGRAMS = tgif prtgif XCOMM frontend11.o testdrive XCOMM CDEBUGFLAGS= -g *** HISTORY.orig Sun May 12 04:21:52 1996 --- HISTORY Sun May 12 04:21:53 1996 *************** *** 1,5 **** /* ! * @(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/HISTORY,v 3.2 1996/05/11 05:42:27 william Exp $ */ -----------------------> tgif-3.0-p1 => tgif-3.0-p2 <----------------------- I've just put tgif-3.0-patch2 (2nd patch for tgif-3.0) in --- 1,49 ---- /* ! * @(#)$Header: /n/opus/u/guest/william/src/tgif/v3/RCS/HISTORY,v 3.4 1996/05/12 08:15:33 william Exp $ */ + -----------------------> tgif-3.0-p2 => tgif-3.0-p3 <----------------------- + I've just put tgif-3.0-patch3 (3rd patch for tgif-3.0) in + the following places for anonymous ftp (binaries are still not + available at the time of this release, please check + for availability): + + ftp://ftp.x.org/contrib/applications/tgif/tgif-3.0-patch3.gz + ftp://ftp.cs.ucla.edu/pub/tgif/tgif-3.0-patch3.gz + ftp://bourbon.cs.ucla.edu/pub/tgif-3.0-patch3.gz + + Tgif is an Xlib-based 2-D drawing tool. It's also a hyper-graphics (or + hyper-structured-graphics) browser on the World-Wide-Web. Its hyper-text home + page is at and its hyper-graphics + home page is at . + (Please note that the Content-type of a tgif file sent by the httpd at + bourbon.cs.ucla.edu:8001 is applications/x-tgif.) + + Tgif is free, but please read the Copyright file in the distribution + (or select Copyright from the Help Menu in tgif) for restrictions. + + (Pelase note that tgif is NEITHER an html viewer NOR an html editor. + It is also NOT directly related to GIF nor Transparent GIF.) + + Please gunzip and then apply the patch with + 'patch -p -N < tgif-3.0-patch3'. + Here's a short list of added features/bug fixes. + + 1) Fix bugs with change font properties of transformed text. Thanks to + Kyle Bateman for pointing out the problems. + 2) Getting rid of uncessary redraws on transformed text when scrolling. + 3) Make CenterAnEndPoint() work for rotated polyline objects. + 4) Add a new internal command: rotate_selected_obj(). + With this command, the following code will keep rotating an object + named "toy" forever (until is entered): + + exec=disable_undo(); + begin_animate(); + select_obj_by_name(toy); + while(1,do_it); + unselect_all_obj(); + end_animate(); + enable_undo(); + + do_it=rotate_selected_obj(10); -----------------------> tgif-3.0-p1 => tgif-3.0-p2 <----------------------- I've just put tgif-3.0-patch2 (2nd patch for tgif-3.0) in