*** align.c.orig Tue Sep 30 13:22:37 1997 --- align.c Tue Sep 30 13:22:37 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/align.c,v 3.4 1996/10/30 18:23:30 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/align.c,v 3.5 1997/09/14 20:37:48 william Exp $ */ #include *** animate.c.orig Tue Sep 30 13:22:39 1997 --- animate.c Tue Sep 30 13:22:39 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/animate.c,v 3.0 1996/05/06 16:03:36 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/animate.c,v 3.1 1997/09/14 20:37:48 william Exp $ */ #include *** arc.c.orig Tue Sep 30 13:22:40 1997 --- arc.c Tue Sep 30 13:22:40 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/arc.c,v 3.10 1997/01/30 19:24:51 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/arc.c,v 3.11 1997/09/14 20:37:48 william Exp $ */ #include *** attr.c.orig Tue Sep 30 13:22:42 1997 --- attr.c Tue Sep 30 13:22:42 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/attr.c,v 3.3 1996/10/28 00:03:47 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/attr.c,v 3.8 1997/09/17 05:54:07 william Exp $ */ #include *************** *** 408,470 **** } ! void AddAttrs () { ! struct ObjRec * owner_ptr = NULL; ! struct SelRec * sel_ptr; ! int text_count=0, sel_ltx, sel_lty, sel_rbx, sel_rby; ! int locked_text_count=0; ! if (topSel == NULL) ! { ! MsgBox ("Must select at least one text object.", TOOL_NAME, INFO_MB); return; } ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! switch (sel_ptr->obj->type) ! { ! case OBJ_TEXT: text_count++; break; ! ! case OBJ_BOX: ! case OBJ_OVAL: ! case OBJ_POLYGON: ! case OBJ_POLY: ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! case OBJ_ARC: ! case OBJ_RCBOX: ! case OBJ_XBM: ! case OBJ_XPM: ! if (owner_ptr != NULL) ! { ! Msg("Two non-text objects selected."); ! return; ! } ! owner_ptr = sel_ptr->obj; ! break; } ! ! if (text_count == 0) ! { ! MsgBox ("No text objects selected to add as attributes.", TOOL_NAME, INFO_MB); return; } ! if (owner_ptr == NULL) ! { ! MsgBox ("No objects (other than TEXT objects) selected.", TOOL_NAME, INFO_MB); return; } ! HighLightReverse (); ! PrepareToRecord (CMD_REPLACE, topSel, botSel, numObjSelected); sel_ltx = selLtX; sel_lty = selLtY; sel_rbx = selRbX; sel_rby = selRbY; ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) ! if (sel_ptr->obj->type == OBJ_TEXT) ! { ! if (sel_ptr->obj->locked) ! { locked_text_count++; sel_ptr->obj->locked = FALSE; --- 406,452 ---- } ! void AddAttrs() { ! struct ObjRec *owner_ptr=NULL; ! struct SelRec *sel_ptr; ! int text_count=0, sel_ltx, sel_lty, sel_rbx, sel_rby; ! int locked_text_count=0; ! if (topSel == NULL) { ! MsgBox("Must select at least one text object.", TOOL_NAME, INFO_MB); return; } ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! switch (sel_ptr->obj->type) { ! case OBJ_TEXT: text_count++; break; ! ! default: ! if (owner_ptr != NULL) { ! Msg("Two non-text objects selected."); ! return; ! } ! owner_ptr = sel_ptr->obj; ! break; } ! } ! ! if (text_count == 0) { ! MsgBox("No text objects selected to add as attributes.", TOOL_NAME, INFO_MB); return; } ! if (owner_ptr == NULL) { ! MsgBox("No objects (other than TEXT objects) selected.", TOOL_NAME, INFO_MB); return; } ! HighLightReverse(); ! PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); sel_ltx = selLtX; sel_lty = selLtY; sel_rbx = selRbX; sel_rby = selRbY; ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { ! if (sel_ptr->obj->type == OBJ_TEXT) { ! if (sel_ptr->obj->locked) { locked_text_count++; sel_ptr->obj->locked = FALSE; *************** *** 472,498 **** AddAttr(owner_ptr, sel_ptr->obj); } ! RemoveAllSel (); ! UnlinkObj (owner_ptr); ! AddObj (NULL, topObj, owner_ptr); topSel = botSel = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (topSel == NULL) FailAllocMessage (); topSel->obj = owner_ptr; topSel->prev = NULL; botSel->next = NULL; ! AdjObjBBox (owner_ptr); ! UpdSelBBox (); ! RecordCmd (CMD_MANY_TO_ONE, NULL, topSel, botSel, 1); ! RedrawAreas (botObj, sel_ltx-GRID_ABS_SIZE(1), sel_lty-GRID_ABS_SIZE(1), sel_rbx+GRID_ABS_SIZE(1), sel_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)); ! HighLightForward (); ! SetFileModified (TRUE); justDupped = FALSE; ! if (locked_text_count==0) ! Msg ("Text object(s) attached."); ! else ! Msg ("Text object(s) unlocked and attached."); } --- 454,482 ---- AddAttr(owner_ptr, sel_ptr->obj); } + } ! RemoveAllSel(); ! UnlinkObj(owner_ptr); ! AddObj(NULL, topObj, owner_ptr); topSel = botSel = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (topSel == NULL) FailAllocMessage(); topSel->obj = owner_ptr; topSel->prev = NULL; botSel->next = NULL; ! AdjObjBBox(owner_ptr); ! UpdSelBBox(); ! RecordCmd(CMD_MANY_TO_ONE, NULL, topSel, botSel, 1); ! RedrawAreas(botObj, sel_ltx-GRID_ABS_SIZE(1), sel_lty-GRID_ABS_SIZE(1), sel_rbx+GRID_ABS_SIZE(1), sel_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)); ! HighLightForward(); ! SetFileModified(TRUE); justDupped = FALSE; ! if (locked_text_count==0) { ! Msg("Text object(s) attached."); ! } else { ! Msg("Text object(s) unlocked and attached."); ! } } *************** *** 664,689 **** static ! void UpdateFirstTextStringWithAttrNameAndValue (ObjPtr, AttrPtr) ! struct ObjRec * ObjPtr; ! struct AttrRec * AttrPtr; { ! int len1, len2; ! char s[MAXSTRING+1], msg[80]; ! struct DynStrRec * dest_dyn_str=(&ObjPtr->detail.t->first->dyn_str); ! DynStrCpy (dest_dyn_str, &AttrPtr->attr_name); len1 = AttrPtr->attr_name.sz-1; len2 = AttrPtr->attr_value.sz-1; ! if (len1+len2 >= MAXSTRING) ! { ! sprintf (msg, "String length exceeds %1d. %s.", MAXSTRING, "String truncated"); ! Msg (msg); AttrPtr->attr_value.s[MAXSTRING-len1] = '\0'; AttrPtr->attr_value.sz = MAXSTRING-len1+1; } ! sprintf (s, "%s%s", dest_dyn_str->s, AttrPtr->attr_value.s); ! DynStrSet (dest_dyn_str, s); } --- 648,697 ---- static ! void GetFirstTextStringWithAttrNameAndValue(ObjPtr, AttrPtr, pszBuf, cbBuf) ! struct ObjRec *ObjPtr; ! struct AttrRec *AttrPtr; ! char *pszBuf; ! int cbBuf; ! { ! int len1, len2; ! char s[MAXSTRING+1]; ! ! len1 = AttrPtr->attr_name.sz-1; ! len2 = AttrPtr->attr_value.sz-1; ! if (len1+len2 >= MAXSTRING) { ! char saved_ch=AttrPtr->attr_value.s[MAXSTRING-len1]; ! ! AttrPtr->attr_value.s[MAXSTRING-len1] = '\0'; ! AttrPtr->attr_value.sz = MAXSTRING-len1+1; ! sprintf(s, "%s%s", AttrPtr->attr_name.s, AttrPtr->attr_value.s); ! AttrPtr->attr_value.s[MAXSTRING-len1] = saved_ch; ! } else { ! sprintf(s, "%s%s", AttrPtr->attr_name.s, AttrPtr->attr_value.s); ! } ! strncpy(pszBuf, s, cbBuf); ! } ! ! static ! void UpdateFirstTextStringWithAttrNameAndValue(ObjPtr, AttrPtr) ! struct ObjRec *ObjPtr; ! struct AttrRec *AttrPtr; { ! int len1=0, len2=0; ! char buf[MAXSTRING+1]; ! struct DynStrRec *dest_dyn_str=(&ObjPtr->detail.t->first->dyn_str); ! DynStrCpy(dest_dyn_str, &AttrPtr->attr_name); len1 = AttrPtr->attr_name.sz-1; len2 = AttrPtr->attr_value.sz-1; ! if (len1+len2 >= MAXSTRING) { ! sprintf(gszMsgBox, "String length exceeds %1d. %s.", MAXSTRING, "String truncated"); ! Msg(gszMsgBox); AttrPtr->attr_value.s[MAXSTRING-len1] = '\0'; AttrPtr->attr_value.sz = MAXSTRING-len1+1; } ! sprintf(buf, "%s%s", dest_dyn_str->s, AttrPtr->attr_value.s); ! DynStrSet(dest_dyn_str, buf); } *************** *** 1036,1072 **** } ! void DetachAttrs () { ! struct SelRec * sel_ptr, * new_sel_ptr; ! struct ObjRec * obj_ptr; ! struct AttrRec * attr_ptr, * next_attr; ! int picture_changed=FALSE, name_changed=FALSE; ! HighLightReverse (); ! StartCompositeCmd (); ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! { obj_ptr = sel_ptr->obj; attr_ptr = obj_ptr->fattr; ! if (attr_ptr != NULL) ! { ! int obj_change = FALSE; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) ! if (!attr_ptr->inherited) ! { obj_change = TRUE; break; } ! if (obj_change) ! { ! struct SelRec * tmp_top_sel, * tmp_bot_sel; ! struct SelRec * tmp_sel_ptr, * next_sel; ! int count; ! ! PrepareToReplaceAnObj (obj_ptr); ! if (DoShowAndUpdAttrNames (obj_ptr, FALSE)) name_changed = TRUE; tmp_top_sel = tmp_bot_sel = (struct SelRec *)malloc( --- 1044,1076 ---- } ! void DetachAttrs() { ! struct SelRec *sel_ptr, *new_sel_ptr; ! struct ObjRec *obj_ptr; ! struct AttrRec *attr_ptr, *next_attr; ! int picture_changed=FALSE, name_changed=FALSE; ! HighLightReverse(); ! StartCompositeCmd(); ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { obj_ptr = sel_ptr->obj; attr_ptr = obj_ptr->fattr; ! if (attr_ptr != NULL) { ! int obj_change=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr=attr_ptr->next) { ! if (!attr_ptr->inherited) { obj_change = TRUE; break; } + } + if (obj_change) { + struct SelRec *tmp_top_sel, *tmp_bot_sel; + struct SelRec *tmp_sel_ptr, *next_sel; + int count; ! PrepareToReplaceAnObj(obj_ptr); ! if (DoShowAndUpdAttrNames(obj_ptr, FALSE)) name_changed = TRUE; tmp_top_sel = tmp_bot_sel = (struct SelRec *)malloc( *************** *** 1078,1087 **** topAttr = botAttr = NULL; ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=next_attr) ! { next_attr = attr_ptr->next; ! if (obj_ptr->type == OBJ_ICON && attr_ptr->inherited) ! { ! LinkInAttr ((struct AttrRec *)NULL, topAttr, attr_ptr); continue; } --- 1082,1089 ---- topAttr = botAttr = NULL; ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=next_attr) { next_attr = attr_ptr->next; ! if (obj_ptr->type == OBJ_ICON && attr_ptr->inherited) { ! LinkInAttr((struct AttrRec *)NULL, topAttr, attr_ptr); continue; } *************** *** 1089,1103 **** tmp_sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (tmp_sel_ptr == NULL) FailAllocMessage (); tmp_sel_ptr->next = tmp_bot_sel; tmp_sel_ptr->obj = attr_ptr->obj; ! if (tmp_top_sel == tmp_bot_sel) ! { tmp_sel_ptr->prev = NULL; tmp_top_sel->prev = tmp_sel_ptr; tmp_top_sel = tmp_sel_ptr; ! } ! else ! { tmp_sel_ptr->prev = tmp_bot_sel->prev; tmp_bot_sel->prev->next = tmp_sel_ptr; --- 1091,1102 ---- tmp_sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (tmp_sel_ptr == NULL) FailAllocMessage(); tmp_sel_ptr->next = tmp_bot_sel; tmp_sel_ptr->obj = attr_ptr->obj; ! if (tmp_top_sel == tmp_bot_sel) { tmp_sel_ptr->prev = NULL; tmp_top_sel->prev = tmp_sel_ptr; tmp_top_sel = tmp_sel_ptr; ! } else { tmp_sel_ptr->prev = tmp_bot_sel->prev; tmp_bot_sel->prev->next = tmp_sel_ptr; *************** *** 1107,1113 **** attr_ptr->obj->detail.t->attr = NULL; ! AddObj (obj_ptr->prev, obj_ptr, attr_ptr->obj); new_sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (new_sel_ptr == NULL) FailAllocMessage (); new_sel_ptr->obj = obj_ptr->prev; AddSel(sel_ptr->prev, sel_ptr, new_sel_ptr); --- 1106,1112 ---- attr_ptr->obj->detail.t->attr = NULL; ! AddObj(obj_ptr->prev, obj_ptr, attr_ptr->obj); new_sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (new_sel_ptr == NULL) FailAllocMessage(); new_sel_ptr->obj = obj_ptr->prev; AddSel(sel_ptr->prev, sel_ptr, new_sel_ptr); *************** *** 1116,1121 **** obj_ptr->fattr = topAttr; obj_ptr->lattr = botAttr; ! AdjObjBBox (obj_ptr); ! RecordCmd (CMD_ONE_TO_MANY, NULL, tmp_top_sel, tmp_bot_sel, count); for (tmp_sel_ptr=tmp_top_sel; tmp_sel_ptr!=NULL; --- 1115,1120 ---- obj_ptr->fattr = topAttr; obj_ptr->lattr = botAttr; ! AdjObjBBox(obj_ptr); ! RecordCmd(CMD_ONE_TO_MANY, NULL, tmp_top_sel, tmp_bot_sel, count); for (tmp_sel_ptr=tmp_top_sel; tmp_sel_ptr!=NULL; *************** *** 1127,1150 **** } } ! EndCompositeCmd (); ! UpdSelBBox (); ! if (picture_changed || name_changed) ! { ! RedrawAnArea (botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! SetFileModified (TRUE); } ! HighLightForward (); } ! void UpdAttr (AttrPtr) ! struct AttrRec * AttrPtr; /* Update the text object's string value associated with AttrPtr */ { ! if (AttrPtr->nameshown) ! UpdateFirstTextStringWithAttrNameAndValue (AttrPtr->obj, AttrPtr); ! else ! DynStrCpy (&AttrPtr->obj->detail.t->first->dyn_str, &AttrPtr->attr_value); UpdTextBBox(AttrPtr->obj); } --- 1126,1149 ---- } } ! EndCompositeCmd(); ! UpdSelBBox(); ! if (picture_changed || name_changed) { ! RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! SetFileModified(TRUE); } ! HighLightForward(); } ! void UpdAttr(AttrPtr) ! struct AttrRec *AttrPtr; /* Update the text object's string value associated with AttrPtr */ { ! if (AttrPtr->nameshown) { ! UpdateFirstTextStringWithAttrNameAndValue(AttrPtr->obj, AttrPtr); ! } else { ! DynStrCpy(&AttrPtr->obj->detail.t->first->dyn_str, &AttrPtr->attr_value); ! } UpdTextBBox(AttrPtr->obj); } *************** *** 1233,1236 **** --- 1232,1236 ---- { XUngrabPointer (mainDisplay, CurrentTime); + XSync(mainDisplay, False); placing = FALSE; SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy); *************** *** 1366,1369 **** --- 1366,1370 ---- { XUngrabPointer (mainDisplay, CurrentTime); + XSync(mainDisplay, False); placing = FALSE; SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy); *************** *** 1402,1406 **** int * fore_colors, * pixel_ptr, * valid, * flag_ptr; int * init_rv; ! char * * attrStrs, * s, buf[MAXSTRING]; unsigned int button; --- 1403,1407 ---- int * fore_colors, * pixel_ptr, * valid, * flag_ptr; int * init_rv; ! char * * attrStrs, buf[MAXSTRING]; unsigned int button; *************** *** 1426,1435 **** for (i = 0; i < num_attrs; i++, attr_ptr1 = attr_ptr1->next) { ! s = (char*)malloc((MAXSTRING+1)*sizeof(char)); ! if (s == NULL) FailAllocMessage(); ! attrStrs[i] = s; ! UpdateFirstTextStringWithAttrNameAndValue (attr_ptr1->obj, attr_ptr1); ! strcpy (s, attr_ptr1->obj->detail.t->first->dyn_str.s); *pixel_ptr++ = colorPixels[attr_ptr1->obj->color]; --- 1427,1436 ---- for (i = 0; i < num_attrs; i++, attr_ptr1 = attr_ptr1->next) { ! char buf[MAXSTRING]; ! *buf = '\0'; ! GetFirstTextStringWithAttrNameAndValue(attr_ptr1->obj, attr_ptr1, ! buf, sizeof(buf)); ! if ((attrStrs[i]=UtilStrDup(buf)) == NULL) FailAllocMessage(); *pixel_ptr++ = colorPixels[attr_ptr1->obj->color]; *************** *** 1484,1488 **** } ! for (i = 0; i < num_attrs; i++) free(attrStrs[i]); free(attrStrs); justDupped = FALSE; --- 1485,1489 ---- } ! for (i = 0; i < num_attrs; i++) UtilFree(attrStrs[i]); free(attrStrs); justDupped = FALSE; *** auxtext.c.orig Tue Sep 30 13:22:43 1997 --- auxtext.c Tue Sep 30 13:22:43 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/auxtext.c,v 3.6 1996/10/28 00:33:18 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/auxtext.c,v 3.10 1997/09/17 05:55:06 william Exp $ */ #include *************** *** 83,102 **** int groupedTextEditable = FALSE; ! struct SelRec * outerSel=NULL, * innerSel=NULL; ! void GetStrSizeInfo (StrPtr, w, lbearing, rextra) ! struct StrRec * StrPtr; ! int * w, * lbearing, * rextra; { ! int dir, asc, des; ! XCharStruct xcs; ! if (canvasFontDoubleByte) ! XTextExtents16 (canvasFontPtr, (XChar2b*)StrPtr->dyn_str.s, (StrPtr->dyn_str.sz-1)>>1, &dir, &asc, &des, &xcs); ! else ! XTextExtents (canvasFontPtr, StrPtr->dyn_str.s, StrPtr->dyn_str.sz-1, &dir, &asc, &des, &xcs); ! if (w != NULL) *w = xcs.width; if (lbearing != NULL) *lbearing = (xcs.lbearing >= 0 ? 0 : xcs.lbearing); --- 81,100 ---- int groupedTextEditable = FALSE; ! struct SelRec *outerSel=NULL, *innerSel=NULL; ! void GetStrSizeInfo(StrPtr, w, lbearing, rextra) ! struct StrRec *StrPtr; ! int *w, *lbearing, *rextra; { ! int dir, asc, des; ! XCharStruct xcs; ! if (canvasFontDoubleByte) { ! XTextExtents16(canvasFontPtr, (XChar2b*)StrPtr->dyn_str.s, (StrPtr->dyn_str.sz-1)>>1, &dir, &asc, &des, &xcs); ! } else { ! XTextExtents(canvasFontPtr, StrPtr->dyn_str.s, StrPtr->dyn_str.sz-1, &dir, &asc, &des, &xcs); ! } if (w != NULL) *w = xcs.width; if (lbearing != NULL) *lbearing = (xcs.lbearing >= 0 ? 0 : xcs.lbearing); *************** *** 104,124 **** } ! void GetTextObjSizeInfo (TextPtr, num_lines, max_w, min_lbearing, max_rextra) ! struct TextRec * TextPtr; ! int * num_lines, * max_w, * min_lbearing, * max_rextra; ! { ! register struct StrRec * s_ptr; ! int dir, asc, des; ! int w=0, lbearing=0, rextra=0, n=0; ! XCharStruct xcs; ! ! for (s_ptr=TextPtr->first; s_ptr != NULL; s_ptr=s_ptr->next, n++) ! { ! if (canvasFontDoubleByte) ! XTextExtents16 (canvasFontPtr, (XChar2b*)s_ptr->dyn_str.s, (s_ptr->dyn_str.sz-1)>>1, &dir, &asc, &des, &xcs); ! else ! XTextExtents (canvasFontPtr, s_ptr->dyn_str.s, s_ptr->dyn_str.sz-1, &dir, &asc, &des, &xcs); if (w < xcs.width) w = xcs.width; if (lbearing > xcs.lbearing) lbearing = xcs.lbearing; --- 102,121 ---- } ! void GetTextObjSizeInfo(TextPtr, num_lines, max_w, min_lbearing, max_rextra) ! struct TextRec *TextPtr; ! int *num_lines, *max_w, *min_lbearing, *max_rextra; ! { ! register struct StrRec *s_ptr; ! int dir, asc, des, w=0, lbearing=0, rextra=0, n=0; ! XCharStruct xcs; ! ! for (s_ptr=TextPtr->first; s_ptr != NULL; s_ptr=s_ptr->next, n++) { ! if (canvasFontDoubleByte) { ! XTextExtents16(canvasFontPtr, (XChar2b*)s_ptr->dyn_str.s, (s_ptr->dyn_str.sz-1)>>1, &dir, &asc, &des, &xcs); ! } else { ! XTextExtents(canvasFontPtr, s_ptr->dyn_str.s, s_ptr->dyn_str.sz-1, &dir, &asc, &des, &xcs); + } if (w < xcs.width) w = xcs.width; if (lbearing > xcs.lbearing) lbearing = xcs.lbearing; *************** *** 215,256 **** } ! void TranslateKeys (s, key_sym) ! char * s; ! KeySym * key_sym; ! { ! switch (*key_sym) ! { ! case XK_KP_Space: *key_sym=XK_space; s[0]=' '; s[1]='\0'; break; ! case XK_KP_Tab: *key_sym=XK_Tab; s[0]='\t'; s[1]='\0'; break; ! case XK_KP_Enter: *key_sym=XK_Return; s[0]='\r'; s[1]='\0'; break; ! case XK_KP_Equal: *key_sym=XK_equal; s[0]='='; s[1]='\0'; break; ! case XK_KP_Multiply: *key_sym=XK_multiply; s[0]='*'; s[1]='\0'; break; ! case XK_KP_Add: *key_sym=XK_plus; s[0]='+'; s[1]='\0'; break; ! case XK_KP_Separator: *key_sym=XK_comma; s[0]=','; s[1]='\0'; break; ! case XK_KP_Subtract: *key_sym=XK_minus; s[0]='-'; s[1]='\0'; break; ! case XK_KP_Decimal: *key_sym=XK_period; s[0]='.'; s[1]='\0'; break; ! case XK_KP_Divide: *key_sym=XK_slash; s[0]='/'; s[1]='\0'; break; ! ! case XK_KP_0: *key_sym=XK_0; s[0]='0'; s[1]='\0'; break; ! case XK_KP_1: *key_sym=XK_1; s[0]='1'; s[1]='\0'; break; ! case XK_KP_2: *key_sym=XK_2; s[0]='2'; s[1]='\0'; break; ! case XK_KP_3: *key_sym=XK_3; s[0]='3'; s[1]='\0'; break; ! case XK_KP_4: *key_sym=XK_4; s[0]='4'; s[1]='\0'; break; ! case XK_KP_5: *key_sym=XK_5; s[0]='5'; s[1]='\0'; break; ! case XK_KP_6: *key_sym=XK_6; s[0]='6'; s[1]='\0'; break; ! case XK_KP_7: *key_sym=XK_7; s[0]='7'; s[1]='\0'; break; ! case XK_KP_8: *key_sym=XK_8; s[0]='8'; s[1]='\0'; break; ! case XK_KP_9: *key_sym=XK_9; s[0]='9'; s[1]='\0'; break; } } static ! void GetTransformedTextBBoxAbsVs (ObjPtr, LBearing, RightExtra, Vs) ! struct ObjRec * ObjPtr; ! int LBearing, RightExtra; ! IntPoint * Vs; /* array of 5 points */ { ! int x, y; ! struct BBRec bbox; bbox.ltx = ObjPtr->orig_obbox.ltx - ObjPtr->x + LBearing; --- 212,252 ---- } ! void TranslateKeys(s, key_sym) ! char *s; ! KeySym *key_sym; ! { ! switch (*key_sym) { ! case XK_KP_Space: *key_sym=XK_space; s[0]=' '; s[1]='\0'; break; ! case XK_KP_Tab: *key_sym=XK_Tab; s[0]='\t'; s[1]='\0'; break; ! case XK_KP_Enter: *key_sym=XK_Return; s[0]='\r'; s[1]='\0'; break; ! case XK_KP_Equal: *key_sym=XK_equal; s[0]='='; s[1]='\0'; break; ! case XK_KP_Multiply: *key_sym=XK_multiply; s[0]='*'; s[1]='\0'; break; ! case XK_KP_Add: *key_sym=XK_plus; s[0]='+'; s[1]='\0'; break; ! case XK_KP_Separator: *key_sym=XK_comma; s[0]=','; s[1]='\0'; break; ! case XK_KP_Subtract: *key_sym=XK_minus; s[0]='-'; s[1]='\0'; break; ! case XK_KP_Decimal: *key_sym=XK_period; s[0]='.'; s[1]='\0'; break; ! case XK_KP_Divide: *key_sym=XK_slash; s[0]='/'; s[1]='\0'; break; ! ! case XK_KP_0: *key_sym=XK_0; s[0]='0'; s[1]='\0'; break; ! case XK_KP_1: *key_sym=XK_1; s[0]='1'; s[1]='\0'; break; ! case XK_KP_2: *key_sym=XK_2; s[0]='2'; s[1]='\0'; break; ! case XK_KP_3: *key_sym=XK_3; s[0]='3'; s[1]='\0'; break; ! case XK_KP_4: *key_sym=XK_4; s[0]='4'; s[1]='\0'; break; ! case XK_KP_5: *key_sym=XK_5; s[0]='5'; s[1]='\0'; break; ! case XK_KP_6: *key_sym=XK_6; s[0]='6'; s[1]='\0'; break; ! case XK_KP_7: *key_sym=XK_7; s[0]='7'; s[1]='\0'; break; ! case XK_KP_8: *key_sym=XK_8; s[0]='8'; s[1]='\0'; break; ! case XK_KP_9: *key_sym=XK_9; s[0]='9'; s[1]='\0'; break; } } static ! void GetTransformedTextBBoxAbsVs(ObjPtr, LBearing, RightExtra, Vs) ! struct ObjRec *ObjPtr; ! int LBearing, RightExtra; ! IntPoint *Vs; /* array of 5 points */ { ! int x, y; ! struct BBRec bbox; bbox.ltx = ObjPtr->orig_obbox.ltx - ObjPtr->x + LBearing; *************** *** 258,262 **** bbox.rbx = ObjPtr->orig_obbox.rbx - ObjPtr->x + RightExtra; bbox.rby = ObjPtr->orig_obbox.rby - ObjPtr->y; ! TransformOffsetBBoxThroughCTM (&bbox, ObjPtr->ctm, Vs); x = Vs[0].x + ObjPtr->x; y = Vs[0].y + ObjPtr->y; Vs[0].x = Vs[4].x = x; Vs[0].y = Vs[4].y = y; --- 254,258 ---- bbox.rbx = ObjPtr->orig_obbox.rbx - ObjPtr->x + RightExtra; bbox.rby = ObjPtr->orig_obbox.rby - ObjPtr->y; ! TransformOffsetBBoxThroughCTM(&bbox, ObjPtr->ctm, Vs); x = Vs[0].x + ObjPtr->x; y = Vs[0].y + ObjPtr->y; Vs[0].x = Vs[4].x = x; Vs[0].y = Vs[4].y = y; *************** *** 273,279 **** int Just, W, H, LBearing, RightExtra, Rotate; { /* In this procedure, it is assumed that the x and y field */ ! /* of the text object has the correct information.*/ /* The rotation is clockwise */ ! register int mw2, pw2; if (ObjPtr->ctm == NULL) { --- 269,275 ---- int Just, W, H, LBearing, RightExtra, Rotate; { /* In this procedure, it is assumed that the x and y field */ ! /* of the text object has the correct information.*/ /* The rotation is clockwise */ ! register int mw2, pw2; if (ObjPtr->ctm == NULL) { *************** *** 368,372 **** int Just, W, H, LBearing, RightExtra, Rotate; /* In this procedure, it is assumed that the x and y field */ ! /* of the text object has the correct information.*/ /* The rotation is clockwise */ { --- 364,368 ---- int Just, W, H, LBearing, RightExtra, Rotate; /* In this procedure, it is assumed that the x and y field */ ! /* of the text object has the correct information.*/ /* The rotation is clockwise */ { *************** *** 403,407 **** IntPoint abs_obj_bbox_vs[5]; ! GetTransformedTextBBoxAbsVs (ObjPtr, LBearing, RightExtra, abs_obj_bbox_vs); ObjPtr->bbox.ltx = min(min(abs_obj_bbox_vs[0].x,abs_obj_bbox_vs[1].x), --- 399,403 ---- IntPoint abs_obj_bbox_vs[5]; ! GetTransformedTextBBoxAbsVs(ObjPtr, LBearing, RightExtra, abs_obj_bbox_vs); ObjPtr->bbox.ltx = min(min(abs_obj_bbox_vs[0].x,abs_obj_bbox_vs[1].x), *************** *** 424,428 **** int Just, W, H, LBearing, RightExtra, Rotate; /* In this procedure, it is assumed that the x and y field */ ! /* of the text object has the correct information.*/ /* The rotation is clockwise */ { --- 420,424 ---- int Just, W, H, LBearing, RightExtra, Rotate; /* In this procedure, it is assumed that the x and y field */ ! /* of the text object has the correct information.*/ /* The rotation is clockwise */ { *************** *** 443,460 **** } ! int UpdTextBBox (ObjPtr) ! struct ObjRec * ObjPtr; { ! int num_lines, max_len=0, min_lbearing=0, max_rextra=0; ! if (ObjPtr->detail.t->read_only) ! { ! SetTextBBox (ObjPtr, ObjPtr->detail.t->just, ObjPtr->detail.t->orig_w, ObjPtr->detail.t->orig_h, ObjPtr->detail.t->min_lbearing, ObjPtr->detail.t->max_rextra, ObjPtr->detail.t->rotate); ! return (TRUE); } ! SaveCurFont (); curFont = ObjPtr->detail.t->font; curStyle = ObjPtr->detail.t->style; --- 439,455 ---- } ! int UpdTextBBox(ObjPtr) ! struct ObjRec *ObjPtr; { ! int num_lines, max_len=0, min_lbearing=0, max_rextra=0; ! if (ObjPtr->detail.t->read_only) { ! SetTextBBox(ObjPtr, ObjPtr->detail.t->just, ObjPtr->detail.t->orig_w, ObjPtr->detail.t->orig_h, ObjPtr->detail.t->min_lbearing, ObjPtr->detail.t->max_rextra, ObjPtr->detail.t->rotate); ! return TRUE; } ! SaveCurFont(); curFont = ObjPtr->detail.t->font; curStyle = ObjPtr->detail.t->style; *************** *** 465,549 **** curUnderline = ObjPtr->detail.t->underline; attemptingToSetFontProperty = TRUE; ! SetCanvasFont (); attemptingToSetFontProperty = FALSE; ! if (canvasFontSize == INVALID || curSize != canvasFontSize) ! { ! RestoreCurFont (); ! return (INVALID); ! } ! if (textCursorH+textVSpace <= 0) ! { ! RestoreCurFont (); ! return (FALSE); } ObjPtr->detail.t->asc = canvasFontAsc; ObjPtr->detail.t->des = canvasFontDes; ! GetTextObjSizeInfo (ObjPtr->detail.t, &num_lines, &max_len, &min_lbearing, &max_rextra); ObjPtr->detail.t->min_lbearing = min_lbearing; ObjPtr->detail.t->max_rextra = max_rextra; ! SetTextOrigBBoxes (ObjPtr, textJust, max_len, num_lines*textCursorH+(num_lines-1)*textVSpace, min_lbearing, max_rextra, ObjPtr->detail.t->rotate); ! SetTextBBox (ObjPtr, textJust, max_len, num_lines*textCursorH+(num_lines-1)*textVSpace, min_lbearing, max_rextra, ObjPtr->detail.t->rotate); ! RestoreCurFont (); ! return (TRUE); } ! int PixelOnOff (image, col_start, row_start, scale) ! XImage * image; ! int col_start, row_start, scale; ! { ! register int m, n; ! int on_count=0, off_count=0; ! ! if (scale == 2) ! { ! for (m = 0; m < 2; m++) ! for (n = 0; n < 2; n++) ! switch (XGetPixel (image,col_start+n,row_start+m)) ! { ! case 0: if (++off_count > 2) return (0); break; ! case 1: if (++on_count >= 2) return (1); break; } ! } ! else if (scale > 2) ! { ! int half_scale=scale>>1; ! ! for (m = 0; m < 2; m++) ! for (n = 0; n < 2; n++) ! switch (PixelOnOff (image, col_start+n*half_scale, ! row_start+m*half_scale, half_scale)) ! { ! case 0: if (++off_count > 2) return (0); break; ! case 1: if (++on_count >= 2) return (1); break; } } ! else ! return (1); ! return (0); ! } ! ! void MakeCachedTextBitmap (ObjPtr) ! struct ObjRec * ObjPtr; ! { ! register int r, c; ! int w=0, h=0, num_cols=0, num_rows=0; ! int yinc, y, rotate, watch_cursor, do_msg; ! int max_len=0, min_lbearing=0, max_rextra=0; ! int flat=FALSE, skinny=FALSE, start_row, start_col; ! struct MtrxRec mtrx; ! Pixmap dest_bitmap; ! XImage * src_image, * dest_image; ! struct StrRec * s_ptr; ! struct TextRec * text_ptr = ObjPtr->detail.t; ! XGCValues values; --- 460,541 ---- curUnderline = ObjPtr->detail.t->underline; attemptingToSetFontProperty = TRUE; ! SetCanvasFont(); attemptingToSetFontProperty = FALSE; ! if (canvasFontSize == INVALID || curSize != canvasFontSize) { ! RestoreCurFont(); ! return INVALID; ! } ! if (textCursorH+textVSpace <= 0) { ! RestoreCurFont(); ! return FALSE; } ObjPtr->detail.t->asc = canvasFontAsc; ObjPtr->detail.t->des = canvasFontDes; ! GetTextObjSizeInfo(ObjPtr->detail.t, &num_lines, &max_len, &min_lbearing, &max_rextra); ObjPtr->detail.t->min_lbearing = min_lbearing; ObjPtr->detail.t->max_rextra = max_rextra; ! SetTextOrigBBoxes(ObjPtr, textJust, max_len, num_lines*textCursorH+(num_lines-1)*textVSpace, min_lbearing, max_rextra, ObjPtr->detail.t->rotate); ! SetTextBBox(ObjPtr, textJust, max_len, num_lines*textCursorH+(num_lines-1)*textVSpace, min_lbearing, max_rextra, ObjPtr->detail.t->rotate); ! RestoreCurFont(); ! return TRUE; } ! int PixelOnOff(image, col_start, row_start, scale) ! XImage *image; ! int col_start, row_start, scale; ! { ! register int m, n; ! int on_count=0, off_count=0; ! ! if (scale == 2) { ! for (m = 0; m < 2; m++) { ! for (n = 0; n < 2; n++) { ! switch (XGetPixel(image,col_start+n,row_start+m)) { ! case 0: if (++off_count > 2) return 0; break; ! case 1: if (++on_count >= 2) return 1; break; } ! } ! } ! } else if (scale > 2) { ! int half_scale=scale>>1; ! ! for (m = 0; m < 2; m++) { ! for (n = 0; n < 2; n++) { ! switch (PixelOnOff(image, col_start+n*half_scale, ! row_start+m*half_scale, half_scale)) { ! case 0: if (++off_count > 2) return 0; break; ! case 1: if (++on_count >= 2) return 1; break; } + } + } + } else { + return 1; } ! return 0; ! } ! ! void MakeCachedTextBitmap(ObjPtr) ! struct ObjRec *ObjPtr; ! { ! register int r, c; ! int w=0, h=0, num_cols=0, num_rows=0; ! int yinc, y, rotate, watch_cursor, do_msg; ! int max_len=0, min_lbearing=0, max_rextra=0; ! int flat=FALSE, skinny=FALSE, start_row, start_col; ! struct MtrxRec mtrx; ! Pixmap dest_bitmap; ! XImage *src_image, *dest_image; ! struct StrRec *s_ptr; ! struct TextRec *text_ptr=ObjPtr->detail.t; ! XGCValues values; *************** *** 551,631 **** text_ptr->cached_zoomed==zoomedIn && text_ptr->cached_zoom==zoomScale && (text_ptr->rotate==ROTATE0 || ! text_ptr->cached_rotate==text_ptr->rotate)) return; ! if (ObjPtr->obbox.ltx==ObjPtr->obbox.rbx || ! ObjPtr->obbox.lty==ObjPtr->obbox.rby) return; ! ! if (text_ptr->cached_bitmap != None) ! { ! XFreePixmap (mainDisplay, text_ptr->cached_bitmap); text_ptr->cached_bitmap = None; } rotate = text_ptr->rotate; ! if (text_ptr->read_only) ! GetTextObjSizeInfo (text_ptr, NULL, &max_len, &min_lbearing, &max_rextra); ! ! switch (rotate) ! { ! case ROTATE0: ! case ROTATE180: ! if (text_ptr->read_only) ! { ! w = max_len-min_lbearing+max_rextra; ! h = text_ptr->lines*textCursorH+(text_ptr->lines-1)*textVSpace; ! } ! else ! { ! if (ObjPtr->ctm == NULL) ! { ! max_len = ObjPtr->obbox.rbx - ObjPtr->obbox.ltx; ! min_lbearing = ObjPtr->detail.t->min_lbearing; ! max_rextra = ObjPtr->detail.t->max_rextra; ! w = ObjPtr->bbox.rbx - ObjPtr->bbox.ltx - 2; ! h = ObjPtr->bbox.rby - ObjPtr->bbox.lty - 2; ! } ! else ! { ! max_len = ObjPtr->orig_obbox.rbx - ObjPtr->orig_obbox.ltx; ! min_lbearing = ObjPtr->detail.t->min_lbearing; ! max_rextra = ObjPtr->detail.t->max_rextra; ! w = max_len - min_lbearing + max_rextra; ! h = ObjPtr->orig_obbox.rby - ObjPtr->orig_obbox.lty; ! } ! } ! break; ! case ROTATE90: ! case ROTATE270: ! if (text_ptr->read_only) ! { ! w = max_len-min_lbearing+max_rextra; ! h = text_ptr->lines*textCursorH+(text_ptr->lines-1)*textVSpace; ! } ! else ! { ! max_len = ObjPtr->obbox.rby - ObjPtr->obbox.lty; min_lbearing = ObjPtr->detail.t->min_lbearing; max_rextra = ObjPtr->detail.t->max_rextra; ! w = ObjPtr->bbox.rby - ObjPtr->bbox.lty - 2; ! h = ObjPtr->bbox.rbx - ObjPtr->bbox.ltx - 2; } ! break; } ! if (w > textBackingPixmapW || h > textBackingPixmapH) ! { ! int tmp_w, tmp_h; ! if (textBackingPixmap != None) ! XFreePixmap (mainDisplay, textBackingPixmap); tmp_w = max(w,textBackingPixmapW); tmp_h = max(h,textBackingPixmapH); ! textBackingPixmap = XCreatePixmap (mainDisplay, mainWindow, tmp_w, tmp_h, 1); ! if (textBackingPixmap == None) ! { sprintf(gszMsgBox, "Can not allocate pixmap of size %1dx%1d.", tmp_w, tmp_h); --- 543,611 ---- text_ptr->cached_zoomed==zoomedIn && text_ptr->cached_zoom==zoomScale && (text_ptr->rotate==ROTATE0 || ! text_ptr->cached_rotate==text_ptr->rotate)) { return; ! } if (ObjPtr->obbox.ltx==ObjPtr->obbox.rbx || ! ObjPtr->obbox.lty==ObjPtr->obbox.rby) { return; ! } ! if (text_ptr->cached_bitmap != None) { ! XFreePixmap(mainDisplay, text_ptr->cached_bitmap); text_ptr->cached_bitmap = None; } rotate = text_ptr->rotate; ! if (text_ptr->read_only) { ! GetTextObjSizeInfo(text_ptr, NULL, &max_len, &min_lbearing, &max_rextra); ! } ! switch (rotate) { ! case ROTATE0: ! case ROTATE180: ! if (text_ptr->read_only) { ! w = max_len-min_lbearing+max_rextra; ! h = text_ptr->lines*textCursorH+(text_ptr->lines-1)*textVSpace; ! } else { ! if (ObjPtr->ctm == NULL) { ! max_len = ObjPtr->obbox.rbx - ObjPtr->obbox.ltx; ! min_lbearing = ObjPtr->detail.t->min_lbearing; ! max_rextra = ObjPtr->detail.t->max_rextra; ! w = ObjPtr->bbox.rbx - ObjPtr->bbox.ltx - 2; ! h = ObjPtr->bbox.rby - ObjPtr->bbox.lty - 2; ! } else { ! max_len = ObjPtr->orig_obbox.rbx - ObjPtr->orig_obbox.ltx; min_lbearing = ObjPtr->detail.t->min_lbearing; max_rextra = ObjPtr->detail.t->max_rextra; ! w = max_len - min_lbearing + max_rextra; ! h = ObjPtr->orig_obbox.rby - ObjPtr->orig_obbox.lty; } ! } ! break; ! case ROTATE90: ! case ROTATE270: ! if (text_ptr->read_only) { ! w = max_len-min_lbearing+max_rextra; ! h = text_ptr->lines*textCursorH+(text_ptr->lines-1)*textVSpace; ! } else { ! max_len = ObjPtr->obbox.rby - ObjPtr->obbox.lty; ! min_lbearing = ObjPtr->detail.t->min_lbearing; ! max_rextra = ObjPtr->detail.t->max_rextra; ! w = ObjPtr->bbox.rby - ObjPtr->bbox.lty - 2; ! h = ObjPtr->bbox.rbx - ObjPtr->bbox.ltx - 2; ! } ! break; } ! if (w > textBackingPixmapW || h > textBackingPixmapH) { ! int tmp_w, tmp_h; ! if (textBackingPixmap != None) { ! XFreePixmap(mainDisplay, textBackingPixmap); ! } tmp_w = max(w,textBackingPixmapW); tmp_h = max(h,textBackingPixmapH); ! textBackingPixmap = XCreatePixmap(mainDisplay, mainWindow, tmp_w, tmp_h, 1); ! if (textBackingPixmap == None) { sprintf(gszMsgBox, "Can not allocate pixmap of size %1dx%1d.", tmp_w, tmp_h); *************** *** 637,727 **** } watch_cursor = watchCursorOnMainWindow; ! if (!watch_cursor) ! { ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); } ! XSetForeground (mainDisplay, rotateGC, 0); ! XFillRectangle (mainDisplay,textBackingPixmap,rotateGC,0,0,w,h); values.foreground = 1; values.font = canvasFontPtr->fid; ! XChangeGC (mainDisplay, rotateGC, GCForeground | GCFont, &values); y = 0; yinc = textCursorH+textVSpace; ! for (s_ptr = text_ptr->first; s_ptr != NULL; s_ptr = s_ptr->next) ! { ! int x=0, str_w; ! str_w = XTextWidth (canvasFontPtr, s_ptr->dyn_str.s, s_ptr->dyn_str.sz-1); ! switch (textJust) ! { ! case JUST_L: x = (-min_lbearing); break; ! case JUST_C: ! x = ((w+min_lbearing-max_rextra-str_w)>>1)-min_lbearing; break; ! case JUST_R: x = w-str_w-max_rextra; break; } ! XDrawString (mainDisplay, textBackingPixmap, rotateGC, x, y+canvasFontAsc, s_ptr->dyn_str.s, s_ptr->dyn_str.sz-1); y += yinc; } ! src_image = XGetImage (mainDisplay,textBackingPixmap,0,0,w,h,1,ZPixmap); ! if (ObjPtr->ctm == NULL) ! { ! switch (rotate) ! { ! case ROTATE0: ! case ROTATE180: ! if (text_ptr->read_only) ! { ! num_cols=ObjPtr->bbox.rbx - ObjPtr->bbox.ltx; ! num_rows=ObjPtr->bbox.rby - ObjPtr->bbox.lty; ! } ! else ! { ! num_cols=w; num_rows=h; ! } ! break; ! case ROTATE90: ! case ROTATE270: ! if (text_ptr->read_only) ! { ! num_cols=ObjPtr->bbox.rbx - ObjPtr->bbox.ltx; ! num_rows=ObjPtr->bbox.rby - ObjPtr->bbox.lty; ! } ! else ! { ! num_cols=h; num_rows=w; ! } ! break; } ! if (zoomedIn || zoomScale == 0) ! { num_cols <<= zoomScale; num_rows <<= zoomScale; ! } ! else ! { num_cols >>= zoomScale; num_rows >>= zoomScale; } ! } ! else ! { num_cols = ZOOMED_SIZE(ObjPtr->bbox.rbx - ObjPtr->bbox.ltx - 2); num_rows = ZOOMED_SIZE(ObjPtr->bbox.rby - ObjPtr->bbox.lty - 2); } ! if (num_cols == 0) ! { skinny = TRUE; num_cols = 1; } ! if (num_rows == 0) ! { flat = TRUE; num_rows = 1; --- 617,690 ---- } watch_cursor = watchCursorOnMainWindow; ! if (!watch_cursor) { ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); } ! XSetForeground(mainDisplay, rotateGC, 0); ! XFillRectangle(mainDisplay,textBackingPixmap,rotateGC,0,0,w,h); values.foreground = 1; values.font = canvasFontPtr->fid; ! XChangeGC(mainDisplay, rotateGC, GCForeground | GCFont, &values); y = 0; yinc = textCursorH+textVSpace; ! for (s_ptr=text_ptr->first; s_ptr != NULL; s_ptr=s_ptr->next) { ! int x=0, str_w; ! str_w = XTextWidth(canvasFontPtr, s_ptr->dyn_str.s, s_ptr->dyn_str.sz-1); ! switch (textJust) { ! case JUST_L: x = (-min_lbearing); break; ! case JUST_C: ! x = ((w+min_lbearing-max_rextra-str_w)>>1)-min_lbearing; ! break; ! case JUST_R: x = w-str_w-max_rextra; break; } ! XDrawString(mainDisplay, textBackingPixmap, rotateGC, x, y+canvasFontAsc, s_ptr->dyn_str.s, s_ptr->dyn_str.sz-1); y += yinc; } ! src_image = XGetImage(mainDisplay,textBackingPixmap,0,0,w,h,1,ZPixmap); ! if (ObjPtr->ctm == NULL) { ! switch (rotate) { ! case ROTATE0: ! case ROTATE180: ! if (text_ptr->read_only) { ! num_cols = ObjPtr->bbox.rbx - ObjPtr->bbox.ltx; ! num_rows = ObjPtr->bbox.rby - ObjPtr->bbox.lty; ! } else { ! num_cols = w; num_rows = h; ! } ! break; ! case ROTATE90: ! case ROTATE270: ! if (text_ptr->read_only) { ! num_cols = ObjPtr->bbox.rbx - ObjPtr->bbox.ltx; ! num_rows = ObjPtr->bbox.rby - ObjPtr->bbox.lty; ! } else { ! num_cols = h; num_rows = w; ! } ! break; } ! if (zoomedIn || zoomScale == 0) { num_cols <<= zoomScale; num_rows <<= zoomScale; ! } else { num_cols >>= zoomScale; num_rows >>= zoomScale; } ! } else { num_cols = ZOOMED_SIZE(ObjPtr->bbox.rbx - ObjPtr->bbox.ltx - 2); num_rows = ZOOMED_SIZE(ObjPtr->bbox.rby - ObjPtr->bbox.lty - 2); } ! if (num_cols == 0) { skinny = TRUE; num_cols = 1; } ! if (num_rows == 0) { flat = TRUE; num_rows = 1; *************** *** 735,748 **** } ! dest_bitmap = XCreatePixmap (mainDisplay,mainWindow,num_cols,num_rows,1); ! XSetForeground (mainDisplay, rotateGC, 0); ! XFillRectangle (mainDisplay,dest_bitmap,rotateGC,0,0,num_cols,num_rows); ! dest_image = XGetImage (mainDisplay, dest_bitmap, 0, 0, num_cols, num_rows, 1, ZPixmap); ! if (!flat && !skinny) ! { ! if (ObjPtr->ctm == NULL) ! { mtrx.image_w = (float)w; mtrx.image_h = (float)h; --- 698,709 ---- } ! dest_bitmap = XCreatePixmap(mainDisplay,mainWindow,num_cols,num_rows,1); ! XSetForeground(mainDisplay, rotateGC, 0); ! XFillRectangle(mainDisplay,dest_bitmap,rotateGC,0,0,num_cols,num_rows); ! dest_image = XGetImage(mainDisplay, dest_bitmap, 0, 0, num_cols, num_rows, 1, ZPixmap); ! if (!flat && !skinny) { ! if (ObjPtr->ctm == NULL) { mtrx.image_w = (float)w; mtrx.image_h = (float)h; *************** *** 752,763 **** mtrx.flip = NO_FLIP; ! CalcTransform (&mtrx); start_col = (mtrx.transformed_w >= 0.0) ? 0 : (-num_cols)+1; start_row = (mtrx.transformed_h >= 0.0) ? 0 : (-num_rows)+1; ! for (r = 0; r < num_rows; r++) ! { ! float part_x, part_y; if (do_msg && ((r & 0xf) == 0)) { --- 713,723 ---- mtrx.flip = NO_FLIP; ! CalcTransform(&mtrx); start_col = (mtrx.transformed_w >= 0.0) ? 0 : (-num_cols)+1; start_row = (mtrx.transformed_h >= 0.0) ? 0 : (-num_rows)+1; ! for (r=0; r < num_rows; r++) { ! float part_x, part_y; if (do_msg && ((r & 0xf) == 0)) { *************** *** 770,792 **** part_x = (r+start_row)*mtrx.rev_m[1][0]; part_y = (r+start_row)*mtrx.rev_m[1][1]; ! for (c = 0; c < num_cols; c++) ! { ! int x, y; x = (int)((c+start_col)*mtrx.rev_m[0][0]+part_x); y = (int)((c+start_col)*mtrx.rev_m[0][1]+part_y); ! if (x>=0 && x=0 && ybbox.ltx+1-ObjPtr->x; ! int abs_offset_y=ObjPtr->bbox.lty+1-ObjPtr->y; ! ! for (r = 0; r < num_rows; r++) ! { ! int y=abs_offset_y+ABS_SIZE(r); if (do_msg && ((r & 0xf) == 0)) { --- 730,749 ---- part_x = (r+start_row)*mtrx.rev_m[1][0]; part_y = (r+start_row)*mtrx.rev_m[1][1]; ! for (c=0; c < num_cols; c++) { ! int x, y; x = (int)((c+start_col)*mtrx.rev_m[0][0]+part_x); y = (int)((c+start_col)*mtrx.rev_m[0][1]+part_y); ! if (x>=0 && x=0 && ybbox.ltx+1-ObjPtr->x; ! int abs_offset_y=ObjPtr->bbox.lty+1-ObjPtr->y; ! ! for (r=0; r < num_rows; r++) { ! int y=abs_offset_y+ABS_SIZE(r); if (do_msg && ((r & 0xf) == 0)) { *************** *** 797,815 **** XSync(mainDisplay, False); } ! for (c = 0; c < num_cols; c++) ! { ! int x=abs_offset_x+ABS_SIZE(c); ! int new_x, new_y; ! ReverseTransformPointThroughCTM (x, y, ObjPtr->ctm, &new_x, &new_y); new_x += ObjPtr->x-ObjPtr->detail.t->orig_bbox.ltx; new_y += ObjPtr->y-ObjPtr->detail.t->orig_bbox.lty; if (new_x>=0 && new_x=0 && new_ycached_ctm,ObjPtr->ctm,sizeof(struct XfrmMtrxRec)); } } --- 754,772 ---- XSync(mainDisplay, False); } ! for (c=0; c < num_cols; c++) { ! int x=abs_offset_x+ABS_SIZE(c); ! int new_x, new_y; ! ReverseTransformPointThroughCTM(x, y, ObjPtr->ctm, &new_x, &new_y); new_x += ObjPtr->x-ObjPtr->detail.t->orig_bbox.ltx; new_y += ObjPtr->y-ObjPtr->detail.t->orig_bbox.lty; if (new_x>=0 && new_x=0 && new_ycached_ctm,ObjPtr->ctm,sizeof(struct XfrmMtrxRec)); } } *************** *** 818,822 **** XSync(mainDisplay, False); } ! XPutImage (mainDisplay, dest_bitmap, rotateGC, dest_image, 0, 0, 0, 0, num_cols, num_rows); if (do_msg) RestoreStatusStrings(); --- 775,779 ---- XSync(mainDisplay, False); } ! XPutImage(mainDisplay, dest_bitmap, rotateGC, dest_image, 0, 0, 0, 0, num_cols, num_rows); if (do_msg) RestoreStatusStrings(); *************** *** 826,839 **** text_ptr->cached_zoom = zoomScale; text_ptr->cached_rotate = rotate; ! XDestroyImage (src_image); ! XDestroyImage (dest_image); ! if (!watch_cursor) ! { ! SetDefaultCursor (mainWindow); ! ShowCursor (); } } static struct ObjRec *SubFindTextObj(ObjPtr, XOff, YOff, obj_to_be_found) --- 783,825 ---- text_ptr->cached_zoom = zoomScale; text_ptr->cached_rotate = rotate; ! XDestroyImage(src_image); ! XDestroyImage(dest_image); ! if (!watch_cursor) { ! SetDefaultCursor(mainWindow); ! ShowCursor(); } } + void CleanOuterInnerSel() + { + register struct SelRec *sel_ptr, *next_sel; + + if (outerSel != NULL) { + for (sel_ptr=outerSel; sel_ptr != NULL; sel_ptr=next_sel) { + next_sel = sel_ptr->next; + free(sel_ptr); + } + outerSel = innerSel = NULL; + } + } + + void UpdateOuterInnerSel(obj_ptr) + struct ObjRec *obj_ptr; + { + struct SelRec *sel_ptr=(struct SelRec *)malloc(sizeof(struct SelRec)); + + if (sel_ptr == NULL) FailAllocMessage(); + sel_ptr->obj = obj_ptr; + sel_ptr->prev = NULL; + sel_ptr->next = outerSel; + if (outerSel == NULL) { + innerSel = sel_ptr; + } else { + outerSel->prev = sel_ptr; + } + outerSel = sel_ptr; + } + static struct ObjRec *SubFindTextObj(ObjPtr, XOff, YOff, obj_to_be_found) *************** *** 844,848 **** register struct AttrRec *attr_ptr; struct ObjRec *found_text_obj; - struct SelRec *sel_ptr; for (obj_ptr=ObjPtr->detail.r->first; obj_ptr!=NULL; obj_ptr=obj_ptr->next) { --- 830,833 ---- *************** *** 854,861 **** XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! return (obj_ptr); } else { attr_ptr = obj_ptr->fattr; ! for (; attr_ptr != NULL; attr_ptr = attr_ptr->next) { if (XOff>=OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff>=OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && --- 839,846 ---- XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! return obj_ptr; } else { attr_ptr = obj_ptr->fattr; ! for (; attr_ptr != NULL; attr_ptr=attr_ptr->next) { if (XOff>=OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff>=OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && *************** *** 863,867 **** YOff<=OFFSET_Y(attr_ptr->obj->bbox.rby)+3 && attr_ptr->shown == TRUE) { ! return (attr_ptr->obj); } } --- 848,852 ---- YOff<=OFFSET_Y(attr_ptr->obj->bbox.rby)+3 && attr_ptr->shown == TRUE) { ! return attr_ptr->obj; } } *************** *** 878,893 **** if ((found_text_obj=SubFindTextObj(obj_ptr, XOff, YOff, obj_to_be_found)) != NULL) { ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! sel_ptr->obj = obj_ptr; ! sel_ptr->prev = NULL; ! sel_ptr->next = outerSel; ! if (outerSel == NULL) { ! innerSel = sel_ptr; ! } else { ! outerSel->prev = sel_ptr; ! } ! outerSel = sel_ptr; ! return (found_text_obj); } } --- 863,868 ---- if ((found_text_obj=SubFindTextObj(obj_ptr, XOff, YOff, obj_to_be_found)) != NULL) { ! UpdateOuterInnerSel(obj_ptr); ! return found_text_obj; } } *************** *** 895,904 **** } else { if (obj_ptr == obj_to_be_found) { ! return (obj_ptr); } else { attr_ptr = obj_ptr->fattr; ! for (; attr_ptr != NULL; attr_ptr = attr_ptr->next) { if (attr_ptr->obj == obj_to_be_found) { ! return (attr_ptr->obj); } } --- 870,879 ---- } else { if (obj_ptr == obj_to_be_found) { ! return obj_ptr; } else { attr_ptr = obj_ptr->fattr; ! for (; attr_ptr != NULL; attr_ptr=attr_ptr->next) { if (attr_ptr->obj == obj_to_be_found) { ! return attr_ptr->obj; } } *************** *** 911,926 **** if ((found_text_obj=SubFindTextObj(obj_ptr, XOff, YOff, obj_to_be_found)) != NULL) { ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! sel_ptr->obj = obj_ptr; ! sel_ptr->prev = NULL; ! sel_ptr->next = outerSel; ! if (outerSel == NULL) { ! innerSel = sel_ptr; ! } else { ! outerSel->prev = sel_ptr; ! } ! outerSel = sel_ptr; ! return (found_text_obj); } } --- 886,891 ---- if ((found_text_obj=SubFindTextObj(obj_ptr, XOff, YOff, obj_to_be_found)) != NULL) { ! UpdateOuterInnerSel(obj_ptr); ! return found_text_obj; } } *************** *** 930,947 **** } - static - void CleanOuterInnerSel() - { - register struct SelRec *sel_ptr, *next_sel; - - if (outerSel != NULL) { - for (sel_ptr = outerSel; sel_ptr != NULL; sel_ptr = next_sel) { - next_sel = sel_ptr->next; - free(sel_ptr); - } - outerSel = innerSel = NULL; - } - } - struct ObjRec *FindTextObj(XOff, YOff, obj_to_be_found) int XOff, YOff; --- 895,898 ---- *************** *** 952,960 **** register struct AttrRec *attr_ptr; struct ObjRec *found_text_obj; - struct SelRec *sel_ptr; CleanOuterInnerSel(); ! for (obj_ptr = topObj; obj_ptr != NULL; obj_ptr = obj_ptr->next) { obj_ptr->tmp_parent = NULL; if (colorLayers && !ObjInVisibleLayer(obj_ptr)) { --- 903,910 ---- register struct AttrRec *attr_ptr; struct ObjRec *found_text_obj; CleanOuterInnerSel(); ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=obj_ptr->next) { obj_ptr->tmp_parent = NULL; if (colorLayers && !ObjInVisibleLayer(obj_ptr)) { *************** *** 967,974 **** XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! return (obj_ptr); } else { attr_ptr = obj_ptr->fattr; ! for (; attr_ptr != NULL; attr_ptr = attr_ptr->next) { if (XOff>=OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff>=OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && --- 917,924 ---- XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! return obj_ptr; } else { attr_ptr = obj_ptr->fattr; ! for (; attr_ptr != NULL; attr_ptr=attr_ptr->next) { if (XOff>=OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff>=OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && *************** *** 976,980 **** YOff<=OFFSET_Y(attr_ptr->obj->bbox.rby)+3 && attr_ptr->shown == TRUE) { ! return (attr_ptr->obj); } } --- 926,930 ---- YOff<=OFFSET_Y(attr_ptr->obj->bbox.rby)+3 && attr_ptr->shown == TRUE) { ! return attr_ptr->obj; } } *************** *** 994,1009 **** } else if ((found_text_obj=SubFindTextObj(obj_ptr, XOff, YOff, obj_to_be_found)) != NULL) { ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! sel_ptr->obj = obj_ptr; ! sel_ptr->prev = NULL; ! sel_ptr->next = outerSel; ! if (outerSel == NULL) { ! innerSel = sel_ptr; ! } else { ! outerSel->prev = sel_ptr; ! } ! outerSel = sel_ptr; ! return (found_text_obj); } } --- 944,949 ---- } else if ((found_text_obj=SubFindTextObj(obj_ptr, XOff, YOff, obj_to_be_found)) != NULL) { ! UpdateOuterInnerSel(obj_ptr); ! return found_text_obj; } } *************** *** 1011,1020 **** } else { if (obj_ptr == obj_to_be_found) { ! return (obj_ptr); } else { attr_ptr = obj_ptr->fattr; ! for (; attr_ptr != NULL; attr_ptr = attr_ptr->next) { if (attr_ptr->obj == obj_to_be_found) { ! return (attr_ptr->obj); } } --- 951,960 ---- } else { if (obj_ptr == obj_to_be_found) { ! return obj_ptr; } else { attr_ptr = obj_ptr->fattr; ! for (; attr_ptr != NULL; attr_ptr=attr_ptr->next) { if (attr_ptr->obj == obj_to_be_found) { ! return attr_ptr->obj; } } *************** *** 1030,1066 **** } else if ((found_text_obj=SubFindTextObj(obj_ptr, XOff, YOff, obj_to_be_found)) != NULL) { ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! sel_ptr->obj = obj_ptr; ! sel_ptr->prev = NULL; ! sel_ptr->next = outerSel; ! if (outerSel == NULL) { ! innerSel = sel_ptr; ! } else { ! outerSel->prev = sel_ptr; ! } ! outerSel = sel_ptr; ! return (found_text_obj); } } } } ! return (NULL); } ! void UnlinkCurTextFromInnerSel () { ! register struct GroupRec * group_obj=innerSel->obj->detail.r; ! if (group_obj->first == group_obj->last) ! { ! if (outerSel != innerSel || innerSel->obj->fattr != NULL) ! { ! Msg ("Error! The text object within a composite object which you"); ! Msg (" have just erased caused all ancestors to be deleted."); ! Msg (" You may see ghost images now!"); ! Msg (" Please undo and try ungroup the ancestor object first"); ! Msg (" before erasing the text."); ! fprintf (stderr, "%s\n%s\n%s\n%s\n%s\n", "Error! The text object within a composite object which you", " have just erased caused all ancestors to be deleted.", --- 970,994 ---- } else if ((found_text_obj=SubFindTextObj(obj_ptr, XOff, YOff, obj_to_be_found)) != NULL) { ! UpdateOuterInnerSel(obj_ptr); ! return found_text_obj; } } } } ! return NULL; } ! void UnlinkCurTextFromInnerSel() { ! register struct GroupRec *group_obj=innerSel->obj->detail.r; ! if (group_obj->first == group_obj->last) { ! if (outerSel != innerSel || innerSel->obj->fattr != NULL) { ! Msg("Error! The text object within a composite object which you"); ! Msg(" have just erased caused all ancestors to be deleted."); ! Msg(" You may see ghost images now!"); ! Msg(" Please undo and try ungroup the ancestor object first"); ! Msg(" before erasing the text."); ! fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", "Error! The text object within a composite object which you", " have just erased caused all ancestors to be deleted.", *************** *** 1069,1089 **** " before erasing the text."); } ! DelObj (outerSel->obj); ! CleanOuterInnerSel (); curTextObj = NULL; return; ! } ! else if (curTextObj == group_obj->first) ! { curTextObj->next->prev = NULL; group_obj->first = curTextObj->next; ! } ! else if (curTextObj == group_obj->last) ! { curTextObj->prev->next = NULL; group_obj->last = curTextObj->prev; ! } ! else ! { curTextObj->prev->next = curTextObj->next; curTextObj->next->prev = curTextObj->prev; --- 997,1011 ---- " before erasing the text."); } ! DelObj(outerSel->obj); ! CleanOuterInnerSel(); curTextObj = NULL; return; ! } else if (curTextObj == group_obj->first) { curTextObj->next->prev = NULL; group_obj->first = curTextObj->next; ! } else if (curTextObj == group_obj->last) { curTextObj->prev->next = NULL; group_obj->last = curTextObj->prev; ! } else { curTextObj->prev->next = curTextObj->next; curTextObj->next->prev = curTextObj->prev; *************** *** 1092,1116 **** } ! void AdjAncestorsBBox () { ! register struct SelRec * sel_ptr; ! for (sel_ptr = innerSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) ! AdjObjBBox (sel_ptr->obj); } static ! void DumpTextPath (FP, ObjPtr, TextPtr) ! FILE * FP; ! register struct ObjRec * ObjPtr; ! register struct TextRec * TextPtr; { ! int x, y, xinc = 0, yinc = 0; ! struct StrRec * s_ptr; x = ObjPtr->x; y = ObjPtr->y; ! fprintf (FP, " gsave\n"); if (ObjPtr->ctm != NULL) { float m[6]; --- 1014,1039 ---- } ! void AdjAncestorsBBox() { ! register struct SelRec *sel_ptr; ! for (sel_ptr=innerSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { ! AdjObjBBox(sel_ptr->obj); ! } } static ! void DumpTextPath(FP, ObjPtr, TextPtr) ! FILE *FP; ! register struct ObjRec *ObjPtr; ! register struct TextRec *TextPtr; { ! int x, y, xinc=0, yinc=0; ! struct StrRec *s_ptr; x = ObjPtr->x; y = ObjPtr->y; ! fprintf(FP, " gsave\n"); if (ObjPtr->ctm != NULL) { float m[6]; *************** *** 1120,1236 **** m[CTM_SIN] = ((float)ObjPtr->ctm->m[CTM_SIN])/((float)1000.0); m[CTM_MSIN] = ((float)ObjPtr->ctm->m[CTM_MSIN])/((float)1000.0); ! fprintf (FP, " %1d %1d translate\n", ObjPtr->x, ObjPtr->y); ! fprintf (FP, " [%.3f %.3f %.3f %.3f %1d %1d] concat\n", m[CTM_SX], m[CTM_SIN], m[CTM_MSIN], m[CTM_SY], ObjPtr->ctm->m[CTM_TX], ObjPtr->ctm->m[CTM_TY]); x = y = 0; } ! switch (penPat) ! { ! case SOLIDPAT: break; ! case BACKPAT: fprintf (FP, " 1 setgray\n"); break; ! default: ! if (!colorDump && useGray) ! { ! GrayCheck (penPat); ! fprintf (FP, " %s setgray\n", GrayStr(penPat)); ! } ! break; ! } ! ! switch (curRotate) ! { ! case ROTATE0: xinc = 0; yinc = textCursorH+textVSpace; break; ! case ROTATE90: xinc = -(textCursorH+textVSpace); yinc = 0; break; ! case ROTATE180: xinc = 0; yinc = -(textCursorH+textVSpace); break; ! case ROTATE270: xinc = textCursorH+textVSpace; yinc = 0; break; } ! for (s_ptr = TextPtr->first; s_ptr != NULL; s_ptr = s_ptr->next) ! { ! switch (curRotate) ! { ! case ROTATE0: ! fprintf (FP, " %1d %1d moveto (", x, y+canvasFontAsc); break; ! case ROTATE90: ! fprintf (FP, " %1d %1d moveto 90 rotate (",x-canvasFontAsc,y); break; ! case ROTATE180: ! fprintf (FP, " %1d %1d moveto 180 rotate (",x,y-canvasFontAsc); break; ! case ROTATE270: ! fprintf (FP, " %1d %1d moveto 270 rotate (",x+canvasFontAsc,y); break; - } - DumpOneStr (FP, curFont, s_ptr->dyn_str.s); - if ((colorDump || !useGray) && penPat > BACKPAT) - { - switch (textJust) - { - case JUST_L: fprintf(FP,") "); break; - case JUST_C: - if (preDumpSetup) PSUseCenterText(); - fprintf(FP,") tgifcentertext "); - break; - case JUST_R: - if (preDumpSetup) PSUseRightText(); - fprintf(FP,") tgifrighttext "); - break; } - fprintf(FP,"true charpath clip newpath\n"); } ! else ! { ! switch (textJust) ! { ! case JUST_L: fprintf (FP, ") show\n"); break; ! case JUST_C: ! if (preDumpSetup) PSUseCenterText(); ! fprintf (FP, ") tgifcentertext show\n"); ! break; ! case JUST_R: ! if (preDumpSetup) PSUseRightText(); ! fprintf (FP, ") tgifrighttext show\n"); ! break; ! } ! } ! switch (curRotate) ! { ! case ROTATE0: break; ! case ROTATE90: fprintf (FP, " -90 rotate \n"); break; ! case ROTATE180: fprintf (FP, " -180 rotate \n"); break; ! case ROTATE270: fprintf (FP, " -270 rotate \n"); break; } ! if ((colorDump || !useGray) && penPat > BACKPAT) ! { if (preDumpSetup) PSUseColorPattern(); ! DumpPatFill (FP, penPat, 8, ObjPtr->bbox, " "); } if (penPat != SOLIDPAT && penPat != BACKPAT && s_ptr->next != NULL && ! (colorDump || !useGray)) ! { ! fprintf (FP, " grestore\n"); ! fprintf (FP, " gsave\n"); } x += xinc; y += yinc; } ! fprintf (FP, " grestore\n"); } ! void DumpTextObj (FP, ObjPtr) ! FILE * FP; ! register struct ObjRec * ObjPtr; { ! int color_index, fill; ! int ltx, lty, rbx, rby; ! char font_str[MAXSTRING]; ! struct TextRec * text_ptr = ObjPtr->detail.t; if (text_ptr->pen == NONEPAT && text_ptr->fill == NONEPAT) return; ! fprintf (FP, "%% TEXT\n"); ! if (!PRTGIF) SaveCurFont (); curFont = text_ptr->font; --- 1043,1145 ---- m[CTM_SIN] = ((float)ObjPtr->ctm->m[CTM_SIN])/((float)1000.0); m[CTM_MSIN] = ((float)ObjPtr->ctm->m[CTM_MSIN])/((float)1000.0); ! fprintf(FP, " %1d %1d translate\n", ObjPtr->x, ObjPtr->y); ! fprintf(FP, " [%.3f %.3f %.3f %.3f %1d %1d] concat\n", m[CTM_SX], m[CTM_SIN], m[CTM_MSIN], m[CTM_SY], ObjPtr->ctm->m[CTM_TX], ObjPtr->ctm->m[CTM_TY]); x = y = 0; } ! switch (penPat) { ! case SOLIDPAT: break; ! case BACKPAT: fprintf(FP, " 1 setgray\n"); break; ! default: ! if (!colorDump && useGray) { ! GrayCheck(penPat); ! fprintf(FP, " %s setgray\n", GrayStr(penPat)); ! } ! break; ! } ! ! switch (curRotate) { ! case ROTATE0: xinc = 0; yinc = textCursorH+textVSpace; break; ! case ROTATE90: xinc = -(textCursorH+textVSpace); yinc = 0; break; ! case ROTATE180: xinc = 0; yinc = -(textCursorH+textVSpace); break; ! case ROTATE270: xinc = textCursorH+textVSpace; yinc = 0; break; } ! for (s_ptr=TextPtr->first; s_ptr != NULL; s_ptr=s_ptr->next) { ! switch (curRotate) { ! case ROTATE0: ! fprintf(FP, " %1d %1d moveto (", x, y+canvasFontAsc); ! break; ! case ROTATE90: ! fprintf(FP, " %1d %1d moveto 90 rotate (",x-canvasFontAsc,y); ! break; ! case ROTATE180: ! fprintf(FP, " %1d %1d moveto 180 rotate (",x,y-canvasFontAsc); ! break; ! case ROTATE270: ! fprintf(FP, " %1d %1d moveto 270 rotate (",x+canvasFontAsc,y); ! break; ! } ! DumpOneStr(FP, curFont, s_ptr->dyn_str.s); ! if ((colorDump || !useGray) && penPat > BACKPAT) { ! switch (textJust) { ! case JUST_L: fprintf(FP,") "); break; ! case JUST_C: ! if (preDumpSetup) PSUseCenterText(); ! fprintf(FP,") tgifcentertext "); break; ! case JUST_R: ! if (preDumpSetup) PSUseRightText(); ! fprintf(FP,") tgifrighttext "); break; ! } ! fprintf(FP,"true charpath clip newpath\n"); ! } else { ! switch (textJust) { ! case JUST_L: fprintf(FP, ") show\n"); break; ! case JUST_C: ! if (preDumpSetup) PSUseCenterText(); ! fprintf(FP, ") tgifcentertext show\n"); break; ! case JUST_R: ! if (preDumpSetup) PSUseRightText(); ! fprintf(FP, ") tgifrighttext show\n"); break; } } ! switch (curRotate) { ! case ROTATE0: break; ! case ROTATE90: fprintf(FP, " -90 rotate \n"); break; ! case ROTATE180: fprintf(FP, " -180 rotate \n"); break; ! case ROTATE270: fprintf(FP, " -270 rotate \n"); break; } ! if ((colorDump || !useGray) && penPat > BACKPAT) { if (preDumpSetup) PSUseColorPattern(); ! DumpPatFill(FP, penPat, 8, ObjPtr->bbox, " "); } if (penPat != SOLIDPAT && penPat != BACKPAT && s_ptr->next != NULL && ! (colorDump || !useGray)) { ! fprintf(FP, " grestore\n"); ! fprintf(FP, " gsave\n"); } x += xinc; y += yinc; } ! fprintf(FP, " grestore\n"); } ! void DumpTextObj(FP, ObjPtr) ! FILE *FP; ! register struct ObjRec *ObjPtr; { ! int color_index, fill, ltx, lty, rbx, rby; ! char font_str[MAXSTRING]; ! struct TextRec *text_ptr=ObjPtr->detail.t; if (text_ptr->pen == NONEPAT && text_ptr->fill == NONEPAT) return; ! fprintf(FP, "%% TEXT\n"); ! if (!PRTGIF) SaveCurFont(); curFont = text_ptr->font; *************** *** 1244,1256 **** fill = text_ptr->fill; ! if (PRTGIF || text_ptr->read_only) ! { canvasFontAsc = text_ptr->asc; canvasFontDes = text_ptr->des; textCursorH = canvasFontAsc + canvasFontDes; } - else - SetCanvasFont (); - color_index = ObjPtr->color; DumpRGBColorLine(FP, color_index, 0, TRUE); --- 1153,1163 ---- fill = text_ptr->fill; ! if (PRTGIF || text_ptr->read_only) { canvasFontAsc = text_ptr->asc; canvasFontDes = text_ptr->des; textCursorH = canvasFontAsc + canvasFontDes; + } else { + SetCanvasFont(); } color_index = ObjPtr->color; DumpRGBColorLine(FP, color_index, 0, TRUE); *************** *** 1275,1396 **** m[CTM_SIN] = ((float)ObjPtr->ctm->m[CTM_SIN])/((float)1000.0); m[CTM_MSIN] = ((float)ObjPtr->ctm->m[CTM_MSIN])/((float)1000.0); ! fprintf (FP, " %1d %1d translate\n", ObjPtr->x, ObjPtr->y); ! fprintf (FP, " [%.3f %.3f %.3f %.3f %1d %1d] concat\n", m[CTM_SX], m[CTM_SIN], m[CTM_MSIN], m[CTM_SY], ObjPtr->ctm->m[CTM_TX], ObjPtr->ctm->m[CTM_TY]); ! fprintf (FP, " %1d neg %1d neg translate\n", ObjPtr->x, ObjPtr->y); } ! switch (fill) ! { ! case NONEPAT: break; ! case SOLIDPAT: ! fprintf (FP, "newpath\n"); ! fprintf (FP, " %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); ! fprintf (FP, "closepath fill\n"); ! break; ! case BACKPAT: ! fprintf (FP, "newpath\n"); ! fprintf (FP, " %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); ! fprintf (FP, "closepath 1 setgray fill\n"); ! DumpRGBColorLine(FP, color_index, 0, TRUE); ! break; ! default: ! /* patterned */ ! fprintf (FP, "gsave\n"); ! if (colorDump || !useGray) ! { ! fprintf (FP, " newpath\n"); ! fprintf (FP, " %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); ! fprintf (FP, " closepath 1 setgray fill\n"); ! DumpRGBColorLine(FP, color_index, 3, TRUE); ! } ! else ! { ! GrayCheck (fill); ! fprintf (FP, " %s setgray\n", GrayStr(fill)); ! } ! fprintf (FP, " newpath\n"); ! fprintf (FP, " %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); ! if (colorDump || !useGray) ! { ! if (preDumpSetup) PSUseColorPattern(); ! fprintf (FP, " closepath eoclip newpath\n"); ! DumpPatFill (FP, fill, 8, ObjPtr->bbox, " "); ! } ! else ! fprintf (FP, " closepath fill\n"); ! fprintf (FP, "grestore\n"); ! break; } if (ObjPtr->ctm != NULL) fprintf(FP, "grestore\n"); ! if (penPat == NONEPAT) ! { ! fprintf (FP, "\n"); ! if (!PRTGIF) RestoreCurFont (); return; } ! if ((colorDump || !useGray) && penPat>BACKPAT && curFont==FONT_COU) ! { ! if (PRTGIF) ! fprintf (stderr, "Warning: %s %s\n", "Printing Courier fonts with non-solid pen in color.", "May cause error!"); ! else ! { ! sprintf (gszMsgBox, "Warning: %s", "Printing Courier fonts with non-solid pen in color."); ! TwoLineMsg (gszMsgBox, " May cause error!"); } } ! if (PRTGIF && text_ptr->font_name != NULL) ! sprintf (font_str, "/%s", text_ptr->font_name); ! else ! GetPSFontStr (curFont, curStyle, font_str); ! fprintf (FP, "%s", font_str); ! ! if (NeedEncode (curFont, curStyle)) ! fprintf (FP, "-8 "); ! else ! fprintf (FP, " "); ! UpdateDocumentFonts (&font_str[1]); ! fprintf (FP, "findfont [%1d 0 0 -%1d 0 0] makefont setfont\n", curSize, curSize); ! if ((colorDump || !useGray) && penPat > BACKPAT) ! { int tmp_pen = penPat; penPat = BACKPAT; ! DumpTextPath (FP, ObjPtr, text_ptr); DumpRGBColorLine(FP, color_index, 3, TRUE); penPat = tmp_pen; } ! DumpTextPath (FP, ObjPtr, text_ptr); ! fprintf (FP, "\n"); ! if (!PRTGIF) RestoreCurFont (); } ! int NeedsToCacheTextObj (ObjPtr) ! struct ObjRec * ObjPtr; { ! register struct TextRec * text_ptr = ObjPtr->detail.t; return (ObjPtr->ctm != NULL || zoomScale != 0 || --- 1182,1295 ---- m[CTM_SIN] = ((float)ObjPtr->ctm->m[CTM_SIN])/((float)1000.0); m[CTM_MSIN] = ((float)ObjPtr->ctm->m[CTM_MSIN])/((float)1000.0); ! fprintf(FP, " %1d %1d translate\n", ObjPtr->x, ObjPtr->y); ! fprintf(FP, " [%.3f %.3f %.3f %.3f %1d %1d] concat\n", m[CTM_SX], m[CTM_SIN], m[CTM_MSIN], m[CTM_SY], ObjPtr->ctm->m[CTM_TX], ObjPtr->ctm->m[CTM_TY]); ! fprintf(FP, " %1d neg %1d neg translate\n", ObjPtr->x, ObjPtr->y); } ! switch (fill) { ! case NONEPAT: break; ! case SOLIDPAT: ! fprintf(FP, "newpath\n"); ! fprintf(FP, " %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); ! fprintf(FP, "closepath fill\n"); ! break; ! case BACKPAT: ! fprintf(FP, "newpath\n"); ! fprintf(FP, " %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); ! fprintf(FP, "closepath 1 setgray fill\n"); ! DumpRGBColorLine(FP, color_index, 0, TRUE); ! break; ! default: ! /* patterned */ ! fprintf(FP, "gsave\n"); ! if (colorDump || !useGray) { ! fprintf(FP, " newpath\n"); ! fprintf(FP, " %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); ! fprintf(FP, " closepath 1 setgray fill\n"); ! DumpRGBColorLine(FP, color_index, 3, TRUE); ! } else { ! GrayCheck(fill); ! fprintf(FP, " %s setgray\n", GrayStr(fill)); ! } ! fprintf(FP, " newpath\n"); ! fprintf(FP, " %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); ! if (colorDump || !useGray) { ! if (preDumpSetup) PSUseColorPattern(); ! fprintf(FP, " closepath eoclip newpath\n"); ! DumpPatFill(FP, fill, 8, ObjPtr->bbox, " "); ! } else { ! fprintf(FP, " closepath fill\n"); ! } ! fprintf(FP, "grestore\n"); ! break; } if (ObjPtr->ctm != NULL) fprintf(FP, "grestore\n"); ! if (penPat == NONEPAT) { ! fprintf(FP, "\n"); ! if (!PRTGIF) RestoreCurFont(); return; } ! if ((colorDump || !useGray) && penPat>BACKPAT && curFont==FONT_COU) { ! if (PRTGIF) { ! fprintf(stderr, "Warning: %s %s\n", "Printing Courier fonts with non-solid pen in color.", "May cause error!"); ! } else { ! sprintf(gszMsgBox, "Warning: %s", "Printing Courier fonts with non-solid pen in color."); ! TwoLineMsg(gszMsgBox, " May cause error!"); } } ! if (PRTGIF && text_ptr->font_name != NULL) { ! sprintf(font_str, "/%s", text_ptr->font_name); ! } else { ! GetPSFontStr(curFont, curStyle, font_str); ! } ! fprintf(FP, "%s", font_str); ! if (NeedEncode(curFont, curStyle)) { ! fprintf(FP, "-8 "); ! } else { ! fprintf(FP, " "); ! } ! UpdateDocumentFonts(&font_str[1]); ! fprintf(FP, "findfont [%1d 0 0 -%1d 0 0] makefont setfont\n", curSize, curSize); ! if ((colorDump || !useGray) && penPat > BACKPAT) { int tmp_pen = penPat; penPat = BACKPAT; ! DumpTextPath(FP, ObjPtr, text_ptr); DumpRGBColorLine(FP, color_index, 3, TRUE); penPat = tmp_pen; } ! DumpTextPath(FP, ObjPtr, text_ptr); ! fprintf(FP, "\n"); ! if (!PRTGIF) RestoreCurFont(); } ! int NeedsToCacheTextObj(ObjPtr) ! struct ObjRec *ObjPtr; { ! register struct TextRec *text_ptr=ObjPtr->detail.t; return (ObjPtr->ctm != NULL || zoomScale != 0 || *************** *** 1399,1446 **** } ! void SaveString (FP, S) ! FILE * FP; ! register char * S; { ! for ( ; *S != '\0'; S++) ! { ! if (*S == '\\') ! { ! if (fprintf (FP, "%s", "\\\\") == EOF) writeFileFailed = TRUE; ! } ! else if (*S == '"') ! { ! if (doubleQuoteDoubleQuote) ! { ! if (fprintf (FP, "%s", "\"\"") == EOF) writeFileFailed = TRUE; ! } ! else ! { ! if (fprintf (FP, "%s", "\\\"") == EOF) writeFileFailed = TRUE; } } - else if ((*S) & 0x80) - { - if (fprintf (FP, "\\%o", (*S)&0xff) == EOF) writeFileFailed = TRUE; - } - else - if (fputc (*S, FP) == EOF) writeFileFailed = TRUE; } } ! void SaveTextObj (FP, ObjPtr) ! FILE * FP; ! struct ObjRec * ObjPtr; { ! register struct TextRec * text_ptr = ObjPtr->detail.t; ! register struct StrRec * s_ptr; ! char font_str[MAXSTRING]; ! int compressed=FALSE; ! GetPSFontStr (text_ptr->font, text_ptr->style, font_str); /* font_str starts with the '/' character */ ! if (fprintf (FP, "text('%s',", colorMenuItems[ObjPtr->color]) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,'%s',%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,\"%s\",%1d,%1d,%1d,[\n", ObjPtr->x, ObjPtr->y, &font_str[1], text_ptr->style, text_ptr->size, --- 1298,1337 ---- } ! void SaveString(FP, S) ! FILE *FP; ! register char *S; { ! for ( ; *S != '\0'; S++) { ! if (*S == '\\') { ! if (fprintf(FP, "%s", "\\\\") == EOF) writeFileFailed = TRUE; ! } else if (*S == '"') { ! if (doubleQuoteDoubleQuote) { ! if (fprintf(FP, "%s", "\"\"") == EOF) writeFileFailed = TRUE; ! } else { ! if (fprintf(FP, "%s", "\\\"") == EOF) writeFileFailed = TRUE; } + } else if ((*S) & 0x80) { + if (fprintf(FP, "\\%o", (*S)&0xff) == EOF) writeFileFailed = TRUE; + } else { + if (fputc(*S, FP) == EOF) writeFileFailed = TRUE; } } } ! void SaveTextObj(FP, ObjPtr) ! FILE *FP; ! struct ObjRec *ObjPtr; { ! register struct TextRec *text_ptr=ObjPtr->detail.t; ! register struct StrRec *s_ptr; ! char font_str[MAXSTRING]; ! int compressed=FALSE; ! GetPSFontStr(text_ptr->font, text_ptr->style, font_str); /* font_str starts with the '/' character */ ! if (fprintf(FP, "text('%s',", colorMenuItems[ObjPtr->color]) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,'%s',%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,\"%s\",%1d,%1d,%1d,[\n", ObjPtr->x, ObjPtr->y, &font_str[1], text_ptr->style, text_ptr->size, *************** *** 1469,1527 **** writeFileFailed = TRUE; } ! for (s_ptr = text_ptr->first; s_ptr->next != NULL; s_ptr = s_ptr->next) ! { ! if (fprintf (FP, "\t\"") == EOF) writeFileFailed = TRUE; ! SaveString (FP, s_ptr->dyn_str.s); ! if (fprintf (FP, "\",\n") == EOF) writeFileFailed = TRUE; } ! if (fprintf (FP, "\t\"") == EOF) writeFileFailed = TRUE; ! SaveString (FP, s_ptr->dyn_str.s); ! if (fprintf (FP, "\"])") == EOF) writeFileFailed = TRUE; } ! char * ReadString (Str) ! char * Str; { ! register char * s; ! for (s = Str; *s != '\0'; s++) ! if (*s == '"') ! { ! if (s[1] == '"') ! strcpy (s, s+1); ! else break; ! } ! else if (*s == '\\') ! { ! if (s[1] >= '0' && s[1] <= '3') ! { ! if (s[2] >= '0' && s[2] <= '7' && s[3] >= '0' && s[3] <= '7') ! { *s = (char)(((s[1]-'0')<<6)+((s[2]-'0')<<3)+(s[3]-'0')); ! strcpy (s+1, s+4); ! } ! else ! { ! if (PRTGIF) ! fprintf (stderr, "Bad octal string \\%c%c%c encountered.\n", s[1], s[2], s[3]); ! else ! { ! sprintf (gszMsgBox, "Bad octal string \\%c%c%c encountered.\n", s[1], s[2], s[3]); ! Msg (gszMsgBox); } ! strcpy (s, s+1); } } - else - strcpy (s, s+1); } ! if (*s == '"') s++; ! return (s); } --- 1360,1410 ---- writeFileFailed = TRUE; } ! for (s_ptr=text_ptr->first; s_ptr->next != NULL; s_ptr=s_ptr->next) { ! if (fprintf(FP, "\t\"") == EOF) writeFileFailed = TRUE; ! SaveString(FP, s_ptr->dyn_str.s); ! if (fprintf(FP, "\",\n") == EOF) writeFileFailed = TRUE; } ! if (fprintf(FP, "\t\"") == EOF) writeFileFailed = TRUE; ! SaveString(FP, s_ptr->dyn_str.s); ! if (fprintf(FP, "\"])") == EOF) writeFileFailed = TRUE; } ! char *ReadString(Str) ! char *Str; { ! register char *s; ! for (s=Str; *s != '\0'; s++) { ! if (*s == '"') { ! if (s[1] == '"') { ! strcpy(s, s+1); ! } else { break; ! } ! } else if (*s == '\\') { ! if (s[1] >= '0' && s[1] <= '3') { ! if (s[2] >= '0' && s[2] <= '7' && s[3] >= '0' && s[3] <= '7') { *s = (char)(((s[1]-'0')<<6)+((s[2]-'0')<<3)+(s[3]-'0')); ! strcpy(s+1, s+4); ! } else { ! if (PRTGIF) { ! fprintf(stderr, "Bad octal string \\%c%c%c encountered.\n", s[1], s[2], s[3]); ! } else { ! sprintf(gszMsgBox, "Bad octal string \\%c%c%c encountered.\n", s[1], s[2], s[3]); ! Msg(gszMsgBox); } ! strcpy(s, s+1); } + } else { + strcpy(s, s+1); } } ! } if (*s == '"') s++; ! return s; } *************** *** 1614,1653 **** static ! int PaintLeftText (Str, Just, Rotate, LtX, LtY) ! char * Str; ! int Just, Rotate, LtX, LtY; /* LtX and LtY are UNSCALED screen offset */ { ! register int amount; ! if (zoomScale != 0) ! { LtX = ZOOMED_SIZE(LtX); LtY = ZOOMED_SIZE(LtY); ! amount = XTextWidth (canvasFontPtr, Str, strlen (Str)); ! BlurText (drawWindow, drawGC, LtX, LtY, (zoomedIn ? ((amount<>zoomScale)+1), (zoomedIn ? (textCursorH<>zoomScale)+1)); ! return (amount); } LtY += canvasFontAsc; ! amount = XTextWidth (canvasFontPtr, Str, strlen (Str)); ! XDrawString (mainDisplay, drawWindow, drawGC, LtX, LtY, Str, strlen (Str)); ! return (amount); /* return the length of the painted string */ } ! void RepaintFirstStr (ObjPtr, Str) ! struct ObjRec * ObjPtr; ! char * Str; /* Replace (graphically) the FIRST string of the text in ObjPtr by Str */ { ! register char * s = ObjPtr->detail.t->first->dyn_str.s, * s1 = Str; ! char tmp_str[MAXSTRING+1], * c_ptr; ! int len; ! struct BBRec bbox; ! XGCValues values; bbox.ltx = ObjPtr->obbox.ltx; bbox.lty = ObjPtr->obbox.lty; --- 1497,1535 ---- static ! int PaintLeftText(Str, Just, Rotate, LtX, LtY) ! char *Str; ! int Just, Rotate, LtX, LtY; /* LtX and LtY are UNSCALED screen offset */ { ! register int amount; ! if (zoomScale != 0) { LtX = ZOOMED_SIZE(LtX); LtY = ZOOMED_SIZE(LtY); ! amount = XTextWidth(canvasFontPtr, Str, strlen(Str)); ! BlurText(drawWindow, drawGC, LtX, LtY, (zoomedIn ? ((amount<>zoomScale)+1), (zoomedIn ? (textCursorH<>zoomScale)+1)); ! return amount; } LtY += canvasFontAsc; ! amount = XTextWidth(canvasFontPtr, Str, strlen(Str)); ! XDrawString(mainDisplay, drawWindow, drawGC, LtX, LtY, Str, strlen(Str)); ! return amount; /* return the length of the painted string */ } ! void RepaintFirstStr(ObjPtr, Str) ! struct ObjRec *ObjPtr; ! char *Str; /* Replace (graphically) the FIRST string of the text in ObjPtr by Str */ { ! register char *s=ObjPtr->detail.t->first->dyn_str.s, *s1=Str; ! char tmp_str[MAXSTRING+1], *c_ptr; ! int len; ! struct BBRec bbox; ! XGCValues values; bbox.ltx = ObjPtr->obbox.ltx; bbox.lty = ObjPtr->obbox.lty; *************** *** 1661,1665 **** *c_ptr = '\0'; ! SaveCurFont (); curFont = ObjPtr->detail.t->font; curStyle = ObjPtr->detail.t->style; --- 1543,1547 ---- *c_ptr = '\0'; ! SaveCurFont(); curFont = ObjPtr->detail.t->font; curStyle = ObjPtr->detail.t->style; *************** *** 1668,1683 **** textVSpace = ObjPtr->detail.t->v_space; curRotate = ObjPtr->detail.t->rotate; ! SetCanvasFont (); ! if (*s != '\0') ! { values.foreground = GetDrawingBgPixel(INVALID, INVALID); values.function = GXcopy; values.fill_style = FillSolid; ! XChangeGC (mainDisplay, drawGC, GCForeground | GCFunction | GCFillStyle, &values); ! len = XTextWidth (canvasFontPtr, tmp_str, strlen (tmp_str)); ! XFillRectangle (mainDisplay, drawWindow, drawGC, OFFSET_X(bbox.ltx+len), OFFSET_Y(bbox.lty), (zoomedIn ? ((bbox.rbx-bbox.ltx-len)<detail.t->v_space; curRotate = ObjPtr->detail.t->rotate; ! SetCanvasFont(); ! if (*s != '\0') { values.foreground = GetDrawingBgPixel(INVALID, INVALID); values.function = GXcopy; values.fill_style = FillSolid; ! XChangeGC(mainDisplay, drawGC, GCForeground | GCFunction | GCFillStyle, &values); ! len = XTextWidth(canvasFontPtr, tmp_str, strlen(tmp_str)); ! XFillRectangle(mainDisplay, drawWindow, drawGC, OFFSET_X(bbox.ltx+len), OFFSET_Y(bbox.lty), (zoomedIn ? ((bbox.rbx-bbox.ltx-len)<color]; ! XChangeGC (mainDisplay, drawGC, GCForeground, &values); ! } ! else ! { values.foreground = colorPixels[ObjPtr->color]; values.function = GXcopy; values.fill_style = FillSolid; ! XChangeGC (mainDisplay, drawGC, GCForeground | GCFunction | GCFillStyle, &values); } ! ObjPtr->bbox.rbx = ObjPtr->obbox.rbx = bbox.ltx + PaintLeftText (Str, textJust, curRotate, bbox.ltx-drawOrigX, bbox.lty-drawOrigY); ! RestoreCurFont (); } --- 1568,1583 ---- values.foreground = colorPixels[ObjPtr->color]; ! XChangeGC(mainDisplay, drawGC, GCForeground, &values); ! } else { values.foreground = colorPixels[ObjPtr->color]; values.function = GXcopy; values.fill_style = FillSolid; ! XChangeGC(mainDisplay, drawGC, GCForeground | GCFunction | GCFillStyle, &values); } ! ObjPtr->bbox.rbx = ObjPtr->obbox.rbx = bbox.ltx + PaintLeftText(Str, textJust, curRotate, bbox.ltx-drawOrigX, bbox.lty-drawOrigY); ! RestoreCurFont(); } *** box.c.orig Tue Sep 30 13:22:45 1997 --- box.c Tue Sep 30 13:22:45 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/box.c,v 3.6 1997/01/30 19:24:51 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/box.c,v 3.7 1997/09/14 20:37:49 william Exp $ */ #include *** button.c.orig Tue Sep 30 13:22:46 1997 --- button.c Tue Sep 30 13:22:46 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/button.c,v 3.0 1996/05/06 16:03:56 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/button.c,v 3.1 1997/09/14 20:37:49 william Exp $ */ #include *** choice.c.orig Tue Sep 30 13:22:48 1997 --- choice.c Tue Sep 30 13:22:48 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/choice.c,v 3.8 1997/01/30 05:52:48 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/choice.c,v 3.11 1997/09/16 02:39:40 william Exp $ */ #include *************** *** 269,335 **** } ! void ShowWhereToPrint () { ! if (colorDump) ! XSetForeground (mainDisplay, rasterGC, colorPixels[colorIndex]); ! XSetStipple (mainDisplay, rasterGC, whereToPrintPixmap[whereToPrint]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, PRINT_COL*choiceImageW, PRINT_ROW*choiceImageH, choiceImageW, choiceImageH); ! if (colorDump) XSetForeground (mainDisplay, rasterGC, myFgPixel); } ! void ShowMode () { ! XSetStipple (mainDisplay, rasterGC, choicePixmap[curChoice]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, MODE_COL*choiceImageW, MODE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowColor (PropagateWhereToPrint) int PropagateWhereToPrint; { XGCValues values; ! if (colorDisplay) ! { values.foreground = colorPixels[colorIndex]; values.function = GXcopy; values.fill_style = FillOpaqueStippled; values.stipple = patPixmap[1]; ! XChangeGC (mainDisplay, patGC, GCForeground | GCFunction | GCFillStyle | GCStipple, &values); ! XFillRectangle (mainDisplay, choiceWindow, patGC, COLOR_COL*choiceImageW, COLOR_ROW*choiceImageH, choiceImageW, choiceImageH); } ! if (PropagateWhereToPrint) ShowWhereToPrint (); } ! void ShowHoriAlign () { ! XSetStipple (mainDisplay, rasterGC, alignHoriPixmap[horiAlign]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, HORI_ALIGN_COL*choiceImageW, HORI_ALIGN_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowVertAlign () { ! XSetStipple (mainDisplay, rasterGC, alignVertPixmap[vertAlign]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, VERT_ALIGN_COL*choiceImageW, VERT_ALIGN_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowJust () { ! XSetStipple (mainDisplay, rasterGC, justPixmap[textJust]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, JUST_COL*choiceImageW, JUST_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowCurFont () { int x, y, w, h; --- 267,333 ---- } ! void ShowWhereToPrint() { ! if (colorDump) { ! XSetForeground(mainDisplay, rasterGC, colorPixels[colorIndex]); ! } ! XSetStipple(mainDisplay, rasterGC, whereToPrintPixmap[whereToPrint]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, PRINT_COL*choiceImageW, PRINT_ROW*choiceImageH, choiceImageW, choiceImageH); ! if (colorDump) XSetForeground(mainDisplay, rasterGC, myFgPixel); } ! void ShowMode() { ! XSetStipple(mainDisplay, rasterGC, choicePixmap[curChoice]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, MODE_COL*choiceImageW, MODE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowColor(PropagateWhereToPrint) int PropagateWhereToPrint; { XGCValues values; ! if (colorDisplay) { values.foreground = colorPixels[colorIndex]; values.function = GXcopy; values.fill_style = FillOpaqueStippled; values.stipple = patPixmap[1]; ! XChangeGC(mainDisplay, patGC, GCForeground | GCFunction | GCFillStyle | GCStipple, &values); ! XFillRectangle(mainDisplay, choiceWindow, patGC, COLOR_COL*choiceImageW, COLOR_ROW*choiceImageH, choiceImageW, choiceImageH); } ! if (PropagateWhereToPrint) ShowWhereToPrint(); } ! void ShowHoriAlign() { ! XSetStipple(mainDisplay, rasterGC, alignHoriPixmap[horiAlign]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, HORI_ALIGN_COL*choiceImageW, HORI_ALIGN_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowVertAlign() { ! XSetStipple(mainDisplay, rasterGC, alignVertPixmap[vertAlign]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, VERT_ALIGN_COL*choiceImageW, VERT_ALIGN_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowJust() { ! XSetStipple(mainDisplay, rasterGC, justPixmap[textJust]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, JUST_COL*choiceImageW, JUST_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowCurFont() { int x, y, w, h; *************** *** 342,346 **** recs[0].height = choiceImageH; ! w = XTextWidth (canvasFontPtr, "W", 1); h = canvasFontHeight; --- 340,344 ---- recs[0].height = choiceImageH; ! w = XTextWidth(canvasFontPtr, "W", 1); h = canvasFontHeight; *************** *** 352,370 **** FONT_ROW*choiceImageH + (canvasFontAsc+(choiceImageH-h)/2); ! XClearArea (mainDisplay, choiceWindow, FONT_COL*choiceImageW, FONT_ROW*choiceImageH, choiceImageW, choiceImageH, FALSE); ! XSetFont (mainDisplay, choiceGC, canvasFontPtr->fid); ! XSetClipRectangles (mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded); values.foreground = myFgPixel; values.background = myBgPixel; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values); ! XDrawString (mainDisplay, choiceWindow, choiceGC, x, y, "W", 1); values.foreground = xorOne; values.background = xorZero; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values); recs[0].x = 0; --- 350,368 ---- FONT_ROW*choiceImageH + (canvasFontAsc+(choiceImageH-h)/2); ! XClearArea(mainDisplay, choiceWindow, FONT_COL*choiceImageW, FONT_ROW*choiceImageH, choiceImageW, choiceImageH, FALSE); ! XSetFont(mainDisplay, choiceGC, canvasFontPtr->fid); ! XSetClipRectangles(mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded); values.foreground = myFgPixel; values.background = myBgPixel; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground, &values); ! XDrawString(mainDisplay, choiceWindow, choiceGC, x, y, "W", 1); values.foreground = xorOne; values.background = xorZero; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground, &values); recs[0].x = 0; *************** *** 372,379 **** recs[0].width = choiceWindowW; recs[0].height = choiceWindowH; ! XSetClipRectangles (mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded); } ! void ShowTextVSpace () { int len, x, y; --- 370,377 ---- recs[0].width = choiceWindowW; recs[0].height = choiceWindowH; ! XSetClipRectangles(mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded); } ! void ShowTextVSpace() { int len, x, y; *************** *** 381,389 **** XGCValues values; ! XSetStipple (mainDisplay, rasterGC, vspacePixmap); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, VSPACE_COL*choiceImageW, VSPACE_ROW*choiceImageH, choiceImageW, choiceImageH); ! sprintf (s, "%1d", textVSpace); ! len = strlen (s); x = (int)((VSPACE_COL+0.5)*choiceImageW-2); y = VSPACE_ROW*choiceImageH+((choiceImageH-rulerFontAsc)>>1)+rulerFontAsc; --- 379,387 ---- XGCValues values; ! XSetStipple(mainDisplay, rasterGC, vspacePixmap); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, VSPACE_COL*choiceImageW, VSPACE_ROW*choiceImageH, choiceImageW, choiceImageH); ! sprintf(s, "%1d", textVSpace); ! len = strlen(s); x = (int)((VSPACE_COL+0.5)*choiceImageW-2); y = VSPACE_ROW*choiceImageH+((choiceImageH-rulerFontAsc)>>1)+rulerFontAsc; *************** *** 392,406 **** values.background = myBgPixel; values.font = rulerFontPtr->fid; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString (mainDisplay, choiceWindow, choiceGC, x, y, s, len); values.foreground = xorOne; values.background = xorZero; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values); } ! void ShowZoom () { int len, x, y, w, x_w, one_w; --- 390,404 ---- values.background = myBgPixel; values.font = rulerFontPtr->fid; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString(mainDisplay, choiceWindow, choiceGC, x, y, s, len); values.foreground = xorOne; values.background = xorZero; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground, &values); } ! void ShowZoom() { int len, x, y, w, x_w, one_w; *************** *** 408,420 **** XGCValues values; ! XClearArea (mainDisplay, choiceWindow, ZOOM_COL*choiceImageW, ZOOM_ROW*choiceImageH, choiceImageW, choiceImageH, FALSE); ! sprintf (s, "x%1d", 1<>1); y = ZOOM_ROW*choiceImageH+((choiceImageH-rulerFontAsc)>>1)+rulerFontAsc; --- 406,418 ---- XGCValues values; ! XClearArea(mainDisplay, choiceWindow, ZOOM_COL*choiceImageW, ZOOM_ROW*choiceImageH, choiceImageW, choiceImageH, FALSE); ! sprintf(s, "x%1d", 1<>1); y = ZOOM_ROW*choiceImageH+((choiceImageH-rulerFontAsc)>>1)+rulerFontAsc; *************** *** 423,443 **** values.background = myBgPixel; values.font = rulerFontPtr->fid; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString (mainDisplay, choiceWindow, choiceGC, x, y, "x", 1); x += x_w; ! sprintf (s, "%1d", 1<>1); ! XDrawString (mainDisplay, choiceWindow, choiceGC, x+((w-x_w-one_w)>>1), y-2, "1", 1); ! XDrawLine (mainDisplay, choiceWindow, choiceGC, x, y, x+(w-x_w-1), y); ! XDrawString (mainDisplay, choiceWindow, choiceGC, x, y+rulerFontAsc, s, len); } --- 421,440 ---- values.background = myBgPixel; values.font = rulerFontPtr->fid; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString(mainDisplay, choiceWindow, choiceGC, x, y, "x", 1); x += x_w; ! sprintf(s, "%1d", 1<>1); ! XDrawString(mainDisplay, choiceWindow, choiceGC, x+((w-x_w-one_w)>>1), y-2, "1", 1); ! XDrawLine(mainDisplay, choiceWindow, choiceGC, x, y, x+(w-x_w-1), y); ! XDrawString(mainDisplay, choiceWindow, choiceGC, x, y+rulerFontAsc, s, len); } *************** *** 445,452 **** values.foreground = xorOne; values.background = xorZero; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values); } ! void ShowTextSize () { int len, x, y, w; --- 442,449 ---- values.foreground = xorOne; values.background = xorZero; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground, &values); } ! void ShowTextSize() { int len, x, y, w; *************** *** 454,464 **** XGCValues values; ! XClearArea (mainDisplay, choiceWindow, TEXT_SIZE_COL*choiceImageW, TEXT_SIZE_ROW*choiceImageH, choiceImageW, choiceImageH, FALSE); ! sprintf (s, "%1d", (curChoice == DRAWTEXT && editingText && editTextSize != 0 && savedEditTextSize != (-1)) ? savedEditTextSize : curSize); ! len = strlen (s); ! w = XTextWidth (defaultFontPtr, s, len); x = TEXT_SIZE_COL*choiceImageW + ((choiceImageW-w)>>1); y = TEXT_SIZE_ROW*choiceImageH + ((choiceImageH-defaultFontAsc)>>1) + --- 451,461 ---- XGCValues values; ! XClearArea(mainDisplay, choiceWindow, TEXT_SIZE_COL*choiceImageW, TEXT_SIZE_ROW*choiceImageH, choiceImageW, choiceImageH, FALSE); ! sprintf(s, "%1d", (curChoice == DRAWTEXT && editingText && editTextSize != 0 && savedEditTextSize != (-1)) ? savedEditTextSize : curSize); ! len = strlen(s); ! w = XTextWidth(defaultFontPtr, s, len); x = TEXT_SIZE_COL*choiceImageW + ((choiceImageW-w)>>1); y = TEXT_SIZE_ROW*choiceImageH + ((choiceImageH-defaultFontAsc)>>1) + *************** *** 468,479 **** values.background = myBgPixel; values.font = defaultFontPtr->fid; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString (mainDisplay, choiceWindow, choiceGC, x, y, s, len); values.foreground = xorOne; values.background = xorZero; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values); } --- 465,476 ---- values.background = myBgPixel; values.font = defaultFontPtr->fid; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString(mainDisplay, choiceWindow, choiceGC, x, y, s, len); values.foreground = xorOne; values.background = xorZero; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground, &values); } *************** *** 529,533 **** values.ts_y_origin = ROTATE_ROW*choiceImageH+lty-y; values.stipple = bitmap; ! XChangeGC (mainDisplay, patGC, GCForeground | GCBackground | GCFunction | GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, &values); --- 526,530 ---- values.ts_y_origin = ROTATE_ROW*choiceImageH+lty-y; values.stipple = bitmap; ! XChangeGC(mainDisplay, patGC, GCForeground | GCBackground | GCFunction | GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, &values); *************** *** 538,545 **** } ! void ShowSpecial () { ! XSetStipple (mainDisplay, rasterGC, specialPixmap); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, SPECIAL_COL*choiceImageW, SPECIAL_ROW*choiceImageH, choiceImageW, choiceImageH); --- 535,542 ---- } ! void ShowSpecial() { ! XSetStipple(mainDisplay, rasterGC, specialPixmap); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, SPECIAL_COL*choiceImageW, SPECIAL_ROW*choiceImageH, choiceImageW, choiceImageH); *************** *** 577,622 **** } ! void ShowLineStyle () { ! XSetStipple (mainDisplay, rasterGC, shortLineStylePixmap[lineStyle]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, LINE_STYLE_COL*choiceImageW, LINE_STYLE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowLineType () { ! XSetStipple (mainDisplay, rasterGC, shortLineTypePixmap[curSpline]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, LINE_TYPE_COL*choiceImageW, LINE_TYPE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowDash () { ! XSetStipple (mainDisplay, rasterGC, shortDashPixmap[curDash]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, DASH_COL*choiceImageW, DASH_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowFile () { ! switch (pageStyle) ! { ! case PORTRAIT: XSetStipple(mainDisplay,rasterGC,filePixmap); break; ! case LANDSCAPE: XSetStipple(mainDisplay,rasterGC,landscapePixmap); break; } ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, FILE_COL*choiceImageW, FILE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowEdit () { ! XSetStipple (mainDisplay, rasterGC, editPixmap); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, EDIT_COL*choiceImageW, EDIT_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowRCBRadius () { int len, x, y; --- 574,618 ---- } ! void ShowLineStyle() { ! XSetStipple(mainDisplay, rasterGC, shortLineStylePixmap[lineStyle]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, LINE_STYLE_COL*choiceImageW, LINE_STYLE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowLineType() { ! XSetStipple(mainDisplay, rasterGC, shortLineTypePixmap[curSpline]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, LINE_TYPE_COL*choiceImageW, LINE_TYPE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowDash() { ! XSetStipple(mainDisplay, rasterGC, shortDashPixmap[curDash]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, DASH_COL*choiceImageW, DASH_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowFile() { ! switch (pageStyle) { ! case PORTRAIT: XSetStipple(mainDisplay,rasterGC,filePixmap); break; ! case LANDSCAPE: XSetStipple(mainDisplay,rasterGC,landscapePixmap); break; } ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, FILE_COL*choiceImageW, FILE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowEdit() { ! XSetStipple(mainDisplay, rasterGC, editPixmap); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, EDIT_COL*choiceImageW, EDIT_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowRCBRadius() { int len, x, y; *************** *** 624,632 **** XGCValues values; ! XSetStipple (mainDisplay, rasterGC, rcbRadiusPixmap); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, RADIUS_COL*choiceImageW, RADIUS_ROW*choiceImageH, choiceImageW, choiceImageH); ! sprintf (s, "%1d", rcbRadius); ! len = strlen (s); x = (int)((RADIUS_COL+0.5)*choiceImageW-2); y = (((RADIUS_ROW+1)*choiceImageH-rulerFontAsc)>>1)+rulerFontAsc; --- 620,628 ---- XGCValues values; ! XSetStipple(mainDisplay, rasterGC, rcbRadiusPixmap); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, RADIUS_COL*choiceImageW, RADIUS_ROW*choiceImageH, choiceImageW, choiceImageH); ! sprintf(s, "%1d", rcbRadius); ! len = strlen(s); x = (int)((RADIUS_COL+0.5)*choiceImageW-2); y = (((RADIUS_ROW+1)*choiceImageH-rulerFontAsc)>>1)+rulerFontAsc; *************** *** 635,657 **** values.background = myBgPixel; values.font = rulerFontPtr->fid; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString (mainDisplay, choiceWindow, choiceGC, x, y, s, len); values.foreground = xorOne; values.background = xorZero; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values); } ! void ShowMoveMode () { ! XSetStipple (mainDisplay, rasterGC, moveModePixmap[moveMode]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, MOVE_MODE_COL*choiceImageW, MOVE_MODE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowShape () { XSetStipple(mainDisplay, rasterGC, shapePixmap[STAR_SHAPE]); --- 631,653 ---- values.background = myBgPixel; values.font = rulerFontPtr->fid; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString(mainDisplay, choiceWindow, choiceGC, x, y, s, len); values.foreground = xorOne; values.background = xorZero; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground, &values); } ! void ShowMoveMode() { ! XSetStipple(mainDisplay, rasterGC, moveModePixmap[moveMode]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, MOVE_MODE_COL*choiceImageW, MOVE_MODE_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowShape() { XSetStipple(mainDisplay, rasterGC, shapePixmap[STAR_SHAPE]); *************** *** 660,672 **** } ! void ShowStretchableTextMode () { ! XSetStipple (mainDisplay, rasterGC, stretchableModePixmap[stretchableText]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, STRETCHTEXT_COL*choiceImageW, STRETCHTEXT_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowFill () { XGCValues values; --- 656,668 ---- } ! void ShowStretchableTextMode() { ! XSetStipple(mainDisplay, rasterGC, stretchableModePixmap[stretchableText]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, STRETCHTEXT_COL*choiceImageW, STRETCHTEXT_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowFill() { XGCValues values; *************** *** 677,689 **** values.fill_style = FillOpaqueStippled; values.stipple = patPixmap[objFill]; ! XChangeGC (mainDisplay, patGC, GCForeground | GCBackground | GCFunction | GCFillStyle | GCStipple, &values); ! XFillRectangle (mainDisplay, choiceWindow, patGC, FILL_COL*choiceImageW, FILL_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowPen () { XGCValues values; --- 673,685 ---- values.fill_style = FillOpaqueStippled; values.stipple = patPixmap[objFill]; ! XChangeGC(mainDisplay, patGC, GCForeground | GCBackground | GCFunction | GCFillStyle | GCStipple, &values); ! XFillRectangle(mainDisplay, choiceWindow, patGC, FILL_COL*choiceImageW, FILL_ROW*choiceImageH, choiceImageW, choiceImageH); } ! void ShowPen() { XGCValues values; *************** *** 694,726 **** values.fill_style = FillOpaqueStippled; values.stipple = patPixmap[penPat]; ! XChangeGC (mainDisplay, patGC, GCForeground | GCBackground | GCFunction | GCFillStyle | GCStipple, &values); ! XFillRectangle (mainDisplay, choiceWindow, patGC, PEN_COL*choiceImageW, PEN_ROW*choiceImageH, choiceImageW, choiceImageH); ! if (penPat != NONEPAT) ! XClearArea (mainDisplay, choiceWindow, PEN_COL*choiceImageW+(choiceImageW>>2), PEN_ROW*choiceImageH+(choiceImageH>>2), (choiceImageW>>1), (choiceImageH>>1), FALSE); } ! void ShowPage () { ! int len, x, y, w; ! char s[80]; ! XGCValues values; ! XClearArea (mainDisplay, choiceWindow, PAGE_COL*choiceImageW, PAGE_ROW*choiceImageH, choiceImageW, choiceImageH, FALSE); ! switch (pageLayoutMode) ! { ! case PAGE_STACK: sprintf (s, "%1d/%1d", curPageNum, lastPageNum); break; ! case PAGE_TILE: sprintf (s, "%1dx%1d", paperCol, paperRow); break; } ! len = strlen (s); ! w = XTextWidth (rulerFontPtr, s, len); x = PAGE_COL*choiceImageW+((choiceImageW-w)>>1); y = PAGE_ROW*choiceImageH+((choiceImageH-rulerFontAsc)>>1) + --- 690,722 ---- values.fill_style = FillOpaqueStippled; values.stipple = patPixmap[penPat]; ! XChangeGC(mainDisplay, patGC, GCForeground | GCBackground | GCFunction | GCFillStyle | GCStipple, &values); ! XFillRectangle(mainDisplay, choiceWindow, patGC, PEN_COL*choiceImageW, PEN_ROW*choiceImageH, choiceImageW, choiceImageH); ! if (penPat != NONEPAT) { ! XClearArea(mainDisplay, choiceWindow, PEN_COL*choiceImageW+(choiceImageW>>2), PEN_ROW*choiceImageH+(choiceImageH>>2), (choiceImageW>>1), (choiceImageH>>1), FALSE); + } } ! void ShowPage() { ! int len, x, y, w; ! char s[80]; ! XGCValues values; ! XClearArea(mainDisplay, choiceWindow, PAGE_COL*choiceImageW, PAGE_ROW*choiceImageH, choiceImageW, choiceImageH, FALSE); ! switch (pageLayoutMode) { ! case PAGE_STACK: sprintf(s, "%1d/%1d", curPageNum, lastPageNum); break; ! case PAGE_TILE: sprintf(s, "%1dx%1d", paperCol, paperRow); break; } ! len = strlen(s); ! w = XTextWidth(rulerFontPtr, s, len); x = PAGE_COL*choiceImageW+((choiceImageW-w)>>1); y = PAGE_ROW*choiceImageH+((choiceImageH-rulerFontAsc)>>1) + *************** *** 730,741 **** values.background = myBgPixel; values.font = rulerFontPtr->fid; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString (mainDisplay, choiceWindow, choiceGC, x, y, s, len); values.foreground = xorOne; values.background = xorZero; ! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values); --- 726,737 ---- values.background = myBgPixel; values.font = rulerFontPtr->fid; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground | GCFont, &values); ! XDrawString(mainDisplay, choiceWindow, choiceGC, x, y, s, len); values.foreground = xorOne; values.background = xorZero; ! XChangeGC(mainDisplay, choiceGC, GCForeground | GCBackground, &values); *************** *** 743,750 **** } ! void ShowPageLayout () { ! XSetStipple (mainDisplay, rasterGC, pageLayoutPixmap[pageLayoutMode]); ! XFillRectangle (mainDisplay, choiceWindow, rasterGC, PAGELAYOUT_COL*choiceImageW, PAGELAYOUT_ROW*choiceImageH, choiceImageW, choiceImageH); --- 739,746 ---- } ! void ShowPageLayout() { ! XSetStipple(mainDisplay, rasterGC, pageLayoutPixmap[pageLayoutMode]); ! XFillRectangle(mainDisplay, choiceWindow, rasterGC, PAGELAYOUT_COL*choiceImageW, PAGELAYOUT_ROW*choiceImageH, choiceImageW, choiceImageH); *************** *** 907,919 **** static int prevChoice=NOTHING; ! void PushCurChoice () /* Kouichi Matsuda's modification */ { ! if (curChoice == NOTHING) ! SetCurChoice (prevChoice); ! else ! { prevChoice = curChoice; ! SetCurChoice (NOTHING); } } --- 903,914 ---- static int prevChoice=NOTHING; ! void PushCurChoice() /* Kouichi Matsuda's modification */ { ! if (curChoice == NOTHING) { ! SetCurChoice(prevChoice); ! } else { prevChoice = curChoice; ! SetCurChoice(NOTHING); } } *************** *** 964,968 **** static ! void RCBRadiusLoop (button_ev) XButtonEvent *button_ev; { --- 959,963 ---- static ! void RCBRadiusLoop(button_ev) XButtonEvent *button_ev; { *************** *** 971,1008 **** XEvent ev; ! XGrabPointer (mainDisplay, choiceWindow, False, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! while (!done) ! { ! XNextEvent (mainDisplay, &ev); ! ! if (ev.type == Expose || ev.type == VisibilityNotify) ! ExposeEventHandler (&ev, TRUE); ! else if (ev.type == ButtonRelease) ! { ! XUngrabPointer (mainDisplay, CurrentTime); done = TRUE; ! } ! else if (ev.type == MotionNotify) ! { int dx=ev.xmotion.x-orig_x, dy=ev.xmotion.y-orig_y; int change=((abs(dx)>abs(dy)) ? (int)(dx/res) : (int)(dy/res)); ! if (change != saved_change) ! { rcbRadius = max(MIN_RCB_RADIUS, saved_rcb_radius+change); ! ShowRCBRadius (); saved_change = change; } ! while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &ev)) ; } } ! if (topSel != NULL) ChangeAllSelRCBRadius (rcbRadius); } static ! void ZoomLoop (button_ev) XButtonEvent *button_ev; { --- 966,998 ---- XEvent ev; ! XGrabPointer(mainDisplay, choiceWindow, False, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! while (!done) { ! XNextEvent(mainDisplay, &ev); ! ! if (ev.type == Expose || ev.type == VisibilityNotify) { ! ExposeEventHandler(&ev, TRUE); ! } else if (ev.type == ButtonRelease) { ! XUngrabPointer(mainDisplay, CurrentTime); done = TRUE; ! } else if (ev.type == MotionNotify) { int dx=ev.xmotion.x-orig_x, dy=ev.xmotion.y-orig_y; int change=((abs(dx)>abs(dy)) ? (int)(dx/res) : (int)(dy/res)); ! if (change != saved_change) { rcbRadius = max(MIN_RCB_RADIUS, saved_rcb_radius+change); ! ShowRCBRadius(); saved_change = change; } ! while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } } ! if (topSel != NULL) ChangeAllSelRCBRadius(rcbRadius); } static ! void ZoomLoop(button_ev) XButtonEvent *button_ev; { *************** *** 1020,1048 **** new_zoomed_in = zoomedIn; new_zoom_scale = zoomScale; ! while ((win_w>>1) >= paperWidth && (win_h>>1) >= paperHeight) ! { ! if (new_zoomed_in) new_zoom_scale++; ! else if (new_zoom_scale == 0) ! { new_zoomed_in = TRUE; new_zoom_scale++; ! } ! else new_zoom_scale--; win_w >>= 1; win_h >>= 1; } ! while (win_w < paperWidth || win_h < paperHeight) ! { ! if (!new_zoomed_in) new_zoom_scale++; ! else if (new_zoom_scale == 1) ! { new_zoomed_in = FALSE; new_zoom_scale--; ! } ! else new_zoom_scale--; win_w <<= 1; win_h <<= 1; --- 1010,1034 ---- new_zoomed_in = zoomedIn; new_zoom_scale = zoomScale; ! while ((win_w>>1) >= paperWidth && (win_h>>1) >= paperHeight) { ! if (new_zoomed_in) { new_zoom_scale++; ! } else if (new_zoom_scale == 0) { new_zoomed_in = TRUE; new_zoom_scale++; ! } else { new_zoom_scale--; + } win_w >>= 1; win_h >>= 1; } ! while (win_w < paperWidth || win_h < paperHeight) { ! if (!new_zoomed_in) { new_zoom_scale++; ! } else if (new_zoom_scale == 1) { new_zoomed_in = FALSE; new_zoom_scale--; ! } else { new_zoom_scale--; + } win_w <<= 1; win_h <<= 1; *************** *** 1051,1076 **** (MAX_ZOOMED_IN+new_zoom_scale); ! XGrabPointer (mainDisplay, choiceWindow, False, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! while (!done) ! { ! XNextEvent (mainDisplay, &ev); ! ! if (ev.type == Expose || ev.type == VisibilityNotify) ! ExposeEventHandler (&ev, TRUE); ! else if (ev.type == ButtonRelease) ! { ! XUngrabPointer (mainDisplay, CurrentTime); done = TRUE; ! } ! else if (ev.type == MotionNotify) ! { int dx=ev.xmotion.x-orig_x, dy=ev.xmotion.y-orig_y; int change=((abs(dx)>abs(dy)) ? (int)(dx/res) : (int)(dy/res)); ! if (change != saved_change) ! { zoom = initial_zoom+change; if (zoom < 0) zoom = 0; --- 1037,1057 ---- (MAX_ZOOMED_IN+new_zoom_scale); ! XGrabPointer(mainDisplay, choiceWindow, False, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! while (!done) { ! XNextEvent(mainDisplay, &ev); ! ! if (ev.type == Expose || ev.type == VisibilityNotify) { ! ExposeEventHandler(&ev, TRUE); ! } else if (ev.type == ButtonRelease) { ! XUngrabPointer(mainDisplay, CurrentTime); done = TRUE; ! } else if (ev.type == MotionNotify) { int dx=ev.xmotion.x-orig_x, dy=ev.xmotion.y-orig_y; int change=((abs(dx)>abs(dy)) ? (int)(dx/res) : (int)(dy/res)); ! if (change != saved_change) { zoom = initial_zoom+change; if (zoom < 0) zoom = 0; *************** *** 1079,1086 **** zoomScale = (zoomedIn) ? (MAX_ZOOMED_IN-zoom) : (zoom-MAX_ZOOMED_IN); ! ShowZoom (); saved_change = change; } ! while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &ev)) ; } } --- 1060,1067 ---- zoomScale = (zoomedIn) ? (MAX_ZOOMED_IN-zoom) : (zoom-MAX_ZOOMED_IN); ! ShowZoom(); saved_change = change; } ! while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } } *************** *** 1090,1094 **** zoomedIn = saved_zoomed_in; zoomScale = saved_zoom_scale; ! PreciseZoom (new_zoomed_in, new_zoom_scale, FALSE); } --- 1071,1075 ---- zoomedIn = saved_zoomed_in; zoomScale = saved_zoom_scale; ! PreciseZoom(new_zoomed_in, new_zoom_scale, FALSE); } *************** *** 1644,1649 **** ChangeAllSelLineWidth(lineWidth, TRUE); } else { ! sprintf(gszMsgBox, "Line width set to %1d.", ! curWidthOfLine[lineWidth]); Msg(gszMsgBox); } --- 1625,1630 ---- ChangeAllSelLineWidth(lineWidth, TRUE); } else { ! sprintf(gszMsgBox, "Line width set to %s.", ! curWidthOfLineSpec[lineWidth]); Msg(gszMsgBox); } *** choose.c.orig Tue Sep 30 13:22:49 1997 --- choose.c Tue Sep 30 13:22:49 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/choose.c,v 3.4 1996/10/28 00:40:53 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/choose.c,v 3.5 1997/09/14 20:37:49 william Exp $ */ #include *** cmd.c.orig Tue Sep 30 13:22:51 1997 --- cmd.c Tue Sep 30 13:22:51 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cmd.c,v 3.1 1996/10/28 00:45:35 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cmd.c,v 3.2 1997/09/14 20:37:49 william Exp $ */ #include *** color.c.orig Tue Sep 30 13:22:52 1997 --- color.c Tue Sep 30 13:22:53 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/color.c,v 3.10 1996/12/25 16:39:09 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/color.c,v 3.17 1997/09/18 15:31:25 william Exp $ */ #include *************** *** 110,118 **** }; ! void DefaultColorArrays (Entries, ForePixels, Valid, InitRV, StatusStr) ! int Entries, * * ForePixels, * * Valid, * * InitRV; ! char * * * StatusStr; { ! register int i, * fore_pixels, pixel, * valid, * init_rv; pixel = myFgPixel; --- 108,116 ---- }; ! void DefaultColorArrays(Entries, ForePixels, Valid, InitRV, StatusStr) ! int Entries, **ForePixels, **Valid, **InitRV; ! char ***StatusStr; { ! register int i, *fore_pixels, pixel, *valid, *init_rv; pixel = myFgPixel; *************** *** 123,127 **** *InitRV = init_rv = (int*)malloc(Entries*sizeof(int)); if (*InitRV == NULL) FailAllocMessage(); ! for (i = 0; i < Entries; i++) { *fore_pixels++ = pixel; *valid++ = TRUE; --- 121,125 ---- *InitRV = init_rv = (int*)malloc(Entries*sizeof(int)); if (*InitRV == NULL) FailAllocMessage(); ! for (i=0; i < Entries; i++) { *fore_pixels++ = pixel; *valid++ = TRUE; *************** *** 194,231 **** static ! int ParseAndAllocColorByName (colorname, color, red_req, green_req, blue_req) ! char * colorname; ! XColor * color; ! unsigned short * red_req, * green_req, * blue_req; ! { ! Colormap colormap; ! ! if (!TgifParseColor(colorname, color)) ! { ! fprintf (stderr, "Warning: can not parse color '%s'\n", colorname); ! return (FALSE); } if (red_req != NULL) *red_req = color->red; if (green_req != NULL) *green_req = color->green; if (blue_req != NULL) *blue_req = color->blue; ! if (!XAllocColor(mainDisplay, mainColormap, color)) ! { ! if (newColormapUsed) ! { ! fprintf (stderr, "Warning: can not allocate color '%s'\n", colorname); ! return (FALSE); } ! colormap = XCopyColormapAndFree (mainDisplay, mainColormap); mainColormap = colormap; newColormapUsed = TRUE; ! if (mainWindow != None) ! XSetWindowColormap (mainDisplay, mainWindow, mainColormap); ! if (!XAllocColor(mainDisplay, mainColormap, color)) ! { ! fprintf (stderr, "Warning: can not allocate color '%s'\n", colorname); ! return (FALSE); } } ! return (TRUE); } --- 192,226 ---- static ! int ParseAndAllocColorByName(colorname, color, red_req, green_req, blue_req) ! char *colorname; ! XColor *color; ! unsigned short *red_req, *green_req, *blue_req; ! { ! Colormap colormap; ! ! if (!TgifParseColor(colorname, color)) { ! fprintf(stderr, "Warning: can not parse color '%s'\n", colorname); ! return FALSE; } if (red_req != NULL) *red_req = color->red; if (green_req != NULL) *green_req = color->green; if (blue_req != NULL) *blue_req = color->blue; ! if (!XAllocColor(mainDisplay, mainColormap, color)) { ! if (newColormapUsed) { ! fprintf(stderr, "Warning: can not allocate color '%s'\n", colorname); ! return FALSE; } ! colormap = XCopyColormapAndFree(mainDisplay, mainColormap); mainColormap = colormap; newColormapUsed = TRUE; ! if (mainWindow != None) { ! XSetWindowColormap(mainDisplay, mainWindow, mainColormap); ! } ! if (!XAllocColor(mainDisplay, mainColormap, color)) { ! fprintf(stderr, "Warning: can not allocate color '%s'\n", colorname); ! return FALSE; } } ! return TRUE; } *************** *** 236,240 **** bg_pixel = GetDrawingBgPixel(INVALID, INVALID); if (xorColorPixels != NULL) { ! for (i = 0; i < maxColors; i++) { xorColorPixels[i] = colorPixels[i] ^ bg_pixel; } --- 231,235 ---- bg_pixel = GetDrawingBgPixel(INVALID, INVALID); if (xorColorPixels != NULL) { ! for (i=0; i < maxColors; i++) { xorColorPixels[i] = colorPixels[i] ^ bg_pixel; } *************** *** 324,334 **** } void InitColor() { ! int i, index, looking_for_default_color, tmp_max; XColor color; char buf[80], * c_ptr, fg_color[80], bg_color[80], brdr_color[80]; long bg_gray=(long)0; ! int bg_allocated=FALSE, fg_allocated=FALSE, brdr_allocated=FALSE; InitLocalRGBTxt(); --- 319,372 ---- } + static + int InitColorFromXPixmap(pn_num_colors, pppsz_color_str) + int *pn_num_colors; + char ***pppsz_color_str; + /* return TRUE mean maxColors and initial colors are setup */ + { + char *c_ptr, xpm_fname[MAXPATHLENGTH], *color_char=NULL, **color_str=NULL; + int i, ncolors=0, rc; + + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ColorFromXPixmap")) == NULL) { + return FALSE; + } + strncpy(xpm_fname, c_ptr, sizeof(xpm_fname)); + rc = MyReadPixmapFile(xpm_fname, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, &ncolors, NULL, NULL, &color_char, &color_str, + NULL, NULL); + if (rc != BitmapSuccess) { + fprintf(stderr, "Invalid %s.ColorFromXPixmap: '%s' - %s.\n\t%s.\n", + TOOL_NAME, xpm_fname, "Failed to get colors", "Resource ignored"); + return FALSE; + } + if (myReadTransparentPixmap) { + fprintf(stderr, "Invalid %s.ColorFromXPixmap: '%s' - %s. %s.\n", + TOOL_NAME, xpm_fname, "Transparent color is not allowed", + "Resource ignored"); + if (color_str != NULL) { + for (i=0; i < ncolors; i++) { + if (color_str[i] != NULL) { + free(color_str[i]); + } + } + free(color_str); + } + if (color_char != NULL) free(color_char); + return FALSE; + } + *pn_num_colors = ncolors; + *pppsz_color_str = color_str; + if (color_char != NULL) free(color_char); + return TRUE; + } + void InitColor() { ! int i, index, looking_for_default_color, tmp_max, color_from_pixmap=FALSE; XColor color; char buf[80], * c_ptr, fg_color[80], bg_color[80], brdr_color[80]; long bg_gray=(long)0; ! int bg_allocated=FALSE, fg_allocated=FALSE, brdr_allocated=FALSE, ncolors=0; ! char **color_str=NULL; InitLocalRGBTxt(); *************** *** 363,440 **** defaultColorIndex = atoi(c_ptr); } ! maxColors = MAXCOLORS; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "MaxColors")) != NULL) { ! maxColors = atoi(c_ptr); ! if (maxColors <= 0) { ! fprintf(stderr, "Invalid %s*MaxColors: '%s', %1d is used.\n", ! TOOL_NAME, c_ptr, MAXCOLORS); ! maxColors = MAXCOLORS; } } ! if (colorDisplay) ! { if (((cmdLineForeground != NULL && cmdLineBackground == NULL) || (cmdLineForeground == NULL && cmdLineBackground != NULL)) && ! reverseVideo) ! { ! fprintf (stderr, "Normal video mode assumed since %s is %s.\n", cmdLineForeground == NULL ? "-bg" : "-fg", "specified in the command line"); reverseVideo = FALSE; } ! if (cmdLineForeground != NULL) ! strcpy (fg_color, cmdLineForeground); ! else if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"Foreground")) != NULL) ! { ! if (reverseVideo) ! strcpy (bg_color, c_ptr); ! else ! strcpy (fg_color, c_ptr); ! } ! else if (reverseVideo) ! strcpy (fg_color, "white"); ! else ! strcpy (fg_color, "black"); ! ! if (cmdLineBackground != NULL) ! strcpy (bg_color, cmdLineBackground); ! else if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"Background")) != NULL) ! { ! if (reverseVideo) ! strcpy (fg_color, c_ptr); ! else ! strcpy (bg_color, c_ptr); ! } ! else if (reverseVideo) ! strcpy (bg_color, "black"); ! else ! strcpy (bg_color, "white"); ! ! if (cmdLineBorder != NULL) ! strcpy (brdr_color, cmdLineBorder); ! else if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"BorderColor")) != NULL) ! strcpy (brdr_color, c_ptr); ! else ! strcpy (brdr_color, fg_color); ! } ! else ! { ! if (reverseVideo) ! { ! strcpy (fg_color, "white"); ! strcpy (bg_color, "black"); ! } ! else ! { ! strcpy (fg_color, "black"); ! strcpy (bg_color, "white"); ! } ! strcpy (brdr_color, fg_color); ! } ! ! if (maxColors <= 0) ! { ! fprintf (stderr, "0 colors specified (must be at least 1).\n"); exit (-1); } --- 401,477 ---- defaultColorIndex = atoi(c_ptr); } ! color_from_pixmap = InitColorFromXPixmap(&ncolors, &color_str); ! if (color_from_pixmap && ncolors > 0 && color_str != NULL) { ! maxColors = ncolors; ! } else { ! maxColors = MAXCOLORS; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "MaxColors")) != NULL) { ! maxColors = atoi(c_ptr); ! if (maxColors <= 0) { ! fprintf(stderr, "Invalid %s*MaxColors: '%s', %1d is used.\n", ! TOOL_NAME, c_ptr, MAXCOLORS); ! maxColors = MAXCOLORS; ! } } } ! if (colorDisplay) { if (((cmdLineForeground != NULL && cmdLineBackground == NULL) || (cmdLineForeground == NULL && cmdLineBackground != NULL)) && ! reverseVideo) { ! fprintf(stderr, "Normal video mode assumed since %s is %s.\n", cmdLineForeground == NULL ? "-bg" : "-fg", "specified in the command line"); reverseVideo = FALSE; } ! if (cmdLineForeground != NULL) { ! strcpy(fg_color, cmdLineForeground); ! } else if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"Foreground")) != ! NULL) { ! if (reverseVideo) { ! strcpy(bg_color, c_ptr); ! } else { ! strcpy(fg_color, c_ptr); ! } ! } else if (reverseVideo) { ! strcpy(fg_color, "white"); ! } else { ! strcpy(fg_color, "black"); ! } ! if (cmdLineBackground != NULL) { ! strcpy(bg_color, cmdLineBackground); ! } else if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"Background")) != ! NULL) { ! if (reverseVideo) { ! strcpy(fg_color, c_ptr); ! } else { ! strcpy(bg_color, c_ptr); ! } ! } else if (reverseVideo) { ! strcpy(bg_color, "black"); ! } else { ! strcpy(bg_color, "white"); ! } ! if (cmdLineBorder != NULL) { ! strcpy(brdr_color, cmdLineBorder); ! } else if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, ! "BorderColor")) != NULL) { ! strcpy(brdr_color, c_ptr); ! } else { ! strcpy(brdr_color, fg_color); ! } ! } else { ! if (reverseVideo) { ! strcpy(fg_color, "white"); ! strcpy(bg_color, "black"); ! } else { ! strcpy(fg_color, "black"); ! strcpy(bg_color, "white"); ! } ! strcpy(brdr_color, fg_color); ! } ! ! if (maxColors <= 0) { ! fprintf(stderr, "0 colors specified (must be at least 1).\n"); exit (-1); } *************** *** 454,486 **** allocatedMaxColors = maxColors; ! for (i = 0; i < allocatedMaxColors; i++) { colorMenuItems[i] = (char*)malloc(COLORSTRLEN*sizeof(char)); if (colorMenuItems[i] == NULL) FailAllocMessage(); } ! ! for (i = 0; i < maxColors; i++) { ! 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, "Could not GetDefault %s*%s\n", TOOL_NAME, buf); ! exit(-1); } - colorLayerOn[i] = TRUE; } ! if (colorDisplay) ! { index = 0; ! for (i = 0; i < maxColors; i++) ! { ! unsigned short red_req, green_req, blue_req; ! ! if (!ParseAndAllocColorByName (colorMenuItems[i], &color, ! &red_req, &green_req, &blue_req)) ! { ! fprintf (stderr, "%s %1d: '%s'! %s aborted!\n", "Fail to allocate color number", i, colorMenuItems[i], TOOL_NAME); --- 491,529 ---- allocatedMaxColors = maxColors; ! for (i=0; i < allocatedMaxColors; i++) { colorMenuItems[i] = (char*)malloc(COLORSTRLEN*sizeof(char)); if (colorMenuItems[i] == NULL) FailAllocMessage(); } ! if (color_from_pixmap && ncolors > 0 && color_str != NULL) { ! for (i=0; i < maxColors; i++) { ! strcpy(colorMenuItems[i], color_str[i]); ! free(color_str[i]); ! colorLayerOn[i] = TRUE; ! } ! free(color_str); ! color_str = NULL; ! } else { ! for (i=0; i < maxColors; i++) { ! 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, "Could not GetDefault %s*%s\n", TOOL_NAME, buf); ! exit(-1); ! } ! colorLayerOn[i] = TRUE; } } ! if (colorDisplay) { index = 0; ! for (i=0; i < maxColors; i++) { ! unsigned short red_req, green_req, blue_req; ! ! if (!ParseAndAllocColorByName(colorMenuItems[i], &color, ! &red_req, &green_req, &blue_req)) { ! fprintf(stderr, "%s %1d: '%s'! %s aborted!\n", "Fail to allocate color number", i, colorMenuItems[i], TOOL_NAME); *************** *** 488,492 **** } ! if (i != index) strcpy (colorMenuItems[index], colorMenuItems[i]); colorPixels[index] = color.pixel; --- 531,535 ---- } ! if (i != index) strcpy(colorMenuItems[index], colorMenuItems[i]); colorPixels[index] = color.pixel; *************** *** 500,512 **** tgifRequestedColors[index].blue = blue_req; ! if (UtilStrICmp (colorMenuItems[i], fg_color) == 0) ! { myFgPixel = color.pixel; ! strcpy (myFgColorStr, fg_color); fg_allocated = TRUE; } ! if (UtilStrICmp (colorMenuItems[i], bg_color) == 0) ! { myBgPixel = color.pixel; myBgColor.pixel = color.pixel; --- 543,553 ---- tgifRequestedColors[index].blue = blue_req; ! if (UtilStrICmp(colorMenuItems[i], fg_color) == 0) { myFgPixel = color.pixel; ! strcpy(myFgColorStr, fg_color); fg_allocated = TRUE; } ! if (UtilStrICmp(colorMenuItems[i], bg_color) == 0) { myBgPixel = color.pixel; myBgColor.pixel = color.pixel; *************** *** 514,518 **** myBgColor.green = color.green; myBgColor.blue = color.blue; ! strcpy (myBgColorStr, bg_color); bg_allocated = TRUE; --- 555,559 ---- myBgColor.green = color.green; myBgColor.blue = color.blue; ! strcpy(myBgColorStr, bg_color); bg_allocated = TRUE; *************** *** 520,525 **** (((long)tgifColors[i].green)<<3) + ((long)tgifColors[i].blue); } ! if (UtilStrICmp (colorMenuItems[i], brdr_color) == 0) ! { myBorderPixel = color.pixel; brdr_allocated = TRUE; --- 561,565 ---- (((long)tgifColors[i].green)<<3) + ((long)tgifColors[i].blue); } ! if (UtilStrICmp(colorMenuItems[i], brdr_color) == 0) { myBorderPixel = color.pixel; brdr_allocated = TRUE; *************** *** 528,553 **** } maxColors = index; ! if (maxColors <= 0) ! { ! fprintf (stderr, "0 colors specified (must be at least 1).\n"); exit (-1); } looking_for_default_color = FALSE; ! if (defaultColorIndexInXDefaults) ! { ! if (defaultColorIndexInXDefaults && defaultColorIndex >= maxColors) ! { ! fprintf (stderr, "Warning: DefaultColorIndex >= MaxColors, "); ! fprintf (stderr, "Use 0 for DefaultColorIndex\n"); defaultColorIndex = 0; } ! } ! else ! { looking_for_default_color = TRUE; ! for (i = 0; i < maxColors; i++) ! { ! if (UtilStrICmp(fg_color, colorMenuItems[i]) == 0) ! { defaultColorIndex = i; looking_for_default_color = FALSE; --- 568,586 ---- } maxColors = index; ! if (maxColors <= 0) { ! fprintf(stderr, "0 colors specified (must be at least 1).\n"); exit (-1); } looking_for_default_color = FALSE; ! if (defaultColorIndexInXDefaults) { ! if (defaultColorIndexInXDefaults && defaultColorIndex >= maxColors) { ! fprintf(stderr, "Warning: DefaultColorIndex >= MaxColors, "); ! fprintf(stderr, "Use 0 for DefaultColorIndex\n"); defaultColorIndex = 0; } ! } else { looking_for_default_color = TRUE; ! for (i=0; i < maxColors; i++) { ! if (UtilStrICmp(fg_color, colorMenuItems[i]) == 0) { defaultColorIndex = i; looking_for_default_color = FALSE; *************** *** 556,575 **** } } ! if (!fg_allocated) ! { ! if (!ParseAndAllocColorByName (fg_color, &color, NULL, NULL, NULL)) ! { ! fprintf (stderr, "Fail to allocate the '%s' color! Abort!\n", fg_color); exit (-1); } myFgPixel = color.pixel; ! strcpy (myFgColorStr, fg_color); } ! if (!bg_allocated) ! { ! if (!ParseAndAllocColorByName (bg_color, &color, NULL, NULL, NULL)) ! { ! fprintf (stderr, "Fail to allocate the '%s' color! Abort!\n", bg_color); exit (-1); --- 589,604 ---- } } ! if (!fg_allocated) { ! if (!ParseAndAllocColorByName(fg_color, &color, NULL, NULL, NULL)) { ! fprintf(stderr, "Fail to allocate the '%s' color! Abort!\n", fg_color); exit (-1); } myFgPixel = color.pixel; ! strcpy(myFgColorStr, fg_color); } ! if (!bg_allocated) { ! if (!ParseAndAllocColorByName(bg_color, &color, NULL, NULL, NULL)) { ! fprintf(stderr, "Fail to allocate the '%s' color! Abort!\n", bg_color); exit (-1); *************** *** 580,618 **** myBgColor.green = color.green; myBgColor.blue = color.blue; ! strcpy (myBgColorStr, bg_color); ! if (looking_for_default_color) bg_gray = (((long)color.red)<<2) + (((long)color.green)<<3) + ((long)color.blue); } ! if (looking_for_default_color) ! { ! long val, val1; defaultColorIndex = 0; val = (((long)tgifColors[0].red)<<2) + (((long)tgifColors[0].green)<<3) + ((long)tgifColors[0].blue); ! if (bg_gray >= 0x67ff9) /* (0xffff<<1) + (0xffff<<2) + (0x7fff) */ ! { ! for (i = 1; i < maxColors; i++) ! { val1 = (((long)tgifColors[i].red)<<2) + (((long)tgifColors[i].green)<<3) + ((long)tgifColors[i].blue); ! if (val > val1) ! { val = val1; defaultColorIndex = i; } } ! } ! else ! { ! for (i = 1; i < maxColors; i++) ! { val1 = (((long)tgifColors[i].red)<<2) + (((long)tgifColors[i].green)<<3) + ((long)tgifColors[i].blue); ! if (val < val1) ! { val = val1; defaultColorIndex = i; --- 609,640 ---- myBgColor.green = color.green; myBgColor.blue = color.blue; ! strcpy(myBgColorStr, bg_color); ! if (looking_for_default_color) { bg_gray = (((long)color.red)<<2) + (((long)color.green)<<3) + ((long)color.blue); + } } ! if (looking_for_default_color) { ! long val, val1; defaultColorIndex = 0; val = (((long)tgifColors[0].red)<<2) + (((long)tgifColors[0].green)<<3) + ((long)tgifColors[0].blue); ! if (bg_gray >= 0x67ff9) { /* (0xffff<<1) + (0xffff<<2) + (0x7fff) */ ! for (i=1; i < maxColors; i++) { val1 = (((long)tgifColors[i].red)<<2) + (((long)tgifColors[i].green)<<3) + ((long)tgifColors[i].blue); ! if (val > val1) { val = val1; defaultColorIndex = i; } } ! } else { ! for (i=1; i < maxColors; i++) { val1 = (((long)tgifColors[i].red)<<2) + (((long)tgifColors[i].green)<<3) + ((long)tgifColors[i].blue); ! if (val < val1) { val = val1; defaultColorIndex = i; *************** *** 621,629 **** } } ! if (!brdr_allocated) ! { ! if (!ParseAndAllocColorByName (brdr_color, &color, NULL, NULL, NULL)) ! { ! fprintf (stderr, "Fail to allocate the '%s' color! Abort!\n", brdr_color); exit (-1); --- 643,649 ---- } } ! if (!brdr_allocated) { ! if (!ParseAndAllocColorByName(brdr_color, &color, NULL, NULL, NULL)) { ! fprintf(stderr, "Fail to allocate the '%s' color! Abort!\n", brdr_color); exit (-1); *************** *** 631,661 **** myBorderPixel = color.pixel; } ! for (i = 0; i < maxColors; i++) xorColorPixels[i] = colorPixels[i] ^ myBgPixel; colorIndex = defaultColorIndex; ! } ! else ! { /* !colorDisplay */ ! if (!ParseAndAllocColorByName (fg_color, &color, NULL, NULL, NULL)) ! { ! fprintf (stderr, "Fail to allocate the '%s' color! Abort!\n", fg_color); exit (-1); } myFgPixel = color.pixel; ! strcpy (myFgColorStr, fg_color); ! if (!ParseAndAllocColorByName (bg_color, &color, NULL, NULL, NULL)) ! { ! fprintf (stderr, "Fail to allocate the '%s' color! Abort!\n", bg_color); exit (-1); } myBgPixel = color.pixel; ! strcpy (myBgColorStr, bg_color); ! if (!ParseAndAllocColorByName (brdr_color, &color, NULL, NULL, NULL)) ! { ! fprintf (stderr, "Fail to allocate the '%s' color! Abort!\n", brdr_color); exit (-1); --- 651,678 ---- myBorderPixel = color.pixel; } ! for (i=0; i < maxColors; i++) { xorColorPixels[i] = colorPixels[i] ^ myBgPixel; + } colorIndex = defaultColorIndex; ! } else { ! /* !colorDisplay */ ! if (!ParseAndAllocColorByName(fg_color, &color, NULL, NULL, NULL)) { ! fprintf(stderr, "Fail to allocate the '%s' color! Abort!\n", fg_color); exit (-1); } myFgPixel = color.pixel; ! strcpy(myFgColorStr, fg_color); ! if (!ParseAndAllocColorByName(bg_color, &color, NULL, NULL, NULL)) { ! fprintf(stderr, "Fail to allocate the '%s' color! Abort!\n", bg_color); exit (-1); } myBgPixel = color.pixel; ! strcpy(myBgColorStr, bg_color); ! if (!ParseAndAllocColorByName(brdr_color, &color, NULL, NULL, NULL)) { ! fprintf(stderr, "Fail to allocate the '%s' color! Abort!\n", brdr_color); exit (-1); *************** *** 663,674 **** myBorderPixel = color.pixel; ! for (i = 0; i < maxColors; i++) ! { ! unsigned short red_req, green_req, blue_req; ! ! if (!ParseAndAllocColorByName (colorMenuItems[i], &color, ! &red_req, &green_req, &blue_req)) ! { ! fprintf (stderr, "%s %1d: '%s'! %s aborted!\n", "Fail to allocate color number", i, colorMenuItems[i], TOOL_NAME); --- 680,689 ---- myBorderPixel = color.pixel; ! for (i=0; i < maxColors; i++) { ! unsigned short red_req, green_req, blue_req; ! ! if (!ParseAndAllocColorByName(colorMenuItems[i], &color, ! &red_req, &green_req, &blue_req)) { ! fprintf(stderr, "%s %1d: '%s'! %s aborted!\n", "Fail to allocate color number", i, colorMenuItems[i], TOOL_NAME); *************** *** 684,718 **** tgifRequestedColors[i].blue = blue_req; ! if (UtilStrICmp (colorMenuItems[i], bg_color) == 0) colorPixels[i] = myBgPixel; ! else colorPixels[i] = myFgPixel; xorColorPixels[i] = myFgPixel ^ myBgPixel; } colorIndex = defaultColorIndex; } ! if (!ParseAndAllocColorByName ("black", &color, NULL, NULL, NULL)) ! { ! fprintf (stderr, "Fail to allocate the 'black' color! Abort!\n"); exit (-1); } tmp_max = max(((int)color.red),max(((int)color.green),((int)color.blue))); #ifndef DONTFREECOLORS ! XFreeColors (mainDisplay, mainColormap, &(color.pixel), 1, 0); #endif if (tmp_max > maxRGB) maxRGB = tmp_max; ! if (!ParseAndAllocColorByName ("white", &color, NULL, NULL, NULL)) ! { ! fprintf (stderr, "Fail to allocate the 'white' color! Abort!\n"); exit (-1); } tmp_max = max(((int)color.red),max(((int)color.green),((int)color.blue))); #ifndef DONTFREECOLORS ! XFreeColors (mainDisplay, mainColormap, &(color.pixel), 1, 0); #endif if (tmp_max > maxRGB) maxRGB = tmp_max; ! if (tmp_max == 0) ! fprintf (stderr, "Warning: Unexpected maximum RGB intensity of 0."); ! *myRubberBandColorStr = '\0'; myRubberBandPixel = INVALID; --- 699,732 ---- tgifRequestedColors[i].blue = blue_req; ! if (UtilStrICmp(colorMenuItems[i], bg_color) == 0) { colorPixels[i] = myBgPixel; ! } else { colorPixels[i] = myFgPixel; + } xorColorPixels[i] = myFgPixel ^ myBgPixel; } colorIndex = defaultColorIndex; } ! if (!ParseAndAllocColorByName("black", &color, NULL, NULL, NULL)) { ! fprintf(stderr, "Fail to allocate the 'black' color! Abort!\n"); exit (-1); } tmp_max = max(((int)color.red),max(((int)color.green),((int)color.blue))); #ifndef DONTFREECOLORS ! XFreeColors(mainDisplay, mainColormap, &(color.pixel), 1, 0); #endif if (tmp_max > maxRGB) maxRGB = tmp_max; ! if (!ParseAndAllocColorByName("white", &color, NULL, NULL, NULL)) { ! fprintf(stderr, "Fail to allocate the 'white' color! Abort!\n"); exit (-1); } tmp_max = max(((int)color.red),max(((int)color.green),((int)color.blue))); #ifndef DONTFREECOLORS ! XFreeColors(mainDisplay, mainColormap, &(color.pixel), 1, 0); #endif if (tmp_max > maxRGB) maxRGB = tmp_max; ! if (tmp_max == 0) { ! fprintf(stderr, "Warning: Unexpected maximum RGB intensity of 0."); ! } *myRubberBandColorStr = '\0'; myRubberBandPixel = INVALID; *************** *** 727,735 **** xorZero = myBgPixel; ! if (myFgPixel == myBgPixel) ! fprintf (stderr, "%s.\n%s.\n", "Warning: foreground and background colors are the same", " You may not be able to see much"); ! if (!initColorDontReload) { canChangeAttrColor = FALSE; --- 741,749 ---- xorZero = myBgPixel; ! if (myFgPixel == myBgPixel) { ! fprintf(stderr, "%s.\n%s.\n", "Warning: foreground and background colors are the same", " You may not be able to see much"); ! } if (!initColorDontReload) { canChangeAttrColor = FALSE; *************** *** 812,985 **** } ! int OneColorObject (ObjPtr, ColorIndex) ! struct ObjRec * ObjPtr; ! int * ColorIndex; ! { ! register struct ObjRec * obj_ptr; ! ! for (obj_ptr=ObjPtr->detail.r->last; obj_ptr!=NULL; obj_ptr=obj_ptr->prev) ! switch (obj_ptr->type) ! { ! case OBJ_POLY: ! if (*ColorIndex == INVALID) ! { ! if ((obj_ptr->detail.p->fill != NONEPAT && ! obj_ptr->detail.p->fill != BACKPAT) || ! (obj_ptr->detail.p->pen != NONEPAT && ! obj_ptr->detail.p->pen != BACKPAT)) ! *ColorIndex = obj_ptr->color; ! } ! else if (obj_ptr->color != *ColorIndex) ! { ! if ((obj_ptr->detail.p->fill != NONEPAT && ! obj_ptr->detail.p->fill != BACKPAT) || ! (obj_ptr->detail.p->pen != NONEPAT && ! obj_ptr->detail.p->pen != BACKPAT)) ! return (FALSE); } ! break; ! case OBJ_BOX: ! if (*ColorIndex == INVALID) ! { ! if ((obj_ptr->detail.b->fill != NONEPAT && ! obj_ptr->detail.b->fill != BACKPAT) || ! (obj_ptr->detail.b->pen != NONEPAT && ! obj_ptr->detail.b->pen != BACKPAT)) ! *ColorIndex = obj_ptr->color; ! } ! else if (obj_ptr->color != *ColorIndex) ! { ! if ((obj_ptr->detail.b->fill != NONEPAT && ! obj_ptr->detail.b->fill != BACKPAT) || ! (obj_ptr->detail.b->pen != NONEPAT && ! obj_ptr->detail.b->pen != BACKPAT)) ! return (FALSE); } ! break; ! case OBJ_OVAL: ! if (*ColorIndex == INVALID) ! { ! if ((obj_ptr->detail.o->fill != NONEPAT && ! obj_ptr->detail.o->fill != BACKPAT) || ! (obj_ptr->detail.o->pen != NONEPAT && ! obj_ptr->detail.o->pen != BACKPAT)) ! *ColorIndex = obj_ptr->color; ! } ! else if (obj_ptr->color != *ColorIndex) ! { ! if ((obj_ptr->detail.o->fill != NONEPAT && ! obj_ptr->detail.o->fill != BACKPAT) || ! (obj_ptr->detail.o->pen != NONEPAT && ! obj_ptr->detail.o->pen != BACKPAT)) ! return (FALSE); } ! break; ! case OBJ_TEXT: ! if (*ColorIndex == INVALID) ! { ! if ((obj_ptr->detail.t->fill != NONEPAT && ! obj_ptr->detail.t->fill != BACKPAT) || ! (obj_ptr->detail.t->pen != NONEPAT && ! obj_ptr->detail.t->pen != BACKPAT)) ! *ColorIndex = obj_ptr->color; ! } ! else if (obj_ptr->color != *ColorIndex) ! { ! if ((obj_ptr->detail.t->fill != NONEPAT && ! obj_ptr->detail.t->fill != BACKPAT) || ! (obj_ptr->detail.t->pen != NONEPAT && ! obj_ptr->detail.t->pen != BACKPAT)) ! return (FALSE); } ! break; ! case OBJ_POLYGON: ! if (*ColorIndex == INVALID) ! { ! if ((obj_ptr->detail.g->fill != NONEPAT && ! obj_ptr->detail.g->fill != BACKPAT) || ! (obj_ptr->detail.g->pen != NONEPAT && ! obj_ptr->detail.g->pen != BACKPAT)) ! *ColorIndex = obj_ptr->color; ! } ! else if (obj_ptr->color != *ColorIndex) ! { ! if ((obj_ptr->detail.g->fill != NONEPAT && ! obj_ptr->detail.g->fill != BACKPAT) || ! (obj_ptr->detail.g->pen != NONEPAT && ! obj_ptr->detail.g->pen != BACKPAT)) ! return (FALSE); } ! break; ! case OBJ_ARC: ! if (*ColorIndex == INVALID) ! { ! if ((obj_ptr->detail.a->fill != NONEPAT && ! obj_ptr->detail.a->fill != BACKPAT) || ! (obj_ptr->detail.a->pen != NONEPAT && ! obj_ptr->detail.a->pen != BACKPAT)) ! *ColorIndex = obj_ptr->color; ! } ! else if (obj_ptr->color != *ColorIndex) ! { ! if ((obj_ptr->detail.a->fill != NONEPAT && ! obj_ptr->detail.a->fill != BACKPAT) || ! (obj_ptr->detail.a->pen != NONEPAT && ! obj_ptr->detail.a->pen != BACKPAT)) ! return (FALSE); } ! break; ! case OBJ_RCBOX: ! if (*ColorIndex == INVALID) ! { ! if ((obj_ptr->detail.rcb->fill != NONEPAT && ! obj_ptr->detail.rcb->fill != BACKPAT) || ! (obj_ptr->detail.rcb->pen != NONEPAT && ! obj_ptr->detail.rcb->pen != BACKPAT)) ! *ColorIndex = obj_ptr->color; ! } ! else if (obj_ptr->color != *ColorIndex) ! { ! if ((obj_ptr->detail.rcb->fill != NONEPAT && ! obj_ptr->detail.rcb->fill != BACKPAT) || ! (obj_ptr->detail.rcb->pen != NONEPAT && ! obj_ptr->detail.rcb->pen != BACKPAT)) ! return (FALSE); } ! break; ! case OBJ_XBM: ! if (*ColorIndex == INVALID) ! { ! if (obj_ptr->detail.xbm->fill != NONEPAT && ! obj_ptr->detail.xbm->fill != BACKPAT) ! *ColorIndex = obj_ptr->color; ! } ! else if (obj_ptr->color != *ColorIndex) ! { ! if (obj_ptr->detail.xbm->fill != NONEPAT && ! obj_ptr->detail.xbm->fill != BACKPAT) ! return (FALSE); } ! break; ! ! case OBJ_XPM: ! if (*ColorIndex == INVALID) ! { *ColorIndex = obj_ptr->color; } ! else if (obj_ptr->color != *ColorIndex) ! { ! return (FALSE); } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! if (!OneColorObject (obj_ptr, ColorIndex)) ! return (FALSE); ! break; } ! return (TRUE); } --- 826,988 ---- } ! int OneColorObject(ObjPtr, ColorIndex) ! struct ObjRec *ObjPtr; ! int *ColorIndex; ! { ! register struct ObjRec *obj_ptr; ! ! for (obj_ptr=ObjPtr->detail.r->last; obj_ptr!=NULL; obj_ptr=obj_ptr->prev) { ! switch (obj_ptr->type) { ! case OBJ_POLY: ! if (*ColorIndex == INVALID) { ! if ((obj_ptr->detail.p->fill != NONEPAT && ! obj_ptr->detail.p->fill != BACKPAT) || ! (obj_ptr->detail.p->pen != NONEPAT && ! obj_ptr->detail.p->pen != BACKPAT)) { ! *ColorIndex = obj_ptr->color; } ! } else if (obj_ptr->color != *ColorIndex) { ! if ((obj_ptr->detail.p->fill != NONEPAT && ! obj_ptr->detail.p->fill != BACKPAT) || ! (obj_ptr->detail.p->pen != NONEPAT && ! obj_ptr->detail.p->pen != BACKPAT)) { ! return FALSE; } ! } ! break; ! case OBJ_BOX: ! if (*ColorIndex == INVALID) { ! if ((obj_ptr->detail.b->fill != NONEPAT && ! obj_ptr->detail.b->fill != BACKPAT) || ! (obj_ptr->detail.b->pen != NONEPAT && ! obj_ptr->detail.b->pen != BACKPAT)) { ! *ColorIndex = obj_ptr->color; } ! } else if (obj_ptr->color != *ColorIndex) { ! if ((obj_ptr->detail.b->fill != NONEPAT && ! obj_ptr->detail.b->fill != BACKPAT) || ! (obj_ptr->detail.b->pen != NONEPAT && ! obj_ptr->detail.b->pen != BACKPAT)) { ! return FALSE; } ! } ! break; ! case OBJ_OVAL: ! if (*ColorIndex == INVALID) { ! if ((obj_ptr->detail.o->fill != NONEPAT && ! obj_ptr->detail.o->fill != BACKPAT) || ! (obj_ptr->detail.o->pen != NONEPAT && ! obj_ptr->detail.o->pen != BACKPAT)) { ! *ColorIndex = obj_ptr->color; } ! } else if (obj_ptr->color != *ColorIndex) { ! if ((obj_ptr->detail.o->fill != NONEPAT && ! obj_ptr->detail.o->fill != BACKPAT) || ! (obj_ptr->detail.o->pen != NONEPAT && ! obj_ptr->detail.o->pen != BACKPAT)) { ! return FALSE; } ! } ! break; ! case OBJ_TEXT: ! if (*ColorIndex == INVALID) { ! if ((obj_ptr->detail.t->fill != NONEPAT && ! obj_ptr->detail.t->fill != BACKPAT) || ! (obj_ptr->detail.t->pen != NONEPAT && ! obj_ptr->detail.t->pen != BACKPAT)) { ! *ColorIndex = obj_ptr->color; } ! } else if (obj_ptr->color != *ColorIndex) { ! if ((obj_ptr->detail.t->fill != NONEPAT && ! obj_ptr->detail.t->fill != BACKPAT) || ! (obj_ptr->detail.t->pen != NONEPAT && ! obj_ptr->detail.t->pen != BACKPAT)) { ! return FALSE; } ! } ! break; ! case OBJ_POLYGON: ! if (*ColorIndex == INVALID) { ! if ((obj_ptr->detail.g->fill != NONEPAT && ! obj_ptr->detail.g->fill != BACKPAT) || ! (obj_ptr->detail.g->pen != NONEPAT && ! obj_ptr->detail.g->pen != BACKPAT)) { *ColorIndex = obj_ptr->color; } ! } else if (obj_ptr->color != *ColorIndex) { ! if ((obj_ptr->detail.g->fill != NONEPAT && ! obj_ptr->detail.g->fill != BACKPAT) || ! (obj_ptr->detail.g->pen != NONEPAT && ! obj_ptr->detail.g->pen != BACKPAT)) { ! return FALSE; } ! } ! break; ! case OBJ_ARC: ! if (*ColorIndex == INVALID) { ! if ((obj_ptr->detail.a->fill != NONEPAT && ! obj_ptr->detail.a->fill != BACKPAT) || ! (obj_ptr->detail.a->pen != NONEPAT && ! obj_ptr->detail.a->pen != BACKPAT)) { ! *ColorIndex = obj_ptr->color; ! } ! } else if (obj_ptr->color != *ColorIndex) { ! if ((obj_ptr->detail.a->fill != NONEPAT && ! obj_ptr->detail.a->fill != BACKPAT) || ! (obj_ptr->detail.a->pen != NONEPAT && ! obj_ptr->detail.a->pen != BACKPAT)) { ! return FALSE; ! } ! } ! break; ! case OBJ_RCBOX: ! if (*ColorIndex == INVALID) { ! if ((obj_ptr->detail.rcb->fill != NONEPAT && ! obj_ptr->detail.rcb->fill != BACKPAT) || ! (obj_ptr->detail.rcb->pen != NONEPAT && ! obj_ptr->detail.rcb->pen != BACKPAT)) { ! *ColorIndex = obj_ptr->color; ! } ! } else if (obj_ptr->color != *ColorIndex) { ! if ((obj_ptr->detail.rcb->fill != NONEPAT && ! obj_ptr->detail.rcb->fill != BACKPAT) || ! (obj_ptr->detail.rcb->pen != NONEPAT && ! obj_ptr->detail.rcb->pen != BACKPAT)) { ! return FALSE; ! } ! } ! break; ! case OBJ_XBM: ! if (*ColorIndex == INVALID) { ! if (obj_ptr->detail.xbm->fill != NONEPAT && ! obj_ptr->detail.xbm->fill != BACKPAT) { ! *ColorIndex = obj_ptr->color; ! } ! } else if (obj_ptr->color != *ColorIndex) { ! if (obj_ptr->detail.xbm->fill != NONEPAT && ! obj_ptr->detail.xbm->fill != BACKPAT) { ! return FALSE; ! } ! } ! break; ! case OBJ_XPM: ! if (*ColorIndex == INVALID) { ! *ColorIndex = obj_ptr->color; ! } else if (obj_ptr->color != *ColorIndex) { ! return FALSE; ! } ! break; + case OBJ_GROUP: + case OBJ_SYM: + case OBJ_ICON: + if (!OneColorObject(obj_ptr, ColorIndex)) { + return FALSE; + } + break; } ! } ! return TRUE; } *************** *** 1160,1168 **** } ! void SetUpColorMenuPixmap (fore_colors, init_rv, pixmap, rows, cols) ! int * * fore_colors, * * init_rv, * rows, * cols; ! Pixmap * * pixmap; { ! register int i; *pixmap = (Pixmap*)malloc(maxColors*sizeof(Pixmap)); --- 1163,1171 ---- } ! void SetUpColorMenuPixmap(fore_colors, init_rv, pixmap, rows, cols) ! int **fore_colors, **init_rv, *rows, *cols; ! Pixmap **pixmap; { ! register int i; *pixmap = (Pixmap*)malloc(maxColors*sizeof(Pixmap)); *************** *** 1172,1176 **** FailAllocMessage(); } ! for (i = 0; i < maxColors; i++) { (*pixmap)[i] = patPixmap[SOLIDPAT]; (*fore_colors)[i] = colorPixels[i]; --- 1175,1179 ---- FailAllocMessage(); } ! for (i=0; i < maxColors; i++) { (*pixmap)[i] = patPixmap[SOLIDPAT]; (*fore_colors)[i] = colorPixels[i]; *************** *** 1181,1193 **** } ! int ColorMenu (X, Y, TrackMenubar) ! int X, Y, TrackMenubar; { ! register int i; ! Pixmap * pixmap; ! int index, * fore_colors, * init_rv, rows, cols; ! char * * desc; ! if (!colorDisplay) return (INVALID); desc = (char**)malloc((maxColors+1)*sizeof(char*)); --- 1184,1196 ---- } ! int ColorMenu(X, Y, TrackMenubar) ! int X, Y, TrackMenubar; { ! register int i; ! Pixmap *pixmap; ! int index, *fore_colors, *init_rv, rows, cols; ! char **desc; ! if (!colorDisplay) return INVALID; desc = (char**)malloc((maxColors+1)*sizeof(char*)); *************** *** 1199,1212 **** } desc[i] = NULL; ! SetUpColorMenuPixmap (&fore_colors, &init_rv, &pixmap, &rows, &cols); activeMenu = MENU_COLOR; ! index = PxMpMenuLoop (X, Y, choiceImageW, choiceImageH, rows, cols, maxColors, fore_colors, pixmap, init_rv, desc, MULTICOLOR, TrackMenubar); free(pixmap); ! if (index >= 0) ChangeAllSelColor (index, TRUE); ! if (desc != NULL) ! { for (i=0; i < maxColors; i++) { if (desc[i] != NULL) { --- 1202,1214 ---- } desc[i] = NULL; ! SetUpColorMenuPixmap(&fore_colors, &init_rv, &pixmap, &rows, &cols); activeMenu = MENU_COLOR; ! index = PxMpMenuLoop(X, Y, choiceImageW, choiceImageH, rows, cols, maxColors, fore_colors, pixmap, init_rv, desc, MULTICOLOR, TrackMenubar); free(pixmap); ! if (index >= 0) ChangeAllSelColor(index, TRUE); ! if (desc != NULL) { for (i=0; i < maxColors; i++) { if (desc[i] != NULL) { *************** *** 1216,1225 **** free(desc); } ! return (index); } ! void CleanUpColors () { ! register int i; if (privateColorInfo != NULL) { --- 1218,1227 ---- free(desc); } ! return index; } ! void CleanUpColors() { ! register int i; if (privateColorInfo != NULL) { *************** *** 1243,1247 **** if (colorMenuItems != NULL) { ! for (i = 0; i < maxColors; i++) { if (colorMenuItems[i] != NULL) free(colorMenuItems[i]); } --- 1245,1249 ---- if (colorMenuItems != NULL) { ! for (i=0; i < maxColors; i++) { if (colorMenuItems[i] != NULL) free(colorMenuItems[i]); } *************** *** 1523,1527 **** to_pixels = (unsigned long *)malloc(ncolors*sizeof(unsigned long)); if (from_pixels == NULL || to_pixels == NULL) FailAllocMessage(); ! for (i = 0; i < ncolors; i++) { from_pixels[i] = xpm_ptr->pixels[i]; index = QuickFindColorIndex(NULL, xpm_ptr->color_str[i], --- 1525,1529 ---- to_pixels = (unsigned long *)malloc(ncolors*sizeof(unsigned long)); if (from_pixels == NULL || to_pixels == NULL) FailAllocMessage(); ! for (i=0; i < ncolors; i++) { from_pixels[i] = xpm_ptr->pixels[i]; index = QuickFindColorIndex(NULL, xpm_ptr->color_str[i], *************** *** 1664,1668 **** if (old_color_str == NULL) FailAllocMessage(); old_allocated_colors = maxColors; ! for (i = 0; i < maxColors; i++) { old_color_str[i] = (char*)malloc((strlen(colorMenuItems[i])+1)*sizeof(char)); --- 1666,1670 ---- if (old_color_str == NULL) FailAllocMessage(); old_allocated_colors = maxColors; ! for (i=0; i < maxColors; i++) { old_color_str[i] = (char*)malloc((strlen(colorMenuItems[i])+1)*sizeof(char)); *************** *** 1723,1727 **** } RestoreStatusStrings(); ! for (i = 0; i < old_allocated_colors; i++) free(old_color_str[i]); free(old_color_str); --- 1725,1729 ---- } RestoreStatusStrings(); ! for (i=0; i < old_allocated_colors; i++) free(old_color_str[i]); free(old_color_str); *************** *** 1814,1818 **** return FALSE; } ! if (PRTGIF && cmdLineColor) { CleanUpColors(); maxColors = max_colors; --- 1816,1820 ---- return FALSE; } ! if (PRTGIF && !cmdLineOpenDisplay && cmdLineColor) { CleanUpColors(); maxColors = max_colors; *************** *** 1830,1834 **** } } ! if (!PRTGIF && !importingFile) { colorLayers = color_layers; } --- 1832,1836 ---- } } ! if ((!(PRTGIF && !cmdLineOpenDisplay)) && !importingFile) { colorLayers = color_layers; } *************** *** 1840,1847 **** scanLineNum++; ! if (*line == ']') break; ! ! if (PRTGIF && cmdLineColor && index >= maxColors) { fprintf(stderr, "Warning: too many lines in color_info.\n"); break; } --- 1842,1852 ---- scanLineNum++; ! if (*line == ']') { ! free(line); ! break; ! } ! if (PRTGIF && !cmdLineOpenDisplay && cmdLineColor && index >= maxColors) { fprintf(stderr, "Warning: too many lines in color_info.\n"); + free(line); break; } *************** *** 1858,1862 **** return FALSE; } ! if (PRTGIF && cmdLineColor) { UtilStrCpy(colorMenuItems[index], COLORSTRLEN*sizeof(char), color_s); if (cmdLineRequestedColor) { --- 1863,1867 ---- return FALSE; } ! if (PRTGIF && !cmdLineOpenDisplay && cmdLineColor) { UtilStrCpy(colorMenuItems[index], COLORSTRLEN*sizeof(char), color_s); if (cmdLineRequestedColor) { *************** *** 1871,1875 **** index++; } ! if (!PRTGIF && !importingFile) { int new_alloc=FALSE; int cur_index=QuickFindColorIndex(NULL, color_s, &new_alloc, TRUE); --- 1876,1880 ---- index++; } ! if ((!(PRTGIF && !cmdLineOpenDisplay)) && !importingFile) { int new_alloc=FALSE; int cur_index=QuickFindColorIndex(NULL, color_s, &new_alloc, TRUE); *************** *** 1892,1906 **** if (colorDump) { ! for (i=0; i < Indent; i++) fprintf (FP, " "); if (tgifColors[ColorIndex].red == 0 && tgifColors[ColorIndex].green == 0 && tgifColors[ColorIndex].blue == 0) { ! fprintf (FP, "0 setgray"); } else if (tgifColors[ColorIndex].red == maxRGB && tgifColors[ColorIndex].green == maxRGB && tgifColors[ColorIndex].blue == maxRGB) { ! fprintf (FP, "1 setgray"); } else { ! fprintf (FP, "%.3f %.3f %.3f setrgbcolor", ((float)tgifColors[ColorIndex].red/maxRGB), ((float)tgifColors[ColorIndex].green/maxRGB), --- 1897,1911 ---- if (colorDump) { ! for (i=0; i < Indent; i++) fprintf(FP, " "); if (tgifColors[ColorIndex].red == 0 && tgifColors[ColorIndex].green == 0 && tgifColors[ColorIndex].blue == 0) { ! fprintf(FP, "0 setgray"); } else if (tgifColors[ColorIndex].red == maxRGB && tgifColors[ColorIndex].green == maxRGB && tgifColors[ColorIndex].blue == maxRGB) { ! fprintf(FP, "1 setgray"); } else { ! fprintf(FP, "%.3f %.3f %.3f setrgbcolor", ((float)tgifColors[ColorIndex].red/maxRGB), ((float)tgifColors[ColorIndex].green/maxRGB), *************** *** 1909,1914 **** fprintf(FP, "%c", EndOfLine ? '\n' : ' '); } else { ! for (i=0; i < Indent; i++) fprintf (FP, " "); ! fprintf (FP, "0 setgray\n"); } } --- 1914,1919 ---- fprintf(FP, "%c", EndOfLine ? '\n' : ' '); } else { ! for (i=0; i < Indent; i++) fprintf(FP, " "); ! fprintf(FP, "0 setgray\n"); } } *** cursor.c.orig Tue Sep 30 13:22:54 1997 --- cursor.c Tue Sep 30 13:22:54 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cursor.c,v 3.2 1996/10/31 03:25:58 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cursor.c,v 3.3 1997/09/14 20:37:49 william Exp $ */ #include *** cutpaste.c.orig Tue Sep 30 13:22:55 1997 --- cutpaste.c Tue Sep 30 13:22:55 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cutpaste.c,v 3.2 1996/10/28 00:53:55 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cutpaste.c,v 3.3 1997/09/14 20:37:49 william Exp $ */ #include *** dialog.c.orig Tue Sep 30 13:22:57 1997 --- dialog.c Tue Sep 30 13:22:57 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/dialog.c,v 3.3 1996/10/28 00:57:21 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/dialog.c,v 3.5 1997/09/14 20:37:49 william Exp $ */ #include *************** *** 1149,1155 **** int IconAndBtns; { ! char *dup_msg=UtilStrDup(Message); int rc=MB_ID_FAILED, looping=TRUE; if (dup_msg == NULL) { FailAllocMessage(); --- 1147,1158 ---- int IconAndBtns; { ! char *dup_msg=NULL; int rc=MB_ID_FAILED, looping=TRUE; + if (PRTGIF) { + fprintf(stderr, "%s\n", Message); + return rc; + } + dup_msg = UtilStrDup(Message); if (dup_msg == NULL) { FailAllocMessage(); *** drawing.c.orig Tue Sep 30 13:22:59 1997 --- drawing.c Tue Sep 30 13:22:59 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/drawing.c,v 3.17 1997/01/30 03:59:40 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/drawing.c,v 3.19 1997/09/14 20:37:50 william Exp $ */ #include *************** *** 1764,1769 **** } else if (strcmp(name, "FindAgain()") == 0) { FindAgain(); ! } else if (strcmp(name, "CurrentVersionInfo()") == 0) { ! CurrentVersionInfo(); } } --- 1762,1768 ---- } else if (strcmp(name, "FindAgain()") == 0) { FindAgain(); ! } else if (strcmp(name, "CurrentVersionInfo()") == 0 || ! strcmp(name, "LatestReleaseInfo()") == 0) { ! LatestReleaseInfo(); } } *** dup.c.orig Tue Sep 30 13:23:00 1997 --- dup.c Tue Sep 30 13:23:00 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/dup.c,v 3.2 1996/10/30 18:25:09 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/dup.c,v 3.4 1997/09/16 04:47:20 william Exp $ */ #include *************** *** 65,140 **** int dupDx = INVALID, dupDy = INVALID; ! void CopyObjId (FromObjPtr, ToObjPtr) ! struct ObjRec * FromObjPtr, * ToObjPtr; { ! register struct ObjRec * from_obj_ptr, * to_obj_ptr; ! register struct AttrRec * from_attr_ptr, * to_attr_ptr; ToObjPtr->id = FromObjPtr->id; ! switch (FromObjPtr->type) ! { ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! from_obj_ptr = FromObjPtr->detail.r->first; ! to_obj_ptr = ToObjPtr->detail.r->first; ! for ( ; from_obj_ptr!=NULL; from_obj_ptr=from_obj_ptr->next, ! to_obj_ptr=to_obj_ptr->next) ! CopyObjId (from_obj_ptr, to_obj_ptr); } from_attr_ptr = FromObjPtr->fattr; to_attr_ptr = ToObjPtr->fattr; for ( ; from_attr_ptr!=NULL; from_attr_ptr=from_attr_ptr->next, ! to_attr_ptr=to_attr_ptr->next) ! CopyObjId (from_attr_ptr->obj, to_attr_ptr->obj); } ! void CopyObjLocks (FromObjPtr, ToObjPtr) ! struct ObjRec * FromObjPtr, * ToObjPtr; { ! register struct ObjRec * from_obj_ptr, * to_obj_ptr; ! register struct AttrRec * from_attr_ptr, * to_attr_ptr; ToObjPtr->locked = FromObjPtr->locked; ! switch (FromObjPtr->type) ! { ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! from_obj_ptr = FromObjPtr->detail.r->first; ! to_obj_ptr = ToObjPtr->detail.r->first; ! for ( ; from_obj_ptr!=NULL; from_obj_ptr=from_obj_ptr->next, ! to_obj_ptr=to_obj_ptr->next) ! CopyObjLocks (from_obj_ptr, to_obj_ptr); } from_attr_ptr = FromObjPtr->fattr; to_attr_ptr = ToObjPtr->fattr; for ( ; from_attr_ptr!=NULL; from_attr_ptr=from_attr_ptr->next, ! to_attr_ptr=to_attr_ptr->next) ! CopyObjLocks (from_attr_ptr->obj, to_attr_ptr->obj); } ! void UnlockAnObj (ObjPtr) ! struct ObjRec * ObjPtr; { ! register struct ObjRec * obj_ptr; ! register struct AttrRec * attr_ptr; ObjPtr->locked = FALSE; ! switch (ObjPtr->type) ! { ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! for (obj_ptr=ObjPtr->detail.r->first; obj_ptr!=NULL; ! obj_ptr=obj_ptr->next) ! UnlockAnObj (obj_ptr); } ! for (attr_ptr=ObjPtr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) attr_ptr->obj->locked = FALSE; } ! void DupObjXfrmMtrx (FromObjPtr, ToObjPtr) ! register struct ObjRec * FromObjPtr, * ToObjPtr; { ToObjPtr->ctm = NULL; --- 63,141 ---- int dupDx = INVALID, dupDy = INVALID; ! void CopyObjId(FromObjPtr, ToObjPtr) ! struct ObjRec *FromObjPtr, *ToObjPtr; { ! register struct ObjRec *from_obj_ptr, *to_obj_ptr; ! register struct AttrRec *from_attr_ptr, *to_attr_ptr; ToObjPtr->id = FromObjPtr->id; ! switch (FromObjPtr->type) { ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! from_obj_ptr = FromObjPtr->detail.r->first; ! to_obj_ptr = ToObjPtr->detail.r->first; ! for ( ; from_obj_ptr!=NULL; from_obj_ptr=from_obj_ptr->next, ! to_obj_ptr=to_obj_ptr->next) { ! CopyObjId(from_obj_ptr, to_obj_ptr); ! } } from_attr_ptr = FromObjPtr->fattr; to_attr_ptr = ToObjPtr->fattr; for ( ; from_attr_ptr!=NULL; from_attr_ptr=from_attr_ptr->next, ! to_attr_ptr=to_attr_ptr->next) { ! CopyObjId(from_attr_ptr->obj, to_attr_ptr->obj); ! } } ! void CopyObjLocks(FromObjPtr, ToObjPtr) ! struct ObjRec *FromObjPtr, *ToObjPtr; { ! register struct ObjRec *from_obj_ptr, *to_obj_ptr; ! register struct AttrRec *from_attr_ptr, *to_attr_ptr; ToObjPtr->locked = FromObjPtr->locked; ! switch (FromObjPtr->type) { ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! from_obj_ptr = FromObjPtr->detail.r->first; ! to_obj_ptr = ToObjPtr->detail.r->first; ! for ( ; from_obj_ptr!=NULL; from_obj_ptr=from_obj_ptr->next, ! to_obj_ptr=to_obj_ptr->next) { ! CopyObjLocks(from_obj_ptr, to_obj_ptr); ! } } from_attr_ptr = FromObjPtr->fattr; to_attr_ptr = ToObjPtr->fattr; for ( ; from_attr_ptr!=NULL; from_attr_ptr=from_attr_ptr->next, ! to_attr_ptr=to_attr_ptr->next) { ! CopyObjLocks(from_attr_ptr->obj, to_attr_ptr->obj); ! } } ! void UnlockAnObj(ObjPtr) ! struct ObjRec *ObjPtr; { ! register struct ObjRec *obj_ptr; ! register struct AttrRec *attr_ptr; ObjPtr->locked = FALSE; ! switch (ObjPtr->type) { ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! for (obj_ptr=ObjPtr->detail.r->first; obj_ptr!=NULL; ! obj_ptr=obj_ptr->next) { ! UnlockAnObj(obj_ptr); ! } } ! for (attr_ptr=ObjPtr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) { attr_ptr->obj->locked = FALSE; + } } ! void DupObjXfrmMtrx(FromObjPtr, ToObjPtr) ! register struct ObjRec *FromObjPtr, *ToObjPtr; { ToObjPtr->ctm = NULL; *************** *** 146,151 **** } ! void DupObjBasics (FromObjPtr, ToObjPtr) ! register struct ObjRec * FromObjPtr, * ToObjPtr; { ToObjPtr->next = ToObjPtr->prev = NULL; --- 147,152 ---- } ! void DupObjBasics(FromObjPtr, ToObjPtr) ! register struct ObjRec *FromObjPtr, *ToObjPtr; { ToObjPtr->next = ToObjPtr->prev = NULL; *************** *** 168,186 **** ToObjPtr->invisible = FromObjPtr->invisible; ! memcpy (&ToObjPtr->orig_obbox, &FromObjPtr->orig_obbox, sizeof(struct BBRec)); ! memcpy (ToObjPtr->rotated_obbox, FromObjPtr->rotated_obbox, 5*sizeof(XPoint)); ! DupObjXfrmMtrx (FromObjPtr, ToObjPtr); } ! void DupPolyObj (PolyPtr, ObjPtr) ! struct PolyRec * PolyPtr; ! struct ObjRec * ObjPtr; { ! register int i, num_pts; ! register struct PolyRec * poly_ptr; ! register XPoint *sv; ! register IntPoint *pv; poly_ptr = (struct PolyRec *)malloc(sizeof(struct PolyRec)); --- 169,187 ---- ToObjPtr->invisible = FromObjPtr->invisible; ! memcpy(&ToObjPtr->orig_obbox, &FromObjPtr->orig_obbox, sizeof(struct BBRec)); ! memcpy(ToObjPtr->rotated_obbox, FromObjPtr->rotated_obbox, 5*sizeof(XPoint)); ! DupObjXfrmMtrx(FromObjPtr, ToObjPtr); } ! void DupPolyObj(PolyPtr, ObjPtr) ! struct PolyRec *PolyPtr; ! struct ObjRec *ObjPtr; { ! register int i, num_pts; ! register struct PolyRec *poly_ptr; ! register XPoint *sv; ! register IntPoint *pv; poly_ptr = (struct PolyRec *)malloc(sizeof(struct PolyRec)); *************** *** 196,200 **** poly_ptr->smooth = NULL; } ! for (i = 0; i < num_pts; i++) { pv[i].x = PolyPtr->vlist[i].x; pv[i].y = PolyPtr->vlist[i].y; --- 197,201 ---- poly_ptr->smooth = NULL; } ! for (i=0; i < num_pts; i++) { pv[i].x = PolyPtr->vlist[i].x; pv[i].y = PolyPtr->vlist[i].y; *************** *** 218,222 **** sv = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { sv[i].x = PolyPtr->svlist[i].x; sv[i].y = PolyPtr->svlist[i].y; --- 219,223 ---- sv = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { sv[i].x = PolyPtr->svlist[i].x; sv[i].y = PolyPtr->svlist[i].y; *************** *** 232,236 **** pv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); if (pv == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { pv[i].x = PolyPtr->intvlist[i].x; pv[i].y = PolyPtr->intvlist[i].y; --- 233,237 ---- pv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); if (pv == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { pv[i].x = PolyPtr->intvlist[i].x; pv[i].y = PolyPtr->intvlist[i].y; *************** *** 247,251 **** sv = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { sv[i].x = PolyPtr->rotated_vlist[i].x; sv[i].y = PolyPtr->rotated_vlist[i].y; --- 248,252 ---- sv = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { sv[i].x = PolyPtr->rotated_vlist[i].x; sv[i].y = PolyPtr->rotated_vlist[i].y; *************** *** 260,271 **** } ! void DupPolygonObj (PolygonPtr, ObjPtr) ! struct PolygonRec * PolygonPtr; ! struct ObjRec * ObjPtr; ! { ! register int i, num_pts; ! register struct PolygonRec * polygon_ptr; ! XPoint *sv; ! IntPoint *pv; polygon_ptr = (struct PolygonRec *)malloc(sizeof(struct PolygonRec)); --- 261,272 ---- } ! void DupPolygonObj(PolygonPtr, ObjPtr) ! struct PolygonRec *PolygonPtr; ! struct ObjRec *ObjPtr; ! { ! register int i, num_pts; ! register struct PolygonRec *polygon_ptr; ! XPoint *sv; ! IntPoint *pv; polygon_ptr = (struct PolygonRec *)malloc(sizeof(struct PolygonRec)); *************** *** 281,285 **** polygon_ptr->smooth = NULL; } ! for (i = 0; i < num_pts; i++) { pv[i].x = PolygonPtr->vlist[i].x; pv[i].y = PolygonPtr->vlist[i].y; --- 282,286 ---- polygon_ptr->smooth = NULL; } ! for (i=0; i < num_pts; i++) { pv[i].x = PolygonPtr->vlist[i].x; pv[i].y = PolygonPtr->vlist[i].y; *************** *** 298,302 **** sv = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { sv[i].x = PolygonPtr->svlist[i].x; sv[i].y = PolygonPtr->svlist[i].y; --- 299,303 ---- sv = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { sv[i].x = PolygonPtr->svlist[i].x; sv[i].y = PolygonPtr->svlist[i].y; *************** *** 312,316 **** pv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); if (pv == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { pv[i].x = PolygonPtr->intvlist[i].x; pv[i].y = PolygonPtr->intvlist[i].y; --- 313,317 ---- pv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); if (pv == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { pv[i].x = PolygonPtr->intvlist[i].x; pv[i].y = PolygonPtr->intvlist[i].y; *************** *** 327,331 **** sv = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { sv[i].x = PolygonPtr->rotated_vlist[i].x; sv[i].y = PolygonPtr->rotated_vlist[i].y; --- 328,332 ---- sv = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (sv == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { sv[i].x = PolygonPtr->rotated_vlist[i].x; sv[i].y = PolygonPtr->rotated_vlist[i].y; *************** *** 340,348 **** } ! void DupOvalObj (OvalPtr, ObjPtr) ! struct OvalRec * OvalPtr; ! struct ObjRec * ObjPtr; { ! register struct OvalRec * oval_ptr; oval_ptr = (struct OvalRec *)malloc(sizeof(struct OvalRec)); --- 341,349 ---- } ! void DupOvalObj(OvalPtr, ObjPtr) ! struct OvalRec *OvalPtr; ! struct ObjRec *ObjPtr; { ! register struct OvalRec *oval_ptr; oval_ptr = (struct OvalRec *)malloc(sizeof(struct OvalRec)); *************** *** 355,375 **** oval_ptr->dash = OvalPtr->dash; if (ObjPtr->ctm != NULL && OvalPtr->rotated_n != 0 && ! OvalPtr->rotated_vlist != NULL) ! { ! int i, num_pts; ! XPoint * v; oval_ptr->rotated_n = num_pts = OvalPtr->rotated_n; v = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (v == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) ! { v[i].x = OvalPtr->rotated_vlist[i].x; v[i].y = OvalPtr->rotated_vlist[i].y; } oval_ptr->rotated_vlist = v; ! } ! else ! { oval_ptr->rotated_n = 0; oval_ptr->rotated_vlist = NULL; --- 356,372 ---- oval_ptr->dash = OvalPtr->dash; if (ObjPtr->ctm != NULL && OvalPtr->rotated_n != 0 && ! OvalPtr->rotated_vlist != NULL) { ! int i, num_pts; ! XPoint *v; oval_ptr->rotated_n = num_pts = OvalPtr->rotated_n; v = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (v == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { v[i].x = OvalPtr->rotated_vlist[i].x; v[i].y = OvalPtr->rotated_vlist[i].y; } oval_ptr->rotated_vlist = v; ! } else { oval_ptr->rotated_n = 0; oval_ptr->rotated_vlist = NULL; *************** *** 379,387 **** } ! void DupBoxObj (BoxPtr, ObjPtr) ! struct BoxRec * BoxPtr; ! struct ObjRec * ObjPtr; { ! register struct BoxRec * box_ptr; box_ptr = (struct BoxRec *)malloc(sizeof(struct BoxRec)); --- 376,384 ---- } ! void DupBoxObj(BoxPtr, ObjPtr) ! struct BoxRec *BoxPtr; ! struct ObjRec *ObjPtr; { ! register struct BoxRec *box_ptr; box_ptr = (struct BoxRec *)malloc(sizeof(struct BoxRec)); *************** *** 397,405 **** } ! void DupRCBoxObj (RCBoxPtr, ObjPtr) ! struct RCBoxRec * RCBoxPtr; ! struct ObjRec * ObjPtr; { ! register struct RCBoxRec * rcbox_ptr; rcbox_ptr = (struct RCBoxRec *)malloc(sizeof(struct RCBoxRec)); --- 394,402 ---- } ! void DupRCBoxObj(RCBoxPtr, ObjPtr) ! struct RCBoxRec *RCBoxPtr; ! struct ObjRec *ObjPtr; { ! register struct RCBoxRec *rcbox_ptr; rcbox_ptr = (struct RCBoxRec *)malloc(sizeof(struct RCBoxRec)); *************** *** 420,424 **** v = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (v == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { v[i].x = RCBoxPtr->rotated_vlist[i].x; v[i].y = RCBoxPtr->rotated_vlist[i].y; --- 417,421 ---- v = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); if (v == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { v[i].x = RCBoxPtr->rotated_vlist[i].x; v[i].y = RCBoxPtr->rotated_vlist[i].y; *************** *** 433,441 **** } ! void DupArcObj (ArcPtr, ObjPtr) ! struct ArcRec * ArcPtr; ! struct ObjRec * ObjPtr; { ! register struct ArcRec * arc_ptr; arc_ptr = (struct ArcRec *)malloc(sizeof(struct ArcRec)); --- 430,438 ---- } ! void DupArcObj(ArcPtr, ObjPtr) ! struct ArcRec *ArcPtr; ! struct ObjRec *ObjPtr; { ! register struct ArcRec *arc_ptr; arc_ptr = (struct ArcRec *)malloc(sizeof(struct ArcRec)); *************** *** 469,473 **** v = (XPoint*)malloc((num_pts+2)*sizeof(XPoint)); if (v == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts+2; i++) { v[i].x = ArcPtr->rotated_vlist[i].x; v[i].y = ArcPtr->rotated_vlist[i].y; --- 466,470 ---- v = (XPoint*)malloc((num_pts+2)*sizeof(XPoint)); if (v == NULL) FailAllocMessage(); ! for (i=0; i < num_pts+2; i++) { v[i].x = ArcPtr->rotated_vlist[i].x; v[i].y = ArcPtr->rotated_vlist[i].y; *************** *** 482,494 **** } ! void DupXBmObj (XBmPtr, ObjPtr) ! struct XBmRec * XBmPtr; ! struct ObjRec * ObjPtr; ! { ! register struct XBmRec * xbm_ptr; ! register int i; ! Pixmap bitmap, cached_bitmap; ! int w, h, image_w, image_h; ! char msg[MAXSTRING]; xbm_ptr = (struct XBmRec *)malloc(sizeof(struct XBmRec)); --- 479,490 ---- } ! void DupXBmObj(XBmPtr, ObjPtr) ! struct XBmRec *XBmPtr; ! struct ObjRec *ObjPtr; ! { ! register struct XBmRec *xbm_ptr; ! register int i; ! Pixmap bitmap, cached_bitmap; ! int w, h, image_w, image_h; xbm_ptr = (struct XBmRec *)malloc(sizeof(struct XBmRec)); *************** *** 521,553 **** xbm_ptr->real_type = XBmPtr->real_type; ! if (ObjPtr->ctm != NULL) ! memcpy (&xbm_ptr->cached_ctm, &XBmPtr->cached_ctm, sizeof(struct XfrmMtrxRec)); if (XBmPtr->real_type==XBM_XBM || (XBmPtr->real_type==XBM_EPS && ! XBmPtr->bitmap!=None)) ! { ! bitmap = XCreatePixmap (mainDisplay, mainWindow, image_w, image_h, 1); ! if (bitmap == None) ! { ! sprintf (msg,"Can not copy bitmap of size %1dx%1d.",image_w,image_h); ! Msg (msg); return; } ! XCopyArea (mainDisplay, XBmPtr->bitmap, bitmap, xbmGC, 0, 0, image_w, image_h, 0, 0); xbm_ptr->bitmap = bitmap; ! if (XBmPtr->cached_bitmap != None) ! { w = ZOOMED_SIZE(ObjPtr->obbox.rbx - ObjPtr->obbox.ltx); h = ZOOMED_SIZE(ObjPtr->obbox.rby - ObjPtr->obbox.lty); ! cached_bitmap = XCreatePixmap (mainDisplay, mainWindow, w, h, 1); ! if (cached_bitmap == None) ! { ! sprintf (msg, "Can not copy bitmap of size %1dx%1d.", w, h); ! Msg (msg); return; } ! XCopyArea (mainDisplay, XBmPtr->cached_bitmap, cached_bitmap, xbmGC, 0, 0, w, h, 0, 0); xbm_ptr->cached_bitmap = cached_bitmap; --- 517,544 ---- xbm_ptr->real_type = XBmPtr->real_type; ! if (ObjPtr->ctm != NULL) { ! memcpy(&xbm_ptr->cached_ctm, &XBmPtr->cached_ctm, sizeof(struct XfrmMtrxRec)); + } if (XBmPtr->real_type==XBM_XBM || (XBmPtr->real_type==XBM_EPS && ! XBmPtr->bitmap!=None)) { ! bitmap = XCreatePixmap(mainDisplay, mainWindow, image_w, image_h, 1); ! if (bitmap == None) { ! FailAllocBitmapMessage(image_w, image_h); return; } ! XCopyArea(mainDisplay, XBmPtr->bitmap, bitmap, xbmGC, 0, 0, image_w, image_h, 0, 0); xbm_ptr->bitmap = bitmap; ! if (XBmPtr->cached_bitmap != None) { w = ZOOMED_SIZE(ObjPtr->obbox.rbx - ObjPtr->obbox.ltx); h = ZOOMED_SIZE(ObjPtr->obbox.rby - ObjPtr->obbox.lty); ! cached_bitmap = XCreatePixmap(mainDisplay, mainWindow, w, h, 1); ! if (cached_bitmap == None) { ! FailAllocBitmapMessage(w, h); return; } ! XCopyArea(mainDisplay, XBmPtr->cached_bitmap, cached_bitmap, xbmGC, 0, 0, w, h, 0, 0); xbm_ptr->cached_bitmap = cached_bitmap; *************** *** 576,589 **** } ! void DupXPmObj (XPmPtr, ObjPtr) ! struct XPmRec * XPmPtr; ! struct ObjRec * ObjPtr; ! { ! register struct XPmRec * xpm_ptr; ! register int j, i; ! Pixmap pixmap, bitmap, cached_pixmap, cached_bitmap; ! int w, h, ncolors, * pixels, len, chars_per_pixel; ! int image_w, image_h; ! char * color_char, * * color_str, msg[MAXSTRING]; xpm_ptr = (struct XPmRec *)malloc(sizeof(struct XPmRec)); --- 567,579 ---- } ! void DupXPmObj(XPmPtr, ObjPtr) ! struct XPmRec *XPmPtr; ! struct ObjRec *ObjPtr; ! { ! register struct XPmRec *xpm_ptr; ! register int j, i; ! Pixmap pixmap, bitmap, cached_pixmap, cached_bitmap; ! int w, h, ncolors, *pixels, len, chars_per_pixel, image_w, image_h; ! char *color_char, **color_str; xpm_ptr = (struct XPmRec *)malloc(sizeof(struct XPmRec)); *************** *** 614,636 **** xpm_ptr->clip_mask = None; ! if (ObjPtr->ctm != NULL) ! memcpy (&xpm_ptr->cached_ctm, &XPmPtr->cached_ctm, sizeof(struct XfrmMtrxRec)); pixmap = XCreatePixmap(mainDisplay,mainWindow,image_w,image_h,mainDepth); if (pixmap == None) { ! sprintf(msg, "Can not copy pixmap of size %1dx%1d.", image_w, image_h); ! Msg(msg); return; } ! XCopyArea (mainDisplay,XPmPtr->pixmap,pixmap,xpmGC,0,0,image_w,image_h,0,0); xpm_ptr->pixmap = pixmap; bitmap = XCreatePixmap(mainDisplay,mainWindow,image_w,image_h,1); if (bitmap == None) { ! sprintf(msg, "Can not copy bitmap of size %1dx%1d.", image_w, image_h); ! Msg(msg); return; } ! XCopyArea (mainDisplay,XPmPtr->bitmap,bitmap,xbmGC,0,0,image_w,image_h,0,0); xpm_ptr->bitmap = bitmap; --- 604,625 ---- xpm_ptr->clip_mask = None; ! if (ObjPtr->ctm != NULL) { ! memcpy(&xpm_ptr->cached_ctm, &XPmPtr->cached_ctm, sizeof(struct XfrmMtrxRec)); + } pixmap = XCreatePixmap(mainDisplay,mainWindow,image_w,image_h,mainDepth); if (pixmap == None) { ! FailAllocPixmapMessage(image_w, image_h); return; } ! XCopyArea(mainDisplay,XPmPtr->pixmap,pixmap,xpmGC,0,0,image_w,image_h,0,0); xpm_ptr->pixmap = pixmap; bitmap = XCreatePixmap(mainDisplay,mainWindow,image_w,image_h,1); if (bitmap == None) { ! FailAllocBitmapMessage(image_w, image_h); return; } ! XCopyArea(mainDisplay,XPmPtr->bitmap,bitmap,xbmGC,0,0,image_w,image_h,0,0); xpm_ptr->bitmap = bitmap; *************** *** 641,646 **** cached_pixmap = XCreatePixmap(mainDisplay, mainWindow, w, h, mainDepth); if (cached_pixmap == None) { ! sprintf(msg, "Can not copy pixmap of size %1dx%1d.", w, h); ! Msg(msg); return; } --- 630,634 ---- cached_pixmap = XCreatePixmap(mainDisplay, mainWindow, w, h, mainDepth); if (cached_pixmap == None) { ! FailAllocPixmapMessage(w, h); return; } *************** *** 652,657 **** cached_bitmap = XCreatePixmap(mainDisplay, mainWindow, w, h, 1); if (cached_bitmap == None) { ! sprintf(msg, "Can not copy bitmap of size %1dx%1d.", w, h); ! Msg(msg); return; } --- 640,644 ---- cached_bitmap = XCreatePixmap(mainDisplay, mainWindow, w, h, 1); if (cached_bitmap == None) { ! FailAllocBitmapMessage(w, h); return; } *************** *** 670,675 **** pixels = xpm_ptr->pixels = (int*)malloc(ncolors*sizeof(int)); if (color_char==NULL || color_str==NULL || pixels==NULL) FailAllocMessage(); ! for (i = 0; i < ncolors; i++) { ! for (j = 0; j < chars_per_pixel; j++) { color_char[i*chars_per_pixel+j] = XPmPtr->color_char[i*chars_per_pixel+j]; --- 657,662 ---- pixels = xpm_ptr->pixels = (int*)malloc(ncolors*sizeof(int)); if (color_char==NULL || color_str==NULL || pixels==NULL) FailAllocMessage(); ! for (i=0; i < ncolors; i++) { ! for (j=0; j < chars_per_pixel; j++) { color_char[i*chars_per_pixel+j] = XPmPtr->color_char[i*chars_per_pixel+j]; *************** *** 677,681 **** pixels[i] = XPmPtr->pixels[i]; ! len = strlen (XPmPtr->color_str[i]); color_str[i] = (char*)malloc((len+1)*sizeof(char)); if (color_str[i] == NULL) FailAllocMessage(); --- 664,668 ---- pixels[i] = XPmPtr->pixels[i]; ! len = strlen(XPmPtr->color_str[i]); color_str[i] = (char*)malloc((len+1)*sizeof(char)); if (color_str[i] == NULL) FailAllocMessage(); *************** *** 683,699 **** } xpm_ptr->red = xpm_ptr->green = xpm_ptr->blue = NULL; ! if (ObjPtr->ctm != NULL && XPmPtr->clip_mask != None) ! { w = ZOOMED_SIZE(ObjPtr->obbox.rbx - ObjPtr->obbox.ltx); h = ZOOMED_SIZE(ObjPtr->obbox.rby - ObjPtr->obbox.lty); ! pixmap = XCreatePixmap (mainDisplay, mainWindow, w, h, 1); ! if (pixmap == None) ! { ! sprintf (msg, "Can not copy pixmap of size %1dx%1d.", w, h); ! Msg (msg); return; } ! XCopyArea (mainDisplay, XPmPtr->clip_mask, pixmap, xbmGC, 0, 0, w, h, 0, 0); xpm_ptr->clip_mask = pixmap; --- 670,683 ---- } xpm_ptr->red = xpm_ptr->green = xpm_ptr->blue = NULL; ! if (ObjPtr->ctm != NULL && XPmPtr->clip_mask != None) { w = ZOOMED_SIZE(ObjPtr->obbox.rbx - ObjPtr->obbox.ltx); h = ZOOMED_SIZE(ObjPtr->obbox.rby - ObjPtr->obbox.lty); ! pixmap = XCreatePixmap(mainDisplay, mainWindow, w, h, 1); ! if (pixmap == None) { ! FailAllocBitmapMessage(w, h); return; } ! XCopyArea(mainDisplay, XPmPtr->clip_mask, pixmap, xbmGC, 0, 0, w, h, 0, 0); xpm_ptr->clip_mask = pixmap; *************** *** 701,713 **** } ! void DupTextObj (TextPtr, FromObjPtr, ToObjPtr) ! struct TextRec * TextPtr; ! struct ObjRec * FromObjPtr, * ToObjPtr; ! { ! register int i, num_lines; ! register struct TextRec * text_ptr; ! struct StrRec * first_str; ! struct StrRec * from_str_ptr, * to_str_ptr; ! char msg[MAXSTRING]; text_ptr = (struct TextRec *)malloc(sizeof(struct TextRec)); --- 685,696 ---- } ! void DupTextObj(TextPtr, FromObjPtr, ToObjPtr) ! struct TextRec *TextPtr; ! struct ObjRec *FromObjPtr, *ToObjPtr; ! { ! register int i, num_lines; ! register struct TextRec *text_ptr; ! struct StrRec *first_str; ! struct StrRec *from_str_ptr, *to_str_ptr; text_ptr = (struct TextRec *)malloc(sizeof(struct TextRec)); *************** *** 719,731 **** from_str_ptr = TextPtr->last; first_str = NULL; ! for (i = 0; i < num_lines; i++, from_str_ptr = from_str_ptr->prev) ! { ! to_str_ptr = NewStr (); ! DynStrCpy (&to_str_ptr->dyn_str, &from_str_ptr->dyn_str); to_str_ptr->next = first_str; ! if (first_str == NULL) text_ptr->last = to_str_ptr; ! else first_str->prev = to_str_ptr; first_str = to_str_ptr; } --- 702,714 ---- from_str_ptr = TextPtr->last; first_str = NULL; ! for (i=0; i < num_lines; i++, from_str_ptr=from_str_ptr->prev) { ! to_str_ptr = NewStr(); ! DynStrCpy(&to_str_ptr->dyn_str, &from_str_ptr->dyn_str); to_str_ptr->next = first_str; ! if (first_str == NULL) { text_ptr->last = to_str_ptr; ! } else { first_str->prev = to_str_ptr; + } first_str = to_str_ptr; } *************** *** 747,755 **** text_ptr->double_byte = TextPtr->double_byte; text_ptr->direction = TextPtr->direction; ! if (TextPtr->custom_screen_font_name == NULL) text_ptr->custom_screen_font_name = NULL; ! else text_ptr->custom_screen_font_name = UtilStrDup(TextPtr->custom_screen_font_name); text_ptr->cached_zoom = TextPtr->cached_zoom; text_ptr->cached_bitmap = None; --- 730,739 ---- text_ptr->double_byte = TextPtr->double_byte; text_ptr->direction = TextPtr->direction; ! if (TextPtr->custom_screen_font_name == NULL) { text_ptr->custom_screen_font_name = NULL; ! } else { text_ptr->custom_screen_font_name = UtilStrDup(TextPtr->custom_screen_font_name); + } text_ptr->cached_zoom = TextPtr->cached_zoom; text_ptr->cached_bitmap = None; *************** *** 765,786 **** ToObjPtr->detail.t = text_ptr; ! if (ToObjPtr->ctm != NULL) ! memcpy (&text_ptr->cached_ctm, &TextPtr->cached_ctm, sizeof(struct XfrmMtrxRec)); ! if (TextPtr->cached_bitmap != None) ! { ! int w=ZOOMED_SIZE(FromObjPtr->bbox.rbx - FromObjPtr->bbox.ltx - 2); ! int h=ZOOMED_SIZE(FromObjPtr->bbox.rby - FromObjPtr->bbox.lty - 2); if (w == 0) w = 1; if (h == 0) h = 1; ! text_ptr->cached_bitmap = XCreatePixmap (mainDisplay,mainWindow,w,h,1); ! if (text_ptr->cached_bitmap == None) ! { ! sprintf (msg, "Can not create bitmap of size %1dx%1d.", w, h); ! Msg (msg); return; } ! XCopyArea (mainDisplay, TextPtr->cached_bitmap, text_ptr->cached_bitmap, rotateGC, 0, 0, w, h, 0, 0); } --- 749,768 ---- ToObjPtr->detail.t = text_ptr; ! if (ToObjPtr->ctm != NULL) { ! memcpy(&text_ptr->cached_ctm, &TextPtr->cached_ctm, sizeof(struct XfrmMtrxRec)); ! } ! if (TextPtr->cached_bitmap != None) { ! int w=ZOOMED_SIZE(FromObjPtr->bbox.rbx - FromObjPtr->bbox.ltx - 2); ! int h=ZOOMED_SIZE(FromObjPtr->bbox.rby - FromObjPtr->bbox.lty - 2); if (w == 0) w = 1; if (h == 0) h = 1; ! text_ptr->cached_bitmap = XCreatePixmap(mainDisplay,mainWindow,w,h,1); ! if (text_ptr->cached_bitmap == None) { ! FailAllocBitmapMessage(w, h); return; } ! XCopyArea(mainDisplay, TextPtr->cached_bitmap, text_ptr->cached_bitmap, rotateGC, 0, 0, w, h, 0, 0); } *************** *** 791,804 **** #ifdef _NO_EXTERN ! struct ObjRec * DupObj ARGS_DECL((struct ObjRec *)); #endif /* _NO_EXTERN */ ! void DupGroupObj (GroupPtr, ObjPtr) ! struct GroupRec * GroupPtr; ! struct ObjRec * ObjPtr; ! { ! register struct GroupRec * group_ptr; ! struct ObjRec * top_obj; ! struct ObjRec * from_obj_ptr, * to_obj_ptr; group_ptr = (struct GroupRec *)malloc(sizeof(struct GroupRec)); --- 773,786 ---- #ifdef _NO_EXTERN ! struct ObjRec *DupObj ARGS_DECL((struct ObjRec *)); #endif /* _NO_EXTERN */ ! void DupGroupObj(GroupPtr, ObjPtr) ! struct GroupRec *GroupPtr; ! struct ObjRec *ObjPtr; ! { ! register struct GroupRec *group_ptr; ! struct ObjRec *top_obj; ! struct ObjRec *from_obj_ptr, *to_obj_ptr; group_ptr = (struct GroupRec *)malloc(sizeof(struct GroupRec)); *************** *** 807,818 **** top_obj = NULL; from_obj_ptr = GroupPtr->last; ! for ( ; from_obj_ptr != NULL; from_obj_ptr = from_obj_ptr->prev) ! { ! to_obj_ptr = DupObj (from_obj_ptr); to_obj_ptr->next = top_obj; ! if (top_obj == NULL) group_ptr->last = to_obj_ptr; ! else top_obj->prev = to_obj_ptr; top_obj = to_obj_ptr; } --- 789,800 ---- top_obj = NULL; from_obj_ptr = GroupPtr->last; ! for ( ; from_obj_ptr != NULL; from_obj_ptr=from_obj_ptr->prev) { ! to_obj_ptr = DupObj(from_obj_ptr); to_obj_ptr->next = top_obj; ! if (top_obj == NULL) { group_ptr->last = to_obj_ptr; ! } else { top_obj->prev = to_obj_ptr; + } top_obj = to_obj_ptr; } *************** *** 823,915 **** } ! struct ObjRec * DupObj (ObjPtr) ! struct ObjRec * ObjPtr; { ! struct ObjRec * obj_ptr; obj_ptr = (struct ObjRec *)malloc(sizeof(struct ObjRec)); if (obj_ptr == NULL) FailAllocMessage(); memset(obj_ptr, 0, sizeof(struct ObjRec)); ! DupObjBasics (ObjPtr, obj_ptr); ! switch (ObjPtr->type) ! { ! case OBJ_POLY: ! DupPolyObj (ObjPtr->detail.p, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! break; ! case OBJ_BOX: ! DupBoxObj (ObjPtr->detail.b, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! break; ! case OBJ_OVAL: ! DupOvalObj (ObjPtr->detail.o, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! break; ! case OBJ_TEXT: DupTextObj (ObjPtr->detail.t, ObjPtr, obj_ptr); break; ! case OBJ_POLYGON: ! DupPolygonObj (ObjPtr->detail.g, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! break; ! case OBJ_ARC: ! DupArcObj (ObjPtr->detail.a, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! break; ! case OBJ_RCBOX: ! DupRCBoxObj (ObjPtr->detail.rcb, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! break; ! case OBJ_XBM: ! DupXBmObj (ObjPtr->detail.xbm, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! break; ! case OBJ_XPM: ! DupXPmObj (ObjPtr->detail.xpm, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! break; ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! DupGroupObj (ObjPtr->detail.r, obj_ptr); ! DupAttrs (ObjPtr, obj_ptr); ! if (obj_ptr->type == OBJ_ICON) ! { ! strcpy (obj_ptr->detail.r->s, ObjPtr->detail.r->s); ! obj_ptr->detail.r->rotate = ObjPtr->detail.r->rotate; ! obj_ptr->detail.r->flip = ObjPtr->detail.r->flip; ! obj_ptr->detail.r->deck_index = (-1); ! } ! break; ! } ! return (obj_ptr); ! } ! ! void DupSelObj () ! { ! struct SelRec * sel_ptr, * sel_ptr1; ! struct ObjRec * obj_ptr, * top_obj, * bot_obj; ! int dx = 0, dy = 0; if (topSel==NULL || curChoice==VERTEXMODE) return; top_obj = bot_obj = NULL; ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) ! { ! obj_ptr = DupObj (sel_ptr->obj); obj_ptr->next = top_obj; ! if (top_obj == NULL) bot_obj = obj_ptr; ! else top_obj->prev = obj_ptr; top_obj = obj_ptr; } top_obj->prev = NULL; ! HighLightReverse (); sel_ptr = botSel; sel_ptr1 = sel_ptr->prev; ! for (obj_ptr = bot_obj; sel_ptr1 != NULL; obj_ptr = obj_ptr->prev) ! { sel_ptr->obj = obj_ptr; sel_ptr = sel_ptr1; --- 805,894 ---- } ! struct ObjRec *DupObj(ObjPtr) ! struct ObjRec *ObjPtr; { ! struct ObjRec *obj_ptr; obj_ptr = (struct ObjRec *)malloc(sizeof(struct ObjRec)); if (obj_ptr == NULL) FailAllocMessage(); memset(obj_ptr, 0, sizeof(struct ObjRec)); ! DupObjBasics(ObjPtr, obj_ptr); ! switch (ObjPtr->type) { ! case OBJ_POLY: ! DupPolyObj(ObjPtr->detail.p, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! break; ! case OBJ_BOX: ! DupBoxObj(ObjPtr->detail.b, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! break; ! case OBJ_OVAL: ! DupOvalObj(ObjPtr->detail.o, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! break; ! case OBJ_TEXT: DupTextObj(ObjPtr->detail.t, ObjPtr, obj_ptr); break; ! case OBJ_POLYGON: ! DupPolygonObj(ObjPtr->detail.g, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! break; ! case OBJ_ARC: ! DupArcObj(ObjPtr->detail.a, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! break; ! case OBJ_RCBOX: ! DupRCBoxObj(ObjPtr->detail.rcb, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! break; ! case OBJ_XBM: ! DupXBmObj(ObjPtr->detail.xbm, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! break; ! case OBJ_XPM: ! DupXPmObj(ObjPtr->detail.xpm, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! break; ! case OBJ_SYM: ! case OBJ_GROUP: ! case OBJ_ICON: ! DupGroupObj(ObjPtr->detail.r, obj_ptr); ! DupAttrs(ObjPtr, obj_ptr); ! if (obj_ptr->type == OBJ_ICON) { ! strcpy(obj_ptr->detail.r->s, ObjPtr->detail.r->s); ! obj_ptr->detail.r->rotate = ObjPtr->detail.r->rotate; ! obj_ptr->detail.r->flip = ObjPtr->detail.r->flip; ! obj_ptr->detail.r->deck_index = (-1); ! } ! break; ! } ! return obj_ptr; ! } ! ! void DupSelObj() ! { ! struct SelRec *sel_ptr, *sel_ptr1; ! struct ObjRec *obj_ptr, *top_obj, *bot_obj; ! int dx=0, dy=0; if (topSel==NULL || curChoice==VERTEXMODE) return; top_obj = bot_obj = NULL; ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { ! obj_ptr = DupObj(sel_ptr->obj); obj_ptr->next = top_obj; ! if (top_obj == NULL) { bot_obj = obj_ptr; ! } else { top_obj->prev = obj_ptr; + } top_obj = obj_ptr; } top_obj->prev = NULL; ! HighLightReverse(); sel_ptr = botSel; sel_ptr1 = sel_ptr->prev; ! for (obj_ptr=bot_obj; sel_ptr1 != NULL; obj_ptr=obj_ptr->prev) { sel_ptr->obj = obj_ptr; sel_ptr = sel_ptr1; *************** *** 922,958 **** curPage->top = topObj = top_obj; ! if (justDupped && useRecentDupDistance) ! { dx = dupDx; dy = dupDy; ! } ! else ! { ! switch (gridSystem) ! { ! case ENGLISH_GRID: ! if (gridOn) ! dupDx = dupDy = dx = dy = GRID_ABS_SIZE(xyEnglishGrid); ! else ! dupDx = dupDy = dx = dy = GRID_ABS_SIZE(DEFAULT_ENGLISH_GRID); ! break; ! case METRIC_GRID: ! if (gridOn) ! dupDx = dupDy = dx = dy = GRID_ABS_SIZE(xyMetricGrid); ! else ! dupDx = dupDy = dx = dy = GRID_ABS_SIZE(DEFAULT_METRIC_GRID); ! break; } justDupped = TRUE; } ! MoveAllSelObjects (dx, dy); ! PrepareToRecord (CMD_NEW, NULL, NULL, 0); ! RecordCmd (CMD_NEW, NULL, topSel, botSel, numObjSelected); ! UpdSelBBox (); ! RedrawAnArea (botObj, selLtX-(GRID_ABS_SIZE(1)), selLtY-(GRID_ABS_SIZE(1)), selRbX+(GRID_ABS_SIZE(1)), selRbY+(GRID_ABS_SIZE(1))); ! HighLightForward (); ! SetFileModified (TRUE); } --- 901,935 ---- curPage->top = topObj = top_obj; ! if (justDupped && useRecentDupDistance) { dx = dupDx; dy = dupDy; ! } else { ! switch (gridSystem) { ! case ENGLISH_GRID: ! if (gridOn) { ! dupDx = dupDy = dx = dy = GRID_ABS_SIZE(xyEnglishGrid); ! } else { ! dupDx = dupDy = dx = dy = GRID_ABS_SIZE(DEFAULT_ENGLISH_GRID); ! } ! break; ! case METRIC_GRID: ! if (gridOn) { ! dupDx = dupDy = dx = dy = GRID_ABS_SIZE(xyMetricGrid); ! } else { ! dupDx = dupDy = dx = dy = GRID_ABS_SIZE(DEFAULT_METRIC_GRID); ! } ! break; } justDupped = TRUE; } ! MoveAllSelObjects(dx, dy); ! PrepareToRecord(CMD_NEW, NULL, NULL, 0); ! RecordCmd(CMD_NEW, NULL, topSel, botSel, numObjSelected); ! UpdSelBBox(); ! RedrawAnArea(botObj, selLtX-(GRID_ABS_SIZE(1)), selLtY-(GRID_ABS_SIZE(1)), selRbX+(GRID_ABS_SIZE(1)), selRbY+(GRID_ABS_SIZE(1))); ! HighLightForward(); ! SetFileModified(TRUE); } *************** *** 987,993 **** } ! void JustDupSelObj (NewTopSel, NewBotSel) ! struct SelRec * * NewTopSel, * * NewBotSel; { ! DupTheseObjects (topSel, botSel, NewTopSel, NewBotSel); } --- 964,970 ---- } ! void JustDupSelObj(NewTopSel, NewBotSel) ! struct SelRec **NewTopSel, **NewBotSel; { ! DupTheseObjects(topSel, botSel, NewTopSel, NewBotSel); } *** edit.c.orig Tue Sep 30 13:23:02 1997 --- edit.c Tue Sep 30 13:23:02 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/edit.c,v 3.18 1997/01/31 00:09:54 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/edit.c,v 3.23 1997/09/16 04:58:04 william Exp $ */ #include *************** *** 2484,2491 **** int grid_x, grid_y, finalize; { ! int i, num_objects=numObjSelected-1; int abs_cx, abs_cy, abs_x=ABS_X(grid_x), abs_y=ABS_Y(grid_y), dx, dy; double abs_radius, total_arc_radian, total_radian=0, inc_radian=0, angle; abs_cx = arc_ptr->xc; abs_cy = arc_ptr->yc; --- 2482,2492 ---- int grid_x, grid_y, finalize; { ! int i, num_objects=numObjSelected-1, circular=FALSE; int abs_cx, abs_cy, abs_x=ABS_X(grid_x), abs_y=ABS_Y(grid_y), dx, dy; double abs_radius, total_arc_radian, total_radian=0, inc_radian=0, angle; + if (abs(arc_ptr->angle2) == (360<<6)) { + circular = TRUE; + } abs_cx = arc_ptr->xc; abs_cy = arc_ptr->yc; *************** *** 2508,2515 **** switch (gnLayoutDirection) { case LAYOUT_DIR_S: ! inc_radian = (total_arc_radian-total_radian)/((double)(num_objects-1)); break; case LAYOUT_DIR_N: ! inc_radian = (total_arc_radian+total_radian)/((double)(num_objects-1)); break; } --- 2509,2524 ---- switch (gnLayoutDirection) { case LAYOUT_DIR_S: ! if (circular) { ! inc_radian = (total_arc_radian-total_radian)/((double)num_objects); ! } else { ! inc_radian = (total_arc_radian-total_radian)/((double)(num_objects-1)); ! } break; case LAYOUT_DIR_N: ! if (circular) { ! inc_radian = (total_arc_radian+total_radian)/((double)num_objects); ! } else { ! inc_radian = (total_arc_radian+total_radian)/((double)(num_objects-1)); ! } break; } *************** *** 3194,3197 **** --- 3203,3207 ---- return_obj = DoFind(ptr); if (return_obj != NULL) { + UpdateOuterInnerSel(obj_ptr); return return_obj; } *************** *** 3263,3266 **** --- 3273,3277 ---- return_obj = DoFindAlready(ptr, bottom_half, pn_give_up); if (return_obj != NULL) { + UpdateOuterInnerSel(obj_ptr); return return_obj; } *************** *** 3319,3322 **** --- 3330,3335 ---- struct ObjRec *found_obj=NULL; + CleanOuterInnerSel(); + if (gpszSearch == NULL) return; gnSearchLen = strlen(gpszSearch); *************** *** 3926,3937 **** } ! void UpdateSymbols () { ! int dx = 0, dy = 0, changed=FALSE; ! int sel_ltx, sel_lty, sel_rbx, sel_rby; ! char path_name[MAXPATHLENGTH], sym_name[MAXPATHLENGTH]; ! struct ObjRec * obj_ptr, * new_obj_ptr; ! struct SelRec * sel_ptr; ! struct GroupRec * icon_ptr; if (topSel == NULL) return; --- 3939,3950 ---- } ! void UpdateSymbols() { ! int dx=0, dy=0, changed=FALSE; ! int sel_ltx, sel_lty, sel_rbx, sel_rby; ! char path_name[MAXPATHLENGTH], sym_name[MAXPATHLENGTH]; ! struct ObjRec *obj_ptr, *new_obj_ptr; ! struct SelRec *sel_ptr; ! struct GroupRec *icon_ptr; if (topSel == NULL) return; *************** *** 3943,4044 **** sel_rbx = selRbX; sel_rby = selRbY; ! HighLightReverse (); ! StartCompositeCmd (); ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) ! { obj_ptr = sel_ptr->obj; if (obj_ptr->type!=OBJ_ICON || obj_ptr->locked) continue; icon_ptr = obj_ptr->detail.r; ! strcpy (sym_name, icon_ptr->s); ! if (GetSymbolPath (icon_ptr->s, path_name)) ! { ! if ((new_obj_ptr = GetObjRepresentation (path_name, sym_name)) != NULL) ! { ! PrepareToReplaceAnObj (obj_ptr); ! if (icon_ptr->rotate != ROTATE0 || icon_ptr->flip != NO_FLIP) ! { ! if (icon_ptr->flip & HORI_EVEN) FlipIconHorizontal (new_obj_ptr); ! if (icon_ptr->flip & VERT_EVEN) FlipIconVertical (new_obj_ptr); ! if (icon_ptr->rotate == ROTATE0) ! { ! if (icon_ptr->flip & (HORI_ODD | VERT_ODD)) ! { ! RotateIconClockWise (new_obj_ptr); ! if (icon_ptr->flip & HORI_ODD) ! FlipIconHorizontal (new_obj_ptr); ! if (icon_ptr->flip & VERT_ODD) ! FlipIconVertical (new_obj_ptr); ! RotateIconCounter (new_obj_ptr); } ! } ! else ! { ! switch (icon_ptr->rotate) ! { ! case ROTATE90: ! RotateIconClockWise (new_obj_ptr); ! if (icon_ptr->flip & HORI_ODD) ! FlipIconHorizontal (new_obj_ptr); ! if (icon_ptr->flip & VERT_ODD) ! FlipIconVertical (new_obj_ptr); ! break; ! case ROTATE180: ! RotateIconClockWise (new_obj_ptr); ! if (icon_ptr->flip & HORI_ODD) ! FlipIconHorizontal (new_obj_ptr); ! if (icon_ptr->flip & VERT_ODD) ! FlipIconVertical (new_obj_ptr); ! RotateIconClockWise (new_obj_ptr); ! break; ! case ROTATE270: ! RotateIconClockWise (new_obj_ptr); ! if (icon_ptr->flip & HORI_ODD) ! FlipIconHorizontal (new_obj_ptr); ! if (icon_ptr->flip & VERT_ODD) ! FlipIconVertical (new_obj_ptr); ! RotateIconClockWise (new_obj_ptr); ! RotateIconClockWise (new_obj_ptr); ! break; } } } ! switch (horiAlign) ! { ! case ALIGN_L: ! dx = obj_ptr->obbox.ltx - new_obj_ptr->obbox.ltx; ! break; ! case ALIGN_N: ! case ALIGN_S: ! case ALIGN_C: ! dx = (int)(((obj_ptr->obbox.ltx+obj_ptr->obbox.rbx) - ! (new_obj_ptr->obbox.ltx+new_obj_ptr->obbox.rbx))/2); ! break; ! case ALIGN_R: ! dx = obj_ptr->obbox.rbx - new_obj_ptr->obbox.rbx; ! break; } ! switch (vertAlign) ! { ! case ALIGN_T: ! dy = obj_ptr->obbox.lty - new_obj_ptr->obbox.lty; ! break; ! case ALIGN_N: ! case ALIGN_S: ! case ALIGN_M: ! dy = (int)(((obj_ptr->obbox.lty+obj_ptr->obbox.rby) - ! (new_obj_ptr->obbox.lty+new_obj_ptr->obbox.rby))/2); ! break; ! case ALIGN_B: ! dy = obj_ptr->obbox.rby - new_obj_ptr->obbox.rby; ! break; } ! MoveObj (new_obj_ptr, dx, dy); changed = TRUE; ! UnlinkObj (obj_ptr); ! CopyAndUpdateAttrs (new_obj_ptr, obj_ptr); if (new_obj_ptr->bbox.ltx < selLtX) selLtX = new_obj_ptr->bbox.ltx; --- 3956,4055 ---- sel_rbx = selRbX; sel_rby = selRbY; ! HighLightReverse(); ! StartCompositeCmd(); ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { obj_ptr = sel_ptr->obj; if (obj_ptr->type!=OBJ_ICON || obj_ptr->locked) continue; icon_ptr = obj_ptr->detail.r; ! strcpy(sym_name, icon_ptr->s); ! if (GetSymbolPath(icon_ptr->s, path_name)) { ! if ((new_obj_ptr=GetObjRepresentation(path_name, sym_name, ! SYM_FILE_TYPE)) != NULL) { ! PrepareToReplaceAnObj(obj_ptr); ! if (icon_ptr->rotate != ROTATE0 || icon_ptr->flip != NO_FLIP) { ! if (icon_ptr->flip & HORI_EVEN) FlipIconHorizontal(new_obj_ptr); ! if (icon_ptr->flip & VERT_EVEN) FlipIconVertical(new_obj_ptr); ! if (icon_ptr->rotate == ROTATE0) { ! if (icon_ptr->flip & (HORI_ODD | VERT_ODD)) { ! RotateIconClockWise(new_obj_ptr); ! if (icon_ptr->flip & HORI_ODD) { ! FlipIconHorizontal(new_obj_ptr); ! } ! if (icon_ptr->flip & VERT_ODD) { ! FlipIconVertical(new_obj_ptr); ! } ! RotateIconCounter(new_obj_ptr); } ! } else { ! switch (icon_ptr->rotate) { ! case ROTATE90: ! RotateIconClockWise(new_obj_ptr); ! if (icon_ptr->flip & HORI_ODD) { ! FlipIconHorizontal(new_obj_ptr); ! } ! if (icon_ptr->flip & VERT_ODD) { ! FlipIconVertical(new_obj_ptr); ! } ! break; ! case ROTATE180: ! RotateIconClockWise(new_obj_ptr); ! if (icon_ptr->flip & HORI_ODD) { ! FlipIconHorizontal(new_obj_ptr); ! } ! if (icon_ptr->flip & VERT_ODD) { ! FlipIconVertical(new_obj_ptr); ! } ! RotateIconClockWise(new_obj_ptr); ! break; ! case ROTATE270: ! RotateIconClockWise(new_obj_ptr); ! if (icon_ptr->flip & HORI_ODD) { ! FlipIconHorizontal(new_obj_ptr); ! } ! if (icon_ptr->flip & VERT_ODD) { ! FlipIconVertical(new_obj_ptr); ! } ! RotateIconClockWise(new_obj_ptr); ! RotateIconClockWise(new_obj_ptr); ! break; } } } ! switch (horiAlign) { ! case ALIGN_L: ! dx = obj_ptr->obbox.ltx - new_obj_ptr->obbox.ltx; ! break; ! case ALIGN_N: ! case ALIGN_S: ! case ALIGN_C: ! dx = (int)(((obj_ptr->obbox.ltx+obj_ptr->obbox.rbx) - ! (new_obj_ptr->obbox.ltx+new_obj_ptr->obbox.rbx))/2); ! break; ! case ALIGN_R: ! dx = obj_ptr->obbox.rbx - new_obj_ptr->obbox.rbx; ! break; } ! switch (vertAlign) { ! case ALIGN_T: ! dy = obj_ptr->obbox.lty - new_obj_ptr->obbox.lty; ! break; ! case ALIGN_N: ! case ALIGN_S: ! case ALIGN_M: ! dy = (int)(((obj_ptr->obbox.lty+obj_ptr->obbox.rby) - ! (new_obj_ptr->obbox.lty+new_obj_ptr->obbox.rby))/2); ! break; ! case ALIGN_B: ! dy = obj_ptr->obbox.rby - new_obj_ptr->obbox.rby; ! break; } ! MoveObj(new_obj_ptr, dx, dy); changed = TRUE; ! UnlinkObj(obj_ptr); ! CopyAndUpdateAttrs(new_obj_ptr, obj_ptr); if (new_obj_ptr->bbox.ltx < selLtX) selLtX = new_obj_ptr->bbox.ltx; *************** *** 4046,4084 **** if (new_obj_ptr->bbox.rbx < selRbX) selRbX = new_obj_ptr->bbox.rbx; if (new_obj_ptr->bbox.rby < selRbY) selRbY = new_obj_ptr->bbox.rby; ! if (new_obj_ptr->obbox.ltx < selObjLtX) ! selObjLtX = new_obj_ptr->obbox.ltx; ! if (new_obj_ptr->obbox.lty < selObjLtY) ! selObjLtY = new_obj_ptr->obbox.lty; ! if (new_obj_ptr->obbox.rbx < selObjRbX) ! selObjRbX = new_obj_ptr->obbox.rbx; ! if (new_obj_ptr->obbox.rby < selObjRbY) ! selObjRbY = new_obj_ptr->obbox.rby; sel_ptr->obj = new_obj_ptr; ! AssignNewObjIds (new_obj_ptr); ! AddObj (NULL, topObj, new_obj_ptr); ! RecordReplaceAnObj (new_obj_ptr); ! FreeObj (obj_ptr); } } } ! EndCompositeCmd (); ! if (changed) ! { ! UpdSelBBox (); ! RedrawAreas (botObj, sel_ltx-GRID_ABS_SIZE(1), sel_lty-GRID_ABS_SIZE(1), sel_rbx+GRID_ABS_SIZE(1), sel_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; ! Msg ("Selected icons are brought up to date."); } ! HighLightForward (); } void CleanUpEdit() { if (gpszSearch != NULL) free(gpszSearch); gpszSearch = NULL; --- 4057,4099 ---- if (new_obj_ptr->bbox.rbx < selRbX) selRbX = new_obj_ptr->bbox.rbx; if (new_obj_ptr->bbox.rby < selRbY) selRbY = new_obj_ptr->bbox.rby; ! if (new_obj_ptr->obbox.ltx < selObjLtX) { ! selObjLtX = new_obj_ptr->obbox.ltx; ! } ! if (new_obj_ptr->obbox.lty < selObjLtY) { ! selObjLtY = new_obj_ptr->obbox.lty; ! } ! if (new_obj_ptr->obbox.rbx < selObjRbX) { ! selObjRbX = new_obj_ptr->obbox.rbx; ! } ! if (new_obj_ptr->obbox.rby < selObjRbY) { ! selObjRbY = new_obj_ptr->obbox.rby; ! } sel_ptr->obj = new_obj_ptr; ! AssignNewObjIds(new_obj_ptr); ! AddObj(NULL, topObj, new_obj_ptr); ! RecordReplaceAnObj(new_obj_ptr); ! FreeObj(obj_ptr); } } } ! EndCompositeCmd(); ! if (changed) { ! UpdSelBBox(); ! RedrawAreas(botObj, sel_ltx-GRID_ABS_SIZE(1), sel_lty-GRID_ABS_SIZE(1), sel_rbx+GRID_ABS_SIZE(1), sel_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; ! Msg("Selected icons are brought up to date."); } ! HighLightForward(); } void CleanUpEdit() { + CleanOuterInnerSel(); if (gpszSearch != NULL) free(gpszSearch); gpszSearch = NULL; *** eps.c.orig Tue Sep 30 13:23:04 1997 --- eps.c Tue Sep 30 13:23:04 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/eps.c,v 3.8 1997/01/30 04:33:44 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/eps.c,v 3.13 1997/09/30 17:11:53 william Exp $ */ #include *************** *** 88,91 **** --- 86,93 ---- static char tiffToXbmCmd[MAXSTRING+1]; + static int tiffToXbmCmdInitialized=FALSE; + + static char hexValue[]="0123456789abcdef"; + static char flippedHexValue[]="084c2a6e195d3b7f"; void InitEPS () *************** *** 121,124 **** --- 123,127 ---- } } + tiffToXbmCmdInitialized = TRUE; strcpy(tiffToXbmCmd, "tifftopnm %s | pgmtopbm | pbmtoxbm"); if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"TiffToXbm")) != NULL) { *************** *** 160,163 **** --- 163,191 ---- static + void DumpXBmByte(fp, num_nibbles, image_h, nibble_index, row_index, + byte_data, pn_out_byte_count) + FILE *fp; + int num_nibbles, image_h, nibble_index, row_index; + int byte_data, *pn_out_byte_count; + { + if ((*pn_out_byte_count)++ == 12) { + (*pn_out_byte_count) = 1; + if (fprintf(fp, "\n ") == EOF) writeFileFailed = TRUE; + } + if (fprintf(fp, "0x%c", flippedHexValue[(byte_data>>4) & 0xf]) == EOF) { + writeFileFailed = TRUE; + } + if (row_index == image_h-1 && nibble_index == num_nibbles-1) { + if (fprintf(fp, "%c};\n", flippedHexValue[byte_data & 0xf]) == EOF) { + writeFileFailed = TRUE; + } + } else { + if (fprintf(fp, "%c, ", flippedHexValue[byte_data & 0xf]) == EOF) { + writeFileFailed = TRUE; + } + } + } + + static int ReadPreviewBitmap (fp, image_w, image_h, bps, bitmap, image) FILE * fp; *************** *** 167,171 **** { register int k, j; ! int i, num_nibbles, bit_count; char * line, * c_ptr; --- 195,199 ---- { register int k, j; ! int i, num_nibbles, bit_count, out_byte_count=0; char * line, * c_ptr; *************** *** 184,192 **** line = (char*)malloc((num_nibbles+10)*sizeof(char)); if (line == NULL) FailAllocMessage(); ! *bitmap = XCreatePixmap(mainDisplay, dummyBitmap, image_w, image_h, 1); ! XFillRectangle(mainDisplay, *bitmap, xbmGC, 0, 0, image_w, image_h); ! *image = XGetImage(mainDisplay,*bitmap,0,0,image_w,image_h,1,ZPixmap); ! for (i=0; i < image_h; i++) { for (j=0, c_ptr = line; j < num_nibbles; j++, c_ptr++) { while (TRUE) { --- 212,231 ---- line = (char*)malloc((num_nibbles+10)*sizeof(char)); if (line == NULL) FailAllocMessage(); ! if (cmdLineDosEpsFilter && cmdLinePreviewOnly) { ! *bitmap = None; ! *image = NULL; ! printf("#define noname_width %1d\n", image_w); ! printf("#define noname_height %1d\n", image_h); ! printf("#define noname_x_hot 0\n"); ! printf("#define noname_y_hot 0\n"); ! printf("static char noname_bits[] = {\n "); ! } else { ! *bitmap = XCreatePixmap(mainDisplay, dummyBitmap, image_w, image_h, 1); ! XFillRectangle(mainDisplay, *bitmap, xbmGC, 0, 0, image_w, image_h); ! *image = XGetImage(mainDisplay,*bitmap,0,0,image_w,image_h,1,ZPixmap); ! } for (i=0; i < image_h; i++) { + int byte_data=0; + for (j=0, c_ptr = line; j < num_nibbles; j++, c_ptr++) { while (TRUE) { *************** *** 195,200 **** INFO_MB); free(line); ! XFreePixmap(mainDisplay, *bitmap); *bitmap = None; ! XDestroyImage(*image); *image = NULL; return FALSE; } --- 234,245 ---- INFO_MB); free(line); ! if (*bitmap != None) { ! XFreePixmap(mainDisplay, *bitmap); ! *bitmap = None; ! } ! if (*image != NULL) { ! XDestroyImage(*image); ! *image = NULL; ! } return FALSE; } *************** *** 210,214 **** c_ptr = line; for (j=0; j= '0' && *c_ptr <= '9') { --- 255,259 ---- c_ptr = line; for (j=0; j= '0' && *c_ptr <= '9') { *************** *** 221,242 **** break; } ! for (k = 0; k < 4; k++) { ! if (bit_count++ == image_w) break; ! ! if (data & (1<<(3-k))) { ! XPutPixel(*image, j*4+k, i, 1); } } } } if (fgets(line, MAXSTRING, fp) == NULL) { MsgBox("Invalid preview bitmap in EPS file.", TOOL_NAME, INFO_MB); free(line); ! XFreePixmap(mainDisplay, *bitmap); *bitmap = None; ! XDestroyImage(*image); *image = NULL; return FALSE; } ! XPutImage(mainDisplay,*bitmap,xbmGC,*image,0,0,0,0,image_w,image_h); free(line); return (TRUE); --- 266,311 ---- break; } + if (cmdLineDosEpsFilter && cmdLinePreviewOnly) { + if (j & 0x1) { + byte_data |= (data<<4); + DumpXBmByte(stdout, num_nibbles, image_h, j, i, + byte_data, &out_byte_count); + } else { + byte_data = data; + } + } else { + for (k = 0; k < 4; k++) { + if (bit_count++ == image_w) break; ! if (data & (1<<(3-k))) { ! XPutPixel(*image, j*4+k, i, 1); ! } } } } + if (cmdLineDosEpsFilter && cmdLinePreviewOnly) { + if (num_nibbles & 0x1) { + DumpXBmByte(stdout, num_nibbles, image_h, j, i, + byte_data, &out_byte_count); + } + } } if (fgets(line, MAXSTRING, fp) == NULL) { MsgBox("Invalid preview bitmap in EPS file.", TOOL_NAME, INFO_MB); free(line); ! if (*bitmap != None) { ! XFreePixmap(mainDisplay, *bitmap); ! *bitmap = None; ! } ! if (*image != NULL) { ! XDestroyImage(*image); ! *image = NULL; ! } return FALSE; } ! if (cmdLineDosEpsFilter && cmdLinePreviewOnly) { ! } else { ! XPutImage(mainDisplay,*bitmap,xbmGC,*image,0,0,0,0,image_w,image_h); ! } free(line); return (TRUE); *************** *** 282,287 **** } - static char hexValue[]="0123456789abcdef"; - static int XbmToPreviewBitmap(FP, xbm_fname) --- 351,354 ---- *************** *** 426,433 **** return ErrorInConvertTiffToXbm(fp, NULL, NULL, NULL); } sprintf(cmd, tiffToXbmCmd, tiff_fname); sprintf(gszMsgBox, "Executing '%s'...", cmd); SetStringStatus(gszMsgBox); ! XSync(mainDisplay, False); if ((pfp=(FILE*)popen(cmd,"r")) == NULL) { unlink(tiff_fname); --- 493,503 ---- return ErrorInConvertTiffToXbm(fp, NULL, NULL, NULL); } + if (!tiffToXbmCmdInitialized) { + strcpy(tiffToXbmCmd, "tifftopnm %s | pgmtopbm | pbmtoxbm"); + } sprintf(cmd, tiffToXbmCmd, tiff_fname); sprintf(gszMsgBox, "Executing '%s'...", cmd); SetStringStatus(gszMsgBox); ! if (mainDisplay != NULL) XSync(mainDisplay, False); if ((pfp=(FILE*)popen(cmd,"r")) == NULL) { unlink(tiff_fname); *************** *** 494,498 **** if (cmdLineDosEpsFilter) { ! *pnPreviewOK = TRUE; } else { *pnPreviewOK = ConvertTiffToXbm(fp, tiff_offset, tiff_sz, xbm_fname); --- 564,601 ---- if (cmdLineDosEpsFilter) { ! if (cmdLinePreviewOnly) { ! FILE *xbm_fp=NULL; ! int bytes_read=0; ! ! *pnPreviewOK = ConvertTiffToXbm(fp, tiff_offset, tiff_sz, xbm_fname); ! if (fseek(fp, 0x1e, SEEK_SET) != 0) { ! return ErrorInGetTiffEPSIInfo(fp, NULL, NULL); ! } ! if ((xbm_fp=fopen(xbm_fname,"r")) == NULL) { ! unlink(xbm_fname); ! *xbm_fname = '\0'; ! return ErrorInGetTiffEPSIInfo(fp, NULL, NULL); ! } ! while ((bytes_read=(int)fread(gszMsgBox, sizeof(char), ! sizeof(gszMsgBox), xbm_fp)) > 0) { ! if ((int)fwrite(gszMsgBox, sizeof(char), bytes_read, stdout) <= 0) { ! writeFileFailed = TRUE; ! break; ! } ! } ! fclose(xbm_fp); ! if (writeFileFailed) { ! fprintf(stderr, ! "Fail to write to a file.\n\nFile system may be full."); ! } ! unlink(xbm_fname); ! *xbm_fname = '\0'; ! return ((FILE*)TRUE); ! } else { ! *pnPreviewOK = TRUE; ! if (fseek(fp, 0x1e, SEEK_SET) != 0) { ! return ErrorInGetTiffEPSIInfo(fp, NULL, NULL); ! } ! } } else { *pnPreviewOK = ConvertTiffToXbm(fp, tiff_offset, tiff_sz, xbm_fname); *************** *** 629,632 **** --- 732,744 ---- return BitmapFileInvalid; } + } else if (cmdLineDosEpsFilter && !cmdLinePreviewOnly) { + printf("%s\n", line); + free(line); + while ((line=UtilGetALine(fp)) != NULL) { + printf("%s\n", line); + free(line); + } + fclose(fp); + return BitmapSuccess; } first_line = FALSE; *************** *** 639,643 **** } if (cmdLineDosEpsFilter) { ! printf("%s\n", line); } else { AddLine(line); --- 751,757 ---- } if (cmdLineDosEpsFilter) { ! if (!cmdLinePreviewOnly) { ! printf("%s\n", line); ! } } else { AddLine(line); *************** *** 654,659 **** } } ! } else if (!cmdLineDosEpsFilter && !preview_found && ! strncmp(line, "%%BeginPreview:", 15) == 0) { int bps=1; char *preview_line; --- 768,773 ---- } } ! } else if (!(cmdLineDosEpsFilter && !cmdLinePreviewOnly) && ! !preview_found && strncmp(line, "%%BeginPreview:", 15) == 0) { int bps=1; char *preview_line; *************** *** 714,718 **** if (!stripEPSComments || line[0] != '%') { if (cmdLineDosEpsFilter) { ! printf("%s\n", line); } else { AddLine(line); --- 828,834 ---- if (!stripEPSComments || line[0] != '%') { if (cmdLineDosEpsFilter) { ! if (!cmdLinePreviewOnly) { ! printf("%s\n", line); ! } } else { AddLine(line); *************** *** 887,890 **** --- 1003,1015 ---- } + if (xbm_ptr->epsflines != NULL) { + for (i = 0; i < xbm_ptr->num_epsf_lines; i++) { + if (xbm_ptr->epsflines[i] != NULL) { + free(xbm_ptr->epsflines[i]); + } + } + free(xbm_ptr->epsflines); + xbm_ptr->epsflines = NULL; + } CleanUpLines(); *************** *** 1024,1029 **** struct XBmRec *xbm_ptr=ObjPtr->detail.xbm; struct MtrxRec mtrx; ! int no_rotate=(ObjPtr->ctm==NULL || (ObjPtr->ctm->m[CTM_SIN]== 0 && ! ObjPtr->ctm->m[CTM_MSIN] == 0)); if (!xbm_ptr->save_epsf) { --- 1149,1154 ---- struct XBmRec *xbm_ptr=ObjPtr->detail.xbm; struct MtrxRec mtrx; ! int no_rotate=(ObjPtr->ctm==NULL); ! /* (ObjPtr->ctm->m[CTM_SIN]== 0 && ObjPtr->ctm->m[CTM_MSIN] == 0); */ if (!xbm_ptr->save_epsf) { *************** *** 1251,1256 **** else { ! xbm_ptr->eps_w = w = ImageW; ! xbm_ptr->eps_h = h = ImageH; } --- 1376,1384 ---- else { ! /* same as above! */ ! xbm_ptr->eps_w = w = ((*urx) >= (*llx)) ? (int)((*urx)-(*llx)) : ! (int)((*llx)-(*urx)); ! xbm_ptr->eps_h = h = ((*ury) >= (*lly)) ? (int)((*ury)-(*lly)) : ! (int)((*lly)-(*ury)); } *************** *** 1297,1379 **** void UpdateEPS() { ! struct XBmRec *xbm_ptr, *new_xbm_ptr; ! struct ObjRec *obj_ptr, *new_obj_ptr; ! char write_date[32], **lines=NULL; ! int rc, num_lines, epsf_level, image_w, image_h, save_epsf; ! int transformed; ! float llx, lly, urx, ury; ! Pixmap bitmap; ! XImage *image=NULL; ! if (topSel==NULL || topSel!=botSel || topSel->obj->type!=OBJ_XBM || ! topSel->obj->detail.xbm->real_type!=XBM_EPS) { ! MsgBox("Please select an EPS object.", TOOL_NAME, INFO_MB); ! return; } ! obj_ptr = topSel->obj; ! xbm_ptr = obj_ptr->detail.xbm; ! transformed = (obj_ptr->ctm!=NULL); ! ! save_epsf = xbm_ptr->save_epsf; ! ! importingFile = TRUE; ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! rc = MyReadEPSFile(xbm_ptr->filename, &image_w, &image_h, &bitmap, &image, ! &num_lines, &lines, &epsf_level, &llx, &lly, &urx, &ury, write_date); ! SetDefaultCursor(mainWindow); ! SetDefaultCursor(drawWindow); ! ! if (rc != BitmapSuccess) { ! sprintf(gszMsgBox, "Can not import EPS file '%s'.", xbm_ptr->filename); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! importingFile = FALSE; return; } - importingFile = FALSE; HighLightReverse(); ! PrepareToReplaceAnObj(obj_ptr); ! if (save_epsf) saveEPSLines = TRUE; ! new_obj_ptr = CreateEPSObj(xbm_ptr->filename, image_w, image_h, bitmap, ! image, num_lines, lines, epsf_level, &llx, &lly, &urx, &ury, ! write_date); ! saveEPSLines = FALSE; ! ! new_obj_ptr->x = obj_ptr->x; ! new_obj_ptr->y = obj_ptr->y; ! if (transformed) { ! new_obj_ptr->obbox.ltx = obj_ptr->orig_obbox.ltx; ! new_obj_ptr->obbox.lty = obj_ptr->orig_obbox.lty; ! new_obj_ptr->obbox.rbx = obj_ptr->orig_obbox.rbx; ! new_obj_ptr->obbox.rby = obj_ptr->orig_obbox.rby; ! new_obj_ptr->obbox.rby = obj_ptr->orig_obbox.rby; ! SetCTM(new_obj_ptr, obj_ptr->ctm); ! AdjObjBBox(new_obj_ptr); ! } else { ! new_obj_ptr->bbox.ltx = obj_ptr->bbox.ltx; ! new_obj_ptr->bbox.lty = obj_ptr->bbox.lty; ! new_obj_ptr->bbox.rbx = obj_ptr->bbox.rbx; ! new_obj_ptr->bbox.rby = obj_ptr->bbox.rby; ! new_obj_ptr->obbox.ltx = obj_ptr->obbox.ltx; ! new_obj_ptr->obbox.lty = obj_ptr->obbox.lty; ! new_obj_ptr->obbox.rbx = obj_ptr->obbox.rbx; ! new_obj_ptr->obbox.rby = obj_ptr->obbox.rby; ! } ! new_xbm_ptr = new_obj_ptr->detail.xbm; ! new_xbm_ptr->rotate = xbm_ptr->rotate; ! new_xbm_ptr->flip = xbm_ptr->flip; ! ! UnlinkObj(obj_ptr); ! topSel->obj = new_obj_ptr; ! AddObj(NULL, topObj, new_obj_ptr); ! RecordReplaceAnObj(new_obj_ptr); ! FreeObj(obj_ptr); ! ! UpdSelBBox(); ! RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), ! selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! SetFileModified(TRUE); ! justDupped = FALSE; HighLightForward(); - Msg("EPS object updated."); } --- 1425,1530 ---- void UpdateEPS() { ! struct SelRec *sel_ptr; ! int count=0; ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! if (sel_ptr->obj->type == OBJ_XBM && ! sel_ptr->obj->detail.xbm->real_type == XBM_EPS) { ! count++; ! } } ! if (count == 0) { ! MsgBox("No top-level EPS object selected.", TOOL_NAME, INFO_MB); return; } HighLightReverse(); ! ! StartCompositeCmd(); ! count = 0; ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! if (sel_ptr->obj->type == OBJ_XBM && ! sel_ptr->obj->detail.xbm->real_type == XBM_EPS) { ! struct XBmRec *xbm_ptr, *new_xbm_ptr; ! struct ObjRec *obj_ptr, *new_obj_ptr; ! char write_date[32], **lines=NULL; ! int rc, num_lines, epsf_level, image_w, image_h, save_epsf; ! int transformed; ! float llx, lly, urx, ury; ! Pixmap bitmap; ! XImage *image=NULL; ! ! obj_ptr = sel_ptr->obj; ! xbm_ptr = obj_ptr->detail.xbm; ! transformed = (obj_ptr->ctm!=NULL); ! ! save_epsf = xbm_ptr->save_epsf; ! ! importingFile = TRUE; ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! rc = MyReadEPSFile(xbm_ptr->filename, &image_w, &image_h, &bitmap, ! &image, &num_lines, &lines, &epsf_level, &llx, &lly, &urx, &ury, ! write_date); ! SetDefaultCursor(mainWindow); ! SetDefaultCursor(drawWindow); ! ! if (rc != BitmapSuccess) { ! sprintf(gszMsgBox, "Can not import EPS file '%s'.", ! xbm_ptr->filename); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! importingFile = FALSE; ! return; ! } ! importingFile = FALSE; ! PrepareToReplaceAnObj(obj_ptr); ! if (save_epsf) saveEPSLines = TRUE; ! new_obj_ptr = CreateEPSObj(xbm_ptr->filename, image_w, image_h, bitmap, ! image, num_lines, lines, epsf_level, &llx, &lly, &urx, &ury, ! write_date); ! saveEPSLines = FALSE; ! ! new_obj_ptr->x = obj_ptr->x; ! new_obj_ptr->y = obj_ptr->y; ! if (transformed) { ! new_obj_ptr->obbox.ltx = obj_ptr->orig_obbox.ltx; ! new_obj_ptr->obbox.lty = obj_ptr->orig_obbox.lty; ! new_obj_ptr->obbox.rbx = obj_ptr->orig_obbox.rbx; ! new_obj_ptr->obbox.rby = obj_ptr->orig_obbox.rby; ! new_obj_ptr->obbox.rby = obj_ptr->orig_obbox.rby; ! SetCTM(new_obj_ptr, obj_ptr->ctm); ! AdjObjBBox(new_obj_ptr); ! } else { ! new_obj_ptr->bbox.ltx = obj_ptr->bbox.ltx; ! new_obj_ptr->bbox.lty = obj_ptr->bbox.lty; ! new_obj_ptr->bbox.rbx = obj_ptr->bbox.rbx; ! new_obj_ptr->bbox.rby = obj_ptr->bbox.rby; ! new_obj_ptr->obbox.ltx = obj_ptr->obbox.ltx; ! new_obj_ptr->obbox.lty = obj_ptr->obbox.lty; ! new_obj_ptr->obbox.rbx = obj_ptr->obbox.rbx; ! new_obj_ptr->obbox.rby = obj_ptr->obbox.rby; ! } ! new_xbm_ptr = new_obj_ptr->detail.xbm; ! new_xbm_ptr->rotate = xbm_ptr->rotate; ! new_xbm_ptr->flip = xbm_ptr->flip; ! ! ReplaceObj(obj_ptr, new_obj_ptr); ! sel_ptr->obj = new_obj_ptr; ! RecordReplaceAnObj(new_obj_ptr); ! FreeObj(obj_ptr); ! ! count++; ! } ! } ! EndCompositeCmd(); ! ! if (count > 0) { ! UpdSelBBox(); ! RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), ! selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! SetFileModified(TRUE); ! justDupped = FALSE; ! sprintf(gszMsgBox, "EPS object%s updated.", (count>1 ? "s" : "")); ! Msg(gszMsgBox); ! } HighLightForward(); } *** exec.c.orig Tue Sep 30 13:23:06 1997 --- exec.c Tue Sep 30 13:23:06 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/exec.c,v 3.12 1997/01/31 00:10:38 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/exec.c,v 3.17 1997/09/17 05:59:06 william Exp $ */ #include *************** *** 233,236 **** --- 231,240 ---- int ExecGetFileSize ARGS_DECL((char**, struct ObjRec *, char*)); int ExecIsFile ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecIndex ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecRIndex ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecGetNumberOfLines ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecGetLineInAttr ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecTrim ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecIsAttr ARGS_DECL((char**, struct ObjRec *, char*)); static *************** *** 318,321 **** --- 322,331 ---- { (void*)ExecGetFileSize, "get_file_size", 2, 0}, { (void*)ExecIsFile, "is_file", 2, 0}, + { (void*)ExecIndex, "index", 3, 1}, + { (void*)ExecRIndex, "rindex", 3, 1}, + { (void*)ExecGetNumberOfLines, "get_number_of_lines_in_attr", 2, 0}, + { (void*)ExecGetLineInAttr, "get_line_in_attr", 3, 0}, + { (void*)ExecTrim, "trim", 1, 1}, + { (void*)ExecIsAttr, "is_attr", 2, 0}, { NULL, NULL, 0, 0 } }; *************** *** 3100,3104 **** char *attr_name=argv[0], *the_str=argv[1]; char *start_index_str=argv[2], *length_str=argv[3], *buf; ! int len, start_index, length; struct AttrRec *attr_ptr; struct ObjRec *attr_owner_obj=NULL; --- 3110,3114 ---- char *attr_name=argv[0], *the_str=argv[1]; char *start_index_str=argv[2], *length_str=argv[3], *buf; ! int len, start_index=(-1), length=(-1); struct AttrRec *attr_ptr; struct ObjRec *attr_owner_obj=NULL; *************** *** 3112,3119 **** if (attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); ! if (sscanf(start_index_str, "%d", &start_index) != 1) { ! return BadArg("start_index", orig_cmd); ! } else if (sscanf(length_str, "%d", &length) != 1) { ! return BadArg("length", orig_cmd); } if (start_index < 0) start_index = 0; --- 3122,3128 ---- if (attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); ! if (!IntExpression(start_index_str, &start_index, orig_cmd) || ! !IntExpression(length_str, &length, orig_cmd)) { ! return FALSE; } if (start_index < 0) start_index = 0; *************** *** 3126,3130 **** } else { strncpy(buf, &the_str[start_index], length); ! buf[start_index+length] = '\0'; } ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, (buf==NULL ? "" : buf)); --- 3135,3139 ---- } else { strncpy(buf, &the_str[start_index], length); ! buf[length] = '\0'; } ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, (buf==NULL ? "" : buf)); *************** *** 4736,4739 **** --- 4745,4939 ---- } ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, buf); + return TRUE; + } + + int ExecIndex(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* index(attr_name,str,substr); */ + { + char *attr_name=argv[0], *the_str=argv[1], *sub_str=argv[2], *c_ptr, buf[40]; + struct AttrRec *attr_ptr; + struct ObjRec *attr_owner_obj=NULL; + + UtilRemoveQuotes(attr_name); + UtilRemoveQuotes(the_str); + UtilRemoveQuotes(sub_str); + sprintf(execDummyStr, "%s=", attr_name); + attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &attr_owner_obj); + if (attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + c_ptr = strstr(the_str, sub_str); + if (c_ptr == NULL) { + strcpy(buf, "-1"); + } else { + sprintf(buf, "%1d", (int)(c_ptr-the_str)); + } + ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, buf); + return TRUE; + } + + int ExecRIndex(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* rindex(attr_name,str,substr); */ + { + char *attr_name=argv[0], *the_str=argv[1], *sub_str=argv[2]; + char *c_ptr, *last_match=NULL, buf[40]; + struct AttrRec *attr_ptr; + struct ObjRec *attr_owner_obj=NULL; + + UtilRemoveQuotes(attr_name); + UtilRemoveQuotes(the_str); + UtilRemoveQuotes(sub_str); + sprintf(execDummyStr, "%s=", attr_name); + attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &attr_owner_obj); + if (attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + for (c_ptr=strstr(the_str, sub_str); c_ptr != NULL; + c_ptr=strstr(&last_match[1], sub_str)) { + last_match = c_ptr; + } + if (last_match == NULL) { + strcpy(buf, "-1"); + } else { + sprintf(buf, "%1d", (int)(last_match-the_str)); + } + ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, buf); + return TRUE; + } + + int ExecGetNumberOfLines(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* get_number_of_lines_in_attr(result_attr,attr_name); */ + { + char *result_attr_name=argv[0], *attr_name=argv[1], buf[40]; + int count; + struct StrRec *str_ptr; + struct AttrRec *result_attr_ptr, *attr_ptr; + struct ObjRec *result_attr_owner_obj=NULL, *attr_owner_obj=NULL; + + UtilRemoveQuotes(result_attr_name); + UtilRemoveQuotes(attr_name); + + sprintf(execDummyStr, "%s=", attr_name); + attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &attr_owner_obj); + if (attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + sprintf(execDummyStr, "%s=", result_attr_name); + result_attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, + &result_attr_owner_obj); + if (result_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + count = 0; + for (str_ptr=attr_ptr->obj->detail.t->first; str_ptr != NULL; + str_ptr=str_ptr->next) { + count++; + } + sprintf(buf, "%1d", count); + ReplaceAttrFirstValue(result_attr_owner_obj, result_attr_ptr, buf); + + SetFileModified(TRUE); + return TRUE; + } + + int ExecGetLineInAttr(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* get_line_in_attr(result_attr,attr_name,line_number); */ + { + char *result_attr_name=argv[0], *attr_name=argv[1]; + char *line_number_str=argv[2], *psz=NULL; + int count, line_number=(-1); + struct StrRec *str_ptr; + struct AttrRec *result_attr_ptr, *attr_ptr; + struct ObjRec *result_attr_owner_obj=NULL, *attr_owner_obj=NULL; + + UtilRemoveQuotes(result_attr_name); + UtilRemoveQuotes(attr_name); + UtilRemoveQuotes(line_number_str); + + sprintf(execDummyStr, "%s=", attr_name); + attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &attr_owner_obj); + if (attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + sprintf(execDummyStr, "%s=", result_attr_name); + result_attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, + &result_attr_owner_obj); + if (result_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + if (!IntExpression(line_number_str, &line_number, orig_cmd)) { + return FALSE; + } + + count = 0; + for (str_ptr=attr_ptr->obj->detail.t->first; str_ptr != NULL; + str_ptr=str_ptr->next) { + if (count == line_number) { + if (str_ptr == attr_ptr->obj->detail.t->first) { + psz = UtilStrDup(attr_ptr->attr_value.s); + } else { + psz = UtilStrDup(str_ptr->dyn_str.s); + } + if (psz == NULL) FailAllocMessage(); + break; + } + count++; + } + if (psz == NULL) psz = UtilStrDup(""); + ReplaceAttrFirstValue(result_attr_owner_obj, result_attr_ptr, psz); + UtilFree(psz); + + SetFileModified(TRUE); + return TRUE; + } + + int ExecTrim(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* trim(attr_name); */ + { + char *attr_name=argv[0], *psz; + struct AttrRec *attr_ptr; + struct ObjRec *attr_owner_obj=NULL; + + UtilRemoveQuotes(attr_name); + sprintf(execDummyStr, "%s=", attr_name); + attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &attr_owner_obj); + if (attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + psz = UtilStrDup(attr_ptr->attr_value.s); + if (psz == NULL) FailAllocMessage(); + UtilTrimBlanks(psz); + ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, psz); + UtilFree(psz); + return TRUE; + } + + int ExecIsAttr(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* is_attr(result_attr,attr_name); */ + { + char *result_attr_name=argv[0], *attr_name=argv[1], buf[40]; + struct AttrRec *result_attr_ptr, *attr_ptr; + struct ObjRec *result_attr_owner_obj=NULL, *attr_owner_obj=NULL; + + UtilRemoveQuotes(result_attr_name); + UtilRemoveQuotes(attr_name); + + sprintf(execDummyStr, "%s=", attr_name); + attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &attr_owner_obj); + strcpy(buf, (attr_ptr==NULL ? "0" : "1")); + + sprintf(execDummyStr, "%s=", result_attr_name); + result_attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, + &result_attr_owner_obj); + if (result_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + ReplaceAttrFirstValue(result_attr_owner_obj, result_attr_ptr, buf); + + SetFileModified(TRUE); return TRUE; } *** expr.c.orig Tue Sep 30 13:23:08 1997 --- expr.c Tue Sep 30 13:23:08 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/expr.c,v 3.0 1996/05/06 16:04:59 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/expr.c,v 3.1 1997/09/14 20:37:51 william Exp $ */ #include *** file.c.orig Tue Sep 30 13:23:10 1997 --- file.c Tue Sep 30 13:23:11 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/file.c,v 3.21 1997/01/30 19:12:47 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/file.c,v 3.32 1997/09/18 00:29:18 william Exp $ */ #include *************** *** 140,150 **** #ifndef _NO_EXTERN extern time_t time ARGS_DECL((time_t *)); ! #ifdef SYSV extern unsigned sleep ARGS_DECL((unsigned)); ! #else extern int sleep ARGS_DECL((unsigned)); ! #endif #endif #define CUR_VERSION 33 --- 138,152 ---- #ifndef _NO_EXTERN extern time_t time ARGS_DECL((time_t *)); ! #if defined(SYSV) || defined(_AIX) extern unsigned sleep ARGS_DECL((unsigned)); ! #else /* ~(defined(SYSV) || defined(_AIX)) */ extern int sleep ARGS_DECL((unsigned)); ! #endif /* defined(SYSV) || defined(_AIX) */ #endif + #ifdef _METRIC_PIX_PER_INCH + #define METRIC_PIX_PER_INCH 127 + #endif /* _METRIC_PIX_PER_INCH */ + #define CUR_VERSION 33 *************** *** 204,207 **** --- 206,220 ---- int cmdLineDosEpsFilter=FALSE; + int cmdLinePreviewOnly=FALSE; + + int tmpFileMode=PSFILE_MOD; + char cmdLineTmpFileModeStr[MAXSTRING]; + + int cmdLineOpenDisplay=FALSE; + int cmdLineStdOut=FALSE; + int cmdLineWhereToPrint=INVALID; + int cmdLineTiffEPSI=INVALID; + + int generateTiffEPSI=INVALID; int showPageInEPS=FALSE; *************** *** 229,246 **** static struct DocFontRec *firstDocFont=NULL; ! void UpdateDocumentFonts (ps_font_name) ! char * ps_font_name; { ! int len=strlen(ps_font_name); ! struct DocFontRec * df_ptr; ! for (df_ptr=firstDocFont; df_ptr!=NULL; df_ptr=df_ptr->next) ! if (df_ptr->len == len && strcmp(df_ptr->name,ps_font_name) == 0) return; df_ptr = (struct DocFontRec *)malloc(sizeof(struct DocFontRec)); if (df_ptr == NULL) FailAllocMessage(); memset(df_ptr, 0, sizeof(struct DocFontRec)); df_ptr->len = len; ! strcpy (df_ptr->name, ps_font_name); df_ptr->next = firstDocFont; firstDocFont = df_ptr; --- 242,261 ---- static struct DocFontRec *firstDocFont=NULL; ! void UpdateDocumentFonts(ps_font_name) ! char *ps_font_name; { ! int len=strlen(ps_font_name); ! struct DocFontRec *df_ptr; ! for (df_ptr=firstDocFont; df_ptr!=NULL; df_ptr=df_ptr->next) { ! if (df_ptr->len == len && strcmp(df_ptr->name,ps_font_name) == 0) { return; + } + } df_ptr = (struct DocFontRec *)malloc(sizeof(struct DocFontRec)); if (df_ptr == NULL) FailAllocMessage(); memset(df_ptr, 0, sizeof(struct DocFontRec)); df_ptr->len = len; ! strcpy(df_ptr->name, ps_font_name); df_ptr->next = firstDocFont; firstDocFont = df_ptr; *************** *** 248,301 **** static ! int CopyAFile (file1, file2) ! char * file1, * file2; { ! char tmp_str[MAXSTRING+1], * rest; ! int short_name; ! FILE * fp1, * fp2; ! if ((fp1 = fopen (file1, "r")) == NULL) ! { ! sprintf (tmp_str, "Cannot open '%s' for read.", file1); ! if (PRTGIF) ! fprintf (stderr, "%s\n", tmp_str); ! else ! Msg (tmp_str); ! return (FALSE); } ! if ((short_name = IsPrefix (bootDir, file2, &rest))) ++rest; ! if ((fp2 = fopen (file2, "w")) == NULL) ! { ! if (PRTGIF) ! fprintf (stderr, "Cannot open '%s' for write.\n", file2); ! else ! { ! if (short_name) ! sprintf (tmp_str, "Cannot open '%s' for write.", rest); ! else ! sprintf (tmp_str, "Cannot open '%s' for write.", file2); ! Msg (tmp_str); } - fclose (fp1); - return (FALSE); } writeFileFailed = FALSE; ! while (fgets (tmp_str, MAXSTRING, fp1) != NULL) ! if (fputs (tmp_str, fp2) == EOF) writeFileFailed = TRUE; ! fclose (fp1); ! fclose (fp2); ! if (writeFileFailed) ! { writeFileFailed = FALSE; ! sprintf (tmp_str, "Fail to write to '%s'.\n\nFile system may be full.", ! file2); ! if (PRTGIF) ! fprintf (stderr, "%s\n", tmp_str); ! else ! MsgBox (tmp_str, TOOL_NAME, INFO_MB); ! return (FALSE); } ! return (TRUE); } --- 263,327 ---- static ! int CopyAFile(file1, file2) ! char *file1, *file2; { ! char tmp_str[MAXSTRING+1], *rest; ! FILE *fp1, *fp2; ! if ((fp1=fopen(file1, "r")) == NULL) { ! sprintf(tmp_str, "Cannot open '%s' for read.", file1); ! if (PRTGIF) { ! fprintf(stderr, "%s\n", tmp_str); ! } else { ! Msg(tmp_str); ! } ! return FALSE; } ! if (file2 == NULL) { ! /* PRTGIF && cmdLineStdOut */ ! fp2 = stdout; ! } else { ! int short_name=FALSE; ! ! if ((short_name=IsPrefix(bootDir, file2, &rest))) ++rest; ! if ((fp2=fopen(file2, "w")) == NULL) { ! if (PRTGIF) { ! fprintf(stderr, "Cannot open '%s' for write.\n", file2); ! } else { ! if (short_name) { ! sprintf(tmp_str, "Cannot open '%s' for write.", rest); ! } else { ! sprintf(tmp_str, "Cannot open '%s' for write.", file2); ! } ! Msg(tmp_str); ! } ! fclose(fp1); ! return FALSE; } } writeFileFailed = FALSE; ! while (fgets(tmp_str, MAXSTRING, fp1) != NULL) { ! if (fputs(tmp_str, fp2) == EOF) { writeFileFailed = TRUE; ! } ! } ! fclose(fp1); ! if (file2 != NULL) fclose(fp2); ! if (writeFileFailed) { writeFileFailed = FALSE; ! if (file2 == NULL) { ! sprintf(tmp_str, "Fail to write file.\n\nFile system may be full."); ! } else { ! sprintf(tmp_str, "Fail to write to '%s'.\n\nFile system may be full.", ! file2); ! } ! if (PRTGIF) { ! fprintf(stderr, "%s\n", tmp_str); ! } else { ! MsgBox(tmp_str, TOOL_NAME, INFO_MB); ! } ! return FALSE; } ! return TRUE; } *************** *** 304,308 **** char *cmd; { ! char tmp_str[MAXSTRING+1]; FILE *fp; --- 330,334 ---- char *cmd; { ! char tmp_str[MAXSTRING+1]; FILE *fp; *************** *** 325,333 **** } ! void ClearFileInfo () { curFileName[0] = '\0'; curFileDefined = FALSE; ! if (!curDirIsLocal) strcpy (curDir, curLocalDir); curDirIsLocal = TRUE; *curLocalDir = '\0'; --- 351,359 ---- } ! void ClearFileInfo() { curFileName[0] = '\0'; curFileDefined = FALSE; ! if (!curDirIsLocal) strcpy(curDir, curLocalDir); curDirIsLocal = TRUE; *curLocalDir = '\0'; *************** *** 362,422 **** } ! void Save (FP, BotObjPtr, Level, PageNumber) ! FILE * FP; ! struct ObjRec * BotObjPtr; ! int Level, PageNumber; { ! struct ObjRec * obj_ptr; ! SetCurChoice (NOTHING); ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); ! if (Level == 0 && PageNumber == 1) ! { ! char font_str[81]; ! ResetXPmErrorMessage (); ! GetPSFontStr (curFont, curStyle, font_str); ! if (TGIF_PATCHLEVEL == 0) ! { ! if (fprintf (FP, "%%TGIF %s\n", versionString) == EOF) writeFileFailed = TRUE; ! } ! else ! { ! if (fprintf (FP, "%%TGIF %s-p%1d\n", versionString, ! TGIF_PATCHLEVEL) == EOF) writeFileFailed = TRUE; } ! if (fprintf (FP, "state(%1d,%1d,%.3f,", pageStyle, CUR_VERSION, ! printMag) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,", drawOrigX, drawOrigY, zoomScale) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,", xyEnglishGrid, gridOn, colorIndex) == ! EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,", horiAlign, vertAlign, lineWidth) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,%1d,", curSpline, lineStyle, objFill, ! penPat) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,'%s',%1d,%1d,", textJust, /* font_str starts with the '/' character */ ! &font_str[1], curStyle, curSize) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,", 0, curDash, gridSystem) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,", xyMetricGrid, textVSpace, zoomedIn) == ! EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,", gridShown, moveMode, curRotate) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,", rcbRadius, useGray) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d).\n", pageLayoutMode, (pageLayoutMode == PAGE_STACK) ? curPageNum : paperCol, --- 388,456 ---- } ! void Save(FP, BotObjPtr, Level, PageNumber) ! FILE *FP; ! struct ObjRec *BotObjPtr; ! int Level, PageNumber; { ! struct ObjRec *obj_ptr; ! SetCurChoice(NOTHING); ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! if (Level == 0 && PageNumber == 1) { ! char font_str[81]; ! ResetXPmErrorMessage(); ! GetPSFontStr(curFont, curStyle, font_str); ! if (TGIF_PATCHLEVEL == 0) { ! if (fprintf(FP, "%%TGIF %s\n", versionString) == EOF) { writeFileFailed = TRUE; ! } ! } else { ! if (fprintf(FP, "%%TGIF %s-p%1d\n", versionString, ! TGIF_PATCHLEVEL) == EOF) { writeFileFailed = TRUE; + } } ! if (fprintf(FP, "state(%1d,%1d,%.3f,", pageStyle, CUR_VERSION, ! printMag) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,", drawOrigX, drawOrigY, zoomScale) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,", xyEnglishGrid, gridOn, colorIndex) == ! EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,", horiAlign, vertAlign, lineWidth) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,%1d,", curSpline, lineStyle, objFill, ! penPat) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,'%s',%1d,%1d,", textJust, /* font_str starts with the '/' character */ ! &font_str[1], curStyle, curSize) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,", 0, curDash, gridSystem) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,", xyMetricGrid, textVSpace, zoomedIn) == ! EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,", gridShown, moveMode, curRotate) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,", rcbRadius, useGray) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d).\n", pageLayoutMode, (pageLayoutMode == PAGE_STACK) ? curPageNum : paperCol, *************** *** 425,448 **** round(((float)onePageWidth)*printMag/100.0), round(((float)onePageHeight)*printMag/100.0), ! stretchableText, textRotation, rotationIncrement) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%%\n") == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%% @%s%s\n", "(#)$H", "eader$") == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%% %s\n", "%W%") == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%%\n") == EOF) writeFileFailed = TRUE; ! if (savedComments != NULL) ! if (fputs (savedComments, FP) == EOF) writeFileFailed = TRUE; ! if (tgifObj->lattr != NULL) ! { ! if (fprintf (FP, "file_attr(") == EOF) writeFileFailed = TRUE; ! SaveAttrs (FP, tgifObj->lattr); ! if (fprintf (FP, ").\n") == EOF) writeFileFailed = TRUE; } GetUnitSpec(gszMsgBox); --- 459,488 ---- round(((float)onePageWidth)*printMag/100.0), round(((float)onePageHeight)*printMag/100.0), ! stretchableText, textRotation, rotationIncrement) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%%\n") == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%% @%s%s\n", "(#)$H", "eader$") == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%% %s\n", "%W%") == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%%\n") == EOF) { writeFileFailed = TRUE; + } ! if (savedComments != NULL) { ! if (fputs(savedComments, FP) == EOF) { writeFileFailed = TRUE; + } + } ! if (tgifObj->lattr != NULL) { ! if (fprintf(FP, "file_attr(") == EOF) writeFileFailed = TRUE; ! SaveAttrs(FP, tgifObj->lattr); ! if (fprintf(FP, ").\n") == EOF) writeFileFailed = TRUE; } GetUnitSpec(gszMsgBox); *************** *** 458,790 **** SaveColors(FP); } ! if (Level == 0) ! if (fprintf (FP, "page(%1d,\"%s\",%1d).\n", PageNumber, ((pageLayoutMode==PAGE_TILE || curPage->name==NULL) ? "" : ! curPage->name), curPage->layer_on) == EOF) writeFileFailed = TRUE; - - for (obj_ptr = BotObjPtr; obj_ptr != NULL; obj_ptr = obj_ptr->prev) - { - switch (obj_ptr->type) - { - case OBJ_POLY: SavePolyObj (FP, obj_ptr); break; - case OBJ_BOX: SaveBoxObj (FP, obj_ptr); break; - case OBJ_OVAL: SaveOvalObj (FP, obj_ptr); break; - case OBJ_TEXT: SaveTextObj (FP, obj_ptr); break; - case OBJ_POLYGON: SavePolygonObj (FP, obj_ptr); break; - case OBJ_ARC: SaveArcObj (FP, obj_ptr); break; - case OBJ_RCBOX: SaveRCBoxObj (FP, obj_ptr); break; - case OBJ_XBM: SaveXBmObj (FP, obj_ptr); break; - case OBJ_XPM: SaveXPmObj (FP, obj_ptr); break; - case OBJ_GROUP: SaveGroupObj (FP, obj_ptr, Level); break; - case OBJ_SYM: SaveCompObj (FP, obj_ptr, Level); break; - case OBJ_ICON: SaveIconObj (FP, obj_ptr, Level); break; - } - if (obj_ptr->prev == NULL) - { - if (Level == 0) - { - if (fprintf (FP, ".\n") == EOF) writeFileFailed = TRUE; - } - else - { - if (fprintf (FP, "\n") == EOF) writeFileFailed = TRUE; - } } ! else ! { ! if (Level == 0) ! { ! if (fprintf (FP, ".\n") == EOF) writeFileFailed = TRUE; } ! else ! { ! if (fprintf (FP, ",\n") == EOF) writeFileFailed = TRUE; } } } ! SetDefaultCursor (mainWindow); ! ShowCursor (); } ! int SaveTmpFile (NewFileName) ! char * NewFileName; /* return TRUE if file successfully saved */ { ! char new_file_name[MAXPATHLENGTH+1], s[MAXPATHLENGTH+1]; ! char * rest; ! FILE * fp; ! int count = 0, status, short_name; ! struct PageRec * saved_cur_page; ! struct ObjRec * obj_ptr; ! strcpy (new_file_name, NewFileName); saved_cur_page = curPage; ! for (curPage=firstPage; curPage != NULL; curPage = curPage->next) ! for (obj_ptr = curPage->top; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! if (obj_ptr->type == OBJ_SYM) count++; curPage = saved_cur_page; ! switch (count) ! { ! case 0: ! sprintf (new_file_name, "%s.%s", NewFileName, OBJ_FILE_EXT); ! status = OBJ_FILE_SAVED; ! break; ! case 1: ! if (lastPageNum == 1) ! { ! sprintf (new_file_name, "%s.%s", NewFileName, SYM_FILE_EXT); ! status = SYM_FILE_SAVED; ! } ! else ! { ! MsgBox ("A symbol file can only have one page.\n\nSave aborted!", ! TOOL_NAME, INFO_MB); ! return (INVALID); ! } ! break; ! default: ! MsgBox ("Too many symbols!\n\nSymbol file not saved.", TOOL_NAME, INFO_MB); ! return (INVALID); } ! unlink (new_file_name); ! if ((short_name = IsPrefix (bootDir, new_file_name, &rest))) ++rest; ! if ((fp = fopen (new_file_name, "w")) == NULL) ! { ! if (short_name) ! sprintf (s, "Cannot open '%s', file not saved.", rest); ! else ! sprintf (s, "Cannot open '%s', file not saved.", new_file_name); ! MsgBox (s, TOOL_NAME, INFO_MB); ! return (INVALID); } ! if (short_name) ! sprintf (s, "Saving temporary file '%s' ...", rest); ! else ! sprintf (s, "Saving temporary file '%s' ...", new_file_name); ! Msg (s); writeFileFailed = FALSE; ! MakeQuiescent (); saved_cur_page = curPage; ! for (curPage = firstPage, count = 1; curPage != NULL; ! curPage = curPage->next, count++) ! { topObj = curPage->top; botObj = curPage->bot; ! Save (fp, botObj, 0, count); } curPage = saved_cur_page; topObj = curPage->top; botObj = curPage->bot; ! fclose (fp); ! if (writeFileFailed) ! { writeFileFailed = FALSE; ! sprintf (s, "Fail to write to '%s'.\n\nFile system may be full.", new_file_name); ! MsgBox (s, TOOL_NAME, INFO_MB); ! } ! else ! { ! if (short_name) ! sprintf (s, "Temporary file '%s' saved.", rest); ! else ! sprintf (s, "Temporary file '%s' saved.", new_file_name); ! Msg (s); } ! if (PSFILE_MOD != 0 && chmod (new_file_name, 0777)) ! { ! if (short_name) ! sprintf (s, "Cannot chmod '%s' to 0777.", rest); ! else ! sprintf (s, "Cannot chmod '%s' to 0777.", new_file_name); ! MsgBox (s, TOOL_NAME, INFO_MB); } ! return (status); } ! void SaveNewFile (SaveSelectedOnly) ! int SaveSelectedOnly; { ! char new_file_name[MAXPATHLENGTH+1], s[MAXPATHLENGTH+1]; ! char new_full_name[MAXPATHLENGTH+1]; ! char tmp_str[MAXPATHLENGTH+1]; ! char name_without_ext[MAXPATHLENGTH+1], * rest; ! char saved_cur_dir[MAXPATHLENGTH+1]; ! char saved_cur_file_name[MAXPATHLENGTH+1]; ! char obj_ext_str[MAXSTRING+1], sym_ext_str[MAXSTRING+1]; ! int saved_cur_file_defined=FALSE, obj_ext_len, sym_ext_len; ! FILE * fp; ! int count = 0, len, short_name, ok=TRUE; ! struct ObjRec * obj_ptr, * saved_top_obj=NULL, * saved_bot_obj=NULL; ! struct SelRec * top_sel_ptr, * bot_sel_ptr; ! struct SelRec * sel_ptr, * next_sel; ! struct PageRec * saved_cur_page; ! if (SaveSelectedOnly && topSel==NULL) ! { ! MsgBox ("No objects selected!\n\nNothing saved!", TOOL_NAME, INFO_MB); return; } ! if (curDirIsLocal) ! sprintf (s, "( working directory: %s )", curDir); ! else ! sprintf (s, "( working directory: %s )", curLocalDir); ! Dialog ("Please enter new file name: ( : accept, : cancel )", s, new_file_name); if (*new_file_name == '\0') return; ! len = strlen (new_file_name); ! if (SaveSelectedOnly) ! { ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! if (sel_ptr->obj->type == OBJ_SYM) count++; ! } ! else ! { saved_cur_page = curPage; ! for (curPage = firstPage; curPage != NULL; curPage = curPage->next) ! for (obj_ptr = curPage->top; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! if (obj_ptr->type == OBJ_SYM) count++; curPage = saved_cur_page; } ! sprintf (obj_ext_str, ".%s", OBJ_FILE_EXT); ! sprintf (sym_ext_str, ".%s", SYM_FILE_EXT); ! obj_ext_len = strlen (obj_ext_str); ! sym_ext_len = strlen (sym_ext_str); ! switch (count) ! { ! case 0: ! if (len >= obj_ext_len || len >= sym_ext_len) ! { ! if (strcmp (&new_file_name[len-sym_ext_len], sym_ext_str) == 0) ! { ! Msg ("Cannot save as a symbol file, no symbol defined."); ! return; ! } ! else if (strcmp (&new_file_name[len-obj_ext_len], obj_ext_str) != 0) ! { ! strcpy (name_without_ext, new_file_name); ! strcat (new_file_name, obj_ext_str); ! } ! else ! { ! strcpy (name_without_ext, new_file_name); ! name_without_ext[len-obj_ext_len] = '\0'; ! } ! if (strlen (new_file_name) == obj_ext_len) ! { ! MsgBox ("No file name specified.\n\nFile not saved.", TOOL_NAME, INFO_MB); return; } - } - else - { - strcpy (name_without_ext, new_file_name); - strcat (new_file_name, obj_ext_str); - } - break; - case 1: - if (lastPageNum == 1) - { - if (len >= obj_ext_len || len >= sym_ext_len) - { - if (strcmp (&new_file_name[len-obj_ext_len], obj_ext_str) == 0) - { - Msg ("Cannot save as an object file; one symbol defined."); - return; - } - else if (strcmp(&new_file_name[len-sym_ext_len],sym_ext_str)!=0) - { - strcpy (name_without_ext, new_file_name); - strcat (new_file_name, sym_ext_str); - } - else - { - strcpy (name_without_ext, new_file_name); - name_without_ext[len-sym_ext_len] = '\0'; - } ! if (strlen (new_file_name) == sym_ext_len) ! { ! MsgBox ("No file name specified.\n\nFile not saved.", ! TOOL_NAME, INFO_MB); ! return; ! } ! } ! else ! { ! strcpy (name_without_ext, new_file_name); ! strcat (new_file_name, sym_ext_str); } } ! else ! { ! MsgBox ("A symbol file can only have one page.\n\nSave aborted!", ! TOOL_NAME, INFO_MB); ! return; ! } ! break; ! default: ! MsgBox ("Too many symbols!\n\nSymbol file not saved.", TOOL_NAME, INFO_MB); return; } ! if (*new_file_name == '/') ! strcpy (new_full_name, new_file_name); ! else if (curDirIsLocal) ! sprintf (new_full_name, "%s/%s", curDir, new_file_name); ! else ! sprintf (new_full_name, "%s/%s", curLocalDir, new_file_name); ! if (!OkayToCreateFile (new_full_name)) return; ! if ((short_name = IsPrefix (bootDir, new_full_name, &rest))) ++rest; ! if ((fp = fopen (new_full_name, "w")) == NULL) ! { ! if (short_name) ! sprintf (s, "Cannot open '%s', file not saved.", rest); ! else ! sprintf (s, "Cannot open '%s', file not saved.", new_full_name); ! MsgBox (s, TOOL_NAME, INFO_MB); return; } if (!SaveSelectedOnly) BeforeNavigate(); ! if (SaveSelectedOnly) ! { ! PushPageInfo (); ! if (pageLayoutMode == PAGE_STACK) paperCol = paperRow = curPageNum = lastPageNum = 1; ! if (curDirIsLocal) ! strcpy (saved_cur_dir, curDir); ! else ! strcpy (saved_cur_dir, curLocalDir); ! strcpy (saved_cur_file_name, curFileName); saved_cur_file_defined = curFileDefined; saved_top_obj = topObj; saved_bot_obj = botObj; ! JustDupSelObj (&top_sel_ptr, &bot_sel_ptr); topObj = top_sel_ptr->obj; botObj = bot_sel_ptr->obj; --- 498,817 ---- SaveColors(FP); } ! if (Level == 0) { ! if (fprintf(FP, "page(%1d,\"%s\",%1d).\n", PageNumber, ((pageLayoutMode==PAGE_TILE || curPage->name==NULL) ? "" : ! curPage->name), curPage->layer_on) == EOF) { writeFileFailed = TRUE; } ! } ! ! for (obj_ptr=BotObjPtr; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! switch (obj_ptr->type) { ! case OBJ_POLY: SavePolyObj(FP, obj_ptr); break; ! case OBJ_BOX: SaveBoxObj(FP, obj_ptr); break; ! case OBJ_OVAL: SaveOvalObj(FP, obj_ptr); break; ! case OBJ_TEXT: SaveTextObj(FP, obj_ptr); break; ! case OBJ_POLYGON: SavePolygonObj(FP, obj_ptr); break; ! case OBJ_ARC: SaveArcObj(FP, obj_ptr); break; ! case OBJ_RCBOX: SaveRCBoxObj(FP, obj_ptr); break; ! case OBJ_XBM: SaveXBmObj(FP, obj_ptr); break; ! case OBJ_XPM: SaveXPmObj(FP, obj_ptr); break; ! case OBJ_GROUP: SaveGroupObj(FP, obj_ptr, Level); break; ! case OBJ_SYM: SaveCompObj(FP, obj_ptr, Level); break; ! case OBJ_ICON: SaveIconObj(FP, obj_ptr, Level); break; ! } ! if (obj_ptr->prev == NULL) { ! if (Level == 0) { ! if (fprintf(FP, ".\n") == EOF) writeFileFailed = TRUE; ! } else { ! if (fprintf(FP, "\n") == EOF) writeFileFailed = TRUE; } ! } else { ! if (Level == 0) { ! if (fprintf(FP, ".\n") == EOF) writeFileFailed = TRUE; ! } else { ! if (fprintf(FP, ",\n") == EOF) writeFileFailed = TRUE; } } } ! SetDefaultCursor(mainWindow); ! ShowCursor(); } ! int SaveTmpFile(NewFileName) ! char *NewFileName; /* return TRUE if file successfully saved */ { ! char new_file_name[MAXPATHLENGTH+1], s[MAXPATHLENGTH+1]; ! char *rest=NULL; ! FILE *fp=NULL; ! int count=0, status=INVALID, short_name; ! struct PageRec *saved_cur_page; ! struct ObjRec *obj_ptr; ! struct ObjRec *obj_ptr1=NULL, *obj_ptr2=NULL; ! strcpy(new_file_name, NewFileName); saved_cur_page = curPage; ! for (curPage=firstPage; curPage != NULL; curPage=curPage->next) { ! for (obj_ptr=curPage->top; obj_ptr != NULL; obj_ptr=obj_ptr->next) { ! if (obj_ptr->type == OBJ_SYM) { ! if (obj_ptr1 == NULL) { ! obj_ptr1 = obj_ptr; ! } else if (obj_ptr2 == NULL) { ! obj_ptr2 = obj_ptr; ! } count++; + } + } + } curPage = saved_cur_page; ! switch (count) { ! case 0: ! sprintf(new_file_name, "%s.%s", NewFileName, OBJ_FILE_EXT); ! status = OBJ_FILE_TYPE; ! break; ! case 1: ! if (lastPageNum == 1) { ! sprintf(new_file_name, "%s.%s", NewFileName, SYM_FILE_EXT); ! status = SYM_FILE_TYPE; ! } else { ! MsgBox("A symbol file can only have one page.\n\nSave aborted!", TOOL_NAME, INFO_MB); ! return INVALID; ! } ! break; ! default: ! MsgBox("Too many symbols!\n\nSymbol file not saved.", ! TOOL_NAME, INFO_MB); ! return INVALID; } ! unlink(new_file_name); ! if ((short_name=IsPrefix(bootDir, new_file_name, &rest))) ++rest; ! if ((fp=fopen(new_file_name, "w")) == NULL) { ! if (short_name) { ! sprintf(s, "Cannot open '%s', file not saved.", rest); ! } else { ! sprintf(s, "Cannot open '%s', file not saved.", new_file_name); ! } ! MsgBox(s, TOOL_NAME, INFO_MB); ! return INVALID; } ! if (short_name) { ! sprintf(s, "Saving temporary file '%s' ...", rest); ! } else { ! sprintf(s, "Saving temporary file '%s' ...", new_file_name); ! } ! Msg(s); writeFileFailed = FALSE; ! MakeQuiescent(); saved_cur_page = curPage; ! for (curPage=firstPage, count=1; curPage != NULL; ! curPage=curPage->next, count++) { topObj = curPage->top; botObj = curPage->bot; ! Save(fp, botObj, 0, count); } curPage = saved_cur_page; topObj = curPage->top; botObj = curPage->bot; ! fclose(fp); ! if (writeFileFailed) { writeFileFailed = FALSE; ! sprintf(s, "Fail to write to '%s'.\n\nFile system may be full.", new_file_name); ! MsgBox(s, TOOL_NAME, INFO_MB); ! } else { ! if (short_name) { ! sprintf(s, "Temporary file '%s' saved.", rest); ! } else { ! sprintf(s, "Temporary file '%s' saved.", new_file_name); ! } ! Msg(s); } ! if (tmpFileMode != 0 && chmod(new_file_name, tmpFileMode)) { ! if (short_name) { ! sprintf(s, "Cannot chmod '%s' to 0%03o.", rest, tmpFileMode); ! } else { ! sprintf(s, "Cannot chmod '%s' to 0%03o.", new_file_name, tmpFileMode); ! } ! MsgBox(s, TOOL_NAME, INFO_MB); } ! return status; } ! void SaveNewFile(SaveSelectedOnly) ! int SaveSelectedOnly; { ! char new_file_name[MAXPATHLENGTH+1], s[MAXPATHLENGTH+1]; ! char new_full_name[MAXPATHLENGTH+1], tmp_str[MAXPATHLENGTH+1], *rest=NULL; ! char name_without_ext[MAXPATHLENGTH+1]; ! char saved_cur_dir[MAXPATHLENGTH+1], saved_cur_file_name[MAXPATHLENGTH+1]; ! char obj_ext_str[MAXSTRING+1], sym_ext_str[MAXSTRING+1]; ! int saved_cur_file_defined=FALSE, obj_ext_len, sym_ext_len; ! FILE *fp=NULL; ! int count=0, len, short_name, ok=TRUE; ! struct ObjRec *obj_ptr, *saved_top_obj=NULL, *saved_bot_obj=NULL; ! struct SelRec *top_sel_ptr, *bot_sel_ptr; ! struct SelRec *sel_ptr, *next_sel; ! struct PageRec *saved_cur_page; ! struct ObjRec *obj_ptr1=NULL, *obj_ptr2=NULL; ! if (SaveSelectedOnly && topSel==NULL) { ! MsgBox("No objects selected!\n\nNothing saved!", TOOL_NAME, INFO_MB); return; } ! if (curDirIsLocal) { ! sprintf(s, "( working directory: %s )", curDir); ! } else { ! sprintf(s, "( working directory: %s )", curLocalDir); ! } ! Dialog("Please enter new file name: ( : accept, : cancel )", s, new_file_name); if (*new_file_name == '\0') return; ! len = strlen(new_file_name); ! if (SaveSelectedOnly) { ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! if (sel_ptr->obj->type == OBJ_SYM) { ! if (obj_ptr1 == NULL) { ! obj_ptr1 = sel_ptr->obj; ! } else if (obj_ptr2 == NULL) { ! obj_ptr2 = sel_ptr->obj; ! } count++; ! } ! } ! } else { saved_cur_page = curPage; ! for (curPage=firstPage; curPage != NULL; curPage=curPage->next) { ! for (obj_ptr=curPage->top; obj_ptr != NULL; obj_ptr=obj_ptr->next) { ! if (obj_ptr->type == OBJ_SYM) { ! if (obj_ptr1 == NULL) { ! obj_ptr1 = obj_ptr; ! } else if (obj_ptr2 == NULL) { ! obj_ptr2 = obj_ptr; ! } count++; + } + } + } curPage = saved_cur_page; } ! sprintf(obj_ext_str, ".%s", OBJ_FILE_EXT); ! sprintf(sym_ext_str, ".%s", SYM_FILE_EXT); ! obj_ext_len = strlen(obj_ext_str); ! sym_ext_len = strlen(sym_ext_str); ! switch (count) { ! case 0: ! if (len >= obj_ext_len || len >= sym_ext_len) { ! if (strcmp(&new_file_name[len-sym_ext_len], sym_ext_str) == 0) { ! MsgBox("Cannot save as a symbol file.\n\nNo symbol defined.", ! TOOL_NAME, INFO_MB); ! return; ! } else if (strcmp(&new_file_name[len-obj_ext_len], obj_ext_str) != 0) { ! strcpy(name_without_ext, new_file_name); ! strcat(new_file_name, obj_ext_str); ! } else { ! strcpy(name_without_ext, new_file_name); ! name_without_ext[len-obj_ext_len] = '\0'; ! } ! if (strlen(new_file_name) == obj_ext_len) { ! MsgBox("No file name specified.\n\nFile not saved.", ! TOOL_NAME, INFO_MB); ! return; ! } ! } else { ! strcpy(name_without_ext, new_file_name); ! strcat(new_file_name, obj_ext_str); ! } ! break; ! case 1: ! if (lastPageNum == 1) { ! if (len >= obj_ext_len || len >= sym_ext_len) { ! if (strcmp(&new_file_name[len-obj_ext_len], obj_ext_str) == 0) { ! MsgBox("Cannot save as an object file; one symbol defined.", TOOL_NAME, INFO_MB); return; + } else if (strcmp(&new_file_name[len-sym_ext_len],sym_ext_str)!=0) { + strcpy(name_without_ext, new_file_name); + strcat(new_file_name, sym_ext_str); + } else { + strcpy(name_without_ext, new_file_name); + name_without_ext[len-sym_ext_len] = '\0'; } ! if (strlen(new_file_name) == sym_ext_len) { ! MsgBox("No file name specified.\n\nFile not saved.", ! TOOL_NAME, INFO_MB); ! return; } + } else { + strcpy(name_without_ext, new_file_name); + strcat(new_file_name, sym_ext_str); } ! } else { ! MsgBox("A symbol file can only have one page.\n\nSave aborted!", TOOL_NAME, INFO_MB); return; + } + break; + default: + MsgBox("Too many symbols!\n\nSymbol file not saved.", + TOOL_NAME, INFO_MB); + return; } ! if (*new_file_name == '/') { ! strcpy(new_full_name, new_file_name); ! } else if (curDirIsLocal) { ! sprintf(new_full_name, "%s/%s", curDir, new_file_name); ! } else { ! sprintf(new_full_name, "%s/%s", curLocalDir, new_file_name); ! } ! if (!OkayToCreateFile(new_full_name)) return; ! if ((short_name=IsPrefix(bootDir, new_full_name, &rest))) ++rest; ! if ((fp=fopen(new_full_name, "w")) == NULL) { ! if (short_name) { ! sprintf(s, "Cannot open '%s', file not saved.", rest); ! } else { ! sprintf(s, "Cannot open '%s', file not saved.", new_full_name); ! } ! MsgBox(s, TOOL_NAME, INFO_MB); return; } if (!SaveSelectedOnly) BeforeNavigate(); ! if (SaveSelectedOnly) { ! PushPageInfo(); ! if (pageLayoutMode == PAGE_STACK) { paperCol = paperRow = curPageNum = lastPageNum = 1; + } ! if (curDirIsLocal) { ! strcpy(saved_cur_dir, curDir); ! } else { ! strcpy(saved_cur_dir, curLocalDir); ! } ! strcpy(saved_cur_file_name, curFileName); saved_cur_file_defined = curFileDefined; saved_top_obj = topObj; saved_bot_obj = botObj; ! JustDupSelObj(&top_sel_ptr, &bot_sel_ptr); topObj = top_sel_ptr->obj; botObj = bot_sel_ptr->obj; *************** *** 798,803 **** firstPage->bot = botObj; firstPage->next = firstPage->prev = NULL; ! if (pageLayoutMode == PAGE_STACK) ! { firstPage->draw_orig_x = drawOrigX; firstPage->draw_orig_y = drawOrigY; --- 825,829 ---- firstPage->bot = botObj; firstPage->next = firstPage->prev = NULL; ! if (pageLayoutMode == PAGE_STACK) { firstPage->draw_orig_x = drawOrigX; firstPage->draw_orig_y = drawOrigY; *************** *** 808,882 **** for (sel_ptr=topSel, obj_ptr=topObj; obj_ptr!=NULL; ! sel_ptr=sel_ptr->next, obj_ptr=obj_ptr->next) ! { ! CopyObjId (sel_ptr->obj, obj_ptr); ! CopyObjLocks (sel_ptr->obj, obj_ptr); } } ! if (curDirIsLocal) ! strcpy (tmp_str, curDir); ! else ! strcpy (tmp_str, curLocalDir); ! SetCurDir (new_full_name); curFileDefined = TRUE; ! switch (count) ! { ! case 0: ! *curSymDir = '\0'; ! if ((strcmp (tmp_str, (curDirIsLocal ? curDir : curLocalDir)) != 0) || ! (!NameInCurDir (curFileName))) ! UpdateDirInfo (); ! break; ! case 1: ! strcpy (curSymDir, (curDirIsLocal ? curDir : curLocalDir)); ! if (!DirInSymPath (curDirIsLocal ? curDir : curLocalDir)) ! UpdateSymInfo (); ! break; } ! if (short_name) ! sprintf (s, "Saving '%s' ...", rest); ! else ! sprintf (s, "Saving '%s' ...", new_full_name); ! Msg (s); ! if (!saveCommentsInSaveNew) CleanUpComments (); writeFileFailed = FALSE; saved_cur_page = curPage; ! for (curPage = firstPage, count = 1; curPage != NULL; ! curPage = curPage->next, count++) ! { topObj = curPage->top; botObj = curPage->bot; ! Save (fp, botObj, 0, count); } curPage = saved_cur_page; topObj = curPage->top; botObj = curPage->bot; ! fclose (fp); ! if (writeFileFailed) ! { writeFileFailed = FALSE; ! sprintf (s, "Fail to write to '%s'.\n\nFile system may be full.", new_full_name); ! MsgBox (s, TOOL_NAME, INFO_MB); ok = FALSE; ! } ! else ! { ! if (short_name) ! sprintf (s, "File '%s' saved.", rest); ! else ! sprintf (s, "File '%s' saved.", new_full_name); ! Msg (s); } ! if (SaveSelectedOnly) ! { ! CleanUpPage (); ! for (sel_ptr = top_sel_ptr; sel_ptr != NULL; sel_ptr = next_sel) { next_sel = sel_ptr->next; free(sel_ptr); --- 834,906 ---- for (sel_ptr=topSel, obj_ptr=topObj; obj_ptr!=NULL; ! sel_ptr=sel_ptr->next, obj_ptr=obj_ptr->next) { ! CopyObjId(sel_ptr->obj, obj_ptr); ! CopyObjLocks(sel_ptr->obj, obj_ptr); } } ! if (curDirIsLocal) { ! strcpy(tmp_str, curDir); ! } else { ! strcpy(tmp_str, curLocalDir); ! } ! SetCurDir(new_full_name); curFileDefined = TRUE; ! switch (count) { ! case 0: ! *curSymDir = '\0'; ! if ((strcmp(tmp_str, (curDirIsLocal ? curDir : curLocalDir)) != 0) || ! (!NameInCurDir(curFileName))) { ! UpdateDirInfo(); ! } ! break; ! case 1: ! strcpy(curSymDir, (curDirIsLocal ? curDir : curLocalDir)); ! if (!DirInSymPath(curDirIsLocal ? curDir : curLocalDir)) { ! UpdateSymInfo(); ! } ! break; } ! if (short_name) { ! sprintf(s, "Saving '%s' ...", rest); ! } else { ! sprintf(s, "Saving '%s' ...", new_full_name); ! } ! Msg(s); ! if (!saveCommentsInSaveNew) CleanUpComments(); writeFileFailed = FALSE; saved_cur_page = curPage; ! for (curPage=firstPage, count=1; curPage != NULL; ! curPage=curPage->next, count++) { topObj = curPage->top; botObj = curPage->bot; ! Save(fp, botObj, 0, count); } curPage = saved_cur_page; topObj = curPage->top; botObj = curPage->bot; ! fclose(fp); ! if (writeFileFailed) { writeFileFailed = FALSE; ! sprintf(s, "Fail to write to '%s'.\n\nFile system may be full.", new_full_name); ! MsgBox(s, TOOL_NAME, INFO_MB); ok = FALSE; ! } else { ! if (short_name) { ! sprintf(s, "File '%s' saved.", rest); ! } else { ! sprintf(s, "File '%s' saved.", new_full_name); ! } ! Msg(s); } ! if (SaveSelectedOnly) { ! CleanUpPage(); ! for (sel_ptr=top_sel_ptr; sel_ptr != NULL; sel_ptr=next_sel) { next_sel = sel_ptr->next; free(sel_ptr); *************** *** 885,1206 **** topObj = saved_top_obj; botObj = saved_bot_obj; ! if (curDirIsLocal) ! strcpy (curDir, saved_cur_dir); ! else ! strcpy (curLocalDir, saved_cur_dir); ! strcpy (curFileName, saved_cur_file_name); curFileDefined = saved_cur_file_defined; ! PopPageInfo (); ! } ! else if (ok) ! { ! SetFileModified (FALSE); ! RedrawTitleWindow (); } ! if (!SaveSelectedOnly) CommitNavigate (); } ! void SaveSymInLibrary () { ! char new_file_name[MAXPATHLENGTH+1], s[MAXPATHLENGTH+1]; ! char new_full_name[MAXPATHLENGTH+1]; ! char dir_name[MAXPATHLENGTH+1]; ! char saved_dir[MAXPATHLENGTH+1], saved_file[MAXPATHLENGTH+1]; ! char saved_sym_dir[MAXPATHLENGTH+1]; ! char name_without_ext[MAXPATHLENGTH+1], * rest; ! char sym_ext_str[MAXSTRING+1], * c_ptr; ! FILE * fp; ! int count=0, len, short_name, sym_ext_len; ! int saved_cur_file_defined; ! struct ObjRec * obj_ptr; ! struct PageRec * saved_cur_page; saved_cur_page = curPage; ! for (curPage = firstPage; curPage != NULL; curPage = curPage->next) ! for (obj_ptr = curPage->top; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! if (obj_ptr->type == OBJ_SYM) count++; curPage = saved_cur_page; ! switch (count) ! { ! case 0: ! MsgBox ("No symbol found!\n\nSymbol file not saved.", ! TOOL_NAME, INFO_MB); ! return; ! case 1: ! if (lastPageNum != 1) ! { ! MsgBox ("A symbol file can only have one page.\n\nSave aborted!", ! TOOL_NAME, INFO_MB); ! return; ! } ! break; ! default: ! MsgBox ("Too many symbols!\n\nSymbol file not saved.", TOOL_NAME, INFO_MB); return; } ! MakeQuiescent (); ! sprintf (sym_ext_str, ".%s", SYM_FILE_EXT); ! sym_ext_len = strlen (sym_ext_str); ! if (*curFileName == '\0') ! { ! Dialog ("Please enter new file name:", "( : accept, : cancel )", new_file_name); if (*new_file_name == '\0') return; ! len = strlen (new_file_name); ! if (len >= sym_ext_len) ! { ! if (strcmp (&new_file_name[len-sym_ext_len], sym_ext_str) != 0) ! { ! strcpy (name_without_ext, new_file_name); ! strcat (new_file_name, sym_ext_str); ! } ! else ! { ! strcpy (name_without_ext, new_file_name); name_without_ext[len-sym_ext_len] = '\0'; } ! if (strlen (new_file_name) == sym_ext_len) ! { ! MsgBox ("No file name specified.\n\nFile not saved.", TOOL_NAME, INFO_MB); return; } } ! else ! { ! strcpy (name_without_ext, new_file_name); ! strcat (new_file_name, sym_ext_str); ! } ! } ! else ! { ! len = strlen (curFileName); ! for (c_ptr = &curFileName[len-1]; c_ptr != curFileName; c_ptr--) ! if (*c_ptr == '/') break; if (*c_ptr == '/') c_ptr++; ! strcpy (new_file_name, c_ptr); } ! if (SelectSymDir (dir_name) == INVALID) { Msg (""); return; } ! if (strcmp (dir_name, ".") == 0) ! sprintf (new_full_name, "%s/%s", (curDirIsLocal ? curDir : curLocalDir), new_file_name); ! else ! sprintf (new_full_name, "%s/%s", dir_name, new_file_name); ! if (!OkayToCreateFile (new_full_name)) return; ! if ((short_name = IsPrefix (bootDir, new_full_name, &rest))) ++rest; ! if ((fp = fopen (new_full_name, "w")) == NULL) ! { ! if (short_name) ! sprintf (s, "Cannot open '%s', file not saved.", rest); ! else ! sprintf (s, "Cannot open '%s', file not saved.", new_full_name); ! MsgBox (s, TOOL_NAME, INFO_MB); return; } ! strcpy (saved_dir, (curDirIsLocal ? curDir : curLocalDir)); ! strcpy (saved_file, curFileName); ! strcpy (saved_sym_dir, curSymDir); saved_cur_file_defined = curFileDefined; ! SetCurDir (new_full_name); curFileDefined = TRUE; ! strcpy (curSymDir, (curDirIsLocal ? curDir : curLocalDir)); ! if (!DirInSymPath (curDirIsLocal ? curDir : curLocalDir)) UpdateSymInfo (); ! if (short_name) ! sprintf (s, "Saving '%s' ...", rest); ! else ! sprintf (s, "Saving '%s' ...", new_full_name); ! Msg (s); ! if (!saveCommentsInSaveNew) CleanUpComments (); writeFileFailed = FALSE; saved_cur_page = curPage; ! for (curPage = firstPage, count = 1; curPage != NULL; ! curPage = curPage->next, count++) ! { topObj = curPage->top; botObj = curPage->bot; ! Save (fp, botObj, 0, count); } curPage = saved_cur_page; topObj = curPage->top; botObj = curPage->bot; ! fclose (fp); ! if (writeFileFailed) ! { writeFileFailed = FALSE; ! sprintf (s, "Fail to write to '%s'.\n\nFile system may be full.", new_full_name); ! MsgBox (s, TOOL_NAME, INFO_MB); ! } ! else ! { ! if (short_name) ! sprintf (s, "File '%s' saved.", rest); ! else ! sprintf (s, "File '%s' saved.", new_full_name); ! Msg (s); } ! if (curDirIsLocal) ! strcpy (curDir, saved_dir); ! else ! strcpy (curLocalDir, saved_dir); ! strcpy (curFileName, saved_file); ! strcpy (curSymDir, saved_sym_dir); curFileDefined = saved_cur_file_defined; ! RedrawTitleWindow (); } ! void SaveFile () { ! int i, len, count=0, short_name; ! struct ObjRec * obj_ptr; ! FILE * fp; ! char ext[MAXPATHLENGTH+1], s[MAXPATHLENGTH+1]; ! char full_name[MAXPATHLENGTH+1], * rest; ! struct PageRec * saved_cur_page; ! if (!curFileDefined || !curDirIsLocal) ! { ! SaveNewFile (FALSE); return; } ! len = strlen (curFileName); ! for (i = len-1; curFileName[i] != '.'; i--) ; ! strcpy (ext, &curFileName[i+1]); saved_cur_page = curPage; ! for (curPage = firstPage; curPage != NULL; curPage = curPage->next) ! for (obj_ptr = curPage->top; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! if (obj_ptr->type == OBJ_SYM) count++; curPage = saved_cur_page; ! switch (count) ! { ! case 0: ! if (strcmp (ext, SYM_FILE_EXT) == 0) ! { ! sprintf (gszMsgBox, "%s.\n\n%s.", ! "No symbol defined in a symbol file", ! "Symbol file not saved"); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } ! break; ! case 1: ! if (strcmp (ext, OBJ_FILE_EXT) == 0) ! { ! sprintf (gszMsgBox, "%s.\n\n%s.", ! "One symbol defined in OBJECT file", ! "Object file not saved"); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } ! break; ! default: ! if (strcmp (ext, SYM_FILE_EXT) == 0) ! { ! sprintf (gszMsgBox, "%s!\n\n%s.", ! "Too many symbols in a symbol file", ! "Symbol file not saved"); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } ! break; } ! if (strcmp (ext, SYM_FILE_EXT) == 0) ! sprintf (full_name, "%s/%s", curSymDir, curFileName); ! else if (strcmp (ext, OBJ_FILE_EXT) == 0) ! sprintf (full_name, "%s/%s", curDir, curFileName); ! if ((short_name = IsPrefix (bootDir, full_name, &rest))) ++rest; ! if ((fp = fopen (full_name, "w")) == NULL) ! { ! if (short_name) ! sprintf (s, "Cannot open '%s', file not saved.", rest); ! else ! sprintf (s, "Cannot open '%s', file not saved.", full_name); ! MsgBox (s, TOOL_NAME, INFO_MB); return; } ! if (short_name) ! sprintf (s, "Saving '%s' ...", rest); ! else ! sprintf (s, "Saving '%s' ...", full_name); ! Msg (s); writeFileFailed = FALSE; ! MakeQuiescent (); saved_cur_page = curPage; ! for (curPage = firstPage, count = 1; curPage != NULL; ! curPage = curPage->next, count++) ! { topObj = curPage->top; botObj = curPage->bot; ! Save (fp, botObj, 0, count); } curPage = saved_cur_page; topObj = curPage->top; botObj = curPage->bot; ! fclose (fp); ! if (writeFileFailed) ! { writeFileFailed = FALSE; ! sprintf (s, "Fail to write to '%s'.\n\nFile system may be full.", full_name); ! MsgBox (s, TOOL_NAME, INFO_MB); ! } ! else ! { ! if (short_name) ! sprintf (s, "File '%s' saved.", rest); ! else ! sprintf (s, "File '%s' saved.", full_name); ! Msg (s); ! SetFileModified (FALSE); ! if (!NameInCurDir (curFileName)) UpdateDirInfo (); } } ! char * ParseStr (Str, C, Left, LeftSz) ! char * Str, * Left; ! int C, LeftSz; { ! register char * s = Str, * l = Left; ! register int len = 0; ! int max_len=LeftSz-1; ! char the_char=(char)C; ! while (*s != '\0' && *s != the_char) ! { ! if (len < max_len) ! { *l++ = *s++; len++; ! } ! else break; } --- 909,1230 ---- topObj = saved_top_obj; botObj = saved_bot_obj; ! if (curDirIsLocal) { ! strcpy(curDir, saved_cur_dir); ! } else { ! strcpy(curLocalDir, saved_cur_dir); ! } ! strcpy(curFileName, saved_cur_file_name); curFileDefined = saved_cur_file_defined; ! PopPageInfo(); ! } else if (ok) { ! SetFileModified(FALSE); ! RedrawTitleWindow(); } ! if (!SaveSelectedOnly) CommitNavigate(); } ! void SaveSymInLibrary() { ! char new_file_name[MAXPATHLENGTH+1], s[MAXPATHLENGTH+1]; ! char new_full_name[MAXPATHLENGTH+1], dir_name[MAXPATHLENGTH+1]; ! char saved_dir[MAXPATHLENGTH+1], saved_file[MAXPATHLENGTH+1]; ! char saved_sym_dir[MAXPATHLENGTH+1], *rest=NULL; ! char name_without_ext[MAXPATHLENGTH+1], sym_ext_str[MAXSTRING+1], *c_ptr; ! FILE *fp; ! int count=0, len, short_name, sym_ext_len; ! int saved_cur_file_defined; ! struct ObjRec *obj_ptr; ! struct PageRec *saved_cur_page; ! struct ObjRec *obj_ptr1=NULL, *obj_ptr2=NULL; saved_cur_page = curPage; ! for (curPage=firstPage; curPage != NULL; curPage=curPage->next) { ! for (obj_ptr=curPage->top; obj_ptr != NULL; obj_ptr=obj_ptr->next) { ! if (obj_ptr->type == OBJ_SYM) { ! if (obj_ptr1 == NULL) { ! obj_ptr1 = obj_ptr; ! } else if (obj_ptr2 == NULL) { ! obj_ptr2 = obj_ptr; ! } count++; + } + } + } curPage = saved_cur_page; ! switch (count) { ! case 0: ! MsgBox("No symbol found!\n\nSymbol file not saved.", ! TOOL_NAME, INFO_MB); ! return; ! case 1: ! if (lastPageNum != 1) { ! MsgBox("A symbol file can only have one page.\n\nSave aborted!", TOOL_NAME, INFO_MB); return; + } + break; + default: + MsgBox("Too many symbols!\n\nSymbol file not saved.", + TOOL_NAME, INFO_MB); + return; } ! MakeQuiescent(); ! sprintf(sym_ext_str, ".%s", SYM_FILE_EXT); ! sym_ext_len = strlen(sym_ext_str); ! if (*curFileName == '\0') { ! Dialog("Please enter new file name:", "( : accept, : cancel )", new_file_name); if (*new_file_name == '\0') return; ! len = strlen(new_file_name); ! if (len >= sym_ext_len) { ! if (strcmp(&new_file_name[len-sym_ext_len], sym_ext_str) != 0) { ! strcpy(name_without_ext, new_file_name); ! strcat(new_file_name, sym_ext_str); ! } else { ! strcpy(name_without_ext, new_file_name); name_without_ext[len-sym_ext_len] = '\0'; } ! if (strlen(new_file_name) == sym_ext_len) { ! MsgBox("No file name specified.\n\nFile not saved.", TOOL_NAME, INFO_MB); return; } + } else { + strcpy(name_without_ext, new_file_name); + strcat(new_file_name, sym_ext_str); } ! } else { ! len = strlen(curFileName); ! for (c_ptr = &curFileName[len-1]; c_ptr != curFileName; c_ptr--) { ! if (*c_ptr == '/') { break; + } + } if (*c_ptr == '/') c_ptr++; ! strcpy(new_file_name, c_ptr); } ! if (SelectSymDir(dir_name) == INVALID) { ! Msg(""); ! return; ! } ! if (strcmp(dir_name, ".") == 0) { ! sprintf(new_full_name, "%s/%s", (curDirIsLocal ? curDir : curLocalDir), new_file_name); ! } else { ! sprintf(new_full_name, "%s/%s", dir_name, new_file_name); ! } ! if (!OkayToCreateFile(new_full_name)) return; ! if ((short_name=IsPrefix(bootDir, new_full_name, &rest))) ++rest; ! if ((fp=fopen(new_full_name, "w")) == NULL) { ! if (short_name) { ! sprintf(s, "Cannot open '%s', file not saved.", rest); ! } else { ! sprintf(s, "Cannot open '%s', file not saved.", new_full_name); ! } ! MsgBox(s, TOOL_NAME, INFO_MB); return; } ! strcpy(saved_dir, (curDirIsLocal ? curDir : curLocalDir)); ! strcpy(saved_file, curFileName); ! strcpy(saved_sym_dir, curSymDir); saved_cur_file_defined = curFileDefined; ! SetCurDir(new_full_name); curFileDefined = TRUE; ! strcpy(curSymDir, (curDirIsLocal ? curDir : curLocalDir)); ! if (!DirInSymPath(curDirIsLocal ? curDir : curLocalDir)) UpdateSymInfo(); ! if (short_name) { ! sprintf(s, "Saving '%s' ...", rest); ! } else { ! sprintf(s, "Saving '%s' ...", new_full_name); ! } ! Msg(s); ! if (!saveCommentsInSaveNew) CleanUpComments(); writeFileFailed = FALSE; saved_cur_page = curPage; ! for (curPage=firstPage, count=1; curPage != NULL; ! curPage=curPage->next, count++) { topObj = curPage->top; botObj = curPage->bot; ! Save(fp, botObj, 0, count); } curPage = saved_cur_page; topObj = curPage->top; botObj = curPage->bot; ! fclose(fp); ! if (writeFileFailed) { writeFileFailed = FALSE; ! sprintf(s, "Fail to write to '%s'.\n\nFile system may be full.", new_full_name); ! MsgBox(s, TOOL_NAME, INFO_MB); ! } else { ! if (short_name) { ! sprintf(s, "File '%s' saved.", rest); ! } else { ! sprintf(s, "File '%s' saved.", new_full_name); ! } ! Msg(s); } ! if (curDirIsLocal) { ! strcpy(curDir, saved_dir); ! } else { ! strcpy(curLocalDir, saved_dir); ! } ! strcpy(curFileName, saved_file); ! strcpy(curSymDir, saved_sym_dir); curFileDefined = saved_cur_file_defined; ! RedrawTitleWindow(); } ! void SaveFile() { ! int i, len, count=0, short_name; ! struct ObjRec *obj_ptr; ! FILE *fp=NULL; ! char ext[MAXPATHLENGTH+1], s[MAXPATHLENGTH+1]; ! char full_name[MAXPATHLENGTH+1], *rest; ! struct PageRec *saved_cur_page; ! struct ObjRec *obj_ptr1=NULL, *obj_ptr2=NULL; ! if (!curFileDefined || !curDirIsLocal) { ! SaveNewFile(FALSE); return; } ! len = strlen(curFileName); ! for (i=len-1; curFileName[i] != '.'; i--) ; ! strcpy(ext, &curFileName[i+1]); saved_cur_page = curPage; ! for (curPage=firstPage; curPage != NULL; curPage=curPage->next) { ! for (obj_ptr=curPage->top; obj_ptr != NULL; obj_ptr=obj_ptr->next) { ! if (obj_ptr->type == OBJ_SYM) { ! if (obj_ptr1 == NULL) { ! obj_ptr1 = obj_ptr; ! } else if (obj_ptr2 == NULL) { ! obj_ptr2 = obj_ptr; ! } count++; + } + } + } curPage = saved_cur_page; ! switch (count) { ! case 0: ! if (strcmp(ext, SYM_FILE_EXT) == 0) { ! sprintf(gszMsgBox, "%s.\n\n%s.", ! "No symbol defined in a symbol file", ! "Symbol file not saved"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } ! break; ! case 1: ! if (strcmp(ext, OBJ_FILE_EXT) == 0) { ! sprintf(gszMsgBox, "%s.\n\n%s.", ! "One symbol defined in OBJECT file", ! "Object file not saved"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } ! break; ! default: ! if (strcmp(ext, SYM_FILE_EXT) == 0) { ! sprintf(gszMsgBox, "%s!\n\n%s.", ! "Too many symbols in a symbol file", ! "Symbol file not saved"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } ! break; } ! if (strcmp(ext, SYM_FILE_EXT) == 0) { ! sprintf(full_name, "%s/%s", curSymDir, curFileName); ! } else if (strcmp(ext, OBJ_FILE_EXT) == 0) { ! sprintf(full_name, "%s/%s", curDir, curFileName); ! } ! if ((short_name=IsPrefix(bootDir, full_name, &rest))) ++rest; ! if ((fp=fopen(full_name, "w")) == NULL) { ! if (short_name) { ! sprintf(s, "Cannot open '%s', file not saved.", rest); ! } else { ! sprintf(s, "Cannot open '%s', file not saved.", full_name); ! } ! MsgBox(s, TOOL_NAME, INFO_MB); return; } ! if (short_name) { ! sprintf(s, "Saving '%s' ...", rest); ! } else { ! sprintf(s, "Saving '%s' ...", full_name); ! } ! Msg(s); writeFileFailed = FALSE; ! MakeQuiescent(); saved_cur_page = curPage; ! for (curPage=firstPage, count=1; curPage != NULL; ! curPage=curPage->next, count++) { topObj = curPage->top; botObj = curPage->bot; ! Save(fp, botObj, 0, count); } curPage = saved_cur_page; topObj = curPage->top; botObj = curPage->bot; ! fclose(fp); ! if (writeFileFailed) { writeFileFailed = FALSE; ! sprintf(s, "Fail to write to '%s'.\n\nFile system may be full.", full_name); ! MsgBox(s, TOOL_NAME, INFO_MB); ! } else { ! if (short_name) { ! sprintf(s, "File '%s' saved.", rest); ! } else { ! sprintf(s, "File '%s' saved.", full_name); ! } ! Msg(s); ! SetFileModified(FALSE); ! if (!NameInCurDir(curFileName)) UpdateDirInfo(); } } ! char *ParseStr(Str, C, Left, LeftSz) ! char *Str, *Left; ! int C, LeftSz; { ! register char *s=Str, *l=Left; ! register int len=0; ! int max_len=LeftSz-1; ! char the_char=(char)C; ! while (*s != '\0' && *s != the_char) { ! if (len < max_len) { *l++ = *s++; len++; ! } else { break; + } } *************** *** 1208,1214 **** *l = '\0'; ! while (len >= 2 && *Left == '\'' && *(--l) == '\'') ! { ! char * c_ptr, * c_ptr1; *l-- = '\0'; --- 1232,1237 ---- *l = '\0'; ! while (len >= 2 && *Left == '\'' && *(--l) == '\'') { ! char *c_ptr, *c_ptr1; *l-- = '\0'; *************** *** 1219,1236 **** *c_ptr1 = '\0'; } ! return (s); } ! char * FindChar (C, Str) ! int C; ! char * Str; /* returns the address of the character right after C of the string Str */ { ! register char * s = Str, the_char=(char)C; while (*s != '\0' && *s != the_char) s++; if (*s == the_char) s++; ! return (s); } --- 1242,1259 ---- *c_ptr1 = '\0'; } ! return s; } ! char *FindChar(C, Str) ! int C; ! char *Str; /* returns the address of the character right after C of the string Str */ { ! register char *s=Str, the_char=(char)C; while (*s != '\0' && *s != the_char) s++; if (*s == the_char) s++; ! return s; } *************** *** 1247,1264 **** int page_style, forced_use_gray=FALSE, compat_dpi; ! s = FindChar ((int)'(', Inbuf); ! if (sscanf (s, "%d", &page_style) != 1) return (FALSE); ! s = FindChar ((int)',', s); ! if (*s == '\0') fileVersion = INVALID; ! else if (sscanf (s, "%d", &fileVersion) != 1) ! return (FALSE); ! if (fileVersion > CUR_VERSION) return (FALSE); ! if (!importingFile) ! { ! if (fileVersion <= 13) ! { switch (page_style) { case PORTRAIT: printMag = (float)100.0; break; --- 1270,1286 ---- int page_style, forced_use_gray=FALSE, compat_dpi; ! s = FindChar((int)'(', Inbuf); ! if (sscanf(s, "%d", &page_style) != 1) return FALSE; ! s = FindChar((int)',', s); ! if (*s == '\0') { fileVersion = INVALID; ! } else if (sscanf(s, "%d", &fileVersion) != 1) { ! return FALSE; ! } ! if (fileVersion > CUR_VERSION) return FALSE; ! if (!importingFile) { ! if (fileVersion <= 13) { switch (page_style) { case PORTRAIT: printMag = (float)100.0; break; *************** *** 1276,1284 **** break; } ! } ! else ! { ! if (page_style != PORTRAIT && page_style != LANDSCAPE) ! { sprintf(gszMsgBox, "Unrecognizable page style '%1d'.", page_style); TwoLineMsg(gszMsgBox, "Portrait style assumed."); --- 1298,1303 ---- break; } ! } else { ! if (page_style != PORTRAIT && page_style != LANDSCAPE) { sprintf(gszMsgBox, "Unrecognizable page style '%1d'.", page_style); TwoLineMsg(gszMsgBox, "Portrait style assumed."); *************** *** 1292,1302 **** if (PRTGIF && useGray) forced_use_gray = TRUE; ! if (!importingFile) ! { ! int page_arg1=1, page_arg2=1; ! int one_page_width=onePageWidth, one_page_height=onePageHeight; ! if (fileVersion >= 2) ! { compat_dpi = FONT_DPI_75; curDash = 0; --- 1311,1319 ---- if (PRTGIF && useGray) forced_use_gray = TRUE; ! if (!importingFile) { ! int page_arg1=1, page_arg2=1; ! int one_page_width=onePageWidth, one_page_height=onePageHeight; ! if (fileVersion >= 2) { compat_dpi = FONT_DPI_75; curDash = 0; *************** *** 1312,1323 **** pageLineShownInTileMode = TRUE; ! if (usePaperSizeStoredInFile) ResetOnePageSize (); ! s = FindChar ((int)',', s); ! InitScan (s, "\t\n, "); ! if (fileVersion <= 3) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1329,1339 ---- pageLineShownInTileMode = TRUE; ! if (usePaperSizeStoredInFile) ResetOnePageSize(); ! s = FindChar((int)',', s); ! InitScan(s, "\t\n, "); ! if (fileVersion <= 3) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1337,1350 **** GETVALUE(curSize, "Font Size"); ! if (lineWidth == LINE_CURVED) ! { lineWidth = 0; curSpline = LT_SPLINE; ! } ! else curSpline = LT_STRAIGHT; ! } ! else if (fileVersion <= 7) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1353,1363 ---- GETVALUE(curSize, "Font Size"); ! if (lineWidth == LINE_CURVED) { lineWidth = 0; curSpline = LT_SPLINE; ! } else { curSpline = LT_STRAIGHT; ! } ! } else if (fileVersion <= 7) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1364,1370 **** GETVALUE(curStyle, "Font Style"); GETVALUE(curSize, "Font Size"); ! } ! else if (fileVersion <= 8) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1377,1381 ---- GETVALUE(curStyle, "Font Style"); GETVALUE(curSize, "Font Size"); ! } else if (fileVersion <= 8) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1385,1391 **** GETVALUE(curSize, "Font Size"); GETVALUE(compat_dpi, "Font DPI"); ! } ! else if (fileVersion <= 11) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1396,1400 ---- GETVALUE(curSize, "Font Size"); GETVALUE(compat_dpi, "Font DPI"); ! } else if (fileVersion <= 11) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1407,1413 **** GETVALUE(compat_dpi, "Font DPI"); GETVALUE(curDash, "Dash Style"); ! } ! else if (fileVersion <= 12) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1416,1420 ---- GETVALUE(compat_dpi, "Font DPI"); GETVALUE(curDash, "Dash Style"); ! } else if (fileVersion <= 12) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1431,1437 **** GETVALUE(gridSystem, "Grid System"); GETVALUE(xyMetricGrid, "Metric Grid"); ! } ! else if (fileVersion <= 18) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1438,1442 ---- GETVALUE(gridSystem, "Grid System"); GETVALUE(xyMetricGrid, "Metric Grid"); ! } else if (fileVersion <= 18) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1456,1462 **** GETVALUE(xyMetricGrid, "Metric Grid"); GETVALUE(textVSpace, "Text Vertical Spacing"); ! } ! else if (fileVersion <= 19) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1461,1465 ---- GETVALUE(xyMetricGrid, "Metric Grid"); GETVALUE(textVSpace, "Text Vertical Spacing"); ! } else if (fileVersion <= 19) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1482,1488 **** GETVALUE(textVSpace, "Text Vertical Spacing"); GETVALUE(zoomedIn, "Zoomed In"); ! } ! else if (fileVersion <= 21) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1485,1489 ---- GETVALUE(textVSpace, "Text Vertical Spacing"); GETVALUE(zoomedIn, "Zoomed In"); ! } else if (fileVersion <= 21) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1510,1516 **** GETVALUE(gridShown, "Grid Shown"); GETVALUE(moveMode, "Move Mode"); ! } ! else if (fileVersion <= 26) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1511,1515 ---- GETVALUE(gridShown, "Grid Shown"); GETVALUE(moveMode, "Move Mode"); ! } else if (fileVersion <= 26) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1540,1546 **** GETVALUE(curRotate, "Text Rotation"); GETVALUE(rcbRadius, "RCBox Radius"); ! } ! else if (fileVersion <= 27) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1539,1543 ---- GETVALUE(curRotate, "Text Rotation"); GETVALUE(rcbRadius, "RCBox Radius"); ! } else if (fileVersion <= 27) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1571,1577 **** GETVALUE(rcbRadius, "RCBox Radius"); GETVALUE(useGray, "Use Gray Scale"); ! } ! else if (fileVersion <= 28) ! { /* Matsuda's Version */ GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1568,1573 ---- GETVALUE(rcbRadius, "RCBox Radius"); GETVALUE(useGray, "Use Gray Scale"); ! } else if (fileVersion <= 28) { ! /* Matsuda's Version */ GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1605,1612 **** GETVALUE(paperRow, "Num Rows"); GETVALUE(curPageNum, "Current Page Number"); ! GETVALUE(lastPageNum, "Last Page Number"); ! } ! else if (fileVersion <= 29) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1601,1606 ---- GETVALUE(paperRow, "Num Rows"); GETVALUE(curPageNum, "Current Page Number"); ! GETVALUE(lastPageNum, "Last Page Number"); ! } else if (fileVersion <= 29) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1641,1647 **** GETVALUE(page_arg2, "Page Layout Subarg 2"); GETVALUE(pageLineShownInTileMode,"Page Lines Shown"); ! } ! else if (fileVersion <= 30) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1635,1639 ---- GETVALUE(page_arg2, "Page Layout Subarg 2"); GETVALUE(pageLineShownInTileMode,"Page Lines Shown"); ! } else if (fileVersion <= 30) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1676,1682 **** GETVALUE(page_arg2, "Page Layout Subarg 2"); GETVALUE(pageLineShownInTileMode,"Page Lines Shown"); ! } ! else if (fileVersion <= 31) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1668,1672 ---- GETVALUE(page_arg2, "Page Layout Subarg 2"); GETVALUE(pageLineShownInTileMode,"Page Lines Shown"); ! } else if (fileVersion <= 31) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1712,1718 **** GETVALUE(pageLineShownInTileMode,"Page Lines Shown"); GETVALUE(colorDump, "Print In Color"); ! } ! else if (fileVersion <= 32) ! { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); --- 1702,1706 ---- GETVALUE(pageLineShownInTileMode,"Page Lines Shown"); GETVALUE(colorDump, "Print In Color"); ! } else if (fileVersion <= 32) { GETVALUE(drawOrigX, "X Draw Origin"); GETVALUE(drawOrigY, "Y Draw Origin"); *************** *** 1799,1810 **** char *s; ! if (*font_str == '\'' && font_str[len-1] == '\'') ! { font_str[len-1] = '\0'; s = &font_str[1]; ! } ! else s = font_str; ! curFont = GetFontIndex (s, curStyle, TRUE); if (curFont == INVALID && !PRTGIF) { sprintf(gszMsgBox, "Cannot find screen font for '%s'.", s); --- 1787,1797 ---- char *s; ! if (*font_str == '\'' && font_str[len-1] == '\'') { font_str[len-1] = '\0'; s = &font_str[1]; ! } else { s = font_str; ! } ! curFont = GetFontIndex(s, curStyle, TRUE); if (curFont == INVALID && !PRTGIF) { sprintf(gszMsgBox, "Cannot find screen font for '%s'.", s); *************** *** 1827,1834 **** } loadedCurPageNum = curPageNum; ! InitPage (); curPageNum = loadedCurPageNum; ! if (PRTGIF) { if (forced_use_gray) useGray = TRUE; return TRUE; --- 1814,1821 ---- } loadedCurPageNum = curPageNum; ! InitPage(); curPageNum = loadedCurPageNum; ! if (PRTGIF && !cmdLineOpenDisplay) { if (forced_use_gray) useGray = TRUE; return TRUE; *************** *** 1850,1917 **** colorIndex = defaultColorIndex; } ! SetCanvasFont (); ! if (fileVersion <= 13) ! { ! switch (gridSystem) ! { ! case ENGLISH_GRID: ! drawOrigX += HALF_INCH; ! drawOrigY += HALF_INCH; ! break; ! case METRIC_GRID: ! drawOrigX += 2.5*ONE_CM; ! drawOrigY += 2.5*ONE_CM; ! break; } } ! if (usePaperSizeStoredInFile && fileVersion >= 32) ! { ! if (pageStyle == LANDSCAPE) ! { onePageWidth = one_page_height; onePageHeight = one_page_width; ! } ! else ! { onePageWidth = one_page_width; onePageHeight = one_page_height; } ! SetPSPageWidthHeight (); } } ! UpdPageStyle (pageStyle); ! if (PRTGIF) return (TRUE); ! if (lineWidth >= maxLineWidths) ! { ! fprintf (stderr, "%s '%1d' is out of range! Set to 0.\n", "File's linewidth index", lineWidth); lineWidth = 0; } ! UpdDrawWinWH (); ! RedrawScrollBars (); ! ShowPage (); ! ShowPageLayout (); ! UpdDrawWinBBox (); ! ! SetDefaultDrawWinClipRecs (); ! ! DrawPaperBoundary (drawWindow); ! RedrawGridLines (drawWindow); ! RedrawPageLines (drawWindow); ! RedrawRulers (); ! RedrawChoiceWindow (); } ! return (TRUE); } static ! void ReadObjAttrs (MinFileVersion, FP, ObjPtr) ! int MinFileVersion; ! FILE * FP; ! struct ObjRec * * ObjPtr; { ! struct AttrRec * top_attr = NULL, * bot_attr = NULL, * attr_ptr; if (fileVersion <= MinFileVersion) return; --- 1837,1897 ---- colorIndex = defaultColorIndex; } ! SetCanvasFont(); ! if (fileVersion <= 13) { ! switch (gridSystem) { ! case ENGLISH_GRID: ! drawOrigX += HALF_INCH; ! drawOrigY += HALF_INCH; ! break; ! case METRIC_GRID: ! drawOrigX += 2.5*ONE_CM; ! drawOrigY += 2.5*ONE_CM; ! break; } } ! if (usePaperSizeStoredInFile && fileVersion >= 32) { ! if (pageStyle == LANDSCAPE) { onePageWidth = one_page_height; onePageHeight = one_page_width; ! } else { onePageWidth = one_page_width; onePageHeight = one_page_height; } ! SetPSPageWidthHeight(); } } ! UpdPageStyle(pageStyle); ! if (PRTGIF && !cmdLineOpenDisplay) return TRUE; ! if (lineWidth >= maxLineWidths) { ! fprintf(stderr, "%s '%1d' is out of range! Set to 0.\n", "File's linewidth index", lineWidth); lineWidth = 0; } ! UpdDrawWinWH(); ! RedrawScrollBars(); ! ShowPage(); ! ShowPageLayout(); ! UpdDrawWinBBox(); ! ! SetDefaultDrawWinClipRecs(); ! ! DrawPaperBoundary(drawWindow); ! RedrawGridLines(drawWindow); ! RedrawPageLines(drawWindow); ! RedrawRulers(); ! RedrawChoiceWindow(); } ! return TRUE; } static ! void ReadObjAttrs(MinFileVersion, FP, ObjPtr) ! int MinFileVersion; ! FILE *FP; ! struct ObjRec **ObjPtr; { ! struct AttrRec *top_attr=NULL, *bot_attr=NULL, *attr_ptr; if (fileVersion <= MinFileVersion) return; *************** *** 1939,1950 **** static int ReadPageObj (Inbuf, ppsz_page_name) ! char * Inbuf, **ppsz_page_name; { ! int page_num; ! char * s, * c_ptr; if (ppsz_page_name != NULL) *ppsz_page_name = NULL; ! s = FindChar ((int)'(', Inbuf); ! if (sscanf (s, "%d", &page_num) != 1) { (void) sprintf(gszMsgBox, "%s, %d: Missing %s in %s.", --- 1919,1930 ---- static int ReadPageObj (Inbuf, ppsz_page_name) ! char *Inbuf, **ppsz_page_name; { ! int page_num; ! char *s, *c_ptr; if (ppsz_page_name != NULL) *ppsz_page_name = NULL; ! s = FindChar((int)'(', Inbuf); ! if (sscanf(s, "%d", &page_num) != 1) { (void) sprintf(gszMsgBox, "%s, %d: Missing %s in %s.", *************** *** 1963,1977 **** if (curPage == NULL) { ! sprintf (gszMsgBox, "Malformed input file (%s %1d). Abort!", "apparently reading page", page_num); if (PRTGIF) { ! fprintf (stderr, "%s\n", gszMsgBox); } else { ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); } return FALSE; } ! s = FindChar ((int)',', s); ! c_ptr = FindChar ((int)'"', s); s = ReadString (c_ptr); *(--s) = '\0'; --- 1943,1957 ---- if (curPage == NULL) { ! sprintf(gszMsgBox, "Malformed input file (%s %1d). Abort!", "apparently reading page", page_num); if (PRTGIF) { ! fprintf(stderr, "%s\n", gszMsgBox); } else { ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } return FALSE; } ! s = FindChar((int)',', s); ! c_ptr = FindChar((int)'"', s); s = ReadString (c_ptr); *(--s) = '\0'; *************** *** 1994,2000 **** scanFileName, scanLineNum, "layer_on", "page"); if (PRTGIF) { ! fprintf (stderr, "%s\n", gszMsgBox); } else { ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); } return FALSE; --- 1974,1980 ---- scanFileName, scanLineNum, "layer_on", "page"); if (PRTGIF) { ! fprintf(stderr, "%s\n", gszMsgBox); } else { ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } return FALSE; *************** *** 2005,2010 **** else { ! s = FindChar ((int)',', s); ! c_ptr = FindChar ((int)'"', s); s = ReadString (c_ptr); *(--s) = '\0'; --- 1985,1990 ---- else { ! s = FindChar((int)',', s); ! c_ptr = FindChar((int)'"', s); s = ReadString (c_ptr); *(--s) = '\0'; *************** *** 2067,2073 **** } ! int ReadObj (FP, ObjPtr) ! FILE * FP; ! struct ObjRec * * ObjPtr; { char *line, obj_name[80]; --- 2047,2053 ---- } ! int ReadObj(FP, ObjPtr) ! FILE *FP; ! struct ObjRec **ObjPtr; { char *line, obj_name[80]; *************** *** 2081,2085 **** if (*line == '%') { if (!importingFile && line[1]=='%') { ! int line_len=strlen(line); if (savedComments == NULL) { --- 2061,2065 ---- if (*line == '%') { if (!importingFile && line[1]=='%') { ! int line_len=strlen(line); if (savedComments == NULL) { *************** *** 2105,2215 **** } ! if (ParseStr (line, (int)'(', obj_name, sizeof(obj_name)) == NULL) { ! } ! else if (strcmp (obj_name, "poly") == 0) ! { ! ReadPolyObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (INVALID, FP, ObjPtr); if (RetractedArrowAttr(*ObjPtr) || AutoRetractedArrowAttr(*ObjPtr, TRUE)) { /* fake the undoingOrRedoing so that no */ ! /* actual auto-adjusting is done */ undoingOrRedoing = TRUE; AdjObjSplineVs(*ObjPtr); undoingOrRedoing = FALSE; } ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "box") == 0) ! { ! ReadBoxObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "oval") == 0) ! { ! ReadOvalObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "text") == 0) ! { ! ReadTextObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "polygon") == 0) ! { ! ReadPolygonObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "arc") == 0) ! { ! ReadArcObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "rcbox") == 0) ! { ! ReadRCBoxObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "xbm") == 0) ! { ! ReadXBmObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "xpm") == 0) ! { ! ReadXPmObj (FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "group") == 0) ! { ! ReadGroupObj (FP, OBJ_GROUP, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (INVALID, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "sym") == 0) ! { ! ReadGroupObj (FP, OBJ_SYM, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (INVALID, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "icon") == 0) ! { ! ReadGroupObj (FP, OBJ_ICON, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs (INVALID, FP, ObjPtr); ! AdjObjBBox (*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp (obj_name, "page") == 0) ! { int ok; char *page_name=NULL; --- 2085,2169 ---- } ! if (ParseStr(line, (int)'(', obj_name, sizeof(obj_name)) == NULL) { ! } else if (strcmp(obj_name, "poly") == 0) { ! ReadPolyObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(INVALID, FP, ObjPtr); if (RetractedArrowAttr(*ObjPtr) || AutoRetractedArrowAttr(*ObjPtr, TRUE)) { /* fake the undoingOrRedoing so that no */ ! /* actual auto-adjusting is done */ undoingOrRedoing = TRUE; AdjObjSplineVs(*ObjPtr); undoingOrRedoing = FALSE; } ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "box") == 0) { ! ReadBoxObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "oval") == 0) { ! ReadOvalObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "text") == 0) { ! ReadTextObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "polygon") == 0) { ! ReadPolygonObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "arc") == 0) { ! ReadArcObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "rcbox") == 0) { ! ReadRCBoxObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "xbm") == 0) { ! ReadXBmObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "xpm") == 0) { ! ReadXPmObj(FP, line, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(START_HAVING_ATTRS-1, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "group") == 0) { ! ReadGroupObj(FP, OBJ_GROUP, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(INVALID, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "sym") == 0) { ! ReadGroupObj(FP, OBJ_SYM, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(INVALID, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "icon") == 0) { ! ReadGroupObj(FP, OBJ_ICON, ObjPtr); if (*ObjPtr == NULL) return FreeBufAndReturn(line, FALSE); ! ReadObjAttrs(INVALID, FP, ObjPtr); ! AdjObjBBox(*ObjPtr); return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "page") == 0) { int ok; char *page_name=NULL; *************** *** 2221,2225 **** /* as if read to the end of file */ if (!PRTGIF && !pastingFile) { ! Msg ("Only page 1 is imported from a multipage file."); } return FreeBufAndReturn(line, FALSE); --- 2175,2179 ---- /* as if read to the end of file */ if (!PRTGIF && !pastingFile) { ! Msg("Only page 1 is imported from a multipage file."); } return FreeBufAndReturn(line, FALSE); *************** *** 2238,2242 **** } } ! ok = ReadPageObj (line, &page_name); if (importingFile && !importingIconFile && importingPageNum == (-1) && *importingPageName != '\0' && --- 2192,2196 ---- } } ! ok = ReadPageObj(line, &page_name); if (importingFile && !importingIconFile && importingPageNum == (-1) && *importingPageName != '\0' && *************** *** 2247,2263 **** if (page_name != NULL) free(page_name); return FreeBufAndReturn(line, ok); ! } ! else if (strcmp (obj_name, "state") == 0) ! { ! if ((read_state_ok=ReadState(line)) == TRUE) foundGoodStateObject = TRUE; *ObjPtr = NULL; return FreeBufAndReturn(line, (read_state_ok) ? TRUE : INVALID); ! } ! else if (strcmp (obj_name, "file_attr") == 0) ! { ! if (importingFile && !importingIconFile) ! { ! struct AttrRec * saved_first_attr, * saved_last_attr; saved_first_attr = tgifObj->fattr; --- 2201,2213 ---- if (page_name != NULL) free(page_name); return FreeBufAndReturn(line, ok); ! } else if (strcmp(obj_name, "state") == 0) { ! if ((read_state_ok=ReadState(line)) == TRUE) { foundGoodStateObject = TRUE; + } *ObjPtr = NULL; return FreeBufAndReturn(line, (read_state_ok) ? TRUE : INVALID); ! } else if (strcmp(obj_name, "file_attr") == 0) { ! if (importingFile && !importingIconFile) { ! struct AttrRec *saved_first_attr, *saved_last_attr; saved_first_attr = tgifObj->fattr; *************** *** 2266,2295 **** tgifObj->lattr = NULL; ! ReadObjAttrs (START_HAVING_ATTRS-1, FP, &tgifObj); ! DelAllAttrs (tgifObj->fattr); tgifObj->fattr = saved_first_attr; tgifObj->lattr = saved_last_attr; } - else - ReadObjAttrs (START_HAVING_ATTRS-1, FP, &tgifObj); return FreeBufAndReturn(line, TRUE); ! } ! else if (strcmp(obj_name, "unit") == 0) ! { int ok=ReadUnitObj(line); *ObjPtr = NULL; return FreeBufAndReturn(line, ok); ! } ! else if (strcmp(obj_name, "shapeshadow") == 0) ! { int ok=ReadShapeShadowObj(line); *ObjPtr = NULL; return FreeBufAndReturn(line, ok); ! } ! else if (strcmp(obj_name, "color_info") == 0) ! { int ok=ReadColors(FP, line); --- 2216,2239 ---- tgifObj->lattr = NULL; ! ReadObjAttrs(START_HAVING_ATTRS-1, FP, &tgifObj); ! DelAllAttrs(tgifObj->fattr); tgifObj->fattr = saved_first_attr; tgifObj->lattr = saved_last_attr; + } else { + ReadObjAttrs(START_HAVING_ATTRS-1, FP, &tgifObj); } return FreeBufAndReturn(line, TRUE); ! } else if (strcmp(obj_name, "unit") == 0) { int ok=ReadUnitObj(line); *ObjPtr = NULL; return FreeBufAndReturn(line, ok); ! } else if (strcmp(obj_name, "shapeshadow") == 0) { int ok=ReadShapeShadowObj(line); *ObjPtr = NULL; return FreeBufAndReturn(line, ok); ! } else if (strcmp(obj_name, "color_info") == 0) { int ok=ReadColors(FP, line); *************** *** 2303,2383 **** static ! void ConvertToUpperCase (InStr, OutStr) ! register char * InStr, * OutStr; { ! for ( ; *InStr != '\0'; InStr++, OutStr++) *OutStr = (*InStr>='a' && *InStr<='z') ? *InStr-'a'+'A' : *InStr; *OutStr = '\0'; } ! void ChangeDomain () { ! char domain_name[MAXPATHLENGTH+1], env_str[MAXPATHLENGTH+1]; ! char s[MAXSTRING+1], s1[MAXSTRING+1], * c_ptr; ! char cap_tool_name[MAXSTRING+1]; ! int index; ! XEvent ev; ! index = SelectDomain (domain_name); if (index == INVALID) return; ! XSync (mainDisplay, False); ! if (XCheckMaskEvent (mainDisplay, ExposureMask, &ev)) ! ExposeEventHandler (&ev, TRUE); ! if (domainInResource) ! { ! sprintf (s, "DomainPath%1d", index); ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,s)) != NULL) ! { ! char * c_ptr1; while (*c_ptr==' ' || *c_ptr=='\t' || *c_ptr=='\n') c_ptr++; ! if (*c_ptr != '\0' && (c_ptr1=strchr (c_ptr, ':')) != NULL) c_ptr = &c_ptr1[1]; ! ParseSymPath (c_ptr); } ! else if (strcmp (domain_name, "Examples") == 0) ! ParseSymPath (TGIF_PATH); ! else ! ParseSymPath ("."); ! } ! else ! { ! ConvertToUpperCase (TOOL_NAME, cap_tool_name); ! sprintf (env_str, "%s_%s", cap_tool_name, domain_name); ! if ((c_ptr = getenv (env_str)) == NULL) ! { ! if (strcmp (domain_name, "Examples") == 0) ! ParseSymPath (TGIF_PATH); ! else ! ParseSymPath ("."); } - else - ParseSymPath (c_ptr); } ! UpdateSymInfo (); ! strcpy (curDomainName, domain_name); ! sprintf (s, "Current domain is '%s'.", curDomainName); ! sprintf (s1, "Symbol path set to '%s'.", curDomainPath); ! TwoLineMsg (s, s1); ! RedrawTitleWindow (); } ! void AdjForOldVersion (obj_ptr) ! struct ObjRec * obj_ptr; { ! if (fileVersion <= 13) ! { ! switch (gridSystem) ! { ! case ENGLISH_GRID: ! MoveObj (obj_ptr, (int)(HALF_INCH), (int)(HALF_INCH)); ! break; ! case METRIC_GRID: ! MoveObj (obj_ptr, (int)(2.5*ONE_CM), (int)(2.5*ONE_CM)); ! break; } } --- 2247,2324 ---- static ! void ConvertToUpperCase(InStr, OutStr) ! register char *InStr, *OutStr; { ! for ( ; *InStr != '\0'; InStr++, OutStr++) { *OutStr = (*InStr>='a' && *InStr<='z') ? *InStr-'a'+'A' : *InStr; + } *OutStr = '\0'; } ! void ChangeDomain() { ! char domain_name[MAXPATHLENGTH+1], env_str[MAXPATHLENGTH+1]; ! char s[MAXSTRING+1], s1[MAXSTRING+1], *c_ptr; ! char cap_tool_name[MAXSTRING+1]; ! int index; ! XEvent ev; ! index = SelectDomain(domain_name); if (index == INVALID) return; ! XSync(mainDisplay, False); ! if (XCheckMaskEvent(mainDisplay, ExposureMask, &ev)) { ! ExposeEventHandler(&ev, TRUE); ! } ! if (domainInResource) { ! sprintf(s, "DomainPath%1d", index); ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,s)) != NULL) { ! char *c_ptr1; while (*c_ptr==' ' || *c_ptr=='\t' || *c_ptr=='\n') c_ptr++; ! if (*c_ptr != '\0' && (c_ptr1=strchr(c_ptr, ':')) != NULL) { c_ptr = &c_ptr1[1]; ! } ! ParseSymPath(c_ptr); ! } else if (strcmp(domain_name, "Examples") == 0) { ! ParseSymPath(TGIF_PATH); ! } else { ! ParseSymPath("."); } ! } else { ! ConvertToUpperCase(TOOL_NAME, cap_tool_name); ! sprintf(env_str, "%s_%s", cap_tool_name, domain_name); ! if ((c_ptr=getenv(env_str)) == NULL) { ! if (strcmp(domain_name, "Examples") == 0) { ! ParseSymPath(TGIF_PATH); ! } else { ! ParseSymPath("."); ! } ! } else { ! ParseSymPath(c_ptr); } } ! UpdateSymInfo(); ! strcpy(curDomainName, domain_name); ! sprintf(s, "Current domain is '%s'.", curDomainName); ! sprintf(s1, "Symbol path set to '%s'.", curDomainPath); ! TwoLineMsg(s, s1); ! RedrawTitleWindow(); } ! void AdjForOldVersion(obj_ptr) ! struct ObjRec *obj_ptr; { ! if (fileVersion <= 13) { ! switch (gridSystem) { ! case ENGLISH_GRID: ! MoveObj(obj_ptr, (int)(HALF_INCH), (int)(HALF_INCH)); ! break; ! case METRIC_GRID: ! MoveObj(obj_ptr, (int)(2.5*ONE_CM), (int)(2.5*ONE_CM)); ! break; } } *************** *** 2951,3032 **** } ! int LoadFile (FullName, ObjFile) ! char * FullName; ! int ObjFile; /* equals TRUE if the file is an OBJ file */ ! /* equals FALSE if the file is an SYM file */ ! /* equals -1 if the file is an temporary OBJ file */ ! { ! struct ObjRec * obj_ptr; ! char file_name[MAXPATHLENGTH+1]; ! char saved_cur_dir[MAXPATHLENGTH+1], * rest; ! int read_status, short_name; ! FILE * fp; ! char tmp_filename[MAXPATHLENGTH+1]; ! int tmp_linenum, interrupted; ! XEvent ev; ! if (ObjFile != FALSE) ! strcpy (saved_cur_dir, curDir); ! else ! strcpy (saved_cur_dir, curSymDir); ! strcpy (file_name, FullName); ! if ((short_name = IsPrefix (bootDir, file_name, &rest))) ++rest; ! if ((fp = fopen (file_name, "r")) == NULL) ! { ! if (short_name) ! sprintf (gszMsgBox, "Cannot open '%s'.", rest); ! else ! sprintf (gszMsgBox, "Cannot open '%s'.", file_name); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! return (FALSE); } ! BeforeNavigate(); ! CleanUpComments (); ! if (usePaperSizeStoredInFile) ResetOnePageSize (); ! strcpy (tmp_filename, scanFileName); tmp_linenum = scanLineNum; ! strcpy (scanFileName, (short_name ? rest : file_name)); scanLineNum = 0; ! TieLooseEnds (); ! CleanUpDrawingWindow (); ! SetFileModified (FALSE); ! XSync (mainDisplay, False); ! while (XCheckWindowEvent (mainDisplay, drawWindow, ExposureMask, &ev)) ; ! if (short_name) ! sprintf (gszMsgBox, "Loading '%s' ...", rest); ! else ! sprintf (gszMsgBox, "Loading '%s' ...", file_name); ! Msg (gszMsgBox); ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); ! XClearWindow (mainDisplay, drawWindow); somethingHighLighted = FALSE; numRedrawBBox = 0; ! ShowInterrupt (1); interrupted = FALSE; readingPageNum = 0; loadedCurPageNum = 0; foundGoodStateObject = FALSE; ! while ((read_status=ReadObj(fp, &obj_ptr)) == TRUE) ! { ! if (obj_ptr != NULL) ! { obj_ptr->tmp_parent = NULL; ! AdjForOldVersion (obj_ptr); ! AddObj (NULL, topObj, obj_ptr); if (!interrupted && readingPageNum == loadedCurPageNum && ! (PointInBBox (obj_ptr->x, obj_ptr->y, drawWinBBox) || ! BBoxIntersect (obj_ptr->bbox, drawWinBBox))) ! { ! if (!DrawObj (drawWindow, obj_ptr)) interrupted = TRUE; ! if (CheckInterrupt ()) interrupted = TRUE; } } --- 2892,2970 ---- } ! int LoadFile(FullName, ObjFile) ! char *FullName; ! int ObjFile; /* equals TRUE if the file is an OBJ file */ ! /* equals FALSE if the file is an SYM file */ ! /* equals -1 if the file is an temporary OBJ file */ ! { ! struct ObjRec *obj_ptr; ! char file_name[MAXPATHLENGTH+1], tmp_filename[MAXPATHLENGTH+1]; ! char saved_cur_dir[MAXPATHLENGTH+1], *rest; ! int read_status, short_name, tmp_linenum, interrupted; ! FILE *fp; ! XEvent ev; ! if (ObjFile != FALSE) { ! strcpy(saved_cur_dir, curDir); ! } else { ! strcpy(saved_cur_dir, curSymDir); ! } ! strcpy(file_name, FullName); ! if ((short_name=IsPrefix(bootDir, file_name, &rest))) ++rest; ! if ((fp=fopen(file_name, "r")) == NULL) { ! if (short_name) { ! sprintf(gszMsgBox, "Cannot open '%s'.", rest); ! } else { ! sprintf(gszMsgBox, "Cannot open '%s'.", file_name); ! } ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! return FALSE; } ! if (!navigatingBackAndForth) BeforeNavigate(); ! CleanUpComments(); ! if (usePaperSizeStoredInFile) ResetOnePageSize(); ! strcpy(tmp_filename, scanFileName); tmp_linenum = scanLineNum; ! strcpy(scanFileName, (short_name ? rest : file_name)); scanLineNum = 0; ! TieLooseEnds(); ! CleanUpDrawingWindow(); ! SetFileModified(FALSE); ! XSync(mainDisplay, False); ! while (XCheckWindowEvent(mainDisplay, drawWindow, ExposureMask, &ev)) ; ! if (short_name) { ! sprintf(gszMsgBox, "Loading '%s' ...", rest); ! } else { ! sprintf(gszMsgBox, "Loading '%s' ...", file_name); ! } ! Msg(gszMsgBox); ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! XClearWindow(mainDisplay, drawWindow); somethingHighLighted = FALSE; numRedrawBBox = 0; ! ShowInterrupt(1); interrupted = FALSE; readingPageNum = 0; loadedCurPageNum = 0; foundGoodStateObject = FALSE; ! while ((read_status=ReadObj(fp, &obj_ptr)) == TRUE) { ! if (obj_ptr != NULL) { obj_ptr->tmp_parent = NULL; ! AdjForOldVersion(obj_ptr); ! AddObj(NULL, topObj, obj_ptr); if (!interrupted && readingPageNum == loadedCurPageNum && ! (PointInBBox(obj_ptr->x, obj_ptr->y, drawWinBBox) || ! BBoxIntersect(obj_ptr->bbox, drawWinBBox))) { ! if (!DrawObj(drawWindow, obj_ptr)) interrupted = TRUE; ! if (CheckInterrupt()) interrupted = TRUE; } } *************** *** 3062,3072 **** } ! if (ObjFile == TRUE) ! { ! SetCurDir (file_name); *curSymDir = '\0'; } - else if (ObjFile == FALSE) - SetCurSymDir (file_name); curFileDefined = TRUE; --- 3000,3009 ---- } ! if (ObjFile == TRUE) { ! SetCurDir(file_name); *curSymDir = '\0'; + } else if (ObjFile == FALSE) { + SetCurSymDir(file_name); } curFileDefined = TRUE; *************** *** 3074,3095 **** CheckFileAttrsInLoad(); ! if (loadedCurPageNum <= 0 || curPage == NULL) ! { ! DelAllPages (); loadedCurPageNum = curPageNum = lastPageNum = 1; ! InitPage (); ! DrawPaperBoundary (drawWindow); ! RedrawGridLines (drawWindow); ! RedrawPageLines (drawWindow); ! RedrawChoiceWindow (); } ! GotoPageNum (loadedCurPageNum); if (ObjFile != FALSE) { ! if (strcmp(saved_cur_dir, curDir) != 0 && DirInSymPath (".")) { UpdateSymInfo(); } } else { ! if (strcmp(saved_cur_dir, curSymDir) != 0 && DirInSymPath (".")) { UpdateSymInfo(); } --- 3011,3031 ---- CheckFileAttrsInLoad(); ! if (loadedCurPageNum <= 0 || curPage == NULL) { ! DelAllPages(); loadedCurPageNum = curPageNum = lastPageNum = 1; ! InitPage(); ! DrawPaperBoundary(drawWindow); ! RedrawGridLines(drawWindow); ! RedrawPageLines(drawWindow); ! RedrawChoiceWindow(); } ! GotoPageNum(loadedCurPageNum); if (ObjFile != FALSE) { ! if (strcmp(saved_cur_dir, curDir) != 0 && DirInSymPath(".")) { UpdateSymInfo(); } } else { ! if (strcmp(saved_cur_dir, curSymDir) != 0 && DirInSymPath(".")) { UpdateSymInfo(); } *************** *** 3116,3126 **** } ! void DumpPatFill (FP, Fill, CellSize, BBox, Blanks) ! FILE * FP; ! int Fill, CellSize; ! struct BBRec BBox; ! char * Blanks; { ! int ltx, lty, rbx, rby; ltx = ((BBox.ltx % CellSize) == 0) ? BBox.ltx : --- 3052,3062 ---- } ! void DumpPatFill(FP, Fill, CellSize, BBox, Blanks) ! FILE *FP; ! int Fill, CellSize; ! struct BBRec BBox; ! char *Blanks; { ! int ltx, lty, rbx, rby; ltx = ((BBox.ltx % CellSize) == 0) ? BBox.ltx : *************** *** 3137,3150 **** ((int)(BBox.rby / CellSize))*CellSize); ! if (fprintf (FP, "%spat%1d %1d %1d %1d %1d %1d tgifpatfill\n", ! Blanks, Fill, CellSize, ltx, lty, rbx-ltx, rby-lty) == EOF) writeFileFailed = TRUE; } ! void DumpSymOutline (FP, ObjPtr) ! FILE * FP; ! register struct ObjRec * ObjPtr; { ! int ltx, lty, rbx, rby; ltx = ObjPtr->obbox.ltx - QUARTER_INCH + 1; --- 3073,3087 ---- ((int)(BBox.rby / CellSize))*CellSize); ! if (fprintf(FP, "%spat%1d %1d %1d %1d %1d %1d tgifpatfill\n", ! Blanks, Fill, CellSize, ltx, lty, rbx-ltx, rby-lty) == EOF) { writeFileFailed = TRUE; + } } ! void DumpSymOutline(FP, ObjPtr) ! FILE *FP; ! register struct ObjRec *ObjPtr; { ! int ltx, lty, rbx, rby; ltx = ObjPtr->obbox.ltx - QUARTER_INCH + 1; *************** *** 3153,3165 **** rby = ObjPtr->obbox.rby + QUARTER_INCH - 1; ! fprintf (FP, "gsave\n"); ! fprintf (FP, " 0 setgray\n"); ! fprintf (FP, " [4 4] 0 setdash\n"); ! fprintf (FP, " newpath\n %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); ! fprintf (FP, " closepath stroke\n"); ! fprintf (FP, "grestore\n"); } --- 3090,3102 ---- rby = ObjPtr->obbox.rby + QUARTER_INCH - 1; ! fprintf(FP, "gsave\n"); ! fprintf(FP, " 0 setgray\n"); ! fprintf(FP, " [4 4] 0 setdash\n"); ! fprintf(FP, " newpath\n %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); ! fprintf(FP, " closepath stroke\n"); ! fprintf(FP, "grestore\n"); } *************** *** 3170,3174 **** static int dumpOnePageInStackMode=FALSE; ! static FILE * dumpFP=NULL; static char tmpFile[MAXSTRING+1]; static int llxTotal=0, llyTotal=0, urxTotal=0, uryTotal=0; --- 3107,3111 ---- static int dumpOnePageInStackMode=FALSE; ! static FILE *dumpFP=NULL; static char tmpFile[MAXSTRING+1]; static int llxTotal=0, llyTotal=0, urxTotal=0, uryTotal=0; *************** *** 3354,3365 **** #define PAGE_BBOX 1 ! int DumpBBox (fp, page_only, page_bbox) ! FILE * fp; ! int page_only; ! struct BBRec * page_bbox; ! { ! register struct ObjRec * obj_ptr; ! int ltx=0, lty=0, rbx=0, rby=0, rc=TRUE; ! double llx1=0, lly1=0, urx1=0, ury1=0; if ((obj_ptr = topObj) == NULL) --- 3291,3302 ---- #define PAGE_BBOX 1 ! int DumpBBox(fp, page_only, page_bbox) ! FILE *fp; ! int page_only; ! struct BBRec *page_bbox; ! { ! register struct ObjRec *obj_ptr; ! int ltx=0, lty=0, rbx=0, rby=0, rc=TRUE; ! double llx1=0, lly1=0, urx1=0, ury1=0; if ((obj_ptr = topObj) == NULL) *************** *** 3420,3424 **** else if (page_bbox != NULL) { ! struct BBRec bbox, bbox1; bbox.ltx = ltx; bbox.lty = lty; bbox.rbx = rbx; bbox.rby = rby; --- 3357,3361 ---- else if (page_bbox != NULL) { ! struct BBRec bbox, bbox1; bbox.ltx = ltx; bbox.lty = lty; bbox.rbx = rbx; bbox.rby = rby; *************** *** 3453,3457 **** break; default: ! fprintf (stderr, "Unrecognizable page style '%1d'\n", pageStyle); break; } --- 3390,3394 ---- break; default: ! fprintf(stderr, "Unrecognizable page style '%1d'\n", pageStyle); break; } *************** *** 3467,3506 **** llxPage = llyPage = urxPage = uryPage = 0; ! fprintf (fp,"%%%%%sBoundingBox: %1d %1d %1d %1d\n", (page_only ? "Page" : ""), llxPage, llyPage, urxPage, uryPage); return (rc); } ! void ModifyOutputFileName (FileName) ! char * FileName; { ! register int i; ! int len; ! char s[MAXPATHLENGTH+1]; if (*outputDir == '\0') return; ! strcpy (s, FileName); ! len = strlen (s); ! for (i = len-1; i >= 0 && s[i] != '/'; i--) ; ! if (i >= 0) ! sprintf (FileName, "%s/%s", outputDir, &s[i+1]); ! else ! sprintf (FileName, "%s/%s", outputDir, s); } static ! void DumpTextObjInAscii (FP, ObjPtr) ! FILE * FP; ! register struct ObjRec * ObjPtr; { ! struct TextRec * text_ptr=ObjPtr->detail.t; ! struct StrRec * s_ptr; if (text_ptr->pen == NONEPAT) return; ! for (s_ptr=text_ptr->first; s_ptr != NULL; s_ptr=s_ptr->next) ! { ! if (fprintf (FP, "%s\n", s_ptr->dyn_str.s) == EOF) writeFileFailed = TRUE; totalBBoxValid = TRUE; } --- 3404,3444 ---- llxPage = llyPage = urxPage = uryPage = 0; ! fprintf(fp,"%%%%%sBoundingBox: %1d %1d %1d %1d\n", (page_only ? "Page" : ""), llxPage, llyPage, urxPage, uryPage); return (rc); } ! void ModifyOutputFileName(FileName) ! char *FileName; { ! register int i; ! int len; ! char s[MAXPATHLENGTH+1]; if (*outputDir == '\0') return; ! strcpy(s, FileName); ! len = strlen(s); ! for (i=len-1; i >= 0 && s[i] != '/'; i--) ; ! if (i >= 0) { ! sprintf(FileName, "%s/%s", outputDir, &s[i+1]); ! } else { ! sprintf(FileName, "%s/%s", outputDir, s); ! } } static ! void DumpTextObjInAscii(FP, ObjPtr) ! FILE *FP; ! register struct ObjRec *ObjPtr; { ! struct TextRec *text_ptr=ObjPtr->detail.t; ! struct StrRec *s_ptr; if (text_ptr->pen == NONEPAT) return; ! for (s_ptr=text_ptr->first; s_ptr != NULL; s_ptr=s_ptr->next) { ! if (fprintf(FP, "%s\n", s_ptr->dyn_str.s) == EOF) { writeFileFailed = TRUE; + } totalBBoxValid = TRUE; } *************** *** 3638,3642 **** static void WriteWord(fp, word) ! FILE * fp; unsigned short word; { --- 3576,3580 ---- static void WriteWord(fp, word) ! FILE *fp; unsigned short word; { *************** *** 3647,3651 **** static void WriteDoubleWord(fp, dword) ! FILE * fp; unsigned long dword; { --- 3585,3589 ---- static void WriteDoubleWord(fp, dword) ! FILE *fp; unsigned long dword; { *************** *** 3660,3664 **** static int minimalEPS=INVALID; static int colorBgInPrintingColorPS=INVALID; - static int generateTiffEPSI=INVALID; static char xbmToTiffCmd[MAXSTRING+1]; static char epsiExportExtension[MAXSTRING]; --- 3598,3601 ---- *************** *** 3683,3706 **** void GenDumpInitDefaults () { ! char * c_ptr; ! if (PRTGIF) minimalEPS = TRUE; ! else if (minimalEPS == INVALID) ! { minimalEPS = TRUE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"MinimalEPS")) != NULL && ! (strcmp (c_ptr, "false") == 0 || strcmp (c_ptr, "False") == 0)) minimalEPS = FALSE; } ! if (colorBgInPrintingColorPS == INVALID) ! { colorBgInPrintingColorPS = FALSE; ! if (!PRTGIF) ! { ! if ((c_ptr=XGetDefault (mainDisplay, TOOL_NAME, "ColorBgInPrintingColorPS")) != NULL && ! (strcmp (c_ptr, "True") == 0 || strcmp (c_ptr, "true") == 0)) colorBgInPrintingColorPS = TRUE; } } --- 3620,3642 ---- void GenDumpInitDefaults () { ! char *c_ptr; ! if (PRTGIF && !cmdLineOpenDisplay) { minimalEPS = TRUE; ! } else if (minimalEPS == INVALID) { minimalEPS = TRUE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"MinimalEPS")) != NULL && ! (strcmp(c_ptr, "false") == 0 || strcmp(c_ptr, "False") == 0)) { minimalEPS = FALSE; + } } ! if (colorBgInPrintingColorPS == INVALID) { colorBgInPrintingColorPS = FALSE; ! if (!PRTGIF) { ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "ColorBgInPrintingColorPS")) != NULL && ! (strcmp(c_ptr, "True") == 0 || strcmp(c_ptr, "true") == 0)) { colorBgInPrintingColorPS = TRUE; + } } } *************** *** 3712,3716 **** if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PSBopHook")) != NULL) { ! strcpy (psBopHook, c_ptr); psBopHookStatus = TRUE; } --- 3648,3652 ---- if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PSBopHook")) != NULL) { ! strcpy(psBopHook, c_ptr); psBopHookStatus = TRUE; } *************** *** 3726,3730 **** if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PSEopHook")) != NULL) { ! strcpy (psEopHook, c_ptr); psEopHookStatus = TRUE; } --- 3662,3666 ---- if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PSEopHook")) != NULL) { ! strcpy(psEopHook, c_ptr); psEopHookStatus = TRUE; } *************** *** 3736,3764 **** { generateTiffEPSI = FALSE; ! if (!PRTGIF) { ! if ((c_ptr=XGetDefault (mainDisplay, TOOL_NAME, "TiffEPSI")) != NULL && ! (strcmp (c_ptr, "True") == 0 || strcmp (c_ptr, "true") == 0)) generateTiffEPSI = TRUE; ! if ((c_ptr=XGetDefault (mainDisplay, TOOL_NAME, "XbmToTiff")) != NULL) { ! int count=0; strcpy(xbmToTiffCmd, c_ptr); for (c_ptr=strstr(xbmToTiffCmd,"%s"); c_ptr!=NULL; ! c_ptr=strstr(++c_ptr,"%s")) count++; ! if (count != 1 && count != 2) ! { ! sprintf (gszMsgBox, "Invalid %s*%s: %s resource.\n\n'%s' used.", TOOL_NAME, "XbmToTiff", xbmToTiffCmd, "xbmtopbm %s | pnmtotiff -none > %s"); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! strcpy (xbmToTiffCmd, "xbmtopbm %s | pnmtotiff -none > %s"); } } else ! strcpy (xbmToTiffCmd, "xbmtopbm %s | pnmtotiff -none > %s"); } } --- 3672,3705 ---- { generateTiffEPSI = FALSE; ! if (PRTGIF) ! { ! generateTiffEPSI = cmdLineTiffEPSI; ! strcpy(xbmToTiffCmd, "xbmtopbm %s | pnmtotiff -none > %s"); ! } ! else { ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "TiffEPSI")) != NULL && ! (strcmp(c_ptr, "True") == 0 || strcmp(c_ptr, "true") == 0)) generateTiffEPSI = TRUE; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "XbmToTiff")) != NULL) { ! int count=0; strcpy(xbmToTiffCmd, c_ptr); for (c_ptr=strstr(xbmToTiffCmd,"%s"); c_ptr!=NULL; ! c_ptr=strstr(++c_ptr,"%s")) { count++; ! } ! if (count != 1 && count != 2) { ! sprintf(gszMsgBox, "Invalid %s*%s: %s resource.\n\n'%s' used.", TOOL_NAME, "XbmToTiff", xbmToTiffCmd, "xbmtopbm %s | pnmtotiff -none > %s"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! strcpy(xbmToTiffCmd, "xbmtopbm %s | pnmtotiff -none > %s"); } } else ! strcpy(xbmToTiffCmd, "xbmtopbm %s | pnmtotiff -none > %s"); } } *************** *** 3772,3780 **** NULL) { ! strcpy (epsiExportExtension, c_ptr); if (strchr (epsiExportExtension, '.') != NULL || strchr (epsiExportExtension, ' ') != NULL) { ! fprintf (stderr, "Invalid %s*EPSIExportExtension: '%s'.\n", TOOL_NAME, epsiExportExtension); *epsiExportExtension = '\0'; --- 3713,3721 ---- NULL) { ! strcpy(epsiExportExtension, c_ptr); if (strchr (epsiExportExtension, '.') != NULL || strchr (epsiExportExtension, ' ') != NULL) { ! fprintf(stderr, "Invalid %s*EPSIExportExtension: '%s'.\n", TOOL_NAME, epsiExportExtension); *epsiExportExtension = '\0'; *************** *** 3793,3799 **** else { ! if ((c_ptr=XGetDefault (mainDisplay, TOOL_NAME, "NumberFileInPrintOnePage")) != NULL && ! (strcmp (c_ptr, "True") == 0 || strcmp (c_ptr, "true") == 0)) numberFileInPrintOnePage = TRUE; } --- 3734,3740 ---- else { ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "NumberFileInPrintOnePage")) != NULL && ! (strcmp(c_ptr, "True") == 0 || strcmp(c_ptr, "true") == 0)) numberFileInPrintOnePage = TRUE; } *************** *** 3802,3836 **** static ! void GenTiffFile (tmp_fname, epsi_fname) ! char * tmp_fname, * epsi_fname; { ! register int i; ! char tiff_fname[MAXPATHLENGTH+1], xbm_fname[MAXPATHLENGTH+1]; ! char cmd[MAXPATHLENGTH+1], buf[1024], * c_ptr; ! int bytes_read, len, count, tiff_fd, epsi_fd; ! FILE * tmp_fp, * epsi_fp, * pfp; ! struct stat stat_buf; ! long tmp_bytes, tiff_bytes; ! ! sprintf (xbm_fname, "%s/%s", curDir, curFileName); ! len = strlen (xbm_fname); ! for (i = len-1; xbm_fname[i] != '.'; i--) ; ! sprintf (&xbm_fname[i], ".%s", XBM_FILE_EXT); ModifyOutputFileName (xbm_fname); ! sprintf (tiff_fname, "%s/%s", curDir, curFileName); ! len = strlen (tiff_fname); ! for (i = len-1; tiff_fname[i] != '.'; i--) ; ! sprintf (&tiff_fname[i], ".tif"); ModifyOutputFileName (tiff_fname); count = 0; for (c_ptr=strstr(xbmToTiffCmd,"%s"); c_ptr!=NULL; ! c_ptr=strstr(++c_ptr,"%s")) count++; ! if (count == 1) ! sprintf (cmd, xbmToTiffCmd, xbm_fname); ! else ! sprintf (cmd, xbmToTiffCmd, xbm_fname, tiff_fname); unlink (tiff_fname); --- 3743,3779 ---- static ! void GenTiffFile(tmp_fname, epsi_fname) ! char *tmp_fname, *epsi_fname; { ! register int i; ! char tiff_fname[MAXPATHLENGTH+1], xbm_fname[MAXPATHLENGTH+1]; ! char cmd[MAXPATHLENGTH+1], buf[1024], * c_ptr; ! int bytes_read, len, count, tiff_fd, epsi_fd=(-1); ! FILE *tmp_fp=NULL, *epsi_fp=NULL, *pfp=NULL; ! struct stat stat_buf; ! long tmp_bytes, tiff_bytes; ! ! sprintf(xbm_fname, "%s/%s", curDir, curFileName); ! len = strlen(xbm_fname); ! for (i=len-1; xbm_fname[i] != '.'; i--) ; ! sprintf(&xbm_fname[i], ".%s", XBM_FILE_EXT); ModifyOutputFileName (xbm_fname); ! sprintf(tiff_fname, "%s/%s", curDir, curFileName); ! len = strlen(tiff_fname); ! for (i=len-1; tiff_fname[i] != '.'; i--) ; ! sprintf(&tiff_fname[i], ".tif"); ModifyOutputFileName (tiff_fname); count = 0; for (c_ptr=strstr(xbmToTiffCmd,"%s"); c_ptr!=NULL; ! c_ptr=strstr(++c_ptr,"%s")) { count++; ! } ! if (count == 1) { ! sprintf(cmd, xbmToTiffCmd, xbm_fname); ! } else { ! sprintf(cmd, xbmToTiffCmd, xbm_fname, tiff_fname); ! } unlink (tiff_fname); *************** *** 3846,3850 **** while (fgets (buf, sizeof(buf), pfp) != NULL) { ! Msg (buf); sleep (1); } --- 3789,3793 ---- while (fgets (buf, sizeof(buf), pfp) != NULL) { ! Msg(buf); sleep (1); } *************** *** 3869,3888 **** if ((tmp_fp=fopen(tmp_fname, "r")) == NULL) { ! sprintf (gszMsgBox, "Cannot open '%s' for read.", tmp_fname); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); return; } if ((tiff_fd=open(tiff_fname, O_RDONLY)) == (-1)) { ! sprintf (gszMsgBox, "Cannot open '%s' for read.", tiff_fname); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! fclose (tmp_fp); return; } ! if ((epsi_fp=fopen(epsi_fname, "w")) == NULL) { ! sprintf (gszMsgBox, "Cannot open '%s' for read.", tiff_fname); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! fclose (tmp_fp); close (tiff_fd); unlink (tiff_fname); --- 3812,3835 ---- if ((tmp_fp=fopen(tmp_fname, "r")) == NULL) { ! sprintf(gszMsgBox, "Cannot open '%s' for read.", tmp_fname); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); return; } if ((tiff_fd=open(tiff_fname, O_RDONLY)) == (-1)) { ! sprintf(gszMsgBox, "Cannot open '%s' for read.", tiff_fname); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! fclose(tmp_fp); return; } ! if (PRTGIF && cmdLineStdOut) ! { ! epsi_fp = stdout; ! } ! else if ((epsi_fp=fopen(epsi_fname, "w")) == NULL) { ! sprintf(gszMsgBox, "Cannot open '%s' for read.", tiff_fname); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! fclose(tmp_fp); close (tiff_fd); unlink (tiff_fname); *************** *** 3901,3924 **** WriteWord(epsi_fp, 0xffff); ! while (!writeFileFailed && fgets(buf, sizeof(buf), tmp_fp) != NULL) ! if (fputs (buf, epsi_fp) == EOF) writeFileFailed = TRUE; ! fclose (tmp_fp); ! fclose (epsi_fp); if (writeFileFailed) { writeFileFailed = FALSE; ! sprintf (gszMsgBox, "Fail to write to '%s'.\n\nFile system may be full.", ! epsi_fname); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); close (tiff_fd); unlink (tiff_fname); return; } ! if ((epsi_fd=open(epsi_fname, O_WRONLY|O_APPEND)) == (-1)) { ! sprintf (gszMsgBox, "Cannot open '%s' for append.", epsi_fname); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); close (tiff_fd); unlink (tiff_fname); --- 3848,3882 ---- WriteWord(epsi_fp, 0xffff); ! while (!writeFileFailed && fgets(buf, sizeof(buf), tmp_fp) != NULL) { ! if (fputs(buf, epsi_fp) == EOF) { writeFileFailed = TRUE; + } + } ! fclose(tmp_fp); ! if (!(PRTGIF && cmdLineStdOut)) fclose(epsi_fp); if (writeFileFailed) { writeFileFailed = FALSE; ! if (PRTGIF && cmdLineStdOut) { ! sprintf(gszMsgBox, "Write file failed.\n\nFile system may be full."); ! } else { ! sprintf(gszMsgBox, ! "Fail to write to '%s'.\n\nFile system may be full.", ! epsi_fname); ! } ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); close (tiff_fd); unlink (tiff_fname); return; } ! if (PRTGIF && cmdLineStdOut) { ! epsi_fd = 1; ! } ! else if ((epsi_fd=open(epsi_fname, O_WRONLY|O_APPEND)) == (-1)) ! { ! sprintf(gszMsgBox, "Cannot open '%s' for append.", epsi_fname); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); close (tiff_fd); unlink (tiff_fname); *************** *** 3937,3943 **** MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } ! close (epsi_fd); close (tiff_fd); - fclose (epsi_fp); unlink (tiff_fname); } --- 3895,3900 ---- MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } ! if (!(PRTGIF && cmdLineStdOut)) close (epsi_fd); close (tiff_fd); unlink (tiff_fname); } *************** *** 4106,4111 **** } ! if (PRTGIF) fprintf(stderr, "Writing to '%s' ...\n", tmpFile); ! writeFileFailed = FALSE; ResetGrayDetection(); --- 4063,4069 ---- } ! if (PRTGIF && !cmdLineStdOut) { ! fprintf(stderr, "Writing to '%s' ...\n", tmpFile); ! } writeFileFailed = FALSE; ResetGrayDetection(); *************** *** 4154,4158 **** writeFileFailed = TRUE; } ! if (PRTGIF) { if (fprintf(dumpFP, "%%%%Title: %s\n", FileName) == EOF) { writeFileFailed = TRUE; --- 4112,4116 ---- writeFileFailed = TRUE; } ! if (PRTGIF && !cmdLineOpenDisplay) { if (fprintf(dumpFP, "%%%%Title: %s\n", FileName) == EOF) { writeFileFailed = TRUE; *************** *** 4161,4165 **** strcpy(tmp_str, curFileName); len = strlen(tmp_str); ! for (i = len-1; tmp_str[i] != '.'; i--) ; tmp_str[i] = '\0'; if (fprintf(dumpFP, "%%%%Title: %s\n", tmp_str) == EOF) { --- 4119,4123 ---- strcpy(tmp_str, curFileName); len = strlen(tmp_str); ! for (i=len-1; tmp_str[i] != '.'; i--) ; tmp_str[i] = '\0'; if (fprintf(dumpFP, "%%%%Title: %s\n", tmp_str) == EOF) { *************** *** 4213,4217 **** } } ! if (!PRTGIF && whereToPrint == EPSI_FILE && !generateTiffEPSI) { SaveStatusStrings(); SetStringStatus("Generating preview bitmap..."); --- 4171,4175 ---- } } ! if (whereToPrint == EPSI_FILE && !generateTiffEPSI) { SaveStatusStrings(); SetStringStatus("Generating preview bitmap..."); *************** *** 4297,4302 **** --- 4255,4266 ---- psXOffStr[pageStyle], psDotsPerInch, psYOffStr[pageStyle]); + #ifndef METRIC_PIX_PER_INCH fprintf(dumpFP, "%1d %1d div %.3f mul 100 div dup neg scale\n\n", psDotsPerInch, PIX_PER_INCH, printMag); + #else /* METRIC_PIX_PER_INCH */ + fprintf(dumpFP, "%1d %1d div %.3f mul 100 div dup neg scale\n\n", + psDotsPerInch, (gridSystem==ENGLISH_GRID ? PIX_PER_INCH : + METRIC_PIX_PER_INCH), printMag); + #endif /* ~METRIC_PIX_PER_INCH */ fprintf(dumpFP, "gsave\n\n"); *************** *** 4361,4365 **** if (tiledPageScaling == one && !msgAboutTiledPageScalingSeen) { ! char msg1[MAXSTRING+1]; msgAboutTiledPageScalingSeen = TRUE; --- 4325,4329 ---- if (tiledPageScaling == one && !msgAboutTiledPageScalingSeen) { ! char msg1[MAXSTRING+1]; msgAboutTiledPageScalingSeen = TRUE; *************** *** 4438,4443 **** --- 4402,4413 ---- psYOffStr[pageStyle]); + #ifndef METRIC_PIX_PER_INCH fprintf(dumpFP, "%1d %1d div %.3f mul 100 div dup neg scale\n\n", psDotsPerInch, PIX_PER_INCH, printMag); + #else /* METRIC_PIX_PER_INCH */ + fprintf(dumpFP, "%1d %1d div %.3f mul 100 div dup neg scale\n\n", + psDotsPerInch, (gridSystem==ENGLISH_GRID ? PIX_PER_INCH : + METRIC_PIX_PER_INCH), printMag); + #endif /* ~METRIC_PIX_PER_INCH */ fprintf(dumpFP, "gsave\n\n"); *************** *** 4559,4562 **** --- 4529,4533 ---- } fclose(dumpFP); + dumpFP = NULL; EndGrayDetection(); *************** *** 4655,4659 **** sprintf(ps_file, "%s/%s", curDir, curFileName); len = strlen(ps_file); ! for (i = len-1; ps_file[i] != '.'; i--) ; if (dumpOneFilePerPage || (dumpOnePageInStackMode && numberFileInPrintOnePage)) { --- 4626,4630 ---- sprintf(ps_file, "%s/%s", curDir, curFileName); len = strlen(ps_file); ! for (i=len-1; ps_file[i] != '.'; i--) ; if (dumpOneFilePerPage || (dumpOnePageInStackMode && numberFileInPrintOnePage)) { *************** *** 4680,4684 **** Msg(cmd); } ! if (!PRTGIF && whereToPrint == EPSI_FILE && generateTiffEPSI) { int saved_colordump=colorDump; --- 4651,4655 ---- Msg(cmd); } ! if (whereToPrint == EPSI_FILE && generateTiffEPSI) { int saved_colordump=colorDump; *************** *** 4694,4698 **** unlink(tmpFile); } else { ! if (!CopyAFile(tmpFile, ps_file)) { if (PRTGIF) { fprintf(stderr, "LaTeX output not generated.\n"); --- 4665,4669 ---- unlink(tmpFile); } else { ! if (!CopyAFile(tmpFile, (PRTGIF && cmdLineStdOut) ? NULL : ps_file)) { if (PRTGIF) { fprintf(stderr, "LaTeX output not generated.\n"); *************** *** 4704,4724 **** } } ! if (PSFILE_MOD != 0 && chmod (ps_file, PSFILE_MOD)) { if (PRTGIF) { ! fprintf(stderr, "Cannot chmod '%s' to 0%1o.\n", ps_file, ! PSFILE_MOD); } else { if (short_name && *outputDir=='\0') { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%1o.", rest, ! PSFILE_MOD); } else { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%1o.", ps_file, ! PSFILE_MOD); } ! Msg(gszMsgBox); } } if (PRTGIF) { ! fprintf(stderr, "LaTeX figure printed into '%s'.\n\n", ps_file); } else { if (short_name && *outputDir=='\0') { --- 4675,4697 ---- } } ! if (tmpFileMode != 0 && chmod(ps_file, tmpFileMode)) { if (PRTGIF) { ! fprintf(stderr, "Cannot chmod '%s' to 0%03o.\n", ps_file, ! tmpFileMode); } else { if (short_name && *outputDir=='\0') { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%03o.", rest, ! tmpFileMode); } else { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%03o.", ps_file, ! tmpFileMode); } ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } } if (PRTGIF) { ! if (!cmdLineStdOut) { ! fprintf(stderr, "LaTeX figure printed into '%s'.\n\n", ps_file); ! } } else { if (short_name && *outputDir=='\0') { *************** *** 4750,4754 **** sprintf(ps_file, "%s/%s", curDir, curFileName); len = strlen(ps_file); ! for (i = len-1; ps_file[i] != '.'; i--) ; if (dumpOneFilePerPage || (dumpOnePageInStackMode && numberFileInPrintOnePage)) { --- 4723,4727 ---- sprintf(ps_file, "%s/%s", curDir, curFileName); len = strlen(ps_file); ! for (i=len-1; ps_file[i] != '.'; i--) ; if (dumpOneFilePerPage || (dumpOnePageInStackMode && numberFileInPrintOnePage)) { *************** *** 4766,4770 **** Msg(gszMsgBox); } ! if (!CopyAFile(tmpFile, ps_file)) { if (PRTGIF) { fprintf(stderr, "PostScript output not generated.\n"); --- 4739,4743 ---- Msg(gszMsgBox); } ! if (!CopyAFile(tmpFile, (PRTGIF && cmdLineStdOut) ? NULL : ps_file)) { if (PRTGIF) { fprintf(stderr, "PostScript output not generated.\n"); *************** *** 4775,4795 **** return FALSE; } ! if (PSFILE_MOD != 0 && chmod(ps_file, PSFILE_MOD)) { if (PRTGIF) { ! fprintf(stderr, "Cannot chmod '%s' to 0%1o.\n", ps_file, ! PSFILE_MOD); } else { if (short_name && *outputDir=='\0') { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%1o.", rest, ! PSFILE_MOD); } else { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%1o.", ps_file, ! PSFILE_MOD); } ! Msg(gszMsgBox); } } if (PRTGIF) { ! fprintf(stderr, "PostScript file printed into '%s'.\n\n", ps_file); } else { if (short_name && *outputDir=='\0') { --- 4748,4770 ---- return FALSE; } ! if (tmpFileMode != 0 && chmod(ps_file, tmpFileMode)) { if (PRTGIF) { ! fprintf(stderr, "Cannot chmod '%s' to 0%03o.\n", ps_file, ! tmpFileMode); } else { if (short_name && *outputDir=='\0') { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%03o.", rest, ! tmpFileMode); } else { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%03o.", ps_file, ! tmpFileMode); } ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } } if (PRTGIF) { ! if (!cmdLineStdOut) { ! fprintf(stderr, "PostScript file printed into '%s'.\n\n", ps_file); ! } } else { if (short_name && *outputDir=='\0') { *************** *** 4822,4826 **** sprintf(ps_file, "%s/%s", curDir, curFileName); len = strlen(ps_file); ! for (i = len-1; ps_file[i] != '.'; i--) ; if (dumpOneFilePerPage || (dumpOnePageInStackMode && numberFileInPrintOnePage)) { --- 4797,4801 ---- sprintf(ps_file, "%s/%s", curDir, curFileName); len = strlen(ps_file); ! for (i=len-1; ps_file[i] != '.'; i--) ; if (dumpOneFilePerPage || (dumpOnePageInStackMode && numberFileInPrintOnePage)) { *************** *** 4838,4842 **** Msg(gszMsgBox); } ! if (!CopyAFile(tmpFile, ps_file)) { if (PRTGIF) { fprintf(stderr, "ASCII text output not generated.\n"); --- 4813,4817 ---- Msg(gszMsgBox); } ! if (!CopyAFile(tmpFile, (PRTGIF && cmdLineStdOut) ? NULL : ps_file)) { if (PRTGIF) { fprintf(stderr, "ASCII text output not generated.\n"); *************** *** 4847,4867 **** return FALSE; } ! if (PSFILE_MOD != 0 && chmod (ps_file, PSFILE_MOD)) { if (PRTGIF) { ! fprintf(stderr, "Cannot chmod '%s' to 0%1o.\n", ps_file, ! PSFILE_MOD); } else { if (short_name && *outputDir=='\0') { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%1o.", rest, ! PSFILE_MOD); } else { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%1o.", ps_file, ! PSFILE_MOD); } ! Msg(gszMsgBox); } } if (PRTGIF) { ! fprintf(stderr, "ASCII text file printed into '%s'.\n\n", ps_file); } else { if (short_name && *outputDir=='\0') { --- 4822,4844 ---- return FALSE; } ! if (tmpFileMode != 0 && chmod(ps_file, tmpFileMode)) { if (PRTGIF) { ! fprintf(stderr, "Cannot chmod '%s' to 0%03o.\n", ps_file, ! tmpFileMode); } else { if (short_name && *outputDir=='\0') { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%03o.", rest, ! tmpFileMode); } else { ! sprintf(gszMsgBox, "Cannot chmod '%s' to 0%03o.", ps_file, ! tmpFileMode); } ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } } if (PRTGIF) { ! if (!cmdLineStdOut) { ! fprintf(stderr, "ASCII text file printed into '%s'.\n\n", ps_file); ! } } else { if (short_name && *outputDir=='\0') { *************** *** 5043,5048 **** } ! void DumpOnePageInTileMode (row, col) ! int row, col; { int ok=TRUE; --- 5020,5025 ---- } ! void DumpOnePageInTileMode(row, col) ! int row, col; { int ok=TRUE; *************** *** 5051,5056 **** if (printUsingRequestedColor) tgifColors = tgifRequestedColors; ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); totalBBoxValid = FALSE; --- 5028,5033 ---- if (printUsingRequestedColor) tgifColors = tgifRequestedColors; ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); totalBBoxValid = FALSE; *************** *** 5067,5072 **** dumpOnePageInTileMode = FALSE; ! SetDefaultCursor (mainWindow); ! ShowCursor (); if (printUsingRequestedColor) tgifColors = saved_tgif_colors; --- 5044,5049 ---- dumpOnePageInTileMode = FALSE; ! SetDefaultCursor(mainWindow); ! ShowCursor(); if (printUsingRequestedColor) tgifColors = saved_tgif_colors; *************** *** 5080,5085 **** if (printUsingRequestedColor) tgifColors = tgifRequestedColors; ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); totalBBoxValid = FALSE; --- 5057,5062 ---- if (printUsingRequestedColor) tgifColors = tgifRequestedColors; ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); totalBBoxValid = FALSE; *************** *** 5095,5100 **** dumpOnePageInStackMode = FALSE; ! SetDefaultCursor (mainWindow); ! ShowCursor (); if (printUsingRequestedColor) tgifColors = saved_tgif_colors; --- 5072,5077 ---- dumpOnePageInStackMode = FALSE; ! SetDefaultCursor(mainWindow); ! ShowCursor(); if (printUsingRequestedColor) tgifColors = saved_tgif_colors; *************** *** 5108,5113 **** if (printUsingRequestedColor) tgifColors = tgifRequestedColors; ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); if (lastPageNum != 1) dumpOneFilePerPage = TRUE; --- 5085,5090 ---- if (printUsingRequestedColor) tgifColors = tgifRequestedColors; ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); if (lastPageNum != 1) dumpOneFilePerPage = TRUE; *************** *** 5130,5135 **** dumpOneFilePerPage = FALSE; ! SetDefaultCursor (mainWindow); ! ShowCursor (); if (printUsingRequestedColor) tgifColors = saved_tgif_colors; --- 5107,5112 ---- dumpOneFilePerPage = FALSE; ! SetDefaultCursor(mainWindow); ! ShowCursor(); if (printUsingRequestedColor) tgifColors = saved_tgif_colors; *************** *** 5147,5154 **** } ! void PrintWithCommand (FileName) ! char * FileName; { ! struct PageRec * saved_cur_page; int ok=TRUE; XColor *saved_tgif_colors=tgifColors; --- 5124,5131 ---- } ! void PrintWithCommand(FileName) ! char *FileName; { ! struct PageRec *saved_cur_page=NULL; int ok=TRUE; XColor *saved_tgif_colors=tgifColors; *************** *** 5156,5160 **** if (whereToPrint != PRINTER) { ! Msg ("PrintWithCmd only works when output device is the printer."); return; } --- 5133,5137 ---- if (whereToPrint != PRINTER) { ! Msg("PrintWithCmd only works when output device is the printer."); return; } *************** *** 5165,5170 **** if (printUsingRequestedColor) tgifColors = tgifRequestedColors; ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); if (whereToPrint==PRINTER || whereToPrint==LATEX_FIG || --- 5142,5147 ---- if (printUsingRequestedColor) tgifColors = tgifRequestedColors; ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); if (whereToPrint==PRINTER || whereToPrint==LATEX_FIG || *************** *** 5180,5188 **** printingPageNum++) { ! char dummy_str[MAXSTRING+1]; topObj = curPage->top; botObj = curPage->bot; ! sprintf (dummy_str, "Preprocess page %1d of %1d...", printingPageNum, lastPageNum); SetStringStatus (dummy_str); --- 5157,5165 ---- printingPageNum++) { ! char dummy_str[MAXSTRING+1]; topObj = curPage->top; botObj = curPage->bot; ! sprintf(dummy_str, "Preprocess page %1d of %1d...", printingPageNum, lastPageNum); SetStringStatus (dummy_str); *************** *** 5204,5212 **** printingPageNum++) { ! char dummy_str[MAXSTRING+1]; topObj = curPage->top; botObj = curPage->bot; ! sprintf (dummy_str, "Generating page %1d of %1d...", printingPageNum, lastPageNum); SetStringStatus (dummy_str); --- 5181,5189 ---- printingPageNum++) { ! char dummy_str[MAXSTRING+1]; topObj = curPage->top; botObj = curPage->bot; ! sprintf(dummy_str, "Generating page %1d of %1d...", printingPageNum, lastPageNum); SetStringStatus (dummy_str); *************** *** 5218,5223 **** botObj = curPage->bot; ! SetDefaultCursor (mainWindow); ! ShowCursor (); if (printUsingRequestedColor) tgifColors = saved_tgif_colors; --- 5195,5200 ---- botObj = curPage->bot; ! SetDefaultCursor(mainWindow); ! ShowCursor(); if (printUsingRequestedColor) tgifColors = saved_tgif_colors; *************** *** 5320,5328 **** while (!DirIsRemote(curDir) && fileModified) { ! switch (MsgBox ("File modified, save file before clear? [ync](y)", TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: SaveFile (); break; ! case MB_ID_NO: TieLooseEnds (); SetFileModified (FALSE); break; case MB_ID_CANCEL: return; } --- 5297,5305 ---- while (!DirIsRemote(curDir) && fileModified) { ! switch (MsgBox("File modified, save file before clear? [ync](y)", TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: SaveFile(); break; ! case MB_ID_NO: TieLooseEnds (); SetFileModified(FALSE); break; case MB_ID_CANCEL: return; } *************** *** 5338,5342 **** CheckFileAttrsInLoad(); ! Msg ("Editing no file."); objId = 0; RedrawTitleWindow (); --- 5315,5319 ---- CheckFileAttrsInLoad(); ! Msg("Editing no file."); objId = 0; RedrawTitleWindow (); *************** *** 5347,5384 **** } ! void OpenProc () { ! char file_name[MAXPATHLENGTH+1]; ! int do_not_save=FALSE, need_to_check_auto_exec=FALSE; ! while (!DirIsRemote(curDir) && fileModified) ! { ! switch (MsgBox ("File modified, save file before open? [ync](y)", ! TOOL_NAME, YNC_MB)) ! { ! case MB_ID_YES: SaveFile (); break; ! case MB_ID_NO: do_not_save = TRUE; SetFileModified (FALSE); break; ! case MB_ID_CANCEL: return; } } ! if (SelectFileName ("Please select a file to OPEN ...",file_name) != INVALID) ! { ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); ! if (FileIsRemote (file_name)) ! { char remote_fname[MAXPATHLENGTH+1]; char *page_spec=NULL; ! if (!FormNewFileName (curDir, file_name, NULL, remote_fname, ! &page_spec)) ! { sprintf(gszMsgBox, "Invalid remote file name '%s'.", file_name); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! if (do_not_save) SetFileModified (TRUE); ! } ! else ! { char *buf=NULL, *content_type=NULL, final_url[MAXPATHLENGTH+1]; int rc, buf_sz=0, is_html=FALSE; --- 5324,5354 ---- } ! void OpenProc() { ! char file_name[MAXPATHLENGTH+1]; ! int do_not_save=FALSE, need_to_check_auto_exec=FALSE; ! while (!DirIsRemote(curDir) && fileModified) { ! switch (MsgBox("File modified, save file before open? [ync](y)", ! TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: SaveFile(); break; ! case MB_ID_NO: do_not_save = TRUE; SetFileModified(FALSE); break; ! case MB_ID_CANCEL: return; } } ! if (SelectFileName("Please select a file to OPEN ...",file_name) != INVALID) { ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! if (FileIsRemote(file_name)) { char remote_fname[MAXPATHLENGTH+1]; char *page_spec=NULL; ! if (!FormNewFileName(curDir, file_name, NULL, remote_fname, ! &page_spec)) { sprintf(gszMsgBox, "Invalid remote file name '%s'.", file_name); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! if (do_not_save) SetFileModified(TRUE); ! } else { char *buf=NULL, *content_type=NULL, final_url[MAXPATHLENGTH+1]; int rc, buf_sz=0, is_html=FALSE; *************** *** 5398,5402 **** } } else if (do_not_save) { ! SetFileModified (TRUE); } if (content_type != NULL) FreeRemoteBuf (content_type); --- 5368,5372 ---- } } else if (do_not_save) { ! SetFileModified(TRUE); } if (content_type != NULL) FreeRemoteBuf (content_type); *************** *** 5411,5414 **** --- 5381,5385 ---- MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } else if (new_page_num != curPageNum) { + BeforeNavigate(); GotoPageNum(new_page_num); ShowPage(); *************** *** 5425,5448 **** else { ! char ext_str[80]; ! int ext_len, len, obj_file=TRUE; ! sprintf (ext_str, ".%s", OBJ_FILE_EXT); ! ext_len = strlen (ext_str); ! len = strlen (file_name); if (len < ext_len || ! strcmp (&file_name[len-ext_len], ext_str) != 0) { ! sprintf (ext_str, ".%s", SYM_FILE_EXT); ! ext_len = strlen (ext_str); if (len >= ext_len && ! strcmp (&file_name[len-ext_len], ext_str) == 0) obj_file = FALSE; } if (!LoadFile(file_name, obj_file)) { if (do_not_save) { ! SetFileModified (TRUE); } } else { --- 5396,5419 ---- else { ! char ext_str[80]; ! int ext_len, len, obj_file=TRUE; ! sprintf(ext_str, ".%s", OBJ_FILE_EXT); ! ext_len = strlen(ext_str); ! len = strlen(file_name); if (len < ext_len || ! strcmp(&file_name[len-ext_len], ext_str) != 0) { ! sprintf(ext_str, ".%s", SYM_FILE_EXT); ! ext_len = strlen(ext_str); if (len >= ext_len && ! strcmp(&file_name[len-ext_len], ext_str) == 0) obj_file = FALSE; } if (!LoadFile(file_name, obj_file)) { if (do_not_save) { ! SetFileModified(TRUE); } } else { *************** *** 5450,5458 **** } } ! SetDefaultCursor (mainWindow); ! ShowCursor (); } - else if (do_not_save) - SetFileModified (TRUE); if (need_to_check_auto_exec) { --- 5421,5429 ---- } } ! SetDefaultCursor(mainWindow); ! ShowCursor(); ! } else if (do_not_save) { ! SetFileModified(TRUE); } if (need_to_check_auto_exec) { *************** *** 5472,5476 **** struct AttrRec *attr_ptr; ! MakeQuiescent (); if (importFromLibrary) { --- 5443,5447 ---- struct AttrRec *attr_ptr; ! MakeQuiescent(); if (importFromLibrary) { *************** *** 5627,5764 **** }; ! int QuitProc () { ! int do_not_save = FALSE; ! while (!DirIsRemote(curDir) && fileModified) ! { ! switch (MsgBox ("File modified, save file before quit? [ync](y)", ! TOOL_NAME, YNC_MB)) ! { ! case MB_ID_YES: SaveFile (); break; ! case MB_ID_NO: do_not_save = TRUE; SetFileModified (FALSE); break; ! case MB_ID_CANCEL: return (INVALID); } } ! if (AncesterModified ()) ! { ! switch (MsgBox ("Ancester file modified, still quitting? [ync](y)", ! TOOL_NAME, YNC_MB)) ! { ! case MB_ID_YES: return (FILE_QUIT); ! case MB_ID_NO: ! if (do_not_save) SetFileModified (TRUE); ! return (INVALID); ! case MB_ID_CANCEL: ! if (do_not_save) SetFileModified (TRUE); ! return (INVALID); } } ! return (FILE_QUIT); } ! int SolveProc () { ! if (!saveTmpOnReturn) return (FILE_SOLVE); ! switch (SaveTmpFile ("tmpmodel")) ! { ! case OBJ_FILE_SAVED: return (FILE_SOLVE); ! case SYM_FILE_SAVED: return (INVALID); ! case INVALID: return (INVALID); } ! return (INVALID); } ! int SimulateProc () { ! if (!saveTmpOnReturn) return (FILE_SIMULATE); ! switch (SaveTmpFile ("tmpmodel")) ! { ! case OBJ_FILE_SAVED: return (FILE_SIMULATE); ! case SYM_FILE_SAVED: return (INVALID); ! case INVALID: return (INVALID); } ! return (INVALID); } ! int ProbeProc () { ! if (!saveTmpOnReturn) return (FILE_PROBE); ! switch (SaveTmpFile ("tmpmodel")) ! { ! case OBJ_FILE_SAVED: return (FILE_PROBE); ! case SYM_FILE_SAVED: return (INVALID); ! case INVALID: return (INVALID); } ! return (INVALID); } ! int AnimateProc () { ! if (!saveTmpOnReturn) return (FILE_ANIMATE); ! switch (SaveTmpFile ("tmpmodel")) ! { ! case OBJ_FILE_SAVED: return (FILE_ANIMATE); ! case SYM_FILE_SAVED: return (INVALID); ! case INVALID: return (INVALID); } ! return (INVALID); } ! int EscapeProc () { ! return (FILE_ESCAPE); } ! int FileSubMenu (index) ! int index; { ! switch (index) ! { ! case FILE_NEW: NewProc (); break; ! case FILE_OPEN: OpenProc (); break; ! case FILE_SAVE: SaveFile (); break; ! case FILE_SAVENEW: SaveNewFile (FALSE); break; ! case FILE_IMPORT: ImportFile (); break; ! case FILE_IMPORTXBM: ImportXBitmapFile (); break; ! case FILE_IMPORTXPM: ImportXPixmapFile (); break; ! case FILE_IMPORTEPS: ImportEPSFile (FALSE); break; ! case FILE_IMPORTGIF: ImportGIFFile (); break; ! case FILE_IMPORTOTHERS: ImportOtherFile (); break; ! case FILE_EMBEDEPS: ImportEPSFile (TRUE); break; ! case FILE_BROWSEXBM: BrowseXBitmap (); break; ! case FILE_BROWSEXPM: BrowseXPixmap (); break; ! case FILE_BROWSEOTHERS: BrowseOther (); break; ! case FILE_DOMAIN: ChangeDomain (); break; ! case FILE_DUMP: Dump (""); break; ! case FILE_USR_DUMP: PrintWithCommand (""); break; ! case FILE_DUMPSELECTED: PrintSelectedObjs (); break; ! case FILE_PRINTONE: PrintOnePage (); break; ! case FILE_SETEXPORTTRIM: SetExportPixelTrim (NULL); break; ! case FILE_INPUT_POLY: InputPolyPts (); break; ! case FILE_INPUT_POLYGON: InputPolygonPts (); break; ! case FILE_SET_TEMPLATE: SetTemplate (); break; ! case FILE_SOLVE: return (SolveProc ()); ! case FILE_SIMULATE: return (SimulateProc ()); ! case FILE_PROBE: return (ProbeProc ()); ! case FILE_ANIMATE: return (AnimateProc ()); ! case FILE_ESCAPE: return (EscapeProc ()); ! case FILE_SAVESELAS: SaveNewFile (TRUE); break; ! case FILE_SAVESYMINLIB: SaveSymInLibrary (); break; ! case FILE_QUIT: return (QuitProc ()); } ! return (INVALID); } ! int FileMenu (X, Y, TrackMenuBar) ! int X, Y, TrackMenuBar; { register int i; ! int index, * fore_colors, * valid, * init_rv; ! char **desc=(char **)malloc((FILEMENUENTRIES+1)*sizeof(char*)); if (desc == NULL) FailAllocMessage(); --- 5598,5726 ---- }; ! int QuitProc() { ! int do_not_save=FALSE; ! while (!DirIsRemote(curDir) && fileModified) { ! switch (MsgBox("File modified, save file before quit? [ync](y)", ! TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: SaveFile(); break; ! case MB_ID_NO: do_not_save = TRUE; SetFileModified(FALSE); break; ! case MB_ID_CANCEL: return INVALID; } } ! if (AncesterModified()) { ! switch (MsgBox("Ancester file modified, still quitting? [ync](y)", ! TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: return FILE_QUIT; ! case MB_ID_NO: ! if (do_not_save) SetFileModified(TRUE); ! return INVALID; ! case MB_ID_CANCEL: ! if (do_not_save) SetFileModified(TRUE); ! return INVALID; } } ! return FILE_QUIT; } ! int SolveProc() { ! if (!saveTmpOnReturn) return FILE_SOLVE; ! switch (SaveTmpFile("tmpmodel")) { ! case OBJ_FILE_TYPE: return FILE_SOLVE; ! case SYM_FILE_TYPE: return INVALID; ! case INVALID: return INVALID; } ! return INVALID; } ! int SimulateProc() { ! if (!saveTmpOnReturn) return FILE_SIMULATE; ! switch (SaveTmpFile("tmpmodel")) { ! case OBJ_FILE_TYPE: return FILE_SIMULATE; ! case SYM_FILE_TYPE: return INVALID; ! case INVALID: return INVALID; } ! return INVALID; } ! int ProbeProc() { ! if (!saveTmpOnReturn) return FILE_PROBE; ! switch (SaveTmpFile("tmpmodel")) { ! case OBJ_FILE_TYPE: return FILE_PROBE; ! case SYM_FILE_TYPE: return INVALID; ! case INVALID: return INVALID; } ! return INVALID; } ! int AnimateProc() { ! if (!saveTmpOnReturn) return FILE_ANIMATE; ! switch (SaveTmpFile("tmpmodel")) { ! case OBJ_FILE_TYPE: return FILE_ANIMATE; ! case SYM_FILE_TYPE: return INVALID; ! case INVALID: return INVALID; } ! return INVALID; } ! int EscapeProc() { ! return FILE_ESCAPE; } ! int FileSubMenu(index) ! int index; { ! switch (index) { ! case FILE_NEW: NewProc(); break; ! case FILE_OPEN: OpenProc(); break; ! case FILE_SAVE: SaveFile(); break; ! case FILE_SAVENEW: SaveNewFile(FALSE); break; ! case FILE_IMPORT: ImportFile(); break; ! case FILE_IMPORTXBM: ImportXBitmapFile(); break; ! case FILE_IMPORTXPM: ImportXPixmapFile(); break; ! case FILE_IMPORTEPS: ImportEPSFile(FALSE); break; ! case FILE_IMPORTGIF: ImportGIFFile(); break; ! case FILE_IMPORTOTHERS: ImportOtherFile(); break; ! case FILE_EMBEDEPS: ImportEPSFile(TRUE); break; ! case FILE_BROWSEXBM: BrowseXBitmap(); break; ! case FILE_BROWSEXPM: BrowseXPixmap(); break; ! case FILE_BROWSEOTHERS: BrowseOther(); break; ! case FILE_DOMAIN: ChangeDomain(); break; ! case FILE_DUMP: Dump(""); break; ! case FILE_USR_DUMP: PrintWithCommand(""); break; ! case FILE_DUMPSELECTED: PrintSelectedObjs(); break; ! case FILE_PRINTONE: PrintOnePage(); break; ! case FILE_SETEXPORTTRIM: SetExportPixelTrim(NULL); break; ! case FILE_INPUT_POLY: InputPolyPts(); break; ! case FILE_INPUT_POLYGON: InputPolygonPts(); break; ! case FILE_SET_TEMPLATE: SetTemplate(); break; ! case FILE_SOLVE: return SolveProc(); ! case FILE_SIMULATE: return SimulateProc(); ! case FILE_PROBE: return ProbeProc(); ! case FILE_ANIMATE: return AnimateProc(); ! case FILE_ESCAPE: return EscapeProc(); ! case FILE_SAVESELAS: SaveNewFile(TRUE); break; ! case FILE_SAVESYMINLIB: SaveSymInLibrary(); break; ! case FILE_QUIT: return QuitProc(); } ! return INVALID; } ! int FileMenu(X, Y, TrackMenuBar) ! int X, Y, TrackMenuBar; { register int i; ! int index, *fore_colors, *valid, *init_rv; ! char **desc=(char **)malloc((FILEMENUENTRIES+1)*sizeof(char*)); if (desc == NULL) FailAllocMessage(); *************** *** 5768,5776 **** strcpy(desc[i], fileMenuDescription[i]); } ! sprintf (desc[i-1], "Exit %s", TOOL_NAME); desc[i] = NULL; ! DefaultColorArrays (FILEMENUENTRIES, &fore_colors, &valid, &init_rv, NULL); activeMenu = MENU_FILE; ! index = TextMenuLoop (X, Y, fileMenuStr, FILEMENUENTRIES, fore_colors, valid, init_rv, desc, SINGLECOLOR, TrackMenuBar); --- 5730,5738 ---- strcpy(desc[i], fileMenuDescription[i]); } ! sprintf(desc[i-1], "Exit %s", TOOL_NAME); desc[i] = NULL; ! DefaultColorArrays(FILEMENUENTRIES, &fore_colors, &valid, &init_rv, NULL); activeMenu = MENU_FILE; ! index = TextMenuLoop(X, Y, fileMenuStr, FILEMENUENTRIES, fore_colors, valid, init_rv, desc, SINGLECOLOR, TrackMenuBar); *************** *** 5784,5798 **** free(desc); } ! return (index); } ! void CleanUpFiles () { ClearBgColorInfo(FALSE); ClearBgPixmapInfo(FALSE); ! CleanUpComments (); ! ClearFileInfo (); ! if (usePaperSizeStoredInFile) ResetOnePageSize (); fileModified = FALSE; } --- 5746,5760 ---- free(desc); } ! return index; } ! void CleanUpFiles() { ClearBgColorInfo(FALSE); ClearBgPixmapInfo(FALSE); ! CleanUpComments(); ! ClearFileInfo(); ! if (usePaperSizeStoredInFile) ResetOnePageSize(); fileModified = FALSE; } *** font.c.orig Tue Sep 30 13:23:13 1997 --- font.c Tue Sep 30 13:23:13 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/font.c,v 3.6 1997/01/29 16:06:15 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/font.c,v 3.8 1997/09/16 20:29:40 william Exp $ */ #include *************** *** 201,206 **** static char * * fontInfoStr=NULL; ! static char * charCodeToName[] = ! { /* \200 */ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* \220 */ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", --- 199,203 ---- static char * * fontInfoStr=NULL; ! static char * charCodeToName[] = { /* \200 */ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* \220 */ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", *************** *** 438,468 **** } ! int ValidCharCode (c_ptr) ! char * c_ptr; { ! register int index = (int)(*c_ptr - '\200'); if (*charCodeToName[index] == '\0' || *charCodeToName[index] == '8' || ! *charCodeToName[index] == '\\') ! return (TRUE); ! else ! { ! sprintf (gszMsgBox, ! "Unrecognized character code \\%o. Character discarded!", ! (*c_ptr)&0xff); ! Msg (gszMsgBox); ! return (FALSE); } } ! char * CharCodeTranslate (c_ptr) ! char * c_ptr; { ! register int index = (int)(*c_ptr - '\200'); ! if (*charCodeToName[index] == '\\' || *charCodeToName[index] == '8') ! return (charCodeToName[index]); ! else ! return (NULL); } --- 435,462 ---- } ! int ValidCharCode(c_ptr) ! char *c_ptr; { ! register int index=(int)(*c_ptr - '\200'); if (*charCodeToName[index] == '\0' || *charCodeToName[index] == '8' || ! *charCodeToName[index] == '\\') { ! return TRUE; } + sprintf(gszMsgBox, + "Unrecognized character code \\%o. Character discarded!", (*c_ptr)&0xff); + Msg(gszMsgBox); + return FALSE; } ! char *CharCodeTranslate(c_ptr) ! char *c_ptr; { ! register int index=(int)(*c_ptr - '\200'); ! if (*charCodeToName[index] == '\\' || *charCodeToName[index] == '8') { ! return charCodeToName[index]; ! } ! return NULL; } *************** *** 508,532 **** static ! void PrepareText (TextPtr) ! register struct TextRec * TextPtr; { ! register char * c_ptr; ! struct StrRec * str_ptr; ! int index, byte_index; ! short * flag_ptr; ! ! if (TextPtr->font_name == NULL) ! { ! if (TextPtr->font == FONT_SYM) return; ! } ! else if (strcmp (TextPtr->font_name, "Symbol") == 0) return; ! index = TextPtr->font*MAXFONTSTYLES + TextPtr->style; ! for (str_ptr = TextPtr->last; str_ptr != NULL; str_ptr = str_ptr->prev) ! { ! for (c_ptr = str_ptr->dyn_str.s; *c_ptr != '\0'; c_ptr++) ! if (((*c_ptr)&0x80) && *charCodeToName[(int)(*c_ptr-'\200')]=='8') ! { encodeFont[index] = TRUE; flag_ptr = encodeCharFlags[index]; --- 502,524 ---- static ! void PrepareText(TextPtr) ! register struct TextRec *TextPtr; { ! register char *c_ptr; ! struct StrRec *str_ptr; ! int index, byte_index; ! short *flag_ptr; ! ! if (TextPtr->font_name == NULL) { ! if (TextPtr->font == FONT_SYM) { ! return; ! } ! } else if (strcmp(TextPtr->font_name, "Symbol") == 0) { return; ! } index = TextPtr->font*MAXFONTSTYLES + TextPtr->style; ! for (str_ptr=TextPtr->last; str_ptr != NULL; str_ptr=str_ptr->prev) { ! for (c_ptr=str_ptr->dyn_str.s; *c_ptr != '\0'; c_ptr++) { ! if (((*c_ptr)&0x80) && *charCodeToName[(int)(*c_ptr-'\200')]=='8') { encodeFont[index] = TRUE; flag_ptr = encodeCharFlags[index]; *************** *** 534,574 **** flag_ptr[byte_index] |= (1<<(((*c_ptr) & 0x7f) % 8)); } } } static ! void PrepareObjFontInfo (ObjPtr) ! register struct ObjRec * ObjPtr; { ! register struct ObjRec * obj_ptr; ! register struct AttrRec * attr_ptr; ! for (obj_ptr = ObjPtr; obj_ptr != NULL; obj_ptr = obj_ptr->prev) ! { ! switch (obj_ptr->type) ! { ! case OBJ_TEXT: PrepareText (obj_ptr->detail.t); break; ! ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: PrepareObjFontInfo (obj_ptr->detail.r->last); break; } - for (attr_ptr=obj_ptr->lattr; attr_ptr!=NULL; attr_ptr=attr_ptr->prev) - PrepareText (attr_ptr->obj->detail.t); } } ! void PrepareEightBitFontInfo () { ! register struct ObjRec * obj_ptr; ! register struct AttrRec * attr_ptr; ! register int j, i; ! short * flag_ptr; ! struct PageRec * page_ptr; ! if (encodeCharFlagsAllocated && numEncodeCharFonts < numFonts) ! CleanUpEncodeCharFonts (); ! if (!encodeCharFlagsAllocated) ! { int font_count=0; --- 526,566 ---- flag_ptr[byte_index] |= (1<<(((*c_ptr) & 0x7f) % 8)); } + } } } static ! void PrepareObjFontInfo(ObjPtr) ! register struct ObjRec *ObjPtr; { ! register struct ObjRec *obj_ptr; ! register struct AttrRec *attr_ptr; ! for (obj_ptr=ObjPtr; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! switch (obj_ptr->type) { ! case OBJ_TEXT: PrepareText(obj_ptr->detail.t); break; ! ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: PrepareObjFontInfo(obj_ptr->detail.r->last); break; ! } ! for (attr_ptr=obj_ptr->lattr; attr_ptr!=NULL; attr_ptr=attr_ptr->prev) { ! PrepareText(attr_ptr->obj->detail.t); } } } ! void PrepareEightBitFontInfo() { ! register struct ObjRec *obj_ptr; ! register struct AttrRec *attr_ptr; ! register int j, i; ! short *flag_ptr; ! struct PageRec *page_ptr; ! if (encodeCharFlagsAllocated && numEncodeCharFonts < numFonts) { ! CleanUpEncodeCharFonts(); ! } ! if (!encodeCharFlagsAllocated) { int font_count=0; *************** *** 588,678 **** } ! for (i = 0; i < numEncodeCharFonts*MAXFONTSTYLES; i++) ! { encodeFont[i] = FALSE; flag_ptr = encodeCharFlags[i]; ! for (j = 0; j < 16; j++) flag_ptr[j] = 0; } ! for (page_ptr = firstPage; page_ptr != NULL; page_ptr = page_ptr->next) ! for (obj_ptr = page_ptr->bot; obj_ptr != NULL; obj_ptr = obj_ptr->prev) ! { ! switch (obj_ptr->type) ! { ! case OBJ_TEXT: PrepareText (obj_ptr->detail.t); break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: PrepareObjFontInfo (obj_ptr->detail.r->last); break; } - for (attr_ptr=obj_ptr->lattr; attr_ptr!=NULL; attr_ptr=attr_ptr->prev) - PrepareText (attr_ptr->obj->detail.t); } } ! int NeedEncode (FontIndex, StyleIndex) ! int FontIndex, StyleIndex; { ! if (FontIndex == FONT_SYM) ! return (FALSE); ! else ! return (encodeFont[FontIndex*MAXFONTSTYLES+StyleIndex]); } ! void GetPSFontStr (FontIndex, StyleIndex, FontStr) ! int FontIndex, StyleIndex; ! char * FontStr; { ! if (PRTGIF) ! { ! if (FontIndex < MAXFONTS) ! sprintf (FontStr, "/%s", initFontInfoStr[InfoIndex(FontIndex,StyleIndex)+2]); ! else ! sprintf (FontStr, "/%s", fontFamilies[FontIndex].name_faked); ! } ! else ! { ! if (FontIndex < numFonts) ! sprintf (FontStr, "/%s", fontInfoStr[InfoIndex(FontIndex,StyleIndex)+2]); ! else ! sprintf (FontStr, "/%s", fontFamilies[FontIndex].name_faked); } } ! int GetFontIndex (FontStr, StyleIndex, MustFind) ! char * FontStr; ! int StyleIndex; ! int MustFind; { ! register int i; ! if (PRTGIF) ! { ! for (i=0; i < MAXFONTS; i++) if (strcmp (initFontInfoStr[(i*MAXFONTSTYLES+StyleIndex)*3+2], ! FontStr) == 0) ! return (i); ! for ( ; i < MAXFONTS+numFakedFonts; i++) ! if (strcmp (fontFamilies[i].name_faked, FontStr) == 0) ! return (i); ! } ! else ! { ! for (i=0; i < numFonts; i++) if (strcmp (fontInfoStr[(i*MAXFONTSTYLES+StyleIndex)*3+2], ! FontStr) == 0) ! return (i); ! for ( ; i < numFonts+numFakedFonts; i++) ! if (strcmp (fontFamilies[i].name_faked, FontStr) == 0) ! return (i); } ! if (MustFind) return (INVALID); ! if (PRTGIF) ! { numFakedFonts++; if (fontFamilies == NULL) { --- 580,673 ---- } ! for (i=0; i < numEncodeCharFonts*MAXFONTSTYLES; i++) { encodeFont[i] = FALSE; flag_ptr = encodeCharFlags[i]; ! for (j=0; j < 16; j++) flag_ptr[j] = 0; } ! for (page_ptr=firstPage; page_ptr != NULL; page_ptr=page_ptr->next) { ! for (obj_ptr=page_ptr->bot; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! switch (obj_ptr->type) { ! case OBJ_TEXT: PrepareText(obj_ptr->detail.t); break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: PrepareObjFontInfo(obj_ptr->detail.r->last); break; ! } ! for (attr_ptr=obj_ptr->lattr; attr_ptr!=NULL; ! attr_ptr=attr_ptr->prev) { ! PrepareText(attr_ptr->obj->detail.t); } } + } } ! int NeedEncode(FontIndex, StyleIndex) ! int FontIndex, StyleIndex; { ! if (FontIndex == FONT_SYM) { ! return FALSE; ! } ! return encodeFont[FontIndex*MAXFONTSTYLES+StyleIndex]; } ! void GetPSFontStr(FontIndex, StyleIndex, FontStr) ! int FontIndex, StyleIndex; ! char *FontStr; { ! if (PRTGIF) { ! if (FontIndex < MAXFONTS) { ! sprintf(FontStr, "/%s", initFontInfoStr[InfoIndex(FontIndex,StyleIndex)+2]); ! } else { ! sprintf(FontStr, "/%s", fontFamilies[FontIndex].name_faked); ! } ! } else { ! if (FontIndex < numFonts) { ! sprintf(FontStr, "/%s", fontInfoStr[InfoIndex(FontIndex,StyleIndex)+2]); ! } else { ! sprintf(FontStr, "/%s", fontFamilies[FontIndex].name_faked); ! } } } ! int GetFontIndex(FontStr, StyleIndex, MustFind) ! char *FontStr; ! int StyleIndex; ! int MustFind; { ! register int i; ! if (PRTGIF) { ! for (i=0; i < MAXFONTS; i++) { if (strcmp (initFontInfoStr[(i*MAXFONTSTYLES+StyleIndex)*3+2], ! FontStr) == 0) { ! return i; ! } ! } ! for ( ; i < MAXFONTS+numFakedFonts; i++) { ! if (strcmp (fontFamilies[i].name_faked, FontStr) == 0) { ! return i; ! } ! } ! } else { ! for (i=0; i < numFonts; i++) { if (strcmp (fontInfoStr[(i*MAXFONTSTYLES+StyleIndex)*3+2], ! FontStr) == 0) { ! return i; ! } ! } ! for ( ; i < numFonts+numFakedFonts; i++) { ! if (strcmp (fontFamilies[i].name_faked, FontStr) == 0) { ! return i; ! } ! } } ! if (MustFind) return INVALID; ! if (PRTGIF) { numFakedFonts++; if (fontFamilies == NULL) { *************** *** 680,684 **** (MAXFONTS+numFakedFonts)*sizeof(struct FontFmlyRec)); } else { ! fontFamilies = (struct FontFmlyRec *) realloc (fontFamilies, (MAXFONTS+numFakedFonts)*sizeof(struct FontFmlyRec)); } --- 675,679 ---- (MAXFONTS+numFakedFonts)*sizeof(struct FontFmlyRec)); } else { ! fontFamilies = (struct FontFmlyRec *)realloc(fontFamilies, (MAXFONTS+numFakedFonts)*sizeof(struct FontFmlyRec)); } *************** *** 695,701 **** } return (MAXFONTS+numFakedFonts-1); ! } ! else ! { numFakedFonts++; if (fontFamilies == NULL) { --- 690,694 ---- } return (MAXFONTS+numFakedFonts-1); ! } else { numFakedFonts++; if (fontFamilies == NULL) { *************** *** 703,707 **** (numFonts+numFakedFonts)*sizeof(struct FontFmlyRec)); } else { ! fontFamilies = (struct FontFmlyRec *) realloc (fontFamilies, (numFonts+numFakedFonts)*sizeof(struct FontFmlyRec)); } --- 696,700 ---- (numFonts+numFakedFonts)*sizeof(struct FontFmlyRec)); } else { ! fontFamilies = (struct FontFmlyRec *)realloc(fontFamilies, (numFonts+numFakedFonts)*sizeof(struct FontFmlyRec)); } *************** *** 738,773 **** } ! void DumpEightBitFontInfo (FP) ! FILE * FP; { ! register int k, j; ! register short * flag_ptr, flag; ! int font_index, style_index; ! char font_str[MAXSTRING]; ! int font_count; font_count = (PRTGIF ? MAXFONTS+numFakedFonts : numFonts+numFakedFonts); ! for (font_index = 0; font_index < font_count; font_index++) ! { ! for (style_index = 0; style_index < MAXFONTSTYLES; style_index++) ! { ! if (NeedEncode (font_index, style_index)) ! { ! GetPSFontStr (font_index, style_index, font_str); ! fprintf (FP, "%s-vec [\n", font_str); flag_ptr = encodeCharFlags[font_index*MAXFONTSTYLES+style_index]; ! for (j = 0; j < 16; j++, flag_ptr++) ! { flag = *flag_ptr; ! if ((flag & 0xff) != 0) ! { ! for (k = 0; k < 8; k++) ! if (flag & (1<prev = last_fmly; fmly_ptr->font_strings = font_strings; ! if (last_fmly == NULL) first_fmly = fmly_ptr; ! else last_fmly->next = fmly_ptr; last_fmly = fmly_ptr; } if (font_ptr-buf >= len) break; } ! if (ok) ! { ! struct TmpFontFmlyRec * next_fmly; numFonts = MAXFONTS+num_new_fonts; --- 1001,1015 ---- fmly_ptr->prev = last_fmly; fmly_ptr->font_strings = font_strings; ! if (last_fmly == NULL) { first_fmly = fmly_ptr; ! } else { last_fmly->next = fmly_ptr; + } last_fmly = fmly_ptr; } if (font_ptr-buf >= len) break; } ! if (ok) { ! struct TmpFontFmlyRec *next_fmly=NULL; numFonts = MAXFONTS+num_new_fonts; *************** *** 1040,1047 **** for (fmly_ptr=first_fmly, fmly_index=MAXFONTS; fmly_ptr != NULL; fmly_ptr=next_fmly, fmly_index++) { ! char s[81]; next_fmly = fmly_ptr->next; ! strcpy (s, fmly_ptr->font_strings[2]); if ((c_ptr=strchr(s,'-')) != NULL) *c_ptr='\0'; fontMenuStr[fmly_index] = --- 1025,1032 ---- for (fmly_ptr=first_fmly, fmly_index=MAXFONTS; fmly_ptr != NULL; fmly_ptr=next_fmly, fmly_index++) { ! char s[MAXSTRING]; next_fmly = fmly_ptr->next; ! strcpy(s, fmly_ptr->font_strings[2]); if ((c_ptr=strchr(s,'-')) != NULL) *c_ptr='\0'; fontMenuStr[fmly_index] = *************** *** 1069,1074 **** free(buf); } ! if (fontFamilies == NULL) ! { fontFamilies = (struct FontFmlyRec *)malloc(numFonts*sizeof(struct FontFmlyRec)); --- 1054,1058 ---- free(buf); } ! if (fontFamilies == NULL) { fontFamilies = (struct FontFmlyRec *)malloc(numFonts*sizeof(struct FontFmlyRec)); *************** *** 1083,1091 **** i = 0; fmly_index = 0; ! for (fmly_index=0; fmly_index < MAXFONTS; fmly_index++) ! { ! char s[81]; ! strcpy (s, initFontInfoStr[i+2]); if ((c_ptr=strchr(s,'-')) != NULL) *c_ptr='\0'; fontMenuStr[fmly_index] = (char*)malloc((strlen(s)+1)*sizeof(char)); --- 1067,1074 ---- i = 0; fmly_index = 0; ! for (fmly_index=0; fmly_index < MAXFONTS; fmly_index++) { ! char s[MAXSTRING]; ! strcpy(s, initFontInfoStr[i+2]); if ((c_ptr=strchr(s,'-')) != NULL) *c_ptr='\0'; fontMenuStr[fmly_index] = (char*)malloc((strlen(s)+1)*sizeof(char)); *************** *** 1098,1110 **** initFontInfoStr[i+2])) != NULL) { if (strstr(c_ptr, "%d") != NULL) { ! len = strlen (c_ptr); altFontInfoStr[i] = (char*)malloc((len+1)*sizeof(char)); if (altFontInfoStr[i] == NULL) FailAllocMessage(); strcpy(altFontInfoStr[i], c_ptr); fontInfoStr[i] = altFontInfoStr[i]; ! } ! else ! { ! fprintf (stderr, "%s '%s*%s'.\n\t'%s-%s-*-%%d-*-*-*-*-*-%s' used.\n", "Warning: Error in processing", --- 1081,1091 ---- initFontInfoStr[i+2])) != NULL) { if (strstr(c_ptr, "%d") != NULL) { ! len = strlen(c_ptr); altFontInfoStr[i] = (char*)malloc((len+1)*sizeof(char)); if (altFontInfoStr[i] == NULL) FailAllocMessage(); strcpy(altFontInfoStr[i], c_ptr); fontInfoStr[i] = altFontInfoStr[i]; ! } else { ! fprintf(stderr, "%s '%s*%s'.\n\t'%s-%s-*-%%d-*-*-*-*-*-%s' used.\n", "Warning: Error in processing", *************** *** 1114,1124 **** fontInfoStr[i] = initFontInfoStr[i]; } ! } ! else fontInfoStr[i] = initFontInfoStr[i]; } ! } ! else ! { fontInfoStr[i] = initFontInfoStr[i]; i++; fontInfoStr[i] = initFontInfoStr[i]; i++; --- 1095,1103 ---- fontInfoStr[i] = initFontInfoStr[i]; } ! } else { fontInfoStr[i] = initFontInfoStr[i]; + } } ! } else { fontInfoStr[i] = initFontInfoStr[i]; i++; fontInfoStr[i] = initFontInfoStr[i]; i++; *** frontend.c.orig Tue Sep 30 13:23:14 1997 --- frontend.c Tue Sep 30 13:23:15 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/frontend.c,v 3.0 1996/05/06 16:05:14 william Exp $"; - #endif int lastFile; --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/frontend.c,v 3.1 1997/09/14 20:37:51 william Exp $ */ int lastFile; *** ftp.c.orig Tue Sep 30 13:23:16 1997 --- ftp.c Tue Sep 30 13:23:16 1997 *************** *** 6,10 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 6,10 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 31,39 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ftp.c,v 3.3 1997/01/30 05:55:03 william Exp $"; - #endif #include --- 31,37 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ftp.c,v 3.4 1997/09/14 20:37:51 william Exp $ */ #include *** grid.c.orig Tue Sep 30 13:23:17 1997 --- grid.c Tue Sep 30 13:23:17 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/grid.c,v 3.7 1997/01/29 22:41:56 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/grid.c,v 3.9 1997/09/14 20:37:51 william Exp $ */ #include *************** *** 1030,1034 **** void SetPSPageWidthHeight () { ! if (mainWindow != None) { sprintf (psYOffStr[0], "%.2f", --- 1028,1032 ---- void SetPSPageWidthHeight () { ! if (psYOffStr != NULL && psYOff != NULL) { sprintf (psYOffStr[0], "%.2f", *** group.c.orig Tue Sep 30 13:23:19 1997 --- group.c Tue Sep 30 13:23:19 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/group.c,v 3.0 1996/05/06 16:05:24 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/group.c,v 3.2 1997/09/16 20:34:39 william Exp $ */ #include *************** *** 55,65 **** #include "setup.e" ! static struct SelRec * tmpTopSel, * tmpBotSel; ! void CreateGroupObj (TopObjPtr, BotObjPtr) ! struct ObjRec * TopObjPtr, * BotObjPtr; { ! struct GroupRec * group_ptr; ! struct ObjRec * obj_ptr; group_ptr = (struct GroupRec *)malloc(sizeof(struct GroupRec)); --- 53,63 ---- #include "setup.e" ! static struct SelRec *tmpTopSel=NULL, *tmpBotSel=NULL; ! void CreateGroupObj(TopObjPtr, BotObjPtr) ! struct ObjRec *TopObjPtr, *BotObjPtr; { ! struct GroupRec *group_ptr; ! struct ObjRec *obj_ptr; group_ptr = (struct GroupRec *)malloc(sizeof(struct GroupRec)); *************** *** 92,158 **** obj_ptr->invisible = FALSE; if (numObjLocked > 0) obj_ptr->locked = TRUE; ! AddObj (NULL, topObj, obj_ptr); } ! void SaveGroupObj (FP, ObjPtr, Level) ! FILE * FP; ! struct ObjRec * ObjPtr; ! int Level; ! { ! if (fprintf (FP, "group([\n") == EOF) writeFileFailed = TRUE; ! Save (FP, ObjPtr->detail.r->last, Level+1, INVALID); ! if (fprintf (FP, "],\n") == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,", ObjPtr->id, ObjPtr->locked, ObjPtr->invisible) == EOF) { writeFileFailed = TRUE; } ! SaveAttrs (FP, ObjPtr->lattr); ! if (fprintf (FP, ")") == EOF) writeFileFailed = TRUE; } ! void SaveCompObj (FP, ObjPtr, Level) ! FILE * FP; ! struct ObjRec * ObjPtr; ! int Level; ! { ! if (fprintf (FP, "sym([\n") == EOF) writeFileFailed = TRUE; ! Save (FP, ObjPtr->detail.r->last, Level+1, INVALID); ! if (fprintf (FP, "],\n") == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,", ObjPtr->id, ObjPtr->locked, ObjPtr->invisible) == EOF) { writeFileFailed = TRUE; } ! SaveAttrs (FP, ObjPtr->lattr); ! if (fprintf (FP, ")") == EOF) writeFileFailed = TRUE; } ! void SaveIconObj (FP, ObjPtr, Level) ! FILE * FP; ! struct ObjRec * ObjPtr; ! int Level; ! { ! if (fprintf (FP, "icon([\n") == EOF) writeFileFailed = TRUE; ! Save (FP, ObjPtr->detail.r->last, Level+1, INVALID); ! if (fprintf (FP, "],\n") == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "\"%s\",%1d,%1d,%1d,%1d,%1d,", ObjPtr->detail.r->s, ObjPtr->id, ObjPtr->detail.r->rotate, ObjPtr->detail.r->flip, ObjPtr->locked, ObjPtr->invisible) == EOF) { writeFileFailed = TRUE; } ! SaveAttrs (FP, ObjPtr->lattr); ! if (fprintf (FP, ")") == EOF) writeFileFailed = TRUE; } ! void ReadGroupObj (FP, ObjType, ObjPtr) ! FILE * FP; ! int ObjType; ! struct ObjRec * * ObjPtr; ! { ! struct GroupRec * group_ptr; ! struct ObjRec * top_obj = NULL, * bot_obj = NULL, * obj_ptr; ! int ltx, lty, rbx, rby, id=0, locked=FALSE; ! int obj_ltx, obj_lty, obj_rbx, obj_rby, rotate=0, flip=0; ! int invisible=FALSE; ! char line[MAXSTRING+1], * s, * s1, tmp_str[MAXSTRING+1]; *ObjPtr = NULL; --- 90,156 ---- obj_ptr->invisible = FALSE; if (numObjLocked > 0) obj_ptr->locked = TRUE; ! AddObj(NULL, topObj, obj_ptr); } ! void SaveGroupObj(FP, ObjPtr, Level) ! FILE *FP; ! struct ObjRec *ObjPtr; ! int Level; ! { ! if (fprintf(FP, "group([\n") == EOF) writeFileFailed = TRUE; ! Save(FP, ObjPtr->detail.r->last, Level+1, INVALID); ! if (fprintf(FP, "],\n") == EOF) writeFileFailed = TRUE; ! if (fprintf(FP, "%1d,%1d,%1d,", ObjPtr->id, ObjPtr->locked, ObjPtr->invisible) == EOF) { writeFileFailed = TRUE; } ! SaveAttrs(FP, ObjPtr->lattr); ! if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; } ! void SaveCompObj(FP, ObjPtr, Level) ! FILE *FP; ! struct ObjRec *ObjPtr; ! int Level; ! { ! if (fprintf(FP, "sym([\n") == EOF) writeFileFailed = TRUE; ! Save(FP, ObjPtr->detail.r->last, Level+1, INVALID); ! if (fprintf(FP, "],\n") == EOF) writeFileFailed = TRUE; ! if (fprintf(FP, "%1d,%1d,%1d,", ObjPtr->id, ObjPtr->locked, ObjPtr->invisible) == EOF) { writeFileFailed = TRUE; } ! SaveAttrs(FP, ObjPtr->lattr); ! if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; } ! void SaveIconObj(FP, ObjPtr, Level) ! FILE *FP; ! struct ObjRec *ObjPtr; ! int Level; ! { ! if (fprintf(FP, "icon([\n") == EOF) writeFileFailed = TRUE; ! Save(FP, ObjPtr->detail.r->last, Level+1, INVALID); ! if (fprintf(FP, "],\n") == EOF) writeFileFailed = TRUE; ! if (fprintf(FP, "\"%s\",%1d,%1d,%1d,%1d,%1d,", ObjPtr->detail.r->s, ObjPtr->id, ObjPtr->detail.r->rotate, ObjPtr->detail.r->flip, ObjPtr->locked, ObjPtr->invisible) == EOF) { writeFileFailed = TRUE; } ! SaveAttrs(FP, ObjPtr->lattr); ! if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; } ! void ReadGroupObj(FP, ObjType, ObjPtr) ! FILE *FP; ! int ObjType; ! struct ObjRec **ObjPtr; ! { ! struct GroupRec *group_ptr; ! struct ObjRec *top_obj=NULL, *bot_obj=NULL, *obj_ptr; ! int ltx, lty, rbx, rby, id=0, locked=FALSE; ! int obj_ltx, obj_lty, obj_rbx, obj_rby, rotate=0, flip=0; ! int invisible=FALSE; ! char line[MAXSTRING+1], *s, *s1, tmp_str[MAXSTRING+1]; *ObjPtr = NULL; *************** *** 311,317 **** void FreeGroupObj (ObjPtr) ! struct ObjRec * ObjPtr; { ! register struct ObjRec * ptr, * next_obj; for (ptr = ObjPtr->detail.r->first; ptr != NULL; ptr = next_obj) { --- 309,315 ---- void FreeGroupObj (ObjPtr) ! struct ObjRec *ObjPtr; { ! register struct ObjRec *ptr, *next_obj; for (ptr = ObjPtr->detail.r->first; ptr != NULL; ptr = next_obj) { *************** *** 325,329 **** static void UngroupObj (ObjPtr) ! struct ObjRec * ObjPtr; /* ungroup the grouped object ObjPtr to a list of objects */ /* when returns, a list of select pointers will be created, */ --- 323,327 ---- static void UngroupObj (ObjPtr) ! struct ObjRec *ObjPtr; /* ungroup the grouped object ObjPtr to a list of objects */ /* when returns, a list of select pointers will be created, */ *************** *** 331,336 **** /* tmpBotSel will point to the bottom of the list. */ { ! register struct SelRec * sel_ptr; ! register struct ObjRec * obj_ptr = ObjPtr->detail.r->last; tmpTopSel = tmpBotSel = NULL; --- 329,334 ---- /* tmpBotSel will point to the bottom of the list. */ { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr=ObjPtr->detail.r->last; tmpTopSel = tmpBotSel = NULL; *************** *** 354,358 **** int NoObjToUngroup () { ! register struct SelRec * sel_ptr; for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) --- 352,356 ---- int NoObjToUngroup () { ! register struct SelRec *sel_ptr; for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) *************** *** 364,371 **** void UngroupSelObj () { ! register struct SelRec * sel_ptr, * next_sel; ! register struct ObjRec * obj_ptr; ! int sel_ltx, sel_lty, sel_rbx, sel_rby; ! int changed=FALSE; if (topSel==NULL || NoObjToUngroup ()) return; --- 362,369 ---- void UngroupSelObj () { ! register struct SelRec *sel_ptr, *next_sel; ! register struct ObjRec *obj_ptr; ! int sel_ltx, sel_lty, sel_rbx, sel_rby; ! int changed=FALSE; if (topSel==NULL || NoObjToUngroup ()) return; *************** *** 382,387 **** if (obj_ptr->type == OBJ_GROUP) { ! int count; ! struct SelRec * tmp_sel_ptr; changed = TRUE; --- 380,385 ---- if (obj_ptr->type == OBJ_GROUP) { ! int count; ! struct SelRec *tmp_sel_ptr; changed = TRUE; *************** *** 441,447 **** void LockSelObj () { ! register struct SelRec * sel_ptr; ! register struct ObjRec * obj_ptr; ! int changed=FALSE; if (topSel==NULL) { Msg ("No object to lock!"); return; } --- 439,445 ---- void LockSelObj () { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr; ! int changed=FALSE; if (topSel==NULL) { Msg ("No object to lock!"); return; } *************** *** 474,480 **** void UnlockSelObj () { ! register struct SelRec * sel_ptr; ! register struct ObjRec * obj_ptr; ! int changed=FALSE; if (topSel==NULL) { Msg ("No object to unlock!"); return; } --- 472,478 ---- void UnlockSelObj () { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr; ! int changed=FALSE; if (topSel==NULL) { Msg ("No object to unlock!"); return; } *** help.c.orig Tue Sep 30 13:23:20 1997 --- help.c Tue Sep 30 13:23:20 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/help.c,v 3.2 1997/01/30 03:59:40 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/help.c,v 3.9 1997/09/14 20:37:52 william Exp $ */ #include *************** *** 51,54 **** --- 49,53 ---- #include "menu.e" #include "msg.e" + #include "navigate.e" #include "setup.e" #include "util.e" *************** *** 64,70 **** char *helpMenuStr[] = { ! "About ", ! "Copyright ", ! "CurrentVersionInfo ", NULL }; --- 63,69 ---- char *helpMenuStr[] = { ! "About ", ! "Copyright ", ! "LatestReleaseInfo ", NULL }; *************** *** 93,102 **** sprintf(c_ptr, "\n\nWWW Hypertext Home Page: %s", homePageURL); c_ptr = (&c_ptr[strlen(c_ptr)]); ! sprintf(c_ptr, "\n\nCurrent Release Information: %s", currentReleaseURL); c_ptr = (&c_ptr[strlen(c_ptr)]); sprintf(c_ptr, "\n\nWWW Hyper-Graphics Home Page: %s", hyperGraphicsURL); c_ptr = (&c_ptr[strlen(c_ptr)]); ! sprintf(c_ptr, "\n\nPlease send bug reports to %s or %s.", ! "william@cs.ucla.edu", "william@cs.columbia.edu"); c_ptr = (&c_ptr[strlen(c_ptr)]); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); --- 92,100 ---- sprintf(c_ptr, "\n\nWWW Hypertext Home Page: %s", homePageURL); c_ptr = (&c_ptr[strlen(c_ptr)]); ! sprintf(c_ptr, "\n\nLatest Release Information: %s", currentReleaseURL); c_ptr = (&c_ptr[strlen(c_ptr)]); sprintf(c_ptr, "\n\nWWW Hyper-Graphics Home Page: %s", hyperGraphicsURL); c_ptr = (&c_ptr[strlen(c_ptr)]); ! sprintf(c_ptr, "\n\nPlease send bug reports to %s.", "bill.cheng@acm.org"); c_ptr = (&c_ptr[strlen(c_ptr)]); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); *************** *** 147,151 **** } ! void CurrentVersionInfo() { char tmp_fname[MAXPATHLENGTH+1], final_url[MAXPATHLENGTH+1]; --- 145,149 ---- } ! void LatestReleaseInfo() { char tmp_fname[MAXPATHLENGTH+1], final_url[MAXPATHLENGTH+1]; *************** *** 156,161 **** --- 154,161 ---- *final_url = '\0'; strcpy(current_url, currentReleaseURL); + navigateRefresh = TRUE; rc = DownloadRemoteFile(current_url, &content_type, &page_spec, &is_html, tmp_fname, final_url, sizeof(final_url)); + navigateRefresh = FALSE; if (content_type != NULL) FreeRemoteBuf(content_type); if (page_spec != NULL) UtilFree(page_spec); *************** *** 167,171 **** if (fp == NULL) { sprintf(gszMsgBox, "%s '%s' %s.\n\n%s %s %s.", ! "Fail to open", tmp_fname, "for reading", "Please view", currentReleaseURL, "with a web browser"); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); --- 167,171 ---- if (fp == NULL) { sprintf(gszMsgBox, "%s '%s' %s.\n\n%s %s %s.", ! "Fail to open", currentReleaseURL, "for reading", "Please view", currentReleaseURL, "with a web browser"); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); *************** *** 194,210 **** } fclose(fp); } - if (*version_str == '\0') { - sprintf(gszMsgBox, "%s '%s'.\n\n%s %s %s.", - "Fail to find version information in", currentReleaseURL, - "Please view", currentReleaseURL, "with a web browser"); - } else { - sprintf(gszMsgBox, "%s %s %s.\n\n%s %s %s.", - TOOL_NAME, "is currently at", version_str, - "For download information, please visit", - (*final_url=='\0' ? currentReleaseURL : final_url), - "with a web browser"); - } - MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } else { sprintf(gszMsgBox, "%s '%s' %s.\n\n%s %s %s.", --- 194,220 ---- } fclose(fp); + + if (*version_str == '\0') { + sprintf(gszMsgBox, "%s '%s'.\n\n%s %s %s.", + "Fail to find version information in", currentReleaseURL, + "Please view", currentReleaseURL, "with a web browser"); + } else if (TGIF_PATCHLEVEL == 0) { + sprintf(gszMsgBox, "%s %s %s %s %s %s %s.\n\n%s %s %s.", + TOOL_NAME, "is currently at", version_str, + "and this", TOOL_NAME, "is Version", versionString, + "For download information, please visit", + (*final_url=='\0' ? currentReleaseURL : final_url), + "with a web browser"); + } else { + sprintf(gszMsgBox, "%s %s %s %s %s %s %s %s %1d.\n\n%s %s %s.", + TOOL_NAME, "is currently at", version_str, + "and this", TOOL_NAME, "is Version", versionString, + "Patchlevel", TGIF_PATCHLEVEL, + "For download information, please visit", + (*final_url=='\0' ? currentReleaseURL : final_url), + "with a web browser"); + } + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } } else { sprintf(gszMsgBox, "%s '%s' %s.\n\n%s %s %s.", *************** *** 234,238 **** case HELP_ABOUT: About(); break; case HELP_COPYRIGHT: Copyright(); break; ! case HELP_CURRENT: CurrentVersionInfo(); break; } } --- 244,248 ---- case HELP_ABOUT: About(); break; case HELP_COPYRIGHT: Copyright(); break; ! case HELP_CURRENT: LatestReleaseInfo(); break; } } *** http.c.orig Tue Sep 30 13:23:21 1997 --- http.c Tue Sep 30 13:23:21 1997 *************** *** 6,10 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 6,10 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 31,39 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/http.c,v 3.6 1997/01/30 05:32:52 william Exp $"; - #endif #include --- 31,37 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/http.c,v 3.7 1997/09/14 20:37:52 william Exp $ */ #include *** imgproc.c.orig Tue Sep 30 13:23:23 1997 --- imgproc.c Tue Sep 30 13:23:23 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/imgproc.c,v 3.9 1997/01/30 06:03:16 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/imgproc.c,v 3.10 1997/09/14 20:37:53 william Exp $ */ #include *** import.c.orig Tue Sep 30 13:23:25 1997 --- import.c Tue Sep 30 13:23:25 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/import.c,v 3.6 1996/11/03 20:31:10 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/import.c,v 3.8 1997/09/14 20:37:53 william Exp $ */ #include *************** *** 110,119 **** #ifndef _NO_EXTERN ! #ifdef SYSV extern unsigned sleep ARGS_DECL((unsigned)); ! #else /* !SYSV */ extern int sleep ARGS_DECL((unsigned)); ! #endif /* SYSV */ ! #endif /* !_NO_EXTERN */ typedef struct ImportInfoRec { --- 108,117 ---- #ifndef _NO_EXTERN ! #if defined(SYSV) || defined(_AIX) extern unsigned sleep ARGS_DECL((unsigned)); ! #else /* ~(defined(SYSV) || defined(_AIX)) */ extern int sleep ARGS_DECL((unsigned)); ! #endif /* defined(SYSV) || defined(_AIX) */ ! #endif /* ~_NO_EXTERN */ typedef struct ImportInfoRec { *** mainloop.c.orig Tue Sep 30 13:23:27 1997 --- mainloop.c Tue Sep 30 13:23:27 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mainloop.c,v 3.8 1997/01/30 04:34:04 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mainloop.c,v 3.18 1997/09/17 15:57:51 william Exp $ */ #include *************** *** 43,46 **** --- 41,47 ---- #include #endif + #ifdef _LOCALE_SUPPORT + #include + #endif /* _LOCALE_SUPPORT */ #include "const.h" #include "patchlvl.h" *************** *** 57,60 **** --- 58,62 ---- #include "drawing.e" #include "edit.e" + #include "eps.e" #include "exec.e" #include "expr.e" *************** *** 110,113 **** --- 112,116 ---- #endif /* USE_XAPPLRESDIR */ + int x11R6OrAbove = FALSE; int origArgC = 0; char * * origArgV = NULL; *************** *** 123,127 **** char geometrySpec[80]; char * displayName = NULL; - char initMsg1[80], initMsg2[80]; int numExtraWins = 0; --- 126,129 ---- *************** *** 134,155 **** #endif /* USE_XAPPLRESDIR */ ! int AddExtraWinInfo (win, mapped, raise, expose_handler, ev_handler, cleanup_routine) ! Window win; ! int mapped, raise; ! void (* expose_handler)(); ! int (* ev_handler)(); ! void (* cleanup_routine)(); { ! register int i; ! for (i = 0; i < numExtraWins; i++) ! if (extraWinInfo[i].window == None) break; ! ! if (i == numExtraWins && numExtraWins == maxExtraWins) ! { maxExtraWins += 10; ! extraWinInfo = (struct WinInfoRec *) realloc (extraWinInfo, maxExtraWins*sizeof(struct WinInfoRec)); } --- 136,157 ---- #endif /* USE_XAPPLRESDIR */ ! int AddExtraWinInfo(win, mapped, raise, expose_handler, ev_handler, cleanup_routine) ! Window win; ! int mapped, raise; ! void (*expose_handler)(); ! int (*ev_handler)(); ! void (*cleanup_routine)(); { ! register int i; ! for (i = 0; i < numExtraWins; i++) { ! if (extraWinInfo[i].window == None) { break; ! } ! } ! if (i == numExtraWins && numExtraWins == maxExtraWins) { maxExtraWins += 10; ! extraWinInfo = (struct WinInfoRec *)realloc(extraWinInfo, maxExtraWins*sizeof(struct WinInfoRec)); } *************** *** 164,168 **** static ! void InitExtraWinInfo () { extraWinInfo = (struct WinInfoRec *)malloc(10*sizeof(struct WinInfoRec)); --- 166,170 ---- static ! void InitExtraWinInfo() { extraWinInfo = (struct WinInfoRec *)malloc(10*sizeof(struct WinInfoRec)); *************** *** 173,179 **** static ! void CleanUpExtraWinInfo () { ! register int i; if (extraWinInfo != NULL) { --- 175,181 ---- static ! void CleanUpExtraWinInfo() { ! register int i; if (extraWinInfo != NULL) { *************** *** 191,212 **** static ! void ExecWithFile (CmdName, FileName) ! char * CmdName, * FileName; { ! char s[255]; #ifdef _BACKGROUND_DONT_FORK ! sprintf (s, "xterm -bd red -e %s %s", CmdName, FileName); strcat(s, " &"); system(s); #else /* ~_BACKGROUND_DONT_FORK */ ! int pid; ! sprintf (s, "xterm -bd red -e %s %s", CmdName, FileName); ! pid = fork (); ! if (pid == 0) ! { system(s); ! exit (0); } #endif /* _BACKGROUND_DONT_FORK */ --- 193,213 ---- static ! void ExecWithFile(CmdName, FileName) ! char *CmdName, *FileName; { ! char s[255]; #ifdef _BACKGROUND_DONT_FORK ! sprintf(s, "xterm -bd red -e %s %s", CmdName, FileName); strcat(s, " &"); system(s); #else /* ~_BACKGROUND_DONT_FORK */ ! int pid; ! sprintf(s, "xterm -bd red -e %s %s", CmdName, FileName); ! pid = fork(); ! if (pid == 0) { system(s); ! exit(0); } #endif /* _BACKGROUND_DONT_FORK */ *************** *** 249,312 **** /* * static ! * int MyErrorHandler (display, event) ! * Display * display; ! * XErrorEvent * event; * { ! * if (event->type == 0) return (TRUE); ! * printf ("\tError: type -- %1d\n", event->type); ! * exit (-1); * } */ ! void CleanUp () { ! TieLooseEnds (); ! ResetPSInfo (); ! CleanUpEdit (); ! CleanUpShape (); ! CleanUpHelp (); ! CleanUpImport (); ! CleanUpImageProc (); ! CleanUpExec (); ! CleanUpCmds (); ! CleanUpExpr (); ! CleanUpNavigate (); ! CleanUpRemote (); ! ! CleanUpExtraWinInfo (); ! CleanUpDrawingWindow (); ! CleanUpPage (); ! CleanUpStk (); ! CleanUpStatus (); ! CleanUpChoices (); ! ! CleanUpScrolls (); ! CleanUpCursors (); ! ! CleanUpNames (); ! CleanUpRuler (); ! CleanUpRasters (); ! CleanUpFonts (); ! CleanUpMenu (); ! CleanUpText (); ! CleanUpColors (); ! CleanUpFiles (); ! CleanUpGrids (); ! CleanUpCutBuffer (); ! CleanUpXBm (); ! CleanUpXPm (); ! CleanUpMsg (); ! CleanUpShortCut (); ! if (iconWindowCreated) ! { ! XDestroyWindow (mainDisplay, iconBaseWindow); iconWindowCreated = FALSE; } ! CleanUpResiduals (); ! XDestroyWindow (mainDisplay, mainWindow); #ifndef DONT_FREE_COLORMAP ! if (newColormapUsed) XFreeColormap (mainDisplay, mainColormap); #endif /* ~DONT_FREE_COLORMAP */ } --- 250,312 ---- /* * static ! * int MyErrorHandler(display, event) ! * Display *display; ! * XErrorEvent *event; * { ! * if (event->type == 0) return TRUE; ! * printf("\tError: type -- %1d\n", event->type); ! * exit(-1); * } */ ! void CleanUp() { ! TieLooseEnds(); ! ResetPSInfo(); ! CleanUpEdit(); ! CleanUpShape(); ! CleanUpHelp(); ! CleanUpImport(); ! CleanUpImageProc(); ! CleanUpExec(); ! CleanUpCmds(); ! CleanUpExpr(); ! CleanUpNavigate(); ! CleanUpRemote(); ! ! CleanUpExtraWinInfo(); ! CleanUpDrawingWindow(); ! CleanUpPage(); ! CleanUpStk(); ! CleanUpStatus(); ! CleanUpChoices(); ! ! CleanUpScrolls(); ! CleanUpCursors(); ! ! CleanUpNames(); ! CleanUpRuler(); ! CleanUpRasters(); ! CleanUpFonts(); ! CleanUpMenu(); ! CleanUpText(); ! CleanUpColors(); ! CleanUpFiles(); ! CleanUpGrids(); ! CleanUpCutBuffer(); ! CleanUpXBm(); ! CleanUpXPm(); ! CleanUpMsg(); ! CleanUpShortCut(); ! if (iconWindowCreated) { ! XDestroyWindow(mainDisplay, iconBaseWindow); iconWindowCreated = FALSE; } ! CleanUpResiduals(); ! XDestroyWindow(mainDisplay, mainWindow); #ifndef DONT_FREE_COLORMAP ! if (newColormapUsed) XFreeColormap(mainDisplay, mainColormap); #endif /* ~DONT_FREE_COLORMAP */ } *************** *** 374,378 **** } else if (input->xany.window==mainWindow && input->type==VisibilityNotify && input->xvisibility.state==VisibilityUnobscured) { ! XEvent tmp_ev; while (XCheckWindowEvent(mainDisplay, mainWindow, VisibilityChangeMask, --- 374,378 ---- } else if (input->xany.window==mainWindow && input->type==VisibilityNotify && input->xvisibility.state==VisibilityUnobscured) { ! XEvent tmp_ev; while (XCheckWindowEvent(mainDisplay, mainWindow, VisibilityChangeMask, *************** *** 435,904 **** #endif /* USE_XAPPLRESDIR */ ! void MainLoop (Op, FileName, FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3) ! char * Op, * FileName, * * FuncStr; ! char * * Str1, * * Menu1, * * Str2, * * Menu2, * * Str3, * * Menu3; { ! XEvent input; ! char *c_ptr=NULL, file_name[MAXPATHLENGTH+1]; ! char full_name[MAXPATHLENGTH+1], *rest, s[MAXPATHLENGTH+1]; ! int rc, len=0, i, read_status, short_name=FALSE; ! struct ObjRec *obj_ptr=NULL; ! FILE *fp=NULL; ! int tmp_linenum, obj_ext_len, need_to_check_auto_exec=FALSE; ! char tmp_filename[MAXPATHLENGTH+1], obj_ext_str[MAXSTRING+1]; ! ! /* printf ("--> MainLoop (%s, %s, ...)\n", Op, FileName); */ ! ! if (strcmp (Op, "init") == 0 || strcmp (Op, "justinit") == 0) ! { ! int file_is_remote=FALSE, remote_buf_sz=0, is_html=FALSE; ! char remote_fname[MAXPATHLENGTH+1], *tmp_remote_fname=NULL; ! char * remote_buf=NULL, *page_spec=NULL; #ifdef USE_XAPPLRESDIR ! FILE * xenv_fp; ! char tmp_buf[MAXPATHLENGTH+1]; #endif /* USE_XAPPLRESDIR */ ! ! if (TGIF_PATCHLEVEL == 0) ! sprintf (initMsg1, "%s Version %s", TOOL_NAME, versionString); ! else ! sprintf (initMsg1, "%s Version %s (patchlevel %1d)", TOOL_NAME, ! versionString, TGIF_PATCHLEVEL); ! sprintf (initMsg2, "%s %s", copyrightString, "(william@cs.UCLA.edu)"); ! TwoLineMsg (initMsg1, initMsg2); ! if (!cmdLineDumpURL) { ! fprintf (stderr, "%s\n", initMsg1); ! fprintf (stderr, "%s\n", initMsg2); ! } ! fflush(stderr); ! ! exitNormally = FALSE; #ifdef USE_XAPPLRESDIR #ifdef XAPPLOADDIR_DEF ! if (getenv ("XENVIRONMENT") == NULL) ! { ! if (((c_ptr=getenv("XAPPLRESDIR")) == NULL)) { ! UtilStrCpy(tmp_buf, sizeof(tmp_buf), XAPPLOADDIR_DEF); ! } else if (!FindXApplResDir(c_ptr, tmp_buf, sizeof(tmp_buf)) { ! UtilStrCpy(tmp_buf, sizeof(tmp_buf), XAPPLOADDIR_DEF); ! } ! c_ptr = tmp_buf; ! len = strlen(c_ptr); #else /* ~XAPPLOADDIR_DEF */ ! if ((getenv ("XENVIRONMENT") == NULL) && ! ((c_ptr = getenv ("XAPPLRESDIR")) != NULL) && ! ((len = strlen (c_ptr)) > 0)) ! { ! if (FindXApplResDir(c_ptr, tmp_buf, sizeof(tmp_buf))) { ! c_ptr = tmp_buf; ! } ! len = strlen(c_ptr); #endif /* XAPPLOADDIR_DEF */ ! xEnvStr = (char*)malloc( ! (strlen("XENVIRONMENT=")+strlen(TOOL_NAME)+len+3)*sizeof(char)); ! if (xEnvStr == NULL) FailAllocMessage(); ! sprintf (xEnvStr, "%s%s%s", c_ptr, ((c_ptr[len-1] == '/') ? "" : "/"), TOOL_NAME); ! if ((xenv_fp = fopen (xEnvStr, "r")) != NULL) { ! fclose (xenv_fp); ! sprintf (xEnvStr, "XENVIRONMENT=%s%s%s", c_ptr, ! ((c_ptr[len-1] == '/') ? "" : "/"), TOOL_NAME); ! if (putenv (xEnvStr)) ! { ! sprintf (s, "Warning: Can not putenv(%s).", xEnvStr); ! Msg (s); ! *xEnvStr = '\0'; ! free(xEnvStr); ! xEnvStr = NULL; ! } } } ! if ((mainDisplay = XOpenDisplay (displayName)) == 0) #else /* ~USE_XAPPLRESDIR */ #ifdef USE_XT_INITIALIZE ! toplevel = XtInitialize (TOOL_NAME, TOOL_NAME, NULL, 0, &origArgC, ! origArgV); ! if (toplevel == NULL || (mainDisplay = XtDisplay (toplevel)) == 0) #else /* ~USE_XT_INITIALIZE */ ! if ((mainDisplay = XOpenDisplay (displayName)) == 0) #endif /* USE_XT_INITIALIZE */ #endif /* USE_XAPPLRESDIR */ { ! if (displayName == NULL) { ! fprintf (stderr, "Could not open the default display! Abort!\n"); ! exit (-1); } else { ! fprintf (stderr, "Could not open display '%s'! Abort!\n", ! displayName); ! exit (-1); } } ! mainScreen = DefaultScreen (mainDisplay); ! mainColormap = DefaultColormap (mainDisplay, mainScreen); ! mainDepth = DefaultDepth (mainDisplay, mainScreen); ! mainVisual = DefaultVisual (mainDisplay, mainScreen); ! rootWindow = RootWindow (mainDisplay, mainScreen); ! ! XSetErrorHandler (EmergencySaveForX); ! XSetIOErrorHandler (IOEmergencySaveForX); ! signal (SIGHUP, EmergencySave); ! signal (SIGFPE, EmergencySave); ! #ifndef linux ! signal (SIGBUS, EmergencySave); ! #endif /* ~linux */ ! signal (SIGSEGV, EmergencySave); ! Setup (); ! InitExtraWinInfo (); ! quitDraw = FALSE; ! *remote_fname = '\0'; ! if (*FileName != '\0' && FileIsRemote (FileName)) { ! if (!FormNewFileName (curDir, FileName, NULL, remote_fname, ! &page_spec)) { ! sprintf(s, "Invalid remote file name '%s'.", FileName); ! MsgBox (s, TOOL_NAME, INFO_MB); ! *FileName = '\0'; } else { ! char *content_type=NULL; ! char final_url[MAXPATHLENGTH+1]; ! *final_url = '\0'; ! SaveStatusStrings (); ! rc = LoadRemoteFileInMem(remote_fname, &remote_buf, ! &content_type, &remote_buf_sz, &is_html, TRUE, ! final_url, sizeof(final_url)); ! RestoreStatusStrings (); ! if (rc && remote_buf != NULL && ! (tmp_remote_fname=WriteRemoteFileIntoTemp(remote_buf, ! remote_buf_sz, NULL)) != NULL) { ! if (*final_url != '\0') { ! UtilStrCpy(FileName, MAXPATHLENGTH+1, final_url); ! UtilStrCpy(remote_fname, MAXPATHLENGTH+1, final_url); ! } ! if (UseExternalViewer(is_html, remote_fname, content_type, ! tmp_remote_fname) != FALSE) { ! unlink(tmp_remote_fname); ! if (remote_buf != NULL) FreeRemoteBuf(remote_buf); ! if (tmp_remote_fname != NULL) { ! FreeRemoteBuf(tmp_remote_fname); ! } ! remote_buf = tmp_remote_fname = NULL; ! file_is_remote = FALSE; ! *FileName = '\0'; ! } else { ! file_is_remote = TRUE; ! } } else ! { ! if (remote_buf != NULL) FreeRemoteBuf (remote_buf); ! remote_buf = NULL; ! *FileName = '\0'; ! } ! if (content_type != NULL) FreeRemoteBuf(content_type); } } ! if (*FileName != '\0') { ! int obj_file=TRUE; ! sprintf (obj_ext_str, ".%s", OBJ_FILE_EXT); ! obj_ext_len = strlen (obj_ext_str); ! *file_name = '\0'; ! if (file_is_remote) ! { ! if ((fp=fopen(tmp_remote_fname, "r")) == NULL) ! { ! sprintf (s, "Can not read tmp file '%s'.", tmp_remote_fname); ! MsgBox (s, TOOL_NAME, INFO_MB); ! unlink (tmp_remote_fname); ! FreeRemoteBuf (remote_buf); ! FreeRemoteBuf (tmp_remote_fname); ! remote_buf = tmp_remote_fname = NULL; ! file_is_remote = FALSE; ! } ! else ! { ! len = strlen (remote_fname); ! sprintf (obj_ext_str, ".%s", SYM_FILE_EXT); ! obj_ext_len = strlen (obj_ext_str); ! if (len >= obj_ext_len && ! strcmp (&FileName[len-obj_ext_len], obj_ext_str) == 0) ! obj_file = FALSE; ! else ! obj_file = TRUE; ! } } else ! { ! len = strlen (FileName); ! if (len >= obj_ext_len && ! strcmp (&FileName[len-obj_ext_len], obj_ext_str) == 0) ! strcpy (file_name, FileName); ! else ! { ! sprintf (obj_ext_str, ".%s", SYM_FILE_EXT); ! obj_ext_len = strlen (obj_ext_str); ! if (len >= obj_ext_len && ! strcmp (&FileName[len-obj_ext_len], obj_ext_str) == 0) ! { ! strcpy (file_name, FileName); ! obj_file = FALSE; ! } ! else ! sprintf (file_name, "%s.%s", FileName, OBJ_FILE_EXT); ! } ! if ((short_name = IsPrefix (bootDir, file_name, &rest))) ++rest; ! } ! if (*file_name != '\0' && (fp = fopen (file_name, "r")) == NULL) { - DelAllPages (); - lastPageNum = 1; - InitPage (); - if (short_name) ! sprintf (s, "Can not open '%s'.", rest); else ! sprintf (s, "Can not open '%s'.", file_name); ! Msg (s); ! if (*file_name == '/') ! strcpy (full_name, file_name); ! else ! sprintf (full_name, "%s/%s", curDir, file_name); ! if (obj_file) ! { ! SetCurDir (full_name); ! *curSymDir = '\0'; ! } ! else ! SetCurSymDir (full_name); ! curFileDefined = TRUE; ! SetFileModified (FALSE); ! if (short_name) ! sprintf (s, "Current (empty) file is '%s'.", rest); ! else ! sprintf (s, "Current (empty) file is '%s'.", file_name); ! Msg (s); ! } ! else if (file_is_remote || *file_name != '\0') ! { ! SetFileModified (FALSE); ! if (file_is_remote) ! sprintf (s, "Loading '%s' ...", remote_fname); ! else { ! if (short_name) ! sprintf (s, "Loading '%s' ...", rest); ! else ! sprintf (s, "Loading '%s' ...", file_name); } - Msg (s); ! strcpy (tmp_filename, scanFileName); ! tmp_linenum = scanLineNum; ! if (file_is_remote) ! strcpy (scanFileName, tmp_remote_fname); ! else ! strcpy (scanFileName, (short_name ? rest : file_name)); ! scanLineNum = 0; ! ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); ! ! readingPageNum = 0; ! loadedCurPageNum = 0; ! foundGoodStateObject = FALSE; ! while ((read_status = ReadObj (fp, &obj_ptr)) == TRUE) ! if (obj_ptr != NULL) ! { ! AdjForOldVersion (obj_ptr); ! AddObj (NULL, topObj, obj_ptr); ! } ! strcpy (scanFileName, tmp_filename); ! scanLineNum = tmp_linenum; ! fclose (fp); ! if (loadedCurPageNum <= 0) ! { ! DelAllPages (); ! loadedCurPageNum = curPageNum = lastPageNum = 1; ! InitPage (); ! } ! if (read_status == INVALID) { ! sprintf (s, "File version too large (=%1d). Load aborted!", ! fileVersion); ! Msg (s); ! sprintf (s, " You may need a more recent version of %s", ! TOOL_NAME); ! Msg (s); } else { ! CheckFileAttrsInLoad(); ! ! curFileDefined = TRUE; ! if (file_is_remote) ! { ! SetCurDir (remote_fname); ! if (!foundGoodStateObject) PasteString(remote_buf); ! } else { ! if (*file_name == '/') ! strcpy (full_name, file_name); ! else ! sprintf (full_name, "%s/%s", curDir, file_name); ! if (obj_file) ! { ! SetCurDir (full_name); ! *curSymDir = '\0'; ! } ! else ! SetCurSymDir (full_name); } - if (file_is_remote) - sprintf (s, "Current file is '%s'.", remote_fname); else ! { ! if (short_name) ! sprintf (s, "Current file is '%s'.", rest); ! else ! sprintf (s, "Current file is '%s'.", file_name); ! } ! Msg (s); } - GotoPageNum (loadedCurPageNum); - SetDefaultCursor (mainWindow); - SetDefaultCursor (drawWindow); - if (file_is_remote) ! { ! unlink (tmp_remote_fname); ! if (remote_buf != NULL) FreeRemoteBuf (remote_buf); ! if (tmp_remote_fname != NULL) FreeRemoteBuf (tmp_remote_fname); ! remote_buf = tmp_remote_fname = NULL; ! CommitNavigate(); ! } ! if (foundGoodStateObject) { ! struct AttrRec *exec_attr=FindFileAttrWithName("auto_exec="); ! CommitNavigate (); ! if (exec_attr != NULL) { ! XSync(mainDisplay, False); ! need_to_check_auto_exec = TRUE; ! } } } ! if (page_spec != NULL) { ! int new_page_num=(-1); ! if (!GetPageNumFromPageSpec(page_spec, &new_page_num)) { ! sprintf(s, "Invalid page specified for '%s'.", FileName); ! Msg(s); ! } else if (new_page_num != curPageNum) { ! GotoPageNum(new_page_num); ! } } } ! else ! { ! DelAllPages (); ! lastPageNum = 1; ! InitPage (); } ! SetDefaultDrawWinClipRecs (); ! UpdateDirInfo (); ! if (page_spec != NULL) free(page_spec); } SaveDrawWinInfo(); ! if (strcmp (Op, "justinit") == 0) ! { ! XSync (mainDisplay, False); ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, ""); return; } ! ! if (strcmp (Op, "save") == 0) ! { ! SaveFile (); ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, ""); return; } ! ! if (strcmp (Op, "vi") == 0) ! ExecWithFile ("vi", FileName); ! ! if (strcmp (Op, "less") == 0) ! ExecWithFile ("less", FileName); ! ! if (strcmp (Op, "quit") == 0) ! { ! CleanUp (); quitDraw = TRUE; ! XFlush (mainDisplay); ! XSync (mainDisplay, True); #ifdef USE_XT_INITIALIZE ! XtDestroyWidget (toplevel); #else /* ~USE_XT_INITIALIZE */ ! XCloseDisplay (mainDisplay); #endif /* USE_XT_INITIALIZE */ exitNormally = TRUE; ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, "Quit"); ! strcpy (*Str1, ""); return; } ! ! if (strcmp (Op, "msg") == 0) ! { ! Msg (FileName); ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, ""); return; } ! ! if (strcmp (Op, "dialog") == 0) ! { ! Dialog (FileName, "", file_name); ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, file_name); ! strcpy (*Str1, ""); return; } ! ! if (strcmp (Op, "mainmenu") == 0 && quitDraw) ! { ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, "Fail"); ! strcpy (*Str1, ""); return; } ! ! while (TRUE) ! { exitNormally = FALSE; if (need_to_check_auto_exec && XPending(mainDisplay) <= 0) { --- 435,951 ---- #endif /* USE_XAPPLRESDIR */ ! int JustInit(pszFile, pnNeedToCheckAutoExec) ! char *pszFile; ! int *pnNeedToCheckAutoExec; { ! int tmp_linenum, obj_ext_len; ! char tmp_filename[MAXPATHLENGTH+1], obj_ext_str[MAXSTRING+1]; ! char full_name[MAXPATHLENGTH+1], *rest; ! char *c_ptr=NULL, file_name[MAXPATHLENGTH+1]; ! int rc, len=0; ! int file_is_remote=FALSE, remote_buf_sz=0, is_html=FALSE; ! char remote_fname[MAXPATHLENGTH+1], *tmp_remote_fname=NULL; ! char *remote_buf=NULL, *page_spec=NULL; #ifdef USE_XAPPLRESDIR ! FILE *xenv_fp=NULL; ! char tmp_buf[MAXPATHLENGTH+1]; #endif /* USE_XAPPLRESDIR */ ! struct ObjRec *obj_ptr=NULL; ! FILE *fp=NULL; #ifdef USE_XAPPLRESDIR #ifdef XAPPLOADDIR_DEF ! if (getenv ("XENVIRONMENT") == NULL) ! { ! if (((c_ptr=getenv("XAPPLRESDIR")) == NULL)) { ! UtilStrCpy(tmp_buf, sizeof(tmp_buf), XAPPLOADDIR_DEF); ! } else if (!FindXApplResDir(c_ptr, tmp_buf, sizeof(tmp_buf))) { ! UtilStrCpy(tmp_buf, sizeof(tmp_buf), XAPPLOADDIR_DEF); ! } ! c_ptr = tmp_buf; ! len = strlen(c_ptr); #else /* ~XAPPLOADDIR_DEF */ ! if ((getenv ("XENVIRONMENT") == NULL) && ! ((c_ptr = getenv ("XAPPLRESDIR")) != NULL) && ! ((len = strlen (c_ptr)) > 0)) ! { ! if (FindXApplResDir(c_ptr, tmp_buf, sizeof(tmp_buf))) { ! c_ptr = tmp_buf; ! } ! len = strlen(c_ptr); #endif /* XAPPLOADDIR_DEF */ ! xEnvStr = (char*)malloc( ! (strlen("XENVIRONMENT=")+strlen(TOOL_NAME)+len+3)*sizeof(char)); ! if (xEnvStr == NULL) FailAllocMessage(); ! sprintf(xEnvStr, "%s%s%s", c_ptr, ! ((c_ptr[len-1] == '/') ? "" : "/"), TOOL_NAME); ! if ((xenv_fp = fopen (xEnvStr, "r")) != NULL) ! { ! fclose (xenv_fp); ! sprintf(xEnvStr, "XENVIRONMENT=%s%s%s", c_ptr, ((c_ptr[len-1] == '/') ? "" : "/"), TOOL_NAME); ! if (putenv (xEnvStr)) { ! sprintf(gszMsgBox, "Warning: Can not putenv(%s).", xEnvStr); ! Msg(gszMsgBox); ! *xEnvStr = '\0'; ! free(xEnvStr); ! xEnvStr = NULL; } } ! } ! if ((mainDisplay = XOpenDisplay (displayName)) == 0) #else /* ~USE_XAPPLRESDIR */ + c_ptr = NULL; #ifdef USE_XT_INITIALIZE ! toplevel = XtInitialize (TOOL_NAME, TOOL_NAME, NULL, 0, &origArgC, ! origArgV); ! if (toplevel == NULL || (mainDisplay = XtDisplay (toplevel)) == 0) #else /* ~USE_XT_INITIALIZE */ ! if ((mainDisplay = XOpenDisplay (displayName)) == 0) #endif /* USE_XT_INITIALIZE */ #endif /* USE_XAPPLRESDIR */ + { + if (displayName == NULL) { ! fprintf(stderr, "Could not open the default display! Abort!\n"); ! exit(-1); ! } ! else ! { ! fprintf(stderr, "Could not open display '%s'! Abort!\n", ! displayName); ! exit(-1); ! } ! } ! mainScreen = DefaultScreen (mainDisplay); ! mainColormap = DefaultColormap (mainDisplay, mainScreen); ! mainDepth = DefaultDepth (mainDisplay, mainScreen); ! mainVisual = DefaultVisual (mainDisplay, mainScreen); ! rootWindow = RootWindow (mainDisplay, mainScreen); ! ! XSetErrorHandler(EmergencySaveForX); ! XSetIOErrorHandler(IOEmergencySaveForX); ! signal(SIGHUP, EmergencySave); ! signal(SIGFPE, EmergencySave); ! #ifndef linux ! signal(SIGBUS, EmergencySave); ! #endif /* ~linux */ ! signal(SIGSEGV, EmergencySave); ! ! Setup (); ! InitExtraWinInfo (); ! quitDraw = FALSE; ! ! *remote_fname = '\0'; ! ! if (pszFile == NULL) { ! DelAllPages(); ! lastPageNum = 1; ! InitPage(); ! return TRUE; ! } ! ! if (*pszFile != '\0' && FileIsRemote (pszFile)) ! { ! if (!FormNewFileName (curDir, pszFile, NULL, remote_fname, ! &page_spec)) ! { ! sprintf(gszMsgBox, "Invalid remote file name '%s'.", pszFile); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! *pszFile = '\0'; ! } ! else ! { ! char *content_type=NULL; ! char final_url[MAXPATHLENGTH+1]; ! ! *final_url = '\0'; ! SaveStatusStrings (); ! rc = LoadRemoteFileInMem(remote_fname, &remote_buf, ! &content_type, &remote_buf_sz, &is_html, TRUE, ! final_url, sizeof(final_url)); ! RestoreStatusStrings (); ! if (rc && remote_buf != NULL && ! (tmp_remote_fname=WriteRemoteFileIntoTemp(remote_buf, ! remote_buf_sz, NULL)) != NULL) { ! if (*final_url != '\0') { ! UtilStrCpy(pszFile, MAXPATHLENGTH+1, final_url); ! UtilStrCpy(remote_fname, MAXPATHLENGTH+1, final_url); ! } ! if (UseExternalViewer(is_html, remote_fname, content_type, ! tmp_remote_fname) != FALSE) { ! unlink(tmp_remote_fname); ! if (remote_buf != NULL) FreeRemoteBuf(remote_buf); ! if (tmp_remote_fname != NULL) { ! FreeRemoteBuf(tmp_remote_fname); ! } ! remote_buf = tmp_remote_fname = NULL; ! file_is_remote = FALSE; ! *pszFile = '\0'; ! } else { ! file_is_remote = TRUE; ! } } else { ! if (remote_buf != NULL) FreeRemoteBuf (remote_buf); ! remote_buf = NULL; ! *pszFile = '\0'; } + if (content_type != NULL) FreeRemoteBuf(content_type); } ! } ! if (*pszFile != '\0') ! { ! int short_name=FALSE; ! int obj_file=TRUE; ! sprintf(obj_ext_str, ".%s", OBJ_FILE_EXT); ! obj_ext_len = strlen (obj_ext_str); ! *file_name = '\0'; ! if (file_is_remote) { ! if ((fp=fopen(tmp_remote_fname, "r")) == NULL) ! { ! sprintf(gszMsgBox, "Can not read tmp file '%s'.", tmp_remote_fname); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! ! unlink (tmp_remote_fname); ! FreeRemoteBuf (remote_buf); ! FreeRemoteBuf (tmp_remote_fname); ! remote_buf = tmp_remote_fname = NULL; ! file_is_remote = FALSE; ! } ! else { ! len = strlen (remote_fname); ! sprintf(obj_ext_str, ".%s", SYM_FILE_EXT); ! obj_ext_len = strlen (obj_ext_str); ! if (len >= obj_ext_len && ! strcmp(&pszFile[len-obj_ext_len], obj_ext_str) == 0) ! obj_file = FALSE; ! else ! obj_file = TRUE; } + } + else + { + len = strlen (pszFile); + if (len >= obj_ext_len && + strcmp(&pszFile[len-obj_ext_len], obj_ext_str) == 0) + strcpy(file_name, pszFile); else { ! sprintf(obj_ext_str, ".%s", SYM_FILE_EXT); ! obj_ext_len = strlen (obj_ext_str); ! if (len >= obj_ext_len && ! strcmp(&pszFile[len-obj_ext_len], obj_ext_str) == 0) { ! strcpy(file_name, pszFile); ! obj_file = FALSE; } else ! sprintf(file_name, "%s.%s", pszFile, OBJ_FILE_EXT); } + if ((short_name = IsPrefix (bootDir, file_name, &rest))) ++rest; } ! ! if (*file_name != '\0' && (fp = fopen (file_name, "r")) == NULL) { ! DelAllPages (); ! lastPageNum = 1; ! InitPage (); ! if (short_name) ! sprintf(gszMsgBox, "Can not open '%s'.", rest); ! else ! sprintf(gszMsgBox, "Can not open '%s'.", file_name); ! Msg(gszMsgBox); ! if (*file_name == '/') ! strcpy(full_name, file_name); ! else ! sprintf(full_name, "%s/%s", curDir, file_name); ! if (obj_file) ! { ! SetCurDir (full_name); ! *curSymDir = '\0'; } else ! SetCurSymDir (full_name); ! curFileDefined = TRUE; ! SetFileModified (FALSE); ! if (short_name) ! sprintf(gszMsgBox, "Current (empty) file is '%s'.", rest); ! else ! sprintf(gszMsgBox, "Current (empty) file is '%s'.", file_name); ! Msg(gszMsgBox); ! } ! else if (file_is_remote || *file_name != '\0') ! { ! int read_status; ! SetFileModified (FALSE); ! if (file_is_remote) ! sprintf(gszMsgBox, "Loading '%s' ...", remote_fname); ! else { if (short_name) ! sprintf(gszMsgBox, "Loading '%s' ...", rest); else ! sprintf(gszMsgBox, "Loading '%s' ...", file_name); ! } ! Msg(gszMsgBox); ! strcpy(tmp_filename, scanFileName); ! tmp_linenum = scanLineNum; ! if (file_is_remote) ! strcpy(scanFileName, tmp_remote_fname); ! else ! strcpy(scanFileName, (short_name ? rest : file_name)); ! scanLineNum = 0; ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); ! readingPageNum = 0; ! loadedCurPageNum = 0; ! foundGoodStateObject = FALSE; ! while ((read_status = ReadObj (fp, &obj_ptr)) == TRUE) ! if (obj_ptr != NULL) { ! AdjForOldVersion (obj_ptr); ! AddObj (NULL, topObj, obj_ptr); } ! strcpy(scanFileName, tmp_filename); ! scanLineNum = tmp_linenum; ! fclose (fp); ! if (loadedCurPageNum <= 0) ! { ! DelAllPages (); ! loadedCurPageNum = curPageNum = lastPageNum = 1; ! InitPage (); ! } ! if (read_status == INVALID) ! { ! sprintf(gszMsgBox, "File version too large (=%1d). Load aborted!", ! fileVersion); ! Msg(gszMsgBox); ! sprintf(gszMsgBox, " You may need a more recent version of %s", ! TOOL_NAME); ! Msg(gszMsgBox); ! } ! else ! { ! CheckFileAttrsInLoad(); ! curFileDefined = TRUE; ! if (file_is_remote) { ! SetCurDir (remote_fname); ! if (!foundGoodStateObject) PasteString(remote_buf); } else { ! if (*file_name == '/') ! strcpy(full_name, file_name); else + sprintf(full_name, "%s/%s", curDir, file_name); + if (obj_file) { ! SetCurDir (full_name); ! *curSymDir = '\0'; } else ! SetCurSymDir (full_name); } if (file_is_remote) ! sprintf(gszMsgBox, "Current file is '%s'.", remote_fname); ! else if (short_name) ! sprintf(gszMsgBox, "Current file is '%s'.", rest); ! else ! sprintf(gszMsgBox, "Current file is '%s'.", file_name); ! Msg(gszMsgBox); ! } ! GotoPageNum (loadedCurPageNum); ! SetDefaultCursor (mainWindow); ! SetDefaultCursor (drawWindow); ! if (file_is_remote) ! { ! unlink (tmp_remote_fname); ! if (remote_buf != NULL) FreeRemoteBuf (remote_buf); ! if (tmp_remote_fname != NULL) FreeRemoteBuf (tmp_remote_fname); ! remote_buf = tmp_remote_fname = NULL; ! CommitNavigate(); ! } ! if (foundGoodStateObject) { ! struct AttrRec *exec_attr=FindFileAttrWithName("auto_exec="); ! ! CommitNavigate (); ! if (exec_attr != NULL) { ! XSync(mainDisplay, False); ! if (pnNeedToCheckAutoExec != NULL) *pnNeedToCheckAutoExec = TRUE; } } ! } ! if (page_spec != NULL) { ! int new_page_num=(-1); ! if (!GetPageNumFromPageSpec(page_spec, &new_page_num)) { ! sprintf(gszMsgBox, "Invalid page specified for '%s'.", pszFile); ! Msg(gszMsgBox); ! } else if (new_page_num != curPageNum) { ! GotoPageNum(new_page_num); } } ! } ! else ! { ! DelAllPages (); ! lastPageNum = 1; ! InitPage (); ! } ! SetDefaultDrawWinClipRecs (); ! UpdateDirInfo (); ! if (page_spec != NULL) free(page_spec); ! return TRUE; ! } ! ! void MainLoop(Op, FileName, FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3) ! char *Op, *FileName, **FuncStr; ! char **Str1, **Menu1, **Str2, **Menu2, **Str3, **Menu3; ! { ! XEvent input; ! char *c_ptr=NULL, file_name[MAXPATHLENGTH+1]; ! int rc, i; ! int need_to_check_auto_exec=FALSE; ! ! /* printf("--> MainLoop (%s, %s, ...)\n", Op, FileName); */ ! ! if (strcmp(Op, "init") == 0 || strcmp(Op, "justinit") == 0) { ! char szMsg1[80], szMsg2[80]; ! ! if (TGIF_PATCHLEVEL == 0) { ! sprintf(szMsg1, "%s Version %s", TOOL_NAME, versionString); ! } else { ! sprintf(szMsg1, "%s Version %s (patchlevel %1d)", TOOL_NAME, ! versionString, TGIF_PATCHLEVEL); ! } ! sprintf(szMsg2, "%s %s", copyrightString, "(william@cs.UCLA.edu)"); ! TwoLineMsg(szMsg1, szMsg2); ! if (!cmdLineDumpURL) { ! fprintf(stderr, "%s\n", szMsg1); ! fprintf(stderr, "%s\n", szMsg2); } ! fflush(stderr); ! ! exitNormally = FALSE; ! ! #ifdef X_PROTOCOL ! #ifdef XlibSpecificationRelease ! x11R6OrAbove = (X_PROTOCOL >= 11 && XlibSpecificationRelease >= 6); ! #endif /* XlibSpecificationRelease */ ! #endif /* X_PROTOCOL */ ! ! #ifdef _LOCALE_SUPPORT ! if (x11R6OrAbove) { ! #ifdef USE_XT_INITIALIZE ! XtSetLanguageProc(NULL, NULL, NULL); ! #else ! char *c_ptr1=NULL; ! ! setlocale(LC_ALL, NULL); ! if ((c_ptr1=((char*)getenv("LANG"))) != NULL) { ! setlocale(LC_ALL, c_ptr1); ! } ! if ((c_ptr1=((char*)getenv("LC_COLLATE"))) != NULL) { ! setlocale(LC_COLLATE, c_ptr1); ! } ! if ((c_ptr1=((char*)getenv("LC_CTYPE"))) != NULL) { ! setlocale(LC_CTYPE, c_ptr1); ! } ! if ((c_ptr1=((char*)getenv("LC_NUMERIC"))) != NULL) { ! setlocale(LC_NUMERIC, c_ptr1); ! } ! if ((c_ptr1=((char*)getenv("LC_TIME"))) != NULL) { ! setlocale(LC_TIME, c_ptr1); ! } ! if ((c_ptr1=((char*)getenv("LC_MONETARY"))) != NULL) { ! setlocale(LC_MONETARY, c_ptr1); ! } ! XSupportsLocale(); ! XSetLocaleModifiers(NULL); ! #endif /* USE_XT_INITIALIZE */ ! } ! #endif /* _LOCALE_SUPPORT */ ! ! JustInit(FileName, &need_to_check_auto_exec); } SaveDrawWinInfo(); ! if (strcmp(Op, "justinit") == 0) { ! XSync(mainDisplay, False); ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, ""); return; } ! if (strcmp(Op, "save") == 0) { ! SaveFile(); ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, ""); return; } ! if (strcmp(Op, "vi") == 0) { ! ExecWithFile("vi", FileName); ! } ! if (strcmp(Op, "less") == 0) { ! ExecWithFile("less", FileName); ! } ! if (strcmp(Op, "quit") == 0) { ! CleanUp(); quitDraw = TRUE; ! XFlush(mainDisplay); ! XSync(mainDisplay, True); #ifdef USE_XT_INITIALIZE ! XtDestroyWidget(toplevel); #else /* ~USE_XT_INITIALIZE */ ! XCloseDisplay(mainDisplay); #endif /* USE_XT_INITIALIZE */ exitNormally = TRUE; ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, "Quit"); ! strcpy(*Str1, ""); return; } ! if (strcmp(Op, "msg") == 0) { ! Msg(FileName); ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, ""); return; } ! if (strcmp(Op, "dialog") == 0) { ! Dialog(FileName, "", file_name); ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, file_name); ! strcpy(*Str1, ""); return; } ! if (strcmp(Op, "mainmenu") == 0 && quitDraw) { ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, "Fail"); ! strcpy(*Str1, ""); return; } ! while (TRUE) { exitNormally = FALSE; if (need_to_check_auto_exec && XPending(mainDisplay) <= 0) { *************** *** 911,1094 **** } #ifdef _TGIF_WB ! if (XPending(mainDisplay)) ! { ! XNextEvent (mainDisplay, &input); CheckClientServer(); ! } ! else ! { CheckClientServer(); continue; } #else /* ~_TGIF_WB */ ! XNextEvent (mainDisplay, &input); #endif /* _TGIF_WB */ ! if (input.type == KeyRelease) continue; ! else if (input.type == KeyPress) ! { ! rc = ShortHand (&input); ! switch (rc) ! { ! case BAD: /* or */ continue; ! case INVALID: break; ! default: ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, fileMenuStr[rc]); ! strcpy (*Str1, curDomainName); ! sprintf (*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy (*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) ! if (*c_ptr == ' ') ! { ! *c_ptr = '\0'; ! break; ! } ! return; } } ! if (input.xany.window == choiceWindow) ! { ! if ((rc = ChoiceEventHandler (&input)) != INVALID) ! { ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, fileMenuStr[rc]); ! strcpy (*Str1, curDomainName); ! sprintf (*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy (*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) ! if (*c_ptr == ' ') ! { *c_ptr = '\0'; break; } return; } ! } ! else if (input.xany.window == drawWindow) ! { ! if ((rc = DrawingEventHandler (&input)) != INVALID) ! { ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, fileMenuStr[rc]); ! strcpy (*Str1, curDomainName); ! sprintf (*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy (*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) ! if (*c_ptr == ' ') ! { *c_ptr = '\0'; break; } return; } ! } ! else if (input.xany.window == mainWindow) ! { ! if ((rc = mainWinEventHandler (&input)) != INVALID) ! { ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, fileMenuStr[rc]); ! strcpy (*Str1, curDomainName); ! sprintf (*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy (*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) ! if (*c_ptr == ' ') ! { *c_ptr = '\0'; break; } return; } ! } ! else if (input.xany.window == vRuleWindow || ! input.xany.window == hRuleWindow) ! RulersEventHandler (&input); ! else if (input.xany.window == iconWindow || ! input.xany.window == iconBaseWindow) ! IconEventHandler (&input); ! else if (input.xany.window == titleWindow) ! TitleEventHandler (&input); ! else if (menubarWindow != None && input.xany.window == menubarWindow) ! { ! if ((rc = MenubarEventHandler (&input)) != INVALID) ! { ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, fileMenuStr[rc]); ! strcpy (*Str1, curDomainName); ! sprintf (*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy (*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) ! if (*c_ptr == ' ') ! { *c_ptr = '\0'; break; } return; } ! } ! else if (input.xany.window == msgWindow) ! MsgEventHandler (&input); ! else if (input.xany.window == vSBarWindow || ! input.xany.window == hSBarWindow) ! ScrollEventHandler (&input); ! else if (statusWindow != None && input.xany.window == statusWindow) ! StatusEventHandler (&input); ! else if (input.xany.window == dummyWindow1 || ! input.xany.window == dummyWindow2) ! DummiesEventHandler (&input); ! else if (input.xany.type == MappingNotify) ! XRefreshKeyboardMapping (&(input.xmapping)); ! else if (pinnedMainMenu && input.xany.window == mainMenuWindow) ! { ! if ((rc = MainMenuEventHandler (&input)) != INVALID) ! { ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, fileMenuStr[rc]); ! strcpy (*Str1, curDomainName); ! sprintf (*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy (*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) ! if (*c_ptr == ' ') ! { *c_ptr = '\0'; break; } return; } ! } ! else if (input.xany.window == pageWindow) ! PageEventHandler (&input); ! else if (input.xany.window == pageDummyWindow) ! PageDummyEventHandler (&input); ! else if (input.xany.window == colorWindow) ! ColorEventHandler (&input); ! else if (input.xany.window == colorDummyWindow) ! ColorDummyEventHandler (&input); ! else ! { ! for (i = 0; i < numExtraWins; i++) if (input.xany.window == extraWinInfo[i].window && ! extraWinInfo[i].window != None) ! { ! if ((rc = (*(extraWinInfo[i].ev_handler))(&input)) != INVALID) ! { ! AllocStrings (FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy (*FuncStr, fileMenuStr[rc]); ! strcpy (*Str1, curDomainName); ! sprintf (*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy (*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) ! if (*c_ptr == ' ') ! { *c_ptr = '\0'; break; } return; } break; } } } --- 958,1119 ---- } #ifdef _TGIF_WB ! if (XPending(mainDisplay)) { ! XNextEvent(mainDisplay, &input); CheckClientServer(); ! } else { CheckClientServer(); continue; } #else /* ~_TGIF_WB */ ! XNextEvent(mainDisplay, &input); #endif /* _TGIF_WB */ ! if (input.type == KeyRelease) { continue; ! } else if (input.type == KeyPress) { ! rc = ShortHand(&input); ! switch (rc) { ! case BAD: /* or */ continue; ! case INVALID: break; ! default: ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, fileMenuStr[rc]); ! strcpy(*Str1, curDomainName); ! sprintf(*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy(*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) { ! if (*c_ptr == ' ') { ! *c_ptr = '\0'; ! break; ! } ! } ! return; } } ! if (input.xany.window == choiceWindow) { ! if ((rc=ChoiceEventHandler(&input)) != INVALID) { ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, fileMenuStr[rc]); ! strcpy(*Str1, curDomainName); ! sprintf(*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy(*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) { ! if (*c_ptr == ' ') { *c_ptr = '\0'; break; } + } return; } ! } else if (input.xany.window == drawWindow) { ! if ((rc=DrawingEventHandler(&input)) != INVALID) { ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, fileMenuStr[rc]); ! strcpy(*Str1, curDomainName); ! sprintf(*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy(*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) { ! if (*c_ptr == ' ') { *c_ptr = '\0'; break; } + } return; } ! } else if (input.xany.window == mainWindow) { ! if ((rc=mainWinEventHandler(&input)) != INVALID) { ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, fileMenuStr[rc]); ! strcpy(*Str1, curDomainName); ! sprintf(*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy(*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) { ! if (*c_ptr == ' ') { *c_ptr = '\0'; break; } + } return; } ! } else if (input.xany.window == vRuleWindow || ! input.xany.window == hRuleWindow) { ! RulersEventHandler(&input); ! } else if (input.xany.window == iconWindow || ! input.xany.window == iconBaseWindow) { ! IconEventHandler(&input); ! } else if (input.xany.window == titleWindow) { ! TitleEventHandler(&input); ! } else if (menubarWindow != None && input.xany.window == menubarWindow) { ! if ((rc=MenubarEventHandler(&input)) != INVALID) { ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, fileMenuStr[rc]); ! strcpy(*Str1, curDomainName); ! sprintf(*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy(*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) { ! if (*c_ptr == ' ') { *c_ptr = '\0'; break; } + } return; } ! } else if (input.xany.window == msgWindow) { ! MsgEventHandler(&input); ! } else if (input.xany.window == vSBarWindow || ! input.xany.window == hSBarWindow) { ! ScrollEventHandler(&input); ! } else if (statusWindow != None && input.xany.window == statusWindow) { ! StatusEventHandler(&input); ! } else if (input.xany.window == dummyWindow1 || ! input.xany.window == dummyWindow2) { ! DummiesEventHandler(&input); ! } else if (input.xany.type == MappingNotify) { ! XRefreshKeyboardMapping(&(input.xmapping)); ! } else if (pinnedMainMenu && input.xany.window == mainMenuWindow) { ! if ((rc=MainMenuEventHandler(&input)) != INVALID) { ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, fileMenuStr[rc]); ! strcpy(*Str1, curDomainName); ! sprintf(*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy(*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) { ! if (*c_ptr == ' ') { *c_ptr = '\0'; break; } + } return; } ! } else if (input.xany.window == pageWindow) { ! PageEventHandler(&input); ! } else if (input.xany.window == pageDummyWindow) { ! PageDummyEventHandler(&input); ! } else if (input.xany.window == colorWindow) { ! ColorEventHandler(&input); ! } else if (input.xany.window == colorDummyWindow) { ! ColorDummyEventHandler(&input); ! } else { ! for (i = 0; i < numExtraWins; i++) { if (input.xany.window == extraWinInfo[i].window && ! extraWinInfo[i].window != None) { ! if ((rc=(*(extraWinInfo[i].ev_handler))(&input)) != INVALID) { ! AllocStrings(FuncStr, Str1, Menu1, Str2, Menu2, Str3, Menu3); ! strcpy(*FuncStr, fileMenuStr[rc]); ! strcpy(*Str1, curDomainName); ! sprintf(*Menu1, "tmpmodel.%s", OBJ_FILE_EXT); ! strcpy(*Str2, ""); ! for (c_ptr = *FuncStr; *c_ptr != '\0'; c_ptr++) { ! if (*c_ptr == ' ') { *c_ptr = '\0'; break; } + } return; } break; } + } } } *************** *** 1142,1264 **** static ! void HandleSimpleEvent (input) ! XEvent input; { if ((input.type & (PointerMotionMask | EnterWindowMask | LeaveWindowMask)) ! != 0) return; ! ! if (input.xany.window == drawWindow) ! DrawingEventHandler (&input); ! else if (input.xany.window == choiceWindow) ! ChoiceEventHandler (&input); ! else if (input.xany.window==iconWindow || input.xany.window==iconBaseWindow) ! IconEventHandler (&input); ! else if (input.xany.window == titleWindow) ! TitleEventHandler (&input); ! else if (input.xany.window == msgWindow) ! MsgEventHandler (&input); ! else if (input.xany.window==vSBarWindow || input.xany.window==hSBarWindow) ! ScrollEventHandler (&input); ! else if (input.xany.window == hRuleWindow) ! RedrawHRuler (); ! else if (input.xany.window == vRuleWindow) ! RedrawVRuler (); ! else if (pinnedMainMenu && input.xany.window == mainMenuWindow) ! MainMenuEventHandler (&input); } static ! void AllocReturnStr (ReturnStr) ! char * * ReturnStr; { if((*ReturnStr=(char*)malloc(80*sizeof(char))) == NULL) FailAllocMessage(); } ! void Animate (TypeStr, PolyId, SpeedStr, ColorStr, ReturnStr) ! char * TypeStr, * PolyId, * SpeedStr, * ColorStr; ! char * * ReturnStr; { ! struct ObjRec * obj_ptr; ! char s[80]; ! int i, poly_id, speed, pixel, clicked = FALSE; ! XEvent input; ! XButtonEvent * button_event; ! AllocReturnStr (ReturnStr); ! strcpy (*ReturnStr, ""); ! while (XPending (mainDisplay) != 0) ! { ! XPeekEvent (mainDisplay, &input); if ((input.type & (PointerMotionMask | ExposureMask | EnterWindowMask | ! LeaveWindowMask)) != 0) ! { ! XNextEvent (mainDisplay, &input); ! HandleSimpleEvent (input); ! } ! else ! { if (input.type == ButtonPress) clicked = TRUE; ! strcpy (*ReturnStr, "Interrupt"); break; } } ! printf ("--> Animate (%s, %s, %s, %s)\n",TypeStr,PolyId,SpeedStr,ColorStr); ! if (strcmp (TypeStr, "waitclick") == 0) ! { ! Msg ("Left:step. Middle:run. Right:stop."); ! if (!clicked) ! { ! while(TRUE) ! if (XPending (mainDisplay) != 0) ! { ! XNextEvent (mainDisplay, &input); ! if (input.type == ButtonPress) break; } } - else - XNextEvent (mainDisplay, &input); button_event = &(input.xbutton); ! switch (button_event->button) ! { ! case Button1 : strcpy (*ReturnStr, "Left"); break; ! case Button2 : strcpy (*ReturnStr, "Middle"); break; ! case Button3 : strcpy (*ReturnStr, "Right"); break; } ! Msg (""); ! } ! else ! { ! poly_id = atoi (PolyId); ! for (obj_ptr = topObj; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! if (obj_ptr->type == OBJ_POLY && obj_ptr->id == poly_id) break; ! ! if (obj_ptr == NULL) ! { ! sprintf (s, "Can not find poly id = %1d.", poly_id); ! Msg (s); } ! else if (strcmp (TypeStr, "send") == 0) ! { ! speed = atoi (SpeedStr); pixel = (colorDisplay) ? xorColorPixels[obj_ptr->color] : 1; ! AnimateSend (obj_ptr->detail.p, speed, pixel); ! } ! else if (strcmp (TypeStr, "flash") == 0) ! { ! if (colorDisplay) ! strcpy (s, ColorStr); ! else ! strcpy (s, "white"); ! for (i = 0; i < maxColors; i++) ! if (strcmp (colorMenuItems[i], s) == 0) ! { ! AnimateFlashColor (obj_ptr, i); break; } } } --- 1167,1283 ---- static ! void HandleSimpleEvent(input) ! XEvent input; { if ((input.type & (PointerMotionMask | EnterWindowMask | LeaveWindowMask)) ! != 0) { ! return; ! } ! if (input.xany.window == drawWindow) { ! DrawingEventHandler(&input); ! } else if (input.xany.window == choiceWindow) { ! ChoiceEventHandler(&input); ! } else if (input.xany.window==iconWindow || ! input.xany.window==iconBaseWindow) { ! IconEventHandler(&input); ! } else if (input.xany.window == titleWindow) { ! TitleEventHandler(&input); ! } else if (input.xany.window == msgWindow) { ! MsgEventHandler(&input); ! } else if (input.xany.window==vSBarWindow || ! input.xany.window==hSBarWindow) { ! ScrollEventHandler(&input); ! } else if (input.xany.window == hRuleWindow) { ! RedrawHRuler(); ! } else if (input.xany.window == vRuleWindow) { ! RedrawVRuler(); ! } else if (pinnedMainMenu && input.xany.window == mainMenuWindow) { ! MainMenuEventHandler(&input); ! } } static ! void AllocReturnStr(ReturnStr) ! char **ReturnStr; { if((*ReturnStr=(char*)malloc(80*sizeof(char))) == NULL) FailAllocMessage(); } ! void Animate(TypeStr, PolyId, SpeedStr, ColorStr, ReturnStr) ! char *TypeStr, *PolyId, *SpeedStr, *ColorStr; ! char **ReturnStr; { ! struct ObjRec *obj_ptr; ! char s[80]; ! int i, poly_id, speed, pixel, clicked = FALSE; ! XEvent input; ! XButtonEvent *button_event; ! AllocReturnStr(ReturnStr); ! strcpy(*ReturnStr, ""); ! while (XPending(mainDisplay) != 0) { ! XPeekEvent(mainDisplay, &input); if ((input.type & (PointerMotionMask | ExposureMask | EnterWindowMask | ! LeaveWindowMask)) != 0) { ! XNextEvent(mainDisplay, &input); ! HandleSimpleEvent(input); ! } else { if (input.type == ButtonPress) clicked = TRUE; ! strcpy(*ReturnStr, "Interrupt"); break; } } ! printf("--> Animate (%s, %s, %s, %s)\n",TypeStr,PolyId,SpeedStr,ColorStr); ! if (strcmp(TypeStr, "waitclick") == 0) { ! Msg("Left:step. Middle:run. Right:stop."); ! if (!clicked) { ! while(TRUE) { ! if (XPending(mainDisplay) != 0) { ! XNextEvent(mainDisplay, &input); ! if (input.type == ButtonPress) { break; + } } + } + } else { + XNextEvent(mainDisplay, &input); } button_event = &(input.xbutton); ! switch (button_event->button) { ! case Button1 : strcpy(*ReturnStr, "Left"); break; ! case Button2 : strcpy(*ReturnStr, "Middle"); break; ! case Button3 : strcpy(*ReturnStr, "Right"); break; } ! Msg(""); ! } else { ! poly_id = atoi(PolyId); ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=obj_ptr->next) { ! if (obj_ptr->type == OBJ_POLY && obj_ptr->id == poly_id) { break; ! } } ! ! if (obj_ptr == NULL) { ! sprintf(s, "Can not find poly id = %1d.", poly_id); ! Msg(s); ! } else if (strcmp(TypeStr, "send") == 0) { ! speed = atoi(SpeedStr); pixel = (colorDisplay) ? xorColorPixels[obj_ptr->color] : 1; ! AnimateSend(obj_ptr->detail.p, speed, pixel); ! } else if (strcmp(TypeStr, "flash") == 0) { ! if (colorDisplay) { ! strcpy(s, ColorStr); ! } else { ! strcpy(s, "white"); ! } ! for (i = 0; i < maxColors; i++) { ! if (strcmp(colorMenuItems[i], s) == 0) { ! AnimateFlashColor(obj_ptr, i); break; } + } } } *************** *** 1266,1286 **** static ! void MyFormat (Str) ! char * Str; { ! register char * c_ptr = Str, * period_ptr = NULL; ! register int i; ! for ( ; *c_ptr != '\0'; c_ptr++) ! if (*c_ptr >= '0' && *c_ptr <= '9') continue; ! else if (*c_ptr == '.') ! { if (period_ptr != NULL) return; period_ptr = c_ptr; continue; ! } ! else return; if (period_ptr == NULL) return; --- 1285,1305 ---- static ! void MyFormat(Str) ! char *Str; { ! register char *c_ptr=Str, *period_ptr=NULL; ! register int i; ! for ( ; *c_ptr != '\0'; c_ptr++) { ! if (*c_ptr >= '0' && *c_ptr <= '9') { continue; ! } else if (*c_ptr == '.') { if (period_ptr != NULL) return; period_ptr = c_ptr; continue; ! } else { return; + } + } if (period_ptr == NULL) return; *************** *** 1289,1324 **** } ! void UpdAttrVal (ObjId, AttrName, AttrColor, AttrVal, ReturnStr) ! char * ObjId, * AttrName, * AttrColor, * AttrVal; ! char * * ReturnStr; { ! struct ObjRec * obj_ptr; ! struct AttrRec * attr_ptr; ! char s[MAXSTRING+1]; ! int obj_id; ! XEvent input; ! XButtonEvent * button_event; ! AllocReturnStr (ReturnStr); ! strcpy (*ReturnStr, ""); ! while (XPending (mainDisplay) != 0) ! { ! XPeekEvent (mainDisplay, &input); if ((input.type & (PointerMotionMask | ExposureMask | EnterWindowMask | ! LeaveWindowMask)) != 0) ! { ! XNextEvent (mainDisplay, &input); ! HandleSimpleEvent (input); ! } ! else ! { ! strcpy (*ReturnStr, "Interrupt"); button_event = &(input.xbutton); ! switch (button_event->button) ! { ! case Button1 : strcpy (*ReturnStr, "Left"); break; ! case Button2 : strcpy (*ReturnStr, "Middle"); break; ! case Button3 : strcpy (*ReturnStr, "Right"); break; } break; --- 1308,1338 ---- } ! void UpdAttrVal(ObjId, AttrName, AttrColor, AttrVal, ReturnStr) ! char *ObjId, *AttrName, *AttrColor, *AttrVal; ! char **ReturnStr; { ! struct ObjRec *obj_ptr; ! struct AttrRec *attr_ptr; ! char s[MAXSTRING]; ! int obj_id; ! XEvent input; ! XButtonEvent *button_event; ! AllocReturnStr(ReturnStr); ! strcpy(*ReturnStr, ""); ! while (XPending(mainDisplay) != 0) { ! XPeekEvent(mainDisplay, &input); if ((input.type & (PointerMotionMask | ExposureMask | EnterWindowMask | ! LeaveWindowMask)) != 0) { ! XNextEvent(mainDisplay, &input); ! HandleSimpleEvent(input); ! } else { ! strcpy(*ReturnStr, "Interrupt"); button_event = &(input.xbutton); ! switch (button_event->button) { ! case Button1 : strcpy(*ReturnStr, "Left"); break; ! case Button2 : strcpy(*ReturnStr, "Middle"); break; ! case Button3 : strcpy(*ReturnStr, "Right"); break; } break; *************** *** 1326,1370 **** } ! printf ("--> UpdAttrVal (%s, %s, %s, %s)\n", ObjId, AttrName, AttrColor, AttrVal); ! obj_id = atoi (ObjId); ! for (obj_ptr = topObj; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! if (obj_ptr->id == obj_id) break; ! ! if (obj_ptr == NULL) ! { ! sprintf (s, "Can not find obj id = %1d.", obj_id); ! Msg (s); } ! else ! { attr_ptr = obj_ptr->fattr; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) ! { ! if (strcmp (AttrName, attr_ptr->attr_name.s) == 0 && ! strcmp (AttrColor, colorMenuItems[attr_ptr->obj->color]) == 0) break; } ! if (attr_ptr == NULL) ! { ! sprintf (s, "Can not find attr name '%s' and color '%s'.", AttrName, AttrColor); ! Msg (s); ! } ! else ! { ! DynStrSet (&attr_ptr->attr_value, AttrVal); MyFormat(attr_ptr->attr_value.s); ! if (attr_ptr->nameshown) ! sprintf (s, "%s%s", attr_ptr->attr_name.s, attr_ptr->attr_value.s); ! else ! strcpy (s, attr_ptr->attr_value.s); ! if (attr_ptr->shown) RepaintFirstStr (attr_ptr->obj, s); ! DynStrSet (&attr_ptr->obj->detail.t->first->dyn_str, s); } } --- 1340,1381 ---- } ! printf("--> UpdAttrVal (%s, %s, %s, %s)\n", ObjId, AttrName, AttrColor, AttrVal); ! obj_id = atoi(ObjId); ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=obj_ptr->next) { ! if (obj_ptr->id == obj_id) { break; ! } } ! ! if (obj_ptr == NULL) { ! sprintf(gszMsgBox, "Can not find obj id = %1d.", obj_id); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! } else { attr_ptr = obj_ptr->fattr; ! for ( ; attr_ptr != NULL; attr_ptr=attr_ptr->next) { ! if (strcmp(AttrName, attr_ptr->attr_name.s) == 0 && ! strcmp(AttrColor, colorMenuItems[attr_ptr->obj->color]) == 0) { break; + } } ! if (attr_ptr == NULL) { ! sprintf(gszMsgBox, "Can not find attr name '%s' and color '%s'.", AttrName, AttrColor); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! } else { ! DynStrSet(&attr_ptr->attr_value, AttrVal); MyFormat(attr_ptr->attr_value.s); ! if (attr_ptr->nameshown) { ! sprintf(s, "%s%s", attr_ptr->attr_name.s, attr_ptr->attr_value.s); ! } else { ! strcpy(s, attr_ptr->attr_value.s); ! } ! if (attr_ptr->shown) RepaintFirstStr(attr_ptr->obj, s); ! DynStrSet(&attr_ptr->obj->detail.t->first->dyn_str, s); } } *** mainmenu.c.orig Tue Sep 30 13:23:28 1997 --- mainmenu.c Tue Sep 30 13:23:28 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mainmenu.c,v 3.1 1996/07/08 14:53:17 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mainmenu.c,v 3.3 1997/09/14 20:37:54 william Exp $ */ #include *************** *** 70,83 **** #define DEF_MAINMENUPINDIST 80 ! int pinnedMainMenu = FALSE; ! int mainMenuPinDistance = DEF_MAINMENUPINDIST; ! int mainMenuX; ! int mainMenuY; ! int mainMenuW; ! int mainMenuH; ! Window mainMenuWindow; ! int numStacking = 0; ! Window * stackingWins = NULL; typedef struct SubMenuRec { --- 68,83 ---- #define DEF_MAINMENUPINDIST 80 ! int pinnedMainMenu=FALSE; ! int mainMenuPinDistance=DEF_MAINMENUPINDIST; ! int mainMenuX=0; ! int mainMenuY=0; ! int mainMenuW=0; ! int mainMenuH=0; ! Window mainMenuWindow=None; ! int numStacking=0; ! Window *stackingWins=NULL; ! ! int titledPinnedMenu=FALSE; typedef struct SubMenuRec { *************** *** 132,140 **** win_attrs.save_under = True; ! win_attrs.override_redirect = True; XChangeWindowAttributes (mainDisplay, mainMenuWindow, CWSaveUnder | CWOverrideRedirect, &win_attrs); ! XSetTransientForHint (mainDisplay, mainMenuWindow, mainWindow); XSelectInput (mainDisplay, mainMenuWindow, StructureNotifyMask | --- 132,143 ---- win_attrs.save_under = True; ! win_attrs.override_redirect = (titledPinnedMenu ? False : True); XChangeWindowAttributes (mainDisplay, mainMenuWindow, CWSaveUnder | CWOverrideRedirect, &win_attrs); ! if (!titledPinnedMenu) { ! XSetTransientForHint (mainDisplay, mainMenuWindow, mainWindow); ! } ! XStoreName (mainDisplay, mainMenuWindow, "Main Menu"); XSelectInput (mainDisplay, mainMenuWindow, StructureNotifyMask | *************** *** 302,307 **** { case Button1: ! RepositionMainMenuWindow (button_ev->x_root, button_ev->y_root); ! break; case Button2: index = button_ev->y/defaultFontHeight; --- 305,313 ---- { case Button1: ! if (!titledPinnedMenu) { ! RepositionMainMenuWindow (button_ev->x_root, button_ev->y_root); ! break; ! } ! /* dropping through if titledPinnedMenu ! */ case Button2: index = button_ev->y/defaultFontHeight; *************** *** 899,905 **** switch (button_ev->button) { case Button1: ! RepositionSubMenuWindow(win, menu_index, button_ev->x_root, ! button_ev->y_root); ! break; case Button2: GetRowCol(menu_index, button_ev->x, button_ev->y, &down_row, --- 905,914 ---- switch (button_ev->button) { case Button1: ! if (!titledPinnedMenu) { ! RepositionSubMenuWindow(win, menu_index, button_ev->x_root, ! button_ev->y_root); ! break; ! } ! /* dropping through if titledPinnedMenu ! */ case Button2: GetRowCol(menu_index, button_ev->x, button_ev->y, &down_row, *************** *** 990,993 **** --- 999,1014 ---- } + void RealizeMainMenuWindow (win_x, win_y) + int win_x, win_y; + { + XMoveWindow(mainDisplay, mainMenuWindow, win_x, win_y); + XMapRaised(mainDisplay, mainMenuWindow); + XSetWindowColormap(mainDisplay, mainMenuWindow, mainColormap); + XDefineCursor(mainDisplay, mainMenuWindow, defaultCursor); + pinnedMainMenu = TRUE; + mainMenuX = win_x; + mainMenuY = win_y; + } + void RealizeSubMenuWindow (win_x, win_y, win_w, win_h) int win_x, win_y, win_w, win_h; *************** *** 1005,1014 **** win_attrs.save_under = True; ! win_attrs.override_redirect = True; win_attrs.colormap = mainColormap; XChangeWindowAttributes (mainDisplay, win, CWSaveUnder | CWOverrideRedirect | CWColormap, &win_attrs); ! XSetTransientForHint (mainDisplay, win, mainWindow); sizehints.flags = PSize | PMinSize | PMaxSize; --- 1026,1038 ---- win_attrs.save_under = True; ! win_attrs.override_redirect = (titledPinnedMenu ? False : True); win_attrs.colormap = mainColormap; XChangeWindowAttributes (mainDisplay, win, CWSaveUnder | CWOverrideRedirect | CWColormap, &win_attrs); ! if (!titledPinnedMenu) { ! XSetTransientForHint (mainDisplay, win, mainWindow); ! } ! XStoreName (mainDisplay, win, mainMenuDescription[activeMenu]); sizehints.flags = PSize | PMinSize | PMaxSize; *** mark.c.orig Tue Sep 30 13:23:30 1997 --- mark.c Tue Sep 30 13:23:30 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mark.c,v 3.0 1996/05/06 16:05:57 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mark.c,v 3.1 1997/09/14 20:37:54 william Exp $ */ #include *** menu.c.orig Tue Sep 30 13:23:31 1997 --- menu.c Tue Sep 30 13:23:31 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/menu.c,v 3.4 1997/01/30 17:08:30 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/menu.c,v 3.9 1997/09/14 20:37:54 william Exp $ */ #include *************** *** 98,102 **** "Help", NULL }; ! static char * mainMenuDescription[] = { "Mode Menu", "File Menu", --- 96,100 ---- "Help", NULL }; ! char * mainMenuDescription[] = { "Mode Menu", "File Menu", *************** *** 457,467 **** pinned_y = root_y; if (menuIsMainMenu) { ! XMoveWindow (mainDisplay, mainMenuWindow, pinned_x, pinned_y); ! XMapRaised (mainDisplay, mainMenuWindow); ! XSetWindowColormap (mainDisplay, mainMenuWindow, mainColormap); ! XDefineCursor (mainDisplay, mainMenuWindow, defaultCursor); ! pinnedMainMenu = TRUE; ! mainMenuX = pinned_x; ! mainMenuY = pinned_y; } else { RealizeSubMenuWindow (pinned_x, pinned_y, --- 455,459 ---- pinned_y = root_y; if (menuIsMainMenu) { ! RealizeMainMenuWindow (pinned_x, pinned_y); } else { RealizeSubMenuWindow (pinned_x, pinned_y, *************** *** 1158,1168 **** iconWindowCreated = FALSE; ! if (((c_ptr = XGetDefault(mainDisplay,TOOL_NAME,"UseWMIconPixmap")) != NULL) ! && UtilStrICmp(c_ptr,"True") == 0) return; ! if (((c_ptr = XGetDefault(mainDisplay,TOOL_NAME,"NoTgifIcon")) != NULL) ! && UtilStrICmp(c_ptr,"True") == 0) return; ! strcpy (s, drawPath); strcat (s, "/"); --- 1150,1161 ---- iconWindowCreated = FALSE; ! if (((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"UseWMIconPixmap")) != NULL) ! && UtilStrICmp(c_ptr,"True") == 0) { return; ! } ! if (((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"NoTgifIcon")) != NULL) ! && UtilStrICmp(c_ptr,"True") == 0) { return; ! } strcpy (s, drawPath); strcat (s, "/"); *** move.c.orig Tue Sep 30 13:23:33 1997 --- move.c Tue Sep 30 13:23:33 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/move.c,v 3.2 1996/11/30 01:35:40 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/move.c,v 3.4 1997/09/16 22:43:51 william Exp $ */ #include *************** *** 69,80 **** static ! void MovePoly (ObjPtr, Dx, Dy) ! register struct ObjRec * ObjPtr; ! register int Dx, Dy; { ! register int i; ! for (i = 0; i < ObjPtr->detail.p->n; i++) ! { ObjPtr->detail.p->vlist[i].x += Dx; ObjPtr->detail.p->vlist[i].y += Dy; --- 67,77 ---- static ! void MovePoly(ObjPtr, Dx, Dy) ! register struct ObjRec *ObjPtr; ! register int Dx, Dy; { ! register int i; ! for (i=0; i < ObjPtr->detail.p->n; i++) { ObjPtr->detail.p->vlist[i].x += Dx; ObjPtr->detail.p->vlist[i].y += Dy; *************** *** 83,94 **** static ! void MovePolygon (ObjPtr, Dx, Dy) ! register struct ObjRec * ObjPtr; ! register int Dx, Dy; { ! register int i; ! for (i = 0; i < ObjPtr->detail.g->n; i++) ! { ObjPtr->detail.g->vlist[i].x += Dx; ObjPtr->detail.g->vlist[i].y += Dy; --- 80,90 ---- static ! void MovePolygon(ObjPtr, Dx, Dy) ! register struct ObjRec *ObjPtr; ! register int Dx, Dy; { ! register int i; ! for (i=0; i < ObjPtr->detail.g->n; i++) { ObjPtr->detail.g->vlist[i].x += Dx; ObjPtr->detail.g->vlist[i].y += Dy; *************** *** 97,105 **** static ! void MoveArc (ObjPtr, Dx, Dy) ! struct ObjRec * ObjPtr; ! register int Dx, Dy; { ! register struct ArcRec * arc_ptr = ObjPtr->detail.a; arc_ptr->xc += Dx; arc_ptr->yc += Dy; --- 93,101 ---- static ! void MoveArc(ObjPtr, Dx, Dy) ! struct ObjRec *ObjPtr; ! register int Dx, Dy; { ! register struct ArcRec *arc_ptr=ObjPtr->detail.a; arc_ptr->xc += Dx; arc_ptr->yc += Dy; *************** *** 109,118 **** } ! void MoveObj (ObjPtr, Dx, Dy) ! struct ObjRec * ObjPtr; ! int Dx, Dy; { ! struct ObjRec * ptr; ! int saved_undoing_or_redoing=undoingOrRedoing; ObjPtr->x += Dx; --- 105,114 ---- } ! void MoveObj(ObjPtr, Dx, Dy) ! struct ObjRec *ObjPtr; ! int Dx, Dy; { ! struct ObjRec *ptr=NULL; ! int saved_undoing_or_redoing=undoingOrRedoing; ObjPtr->x += Dx; *************** *** 126,378 **** ObjPtr->obbox.rbx += Dx; ObjPtr->obbox.rby += Dy; ! MoveRotatedObjCache (ObjPtr, Dx, Dy); ! switch (ObjPtr->type) ! { ! case OBJ_POLY: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! MovePoly (ObjPtr, Dx, Dy); ! /* fake the undoingOrRedoing so that no */ ! /* actual auto-adjusting is done */ ! undoingOrRedoing = TRUE; ! AdjObjSplineVs (ObjPtr); ! undoingOrRedoing = saved_undoing_or_redoing; ! break; ! case OBJ_BOX: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_OVAL: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_TEXT: ! break; ! case OBJ_POLYGON: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! MovePolygon (ObjPtr, Dx, Dy); ! AdjObjSplineVs (ObjPtr); ! break; ! case OBJ_ARC: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! MoveArc(ObjPtr, Dx, Dy); ! AdjObjSplineVs(ObjPtr); ! break; ! case OBJ_RCBOX: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_XBM: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_XPM: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_SYM: ! case OBJ_ICON: ! case OBJ_GROUP: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! for (ptr = ObjPtr->detail.r->first; ptr != NULL; ptr = ptr->next) ! MoveObj (ptr, Dx, Dy); ! break; } } ! void MoveAllSelObjects (Dx, Dy) ! register int Dx, Dy; { ! register struct SelRec * sel_ptr; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! if (!sel_ptr->obj->locked) ! MoveObj (sel_ptr->obj, Dx, Dy); ! if (numObjLocked != 0) Msg ("Locked objects are not moved."); } static ! void MarkObjectsForMove () { ! register struct ObjRec * obj_ptr; ! register struct SelRec * sel_ptr; ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) obj_ptr->marked = FALSE; ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) sel_ptr->obj->marked = TRUE; } static ! int EndPtInObjList (XOff, YOff, FirstObjPtr) ! int XOff, YOff; ! struct ObjRec * FirstObjPtr; /* XOff and YOff are screen offsets */ { ! register struct ObjRec * obj_ptr; ! register struct AttrRec * attr_ptr; ! int found, saved_fill; ! ! for (obj_ptr = FirstObjPtr; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! { ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) ! return (TRUE); ! if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) ! { ! switch (obj_ptr->type) ! { ! case OBJ_TEXT: ! if (FindGoodText (XOff,YOff,obj_ptr)) return (TRUE); break; ! case OBJ_XBM: ! if (FindGoodXBm (XOff,YOff,obj_ptr)) return (TRUE); break; ! case OBJ_XPM: ! if (FindGoodXPm (XOff,YOff,obj_ptr)) return (TRUE); break; ! case OBJ_BOX: ! saved_fill = obj_ptr->detail.b->fill; ! obj_ptr->detail.b->fill = SOLIDPAT; ! found = FindGoodBox (XOff,YOff,obj_ptr); ! obj_ptr->detail.b->fill = saved_fill; ! if (found) return (TRUE); ! break; ! case OBJ_OVAL: ! saved_fill = obj_ptr->detail.o->fill; ! obj_ptr->detail.o->fill = SOLIDPAT; ! found = FindGoodOval (XOff,YOff,obj_ptr); ! obj_ptr->detail.o->fill = saved_fill; ! if (found) return (TRUE); ! break; ! case OBJ_POLY: ! if (FindGoodPoly (XOff,YOff,obj_ptr)) return (TRUE); ! break; ! case OBJ_POLYGON: ! saved_fill = obj_ptr->detail.g->fill; ! obj_ptr->detail.g->fill = SOLIDPAT; ! found = FindGoodPolygon (XOff,YOff,obj_ptr); ! obj_ptr->detail.g->fill = saved_fill; ! if (found) return (TRUE); ! break; ! case OBJ_ARC: ! if (FindGoodArc (XOff,YOff,obj_ptr)) return (TRUE); ! break; ! case OBJ_RCBOX: ! saved_fill = obj_ptr->detail.rcb->fill; ! obj_ptr->detail.rcb->fill = SOLIDPAT; ! found = FindGoodRCBox (XOff,YOff,obj_ptr); ! obj_ptr->detail.rcb->fill = saved_fill; ! if (found) return (TRUE); ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! if (EndPtInObjList (XOff,YOff,obj_ptr->detail.r->first)) ! return (TRUE); ! break; } } } ! return (FALSE); } ! int EndPtInSelected (XOff, YOff) ! int XOff, YOff; /* XOff and YOff are screen offsets */ { ! register struct SelRec * sel_ptr; ! register struct ObjRec * obj_ptr; ! register struct AttrRec * attr_ptr; ! int found, saved_fill; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! { obj_ptr = sel_ptr->obj; if (obj_ptr->locked) continue; ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) ! return (TRUE); if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) ! { ! switch (obj_ptr->type) ! { ! case OBJ_TEXT: ! if (FindGoodText (XOff,YOff,obj_ptr)) return (TRUE); break; ! case OBJ_XBM: ! if (FindGoodXBm (XOff,YOff,obj_ptr)) return (TRUE); break; ! case OBJ_XPM: ! if (FindGoodXPm (XOff,YOff,obj_ptr)) return (TRUE); break; ! case OBJ_BOX: ! saved_fill = obj_ptr->detail.b->fill; ! obj_ptr->detail.b->fill = SOLIDPAT; ! found = FindGoodBox (XOff,YOff,obj_ptr); ! obj_ptr->detail.b->fill = saved_fill; ! if (found) return (TRUE); ! break; ! case OBJ_OVAL: ! saved_fill = obj_ptr->detail.o->fill; ! obj_ptr->detail.o->fill = SOLIDPAT; ! found = FindGoodOval (XOff,YOff,obj_ptr); ! obj_ptr->detail.o->fill = saved_fill; ! if (found) return (TRUE); ! break; ! case OBJ_POLY: ! if (FindGoodPoly (XOff,YOff,obj_ptr)) return (TRUE); ! break; ! case OBJ_POLYGON: ! saved_fill = obj_ptr->detail.g->fill; ! obj_ptr->detail.g->fill = SOLIDPAT; ! found = FindGoodPolygon (XOff,YOff,obj_ptr); ! obj_ptr->detail.g->fill = saved_fill; ! if (found) return (TRUE); ! break; ! case OBJ_ARC: ! if (FindGoodArc (XOff,YOff,obj_ptr)) return (TRUE); ! break; ! case OBJ_RCBOX: ! saved_fill = obj_ptr->detail.rcb->fill; ! obj_ptr->detail.rcb->fill = SOLIDPAT; ! found = FindGoodRCBox (XOff,YOff,obj_ptr); ! obj_ptr->detail.rcb->fill = saved_fill; ! if (found) return (TRUE); ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! if (EndPtInObjList (XOff,YOff,obj_ptr->detail.r->first)) ! return (TRUE); ! break; } } } ! return (FALSE); } static ! int ConstrainedMoveAllSel (Dx, Dy, ltx, lty, rbx, rby) ! register int Dx, Dy; ! int * ltx, * lty, * rbx, * rby; { ! register struct ObjRec * obj_ptr; ! int something_stretched = FALSE, num_pts; ! int x_off, y_off, move_first, move_last; ! IntPoint * v; ! ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) ! { ! if (!obj_ptr->marked && obj_ptr->type==OBJ_POLY && !obj_ptr->locked) ! { num_pts = obj_ptr->detail.p->n; v = obj_ptr->detail.p->vlist; --- 122,361 ---- ObjPtr->obbox.rbx += Dx; ObjPtr->obbox.rby += Dy; ! MoveRotatedObjCache(ObjPtr, Dx, Dy); ! switch (ObjPtr->type) { ! case OBJ_POLY: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! MovePoly(ObjPtr, Dx, Dy); ! /* fake the undoingOrRedoing so that no */ ! /* actual auto-adjusting is done */ ! undoingOrRedoing = TRUE; ! AdjObjSplineVs(ObjPtr); ! undoingOrRedoing = saved_undoing_or_redoing; ! break; ! case OBJ_BOX: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_OVAL: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_TEXT: ! break; ! case OBJ_POLYGON: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! MovePolygon(ObjPtr, Dx, Dy); ! AdjObjSplineVs(ObjPtr); ! break; ! case OBJ_ARC: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! MoveArc(ObjPtr, Dx, Dy); ! AdjObjSplineVs(ObjPtr); ! break; ! case OBJ_RCBOX: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_XBM: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_XPM: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! break; ! case OBJ_SYM: ! case OBJ_ICON: ! case OBJ_GROUP: ! MoveAttrs(ObjPtr->fattr, Dx, Dy); ! for (ptr=ObjPtr->detail.r->first; ptr != NULL; ptr=ptr->next) { ! MoveObj(ptr, Dx, Dy); ! } ! break; } } ! void MoveAllSelObjects(Dx, Dy) ! register int Dx, Dy; { ! register struct SelRec *sel_ptr; ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! if (!sel_ptr->obj->locked) { ! MoveObj(sel_ptr->obj, Dx, Dy); ! } ! } ! if (numObjLocked != 0) Msg("Locked objects are not moved."); } static ! void MarkObjectsForMove() { ! register struct ObjRec *obj_ptr; ! register struct SelRec *sel_ptr; ! for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { obj_ptr->marked = FALSE; + } ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { sel_ptr->obj->marked = TRUE; + } } static ! int EndPtInObjList(XOff, YOff, FirstObjPtr) ! int XOff, YOff; ! struct ObjRec *FirstObjPtr; /* XOff and YOff are screen offsets */ { ! register struct ObjRec *obj_ptr; ! register struct AttrRec *attr_ptr; ! int found=FALSE, saved_fill; ! ! for (obj_ptr=FirstObjPtr; obj_ptr != NULL; obj_ptr=obj_ptr->next) { ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) { if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) { ! return TRUE; ! } ! } if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! switch (obj_ptr->type) { ! case OBJ_TEXT: if (FindGoodText(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_XBM: if (FindGoodXBm(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_XPM: if (FindGoodXPm(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_BOX: ! saved_fill = obj_ptr->detail.b->fill; ! obj_ptr->detail.b->fill = SOLIDPAT; ! found = FindGoodBox(XOff,YOff,obj_ptr); ! obj_ptr->detail.b->fill = saved_fill; ! if (found) return TRUE; ! break; ! case OBJ_OVAL: ! saved_fill = obj_ptr->detail.o->fill; ! obj_ptr->detail.o->fill = SOLIDPAT; ! found = FindGoodOval(XOff,YOff,obj_ptr); ! obj_ptr->detail.o->fill = saved_fill; ! if (found) return TRUE; ! break; ! case OBJ_POLY: if (FindGoodPoly(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_POLYGON: ! saved_fill = obj_ptr->detail.g->fill; ! obj_ptr->detail.g->fill = SOLIDPAT; ! found = FindGoodPolygon(XOff,YOff,obj_ptr); ! obj_ptr->detail.g->fill = saved_fill; ! if (found) return TRUE; ! break; ! case OBJ_ARC: if (FindGoodArc(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_RCBOX: ! saved_fill = obj_ptr->detail.rcb->fill; ! obj_ptr->detail.rcb->fill = SOLIDPAT; ! found = FindGoodRCBox(XOff,YOff,obj_ptr); ! obj_ptr->detail.rcb->fill = saved_fill; ! if (found) return TRUE; ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! if (EndPtInObjList(XOff,YOff,obj_ptr->detail.r->first)) { ! return TRUE; ! } ! break; } } } ! return FALSE; } ! int EndPtInSelected(XOff, YOff) ! int XOff, YOff; /* XOff and YOff are screen offsets */ { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr; ! register struct AttrRec *attr_ptr; ! int found, saved_fill; ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { obj_ptr = sel_ptr->obj; if (obj_ptr->locked) continue; ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) { if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) { ! return TRUE; ! } ! } if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! switch (obj_ptr->type) { ! case OBJ_TEXT: if (FindGoodText(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_XBM: if (FindGoodXBm(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_XPM: if (FindGoodXPm(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_BOX: ! saved_fill = obj_ptr->detail.b->fill; ! obj_ptr->detail.b->fill = SOLIDPAT; ! found = FindGoodBox(XOff,YOff,obj_ptr); ! obj_ptr->detail.b->fill = saved_fill; ! if (found) return TRUE; ! break; ! case OBJ_OVAL: ! saved_fill = obj_ptr->detail.o->fill; ! obj_ptr->detail.o->fill = SOLIDPAT; ! found = FindGoodOval(XOff,YOff,obj_ptr); ! obj_ptr->detail.o->fill = saved_fill; ! if (found) return TRUE; ! break; ! case OBJ_POLY: if (FindGoodPoly(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_POLYGON: ! saved_fill = obj_ptr->detail.g->fill; ! obj_ptr->detail.g->fill = SOLIDPAT; ! found = FindGoodPolygon(XOff,YOff,obj_ptr); ! obj_ptr->detail.g->fill = saved_fill; ! if (found) return TRUE; ! break; ! case OBJ_ARC: if (FindGoodArc(XOff,YOff,obj_ptr)) return TRUE; break; ! case OBJ_RCBOX: ! saved_fill = obj_ptr->detail.rcb->fill; ! obj_ptr->detail.rcb->fill = SOLIDPAT; ! found = FindGoodRCBox(XOff,YOff,obj_ptr); ! obj_ptr->detail.rcb->fill = saved_fill; ! if (found) return TRUE; ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! if (EndPtInObjList(XOff,YOff,obj_ptr->detail.r->first)) { ! return TRUE; ! } ! break; } } } ! return FALSE; } static ! int ConstrainedMoveAllSel(Dx, Dy, ltx, lty, rbx, rby) ! register int Dx, Dy; ! int *ltx, *lty, *rbx, *rby; { ! register struct ObjRec *obj_ptr; ! int something_stretched=FALSE, num_pts; ! int x_off, y_off, move_first, move_last; ! IntPoint *v; ! ! for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! if (!obj_ptr->marked && obj_ptr->type==OBJ_POLY && !obj_ptr->locked) { num_pts = obj_ptr->detail.p->n; v = obj_ptr->detail.p->vlist; *************** *** 380,386 **** if (obj_ptr->ctm == NULL) { x_off = OFFSET_X(v[0].x); y_off = OFFSET_Y(v[0].y); ! move_first = EndPtInSelected (x_off, y_off); x_off = OFFSET_X(v[num_pts-1].x); y_off = OFFSET_Y(v[num_pts-1].y); ! move_last = EndPtInSelected (x_off, y_off); } else { int tmp_x, tmp_y; --- 363,369 ---- if (obj_ptr->ctm == NULL) { x_off = OFFSET_X(v[0].x); y_off = OFFSET_Y(v[0].y); ! move_first = EndPtInSelected(x_off, y_off); x_off = OFFSET_X(v[num_pts-1].x); y_off = OFFSET_Y(v[num_pts-1].y); ! move_last = EndPtInSelected(x_off, y_off); } else { int tmp_x, tmp_y; *************** *** 391,395 **** tmp_y += obj_ptr->y; x_off = OFFSET_X(tmp_x); y_off = OFFSET_Y(tmp_y); ! move_first = EndPtInSelected (x_off, y_off); TransformPointThroughCTM(v[num_pts-1].x-obj_ptr->x, v[num_pts-1].y-obj_ptr->y, obj_ptr->ctm, &tmp_x, &tmp_y); --- 374,378 ---- tmp_y += obj_ptr->y; x_off = OFFSET_X(tmp_x); y_off = OFFSET_Y(tmp_y); ! move_first = EndPtInSelected(x_off, y_off); TransformPointThroughCTM(v[num_pts-1].x-obj_ptr->x, v[num_pts-1].y-obj_ptr->y, obj_ptr->ctm, &tmp_x, &tmp_y); *************** *** 397,406 **** tmp_y += obj_ptr->y; x_off = OFFSET_X(tmp_x); y_off = OFFSET_Y(tmp_y); ! move_last = EndPtInSelected (x_off, y_off); } ! if (move_first || move_last) ! { ! PrepareToReplaceAnObj (obj_ptr); if (obj_ptr->ctm != NULL) { --- 380,388 ---- tmp_y += obj_ptr->y; x_off = OFFSET_X(tmp_x); y_off = OFFSET_Y(tmp_y); ! move_last = EndPtInSelected(x_off, y_off); } ! if (move_first || move_last) { ! PrepareToReplaceAnObj(obj_ptr); if (obj_ptr->ctm != NULL) { *************** *** 420,447 **** UpdPolyBBox(obj_ptr, num_pts, v); } ! if (something_stretched) ! { if (obj_ptr->bbox.ltx < *ltx) *ltx = obj_ptr->bbox.ltx; if (obj_ptr->bbox.lty < *lty) *lty = obj_ptr->bbox.lty; if (obj_ptr->bbox.rbx > *rbx) *rbx = obj_ptr->bbox.rbx; if (obj_ptr->bbox.rby > *rby) *rby = obj_ptr->bbox.rby; ! } ! else ! { *ltx = obj_ptr->bbox.ltx; *lty = obj_ptr->bbox.lty; *rbx = obj_ptr->bbox.rbx; *rby = obj_ptr->bbox.rby; } something_stretched = TRUE; ! if (move_first && move_last) ! MoveObj (obj_ptr, Dx, Dy); ! else ! { ! int index=INVALID, seg_dx=0, seg_dy=0; ! int cur_seg_dx=0, cur_seg_dy=0; ! ! if (move_first) ! { ! if (num_pts > 2) ! { index = 1; cur_seg_dx = v[index-1].x - v[index].x; --- 402,423 ---- UpdPolyBBox(obj_ptr, num_pts, v); } ! if (something_stretched) { if (obj_ptr->bbox.ltx < *ltx) *ltx = obj_ptr->bbox.ltx; if (obj_ptr->bbox.lty < *lty) *lty = obj_ptr->bbox.lty; if (obj_ptr->bbox.rbx > *rbx) *rbx = obj_ptr->bbox.rbx; if (obj_ptr->bbox.rby > *rby) *rby = obj_ptr->bbox.rby; ! } else { *ltx = obj_ptr->bbox.ltx; *lty = obj_ptr->bbox.lty; *rbx = obj_ptr->bbox.rbx; *rby = obj_ptr->bbox.rby; } something_stretched = TRUE; ! if (move_first && move_last) { ! MoveObj(obj_ptr, Dx, Dy); ! } else { ! int index=INVALID, seg_dx=0, seg_dy=0; ! int cur_seg_dx=0, cur_seg_dy=0; ! ! if (move_first) { ! if (num_pts > 2) { index = 1; cur_seg_dx = v[index-1].x - v[index].x; *************** *** 451,459 **** } v[0].x += Dx; v[0].y += Dy; ! } ! else ! { ! if (num_pts > 2) ! { index = num_pts-2; cur_seg_dx = v[index+1].x - v[index].x; --- 427,432 ---- } v[0].x += Dx; v[0].y += Dy; ! } else { ! if (num_pts > 2) { index = num_pts-2; cur_seg_dx = v[index+1].x - v[index].x; *************** *** 465,491 **** } if (num_pts>2 && cur_seg_dy==0 && cur_seg_dx!=0 && ! (seg_dy!=0 || (seg_dy==0 && Dx==0))) v[index].y += Dy; ! else if (num_pts>2 && cur_seg_dx==0 && cur_seg_dy!=0 && ! (seg_dx!=0 || (seg_dx==0 && Dy==0))) v[index].x += Dx; } ! AdjObjSplineVs (obj_ptr); ! if (obj_ptr->detail.p->curved != LT_INTSPLINE) ! UpdPolyBBox (obj_ptr, num_pts, v); ! else ! UpdPolyBBox (obj_ptr, obj_ptr->detail.p->intn, obj_ptr->detail.p->intvlist); ! if (AutoCenterAttr (obj_ptr)) ! { ! struct AttrRec * attr_ptr=obj_ptr->fattr; ! int modified=FALSE; ! ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) ! if (attr_ptr->shown) ! { ! struct BBRec bbox; ! CenterObjInOBBox (attr_ptr->obj, obj_ptr->obbox, &bbox); if (bbox.ltx < *ltx) *ltx = bbox.ltx; --- 438,464 ---- } if (num_pts>2 && cur_seg_dy==0 && cur_seg_dx!=0 && ! (seg_dy!=0 || (seg_dy==0 && Dx==0))) { v[index].y += Dy; ! } else if (num_pts>2 && cur_seg_dx==0 && cur_seg_dy!=0 && ! (seg_dx!=0 || (seg_dx==0 && Dy==0))) { v[index].x += Dx; + } } ! AdjObjSplineVs(obj_ptr); ! if (obj_ptr->detail.p->curved != LT_INTSPLINE) { ! UpdPolyBBox(obj_ptr, num_pts, v); ! } else { ! UpdPolyBBox(obj_ptr, obj_ptr->detail.p->intn, obj_ptr->detail.p->intvlist); ! } ! if (AutoCenterAttr(obj_ptr)) { ! struct AttrRec *attr_ptr=obj_ptr->fattr; ! int modified=FALSE; ! ! for ( ; attr_ptr != NULL; attr_ptr=attr_ptr->next) { ! if (attr_ptr->shown) { ! struct BBRec bbox; ! CenterObjInOBBox(attr_ptr->obj, obj_ptr->obbox, &bbox); if (bbox.ltx < *ltx) *ltx = bbox.ltx; *************** *** 495,499 **** modified = TRUE; } ! if (modified) AdjObjBBox (obj_ptr); } if (obj_ptr->bbox.ltx < *ltx) *ltx = obj_ptr->bbox.ltx; --- 468,473 ---- modified = TRUE; } ! } ! if (modified) AdjObjBBox(obj_ptr); } if (obj_ptr->bbox.ltx < *ltx) *ltx = obj_ptr->bbox.ltx; *************** *** 501,518 **** if (obj_ptr->bbox.rbx > *rbx) *rbx = obj_ptr->bbox.rbx; if (obj_ptr->bbox.rby > *rby) *rby = obj_ptr->bbox.rby; ! RecordReplaceAnObj (obj_ptr); } } } ! MoveAllSelObjects (Dx, Dy); ! return (something_stretched); } ! void MoveAllSel (Dx, Dy) ! register int Dx, Dy; { ! int ltx, lty, rbx, rby; ! struct MoveSubCmdRec * move_cmd; ! struct SubCmdRec * sub_cmd; move_cmd = (struct MoveSubCmdRec *)malloc(sizeof(struct MoveSubCmdRec)); --- 475,492 ---- if (obj_ptr->bbox.rbx > *rbx) *rbx = obj_ptr->bbox.rbx; if (obj_ptr->bbox.rby > *rby) *rby = obj_ptr->bbox.rby; ! RecordReplaceAnObj(obj_ptr); } } } ! MoveAllSelObjects(Dx, Dy); ! return something_stretched; } ! void MoveAllSel(Dx, Dy) ! register int Dx, Dy; { ! int ltx, lty, rbx, rby; ! struct MoveSubCmdRec *move_cmd; ! struct SubCmdRec *sub_cmd; move_cmd = (struct MoveSubCmdRec *)malloc(sizeof(struct MoveSubCmdRec)); *************** *** 525,559 **** move_cmd->dy = Dy; ! if (moveMode==CONST_MOVE && !justDupped) ! { ! MarkObjectsForMove (); ! ! StartCompositeCmd (); ! PrepareToRecord (CMD_MOVE, NULL, NULL, 0); ! RecordCmd (CMD_MOVE, sub_cmd, topSel, botSel, numObjSelected); ! if (ConstrainedMoveAllSel (Dx, Dy, <x, <y, &rbx, &rby)) ! { ltx = min(ltx,min(selLtX,selLtX+Dx)); lty = min(lty,min(selLtY,selLtY+Dy)); rbx = max(rbx,max(selRbX,selRbX+Dx)); rby = max(rby,max(selRbY,selRbY+Dy)); ! RedrawAnArea (botObj, ltx-GRID_ABS_SIZE(1), lty-GRID_ABS_SIZE(1), rbx+GRID_ABS_SIZE(1), rby+GRID_ABS_SIZE(1)); ! } ! else ! RedrawAreas (botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1), selLtX-GRID_ABS_SIZE(1)+Dx, selLtY-GRID_ABS_SIZE(1)+Dy, selRbX+GRID_ABS_SIZE(1)+Dx, selRbY+GRID_ABS_SIZE(1)+Dy); ! EndCompositeCmd (); ! } ! else ! { ! MoveAllSelObjects (Dx, Dy); ! PrepareToRecord (CMD_MOVE, NULL, NULL, 0); ! RecordCmd (CMD_MOVE, sub_cmd, topSel, botSel, numObjSelected); ! RedrawAreas (botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1), --- 499,529 ---- move_cmd->dy = Dy; ! if (moveMode==CONST_MOVE && !justDupped) { ! MarkObjectsForMove(); ! ! StartCompositeCmd(); ! PrepareToRecord(CMD_MOVE, NULL, NULL, 0); ! RecordCmd(CMD_MOVE, sub_cmd, topSel, botSel, numObjSelected); ! if (ConstrainedMoveAllSel(Dx, Dy, <x, <y, &rbx, &rby)) { ltx = min(ltx,min(selLtX,selLtX+Dx)); lty = min(lty,min(selLtY,selLtY+Dy)); rbx = max(rbx,max(selRbX,selRbX+Dx)); rby = max(rby,max(selRbY,selRbY+Dy)); ! RedrawAnArea(botObj, ltx-GRID_ABS_SIZE(1), lty-GRID_ABS_SIZE(1), rbx+GRID_ABS_SIZE(1), rby+GRID_ABS_SIZE(1)); ! } else { ! RedrawAreas(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1), selLtX-GRID_ABS_SIZE(1)+Dx, selLtY-GRID_ABS_SIZE(1)+Dy, selRbX+GRID_ABS_SIZE(1)+Dx, selRbY+GRID_ABS_SIZE(1)+Dy); ! } ! EndCompositeCmd(); ! } else { ! MoveAllSelObjects(Dx, Dy); ! PrepareToRecord(CMD_MOVE, NULL, NULL, 0); ! RecordCmd(CMD_MOVE, sub_cmd, topSel, botSel, numObjSelected); ! RedrawAreas(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1), *************** *** 565,611 **** } ! void MoveSel (OrigX, OrigY, ObjPtr, down_button_ev) ! int OrigX, OrigY; ! struct ObjRec * ObjPtr; ! XButtonEvent * down_button_ev; { ! register int i, num_pts = 0; ! struct PolyRec * poly_ptr = NULL; ! struct PolygonRec * polygon_ptr = NULL; ! struct ArcRec * arc_ptr = NULL; ! struct ObjRec * arc_obj_ptr = NULL; ! struct BBRec bbox, o_bbox; ! IntPoint *cntrlv=NULL, *polyv=NULL; ! XPoint obj_obbox_vs[5], *v=NULL, *sv=NULL, *pv=NULL; ! int ltx = 0, lty = 0, rbx = 0, rby = 0, sn = 0; ! int sel_ltx, sel_lty, sel_rbx, sel_rby, curved = FALSE; ! int ruler_ltx, ruler_lty, ruler_rbx, ruler_rby; ! int x, y, moving = TRUE, dx, dy; ! int w = 0, h = 0, angle1 = 0, angle2 = 0; ! int xc = 0, yc = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0; ! int grid_x = OrigX, grid_y = OrigY, radius = 0; ! int saved_xc = 0, saved_yc = 0, saved_x1 = 0, saved_y1 = 0; ! int saved_x2 = 0, saved_y2 = 0; ! int saved_ltx = 0, saved_lty = 0, intn=0; ! char buf[80], x_buf[80], y_buf[80], * smooth=NULL; ! XEvent input, ev; ! Time down_click_time=(Time)0; if (down_button_ev != NULL) { down_click_time = down_button_ev->time; } ! if (numObjSelected == numObjLocked) ! { ! Msg ("Locked object(s) can not be moved."); return; } ! XFlush (mainDisplay); ! XSync (mainDisplay, False); ! ! if (XCheckMaskEvent (mainDisplay, ExposureMask, &ev) || ! XCheckMaskEvent (mainDisplay, VisibilityChangeMask, &ev)) ! ExposeEventHandler (&ev, TRUE); sel_ltx = OFFSET_X(selLtX) - 1; sel_lty = OFFSET_Y(selLtY) - 1; sel_rbx = OFFSET_X(selRbX) + 1; sel_rby = OFFSET_Y(selRbY) + 1; --- 535,580 ---- } ! void MoveSel(OrigX, OrigY, ObjPtr, down_button_ev) ! int OrigX, OrigY; ! struct ObjRec *ObjPtr; ! XButtonEvent *down_button_ev; { ! register int i, num_pts=0; ! struct PolyRec *poly_ptr=NULL; ! struct PolygonRec *polygon_ptr=NULL; ! struct ArcRec *arc_ptr=NULL; ! struct ObjRec *arc_obj_ptr=NULL; ! struct BBRec bbox, o_bbox; ! IntPoint *cntrlv=NULL, *polyv=NULL; ! XPoint obj_obbox_vs[5], *v=NULL, *sv=NULL, *pv=NULL; ! int ltx=0, lty=0, rbx=0, rby=0, sn=0; ! int sel_ltx, sel_lty, sel_rbx, sel_rby, curved=FALSE; ! int ruler_ltx, ruler_lty, ruler_rbx, ruler_rby; ! int x, y, moving=TRUE, dx, dy; ! int w=0, h=0, angle1=0, angle2=0; ! int xc=0, yc=0, x1=0, y1=0, x2=0, y2=0; ! int grid_x=OrigX, grid_y=OrigY, radius=0; ! int saved_xc=0, saved_yc=0, saved_x1=0, saved_y1=0; ! int saved_x2=0, saved_y2=0; ! int saved_ltx=0, saved_lty=0, intn=0; ! char buf[80], x_buf[80], y_buf[80], *smooth=NULL; ! XEvent input, ev; ! Time down_click_time=(Time)0; if (down_button_ev != NULL) { down_click_time = down_button_ev->time; } ! if (numObjSelected == numObjLocked) { ! Msg("Locked object(s) can not be moved."); return; } ! XFlush(mainDisplay); ! XSync(mainDisplay, False); + if (XCheckMaskEvent(mainDisplay, ExposureMask, &ev) || + XCheckMaskEvent(mainDisplay, VisibilityChangeMask, &ev)) { + ExposeEventHandler(&ev, TRUE); + } sel_ltx = OFFSET_X(selLtX) - 1; sel_lty = OFFSET_Y(selLtY) - 1; sel_rbx = OFFSET_X(selRbX) + 1; sel_rby = OFFSET_Y(selRbY) + 1; *************** *** 621,835 **** BeginIntervalRulers(ruler_ltx, ruler_lty, ruler_rbx, ruler_rby); ! switch (ObjPtr->type) ! { ! case OBJ_BOX: ! case OBJ_XBM: ! case OBJ_XPM: ! case OBJ_TEXT: ! if (ObjPtr->ctm == NULL) ! { ! ltx = OFFSET_X(ObjPtr->obbox.ltx); ! lty = OFFSET_Y(ObjPtr->obbox.lty); ! rbx = OFFSET_X(ObjPtr->obbox.rbx); ! rby = OFFSET_Y(ObjPtr->obbox.rby); ! SelBox (drawWindow, revDefaultGC, ltx, lty, rbx, rby); ! } ! else ! { ! memcpy (obj_obbox_vs, ObjPtr->rotated_obbox, 5*sizeof(XPoint)); ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, obj_obbox_vs, 5, ! CoordModeOrigin); } ! break; ! case OBJ_RCBOX: ! if (ObjPtr->ctm == NULL) { ! ltx = OFFSET_X(ObjPtr->obbox.ltx); ! lty = OFFSET_Y(ObjPtr->obbox.lty); ! rbx = OFFSET_X(ObjPtr->obbox.rbx); ! rby = OFFSET_Y(ObjPtr->obbox.rby); ! radius = ObjPtr->detail.rcb->radius; ! SetRCBoxVertex (ltx, lty, rbx, rby, radius); ! MyRCBox (drawWindow, revDefaultGC, ltx, lty, rbx, rby, radius); } else { - sn = ObjPtr->detail.rcb->rotated_n; - sv = (XPoint*)malloc(sn*sizeof(XPoint)); - pv = (XPoint*)malloc(sn*sizeof(XPoint)); - if (sv == NULL || pv == NULL) FailAllocMessage(); - for (i=0; i < sn; i++) { - pv[i].x = sv[i].x = ObjPtr->detail.rcb->rotated_vlist[i].x; - pv[i].y = sv[i].y = ObjPtr->detail.rcb->rotated_vlist[i].y; - } XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, CoordModeOrigin); } ! break; ! case OBJ_ARC: if (ObjPtr->ctm == NULL) { ! arc_obj_ptr = DupObj(ObjPtr); ! arc_ptr = arc_obj_ptr->detail.a; ! ltx = OFFSET_X(arc_ptr->ltx); lty = OFFSET_Y(arc_ptr->lty); ! w = OFFSET_X(arc_ptr->ltx+arc_ptr->w)-ltx; ! h = OFFSET_Y(arc_ptr->lty+arc_ptr->h)-lty; ! angle1 = arc_ptr->angle1; angle2 = arc_ptr->angle2; ! xc = OFFSET_X(arc_ptr->xc); yc = OFFSET_Y(arc_ptr->yc); ! x1 = OFFSET_X(arc_ptr->x1); y1 = OFFSET_Y(arc_ptr->y1); ! ArcRealX2Y2(arc_ptr, &x2, &y2); ! x2 = OFFSET_X(x2); y2 = OFFSET_Y(y2); ! saved_xc = xc; saved_yc = yc; ! saved_x1 = x1; saved_y1 = y1; ! saved_x2 = x2; saved_y2 = y2; ! saved_ltx = ltx; saved_lty = lty; ! if (arc_ptr->fill != NONEPAT) { ! XDrawLine(mainDisplay, drawWindow, revDefaultGC, xc, yc, x1, y1); ! XDrawLine(mainDisplay, drawWindow, revDefaultGC, xc, yc, x2, y2); } - XDrawArc(mainDisplay, drawWindow, revDefaultGC, ltx, lty, w, h, - angle1, angle2); } else { ! arc_ptr = ObjPtr->detail.a; ! sn = ObjPtr->detail.a->rotated_n; ! sv = (XPoint*)malloc((sn+2)*sizeof(XPoint)); ! pv = (XPoint*)malloc((sn+2)*sizeof(XPoint)); ! if (sv == NULL || pv == NULL) FailAllocMessage(); ! for (i=0; i < sn+2; i++) { ! pv[i].x = sv[i].x = ObjPtr->detail.a->rotated_vlist[i].x; ! pv[i].y = sv[i].y = ObjPtr->detail.a->rotated_vlist[i].y; ! } ! if (arc_ptr->fill != NONEPAT) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn+2, ! CoordModeOrigin); ! } else { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); } } ! break; ! case OBJ_OVAL: ! if (ObjPtr->ctm == NULL) { ! num_pts = 13; ! bbox.ltx = OFFSET_X(ObjPtr->obbox.ltx); ! bbox.lty = OFFSET_Y(ObjPtr->obbox.lty); ! bbox.rbx = OFFSET_X(ObjPtr->obbox.rbx); ! bbox.rby = OFFSET_Y(ObjPtr->obbox.rby); ! MyOval (drawWindow, revDefaultGC, bbox); } else { ! sn = ObjPtr->detail.o->rotated_n; ! sv = (XPoint*)malloc(sn*sizeof(XPoint)); ! pv = (XPoint*)malloc(sn*sizeof(XPoint)); ! if (sv == NULL || pv == NULL) FailAllocMessage(); ! for (i=0; i < sn; i++) { ! pv[i].x = sv[i].x = ObjPtr->detail.o->rotated_vlist[i].x; ! pv[i].y = sv[i].y = ObjPtr->detail.o->rotated_vlist[i].y; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); } ! break; ! case OBJ_POLY: ! poly_ptr = ObjPtr->detail.p; ! curved = poly_ptr->curved; ! num_pts = poly_ptr->n; ! if (splineRubberband) { ! polyv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); ! if (polyv == NULL) FailAllocMessage(); ! if (curved != LT_INTSPLINE && poly_ptr->smooth != NULL) { ! smooth = (char*)malloc((num_pts+1)*sizeof(char)); ! if (smooth == NULL) FailAllocMessage(); ! } ! if (ObjPtr->ctm == NULL) { ! for (i = 0; i < num_pts; i++) { ! polyv[i].x = poly_ptr->vlist[i].x; ! polyv[i].y = poly_ptr->vlist[i].y; ! if (smooth != NULL) smooth[i] = poly_ptr->smooth[i]; ! } ! } else { ! for (i = 0; i < num_pts; i++) { ! int x, y; ! ! TransformPointThroughCTM(poly_ptr->vlist[i].x-ObjPtr->x, ! poly_ptr->vlist[i].y-ObjPtr->y, ObjPtr->ctm, &x, &y); ! polyv[i].x = x+ObjPtr->x; ! polyv[i].y = y+ObjPtr->y; ! if (smooth != NULL) smooth[i] = poly_ptr->smooth[i]; ! } ! } ! if (curved != LT_INTSPLINE) { ! sv = MakeMultiSplinePolyVertex (&sn, smooth, ! drawOrigX, drawOrigY, num_pts, polyv); ! } else { ! sv = MakeIntSplinePolyVertex (&sn, &intn, &cntrlv, drawOrigX, ! drawOrigY, num_pts, polyv); ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } else { ! v = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); ! if (v == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { ! v[i].x = OFFSET_X(poly_ptr->vlist[i].x); ! v[i].y = OFFSET_Y(poly_ptr->vlist[i].y); ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); } ! break; ! case OBJ_POLYGON: ! polygon_ptr = ObjPtr->detail.g; ! curved = polygon_ptr->curved; ! num_pts = polygon_ptr->n; ! if (splineRubberband) { ! polyv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); ! if (polyv == NULL) FailAllocMessage(); ! if (curved != LT_INTSPLINE && polygon_ptr->smooth != NULL) { ! smooth = (char*)malloc((num_pts+1)*sizeof(char)); ! if (smooth == NULL) FailAllocMessage(); } ! if (ObjPtr->ctm == NULL) { ! for (i = 0; i < num_pts; i++) { ! polyv[i].x = polygon_ptr->vlist[i].x; ! polyv[i].y = polygon_ptr->vlist[i].y; ! if (smooth != NULL) smooth[i] = polygon_ptr->smooth[i]; ! } ! } else { ! for (i = 0; i < num_pts; i++) { ! int x, y; ! TransformPointThroughCTM(polygon_ptr->vlist[i].x-ObjPtr->x, ! polygon_ptr->vlist[i].y-ObjPtr->y, ObjPtr->ctm, &x, &y); ! polyv[i].x = x+ObjPtr->x; ! polyv[i].y = y+ObjPtr->y; ! if (smooth != NULL) smooth[i] = polygon_ptr->smooth[i]; ! } ! } ! if (curved != LT_INTSPLINE) { ! sv = MakeMultiSplinePolygonVertex (&sn, smooth, ! drawOrigX, drawOrigY, num_pts, polyv); ! } else { ! sv = MakeIntSplinePolygonVertex (&sn, &intn, &cntrlv, ! drawOrigX, drawOrigY, num_pts, polyv); } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); } else { ! v = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); ! if (v == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { ! v[i].x = OFFSET_X(polygon_ptr->vlist[i].x); ! v[i].y = OFFSET_Y(polygon_ptr->vlist[i].y); ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! ltx = OFFSET_X(ObjPtr->obbox.ltx); lty = OFFSET_Y(ObjPtr->obbox.lty); ! rbx = OFFSET_X(ObjPtr->obbox.rbx); rby = OFFSET_Y(ObjPtr->obbox.rby); ! SelBox (drawWindow, revDefaultGC, ltx, lty, rbx, rby); ! break; } ! XGrabPointer (mainDisplay, drawWindow, FALSE, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, moveCursor, CurrentTime); --- 590,800 ---- BeginIntervalRulers(ruler_ltx, ruler_lty, ruler_rbx, ruler_rby); ! switch (ObjPtr->type) { ! case OBJ_BOX: ! case OBJ_XBM: ! case OBJ_XPM: ! case OBJ_TEXT: ! if (ObjPtr->ctm == NULL) { ! ltx = OFFSET_X(ObjPtr->obbox.ltx); ! lty = OFFSET_Y(ObjPtr->obbox.lty); ! rbx = OFFSET_X(ObjPtr->obbox.rbx); ! rby = OFFSET_Y(ObjPtr->obbox.rby); ! SelBox(drawWindow, revDefaultGC, ltx, lty, rbx, rby); ! } else { ! memcpy(obj_obbox_vs, ObjPtr->rotated_obbox, 5*sizeof(XPoint)); ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, obj_obbox_vs, 5, ! CoordModeOrigin); ! } ! break; ! case OBJ_RCBOX: ! if (ObjPtr->ctm == NULL) { ! ltx = OFFSET_X(ObjPtr->obbox.ltx); ! lty = OFFSET_Y(ObjPtr->obbox.lty); ! rbx = OFFSET_X(ObjPtr->obbox.rbx); ! rby = OFFSET_Y(ObjPtr->obbox.rby); ! radius = ObjPtr->detail.rcb->radius; ! SetRCBoxVertex(ltx, lty, rbx, rby, radius); ! MyRCBox(drawWindow, revDefaultGC, ltx, lty, rbx, rby, radius); ! } else { ! sn = ObjPtr->detail.rcb->rotated_n; ! sv = (XPoint*)malloc(sn*sizeof(XPoint)); ! pv = (XPoint*)malloc(sn*sizeof(XPoint)); ! if (sv == NULL || pv == NULL) FailAllocMessage(); ! for (i=0; i < sn; i++) { ! pv[i].x = sv[i].x = ObjPtr->detail.rcb->rotated_vlist[i].x; ! pv[i].y = sv[i].y = ObjPtr->detail.rcb->rotated_vlist[i].y; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_ARC: ! if (ObjPtr->ctm == NULL) { ! arc_obj_ptr = DupObj(ObjPtr); ! arc_ptr = arc_obj_ptr->detail.a; ! ltx = OFFSET_X(arc_ptr->ltx); lty = OFFSET_Y(arc_ptr->lty); ! w = OFFSET_X(arc_ptr->ltx+arc_ptr->w)-ltx; ! h = OFFSET_Y(arc_ptr->lty+arc_ptr->h)-lty; ! angle1 = arc_ptr->angle1; angle2 = arc_ptr->angle2; ! xc = OFFSET_X(arc_ptr->xc); yc = OFFSET_Y(arc_ptr->yc); ! x1 = OFFSET_X(arc_ptr->x1); y1 = OFFSET_Y(arc_ptr->y1); ! ArcRealX2Y2(arc_ptr, &x2, &y2); ! x2 = OFFSET_X(x2); y2 = OFFSET_Y(y2); ! saved_xc = xc; saved_yc = yc; ! saved_x1 = x1; saved_y1 = y1; ! saved_x2 = x2; saved_y2 = y2; ! saved_ltx = ltx; saved_lty = lty; ! if (arc_ptr->fill != NONEPAT) { ! XDrawLine(mainDisplay, drawWindow, revDefaultGC, xc, yc, x1, y1); ! XDrawLine(mainDisplay, drawWindow, revDefaultGC, xc, yc, x2, y2); ! } ! XDrawArc(mainDisplay, drawWindow, revDefaultGC, ltx, lty, w, h, ! angle1, angle2); ! } else { ! arc_ptr = ObjPtr->detail.a; ! sn = ObjPtr->detail.a->rotated_n; ! sv = (XPoint*)malloc((sn+2)*sizeof(XPoint)); ! pv = (XPoint*)malloc((sn+2)*sizeof(XPoint)); ! if (sv == NULL || pv == NULL) FailAllocMessage(); ! for (i=0; i < sn+2; i++) { ! pv[i].x = sv[i].x = ObjPtr->detail.a->rotated_vlist[i].x; ! pv[i].y = sv[i].y = ObjPtr->detail.a->rotated_vlist[i].y; ! } ! if (arc_ptr->fill != NONEPAT) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn+2, ! CoordModeOrigin); } else { XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, CoordModeOrigin); } ! } ! break; ! case OBJ_OVAL: ! if (ObjPtr->ctm == NULL) { ! num_pts = 13; ! bbox.ltx = OFFSET_X(ObjPtr->obbox.ltx); ! bbox.lty = OFFSET_Y(ObjPtr->obbox.lty); ! bbox.rbx = OFFSET_X(ObjPtr->obbox.rbx); ! bbox.rby = OFFSET_Y(ObjPtr->obbox.rby); ! MyOval(drawWindow, revDefaultGC, bbox); ! } else { ! sn = ObjPtr->detail.o->rotated_n; ! sv = (XPoint*)malloc(sn*sizeof(XPoint)); ! pv = (XPoint*)malloc(sn*sizeof(XPoint)); ! if (sv == NULL || pv == NULL) FailAllocMessage(); ! for (i=0; i < sn; i++) { ! pv[i].x = sv[i].x = ObjPtr->detail.o->rotated_vlist[i].x; ! pv[i].y = sv[i].y = ObjPtr->detail.o->rotated_vlist[i].y; ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_POLY: ! poly_ptr = ObjPtr->detail.p; ! curved = poly_ptr->curved; ! num_pts = poly_ptr->n; ! if (splineRubberband) { ! polyv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); ! if (polyv == NULL) FailAllocMessage(); ! if (curved != LT_INTSPLINE && poly_ptr->smooth != NULL) { ! smooth = (char*)malloc((num_pts+1)*sizeof(char)); ! if (smooth == NULL) FailAllocMessage(); ! } if (ObjPtr->ctm == NULL) { ! for (i=0; i < num_pts; i++) { ! polyv[i].x = poly_ptr->vlist[i].x; ! polyv[i].y = poly_ptr->vlist[i].y; ! if (smooth != NULL) smooth[i] = poly_ptr->smooth[i]; } } else { ! for (i=0; i < num_pts; i++) { ! int x, y; ! ! TransformPointThroughCTM(poly_ptr->vlist[i].x-ObjPtr->x, ! poly_ptr->vlist[i].y-ObjPtr->y, ObjPtr->ctm, &x, &y); ! polyv[i].x = x+ObjPtr->x; ! polyv[i].y = y+ObjPtr->y; ! if (smooth != NULL) smooth[i] = poly_ptr->smooth[i]; } } ! if (curved != LT_INTSPLINE) { ! sv = MakeMultiSplinePolyVertex(&sn, smooth, ! drawOrigX, drawOrigY, num_pts, polyv); } else { ! sv = MakeIntSplinePolyVertex(&sn, &intn, &cntrlv, drawOrigX, ! drawOrigY, num_pts, polyv); } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } else { ! v = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); ! if (v == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { ! v[i].x = OFFSET_X(poly_ptr->vlist[i].x); ! v[i].y = OFFSET_Y(poly_ptr->vlist[i].y); } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); ! } ! break; ! case OBJ_POLYGON: ! polygon_ptr = ObjPtr->detail.g; ! curved = polygon_ptr->curved; ! num_pts = polygon_ptr->n; ! if (splineRubberband) { ! polyv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); ! if (polyv == NULL) FailAllocMessage(); ! if (curved != LT_INTSPLINE && polygon_ptr->smooth != NULL) { ! smooth = (char*)malloc((num_pts+1)*sizeof(char)); ! if (smooth == NULL) FailAllocMessage(); ! } ! if (ObjPtr->ctm == NULL) { ! for (i=0; i < num_pts; i++) { ! polyv[i].x = polygon_ptr->vlist[i].x; ! polyv[i].y = polygon_ptr->vlist[i].y; ! if (smooth != NULL) smooth[i] = polygon_ptr->smooth[i]; } ! } else { ! for (i=0; i < num_pts; i++) { ! int x, y; ! TransformPointThroughCTM(polygon_ptr->vlist[i].x-ObjPtr->x, ! polygon_ptr->vlist[i].y-ObjPtr->y, ObjPtr->ctm, &x, &y); ! polyv[i].x = x+ObjPtr->x; ! polyv[i].y = y+ObjPtr->y; ! if (smooth != NULL) smooth[i] = polygon_ptr->smooth[i]; } ! } ! if (curved != LT_INTSPLINE) { ! sv = MakeMultiSplinePolygonVertex(&sn, smooth, ! drawOrigX, drawOrigY, num_pts, polyv); } else { ! sv = MakeIntSplinePolygonVertex(&sn, &intn, &cntrlv, ! drawOrigX, drawOrigY, num_pts, polyv); } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } else { ! v = (XPoint*)malloc((num_pts+1)*sizeof(XPoint)); ! if (v == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { ! v[i].x = OFFSET_X(polygon_ptr->vlist[i].x); ! v[i].y = OFFSET_Y(polygon_ptr->vlist[i].y); ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); ! } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! ltx = OFFSET_X(ObjPtr->obbox.ltx); lty = OFFSET_Y(ObjPtr->obbox.lty); ! rbx = OFFSET_X(ObjPtr->obbox.rbx); rby = OFFSET_Y(ObjPtr->obbox.rby); ! SelBox(drawWindow, revDefaultGC, ltx, lty, rbx, rby); ! break; } ! XGrabPointer(mainDisplay, drawWindow, FALSE, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, moveCursor, CurrentTime); *************** *** 837,952 **** dx = dy = 0; ! while (moving) ! { ! XNextEvent (mainDisplay, &input); ! ! if (input.type == Expose || input.type == VisibilityNotify) ! ExposeEventHandler (&input, TRUE); ! else if (input.type == ButtonRelease) ! { Time release_time=input.xbutton.time; ! XUngrabPointer (mainDisplay, CurrentTime); ! XSync (mainDisplay, False); moving = FALSE; ! switch (ObjPtr->type) ! { ! case OBJ_BOX: ! case OBJ_XBM: ! case OBJ_XPM: ! case OBJ_TEXT: ! if (ObjPtr->ctm == NULL) ! SelBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! else ! { ! for (i=0; i < 5; i++) ! { ! obj_obbox_vs[i].x = ObjPtr->rotated_obbox[i].x+dx; ! obj_obbox_vs[i].y = ObjPtr->rotated_obbox[i].y+dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, ! obj_obbox_vs, 5, CoordModeOrigin); } ! break; ! case OBJ_RCBOX: ! if (ObjPtr->ctm == NULL) { ! MyRCBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy, ! radius); ! } else { ! for (i=0; i < sn; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); } ! break; ! case OBJ_OVAL: ! if (ObjPtr->ctm == NULL) ! { ! o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy; ! o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy; ! MyOval (drawWindow, revDefaultGC, o_bbox); ! } ! else ! { ! for (i=0; i < sn; i++) ! { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); } ! break; ! case OBJ_ARC: ! if (ObjPtr->ctm == NULL) { ! XDrawArc(mainDisplay, drawWindow, revDefaultGC, ltx, lty, ! w, h, angle1, angle2); ! if (arc_ptr->fill != NONEPAT) { ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x1,y1); ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x2,y2); ! } ! } else { ! for (i=0; i < sn+2; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! if (arc_ptr->fill != NONEPAT) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn+2, ! CoordModeOrigin); ! } else { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } } ! break; ! case OBJ_POLY: ! case OBJ_POLYGON: ! if (splineRubberband) ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, sv, sn, CoordModeOrigin); ! else ! { ! for (i = 0; i < num_pts; i++) ! { ! v[i].x += dx; ! v[i].y += dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts, CoordModeOrigin); - for (i = 0; i < num_pts; i++) - { - v[i].x -= dx; - v[i].y -= dy; - } } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! SelBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! break; } EndIntervalRulers(grid_x, grid_y); --- 802,905 ---- dx = dy = 0; ! while (moving) { ! XNextEvent(mainDisplay, &input); ! ! if (input.type == Expose || input.type == VisibilityNotify) { ! ExposeEventHandler(&input, TRUE); ! } else if (input.type == ButtonRelease) { Time release_time=input.xbutton.time; ! XUngrabPointer(mainDisplay, CurrentTime); ! XSync(mainDisplay, False); moving = FALSE; ! switch (ObjPtr->type) { ! case OBJ_BOX: ! case OBJ_XBM: ! case OBJ_XPM: ! case OBJ_TEXT: ! if (ObjPtr->ctm == NULL) { ! SelBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! } else { ! for (i=0; i < 5; i++) { ! obj_obbox_vs[i].x = ObjPtr->rotated_obbox[i].x+dx; ! obj_obbox_vs[i].y = ObjPtr->rotated_obbox[i].y+dy; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, ! obj_obbox_vs, 5, CoordModeOrigin); ! } ! break; ! case OBJ_RCBOX: ! if (ObjPtr->ctm == NULL) { ! MyRCBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy, ! radius); ! } else { ! for (i=0; i < sn; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_OVAL: ! if (ObjPtr->ctm == NULL) { ! o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy; ! o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy; ! MyOval(drawWindow, revDefaultGC, o_bbox); ! } else { ! for (i=0; i < sn; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_ARC: ! if (ObjPtr->ctm == NULL) { ! XDrawArc(mainDisplay, drawWindow, revDefaultGC, ltx, lty, ! w, h, angle1, angle2); ! if (arc_ptr->fill != NONEPAT) { ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x1,y1); ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x2,y2); } ! } else { ! for (i=0; i < sn+2; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! if (arc_ptr->fill != NONEPAT) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn+2, CoordModeOrigin); ! } else { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, CoordModeOrigin); } ! } ! break; ! case OBJ_POLY: ! case OBJ_POLYGON: ! if (splineRubberband) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } else { ! for (i=0; i < num_pts; i++) { ! v[i].x += dx; ! v[i].y += dy; ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); ! for (i=0; i < num_pts; i++) { ! v[i].x -= dx; ! v[i].y -= dy; ! } ! } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! SelBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! break; } EndIntervalRulers(grid_x, grid_y); *************** *** 961,994 **** dy = grid_y - OrigY; ! switch (ObjPtr->type) ! { ! case OBJ_ARC: ! if (ObjPtr->ctm != NULL) { ! free(sv); ! free(pv); ! } else { ! FreeArcObj(arc_obj_ptr); ! } ! break; ! case OBJ_RCBOX: ! case OBJ_OVAL: ! if (ObjPtr->ctm != NULL) { ! free(sv); ! free(pv); ! } ! break; ! case OBJ_POLY: ! case OBJ_POLYGON: ! if (splineRubberband) { ! if (sv != NULL) free(sv); ! if (polyv != NULL) free(polyv); ! if (smooth != NULL) free(smooth); ! if (curved == LT_INTSPLINE && cntrlv != NULL) free(cntrlv); ! } else { ! free(v); ! } ! break; } if (oneMotionSelectMove && down_button_ev != NULL && --- 914,946 ---- dy = grid_y - OrigY; ! switch (ObjPtr->type) { ! case OBJ_ARC: ! if (ObjPtr->ctm != NULL) { ! free(sv); ! free(pv); ! } else { ! FreeArcObj(arc_obj_ptr); ! } ! break; ! case OBJ_RCBOX: ! case OBJ_OVAL: ! if (ObjPtr->ctm != NULL) { ! free(sv); ! free(pv); ! } ! break; ! case OBJ_POLY: ! case OBJ_POLYGON: ! if (splineRubberband) { ! if (sv != NULL) free(sv); ! if (polyv != NULL) free(polyv); ! if (smooth != NULL) free(smooth); ! if (curved == LT_INTSPLINE && cntrlv != NULL) free(cntrlv); ! } else { ! free(v); ! } ! break; } if (oneMotionSelectMove && down_button_ev != NULL && *************** *** 999,1025 **** dx = dy = 0; } ! if (dx != 0 || dy != 0) ! { ! HighLightReverse (); dx = ABS_SIZE(dx); dy = ABS_SIZE(dy); ! if (numObjSelected == numObjLocked) ! { ! HighLightForward (); return; } ! MoveAllSel (dx, dy); ! HighLightForward (); ! UpdSelBBox (); ! if (justDupped) ! { dupDx += dx; dupDy += dy; } ! SetFileModified (TRUE); } ! } ! else if (input.type == MotionNotify) ! { PixelToMeasurementUnit(x_buf, ABS_SIZE(dx)); PixelToMeasurementUnit(y_buf, ABS_SIZE(dy)); --- 951,972 ---- dx = dy = 0; } ! if (dx != 0 || dy != 0) { ! HighLightReverse(); dx = ABS_SIZE(dx); dy = ABS_SIZE(dy); ! if (numObjSelected == numObjLocked) { ! HighLightForward(); return; } ! MoveAllSel(dx, dy); ! HighLightForward(); ! UpdSelBBox(); ! if (justDupped) { dupDx += dx; dupDy += dy; } ! SetFileModified(TRUE); } ! } else if (input.type == MotionNotify) { PixelToMeasurementUnit(x_buf, ABS_SIZE(dx)); PixelToMeasurementUnit(y_buf, ABS_SIZE(dy)); *************** *** 1028,1133 **** x = input.xmotion.x; y = input.xmotion.y; ! GridXY (x, y, &grid_x, &grid_y); ! switch (ObjPtr->type) ! { ! case OBJ_BOX: ! case OBJ_XBM: ! case OBJ_XPM: ! case OBJ_TEXT: ! if (ObjPtr->ctm == NULL) ! SelBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! else ! { ! for (i=0; i < 5; i++) ! { ! obj_obbox_vs[i].x = ObjPtr->rotated_obbox[i].x+dx; ! obj_obbox_vs[i].y = ObjPtr->rotated_obbox[i].y+dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, ! obj_obbox_vs, 5, CoordModeOrigin); } ! break; ! case OBJ_RCBOX: ! if (ObjPtr->ctm == NULL) { ! MyRCBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy, ! radius); } else { - for (i=0; i < sn; i++) { - sv[i].x = pv[i].x + dx; - sv[i].y = pv[i].y + dy; - } XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, CoordModeOrigin); } ! break; ! case OBJ_ARC: ! if (ObjPtr->ctm == NULL) { ! XDrawArc(mainDisplay, drawWindow, revDefaultGC, ltx, lty, ! w, h, angle1, angle2); ! if (arc_ptr->fill != NONEPAT) { ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x1,y1); ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x2,y2); ! } ! } else { ! for (i=0; i < sn+2; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! if (arc_ptr->fill != NONEPAT) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn+2, ! CoordModeOrigin); ! } else { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } } ! break; ! case OBJ_OVAL: ! if (ObjPtr->ctm == NULL) ! { ! o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy; ! o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy; ! MyOval (drawWindow, revDefaultGC, o_bbox); ! } ! else ! { ! for (i=0; i < sn; i++) ! { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); } ! break; ! case OBJ_POLY: ! case OBJ_POLYGON: ! if (splineRubberband) ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! else ! { ! for (i = 0; i < num_pts; i++) ! { ! v[i].x += dx; ! v[i].y += dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); ! for (i = 0; i < num_pts; i++) ! { ! v[i].x -= dx; ! v[i].y -= dy; ! } } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! SelBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! break; } ! SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx, sel_rby+dy); --- 975,1070 ---- x = input.xmotion.x; y = input.xmotion.y; ! GridXY(x, y, &grid_x, &grid_y); ! switch (ObjPtr->type) { ! case OBJ_BOX: ! case OBJ_XBM: ! case OBJ_XPM: ! case OBJ_TEXT: ! if (ObjPtr->ctm == NULL) { ! SelBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! } else { ! for (i=0; i < 5; i++) { ! obj_obbox_vs[i].x = ObjPtr->rotated_obbox[i].x+dx; ! obj_obbox_vs[i].y = ObjPtr->rotated_obbox[i].y+dy; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, ! obj_obbox_vs, 5, CoordModeOrigin); ! } ! break; ! case OBJ_RCBOX: ! if (ObjPtr->ctm == NULL) { ! MyRCBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy, ! radius); ! } else { ! for (i=0; i < sn; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_ARC: ! if (ObjPtr->ctm == NULL) { ! XDrawArc(mainDisplay, drawWindow, revDefaultGC, ltx, lty, ! w, h, angle1, angle2); ! if (arc_ptr->fill != NONEPAT) { ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x1,y1); ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x2,y2); ! } ! } else { ! for (i=0; i < sn+2; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! if (arc_ptr->fill != NONEPAT) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn+2, ! CoordModeOrigin); } else { XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, CoordModeOrigin); } ! } ! break; ! case OBJ_OVAL: ! if (ObjPtr->ctm == NULL) { ! o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy; ! o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy; ! MyOval(drawWindow, revDefaultGC, o_bbox); ! } else { ! for (i=0; i < sn; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_POLY: ! case OBJ_POLYGON: ! if (splineRubberband) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } else { ! for (i=0; i < num_pts; i++) { ! v[i].x += dx; ! v[i].y += dy; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); ! for (i=0; i < num_pts; i++) { ! v[i].x -= dx; ! v[i].y -= dy; } ! } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! SelBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! break; } ! SelBox(drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx, sel_rby+dy); *************** *** 1143,1317 **** sprintf(buf, "dx=%s\ndy=%s", x_buf, y_buf); ShowMeasureCursor(grid_x, grid_y, buf, TRUE); ! switch (ObjPtr->type) ! { ! case OBJ_BOX: ! case OBJ_XBM: ! case OBJ_XPM: ! case OBJ_TEXT: ! if (ObjPtr->ctm == NULL) ! SelBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! else ! { ! for (i=0; i < 5; i++) ! { ! obj_obbox_vs[i].x = ObjPtr->rotated_obbox[i].x+dx; ! obj_obbox_vs[i].y = ObjPtr->rotated_obbox[i].y+dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, ! obj_obbox_vs, 5, CoordModeOrigin); } ! break; ! case OBJ_RCBOX: ! if (ObjPtr->ctm == NULL) { ! SetRCBoxVertex (ltx+dx, lty+dy, rbx+dx, rby+dy, radius); ! MyRCBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy, ! radius); } else { - for (i=0; i < sn; i++) { - sv[i].x = pv[i].x + dx; - sv[i].y = pv[i].y + dy; - } XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, CoordModeOrigin); } ! break; ! case OBJ_OVAL: ! if (ObjPtr->ctm == NULL) ! { ! o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy; ! o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy; ! MyOval (drawWindow, revDefaultGC, o_bbox); ! } ! else ! { ! for (i=0; i < sn; i++) ! { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_ARC: ! if (ObjPtr->ctm == NULL) { ! xc = saved_xc+dx; yc = saved_yc+dy; ! x1 = saved_x1+dx; y1 = saved_y1+dy; ! x2 = saved_x2+dx; y2 = saved_y2+dy; ! ltx = saved_ltx+dx; lty = saved_lty+dy; ! if (arc_ptr->fill != NONEPAT) { ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x1,y1); ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x2,y2); ! } ! XDrawArc(mainDisplay, drawWindow, revDefaultGC, ltx, lty, ! w, h, angle1, angle2); ! } else { ! for (i=0; i < sn+2; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! if (arc_ptr->fill != NONEPAT) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn+2, ! CoordModeOrigin); } else { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); } } ! break; ! case OBJ_POLY: ! case OBJ_POLYGON: ! if (splineRubberband) ! { ! free(sv); ! switch (ObjPtr->type) ! { ! case OBJ_POLY: ! if (ObjPtr->ctm == NULL) { ! for (i = 0; i < num_pts; i++) { ! polyv[i].x = poly_ptr->vlist[i].x+ABS_SIZE(dx); ! polyv[i].y = poly_ptr->vlist[i].y+ABS_SIZE(dy); ! } ! } else { ! for (i = 0; i < num_pts; i++) { ! int x, y; ! ! TransformPointThroughCTM( ! poly_ptr->vlist[i].x-ObjPtr->x, ! poly_ptr->vlist[i].y-ObjPtr->y, ! ObjPtr->ctm, &x, &y); ! polyv[i].x = x+ObjPtr->x+ABS_SIZE(dx); ! polyv[i].y = y+ObjPtr->y+ABS_SIZE(dy); ! } ! } ! if (curved != LT_INTSPLINE) { ! sv = MakeMultiSplinePolyVertex (&sn, smooth, ! drawOrigX, drawOrigY, num_pts, polyv); ! } else { ! free(cntrlv); ! sv = MakeIntSplinePolyVertex (&sn, &intn, &cntrlv, ! drawOrigX, drawOrigY, num_pts, polyv); ! } ! break; ! case OBJ_POLYGON: ! if (ObjPtr->ctm == NULL) { ! for (i = 0; i < num_pts; i++) { ! polyv[i].x = polygon_ptr->vlist[i].x+ABS_SIZE(dx); ! polyv[i].y = polygon_ptr->vlist[i].y+ABS_SIZE(dy); ! } ! } else { ! for (i = 0; i < num_pts; i++) { ! int x, y; ! ! TransformPointThroughCTM( ! polygon_ptr->vlist[i].x-ObjPtr->x, ! polygon_ptr->vlist[i].y-ObjPtr->y, ! ObjPtr->ctm, &x, &y); ! polyv[i].x = x+ObjPtr->x+ABS_SIZE(dx); ! polyv[i].y = y+ObjPtr->y+ABS_SIZE(dy); ! } ! } ! if (curved != LT_INTSPLINE) { ! sv = MakeMultiSplinePolygonVertex (&sn, smooth, ! drawOrigX, drawOrigY, num_pts, polyv); ! } else { ! free(cntrlv); ! sv = MakeIntSplinePolygonVertex (&sn, &intn, ! &cntrlv, drawOrigX, drawOrigY, num_pts, ! polyv); ! } ! break; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, ! sv, sn, CoordModeOrigin); } ! else ! { ! for (i = 0; i < num_pts; i++) ! { ! v[i].x += dx; ! v[i].y += dy; ! } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); ! for (i = 0; i < num_pts; i++) ! { ! v[i].x -= dx; ! v[i].y -= dy; ! } } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! SelBox (drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! break; } ! while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &ev)) ; } } } ! void MoveAllSelVs (Dx, Dy) register int Dx, Dy; /* Dx and Dy are absolute size */ --- 1080,1241 ---- sprintf(buf, "dx=%s\ndy=%s", x_buf, y_buf); ShowMeasureCursor(grid_x, grid_y, buf, TRUE); ! switch (ObjPtr->type) { ! case OBJ_BOX: ! case OBJ_XBM: ! case OBJ_XPM: ! case OBJ_TEXT: ! if (ObjPtr->ctm == NULL) { ! SelBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! } else { ! for (i=0; i < 5; i++) { ! obj_obbox_vs[i].x = ObjPtr->rotated_obbox[i].x+dx; ! obj_obbox_vs[i].y = ObjPtr->rotated_obbox[i].y+dy; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, ! obj_obbox_vs, 5, CoordModeOrigin); ! } ! break; ! case OBJ_RCBOX: ! if (ObjPtr->ctm == NULL) { ! SetRCBoxVertex(ltx+dx, lty+dy, rbx+dx, rby+dy, radius); ! MyRCBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy, ! radius); ! } else { ! for (i=0; i < sn; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_OVAL: ! if (ObjPtr->ctm == NULL) { ! o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy; ! o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy; ! MyOval(drawWindow, revDefaultGC, o_bbox); ! } else { ! for (i=0; i < sn; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, ! CoordModeOrigin); ! } ! break; ! case OBJ_ARC: ! if (ObjPtr->ctm == NULL) { ! xc = saved_xc+dx; yc = saved_yc+dy; ! x1 = saved_x1+dx; y1 = saved_y1+dy; ! x2 = saved_x2+dx; y2 = saved_y2+dy; ! ltx = saved_ltx+dx; lty = saved_lty+dy; ! if (arc_ptr->fill != NONEPAT) { ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x1,y1); ! XDrawLine(mainDisplay,drawWindow,revDefaultGC,xc,yc,x2,y2); ! } ! XDrawArc(mainDisplay, drawWindow, revDefaultGC, ltx, lty, ! w, h, angle1, angle2); ! } else { ! for (i=0; i < sn+2; i++) { ! sv[i].x = pv[i].x + dx; ! sv[i].y = pv[i].y + dy; ! } ! if (arc_ptr->fill != NONEPAT) { ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn+2, ! CoordModeOrigin); } else { XDrawLines(mainDisplay, drawWindow, revDefaultGC, sv, sn, CoordModeOrigin); } ! } ! break; ! case OBJ_POLY: ! case OBJ_POLYGON: ! if (splineRubberband) { ! free(sv); ! switch (ObjPtr->type) { ! case OBJ_POLY: ! if (ObjPtr->ctm == NULL) { ! for (i=0; i < num_pts; i++) { ! polyv[i].x = poly_ptr->vlist[i].x+ABS_SIZE(dx); ! polyv[i].y = poly_ptr->vlist[i].y+ABS_SIZE(dy); ! } ! } else { ! for (i=0; i < num_pts; i++) { ! int x, y; ! ! TransformPointThroughCTM( ! poly_ptr->vlist[i].x-ObjPtr->x, ! poly_ptr->vlist[i].y-ObjPtr->y, ! ObjPtr->ctm, &x, &y); ! polyv[i].x = x+ObjPtr->x+ABS_SIZE(dx); ! polyv[i].y = y+ObjPtr->y+ABS_SIZE(dy); ! } ! } ! if (curved != LT_INTSPLINE) { ! sv = MakeMultiSplinePolyVertex(&sn, smooth, ! drawOrigX, drawOrigY, num_pts, polyv); ! } else { ! free(cntrlv); ! sv = MakeIntSplinePolyVertex(&sn, &intn, &cntrlv, ! drawOrigX, drawOrigY, num_pts, polyv); ! } ! break; ! case OBJ_POLYGON: ! if (ObjPtr->ctm == NULL) { ! for (i=0; i < num_pts; i++) { ! polyv[i].x = polygon_ptr->vlist[i].x+ABS_SIZE(dx); ! polyv[i].y = polygon_ptr->vlist[i].y+ABS_SIZE(dy); ! } } else { ! for (i=0; i < num_pts; i++) { ! int x, y; ! ! TransformPointThroughCTM( ! polygon_ptr->vlist[i].x-ObjPtr->x, ! polygon_ptr->vlist[i].y-ObjPtr->y, ! ObjPtr->ctm, &x, &y); ! polyv[i].x = x+ObjPtr->x+ABS_SIZE(dx); ! polyv[i].y = y+ObjPtr->y+ABS_SIZE(dy); ! } ! } ! if (curved != LT_INTSPLINE) { ! sv = MakeMultiSplinePolygonVertex(&sn, smooth, ! drawOrigX, drawOrigY, num_pts, polyv); ! } else { ! free(cntrlv); ! sv = MakeIntSplinePolygonVertex(&sn, &intn, ! &cntrlv, drawOrigX, drawOrigY, num_pts, ! polyv); } + break; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, ! sv, sn, CoordModeOrigin); ! } else { ! for (i=0; i < num_pts; i++) { ! v[i].x += dx; ! v[i].y += dy; } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, v, num_pts, ! CoordModeOrigin); ! for (i=0; i < num_pts; i++) { ! v[i].x -= dx; ! v[i].y -= dy; } ! } ! break; ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! SelBox(drawWindow,revDefaultGC,ltx+dx,lty+dy,rbx+dx,rby+dy); ! break; } ! while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } } } ! void MoveAllSelVs(Dx, Dy) register int Dx, Dy; /* Dx and Dy are absolute size */ *************** *** 1324,1328 **** StartCompositeCmd(); ! for (vsel_ptr = botVSel; vsel_ptr != NULL; vsel_ptr = vsel_ptr->prev) { int auto_retracted_arrow=FALSE; --- 1248,1252 ---- StartCompositeCmd(); ! for (vsel_ptr=botVSel; vsel_ptr != NULL; vsel_ptr=vsel_ptr->prev) { int auto_retracted_arrow=FALSE; *************** *** 1341,1345 **** PrepareToReplaceAnObj(obj_ptr); if (obj_ptr->ctm == NULL) { ! for (i = 0; i < vsel_ptr->n; i++) { vsel_ptr->x[i] += Dx; vsel_ptr->y[i] += Dy; --- 1265,1269 ---- PrepareToReplaceAnObj(obj_ptr); if (obj_ptr->ctm == NULL) { ! for (i=0; i < vsel_ptr->n; i++) { vsel_ptr->x[i] += Dx; vsel_ptr->y[i] += Dy; *************** *** 1348,1352 **** } } else { ! for (i = 0; i < vsel_ptr->n; i++) { int x, y; --- 1272,1276 ---- } } else { ! for (i=0; i < vsel_ptr->n; i++) { int x, y; *************** *** 1396,1400 **** } ! static struct ObjRec * tmpTopObj, * tmpBotObj; #define FORWARD 0 --- 1320,1324 ---- } ! static struct ObjRec *tmpTopObj=NULL, *tmpBotObj=NULL; #define FORWARD 0 *************** *** 1402,1408 **** static ! void EndMoveVs () { ! register struct ObjRec * obj_ptr, * next_obj; for (obj_ptr=tmpTopObj; obj_ptr != NULL; obj_ptr = next_obj) { --- 1326,1332 ---- static ! void EndMoveVs() { ! register struct ObjRec *obj_ptr, *next_obj; for (obj_ptr=tmpTopObj; obj_ptr != NULL; obj_ptr = next_obj) { *************** *** 1437,1441 **** static ! void PrepareToMoveVs () { register int i; --- 1361,1365 ---- static ! void PrepareToMoveVs() { register int i; *************** *** 1450,1454 **** tmpTopObj = tmpBotObj = NULL; ! for (vsel_ptr = botVSel; vsel_ptr != NULL; vsel_ptr = vsel_ptr->prev) { obj_ptr = (struct ObjRec *)malloc(sizeof(struct ObjRec)); if (obj_ptr == NULL) FailAllocMessage(); --- 1374,1378 ---- tmpTopObj = tmpBotObj = NULL; ! for (vsel_ptr=botVSel; vsel_ptr != NULL; vsel_ptr=vsel_ptr->prev) { obj_ptr = (struct ObjRec *)malloc(sizeof(struct ObjRec)); if (obj_ptr == NULL) FailAllocMessage(); *************** *** 1483,1487 **** } if (vsel_ptr->obj->ctm == NULL) { ! for (i = 0; i < num_pts; i++) { polyv[i].x = poly_ptr->vlist[i].x; polyv[i].y = poly_ptr->vlist[i].y; --- 1407,1411 ---- } if (vsel_ptr->obj->ctm == NULL) { ! for (i=0; i < num_pts; i++) { polyv[i].x = poly_ptr->vlist[i].x; polyv[i].y = poly_ptr->vlist[i].y; *************** *** 1489,1493 **** } } else { ! for (i = 0; i < num_pts; i++) { int x, y; --- 1413,1417 ---- } } else { ! for (i=0; i < num_pts; i++) { int x, y; *************** *** 1515,1519 **** polyv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); if (polyv == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { polyv[i].x = OFFSET_X(poly_ptr->vlist[i].x); polyv[i].y = OFFSET_Y(poly_ptr->vlist[i].y); --- 1439,1443 ---- polyv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); if (polyv == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { polyv[i].x = OFFSET_X(poly_ptr->vlist[i].x); polyv[i].y = OFFSET_Y(poly_ptr->vlist[i].y); *************** *** 1540,1544 **** } if (vsel_ptr->obj->ctm == NULL) { ! for (i = 0; i < num_pts; i++) { polyv[i].x = polygon_ptr->vlist[i].x; polyv[i].y = polygon_ptr->vlist[i].y; --- 1464,1468 ---- } if (vsel_ptr->obj->ctm == NULL) { ! for (i=0; i < num_pts; i++) { polyv[i].x = polygon_ptr->vlist[i].x; polyv[i].y = polygon_ptr->vlist[i].y; *************** *** 1546,1550 **** } } else { ! for (i = 0; i < num_pts; i++) { int x, y; --- 1470,1474 ---- } } else { ! for (i=0; i < num_pts; i++) { int x, y; *************** *** 1572,1576 **** polyv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); if (polyv == NULL) FailAllocMessage(); ! for (i = 0; i < num_pts; i++) { polyv[i].x = OFFSET_X(polygon_ptr->vlist[i].x); polyv[i].y = OFFSET_Y(polygon_ptr->vlist[i].y); --- 1496,1500 ---- polyv = (IntPoint*)malloc((num_pts+1)*sizeof(IntPoint)); if (polyv == NULL) FailAllocMessage(); ! for (i=0; i < num_pts; i++) { polyv[i].x = OFFSET_X(polygon_ptr->vlist[i].x); polyv[i].y = OFFSET_Y(polygon_ptr->vlist[i].y); *************** *** 1585,1691 **** static ! void HighLightVs (Dir) ! int Dir; { ! register int i; ! register struct ObjRec * obj_ptr=NULL; ! register IntPoint * v; ! ! switch (Dir) ! { ! case FORWARD: obj_ptr = tmpBotObj; break; ! case REVERSE: obj_ptr = tmpTopObj; break; ! } ! while (obj_ptr != NULL) ! { ! switch (obj_ptr->type) ! { ! case OBJ_POLY: ! v = obj_ptr->detail.p->vlist; ! if (splineRubberband) ! { ! if (obj_ptr->detail.p->curved != LT_INTSPLINE && ! obj_ptr->detail.p->smooth != NULL) ! { ! char * smooth=obj_ptr->detail.p->smooth; ! ! for (i = 0; i < obj_ptr->detail.p->n; i++) ! if (smooth[i]) ! MARKO(drawWindow, revDefaultGC, OFFSET_X(v[i].x), ! OFFSET_Y(v[i].y)); ! else ! MARK(drawWindow, revDefaultGC, OFFSET_X(v[i].x), ! OFFSET_Y(v[i].y)); ! } ! else ! for (i = 0; i < obj_ptr->detail.p->n; i++) MARK(drawWindow, revDefaultGC, OFFSET_X(v[i].x), OFFSET_Y(v[i].y)); ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, ! obj_ptr->detail.p->svlist, obj_ptr->detail.p->sn, ! CoordModeOrigin); ! } ! else ! { ! int sn=obj_ptr->detail.p->n; ! XPoint *sv=(XPoint*)malloc(sn*sizeof(XPoint)); ! ! if (sv == NULL) FailAllocMessage(); ! for (i = 0; i < obj_ptr->detail.p->n; i++) { ! MARK(drawWindow, revDefaultGC, v[i].x, v[i].y); ! sv[i].x = (short)v[i].x; ! sv[i].y = (short)v[i].y; } ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, ! sv, sn, CoordModeOrigin); ! if (sv != NULL) free(sv); ! } ! break; ! case OBJ_POLYGON: ! v = obj_ptr->detail.p->vlist; ! if (splineRubberband) ! { ! if (obj_ptr->detail.g->curved != LT_INTSPLINE && ! obj_ptr->detail.g->smooth != NULL) ! { ! char * smooth=obj_ptr->detail.g->smooth; ! ! for (i = 0; i < obj_ptr->detail.g->n-1; i++) ! if (smooth[i]) ! MARKO(drawWindow, revDefaultGC, OFFSET_X(v[i].x), ! OFFSET_Y(v[i].y)); ! else ! MARK(drawWindow, revDefaultGC, OFFSET_X(v[i].x), ! OFFSET_Y(v[i].y)); } ! else ! for (i = 0; i < obj_ptr->detail.g->n-1; i++) MARK(drawWindow, revDefaultGC, OFFSET_X(v[i].x), OFFSET_Y(v[i].y)); ! XDrawLines (mainDisplay, drawWindow, revDefaultGC, ! obj_ptr->detail.g->svlist, obj_ptr->detail.g->sn, ! CoordModeOrigin); ! } ! else ! { ! int sn=obj_ptr->detail.g->n; ! XPoint *sv=(XPoint*)malloc(sn*sizeof(XPoint)); ! ! if (sv == NULL) FailAllocMessage(); ! for (i = 0; i < obj_ptr->detail.g->n-1; i++) { ! MARK(drawWindow, revDefaultGC, v[i].x, v[i].y); ! sv[i].x = (short)v[i].x; ! sv[i].y = (short)v[i].y; } - XDrawLines (mainDisplay, drawWindow, revDefaultGC, - sv, sn, CoordModeOrigin); - if (sv != NULL) free(sv); } ! break; } ! switch (Dir) ! { ! case FORWARD: obj_ptr = obj_ptr->prev; break; ! case REVERSE: obj_ptr = obj_ptr->next; break; } } --- 1509,1609 ---- static ! void HighLightVs(Dir) ! int Dir; { ! register int i; ! register struct ObjRec *obj_ptr=NULL; ! register IntPoint *v=NULL; ! ! switch (Dir) { ! case FORWARD: obj_ptr = tmpBotObj; break; ! case REVERSE: obj_ptr = tmpTopObj; break; ! } ! while (obj_ptr != NULL) { ! switch (obj_ptr->type) { ! case OBJ_POLY: ! v = obj_ptr->detail.p->vlist; ! if (splineRubberband) { ! if (obj_ptr->detail.p->curved != LT_INTSPLINE && ! obj_ptr->detail.p->smooth != NULL) { ! char *smooth=obj_ptr->detail.p->smooth; ! ! for (i=0; i < obj_ptr->detail.p->n; i++) { ! if (smooth[i]) { ! MARKO(drawWindow, revDefaultGC, OFFSET_X(v[i].x), ! OFFSET_Y(v[i].y)); ! } else { MARK(drawWindow, revDefaultGC, OFFSET_X(v[i].x), OFFSET_Y(v[i].y)); ! } } ! } else { ! for (i=0; i < obj_ptr->detail.p->n; i++) { ! MARK(drawWindow, revDefaultGC, OFFSET_X(v[i].x), ! OFFSET_Y(v[i].y)); } ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, ! obj_ptr->detail.p->svlist, obj_ptr->detail.p->sn, ! CoordModeOrigin); ! } else { ! int sn=obj_ptr->detail.p->n; ! XPoint *sv=(XPoint*)malloc(sn*sizeof(XPoint)); ! ! if (sv == NULL) FailAllocMessage(); ! for (i=0; i < obj_ptr->detail.p->n; i++) { ! MARK(drawWindow, revDefaultGC, v[i].x, v[i].y); ! sv[i].x = (short)v[i].x; ! sv[i].y = (short)v[i].y; ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, ! sv, sn, CoordModeOrigin); ! if (sv != NULL) free(sv); ! } ! break; ! case OBJ_POLYGON: ! v = obj_ptr->detail.p->vlist; ! if (splineRubberband) { ! if (obj_ptr->detail.g->curved != LT_INTSPLINE && ! obj_ptr->detail.g->smooth != NULL) { ! char *smooth=obj_ptr->detail.g->smooth; ! ! for (i=0; i < obj_ptr->detail.g->n-1; i++) { ! if (smooth[i]) { ! MARKO(drawWindow, revDefaultGC, OFFSET_X(v[i].x), ! OFFSET_Y(v[i].y)); ! } else { MARK(drawWindow, revDefaultGC, OFFSET_X(v[i].x), OFFSET_Y(v[i].y)); ! } ! } ! } else { ! for (i=0; i < obj_ptr->detail.g->n-1; i++) { ! MARK(drawWindow, revDefaultGC, OFFSET_X(v[i].x), ! OFFSET_Y(v[i].y)); } } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, ! obj_ptr->detail.g->svlist, obj_ptr->detail.g->sn, ! CoordModeOrigin); ! } else { ! int sn=obj_ptr->detail.g->n; ! XPoint *sv=(XPoint*)malloc(sn*sizeof(XPoint)); ! ! if (sv == NULL) FailAllocMessage(); ! for (i=0; i < obj_ptr->detail.g->n-1; i++) { ! MARK(drawWindow, revDefaultGC, v[i].x, v[i].y); ! sv[i].x = (short)v[i].x; ! sv[i].y = (short)v[i].y; ! } ! XDrawLines(mainDisplay, drawWindow, revDefaultGC, ! sv, sn, CoordModeOrigin); ! if (sv != NULL) free(sv); ! } ! break; } ! switch (Dir) { ! case FORWARD: obj_ptr = obj_ptr->prev; break; ! case REVERSE: obj_ptr = obj_ptr->next; break; } } *************** *** 1693,1752 **** static ! void MarkVs (Dir, Dx, Dy) ! int Dir, Dx, Dy; { ! register int i, x, y; ! register struct VSelRec * vsel_ptr=NULL; ! switch (Dir) ! { ! case FORWARD: vsel_ptr = botVSel; break; ! case REVERSE: vsel_ptr = topVSel; break; ! } ! while (vsel_ptr != NULL) ! { ! char * smooth=NULL; ! int curved=(-1); ! switch (vsel_ptr->obj->type) ! { ! case OBJ_POLY: ! smooth = vsel_ptr->obj->detail.p->smooth; ! curved = vsel_ptr->obj->detail.p->curved; ! break; ! case OBJ_POLYGON: ! smooth = vsel_ptr->obj->detail.g->smooth; ! curved = vsel_ptr->obj->detail.g->curved; ! break; } ! for (i = 0; i < vsel_ptr->n; i++) ! { if (!(vsel_ptr->obj->type==OBJ_POLYGON && ! vsel_ptr->obj->detail.g->n-1==vsel_ptr->v_index[i])) ! { x = OFFSET_X(vsel_ptr->x[i])+Dx; y = OFFSET_Y(vsel_ptr->y[i])+Dy; ! if (curved != LT_INTSPLINE && curved != (-1) && smooth != NULL) ! { ! if (smooth[vsel_ptr->v_index[i]]) MARKO(drawWindow, revDefaultGC, x, y); ! else MARK(drawWindow, revDefaultGC, x, y); ! } ! else MARK(drawWindow, revDefaultGC, x, y); MARKV(drawWindow, revDefaultGC, x, y); } } ! switch (Dir) ! { ! case FORWARD: vsel_ptr = vsel_ptr->prev; break; ! case REVERSE: vsel_ptr = vsel_ptr->next; break; } } } ! void MoveSelVs (OrigX, OrigY) ! int OrigX, OrigY; { register int x, y, i; --- 1611,1664 ---- static ! void MarkVs(Dir, Dx, Dy) ! int Dir, Dx, Dy; { ! register int i, x, y; ! register struct VSelRec *vsel_ptr=NULL; ! switch (Dir) { ! case FORWARD: vsel_ptr = botVSel; break; ! case REVERSE: vsel_ptr = topVSel; break; ! } ! while (vsel_ptr != NULL) { ! char *smooth=NULL; ! int curved=(-1); ! switch (vsel_ptr->obj->type) { ! case OBJ_POLY: ! smooth = vsel_ptr->obj->detail.p->smooth; ! curved = vsel_ptr->obj->detail.p->curved; ! break; ! case OBJ_POLYGON: ! smooth = vsel_ptr->obj->detail.g->smooth; ! curved = vsel_ptr->obj->detail.g->curved; ! break; } ! for (i=0; i < vsel_ptr->n; i++) { if (!(vsel_ptr->obj->type==OBJ_POLYGON && ! vsel_ptr->obj->detail.g->n-1==vsel_ptr->v_index[i])) { x = OFFSET_X(vsel_ptr->x[i])+Dx; y = OFFSET_Y(vsel_ptr->y[i])+Dy; ! if (curved != LT_INTSPLINE && curved != (-1) && smooth != NULL) { ! if (smooth[vsel_ptr->v_index[i]]) { MARKO(drawWindow, revDefaultGC, x, y); ! } else { MARK(drawWindow, revDefaultGC, x, y); ! } ! } else { MARK(drawWindow, revDefaultGC, x, y); + } MARKV(drawWindow, revDefaultGC, x, y); } } ! switch (Dir) { ! case FORWARD: vsel_ptr = vsel_ptr->prev; break; ! case REVERSE: vsel_ptr = vsel_ptr->next; break; } } } ! void MoveSelVs(OrigX, OrigY) ! int OrigX, OrigY; { register int x, y, i; *************** *** 1834,1839 **** MarkRulers(grid_x, grid_y); ! for (vsel_ptr = botVSel, obj_ptr = tmpBotObj; vsel_ptr != NULL; ! vsel_ptr = vsel_ptr->prev, obj_ptr = obj_ptr->prev) { switch (obj_ptr->type) { case OBJ_POLY: --- 1746,1751 ---- MarkRulers(grid_x, grid_y); ! for (vsel_ptr=botVSel, obj_ptr = tmpBotObj; vsel_ptr != NULL; ! vsel_ptr=vsel_ptr->prev, obj_ptr=obj_ptr->prev) { switch (obj_ptr->type) { case OBJ_POLY: *************** *** 1843,1847 **** pv = poly_ptr->vlist; if (splineRubberband) { ! for (i = 0; i < vsel_ptr->n; i++) { pv[vsel_ptr->v_index[i]].x += ABS_SIZE(dx); pv[vsel_ptr->v_index[i]].y += ABS_SIZE(dy); --- 1755,1759 ---- pv = poly_ptr->vlist; if (splineRubberband) { ! for (i=0; i < vsel_ptr->n; i++) { pv[vsel_ptr->v_index[i]].x += ABS_SIZE(dx); pv[vsel_ptr->v_index[i]].y += ABS_SIZE(dy); *************** *** 1864,1868 **** } } else { ! for (i = 0; i < vsel_ptr->n; i++) { pv[vsel_ptr->v_index[i]].x += dx; pv[vsel_ptr->v_index[i]].y += dy; --- 1776,1780 ---- } } else { ! for (i=0; i < vsel_ptr->n; i++) { pv[vsel_ptr->v_index[i]].x += dx; pv[vsel_ptr->v_index[i]].y += dy; *************** *** 1876,1880 **** pv = polygon_ptr->vlist; if (splineRubberband) { ! for (i = 0; i < vsel_ptr->n; i++) { pv[vsel_ptr->v_index[i]].x += ABS_SIZE(dx); pv[vsel_ptr->v_index[i]].y += ABS_SIZE(dy); --- 1788,1792 ---- pv = polygon_ptr->vlist; if (splineRubberband) { ! for (i=0; i < vsel_ptr->n; i++) { pv[vsel_ptr->v_index[i]].x += ABS_SIZE(dx); pv[vsel_ptr->v_index[i]].y += ABS_SIZE(dy); *************** *** 1898,1902 **** } } else { ! for (i = 0; i < vsel_ptr->n; i++) { pv[vsel_ptr->v_index[i]].x += dx; pv[vsel_ptr->v_index[i]].y += dy; --- 1810,1814 ---- } } else { ! for (i=0; i < vsel_ptr->n; i++) { pv[vsel_ptr->v_index[i]].x += dx; pv[vsel_ptr->v_index[i]].y += dy; *** msg.c.orig Tue Sep 30 13:23:35 1997 --- msg.c Tue Sep 30 13:23:35 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/msg.c,v 3.7 1997/01/30 04:03:48 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/msg.c,v 3.14 1997/09/18 00:29:58 william Exp $ */ #include *************** *** 91,100 **** } static ! void AddMsg (Msg) ! char * Msg; { ! char * s; ! struct MsgRec * msg_ptr; firstCharIndex = 0; --- 89,114 ---- } + int FailAllocBitmapMessage(w, h) + int w, h; + { + fprintf(stderr, "Can not allocate bitmap of size %1dx%1d.\n", w, h); + fflush(stderr); + return FALSE; + } + + int FailAllocPixmapMessage(w, h) + int w, h; + { + fprintf(stderr, "Can not allocate pixmap of size %1dx%1d.\n", w, h); + fflush(stderr); + return FALSE; + } + static ! void AddMsg(Msg) ! char *Msg; { ! char *s; ! struct MsgRec *msg_ptr; firstCharIndex = 0; *************** *** 106,110 **** if (msg_ptr == NULL) FailAllocMessage(); ! strcpy (s, Msg); msg_ptr->s = s; --- 120,124 ---- if (msg_ptr == NULL) FailAllocMessage(); ! strcpy(s, Msg); msg_ptr->s = s; *************** *** 115,123 **** msg_ptr->next = NULL; ! if (botMsg == NULL) topMsg = msg_ptr; ! else botMsg->next = msg_ptr; ! botMsg = msg_ptr; } --- 129,137 ---- msg_ptr->next = NULL; ! if (botMsg == NULL) { topMsg = msg_ptr; ! } else { botMsg->next = msg_ptr; ! } botMsg = msg_ptr; } *************** *** 138,170 **** static ! struct MsgRec * FindMsg (Number) ! int Number; { ! register int i; ! register struct MsgRec * ptr; ! ! if (Number >= msgCount) ! return (botMsg); ! else if (Number < 0) ! return (topMsg); ! else if (Number > (int)(msgCount/2)) ! for (i = msgCount-1, ptr = botMsg; i != Number; i--, ptr = ptr->prev) ; ! else ! for (i = 0, ptr = topMsg; i != Number; i++, ptr = ptr->next) ; ! return (ptr); } ! void RedrawMsg () { ! int i, x, y, len; ! XEvent ev; ! struct MsgRec * msg_ptr; if (msgWindow == None) return; ! XClearWindow (mainDisplay, msgWindow); ! XSync (mainDisplay, False); ! while (XCheckWindowEvent (mainDisplay, msgWindow, ExposureMask, &ev)) ; if (topMsgNumber == msgCount) return; --- 152,186 ---- static ! struct MsgRec *FindMsg(Number) ! int Number; { ! register int i; ! register struct MsgRec *ptr; ! if (Number >= msgCount) { ! return botMsg; ! } else if (Number < 0) { ! return topMsg; ! } else if (Number > (int)(msgCount/2)) { ! for (i=msgCount-1, ptr=botMsg; i != Number; i--, ptr=ptr->prev) { ! } ! } else { ! for (i=0, ptr=topMsg; i != Number; i++, ptr=ptr->next) { ! } ! } ! return ptr; } ! void RedrawMsg() { ! int i, x, y, len; ! XEvent ev; ! struct MsgRec *msg_ptr; if (msgWindow == None) return; ! XClearWindow(mainDisplay, msgWindow); ! XSync(mainDisplay, False); ! while (XCheckWindowEvent(mainDisplay, msgWindow, ExposureMask, &ev)) ; if (topMsgNumber == msgCount) return; *************** *** 174,274 **** mostRecentTopMsgPtr = msg_ptr = (topMsgNumber == mostRecentTopMsgNumber) ? ! mostRecentTopMsgPtr : FindMsg (topMsgNumber); mostRecentTopMsgNumber = topMsgNumber; ! for (i = topMsgNumber; i < min(msgCount,topMsgNumber+MSG_ROWS); i++) ! { ! len = strlen (msg_ptr->s); ! if (len > firstCharIndex) ! XDrawString (mainDisplay, msgWindow, defaultGC, x, y, &msg_ptr->s[firstCharIndex], len-firstCharIndex); msg_ptr = msg_ptr->next; y += defaultFontHeight; } ! XSync (mainDisplay, False); } ! void Msg (Message) ! char * Message; { ! AddMsg (Message); ! RedrawMsg (); } ! void Warning (Where, Message) ! char * Where, * Message; { ! char buf[MAXSTRING]; ! sprintf (buf, "Warning in %s.\n\n%s.", Where, Message); ! MsgBox (buf, TOOL_NAME, INFO_MB); } ! void TwoLineMsg (Msg1, Msg2) ! char * Msg1, * Msg2; { ! AddMsg (Msg1); ! AddMsg (Msg2); ! RedrawMsg (); } ! void PrintMsgBuffer () { ! char file_name[MAXPATHLENGTH], * rest, msg[MAXSTRING]; ! FILE *fp; ! struct MsgRec * msg_ptr; ! Dialog ("Please enter a file name to write the message buffer content:", "( \"stdout\", \"stderr\", : cancel )", file_name); if (*file_name == '\0') return; ! if (strcmp (file_name, "stdout") == 0) ! { ! for (msg_ptr = topMsg; msg_ptr != NULL; msg_ptr = msg_ptr->next) ! printf ("%s\n", msg_ptr->s); ! } ! else if (strcmp (file_name, "stderr") == 0) ! { ! for (msg_ptr = topMsg; msg_ptr != NULL; msg_ptr = msg_ptr->next) ! fprintf (stderr, "%s\n", msg_ptr->s); ! } ! else ! { ! int short_name; ! ! if (!OkayToCreateFile (file_name)) return; ! ! if ((short_name = IsPrefix (bootDir, file_name, &rest))) ++rest; ! if ((fp = fopen (file_name, "w")) == NULL) ! { ! if (short_name) ! sprintf (msg, "Can not open '%s', message buffer not written out.", rest); ! else ! sprintf (msg, "Can not open '%s', message buffer not written out.", file_name); ! MsgBox (msg, TOOL_NAME, INFO_MB); return; } writeFileFailed = FALSE; ! for (msg_ptr = topMsg; msg_ptr != NULL; msg_ptr = msg_ptr->next) ! if (fprintf (fp, "%s\n", msg_ptr->s) == EOF) writeFileFailed = TRUE; ! fclose (fp); ! if (writeFileFailed) ! { writeFileFailed = FALSE; ! sprintf (msg, "Fail to write to '%s'.\n\nFile system may be full.", file_name); ! MsgBox (msg, TOOL_NAME, INFO_MB); ! } ! else ! { ! if (short_name) ! sprintf (msg, "Message buffer saved into '%s'.", rest); ! else ! sprintf (msg, "Message buffer saved into '%s'.", file_name); ! MsgBox (msg, TOOL_NAME, INFO_MB); } } --- 190,287 ---- mostRecentTopMsgPtr = msg_ptr = (topMsgNumber == mostRecentTopMsgNumber) ? ! mostRecentTopMsgPtr : FindMsg(topMsgNumber); mostRecentTopMsgNumber = topMsgNumber; ! for (i=topMsgNumber; i < min(msgCount,topMsgNumber+MSG_ROWS); i++) { ! len = strlen(msg_ptr->s); ! if (len > firstCharIndex) { ! XDrawString(mainDisplay, msgWindow, defaultGC, x, y, &msg_ptr->s[firstCharIndex], len-firstCharIndex); + } msg_ptr = msg_ptr->next; y += defaultFontHeight; } ! XSync(mainDisplay, False); } ! void Msg(Message) ! char *Message; { ! AddMsg(Message); ! RedrawMsg(); } ! void Warning(Where, Message) ! char *Where, *Message; { ! char buf[MAXSTRING]; ! sprintf(buf, "Warning in %s.\n\n%s.", Where, Message); ! MsgBox(buf, TOOL_NAME, INFO_MB); } ! void TwoLineMsg(Msg1, Msg2) ! char *Msg1, *Msg2; { ! AddMsg(Msg1); ! AddMsg(Msg2); ! RedrawMsg(); } ! void PrintMsgBuffer() { ! char file_name[MAXPATHLENGTH], *rest, msg[MAXSTRING]; ! FILE *fp; ! struct MsgRec *msg_ptr; ! Dialog("Please enter a file name to write the message buffer content:", "( \"stdout\", \"stderr\", : cancel )", file_name); if (*file_name == '\0') return; ! if (strcmp(file_name, "stdout") == 0) { ! for (msg_ptr=topMsg; msg_ptr != NULL; msg_ptr=msg_ptr->next) { ! printf("%s\n", msg_ptr->s); ! } ! } else if (strcmp(file_name, "stderr") == 0) { ! for (msg_ptr=topMsg; msg_ptr != NULL; msg_ptr=msg_ptr->next) { ! fprintf(stderr, "%s\n", msg_ptr->s); ! } ! } else { ! int short_name; ! ! if (!OkayToCreateFile(file_name)) return; ! ! if ((short_name=IsPrefix(bootDir, file_name, &rest))) ++rest; ! if ((fp=fopen(file_name, "w")) == NULL) { ! if (short_name) { ! sprintf(msg, "Can not open '%s', message buffer not written out.", rest); ! } else { ! sprintf(msg, "Can not open '%s', message buffer not written out.", file_name); ! } ! MsgBox(msg, TOOL_NAME, INFO_MB); return; } writeFileFailed = FALSE; ! for (msg_ptr=topMsg; msg_ptr != NULL; msg_ptr=msg_ptr->next) { ! if (fprintf(fp, "%s\n", msg_ptr->s) == EOF) { writeFileFailed = TRUE; ! } ! } ! fclose(fp); ! if (writeFileFailed) { writeFileFailed = FALSE; ! sprintf(msg, "Fail to write to '%s'.\n\nFile system may be full.", file_name); ! MsgBox(msg, TOOL_NAME, INFO_MB); ! } else { ! if (short_name) { ! sprintf(msg, "Message buffer saved into '%s'.", rest); ! } else { ! sprintf(msg, "Message buffer saved into '%s'.", file_name); ! } ! MsgBox(msg, TOOL_NAME, INFO_MB); } } *************** *** 282,288 **** static ! void RedrawStatusStrings () { ! register int i; if (PRTGIF || noStatusWindow) return; --- 295,301 ---- static ! void RedrawStatusStrings() { ! register int i; if (PRTGIF || noStatusWindow) return; *************** *** 291,295 **** int y; ! XClearWindow (mainDisplay, statusWindow); if (msgFontPtr == NULL) { if (defaultFontHeight+(brdrW<<1)+2 > btn1_height) { --- 304,308 ---- int y; ! XClearWindow(mainDisplay, statusWindow); if (msgFontPtr == NULL) { if (defaultFontHeight+(brdrW<<1)+2 > btn1_height) { *************** *** 299,303 **** } XDrawString(mainDisplay, statusWindow, defaultGC, 2, y, ! oneLineStatusStr, strlen (oneLineStatusStr)); } else { if (msgFontHeight+(brdrW<<1)+2 > btn1_height) { --- 312,316 ---- } XDrawString(mainDisplay, statusWindow, defaultGC, 2, y, ! oneLineStatusStr, strlen(oneLineStatusStr)); } else { if (msgFontHeight+(brdrW<<1)+2 > btn1_height) { *************** *** 320,329 **** right += w; if (right >= statusWindowW) right = statusWindowW-1; ! XClearWindow (mainDisplay, statusSubWindow[i]); if (msgFontPtr == NULL) { ! XDrawString (mainDisplay, statusSubWindow[i], defaultGC, 2, 1+defaultFontAsc, btnStatusStr[i], strlen(btnStatusStr[i])); } else { ! XDrawString (mainDisplay, statusSubWindow[i], defaultGC, 2, 1+msgFontAsc, btnStatusStr[i], strlen(btnStatusStr[i])); } --- 333,342 ---- right += w; if (right >= statusWindowW) right = statusWindowW-1; ! XClearWindow(mainDisplay, statusSubWindow[i]); if (msgFontPtr == NULL) { ! XDrawString(mainDisplay, statusSubWindow[i], defaultGC, 2, 1+defaultFontAsc, btnStatusStr[i], strlen(btnStatusStr[i])); } else { ! XDrawString(mainDisplay, statusSubWindow[i], defaultGC, 2, 1+msgFontAsc, btnStatusStr[i], strlen(btnStatusStr[i])); } *************** *** 337,344 **** } ! void RedrawStatusWindow () { ! register int i; ! XEvent ev; if (PRTGIF || noStatusWindow) return; --- 350,357 ---- } ! void RedrawStatusWindow() { ! register int i; ! XEvent ev; if (PRTGIF || noStatusWindow) return; *************** *** 360,396 **** } } ! for (i=0; i < MAX_STATUS_BTNS; i++) ! { ! int x=left+(brdrW<<2); right += w; if (right >= statusWindowW) right = statusWindowW-1; ! XSetTSOrigin (mainDisplay, rasterGC, x, y); ! XSetStipple (mainDisplay, rasterGC, statusBtnPixmap[i]); ! XFillRectangle (mainDisplay, statusWindow, rasterGC, x, y, btn1_width, btn1_height); ! XSetTSOrigin (mainDisplay, rasterGC, 0, 0); left += w; } } ! RedrawStatusStrings (); ! XSync (mainDisplay, False); ! while (XCheckWindowEvent (mainDisplay, statusWindow, ExposureMask, &ev)) ; } ! void SetMouseStatus (Left, Middle, Right) ! char * Left, * Middle, * Right; /* If Left, Middle, and Right are all NULL, just refresh the status */ { ! register int i; ! int force_redraw=FALSE, left_index, right_index; ! if (reverseMouseStatusButtons) ! { left_index = 2; right_index = 0; ! } ! else ! { left_index = 0; right_index = 2; --- 373,405 ---- } } ! for (i=0; i < MAX_STATUS_BTNS; i++) { ! int x=left+(brdrW<<2); right += w; if (right >= statusWindowW) right = statusWindowW-1; ! XSetTSOrigin(mainDisplay, rasterGC, x, y); ! XSetStipple(mainDisplay, rasterGC, statusBtnPixmap[i]); ! XFillRectangle(mainDisplay, statusWindow, rasterGC, x, y, btn1_width, btn1_height); ! XSetTSOrigin(mainDisplay, rasterGC, 0, 0); left += w; } } ! RedrawStatusStrings(); ! XSync(mainDisplay, False); ! while (XCheckWindowEvent(mainDisplay, statusWindow, ExposureMask, &ev)) ; } ! void SetMouseStatus(Left, Middle, Right) ! char *Left, *Middle, *Right; /* If Left, Middle, and Right are all NULL, just refresh the status */ { ! register int i; ! int force_redraw=FALSE, left_index, right_index; ! if (reverseMouseStatusButtons) { left_index = 2; right_index = 0; ! } else { left_index = 0; right_index = 2; *************** *** 399,427 **** if (PRTGIF || noStatusWindow) return; ! if (oneLineStatus) ! { oneLineStatus = FALSE; ! XClearWindow (mainDisplay, statusWindow); ! for (i=0; i < MAX_STATUS_BTNS; i++) ! XMapWindow (mainDisplay, statusSubWindow[i]); ! XSync (mainDisplay, False); force_redraw = TRUE; ! } ! else if (Left != NULL || Middle != NULL || Right != NULL) ! { if (((Left == NULL && *btnStatusStr[left_index] == '\0') || ! (Left != NULL && strcmp (Left, btnStatusStr[left_index]) == 0)) && ((Middle == NULL && *btnStatusStr[1] == '\0') || ! (Middle != NULL && strcmp (Middle, btnStatusStr[1]) == 0)) && ((Right == NULL && *btnStatusStr[right_index] == '\0') || ! (Right != NULL && strcmp (Right, btnStatusStr[right_index]) == 0))) return; } ! if (Left != NULL || Middle != NULL || Right != NULL) ! { if (Left != NULL) { if (Left != btnStatusStr[left_index] && strcmp(Left, btnStatusStr[left_index]) != 0) { ! UtilStrCpy (btnStatusStr[left_index], MAXSTRING+1, Left); } } else { --- 408,434 ---- if (PRTGIF || noStatusWindow) return; ! if (oneLineStatus) { oneLineStatus = FALSE; ! XClearWindow(mainDisplay, statusWindow); ! for (i=0; i < MAX_STATUS_BTNS; i++) { ! XMapWindow(mainDisplay, statusSubWindow[i]); ! } ! XSync(mainDisplay, False); force_redraw = TRUE; ! } else if (Left != NULL || Middle != NULL || Right != NULL) { if (((Left == NULL && *btnStatusStr[left_index] == '\0') || ! (Left != NULL && strcmp(Left, btnStatusStr[left_index]) == 0)) && ((Middle == NULL && *btnStatusStr[1] == '\0') || ! (Middle != NULL && strcmp(Middle, btnStatusStr[1]) == 0)) && ((Right == NULL && *btnStatusStr[right_index] == '\0') || ! (Right != NULL && strcmp(Right, btnStatusStr[right_index]) == 0))) { return; + } } ! if (Left != NULL || Middle != NULL || Right != NULL) { if (Left != NULL) { if (Left != btnStatusStr[left_index] && strcmp(Left, btnStatusStr[left_index]) != 0) { ! UtilStrCpy(btnStatusStr[left_index], MAXSTRING+1, Left); } } else { *************** *** 431,435 **** if (Middle != btnStatusStr[1] && strcmp(Middle, btnStatusStr[1]) != 0) { ! UtilStrCpy (btnStatusStr[1], MAXSTRING+1, Middle); } } else { --- 438,442 ---- if (Middle != btnStatusStr[1] && strcmp(Middle, btnStatusStr[1]) != 0) { ! UtilStrCpy(btnStatusStr[1], MAXSTRING+1, Middle); } } else { *************** *** 439,443 **** if (Right != btnStatusStr[right_index] && strcmp(Right, btnStatusStr[right_index]) != 0) { ! UtilStrCpy (btnStatusStr[right_index], MAXSTRING+1, Right); } } else { --- 446,450 ---- if (Right != btnStatusStr[right_index] && strcmp(Right, btnStatusStr[right_index]) != 0) { ! UtilStrCpy(btnStatusStr[right_index], MAXSTRING+1, Right); } } else { *************** *** 446,480 **** } if (force_redraw) { ! RedrawStatusWindow (); } else { ! RedrawStatusStrings (); } } ! void SetStringStatus (StatusStr) ! char * StatusStr; /* If StatusStr is NULL, just refresh the status */ { ! register int i; ! int force_redraw=FALSE; if (PRTGIF || noStatusWindow) return; ! if (!oneLineStatus) ! { oneLineStatus = TRUE; ! for (i=0; i < MAX_STATUS_BTNS; i++) ! XUnmapWindow (mainDisplay, statusSubWindow[i]); ! XSync (mainDisplay, False); force_redraw = TRUE; ! } ! else if (StatusStr != NULL && strcmp (StatusStr, oneLineStatusStr) == 0) return; ! ! if (StatusStr != NULL) UtilStrCpy (oneLineStatusStr, MAXSTRING+1, StatusStr); ! if (force_redraw) ! RedrawStatusWindow (); ! else ! RedrawStatusStrings (); } --- 453,487 ---- } if (force_redraw) { ! RedrawStatusWindow(); } else { ! RedrawStatusStrings(); } } ! void SetStringStatus(StatusStr) ! char *StatusStr; /* If StatusStr is NULL, just refresh the status */ { ! register int i; ! int force_redraw=FALSE; if (PRTGIF || noStatusWindow) return; ! if (!oneLineStatus) { oneLineStatus = TRUE; ! for (i=0; i < MAX_STATUS_BTNS; i++) { ! XUnmapWindow(mainDisplay, statusSubWindow[i]); ! } ! XSync(mainDisplay, False); force_redraw = TRUE; ! } else if (StatusStr != NULL && strcmp(StatusStr, oneLineStatusStr) == 0) { return; ! } ! if (StatusStr != NULL) UtilStrCpy(oneLineStatusStr, MAXSTRING+1, StatusStr); ! if (force_redraw) { ! RedrawStatusWindow(); ! } else { ! RedrawStatusStrings(); ! } } *************** *** 488,492 **** static struct StatusInfoRec *topStatusInfo=NULL; ! void SaveStatusStrings () { struct StatusInfoRec *psi; --- 495,499 ---- static struct StatusInfoRec *topStatusInfo=NULL; ! void SaveStatusStrings() { struct StatusInfoRec *psi; *************** *** 506,510 **** } ! void RestoreStatusStrings () { struct StatusInfoRec *psi; --- 513,517 ---- } ! void RestoreStatusStrings() { struct StatusInfoRec *psi; *************** *** 569,633 **** } ! void MsgEventHandler (input) ! XEvent * input; { ! XButtonEvent * button_ev; ! double frac; ! if (input->type == Expose) ! RedrawMsg (); ! else if (input->type == EnterNotify) ! SetMouseStatus ("scroll down 1 line", "scroll around", "scroll up 1 line"); ! else if (input->type == ButtonPress) ! { button_ev = &(input->xbutton); ! if (button_ev->button == Button1) ! { ! if (button_ev->state & (ShiftMask | ControlMask)) ! { firstCharIndex += 4; ! RedrawMsg (); ! } ! else ! { if (topMsgNumber+1 >= msgCount) return; topMsgNumber++; ! RedrawMsg (); } ! } ! else if (button_ev->button == Button2) ! { ! int done=FALSE, saved_x=button_ev->x, saved_y=button_ev->y, x, y; ! int saved_index=firstCharIndex; ! XEvent ev; frac = ((double)saved_y) / ((double)msgWindowH); topMsgNumber = max(0,round(msgCount * frac)); ! RedrawMsg (); ! XGrabPointer (mainDisplay, msgWindow, False, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! while (!done) ! { ! XNextEvent (mainDisplay, &ev); ! ! if (ev.type == Expose || ev.type == VisibilityNotify) ! ExposeEventHandler (&ev, TRUE); ! else if (ev.type == ButtonRelease) ! { ! XUngrabPointer (mainDisplay, CurrentTime); done = TRUE; ! } ! else if (ev.type == MotionNotify) ! { x = ev.xmotion.x; y = ev.xmotion.y; if (!((y<0 && topMsgNumber<=0) || (y>msgWindowH && ! topMsgNumber>=msgCount)) && y != saved_y) ! { saved_y = y; frac = ((double)saved_y) / ((double)msgWindowH); --- 576,628 ---- } ! void MsgEventHandler(input) ! XEvent *input; { ! XButtonEvent *button_ev; ! double frac; ! if (input->type == Expose) { ! RedrawMsg(); ! } else if (input->type == EnterNotify) { ! SetMouseStatus("scroll down 1 line", "scroll around", "scroll up 1 line"); ! } else if (input->type == ButtonPress) { button_ev = &(input->xbutton); ! if (button_ev->button == Button1) { ! if (button_ev->state & (ShiftMask | ControlMask)) { firstCharIndex += 4; ! RedrawMsg(); ! } else { if (topMsgNumber+1 >= msgCount) return; topMsgNumber++; ! RedrawMsg(); } ! } else if (button_ev->button == Button2) { ! int done=FALSE, saved_x=button_ev->x, saved_y=button_ev->y, x, y; ! int saved_index=firstCharIndex; ! XEvent ev; frac = ((double)saved_y) / ((double)msgWindowH); topMsgNumber = max(0,round(msgCount * frac)); ! RedrawMsg(); ! XGrabPointer(mainDisplay, msgWindow, False, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! while (!done) { ! XNextEvent(mainDisplay, &ev); ! ! if (ev.type == Expose || ev.type == VisibilityNotify) { ! ExposeEventHandler(&ev, TRUE); ! } else if (ev.type == ButtonRelease) { ! XUngrabPointer(mainDisplay, CurrentTime); done = TRUE; ! } else if (ev.type == MotionNotify) { x = ev.xmotion.x; y = ev.xmotion.y; if (!((y<0 && topMsgNumber<=0) || (y>msgWindowH && ! topMsgNumber>=msgCount)) && y != saved_y) { saved_y = y; frac = ((double)saved_y) / ((double)msgWindowH); *************** *** 635,660 **** firstCharIndex = ((x-saved_x)>>3) + saved_index; if (firstCharIndex < 0) firstCharIndex = 0; ! RedrawMsg (); } ! while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &ev)) ; } } ! } ! else if (button_ev->button == Button3) ! { ! if (button_ev->state & (ShiftMask | ControlMask)) ! { if (firstCharIndex <= 0) return; firstCharIndex -= 4; if (firstCharIndex < 0) firstCharIndex = 0; ! RedrawMsg (); ! } ! else ! { if (topMsgNumber == 0) return; topMsgNumber--; ! RedrawMsg (); } } --- 630,650 ---- firstCharIndex = ((x-saved_x)>>3) + saved_index; if (firstCharIndex < 0) firstCharIndex = 0; ! RedrawMsg(); } ! while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } } ! } else if (button_ev->button == Button3) { ! if (button_ev->state & (ShiftMask | ControlMask)) { if (firstCharIndex <= 0) return; firstCharIndex -= 4; if (firstCharIndex < 0) firstCharIndex = 0; ! RedrawMsg(); ! } else { if (topMsgNumber == 0) return; topMsgNumber--; ! RedrawMsg(); } } *************** *** 662,678 **** } ! void StatusEventHandler (input) ! XEvent * input; { if (PRTGIF || noStatusWindow) return; ! if (input->type == Expose) ! RedrawStatusWindow (); } ! void InitStatus () { ! register int i; ! char * c_ptr; oneLineStatus = FALSE; --- 652,669 ---- } ! void StatusEventHandler(input) ! XEvent *input; { if (PRTGIF || noStatusWindow) return; ! if (input->type == Expose) { ! RedrawStatusWindow(); ! } } ! void InitStatus() { ! register int i; ! char *c_ptr; oneLineStatus = FALSE; *************** *** 681,688 **** reverseMouseStatusButtons = FALSE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "ReverseMouseStatusButtons")) != NULL && ! (strcmp (c_ptr, "true") == 0 || strcmp (c_ptr, "True") == 0)) reverseMouseStatusButtons = TRUE; } --- 672,680 ---- reverseMouseStatusButtons = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "ReverseMouseStatusButtons")) != NULL && ! UtilStrICmp(c_ptr, "true") == 0) { reverseMouseStatusButtons = TRUE; + } } *************** *** 697,705 **** } ! static char * scanVal = NULL; ! static char * scanSep = NULL; ! void InitScan (s, pat) ! char * s, * pat; { scanVal = s; --- 689,697 ---- } ! static char *scanVal=NULL; ! static char *scanSep=NULL; ! void InitScan(s, pat) ! char *s, *pat; { scanVal = s; *************** *** 708,718 **** static ! char * GetString () { ! char * c_ptr; ! if (scanVal == NULL || scanSep == NULL) return (NULL); while (*scanVal!='\0' && strchr(scanSep,*scanVal)!=NULL) *scanVal++ = '\0'; ! if (*scanVal == '\0') return (NULL); c_ptr=scanVal; --- 700,710 ---- static ! char *GetString() { ! char *c_ptr; ! if (scanVal == NULL || scanSep == NULL) return NULL; while (*scanVal!='\0' && strchr(scanSep,*scanVal)!=NULL) *scanVal++ = '\0'; ! if (*scanVal == '\0') return NULL; c_ptr=scanVal; *************** *** 720,774 **** if (*scanVal != '\0') *scanVal++ = '\0'; ! return (c_ptr); } ! int ScanValue (fmt, v, item, stype) ! char * fmt, * item, * stype; ! void * v; { ! char * c_ptr, msg[MAXPATHLENGTH]; ! if (scanVal == NULL) return (INVALID); #ifdef DEBUG ! printf ("get %s for %s from %s: ", item, stype, scanVal); #endif ! if ((c_ptr = GetString()) == NULL) ! { ! #ifdef DEBUG ! printf ("nothing\n"); #endif ! ! (void) sprintf (msg, "%s, %d: Missing %s in %s", scanFileName, scanLineNum, item, stype); ! if (PRTGIF) ! fprintf (stderr, "%s\n", msg); ! else ! Msg (msg); ! return (INVALID); } ! if (sscanf (c_ptr, fmt, v) != 1) ! { ! #ifdef DEBUG ! printf ("error in %s\n", c_ptr); #endif ! ! (void) sprintf (msg, "%s, %d: Bad %s in %s [%s]", scanFileName, scanLineNum, item, stype, c_ptr); ! if (PRTGIF) ! fprintf (stderr, "%s\n", msg); ! else ! Msg (msg); ! return (INVALID); } #ifdef DEBUG ! printf ("got %d\n", (*(int *)v)); #endif ! return (0); } --- 712,762 ---- if (*scanVal != '\0') *scanVal++ = '\0'; ! return c_ptr; } ! int ScanValue(fmt, v, item, stype) ! char *fmt, *item, *stype; ! void *v; { ! char *c_ptr, msg[MAXPATHLENGTH]; ! if (scanVal == NULL) return INVALID; #ifdef DEBUG ! printf("get %s for %s from %s: ", item, stype, scanVal); #endif ! if ((c_ptr=GetString()) == NULL) { #ifdef DEBUG ! printf("nothing\n"); #endif ! (void)sprintf(msg, "%s, %d: Missing %s in %s", scanFileName, scanLineNum, item, stype); ! if (PRTGIF) { ! fprintf(stderr, "%s\n", msg); ! } else { ! Msg(msg); ! } ! return INVALID; } ! if (sscanf(c_ptr, fmt, v) != 1) { #ifdef DEBUG ! printf("error in %s\n", c_ptr); #endif ! (void)sprintf(msg, "%s, %d: Bad %s in %s [%s]", scanFileName, scanLineNum, item, stype, c_ptr); ! if (PRTGIF) { ! fprintf(stderr, "%s\n", msg); ! } else { ! Msg(msg); ! } ! return INVALID; } #ifdef DEBUG ! printf("got %d\n", (*(int *)v)); #endif ! return 0; } *************** *** 777,874 **** static int emergencyCount = 0; ! void EmergencySave (sig) ! int sig; { ! switch (sig) ! { ! case SIGHUP: ! fprintf(stderr, "SIGHUP signal received! %s aborted!\n", TOOL_NAME); ! break; ! case SIGFPE: ! fprintf(stderr, "SIGFPE signal received! %s aborted!\n", TOOL_NAME); ! break; #ifndef linux ! case SIGBUS: ! fprintf(stderr, "SIGBUS signal received! %s aborted!\n", TOOL_NAME); ! break; #endif ! case SIGSEGV: ! fprintf(stderr, "SIGSEGV signal received! %s aborted!\n", TOOL_NAME); ! break; } ! ! if (++emergencyCount > MAXEMERGENCYCOUNT) ! { ! fprintf (stderr, "Error count exceeds %1d in %s! %s aborted!\n", MAXEMERGENCYCOUNT, "EmergencySave()", TOOL_NAME); ! exit (-1); } if (exitNormally) return; ! signal (SIGHUP, SIG_DFL); ! signal (SIGFPE, SIG_DFL); #ifndef linux ! signal (SIGBUS, SIG_DFL); #endif ! signal (SIGSEGV, SIG_DFL); ! if (fileModified) ! { ! switch (SaveTmpFile ("EmergencySave")) ! { ! case OBJ_FILE_SAVED: ! fprintf (stderr, "Saved to EmergencySave.%s.\n", OBJ_FILE_EXT); ! break; ! case SYM_FILE_SAVED: ! fprintf (stderr, "Saved to EmergencySave.%s.\n", SYM_FILE_EXT); ! break; ! case INVALID: ! fprintf (stderr, "Unable to save working file.\n"); break; } } exitNormally = TRUE; ! exit (0); } static ! int EmergencySaveForXCont (s) ! char * s; { ! if (++emergencyCount > MAXEMERGENCYCOUNT) ! { ! fprintf (stderr, "Error count exceeds %1d in %s! %s aborted!\n", MAXEMERGENCYCOUNT, s, TOOL_NAME); ! exit (-1); } ! if (exitNormally) return (0); ! if (copyingToCutBuffer) ! { copyingToCutBuffer = INVALID; ! return (0); } ! signal (SIGHUP, SIG_DFL); ! signal (SIGFPE, SIG_DFL); #ifndef linux ! signal (SIGBUS, SIG_DFL); #endif ! signal (SIGSEGV, SIG_DFL); ! if (fileModified) ! { ! switch (SaveTmpFile ("EmergencySave")) ! { ! case OBJ_FILE_SAVED: ! fprintf (stderr, "Saved to EmergencySave.%s.\n", OBJ_FILE_EXT); ! break; ! case SYM_FILE_SAVED: ! fprintf (stderr, "Saved to EmergencySave.%s.\n", SYM_FILE_EXT); ! break; ! case INVALID: ! fprintf (stderr, "Unable to save working file.\n"); ! break; } } --- 765,853 ---- static int emergencyCount = 0; ! void EmergencySave(sig) ! int sig; { ! switch (sig) { ! case SIGHUP: ! fprintf(stderr, "SIGHUP signal received! %s aborted!\n", TOOL_NAME); ! break; ! case SIGFPE: ! fprintf(stderr, "SIGFPE signal received! %s aborted!\n", TOOL_NAME); ! break; #ifndef linux ! case SIGBUS: ! fprintf(stderr, "SIGBUS signal received! %s aborted!\n", TOOL_NAME); ! break; #endif ! case SIGSEGV: ! fprintf(stderr, "SIGSEGV signal received! %s aborted!\n", TOOL_NAME); ! break; } ! if (++emergencyCount > MAXEMERGENCYCOUNT) { ! fprintf(stderr, "Error count exceeds %1d in %s! %s aborted!\n", MAXEMERGENCYCOUNT, "EmergencySave()", TOOL_NAME); ! exit(-1); } if (exitNormally) return; ! signal(SIGHUP, SIG_DFL); ! signal(SIGFPE, SIG_DFL); #ifndef linux ! signal(SIGBUS, SIG_DFL); #endif ! signal(SIGSEGV, SIG_DFL); ! if (fileModified) { ! switch (SaveTmpFile("EmergencySave")) { ! case OBJ_FILE_TYPE: ! fprintf(stderr, "Saved to EmergencySave.%s.\n", OBJ_FILE_EXT); ! break; ! case SYM_FILE_TYPE: ! fprintf(stderr, "Saved to EmergencySave.%s.\n", SYM_FILE_EXT); ! break; ! case INVALID: ! fprintf(stderr, "Unable to save working file.\n"); break; } } exitNormally = TRUE; ! exit(0); } static ! int EmergencySaveForXCont(s) ! char *s; { ! if (++emergencyCount > MAXEMERGENCYCOUNT) { ! fprintf(stderr, "Error count exceeds %1d in %s! %s aborted!\n", MAXEMERGENCYCOUNT, s, TOOL_NAME); ! exit(-1); } ! if (exitNormally) return 0; ! if (copyingToCutBuffer) { copyingToCutBuffer = INVALID; ! return 0; } ! signal(SIGHUP, SIG_DFL); ! signal(SIGFPE, SIG_DFL); #ifndef linux ! signal(SIGBUS, SIG_DFL); #endif ! signal(SIGSEGV, SIG_DFL); ! if (fileModified) { ! switch (SaveTmpFile("EmergencySave")) { ! case OBJ_FILE_TYPE: ! fprintf(stderr, "Saved to EmergencySave.%s.\n", OBJ_FILE_EXT); ! break; ! case SYM_FILE_TYPE: ! fprintf(stderr, "Saved to EmergencySave.%s.\n", SYM_FILE_EXT); ! break; ! case INVALID: ! fprintf(stderr, "Unable to save working file.\n"); ! break; } } *************** *** 877,944 **** } ! int EmergencySaveForX (dsp, ev) ! Display * dsp; ! XErrorEvent * ev; ! { ! char msg[MAXSTRING+1]; ! ! XGetErrorText (mainDisplay, (int)(ev->error_code), msg, MAXSTRING); ! fprintf (stderr, "X ERROR: %s.\n", msg); ! ! return (EmergencySaveForXCont ("EmergencySaveForX()")); ! } ! ! int IOEmergencySaveForX (dsp) ! Display * dsp; ! { ! return (EmergencySaveForXCont ("IOEmergencySaveForX()")); ! } ! ! void Error (Where, Message) ! char * Where, * Message; ! { ! fprintf (stderr, "Error in %s. %s.\n", Where, Message); ! fprintf (stderr, "%s aborted!\n", TOOL_NAME); ! if (fileModified) EmergencySave (0); ! exit (-1); ! } ! ! void Usage (tool_name) ! char * tool_name; ! { ! fprintf (stderr, "Usage:\t%s \\\n", tool_name); ! fprintf (stderr, "\t[-display displayname] \\\n"); ! fprintf (stderr, "\t[-fg ] \\\n"); ! fprintf (stderr, "\t[-bg ] \\\n"); ! fprintf (stderr, "\t[-bd ] \\\n"); ! fprintf (stderr, "\t[-rv] [-nv] \\\n"); ! fprintf (stderr, "\t[-bw] \\\n"); ! fprintf (stderr, "\t[-reqcolor] \\\n"); ! fprintf (stderr, "\t[-cwo] \\\n"); ! fprintf (stderr, "\t[-hyper] \\\n"); ! fprintf (stderr, "\t[-a4] \\\n"); ! fprintf (stderr, "\t[-geometry ] [=] \\\n"); ! fprintf (stderr, "\t[[.obj]]\n"); ! fprintf (stderr, "or:\n"); ! fprintf (stderr, "\t%s -print \\\n", tool_name); ! fprintf (stderr, "\t[-eps] [-p] \\\n"); ! fprintf (stderr, "\t[-ps] [-f] \\\n"); ! fprintf (stderr, "\t[-text] \\\n"); ! fprintf (stderr, "\t[-raw[+h]] \\\n"); ! fprintf (stderr, "\t[-dosepsfilter] \\\n"); ! fprintf (stderr, "\t[-status] \\\n"); ! fprintf (stderr, "\t[-gray] \\\n"); ! fprintf (stderr, "\t[-color | -reqcolor] \\\n"); ! fprintf (stderr, "\t[-adobe | -adobe=/] \\\n"); ! fprintf (stderr, "\t[-print_cmd \"\"] \\\n"); ! fprintf (stderr, "\t[-one_file_per_page] \\\n"); ! fprintf (stderr, "\t[-pepsc] \\\n"); ! fprintf (stderr, "\t[-a4] \\\n"); ! fprintf (stderr, "\t[-bop_hook \"\"] \\\n"); ! fprintf (stderr, "\t[-eop_hook \"\"] \\\n"); ! fprintf (stderr, "\t[-odir] \\\n"); ! fprintf (stderr, "\t[[.obj] [.obj] ...]\n"); ! exit (-1); } --- 856,934 ---- } ! int EmergencySaveForX(dsp, ev) ! Display *dsp; ! XErrorEvent *ev; ! { ! char msg[MAXSTRING+1]; ! ! XGetErrorText(mainDisplay, (int)(ev->error_code), msg, MAXSTRING); ! fprintf(stderr, "X ERROR: %s.\n", msg); ! ! return EmergencySaveForXCont("EmergencySaveForX()"); ! } ! ! int IOEmergencySaveForX(dsp) ! Display *dsp; ! { ! return EmergencySaveForXCont("IOEmergencySaveForX()"); ! } ! ! void Error(Where, Message) ! char *Where, *Message; ! { ! fprintf(stderr, "Error in %s. %s.\n", Where, Message); ! fprintf(stderr, "%s aborted!\n", TOOL_NAME); ! if (fileModified) EmergencySave(0); ! exit(-1); ! } ! ! void Usage(tool_name) ! char *tool_name; ! { ! if (TGIF_PATCHLEVEL == 0) { ! fprintf(stderr, "%s Version %s\n", TOOL_NAME, versionString); ! } else { ! fprintf(stderr, "%s Version %s (patchlevel %1d)\n", TOOL_NAME, ! versionString, TGIF_PATCHLEVEL); ! } ! fprintf(stderr, "%s\n\n", copyrightString); ! fprintf(stderr, "Usage:\t%s \\\n", tool_name); ! fprintf(stderr, "\t[-display displayname] \\\n"); ! fprintf(stderr, "\t[-fg ] \\\n"); ! fprintf(stderr, "\t[-bg ] \\\n"); ! fprintf(stderr, "\t[-bd ] \\\n"); ! fprintf(stderr, "\t[-rv] [-nv] \\\n"); ! fprintf(stderr, "\t[-bw] \\\n"); ! fprintf(stderr, "\t[-reqcolor] \\\n"); ! fprintf(stderr, "\t[-cwo] \\\n"); ! fprintf(stderr, "\t[-hyper] \\\n"); ! fprintf(stderr, "\t[-a4] \\\n"); ! fprintf(stderr, "\t[-geometry ] [=] \\\n"); ! fprintf(stderr, "\t[[.obj]]\n"); ! fprintf(stderr, "or:\n"); ! fprintf(stderr, "\t%s -print \\\n", tool_name); ! fprintf(stderr, "\t[-display displayname] \\\n"); ! fprintf(stderr, "\t[-stdout] \\\n"); ! fprintf(stderr, "\t[-eps | -p | -epsi | -tiffepsi] \\\n"); ! fprintf(stderr, "\t[-ps | -f] \\\n"); ! fprintf(stderr, "\t[-text] \\\n"); ! fprintf(stderr, "\t[-gif | -xpm | -xbm | -html] \\\n"); ! fprintf(stderr, "\t[-raw[+h]] \\\n"); ! fprintf(stderr, "\t[-dosepsfilter [-previewonly]] \\\n"); ! fprintf(stderr, "\t[-status] \\\n"); ! fprintf(stderr, "\t[-gray] \\\n"); ! fprintf(stderr, "\t[-color | -reqcolor] \\\n"); ! fprintf(stderr, "\t[-adobe | -adobe=/] \\\n"); ! fprintf(stderr, "\t[-print_cmd \"\"] \\\n"); ! fprintf(stderr, "\t[-one_file_per_page] \\\n"); ! fprintf(stderr, "\t[-pepsc] \\\n"); ! fprintf(stderr, "\t[-a4] \\\n"); ! fprintf(stderr, "\t[-bop_hook \"\"] \\\n"); ! fprintf(stderr, "\t[-eop_hook \"\"] \\\n"); ! fprintf(stderr, "\t[-tmp_file_mode \"\"] \\\n"); ! fprintf(stderr, "\t[-odir] \\\n"); ! fprintf(stderr, "\t[[.obj] [.obj] ...]\n"); ! exit(-1); } *************** *** 947,963 **** char *argv[]; { ! char *c_ptr; ! int saved_argc=argc; char **saved_argv=argv; cmdLineOneFilePerPage = FALSE; for (argc--, argv++; argc > 0; argc--, argv++) { if (**argv == '-') { if (strcmp(*argv, "-raw") == 0) { ! cmdLineDumpURL = TRUE; ! cmdLineDumpURLWithHeader = FALSE; } else if (strcmp(*argv, "-raw+h") == 0) { ! cmdLineDumpURL = TRUE; ! cmdLineDumpURLWithHeader = TRUE; } } --- 937,954 ---- char *argv[]; { ! char *c_ptr; ! int saved_argc=argc, show_copyright=TRUE; char **saved_argv=argv; + *cmdLineTmpFileModeStr = '\0'; cmdLineOneFilePerPage = FALSE; for (argc--, argv++; argc > 0; argc--, argv++) { if (**argv == '-') { if (strcmp(*argv, "-raw") == 0) { ! show_copyright = FALSE; } else if (strcmp(*argv, "-raw+h") == 0) { ! show_copyright = FALSE; ! } else if (strcmp(*argv, "-stdout") == 0) { ! show_copyright = FALSE; } } *************** *** 965,969 **** argc = saved_argc; argv = saved_argv; ! if (!cmdLineDumpURL) { if (TGIF_PATCHLEVEL == 0) { fprintf(stderr, "%s Version %s\n", TOOL_NAME, versionString); --- 956,960 ---- argc = saved_argc; argv = saved_argv; ! if (show_copyright) { if (TGIF_PATCHLEVEL == 0) { fprintf(stderr, "%s Version %s\n", TOOL_NAME, versionString); *************** *** 976,982 **** } if (!from_prtgif) { ! if ((c_ptr=getenv("TGIFPATH")) == NULL) strcpy(drawPath, TGIF_PATH); ! else if (((int)strlen(c_ptr)) >= MAXSTRING) { /* must be an error */ --- 967,973 ---- } if (!from_prtgif) { ! if ((c_ptr=getenv("TGIFPATH")) == NULL) { strcpy(drawPath, TGIF_PATH); ! } else { if (((int)strlen(c_ptr)) >= MAXSTRING) { /* must be an error */ *************** *** 985,988 **** --- 976,980 ---- strcpy(drawPath, c_ptr); } + } #ifdef PRINT_CMD strcpy(printCommand, PRINT_CMD); *************** *** 1011,1018 **** int len; ! if (strcmp(*argv, "-p") == 0 || strcmp(*argv, "-eps") == 0) { whereToPrint = LATEX_FIG; } else if (strcmp(*argv,"-f") == 0 || strcmp(*argv,"-ps") == 0) { whereToPrint = PS_FILE; } else if (strcmp(*argv, "-text") == 0) { whereToPrint = TEXT_FILE; --- 1003,1043 ---- int len; ! if (strcmp(*argv, "-display") == 0) { ! argc--; argv++; ! if (argc <= 0) { ! fprintf(stderr, "Missing display name.\n"); ! Usage(progName); ! } ! if ((displayName=UtilStrDup(*argv)) == NULL) FailAllocMessage(); ! } else if (strcmp(*argv, "-p") == 0 || strcmp(*argv, "-eps") == 0) { whereToPrint = LATEX_FIG; } else if (strcmp(*argv,"-f") == 0 || strcmp(*argv,"-ps") == 0) { whereToPrint = PS_FILE; + } else if (strcmp(*argv,"-stdout") == 0) { + cmdLineStdOut = TRUE; + } else if (strcmp(*argv,"-epsi") == 0) { + cmdLineWhereToPrint = EPSI_FILE; + cmdLineTiffEPSI = FALSE; + cmdLineOpenDisplay = TRUE; + } else if (strcmp(*argv,"-tiffepsi") == 0) { + cmdLineWhereToPrint = EPSI_FILE; + cmdLineTiffEPSI = TRUE; + cmdLineOpenDisplay = TRUE; + } else if (strcmp(*argv,"-gif") == 0) { + cmdLineWhereToPrint = GIF_FILE; + cmdLineColor = TRUE; + cmdLineOpenDisplay = TRUE; + } else if (strcmp(*argv,"-xpm") == 0) { + cmdLineWhereToPrint = XBM_FILE; + cmdLineColor = TRUE; + cmdLineOpenDisplay = TRUE; + } else if (strcmp(*argv,"-xbm") == 0) { + cmdLineWhereToPrint = XBM_FILE; + cmdLineColor = FALSE; + cmdLineOpenDisplay = TRUE; + } else if (strcmp(*argv,"-html") == 0) { + cmdLineWhereToPrint = HTML_FILE; + cmdLineColor = TRUE; + cmdLineOpenDisplay = TRUE; } else if (strcmp(*argv, "-text") == 0) { whereToPrint = TEXT_FILE; *************** *** 1025,1028 **** --- 1050,1055 ---- } else if (strcmp(*argv, "-dosepsfilter") == 0) { cmdLineDosEpsFilter = TRUE; + } else if (strcmp(*argv, "-previewonly") == 0) { + cmdLinePreviewOnly = TRUE; } else if (strcmp(*argv, "-status") == 0) { cmdLineDumpURLShowStatus = TRUE; *************** *** 1061,1064 **** --- 1088,1110 ---- } SetEopHook(*argv); + } else if (strcmp(*argv, "-tmp_file_mode") == 0) { + int nFileMode=0; + + argc--; argv++; + if (argc <= 0) { + fprintf(stderr, "Missing argument for -tmp_file_mode.\n"); + Usage(progName); + } + strcpy(cmdLineTmpFileModeStr, *argv); + UtilTrimBlanks(cmdLineTmpFileModeStr); + if (*cmdLineTmpFileModeStr != '\0' && sscanf(cmdLineTmpFileModeStr, + "%o", &nFileMode) == 1) { + if (nFileMode >= 0) { + tmpFileMode = nFileMode; + } else { + fprintf(stderr, "Invalid argument for -tmp_file_mode.\n"); + Usage(progName); + } + } } else if (strcmp(*argv, "-gray") == 0) { useGray = TRUE; *************** *** 1077,1082 **** strcpy(tmp_str, &(*argv)[7]); if (!ParsePsAdobeString(tmp_str, &usePsAdobeString, adobeString, ! epsfString)) ! { fprintf(stderr, "%s %s*UsePsAdobeString: '%s', %s.\n", "Invalid", TOOL_NAME, tmp_str, "'false' is used"); --- 1123,1127 ---- strcpy(tmp_str, &(*argv)[7]); if (!ParsePsAdobeString(tmp_str, &usePsAdobeString, adobeString, ! epsfString)) { fprintf(stderr, "%s %s*UsePsAdobeString: '%s', %s.\n", "Invalid", TOOL_NAME, tmp_str, "'false' is used"); *************** *** 1113,1117 **** } } else if (strncmp(*argv, "-o", 2) == 0) { ! strcpy (outputDir, &(*argv)[2]); } else if (strcmp(*argv, "-prtgif") != 0 && strcmp(*argv, "-print") != 0 && --- 1158,1162 ---- } } else if (strncmp(*argv, "-o", 2) == 0) { ! strcpy(outputDir, &(*argv)[2]); } else if (strcmp(*argv, "-prtgif") != 0 && strcmp(*argv, "-print") != 0 && *************** *** 1145,1148 **** --- 1190,1194 ---- *file_name = '\0'; + *cmdLineTmpFileModeStr = '\0'; for (i=1; i < argc; i++) { if (strcmp(argv[i], "-display") == 0) { *************** *** 1151,1155 **** Usage(progName); } ! displayName = argv[i]; } else if (strcmp(argv[i], "-bw") == 0) { cmdLineBW = TRUE; --- 1197,1201 ---- Usage(progName); } ! if ((displayName=UtilStrDup(argv[i])) == NULL) FailAllocMessage(); } else if (strcmp(argv[i], "-bw") == 0) { cmdLineBW = TRUE; *************** *** 1175,1192 **** strcpy(cmdLineForeground, argv[i]); } else if (strcmp(argv[i], "-bg") == 0) { ! if (++i == argc) ! { fprintf(stderr, "Missing background color.\n"); Usage(progName); } cmdLineBackground = (char*)malloc(80*sizeof(char)); if (cmdLineBackground == NULL) FailAllocMessage(); strcpy(cmdLineBackground, argv[i]); } else if (strcmp(argv[i], "-bd") == 0) { ! if (++i == argc) ! { fprintf(stderr, "Missing border color.\n"); Usage(progName); } cmdLineBorder = (char*)malloc(80*sizeof(char)); if (cmdLineBorder == NULL) FailAllocMessage(); strcpy(cmdLineBorder, argv[i]); } else if (strcmp(argv[i], "-geometry") == 0) { ! if (++i == argc) ! { fprintf(stderr, "Missing geometry spec.\n"); Usage(progName); } strcat(geometrySpec, argv[i]); geometrySpecified = TRUE; --- 1221,1244 ---- strcpy(cmdLineForeground, argv[i]); } else if (strcmp(argv[i], "-bg") == 0) { ! if (++i == argc) { ! fprintf(stderr, "Missing background color.\n"); ! Usage(progName); ! } cmdLineBackground = (char*)malloc(80*sizeof(char)); if (cmdLineBackground == NULL) FailAllocMessage(); strcpy(cmdLineBackground, argv[i]); } else if (strcmp(argv[i], "-bd") == 0) { ! if (++i == argc) { ! fprintf(stderr, "Missing border color.\n"); ! Usage(progName); ! } cmdLineBorder = (char*)malloc(80*sizeof(char)); if (cmdLineBorder == NULL) FailAllocMessage(); strcpy(cmdLineBorder, argv[i]); } else if (strcmp(argv[i], "-geometry") == 0) { ! if (++i == argc) { ! fprintf(stderr, "Missing geometry spec.\n"); ! Usage(progName); ! } strcat(geometrySpec, argv[i]); geometrySpecified = TRUE; *** names.c.orig Tue Sep 30 13:23:37 1997 --- names.c Tue Sep 30 13:23:37 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/names.c,v 3.4 1996/11/03 20:20:11 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/names.c,v 3.5 1997/09/14 20:37:55 william Exp $ */ #include *** navigate.c.orig Tue Sep 30 13:23:38 1997 --- navigate.c Tue Sep 30 13:23:38 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/navigate.c,v 3.4 1996/11/29 22:58:43 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/navigate.c,v 3.7 1997/09/30 17:10:25 william Exp $ */ #include *************** *** 337,340 **** --- 335,343 ---- if (strcmp(simple_url_name, url_cache->simple_url_name) == 0) { free(simple_url_name); + if (!navigatingBackAndForth) { + /* + * Should get HEAD of the URL to see if Last-modified has changed. + */ + } if (update_lru) UpdateLRU(url_cache); return url_cache; *** obj.c.orig Tue Sep 30 13:23:40 1997 --- obj.c Tue Sep 30 13:23:40 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/obj.c,v 3.3 1996/10/30 22:11:57 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/obj.c,v 3.6 1997/09/16 23:54:41 william Exp $ */ #include *************** *** 97,102 **** } ! void FreeObj (ObjPtr) ! register struct ObjRec * ObjPtr; { if (ObjPtr->ctm != NULL) { --- 95,119 ---- } ! void ReplaceObj(old_obj, new_obj) ! struct ObjRec *old_obj, *new_obj; ! { ! if (topObj == old_obj) { ! curPage->top = topObj = new_obj; ! new_obj->prev = NULL; ! } else { ! old_obj->prev->next = new_obj; ! new_obj->prev = old_obj->prev; ! } ! if (botObj == old_obj) { ! curPage->bot = botObj = new_obj; ! new_obj->next = NULL; ! } else { ! old_obj->next->prev = new_obj; ! new_obj->next = old_obj->next; ! } ! } ! ! void FreeObj(ObjPtr) ! register struct ObjRec *ObjPtr; { if (ObjPtr->ctm != NULL) { *************** *** 114,137 **** case OBJ_XBM: DelAllAttrs(ObjPtr->fattr); FreeXBmObj(ObjPtr); break; case OBJ_XPM: DelAllAttrs(ObjPtr->fattr); FreeXPmObj(ObjPtr); break; ! case OBJ_SYM: case OBJ_ICON: ! case OBJ_GROUP: DelAllAttrs(ObjPtr->fattr); FreeGroupObj(ObjPtr); break; } } ! void DelObj (ObjPtr) ! struct ObjRec *ObjPtr; { ! if (topObj == ObjPtr) curPage->top = topObj = ObjPtr->next; ! else ObjPtr->prev->next = ObjPtr->next; ! ! if (botObj == ObjPtr) curPage->bot = botObj = ObjPtr->prev; ! else ObjPtr->next->prev = ObjPtr->prev; ! ! FreeObj (ObjPtr); } --- 131,154 ---- case OBJ_XBM: DelAllAttrs(ObjPtr->fattr); FreeXBmObj(ObjPtr); break; case OBJ_XPM: DelAllAttrs(ObjPtr->fattr); FreeXPmObj(ObjPtr); break; ! case OBJ_GROUP: case OBJ_ICON: ! case OBJ_SYM: DelAllAttrs(ObjPtr->fattr); FreeGroupObj(ObjPtr); break; } } ! void DelObj(ObjPtr) ! struct ObjRec *ObjPtr; { ! if (topObj == ObjPtr) { curPage->top = topObj = ObjPtr->next; ! } else { ObjPtr->prev->next = ObjPtr->next; ! } ! if (botObj == ObjPtr) { curPage->bot = botObj = ObjPtr->prev; ! } else { ObjPtr->next->prev = ObjPtr->prev; ! } ! FreeObj(ObjPtr); } *************** *** 181,187 **** } break; - case OBJ_SYM: case OBJ_GROUP: case OBJ_ICON: obj_ptr = ObjPtr->detail.r->last; oltx = obj_ptr->obbox.ltx; olty = obj_ptr->obbox.lty; --- 198,204 ---- } break; case OBJ_GROUP: case OBJ_ICON: + case OBJ_SYM: obj_ptr = ObjPtr->detail.r->last; oltx = obj_ptr->obbox.ltx; olty = obj_ptr->obbox.lty; *************** *** 223,229 **** case OBJ_XPM: break; - case OBJ_SYM: case OBJ_GROUP: case OBJ_ICON: obj_ptr = ObjPtr->detail.r->last; ltx = obj_ptr->bbox.ltx; lty = obj_ptr->bbox.lty; --- 240,246 ---- case OBJ_XPM: break; case OBJ_GROUP: case OBJ_ICON: + case OBJ_SYM: obj_ptr = ObjPtr->detail.r->last; ltx = obj_ptr->bbox.ltx; lty = obj_ptr->bbox.lty; *************** *** 434,440 **** break; - case OBJ_SYM: - case OBJ_ICON: case OBJ_GROUP: for (obj_ptr=ObjPtr->detail.r->first; obj_ptr != NULL; obj_ptr=obj_ptr->next) { --- 451,457 ---- break; case OBJ_GROUP: + case OBJ_ICON: + case OBJ_SYM: for (obj_ptr=ObjPtr->detail.r->first; obj_ptr != NULL; obj_ptr=obj_ptr->next) { *************** *** 453,459 **** GetTransformedOBBoxOffsetVs(ObjPtr, ObjPtr->rotated_obbox); switch (ObjPtr->type) { - case OBJ_SYM: - case OBJ_ICON: case OBJ_GROUP: for (obj_ptr=ObjPtr->detail.r->first; obj_ptr != NULL; obj_ptr=obj_ptr->next) { --- 470,476 ---- GetTransformedOBBoxOffsetVs(ObjPtr, ObjPtr->rotated_obbox); switch (ObjPtr->type) { case OBJ_GROUP: + case OBJ_ICON: + case OBJ_SYM: for (obj_ptr=ObjPtr->detail.r->first; obj_ptr != NULL; obj_ptr=obj_ptr->next) { *************** *** 486,492 **** AdjObjCache(obj_ptr); break; - case OBJ_SYM: - case OBJ_ICON: case OBJ_GROUP: for (ptr=obj_ptr->detail.r->first; ptr != NULL; ptr=ptr->next) { AdjObjCache(ptr); --- 503,509 ---- AdjObjCache(obj_ptr); break; case OBJ_GROUP: + case OBJ_ICON: + case OBJ_SYM: for (ptr=obj_ptr->detail.r->first; ptr != NULL; ptr=ptr->next) { AdjObjCache(ptr); *************** *** 706,711 **** } ! void AdjObjSplineVs (ObjPtr) ! struct ObjRec * ObjPtr; { struct ObjRec *obj_ptr; --- 723,728 ---- } ! void AdjObjSplineVs(ObjPtr) ! struct ObjRec *ObjPtr; { struct ObjRec *obj_ptr; *************** *** 722,728 **** case OBJ_POLYGON: AdjPolygonCache(ObjPtr); break; - case OBJ_SYM: - case OBJ_ICON: case OBJ_GROUP: for (obj_ptr=ObjPtr->detail.r->first; obj_ptr != NULL; obj_ptr=obj_ptr->next) { --- 739,745 ---- case OBJ_POLYGON: AdjPolygonCache(ObjPtr); break; case OBJ_GROUP: + case OBJ_ICON: + case OBJ_SYM: for (obj_ptr=ObjPtr->detail.r->first; obj_ptr != NULL; obj_ptr=obj_ptr->next) { *************** *** 754,764 **** AdjObjSplineVs (obj_ptr); break; - case OBJ_SYM: - case OBJ_ICON: case OBJ_GROUP: ! for (ptr = obj_ptr->detail.r->first; ptr != NULL; ptr = ptr->next) { ! AdjObjSplineVs (ptr); } ! GetTransformedOBBoxOffsetVs (obj_ptr, obj_ptr->rotated_obbox); break; } --- 771,781 ---- AdjObjSplineVs (obj_ptr); break; case OBJ_GROUP: ! case OBJ_ICON: ! case OBJ_SYM: ! for (ptr=obj_ptr->detail.r->first; ptr != NULL; ptr=ptr->next) { ! AdjObjSplineVs(ptr); } ! GetTransformedOBBoxOffsetVs(obj_ptr, obj_ptr->rotated_obbox); break; } *************** *** 840,845 **** case OBJ_BOX: case OBJ_GROUP: - case OBJ_SYM: case OBJ_ICON: case OBJ_XBM: case OBJ_XPM: --- 857,862 ---- case OBJ_BOX: case OBJ_GROUP: case OBJ_ICON: + case OBJ_SYM: case OBJ_XBM: case OBJ_XPM: *** oval.c.orig Tue Sep 30 13:23:41 1997 --- oval.c Tue Sep 30 13:23:41 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/oval.c,v 3.7 1997/01/31 00:08:33 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/oval.c,v 3.8 1997/09/14 20:37:56 william Exp $ */ #include *** page.c.orig Tue Sep 30 13:23:43 1997 --- page.c Tue Sep 30 13:23:43 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/page.c,v 3.7 1996/10/30 22:19:57 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/page.c,v 3.9 1997/09/14 20:37:56 william Exp $ */ #include *************** *** 1081,1097 **** } ! void SpecifyPaperSize () { ! char spec[MAXSTRING+1]; ! MakeQuiescent (); ! if (Dialog ("Please enter physical paper size: [W x H] (e.g., 8.5in x 11in)", ! "( : accept, : cancel )", spec) == INVALID) { return; } if (SetPaperSize(spec)) { ! UpdPageStyle (pageStyle); ! SetFileModified (TRUE); ! ClearAndRedrawDrawWindow (); } } --- 1079,1132 ---- } ! static ! void GetCurPaperSizeSpec(buf) ! char *buf; { ! char w_str[MAXSTRING], h_str[MAXSTRING]; ! float w=((float)onePageWidth)*printMag/((float)100.0); ! float h=((float)onePageHeight)*printMag/((float)100.0); ! float unit=(float)0.0, w_val=(float)0.0, h_val=(float)0.0; ! ! switch (gridSystem) { ! case ENGLISH_GRID: ! unit = (float)PIX_PER_INCH; ! ! switch (pageStyle) { ! case PORTRAIT: w_val = w/unit; h_val = h/unit; break; ! case LANDSCAPE: w_val = h/unit; h_val = w/unit; break; ! } ! FormatFloat(&w_val, w_str); ! FormatFloat(&h_val, h_str); ! sprintf(buf, "%s in x %s in", w_str, h_str); ! break; ! case METRIC_GRID: ! unit = (float)ONE_CM; ! switch (pageStyle) { ! case PORTRAIT: w_val = w/unit; h_val = h/unit; break; ! case LANDSCAPE: w_val = h/unit; h_val = w/unit; break; ! } ! FormatFloat(&w_val, w_str); ! FormatFloat(&h_val, h_str); ! sprintf(buf, "%s cm x %s cm", w_str, h_str); ! break; ! } ! } ! ! void SpecifyPaperSize() ! { ! char buf[MAXSTRING+1], spec[MAXSTRING+1]; ! ! MakeQuiescent(); ! GetCurPaperSizeSpec(gszMsgBox); ! sprintf(buf, "( current paper size: '%s' )", gszMsgBox); ! if (Dialog("Please enter physical paper size: [W x H] (e.g., 8.5in x 11in)", ! buf, spec) == INVALID) { return; } if (SetPaperSize(spec)) { ! UpdPageStyle(pageStyle); ! SetFileModified(TRUE); ! ClearAndRedrawDrawWindow(); } } *** pattern.c.orig Tue Sep 30 13:23:44 1997 --- pattern.c Tue Sep 30 13:23:44 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/pattern.c,v 3.3 1996/12/25 16:39:09 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/pattern.c,v 3.6 1997/09/16 00:16:45 william Exp $ */ #include *************** *** 818,822 **** if (topSel == NULL) dont_do_obj = TRUE; } ! sprintf(gszMsgBox, "Line width set to %1d.", curWidthOfLine[WidthIndex]); Msg(gszMsgBox); if (dont_do_obj) return; --- 816,820 ---- if (topSel == NULL) dont_do_obj = TRUE; } ! sprintf(gszMsgBox, "Line width set to %s.", curWidthOfLineSpec[WidthIndex]); Msg(gszMsgBox); if (dont_do_obj) return; *************** *** 1277,1280 **** --- 1275,1279 ---- if (ObjPtr->detail.rcb->radius != Radius) { ObjPtr->detail.rcb->radius = Radius; + AdjObjCache(ObjPtr); changed = TRUE; } *** poly.c.orig Tue Sep 30 13:23:46 1997 --- poly.c Tue Sep 30 13:23:46 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/poly.c,v 3.9 1997/01/31 00:11:04 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/poly.c,v 3.10 1997/09/14 20:37:58 william Exp $ */ #include *** polygon.c.orig Tue Sep 30 13:23:48 1997 --- polygon.c Tue Sep 30 13:23:48 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/polygon.c,v 3.6 1997/01/30 22:45:54 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/polygon.c,v 3.7 1997/09/14 20:37:58 william Exp $ */ #include *** prtgif.c.orig Tue Sep 30 13:23:49 1997 --- prtgif.c Tue Sep 30 13:23:49 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/prtgif.c,v 3.0 1996/05/06 16:06:53 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/prtgif.c,v 3.1 1997/09/14 20:37:58 william Exp $ */ #include *** ps.c.orig Tue Sep 30 13:23:50 1997 --- ps.c Tue Sep 30 13:23:50 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ps.c,v 3.0 1996/05/06 16:06:59 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ps.c,v 3.1 1997/09/14 20:37:59 william Exp $ */ #include *** raster.c.orig Tue Sep 30 13:23:52 1997 --- raster.c Tue Sep 30 13:23:52 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/raster.c,v 3.2 1996/10/30 22:47:02 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/raster.c,v 3.3 1997/09/14 20:37:59 william Exp $ */ #include *** rcbox.c.orig Tue Sep 30 13:23:53 1997 --- rcbox.c Tue Sep 30 13:23:53 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/rcbox.c,v 3.7 1997/01/30 22:46:09 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/rcbox.c,v 3.8 1997/09/14 20:37:59 william Exp $ */ #include *** rect.c.orig Tue Sep 30 13:23:55 1997 --- rect.c Tue Sep 30 13:23:55 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/rect.c,v 3.2 1997/01/30 22:59:18 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/rect.c,v 3.4 1997/09/17 00:23:34 william Exp $ */ #include *************** *** 51,57 **** #include "spline.e" ! void SetRotateVs (vs, ltx, lty, rbx, rby) ! XPoint * vs; /* array of 5 points */ ! int ltx, lty, rbx, rby; { vs[0].x = vs[4].x = ltx; vs[0].y = vs[4].y = lty; --- 49,55 ---- #include "spline.e" ! void SetRotateVs(vs, ltx, lty, rbx, rby) ! XPoint *vs; /* array of 5 points */ ! int ltx, lty, rbx, rby; { vs[0].x = vs[4].x = ltx; vs[0].y = vs[4].y = lty; *************** *** 61,87 **** } ! void SetBBRec (bbox, ltx, lty, rbx, rby) ! struct BBRec * bbox; ! int ltx, lty, rbx, rby; { bbox->ltx = ltx; bbox->lty = lty; bbox->rbx = rbx; bbox->rby = rby; } ! void ConcatCTM (ctm, orig_ctm, new_ctm) ! struct XfrmMtrxRec * ctm, * orig_ctm, * new_ctm; /* Note: CTM_SX, CTM_SIN, CTM_MSIN, and CTM_SY are scaled 1000 times */ /* while CTM_TX and CTM_TY are not scaled */ { ! new_ctm->m[0] = round(((float)(ctm->m[0]*orig_ctm->m[0] + ctm->m[1]*orig_ctm->m[2]))/1000.0); ! new_ctm->m[1] = round(((float)(ctm->m[0]*orig_ctm->m[1] + ctm->m[1]*orig_ctm->m[3]))/1000.0); ! new_ctm->m[2] = round(((float)(ctm->m[2]*orig_ctm->m[0] + ctm->m[3]*orig_ctm->m[2]))/1000.0); ! new_ctm->m[3] = round(((float)(ctm->m[2]*orig_ctm->m[1] + ctm->m[3]*orig_ctm->m[3]))/1000.0); ! new_ctm->m[4] = round(((float)(ctm->m[4]*orig_ctm->m[0] + ctm->m[5]*orig_ctm->m[2]))/1000.0) + orig_ctm->m[4]; ! new_ctm->m[5] = round(((float)(ctm->m[4]*orig_ctm->m[1] + ctm->m[5]*orig_ctm->m[3]))/1000.0) + orig_ctm->m[5]; } --- 59,85 ---- } ! void SetBBRec(bbox, ltx, lty, rbx, rby) ! struct BBRec *bbox; ! int ltx, lty, rbx, rby; { bbox->ltx = ltx; bbox->lty = lty; bbox->rbx = rbx; bbox->rby = rby; } ! void ConcatCTM(ctm, orig_ctm, new_ctm) ! struct XfrmMtrxRec *ctm, *orig_ctm, *new_ctm; /* Note: CTM_SX, CTM_SIN, CTM_MSIN, and CTM_SY are scaled 1000 times */ /* while CTM_TX and CTM_TY are not scaled */ { ! new_ctm->m[0] = round(((double)(ctm->m[0]*orig_ctm->m[0] + ctm->m[1]*orig_ctm->m[2]))/1000.0); ! new_ctm->m[1] = round(((double)(ctm->m[0]*orig_ctm->m[1] + ctm->m[1]*orig_ctm->m[3]))/1000.0); ! new_ctm->m[2] = round(((double)(ctm->m[2]*orig_ctm->m[0] + ctm->m[3]*orig_ctm->m[2]))/1000.0); ! new_ctm->m[3] = round(((double)(ctm->m[2]*orig_ctm->m[1] + ctm->m[3]*orig_ctm->m[3]))/1000.0); ! new_ctm->m[4] = round(((double)(ctm->m[4]*orig_ctm->m[0] + ctm->m[5]*orig_ctm->m[2]))/1000.0) + orig_ctm->m[4]; ! new_ctm->m[5] = round(((double)(ctm->m[4]*orig_ctm->m[1] + ctm->m[5]*orig_ctm->m[3]))/1000.0) + orig_ctm->m[5]; } *************** *** 91,99 **** struct XfrmMtrxRec *ctm; { ! *NewX = round(((float)(X*ctm->m[0] + Y*ctm->m[2]))/1000.0) + ctm->m[CTM_TX]; ! *NewY = round(((float)(X*ctm->m[1] + Y*ctm->m[3]))/1000.0) + ctm->m[CTM_TY]; } ! void TransformDoublePointThroughCTM (X, Y, ctm, NewX, NewY) double X, Y, *NewX, *NewY; struct XfrmMtrxRec *ctm; --- 89,97 ---- struct XfrmMtrxRec *ctm; { ! *NewX = round(((double)(X*ctm->m[0] + Y*ctm->m[2]))/1000.0) + ctm->m[CTM_TX]; ! *NewY = round(((double)(X*ctm->m[1] + Y*ctm->m[3]))/1000.0) + ctm->m[CTM_TY]; } ! void TransformDoublePointThroughCTM(X, Y, ctm, NewX, NewY) double X, Y, *NewX, *NewY; struct XfrmMtrxRec *ctm; *************** *** 105,111 **** } ! void ReverseTransformPointThroughCTM (X, Y, ctm, NewX, NewY) ! int X, Y, * NewX, * NewY; ! struct XfrmMtrxRec * ctm; /* * [ a b 0 ] --- 103,109 ---- } ! void ReverseTransformPointThroughCTM(X, Y, ctm, NewX, NewY) ! int X, Y, *NewX, *NewY; ! struct XfrmMtrxRec *ctm; /* * [ a b 0 ] *************** *** 122,133 **** */ { ! int ad_bc=ctm->m[0]*ctm->m[3]-ctm->m[1]*ctm->m[2]; ! int term_1=X-ctm->m[CTM_TX], term_2=Y-ctm->m[CTM_TY]; ! float x, y; ! ! x = ((float)1000.0) * ! ((float)(ctm->m[3]*term_1 - ctm->m[2]*term_2)) / ((float)ad_bc); ! y = ((float)1000.0) * ! ((float)(ctm->m[0]*term_2 - ctm->m[1]*term_1)) / ((float)(ad_bc)); *NewX = round(x); *NewY = round(y); --- 120,131 ---- */ { ! int ad_bc=ctm->m[0]*ctm->m[3]-ctm->m[1]*ctm->m[2]; ! int term_1=X-ctm->m[CTM_TX], term_2=Y-ctm->m[CTM_TY]; ! double x, y; ! ! x = ((double)1000.0) * ! ((double)(ctm->m[3]*term_1 - ctm->m[2]*term_2)) / ((double)ad_bc); ! y = ((double)1000.0) * ! ((double)(ctm->m[0]*term_2 - ctm->m[1]*term_1)) / ((double)(ad_bc)); *NewX = round(x); *NewY = round(y); *************** *** 158,185 **** } ! void TransformOffsetBBoxThroughCTM (bbox, ctm, vs) ! struct BBRec * bbox; ! struct XfrmMtrxRec * ctm; ! IntPoint * vs; /* array of 5 points */ { ! int x, y; ! TransformPointThroughCTM (bbox->ltx, bbox->lty, ctm, &x, &y); vs[0].x = vs[4].x = x; vs[0].y = vs[4].y = y; ! TransformPointThroughCTM (bbox->rbx, bbox->lty, ctm, &x, &y); vs[1].x = x; vs[1].y = y; ! TransformPointThroughCTM (bbox->rbx, bbox->rby, ctm, &x, &y); vs[2].x = x; vs[2].y = y; ! TransformPointThroughCTM (bbox->ltx, bbox->rby, ctm, &x, &y); vs[3].x = x; vs[3].y = y; } ! void GetTransformedOBBoxOffsetVs (ObjPtr, Vs) ! struct ObjRec * ObjPtr; ! XPoint * Vs; /* array of 5 points */ ! { ! int x, y; ! struct BBRec obbox; ! IntPoint vs[5]; if (ObjPtr->ctm == NULL) return; --- 156,183 ---- } ! void TransformOffsetBBoxThroughCTM(bbox, ctm, vs) ! struct BBRec *bbox; ! struct XfrmMtrxRec *ctm; ! IntPoint *vs; /* array of 5 points */ { ! int x, y; ! TransformPointThroughCTM(bbox->ltx, bbox->lty, ctm, &x, &y); vs[0].x = vs[4].x = x; vs[0].y = vs[4].y = y; ! TransformPointThroughCTM(bbox->rbx, bbox->lty, ctm, &x, &y); vs[1].x = x; vs[1].y = y; ! TransformPointThroughCTM(bbox->rbx, bbox->rby, ctm, &x, &y); vs[2].x = x; vs[2].y = y; ! TransformPointThroughCTM(bbox->ltx, bbox->rby, ctm, &x, &y); vs[3].x = x; vs[3].y = y; } ! void GetTransformedOBBoxOffsetVs(ObjPtr, Vs) ! struct ObjRec *ObjPtr; ! XPoint *Vs; /* array of 5 points */ ! { ! int x, y; ! struct BBRec obbox; ! IntPoint vs[5]; if (ObjPtr->ctm == NULL) return; *************** *** 189,193 **** obbox.rbx = ObjPtr->orig_obbox.rbx - ObjPtr->x; obbox.rby = ObjPtr->orig_obbox.rby - ObjPtr->y; ! TransformOffsetBBoxThroughCTM (&obbox, ObjPtr->ctm, vs); x = OFFSET_X(vs[0].x + ObjPtr->x); y = OFFSET_Y(vs[0].y + ObjPtr->y); --- 187,191 ---- obbox.rbx = ObjPtr->orig_obbox.rbx - ObjPtr->x; obbox.rby = ObjPtr->orig_obbox.rby - ObjPtr->y; ! TransformOffsetBBoxThroughCTM(&obbox, ObjPtr->ctm, vs); x = OFFSET_X(vs[0].x + ObjPtr->x); y = OFFSET_Y(vs[0].y + ObjPtr->y); *************** *** 204,214 **** } ! void GetTransformedOBBoxAbsVs (ObjPtr, Vs) ! struct ObjRec * ObjPtr; ! IntPoint * Vs; /* array of 5 points */ ! { ! int x, y; ! struct BBRec obbox; ! IntPoint vs[5]; if (ObjPtr->ctm == NULL) return; --- 202,212 ---- } ! void GetTransformedOBBoxAbsVs(ObjPtr, Vs) ! struct ObjRec *ObjPtr; ! IntPoint *Vs; /* array of 5 points */ ! { ! int x, y; ! struct BBRec obbox; ! IntPoint vs[5]; if (ObjPtr->ctm == NULL) return; *************** *** 218,222 **** obbox.rbx = ObjPtr->orig_obbox.rbx - ObjPtr->x; obbox.rby = ObjPtr->orig_obbox.rby - ObjPtr->y; ! TransformOffsetBBoxThroughCTM (&obbox, ObjPtr->ctm, vs); x = vs[0].x + ObjPtr->x; y = vs[0].y + ObjPtr->y; Vs[0].x = Vs[4].x = x; Vs[0].y = Vs[4].y = y; --- 216,220 ---- obbox.rbx = ObjPtr->orig_obbox.rbx - ObjPtr->x; obbox.rby = ObjPtr->orig_obbox.rby - ObjPtr->y; ! TransformOffsetBBoxThroughCTM(&obbox, ObjPtr->ctm, vs); x = vs[0].x + ObjPtr->x; y = vs[0].y + ObjPtr->y; Vs[0].x = Vs[4].x = x; Vs[0].y = Vs[4].y = y; *************** *** 272,307 **** } ! int BBoxIntersect (Rect1, Rect2) ! struct BBRec Rect1, Rect2; { ! if (Rect1.ltx < Rect2.ltx) ! if (Rect1.lty < Rect2.lty) return (Rect1.rbx >= Rect2.ltx && Rect1.rby >= Rect2.lty); ! else return (Rect1.rbx >= Rect2.ltx && Rect1.lty <= Rect2.rby); ! else ! if (Rect1.lty < Rect2.lty) return (Rect1.ltx <= Rect2.rbx && Rect1.rby >= Rect2.lty); ! else return (Rect1.ltx <= Rect2.rbx && Rect1.lty <= Rect2.rby); } int IntersectRect(BBox1, BBox2, BBox3) ! struct BBRec BBox1, BBox2, *BBox3; /* returns the intersection of BBox1 and BBox2 in BBox3 */ { ! if (BBoxIntersect (BBox1, BBox2)) ! { BBox3->ltx = max(BBox1.ltx,BBox2.ltx); BBox3->lty = max(BBox1.lty,BBox2.lty); BBox3->rbx = min(BBox1.rbx,BBox2.rbx); BBox3->rby = min(BBox1.rby,BBox2.rby); ! return (TRUE); } ! return (FALSE); } ! int Inside (BBox1, BBox2) ! struct BBRec BBox1, BBox2; /* returns TRUE if BBox1 is inside BBox2 */ { --- 270,307 ---- } ! int BBoxIntersect(Rect1, Rect2) ! struct BBRec Rect1, Rect2; { ! if (Rect1.ltx < Rect2.ltx) { ! if (Rect1.lty < Rect2.lty) { return (Rect1.rbx >= Rect2.ltx && Rect1.rby >= Rect2.lty); ! } else { return (Rect1.rbx >= Rect2.ltx && Rect1.lty <= Rect2.rby); ! } ! } else { ! if (Rect1.lty < Rect2.lty) { return (Rect1.ltx <= Rect2.rbx && Rect1.rby >= Rect2.lty); ! } else { return (Rect1.ltx <= Rect2.rbx && Rect1.lty <= Rect2.rby); + } + } } int IntersectRect(BBox1, BBox2, BBox3) ! struct BBRec BBox1, BBox2, *BBox3; /* returns the intersection of BBox1 and BBox2 in BBox3 */ { ! if (BBoxIntersect(BBox1, BBox2)) { BBox3->ltx = max(BBox1.ltx,BBox2.ltx); BBox3->lty = max(BBox1.lty,BBox2.lty); BBox3->rbx = min(BBox1.rbx,BBox2.rbx); BBox3->rby = min(BBox1.rby,BBox2.rby); ! return TRUE; } ! return FALSE; } ! int Inside(BBox1, BBox2) ! struct BBRec BBox1, BBox2; /* returns TRUE if BBox1 is inside BBox2 */ { *************** *** 310,316 **** } ! int PointInBBox (X, Y, Rect) ! int X, Y; ! struct BBRec Rect; { return (X >= Rect.ltx && Y >= Rect.lty && X <= Rect.rbx && Y <= Rect.rby); --- 310,316 ---- } ! int PointInBBox(X, Y, Rect) ! int X, Y; ! struct BBRec Rect; { return (X >= Rect.ltx && Y >= Rect.lty && X <= Rect.rbx && Y <= Rect.rby); *************** *** 319,349 **** #define POLYGON_TOL (1.0e-5) ! int PointInPolygon (X, Y, NumPts, V) ! int X, Y, NumPts; ! XPoint * V; ! { ! register double x1, x2, y1, y2; ! double m, y_int; ! int n, count = 0; x2 = (double)V[0].x; y2 = (double)V[0].y; ! for (n = 0; n < NumPts-1; n++) ! { x1 = x2; y1 = y2; ! x2 = (double)V[n+1].x; ! y2 = (double)V[n+1].y; ! if (x2 == x1) ! { if (X == x1 && Y >= min(y1,y2) && Y <= max(y1,y2)) count++; continue; } ! if (x2 > x1) ! { if (X >= x2 || X < x1) continue; ! } ! else ! { if (X > x1 || X <= x2) continue; } --- 319,344 ---- #define POLYGON_TOL (1.0e-5) ! int PointInPolygon(X, Y, NumPts, V) ! int X, Y, NumPts; ! XPoint *V; ! { ! register double x1, x2, y1, y2; ! double m, y_int; ! int n, count=0; x2 = (double)V[0].x; y2 = (double)V[0].y; ! for (n=0; n < NumPts-1; n++) { x1 = x2; y1 = y2; ! x2 = (double)(V[n+1].x); ! y2 = (double)(V[n+1].y); ! if (x2 == x1) { if (X == x1 && Y >= min(y1,y2) && Y <= max(y1,y2)) count++; continue; } ! if (x2 > x1) { if (X >= x2 || X < x1) continue; ! } else { if (X > x1 || X <= x2) continue; } *************** *** 351,364 **** m = (y1 - y2) / (x1 - x2); y_int = m * X + (y1 - m * x1); ! if (Y <= y_int) ! { ! if (fabs(X-x1) < POLYGON_TOL) ! { ! double x3 = (double)((n == 0) ? V[NumPts-2].x : V[n-1].x); if ((x2 > X && X > x3) || (x3 > X && X > x2)) count++; ! } ! else count++; } } --- 346,357 ---- m = (y1 - y2) / (x1 - x2); y_int = m * X + (y1 - m * x1); ! if (Y <= y_int) { ! if (fabs(X-x1) < POLYGON_TOL) { ! double x3=(double)((n == 0) ? V[NumPts-2].x : V[n-1].x); if ((x2 > X && X > x3) || (x3 > X && X > x2)) count++; ! } else { count++; + } } } *************** *** 366,385 **** } ! int PointOnPoly (X, Y, NumPts, V, W) ! int X, Y, NumPts, W; ! XPoint * V; ! { ! register double x1, x2, y1, y2; ! double x_int, y_int, dx, dy, abs_dx, abs_dy, real_w; ! int n, horizontal; x2 = (double)V[0].x; y2 = (double)V[0].y; ! for (n = 0; n < NumPts-1; n++) ! { x1 = x2; y1 = y2; ! x2 = (double)V[n+1].x; ! y2 = (double)V[n+1].y; if (V[n].x==V[n+1].x && V[n].y==V[n+1].y) continue; --- 359,377 ---- } ! int PointOnPoly(X, Y, NumPts, V, W) ! int X, Y, NumPts, W; ! XPoint *V; ! { ! register double x1, x2, y1, y2; ! double x_int, y_int, dx, dy, abs_dx, abs_dy, real_w; ! int n, horizontal; x2 = (double)V[0].x; y2 = (double)V[0].y; ! for (n=0; n < NumPts-1; n++) { x1 = x2; y1 = y2; ! x2 = (double)(V[n+1].x); ! y2 = (double)(V[n+1].y); if (V[n].x==V[n+1].x && V[n].y==V[n+1].y) continue; *************** *** 389,412 **** horizontal = (abs_dx >= abs_dy); ! if (horizontal) ! { ! if (x2 >= x1) ! { if (X < x1 || X > x2) continue; ! } ! else ! { if (X < x2 || X > x1) continue; } real_w = (double)sqrt(abs_dx*abs_dx+abs_dy*abs_dy)*((double)W)/abs_dx; ! } ! else ! { ! if (y2 >= y1) ! { if (Y < y1 || Y > y2) continue; ! } ! else ! { if (Y < y2 || Y > y1) continue; } --- 381,395 ---- horizontal = (abs_dx >= abs_dy); ! if (horizontal) { ! if (x2 >= x1) { if (X < x1 || X > x2) continue; ! } else { if (X < x2 || X > x1) continue; } real_w = (double)sqrt(abs_dx*abs_dx+abs_dy*abs_dy)*((double)W)/abs_dx; ! } else { ! if (y2 >= y1) { if (Y < y1 || Y > y2) continue; ! } else { if (Y < y2 || Y > y1) continue; } *************** *** 414,434 **** } ! if (abs_dx >= abs_dy) ! { /* kind of a horizontal segment */ y_int = y1+(((double)X)-x1)*dy/dx; ! if ((double)fabs((double)Y-y_int) <= (real_w+4)) return (TRUE); ! } ! else ! { /* kind of a vertical segment */ x_int = x1+(((double)Y)-y1)*dx/dy; ! if ((double)fabs((double)X-x_int) <= (real_w+4)) return (TRUE); } } ! return (FALSE); } ! int FindGoodText (XOff, YOff, TextObj) ! int XOff, YOff; ! struct ObjRec * TextObj; /* XOff and YOff are screen offsets */ { --- 397,416 ---- } ! if (abs_dx >= abs_dy) { ! /* kind of a horizontal segment */ y_int = y1+(((double)X)-x1)*dy/dx; ! if ((double)fabs((double)Y-y_int) <= (real_w+4)) return TRUE; ! } else { ! /* kind of a vertical segment */ x_int = x1+(((double)Y)-y1)*dx/dy; ! if ((double)fabs((double)X-x_int) <= (real_w+4)) return TRUE; } } ! return FALSE; } ! int FindGoodText(XOff, YOff, TextObj) ! int XOff, YOff; ! struct ObjRec *TextObj; /* XOff and YOff are screen offsets */ { *************** *** 437,452 **** return FALSE; } ! if (TextObj->ctm == NULL) return TRUE; ! else ! return (PointInPolygon (XOff, YOff, 5, TextObj->rotated_obbox)); } ! int FindGoodXBm (XOff, YOff, XBmObj) ! int XOff, YOff; ! struct ObjRec * XBmObj; /* XOff and YOff are screen offsets */ { ! struct BBRec bbox; if (colorLayers && XBmObj->tmp_parent == NULL && --- 419,435 ---- return FALSE; } ! if (TextObj->ctm == NULL) { return TRUE; ! } else { ! return PointInPolygon(XOff, YOff, 5, TextObj->rotated_obbox); ! } } ! int FindGoodXBm(XOff, YOff, XBmObj) ! int XOff, YOff; ! struct ObjRec *XBmObj; /* XOff and YOff are screen offsets */ { ! struct BBRec bbox; if (colorLayers && XBmObj->tmp_parent == NULL && *************** *** 458,473 **** bbox.rbx = OFFSET_X(XBmObj->obbox.rbx)+3; bbox.rby = OFFSET_Y(XBmObj->obbox.rby)+3; ! if (XBmObj->ctm == NULL) ! return (PointInBBox (XOff, YOff, bbox)); ! else ! return (PointInPolygon (XOff, YOff, 5, XBmObj->rotated_obbox)); } ! int FindGoodXPm (XOff, YOff, XPmObj) ! int XOff, YOff; ! struct ObjRec * XPmObj; /* XOff and YOff are screen offsets */ { ! struct BBRec bbox; if (colorLayers && XPmObj->tmp_parent == NULL && --- 441,457 ---- bbox.rbx = OFFSET_X(XBmObj->obbox.rbx)+3; bbox.rby = OFFSET_Y(XBmObj->obbox.rby)+3; ! if (XBmObj->ctm == NULL) { ! return PointInBBox(XOff, YOff, bbox); ! } else { ! return PointInPolygon(XOff, YOff, 5, XBmObj->rotated_obbox); ! } } ! int FindGoodXPm(XOff, YOff, XPmObj) ! int XOff, YOff; ! struct ObjRec *XPmObj; /* XOff and YOff are screen offsets */ { ! struct BBRec bbox; if (colorLayers && XPmObj->tmp_parent == NULL && *************** *** 479,495 **** bbox.rbx = OFFSET_X(XPmObj->obbox.rbx)+3; bbox.rby = OFFSET_Y(XPmObj->obbox.rby)+3; ! if (XPmObj->ctm == NULL) ! return (PointInBBox (XOff, YOff, bbox)); ! else ! return (PointInPolygon (XOff, YOff, 5, XPmObj->rotated_obbox)); } ! int FindGoodBox (XOff, YOff, BoxObj) ! int XOff, YOff; ! struct ObjRec * BoxObj; /* XOff and YOff are screen offsets */ { ! struct BBRec bbox; ! int w; if (colorLayers && BoxObj->tmp_parent == NULL && --- 463,480 ---- bbox.rbx = OFFSET_X(XPmObj->obbox.rbx)+3; bbox.rby = OFFSET_Y(XPmObj->obbox.rby)+3; ! if (XPmObj->ctm == NULL) { ! return PointInBBox(XOff, YOff, bbox); ! } else { ! return PointInPolygon(XOff, YOff, 5, XPmObj->rotated_obbox); ! } } ! int FindGoodBox(XOff, YOff, BoxObj) ! int XOff, YOff; ! struct ObjRec *BoxObj; /* XOff and YOff are screen offsets */ { ! struct BBRec bbox; ! int w; if (colorLayers && BoxObj->tmp_parent == NULL && *************** *** 501,509 **** bbox.rbx = OFFSET_X(BoxObj->obbox.rbx)+3; bbox.rby = OFFSET_Y(BoxObj->obbox.rby)+3; ! if (!PointInBBox (XOff, YOff, bbox)) return (FALSE); ! if (BoxObj->ctm == NULL) ! { ! if (BoxObj->detail.b->fill != NONEPAT) return (TRUE); w = HALF_W(BoxObj->detail.b->width); --- 486,493 ---- bbox.rbx = OFFSET_X(BoxObj->obbox.rbx)+3; bbox.rby = OFFSET_Y(BoxObj->obbox.rby)+3; ! if (!PointInBBox(XOff, YOff, bbox)) return FALSE; ! if (BoxObj->ctm == NULL) { ! if (BoxObj->detail.b->fill != NONEPAT) return TRUE; w = HALF_W(BoxObj->detail.b->width); *************** *** 512,530 **** bbox.rbx = OFFSET_X(BoxObj->obbox.rbx-w)-3; bbox.rby = OFFSET_Y(BoxObj->obbox.rby-w)-3; ! return (!PointInBBox (XOff, YOff, bbox)); ! } ! else ! { ! if (BoxObj->detail.b->fill != NONEPAT) ! if (PointInPolygon (XOff, YOff, 5, BoxObj->rotated_obbox)) ! return (TRUE); ! return (PointOnPoly (XOff, YOff, 5, BoxObj->rotated_obbox, ! ZOOMED_HALF_W(BoxObj->detail.b->width))); } } ! int FindGoodRCBox (XOff, YOff, RCBoxObj) ! int XOff, YOff; ! struct ObjRec * RCBoxObj; /* XOff and YOff are screen offsets */ { --- 496,514 ---- bbox.rbx = OFFSET_X(BoxObj->obbox.rbx-w)-3; bbox.rby = OFFSET_Y(BoxObj->obbox.rby-w)-3; ! return (!PointInBBox(XOff, YOff, bbox)); ! } else { ! if (BoxObj->detail.b->fill != NONEPAT) { ! if (PointInPolygon(XOff, YOff, 5, BoxObj->rotated_obbox)) { ! return TRUE; ! } ! } ! return PointOnPoly(XOff, YOff, 5, BoxObj->rotated_obbox, ! ZOOMED_HALF_W(BoxObj->detail.b->width)); } } ! int FindGoodRCBox(XOff, YOff, RCBoxObj) ! int XOff, YOff; ! struct ObjRec *RCBoxObj; /* XOff and YOff are screen offsets */ { *************** *** 547,553 **** bbox.rbx = OFFSET_X(obbox->rbx)+3; bbox.rby = OFFSET_Y(obbox->rby)+3; ! if (!PointInBBox(XOff, YOff, bbox)) return (FALSE); ! if (fill != NONEPAT) return (TRUE); r = rcbox_ptr->radius; --- 531,537 ---- bbox.rbx = OFFSET_X(obbox->rbx)+3; bbox.rby = OFFSET_Y(obbox->rby)+3; ! if (!PointInBBox(XOff, YOff, bbox)) return FALSE; ! if (fill != NONEPAT) return TRUE; r = rcbox_ptr->radius; *************** *** 558,562 **** if (PointInBBox(XOff, YOff, bbox)) { ! return (FALSE); } else { bbox.ltx = OFFSET_X(obbox->ltx+r)+3; --- 542,546 ---- if (PointInBBox(XOff, YOff, bbox)) { ! return FALSE; } else { bbox.ltx = OFFSET_X(obbox->ltx+r)+3; *************** *** 573,589 **** } } ! return (PointOnPoly(XOff, YOff, rcbox_ptr->rotated_n, ! rcbox_ptr->rotated_vlist, ZOOMED_HALF_W(rcbox_ptr->width))); } } ! int FindGoodOval (XOff, YOff, OvalObj) ! int XOff, YOff; ! struct ObjRec * OvalObj; /* XOff and YOff are screen offsets */ { ! struct OvalRec * oval_ptr=OvalObj->detail.o; ! int w, ltx, lty, rbx, rby; ! int fill=oval_ptr->fill; if (colorLayers && OvalObj->tmp_parent == NULL && --- 557,572 ---- } } ! return PointOnPoly(XOff, YOff, rcbox_ptr->rotated_n, ! rcbox_ptr->rotated_vlist, ZOOMED_HALF_W(rcbox_ptr->width)); } } ! int FindGoodOval(XOff, YOff, OvalObj) ! int XOff, YOff; ! struct ObjRec *OvalObj; /* XOff and YOff are screen offsets */ { ! struct OvalRec *oval_ptr=OvalObj->detail.o; ! int w, ltx, lty, rbx, rby, fill=oval_ptr->fill; if (colorLayers && OvalObj->tmp_parent == NULL && *************** *** 594,616 **** rbx = OFFSET_X(OvalObj->obbox.rbx); rby = OFFSET_Y(OvalObj->obbox.rby); ! if (ltx==rbx && lty==rby) return (FALSE); ! if (OvalObj->ctm == NULL) ! { ! double cx, cy, rx, ry, tmp_x, tmp_y; ! double x1=0.0, x2=0.0, y1=0.0, y2=0.0; cx = ((double)(ltx+rbx)/2.0); cy = ((double)(lty+rby)/2.0); rx = ((double)(rbx-ltx)/2.0); ry = ((double)(rby-lty)/2.0); ! if (rx >= ry) ! { /* flat oval */ tmp_y = (double)sqrt(fabs((double)(ry*ry*(1 - (((double)XOff)-cx)*(((double)XOff)-cx)/rx/rx)))); y1 = cy - tmp_y; y2 = cy + tmp_y; ! } ! else ! { /* tall oval */ tmp_x = (double)sqrt(fabs((double)(rx*rx*(1 - (((double)YOff)-cy)*(((double)YOff)-cy)/ry/ry)))); --- 577,596 ---- rbx = OFFSET_X(OvalObj->obbox.rbx); rby = OFFSET_Y(OvalObj->obbox.rby); ! if (ltx==rbx && lty==rby) return FALSE; ! if (OvalObj->ctm == NULL) { ! double cx, cy, rx, ry, tmp_x, tmp_y, x1=0.0, x2=0.0, y1=0.0, y2=0.0; cx = ((double)(ltx+rbx)/2.0); cy = ((double)(lty+rby)/2.0); rx = ((double)(rbx-ltx)/2.0); ry = ((double)(rby-lty)/2.0); ! if (rx >= ry) { ! /* flat oval */ tmp_y = (double)sqrt(fabs((double)(ry*ry*(1 - (((double)XOff)-cx)*(((double)XOff)-cx)/rx/rx)))); y1 = cy - tmp_y; y2 = cy + tmp_y; ! } else { ! /* tall oval */ tmp_x = (double)sqrt(fabs((double)(rx*rx*(1 - (((double)YOff)-cy)*(((double)YOff)-cy)/ry/ry)))); *************** *** 619,659 **** } ! if (fill != NONEPAT) ! { ! if (rx >= ry) ! { /* flat oval */ ! if (YOff >= y1-4 && y2+4 >= YOff) return (TRUE); ! } ! else ! { /* tall oval */ ! if (XOff >= x1-4 && x2+4 >= XOff) return (TRUE); } } w = ZOOMED_HALF_W(oval_ptr->width)+4; ! if (rx >= ry) return ((fabs((double)(YOff-y1))<=w) || (fabs((double)(YOff-y2))<=w)); ! else return ((fabs((double)(XOff-x1))<=w) || (fabs((double)(XOff-x2))<=w)); ! } ! else ! { ! if (fill != NONEPAT) ! if (PointInPolygon (XOff, YOff, oval_ptr->rotated_n, ! oval_ptr->rotated_vlist)) return TRUE; ! return (PointOnPoly (XOff, YOff, oval_ptr->rotated_n, ! oval_ptr->rotated_vlist, ZOOMED_HALF_W(oval_ptr->width))); } } ! int FindGoodPoly (XOff, YOff, PolyObj) ! int XOff, YOff; ! struct ObjRec * PolyObj; /* XOff and YOff are screen offsets */ { ! int sn=0, dx, dy; ! double len, sin, cos, aw, ah; ! XPoint tmp_v[4], *sv=NULL; ! struct PolyRec * poly_ptr = PolyObj->detail.p; if (colorLayers && PolyObj->tmp_parent == NULL && --- 599,638 ---- } ! if (fill != NONEPAT) { ! if (rx >= ry) { ! /* flat oval */ ! if (YOff >= y1-4 && y2+4 >= YOff) return TRUE; ! } else { ! /* tall oval */ ! if (XOff >= x1-4 && x2+4 >= XOff) return TRUE; } } w = ZOOMED_HALF_W(oval_ptr->width)+4; ! if (rx >= ry) { return ((fabs((double)(YOff-y1))<=w) || (fabs((double)(YOff-y2))<=w)); ! } else { return ((fabs((double)(XOff-x1))<=w) || (fabs((double)(XOff-x2))<=w)); ! } ! } else { ! if (fill != NONEPAT) { ! if (PointInPolygon(XOff, YOff, oval_ptr->rotated_n, ! oval_ptr->rotated_vlist)) { return TRUE; ! } ! } ! return PointOnPoly(XOff, YOff, oval_ptr->rotated_n, ! oval_ptr->rotated_vlist, ZOOMED_HALF_W(oval_ptr->width)); } } ! int FindGoodPoly(XOff, YOff, PolyObj) ! int XOff, YOff; ! struct ObjRec *PolyObj; /* XOff and YOff are screen offsets */ { ! int sn=0, dx, dy; ! double len, sin, cos, aw, ah; ! XPoint tmp_v[4], *sv=NULL; ! struct PolyRec *poly_ptr=PolyObj->detail.p; if (colorLayers && PolyObj->tmp_parent == NULL && *************** *** 666,675 **** sv = poly_ptr->svlist; sv[sn].x = sv[0].x; sv[sn].y = sv[0].y; ! if (PointInPolygon(XOff, YOff, sn+1, sv)) return (TRUE); } else { sn = poly_ptr->rotated_n; sv = poly_ptr->rotated_vlist; sv[sn].x = sv[0].x; sv[sn].y = sv[0].y; ! if (PointInPolygon(XOff, YOff, sn+1, sv)) return (TRUE); } } --- 645,654 ---- sv = poly_ptr->svlist; sv[sn].x = sv[0].x; sv[sn].y = sv[0].y; ! if (PointInPolygon(XOff, YOff, sn+1, sv)) return TRUE; } else { sn = poly_ptr->rotated_n; sv = poly_ptr->rotated_vlist; sv[sn].x = sv[0].x; sv[sn].y = sv[0].y; ! if (PointInPolygon(XOff, YOff, sn+1, sv)) return TRUE; } } *************** *** 678,686 **** if (PointOnPoly(XOff, YOff, poly_ptr->sn, poly_ptr->svlist, ZOOMED_HALF_W(poly_ptr->width))) ! return (TRUE); } else { if (PointOnPoly(XOff, YOff, poly_ptr->rotated_n, poly_ptr->rotated_vlist, ZOOMED_HALF_W(poly_ptr->width))) ! return (TRUE); } } else { --- 657,665 ---- if (PointOnPoly(XOff, YOff, poly_ptr->sn, poly_ptr->svlist, ZOOMED_HALF_W(poly_ptr->width))) ! return TRUE; } else { if (PointOnPoly(XOff, YOff, poly_ptr->rotated_n, poly_ptr->rotated_vlist, ZOOMED_HALF_W(poly_ptr->width))) ! return TRUE; } } else { *************** *** 688,705 **** if (PointOnPoly(XOff, YOff, poly_ptr->asn, poly_ptr->asvlist, ZOOMED_HALF_W(poly_ptr->width))) ! return (TRUE); } else { if (PointOnPoly(XOff, YOff, poly_ptr->rotated_n, poly_ptr->rotated_vlist, ZOOMED_HALF_W(poly_ptr->width))) ! return (TRUE); } } ! if (PolyObj->ctm == NULL) ! { sv = poly_ptr->svlist; sn = poly_ptr->sn; ! } ! else ! { sv = poly_ptr->rotated_vlist; sn = poly_ptr->rotated_n; --- 667,681 ---- if (PointOnPoly(XOff, YOff, poly_ptr->asn, poly_ptr->asvlist, ZOOMED_HALF_W(poly_ptr->width))) ! return TRUE; } else { if (PointOnPoly(XOff, YOff, poly_ptr->rotated_n, poly_ptr->rotated_vlist, ZOOMED_HALF_W(poly_ptr->width))) ! return TRUE; } } ! if (PolyObj->ctm == NULL) { sv = poly_ptr->svlist; sn = poly_ptr->sn; ! } else { sv = poly_ptr->rotated_vlist; sn = poly_ptr->rotated_n; *************** *** 711,716 **** dy = (int)(sv[1].y - sv[0].y); ! if ((poly_ptr->style & LS_LEFT) && (dx != 0 || dy != 0)) ! { len = (double)sqrt((double)(((double)dx)*((double)dx) + ((double)dy)*((double)dy))); --- 687,691 ---- dy = (int)(sv[1].y - sv[0].y); ! if ((poly_ptr->style & LS_LEFT) && (dx != 0 || dy != 0)) { len = (double)sqrt((double)(((double)dx)*((double)dx) + ((double)dy)*((double)dy))); *************** *** 725,734 **** tmp_v[2].y = OFFSET_Y(round(sv[0].y+aw*sin-ah*cos)); ! if (PointInPolygon (XOff, YOff, 4, tmp_v)) return (TRUE); } dx = (int)(sv[sn-1].x - sv[sn-2].x); dy = (int)(sv[sn-1].y - sv[sn-2].y); ! if ((poly_ptr->style & LS_RIGHT) && (dx != 0 || dy != 0)) ! { len = (double)sqrt((double)(((double)dx)*((double)dx) + ((double)dy)*((double)dy))); --- 700,708 ---- tmp_v[2].y = OFFSET_Y(round(sv[0].y+aw*sin-ah*cos)); ! if (PointInPolygon(XOff, YOff, 4, tmp_v)) return TRUE; } dx = (int)(sv[sn-1].x - sv[sn-2].x); dy = (int)(sv[sn-1].y - sv[sn-2].y); ! if ((poly_ptr->style & LS_RIGHT) && (dx != 0 || dy != 0)) { len = (double)sqrt((double)(((double)dx)*((double)dx) + ((double)dy)*((double)dy))); *************** *** 743,757 **** tmp_v[2].y = OFFSET_Y(round(sv[sn-1].y-aw*sin+ah*cos)); ! if (PointInPolygon (XOff, YOff, 4, tmp_v)) return (TRUE); } ! return (FALSE); } ! int FindGoodPolygon (XOff, YOff, PolygonObj) ! int XOff, YOff; ! struct ObjRec * PolygonObj; /* XOff and YOff are screen offsets */ { ! struct PolygonRec * polygon_ptr = PolygonObj->detail.g; if (colorLayers && PolygonObj->tmp_parent == NULL && --- 717,731 ---- tmp_v[2].y = OFFSET_Y(round(sv[sn-1].y-aw*sin+ah*cos)); ! if (PointInPolygon(XOff, YOff, 4, tmp_v)) return TRUE; } ! return FALSE; } ! int FindGoodPolygon(XOff, YOff, PolygonObj) ! int XOff, YOff; ! struct ObjRec *PolygonObj; /* XOff and YOff are screen offsets */ { ! struct PolygonRec *polygon_ptr=PolygonObj->detail.g; if (colorLayers && PolygonObj->tmp_parent == NULL && *************** *** 759,1066 **** return FALSE; } ! if (PolygonObj->ctm == NULL) ! { ! if (polygon_ptr->fill != NONEPAT) ! if (PointInPolygon (XOff, YOff, polygon_ptr->sn, polygon_ptr->svlist)) ! return (TRUE); ! ! return (PointOnPoly (XOff, YOff, polygon_ptr->sn, polygon_ptr->svlist, ! ZOOMED_HALF_W(polygon_ptr->width))); ! } ! else ! { ! if (polygon_ptr->fill != NONEPAT) ! if (PointInPolygon (XOff, YOff, polygon_ptr->rotated_n, ! polygon_ptr->rotated_vlist)) ! return (TRUE); ! ! return (PointOnPoly (XOff, YOff, polygon_ptr->rotated_n, ! polygon_ptr->rotated_vlist, ZOOMED_HALF_W(polygon_ptr->width))); } } static ! int PointInFlatPie (Y,dir,angle,ov_int_y1,ov_int_y2,rad_int_y1,rad_int_y2) ! int Y, dir, angle; ! double ov_int_y1, ov_int_y2, rad_int_y1, rad_int_y2; ! { ! switch (dir) ! { ! case ARC_CCW: ! switch ((angle+360)%360) ! { ! case 0: ! if (ov_int_y2 > rad_int_y1) ! { ! if (Y>=rad_int_y2 && rad_int_y1>=Y) return (TRUE); ! } ! else if (ov_int_y2 > rad_int_y2) ! { ! if (Y>=rad_int_y2 && ov_int_y2>=Y) return (TRUE); ! } ! break; ! case 90: ! if (ov_int_y1 < rad_int_y2) ! { ! if (Y>=rad_int_y2 && rad_int_y1>=Y) return (TRUE); ! } ! else if (ov_int_y1 < rad_int_y1) ! { ! if (Y>=ov_int_y1 && rad_int_y1>=Y) return (TRUE); ! } ! break; ! case 180: ! if (ov_int_y1 < rad_int_y1) ! { ! if (Y>=rad_int_y1 && rad_int_y2>=Y) return (TRUE); ! } ! else if (ov_int_y1 < rad_int_y2) ! { ! if (Y>=ov_int_y1 && rad_int_y2>=Y) return (TRUE); ! } ! break; ! case 270: ! if (ov_int_y2 > rad_int_y2) ! { ! if (Y>=rad_int_y1 && rad_int_y2>=Y) return (TRUE); ! } ! else if (ov_int_y2 > rad_int_y1) ! { ! if (Y>=rad_int_y1 && ov_int_y2>=Y) return (TRUE); ! } ! break; } break; ! case ARC_CW: ! switch ((angle+360)%360) ! { ! case 0: ! if (ov_int_y1 < rad_int_y1) ! { ! if (Y>=rad_int_y1 && rad_int_y2>=Y) return (TRUE); ! } ! else if (ov_int_y1 < rad_int_y2) ! { ! if (Y>=ov_int_y1 && rad_int_y2>=Y) return (TRUE); ! } ! break; ! case 90: ! if (ov_int_y1 < rad_int_y2) ! { ! if (Y>=rad_int_y2 && rad_int_y1>=Y) return (TRUE); ! } ! else if (ov_int_y1 < rad_int_y1) ! { ! if (Y>=ov_int_y1 && rad_int_y1>=Y) return (TRUE); ! } ! break; ! case 180: ! if (ov_int_y2 > rad_int_y1) ! { ! if (Y>=rad_int_y2 && rad_int_y1>=Y) return (TRUE); ! } ! else if (ov_int_y2 > rad_int_y2) ! { ! if (Y>=rad_int_y2 && ov_int_y2>=Y) return (TRUE); ! } ! break; ! case 270: ! if (ov_int_y2 > rad_int_y2) ! { ! if (Y>=rad_int_y1 && rad_int_y2>=Y) return (TRUE); ! } ! else if (ov_int_y2 > rad_int_y1) ! { ! if (Y>=rad_int_y1 && ov_int_y2>=Y) return (TRUE); ! } ! break; } break; ! } ! return (FALSE); ! } ! ! static ! int PointInTallPie (X,dir,angle,ov_int_x1,ov_int_x2,rad_int_x1,rad_int_x2) ! int X, dir, angle; ! double ov_int_x1, ov_int_x2, rad_int_x1, rad_int_x2; ! { ! switch (dir) ! { ! case ARC_CCW: ! switch ((angle+360)%360) ! { ! case 0: ! if (ov_int_x2 > rad_int_x2) ! { ! if (X>=rad_int_x1 && rad_int_x2>=X) return (TRUE); ! } ! else if (ov_int_x2 > rad_int_x1) ! { ! if (X>=rad_int_x1 && ov_int_x2>=X) return (TRUE); ! } ! break; ! case 90: ! if (ov_int_x2 > rad_int_x1) ! { ! if (X>=rad_int_x2 && rad_int_x1>=X) return (TRUE); ! } ! else if (ov_int_x2 > rad_int_x2) ! { ! if (X>=rad_int_x2 && ov_int_x2>=X) return (TRUE); ! } ! break; ! case 180: ! if (ov_int_x1 < rad_int_x2) ! { ! if (X>=rad_int_x2 && rad_int_x1>=X) return (TRUE); ! } ! else if (ov_int_x1 < rad_int_x1) ! { ! if (X>=ov_int_x1 && rad_int_x1>=X) return (TRUE); ! } ! break; ! case 270: ! if (ov_int_x1 < rad_int_x1) ! { ! if (X>=rad_int_x1 && rad_int_x2>=X) return (TRUE); ! } ! else if (ov_int_x1 < rad_int_x2) ! { ! if (X>=ov_int_x1 && rad_int_x2>=X) return (TRUE); ! } ! break; } break; ! case ARC_CW: ! switch ((angle+360)%360) ! { ! case 0: ! if (ov_int_x2 > rad_int_x2) ! { ! if (X>=rad_int_x1 && rad_int_x2>=X) return (TRUE); ! } ! else if (ov_int_x2 > rad_int_x1) ! { ! if (X>=rad_int_x1 && ov_int_x2>=X) return (TRUE); ! } ! break; ! case 90: ! if (ov_int_x1 < rad_int_x1) ! { ! if (X>=rad_int_x1 && rad_int_x2>=X) return (TRUE); ! } ! else if (ov_int_x1 < rad_int_x2) ! { ! if (X>=ov_int_x1 && rad_int_x2>=X) return (TRUE); ! } ! break; ! case 180: ! if (ov_int_x1 < rad_int_x2) ! { ! if (X>=rad_int_x2 && rad_int_x1>=X) return (TRUE); ! } ! else if (ov_int_x1 < rad_int_x1) ! { ! if (X>=ov_int_x1 && rad_int_x1>=X) return (TRUE); ! } ! break; ! case 270: ! if (ov_int_x2 > rad_int_x1) ! { ! if (X>=rad_int_x2 && rad_int_x1>=X) return (TRUE); ! } ! else if (ov_int_x2 > rad_int_x2) ! { ! if (X>=rad_int_x2 && ov_int_x2>=X) return (TRUE); ! } ! break; } break; } ! return (FALSE); } static ! int XInPieRange (X, dir, angle, cx, rx) ! int X, dir, angle; ! double cx, rx; ! { ! switch (dir) ! { ! case ARC_CCW: ! switch ((angle+360)%360) ! { ! case 0: ! case 90: return (X>=cx && cx+rx>=X); ! ! case 180: ! case 270: return (X>=cx-rx && cx>=X); } break; ! case ARC_CW: ! switch ((angle+360)%360) ! { ! case 0: ! case 270: return (X>=cx && cx+rx>=X); ! ! case 90: ! case 180: return (X>=cx-rx && cx>=X); } break; } ! return (FALSE); } static ! int YInPieRange (Y, dir, angle, cy, ry) ! int Y, dir, angle; ! double cy, ry; ! { ! switch (dir) ! { ! case ARC_CCW: ! switch ((angle+360)%360) ! { ! case 0: ! case 270: return (Y>=cy && cy+ry>=Y); ! case 90: ! case 180: return (Y>=cy-ry && cy>=Y); ! } ! break; ! case ARC_CW: ! switch ((angle+360)%360) ! { ! case 0: ! case 90: return (Y>=cy-ry && cy>=Y); ! case 180: ! case 270: return (Y>=cy && cy+ry>=Y); ! } ! break; } ! return (FALSE); } #define ARC_TOL (1.0e-5) ! int FindGoodArc (XOff, YOff, ArcObj) ! int XOff, YOff; ! struct ObjRec * ArcObj; /* XOff and YOff are screen offsets */ { ! struct ArcRec * arc_ptr = ArcObj->detail.a; ! int w, h, ltx, lty, rbx, rby, aw, ah, dx, dy, theta=0; ! double cx, cy, rx, ry, tmp_x, tmp_y, x = 0.0, y = 0.0; ! double ov_int_x1 = 0.0, ov_int_x2 = 0.0; ! double ov_int_y1 = 0.0, ov_int_y2 = 0.0; ! double rad_int_x1 = 0.0, rad_int_x2 = 0.0; ! double rad_int_y1 = 0.0, rad_int_y2 = 0.0; ! double len, sine, cosine; ! int fill = arc_ptr->fill, angle1, angle2; ! int arc_x1, arc_y1, arc_x2, arc_y2, theta1, theta2; ! int pass_theta1, just_pass_theta1, angle, dir, full_circle; ! XPoint tmp_v[4]; if (colorLayers && ArcObj->tmp_parent == NULL && --- 733,979 ---- return FALSE; } ! if (PolygonObj->ctm == NULL) { ! if (polygon_ptr->fill != NONEPAT) { ! if (PointInPolygon(XOff, YOff, polygon_ptr->sn, polygon_ptr->svlist)) { ! return TRUE; ! } ! } ! return PointOnPoly(XOff, YOff, polygon_ptr->sn, polygon_ptr->svlist, ! ZOOMED_HALF_W(polygon_ptr->width)); ! } else { ! if (polygon_ptr->fill != NONEPAT) { ! if (PointInPolygon(XOff, YOff, polygon_ptr->rotated_n, ! polygon_ptr->rotated_vlist)) { ! return TRUE; ! } ! } ! return PointOnPoly(XOff, YOff, polygon_ptr->rotated_n, ! polygon_ptr->rotated_vlist, ZOOMED_HALF_W(polygon_ptr->width)); } } static ! int PointInFlatPie(Y,dir,angle,ov_int_y1,ov_int_y2,rad_int_y1,rad_int_y2) ! int Y, dir, angle; ! double ov_int_y1, ov_int_y2, rad_int_y1, rad_int_y2; ! { ! switch (dir) { ! case ARC_CCW: ! switch ((angle+360)%360) { ! case 0: ! if (ov_int_y2 > rad_int_y1) { ! if (Y>=rad_int_y2 && rad_int_y1>=Y) return TRUE; ! } else if (ov_int_y2 > rad_int_y2) { ! if (Y>=rad_int_y2 && ov_int_y2>=Y) return TRUE; } break; ! case 90: ! if (ov_int_y1 < rad_int_y2) { ! if (Y>=rad_int_y2 && rad_int_y1>=Y) return TRUE; ! } else if (ov_int_y1 < rad_int_y1) { ! if (Y>=ov_int_y1 && rad_int_y1>=Y) return TRUE; } break; ! case 180: ! if (ov_int_y1 < rad_int_y1) { ! if (Y>=rad_int_y1 && rad_int_y2>=Y) return TRUE; ! } else if (ov_int_y1 < rad_int_y2) { ! if (Y>=ov_int_y1 && rad_int_y2>=Y) return TRUE; } break; ! case 270: ! if (ov_int_y2 > rad_int_y2) { ! if (Y>=rad_int_y1 && rad_int_y2>=Y) return TRUE; ! } else if (ov_int_y2 > rad_int_y1) { ! if (Y>=rad_int_y1 && ov_int_y2>=Y) return TRUE; ! } ! break; ! } ! break; ! case ARC_CW: ! switch ((angle+360)%360) { ! case 0: ! if (ov_int_y1 < rad_int_y1) { ! if (Y>=rad_int_y1 && rad_int_y2>=Y) return TRUE; ! } else if (ov_int_y1 < rad_int_y2) { ! if (Y>=ov_int_y1 && rad_int_y2>=Y) return TRUE; ! } ! break; ! case 90: ! if (ov_int_y1 < rad_int_y2) { ! if (Y>=rad_int_y2 && rad_int_y1>=Y) return TRUE; ! } else if (ov_int_y1 < rad_int_y1) { ! if (Y>=ov_int_y1 && rad_int_y1>=Y) return TRUE; } break; + case 180: + if (ov_int_y2 > rad_int_y1) { + if (Y>=rad_int_y2 && rad_int_y1>=Y) return TRUE; + } else if (ov_int_y2 > rad_int_y2) { + if (Y>=rad_int_y2 && ov_int_y2>=Y) return TRUE; + } + break; + case 270: + if (ov_int_y2 > rad_int_y2) { + if (Y>=rad_int_y1 && rad_int_y2>=Y) return TRUE; + } else if (ov_int_y2 > rad_int_y1) { + if (Y>=rad_int_y1 && ov_int_y2>=Y) return TRUE; + } + break; + } + break; } ! return FALSE; } static ! int PointInTallPie(X,dir,angle,ov_int_x1,ov_int_x2,rad_int_x1,rad_int_x2) ! int X, dir, angle; ! double ov_int_x1, ov_int_x2, rad_int_x1, rad_int_x2; ! { ! switch (dir) { ! case ARC_CCW: ! switch ((angle+360)%360) { ! case 0: ! if (ov_int_x2 > rad_int_x2) { ! if (X>=rad_int_x1 && rad_int_x2>=X) return TRUE; ! } else if (ov_int_x2 > rad_int_x1) { ! if (X>=rad_int_x1 && ov_int_x2>=X) return TRUE; } break; ! case 90: ! if (ov_int_x2 > rad_int_x1) { ! if (X>=rad_int_x2 && rad_int_x1>=X) return TRUE; ! } else if (ov_int_x2 > rad_int_x2) { ! if (X>=rad_int_x2 && ov_int_x2>=X) return TRUE; ! } ! break; ! case 180: ! if (ov_int_x1 < rad_int_x2) { ! if (X>=rad_int_x2 && rad_int_x1>=X) return TRUE; ! } else if (ov_int_x1 < rad_int_x1) { ! if (X>=ov_int_x1 && rad_int_x1>=X) return TRUE; ! } ! break; ! case 270: ! if (ov_int_x1 < rad_int_x1) { ! if (X>=rad_int_x1 && rad_int_x2>=X) return TRUE; ! } else if (ov_int_x1 < rad_int_x2) { ! if (X>=ov_int_x1 && rad_int_x2>=X) return TRUE; ! } ! break; ! } ! break; ! case ARC_CW: ! switch ((angle+360)%360) { ! case 0: ! if (ov_int_x2 > rad_int_x2) { ! if (X>=rad_int_x1 && rad_int_x2>=X) return TRUE; ! } else if (ov_int_x2 > rad_int_x1) { ! if (X>=rad_int_x1 && ov_int_x2>=X) return TRUE; ! } ! break; ! case 90: ! if (ov_int_x1 < rad_int_x1) { ! if (X>=rad_int_x1 && rad_int_x2>=X) return TRUE; ! } else if (ov_int_x1 < rad_int_x2) { ! if (X>=ov_int_x1 && rad_int_x2>=X) return TRUE; ! } ! break; ! case 180: ! if (ov_int_x1 < rad_int_x2) { ! if (X>=rad_int_x2 && rad_int_x1>=X) return TRUE; ! } else if (ov_int_x1 < rad_int_x1) { ! if (X>=ov_int_x1 && rad_int_x1>=X) return TRUE; ! } ! break; ! case 270: ! if (ov_int_x2 > rad_int_x1) { ! if (X>=rad_int_x2 && rad_int_x1>=X) return TRUE; ! } else if (ov_int_x2 > rad_int_x2) { ! if (X>=rad_int_x2 && ov_int_x2>=X) return TRUE; } break; + } + break; } ! return FALSE; } static ! int XInPieRange(X, dir, angle, cx, rx) ! int X, dir, angle; ! double cx, rx; ! { ! switch (dir) { ! case ARC_CCW: ! switch ((angle+360)%360) { ! case 0: ! case 90: return (X>=cx && cx+rx>=X); ! ! case 180: ! case 270: return (X>=cx-rx && cx>=X); ! } ! break; ! case ARC_CW: ! switch ((angle+360)%360) { ! case 0: ! case 270: return (X>=cx && cx+rx>=X); ! case 90: ! case 180: return (X>=cx-rx && cx>=X); ! } ! break; ! } ! return FALSE; ! } ! static ! int YInPieRange(Y, dir, angle, cy, ry) ! int Y, dir, angle; ! double cy, ry; ! { ! switch (dir) { ! case ARC_CCW: ! switch ((angle+360)%360) { ! case 0: ! case 270: return (Y>=cy && cy+ry>=Y); ! ! case 90: ! case 180: return (Y>=cy-ry && cy>=Y); ! } ! break; ! case ARC_CW: ! switch ((angle+360)%360) { ! case 0: ! case 90: return (Y>=cy-ry && cy>=Y); ! ! case 180: ! case 270: return (Y>=cy && cy+ry>=Y); ! } ! break; } ! return FALSE; } #define ARC_TOL (1.0e-5) ! int FindGoodArc(XOff, YOff, ArcObj) ! int XOff, YOff; ! struct ObjRec *ArcObj; /* XOff and YOff are screen offsets */ { ! struct ArcRec *arc_ptr=ArcObj->detail.a; ! int w, h, ltx, lty, rbx, rby, aw, ah, dx, dy, theta=0; ! double cx, cy, rx, ry, tmp_x, tmp_y, x=0.0, y=0.0; ! double ov_int_x1=0.0, ov_int_x2=0.0; ! double ov_int_y1=0.0, ov_int_y2=0.0; ! double rad_int_x1=0.0, rad_int_x2=0.0; ! double rad_int_y1=0.0, rad_int_y2=0.0; ! double len, sine, cosine; ! int fill=arc_ptr->fill, angle1, angle2; ! int arc_x1, arc_y1, arc_x2, arc_y2, theta1, theta2; ! int pass_theta1, just_pass_theta1, angle, dir, full_circle; ! XPoint tmp_v[4]; if (colorLayers && ArcObj->tmp_parent == NULL && *************** *** 1075,1080 **** } } ! return (PointOnPoly(XOff, YOff, arc_ptr->rotated_n, ! arc_ptr->rotated_vlist, ZOOMED_HALF_W(arc_ptr->width))); } --- 988,993 ---- } } ! return PointOnPoly(XOff, YOff, arc_ptr->rotated_n, ! arc_ptr->rotated_vlist, ZOOMED_HALF_W(arc_ptr->width)); } *************** *** 1084,1088 **** rby = OFFSET_Y(arc_ptr->lty+arc_ptr->h); ! if (ltx==rbx && lty==rby) return (FALSE); rx = (rbx-ltx)/2; ry = (rby-lty)/2; --- 997,1001 ---- rby = OFFSET_Y(arc_ptr->lty+arc_ptr->h); ! if (ltx==rbx && lty==rby) return FALSE; rx = (rbx-ltx)/2; ry = (rby-lty)/2; *************** *** 1108,1120 **** full_circle = (abs(angle2) == 64*360); ! if (rx >= ry) ! { /* flat oval */ tmp_y = (double)sqrt(fabs((double)(ry*ry*(1 - (((double)XOff)-cx)*(((double)XOff)-cx)/rx/rx)))); ov_int_y1 = cy - tmp_y; ov_int_y2 = cy + tmp_y; ! } ! else ! { /* tall oval */ tmp_x = (double)sqrt(fabs((double)(rx*rx*(1 - (((double)YOff)-cy)*(((double)YOff)-cy)/ry/ry)))); --- 1021,1032 ---- full_circle = (abs(angle2) == 64*360); ! if (rx >= ry) { ! /* flat oval */ tmp_y = (double)sqrt(fabs((double)(ry*ry*(1 - (((double)XOff)-cx)*(((double)XOff)-cx)/rx/rx)))); ov_int_y1 = cy - tmp_y; ov_int_y2 = cy + tmp_y; ! } else { ! /* tall oval */ tmp_x = (double)sqrt(fabs((double)(rx*rx*(1 - (((double)YOff)-cy)*(((double)YOff)-cy)/ry/ry)))); *************** *** 1124,1235 **** w = ZOOMED_HALF_W(arc_ptr->width)+4; ! if (rx >= ry) ! { /* flat oval */ ! if (fabs (arc_x1-cx) < ARC_TOL) ! { ! switch (theta1) ! { ! case 90: rad_int_y1 = cy - 1/ARC_TOL; break; ! case 270: rad_int_y1 = cy + 1/ARC_TOL; break; ! default: fprintf (stderr, "theta1 = %1d (flat)\n", theta1); break; } ! } ! else rad_int_y1 = cy + (XOff-cx)*(arc_y1-cy)/(arc_x1-cx); - - if (fabs (arc_x2-cx) < ARC_TOL) - { - switch (theta2) - { - case 90: rad_int_y2 = cy - 1/ARC_TOL; break; - case 270: rad_int_y2 = cy + 1/ARC_TOL; break; - default: fprintf (stderr, "theta2 = %1d (flat)\n", theta2); break; - } } ! else ! rad_int_y2 = cy + (XOff-cx)*(arc_y2-cy)/(arc_x2-cx); ! } ! else ! { /* tall oval */ ! if (fabs (arc_y1-cy) < ARC_TOL) ! { ! switch (theta1) ! { ! case 0: ! case 360: rad_int_x1 = cx + 1/ARC_TOL; break; ! case 180: rad_int_x1 = cx - 1/ARC_TOL; break; ! default: fprintf (stderr, "theta1 = %1d (tall)\n", theta1); break; } } ! else ! rad_int_x1 = cx + (YOff-cy)*(arc_x1-cx)/(arc_y1-cy); ! ! if (fabs (arc_y2-cy) < ARC_TOL) ! { ! switch (theta2) ! { ! case 0: ! case 360: rad_int_x2 = cx + 1/ARC_TOL; break; ! case 180: rad_int_x2 = cx - 1/ARC_TOL; break; ! default: fprintf (stderr, "theta2 = %1d (tall)\n", theta2); break; } } ! else rad_int_x2 = cx + (YOff-cy)*(arc_x2-cx)/(arc_y2-cy); } ! if (dir == ARC_CCW) ! { angle = 0; pass_theta1 = FALSE; just_pass_theta1 = FALSE; ! while (angle < theta2 || !pass_theta1) ! { ! if (angle >= theta1 && !pass_theta1) ! { pass_theta1 = TRUE; just_pass_theta1 = TRUE; ! if (theta2 > theta1 && angle >= theta2 && !full_circle) ! { /* theta1 and theta2 are in the same quadrant */ ! if (fill != NONEPAT) ! { ! if (rx >= ry) ! { /* flat oval */ ! if (PointInFlatPie (YOff, dir, angle, ov_int_y1, ! ov_int_y2, rad_int_y1, rad_int_y2)) ! return (TRUE); ! } ! else ! { /* tall oval */ ! if (PointInTallPie (XOff, dir, angle, ov_int_x1, ! ov_int_x2, rad_int_x1, rad_int_x2)) ! return (TRUE); ! } ! } ! if (rx >= ry) ! { /* flat oval */ ! switch ((angle+360)%360) ! { ! case 0: ! case 270: ! return (XOff>=arc_x1 && arc_x2>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)); ! case 90: ! case 180: ! return (XOff>=arc_x2 && arc_x1>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)); } } ! else ! { /* tall oval */ ! switch ((angle+360)%360) ! { ! case 0: ! case 90: ! return (YOff>=arc_y2 && arc_y1>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)); ! case 180: ! case 270: ! return (YOff>=arc_y1 && arc_y2>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)); } } --- 1036,1130 ---- w = ZOOMED_HALF_W(arc_ptr->width)+4; ! if (rx >= ry) { ! /* flat oval */ ! if (fabs(arc_x1-cx) < ARC_TOL) { ! switch (theta1) { ! case 90: rad_int_y1 = cy - 1/ARC_TOL; break; ! case 270: rad_int_y1 = cy + 1/ARC_TOL; break; ! default: fprintf(stderr, "theta1 = %1d (flat)\n", theta1); break; } ! } else { rad_int_y1 = cy + (XOff-cx)*(arc_y1-cy)/(arc_x1-cx); } ! if (fabs(arc_x2-cx) < ARC_TOL) { ! switch (theta2) { ! case 90: rad_int_y2 = cy - 1/ARC_TOL; break; ! case 270: rad_int_y2 = cy + 1/ARC_TOL; break; ! default: fprintf(stderr, "theta2 = %1d (flat)\n", theta2); break; } + } else { + rad_int_y2 = cy + (XOff-cx)*(arc_y2-cy)/(arc_x2-cx); } ! } else { ! /* tall oval */ ! if (fabs(arc_y1-cy) < ARC_TOL) { ! switch (theta1) { ! case 0: ! case 360: rad_int_x1 = cx + 1/ARC_TOL; break; ! case 180: rad_int_x1 = cx - 1/ARC_TOL; break; ! default: fprintf(stderr, "theta1 = %1d (tall)\n", theta1); break; } + } else { + rad_int_x1 = cx + (YOff-cy)*(arc_x1-cx)/(arc_y1-cy); } ! if (fabs(arc_y2-cy) < ARC_TOL) { ! switch (theta2) { ! case 0: ! case 360: rad_int_x2 = cx + 1/ARC_TOL; break; ! case 180: rad_int_x2 = cx - 1/ARC_TOL; break; ! default: fprintf(stderr, "theta2 = %1d (tall)\n", theta2); break; ! } ! } else { rad_int_x2 = cx + (YOff-cy)*(arc_x2-cx)/(arc_y2-cy); + } } ! if (dir == ARC_CCW) { angle = 0; pass_theta1 = FALSE; just_pass_theta1 = FALSE; ! while (angle < theta2 || !pass_theta1) { ! if (angle >= theta1 && !pass_theta1) { pass_theta1 = TRUE; just_pass_theta1 = TRUE; ! if (theta2 > theta1 && angle >= theta2 && !full_circle) { ! /* theta1 and theta2 are in the same quadrant */ ! if (fill != NONEPAT) { ! if (rx >= ry) { ! /* flat oval */ ! if (PointInFlatPie(YOff, dir, angle, ov_int_y1, ! ov_int_y2, rad_int_y1, rad_int_y2)) { ! return TRUE; ! } ! } else { ! /* tall oval */ ! if (PointInTallPie(XOff, dir, angle, ov_int_x1, ! ov_int_x2, rad_int_x1, rad_int_x2)) { ! return TRUE; ! } } } ! if (rx >= ry) { ! /* flat oval */ ! switch ((angle+360)%360) { ! case 0: ! case 270: ! return (XOff>=arc_x1 && arc_x2>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)); ! case 90: ! case 180: ! return (XOff>=arc_x2 && arc_x1>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)); ! } ! } else { ! /* tall oval */ ! switch ((angle+360)%360) { ! case 0: ! case 90: ! return (YOff>=arc_y2 && arc_y1>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)); ! case 180: ! case 270: ! return (YOff>=arc_y1 && arc_y2>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)); } } *************** *** 1238,1389 **** if (angle > theta2) angle -= 360; } ! if (just_pass_theta1) ! { just_pass_theta1 = FALSE; ! if (rx >= ry) ! { /* flat oval */ ! switch ((angle+360)%360) ! { ! case 0: y = cy; break; ! case 90: y = cy-ry; break; ! case 180: y = cy; break; ! case 270: y = cy+ry; break; ! } ! if (fill != NONEPAT) ! { ! if (XInPieRange (XOff, dir, angle, cx, rx) && PointInFlatPie (YOff, dir, angle, ov_int_y1, ! ov_int_y2, rad_int_y1, y)) ! return (TRUE); } ! switch ((angle+360)%360) ! { ! case 0: ! if (XOff>=arc_x1 && cx+rx>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)) ! return (TRUE); ! break; ! case 90: ! if (XOff>=cx && arc_x1>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)) ! return (TRUE); ! break; ! case 180: ! if (XOff>=cx-rx && arc_x1>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)) ! return (TRUE); ! break; ! case 270: ! if (XOff>=arc_x1 && cx>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)) ! return (TRUE); ! break; } ! } ! else ! { /* tall oval */ ! switch ((angle+360)%360) ! { ! case 0: x = cx+rx; break; ! case 90: x = cx; break; ! case 180: x = cx-rx; break; ! case 270: x = cx; break; ! } ! if (fill != NONEPAT) ! { ! if (YInPieRange (YOff, dir, angle, cy, ry) && ! PointInTallPie (XOff, dir, angle, ov_int_x1, ! ov_int_x2, rad_int_x1, x)) ! return (TRUE); } ! switch ((angle+360)%360) ! { ! case 0: ! if (YOff>=cy && arc_y1>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)) ! return (TRUE); ! break; ! case 90: ! if (YOff>=cy-ry && arc_y1>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)) ! return (TRUE); ! break; ! case 180: ! if (YOff>=arc_y1 && cy>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)) ! return (TRUE); ! break; ! case 270: ! if (YOff>=arc_y1 && cy+ry>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)) ! return (TRUE); ! break; } } ! } ! else if (pass_theta1) ! { /* see if point is in the quadrant */ ! if (rx >= ry) ! { /* flat oval */ ! if (XInPieRange (XOff, dir, angle, cx, rx)) ! { ! if (fill != NONEPAT) ! { ! switch ((angle+360)%360) ! { ! case 90: ! case 180: ! if (YOff>=ov_int_y1 && cy>=YOff) return (TRUE); ! break; ! ! case 0: ! case 270: ! if (YOff>=cy && ov_int_y2>=YOff) return (TRUE); ! break; ! } ! } ! switch ((angle+360)%360) ! { ! case 0: ! case 270: ! if (fabs ((double)(YOff-ov_int_y2)) <= w) return (TRUE); ! break; case 90: case 180: ! if (fabs ((double)(YOff-ov_int_y1)) <= w) return (TRUE); break; - } - } - } - else - { /* tall oval */ - if (YInPieRange (YOff, dir, angle, cy, ry)) - { - if (fill != NONEPAT) - { - switch ((angle+360)%360) - { - case 0: - case 90: - if (XOff>=cx && ov_int_x2>=XOff) return (TRUE); - break; - - case 180: - case 270: - if (XOff>=ov_int_x1 && cx>=XOff) return (TRUE); - break; } } ! switch ((angle+360)%360) ! { case 0: case 90: ! if (fabs ((double)(XOff-ov_int_x2)) <= w) return (TRUE); break; case 180: case 270: ! if (fabs ((double)(XOff-ov_int_x1)) <= w) return (TRUE); break; } } --- 1133,1276 ---- if (angle > theta2) angle -= 360; } ! if (just_pass_theta1) { just_pass_theta1 = FALSE; ! if (rx >= ry) { ! /* flat oval */ ! switch ((angle+360)%360) { ! case 0: y = cy; break; ! case 90: y = cy-ry; break; ! case 180: y = cy; break; ! case 270: y = cy+ry; break; ! } ! if (fill != NONEPAT) { ! if (XInPieRange(XOff, dir, angle, cx, rx) && PointInFlatPie (YOff, dir, angle, ov_int_y1, ! ov_int_y2, rad_int_y1, y)) { ! return TRUE; ! } } ! switch ((angle+360)%360) { ! case 0: ! if (XOff>=arc_x1 && cx+rx>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)) { ! return TRUE; ! } ! break; ! case 90: ! if (XOff>=cx && arc_x1>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)) { ! return TRUE; ! } ! break; ! case 180: ! if (XOff>=cx-rx && arc_x1>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)) { ! return TRUE; ! } ! break; ! case 270: ! if (XOff>=arc_x1 && cx>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)) { ! return TRUE; ! } ! break; } ! } else { ! /* tall oval */ ! switch ((angle+360)%360) { ! case 0: x = cx+rx; break; ! case 90: x = cx; break; ! case 180: x = cx-rx; break; ! case 270: x = cx; break; ! } ! if (fill != NONEPAT) { ! if (YInPieRange(YOff, dir, angle, cy, ry) && ! PointInTallPie(XOff, dir, angle, ov_int_x1, ! ov_int_x2, rad_int_x1, x)) { ! return TRUE; ! } } ! switch ((angle+360)%360) { ! case 0: ! if (YOff>=cy && arc_y1>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)) { ! return TRUE; ! } ! break; ! case 90: ! if (YOff>=cy-ry && arc_y1>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)) { ! return TRUE; ! } ! break; ! case 180: ! if (YOff>=arc_y1 && cy>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)) { ! return TRUE; ! } ! break; ! case 270: ! if (YOff>=arc_y1 && cy+ry>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)) { ! return TRUE; ! } ! break; } } ! } else if (pass_theta1) { ! /* see if point is in the quadrant */ ! if (rx >= ry) { ! /* flat oval */ ! if (XInPieRange(XOff, dir, angle, cx, rx)) { ! if (fill != NONEPAT) { ! switch ((angle+360)%360) { case 90: case 180: ! if (YOff>=ov_int_y1 && cy>=YOff) return TRUE; ! break; ! ! case 0: ! case 270: ! if (YOff>=cy && ov_int_y2>=YOff) return TRUE; break; } } ! switch ((angle+360)%360) { ! case 0: ! case 270: ! if (fabs((double)(YOff-ov_int_y2)) <= w) return TRUE; ! break; ! case 90: ! case 180: ! if (fabs((double)(YOff-ov_int_y1)) <= w) return TRUE; ! break; ! } ! } ! } else { ! /* tall oval */ ! if (YInPieRange(YOff, dir, angle, cy, ry)) { ! if (fill != NONEPAT) { ! switch ((angle+360)%360) { case 0: case 90: ! if (XOff>=cx && ov_int_x2>=XOff) return TRUE; break; case 180: case 270: ! if (XOff>=ov_int_x1 && cx>=XOff) return TRUE; break; + } + } + switch ((angle+360)%360) { + case 0: + case 90: + if (fabs((double)(XOff-ov_int_x2)) <= w) return TRUE; + break; + + case 180: + case 270: + if (fabs((double)(XOff-ov_int_x1)) <= w) return TRUE; + break; } } *************** *** 1392,1532 **** angle = (angle == 360) ? 0 : (angle+90); } ! if (rx >= ry) ! { /* flat oval */ ! switch ((angle+360)%360) ! { ! case 0: y = cy+ry; break; ! case 180: y = cy-ry; break; ! ! case 90: ! case 270: y = cy; break; ! } ! if (fill != NONEPAT) ! { ! if (XInPieRange (XOff, dir, angle, cx, rx) && ! PointInFlatPie (YOff, dir, angle, ov_int_y1, ov_int_y2, ! y, rad_int_y2)) ! return (TRUE); ! } ! switch ((angle+360)%360) ! { ! case 0: ! if (XOff>=cx && arc_x2>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)) ! return (TRUE); ! break; ! case 90: ! if (XOff>=arc_x2 && cx+rx>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)) ! return (TRUE); ! break; ! case 180: ! if (XOff>=arc_x2 && cx>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)) ! return (TRUE); ! break; ! case 270: ! if (XOff>=cx-rx && arc_x2>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)) ! return (TRUE); ! break; ! } ! } ! else ! { /* tall oval */ ! switch ((angle+360)%360) ! { ! case 0: ! case 180: x = cx; break; ! ! case 90: x = cx+rx; break; ! case 270: x = cx-rx; break; ! } ! if (fill != NONEPAT) ! { ! if (YInPieRange (YOff, dir, angle, cy, ry) && ! PointInTallPie (XOff, dir, angle, ov_int_x1, ov_int_x2, ! x, rad_int_x2)) ! return (TRUE); ! } ! switch ((angle+360)%360) ! { ! case 0: ! if (YOff>=arc_y2 && cy+ry>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)) ! return (TRUE); ! break; ! case 90: ! if (YOff>=arc_y2 && cy>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)) ! return (TRUE); ! break; ! case 180: ! if (YOff>=cy-ry && arc_y2>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)) ! return (TRUE); ! break; ! case 270: ! if (YOff>=cy && arc_y2>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)) ! return (TRUE); ! break; } } ! } ! else ! { angle = 360; pass_theta1 = FALSE; just_pass_theta1 = FALSE; ! while (angle > theta2 || !pass_theta1) ! { ! if (angle <= theta1 && !pass_theta1) ! { pass_theta1 = TRUE; just_pass_theta1 = TRUE; ! if (theta2 < theta1 && angle <= theta2 && !full_circle) ! { /* theta1 and theta2 are in the same quadrant */ ! if (fill != NONEPAT) ! { ! if (rx >= ry) ! { ! if (PointInFlatPie (YOff, dir, angle, ov_int_y1, ! ov_int_y2, rad_int_y1, rad_int_y2)) ! return (TRUE); ! } ! else ! { ! if (PointInTallPie (XOff, dir, angle, ov_int_x1, ! ov_int_x2, rad_int_x1, rad_int_x2)) ! return (TRUE); ! } ! } ! if (rx >= ry) ! { /* flat oval */ ! switch ((angle+360)%360) ! { ! case 0: ! case 90: ! return (XOff>=arc_x1 && arc_x2>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)); ! case 180: ! case 270: ! return (XOff>=arc_x2 && arc_x1>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)); } } ! else ! { /* tall oval */ ! switch ((angle+360)%360) ! { ! case 0: ! case 270: ! return (YOff>=arc_y1 && arc_y2>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)); ! case 90: ! case 180: ! return (YOff>=arc_y2 && arc_y1>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)); } } --- 1279,1413 ---- angle = (angle == 360) ? 0 : (angle+90); } ! if (rx >= ry) { ! /* flat oval */ ! switch ((angle+360)%360) { ! case 0: y = cy+ry; break; ! case 180: y = cy-ry; break; ! ! case 90: ! case 270: y = cy; break; ! } ! if (fill != NONEPAT) { ! if (XInPieRange(XOff, dir, angle, cx, rx) && ! PointInFlatPie(YOff, dir, angle, ov_int_y1, ov_int_y2, ! y, rad_int_y2)) { ! return TRUE; ! } ! } ! switch ((angle+360)%360) { ! case 0: ! if (XOff>=cx && arc_x2>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)) { ! return TRUE; ! } ! break; ! case 90: ! if (XOff>=arc_x2 && cx+rx>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)) { ! return TRUE; ! } ! break; ! case 180: ! if (XOff>=arc_x2 && cx>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)) { ! return TRUE; ! } ! break; ! case 270: ! if (XOff>=cx-rx && arc_x2>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)) { ! return TRUE; ! } ! break; ! } ! } else { ! /* tall oval */ ! switch ((angle+360)%360) { ! case 0: ! case 180: x = cx; break; ! ! case 90: x = cx+rx; break; ! case 270: x = cx-rx; break; ! } ! if (fill != NONEPAT) { ! if (YInPieRange(YOff, dir, angle, cy, ry) && ! PointInTallPie(XOff, dir, angle, ov_int_x1, ov_int_x2, ! x, rad_int_x2)) { ! return TRUE; ! } ! } ! switch ((angle+360)%360) { ! case 0: ! if (YOff>=arc_y2 && cy+ry>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)) { ! return TRUE; ! } ! break; ! case 90: ! if (YOff>=arc_y2 && cy>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)) { ! return TRUE; ! } ! break; ! case 180: ! if (YOff>=cy-ry && arc_y2>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)) { ! return TRUE; ! } ! break; ! case 270: ! if (YOff>=cy && arc_y2>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)) { ! return TRUE; ! } ! break; } } ! } else { angle = 360; pass_theta1 = FALSE; just_pass_theta1 = FALSE; ! while (angle > theta2 || !pass_theta1) { ! if (angle <= theta1 && !pass_theta1) { pass_theta1 = TRUE; just_pass_theta1 = TRUE; ! if (theta2 < theta1 && angle <= theta2 && !full_circle) { ! /* theta1 and theta2 are in the same quadrant */ ! if (fill != NONEPAT) { ! if (rx >= ry) { ! if (PointInFlatPie(YOff, dir, angle, ov_int_y1, ! ov_int_y2, rad_int_y1, rad_int_y2)) { ! return TRUE; ! } ! } else { ! if (PointInTallPie(XOff, dir, angle, ov_int_x1, ! ov_int_x2, rad_int_x1, rad_int_x2)) { ! return TRUE; ! } } } ! if (rx >= ry) { ! /* flat oval */ ! switch ((angle+360)%360) { ! case 0: ! case 90: ! return (XOff>=arc_x1 && arc_x2>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)); ! case 180: ! case 270: ! return (XOff>=arc_x2 && arc_x1>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)); ! } ! } else { ! /* tall oval */ ! switch ((angle+360)%360) { ! case 0: ! case 270: ! return (YOff>=arc_y1 && arc_y2>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)); ! case 90: ! case 180: ! return (YOff>=arc_y2 && arc_y1>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)); } } *************** *** 1535,1684 **** if (angle <= theta2) angle += 360; } ! if (just_pass_theta1) ! { just_pass_theta1 = FALSE; ! if (rx >= ry) ! { /* flat oval */ ! switch ((angle+360)%360) ! { ! case 0: y = cy; break; ! case 90: y = cy-ry; break; ! case 180: y = cy; break; ! case 270: y = cy+ry; break; ! } ! if (fill != NONEPAT) ! { ! if (XInPieRange (XOff, dir, angle, cx, rx) && ! PointInFlatPie (YOff, dir, angle, ov_int_y1, ! ov_int_y2, rad_int_y1, y)) ! return (TRUE); } ! switch ((angle+360)%360) ! { ! case 0: ! if (XOff>=arc_x1 && cx+rx>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)) ! return (TRUE); ! break; ! case 90: ! if (XOff>=arc_x1 && cx>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)) ! return (TRUE); ! break; ! case 180: ! if (XOff>=cx-rx && arc_x1>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)) ! return (TRUE); ! break; ! case 270: ! if (XOff>=cx && arc_x1>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)) ! return (TRUE); ! break; } ! } ! else ! { /* tall oval */ ! switch ((angle+360)%360) ! { ! case 0: x = cx+rx; break; ! case 90: x = cx; break; ! case 180: x = cx-rx; break; ! case 270: x = cx; break; ! } ! if (fill != NONEPAT) ! { ! if (YInPieRange (YOff, dir, angle, cy, ry) && ! PointInTallPie (XOff, dir, angle, ov_int_x1, ! ov_int_x2, rad_int_x1, x)) ! return (TRUE); } ! switch ((angle+360)%360) ! { ! case 0: ! if (YOff>=arc_y1 && cy>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)) ! return (TRUE); ! break; ! case 90: ! if (YOff>=cy-ry && arc_y1>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)) ! return (TRUE); ! break; ! case 180: ! if (YOff>=cy && arc_y1>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)) ! return (TRUE); ! break; ! case 270: ! if (YOff>=arc_y1 && cy+ry>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)) ! return (TRUE); ! break; } } ! } ! else if (pass_theta1) ! { /* see if point is in the quadrant */ ! if (rx >= ry) ! { /* flat oval */ ! if (XInPieRange (XOff, dir, angle, cx, rx)) ! { ! if (fill != NONEPAT) ! { ! switch ((angle+360)%360) ! { ! case 0: ! case 90: ! if (YOff>=ov_int_y1 && cy>=YOff) return (TRUE); ! break; ! ! case 180: ! case 270: ! if (YOff>=cy && ov_int_y2>=YOff) return (TRUE); ! break; ! } ! } ! switch ((angle+360)%360) ! { case 0: case 90: ! if (fabs ((double)(YOff-ov_int_y1)) <= w) return (TRUE); break; case 180: case 270: ! if (fabs ((double)(YOff-ov_int_y2)) <= w) return (TRUE); break; - } - } - } - else - { /* tall oval */ - if (YInPieRange (YOff, dir, angle, cy, ry)) - { - if (fill != NONEPAT) - { - switch ((angle+360)%360) - { - case 0: - case 270: - if (XOff>=cx && ov_int_x2>=XOff) return (TRUE); - break; - case 90: - case 180: - if (XOff>=ov_int_x1 && cx>=XOff) return (TRUE); - break; } } ! switch ((angle+360)%360) ! { case 0: case 270: ! if (fabs ((double)(XOff-ov_int_x2)) <= w) return (TRUE); break; case 90: ! case 180: ! if (fabs ((double)(XOff-ov_int_x1)) <= w) return (TRUE); break; } } --- 1416,1557 ---- if (angle <= theta2) angle += 360; } ! if (just_pass_theta1) { just_pass_theta1 = FALSE; ! if (rx >= ry) { ! /* flat oval */ ! switch ((angle+360)%360) { ! case 0: y = cy; break; ! case 90: y = cy-ry; break; ! case 180: y = cy; break; ! case 270: y = cy+ry; break; ! } ! if (fill != NONEPAT) { ! if (XInPieRange(XOff, dir, angle, cx, rx) && ! PointInFlatPie(YOff, dir, angle, ov_int_y1, ! ov_int_y2, rad_int_y1, y)) { ! return TRUE; ! } } ! switch ((angle+360)%360) { ! case 0: ! if (XOff>=arc_x1 && cx+rx>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)) { ! return TRUE; ! } ! break; ! case 90: ! if (XOff>=arc_x1 && cx>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)) { ! return TRUE; ! } ! break; ! case 180: ! if (XOff>=cx-rx && arc_x1>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)) { ! return TRUE; ! } ! break; ! case 270: ! if (XOff>=cx && arc_x1>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)) { ! return TRUE; ! } ! break; } ! } else { ! /* tall oval */ ! switch ((angle+360)%360) { ! case 0: x = cx+rx; break; ! case 90: x = cx; break; ! case 180: x = cx-rx; break; ! case 270: x = cx; break; ! } ! if (fill != NONEPAT) { ! if (YInPieRange(YOff, dir, angle, cy, ry) && ! PointInTallPie(XOff, dir, angle, ov_int_x1, ! ov_int_x2, rad_int_x1, x)) { ! return TRUE; ! } } ! switch ((angle+360)%360) { ! case 0: ! if (YOff>=arc_y1 && cy>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)) { ! return TRUE; ! } ! break; ! case 90: ! if (YOff>=cy-ry && arc_y1>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)) { ! return TRUE; ! } ! break; ! case 180: ! if (YOff>=cy && arc_y1>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)) { ! return TRUE; ! } ! break; ! case 270: ! if (YOff>=arc_y1 && cy+ry>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)) { ! return TRUE; ! } ! break; } } ! } else if (pass_theta1) { ! /* see if point is in the quadrant */ ! if (rx >= ry) { ! /* flat oval */ ! if (XInPieRange(XOff, dir, angle, cx, rx)) { ! if (fill != NONEPAT) { ! switch ((angle+360)%360) { case 0: case 90: ! if (YOff>=ov_int_y1 && cy>=YOff) return TRUE; break; + case 180: case 270: ! if (YOff>=cy && ov_int_y2>=YOff) return TRUE; break; } } ! switch ((angle+360)%360) { ! case 0: ! case 90: ! if (fabs((double)(YOff-ov_int_y1)) <= w) return TRUE; ! break; ! case 180: ! case 270: ! if (fabs((double)(YOff-ov_int_y2)) <= w) return TRUE; ! break; ! } ! } ! } else { ! /* tall oval */ ! if (YInPieRange(YOff, dir, angle, cy, ry)) { ! if (fill != NONEPAT) { ! switch ((angle+360)%360) { case 0: case 270: ! if (XOff>=cx && ov_int_x2>=XOff) return TRUE; break; case 90: ! case 180: ! if (XOff>=ov_int_x1 && cx>=XOff) return TRUE; break; + } + } + switch ((angle+360)%360) { + case 0: + case 270: + if (fabs((double)(XOff-ov_int_x2)) <= w) return TRUE; + break; + case 90: + case 180: + if (fabs((double)(XOff-ov_int_x1)) <= w) return TRUE; + break; } } *************** *** 1687,1770 **** angle = (angle == 0) ? 360 : (angle-90); } ! if (rx >= ry) ! { /* flat oval */ ! switch ((angle+360)%360) ! { ! case 0: y = cy-ry; break; ! case 180: y = cy+ry; break; ! ! case 90: ! case 270: y = cy; break; ! } ! if (fill != NONEPAT) ! { ! if (XInPieRange (XOff, dir, angle, cx, rx) && ! PointInFlatPie (YOff, dir, angle, ov_int_y1, ov_int_y2, ! y, rad_int_y2)) ! return (TRUE); ! } ! switch ((angle+360)%360) ! { ! case 0: ! if (XOff>=cx && arc_x2>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)) ! return (TRUE); ! break; ! case 90: ! if (XOff>=cx-rx && arc_x2>=XOff && ! (fabs ((double)(YOff-ov_int_y1)) <= w)) ! return (TRUE); ! break; ! case 180: ! if (XOff>=arc_x2 && cx>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)) ! return (TRUE); ! break; ! case 270: ! if (XOff>=arc_x2 && cx+rx>=XOff && ! (fabs ((double)(YOff-ov_int_y2)) <= w)) ! return (TRUE); ! break; ! } ! } ! else ! { /* tall oval */ ! switch ((angle+360)%360) ! { ! case 0: ! case 180: x = cx; break; ! ! case 90: x = cx-rx; break; ! case 270: x = cx+rx; break; ! } ! if (fill != NONEPAT) ! { ! if (YInPieRange (YOff, dir, angle, cy, ry) && ! PointInTallPie (XOff, dir, angle, ov_int_x1, ov_int_x2, ! x, rad_int_x2)) ! return (TRUE); ! } ! switch ((angle+360)%360) ! { ! case 0: ! if (YOff>=cy-ry && arc_y2>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)) ! return (TRUE); ! break; ! case 90: ! if (YOff>=arc_y2 && cy>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)) ! return (TRUE); ! break; ! case 180: ! if (YOff>=arc_y2 && cy+ry>=YOff && ! (fabs ((double)(XOff-ov_int_x1)) <= w)) ! return (TRUE); ! break; ! case 270: ! if (YOff>=cy && arc_y2>=YOff && ! (fabs ((double)(XOff-ov_int_x2)) <= w)) ! return (TRUE); ! break; } } --- 1560,1646 ---- angle = (angle == 0) ? 360 : (angle-90); } ! if (rx >= ry) { ! /* flat oval */ ! switch ((angle+360)%360) { ! case 0: y = cy-ry; break; ! case 180: y = cy+ry; break; ! ! case 90: ! case 270: y = cy; break; ! } ! if (fill != NONEPAT) { ! if (XInPieRange(XOff, dir, angle, cx, rx) && ! PointInFlatPie(YOff, dir, angle, ov_int_y1, ov_int_y2, ! y, rad_int_y2)) { ! return TRUE; ! } ! } ! switch ((angle+360)%360) { ! case 0: ! if (XOff>=cx && arc_x2>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)) { ! return TRUE; ! } ! break; ! case 90: ! if (XOff>=cx-rx && arc_x2>=XOff && ! (fabs((double)(YOff-ov_int_y1)) <= w)) { ! return TRUE; ! } ! break; ! case 180: ! if (XOff>=arc_x2 && cx>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)) { ! return TRUE; ! } ! break; ! case 270: ! if (XOff>=arc_x2 && cx+rx>=XOff && ! (fabs((double)(YOff-ov_int_y2)) <= w)) { ! return TRUE; ! } ! break; ! } ! } else { ! /* tall oval */ ! switch ((angle+360)%360) { ! case 0: ! case 180: x = cx; break; ! ! case 90: x = cx-rx; break; ! case 270: x = cx+rx; break; ! } ! if (fill != NONEPAT) { ! if (YInPieRange(YOff, dir, angle, cy, ry) && ! PointInTallPie(XOff, dir, angle, ov_int_x1, ov_int_x2, ! x, rad_int_x2)) { ! return TRUE; ! } ! } ! switch ((angle+360)%360) { ! case 0: ! if (YOff>=cy-ry && arc_y2>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)) { ! return TRUE; ! } ! break; ! case 90: ! if (YOff>=arc_y2 && cy>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)) { ! return TRUE; ! } ! break; ! case 180: ! if (YOff>=arc_y2 && cy+ry>=YOff && ! (fabs((double)(XOff-ov_int_x1)) <= w)) { ! return TRUE; ! } ! break; ! case 270: ! if (YOff>=cy && arc_y2>=YOff && ! (fabs((double)(XOff-ov_int_x2)) <= w)) { ! return TRUE; ! } ! break; } } *************** *** 1776,1797 **** ah = ZOOMED_SIZE(arc_ptr->ah); if (ah == 0) ah = 1; ! if ((arc_ptr->style & LS_LEFT) && (angle2%(360*64) != 0)) ! { /* the arrow should appear at angle1 */ ! switch (dir) ! { ! case ARC_CCW: theta = (int)(angle1/64)-90; break; ! case ARC_CW: theta = (int)(angle1/64)+90; break; } dx = -round(w*cos(((double)theta)*M_PI/180.0)); dy = round(h*sin(((double)theta)*M_PI/180.0)); ! if (dx == 0 && dy == 0) ! { sine = cosine = ((double)0.0); tmp_v[0].x = tmp_v[1].x = tmp_v[2].x = tmp_v[3].x = arc_x1; tmp_v[0].y = tmp_v[1].y = tmp_v[2].y = tmp_v[3].y = arc_y1; ! } ! else ! { len = (double)sqrt((double)(((double)dx)*((double)dx) + ((double)dy)*((double)dy))); --- 1652,1669 ---- ah = ZOOMED_SIZE(arc_ptr->ah); if (ah == 0) ah = 1; ! if ((arc_ptr->style & LS_LEFT) && (angle2%(360*64) != 0)) { ! /* the arrow should appear at angle1 */ ! switch (dir) { ! case ARC_CCW: theta = (int)(angle1/64)-90; break; ! case ARC_CW: theta = (int)(angle1/64)+90; break; } dx = -round(w*cos(((double)theta)*M_PI/180.0)); dy = round(h*sin(((double)theta)*M_PI/180.0)); ! if (dx == 0 && dy == 0) { sine = cosine = ((double)0.0); tmp_v[0].x = tmp_v[1].x = tmp_v[2].x = tmp_v[3].x = arc_x1; tmp_v[0].y = tmp_v[1].y = tmp_v[2].y = tmp_v[3].y = arc_y1; ! } else { len = (double)sqrt((double)(((double)dx)*((double)dx) + ((double)dy)*((double)dy))); *************** *** 1807,1830 **** } ! if (PointInPolygon (XOff, YOff, 4, tmp_v)) return (TRUE); } ! if ((arc_ptr->style & LS_RIGHT) && (angle2%(360*64) != 0)) ! { ! switch (dir) ! { ! case ARC_CCW: theta = (int)((angle1+angle2)/64)-90; break; ! case ARC_CW: theta = (int)((angle1+angle2)/64)+90; break; } dx = -round(w*cos(((double)theta)*M_PI/180.0)); dy = round(h*sin(((double)theta)*M_PI/180.0)); ! if (dx == 0 && dy == 0) ! { sine = cosine = ((double)0.0); tmp_v[0].x = tmp_v[1].x = tmp_v[2].x = tmp_v[3].x = arc_x2; tmp_v[0].y = tmp_v[1].y = tmp_v[2].y = tmp_v[3].y = arc_y2; ! } ! else ! { len = (double)sqrt((double)(((double)dx)*((double)dx) + ((double)dy)*((double)dy))); --- 1679,1697 ---- } ! if (PointInPolygon(XOff, YOff, 4, tmp_v)) return TRUE; } ! if ((arc_ptr->style & LS_RIGHT) && (angle2%(360*64) != 0)) { ! switch (dir) { ! case ARC_CCW: theta = (int)((angle1+angle2)/64)-90; break; ! case ARC_CW: theta = (int)((angle1+angle2)/64)+90; break; } dx = -round(w*cos(((double)theta)*M_PI/180.0)); dy = round(h*sin(((double)theta)*M_PI/180.0)); ! if (dx == 0 && dy == 0) { sine = cosine = ((double)0.0); tmp_v[0].x = tmp_v[1].x = tmp_v[2].x = tmp_v[3].x = arc_x2; tmp_v[0].y = tmp_v[1].y = tmp_v[2].y = tmp_v[3].y = arc_y2; ! } else { len = (double)sqrt((double)(((double)dx)*((double)dx) + ((double)dy)*((double)dy))); *************** *** 1840,1860 **** } ! if (PointInPolygon (XOff, YOff, 4, tmp_v)) return (TRUE); } ! return (FALSE); } ! int FindGoodObj (XOff, YOff, FirstObj, SubObj, ImmediateChildObj) ! int XOff, YOff; ! struct ObjRec * FirstObj, * * SubObj, * * ImmediateChildObj; /* XOff and YOff are screen offsets */ { ! register struct ObjRec * obj_ptr; ! register struct AttrRec * attr_ptr; *SubObj = NULL; ! for (obj_ptr = FirstObj; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! { obj_ptr->tmp_child = NULL; obj_ptr->tmp_parent = NULL; --- 1707,1726 ---- } ! if (PointInPolygon(XOff, YOff, 4, tmp_v)) return TRUE; } ! return FALSE; } ! int FindGoodObj(XOff, YOff, FirstObj, SubObj, ImmediateChildObj) ! int XOff, YOff; ! struct ObjRec *FirstObj, **SubObj, **ImmediateChildObj; /* XOff and YOff are screen offsets */ { ! register struct ObjRec *obj_ptr; ! register struct AttrRec *attr_ptr; *SubObj = NULL; ! for (obj_ptr=FirstObj; obj_ptr != NULL; obj_ptr=obj_ptr->next) { obj_ptr->tmp_child = NULL; obj_ptr->tmp_parent = NULL; *************** *** 1863,1936 **** continue; } ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) ! { *SubObj = attr_ptr->obj; ! return (TRUE); } if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) ! { ! struct ObjRec * next_level_child=NULL; ! ! switch (obj_ptr->type) ! { ! case OBJ_TEXT: ! if (FindGoodText (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! case OBJ_XBM: ! if (FindGoodXBm (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! case OBJ_XPM: ! if (FindGoodXPm (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! case OBJ_BOX: ! if (FindGoodBox (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! case OBJ_RCBOX: ! if (FindGoodRCBox (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! case OBJ_OVAL: ! if (FindGoodOval (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! case OBJ_POLY: ! if (FindGoodPoly (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! case OBJ_POLYGON: ! if (FindGoodPolygon (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! case OBJ_ARC: ! if (FindGoodArc (XOff, YOff, obj_ptr)) return (TRUE); ! break; ! ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! if (colorLayers) { ! struct ObjRec *tmp_obj; ! ! for (tmp_obj=obj_ptr->detail.r->first; tmp_obj != NULL; ! tmp_obj=tmp_obj->next) { ! tmp_obj->tmp_parent = obj_ptr; ! } ! } ! if (FindGoodObj (XOff, YOff, obj_ptr->detail.r->first, SubObj, ! &next_level_child)) ! { ! obj_ptr->tmp_child = next_level_child; ! return (TRUE); } ! break; } } } if (ImmediateChildObj != NULL) *ImmediateChildObj = NULL; ! return (FALSE); } --- 1729,1799 ---- continue; } ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) { if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) { *SubObj = attr_ptr->obj; ! return TRUE; } + } if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! struct ObjRec *next_level_child=NULL; ! ! switch (obj_ptr->type) { ! case OBJ_TEXT: ! if (FindGoodText(XOff, YOff, obj_ptr)) return TRUE; ! break; ! case OBJ_XBM: ! if (FindGoodXBm(XOff, YOff, obj_ptr)) return TRUE; ! break; ! case OBJ_XPM: ! if (FindGoodXPm(XOff, YOff, obj_ptr)) return TRUE; ! break; ! case OBJ_BOX: ! if (FindGoodBox(XOff, YOff, obj_ptr)) return TRUE; ! break; ! case OBJ_RCBOX: ! if (FindGoodRCBox(XOff, YOff, obj_ptr)) return TRUE; ! break; ! case OBJ_OVAL: ! if (FindGoodOval(XOff, YOff, obj_ptr)) return TRUE; ! break; ! case OBJ_POLY: ! if (FindGoodPoly(XOff, YOff, obj_ptr)) return TRUE; ! break; ! case OBJ_POLYGON: ! if (FindGoodPolygon(XOff, YOff, obj_ptr)) return TRUE; ! break; ! case OBJ_ARC: ! if (FindGoodArc(XOff, YOff, obj_ptr)) return TRUE; ! break; ! ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! if (colorLayers) { ! struct ObjRec *tmp_obj; ! ! for (tmp_obj=obj_ptr->detail.r->first; tmp_obj != NULL; ! tmp_obj=tmp_obj->next) { ! tmp_obj->tmp_parent = obj_ptr; } ! } ! if (FindGoodObj(XOff, YOff, obj_ptr->detail.r->first, SubObj, ! &next_level_child)) { ! obj_ptr->tmp_child = next_level_child; ! return TRUE; ! } ! break; } } } if (ImmediateChildObj != NULL) *ImmediateChildObj = NULL; ! return FALSE; } *** remote.c.orig Tue Sep 30 13:23:57 1997 --- remote.c Tue Sep 30 13:23:57 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/remote.c,v 3.2 1996/11/29 23:54:31 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/remote.c,v 3.7 1997/09/15 16:43:15 william Exp $ */ #include *************** *** 405,411 **** return NULL; } ! if (chmod(tmp_fname, 0777)) { ! sprintf(gszMsgBox, "Can not chmod '%s' to 0777.", tmp_fname); ! Msg(gszMsgBox); } return tmp_fname; --- 403,410 ---- return NULL; } ! if (tmpFileMode != 0 && chmod(tmp_fname, tmpFileMode)) { ! sprintf(gszMsgBox, "Can not chmod '%s' to 0%03o.", tmp_fname, ! tmpFileMode); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } return tmp_fname; *************** *** 1841,1845 **** return FALSE; } ! if (!navigating) navigatingBackAndForth = TRUE; rc_loadfile = LoadFile(tmp_fname, (-1)); if (!navigating) navigatingBackAndForth = FALSE; --- 1840,1847 ---- return FALSE; } ! if (!navigating) { ! BeforeNavigate(); ! navigatingBackAndForth = TRUE; ! } rc_loadfile = LoadFile(tmp_fname, (-1)); if (!navigating) navigatingBackAndForth = FALSE; *** ruler.c.orig Tue Sep 30 13:23:58 1997 --- ruler.c Tue Sep 30 13:23:58 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ruler.c,v 3.6 1996/11/30 00:12:31 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ruler.c,v 3.7 1997/09/14 20:37:59 william Exp $ */ #include *** scroll.c.orig Tue Sep 30 13:24:00 1997 --- scroll.c Tue Sep 30 13:24:00 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/scroll.c,v 3.0 1996/05/06 16:07:22 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/scroll.c,v 3.2 1997/09/15 16:43:52 william Exp $ */ #include *************** *** 818,823 **** if (cur_page_num <= 0 || cur_page_num > lastPageNum) return; ! if (drawOrigX == orig_x && drawOrigY == orig_y && !adj_caches) return; ! drawOrigX = orig_x; drawOrigY = orig_y; --- 816,823 ---- if (cur_page_num <= 0 || cur_page_num > lastPageNum) return; ! if (drawOrigX == orig_x && drawOrigY == orig_y && ! cur_page_num == curPageNum && !adj_caches) { ! return; ! } drawOrigX = orig_x; drawOrigY = orig_y; *** select.c.orig Tue Sep 30 13:24:01 1997 --- select.c Tue Sep 30 13:24:01 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/select.c,v 3.6 1997/01/30 22:46:44 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/select.c,v 3.10 1997/09/17 00:59:52 william Exp $ */ #include *************** *** 94,99 **** int numObjSelected=0; int numObjLocked=0; ! struct SelRec * topSel = NULL, * botSel = NULL; ! struct VSelRec * topVSel = NULL, * botVSel = NULL; int CountSelectedVertices() --- 92,97 ---- int numObjSelected=0; int numObjLocked=0; ! struct SelRec *topSel=NULL, *botSel=NULL; ! struct VSelRec *topVSel=NULL, *botVSel=NULL; int CountSelectedVertices() *************** *** 118,156 **** } ! void CalcBBox (X1, Y1, X2, Y2, LtX, LtY, RbX, RbY) int X1, Y1, X2, Y2, * LtX, * LtY, * RbX, * RbY; { ! if (X1 < X2) ! if (Y1 < Y2) ! { *LtX = X1; *LtY = Y1; *RbX = X2; *RbY = Y2; ! } ! else ! { *LtX = X1; *LtY = Y2; *RbX = X2; *RbY = Y1; } ! else ! if (Y1 < Y2) ! { *LtX = X2; *LtY = Y1; *RbX = X1; *RbY = Y2; ! } ! else ! { *LtX = X2; *LtY = Y2; *RbX = X1; *RbY = Y1; } } ! void CalcVertexBBox (LtX, LtY, RbX, RbY) ! int * LtX, * LtY, * RbX, * RbY; { ! register int i, *x_ptr, *y_ptr; ! struct VSelRec * vsel_ptr; *LtX = selRbX; *LtY = selRbY; *RbX = selLtX; *RbY = selLtY; ! for (vsel_ptr=topVSel; vsel_ptr!=NULL; vsel_ptr=vsel_ptr->next) for (i=0, x_ptr=vsel_ptr->x, y_ptr=vsel_ptr->y; i < vsel_ptr->n; ! i++, x_ptr++, y_ptr++) ! { if (*x_ptr < *LtX) *LtX = *x_ptr; if (*y_ptr < *LtY) *LtY = *y_ptr; --- 116,148 ---- } ! void CalcBBox(X1, Y1, X2, Y2, LtX, LtY, RbX, RbY) int X1, Y1, X2, Y2, * LtX, * LtY, * RbX, * RbY; { ! if (X1 < X2) { ! if (Y1 < Y2) { *LtX = X1; *LtY = Y1; *RbX = X2; *RbY = Y2; ! } else { *LtX = X1; *LtY = Y2; *RbX = X2; *RbY = Y1; } ! } else { ! if (Y1 < Y2) { *LtX = X2; *LtY = Y1; *RbX = X1; *RbY = Y2; ! } else { *LtX = X2; *LtY = Y2; *RbX = X1; *RbY = Y1; } + } } ! void CalcVertexBBox(LtX, LtY, RbX, RbY) ! int *LtX, *LtY, *RbX, *RbY; { ! register int i, *x_ptr, *y_ptr; ! struct VSelRec *vsel_ptr; *LtX = selRbX; *LtY = selRbY; *RbX = selLtX; *RbY = selLtY; ! for (vsel_ptr=topVSel; vsel_ptr!=NULL; vsel_ptr=vsel_ptr->next) { for (i=0, x_ptr=vsel_ptr->x, y_ptr=vsel_ptr->y; i < vsel_ptr->n; ! i++, x_ptr++, y_ptr++) { if (*x_ptr < *LtX) *LtX = *x_ptr; if (*y_ptr < *LtY) *LtY = *y_ptr; *************** *** 158,200 **** if (*y_ptr > *RbY) *RbY = *y_ptr; } } ! void UnSelNonVertexObjs (highlight) ! int highlight; { ! register struct ObjRec * obj_ptr; ! register struct SelRec * sel_ptr, * prev_sel; ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = prev_sel) ! { prev_sel = sel_ptr->prev; obj_ptr = sel_ptr->obj; if ((obj_ptr->type==OBJ_POLY || obj_ptr->type==OBJ_POLYGON) && ! !obj_ptr->locked) continue; ! if (highlight) HighLightAnObj (obj_ptr); ! if (sel_ptr->prev == NULL) topSel = sel_ptr->next; ! else sel_ptr->prev->next = sel_ptr->next; ! ! if (sel_ptr->next == NULL) botSel = sel_ptr->prev; ! else sel_ptr->next->prev = sel_ptr->prev; ! free(sel_ptr); } } ! void JustRemoveAllVSel () { ! register struct VSelRec * next_vsel; ! while (topVSel != NULL) ! { next_vsel = topVSel->next; free(topVSel->v_index); --- 150,192 ---- if (*y_ptr > *RbY) *RbY = *y_ptr; } + } } ! void UnSelNonVertexObjs(highlight) ! int highlight; { ! register struct ObjRec *obj_ptr; ! register struct SelRec *sel_ptr, *prev_sel; ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=prev_sel) { prev_sel = sel_ptr->prev; obj_ptr = sel_ptr->obj; if ((obj_ptr->type==OBJ_POLY || obj_ptr->type==OBJ_POLYGON) && ! !obj_ptr->locked) { continue; + } ! if (highlight) HighLightAnObj(obj_ptr); ! if (sel_ptr->prev == NULL) { topSel = sel_ptr->next; ! } else { sel_ptr->prev->next = sel_ptr->next; ! } ! if (sel_ptr->next == NULL) { botSel = sel_ptr->prev; ! } else { sel_ptr->next->prev = sel_ptr->prev; ! } free(sel_ptr); } } ! void JustRemoveAllVSel() { ! register struct VSelRec *next_vsel; ! while (topVSel != NULL) { next_vsel = topVSel->next; free(topVSel->v_index); *************** *** 207,217 **** } ! void RemoveAllSel () { ! register struct SelRec * next_sel; ! register struct VSelRec * next_vsel; ! while (topSel != NULL) ! { next_sel = topSel->next; free(topSel); --- 199,208 ---- } ! void RemoveAllSel() { ! register struct SelRec *next_sel; ! register struct VSelRec *next_vsel; ! while (topSel != NULL) { next_sel = topSel->next; free(topSel); *************** *** 220,225 **** botSel = NULL; ! while (topVSel != NULL) ! { next_vsel = topVSel->next; free(topVSel->v_index); --- 211,215 ---- botSel = NULL; ! while (topVSel != NULL) { next_vsel = topVSel->next; free(topVSel->v_index); *************** *** 292,306 **** static ! struct ObjRec * FindAVertex (XOff, YOff, VIndex, AbsX, AbsY) ! int XOff, YOff, * VIndex, * AbsX, * AbsY; /* XOff and YOff are screen offsets */ { ! register struct ObjRec * obj_ptr; ! struct PolyRec * poly_ptr; ! struct PolygonRec * polygon_ptr; ! struct SelRec * sel_ptr; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! { obj_ptr = sel_ptr->obj; --- 282,295 ---- static ! struct ObjRec *FindAVertex(XOff, YOff, VIndex, AbsX, AbsY) ! int XOff, YOff, *VIndex, *AbsX, *AbsY; /* XOff and YOff are screen offsets */ { ! register struct ObjRec *obj_ptr; ! struct PolyRec *poly_ptr; ! struct PolygonRec *polygon_ptr; ! struct SelRec *sel_ptr; ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { obj_ptr = sel_ptr->obj; *************** *** 309,374 **** YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3)) continue; ! ! switch (obj_ptr->type) ! { ! case OBJ_POLY: ! poly_ptr = obj_ptr->detail.p; ! if (PtInPolyMark (obj_ptr, XOff, YOff, poly_ptr->n, ! poly_ptr->vlist, VIndex)) ! { ! if (obj_ptr->ctm == NULL) { ! *AbsX = poly_ptr->vlist[*VIndex].x; ! *AbsY = poly_ptr->vlist[*VIndex].y; ! } else { ! int x, y; ! TransformPointThroughCTM( ! poly_ptr->vlist[*VIndex].x-obj_ptr->x, ! poly_ptr->vlist[*VIndex].y-obj_ptr->y, ! obj_ptr->ctm, &x, &y); ! *AbsX = x+obj_ptr->x; ! *AbsY = y+obj_ptr->y; ! } ! return (obj_ptr); } ! break; ! case OBJ_POLYGON: ! polygon_ptr = obj_ptr->detail.g; ! if (PtInPolyMark (obj_ptr, XOff, YOff, polygon_ptr->n, ! polygon_ptr->vlist, VIndex)) ! { ! if (obj_ptr->ctm == NULL) { ! *AbsX = polygon_ptr->vlist[*VIndex].x; ! *AbsY = polygon_ptr->vlist[*VIndex].y; ! } else { ! int x, y; ! TransformPointThroughCTM( ! polygon_ptr->vlist[*VIndex].x-obj_ptr->x, ! polygon_ptr->vlist[*VIndex].y-obj_ptr->y, ! obj_ptr->ctm, &x, &y); ! *AbsX = x+obj_ptr->x; ! *AbsY = y+obj_ptr->y; ! } ! return (obj_ptr); } ! break; } } ! return (NULL); } ! struct ObjRec * FindAnObj (XOff, YOff, OwnerObj, ConnectObj, ReturnedObjName) ! int XOff, YOff; ! struct ObjRec * * OwnerObj, * * ConnectObj; ! char * ReturnedObjName; /* XOff and YOff are screen offsets */ { ! register struct ObjRec * obj_ptr; ! register struct AttrRec * attr_ptr; ! struct ObjRec *sub_obj, *returned_obj=NULL, *actual_obj=NULL; ! struct ObjRec *owner_obj=NULL; ! int found_attr=FALSE; if (OwnerObj != NULL) *OwnerObj = NULL; --- 298,361 ---- YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3)) { ! continue; ! } ! switch (obj_ptr->type) { ! case OBJ_POLY: ! poly_ptr = obj_ptr->detail.p; ! if (PtInPolyMark(obj_ptr, XOff, YOff, poly_ptr->n, ! poly_ptr->vlist, VIndex)) { ! if (obj_ptr->ctm == NULL) { ! *AbsX = poly_ptr->vlist[*VIndex].x; ! *AbsY = poly_ptr->vlist[*VIndex].y; ! } else { ! int x, y; ! TransformPointThroughCTM( ! poly_ptr->vlist[*VIndex].x-obj_ptr->x, ! poly_ptr->vlist[*VIndex].y-obj_ptr->y, ! obj_ptr->ctm, &x, &y); ! *AbsX = x+obj_ptr->x; ! *AbsY = y+obj_ptr->y; } ! return obj_ptr; ! } ! break; ! case OBJ_POLYGON: ! polygon_ptr = obj_ptr->detail.g; ! if (PtInPolyMark(obj_ptr, XOff, YOff, polygon_ptr->n, ! polygon_ptr->vlist, VIndex)) { ! if (obj_ptr->ctm == NULL) { ! *AbsX = polygon_ptr->vlist[*VIndex].x; ! *AbsY = polygon_ptr->vlist[*VIndex].y; ! } else { ! int x, y; ! TransformPointThroughCTM( ! polygon_ptr->vlist[*VIndex].x-obj_ptr->x, ! polygon_ptr->vlist[*VIndex].y-obj_ptr->y, ! obj_ptr->ctm, &x, &y); ! *AbsX = x+obj_ptr->x; ! *AbsY = y+obj_ptr->y; } ! return obj_ptr; ! } ! break; } } ! return NULL; } ! struct ObjRec *FindAnObj(XOff, YOff, OwnerObj, ConnectObj, ReturnedObjName) ! int XOff, YOff; ! struct ObjRec **OwnerObj, **ConnectObj; ! char *ReturnedObjName; /* XOff and YOff are screen offsets */ { ! register struct ObjRec *obj_ptr; ! register struct AttrRec *attr_ptr; ! struct ObjRec *sub_obj, *returned_obj=NULL, *actual_obj=NULL; ! struct ObjRec *owner_obj=NULL; ! int found_attr=FALSE; if (OwnerObj != NULL) *OwnerObj = NULL; *************** *** 390,395 **** YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) ! { owner_obj = obj_ptr; returned_obj = attr_ptr->obj; --- 377,381 ---- YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) { owner_obj = obj_ptr; returned_obj = attr_ptr->obj; *************** *** 404,436 **** XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! struct ObjRec * next_level_child=NULL; switch (obj_ptr->type) { case OBJ_TEXT: ! if (FindGoodText (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_XBM: ! if (FindGoodXBm (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_XPM: ! if (FindGoodXPm (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_BOX: ! if (FindGoodBox (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_OVAL: ! if (FindGoodOval (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_POLY: ! if (FindGoodPoly (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_POLYGON: ! if (FindGoodPolygon (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_ARC: ! if (FindGoodArc (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_RCBOX: ! if (FindGoodRCBox (XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; --- 390,422 ---- XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! struct ObjRec *next_level_child=NULL; switch (obj_ptr->type) { case OBJ_TEXT: ! if (FindGoodText(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_XBM: ! if (FindGoodXBm(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_XPM: ! if (FindGoodXPm(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_BOX: ! if (FindGoodBox(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_OVAL: ! if (FindGoodOval(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_POLY: ! if (FindGoodPoly(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_POLYGON: ! if (FindGoodPolygon(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_ARC: ! if (FindGoodArc(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; case OBJ_RCBOX: ! if (FindGoodRCBox(XOff,YOff,obj_ptr)) returned_obj = obj_ptr; break; *************** *** 446,450 **** } } ! if (FindGoodObj (XOff, YOff, obj_ptr->detail.r->first, &sub_obj, &next_level_child)) { obj_ptr->tmp_child = next_level_child; --- 432,436 ---- } } ! if (FindGoodObj(XOff, YOff, obj_ptr->detail.r->first, &sub_obj, &next_level_child)) { obj_ptr->tmp_child = next_level_child; *************** *** 493,528 **** static ! int VertexAlreadySelected (ObjPtr, VIndex, VSelPtr) ! register struct ObjRec * ObjPtr; ! int VIndex; ! register struct VSelRec * * VSelPtr; ! { ! register int i; ! ! for (*VSelPtr = topVSel; *VSelPtr != NULL; *VSelPtr = (*VSelPtr)->next) ! if ((*VSelPtr)->obj == ObjPtr) ! { ! for (i = 0; i < (*VSelPtr)->n; i++) ! if ((*VSelPtr)->v_index[i] == VIndex) ! return (TRUE); ! return (FALSE); } ! return (FALSE); } static ! struct SelRec * AlreadySelected (ObjPtr) ! register struct ObjRec * ObjPtr; { ! register struct SelRec * sel_ptr; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! if (sel_ptr->obj == ObjPtr) ! return (sel_ptr); ! return (NULL); } ! void AddSel (PrevPtr, NextPtr, SelPtr) ! struct SelRec * PrevPtr, * NextPtr, * SelPtr; /* add SelPtr between PrevPtr and NextPtr */ { --- 479,518 ---- static ! int VertexAlreadySelected(ObjPtr, VIndex, VSelPtr) ! register struct ObjRec *ObjPtr; ! int VIndex; ! register struct VSelRec **VSelPtr; ! { ! register int i; ! ! for (*VSelPtr=topVSel; *VSelPtr != NULL; *VSelPtr=(*VSelPtr)->next) { ! if ((*VSelPtr)->obj == ObjPtr) { ! for (i = 0; i < (*VSelPtr)->n; i++) { ! if ((*VSelPtr)->v_index[i] == VIndex) { ! return TRUE; ! } ! } ! return FALSE; } ! } ! return FALSE; } static ! struct SelRec *AlreadySelected(ObjPtr) ! register struct ObjRec *ObjPtr; { ! register struct SelRec *sel_ptr; ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! if (sel_ptr->obj == ObjPtr) { ! return sel_ptr; ! } ! } ! return NULL; } ! void AddSel(PrevPtr, NextPtr, SelPtr) ! struct SelRec *PrevPtr, *NextPtr, *SelPtr; /* add SelPtr between PrevPtr and NextPtr */ { *************** *** 530,550 **** SelPtr->next = NextPtr; ! if (PrevPtr == NULL) topSel = SelPtr; ! else PrevPtr->next = SelPtr; ! ! if (NextPtr == NULL) botSel = SelPtr; ! else NextPtr->prev = SelPtr; numObjSelected++; } ! void AddNewSelObj (ObjPtr) ! register struct ObjRec * ObjPtr; { ! register struct ObjRec * obj_ptr = topObj; ! register struct SelRec * sel_ptr = topSel, * new_sel_ptr; new_sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); --- 520,541 ---- SelPtr->next = NextPtr; ! if (PrevPtr == NULL) { topSel = SelPtr; ! } else { PrevPtr->next = SelPtr; ! } ! if (NextPtr == NULL) { botSel = SelPtr; ! } else { NextPtr->prev = SelPtr; + } numObjSelected++; } ! void AddNewSelObj(ObjPtr) ! register struct ObjRec *ObjPtr; { ! register struct ObjRec *obj_ptr=topObj; ! register struct SelRec *sel_ptr=topSel, *new_sel_ptr; new_sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); *************** *** 552,578 **** new_sel_ptr->obj = ObjPtr; ! for ( ; sel_ptr != NULL && obj_ptr != ObjPtr; obj_ptr = obj_ptr->next) { if (obj_ptr == sel_ptr->obj) { sel_ptr = sel_ptr->next; } } ! if (sel_ptr == NULL) ! { /* the object is below the last selected object */ ! if (botSel == NULL) topSel = new_sel_ptr; ! else botSel->next = new_sel_ptr; ! new_sel_ptr->prev = botSel; new_sel_ptr->next = NULL; botSel = new_sel_ptr; ! } ! else ! { /* the object is between sel_ptr and sel_ptr->prev */ ! if (sel_ptr->prev == NULL) topSel = new_sel_ptr; ! else sel_ptr->prev->next = new_sel_ptr; ! new_sel_ptr->next = sel_ptr; new_sel_ptr->prev = sel_ptr->prev; --- 543,568 ---- new_sel_ptr->obj = ObjPtr; ! for ( ; sel_ptr != NULL && obj_ptr != ObjPtr; obj_ptr=obj_ptr->next) { if (obj_ptr == sel_ptr->obj) { sel_ptr = sel_ptr->next; } } ! if (sel_ptr == NULL) { ! /* the object is below the last selected object */ ! if (botSel == NULL) { topSel = new_sel_ptr; ! } else { botSel->next = new_sel_ptr; ! } new_sel_ptr->prev = botSel; new_sel_ptr->next = NULL; botSel = new_sel_ptr; ! } else { ! /* the object is between sel_ptr and sel_ptr->prev */ ! if (sel_ptr->prev == NULL) { topSel = new_sel_ptr; ! } else { sel_ptr->prev->next = new_sel_ptr; ! } new_sel_ptr->next = sel_ptr; new_sel_ptr->prev = sel_ptr->prev; *************** *** 582,590 **** } ! void UpdSelBBox () /* update selLtX, selLtY, selRbX, selRbY */ { ! register struct ObjRec * obj_ptr; ! register struct SelRec * sel_ptr; numObjSelected = 0; --- 572,580 ---- } ! void UpdSelBBox() /* update selLtX, selLtY, selRbX, selRbY */ { ! register struct ObjRec *obj_ptr; ! register struct SelRec *sel_ptr; numObjSelected = 0; *************** *** 604,609 **** selObjRbY = obj_ptr->obbox.rby; ! for (sel_ptr = topSel->next; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! { numObjSelected++; obj_ptr = sel_ptr->obj; --- 594,598 ---- selObjRbY = obj_ptr->obbox.rby; ! for (sel_ptr=topSel->next; sel_ptr != NULL; sel_ptr=sel_ptr->next) { numObjSelected++; obj_ptr = sel_ptr->obj; *************** *** 621,635 **** static ! struct VSelRec * SelectOneVertex (XOff, YOff) ! int XOff, YOff; /* XOff and YOff are screen offsets */ { ! register struct ObjRec * obj_ptr; ! int v_index, x, y; ! ! JustRemoveAllVSel (); ! if ((obj_ptr = FindAVertex (XOff, YOff, &v_index, &x, &y)) == NULL) ! return (NULL); topVSel = (struct VSelRec *)malloc(sizeof(struct VSelRec)); if (topVSel == NULL) FailAllocMessage(); --- 610,624 ---- static ! struct VSelRec *SelectOneVertex(XOff, YOff) ! int XOff, YOff; /* XOff and YOff are screen offsets */ { ! register struct ObjRec *obj_ptr; ! int v_index, x, y; + JustRemoveAllVSel(); + if ((obj_ptr=FindAVertex(XOff, YOff, &v_index, &x, &y)) == NULL) { + return NULL; + } topVSel = (struct VSelRec *)malloc(sizeof(struct VSelRec)); if (topVSel == NULL) FailAllocMessage(); *************** *** 644,675 **** topVSel->x[0] = x; topVSel->y[0] = y; ! if (obj_ptr->type==OBJ_POLYGON && v_index==0) ! { topVSel->n = 2; topVSel->v_index[1] = obj_ptr->detail.g->n-1; topVSel->x[1] = x; topVSel->y[1] = y; ! } ! else topVSel->n = 1; topVSel->next = NULL; topVSel->prev = NULL; botVSel = topVSel; ! UpdSelBBox (); ! return (topVSel); } static ! struct SelRec * SelectOneObj (XOff, YOff) ! int XOff, YOff; /* XOff and YOff are screen offsets */ { ! register struct ObjRec * obj_ptr; ! struct ObjRec * owner_obj; ! RemoveAllSel (); ! if ((obj_ptr = FindAnObj (XOff,YOff,&owner_obj,NULL,NULL)) == NULL) { ! return (NULL); } if (owner_obj != NULL) obj_ptr = owner_obj; --- 633,663 ---- topVSel->x[0] = x; topVSel->y[0] = y; ! if (obj_ptr->type==OBJ_POLYGON && v_index==0) { topVSel->n = 2; topVSel->v_index[1] = obj_ptr->detail.g->n-1; topVSel->x[1] = x; topVSel->y[1] = y; ! } else { topVSel->n = 1; + } topVSel->next = NULL; topVSel->prev = NULL; botVSel = topVSel; ! UpdSelBBox(); ! return topVSel; } static ! struct SelRec *SelectOneObj(XOff, YOff) ! int XOff, YOff; /* XOff and YOff are screen offsets */ { ! register struct ObjRec *obj_ptr; ! struct ObjRec *owner_obj; ! RemoveAllSel(); ! if ((obj_ptr=FindAnObj(XOff,YOff,&owner_obj,NULL,NULL)) == NULL) { ! return NULL; } if (owner_obj != NULL) obj_ptr = owner_obj; *************** *** 681,702 **** topSel->prev = NULL; botSel = topSel; ! UpdSelBBox (); ! return (topSel); } static ! int FindVertices (X1, Y1, X2, Y2, TopVSel, BotVSel) ! int X1, Y1, X2, Y2; ! struct VSelRec * * TopVSel, * * BotVSel; /* X1, Y1, X2, Y2 are absolute coordinates */ { ! register struct ObjRec * obj_ptr; ! register struct VSelRec * vsel_ptr; ! register int i; ! struct SelRec * sel_ptr; ! struct BBRec bbox; ! IntPoint * v; ! int n, count, max_count, j; *TopVSel = *BotVSel = NULL; --- 669,690 ---- topSel->prev = NULL; botSel = topSel; ! UpdSelBBox(); ! return topSel; } static ! int FindVertices(X1, Y1, X2, Y2, TopVSel, BotVSel) ! int X1, Y1, X2, Y2; ! struct VSelRec **TopVSel, **BotVSel; /* X1, Y1, X2, Y2 are absolute coordinates */ { ! register struct ObjRec *obj_ptr; ! register struct VSelRec *vsel_ptr; ! register int i; ! struct SelRec *sel_ptr; ! struct BBRec bbox; ! IntPoint *v; ! int n, count, max_count, j; *TopVSel = *BotVSel = NULL; *************** *** 704,713 **** bbox.ltx = X1; bbox.lty = Y1; bbox.rbx = X2; bbox.rby = Y2; ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) ! { obj_ptr = sel_ptr->obj; if (obj_ptr->type != OBJ_POLY && obj_ptr->type != OBJ_POLYGON) continue; ! if (!BBoxIntersect (bbox, obj_ptr->bbox)) continue; v = (obj_ptr->type==OBJ_POLY) ? obj_ptr->detail.p->vlist : --- 692,700 ---- bbox.ltx = X1; bbox.lty = Y1; bbox.rbx = X2; bbox.rby = Y2; ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { obj_ptr = sel_ptr->obj; if (obj_ptr->type != OBJ_POLY && obj_ptr->type != OBJ_POLYGON) continue; ! if (!BBoxIntersect(bbox, obj_ptr->bbox)) continue; v = (obj_ptr->type==OBJ_POLY) ? obj_ptr->detail.p->vlist : *************** *** 734,739 **** } ! if (count != 0) ! { vsel_ptr = (struct VSelRec *)malloc(sizeof(struct VSelRec)); if (vsel_ptr == NULL) FailAllocMessage(); --- 721,725 ---- } ! if (count != 0) { vsel_ptr = (struct VSelRec *)malloc(sizeof(struct VSelRec)); if (vsel_ptr == NULL) FailAllocMessage(); *************** *** 741,748 **** vsel_ptr->next = *TopVSel; vsel_ptr->prev = NULL; ! if (*TopVSel == NULL) *BotVSel = vsel_ptr; ! else (*TopVSel)->prev = vsel_ptr; *TopVSel = vsel_ptr; vsel_ptr->n = count; --- 727,735 ---- vsel_ptr->next = *TopVSel; vsel_ptr->prev = NULL; ! if (*TopVSel == NULL) { *BotVSel = vsel_ptr; ! } else { (*TopVSel)->prev = vsel_ptr; + } *TopVSel = vsel_ptr; vsel_ptr->n = count; *************** *** 787,801 **** static ! struct SelRec * FindObjects (X1, Y1, X2, Y2, TopSel, BotSel) ! int X1, Y1, X2, Y2; ! struct SelRec * * TopSel, * * BotSel; /* X1, Y1, X2, Y2 are absolute coordinates */ { ! register struct ObjRec * obj_ptr; ! register struct SelRec * sel_ptr; *TopSel = *BotSel = NULL; ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) { obj_ptr->tmp_parent = NULL; if (colorLayers && !ObjInVisibleLayer(obj_ptr)) { --- 774,788 ---- static ! struct SelRec *FindObjects(X1, Y1, X2, Y2, TopSel, BotSel) ! int X1, Y1, X2, Y2; ! struct SelRec **TopSel, **BotSel; /* X1, Y1, X2, Y2 are absolute coordinates */ { ! register struct ObjRec *obj_ptr; ! register struct SelRec *sel_ptr; *TopSel = *BotSel = NULL; ! for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { obj_ptr->tmp_parent = NULL; if (colorLayers && !ObjInVisibleLayer(obj_ptr)) { *************** *** 821,835 **** } ! void SelBox (window, gc, x1, y1, x2, y2) ! Window window; ! GC gc; ! int x1, y1, x2, y2; ! { ! XPoint sv[5]; ! ! if (x1 == x2 || y1 == y2) ! XDrawLine (mainDisplay, window, gc, x1, y1, x2, y2); ! else ! { sv[0].x = (short)x1; sv[0].y = (short)y1; sv[1].x = (short)x1; sv[1].y = (short)y2; --- 808,821 ---- } ! void SelBox(window, gc, x1, y1, x2, y2) ! Window window; ! GC gc; ! int x1, y1, x2, y2; ! { ! XPoint sv[5]; ! ! if (x1 == x2 || y1 == y2) { ! XDrawLine(mainDisplay, window, gc, x1, y1, x2, y2); ! } else { sv[0].x = (short)x1; sv[0].y = (short)y1; sv[1].x = (short)x1; sv[1].y = (short)y2; *************** *** 837,1024 **** sv[3].x = (short)x2; sv[3].y = (short)y1; sv[4].x = (short)x1; sv[4].y = (short)y1; ! XDrawLines (mainDisplay, window, gc, sv, 5, CoordModeOrigin); } } static ! struct ObjRec * PtInObjList (XOff, YOff, FirstObjPtr) ! int XOff, YOff; ! struct ObjRec * FirstObjPtr; /* XOff and YOff are screen offsets */ { ! register struct ObjRec * obj_ptr, * obj_ptr1; ! register struct AttrRec * attr_ptr; ! for (obj_ptr = FirstObjPtr; obj_ptr != NULL; obj_ptr = obj_ptr->next) ! { ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) ! return (attr_ptr->obj); if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) ! { ! switch (obj_ptr->type) ! { ! case OBJ_TEXT: ! if (FindGoodText (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_XBM: ! if (FindGoodXBm (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_XPM: ! if (FindGoodXPm (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_BOX: ! if (FindGoodBox (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_OVAL: ! if (FindGoodOval (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_POLY: ! if (FindGoodPoly (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_POLYGON: ! if (FindGoodPolygon (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_ARC: ! if (FindGoodArc (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_RCBOX: ! if (FindGoodRCBox (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! obj_ptr1 = PtInObjList (XOff,YOff,obj_ptr->detail.r->first); ! if (obj_ptr1 != NULL) return (obj_ptr1); ! break; } } } ! return (NULL); } static ! struct ObjRec * PtInSelected (XOff, YOff) ! int XOff, YOff; /* XOff and YOff are screen offsets */ { ! register struct SelRec * sel_ptr; ! register struct ObjRec * obj_ptr, * obj_ptr1; ! register struct AttrRec * attr_ptr; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! { obj_ptr = sel_ptr->obj; ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) ! return (attr_ptr->obj); if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) ! { ! switch (obj_ptr->type) ! { ! case OBJ_TEXT: ! if (FindGoodText (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_XBM: ! if (FindGoodXBm (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_XPM: ! if (FindGoodXPm (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_BOX: ! if (FindGoodBox (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_OVAL: ! if (FindGoodOval (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_POLY: ! if (FindGoodPoly (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_POLYGON: ! if (FindGoodPolygon (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_ARC: ! if (FindGoodArc (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! case OBJ_RCBOX: ! if (FindGoodRCBox (XOff,YOff,obj_ptr)) return (obj_ptr); break; ! ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! obj_ptr1 = PtInObjList (XOff,YOff,obj_ptr->detail.r->first); ! if (obj_ptr1 != NULL) return (obj_ptr1); ! break; } } } ! return (NULL); } static ! void ToggleVertexSelection (ObjPtr, VIndex, AbsX, AbsY) ! struct ObjRec * ObjPtr; ! int VIndex, AbsX, AbsY; ! { ! int i, j, n; ! struct VSelRec * vsel_ptr; ! ! if (!(ObjPtr->type==OBJ_POLYGON && ObjPtr->detail.g->n-1==VIndex)) ! { ! char * smooth=NULL; ! int curved=(-1); ! switch (ObjPtr->type) ! { ! case OBJ_POLY: ! smooth = ObjPtr->detail.p->smooth; ! curved = ObjPtr->detail.p->curved; ! break; ! case OBJ_POLYGON: ! smooth = ObjPtr->detail.g->smooth; ! curved = ObjPtr->detail.g->curved; ! break; } ! if (curved != LT_INTSPLINE && curved != (-1) && smooth != NULL) ! { ! if (smooth[VIndex]) MARKO(drawWindow, revDefaultGC, OFFSET_X(AbsX), OFFSET_Y(AbsY)); ! else MARK(drawWindow, revDefaultGC, OFFSET_X(AbsX), OFFSET_Y(AbsY)); ! } ! else MARK(drawWindow, revDefaultGC, OFFSET_X(AbsX), OFFSET_Y(AbsY)); MARKV(drawWindow, revDefaultGC, OFFSET_X(AbsX), OFFSET_Y(AbsY)); } ! if (VertexAlreadySelected (ObjPtr, VIndex, &vsel_ptr)) ! { /* de-select a vertex */ ! if (vsel_ptr->n == 1) ! { ! if (vsel_ptr->prev == NULL) topVSel = vsel_ptr->next; ! else vsel_ptr->prev->next = vsel_ptr->next; ! ! if (vsel_ptr->next == NULL) botVSel = vsel_ptr->prev; ! else vsel_ptr->next->prev = vsel_ptr->prev; ! free(vsel_ptr->v_index); free(vsel_ptr->x); free(vsel_ptr->y); free(vsel_ptr); ! } ! else ! { ! for (j = 0; j < vsel_ptr->n; j++) ! if (vsel_ptr->v_index[j] == VIndex) break; ! if (j > vsel_ptr->n) ! fprintf (stderr, "%s. Please send bug report.\n", "Inconsistent vertex selection"); ! for (i = j; i < vsel_ptr->n-1; i++) ! { vsel_ptr->v_index[i] = vsel_ptr->v_index[i+1]; vsel_ptr->x[i] = vsel_ptr->x[i+1]; --- 823,1005 ---- sv[3].x = (short)x2; sv[3].y = (short)y1; sv[4].x = (short)x1; sv[4].y = (short)y1; ! XDrawLines(mainDisplay, window, gc, sv, 5, CoordModeOrigin); } } static ! struct ObjRec *PtInObjList(XOff, YOff, FirstObjPtr) ! int XOff, YOff; ! struct ObjRec *FirstObjPtr; /* XOff and YOff are screen offsets */ { ! register struct ObjRec *obj_ptr, *obj_ptr1; ! register struct AttrRec *attr_ptr; ! for (obj_ptr=FirstObjPtr; obj_ptr != NULL; obj_ptr=obj_ptr->next) { ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) { if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) { ! return attr_ptr->obj; ! } ! } if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! switch (obj_ptr->type) { ! case OBJ_TEXT: ! if (FindGoodText(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_XBM: ! if (FindGoodXBm(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_XPM: ! if (FindGoodXPm(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_BOX: ! if (FindGoodBox(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_OVAL: ! if (FindGoodOval(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_POLY: ! if (FindGoodPoly(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_POLYGON: ! if (FindGoodPolygon(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_ARC: ! if (FindGoodArc(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_RCBOX: ! if (FindGoodRCBox(XOff,YOff,obj_ptr)) return obj_ptr; break; ! ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! obj_ptr1 = PtInObjList(XOff, YOff, obj_ptr->detail.r->first); ! if (obj_ptr1 != NULL) return obj_ptr1; ! break; } } } ! return NULL; } static ! struct ObjRec *PtInSelected(XOff, YOff) ! int XOff, YOff; /* XOff and YOff are screen offsets */ { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr, *obj_ptr1; ! register struct AttrRec *attr_ptr; ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { obj_ptr = sel_ptr->obj; ! for (attr_ptr=obj_ptr->fattr; attr_ptr!=NULL; attr_ptr=attr_ptr->next) { if (attr_ptr->shown && XOff >= OFFSET_X(attr_ptr->obj->bbox.ltx)-3 && YOff >= OFFSET_Y(attr_ptr->obj->bbox.lty)-3 && XOff <= OFFSET_X(attr_ptr->obj->bbox.rbx)+3 && ! YOff <= OFFSET_Y(attr_ptr->obj->bbox.rby)+3) { ! return attr_ptr->obj; ! } ! } if (XOff >= OFFSET_X(obj_ptr->bbox.ltx)-3 && YOff >= OFFSET_Y(obj_ptr->bbox.lty)-3 && XOff <= OFFSET_X(obj_ptr->bbox.rbx)+3 && ! YOff <= OFFSET_Y(obj_ptr->bbox.rby)+3) { ! switch (obj_ptr->type) { ! case OBJ_TEXT: ! if (FindGoodText(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_XBM: ! if (FindGoodXBm(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_XPM: ! if (FindGoodXPm(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_BOX: ! if (FindGoodBox(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_OVAL: ! if (FindGoodOval(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_POLY: ! if (FindGoodPoly(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_POLYGON: ! if (FindGoodPolygon(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_ARC: ! if (FindGoodArc(XOff,YOff,obj_ptr)) return obj_ptr; break; ! case OBJ_RCBOX: ! if (FindGoodRCBox(XOff,YOff,obj_ptr)) return obj_ptr; break; ! ! case OBJ_GROUP: ! case OBJ_SYM: ! case OBJ_ICON: ! obj_ptr1 = PtInObjList(XOff, YOff, obj_ptr->detail.r->first); ! if (obj_ptr1 != NULL) return obj_ptr1; ! break; } } } ! return NULL; } static ! void ToggleVertexSelection(ObjPtr, VIndex, AbsX, AbsY) ! struct ObjRec *ObjPtr; ! int VIndex, AbsX, AbsY; ! { ! int i, j, n; ! struct VSelRec *vsel_ptr; ! if (!(ObjPtr->type==OBJ_POLYGON && ObjPtr->detail.g->n-1==VIndex)) { ! char *smooth=NULL; ! int curved=(-1); ! ! switch (ObjPtr->type) { ! case OBJ_POLY: ! smooth = ObjPtr->detail.p->smooth; ! curved = ObjPtr->detail.p->curved; ! break; ! case OBJ_POLYGON: ! smooth = ObjPtr->detail.g->smooth; ! curved = ObjPtr->detail.g->curved; ! break; } ! if (curved != LT_INTSPLINE && curved != (-1) && smooth != NULL) { ! if (smooth[VIndex]) { MARKO(drawWindow, revDefaultGC, OFFSET_X(AbsX), OFFSET_Y(AbsY)); ! } else { MARK(drawWindow, revDefaultGC, OFFSET_X(AbsX), OFFSET_Y(AbsY)); ! } ! } else { MARK(drawWindow, revDefaultGC, OFFSET_X(AbsX), OFFSET_Y(AbsY)); + } MARKV(drawWindow, revDefaultGC, OFFSET_X(AbsX), OFFSET_Y(AbsY)); } ! if (VertexAlreadySelected(ObjPtr, VIndex, &vsel_ptr)) { ! /* de-select a vertex */ ! if (vsel_ptr->n == 1) { ! if (vsel_ptr->prev == NULL) { topVSel = vsel_ptr->next; ! } else { vsel_ptr->prev->next = vsel_ptr->next; ! } ! if (vsel_ptr->next == NULL) { botVSel = vsel_ptr->prev; ! } else { vsel_ptr->next->prev = vsel_ptr->prev; ! } free(vsel_ptr->v_index); free(vsel_ptr->x); free(vsel_ptr->y); free(vsel_ptr); ! } else { ! for (j = 0; j < vsel_ptr->n; j++) { ! if (vsel_ptr->v_index[j] == VIndex) { break; ! } ! } ! if (j > vsel_ptr->n) { ! fprintf(stderr, "%s. Please send bug report.\n", "Inconsistent vertex selection"); ! } ! for (i=j; i < vsel_ptr->n-1; i++) { vsel_ptr->v_index[i] = vsel_ptr->v_index[i+1]; vsel_ptr->x[i] = vsel_ptr->x[i+1]; *************** *** 1027,1035 **** vsel_ptr->n--; } ! } ! else ! { ! if (vsel_ptr == NULL) ! { vsel_ptr = (struct VSelRec *)malloc(sizeof(struct VSelRec)); if (vsel_ptr == NULL) FailAllocMessage(); --- 1008,1013 ---- vsel_ptr->n--; } ! } else { ! if (vsel_ptr == NULL) { vsel_ptr = (struct VSelRec *)malloc(sizeof(struct VSelRec)); if (vsel_ptr == NULL) FailAllocMessage(); *************** *** 1051,1068 **** } topVSel = vsel_ptr; ! } ! else ! { n = ++(vsel_ptr->n); ! if (n > vsel_ptr->max_v) ! { ! int max_v; vsel_ptr->max_v += 10; max_v = vsel_ptr->max_v; ! vsel_ptr->v_index = (int *) realloc (vsel_ptr->v_index, sizeof(int)*max_v); ! vsel_ptr->x = (int *) realloc (vsel_ptr->x, sizeof(int)*max_v); ! vsel_ptr->y = (int *) realloc (vsel_ptr->y, sizeof(int)*max_v); } } --- 1029,1043 ---- } topVSel = vsel_ptr; ! } else { n = ++(vsel_ptr->n); ! if (n > vsel_ptr->max_v) { ! int max_v; vsel_ptr->max_v += 10; max_v = vsel_ptr->max_v; ! vsel_ptr->v_index = (int*)realloc(vsel_ptr->v_index, sizeof(int)*max_v); ! vsel_ptr->x = (int*)realloc(vsel_ptr->x, sizeof(int)*max_v); ! vsel_ptr->y = (int*)realloc(vsel_ptr->y, sizeof(int)*max_v); } } *************** *** 1074,1121 **** static ! void ToggleSelectedObjIfSelectedAlready (ObjPtr) ! register struct ObjRec * ObjPtr; { ! register struct SelRec * sel_ptr; ! if ((sel_ptr = AlreadySelected (ObjPtr)) != NULL) ! { /* de-select an object */ ! HighLightAnObj (ObjPtr); ! if (sel_ptr->prev == NULL) topSel = sel_ptr->next; ! else sel_ptr->prev->next = sel_ptr->next; ! ! if (sel_ptr->next == NULL) botSel = sel_ptr->prev; ! else sel_ptr->next->prev = sel_ptr->prev; ! free(sel_ptr); numObjSelected--; ! } ! else ! { /* add a newly selected object */ ! AddNewSelObj (ObjPtr); ! HighLightAnObj (ObjPtr); } } static ! void ContinueSel (XOff, YOff, ShiftKeyDown) ! int XOff, YOff, ShiftKeyDown; /* XOff and YOff are screen offsets, and they are not on grid */ { ! register int i; ! int end_x, end_y, v_index; ! int done = FALSE, ltx, lty, rbx, rby, dx, dy, x, y; ! int new_end_x, new_end_y; ! char buf[80], w_buf[80], h_buf[80], x_buf[80], y_buf[80]; ! XEvent input, ev; ! XMotionEvent * motion_ev; ! struct SelRec * sel_ptr, * top_sel_ptr, * bot_sel_ptr; ! struct VSelRec * vsel_ptr, * top_vsel_ptr, * bot_vsel_ptr; ! struct ObjRec * obj_ptr, * owner_obj; end_x = XOff; --- 1049,1094 ---- static ! void ToggleSelectedObjIfSelectedAlready(ObjPtr) ! register struct ObjRec *ObjPtr; { ! register struct SelRec *sel_ptr; ! if ((sel_ptr=AlreadySelected(ObjPtr)) != NULL) { ! /* de-select an object */ ! HighLightAnObj(ObjPtr); ! if (sel_ptr->prev == NULL) { topSel = sel_ptr->next; ! } else { sel_ptr->prev->next = sel_ptr->next; ! } ! if (sel_ptr->next == NULL) { botSel = sel_ptr->prev; ! } else { sel_ptr->next->prev = sel_ptr->prev; ! } free(sel_ptr); numObjSelected--; ! } else { ! /* add a newly selected object */ ! AddNewSelObj(ObjPtr); ! HighLightAnObj(ObjPtr); } } static ! void ContinueSel(XOff, YOff, ShiftKeyDown) ! int XOff, YOff, ShiftKeyDown; /* XOff and YOff are screen offsets, and they are not on grid */ { ! register int i; ! int end_x, end_y, v_index, new_end_x, new_end_y; ! int done=FALSE, ltx, lty, rbx, rby, dx, dy, x, y; ! char buf[80], w_buf[80], h_buf[80], x_buf[80], y_buf[80]; ! XEvent input, ev; ! XMotionEvent *motion_ev; ! struct SelRec *sel_ptr, *top_sel_ptr, *bot_sel_ptr; ! struct VSelRec *vsel_ptr, *top_vsel_ptr, *bot_vsel_ptr; ! struct ObjRec *obj_ptr, *owner_obj; end_x = XOff; *************** *** 1133,1145 **** GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! while (!done) ! { ! XNextEvent (mainDisplay, &input); ! ! if (input.type == Expose || input.type == VisibilityNotify) ! ExposeEventHandler (&input, TRUE); ! else if (input.type == ButtonRelease) ! { ! XUngrabPointer (mainDisplay, CurrentTime); PixelToMeasurementUnit(w_buf, ABS_SIZE(abs(end_x-XOff))); PixelToMeasurementUnit(h_buf, ABS_SIZE(abs(end_y-YOff))); --- 1106,1116 ---- GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! while (!done) { ! XNextEvent(mainDisplay, &input); ! ! if (input.type == Expose || input.type == VisibilityNotify) { ! ExposeEventHandler(&input, TRUE); ! } else if (input.type == ButtonRelease) { ! XUngrabPointer(mainDisplay, CurrentTime); PixelToMeasurementUnit(w_buf, ABS_SIZE(abs(end_x-XOff))); PixelToMeasurementUnit(h_buf, ABS_SIZE(abs(end_y-YOff))); *************** *** 1147,1156 **** PixelToMeasurementUnit(y_buf, ABS_Y(end_y)); sprintf(buf, "w=%s\nh=%s\nx=%s\ny=%s", w_buf, h_buf, x_buf, y_buf); ! EndShowMeasureCursor (end_x, end_y, buf, TRUE); ! SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y); done = TRUE; ! } ! else if (input.type == MotionNotify) ! { motion_ev = &(input.xmotion); new_end_x = motion_ev->x; --- 1118,1125 ---- PixelToMeasurementUnit(y_buf, ABS_Y(end_y)); sprintf(buf, "w=%s\nh=%s\nx=%s\ny=%s", w_buf, h_buf, x_buf, y_buf); ! EndShowMeasureCursor(end_x, end_y, buf, TRUE); ! SelBox(drawWindow, revDefaultGC, XOff, YOff, end_x, end_y); done = TRUE; ! } else if (input.type == MotionNotify) { motion_ev = &(input.xmotion); new_end_x = motion_ev->x; *************** *** 1162,1169 **** PixelToMeasurementUnit(y_buf, ABS_Y(end_y)); sprintf(buf, "w=%s\nh=%s\nx=%s\ny=%s", w_buf, h_buf, x_buf, y_buf); ! ShowMeasureCursor (end_x, end_y, buf, TRUE); ! SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y); end_x = new_end_x; end_y = new_end_y; ! SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y); PixelToMeasurementUnit(w_buf, ABS_SIZE(abs(end_x-XOff))); PixelToMeasurementUnit(h_buf, ABS_SIZE(abs(end_y-YOff))); --- 1131,1138 ---- PixelToMeasurementUnit(y_buf, ABS_Y(end_y)); sprintf(buf, "w=%s\nh=%s\nx=%s\ny=%s", w_buf, h_buf, x_buf, y_buf); ! ShowMeasureCursor(end_x, end_y, buf, TRUE); ! SelBox(drawWindow, revDefaultGC, XOff, YOff, end_x, end_y); end_x = new_end_x; end_y = new_end_y; ! SelBox(drawWindow, revDefaultGC, XOff, YOff, end_x, end_y); PixelToMeasurementUnit(w_buf, ABS_SIZE(abs(end_x-XOff))); PixelToMeasurementUnit(h_buf, ABS_SIZE(abs(end_y-YOff))); *************** *** 1171,1244 **** PixelToMeasurementUnit(y_buf, ABS_Y(end_y)); sprintf(buf, "w=%s\nh=%s\nx=%s\ny=%s", w_buf, h_buf, x_buf, y_buf); ! ShowMeasureCursor (end_x, end_y, buf, TRUE); ! MarkRulers (end_x, end_y); ! while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &ev)) ; } } ! dx = abs (XOff - end_x); ! dy = abs (YOff - end_y); ! if (curChoice == VERTEXMODE) ! { ! if (dx <= 2 && dy <= 2) ! { ! if (topSel == NULL) ! { ! if (SelectOneObj (XOff, YOff) != NULL) ! { if ((topSel->obj->type == OBJ_POLY || ! topSel->obj->type == OBJ_POLYGON) && !topSel->obj->locked) ! HighLightForward (); ! else ! RemoveAllSel (); ! } ! } ! else if (ShiftKeyDown) ! { ! obj_ptr = FindAVertex (XOff, YOff, &v_index, &x, &y); ! if (obj_ptr != NULL) ! { ! ToggleVertexSelection (obj_ptr, v_index, x, y); ! if (obj_ptr->type==OBJ_POLYGON && v_index==0) ! ToggleVertexSelection (obj_ptr,obj_ptr->detail.g->n-1,x,y); ! UpdSelBBox (); ! } ! } ! else ! { ! HighLightReverse (); ! SelectOneVertex (XOff, YOff); ! HighLightForward (); ! } ! } ! else ! { ! CalcBBox (XOff, YOff, end_x, end_y, <x, <y, &rbx, &rby); ! if (topSel == NULL) ! { ! if (FindObjects (ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_sel_ptr, &bot_sel_ptr) != NULL) ! { ! topSel = top_sel_ptr; ! botSel = bot_sel_ptr; ! UnSelNonVertexObjs (FALSE); /* do not highlight */ ! UpdSelBBox (); ! HighLightForward (); } } ! else if (ShiftKeyDown) ! { ! if (FindVertices (ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_vsel_ptr, &bot_vsel_ptr)) ! { ! struct VSelRec * next_vsel; ! for (vsel_ptr=top_vsel_ptr; vsel_ptr!=NULL; vsel_ptr=next_vsel) ! { obj_ptr = vsel_ptr->obj; ! for (i = 0; i < vsel_ptr->n; i++) ! ToggleVertexSelection (obj_ptr, vsel_ptr->v_index[i], vsel_ptr->x[i], vsel_ptr->y[i]); next_vsel = vsel_ptr->next; free(vsel_ptr->v_index); --- 1140,1200 ---- PixelToMeasurementUnit(y_buf, ABS_Y(end_y)); sprintf(buf, "w=%s\nh=%s\nx=%s\ny=%s", w_buf, h_buf, x_buf, y_buf); ! ShowMeasureCursor(end_x, end_y, buf, TRUE); ! MarkRulers(end_x, end_y); ! while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } } ! dx = abs(XOff - end_x); ! dy = abs(YOff - end_y); ! if (curChoice == VERTEXMODE) { ! if (dx <= 2 && dy <= 2) { ! if (topSel == NULL) { ! if (SelectOneObj(XOff, YOff) != NULL) { if ((topSel->obj->type == OBJ_POLY || ! topSel->obj->type == OBJ_POLYGON) && ! !topSel->obj->locked) { ! HighLightForward(); ! } else { ! RemoveAllSel(); ! } } + } else if (ShiftKeyDown) { + obj_ptr = FindAVertex(XOff, YOff, &v_index, &x, &y); + if (obj_ptr != NULL) { + ToggleVertexSelection(obj_ptr, v_index, x, y); + if (obj_ptr->type==OBJ_POLYGON && v_index==0) { + ToggleVertexSelection(obj_ptr,obj_ptr->detail.g->n-1,x,y); + } + UpdSelBBox(); + } + } else { + HighLightReverse(); + SelectOneVertex(XOff, YOff); + HighLightForward(); } ! } else { ! CalcBBox(XOff, YOff, end_x, end_y, <x, <y, &rbx, &rby); ! if (topSel == NULL) { ! if (FindObjects(ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_sel_ptr, &bot_sel_ptr) != NULL) { ! topSel = top_sel_ptr; ! botSel = bot_sel_ptr; ! UnSelNonVertexObjs(FALSE); /* do not highlight */ ! UpdSelBBox(); ! HighLightForward(); ! } ! } else if (ShiftKeyDown) { ! if (FindVertices(ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_vsel_ptr, &bot_vsel_ptr)) { ! struct VSelRec *next_vsel; ! for (vsel_ptr=top_vsel_ptr; vsel_ptr!=NULL; vsel_ptr=next_vsel) { obj_ptr = vsel_ptr->obj; ! for (i = 0; i < vsel_ptr->n; i++) { ! ToggleVertexSelection(obj_ptr, vsel_ptr->v_index[i], vsel_ptr->x[i], vsel_ptr->y[i]); + } next_vsel = vsel_ptr->next; free(vsel_ptr->v_index); *************** *** 1247,1322 **** free(vsel_ptr); } ! UpdSelBBox (); } ! } ! else ! { ! HighLightReverse (); ! JustRemoveAllVSel (); ! if (FindVertices (ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_vsel_ptr, &bot_vsel_ptr)) ! { topVSel = top_vsel_ptr; botVSel = bot_vsel_ptr; ! UpdSelBBox (); } ! HighLightForward (); } } ! } ! else ! { ! if (dx <= 2 && dy <= 2) ! { ! if (ShiftKeyDown) ! { ! obj_ptr = FindAnObj (XOff, YOff, &owner_obj, NULL, NULL); ! if (obj_ptr != NULL) ! { if (owner_obj != NULL) obj_ptr = owner_obj; ! ToggleSelectedObjIfSelectedAlready (obj_ptr); ! UpdSelBBox (); } } ! else ! { ! if (topSel != NULL) HighLightReverse (); ! ! if (SelectOneObj (XOff, YOff) != NULL) ! HighLightForward (); ! } ! } ! else ! { ! CalcBBox (XOff, YOff, end_x, end_y, <x, <y, &rbx, &rby); ! if (ShiftKeyDown) ! { ! if (FindObjects (ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_sel_ptr, &bot_sel_ptr) != NULL) ! { ! struct SelRec * next_sel; ! for (sel_ptr=top_sel_ptr; sel_ptr!=NULL; sel_ptr=next_sel) ! { next_sel = sel_ptr->next; obj_ptr = sel_ptr->obj; ! ToggleSelectedObjIfSelectedAlready (obj_ptr); free(sel_ptr); } ! UpdSelBBox (); } ! } ! else ! { ! if (topSel != NULL) HighLightReverse (); ! RemoveAllSel (); ! if (FindObjects (ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_sel_ptr, &bot_sel_ptr) != NULL) ! { topSel = top_sel_ptr; botSel = bot_sel_ptr; ! UpdSelBBox (); ! HighLightForward (); } } --- 1203,1261 ---- free(vsel_ptr); } ! UpdSelBBox(); } ! } else { ! HighLightReverse(); ! JustRemoveAllVSel(); ! if (FindVertices(ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_vsel_ptr, &bot_vsel_ptr)) { topVSel = top_vsel_ptr; botVSel = bot_vsel_ptr; ! UpdSelBBox(); } ! HighLightForward(); } } ! } else { ! if (dx <= 2 && dy <= 2) { ! if (ShiftKeyDown) { ! obj_ptr = FindAnObj(XOff, YOff, &owner_obj, NULL, NULL); ! if (obj_ptr != NULL) { if (owner_obj != NULL) obj_ptr = owner_obj; ! ToggleSelectedObjIfSelectedAlready(obj_ptr); ! UpdSelBBox(); ! } ! } else { ! if (topSel != NULL) HighLightReverse(); ! ! if (SelectOneObj(XOff, YOff) != NULL) { ! HighLightForward(); } } ! } else { ! CalcBBox(XOff, YOff, end_x, end_y, <x, <y, &rbx, &rby); ! if (ShiftKeyDown) { ! if (FindObjects(ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_sel_ptr, &bot_sel_ptr) != NULL) { ! struct SelRec *next_sel; ! for (sel_ptr=top_sel_ptr; sel_ptr!=NULL; sel_ptr=next_sel) { next_sel = sel_ptr->next; obj_ptr = sel_ptr->obj; ! ToggleSelectedObjIfSelectedAlready(obj_ptr); free(sel_ptr); } ! UpdSelBBox(); } ! } else { ! if (topSel != NULL) HighLightReverse(); ! RemoveAllSel(); ! if (FindObjects(ABS_X(ltx), ABS_Y(lty), ABS_X(rbx), ABS_Y(rby), ! &top_sel_ptr, &bot_sel_ptr) != NULL) { topSel = top_sel_ptr; botSel = bot_sel_ptr; ! UpdSelBBox(); ! HighLightForward(); } } *************** *** 1326,1383 **** static Time selectLastClickTime; ! static int selectJustClicked = FALSE; static XComposeStatus c_stat; ! void Select (input) ! XEvent * input; { ! register int i; ! XButtonEvent * button_ev; ! struct SelRec * sel_ptr; ! struct VSelRec * vsel_ptr; ! struct ObjRec * obj_ptr; ! char s[80]; ! KeySym key_sym; ! Time click_time; ! ! if (input->type == KeyPress) ! { ! int delta, dx=0, dy=0; ! ! XLookupString (&(input->xkey), s, 80-1, &key_sym, &c_stat); ! if (topSel==NULL && topVSel==NULL) ! { ! XKeyEvent * key_ev = &(input->xkey); ! ! if (key_ev->state & ControlMask) ! { ! XButtonEvent button_ev; button_ev.state = ShiftMask; ! switch (key_sym) ! { ! case XK_Left: ScrollLeft (&button_ev); break; ! case XK_KP_Left: ScrollLeft (&button_ev); break; ! case XK_Up: ScrollUp (&button_ev); break; ! case XK_KP_Up: ScrollUp (&button_ev); break; ! case XK_Right: ScrollRight (&button_ev); break; ! case XK_KP_Right: ScrollRight (&button_ev); break; ! case XK_Down: ScrollDown (&button_ev); break; ! case XK_KP_Down: ScrollDown (&button_ev); break; ! } ! } ! else ! { ! switch (key_sym) ! { ! case XK_Left: ScrollLeft (NULL); break; ! case XK_KP_Left: ScrollLeft (NULL); break; ! case XK_Up: ScrollUp (NULL); break; ! case XK_KP_Up: ScrollUp (NULL); break; ! case XK_Right: ScrollRight (NULL); break; ! case XK_KP_Right: ScrollRight (NULL); break; ! case XK_Down: ScrollDown (NULL); break; ! case XK_KP_Down: ScrollDown (NULL); break; } } --- 1265,1315 ---- static Time selectLastClickTime; ! static int selectJustClicked=FALSE; static XComposeStatus c_stat; ! void Select(input) ! XEvent *input; { ! register int i; ! XButtonEvent *button_ev; ! struct SelRec *sel_ptr; ! struct VSelRec *vsel_ptr; ! struct ObjRec *obj_ptr; ! char s[80]; ! KeySym key_sym; ! Time click_time; ! ! if (input->type == KeyPress) { ! int delta, dx=0, dy=0; ! ! XLookupString(&(input->xkey), s, 80-1, &key_sym, &c_stat); ! if (topSel==NULL && topVSel==NULL) { ! XKeyEvent *key_ev=(&(input->xkey)); ! ! if (key_ev->state & ControlMask) { ! XButtonEvent button_ev; button_ev.state = ShiftMask; ! switch (key_sym) { ! case XK_Left: ScrollLeft(&button_ev); break; ! case XK_KP_Left: ScrollLeft(&button_ev); break; ! case XK_Up: ScrollUp(&button_ev); break; ! case XK_KP_Up: ScrollUp(&button_ev); break; ! case XK_Right: ScrollRight(&button_ev); break; ! case XK_KP_Right: ScrollRight(&button_ev); break; ! case XK_Down: ScrollDown(&button_ev); break; ! case XK_KP_Down: ScrollDown(&button_ev); break; ! } ! } else { ! switch (key_sym) { ! case XK_Left: ScrollLeft(NULL); break; ! case XK_KP_Left: ScrollLeft(NULL); break; ! case XK_Up: ScrollUp(NULL); break; ! case XK_KP_Up: ScrollUp(NULL); break; ! case XK_Right: ScrollRight(NULL); break; ! case XK_KP_Right: ScrollRight(NULL); break; ! case XK_Down: ScrollDown(NULL); break; ! case XK_KP_Down: ScrollDown(NULL); break; } } *************** *** 1386,1447 **** if (key_sym!=XK_Left && key_sym!=XK_Up && key_sym!=XK_Right && key_sym!=XK_Down && key_sym!=XK_KP_Left && key_sym!=XK_KP_Up && ! key_sym!=XK_KP_Right && key_sym!=XK_KP_Down) return; ! if (gridOn) delta = (gridSystem==ENGLISH_GRID) ? GRID_ABS_SIZE(xyEnglishGrid) : GRID_ABS_SIZE(xyMetricGrid); ! else delta = GRID_ABS_SIZE(1); ! HighLightReverse (); ! switch (key_sym) ! { ! case XK_Left: dx = -delta; dy = 0; break; ! case XK_KP_Left: dx = -delta; dy = 0; break; ! case XK_Up: dx = 0; dy = -delta; break; ! case XK_KP_Up: dx = 0; dy = -delta; break; ! case XK_Right: dx = delta; dy = 0; break; ! case XK_KP_Right: dx = delta; dy = 0; break; ! case XK_Down: dx = 0; dy = delta; break; ! case XK_KP_Down: dx = 0; dy = delta; break; ! } ! if (curChoice == VERTEXMODE) ! MoveAllSelVs (dx, dy); ! else if (numObjSelected == numObjLocked) ! { ! HighLightForward (); return; } ! else ! MoveAllSel (dx, dy); ! HighLightForward (); ! UpdSelBBox (); ! if (justDupped) ! { dupDx += dx; dupDy += dy; } ! SetFileModified (TRUE); return; ! } ! else if (input->type != ButtonPress) return; ! button_ev = &(input->xbutton); ! if (button_ev->button == Button1) ! { ! int mouse_x, mouse_y, grid_x, grid_y, corner; mouse_x = button_ev->x; mouse_y = button_ev->y; ! GridXY (mouse_x, mouse_y, &grid_x, &grid_y); click_time = button_ev->time; if (curChoice==VERTEXMODE && topSel!=NULL && selectJustClicked && ! (click_time-selectLastClickTime) < doubleClickInterval) ! { selectJustClicked = FALSE; ! HighLightReverse (); ! RemoveAllSel (); return; } --- 1318,1375 ---- if (key_sym!=XK_Left && key_sym!=XK_Up && key_sym!=XK_Right && key_sym!=XK_Down && key_sym!=XK_KP_Left && key_sym!=XK_KP_Up && ! key_sym!=XK_KP_Right && key_sym!=XK_KP_Down) { return; + } ! if (gridOn) { delta = (gridSystem==ENGLISH_GRID) ? GRID_ABS_SIZE(xyEnglishGrid) : GRID_ABS_SIZE(xyMetricGrid); ! } else { delta = GRID_ABS_SIZE(1); ! } ! HighLightReverse(); ! switch (key_sym) { ! case XK_Left: dx = -delta; dy = 0; break; ! case XK_KP_Left: dx = -delta; dy = 0; break; ! case XK_Up: dx = 0; dy = -delta; break; ! case XK_KP_Up: dx = 0; dy = -delta; break; ! case XK_Right: dx = delta; dy = 0; break; ! case XK_KP_Right: dx = delta; dy = 0; break; ! case XK_Down: dx = 0; dy = delta; break; ! case XK_KP_Down: dx = 0; dy = delta; break; ! } ! if (curChoice == VERTEXMODE) { ! MoveAllSelVs(dx, dy); ! } else if (numObjSelected == numObjLocked) { ! HighLightForward(); return; + } else { + MoveAllSel(dx, dy); } ! HighLightForward(); ! UpdSelBBox(); ! if (justDupped) { dupDx += dx; dupDy += dy; } ! SetFileModified(TRUE); return; ! } else if (input->type != ButtonPress) { return; ! } button_ev = &(input->xbutton); ! if (button_ev->button == Button1) { ! int mouse_x, mouse_y, grid_x, grid_y, corner; mouse_x = button_ev->x; mouse_y = button_ev->y; ! GridXY(mouse_x, mouse_y, &grid_x, &grid_y); click_time = button_ev->time; if (curChoice==VERTEXMODE && topSel!=NULL && selectJustClicked && ! (click_time-selectLastClickTime) < doubleClickInterval) { selectJustClicked = FALSE; ! HighLightReverse(); ! RemoveAllSel(); return; } *************** *** 1449,1521 **** selectLastClickTime = click_time; ! if (button_ev->state & (ShiftMask | ControlMask)) ! { ! ContinueSel (mouse_x, mouse_y, TRUE); justDupped = FALSE; return; ! } ! else if (curChoice == VERTEXMODE && topVSel != NULL) ! { ! int found = FALSE; for (vsel_ptr=topVSel; vsel_ptr!=NULL && !found; ! vsel_ptr=vsel_ptr->next) ! for (i = 0; i < vsel_ptr->n; i++) ! if (PtInMark (mouse_x, mouse_y, OFFSET_X(vsel_ptr->x[i]), ! OFFSET_Y(vsel_ptr->y[i]))) ! { found = TRUE; break; } ! if (found) ! { ! MoveSelVs (grid_x, grid_y); return; } ! } ! else if (curChoice == NOTHING) ! { ! if (topSel != NULL) ! { if (oneMotionSelectMove && ! PtInSelMark (mouse_x, mouse_y, &corner) == NULL && ! PtInSelected (mouse_x, mouse_y) == NULL) ! { /* may be pointing in not already selected object */ ! HighLightReverse (); ! RemoveAllSel (); ! if (SelectOneObj (mouse_x, mouse_y) != NULL) ! { ! HighLightForward (); ! MoveSel (grid_x, grid_y, topSel->obj, button_ev); return; } ! } ! else if ((sel_ptr=PtInSelMark(mouse_x,mouse_y,&corner)) != NULL) ! { ! StretchSel (grid_x, grid_y, sel_ptr->obj, corner); return; ! } ! else if ((obj_ptr = PtInSelected (mouse_x, mouse_y)) != NULL) ! { ! MoveSel (grid_x, grid_y, obj_ptr, button_ev); return; } ! } ! else if (oneMotionSelectMove && SelectOneObj(mouse_x,mouse_y) != NULL) ! { ! HighLightForward (); ! MoveSel (grid_x, grid_y, topSel->obj, button_ev); return; } ! } ! else if (curChoice == ROTATEMODE && topSel != NULL) ! { ! if ((sel_ptr = PtInSelMark (mouse_x, mouse_y, &corner)) != NULL) ! { ! RotateShearSel (grid_x, grid_y, sel_ptr->obj, corner); return; } } ! ContinueSel (mouse_x, mouse_y, FALSE); justDupped = FALSE; } --- 1377,1434 ---- selectLastClickTime = click_time; ! if (button_ev->state & (ShiftMask | ControlMask)) { ! ContinueSel(mouse_x, mouse_y, TRUE); justDupped = FALSE; return; ! } else if (curChoice == VERTEXMODE && topVSel != NULL) { ! int found=FALSE; for (vsel_ptr=topVSel; vsel_ptr!=NULL && !found; ! vsel_ptr=vsel_ptr->next) { ! for (i = 0; i < vsel_ptr->n; i++) { ! if (PtInMark(mouse_x, mouse_y, OFFSET_X(vsel_ptr->x[i]), ! OFFSET_Y(vsel_ptr->y[i]))) { found = TRUE; break; } ! } ! } ! if (found) { ! MoveSelVs(grid_x, grid_y); return; } ! } else if (curChoice == NOTHING) { ! if (topSel != NULL) { if (oneMotionSelectMove && ! PtInSelMark(mouse_x, mouse_y, &corner) == NULL && ! PtInSelected(mouse_x, mouse_y) == NULL) { ! /* may be pointing in not already selected object */ ! HighLightReverse(); ! RemoveAllSel(); ! if (SelectOneObj(mouse_x, mouse_y) != NULL) { ! HighLightForward(); ! MoveSel(grid_x, grid_y, topSel->obj, button_ev); return; } ! } else if ((sel_ptr=PtInSelMark(mouse_x,mouse_y,&corner)) != NULL) { ! StretchSel(grid_x, grid_y, sel_ptr->obj, corner); return; ! } else if ((obj_ptr=PtInSelected(mouse_x, mouse_y)) != NULL) { ! MoveSel(grid_x, grid_y, obj_ptr, button_ev); return; } ! } else if (oneMotionSelectMove && ! SelectOneObj(mouse_x,mouse_y) != NULL) { ! HighLightForward(); ! MoveSel(grid_x, grid_y, topSel->obj, button_ev); return; } ! } else if (curChoice == ROTATEMODE && topSel != NULL) { ! if ((sel_ptr=PtInSelMark(mouse_x, mouse_y, &corner)) != NULL) { ! RotateShearSel(grid_x, grid_y, sel_ptr->obj, corner); return; } } ! ContinueSel(mouse_x, mouse_y, FALSE); justDupped = FALSE; } *************** *** 1548,1552 **** for (attr_ptr=found_attr->next; attr_ptr!=NULL; attr_ptr=attr_ptr->next) { if (compare_name) { ! if (strcmp (attr_ptr->attr_name.s, AttrName) == 0) { if (attr_ptr->obj->color == colorIndex) { break; --- 1461,1465 ---- for (attr_ptr=found_attr->next; attr_ptr!=NULL; attr_ptr=attr_ptr->next) { if (compare_name) { ! if (strcmp(attr_ptr->attr_name.s, AttrName) == 0) { if (attr_ptr->obj->color == colorIndex) { break; *************** *** 1556,1560 **** } } else { ! if (strcmp (attr_ptr->attr_value.s, AttrName) == 0) { if (attr_ptr->obj->color == colorIndex) { break; --- 1469,1473 ---- } } else { ! if (strcmp(attr_ptr->attr_value.s, AttrName) == 0) { if (attr_ptr->obj->color == colorIndex) { break; *************** *** 1602,1641 **** } ! struct AttrRec * ValidAttrArg (c_ptr, obj_ptr, new_c_ptr) ! char * c_ptr, * * new_c_ptr; ! struct ObjRec * obj_ptr; { ! char name[MAXSTRING+1], * name_ptr; ! struct AttrRec * attr_ptr; name_ptr = name; ! if (c_ptr[0] == '$' && c_ptr[1] == '(') ! { ! for (c_ptr = &c_ptr[2]; *c_ptr != '\0'; c_ptr++) ! switch (*c_ptr) ! { ! case '\\': ! c_ptr++; ! *name_ptr++ = *c_ptr; ! break; ! case ')': ! *name_ptr++ = '='; ! *name_ptr = '\0'; ! *new_c_ptr = c_ptr; ! attr_ptr = FindAttrWithName (obj_ptr, name, NULL); ! if (attr_ptr == NULL) ! { ! char msg[MAXSTRING+1]; ! sprintf (msg, "Can not find '%s' attr.", name); ! Msg (msg); ! } ! return (attr_ptr); ! default: ! *name_ptr++ = *c_ptr; ! break; } } ! return (NULL); } --- 1515,1550 ---- } ! struct AttrRec *ValidAttrArg(c_ptr, obj_ptr, new_c_ptr) ! char *c_ptr, **new_c_ptr; ! struct ObjRec *obj_ptr; { ! char name[MAXSTRING+1], *name_ptr; ! struct AttrRec *attr_ptr; name_ptr = name; ! if (c_ptr[0] == '$' && c_ptr[1] == '(') { ! for (c_ptr = &c_ptr[2]; *c_ptr != '\0'; c_ptr++) { ! switch (*c_ptr) { ! case '\\': ! c_ptr++; ! *name_ptr++ = *c_ptr; ! break; ! case ')': ! *name_ptr++ = '='; ! *name_ptr = '\0'; ! *new_c_ptr = c_ptr; ! attr_ptr = FindAttrWithName(obj_ptr, name, NULL); ! if (attr_ptr == NULL) { ! char msg[MAXSTRING+1]; ! sprintf(msg, "Can not find '%s' attr.", name); ! Msg(msg); ! } ! return attr_ptr; ! default: *name_ptr++ = *c_ptr; break; } + } } ! return NULL; } *************** *** 1676,1682 **** rc = FALSE; } else if (new_page_num != curPageNum) { ! /* PrepareToRecord(CMD_GOTO_PAGE, NULL, NULL, curPageNum); */ GotoPageNum(new_page_num); - /* RecordCmd(CMD_GOTO_PAGE, NULL, NULL, NULL, curPageNum); */ ShowPage(); ClearAndRedrawDrawWindow(); --- 1585,1590 ---- rc = FALSE; } else if (new_page_num != curPageNum) { ! BeforeNavigate(); GotoPageNum(new_page_num); ShowPage(); ClearAndRedrawDrawWindow(); *************** *** 1723,1727 **** } else { if (!LoadFile(file_name, TRUE)) { ! if (do_not_save) SetFileModified(TRUE); rc = FALSE; } } --- 1631,1636 ---- } else { if (!LoadFile(file_name, TRUE)) { ! if (do_not_save) SetFileModified(TRUE); ! rc = FALSE; } } *************** *** 1735,1738 **** --- 1644,1652 ---- rc = FALSE; } else if (new_page_num != curPageNum) { + /* + * No need to call BeforeNavigate() here because either + * LoadRemoteFileFromMem() is called (which calls LoadFile()) + * or LoadFile() is called directly. + */ GotoPageNum(new_page_num); ShowPage(); *************** *** 1862,1872 **** } ! void Teleport (button_ev) ! XButtonEvent * button_ev; { ! struct AttrRec * teleport_attr, * launch_attr, * exec_attr; ! struct ObjRec * obj_ptr, * owner_obj; ! char buf[MAXSTRING+1]; ! int len; if ((obj_ptr=FindAnObj(button_ev->x,button_ev->y,&owner_obj,NULL,NULL)) == --- 1776,1786 ---- } ! void Teleport(button_ev) ! XButtonEvent *button_ev; { ! struct AttrRec *teleport_attr, *launch_attr, *exec_attr; ! struct ObjRec *obj_ptr, *owner_obj; ! char buf[MAXSTRING+1]; ! int len; if ((obj_ptr=FindAnObj(button_ev->x,button_ev->y,&owner_obj,NULL,NULL)) == *************** *** 1876,1882 **** if (owner_obj != NULL) obj_ptr = owner_obj; ! teleport_attr = FindAttrWithName (obj_ptr, TELEPORT_ATTR, NULL); if (teleport_attr != NULL) { ! DoTeleport (teleport_attr); if ((exec_attr=FindFileAttrWithName("auto_exec=")) != NULL) { DoExecLoop(NULL, exec_attr); --- 1790,1796 ---- if (owner_obj != NULL) obj_ptr = owner_obj; ! teleport_attr = FindAttrWithName(obj_ptr, TELEPORT_ATTR, NULL); if (teleport_attr != NULL) { ! DoTeleport(teleport_attr); if ((exec_attr=FindFileAttrWithName("auto_exec=")) != NULL) { DoExecLoop(NULL, exec_attr); *************** *** 1884,1890 **** return; } ! teleport_attr = FindAttrWithName (obj_ptr, "href=", NULL); if (teleport_attr != NULL) { ! DoTeleport (teleport_attr); if ((exec_attr=FindFileAttrWithName("auto_exec=")) != NULL) { DoExecLoop(NULL, exec_attr); --- 1798,1804 ---- return; } ! teleport_attr = FindAttrWithName(obj_ptr, "href=", NULL); if (teleport_attr != NULL) { ! DoTeleport(teleport_attr); if ((exec_attr=FindFileAttrWithName("auto_exec=")) != NULL) { DoExecLoop(NULL, exec_attr); *************** *** 1892,1934 **** return; } ! strcpy (buf, TELEPORT_ATTR); ! len = strlen (buf); ! if (buf[len-1] == '=') ! { ! sprintf (&buf[len-1], "_page#="); ! teleport_attr = FindAttrWithName (obj_ptr, buf, NULL); ! if (teleport_attr != NULL) ! { ! DoPageTeleport (teleport_attr, DO_PAGE_BY_NUM); return; } ! ! sprintf (&buf[len-1], "_page="); ! teleport_attr = FindAttrWithName (obj_ptr, buf, NULL); ! if (teleport_attr != NULL) ! { ! DoPageTeleport (teleport_attr, DO_PAGE_BY_NAME); return; } } ! launch_attr = FindAttrWithName (obj_ptr, LAUNCH_ATTR, NULL); ! if (launch_attr != NULL) { DoLaunch (launch_attr, obj_ptr); return; } ! ! exec_attr = FindAttrWithName (obj_ptr, EXEC_ATTR, NULL); DoExecLoop(obj_ptr, exec_attr); } ! void SelAllObj (high_light) ! int high_light; { ! register struct SelRec * sel_ptr; ! register struct ObjRec * obj_ptr; ! ! TieLooseEnds (); ! SetCurChoice (NOTHING); ! if (topSel!=NULL) { HighLightReverse (); RemoveAllSel (); } ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) { obj_ptr->tmp_parent = NULL; if (colorLayers && !ObjInVisibleLayer(obj_ptr)) { --- 1806,1848 ---- return; } ! strcpy(buf, TELEPORT_ATTR); ! len = strlen(buf); ! if (buf[len-1] == '=') { ! sprintf(&buf[len-1], "_page#="); ! teleport_attr = FindAttrWithName(obj_ptr, buf, NULL); ! if (teleport_attr != NULL) { ! DoPageTeleport(teleport_attr, DO_PAGE_BY_NUM); return; } ! sprintf(&buf[len-1], "_page="); ! teleport_attr = FindAttrWithName(obj_ptr, buf, NULL); ! if (teleport_attr != NULL) { ! DoPageTeleport(teleport_attr, DO_PAGE_BY_NAME); return; } } ! launch_attr = FindAttrWithName(obj_ptr, LAUNCH_ATTR, NULL); ! if (launch_attr != NULL) { ! DoLaunch(launch_attr, obj_ptr); ! return; ! } ! exec_attr = FindAttrWithName(obj_ptr, EXEC_ATTR, NULL); DoExecLoop(obj_ptr, exec_attr); } ! void SelAllObj(high_light) ! int high_light; { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr; ! TieLooseEnds(); ! SetCurChoice(NOTHING); ! if (topSel!=NULL) { ! HighLightReverse(); ! RemoveAllSel(); ! } ! for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { obj_ptr->tmp_parent = NULL; if (colorLayers && !ObjInVisibleLayer(obj_ptr)) { *************** *** 1947,1988 **** topSel = sel_ptr; } ! UpdSelBBox (); ! if (high_light) HighLightForward (); justDupped = FALSE; } ! static struct ObjRec * tmpTopObj, * tmpBotObj; static ! void PushTmpObj (ObjPtr) ! struct ObjRec * ObjPtr; { ObjPtr->next = tmpTopObj; ObjPtr->prev = NULL; ! if (tmpBotObj == NULL) tmpBotObj = ObjPtr; ! else tmpTopObj->prev = ObjPtr; ! tmpTopObj = ObjPtr; } static ! void BreakSel () /* break off selected objects from the main stream objects */ /* when returns, tmpTopObj points to the top of the selected objects */ /* and tmpBotObj points to the bottom of the selected objects */ { ! register struct SelRec * sel_ptr; ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) ! { ! UnlinkObj (sel_ptr->obj); ! PushTmpObj (sel_ptr->obj); } } ! void JustMoveSelToTop () { if (topSel == NULL) return; --- 1861,1901 ---- topSel = sel_ptr; } ! UpdSelBBox(); ! if (high_light) HighLightForward(); justDupped = FALSE; } ! static struct ObjRec *tmpTopObj=NULL, *tmpBotObj=NULL; static ! void PushTmpObj(ObjPtr) ! struct ObjRec *ObjPtr; { ObjPtr->next = tmpTopObj; ObjPtr->prev = NULL; ! if (tmpBotObj == NULL) { tmpBotObj = ObjPtr; ! } else { tmpTopObj->prev = ObjPtr; ! } tmpTopObj = ObjPtr; } static ! void BreakSel() /* break off selected objects from the main stream objects */ /* when returns, tmpTopObj points to the top of the selected objects */ /* and tmpBotObj points to the bottom of the selected objects */ { ! register struct SelRec *sel_ptr; ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { ! UnlinkObj(sel_ptr->obj); ! PushTmpObj(sel_ptr->obj); } } ! void JustMoveSelToTop() { if (topSel == NULL) return; *************** *** 1990,2113 **** tmpTopObj = tmpBotObj = NULL; ! BreakSel (); tmpBotObj->next = topObj; ! if (topObj == NULL) curPage->bot = botObj = tmpBotObj; ! else topObj->prev = tmpBotObj; curPage->top = topObj = tmpTopObj; } ! void MoveSelToTop () { if (topSel == NULL) return; ! PrepareToRecord (CMD_REPLACE, topSel, botSel, numObjSelected); ! JustMoveSelToTop (); ! RecordCmd (CMD_REPLACE, NULL, topSel, botSel, numObjSelected); } ! void MoveSelToBot () { if (topSel == NULL) return; ! PrepareToRecord (CMD_REPLACE, topSel, botSel, numObjSelected); tmpTopObj = tmpBotObj = NULL; ! BreakSel (); tmpTopObj->prev = botObj; ! if (topObj == NULL) curPage->top = topObj = tmpTopObj; ! else botObj->next = tmpTopObj; curPage->bot = botObj = tmpBotObj; ! RecordCmd (CMD_REPLACE, NULL, topSel, botSel, numObjSelected); } ! void DelAllSelObj () { ! register struct ObjRec * obj_ptr; ! register struct SelRec * sel_ptr; ! register int j, i; ! struct VSelRec * vsel_ptr; ! IntPoint * v=NULL; ! struct PolyRec * poly_ptr=NULL; ! struct PolygonRec * polygon_ptr=NULL; ! int n=0; ! short * mark; ! ! if (topSel==NULL && topVSel==NULL) { Msg ("No object selected!"); return; } ! ! HighLightReverse (); ! if (curChoice == VERTEXMODE) ! { ! StartCompositeCmd (); ! for (vsel_ptr=botVSel; vsel_ptr!=NULL; vsel_ptr=vsel_ptr->prev) ! { ! int delete_it=FALSE, extra_vertex=FALSE; ! char *smooth=NULL; obj_ptr = vsel_ptr->obj; ! PrepareToReplaceAnObj (obj_ptr); ! switch (obj_ptr->type) ! { ! case OBJ_POLY: ! poly_ptr = obj_ptr->detail.p; ! v = poly_ptr->vlist; ! n = poly_ptr->n; ! smooth = poly_ptr->smooth; ! if (vsel_ptr->n >= n-1) delete_it = TRUE; ! break; ! case OBJ_POLYGON: ! polygon_ptr = obj_ptr->detail.g; ! v = polygon_ptr->vlist; ! n = polygon_ptr->n; ! smooth = polygon_ptr->smooth; ! ! for (j=0; j < vsel_ptr->n; j++) ! if (vsel_ptr->v_index[j] == 0) ! { ! extra_vertex = TRUE; ! break; ! } ! if ((!extra_vertex && n-vsel_ptr->n <= 3) || ! (extra_vertex && n-vsel_ptr->n <= 2)) ! delete_it = TRUE; ! break; } ! if (delete_it) ! { ! struct SelRec * saved_top_sel, * saved_bot_sel; ! for (sel_ptr=botSel; sel_ptr!=NULL; sel_ptr=sel_ptr->prev) ! if (sel_ptr->obj == obj_ptr) break; ! ! if (sel_ptr->prev == NULL) topSel = sel_ptr->next; ! else sel_ptr->prev->next = sel_ptr->next; ! ! if (sel_ptr->next == NULL) botSel = sel_ptr->prev; ! else sel_ptr->next->prev = sel_ptr->prev; ! saved_top_sel = topSel; saved_bot_sel = botSel; topSel = botSel = sel_ptr; sel_ptr->next = sel_ptr->prev = NULL; ! DelObj (obj_ptr); topSel = saved_top_sel; botSel = saved_bot_sel; free(sel_ptr); ! ChangeReplaceOneCmdToDeleteCmd (); ! } ! else ! { mark = (short *)malloc(n*sizeof(short)); if (mark == NULL) FailAllocMessage(); --- 1903,2026 ---- tmpTopObj = tmpBotObj = NULL; ! BreakSel(); tmpBotObj->next = topObj; ! if (topObj == NULL) { curPage->bot = botObj = tmpBotObj; ! } else { topObj->prev = tmpBotObj; + } curPage->top = topObj = tmpTopObj; } ! void MoveSelToTop() { if (topSel == NULL) return; ! PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); ! JustMoveSelToTop(); ! RecordCmd(CMD_REPLACE, NULL, topSel, botSel, numObjSelected); } ! void MoveSelToBot() { if (topSel == NULL) return; ! PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); tmpTopObj = tmpBotObj = NULL; ! BreakSel(); tmpTopObj->prev = botObj; ! if (topObj == NULL) { curPage->top = topObj = tmpTopObj; ! } else { botObj->next = tmpTopObj; + } curPage->bot = botObj = tmpBotObj; ! RecordCmd(CMD_REPLACE, NULL, topSel, botSel, numObjSelected); } ! void DelAllSelObj() { ! register struct ObjRec *obj_ptr; ! register struct SelRec *sel_ptr; ! register int j, i; ! struct VSelRec *vsel_ptr; ! IntPoint *v=NULL; ! struct PolyRec *poly_ptr=NULL; ! struct PolygonRec *polygon_ptr=NULL; ! int n=0; ! short *mark; ! ! if (topSel==NULL && topVSel==NULL) { ! MsgBox("No object selected!", TOOL_NAME, INFO_MB); ! return; ! } ! HighLightReverse(); ! if (curChoice == VERTEXMODE) { ! StartCompositeCmd(); ! for (vsel_ptr=botVSel; vsel_ptr!=NULL; vsel_ptr=vsel_ptr->prev) { ! int delete_it=FALSE, extra_vertex=FALSE; ! char *smooth=NULL; obj_ptr = vsel_ptr->obj; ! PrepareToReplaceAnObj(obj_ptr); ! switch (obj_ptr->type) { ! case OBJ_POLY: ! poly_ptr = obj_ptr->detail.p; ! v = poly_ptr->vlist; ! n = poly_ptr->n; ! smooth = poly_ptr->smooth; ! if (vsel_ptr->n >= n-1) delete_it = TRUE; ! break; ! case OBJ_POLYGON: ! polygon_ptr = obj_ptr->detail.g; ! v = polygon_ptr->vlist; ! n = polygon_ptr->n; ! smooth = polygon_ptr->smooth; ! ! for (j=0; j < vsel_ptr->n; j++) { ! if (vsel_ptr->v_index[j] == 0) { ! extra_vertex = TRUE; ! break; ! } ! } ! if ((!extra_vertex && n-vsel_ptr->n <= 3) || ! (extra_vertex && n-vsel_ptr->n <= 2)) { ! delete_it = TRUE; ! } ! break; } ! if (delete_it) { ! struct SelRec *saved_top_sel, *saved_bot_sel; ! for (sel_ptr=botSel; sel_ptr!=NULL; sel_ptr=sel_ptr->prev) { ! if (sel_ptr->obj == obj_ptr) { break; ! } ! } ! if (sel_ptr->prev == NULL) { topSel = sel_ptr->next; ! } else { sel_ptr->prev->next = sel_ptr->next; ! } ! if (sel_ptr->next == NULL) { botSel = sel_ptr->prev; ! } else { sel_ptr->next->prev = sel_ptr->prev; ! } saved_top_sel = topSel; saved_bot_sel = botSel; topSel = botSel = sel_ptr; sel_ptr->next = sel_ptr->prev = NULL; ! DelObj(obj_ptr); topSel = saved_top_sel; botSel = saved_bot_sel; free(sel_ptr); ! ChangeReplaceOneCmdToDeleteCmd(); ! } else { mark = (short *)malloc(n*sizeof(short)); if (mark == NULL) FailAllocMessage(); *************** *** 2115,2208 **** for (j=0; j < vsel_ptr->n; j++) mark[vsel_ptr->v_index[j]] = TRUE; ! switch (obj_ptr->type) ! { ! case OBJ_POLY: ! for (i=n-1; i >= 0; i--) ! { ! if (mark[i]) ! { ! for (j=i+1; j < n; j++) { ! v[j-1] = v[j]; ! if (smooth != NULL) smooth[j-1] = smooth[j]; ! } ! if (smooth != NULL) { ! if (i == 0) { ! smooth[0] = FALSE; ! } else if (i == n-1) { ! smooth[n-2] = FALSE; ! } } - n--; } } ! poly_ptr->n -= vsel_ptr->n; ! AdjObjSplineVs (obj_ptr); ! if (poly_ptr->curved != LT_INTSPLINE) ! UpdPolyBBox (obj_ptr, poly_ptr->n, poly_ptr->vlist); ! else ! UpdPolyBBox (obj_ptr, poly_ptr->intn, poly_ptr->intvlist); ! break; ! case OBJ_POLYGON: ! for (i=n-2; i >= 0; i--) ! { ! if (mark[i]) ! { ! for (j=i+1; j < n; j++) { ! v[j-1] = v[j]; ! if (smooth != NULL) smooth[j-1] = smooth[j]; ! } ! n--; ! if (smooth != NULL && i == 0) { ! smooth[n-1] = smooth[0]; ! } } } ! polygon_ptr->n -= vsel_ptr->n; ! if (extra_vertex) v[polygon_ptr->n++] = v[0]; ! AdjObjSplineVs (obj_ptr); ! if (polygon_ptr->curved != LT_INTSPLINE) ! UpdPolyBBox (obj_ptr, polygon_ptr->n, polygon_ptr->vlist); ! else ! UpdPolyBBox (obj_ptr, polygon_ptr->intn, ! polygon_ptr->intvlist); ! break; } free(mark); ! AdjObjBBox (obj_ptr); ! RecordReplaceAnObj (obj_ptr); } } ! EndCompositeCmd (); ! JustRemoveAllVSel (); ! } ! else ! { ! PrepareToRecord (CMD_DELETE, topSel, botSel, numObjSelected); ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) ! { ! UnlinkObj (sel_ptr->obj); ! FreeObj (sel_ptr->obj); } ! RemoveAllSel (); ! RecordCmd (CMD_DELETE, NULL, NULL, NULL, 0); } ! RedrawAnArea (botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! HighLightForward (); ! SetFileModified (TRUE); justDupped = FALSE; } ! void GroupSingleObj () { tmpTopObj = tmpBotObj = NULL; ! BreakSel (); ! CreateGroupObj (tmpTopObj, tmpBotObj); ! RemoveAllSel (); if (tmpTopObj == tmpBotObj && tmpTopObj->fattr != NULL && !(tmpTopObj->type == OBJ_GROUP || tmpTopObj->type == OBJ_SYM || ! tmpTopObj->type == OBJ_ICON)) ! { struct AttrRec *attr_ptr; --- 2028,2116 ---- for (j=0; j < vsel_ptr->n; j++) mark[vsel_ptr->v_index[j]] = TRUE; ! switch (obj_ptr->type) { ! case OBJ_POLY: ! for (i=n-1; i >= 0; i--) { ! if (mark[i]) { ! for (j=i+1; j < n; j++) { ! v[j-1] = v[j]; ! if (smooth != NULL) smooth[j-1] = smooth[j]; ! } ! if (smooth != NULL) { ! if (i == 0) { ! smooth[0] = FALSE; ! } else if (i == n-1) { ! smooth[n-2] = FALSE; } } + n--; } ! } ! poly_ptr->n -= vsel_ptr->n; ! AdjObjSplineVs(obj_ptr); ! if (poly_ptr->curved != LT_INTSPLINE) { ! UpdPolyBBox(obj_ptr, poly_ptr->n, poly_ptr->vlist); ! } else { ! UpdPolyBBox(obj_ptr, poly_ptr->intn, poly_ptr->intvlist); ! } ! break; ! case OBJ_POLYGON: ! for (i=n-2; i >= 0; i--) { ! if (mark[i]) { ! for (j=i+1; j < n; j++) { ! v[j-1] = v[j]; ! if (smooth != NULL) smooth[j-1] = smooth[j]; ! } ! n--; ! if (smooth != NULL && i == 0) { ! smooth[n-1] = smooth[0]; } } ! } ! polygon_ptr->n -= vsel_ptr->n; ! if (extra_vertex) v[polygon_ptr->n++] = v[0]; ! AdjObjSplineVs(obj_ptr); ! if (polygon_ptr->curved != LT_INTSPLINE) { ! UpdPolyBBox(obj_ptr, polygon_ptr->n, polygon_ptr->vlist); ! } else { ! UpdPolyBBox(obj_ptr, polygon_ptr->intn, ! polygon_ptr->intvlist); ! } ! break; } free(mark); ! AdjObjBBox(obj_ptr); ! RecordReplaceAnObj(obj_ptr); } } ! EndCompositeCmd(); ! JustRemoveAllVSel(); ! } else { ! PrepareToRecord(CMD_DELETE, topSel, botSel, numObjSelected); ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { ! UnlinkObj(sel_ptr->obj); ! FreeObj(sel_ptr->obj); } ! RemoveAllSel(); ! RecordCmd(CMD_DELETE, NULL, NULL, NULL, 0); } ! RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! HighLightForward(); ! SetFileModified(TRUE); justDupped = FALSE; } ! void GroupSingleObj(ForcePromoteAttrs) ! int ForcePromoteAttrs; { tmpTopObj = tmpBotObj = NULL; ! BreakSel(); ! CreateGroupObj(tmpTopObj, tmpBotObj); ! RemoveAllSel(); if (tmpTopObj == tmpBotObj && tmpTopObj->fattr != NULL && + (ForcePromoteAttrs || !(tmpTopObj->type == OBJ_GROUP || tmpTopObj->type == OBJ_SYM || ! tmpTopObj->type == OBJ_ICON))) { struct AttrRec *attr_ptr; *************** *** 2222,2237 **** } ! void GroupSelObj () { ! if (topSel == NULL) { Msg ("No object to group!"); return; } ! if (curChoice==VERTEXMODE && topSel!=NULL) ! { ! Msg ("Can not group in vertex mode!"); return; } if (topSel == botSel && topSel->obj->type != OBJ_POLY && ! topSel->obj->type != OBJ_POLYGON) ! { ! Msg ("Can not group a single object! Group aborted!"); return; } --- 2130,2147 ---- } ! void GroupSelObj() { ! if (topSel == NULL) { ! Msg("No object to group!"); ! return; ! } ! if (curChoice==VERTEXMODE && topSel!=NULL) { ! MsgBox("Can not group in vertex mode!", TOOL_NAME, INFO_MB); return; } if (topSel == botSel && topSel->obj->type != OBJ_POLY && ! topSel->obj->type != OBJ_POLYGON) { ! MsgBox("Can not group a single object! Group aborted!", ! TOOL_NAME, INFO_MB); return; } *************** *** 2239,2264 **** tmpTopObj = tmpBotObj = NULL; ! HighLightReverse (); ! PrepareToRecord (CMD_REPLACE, topSel, botSel, numObjSelected); ! BreakSel (); ! CreateGroupObj (tmpTopObj, tmpBotObj); ! RemoveAllSel (); topSel = botSel = (struct SelRec *)malloc(sizeof(struct SelRec)); if (topSel == NULL) FailAllocMessage(); topSel->obj = topObj; topSel->next = topSel->prev = NULL; ! UpdSelBBox (); ! RecordCmd (CMD_MANY_TO_ONE, NULL, topSel, botSel, 1); ! RedrawAnArea (botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! HighLightForward (); ! SetFileModified (TRUE); justDupped = FALSE; } ! void SelectTopObj () { if (topObj == NULL) return; --- 2149,2174 ---- tmpTopObj = tmpBotObj = NULL; ! HighLightReverse(); ! PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); ! BreakSel(); ! CreateGroupObj(tmpTopObj, tmpBotObj); ! RemoveAllSel(); topSel = botSel = (struct SelRec *)malloc(sizeof(struct SelRec)); if (topSel == NULL) FailAllocMessage(); topSel->obj = topObj; topSel->next = topSel->prev = NULL; ! UpdSelBBox(); ! RecordCmd(CMD_MANY_TO_ONE, NULL, topSel, botSel, 1); ! RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! HighLightForward(); ! SetFileModified(TRUE); justDupped = FALSE; } ! void SelectTopObj() { if (topObj == NULL) return; *************** *** 2268,2274 **** topSel->obj = topObj; topSel->next = topSel->prev = NULL; ! UpdSelBBox (); ! HighLightForward (); justDupped = FALSE; } --- 2178,2184 ---- topSel->obj = topObj; topSel->next = topSel->prev = NULL; ! UpdSelBBox(); ! HighLightForward(); justDupped = FALSE; } *** setup.c.orig Tue Sep 30 13:24:03 1997 --- setup.c Tue Sep 30 13:24:03 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/setup.c,v 3.15 1997/01/30 17:27:22 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/setup.c,v 3.22 1997/09/17 01:40:59 william Exp $ */ #include *************** *** 46,49 **** --- 44,48 ---- #include "color.e" #include "cursor.e" + #include "dialog.e" #include "drawing.e" #include "dup.e" *************** *** 238,242 **** static int canvasWindowOnly=FALSE; ! void UpdDrawWinWH () { drawWinW = ABS_SIZE(initDrawWinW); --- 237,241 ---- static int canvasWindowOnly=FALSE; ! void UpdDrawWinWH() { drawWinW = ABS_SIZE(initDrawWinW); *************** *** 244,248 **** } ! void UpdDrawWinBBox () { drawWinBBox.ltx = drawOrigX; --- 243,247 ---- } ! void UpdDrawWinBBox() { drawWinBBox.ltx = drawOrigX; *************** *** 255,271 **** static ! void CalcStatusSubWinGeom () { ! register int i; ! int left=0, w=(int)(statusWindowW/3), win_y, right=0, win_h; ! if (defaultFontHeight+(brdrW<<1)+2 > btn1_height) win_y = 1; ! else win_y = (statusWindowH-defaultFontHeight-(brdrW<<1)-2)>>1; win_h = statusWindowH-(win_y<<1)-2; ! for (i=0; i < MAX_STATUS_BTNS; i++) ! { ! int win_x, win_w; right += w; --- 254,270 ---- static ! void CalcStatusSubWinGeom() { ! register int i; ! int left=0, w=(int)(statusWindowW/3), win_y, right=0, win_h; ! if (defaultFontHeight+(brdrW<<1)+2 > btn1_height) { win_y = 1; ! } else { win_y = (statusWindowH-defaultFontHeight-(brdrW<<1)-2)>>1; + } win_h = statusWindowH-(win_y<<1)-2; ! for (i=0; i < MAX_STATUS_BTNS; i++) { ! int win_x, win_w; right += w; *************** *** 283,287 **** static ! void InitWinSizes () { initDrawWinW = drawWinW; --- 282,286 ---- static ! void InitWinSizes() { initDrawWinW = drawWinW; *************** *** 293,297 **** titleWindowW = drawWinW+rulerW+brdrW+scrollBarW+(brdrW<<1); menubarWindowW = statusWindowW = titleWindowW; ! CalcMenubarWindowHeight (); msgWindowW = titleWindowW-choiceWindowW-(brdrW<<1); mainWinW = titleWindowW+(brdrW<<1); --- 292,296 ---- titleWindowW = drawWinW+rulerW+brdrW+scrollBarW+(brdrW<<1); menubarWindowW = statusWindowW = titleWindowW; ! CalcMenubarWindowHeight(); msgWindowW = titleWindowW-choiceWindowW-(brdrW<<1); mainWinW = titleWindowW+(brdrW<<1); *************** *** 301,314 **** titleWindowH+choiceWindowH+vSBarH+scrollBarW+8*brdrW; if (colorLayers) vSBarH = DEF_VSBAR_H; ! CalcStatusSubWinGeom (); } static ! void InverseInitWinSizes () /* derive other win sizes from mainWinW and mainWinH */ { titleWindowW = mainWinW-(brdrW<<1); menubarWindowW = statusWindowW = titleWindowW; ! CalcMenubarWindowHeight (); msgWindowW = titleWindowW-choiceWindowW-(brdrW<<1); vSBarH = mainWinH - titleWindowH - choiceWindowH - scrollBarW - 8*brdrW - --- 300,313 ---- titleWindowH+choiceWindowH+vSBarH+scrollBarW+8*brdrW; if (colorLayers) vSBarH = DEF_VSBAR_H; ! CalcStatusSubWinGeom(); } static ! void InverseInitWinSizes() /* derive other win sizes from mainWinW and mainWinH */ { titleWindowW = mainWinW-(brdrW<<1); menubarWindowW = statusWindowW = titleWindowW; ! CalcMenubarWindowHeight(); msgWindowW = titleWindowW-choiceWindowW-(brdrW<<1); vSBarH = mainWinH - titleWindowH - choiceWindowH - scrollBarW - 8*brdrW - *************** *** 320,389 **** colorWindowH = drawWinH+rulerW-DEF_VSBAR_H-colorDummyWindowH; if (colorLayers) vSBarH = DEF_VSBAR_H; ! CalcMenubarWindowHeight (); ! CalcStatusSubWinGeom (); } ! void ComputeMainWinXY (MainWinX, MainWinY) ! int * MainWinX, * MainWinY; { ! int win_x, win_y, done = FALSE; ! unsigned int win_w, win_h, win_brdr_w, win_d, num_child; ! Window win = mainWindow, root_win, parent_win, * child_wins; *MainWinX = *MainWinY = 0; ! while (!done) ! { ! XGetGeometry (mainDisplay, win, &root_win, &win_x, &win_y, &win_w, &win_h, &win_brdr_w, &win_d); *MainWinX += win_x; *MainWinY += win_y; ! if (XQueryTree (mainDisplay, win, &root_win, &parent_win, &child_wins, ! &num_child) == 0) return; ! if (child_wins != NULL) XFree ((void *)child_wins); ! if (parent_win == rootWindow) done = TRUE; ! else win = parent_win; } } ! void Reconfigure (Forced) ! int Forced; { ! register int i; ! Window root_win; ! int win_x, win_y, main_win_x, main_win_y; ! unsigned int win_w, win_h, win_brdr_w, win_d; ! XEvent ev; ! ComputeMainWinXY (&main_win_x, &main_win_y); ! XGetGeometry (mainDisplay, mainWindow, &root_win, &win_x, &win_y, &win_w, &win_h, &win_brdr_w, &win_d); ! if (!Forced && win_w == mainWinW && win_h == mainWinH) ! { ! SaveStackingOrder (); ! if (pinnedMainMenu) ! MoveMainMenuWindow (main_win_x, main_win_y); ! else ! SaveMainWinPosition (main_win_x, main_win_y); ! for (i = 0; i < numExtraWins; i++) if (extraWinInfo[i].mapped && extraWinInfo[i].raise && ! extraWinInfo[i].window != None) ! MoveSubMenuWindow (extraWinInfo[i].window); ! for (i = 0; i < numStacking; i++) ! XMapRaised (mainDisplay, stackingWins[i]); ! ! while (XCheckWindowEvent (mainDisplay, mainWindow, VisibilityChangeMask | StructureNotifyMask, &ev)) ; ! XFlush (mainDisplay); return; } ! if (!Forced && !iconWindowShown) ! { ! SaveStackingOrder (); ! for (i = 0; i < numStacking; i++) ! XMapRaised (mainDisplay, stackingWins[i]); } --- 319,391 ---- colorWindowH = drawWinH+rulerW-DEF_VSBAR_H-colorDummyWindowH; if (colorLayers) vSBarH = DEF_VSBAR_H; ! CalcMenubarWindowHeight(); ! CalcStatusSubWinGeom(); } ! void ComputeMainWinXY(MainWinX, MainWinY) ! int *MainWinX, *MainWinY; { ! int win_x, win_y, done = FALSE; ! unsigned int win_w, win_h, win_brdr_w, win_d, num_child; ! Window win=mainWindow, root_win, parent_win, *child_wins; *MainWinX = *MainWinY = 0; ! while (!done) { ! XGetGeometry(mainDisplay, win, &root_win, &win_x, &win_y, &win_w, &win_h, &win_brdr_w, &win_d); *MainWinX += win_x; *MainWinY += win_y; ! if (XQueryTree(mainDisplay, win, &root_win, &parent_win, &child_wins, ! &num_child) == 0) { return; ! } ! if (child_wins != NULL) XFree((void *)child_wins); ! if (parent_win == rootWindow) { done = TRUE; ! } else { win = parent_win; + } } } ! void Reconfigure(Forced) ! int Forced; { ! register int i; ! Window root_win; ! int win_x, win_y, main_win_x, main_win_y; ! unsigned int win_w, win_h, win_brdr_w, win_d; ! XEvent ev; ! ComputeMainWinXY(&main_win_x, &main_win_y); ! XGetGeometry(mainDisplay, mainWindow, &root_win, &win_x, &win_y, &win_w, &win_h, &win_brdr_w, &win_d); ! if (!Forced && win_w == mainWinW && win_h == mainWinH) { ! SaveStackingOrder(); ! if (pinnedMainMenu) { ! MoveMainMenuWindow(main_win_x, main_win_y); ! } else { ! SaveMainWinPosition(main_win_x, main_win_y); ! } ! for (i = 0; i < numExtraWins; i++) { if (extraWinInfo[i].mapped && extraWinInfo[i].raise && ! extraWinInfo[i].window != None) { ! MoveSubMenuWindow(extraWinInfo[i].window); ! } ! } ! for (i = 0; i < numStacking; i++) { ! XMapRaised(mainDisplay, stackingWins[i]); ! } ! while (XCheckWindowEvent(mainDisplay, mainWindow, VisibilityChangeMask | StructureNotifyMask, &ev)) ; ! XFlush(mainDisplay); return; } ! if (!Forced && !iconWindowShown) { ! SaveStackingOrder(); ! for (i = 0; i < numStacking; i++) { ! XMapRaised(mainDisplay, stackingWins[i]); ! } } *************** *** 392,403 **** menubarWindowW = mainWinW - (brdrW<<1); ! CalcMenubarWindowHeight (); ! if (canvasWindowOnly) ! { initDrawWinW = mainWinW-(brdrW<<1); initDrawWinH = mainWinH-(brdrW<<1); ! } ! else ! { initDrawWinW = mainWinW - rulerW - scrollBarW - 6*brdrW; initDrawWinH = mainWinH - titleWindowH - --- 394,402 ---- menubarWindowW = mainWinW - (brdrW<<1); ! CalcMenubarWindowHeight(); ! if (canvasWindowOnly) { initDrawWinW = mainWinW-(brdrW<<1); initDrawWinH = mainWinH-(brdrW<<1); ! } else { initDrawWinW = mainWinW - rulerW - scrollBarW - 6*brdrW; initDrawWinH = mainWinH - titleWindowH - *************** *** 413,534 **** titleWindowW = initDrawWinW + rulerW + scrollBarW + (brdrW<<2); menubarWindowW = statusWindowW = titleWindowW; ! CalcMenubarWindowHeight (); msgWindowW = titleWindowW - choiceWindowW - (brdrW<<1); ! CalcStatusSubWinGeom (); ! if (canvasWindowOnly) ! XResizeWindow (mainDisplay, drawWindow, drawWinW, drawWinH); ! else ! { ! int cur_y=0; ! XResizeWindow (mainDisplay, titleWindow, titleWindowW, titleWindowH); cur_y += titleWindowH + (brdrW<<1); ! if (!noMenubar) ! { ! XResizeWindow (mainDisplay, menubarWindow, menubarWindowW, menubarWindowH); cur_y += menubarWindowH + (brdrW<<1); } ! XMoveResizeWindow (mainDisplay, msgWindow, 0, cur_y, msgWindowW, msgWindowH); ! XMoveWindow (mainDisplay, choiceWindow, msgWindowW+(brdrW<<1), cur_y); cur_y += choiceWindowH + (brdrW<<1); ! XMoveResizeWindow (mainDisplay, dummyWindow1, 0, cur_y, drawWinW, rulerW); ! XMoveResizeWindow (mainDisplay, hRuleWindow, rulerW+(brdrW<<1), cur_y, drawWinW, rulerW); if (colorLayers) { ! XMoveResizeWindow (mainDisplay, colorWindow, drawWinW+rulerW+(brdrW<<2), cur_y, scrollBarW, colorWindowH); ! XMoveWindow (mainDisplay, colorDummyWindow, drawWinW+rulerW+(brdrW<<2), cur_y+colorWindowH+(brdrW<<1)); ! XMoveResizeWindow (mainDisplay, vSBarWindow, drawWinW+rulerW+(brdrW<<2), cur_y+colorWindowH+colorDummyWindowH+(brdrW<<2), scrollBarW, DEF_VSBAR_H); } else { ! XMoveResizeWindow (mainDisplay, vSBarWindow, drawWinW+rulerW+(brdrW<<2), cur_y, scrollBarW, vSBarH); } cur_y += rulerW + (brdrW<<1); ! XMoveResizeWindow (mainDisplay, vRuleWindow, 0, cur_y, rulerW, drawWinH); ! XMoveResizeWindow (mainDisplay, drawWindow, rulerW+(brdrW<<1), cur_y, drawWinW, drawWinH); cur_y += drawWinH + (brdrW<<1); ! XMoveResizeWindow (mainDisplay, pageWindow, 0, cur_y, pageWindowW, scrollBarW+(brdrW<<1)); ! XMoveWindow (mainDisplay, pageDummyWindow, pageWindowW, cur_y); ! XMoveWindow (mainDisplay, hSBarWindow, pageWindowW+pageDummyWindowW+(brdrW<<1), cur_y); ! XMoveWindow (mainDisplay, dummyWindow2, drawWinW+rulerW+(brdrW<<2), cur_y); cur_y += scrollBarW + (brdrW<<1); ! if (!noStatusWindow) ! { ! XMoveResizeWindow (mainDisplay, statusWindow, 0, cur_y, statusWindowW, statusWindowH); ! for (i=0; i < MAX_STATUS_BTNS; i++) ! XMoveResizeWindow (mainDisplay, statusSubWindow[i], statusSubWindowX[i], statusSubWindowY[i], statusSubWindowW[i], statusSubWindowH[i]); } } ! UpdDrawWinWH (); ! UpdDrawWinBBox (); ! UpdScrollWinWH (); ! SetDefaultDrawWinClipRecs (); ! SaveMainWinPosition (main_win_x, main_win_y); } ! int mainWinEventHandler (input) ! XEvent * input; { ! register int i; ! int configure = FALSE; ! char * c_ptr, msg[MAXSTRING]; ! ! if (input->type == UnmapNotify) ! Iconify (); ! else if (input->type == MapNotify) ! UnIconify (); ! else if (input->type == ConfigureNotify) configure = TRUE; ! else if (input->type == VisibilityNotify && ! input->xvisibility.state == VisibilityUnobscured) ! { ! if (iconWindowShown) ! UnIconify (); ! else ! { ! SaveStackingOrder (); ! for (i = 0; i < numStacking; i++) ! XMapRaised (mainDisplay, stackingWins[i]); ! } ! } ! else if (input->type == ClientMessage) ! { ! c_ptr = XGetAtomName (mainDisplay, input->xclient.message_type); ! if (strcmp ("WM_MOVED", c_ptr) == 0) configure = TRUE; ! else if (strcmp ("WM_PROTOCOLS", c_ptr) == 0 && ! input->xclient.data.l[0] == protocolAtom) ! return (QuitProc ()); ! else ! { ! sprintf (msg, "mainWindow ClientMessage: '%s'.", c_ptr); ! Msg (msg); } ! XFree ((void *)c_ptr); } ! if (configure) Reconfigure (FALSE); if (showCrossHair) { SetNullCursor(drawWindow); } ! return (INVALID); } ! void InitPaperSize () { psYOffStr = (char**)malloc(MAXPAGESTYLES*sizeof(char *)); --- 412,527 ---- titleWindowW = initDrawWinW + rulerW + scrollBarW + (brdrW<<2); menubarWindowW = statusWindowW = titleWindowW; ! CalcMenubarWindowHeight(); msgWindowW = titleWindowW - choiceWindowW - (brdrW<<1); ! CalcStatusSubWinGeom(); ! if (canvasWindowOnly) { ! XResizeWindow(mainDisplay, drawWindow, drawWinW, drawWinH); ! } else { ! int cur_y=0; ! XResizeWindow(mainDisplay, titleWindow, titleWindowW, titleWindowH); cur_y += titleWindowH + (brdrW<<1); ! if (!noMenubar) { ! XResizeWindow(mainDisplay, menubarWindow, menubarWindowW, menubarWindowH); cur_y += menubarWindowH + (brdrW<<1); } ! XMoveResizeWindow(mainDisplay, msgWindow, 0, cur_y, msgWindowW, msgWindowH); ! XMoveWindow(mainDisplay, choiceWindow, msgWindowW+(brdrW<<1), cur_y); cur_y += choiceWindowH + (brdrW<<1); ! XMoveResizeWindow(mainDisplay, dummyWindow1, 0, cur_y, drawWinW, rulerW); ! XMoveResizeWindow(mainDisplay, hRuleWindow, rulerW+(brdrW<<1), cur_y, drawWinW, rulerW); if (colorLayers) { ! XMoveResizeWindow(mainDisplay, colorWindow, drawWinW+rulerW+(brdrW<<2), cur_y, scrollBarW, colorWindowH); ! XMoveWindow(mainDisplay, colorDummyWindow, drawWinW+rulerW+(brdrW<<2), cur_y+colorWindowH+(brdrW<<1)); ! XMoveResizeWindow(mainDisplay, vSBarWindow, drawWinW+rulerW+(brdrW<<2), cur_y+colorWindowH+colorDummyWindowH+(brdrW<<2), scrollBarW, DEF_VSBAR_H); } else { ! XMoveResizeWindow(mainDisplay, vSBarWindow, drawWinW+rulerW+(brdrW<<2), cur_y, scrollBarW, vSBarH); } cur_y += rulerW + (brdrW<<1); ! XMoveResizeWindow(mainDisplay, vRuleWindow, 0, cur_y, rulerW, drawWinH); ! XMoveResizeWindow(mainDisplay, drawWindow, rulerW+(brdrW<<1), cur_y, drawWinW, drawWinH); cur_y += drawWinH + (brdrW<<1); ! XMoveResizeWindow(mainDisplay, pageWindow, 0, cur_y, pageWindowW, scrollBarW+(brdrW<<1)); ! XMoveWindow(mainDisplay, pageDummyWindow, pageWindowW, cur_y); ! XMoveWindow(mainDisplay, hSBarWindow, pageWindowW+pageDummyWindowW+(brdrW<<1), cur_y); ! XMoveWindow(mainDisplay, dummyWindow2, drawWinW+rulerW+(brdrW<<2), cur_y); cur_y += scrollBarW + (brdrW<<1); ! if (!noStatusWindow) { ! XMoveResizeWindow(mainDisplay, statusWindow, 0, cur_y, statusWindowW, statusWindowH); ! for (i=0; i < MAX_STATUS_BTNS; i++) { ! XMoveResizeWindow(mainDisplay, statusSubWindow[i], statusSubWindowX[i], statusSubWindowY[i], statusSubWindowW[i], statusSubWindowH[i]); + } } } ! UpdDrawWinWH(); ! UpdDrawWinBBox(); ! UpdScrollWinWH(); ! SetDefaultDrawWinClipRecs(); ! SaveMainWinPosition(main_win_x, main_win_y); } ! int mainWinEventHandler(input) ! XEvent *input; { ! register int i; ! int configure=FALSE; ! char *c_ptr, msg[MAXSTRING]; ! ! if (input->type == UnmapNotify) { ! Iconify(); ! } else if (input->type == MapNotify) { ! UnIconify(); ! } else if (input->type == ConfigureNotify) { configure = TRUE; ! } else if (input->type == VisibilityNotify && ! input->xvisibility.state == VisibilityUnobscured) { ! if (iconWindowShown) { ! UnIconify(); ! } else { ! SaveStackingOrder(); ! for (i = 0; i < numStacking; i++) { ! XMapRaised(mainDisplay, stackingWins[i]); ! } ! } ! } else if (input->type == ClientMessage) { ! c_ptr = XGetAtomName(mainDisplay, input->xclient.message_type); ! if (strcmp("WM_MOVED", c_ptr) == 0) { configure = TRUE; ! } else if (strcmp("WM_PROTOCOLS", c_ptr) == 0 && ! input->xclient.data.l[0] == protocolAtom) { ! return QuitProc(); ! } else { ! sprintf(msg, "mainWindow ClientMessage: '%s'.", c_ptr); ! Msg(msg); } ! XFree((void *)c_ptr); } ! if (configure) Reconfigure(FALSE); if (showCrossHair) { SetNullCursor(drawWindow); } ! return INVALID; } ! void InitPaperSize() { psYOffStr = (char**)malloc(MAXPAGESTYLES*sizeof(char *)); *************** *** 537,543 **** psYOffStr[1] = (char*)malloc(2*sizeof(char)); if (psYOffStr[0] == NULL || psYOffStr[1] == NULL) FailAllocMessage(); ! sprintf (psYOffStr[0], "%.2f", (float)(((float)onePageHeight)/((float)PIX_PER_INCH))); ! sprintf (psYOffStr[1], "0"); psYOff = (float*)malloc(MAXPAGESTYLES*sizeof(float)); if (psYOff == NULL) FailAllocMessage(); --- 530,536 ---- psYOffStr[1] = (char*)malloc(2*sizeof(char)); if (psYOffStr[0] == NULL || psYOffStr[1] == NULL) FailAllocMessage(); ! sprintf(psYOffStr[0], "%.2f", (float)(((float)onePageHeight)/((float)PIX_PER_INCH))); ! sprintf(psYOffStr[1], "0"); psYOff = (float*)malloc(MAXPAGESTYLES*sizeof(float)); if (psYOff == NULL) FailAllocMessage(); *************** *** 554,565 **** } ! void CleanUpPaperSize () { ! free(psPageHeightInInch); ! free(psPageWidthInInch); ! free(psYOff); ! free(psYOffStr[0]); ! free(psYOffStr[1]); ! free(psYOffStr); psYOffStr = NULL; psYOff = psPageWidthInInch = psPageHeightInInch = NULL; --- 547,560 ---- } ! void CleanUpPaperSize() { ! if (psPageHeightInInch != NULL) free(psPageHeightInInch); ! if (psPageWidthInInch != NULL) free(psPageWidthInInch); ! if (psYOff != NULL) free(psYOff); ! if (psYOffStr != NULL) { ! free(psYOffStr[0]); ! free(psYOffStr[1]); ! free(psYOffStr); ! } psYOffStr = NULL; psYOff = psPageWidthInInch = psPageHeightInInch = NULL; *************** *** 620,637 **** } ! void Setup () { ! int bitmask = 0, x_neg_in_def = FALSE, y_neg_in_def = FALSE; ! int x_in_cmdline=FALSE, y_in_cmdline=FALSE, cur_y=0, i; ! char * c_ptr; ! int def_x_neg = 0, def_y_neg = 0, paper_size_set; ! XWMHints wmhints; ! XSizeHints sizehints; *homeDir = *bootDir = '\0'; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "Synchronize")) != NULL) ! if ((strcmp (c_ptr, "on") == 0) || (strcmp (c_ptr, "On") == 0)) ! XSynchronize (mainDisplay, True); ! showVersion = FALSE; if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "DontShowVersion")) != NULL && --- 615,633 ---- } ! void Setup() { ! int bitmask=0, x_neg_in_def=FALSE, y_neg_in_def=FALSE; ! int x_in_cmdline=FALSE, y_in_cmdline=FALSE, cur_y=0, i; ! char *c_ptr; ! int def_x_neg=0, def_y_neg=0, paper_size_set; ! XWMHints wmhints; ! XSizeHints sizehints; *homeDir = *bootDir = '\0'; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "Synchronize")) != NULL) { ! if (UtilStrICmp(c_ptr, "on") == 0) { ! XSynchronize(mainDisplay, True); ! } ! } showVersion = FALSE; if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "DontShowVersion")) != NULL && *************** *** 640,845 **** } ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "PrintCommand")) != NULL) ! strcpy (printCommand, c_ptr); ! else #ifdef PRINT_CMD ! strcpy (printCommand, PRINT_CMD); #else #ifdef VMS ! strcpy (printCommand, "print"); #else #ifdef SYSV ! strcpy (printCommand, "lp -dpostscript"); #else ! strcpy (printCommand, "lpr"); #endif /* SYSV */ #endif /* VMS */ #endif /* PRINT_CMD */ ! ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "PrintDirectory")) != NULL) ! strcpy (outputDir, c_ptr); ! else ! *outputDir = '\0'; ! ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "WhereToPrint")) != NULL) ! { ! if (strcmp (c_ptr, "Printer") == 0) whereToPrint = PRINTER; ! else if (strcmp (c_ptr, "EPS") == 0) whereToPrint = LATEX_FIG; ! else if (strcmp (c_ptr, "PS") == 0) whereToPrint = PS_FILE; ! else if (strcmp (c_ptr, "Bitmap") == 0) whereToPrint = XBM_FILE; ! else if (strcmp (c_ptr, "Text") == 0) whereToPrint = TEXT_FILE; ! else if (strcmp (c_ptr, "EPSI") == 0) whereToPrint = EPSI_FILE; ! else if (strcmp (c_ptr, "GIF") == 0) whereToPrint = GIF_FILE; ! else if (strcmp (c_ptr, "HTML") == 0) whereToPrint = HTML_FILE; ! else ! fprintf (stderr, "Unrecognized WhereToPrint: %s\n", c_ptr); } - useGray = FALSE; ! if ((c_ptr = XGetDefault (mainDisplay,TOOL_NAME,"UseGrayScale")) != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) useGray = TRUE; } - autoPan = TRUE; ! if ((c_ptr = XGetDefault (mainDisplay,TOOL_NAME,"AutoPanInEditText")) != ! NULL) ! { ! if (strcmp ("false", c_ptr) == 0 || strcmp ("False", c_ptr) == 0) autoPan = FALSE; } - moveMode = UNCONST_MOVE; ! if ((c_ptr = XGetDefault (mainDisplay,TOOL_NAME,"ConstrainedMove")) != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) moveMode = CONST_MOVE; } - doubleQuoteDoubleQuote = FALSE; ! if ((c_ptr = XGetDefault (mainDisplay,TOOL_NAME,"DoubleQuoteDoubleQuote")) ! != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) doubleQuoteDoubleQuote = TRUE; } ! ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "GridSystem")) != NULL) ! { ! if (strcmp ("English", c_ptr) == 0 || strcmp ("english", c_ptr) == 0) ! gridSystem = ENGLISH_GRID; ! else if (strcmp ("Metric", c_ptr) == 0 || strcmp ("metric", c_ptr) == 0) gridSystem = METRIC_GRID; } ! ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "InitialGrid")) != NULL) ! { ! int grid_size = atoi (c_ptr); ! ! switch (gridSystem) ! { ! case ENGLISH_GRID: ! if (grid_size < -2 || grid_size > 2) ! fprintf (stderr, "Invalid %s*InitialGrid: '%s', 0 is used.\n", ! TOOL_NAME, c_ptr); ! else ! xyEnglishGrid = HALF_INCH>>(2-grid_size); ! break; ! case METRIC_GRID: ! if (grid_size < -1 || grid_size > 2) ! fprintf (stderr, "Invalid %s*InitialGrid: '%s', 0 is used.\n", ! TOOL_NAME, c_ptr); ! else ! switch (grid_size) ! { ! case -1: xyMetricGrid = ONE_MM; break; ! case 0: xyMetricGrid = TWO_MM; break; ! case 1: xyMetricGrid = FIVE_MM; break; ! case 2: xyMetricGrid = ONE_CM; break; ! } ! break; } } - splineTol = 9; ! if ((c_ptr = XGetDefault (mainDisplay,TOOL_NAME,"SplineTolerance")) != NULL) ! { ! splineTol = atoi (c_ptr); ! if (splineTol < 3 || splineTol > 13) ! { ! fprintf (stderr, "Invalid %s*SplineTolerance: '%s', 9 is used.\n", TOOL_NAME, c_ptr); splineTol = 9; } } - splineRubberband = TRUE; ! if ((c_ptr = XGetDefault (mainDisplay,TOOL_NAME,"SplineRubberband")) != NULL) ! if ((strcmp (c_ptr, "false") == 0) || (strcmp (c_ptr, "False") == 0)) splineRubberband = FALSE; ! saveTmpOnReturn = TRUE; ! if ((c_ptr = XGetDefault (mainDisplay,TOOL_NAME,"SaveTmpOnReturn")) != NULL) ! if ((strcmp (c_ptr, "false") == 0) || (strcmp (c_ptr, "False") == 0)) saveTmpOnReturn = FALSE; ! dropObsIconAttrWhenUpdate = FALSE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, ! "DropObsIconAttrWhenUpdate")) != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) dropObsIconAttrWhenUpdate = TRUE; } - useRecentDupDistance = TRUE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, ! "UseRecentDupDistance")) != NULL) ! { ! if (strcmp ("false", c_ptr) == 0 || strcmp ("False", c_ptr) == 0) useRecentDupDistance = FALSE; } - handleSize = 3; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "HandleSize")) != NULL) ! { ! handleSize = atoi (c_ptr); ! if (handleSize < 2 || handleSize > 6) ! { ! fprintf (stderr, "Invalid %s*HandleSize: '%s', 3 is used.\n", TOOL_NAME, c_ptr); handleSize = 3; } } - historyDepth = -1; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "HistoryDepth")) != NULL) ! historyDepth = atoi (c_ptr); defaultHistoryDepth = historyDepth; canvasWindowOnly = FALSE; ! if (cmdLineCWO) canvasWindowOnly = TRUE; ! else if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"CanvasWindowOnly")) != ! NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) canvasWindowOnly = TRUE; } - saveCommentsInSaveNew = TRUE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, ! "SaveCommentsInSaveNew")) != NULL) ! { ! if (strcmp ("false", c_ptr) == 0 || strcmp ("False", c_ptr) == 0) saveCommentsInSaveNew = FALSE; } - usePsAdobeString = FALSE; *adobeString = '\0'; *epsfString = '\0'; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, ! "UsePsAdobeString")) != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) usePsAdobeString = TRUE; ! else ! { ! char tmp_str[80]; ! strcpy (tmp_str, c_ptr); if (!ParsePsAdobeString(tmp_str, &usePsAdobeString, adobeString, ! epsfString)) ! { ! fprintf (stderr, "%s %s*UsePsAdobeString: '%s', %s.\n", "Invalid", TOOL_NAME, tmp_str, "'false' is used"); usePsAdobeString = FALSE; --- 636,824 ---- } ! *printCommand = '\0'; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "PrintCommand")) != NULL) { ! strcpy(printCommand, c_ptr); ! } else { #ifdef PRINT_CMD ! strcpy(printCommand, PRINT_CMD); #else #ifdef VMS ! strcpy(printCommand, "print"); #else #ifdef SYSV ! strcpy(printCommand, "lp -dpostscript"); #else ! strcpy(printCommand, "lpr"); #endif /* SYSV */ #endif /* VMS */ #endif /* PRINT_CMD */ ! } ! *outputDir = '\0'; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "PrintDirectory")) != NULL) { ! strcpy(outputDir, c_ptr); ! } ! whereToPrint = LATEX_FIG; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "WhereToPrint")) != NULL) { ! if (UtilStrICmp(c_ptr, "Printer") == 0) { whereToPrint = PRINTER; ! } else if (UtilStrICmp(c_ptr, "EPS") == 0) { whereToPrint = LATEX_FIG; ! } else if (UtilStrICmp(c_ptr, "PS") == 0) { whereToPrint = PS_FILE; ! } else if (UtilStrICmp(c_ptr, "Bitmap") == 0) { whereToPrint = XBM_FILE; ! } else if (UtilStrICmp(c_ptr, "Text") == 0) { whereToPrint = TEXT_FILE; ! } else if (UtilStrICmp(c_ptr, "EPSI") == 0) { whereToPrint = EPSI_FILE; ! } else if (UtilStrICmp(c_ptr, "GIF") == 0) { whereToPrint = GIF_FILE; ! } else if (UtilStrICmp(c_ptr, "HTML") == 0) { whereToPrint = HTML_FILE; ! } else { ! fprintf(stderr, "Invalid %s.WhereToPrint: '%s', 'EPS' is used.\n", ! TOOL_NAME, c_ptr); ! } } useGray = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"UseGrayScale")) != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { useGray = TRUE; + } } autoPan = TRUE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"AutoPanInEditText")) != NULL) { ! if (UtilStrICmp("false", c_ptr) == 0) { autoPan = FALSE; + } } moveMode = UNCONST_MOVE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ConstrainedMove")) != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { moveMode = CONST_MOVE; + } } doubleQuoteDoubleQuote = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"DoubleQuoteDoubleQuote")) ! != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { doubleQuoteDoubleQuote = TRUE; + } } ! gridSystem = ENGLISH_GRID; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "GridSystem")) != NULL) { ! if (UtilStrICmp("Metric", c_ptr) == 0) { gridSystem = METRIC_GRID; + } } ! xyEnglishGrid = DEFAULT_ENGLISH_GRID; ! xyMetricGrid = DEFAULT_METRIC_GRID; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "InitialGrid")) != NULL) { ! int grid_size=atoi(c_ptr); ! ! switch (gridSystem) { ! case ENGLISH_GRID: ! if (grid_size < -2 || grid_size > 2) { ! fprintf(stderr, "Invalid %s*InitialGrid: '%s', 0 is used.\n", ! TOOL_NAME, c_ptr); ! } else { ! xyEnglishGrid = HALF_INCH>>(2-grid_size); ! } ! break; ! case METRIC_GRID: ! if (grid_size < -1 || grid_size > 2) { ! fprintf(stderr, "Invalid %s*InitialGrid: '%s', 0 is used.\n", ! TOOL_NAME, c_ptr); ! } else { ! switch (grid_size) { ! case -1: xyMetricGrid = ONE_MM; break; ! case 0: xyMetricGrid = TWO_MM; break; ! case 1: xyMetricGrid = FIVE_MM; break; ! case 2: xyMetricGrid = ONE_CM; break; ! } ! } ! break; } } splineTol = 9; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"SplineTolerance")) != NULL) { ! splineTol = atoi(c_ptr); ! if (splineTol < 3 || splineTol > 13) { ! fprintf(stderr, "Invalid %s*SplineTolerance: '%s', 9 is used.\n", TOOL_NAME, c_ptr); splineTol = 9; } } splineRubberband = TRUE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"SplineRubberband")) != NULL) { ! if (UtilStrICmp(c_ptr, "false") == 0) { splineRubberband = FALSE; ! } ! } saveTmpOnReturn = TRUE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"SaveTmpOnReturn")) != NULL) { ! if (UtilStrICmp(c_ptr, "false") == 0) { saveTmpOnReturn = FALSE; ! } ! } dropObsIconAttrWhenUpdate = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, ! "DropObsIconAttrWhenUpdate")) != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { dropObsIconAttrWhenUpdate = TRUE; + } } useRecentDupDistance = TRUE; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, ! "UseRecentDupDistance")) != NULL) { ! if (UtilStrICmp("false", c_ptr) == 0) { useRecentDupDistance = FALSE; + } } handleSize = 3; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "HandleSize")) != NULL) { ! handleSize = atoi(c_ptr); ! if (handleSize < 2 || handleSize > 6) { ! fprintf(stderr, "Invalid %s*HandleSize: '%s', 3 is used.\n", TOOL_NAME, c_ptr); handleSize = 3; } } historyDepth = -1; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "HistoryDepth")) != NULL) { ! historyDepth = atoi(c_ptr); ! } defaultHistoryDepth = historyDepth; canvasWindowOnly = FALSE; ! if (cmdLineCWO) { canvasWindowOnly = TRUE; ! } else if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"CanvasWindowOnly")) != ! NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { canvasWindowOnly = TRUE; + } } saveCommentsInSaveNew = TRUE; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, ! "SaveCommentsInSaveNew")) != NULL) { ! if (UtilStrICmp("false", c_ptr) == 0 ) { saveCommentsInSaveNew = FALSE; + } } usePsAdobeString = FALSE; *adobeString = '\0'; *epsfString = '\0'; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"UsePsAdobeString")) != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { usePsAdobeString = TRUE; ! } else { ! char tmp_str[80]; ! strcpy(tmp_str, c_ptr); if (!ParsePsAdobeString(tmp_str, &usePsAdobeString, adobeString, ! epsfString)) { ! fprintf(stderr, "%s %s*UsePsAdobeString: '%s', %s.\n", "Invalid", TOOL_NAME, tmp_str, "'false' is used"); usePsAdobeString = FALSE; *************** *** 847,851 **** } } - groupedTextEditable = TRUE; if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "GroupedTextEditable")) != --- 826,829 ---- *************** *** 853,936 **** groupedTextEditable = FALSE; } - intrCheckInterval = 10; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, ! "IntrCheckInterval")) != NULL) ! intrCheckInterval = atoi (c_ptr); ! tiledPageScaling = 0.9; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, ! "TiledPageScaling")) != NULL) ! { ! tiledPageScaling = (float) atof (c_ptr); ! if (tiledPageScaling <= 0.0 || tiledPageScaling > 1.0) ! { ! fprintf (stderr, "Invalid %s*TiledPageScaling: '%s', %s.\n", TOOL_NAME, c_ptr, "0.9 used"); tiledPageScaling = 0.9; } } - stickyMenuSelection = FALSE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, ! "StickyMenuSelection")) != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) ! stickyMenuSelection = TRUE; } - gridShown = TRUE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, ! "InitialShowGrid")) != NULL) ! { ! if (strcmp ("false", c_ptr) == 0 || strcmp ("False", c_ptr) == 0) gridShown = FALSE; } - gridOn = TRUE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "InitialSnapOn")) != NULL) ! { ! if (strcmp ("false", c_ptr) == 0 || strcmp ("False", c_ptr) == 0) gridOn = FALSE; } - noMenubar = FALSE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "NoMenubar")) != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) noMenubar = TRUE; } - noStatusWindow = FALSE; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "NoStatusWindow")) != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) noStatusWindow = TRUE; } - scrollBarW = SCROLLBAR_W; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "ScrollBarWidth")) != NULL) ! { ! scrollBarW = atoi (c_ptr); ! if (scrollBarW < 2 || scrollBarW > 16) ! { ! fprintf (stderr, "Invalid %s*ScrollBarWidth: '%s', %s, %1d is used.\n", TOOL_NAME, c_ptr, "(must be between 2 and 16)", SCROLLBAR_W); splineTol = SCROLLBAR_W; } } - paper_size_set = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"InitialPaperSize")) != NULL) ! paper_size_set = SetPaperSize (c_ptr); ! pageStyle = PORTRAIT; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PageStyleLandscape")) != ! NULL && (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0)) { pageStyle = LANDSCAPE; paper_size_set = TRUE; } ! InitPaperSize (); printMag = (float)100.0; --- 831,897 ---- groupedTextEditable = FALSE; } intrCheckInterval = 10; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"IntrCheckInterval")) != NULL) { ! intrCheckInterval = atoi(c_ptr); ! } tiledPageScaling = 0.9; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"TiledPageScaling")) != NULL) { ! tiledPageScaling = (float)atof(c_ptr); ! if (tiledPageScaling <= 0.0 || tiledPageScaling > 1.0) { ! fprintf(stderr, "Invalid %s*TiledPageScaling: '%s', %s.\n", TOOL_NAME, c_ptr, "0.9 used"); tiledPageScaling = 0.9; } } stickyMenuSelection = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, ! "StickyMenuSelection")) != NULL && UtilStrICmp("true", c_ptr) == 0) { ! stickyMenuSelection = TRUE; } gridShown = TRUE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"InitialShowGrid")) != NULL) { ! if (UtilStrICmp("false", c_ptr) == 0) { gridShown = FALSE; + } } gridOn = TRUE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"InitialSnapOn")) != NULL) { ! if (UtilStrICmp("false", c_ptr) == 0) { gridOn = FALSE; + } } noMenubar = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"NoMenubar")) != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { noMenubar = TRUE; + } } noStatusWindow = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"NoStatusWindow")) != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { noStatusWindow = TRUE; + } } scrollBarW = SCROLLBAR_W; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "ScrollBarWidth")) != NULL) { ! scrollBarW = atoi(c_ptr); ! if (scrollBarW < 2 || scrollBarW > 16) { ! fprintf(stderr, "Invalid %s*ScrollBarWidth: '%s', %s, %1d is used.\n", TOOL_NAME, c_ptr, "(must be between 2 and 16)", SCROLLBAR_W); splineTol = SCROLLBAR_W; } } paper_size_set = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"InitialPaperSize")) != NULL) { ! paper_size_set = SetPaperSize(c_ptr); ! } pageStyle = PORTRAIT; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PageStyleLandscape")) != ! NULL && UtilStrICmp("true", c_ptr) == 0) { pageStyle = LANDSCAPE; paper_size_set = TRUE; } ! InitPaperSize(); printMag = (float)100.0; *************** *** 949,1008 **** } } ! if (paper_size_set) UpdPageStyle (pageStyle); usePaperSizeStoredInFile = FALSE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"UsePaperSizeStoredInFile")) != ! NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) usePaperSizeStoredInFile = TRUE; } - oneMotionSelectMove = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"OneMotionSelMove")) != NULL) ! { ! if (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0) oneMotionSelectMove = TRUE; } - queryZoomInPoint = FALSE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"QueryZoomInPoint")) != NULL) { ! if (strcmp("true",c_ptr)==0 || strcmp("True",c_ptr)==0 || ! strcmp("always",c_ptr)==0 || strcmp("Always",c_ptr)==0) { queryZoomInPoint = TRUE; ! } else if (strcmp("no_select",c_ptr)==0 || strcmp("No_select",c_ptr)==0) { queryZoomInPoint = INVALID; ! } else if (strcmp("no_query",c_ptr)==0 || strcmp("No_query",c_ptr)==0) { queryZoomInPoint = BAD; } } - lineStyle = LS_RIGHT; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"InitialArrowStyle")) != NULL) ! { ! if (strcmp("NONE",c_ptr) == 0) { lineStyle = LS_PLAIN; ! } else if (strcmp("RIGHT",c_ptr) == 0) { lineStyle = LS_RIGHT; ! } else if (strcmp("LEFT",c_ptr) == 0) { lineStyle = LS_LEFT; ! } else if (strcmp("DOUBLE",c_ptr) == 0) { lineStyle = LS_DOUBLE; } else { ! fprintf (stderr, "Invalid %s*InitialArrowStyle: '%s', %s.\n", TOOL_NAME, c_ptr, "RIGHT is used"); } } - showPageInEPS = FALSE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ShowPageInEPS")) != ! NULL && (strcmp ("true", c_ptr) == 0 || strcmp ("True", c_ptr) == 0)) showPageInEPS = TRUE; ! oneMotionTimeout = 200; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"OneMotionTimeout")) != NULL) { oneMotionTimeout = atoi(c_ptr); if (oneMotionTimeout < 0 || oneMotionTimeout >= 1000) { ! fprintf (stderr, "Invalid %s*%s: '%s', %s, %1d is used.\n", TOOL_NAME, "OneMotionTimeout", c_ptr, "(must be between 0 and 1000)", 200); --- 910,963 ---- } } ! if (paper_size_set) UpdPageStyle(pageStyle); usePaperSizeStoredInFile = FALSE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"UsePaperSizeStoredInFile")) != ! NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { usePaperSizeStoredInFile = TRUE; + } } oneMotionSelectMove = FALSE; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"OneMotionSelMove")) != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { oneMotionSelectMove = TRUE; + } } queryZoomInPoint = FALSE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"QueryZoomInPoint")) != NULL) { ! if (UtilStrICmp("true",c_ptr)==0 || UtilStrICmp("always",c_ptr)==0) { queryZoomInPoint = TRUE; ! } else if (UtilStrICmp("no_select",c_ptr) == 0) { queryZoomInPoint = INVALID; ! } else if (UtilStrICmp("no_query",c_ptr) == 0) { queryZoomInPoint = BAD; } } lineStyle = LS_RIGHT; ! if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"InitialArrowStyle")) != NULL) { ! if (UtilStrICmp("NONE",c_ptr) == 0) { lineStyle = LS_PLAIN; ! } else if (UtilStrICmp("RIGHT",c_ptr) == 0) { lineStyle = LS_RIGHT; ! } else if (UtilStrICmp("LEFT",c_ptr) == 0) { lineStyle = LS_LEFT; ! } else if (UtilStrICmp("DOUBLE",c_ptr) == 0) { lineStyle = LS_DOUBLE; } else { ! fprintf(stderr, "Invalid %s*InitialArrowStyle: '%s', %s.\n", TOOL_NAME, c_ptr, "RIGHT is used"); } } showPageInEPS = FALSE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ShowPageInEPS")) != ! NULL && UtilStrICmp("true", c_ptr) == 0) { showPageInEPS = TRUE; ! } oneMotionTimeout = 200; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"OneMotionTimeout")) != NULL) { oneMotionTimeout = atoi(c_ptr); if (oneMotionTimeout < 0 || oneMotionTimeout >= 1000) { ! fprintf(stderr, "Invalid %s*%s: '%s', %s, %1d is used.\n", TOOL_NAME, "OneMotionTimeout", c_ptr, "(must be between 0 and 1000)", 200); *************** *** 1010,1019 **** } } - minMoveInterval = 0; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"MinMoveInterval")) != NULL) { minMoveInterval = atoi(c_ptr); if (minMoveInterval < 0 || minMoveInterval >= 1000) { ! fprintf (stderr, "Invalid %s*%s: '%s', %s, %1d is used.\n", TOOL_NAME, "OneMotionTimeout", c_ptr, "(must be between 0 and 1000)", 0); --- 965,973 ---- } } minMoveInterval = 0; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"MinMoveInterval")) != NULL) { minMoveInterval = atoi(c_ptr); if (minMoveInterval < 0 || minMoveInterval >= 1000) { ! fprintf(stderr, "Invalid %s*%s: '%s', %s, %1d is used.\n", TOOL_NAME, "OneMotionTimeout", c_ptr, "(must be between 0 and 1000)", 0); *************** *** 1021,1025 **** } } - rotationIncrement = (45<<6); /* initially 45 degrees */ if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"RotationIncrement")) != NULL) { --- 975,978 ---- *************** *** 1027,1031 **** if (sscanf(c_ptr, "%f", &fval) != 1 || fval < (float)0.0) { ! fprintf (stderr, "Invalid %s*%s: '%s', 45 is used.\n", TOOL_NAME, "RotationIncrement", c_ptr); } else { --- 980,984 ---- if (sscanf(c_ptr, "%f", &fval) != 1 || fval < (float)0.0) { ! fprintf(stderr, "Invalid %s*%s: '%s', 45 is used.\n", TOOL_NAME, "RotationIncrement", c_ptr); } else { *************** *** 1036,1040 **** } } - stretchableText = FALSE; if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "StretchableText")) != NULL && --- 989,992 ---- *************** *** 1042,1046 **** stretchableText = TRUE; } - editTextSize = 0; if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "EditTextSize")) != NULL) { --- 994,997 ---- *************** *** 1048,1064 **** if (editTextSize == 0) { } else if (editTextSize < 4) { ! fprintf (stderr, "Invalid %s*%s: '%s' (too small), 4 is used.\n", TOOL_NAME, "EditTextSize", c_ptr); editTextSize = 4; } else if (editTextSize > 34) { ! fprintf (stderr, "Invalid %s*%s: '%s' (too large), 34 is used.\n", TOOL_NAME, "EditTextSize", c_ptr); editTextSize = 34; } } initialMenubarWindowH = MENUBAR_WINDOW_H; ! strcpy (scanFileName, "No File"); scanLineNum = 0; --- 999,1036 ---- if (editTextSize == 0) { } else if (editTextSize < 4) { ! fprintf(stderr, "Invalid %s*%s: '%s' (too small), 4 is used.\n", TOOL_NAME, "EditTextSize", c_ptr); editTextSize = 4; } else if (editTextSize > 34) { ! fprintf(stderr, "Invalid %s*%s: '%s' (too large), 34 is used.\n", TOOL_NAME, "EditTextSize", c_ptr); editTextSize = 34; } } + tmpFileMode = PSFILE_MOD; + if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "TmpFileMode")) != NULL) { + int nFileMode=0; + + strcpy(gszMsgBox, c_ptr); + + UtilTrimBlanks(gszMsgBox); + if (*gszMsgBox != '\0' && sscanf(gszMsgBox, "%o", &nFileMode) == 1) { + if (nFileMode >= 0) { + tmpFileMode = nFileMode; + } else { + fprintf(stderr, "Invalid %s*%s: '%s' (too small), 0%03o is used.\n", + TOOL_NAME, "TmpFileMode", gszMsgBox, PSFILE_MOD); + } + } + } + titledPinnedMenu = FALSE; + if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "TitledPinnedMenu")) != + NULL && UtilStrICmp(c_ptr, "true") == 0) { + titledPinnedMenu = TRUE; + } initialMenubarWindowH = MENUBAR_WINDOW_H; ! strcpy(scanFileName, "No File"); scanLineNum = 0; *************** *** 1066,1123 **** mainVisual->class==StaticGray) ? FALSE : TRUE; ! InitColor (); ! ! if ((c_ptr = getenv ("TGIFPATH")) == NULL) ! { ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "TGIFPATH")) != NULL) ! strcpy (drawPath, c_ptr); ! else ! strcpy (drawPath, TGIF_PATH); ! } ! else if (strlen (c_ptr) >= 255) ! strcpy (drawPath, TGIF_PATH); ! else ! strcpy (drawPath, c_ptr); i = strlen(drawPath); if (drawPath[i-1] == '/') drawPath[i-1] = '\0'; ! if ((c_ptr = getenv ("HOME")) == NULL) ! strcpy (homeDir, "/"); ! else if (strlen (c_ptr) >= MAXPATHLENGTH-1) ! strcpy (homeDir, "/"); ! else ! strcpy (homeDir, c_ptr); ! ! if (*bootDir == '\0') ! { #ifdef VMS ! extern char * getcwd ARGS_DECL((char *, int, int)); ! if (getcwd (bootDir, MAXPATHLENGTH+2, 0) == NULL) strcpy (bootDir, "."); #else #ifdef ibm ! extern char * getwd ARGS_DECL((char *, int)); ! if (getwd (bootDir, MAXPATHLENGTH+2) == NULL) strcpy (bootDir, "."); #else #ifdef NeXT ! extern char * getwd ARGS_DECL((char *, int)); ! if (getwd (bootDir, MAXPATHLENGTH+2) == NULL) strcpy (bootDir, "."); #else #ifdef luna88k ! extern char * getwd ARGS_DECL((char *, int)); ! if (getwd (bootDir) == NULL) strcpy (bootDir, "."); #else #ifdef sequent ! extern char * getwd ARGS_DECL((char *, int)); ! if (getwd (bootDir) == NULL) strcpy (bootDir, "."); #else ! extern char * getcwd ARGS_DECL((char *, int)); ! if (getcwd (bootDir, MAXPATHLENGTH+2) == NULL) strcpy (bootDir, "."); #endif #endif --- 1038,1093 ---- mainVisual->class==StaticGray) ? FALSE : TRUE; ! InitColor(); + if ((c_ptr=getenv("TGIFPATH")) == NULL) { + if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "TGIFPATH")) != NULL) { + strcpy(drawPath, c_ptr); + } else { + strcpy(drawPath, TGIF_PATH); + } + } else if (strlen(c_ptr) >= 255) { + strcpy(drawPath, TGIF_PATH); + } else { + strcpy(drawPath, c_ptr); + } i = strlen(drawPath); if (drawPath[i-1] == '/') drawPath[i-1] = '\0'; ! if ((c_ptr=getenv("HOME")) == NULL) { ! strcpy(homeDir, "/"); ! } else if (strlen(c_ptr) >= MAXPATHLENGTH-1) { ! strcpy(homeDir, "/"); ! } else { ! strcpy(homeDir, c_ptr); ! } ! if (*bootDir == '\0') { #ifdef VMS ! extern char *getcwd ARGS_DECL((char *, int, int)); ! if (getcwd(bootDir, MAXPATHLENGTH+2, 0) == NULL) strcpy(bootDir, "."); #else #ifdef ibm ! extern char *getwd ARGS_DECL((char *, int)); ! if (getwd(bootDir, MAXPATHLENGTH+2) == NULL) strcpy(bootDir, "."); #else #ifdef NeXT ! extern char *getwd ARGS_DECL((char *, int)); ! if (getwd(bootDir, MAXPATHLENGTH+2) == NULL) strcpy(bootDir, "."); #else #ifdef luna88k ! extern char *getwd ARGS_DECL((char *, int)); ! if (getwd(bootDir) == NULL) strcpy(bootDir, "."); #else #ifdef sequent ! extern char *getwd ARGS_DECL((char *, int)); ! if (getwd(bootDir) == NULL) strcpy(bootDir, "."); #else ! extern char *getcwd ARGS_DECL((char *, int)); ! if (getcwd(bootDir, MAXPATHLENGTH+2) == NULL) strcpy(bootDir, "."); #endif #endif *************** *** 1133,1155 **** sizehints.height = mainWinH; ! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "Geometry")) != NULL) ! { ! bitmask = XParseGeometry (c_ptr, &(sizehints.x), &(sizehints.y), (unsigned int *)&(sizehints.width), (unsigned int *)&(sizehints.height)); if (bitmask & (XValue | YValue)) sizehints.flags |= USPosition; ! if (bitmask & (WidthValue | HeightValue)) ! { sizehints.flags |= USSize; drawWinW = sizehints.width; drawWinH = sizehints.height; } ! if (bitmask & XNegative) ! { x_neg_in_def = TRUE; def_x_neg = sizehints.x; } ! if (bitmask & YNegative) ! { y_neg_in_def = TRUE; def_y_neg = sizehints.y; --- 1103,1121 ---- sizehints.height = mainWinH; ! if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "Geometry")) != NULL) { ! bitmask = XParseGeometry(c_ptr, &(sizehints.x), &(sizehints.y), (unsigned int *)&(sizehints.width), (unsigned int *)&(sizehints.height)); if (bitmask & (XValue | YValue)) sizehints.flags |= USPosition; ! if (bitmask & (WidthValue | HeightValue)) { sizehints.flags |= USSize; drawWinW = sizehints.width; drawWinH = sizehints.height; } ! if (bitmask & XNegative) { x_neg_in_def = TRUE; def_x_neg = sizehints.x; } ! if (bitmask & YNegative) { y_neg_in_def = TRUE; def_y_neg = sizehints.y; *************** *** 1157,1168 **** } ! if (geometrySpecified && *geometrySpec != '\0') ! { ! bitmask = XParseGeometry (geometrySpec, &(sizehints.x), &(sizehints.y), (unsigned int *)&(sizehints.width), (unsigned int *)&(sizehints.height)); if (bitmask & (XValue | YValue)) sizehints.flags |= USPosition; ! if (bitmask & (WidthValue | HeightValue)) ! { sizehints.flags |= USSize; drawWinW = sizehints.width; --- 1123,1132 ---- } ! if (geometrySpecified && *geometrySpec != '\0') { ! bitmask = XParseGeometry(geometrySpec, &(sizehints.x), &(sizehints.y), (unsigned int *)&(sizehints.width), (unsigned int *)&(sizehints.height)); if (bitmask & (XValue | YValue)) sizehints.flags |= USPosition; ! if (bitmask & (WidthValue | HeightValue)) { sizehints.flags |= USSize; drawWinW = sizehints.width; *************** *** 1173,1177 **** } ! InitFonts (); initialMenubarWindowH = defaultFontHeight; if (msgFontPtr == NULL) { --- 1137,1141 ---- } ! InitFonts(); initialMenubarWindowH = defaultFontHeight; if (msgFontPtr == NULL) { *************** *** 1180,1187 **** statusWindowH = max(msgFontHeight+(brdrW<<1)+4, btn1_height+2); } ! InitWinSizes (); ! if (canvasWindowOnly) ! { noMenubar = TRUE; noStatusWindow = TRUE; --- 1144,1150 ---- statusWindowH = max(msgFontHeight+(brdrW<<1)+4, btn1_height+2); } ! InitWinSizes(); ! if (canvasWindowOnly) { noMenubar = TRUE; noStatusWindow = TRUE; *************** *** 1190,1219 **** mainWinH = initDrawWinH; ! switch (gridSystem) ! { ! case ENGLISH_GRID: ! sizehints.min_width = HALF_INCH+3*brdrW; ! sizehints.min_height = HALF_INCH+3*brdrW; ! break; ! case METRIC_GRID: ! sizehints.min_width = ONE_CM+3*brdrW; ! sizehints.min_height = ONE_CM+3*brdrW; ! break; } ! if (mainWinW > sizehints.min_width) sizehints.width = mainWinW; ! else sizehints.width = sizehints.min_width = mainWinW; ! if (mainWinH > sizehints.min_height) sizehints.height = mainWinH; ! else sizehints.height = sizehints.min_height = mainWinH; ! drawWinW = initDrawWinW = mainWinW-(brdrW<<1); drawWinH = initDrawWinH = mainWinH-(brdrW<<1); if (msgWindowW <= 0) msgWindowW = 2; ! } ! else ! { sizehints.min_width = choiceWindowW+(brdrW<<2)+defaultFontWidth; sizehints.min_height = --- 1153,1180 ---- mainWinH = initDrawWinH; ! switch (gridSystem) { ! case ENGLISH_GRID: ! sizehints.min_width = HALF_INCH+3*brdrW; ! sizehints.min_height = HALF_INCH+3*brdrW; ! break; ! case METRIC_GRID: ! sizehints.min_width = ONE_CM+3*brdrW; ! sizehints.min_height = ONE_CM+3*brdrW; ! break; } ! if (mainWinW > sizehints.min_width) { sizehints.width = mainWinW; ! } else { sizehints.width = sizehints.min_width = mainWinW; ! } ! if (mainWinH > sizehints.min_height) { sizehints.height = mainWinH; ! } else { sizehints.height = sizehints.min_height = mainWinH; ! } drawWinW = initDrawWinW = mainWinW-(brdrW<<1); drawWinH = initDrawWinH = mainWinH-(brdrW<<1); if (msgWindowW <= 0) msgWindowW = 2; ! } else { sizehints.min_width = choiceWindowW+(brdrW<<2)+defaultFontWidth; sizehints.min_height = *************** *** 1221,1448 **** (noStatusWindow ? 0 : statusWindowH+(brdrW<<1))+ titleWindowH+choiceWindowH+PIX_PER_INCH+rulerW+scrollBarW+10*brdrW; ! if (mainWinW > sizehints.min_width) sizehints.width = mainWinW; ! else mainWinW = sizehints.width = sizehints.min_width; ! if (mainWinH > sizehints.min_height) sizehints.height = mainWinH; ! else mainWinH = sizehints.height = sizehints.min_height; ! ! InverseInitWinSizes (); } ! ! if (bitmask & XNegative) sizehints.x += DisplayWidth(mainDisplay,mainScreen)-mainWinW-1; ! else if (!x_in_cmdline && x_neg_in_def) sizehints.x = def_x_neg+DisplayWidth(mainDisplay,mainScreen)-mainWinW-1; ! ! if (bitmask & YNegative) sizehints.y += DisplayHeight(mainDisplay,mainScreen)-mainWinH-1; ! else if (!y_in_cmdline && y_neg_in_def) sizehints.y = def_y_neg+DisplayHeight(mainDisplay,mainScreen)-mainWinH-1; ! ! if ((mainWindow = XCreateSimpleWindow (mainDisplay, rootWindow, sizehints.x, sizehints.y, sizehints.width, sizehints.height, ! brdrW, myBorderPixel, myBgPixel)) == 0) ! { fprintf (stderr, "Could not create main window!\n"); exit(1); } ! ! if (newColormapUsed) ! XSetWindowColormap (mainDisplay, mainWindow, mainColormap); ! ! InitShortCut (); ! InitScroll (); ! InitPattern (); ! InitRuler (); ! InitMenu (); ! InitNames (); ! InitStk (); ! InitXBm (); ! InitXPm (); ! CreateCursor (); lastPageNum = 1; ! InitPage (); ! if ((titleWindow = XCreateSimpleWindow (mainDisplay, mainWindow, 0, 0, ! titleWindowW, titleWindowH, brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the title window"); cur_y += titleWindowH + (brdrW<<1); ! if ((menubarWindow = XCreateSimpleWindow (mainDisplay, mainWindow, 0, cur_y, menubarWindowW, menubarWindowH, brdrW, myBorderPixel, ! myBgPixel)) == 0) ! Error ("setup", "Could not create the menubar window"); ! ! if (!noMenubar) cur_y += menubarWindowH + (brdrW<<1); ! ! if ((msgWindow = XCreateSimpleWindow (mainDisplay, mainWindow, 0, cur_y, ! msgWindowW, msgWindowH, brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the message window"); ! ! if ((choiceWindow = XCreateSimpleWindow (mainDisplay, mainWindow, msgWindowW+(brdrW<<1), cur_y, choiceWindowW, choiceWindowH, ! brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the choice window"); cur_y += msgWindowH + (brdrW<<1); ! InitChoice (); ! ! if ((dummyWindow1 = XCreateSimpleWindow (mainDisplay, mainWindow, 0, cur_y, ! rulerW, rulerW, brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the left top dummy window"); ! if ((hRuleWindow = XCreateSimpleWindow (mainDisplay, mainWindow, rulerW+(brdrW<<1), cur_y, drawWinW, rulerW, ! brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the horizontal ruler window"); ! ! if ((colorWindow = XCreateSimpleWindow (mainDisplay, mainWindow, (brdrW<<2)+rulerW+drawWinW, cur_y, scrollBarW, colorWindowH, ! brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the color window"); ! ! if ((colorDummyWindow = XCreateSimpleWindow (mainDisplay, mainWindow, (brdrW<<2)+rulerW+drawWinW, cur_y+colorWindowH+(brdrW<<1), scrollBarW, ! colorDummyWindowH, brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the color dummy window"); ! ! if ((vSBarWindow = XCreateSimpleWindow (mainDisplay, mainWindow, (brdrW<<2)+rulerW+drawWinW, colorLayers ? cur_y+colorWindowH+colorDummyWindowH+(brdrW<<2) : cur_y, ! scrollBarW, vSBarH, brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the vertical scrollbar window"); cur_y += rulerW + (brdrW<<1); ! if ((vRuleWindow = XCreateSimpleWindow (mainDisplay, mainWindow, 0, cur_y, ! rulerW, drawWinH, brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the vertical ruler window"); ! ! if ((drawWindow = XCreateSimpleWindow (mainDisplay, mainWindow, rulerW+(brdrW<<1), cur_y, drawWinW, drawWinH, ! 0, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the drawing window"); cur_y += drawWinH + (brdrW<<1); ! if ((pageWindow = XCreateSimpleWindow (mainDisplay, mainWindow, 0, cur_y, ! pageWindowW, scrollBarW+(brdrW<<1), 0, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the page window"); ! ! if ((pageDummyWindow = XCreateSimpleWindow (mainDisplay, mainWindow, pageWindowW, cur_y, pageDummyWindowW, scrollBarW, brdrW, ! myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the page dummy window"); ! ! if ((hSBarWindow = XCreateSimpleWindow (mainDisplay, mainWindow, pageWindowW+pageDummyWindowW+(brdrW<<1), cur_y, ! hSBarW, scrollBarW, brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the horizontal scrollbar window"); ! ! if ((dummyWindow2 = XCreateSimpleWindow (mainDisplay, mainWindow, rulerW+drawWinW+(brdrW<<2), cur_y, ! scrollBarW, scrollBarW, brdrW, myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the right bottom dummy window"); cur_y += scrollBarW + (brdrW<<1); ! if ((statusWindow = XCreateSimpleWindow (mainDisplay, mainWindow, 0, cur_y, statusWindowW, statusWindowH, brdrW, myBorderPixel, ! myBgPixel)) == 0) ! Error ("setup", "Could not create the status window"); ! CalcStatusSubWinGeom (); ! for (i=0; i < MAX_STATUS_BTNS; i++) ! if ((statusSubWindow[i] = XCreateSimpleWindow (mainDisplay, statusWindow, statusSubWindowX[i], statusSubWindowY[i], statusSubWindowW[i], statusSubWindowH[i], brdrW, ! myBorderPixel, myBgPixel)) == 0) ! Error ("setup", "Could not create the status sub windows"); ! ! if (!noStatusWindow) cur_y += statusWindowH + (brdrW<<1); ! ! if (canvasWindowOnly) ! { savedMainWindow = mainWindow; savedDrawWindow = drawWindow; ! if ((mainWindow = XCreateSimpleWindow (mainDisplay, rootWindow, sizehints.x, sizehints.y, mainWinW, mainWinH, ! brdrW, myBorderPixel, myBgPixel)) == 0) ! { fprintf (stderr, "Could not create main window!\n"); exit(1); } ! ! if (newColormapUsed) ! XSetWindowColormap (mainDisplay, mainWindow, mainColormap); ! ! if ((drawWindow = XCreateSimpleWindow (mainDisplay, mainWindow, ! 0, 0, drawWinW, drawWinH, brdrW, myBorderPixel, myBgPixel)) == 0) ! { fprintf (stderr, "Could not create draw window!\n"); exit(1); } } #ifdef NOTR4MODE ! XSetNormalHints (mainDisplay, mainWindow, &sizehints); #else ! XSetWMNormalHints (mainDisplay, mainWindow, &sizehints); #endif ! XStoreName (mainDisplay, mainWindow, TOOL_NAME); ! UpdDrawWinBBox (); ! InitTitle (); ! InitStatus (); ! SetCanvasFont (); #ifdef MAPBEFORESELECT ! XMapWindow (mainDisplay, mainWindow); ! XSelectInput (mainDisplay, mainWindow, KeyPressMask | StructureNotifyMask | VisibilityChangeMask); #else ! XSelectInput (mainDisplay, mainWindow, KeyPressMask | StructureNotifyMask | VisibilityChangeMask); ! XMapWindow (mainDisplay, mainWindow); #endif ! XDefineCursor (mainDisplay, mainWindow, defaultCursor); ! protocolAtom = XInternAtom (mainDisplay, "WM_DELETE_WINDOW", False); #ifndef NOTR4MODE ! XSetWMProtocols (mainDisplay, mainWindow, &protocolAtom, 1); #endif #ifdef MAPBEFORESELECT ! if (canvasWindowOnly) ! { ! XMapWindow (mainDisplay, drawWindow); ! XSelectInput (mainDisplay, drawWindow, ButtonReleaseMask | ButtonPressMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask | EnterWindowMask); ! } ! else ! { ! XMapWindow (mainDisplay, titleWindow); ! XSelectInput (mainDisplay, titleWindow, ExposureMask | EnterWindowMask); ! ! if (menubarWindow != None) ! { ! XMapWindow (mainDisplay, menubarWindow); ! XSelectInput (mainDisplay, menubarWindow, ExposureMask | EnterWindowMask | ButtonPressMask | PointerMotionMask); } ! XMapWindow (mainDisplay, msgWindow); ! XSelectInput (mainDisplay, msgWindow, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, choiceWindow); ! XSelectInput (mainDisplay, choiceWindow, ButtonReleaseMask | ButtonPressMask | ExposureMask | PointerMotionMask | EnterWindowMask); ! XMapWindow (mainDisplay, hRuleWindow); ! XSelectInput (mainDisplay, hRuleWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, vRuleWindow); ! XSelectInput (mainDisplay, vRuleWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, drawWindow); ! XSelectInput (mainDisplay, drawWindow, ButtonReleaseMask | ButtonPressMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask | EnterWindowMask); --- 1182,1424 ---- (noStatusWindow ? 0 : statusWindowH+(brdrW<<1))+ titleWindowH+choiceWindowH+PIX_PER_INCH+rulerW+scrollBarW+10*brdrW; ! if (mainWinW > sizehints.min_width) { sizehints.width = mainWinW; ! } else { mainWinW = sizehints.width = sizehints.min_width; ! } ! if (mainWinH > sizehints.min_height) { sizehints.height = mainWinH; ! } else { mainWinH = sizehints.height = sizehints.min_height; ! } ! InverseInitWinSizes(); } ! if (bitmask & XNegative) { sizehints.x += DisplayWidth(mainDisplay,mainScreen)-mainWinW-1; ! } else if (!x_in_cmdline && x_neg_in_def) { sizehints.x = def_x_neg+DisplayWidth(mainDisplay,mainScreen)-mainWinW-1; ! } ! if (bitmask & YNegative) { sizehints.y += DisplayHeight(mainDisplay,mainScreen)-mainWinH-1; ! } else if (!y_in_cmdline && y_neg_in_def) { sizehints.y = def_y_neg+DisplayHeight(mainDisplay,mainScreen)-mainWinH-1; ! } ! if ((mainWindow=XCreateSimpleWindow(mainDisplay, rootWindow, sizehints.x, sizehints.y, sizehints.width, sizehints.height, ! brdrW, myBorderPixel, myBgPixel)) == 0) { ! fprintf(stderr, "Could not create main window!\n"); exit(1); ! } ! if (newColormapUsed) { ! XSetWindowColormap(mainDisplay, mainWindow, mainColormap); ! } ! InitShortCut(); ! InitScroll(); ! InitPattern(); ! InitRuler(); ! InitMenu(); ! InitNames(); ! InitStk(); ! InitXBm(); ! InitXPm(); ! CreateCursor(); lastPageNum = 1; ! InitPage(); ! if ((titleWindow=XCreateSimpleWindow(mainDisplay, mainWindow, 0, 0, ! titleWindowW, titleWindowH, brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the title window"); ! } cur_y += titleWindowH + (brdrW<<1); ! if ((menubarWindow=XCreateSimpleWindow(mainDisplay, mainWindow, 0, cur_y, menubarWindowW, menubarWindowH, brdrW, myBorderPixel, ! myBgPixel)) == 0) { ! Error("setup", "Could not create the menubar window"); ! } ! if (!noMenubar) { cur_y += menubarWindowH + (brdrW<<1); ! } ! if ((msgWindow=XCreateSimpleWindow(mainDisplay, mainWindow, 0, cur_y, ! msgWindowW, msgWindowH, brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the message window"); ! } ! if ((choiceWindow=XCreateSimpleWindow(mainDisplay, mainWindow, msgWindowW+(brdrW<<1), cur_y, choiceWindowW, choiceWindowH, ! brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the choice window"); ! } cur_y += msgWindowH + (brdrW<<1); ! InitChoice(); ! if ((dummyWindow1=XCreateSimpleWindow(mainDisplay, mainWindow, 0, cur_y, ! rulerW, rulerW, brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the left top dummy window"); ! } ! if ((hRuleWindow=XCreateSimpleWindow(mainDisplay, mainWindow, rulerW+(brdrW<<1), cur_y, drawWinW, rulerW, ! brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the horizontal ruler window"); ! } ! if ((colorWindow=XCreateSimpleWindow(mainDisplay, mainWindow, (brdrW<<2)+rulerW+drawWinW, cur_y, scrollBarW, colorWindowH, ! brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the color window"); ! } ! if ((colorDummyWindow=XCreateSimpleWindow(mainDisplay, mainWindow, (brdrW<<2)+rulerW+drawWinW, cur_y+colorWindowH+(brdrW<<1), scrollBarW, ! colorDummyWindowH, brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the color dummy window"); ! } ! if ((vSBarWindow=XCreateSimpleWindow(mainDisplay, mainWindow, (brdrW<<2)+rulerW+drawWinW, colorLayers ? cur_y+colorWindowH+colorDummyWindowH+(brdrW<<2) : cur_y, ! scrollBarW, vSBarH, brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the vertical scrollbar window"); ! } cur_y += rulerW + (brdrW<<1); ! if ((vRuleWindow=XCreateSimpleWindow(mainDisplay, mainWindow, 0, cur_y, ! rulerW, drawWinH, brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the vertical ruler window"); ! } ! if ((drawWindow=XCreateSimpleWindow(mainDisplay, mainWindow, rulerW+(brdrW<<1), cur_y, drawWinW, drawWinH, ! 0, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the drawing window"); ! } cur_y += drawWinH + (brdrW<<1); ! if ((pageWindow=XCreateSimpleWindow(mainDisplay, mainWindow, 0, cur_y, ! pageWindowW, scrollBarW+(brdrW<<1), 0, myBorderPixel, ! myBgPixel)) == 0) { ! Error("setup", "Could not create the page window"); ! } ! if ((pageDummyWindow=XCreateSimpleWindow(mainDisplay, mainWindow, pageWindowW, cur_y, pageDummyWindowW, scrollBarW, brdrW, ! myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the page dummy window"); ! } ! if ((hSBarWindow=XCreateSimpleWindow(mainDisplay, mainWindow, pageWindowW+pageDummyWindowW+(brdrW<<1), cur_y, ! hSBarW, scrollBarW, brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the horizontal scrollbar window"); ! } ! if ((dummyWindow2=XCreateSimpleWindow(mainDisplay, mainWindow, rulerW+drawWinW+(brdrW<<2), cur_y, ! scrollBarW, scrollBarW, brdrW, myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the right bottom dummy window"); ! } cur_y += scrollBarW + (brdrW<<1); ! if ((statusWindow=XCreateSimpleWindow(mainDisplay, mainWindow, 0, cur_y, statusWindowW, statusWindowH, brdrW, myBorderPixel, ! myBgPixel)) == 0) { ! Error("setup", "Could not create the status window"); ! } ! CalcStatusSubWinGeom(); ! for (i=0; i < MAX_STATUS_BTNS; i++) { ! if ((statusSubWindow[i]=XCreateSimpleWindow(mainDisplay, statusWindow, statusSubWindowX[i], statusSubWindowY[i], statusSubWindowW[i], statusSubWindowH[i], brdrW, ! myBorderPixel, myBgPixel)) == 0) { ! Error("setup", "Could not create the status sub windows"); ! } ! } ! if (!noStatusWindow) { cur_y += statusWindowH + (brdrW<<1); ! } ! if (canvasWindowOnly) { savedMainWindow = mainWindow; savedDrawWindow = drawWindow; ! if ((mainWindow=XCreateSimpleWindow(mainDisplay, rootWindow, sizehints.x, sizehints.y, mainWinW, mainWinH, ! brdrW, myBorderPixel, myBgPixel)) == 0) { ! fprintf(stderr, "Could not create main window!\n"); exit(1); ! } ! if (newColormapUsed) { ! XSetWindowColormap(mainDisplay, mainWindow, mainColormap); ! } ! if ((drawWindow=XCreateSimpleWindow(mainDisplay, mainWindow, ! 0, 0, drawWinW, drawWinH, brdrW, myBorderPixel, myBgPixel)) == 0) { ! fprintf(stderr, "Could not create draw window!\n"); exit(1); ! } } #ifdef NOTR4MODE ! XSetNormalHints(mainDisplay, mainWindow, &sizehints); #else ! XSetWMNormalHints(mainDisplay, mainWindow, &sizehints); #endif ! XStoreName(mainDisplay, mainWindow, TOOL_NAME); ! UpdDrawWinBBox(); ! InitTitle(); ! InitStatus(); ! SetCanvasFont(); ! ! InitText(); ! InitRemote(); ! InitImageProc(); ! InitImport(); ! InitHelp(); ! InitShape(); ! ! if (PRTGIF) { ! return; ! } #ifdef MAPBEFORESELECT ! XMapWindow(mainDisplay, mainWindow); ! XSelectInput(mainDisplay, mainWindow, KeyPressMask | StructureNotifyMask | VisibilityChangeMask); #else ! XSelectInput(mainDisplay, mainWindow, KeyPressMask | StructureNotifyMask | VisibilityChangeMask); ! XMapWindow(mainDisplay, mainWindow); #endif ! XDefineCursor(mainDisplay, mainWindow, defaultCursor); ! protocolAtom = XInternAtom(mainDisplay, "WM_DELETE_WINDOW", False); #ifndef NOTR4MODE ! XSetWMProtocols(mainDisplay, mainWindow, &protocolAtom, 1); #endif #ifdef MAPBEFORESELECT ! if (canvasWindowOnly) { ! XMapWindow(mainDisplay, drawWindow); ! XSelectInput(mainDisplay, drawWindow, ButtonReleaseMask | ButtonPressMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask | EnterWindowMask); ! } else { ! XMapWindow(mainDisplay, titleWindow); ! XSelectInput(mainDisplay, titleWindow, ExposureMask | EnterWindowMask); ! ! if (menubarWindow != None) { ! XMapWindow(mainDisplay, menubarWindow); ! XSelectInput(mainDisplay, menubarWindow, ExposureMask | EnterWindowMask | ButtonPressMask | PointerMotionMask); } ! XMapWindow(mainDisplay, msgWindow); ! XSelectInput(mainDisplay, msgWindow, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, choiceWindow); ! XSelectInput(mainDisplay, choiceWindow, ButtonReleaseMask | ButtonPressMask | ExposureMask | PointerMotionMask | EnterWindowMask); ! XMapWindow(mainDisplay, hRuleWindow); ! XSelectInput(mainDisplay, hRuleWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, vRuleWindow); ! XSelectInput(mainDisplay, vRuleWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, drawWindow); ! XSelectInput(mainDisplay, drawWindow, ButtonReleaseMask | ButtonPressMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask | EnterWindowMask); *************** *** 1461,1536 **** ExposureMask | EnterWindowMask); } ! XMapWindow (mainDisplay, vSBarWindow); ! XSelectInput (mainDisplay, vSBarWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, pageWindow); ! XSelectInput (mainDisplay, pageWindow, ButtonPressMask | PointerMotionMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, pageDummyWindow); ! XSelectInput (mainDisplay, pageDummyWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, hSBarWindow); ! XSelectInput (mainDisplay, hSBarWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, dummyWindow1); ! XSelectInput (mainDisplay, dummyWindow1, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, dummyWindow2); ! XSelectInput (mainDisplay, dummyWindow2, EnterWindowMask); ! if (!noStatusWindow) ! { ! XMapWindow (mainDisplay, statusWindow); ! XSelectInput (mainDisplay, statusWindow, ExposureMask | EnterWindowMask); ! for (i=0; i < MAX_STATUS_BTNS; i++) ! XMapWindow (mainDisplay, statusSubWindow[i]); ! } ! else ! XSelectInput (mainDisplay, statusWindow, ExposureMask | EnterWindowMask); } #else /* ~MAPBEFORESELECT */ ! if (canvasWindowOnly) ! { ! XSelectInput (mainDisplay, drawWindow, ButtonReleaseMask | ButtonPressMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, drawWindow); ! } ! else ! { ! XSelectInput (mainDisplay, titleWindow, ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, titleWindow); ! ! if (menubarWindow != None) ! { ! XSelectInput (mainDisplay, menubarWindow, ExposureMask | EnterWindowMask | ButtonPressMask | PointerMotionMask); ! XMapWindow (mainDisplay, menubarWindow); } ! XSelectInput (mainDisplay, msgWindow, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, msgWindow); ! XSelectInput (mainDisplay, choiceWindow, ButtonReleaseMask | ButtonPressMask | ExposureMask | PointerMotionMask | EnterWindowMask); ! XMapWindow (mainDisplay, choiceWindow); ! XSelectInput (mainDisplay, hRuleWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, hRuleWindow); ! XSelectInput (mainDisplay, vRuleWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, vRuleWindow); ! XSelectInput (mainDisplay, drawWindow, ButtonReleaseMask | ButtonPressMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, drawWindow); if (colorLayers) { --- 1437,1508 ---- ExposureMask | EnterWindowMask); } ! XMapWindow(mainDisplay, vSBarWindow); ! XSelectInput(mainDisplay, vSBarWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, pageWindow); ! XSelectInput(mainDisplay, pageWindow, ButtonPressMask | PointerMotionMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, pageDummyWindow); ! XSelectInput(mainDisplay, pageDummyWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, hSBarWindow); ! XSelectInput(mainDisplay, hSBarWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, dummyWindow1); ! XSelectInput(mainDisplay, dummyWindow1, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, dummyWindow2); ! XSelectInput(mainDisplay, dummyWindow2, EnterWindowMask); ! if (!noStatusWindow) { ! XMapWindow(mainDisplay, statusWindow); ! XSelectInput(mainDisplay, statusWindow, ExposureMask | EnterWindowMask); ! for (i=0; i < MAX_STATUS_BTNS; i++) { ! XMapWindow(mainDisplay, statusSubWindow[i]); ! } ! } else { ! XSelectInput(mainDisplay, statusWindow, ExposureMask | EnterWindowMask); + } } #else /* ~MAPBEFORESELECT */ ! if (canvasWindowOnly) { ! XSelectInput(mainDisplay, drawWindow, ButtonReleaseMask | ButtonPressMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, drawWindow); ! } else { ! XSelectInput(mainDisplay, titleWindow, ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, titleWindow); ! ! if (menubarWindow != None) { ! XSelectInput(mainDisplay, menubarWindow, ExposureMask | EnterWindowMask | ButtonPressMask | PointerMotionMask); ! XMapWindow(mainDisplay, menubarWindow); } ! XSelectInput(mainDisplay, msgWindow, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, msgWindow); ! XSelectInput(mainDisplay, choiceWindow, ButtonReleaseMask | ButtonPressMask | ExposureMask | PointerMotionMask | EnterWindowMask); ! XMapWindow(mainDisplay, choiceWindow); ! XSelectInput(mainDisplay, hRuleWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, hRuleWindow); ! XSelectInput(mainDisplay, vRuleWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, vRuleWindow); ! XSelectInput(mainDisplay, drawWindow, ButtonReleaseMask | ButtonPressMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, drawWindow); if (colorLayers) { *************** *** 1547,1580 **** ExposureMask | EnterWindowMask); } ! XSelectInput (mainDisplay, vSBarWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, vSBarWindow); ! XSelectInput (mainDisplay, pageWindow, ButtonPressMask | PointerMotionMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, pageWindow); ! XSelectInput (mainDisplay, pageDummyWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, pageDummyWindow); ! XSelectInput (mainDisplay, hSBarWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, hSBarWindow); ! XSelectInput (mainDisplay, dummyWindow1, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, dummyWindow1); ! XSelectInput (mainDisplay, dummyWindow2, EnterWindowMask); ! XMapWindow (mainDisplay, dummyWindow2); ! ! if (!noStatusWindow) ! { ! XSelectInput (mainDisplay, statusWindow, ExposureMask | EnterWindowMask); ! XMapWindow (mainDisplay, statusWindow); ! for (i=0; i < MAX_STATUS_BTNS; i++) ! XMapWindow (mainDisplay, statusSubWindow[i]); ! } ! else ! XSelectInput (mainDisplay, statusWindow, ExposureMask | EnterWindowMask); } #endif --- 1519,1552 ---- ExposureMask | EnterWindowMask); } ! XSelectInput(mainDisplay, vSBarWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, vSBarWindow); ! XSelectInput(mainDisplay, pageWindow, ButtonPressMask | PointerMotionMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, pageWindow); ! XSelectInput(mainDisplay, pageDummyWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, pageDummyWindow); ! XSelectInput(mainDisplay, hSBarWindow, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, hSBarWindow); ! XSelectInput(mainDisplay, dummyWindow1, ButtonPressMask | ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, dummyWindow1); ! XSelectInput(mainDisplay, dummyWindow2, EnterWindowMask); ! XMapWindow(mainDisplay, dummyWindow2); ! ! if (!noStatusWindow) { ! XSelectInput(mainDisplay, statusWindow, ExposureMask | EnterWindowMask); ! XMapWindow(mainDisplay, statusWindow); ! for (i=0; i < MAX_STATUS_BTNS; i++) { ! XMapWindow(mainDisplay, statusSubWindow[i]); ! } ! } else { ! XSelectInput(mainDisplay, statusWindow, ExposureMask | EnterWindowMask); + } } #endif *************** *** 1585,1589 **** if (iconWindowCreated) { ! unsigned int dummy_icon_w, dummy_icon_h; sizehints.flags = PSize | PMinSize | PMaxSize; --- 1557,1561 ---- if (iconWindowCreated) { ! unsigned int dummy_icon_w, dummy_icon_h; sizehints.flags = PSize | PMinSize | PMaxSize; *************** *** 1602,1606 **** if (bitmask & XNegative) sizehints.x += DisplayWidth (mainDisplay, mainScreen) - iconWindowW - (brdrW<<1) - 1; ! if (bitmask & YNegative) sizehints.y += DisplayHeight (mainDisplay, mainScreen) - iconWindowH - (brdrW<<1) - 1; --- 1574,1578 ---- if (bitmask & XNegative) sizehints.x += DisplayWidth (mainDisplay, mainScreen) - iconWindowW - (brdrW<<1) - 1; ! if (bitmask & YNegative) sizehints.y += DisplayHeight(mainDisplay, mainScreen) - iconWindowH - (brdrW<<1) - 1; *************** *** 1637,1641 **** } wmhints.flags |= IconPixmapHint | StateHint; ! FlushUndoBuffer(); } } --- 1609,1613 ---- } wmhints.flags |= IconPixmapHint | StateHint; ! /* FlushUndoBuffer(); */ } } *************** *** 1645,1655 **** wmhints.input = True; XSetWMHints(mainDisplay, drawWindow, &wmhints); - - InitText(); - InitRemote(); - InitImageProc(); - InitImport(); - InitHelp(); - InitShape(); } --- 1617,1620 ---- *************** *** 1666,1669 **** --- 1631,1638 ---- if (savedMainWindow != None) XDestroyWindow(mainDisplay, savedMainWindow); CleanUpPaperSize(); + if (displayName != NULL) { + UtilFree(displayName); + displayName = NULL; + } } *************** *** 1676,1694 **** } ! void MakeQuiescent () { TieLooseEnds(); SetCurChoice(NOTHING); ! if (topSel != NULL) { HighLightReverse(); RemoveAllSel(); } UpdSelBBox(); } ! void SetFileModified (modified) ! int modified; { ! if (modified != fileModified) ! { fileModified = modified; ! RedrawTitleWindow (); } } --- 1645,1665 ---- } ! void MakeQuiescent() { TieLooseEnds(); SetCurChoice(NOTHING); ! if (topSel != NULL) { ! HighLightReverse(); ! RemoveAllSel(); ! } UpdSelBBox(); } ! void SetFileModified(modified) ! int modified; { ! if (modified != fileModified) { fileModified = modified; ! RedrawTitleWindow(); } } *** shape.c.orig Tue Sep 30 13:24:05 1997 --- shape.c Tue Sep 30 13:24:05 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/shape.c,v 3.4 1996/10/30 22:58:51 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/shape.c,v 3.5 1997/09/14 20:37:59 william Exp $ */ #include *** shortcut.c.orig Tue Sep 30 13:24:06 1997 --- shortcut.c Tue Sep 30 13:24:06 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/shortcut.c,v 3.10 1997/01/30 03:59:40 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/shortcut.c,v 3.12 1997/09/14 20:37:59 william Exp $ */ #include *************** *** 295,298 **** --- 293,297 ---- { '\0', 0, "FindAgain()", 0, }, { '\0', 0, "CurrentVersionInfo()", 0, }, + { '\0', 0, "LatestReleaseInfo()", 0, }, { '\0', 0, "", 0 } }; *** special.c.orig Tue Sep 30 13:24:08 1997 --- special.c Tue Sep 30 13:24:08 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/special.c,v 3.2 1996/12/21 23:02:55 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/special.c,v 3.5 1997/09/17 02:10:57 william Exp $ */ #include *************** *** 144,156 **** }; ! struct ObjRec * ReadSymbol (FP) ! FILE * FP; { ! register struct AttrRec * attr_ptr; ! struct ObjRec * obj_ptr; ! int read_status; ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); importingFile = TRUE; /* ignore 'state' info but set fileVersion */ --- 142,155 ---- }; ! struct ObjRec *ReadSymbol(FP, FileType) ! FILE *FP; ! int FileType; { ! register struct AttrRec *attr_ptr; ! struct ObjRec *obj_ptr; ! int read_status; ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); importingFile = TRUE; /* ignore 'state' info but set fileVersion */ *************** *** 159,171 **** if (obj_ptr != NULL) { if (obj_ptr->type == OBJ_SYM) { UnlockAnObj(obj_ptr); obj_ptr->type = OBJ_ICON; attr_ptr = obj_ptr->lattr; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->prev) attr_ptr->inherited = TRUE; ! importingFile = FALSE; ! SetDefaultCursor(mainWindow); ! SetDefaultCursor(drawWindow); ! return obj_ptr; } else { FreeObj(obj_ptr); --- 158,179 ---- if (obj_ptr != NULL) { if (obj_ptr->type == OBJ_SYM) { + int done=FALSE; + UnlockAnObj(obj_ptr); obj_ptr->type = OBJ_ICON; + attr_ptr = obj_ptr->lattr; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->prev) { attr_ptr->inherited = TRUE; ! } ! if (FileType == SYM_FILE_TYPE) { ! done = TRUE; ! } ! if (done) { ! importingFile = FALSE; ! SetDefaultCursor(mainWindow); ! ShowCursor(); ! return obj_ptr; ! } } else { FreeObj(obj_ptr); *************** *** 177,345 **** RedrawColorWindow(); } ! if (read_status == INVALID) ! { ! sprintf (gszMsgBox, "File version too large (=%1d).\n\nRead symbol aborted!", fileVersion); ! Msg (gszMsgBox); } ! SetDefaultCursor (mainWindow); ! SetDefaultCursor (drawWindow); ! return (NULL); } ! struct ObjRec * GetObjRepresentation (PathName, SymName) ! char * PathName, * SymName; { ! char file_name[MAXPATHLENGTH], * rest; ! int short_name; ! struct ObjRec * obj_ptr; ! FILE * fp; ! int tmp_linenum; ! char tmp_filename[MAXPATHLENGTH]; ! ! sprintf (file_name, "%s/%s.%s", PathName, SymName, SYM_FILE_EXT); ! if ((short_name = IsPrefix (bootDir, file_name, &rest))) ++rest; ! ! if ((fp = fopen (file_name, "r")) == NULL) ! { ! if (short_name) ! sprintf (gszMsgBox, "Can not open '%s'\n", rest); ! else ! sprintf (gszMsgBox, "Can not open '%s'\n", file_name); ! Msg (gszMsgBox); ! return (NULL); } ! strcpy (tmp_filename, scanFileName); tmp_linenum = scanLineNum; ! strcpy (scanFileName, (short_name ? rest : file_name)); scanLineNum = 0; ! if ((obj_ptr = ReadSymbol (fp)) != NULL) ! { obj_ptr->id = objId++; obj_ptr->dirty = FALSE; ! strcpy (obj_ptr->detail.r->s, SymName); obj_ptr->detail.r->rotate = ROTATE0; obj_ptr->detail.r->flip = NO_FLIP; obj_ptr->detail.r->deck_index = (-1); ! AdjObjBBox (obj_ptr); } ! strcpy (scanFileName, tmp_filename); scanLineNum = tmp_linenum; ! fclose (fp); ! return (obj_ptr); } ! unsigned int PlaceTopObj (ObjPtr) ! struct ObjRec * ObjPtr; { ! int x, y, grid_x, grid_y, dx, dy, placing = TRUE; ! int cursor_x, cursor_y, orig_x, orig_y; ! int obj_ltx, obj_lty, obj_rbx, obj_rby; ! int grid_obj_ltx, grid_obj_lty, grid_dx=0, grid_dy=0; ! Window root_win, child_win; ! int root_x, root_y, first_time=TRUE; ! unsigned int status, button_pressed=Button1; ! XEvent input, ev; ! RedrawMsg (); ! XFlush (mainDisplay); ! XSync (mainDisplay, False); placingTopObj = TRUE; ! if (XCheckMaskEvent (mainDisplay, ExposureMask, &ev) || ! XCheckMaskEvent (mainDisplay, VisibilityChangeMask, &ev)) ! ExposeEventHandler (&ev, TRUE); ! obj_ltx = OFFSET_X(ObjPtr->obbox.ltx); obj_lty = OFFSET_Y(ObjPtr->obbox.lty); obj_rbx = OFFSET_X(ObjPtr->obbox.rbx); obj_rby = OFFSET_Y(ObjPtr->obbox.rby); ! GridXY (obj_ltx, obj_lty, &grid_obj_ltx, &grid_obj_lty); dx = dy = 0; ! /* XSetInputFocus (mainDisplay, drawWindow, RevertToNone, CurrentTime); */ ! XGrabPointer (mainDisplay, drawWindow, False, PointerMotionMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! if (XCheckMaskEvent (mainDisplay, PointerMotionMask, &input)) ! { first_time = FALSE; cursor_x = input.xmotion.x; cursor_y = input.xmotion.y; ! while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &input)) ! { cursor_x = input.xmotion.x; cursor_y = input.xmotion.y; } ! GridXY (cursor_x, cursor_y, &orig_x, &orig_y); grid_dx = orig_x-grid_obj_ltx; grid_dy = orig_y-grid_obj_lty; ! SelBox (drawWindow, revDefaultGC, obj_ltx+grid_dx, obj_lty+grid_dy, obj_rbx+grid_dx, obj_rby+grid_dy); } ! while (placing) ! { ! XNextEvent (mainDisplay, &input); ! if (first_time) ! { first_time = FALSE; ! XQueryPointer (mainDisplay, drawWindow, &root_win, &child_win, &root_x, &root_y, &cursor_x, &cursor_y, &status); ! GridXY (cursor_x, cursor_y, &orig_x, &orig_y); grid_dx = orig_x-grid_obj_ltx; grid_dy = orig_y-grid_obj_lty; ! SelBox (drawWindow, revDefaultGC, obj_ltx+grid_dx, obj_lty+grid_dy, obj_rbx+grid_dx, obj_rby+grid_dy); } ! if (input.type == Expose || input.type == VisibilityNotify) ! { ! SelBox (drawWindow, revDefaultGC, obj_ltx+grid_dx, obj_lty+grid_dy, obj_rbx+grid_dx, obj_rby+grid_dy); ! ExposeEventHandler (&input, TRUE); ! SelBox (drawWindow, revDefaultGC, obj_ltx+grid_dx, obj_lty+grid_dy, obj_rbx+grid_dx, obj_rby+grid_dy); ! } ! else if (input.type == ButtonPress) ! { ! XUngrabPointer (mainDisplay, CurrentTime); button_pressed = input.xbutton.button; placing = FALSE; ! SelBox (drawWindow, revDefaultGC, obj_ltx+grid_dx+dx, obj_lty+grid_dy+dy, obj_rbx+grid_dx+dx, obj_rby+grid_dy+dy); grid_dx = ABS_SIZE(grid_dx+dx); grid_dy = ABS_SIZE(grid_dy+dy); ! MoveObj (ObjPtr, grid_dx, grid_dy); numRedrawBBox = 0; ! ShowInterrupt (1); placingTopObj = FALSE; ObjPtr->tmp_parent = NULL; ! DrawObj (drawWindow, ObjPtr); HideInterrupt(); ! } ! else if (input.type == MotionNotify) ! { x = input.xmotion.x; y = input.xmotion.y; ! GridXY (x, y, &grid_x, &grid_y); ! SelBox (drawWindow, revDefaultGC, obj_ltx+grid_dx+dx, obj_lty+grid_dy+dy, obj_rbx+grid_dx+dx, obj_rby+grid_dy+dy); dx = grid_x - orig_x; dy = grid_y - orig_y; ! SelBox (drawWindow, revDefaultGC, obj_ltx+grid_dx+dx, obj_lty+grid_dy+dy, obj_rbx+grid_dx+dx, obj_rby+grid_dy+dy); ! MarkRulers (grid_x, grid_y); ! while (XCheckMaskEvent (mainDisplay, PointerMotionMask, &ev)) ; } } ! XSync (mainDisplay, True); placingTopObj = FALSE; return button_pressed; --- 185,340 ---- RedrawColorWindow(); } ! obj_ptr = NULL; ! if (read_status == INVALID) { ! sprintf(gszMsgBox, "File version too large (=%1d).\n\nRead symbol aborted!", fileVersion); ! Msg(gszMsgBox); } ! SetDefaultCursor(mainWindow); ! ShowCursor(); ! return obj_ptr; } ! struct ObjRec *GetObjRepresentation(PathName, SymName, FileType) ! char *PathName, *SymName; ! int FileType; { ! char file_name[MAXPATHLENGTH], *rest, tmp_filename[MAXPATHLENGTH]; ! int short_name, tmp_linenum; ! struct ObjRec *obj_ptr; ! FILE *fp; ! ! sprintf(file_name, "%s/%s.%s", PathName, SymName, SYM_FILE_EXT); ! if ((short_name=IsPrefix(bootDir, file_name, &rest))) ++rest; ! ! if ((fp=fopen(file_name, "r")) == NULL) { ! if (short_name) { ! sprintf(gszMsgBox, "Can not open '%s'\n", rest); ! } else { ! sprintf(gszMsgBox, "Can not open '%s'\n", file_name); ! } ! Msg(gszMsgBox); ! return NULL; } ! strcpy(tmp_filename, scanFileName); tmp_linenum = scanLineNum; ! strcpy(scanFileName, (short_name ? rest : file_name)); scanLineNum = 0; ! if ((obj_ptr=ReadSymbol(fp, FileType)) != NULL) { obj_ptr->id = objId++; obj_ptr->dirty = FALSE; ! strcpy(obj_ptr->detail.r->s, SymName); obj_ptr->detail.r->rotate = ROTATE0; obj_ptr->detail.r->flip = NO_FLIP; obj_ptr->detail.r->deck_index = (-1); ! AdjObjBBox(obj_ptr); } ! strcpy(scanFileName, tmp_filename); scanLineNum = tmp_linenum; ! fclose(fp); ! return obj_ptr; } ! unsigned int PlaceTopObj(ObjPtr) ! struct ObjRec *ObjPtr; { ! int x, y, grid_x, grid_y, dx, dy, placing=TRUE; ! int cursor_x, cursor_y, orig_x, orig_y, obj_ltx, obj_lty, obj_rbx, obj_rby; ! int grid_obj_ltx, grid_obj_lty, grid_dx=0, grid_dy=0; ! Window root_win, child_win; ! int root_x, root_y, first_time=TRUE; ! unsigned int status, button_pressed=Button1; ! XEvent input, ev; ! RedrawMsg(); ! XFlush(mainDisplay); ! XSync(mainDisplay, False); placingTopObj = TRUE; ! if (XCheckMaskEvent(mainDisplay, ExposureMask, &ev) || ! XCheckMaskEvent(mainDisplay, VisibilityChangeMask, &ev)) { ! ExposeEventHandler(&ev, TRUE); ! } obj_ltx = OFFSET_X(ObjPtr->obbox.ltx); obj_lty = OFFSET_Y(ObjPtr->obbox.lty); obj_rbx = OFFSET_X(ObjPtr->obbox.rbx); obj_rby = OFFSET_Y(ObjPtr->obbox.rby); ! GridXY(obj_ltx, obj_lty, &grid_obj_ltx, &grid_obj_lty); dx = dy = 0; ! XGrabPointer(mainDisplay, drawWindow, False, PointerMotionMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); ! if (XCheckMaskEvent(mainDisplay, PointerMotionMask, &input)) { first_time = FALSE; cursor_x = input.xmotion.x; cursor_y = input.xmotion.y; ! while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &input)) { cursor_x = input.xmotion.x; cursor_y = input.xmotion.y; } ! GridXY(cursor_x, cursor_y, &orig_x, &orig_y); grid_dx = orig_x-grid_obj_ltx; grid_dy = orig_y-grid_obj_lty; ! SelBox(drawWindow, revDefaultGC, obj_ltx+grid_dx, obj_lty+grid_dy, obj_rbx+grid_dx, obj_rby+grid_dy); } ! while (placing) { ! XNextEvent(mainDisplay, &input); ! if (first_time) { first_time = FALSE; ! XQueryPointer(mainDisplay, drawWindow, &root_win, &child_win, &root_x, &root_y, &cursor_x, &cursor_y, &status); ! GridXY(cursor_x, cursor_y, &orig_x, &orig_y); grid_dx = orig_x-grid_obj_ltx; grid_dy = orig_y-grid_obj_lty; ! SelBox(drawWindow, revDefaultGC, obj_ltx+grid_dx, obj_lty+grid_dy, obj_rbx+grid_dx, obj_rby+grid_dy); } ! if (input.type == Expose || input.type == VisibilityNotify) { ! SelBox(drawWindow, revDefaultGC, obj_ltx+grid_dx, obj_lty+grid_dy, obj_rbx+grid_dx, obj_rby+grid_dy); ! ExposeEventHandler(&input, TRUE); ! SelBox(drawWindow, revDefaultGC, obj_ltx+grid_dx, obj_lty+grid_dy, obj_rbx+grid_dx, obj_rby+grid_dy); ! } else if (input.type == ButtonPress) { ! XUngrabPointer(mainDisplay, CurrentTime); button_pressed = input.xbutton.button; placing = FALSE; ! SelBox(drawWindow, revDefaultGC, obj_ltx+grid_dx+dx, obj_lty+grid_dy+dy, obj_rbx+grid_dx+dx, obj_rby+grid_dy+dy); grid_dx = ABS_SIZE(grid_dx+dx); grid_dy = ABS_SIZE(grid_dy+dy); ! MoveObj(ObjPtr, grid_dx, grid_dy); numRedrawBBox = 0; ! ShowInterrupt(1); placingTopObj = FALSE; ObjPtr->tmp_parent = NULL; ! DrawObj(drawWindow, ObjPtr); HideInterrupt(); ! } else if (input.type == MotionNotify) { x = input.xmotion.x; y = input.xmotion.y; ! GridXY(x, y, &grid_x, &grid_y); ! SelBox(drawWindow, revDefaultGC, obj_ltx+grid_dx+dx, obj_lty+grid_dy+dy, obj_rbx+grid_dx+dx, obj_rby+grid_dy+dy); dx = grid_x - orig_x; dy = grid_y - orig_y; ! SelBox(drawWindow, revDefaultGC, obj_ltx+grid_dx+dx, obj_lty+grid_dy+dy, obj_rbx+grid_dx+dx, obj_rby+grid_dy+dy); ! MarkRulers(grid_x, grid_y); ! while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } } ! XSync(mainDisplay, True); placingTopObj = FALSE; return button_pressed; *************** *** 347,390 **** static ! int UnMakeIconicOnInstantiate (obj_ptr) ! struct ObjRec * obj_ptr; { ! register struct AttrRec * attr_ptr; ! for (attr_ptr=obj_ptr->lattr; attr_ptr!=NULL; attr_ptr=attr_ptr->prev) if (*attr_ptr->attr_name.s=='\0' && ! strcmp (attr_ptr->attr_value.s, "unmakeiconic_on_instantiate")==0) ! return (TRUE); ! return (FALSE); } static ! void DeleteUnMakeIconicOnInstantiateText () { ! struct SelRec * sel_ptr; ! struct ObjRec * text_obj_ptr=NULL; ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) if (sel_ptr->obj->type == OBJ_TEXT && ! strcmp (sel_ptr->obj->detail.t->first->dyn_str.s, ! "unmakeiconic_on_instantiate") == 0) ! { text_obj_ptr = sel_ptr->obj; break; } ! if (text_obj_ptr == NULL) ! { ! fprintf (stderr, "Warning: Can not find the '%s' text object.\n", "unmakeiconic_on_instantiate"); ! fprintf (stderr, "Please send bug report to william@cs.ucla.edu.\n"); ! sprintf (gszMsgBox, "%s '%s' %s.\n\n%s.", "Warning: Can not find the", "unmakeiconic_on_instantiate", "text object", "Please send bug report to william@cs.ucla.edu"); ! MsgBox (gszMsgBox, TOOL_NAME, INFO_MB); ! XFlush (mainDisplay); ! XSync (mainDisplay, False); return; } ! MakeQuiescent (); topSel = (struct SelRec *)malloc(sizeof(struct SelRec)); if (topSel == NULL) FailAllocMessage(); --- 342,386 ---- static ! int UnMakeIconicOnInstantiate(obj_ptr) ! struct ObjRec *obj_ptr; { ! register struct AttrRec *attr_ptr; ! for (attr_ptr=obj_ptr->lattr; attr_ptr!=NULL; attr_ptr=attr_ptr->prev) { if (*attr_ptr->attr_name.s=='\0' && ! strcmp(attr_ptr->attr_value.s, "unmakeiconic_on_instantiate")==0) { ! return TRUE; ! } ! } ! return FALSE; } static ! void DeleteUnMakeIconicOnInstantiateText() { ! struct SelRec *sel_ptr; ! struct ObjRec *text_obj_ptr=NULL; ! for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { if (sel_ptr->obj->type == OBJ_TEXT && ! strcmp(sel_ptr->obj->detail.t->first->dyn_str.s, ! "unmakeiconic_on_instantiate") == 0) { text_obj_ptr = sel_ptr->obj; break; } ! } ! if (text_obj_ptr == NULL) { ! fprintf(stderr, "Warning: Can not find the '%s' text object.\n", "unmakeiconic_on_instantiate"); ! fprintf(stderr, "Please send bug report to william@cs.ucla.edu.\n"); ! sprintf(gszMsgBox, "%s '%s' %s.\n\n%s.", "Warning: Can not find the", "unmakeiconic_on_instantiate", "text object", "Please send bug report to william@cs.ucla.edu"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! XFlush(mainDisplay); ! XSync(mainDisplay, False); return; } ! MakeQuiescent(); topSel = (struct SelRec *)malloc(sizeof(struct SelRec)); if (topSel == NULL) FailAllocMessage(); *************** *** 393,496 **** topSel->prev = NULL; botSel = topSel; ! UpdSelBBox (); ! HighLightForward (); ! DelAllSelObj (); } ! void UnMakeIconic (); ! void Instantiate () { ! char file_name[MAXPATHLENGTH], * rest, msg[MAXSTRING]; ! char sym_name[MAXPATHLENGTH], path_name[MAXPATHLENGTH]; ! char ext_str[MAXPATHLENGTH]; ! int short_name; ! struct ObjRec * obj_ptr; ! FILE * fp; ! XEvent ev; ! int tmp_linenum, len, ext_len; ! char tmp_filename[MAXPATHLENGTH]; ! ! TieLooseEnds (); ! SetCurChoice (NOTHING); ! if (topSel!=NULL) { HighLightReverse (); RemoveAllSel (); } ! sprintf (msg, "Please select a symbol to INSTANTIATE in the '%s' domain...", curDomainName); ! if (SelectFromLibrary (msg, SYM_FILE_EXT, sym_name, path_name) == INVALID) return; ! if (XCheckMaskEvent (mainDisplay, ExposureMask, &ev) || ! XCheckMaskEvent (mainDisplay, VisibilityChangeMask, &ev)) ! ExposeEventHandler (&ev, TRUE); ! ! sprintf (file_name, "%s/%s", path_name, sym_name); ! ! len = strlen (sym_name); ! sprintf (ext_str, ".%s", SYM_FILE_EXT); ! ext_len = strlen (ext_str); ! if (len > ext_len && strcmp (ext_str, &sym_name[len-ext_len]) == 0) sym_name[len-ext_len] = '\0'; ! if ((short_name = IsPrefix (bootDir, file_name, &rest))) ++rest; ! ! if ((fp = fopen (file_name, "r")) == NULL) ! { ! if (short_name) ! sprintf (msg, "Can not instantiate '%s'.", rest); ! else ! sprintf (msg, "Can not instantiate '%s'.", file_name); ! Msg (msg); return; } ! strcpy (tmp_filename, scanFileName); tmp_linenum = scanLineNum; ! strcpy (scanFileName, (short_name ? rest : file_name)); scanLineNum = 0; ! SetWatchCursor (drawWindow); ! SetWatchCursor (mainWindow); ! if ((obj_ptr = ReadSymbol (fp)) != NULL) ! { ! if (short_name) ! sprintf (msg, "Instantiating '%s'...", rest); ! else ! sprintf (msg, "Instantiating '%s'...", file_name); ! Msg (msg); obj_ptr->id = objId++; obj_ptr->dirty = FALSE; ! strcpy (obj_ptr->detail.r->s, sym_name); obj_ptr->detail.r->rotate = ROTATE0; obj_ptr->detail.r->flip = NO_FLIP; obj_ptr->detail.r->deck_index = (-1); ! PlaceTopObj (obj_ptr); ! AssignNewObjIds (obj_ptr); ! AddObj (NULL, topObj, obj_ptr); ! AdjObjBBox (obj_ptr); ! ! SelectTopObj (); ! if (UnMakeIconicOnInstantiate (obj_ptr)) ! { ! StartCompositeCmd (); ! RecordNewObjCmd (); ! UnMakeIconic (); ! UngroupSelObj (); ! DeleteUnMakeIconicOnInstantiateText (); ! EndCompositeCmd (); ! } ! else ! RecordNewObjCmd (); ! SetFileModified (TRUE); justDupped = FALSE; } ! fclose (fp); ! strcpy (scanFileName, tmp_filename); scanLineNum = tmp_linenum; ! SetDefaultCursor (mainWindow); ! SetDefaultCursor (drawWindow); ! Msg (""); if (topSel != NULL && topSel == botSel && topSel->obj->type == OBJ_ICON) { --- 389,486 ---- topSel->prev = NULL; botSel = topSel; ! UpdSelBBox(); ! HighLightForward(); ! DelAllSelObj(); } ! void UnMakeIconic(); ! void Instantiate() { ! char file_name[MAXPATHLENGTH], *rest, msg[MAXSTRING]; ! char sym_name[MAXPATHLENGTH], path_name[MAXPATHLENGTH]; ! char ext_str[MAXPATHLENGTH], tmp_filename[MAXPATHLENGTH]; ! int short_name, file_type=SYM_FILE_TYPE, tmp_linenum, len, ext_len; ! struct ObjRec *obj_ptr; ! FILE *fp; ! XEvent ev; ! TieLooseEnds(); ! SetCurChoice(NOTHING); ! if (topSel!=NULL) { HighLightReverse(); RemoveAllSel(); } ! ! sprintf(msg, "Please select a symbol to INSTANTIATE in the '%s' domain...", curDomainName); ! if (SelectFromLibrary(msg, SYM_FILE_EXT, sym_name, path_name) == INVALID) { return; + } + if (XCheckMaskEvent(mainDisplay, ExposureMask, &ev) || + XCheckMaskEvent(mainDisplay, VisibilityChangeMask, &ev)) { + ExposeEventHandler(&ev, TRUE); + } + sprintf(file_name, "%s/%s", path_name, sym_name); ! len = strlen(sym_name); ! sprintf(ext_str, ".%s", SYM_FILE_EXT); ! ext_len = strlen(ext_str); ! if (len > ext_len && strcmp(ext_str, &sym_name[len-ext_len]) == 0) { sym_name[len-ext_len] = '\0'; + } + if ((short_name=IsPrefix(bootDir, file_name, &rest))) ++rest; ! if ((fp=fopen(file_name, "r")) == NULL) { ! sprintf(gszMsgBox, "Can not instantiate '%s'.", ! (short_name ? rest : file_name)); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); return; } ! strcpy(tmp_filename, scanFileName); tmp_linenum = scanLineNum; ! strcpy(scanFileName, (short_name ? rest : file_name)); scanLineNum = 0; ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! if ((obj_ptr=ReadSymbol(fp, file_type)) != NULL) { ! if (short_name) { ! sprintf(msg, "Instantiating '%s'...", rest); ! } else { ! sprintf(msg, "Instantiating '%s'...", file_name); ! } ! Msg(msg); obj_ptr->id = objId++; obj_ptr->dirty = FALSE; ! strcpy(obj_ptr->detail.r->s, sym_name); obj_ptr->detail.r->rotate = ROTATE0; obj_ptr->detail.r->flip = NO_FLIP; obj_ptr->detail.r->deck_index = (-1); ! PlaceTopObj(obj_ptr); ! AssignNewObjIds(obj_ptr); ! AddObj(NULL, topObj, obj_ptr); ! AdjObjBBox(obj_ptr); ! ! SelectTopObj(); ! if (UnMakeIconicOnInstantiate(obj_ptr)) { ! StartCompositeCmd(); ! RecordNewObjCmd(); ! UnMakeIconic(); ! UngroupSelObj(); ! DeleteUnMakeIconicOnInstantiateText(); ! EndCompositeCmd(); ! } else { ! RecordNewObjCmd(); ! } ! SetFileModified(TRUE); justDupped = FALSE; } ! fclose(fp); ! strcpy(scanFileName, tmp_filename); scanLineNum = tmp_linenum; ! SetDefaultCursor(mainWindow); ! SetDefaultCursor(drawWindow); ! Msg(""); if (topSel != NULL && topSel == botSel && topSel->obj->type == OBJ_ICON) { *************** *** 504,565 **** } ! void MakeSymbolic () { ! if (topSel!=NULL && topSel==botSel && topSel->obj->type!=OBJ_SYM) ! { ! HighLightReverse (); ! PrepareToRecord (CMD_REPLACE, topSel, botSel, numObjSelected); ! ! if (topSel->obj->type != OBJ_GROUP && topSel->obj->type != OBJ_ICON) ! { ! GroupSingleObj (); ! if (topSel->obj->fattr != NULL) ! Msg ("Object's attributes are promoted to the new symbol object."); ! } ! topSel->obj->type = OBJ_SYM; ! Msg ("Selected object is now SYMBOLIC."); ! AdjObjBBox (topSel->obj); ! UpdSelBBox (); ! RecordCmd (CMD_REPLACE, NULL, topSel, botSel, numObjSelected); ! RedrawAnArea (botObj, ! botSel->obj->obbox.ltx-QUARTER_INCH-GRID_ABS_SIZE(1), ! botSel->obj->obbox.lty-QUARTER_INCH-GRID_ABS_SIZE(1), ! botSel->obj->obbox.rbx+QUARTER_INCH+GRID_ABS_SIZE(1), ! botSel->obj->obbox.rby+QUARTER_INCH+GRID_ABS_SIZE(1)); ! HighLightForward (); ! SetFileModified (TRUE); ! justDupped = FALSE; } ! else ! Msg ("Please select one non-symbol object to make it Symbolic."); } ! void UnMakeSymbolic () { ! register struct ObjRec * obj_ptr; ! register int ltx = 0, lty = 0, rbx = 0, rby = 0; ! struct SelRec * sel_ptr = topSel; ! int modified = FALSE; ! ! StartCompositeCmd (); ! for ( ; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! { obj_ptr = sel_ptr->obj; ! if (obj_ptr->type == OBJ_SYM) ! { ! PrepareToReplaceAnObj (obj_ptr); obj_ptr->type = OBJ_GROUP; ! AdjObjBBox (obj_ptr); ! RecordReplaceAnObj (obj_ptr); ! if (modified) ! { if (obj_ptr->bbox.ltx < ltx) ltx = obj_ptr->bbox.ltx; if (obj_ptr->bbox.lty < lty) lty = obj_ptr->bbox.lty; if (obj_ptr->bbox.rbx > rbx) rbx = obj_ptr->bbox.rbx; if (obj_ptr->bbox.rby > rby) rby = obj_ptr->bbox.rby; ! } ! else ! { ltx = obj_ptr->bbox.ltx; lty = obj_ptr->bbox.lty; rbx = obj_ptr->bbox.rbx; rby = obj_ptr->bbox.rby; --- 494,558 ---- } ! void MakeSymbolic() { ! if (curChoice == VERTEXMODE) { ! sprintf(gszMsgBox, "Cannot MakeSymbolic() in vertex mode!"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } else if (topSel == NULL || topSel != botSel) { ! sprintf(gszMsgBox, "Please select only one object for MakeSymbolic()!"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } else if (topSel->obj->type == OBJ_SYM) { ! sprintf(gszMsgBox, "Selected object is already symbolic!"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! return; ! } ! HighLightReverse(); ! PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); ! if (topSel->obj->type != OBJ_GROUP && topSel->obj->type != OBJ_ICON) { ! GroupSingleObj(FALSE); ! if (topSel->obj->fattr != NULL) { ! Msg("Object's attributes are promoted to the new symbol object."); ! } } ! ! topSel->obj->type = OBJ_SYM; ! Msg("Selected object is now SYMBOLIC."); ! AdjObjBBox(topSel->obj); ! UpdSelBBox(); ! RecordCmd(CMD_REPLACE, NULL, topSel, botSel, numObjSelected); ! RedrawAnArea(botObj, ! botSel->obj->obbox.ltx-QUARTER_INCH-GRID_ABS_SIZE(1), ! botSel->obj->obbox.lty-QUARTER_INCH-GRID_ABS_SIZE(1), ! botSel->obj->obbox.rbx+QUARTER_INCH+GRID_ABS_SIZE(1), ! botSel->obj->obbox.rby+QUARTER_INCH+GRID_ABS_SIZE(1)); ! HighLightForward(); ! SetFileModified(TRUE); ! justDupped = FALSE; } ! void UnMakeSymbolic() { ! register struct ObjRec *obj_ptr; ! register int ltx=0, lty=0, rbx=0, rby=0; ! struct SelRec *sel_ptr=topSel; ! int modified=FALSE; ! ! StartCompositeCmd(); ! for ( ; sel_ptr != NULL; sel_ptr=sel_ptr->next) { obj_ptr = sel_ptr->obj; ! if (obj_ptr->type == OBJ_SYM) { ! PrepareToReplaceAnObj(obj_ptr); obj_ptr->type = OBJ_GROUP; ! AdjObjBBox(obj_ptr); ! RecordReplaceAnObj(obj_ptr); ! if (modified) { if (obj_ptr->bbox.ltx < ltx) ltx = obj_ptr->bbox.ltx; if (obj_ptr->bbox.lty < lty) lty = obj_ptr->bbox.lty; if (obj_ptr->bbox.rbx > rbx) rbx = obj_ptr->bbox.rbx; if (obj_ptr->bbox.rby > rby) rby = obj_ptr->bbox.rby; ! } else { ltx = obj_ptr->bbox.ltx; lty = obj_ptr->bbox.lty; rbx = obj_ptr->bbox.rbx; rby = obj_ptr->bbox.rby; *************** *** 568,673 **** } } ! EndCompositeCmd (); ! if (modified) ! { ! HighLightReverse (); ! UpdSelBBox (); ! RedrawAnArea (botObj, ltx-QUARTER_INCH-GRID_ABS_SIZE(1), lty-QUARTER_INCH-GRID_ABS_SIZE(1),rbx+QUARTER_INCH+GRID_ABS_SIZE(1), rby+QUARTER_INCH+GRID_ABS_SIZE(1)); ! HighLightForward (); ! SetFileModified (TRUE); justDupped = FALSE; } } ! void MakeIconic () { ! char icon_name[MAXPATHLENGTH], file_name[MAXPATHLENGTH]; ! char s[MAXPATHLENGTH], icon_full_name[MAXPATHLENGTH], * rest; ! char obj_ext_str[MAXSTRING], sym_ext_str[MAXSTRING]; ! FILE * fp; ! int len, short_name, obj_ext_len, sym_ext_len; ! int ltx, lty, rbx, rby; ! ! if (topSel!=NULL && topSel==botSel) ! { ! Dialog ("Please enter name of the icon:", ! "( : accept, : cancel )", icon_name); ! len = strlen (icon_name); ! if (*icon_name == '\0') ! { ! Msg ("Name not specified, icon not created."); return; } ! ! sprintf (obj_ext_str, ".%s", OBJ_FILE_EXT); ! sprintf (sym_ext_str, ".%s", SYM_FILE_EXT); ! obj_ext_len = strlen (obj_ext_str); ! sym_ext_len = strlen (sym_ext_str); ! ! if (len >= obj_ext_len || len >= sym_ext_len) ! { ! if (strcmp (&icon_name[len-obj_ext_len], obj_ext_str) == 0) ! { ! Msg ("Can not save as an object file, icon not created."); return; ! } ! else if (strcmp (&icon_name[len-sym_ext_len], sym_ext_str) != 0) ! { ! strcpy (icon_full_name, icon_name); ! strcat (icon_full_name, sym_ext_str); ! } ! ! if (strlen (icon_full_name) == sym_ext_len) ! { ! Msg ("No file name specified. File not saved."); return; } } ! else ! { ! strcpy (icon_full_name, icon_name); ! strcat (icon_full_name, sym_ext_str); ! } ! ! sprintf (file_name, "%s/%s", curDir, icon_full_name); ! ! if (!OkayToCreateFile (file_name)) return; ! if ((short_name = IsPrefix (bootDir, file_name, &rest))) ++rest; ! ! if ((fp = fopen (file_name, "w")) == NULL) ! { ! if (short_name) ! sprintf (s, "Can not create '%s', icon not created.", rest); ! else ! sprintf (s, "Can not create '%s', icon not created.", file_name); ! Msg (s); return; } ! if (!DirInSymPath (curDir)) UpdateSymInfo (); ! if (short_name) ! sprintf (s, "Creating '%s' ...", rest); ! else ! sprintf (s, "Creating '%s' ...", file_name); ! Msg (s); ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY; ! PrepareToRecord (CMD_REPLACE, topSel, botSel, numObjSelected); if (topSel->obj->type == OBJ_GROUP || topSel->obj->type == OBJ_SYM || ! topSel->obj->type == OBJ_ICON) ! JustMoveSelToTop (); ! else ! { ! GroupSingleObj (); ! if (topSel->obj->fattr != NULL) ! Msg ("Object's attributes are promoted to the new icon object."); } topSel->obj->type = OBJ_SYM; ! strcpy (topSel->obj->detail.r->s, icon_name); topSel->obj->detail.r->rotate = ROTATE0; topSel->obj->detail.r->flip = NO_FLIP; --- 561,655 ---- } } ! EndCompositeCmd(); ! if (modified) { ! HighLightReverse(); ! UpdSelBBox(); ! RedrawAnArea(botObj, ltx-QUARTER_INCH-GRID_ABS_SIZE(1), lty-QUARTER_INCH-GRID_ABS_SIZE(1),rbx+QUARTER_INCH+GRID_ABS_SIZE(1), rby+QUARTER_INCH+GRID_ABS_SIZE(1)); ! HighLightForward(); ! SetFileModified(TRUE); justDupped = FALSE; } } ! void MakeIconic() { ! char icon_name[MAXPATHLENGTH], file_name[MAXPATHLENGTH]; ! char s[MAXPATHLENGTH], icon_full_name[MAXPATHLENGTH], * rest; ! char obj_ext_str[MAXSTRING], sym_ext_str[MAXSTRING]; ! FILE *fp; ! int len, short_name, obj_ext_len, sym_ext_len, ltx, lty, rbx, rby; ! ! if (topSel!=NULL && topSel==botSel) { ! Dialog("Please enter name of the icon:", NULL, icon_name); ! len = strlen(icon_name); ! if (*icon_name == '\0') { ! Msg("Name not specified, icon not created."); return; } ! sprintf(obj_ext_str, ".%s", OBJ_FILE_EXT); ! sprintf(sym_ext_str, ".%s", SYM_FILE_EXT); ! obj_ext_len = strlen(obj_ext_str); ! sym_ext_len = strlen(sym_ext_str); ! ! if (len >= obj_ext_len || len >= sym_ext_len) { ! if (strcmp(&icon_name[len-obj_ext_len], obj_ext_str) == 0) { ! MsgBox("Can not save as an object file, icon not created.", ! TOOL_NAME, INFO_MB); return; ! } else if (strcmp(&icon_name[len-sym_ext_len], sym_ext_str) != 0) { ! strcpy(icon_full_name, icon_name); ! strcat(icon_full_name, sym_ext_str); ! } ! if (strlen(icon_full_name) == sym_ext_len) { ! MsgBox("No file name specified. File not saved.", ! TOOL_NAME, INFO_MB); return; } + } else { + strcpy(icon_full_name, icon_name); + strcat(icon_full_name, sym_ext_str); } ! ! sprintf(file_name, "%s/%s", curDir, icon_full_name); ! ! if (!OkayToCreateFile(file_name)) return; ! if ((short_name=IsPrefix(bootDir, file_name, &rest))) ++rest; ! ! if ((fp=fopen(file_name, "w")) == NULL) { ! if (short_name) { ! sprintf(s, "Can not create '%s', icon not created.", rest); ! } else { ! sprintf(s, "Can not create '%s', icon not created.", file_name); ! } ! MsgBox(s, TOOL_NAME, INFO_MB); return; } ! if (!DirInSymPath(curDir)) UpdateSymInfo(); ! if (short_name) { ! sprintf(s, "Creating '%s' ...", rest); ! } else { ! sprintf(s, "Creating '%s' ...", file_name); ! } ! Msg(s); ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY; ! PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); if (topSel->obj->type == OBJ_GROUP || topSel->obj->type == OBJ_SYM || ! topSel->obj->type == OBJ_ICON) { ! JustMoveSelToTop(); ! } else { ! GroupSingleObj(FALSE); ! if (topSel->obj->fattr != NULL) { ! Msg("Object's attributes are promoted to the new icon object."); ! } } topSel->obj->type = OBJ_SYM; ! strcpy(topSel->obj->detail.r->s, icon_name); topSel->obj->detail.r->rotate = ROTATE0; topSel->obj->detail.r->flip = NO_FLIP; *************** *** 675,753 **** writeFileFailed = FALSE; ! Save (fp, topSel->obj, 0, 1); ! if (writeFileFailed) ! { writeFileFailed = FALSE; ! sprintf (s, "%s '%s'.\n\n%s.\n\n'%s' deleted.", "Fail to write to", file_name, "File system may be full", file_name); ! MsgBox (s, TOOL_NAME, INFO_MB); ! unlink (file_name); ! } ! else ! { ! if (short_name) ! sprintf (s, "File '%s' created.", rest); ! else ! sprintf (s, "File '%s' created.", file_name); ! Msg (s); } ! fclose (fp); ! HighLightReverse (); topSel->obj->type = OBJ_ICON; topSel->obj->id = objId++; ! Msg ("Selected object is now ICONIC."); ! AdjObjBBox (topSel->obj); ! UpdSelBBox (); ! RecordCmd (CMD_REPLACE, NULL, topSel, botSel, numObjSelected); ltx = min(ltx,selLtX); lty = min(lty,selLtY); rbx = max(rbx,selRbX); rby = max(rby,selRbY); ! RedrawAnArea (botObj, ltx-GRID_ABS_SIZE(1), lty-GRID_ABS_SIZE(1), rbx+GRID_ABS_SIZE(1), rby+GRID_ABS_SIZE(1)); ! HighLightForward (); ! SetFileModified (TRUE); justDupped = FALSE; } - else - Msg ("Please select one object to make it ICONIC."); } ! void UnMakeIconic () { ! register struct ObjRec * obj_ptr; ! struct SelRec * sel_ptr; ! struct AttrRec * attr_ptr; ! int modified = FALSE; ! ! HighLightReverse (); ! StartCompositeCmd (); ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! { obj_ptr = sel_ptr->obj; ! if (obj_ptr->type == OBJ_ICON) ! { modified = TRUE; ! PrepareToReplaceAnObj (obj_ptr); obj_ptr->type = OBJ_GROUP; attr_ptr = obj_ptr->fattr; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) attr_ptr->inherited = FALSE; ! AdjObjBBox (obj_ptr); ! RecordReplaceAnObj (obj_ptr); } } ! EndCompositeCmd (); ! if (modified) ! { ! Msg ("Selected ICONIC objects are GROUP objects now."); ! UpdSelBBox (); ! RedrawAnArea (botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! SetFileModified (TRUE); justDupped = FALSE; } ! HighLightForward (); } --- 657,731 ---- writeFileFailed = FALSE; ! Save(fp, topSel->obj, 0, 1); ! if (writeFileFailed) { writeFileFailed = FALSE; ! sprintf(s, "%s '%s'.\n\n%s.\n\n'%s' deleted.", "Fail to write to", file_name, "File system may be full", file_name); ! MsgBox(s, TOOL_NAME, INFO_MB); ! unlink(file_name); ! } else { ! if (short_name) { ! sprintf(s, "File '%s' created.", rest); ! } else { ! sprintf(s, "File '%s' created.", file_name); ! } ! Msg(s); } ! fclose(fp); ! HighLightReverse(); topSel->obj->type = OBJ_ICON; topSel->obj->id = objId++; ! Msg("Selected object is now ICONIC."); ! AdjObjBBox(topSel->obj); ! UpdSelBBox(); ! RecordCmd(CMD_REPLACE, NULL, topSel, botSel, numObjSelected); ltx = min(ltx,selLtX); lty = min(lty,selLtY); rbx = max(rbx,selRbX); rby = max(rby,selRbY); ! RedrawAnArea(botObj, ltx-GRID_ABS_SIZE(1), lty-GRID_ABS_SIZE(1), rbx+GRID_ABS_SIZE(1), rby+GRID_ABS_SIZE(1)); ! HighLightForward(); ! SetFileModified(TRUE); justDupped = FALSE; + } else { + MsgBox("Please select one object to make it ICONIC.", TOOL_NAME, INFO_MB); } } ! void UnMakeIconic() { ! register struct ObjRec *obj_ptr; ! struct SelRec *sel_ptr; ! struct AttrRec *attr_ptr; ! int modified=FALSE; ! ! HighLightReverse(); ! StartCompositeCmd(); ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { obj_ptr = sel_ptr->obj; ! if (obj_ptr->type == OBJ_ICON) { modified = TRUE; ! PrepareToReplaceAnObj(obj_ptr); obj_ptr->type = OBJ_GROUP; attr_ptr = obj_ptr->fattr; ! for ( ; attr_ptr != NULL; attr_ptr=attr_ptr->next) { attr_ptr->inherited = FALSE; ! } ! AdjObjBBox(obj_ptr); ! RecordReplaceAnObj(obj_ptr); } } ! EndCompositeCmd(); ! if (modified) { ! Msg("Selected ICONIC objects are GROUP objects now."); ! UpdSelBBox(); ! RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! SetFileModified(TRUE); justDupped = FALSE; } ! HighLightForward(); } *************** *** 1147,1156 **** } } ! if (firstCmd != NULL) ! { sprintf(gszMsgBox, "MergeWithTable can not be undone.\n\n%s", "Ok to proceed? [ync](y)"); if (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) != MB_ID_YES) return; ! CleanUpCmds (); } if (SelectFileNameToImport("Please select a text file for MergeWithTable...", --- 1125,1133 ---- } } ! if (firstCmd != NULL) { sprintf(gszMsgBox, "MergeWithTable can not be undone.\n\n%s", "Ok to proceed? [ync](y)"); if (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) != MB_ID_YES) return; ! CleanUpCmds(); } if (SelectFileNameToImport("Please select a text file for MergeWithTable...", *************** *** 1657,1708 **** } ! void SpecialSubMenu (index) ! int index; { ! switch (index) ! { ! case SPECIAL_SYM: MakeSymbolic (); break; ! case SPECIAL_UNSYM: UnMakeSymbolic (); break; ! case SPECIAL_INST: Instantiate (); break; ! case SPECIAL_ICON: MakeIconic (); break; ! case SPECIAL_UNICON: UnMakeIconic (); break; ! case SPECIAL_PUSH: PushIcon (); break; ! case SPECIAL_POP: PopIcon (); break; ! case SPECIAL_ADDATTR: AddAttrs (); break; ! case SPECIAL_DETACHATTR: DetachAttrs (); break; ! case SPECIAL_SHOWATTR: ShowAllAttrs (); break; ! case SPECIAL_SHOWATTRNAME: ShowAllAttrNames (); break; ! case SPECIAL_HIDEATTR: HideAllAttrs (); break; ! case SPECIAL_HIDEATTRNAME: HideAllAttrNames (); break; ! case SPECIAL_MOVEATTR: MoveAttr (); break; ! case SPECIAL_EDITATTR: EditAttrs (); break; ! case SPECIAL_ANIMATESEND: AnimateSel (); break; ! case SPECIAL_ANIMATEFLASH: FlashSelColor (); break; ! case SPECIAL_ADDFILEATTR: AddFileAttrs (); break; ! case SPECIAL_DETACHFILEATTR: DetachFileAttrs (); break; ! case SPECIAL_EDITFILEATTR: EditFileAttrs (); break; ! case SPECIAL_UPDATESYMS: UpdateSymbols (); break; ! case SPECIAL_IMPORT_ATTRS: ImportAttrs (); break; ! case SPECIAL_EXPORT_ATTRS: ExportAttrs (); break; ! case SPECIAL_MERGE_WITH_TABLE: MergeWithTable (); break; ! case SPECIAL_EXPORT_TO_TABLE: ExportToTable (); break; #ifdef _TGIF_WB ! case SPECIAL_WHITE_BOARD: WhiteBoard (); break; #endif /* _TGIF_WB */ } } ! int SpecialMenu (X, Y, TrackMenubar) ! int X, Y, TrackMenubar; { ! register int index; ! int * fore_colors, * valid, * init_rv; ! DefaultColorArrays (MAXSPECIALMENUS, &fore_colors, &valid, &init_rv, NULL); activeMenu = MENU_SPECIAL; ! index = TextMenuLoop (X, Y, specialMenuStr, MAXSPECIALMENUS, fore_colors, valid, init_rv, specialMenuDescription, SINGLECOLOR, TrackMenubar); ! if (index >= 0) SpecialSubMenu (index); ! return (index); } --- 1634,1684 ---- } ! void SpecialSubMenu(index) ! int index; { ! switch (index) { ! case SPECIAL_SYM: MakeSymbolic(); break; ! case SPECIAL_UNSYM: UnMakeSymbolic(); break; ! case SPECIAL_INST: Instantiate(); break; ! case SPECIAL_ICON: MakeIconic(); break; ! case SPECIAL_UNICON: UnMakeIconic(); break; ! case SPECIAL_PUSH: PushIcon(); break; ! case SPECIAL_POP: PopIcon(); break; ! case SPECIAL_ADDATTR: AddAttrs(); break; ! case SPECIAL_DETACHATTR: DetachAttrs(); break; ! case SPECIAL_SHOWATTR: ShowAllAttrs(); break; ! case SPECIAL_SHOWATTRNAME: ShowAllAttrNames(); break; ! case SPECIAL_HIDEATTR: HideAllAttrs(); break; ! case SPECIAL_HIDEATTRNAME: HideAllAttrNames(); break; ! case SPECIAL_MOVEATTR: MoveAttr(); break; ! case SPECIAL_EDITATTR: EditAttrs(); break; ! case SPECIAL_ANIMATESEND: AnimateSel(); break; ! case SPECIAL_ANIMATEFLASH: FlashSelColor(); break; ! case SPECIAL_ADDFILEATTR: AddFileAttrs(); break; ! case SPECIAL_DETACHFILEATTR: DetachFileAttrs(); break; ! case SPECIAL_EDITFILEATTR: EditFileAttrs(); break; ! case SPECIAL_UPDATESYMS: UpdateSymbols(); break; ! case SPECIAL_IMPORT_ATTRS: ImportAttrs(); break; ! case SPECIAL_EXPORT_ATTRS: ExportAttrs(); break; ! case SPECIAL_MERGE_WITH_TABLE: MergeWithTable(); break; ! case SPECIAL_EXPORT_TO_TABLE: ExportToTable(); break; #ifdef _TGIF_WB ! case SPECIAL_WHITE_BOARD: WhiteBoard(); break; #endif /* _TGIF_WB */ } } ! int SpecialMenu(X, Y, TrackMenubar) ! int X, Y, TrackMenubar; { ! register int index; ! int *fore_colors, *valid, *init_rv; ! DefaultColorArrays(MAXSPECIALMENUS, &fore_colors, &valid, &init_rv, NULL); activeMenu = MENU_SPECIAL; ! index = TextMenuLoop(X, Y, specialMenuStr, MAXSPECIALMENUS, fore_colors, valid, init_rv, specialMenuDescription, SINGLECOLOR, TrackMenubar); ! if (index >= 0) SpecialSubMenu(index); ! return index; } *** spline.c.orig Tue Sep 30 13:24:09 1997 --- spline.c Tue Sep 30 13:24:10 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/spline.c,v 3.3 1997/01/31 00:00:52 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/spline.c,v 3.5 1997/09/14 20:38:00 william Exp $ */ #include *************** *** 301,316 **** if (Smooth[0] || Smooth[NumVs-1]) { ! fprintf (stderr, "Bad poly in MakeMultiSplinePolyVertex().\n"); fprintf (stderr, "Safest thing to do is to save file and exit.\n"); fprintf (stderr, "Please try to reproduce this error and\n"); fprintf (stderr, "\tsend bug report to william@cs.ucla.edu.\n"); fflush (stderr); ! sprintf (gszMsgBox, "%s.\n\n%s.\n\n%s %s.", ! "Bad poly in MakeMultiSplinePolyVertex()", "Safest thing to do is to save file and exit", "Please try to reproduce this error and", "send bug report to william@cs.ucla.edu"); MsgBox (gszMsgBox, TOOL_NAME, STOP_MB); ! return (NULL); } for (i=1; i < NumVs-1; i++) --- 299,316 ---- if (Smooth[0] || Smooth[NumVs-1]) { ! fprintf (stderr, "Corrupted poly in MakeMultiSplinePolyVertex().\n"); ! fprintf (stderr, "Fix attempted.\n"); fprintf (stderr, "Safest thing to do is to save file and exit.\n"); fprintf (stderr, "Please try to reproduce this error and\n"); fprintf (stderr, "\tsend bug report to william@cs.ucla.edu.\n"); fflush (stderr); ! sprintf (gszMsgBox, "%s.\n\n%s.\n\n%s.\n\n%s %s.", ! "Corrupted poly in MakeMultiSplinePolyVertex()", ! "Fix attempted", "Safest thing to do is to save file and exit", "Please try to reproduce this error and", "send bug report to william@cs.ucla.edu"); MsgBox (gszMsgBox, TOOL_NAME, STOP_MB); ! Smooth[0] = Smooth[NumVs-1] = FALSE; } for (i=1; i < NumVs-1; i++) *************** *** 1227,1242 **** if (Smooth[0] || Smooth[NumPts-1]) { ! fprintf (stderr, "Bad poly in DumpMultiCurvedPolyPoints().\n"); fprintf (stderr, "Safest thing to do is to save file and exit.\n"); fprintf (stderr, "Please try to reproduce this error and\n"); fprintf (stderr, "\tsend bug report to william@cs.ucla.edu.\n"); fflush (stderr); ! sprintf (gszMsgBox, "%s.\n\n%s.\n\n%s %s.", ! "Bad poly in DumpMultiCurvedPolyPoints()", "Safest thing to do is to save file and exit", "Please try to reproduce this error and", "send bug report to william@cs.ucla.edu"); MsgBox (gszMsgBox, TOOL_NAME, STOP_MB); ! return; } for (i=1; i < NumPts-1; i++) --- 1227,1244 ---- if (Smooth[0] || Smooth[NumPts-1]) { ! fprintf (stderr, "Corrupted poly in DumpMultiCurvedPolyPoints().\n"); ! fprintf (stderr, "Fix attempted.\n"); fprintf (stderr, "Safest thing to do is to save file and exit.\n"); fprintf (stderr, "Please try to reproduce this error and\n"); fprintf (stderr, "\tsend bug report to william@cs.ucla.edu.\n"); fflush (stderr); ! sprintf (gszMsgBox, "%s.\n\n%s.\n\n%s.\n\n%s %s.", ! "Corrupted poly in DumpMultiCurvedPolyPoints()", ! "Fix attempted", "Safest thing to do is to save file and exit", "Please try to reproduce this error and", "send bug report to william@cs.ucla.edu"); MsgBox (gszMsgBox, TOOL_NAME, STOP_MB); ! Smooth[0] = Smooth[NumPts-1] = FALSE; } for (i=1; i < NumPts-1; i++) *** stk.c.orig Tue Sep 30 13:24:11 1997 --- stk.c Tue Sep 30 13:24:11 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/stk.c,v 3.4 1996/10/30 18:27:01 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/stk.c,v 3.5 1997/09/14 20:38:00 william Exp $ */ #include *** stretch.c.orig Tue Sep 30 13:24:13 1997 --- stretch.c Tue Sep 30 13:24:13 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/stretch.c,v 3.11 1996/11/30 01:35:44 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/stretch.c,v 3.14 1997/09/17 02:28:20 william Exp $ */ #include *************** *** 81,87 **** static ! int PtIn4Corners (XOff, YOff, BBox, Corner) ! int XOff, YOff, * Corner; ! struct BBRec BBox; { if (PtInMark (XOff, YOff, OFFSET_X(BBox.ltx), OFFSET_Y(BBox.lty))) --- 79,85 ---- static ! int PtIn4Corners(XOff, YOff, BBox, Corner) ! int XOff, YOff, * Corner; ! struct BBRec BBox; { if (PtInMark (XOff, YOff, OFFSET_X(BBox.ltx), OFFSET_Y(BBox.lty))) *************** *** 109,117 **** static ! int PtIn8Places (XOff, YOff, BBox, Corner) ! int XOff, YOff, * Corner; ! struct BBRec BBox; { ! register int xmid, ymid; if (PtIn4Corners (XOff, YOff, BBox, Corner)) return (TRUE); --- 107,115 ---- static ! int PtIn8Places(XOff, YOff, BBox, Corner) ! int XOff, YOff, *Corner; ! struct BBRec BBox; { ! register int xmid, ymid; if (PtIn4Corners (XOff, YOff, BBox, Corner)) return (TRUE); *************** *** 245,263 **** } ! int AutoCenterAttr (obj_ptr) ! struct ObjRec * obj_ptr; { ! register struct AttrRec * attr_ptr; ! for (attr_ptr=obj_ptr->lattr; attr_ptr!=NULL; attr_ptr=attr_ptr->prev) ! if (*attr_ptr->attr_name.s=='\0' && strcmp (attr_ptr->attr_value.s, ! "auto_center_attr")==0) ! return (TRUE); ! return (FALSE); } ! void CenterObjInOBBox (TextObjPtr, OBBox, BBoxReturn) ! struct ObjRec * TextObjPtr; ! struct BBRec OBBox, * BBoxReturn; { int text_w, text_h, bbox_w, bbox_h, dx, dy; --- 243,263 ---- } ! int AutoCenterAttr(obj_ptr) ! struct ObjRec *obj_ptr; { ! register struct AttrRec *attr_ptr; ! for (attr_ptr=obj_ptr->lattr; attr_ptr!=NULL; attr_ptr=attr_ptr->prev) { ! if (*attr_ptr->attr_name.s=='\0' && strcmp(attr_ptr->attr_value.s, ! "auto_center_attr")==0) { ! return TRUE; ! } ! } ! return FALSE; } ! void CenterObjInOBBox(TextObjPtr, OBBox, BBoxReturn) ! struct ObjRec *TextObjPtr; ! struct BBRec OBBox, *BBoxReturn; { int text_w, text_h, bbox_w, bbox_h, dx, dy; *************** *** 355,373 **** static ! void StretchPoly (XGridOff, YGridOff, ObjPtr, NumPts, V, Index) ! int XGridOff, YGridOff, NumPts, Index; ! IntPoint * V; ! struct ObjRec * ObjPtr; ! { ! register int i; ! int x, y, dx, dy, num=0, stretching=TRUE; ! int ltx, lty, rbx, rby, curved=LT_STRAIGHT; ! int grid_x=XGridOff, grid_y=YGridOff, sn, intn; ! int auto_center_attr=AutoCenterAttr (ObjPtr); ! char * smooth=NULL; ! char buf[80], x_buf[80], y_buf[80]; ! XEvent input, ev; ! XPoint *sv=NULL; ! IntPoint *pv=NULL, *cntrlv=NULL; if (ObjPtr->locked) --- 355,373 ---- static ! void StretchPoly(XGridOff, YGridOff, ObjPtr, NumPts, V, Index) ! int XGridOff, YGridOff, NumPts, Index; ! IntPoint *V; ! struct ObjRec *ObjPtr; ! { ! register int i; ! int x, y, dx, dy, num=0, stretching=TRUE; ! int ltx, lty, rbx, rby, curved=LT_STRAIGHT; ! int grid_x=XGridOff, grid_y=YGridOff, sn, intn; ! int auto_center_attr=AutoCenterAttr (ObjPtr); ! char *smooth=NULL; ! char buf[80], x_buf[80], y_buf[80]; ! XEvent input, ev; ! XPoint *sv=NULL; ! IntPoint *pv=NULL, *cntrlv=NULL; if (ObjPtr->locked) *************** *** 706,716 **** if (auto_center_attr) { ! struct AttrRec * attr_ptr=ObjPtr->fattr; ! int modified=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) ! if (attr_ptr->shown) ! { ! struct BBRec bbox; CenterObjInOBBox (attr_ptr->obj, ObjPtr->obbox, &bbox); --- 706,715 ---- if (auto_center_attr) { ! struct AttrRec *attr_ptr=ObjPtr->fattr; ! int modified=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr=attr_ptr->next) { ! if (attr_ptr->shown) { ! struct BBRec bbox; CenterObjInOBBox (attr_ptr->obj, ObjPtr->obbox, &bbox); *************** *** 721,724 **** --- 720,724 ---- modified = TRUE; } + } if (modified) AdjObjBBox (ObjPtr); } *************** *** 1308,1349 **** static ! void StretchAllSelObjects (Corner, XScale, YScale) ! int Corner, XScale, YScale; { ! struct SelRec * sel_ptr; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! if (!sel_ptr->obj->locked) ! StretchObj (sel_ptr->obj, Corner, XScale, YScale); ! if (numObjLocked != 0) Msg ("Locked objects are not stretched."); } static ! void MarkObjectsForStretch () { ! register struct ObjRec * obj_ptr; ! register struct SelRec * sel_ptr; ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) obj_ptr->marked = FALSE; ! ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) sel_ptr->obj->marked = TRUE; } static ! int ConstrainedStretchAllSel (Corner, XScale, YScale, ltx, lty, rbx, rby) ! int Corner, XScale, YScale; ! int * ltx, * lty, * rbx, * rby; ! { ! register struct ObjRec * obj_ptr; ! int something_stretched=FALSE, num_pts; ! int x_off, y_off, move_first, move_last, x, y; ! IntPoint * v; ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) ! { ! if (!obj_ptr->marked && obj_ptr->type==OBJ_POLY && !obj_ptr->locked) ! { num_pts = obj_ptr->detail.p->n; v = obj_ptr->detail.p->vlist; --- 1308,1350 ---- static ! void StretchAllSelObjects(Corner, XScale, YScale) ! int Corner, XScale, YScale; { ! struct SelRec *sel_ptr; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) { ! if (!sel_ptr->obj->locked) { ! StretchObj(sel_ptr->obj, Corner, XScale, YScale); ! } ! } ! if (numObjLocked != 0) Msg("Locked objects are not stretched."); } static ! void MarkObjectsForStretch() { ! register struct ObjRec *obj_ptr; ! register struct SelRec *sel_ptr; ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) { obj_ptr->marked = FALSE; ! } ! for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev) { sel_ptr->obj->marked = TRUE; + } } static ! int ConstrainedStretchAllSel(Corner, XScale, YScale, ltx, lty, rbx, rby) ! int Corner, XScale, YScale; ! int *ltx, *lty, *rbx, *rby; ! { ! register struct ObjRec *obj_ptr; ! int something_stretched=FALSE, num_pts; ! int x_off, y_off, move_first, move_last, x, y; ! IntPoint *v; ! for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! if (!obj_ptr->marked && obj_ptr->type==OBJ_POLY && !obj_ptr->locked) { num_pts = obj_ptr->detail.p->n; v = obj_ptr->detail.p->vlist; *************** *** 1373,1378 **** if (move_first || move_last) { ! int index=INVALID, seg_dx, seg_dy, dx, dy; ! int cur_seg_dx, cur_seg_dy; PrepareToReplaceAnObj (obj_ptr); --- 1374,1378 ---- if (move_first || move_last) { ! int index=INVALID, seg_dx, seg_dy, dx, dy, cur_seg_dx, cur_seg_dy; PrepareToReplaceAnObj (obj_ptr); *************** *** 1492,1502 **** if (AutoCenterAttr (obj_ptr)) { ! struct AttrRec * attr_ptr=obj_ptr->fattr; ! int modified=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) ! if (attr_ptr->shown) ! { ! struct BBRec bbox; CenterObjInOBBox (attr_ptr->obj, obj_ptr->obbox, &bbox); --- 1492,1501 ---- if (AutoCenterAttr (obj_ptr)) { ! struct AttrRec *attr_ptr=obj_ptr->fattr; ! int modified=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) { ! if (attr_ptr->shown) { ! struct BBRec bbox; CenterObjInOBBox (attr_ptr->obj, obj_ptr->obbox, &bbox); *************** *** 1507,1510 **** --- 1506,1510 ---- modified = TRUE; } + } if (modified) AdjObjBBox (obj_ptr); } *************** *** 1521,1535 **** static ! void StretchAllSel (Corner, XScale, YScale) ! int Corner, XScale, YScale; /* XScale and YScale are scaled by 1000 */ { ! int ltx, lty, rbx, rby, saved_ltx, saved_lty, saved_rbx, saved_rby; ! int poly_stretched; saved_ltx = selLtX; saved_lty = selLtY; saved_rbx = selRbX; saved_rby = selRbY; ! if (moveMode==CONST_MOVE) ! { MarkObjectsForStretch (); --- 1521,1534 ---- static ! void StretchAllSel(Corner, XScale, YScale) ! int Corner, XScale, YScale; /* XScale and YScale are scaled by 1000 */ { ! int ltx, lty, rbx, rby, saved_ltx, saved_lty, saved_rbx, saved_rby; ! int poly_stretched; saved_ltx = selLtX; saved_lty = selLtY; saved_rbx = selRbX; saved_rby = selRbY; ! if (moveMode==CONST_MOVE) { MarkObjectsForStretch (); *************** *** 1618,1636 **** static ! void StretchBox (XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec * ObjPtr; ! { ! int x, y, stretching=TRUE; ! int ltx, lty, rbx, rby, sel_ltx, sel_lty, sel_rbx, sel_rby; ! int stretched_ltx, stretched_lty, stretched_rbx, stretched_rby; ! int stretched_sel_ltx, stretched_sel_lty, stretched_sel_rbx; ! int stretched_sel_rby; ! int ruler_ltx, ruler_lty, ruler_rbx, ruler_rby; ! int sel_obj_ltx, sel_obj_lty, sel_obj_rbx, sel_obj_rby; ! int grid_x = XGridOff, grid_y = YGridOff, proportional=FALSE; ! char buf[80], buf1[80]; ! double obj_w, obj_h; ! XEvent input, ev; if (numObjSelected == numObjLocked) --- 1617,1635 ---- static ! void StretchBox(XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec *ObjPtr; ! { ! int x, y, stretching=TRUE; ! int ltx, lty, rbx, rby, sel_ltx, sel_lty, sel_rbx, sel_rby; ! int stretched_ltx, stretched_lty, stretched_rbx, stretched_rby; ! int stretched_sel_ltx, stretched_sel_lty, stretched_sel_rbx; ! int stretched_sel_rby; ! int ruler_ltx, ruler_lty, ruler_rbx, ruler_rby; ! int sel_obj_ltx, sel_obj_lty, sel_obj_rbx, sel_obj_rby; ! int grid_x=XGridOff, grid_y=YGridOff, proportional=FALSE; ! char buf[80], buf1[80]; ! double obj_w, obj_h; ! XEvent input, ev; if (numObjSelected == numObjLocked) *************** *** 1732,1737 **** if (proportional) { ! int new_w, new_h; ! double w_ratio, h_ratio; new_w = moveX + grid_x - XGridOff - pivotX; --- 1731,1736 ---- if (proportional) { ! int new_w, new_h; ! double w_ratio, h_ratio; new_w = moveX + grid_x - XGridOff - pivotX; *************** *** 1808,1812 **** if (multX != (double)1.0 || multY != (double)1.0) { ! int x_scale=1000, y_scale=1000; PointsToShearScale (Corner, pivotX, pivotY, moveX, moveY, --- 1807,1811 ---- if (multX != (double)1.0 || multY != (double)1.0) { ! int x_scale=1000, y_scale=1000; PointsToShearScale (Corner, pivotX, pivotY, moveX, moveY, *************** *** 1830,1871 **** } ! void StretchSel (XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec * ObjPtr; { ! switch (ObjPtr->type) ! { ! case OBJ_BOX: ! case OBJ_OVAL: ! case OBJ_GROUP: ! case OBJ_ICON: ! case OBJ_ARC: ! case OBJ_RCBOX: ! case OBJ_SYM: ! case OBJ_XBM: ! case OBJ_XPM: StretchBox (XGridOff, YGridOff, ObjPtr, Corner); ! break; ! case OBJ_POLY: ! StretchPoly (XGridOff, YGridOff, ObjPtr, ObjPtr->detail.p->n, ! ObjPtr->detail.p->vlist, Corner); ! break; ! case OBJ_POLYGON: ! StretchPoly (XGridOff, YGridOff, ObjPtr, ObjPtr->detail.g->n, ! ObjPtr->detail.g->vlist, Corner); ! break; ! case OBJ_TEXT: ! if (stretchableText) { ! StretchBox (XGridOff, YGridOff, ObjPtr, Corner); ! } ! break; } } ! void ScaleAnEPSObj (ObjPtr, ScalingFactor) ! struct ObjRec * ObjPtr; ! float * ScalingFactor; { ! struct BBRec * obbox = &(ObjPtr->obbox); multX = multY = (double) (*ScalingFactor); --- 1829,1869 ---- } ! void StretchSel(XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec *ObjPtr; { ! switch (ObjPtr->type) { ! case OBJ_BOX: ! case OBJ_OVAL: ! case OBJ_GROUP: ! case OBJ_ICON: ! case OBJ_ARC: ! case OBJ_RCBOX: ! case OBJ_SYM: ! case OBJ_XBM: ! case OBJ_XPM: ! StretchBox (XGridOff, YGridOff, ObjPtr, Corner); ! break; ! case OBJ_POLY: ! StretchPoly (XGridOff, YGridOff, ObjPtr, ObjPtr->detail.p->n, ! ObjPtr->detail.p->vlist, Corner); ! break; ! case OBJ_POLYGON: ! StretchPoly (XGridOff, YGridOff, ObjPtr, ObjPtr->detail.g->n, ! ObjPtr->detail.g->vlist, Corner); ! break; ! case OBJ_TEXT: ! if (stretchableText) { StretchBox (XGridOff, YGridOff, ObjPtr, Corner); ! } ! break; } } ! void ScaleAnEPSObj(ObjPtr, ScalingFactor) ! struct ObjRec *ObjPtr; ! float *ScalingFactor; { ! struct BBRec *obbox=(&(ObjPtr->obbox)); multX = multY = (double) (*ScalingFactor); *************** *** 1881,1893 **** static ! void ScaleAllSelObjects (Corner, XScale, YScale) ! int Corner, XScale, YScale; { ! register struct SelRec * sel_ptr; ! register struct BBRec * obbox; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) ! if (!sel_ptr->obj->locked) ! { obbox = &(sel_ptr->obj->obbox); switch (Corner) --- 1879,1890 ---- static ! void ScaleAllSelObjects(Corner, XScale, YScale) ! int Corner, XScale, YScale; { ! register struct SelRec *sel_ptr; ! register struct BBRec *obbox; ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! if (!sel_ptr->obj->locked) { obbox = &(sel_ptr->obj->obbox); switch (Corner) *************** *** 1936,1948 **** StretchObj (sel_ptr->obj, Corner, XScale, YScale); } ! if (numObjLocked != 0) Msg ("Locked objects are not scaled."); } static ! void ScaleAllSel (Corner, XScale, YScale) ! int Corner, XScale, YScale; { ! int ltx, lty, rbx, rby, saved_ltx, saved_lty, saved_rbx, saved_rby; ! int poly_stretched; saved_ltx = selLtX; saved_lty = selLtY; --- 1933,1946 ---- StretchObj (sel_ptr->obj, Corner, XScale, YScale); } ! } ! if (numObjLocked != 0) Msg("Locked objects are not scaled."); } static ! void ScaleAllSel(Corner, XScale, YScale) ! int Corner, XScale, YScale; { ! int ltx, lty, rbx, rby, saved_ltx, saved_lty, saved_rbx, saved_rby; ! int poly_stretched; saved_ltx = selLtX; saved_lty = selLtY; *************** *** 1995,2000 **** static ! char * FindColon(s) ! register char * s; { while (*s!=':' && *s!='x' && *s!='X' && *s!=' ' && *s!='\0') s++; --- 1993,1998 ---- static ! char *FindColon(s) ! register char *s; { while (*s!=':' && *s!='x' && *s!='X' && *s!=' ' && *s!='\0') s++; *************** *** 2126,2131 **** } ! void FlipObjHorizontal (ObjPtr) ! struct ObjRec * ObjPtr; { int two_x_pivot=selObjLtX+selObjRbX; --- 2124,2129 ---- } ! void FlipObjHorizontal(ObjPtr) ! struct ObjRec *ObjPtr; { int two_x_pivot=selObjLtX+selObjRbX; *************** *** 2314,2324 **** } ! void FlipIconHorizontal (ObjPtr) ! struct ObjRec * ObjPtr; { ! register int two_x_pivot; ! int new_obj_ltx, new_obj_rbx; ! struct ObjRec * obj_ptr; ! struct AttrRec * attr_ptr; two_x_pivot = selObjLtX + selObjRbX; --- 2312,2322 ---- } ! void FlipIconHorizontal(ObjPtr) ! struct ObjRec *ObjPtr; { ! register int two_x_pivot; ! int new_obj_ltx, new_obj_rbx; ! struct ObjRec *obj_ptr; ! struct AttrRec *attr_ptr; two_x_pivot = selObjLtX + selObjRbX; *************** *** 2348,2353 **** } ! void FlipObjVertical (ObjPtr) ! struct ObjRec * ObjPtr; { int two_x_pivot=selObjLtY+selObjRbY; --- 2346,2351 ---- } ! void FlipObjVertical(ObjPtr) ! struct ObjRec *ObjPtr; { int two_x_pivot=selObjLtY+selObjRbY; *************** *** 2526,2536 **** } ! void FlipIconVertical (ObjPtr) ! struct ObjRec * ObjPtr; { ! register int two_x_pivot; ! int new_obj_lty, new_obj_rby; ! struct ObjRec * obj_ptr; ! struct AttrRec * attr_ptr; two_x_pivot = selObjLtY + selObjRbY; --- 2524,2534 ---- } ! void FlipIconVertical(ObjPtr) ! struct ObjRec *ObjPtr; { ! register int two_x_pivot; ! int new_obj_lty, new_obj_rby; ! struct ObjRec *obj_ptr; ! struct AttrRec *attr_ptr; two_x_pivot = selObjLtY + selObjRbY; *************** *** 2579,2584 **** static ! void RotatePtClockWise (X, Y, NewX, NewY) ! int X, Y, * NewX, * NewY; { *NewX = rotatePivotX + rotatePivotY - Y; --- 2577,2582 ---- static ! void RotatePtClockWise(X, Y, NewX, NewY) ! int X, Y, *NewX, *NewY; { *NewX = rotatePivotX + rotatePivotY - Y; *************** *** 2587,2603 **** static ! void RotatedXY (X, Y, AngleDelta, NewX, NewY) ! int X, Y, AngleDelta, * NewX, * NewY; /* AngleDelta is degree*64 */ { ! register double radian, sin_val, cos_val; ! int dx=X-pivotX, dy=Y-pivotY; ! if (dx == 0 && dy == 0) ! { *NewX = pivotX; *NewY = pivotY; ! } ! else ! { radian = (((double)AngleDelta)*M_PI/180.0/64.0); sin_val = sin(radian); --- 2585,2598 ---- static ! void RotatedXY(X, Y, AngleDelta, NewX, NewY) ! int X, Y, AngleDelta, *NewX, *NewY; /* AngleDelta is degree*64 */ { ! register double radian, sin_val, cos_val; ! int dx=X-pivotX, dy=Y-pivotY; ! if (dx == 0 && dy == 0) { *NewX = pivotX; *NewY = pivotY; ! } else { radian = (((double)AngleDelta)*M_PI/180.0/64.0); sin_val = sin(radian); *************** *** 2609,2625 **** static ! void RotatedAbsXY (X, Y, AngleDelta, NewX, NewY) ! int X, Y, AngleDelta, * NewX, * NewY; /* AngleDelta is degree*64 */ { ! register double radian, sin_val, cos_val; ! int dx=X-absPivotX, dy=Y-absPivotY; ! if (dx == 0 && dy == 0) ! { *NewX = absPivotX; *NewY = absPivotY; ! } ! else ! { radian = (((double)AngleDelta)*M_PI/180.0/64.0); sin_val = sin(radian); --- 2604,2617 ---- static ! void RotatedAbsXY(X, Y, AngleDelta, NewX, NewY) ! int X, Y, AngleDelta, *NewX, *NewY; /* AngleDelta is degree*64 */ { ! register double radian, sin_val, cos_val; ! int dx=X-absPivotX, dy=Y-absPivotY; ! if (dx == 0 && dy == 0) { *NewX = absPivotX; *NewY = absPivotY; ! } else { radian = (((double)AngleDelta)*M_PI/180.0/64.0); sin_val = sin(radian); *************** *** 2630,2645 **** } ! void RotateObj (ObjPtr, Corner, AngleDelta, RealLtX, RealLtY) ! struct ObjRec * ObjPtr; ! int Corner, AngleDelta; /* AngleDelta is degree*64 */ ! int *RealLtX, *RealLtY; ! { ! IntPoint abs_obj_obbox_vs[5]; ! int x, y, new_ltx, new_lty, new_rbx, new_rby; ! double radian=(((double)AngleDelta)*M_PI/180.0/64.0); ! double sin_val=sin(radian), cos_val=cos(radian); ! struct XfrmMtrxRec ctm, new_ctm; ! struct ObjRec *obj_ptr; ! struct AttrRec *attr_ptr; switch (ObjPtr->type) { --- 2622,2637 ---- } ! void RotateObj(ObjPtr, Corner, AngleDelta, RealLtX, RealLtY) ! struct ObjRec *ObjPtr; ! int Corner, AngleDelta; /* AngleDelta is degree*64 */ ! int *RealLtX, *RealLtY; ! { ! IntPoint abs_obj_obbox_vs[5]; ! int x, y, new_ltx, new_lty, new_rbx, new_rby; ! double radian=(((double)AngleDelta)*M_PI/180.0/64.0); ! double sin_val=sin(radian), cos_val=cos(radian); ! struct XfrmMtrxRec ctm, new_ctm; ! struct ObjRec *obj_ptr; ! struct AttrRec *attr_ptr; switch (ObjPtr->type) { *************** *** 2706,2709 **** --- 2698,2702 ---- ObjPtr->ctm->m[CTM_MSIN] >= (-1) && ObjPtr->ctm->m[CTM_MSIN] <= 1) { int dx=ObjPtr->ctm->m[CTM_TX], dy=ObjPtr->ctm->m[CTM_TY]; + struct AttrRec *saved_fattr=NULL, *saved_lattr=NULL; free(ObjPtr->ctm); *************** *** 2715,2719 **** --- 2708,2717 ---- sizeof(struct BBRec)); } + saved_fattr = ObjPtr->fattr; + saved_lattr = ObjPtr->lattr; + ObjPtr->fattr = ObjPtr->lattr = NULL; MoveObj(ObjPtr, dx, dy); + ObjPtr->fattr = saved_fattr; + ObjPtr->lattr = saved_lattr; } break; *************** *** 3087,3096 **** static ! void RotateBBoxByAnAngle (bbox, d_angle, vs) ! struct BBRec * bbox; /* the original bounding box */ ! int d_angle; /* d_angle is degree*64 */ ! XPoint * vs; /* array of 5 points */ { ! int x, y; RotatedXY (bbox->ltx, bbox->lty, d_angle, &x, &y); --- 3085,3094 ---- static ! void RotateBBoxByAnAngle(bbox, d_angle, vs) ! struct BBRec *bbox; /* the original bounding box */ ! int d_angle; /* d_angle is degree*64 */ ! XPoint *vs; /* array of 5 points */ { ! int x, y; RotatedXY (bbox->ltx, bbox->lty, d_angle, &x, &y); *************** *** 3105,3119 **** static ! void RotateVsByAnAngle (InVs, NumPts, d_angle, OutVs) ! XPoint * InVs, * OutVs; ! int NumPts, d_angle; { ! register int i; ! for (i=0; i < NumPts; i++) ! { ! int x, y; ! RotatedXY (InVs[i].x, InVs[i].y, d_angle, &x, &y); OutVs[i].x = x; OutVs[i].y = y; --- 3103,3116 ---- static ! void RotateVsByAnAngle(InVs, NumPts, d_angle, OutVs) ! XPoint *InVs, *OutVs; ! int NumPts, d_angle; { ! register int i; ! for (i=0; i < NumPts; i++) { ! int x, y; ! RotatedXY(InVs[i].x, InVs[i].y, d_angle, &x, &y); OutVs[i].x = x; OutVs[i].y = y; *************** *** 3122,3129 **** static ! void RotateAllSelObjects (Corner, AngleDelta) ! int Corner, AngleDelta; /* AngleDelta is degree*64 */ { ! register struct SelRec * sel_ptr; for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) { --- 3119,3126 ---- static ! void RotateAllSelObjects(Corner, AngleDelta) ! int Corner, AngleDelta; /* AngleDelta is degree*64 */ { ! register struct SelRec *sel_ptr; for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) { *************** *** 3136,3151 **** static ! int ConstrainedRotateAllSel (Corner, AngleDelta, ltx, lty, rbx, rby) ! int Corner, AngleDelta, * ltx, * lty, * rbx, * rby; { ! register struct ObjRec * obj_ptr; ! int something_stretched=FALSE, num_pts; ! int x_off, y_off, move_first, move_last, x, y; ! IntPoint * v; ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) ! { ! if (!obj_ptr->marked && obj_ptr->type==OBJ_POLY && !obj_ptr->locked) ! { num_pts = obj_ptr->detail.p->n; v = obj_ptr->detail.p->vlist; --- 3133,3146 ---- static ! int ConstrainedRotateAllSel(Corner, AngleDelta, ltx, lty, rbx, rby) ! int Corner, AngleDelta, *ltx, *lty, *rbx, *rby; { ! register struct ObjRec *obj_ptr; ! int something_stretched=FALSE, num_pts; ! int x_off, y_off, move_first, move_last, x, y; ! IntPoint *v; ! for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! if (!obj_ptr->marked && obj_ptr->type==OBJ_POLY && !obj_ptr->locked) { num_pts = obj_ptr->detail.p->n; v = obj_ptr->detail.p->vlist; *************** *** 3175,3180 **** if (move_first || move_last) { ! int index=INVALID, seg_dx, seg_dy, dx, dy; ! int cur_seg_dx, cur_seg_dy; PrepareToReplaceAnObj (obj_ptr); --- 3170,3174 ---- if (move_first || move_last) { ! int index=INVALID, seg_dx, seg_dy, dx, dy, cur_seg_dx, cur_seg_dy; PrepareToReplaceAnObj (obj_ptr); *************** *** 3296,3306 **** if (AutoCenterAttr (obj_ptr)) { ! struct AttrRec * attr_ptr=obj_ptr->fattr; ! int modified=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) ! if (attr_ptr->shown) ! { ! struct BBRec bbox; CenterObjInOBBox (attr_ptr->obj, obj_ptr->obbox, &bbox); --- 3290,3299 ---- if (AutoCenterAttr (obj_ptr)) { ! struct AttrRec *attr_ptr=obj_ptr->fattr; ! int modified=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) { ! if (attr_ptr->shown) { ! struct BBRec bbox; CenterObjInOBBox (attr_ptr->obj, obj_ptr->obbox, &bbox); *************** *** 3311,3314 **** --- 3304,3308 ---- modified = TRUE; } + } if (modified) AdjObjBBox (obj_ptr); } *************** *** 3325,3333 **** static ! void RotateAllSel (Corner, AngleDelta) ! int Corner, AngleDelta; /* AngleDelta is degree*64 */ { ! int ltx, lty, rbx, rby, saved_ltx, saved_lty, saved_rbx, saved_rby; ! int poly_stretched; saved_ltx = selLtX; saved_lty = selLtY; --- 3319,3327 ---- static ! void RotateAllSel(Corner, AngleDelta) ! int Corner, AngleDelta; /* AngleDelta is degree*64 */ { ! int ltx, lty, rbx, rby, saved_ltx, saved_lty, saved_rbx, saved_rby; ! int poly_stretched; saved_ltx = selLtX; saved_lty = selLtY; *************** *** 3390,3405 **** static ! void RotateSel (XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec * ObjPtr; ! { ! register int i; ! XEvent ev; ! XPoint all_bbox_vs[5], obj_obbox_vs[5], *vs=NULL, *orig_vs=NULL; ! int grid_x=XGridOff, grid_y=YGridOff, dx, dy, d_angle=0; ! int saved_x=XGridOff, saved_y=YGridOff; ! int rotating=TRUE, deg360=(360<<6), n=0; ! char buf[80], msg[MAXSTRING+1]; ! struct BBRec orig_all_bbox, orig_obj_obbox; if (numObjSelected == numObjLocked) --- 3384,3399 ---- static ! void RotateSel(XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec *ObjPtr; ! { ! register int i; ! XEvent ev; ! XPoint all_bbox_vs[5], obj_obbox_vs[5], *vs=NULL, *orig_vs=NULL; ! int grid_x=XGridOff, grid_y=YGridOff, dx, dy, d_angle=0; ! int saved_x=XGridOff, saved_y=YGridOff; ! int rotating=TRUE, deg360=(360<<6), n=0; ! char buf[80], msg[MAXSTRING+1]; ! struct BBRec orig_all_bbox, orig_obj_obbox; if (numObjSelected == numObjLocked) *************** *** 3416,3421 **** if (ObjPtr->type==OBJ_POLY || ObjPtr->type==OBJ_POLYGON) { ! IntPoint *pv; ! int px, py; if (ObjPtr->ctm == NULL) --- 3410,3415 ---- if (ObjPtr->type==OBJ_POLY || ObjPtr->type==OBJ_POLYGON) { ! IntPoint *pv; ! int px, py; if (ObjPtr->ctm == NULL) *************** *** 3535,3541 **** while (rotating) { ! XEvent input; ! XNextEvent (mainDisplay, &input); if (input.type == Expose || input.type == VisibilityNotify) --- 3529,3535 ---- while (rotating) { ! XEvent input; ! XNextEvent(mainDisplay, &input); if (input.type == Expose || input.type == VisibilityNotify) *************** *** 3621,3630 **** static ! void ShearBBox (Corner, bbox, x_shear, y_shear, x_scale, y_scale, vs) ! int Corner, x_shear, y_shear, x_scale, y_scale; ! struct BBRec * bbox; /* the original bounding box */ ! XPoint * vs; /* array of 5 points */ { ! int x, y; switch (Corner) --- 3615,3624 ---- static ! void ShearBBox(Corner, bbox, x_shear, y_shear, x_scale, y_scale, vs) ! int Corner, x_shear, y_shear, x_scale, y_scale; ! struct BBRec *bbox; /* the original bounding box */ ! XPoint *vs; /* array of 5 points */ { ! int x, y; switch (Corner) *************** *** 3698,3707 **** static ! void ShearVs (Corner, InVs, NumPts, x_shear, y_shear, x_scale, y_scale, OutVs) ! int Corner, NumPts, x_shear, y_shear, x_scale, y_scale; ! XPoint * InVs, * OutVs; /* array of 5 points */ { ! register int i; ! int x, y; switch (Corner) --- 3692,3701 ---- static ! void ShearVs(Corner, InVs, NumPts, x_shear, y_shear, x_scale, y_scale, OutVs) ! int Corner, NumPts, x_shear, y_shear, x_scale, y_scale; ! XPoint *InVs, *OutVs; /* array of 5 points */ { ! register int i; ! int x, y; switch (Corner) *************** *** 3747,3754 **** static ! void ShearAllSelObjects (Corner, XShear, YShear, XScale, YScale) ! int Corner, XShear, YShear, XScale, YScale; /* everything scaled by 1000 */ { ! register struct SelRec * sel_ptr; for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) { --- 3741,3748 ---- static ! void ShearAllSelObjects(Corner, XShear, YShear, XScale, YScale) ! int Corner, XShear, YShear, XScale, YScale; /* everything scaled by 1000 */ { ! register struct SelRec *sel_ptr; for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) { *************** *** 3762,3778 **** static ! int ConstrainedShearAllSel (Corner, XShear, YShear, XScale, YScale, ltx, lty, rbx, rby) ! int Corner, XShear, YShear, XScale, YScale, * ltx, * lty, * rbx, * rby; { ! register struct ObjRec * obj_ptr; ! int something_stretched=FALSE, num_pts; ! int x_off, y_off, move_first, move_last, x, y; ! IntPoint * v; ! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev) ! { ! if (!obj_ptr->marked && obj_ptr->type==OBJ_POLY && !obj_ptr->locked) ! { num_pts = obj_ptr->detail.p->n; v = obj_ptr->detail.p->vlist; --- 3756,3770 ---- static ! int ConstrainedShearAllSel(Corner, XShear, YShear, XScale, YScale, ltx, lty, rbx, rby) ! int Corner, XShear, YShear, XScale, YScale, *ltx, *lty, *rbx, *rby; { ! register struct ObjRec *obj_ptr; ! int something_stretched=FALSE, num_pts; ! int x_off, y_off, move_first, move_last, x, y; ! IntPoint *v; ! for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! if (!obj_ptr->marked && obj_ptr->type==OBJ_POLY && !obj_ptr->locked) { num_pts = obj_ptr->detail.p->n; v = obj_ptr->detail.p->vlist; *************** *** 3802,3807 **** if (move_first || move_last) { ! int index=INVALID, seg_dx, seg_dy, dx, dy; ! int cur_seg_dx, cur_seg_dy; PrepareToReplaceAnObj (obj_ptr); --- 3794,3798 ---- if (move_first || move_last) { ! int index=INVALID, seg_dx, seg_dy, dx, dy, cur_seg_dx, cur_seg_dy; PrepareToReplaceAnObj (obj_ptr); *************** *** 3926,3936 **** if (AutoCenterAttr (obj_ptr)) { ! struct AttrRec * attr_ptr=obj_ptr->fattr; ! int modified=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) ! if (attr_ptr->shown) ! { ! struct BBRec bbox; CenterObjInOBBox (attr_ptr->obj, obj_ptr->obbox, &bbox); --- 3917,3926 ---- if (AutoCenterAttr (obj_ptr)) { ! struct AttrRec *attr_ptr=obj_ptr->fattr; ! int modified=FALSE; ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) { ! if (attr_ptr->shown) { ! struct BBRec bbox; CenterObjInOBBox (attr_ptr->obj, obj_ptr->obbox, &bbox); *************** *** 3941,3944 **** --- 3931,3935 ---- modified = TRUE; } + } if (modified) AdjObjBBox (obj_ptr); } *************** *** 3955,3963 **** static ! void ShearAllSel (Corner, XShear, YShear, XScale, YScale) ! int Corner, XShear, YShear, XScale, YScale; /* everything scaled by 1000 */ { ! int ltx, lty, rbx, rby, saved_ltx, saved_lty, saved_rbx, saved_rby; ! int poly_stretched; saved_ltx = selLtX; saved_lty = selLtY; --- 3946,3954 ---- static ! void ShearAllSel(Corner, XShear, YShear, XScale, YScale) ! int Corner, XShear, YShear, XScale, YScale; /* everything scaled by 1000 */ { ! int ltx, lty, rbx, rby, saved_ltx, saved_lty, saved_rbx, saved_rby; ! int poly_stretched; saved_ltx = selLtX; saved_lty = selLtY; *************** *** 4010,4025 **** static ! void ShearSel (XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec * ObjPtr; ! { ! XEvent ev; ! XPoint all_bbox_vs[5], obj_obbox_vs[5]; ! int grid_x=XGridOff, grid_y=YGridOff, dx, dy; ! int saved_x=XGridOff, saved_y=YGridOff; ! int shearing=TRUE, shear_hori=FALSE; ! int x_scale=1000, y_scale=1000, x_shear=0, y_shear=0; ! char buf[80], msg[MAXSTRING+1]; ! struct BBRec orig_all_bbox, orig_obj_obbox; if (numObjSelected == numObjLocked) --- 4001,4016 ---- static ! void ShearSel(XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec *ObjPtr; ! { ! XEvent ev; ! XPoint all_bbox_vs[5], obj_obbox_vs[5]; ! int grid_x=XGridOff, grid_y=YGridOff, dx, dy; ! int saved_x=XGridOff, saved_y=YGridOff; ! int shearing=TRUE, shear_hori=FALSE; ! int x_scale=1000, y_scale=1000, x_shear=0, y_shear=0; ! char buf[80], msg[MAXSTRING+1]; ! struct BBRec orig_all_bbox, orig_obj_obbox; if (numObjSelected == numObjLocked) *************** *** 4095,4099 **** while (shearing) { ! XEvent input; XNextEvent (mainDisplay, &input); --- 4086,4090 ---- while (shearing) { ! XEvent input; XNextEvent (mainDisplay, &input); *************** *** 4161,4167 **** } ! void RotateShearSel (XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec * ObjPtr; /* 1 2 3 */ /* 8 4 */ --- 4152,4158 ---- } ! void RotateShearSel(XGridOff, YGridOff, ObjPtr, Corner) ! int XGridOff, YGridOff, Corner; ! struct ObjRec *ObjPtr; /* 1 2 3 */ /* 8 4 */ *** tcp.c.orig Tue Sep 30 13:24:15 1997 --- tcp.c Tue Sep 30 13:24:15 1997 *************** *** 6,10 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 6,10 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 31,39 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tcp.c,v 3.1 1996/10/30 23:22:22 william Exp $"; - #endif #include --- 31,37 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tcp.c,v 3.2 1997/09/14 20:38:01 william Exp $ */ #include *** testdrive.c.orig Tue Sep 30 13:24:16 1997 --- testdrive.c Tue Sep 30 13:24:16 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/testdrive.c,v 3.0 1996/05/06 16:12:11 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/testdrive.c,v 3.1 1997/09/14 20:38:01 william Exp $ */ #include *** text.c.orig Tue Sep 30 13:24:17 1997 --- text.c Tue Sep 30 13:24:18 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/text.c,v 3.16 1997/01/30 06:05:55 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/text.c,v 3.19 1997/09/17 04:03:10 william Exp $ */ #include *************** *** 345,349 **** YOff = ZOOMED_SIZE(YOff); ! len = strlen (Str); orig_w = XTextWidth (xfs, Str, len); --- 343,347 ---- YOff = ZOOMED_SIZE(YOff); ! len = strlen(Str); orig_w = XTextWidth (xfs, Str, len); *************** *** 385,389 **** XChangeGC (mainDisplay, drawGC, GCForeground | GCFunction | GCFillStyle | GCStipple, &values); ! XDrawString (mainDisplay,Win,drawGC,XOff,YOff+canvasFontAsc,Str,len); } --- 383,387 ---- XChangeGC (mainDisplay, drawGC, GCForeground | GCFunction | GCFillStyle | GCStipple, &values); ! XDrawString(mainDisplay,Win,drawGC,XOff,YOff+canvasFontAsc,Str,len); } *************** *** 404,408 **** XCharStruct xcs; ! len = strlen (Str); if (xfs->min_byte1 != 0 || xfs->max_byte1 != 0) --- 402,406 ---- XCharStruct xcs; ! len = strlen(Str); if (xfs->min_byte1 != 0 || xfs->max_byte1 != 0) *************** *** 445,449 **** XChangeGC (mainDisplay, gc, GCForeground | GCFunction | GCFillStyle, &values); ! XDrawString (mainDisplay, Win, gc, XOff, YOff+canvasFontAsc, Str, len); switch (Mode) --- 443,447 ---- XChangeGC (mainDisplay, gc, GCForeground | GCFunction | GCFillStyle, &values); ! XDrawString(mainDisplay, Win, gc, XOff, YOff+canvasFontAsc, Str, len); switch (Mode) *************** *** 536,556 **** } ! static int curTextIsNew=FALSE; ! void NewCurText () { ! struct TextRec * text_ptr; if (tmpCurTextObj != NULL) FreeObj(tmpCurTextObj); tmpCurTextObj = NULL; ! firstStr = lastStr = curStr = NewStr (); ! if (firstStr == NULL) FailAllocMessage (); ! if (textCursorH+textVSpace <= 0) ! { ! Msg ("Text vertical spacing too small. Reset to 0."); textVSpace = 0; ! ShowTextVSpace (); } savedEditTextSize = (-1); --- 534,554 ---- } ! static int curTextIsNew=FALSE; ! void NewCurText() { ! struct TextRec *text_ptr; if (tmpCurTextObj != NULL) FreeObj(tmpCurTextObj); tmpCurTextObj = NULL; ! firstStr = lastStr = curStr = NewStr(); ! if (firstStr == NULL) FailAllocMessage(); ! if (textCursorH+textVSpace <= 0) { textVSpace = 0; ! ShowTextVSpace(); ! MsgBox("Text vertical spacing too small.\n\nIt is reset to 0.", ! TOOL_NAME, INFO_MB); } savedEditTextSize = (-1); *************** *** 605,609 **** curTextObj->ctm = NULL; curTextObj->invisible = FALSE; ! AddObj (NULL, topObj, curTextObj); UpdateTextW(0, NULL); --- 603,607 ---- curTextObj->ctm = NULL; curTextObj->invisible = FALSE; ! AddObj(NULL, topObj, curTextObj); UpdateTextW(0, NULL); *************** *** 616,637 **** } ! void FreeTextObj (ObjPtr) ! struct ObjRec * ObjPtr; { ! if (ObjPtr->detail.t != NULL) ! { ! register struct StrRec * s_ptr, * next_str; ! for (s_ptr = ObjPtr->detail.t->first; s_ptr != NULL; s_ptr = next_str) ! { next_str = s_ptr->next; ! FreeStr (s_ptr); } ! ! if (ObjPtr->detail.t->cached_bitmap != None) ! XFreePixmap (mainDisplay, ObjPtr->detail.t->cached_bitmap); ! ! if (ObjPtr->detail.t->font_name != NULL) free(ObjPtr->detail.t->font_name); free(ObjPtr->detail.t); } --- 614,633 ---- } ! void FreeTextObj(ObjPtr) ! struct ObjRec *ObjPtr; { ! if (ObjPtr->detail.t != NULL) { ! register struct StrRec *s_ptr, *next_str; ! for (s_ptr=ObjPtr->detail.t->first; s_ptr != NULL; s_ptr=next_str) { next_str = s_ptr->next; ! FreeStr(s_ptr); } ! if (ObjPtr->detail.t->cached_bitmap != None) { ! XFreePixmap(mainDisplay, ObjPtr->detail.t->cached_bitmap); ! } ! if (ObjPtr->detail.t->font_name != NULL) { free(ObjPtr->detail.t->font_name); + } free(ObjPtr->detail.t); } *************** *** 1052,1058 **** RotateObjClockWise(topObj); rotationIncrement = saved_rotation_increment; ! RedrawAreas(botObj, saved_ltx-GRID_ABS_SIZE(1), saved_lty-GRID_ABS_SIZE(1), ! saved_rbx+GRID_ABS_SIZE(1), saved_rby+GRID_ABS_SIZE(1), ! topObj->bbox.ltx-GRID_ABS_SIZE(1), topObj->bbox.lty-GRID_ABS_SIZE(1), topObj->bbox.rbx+GRID_ABS_SIZE(1), --- 1048,1054 ---- RotateObjClockWise(topObj); rotationIncrement = saved_rotation_increment; ! RedrawAreas(botObj, saved_ltx-GRID_ABS_SIZE(1), ! saved_lty-GRID_ABS_SIZE(1), saved_rbx+GRID_ABS_SIZE(1), ! saved_rby+GRID_ABS_SIZE(1), topObj->bbox.ltx-GRID_ABS_SIZE(1), topObj->bbox.lty-GRID_ABS_SIZE(1), topObj->bbox.rbx+GRID_ABS_SIZE(1), *************** *** 1136,1142 **** if (s_ptr == highlightStartStr) { ! strcpy (buf, s_ptr->dyn_str.s); buf[highlightStartIndex] = '\0'; ! len = strlen (buf); start_offset = XTextWidth (canvasFontPtr, buf, len); } --- 1132,1138 ---- if (s_ptr == highlightStartStr) { ! strcpy(buf, s_ptr->dyn_str.s); buf[highlightStartIndex] = '\0'; ! len = strlen(buf); start_offset = XTextWidth (canvasFontPtr, buf, len); } *************** *** 1146,1152 **** if (s_ptr == highlightEndStr) { ! strcpy (buf, s_ptr->dyn_str.s); buf[highlightEndIndex] = '\0'; ! len = strlen (buf); end_offset = XTextWidth (canvasFontPtr, buf, len); } --- 1142,1148 ---- if (s_ptr == highlightEndStr) { ! strcpy(buf, s_ptr->dyn_str.s); buf[highlightEndIndex] = '\0'; ! len = strlen(buf); end_offset = XTextWidth (canvasFontPtr, buf, len); } *************** *** 1528,1568 **** XButtonEvent * Button_Ev; { ! int grid_x, grid_y, x_off, y_off, amount; ! int left, pressed_in_same_text = FALSE, x = 0; ! int abs_x, abs_y, tmp_x, tmp_y; ! struct ObjRec * obj_ptr = NULL; ! struct AttrRec * attr_ptr; ! char * c_ptr, s[2]; ! int done=FALSE, saved_end_index; ! XEvent input, ev; ! struct StrRec * saved_end_str; ! escPressed = FALSE; if (Button_Ev->button == Button1 && ! !(Button_Ev->state & (ShiftMask|ControlMask))) ! { x_off = Button_Ev->x; abs_x = ABS_X(x_off); y_off = Button_Ev->y; abs_y = ABS_Y(y_off); ! if (textCursorShown) ! { ! switch (textJust) ! { ! case JUST_L: x = textOrigX-2; break; ! case JUST_C: x = textOrigX-textW/2-2; break; ! case JUST_R: x = textOrigX-textW-2; break; } if (x_off >= x && x_off <= x+textW+4 && ! y_off >= textOrigY-2 && y_off <= textOrigY+textH+2) pressed_in_same_text = TRUE; ! else ! { ! CreateTextObj (); /* end editing on the old text */ curTextModified = FALSE; } ! } ! else ! { editingText = FALSE; curTextModified = FALSE; --- 1524,1557 ---- XButtonEvent * Button_Ev; { ! int grid_x, grid_y, x_off, y_off, amount; ! int left, pressed_in_same_text = FALSE, x = 0; ! int abs_x, abs_y, tmp_x, tmp_y; ! struct ObjRec *obj_ptr=NULL; ! struct AttrRec *attr_ptr; ! char *c_ptr, s[2]; ! int done=FALSE, saved_end_index; ! XEvent input, ev; ! struct StrRec *saved_end_str; escPressed = FALSE; if (Button_Ev->button == Button1 && ! !(Button_Ev->state & (ShiftMask|ControlMask))) { x_off = Button_Ev->x; abs_x = ABS_X(x_off); y_off = Button_Ev->y; abs_y = ABS_Y(y_off); ! if (textCursorShown) { ! switch (textJust) { ! case JUST_L: x = textOrigX-2; break; ! case JUST_C: x = textOrigX-textW/2-2; break; ! case JUST_R: x = textOrigX-textW-2; break; } if (x_off >= x && x_off <= x+textW+4 && ! y_off >= textOrigY-2 && y_off <= textOrigY+textH+2) { pressed_in_same_text = TRUE; ! } else { ! CreateTextObj(); /* end editing on the old text */ curTextModified = FALSE; } ! } else { editingText = FALSE; curTextModified = FALSE; *************** *** 1570,1586 **** if (!pressed_in_same_text && ! (obj_ptr = FindTextObj(x_off, y_off, NULL)) == NULL) ! { /* cursor not within any existing text object */ ! if (curSize != canvasFontSize) ! { ! char msg[MAXSTRING+1]; ! ! sprintf (msg, "Text size=%1d not available.\n\n%s.", curSize, ! "Please try a different size"); ! MsgBox (msg, TOOL_NAME, INFO_MB); ! } ! else ! { ! GridXY (x_off, y_off, &grid_x, &grid_y); textOrigX = textCurX = grid_x; --- 1559,1570 ---- if (!pressed_in_same_text && ! (obj_ptr = FindTextObj(x_off, y_off, NULL)) == NULL) { ! /* cursor not within any existing text object */ ! if (curSize != canvasFontSize) { ! sprintf(gszMsgBox, "Text size=%1d not available.\n\n%s.", ! curSize, "Please try a different size"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! } else { ! GridXY(x_off, y_off, &grid_x, &grid_y); textOrigX = textCurX = grid_x; *************** *** 1591,1635 **** textAbsY = ABS_Y(grid_y); tmpAdjX = tmpAdjY = 0; ! NewCurText (); ! RedrawCurText (); ! CurFontMsg (); ! PrepareToReplaceAnObj (curTextObj); } ! } ! else ! { /* cursor inside an existing text object */ ! Time click_time=Button_Ev->time; ! int double_clicked=FALSE; ! int inherited_attr_left_index=(-1); double_clicked = (pressed_in_same_text && textJustClicked && (click_time-lastClickTime) < doubleClickInterval); ! if (pressed_in_same_text) ! { obj_ptr = curTextObj; curStr = obj_ptr->detail.t->first; if (textJustClicked && (click_time-lastClickTime) < ! doubleClickInterval) double_clicked = TRUE; ! } ! else if (!PrepareEditExistingText (obj_ptr,abs_x,abs_y,&x_off,&y_off)) return; textCurY = textOrigY; ! if (pressed_in_same_text) ! { while (y_off >= textCurY+textCursorH+textVSpace && ! curStr->next != NULL) ! { textCurY += textCursorH+textVSpace; curStr = curStr->next; } ! } ! else ! { tmp_y = textAbsY; while (ABS_Y(y_off)>=tmp_y+textCursorH+textVSpace && ! curStr->next != NULL) ! { textCurY += textCursorH+textVSpace; tmp_y += textCursorH+textVSpace; --- 1575,1613 ---- textAbsY = ABS_Y(grid_y); tmpAdjX = tmpAdjY = 0; ! NewCurText(); ! RedrawCurText(); ! CurFontMsg(); ! PrepareToReplaceAnObj(curTextObj); } ! } else { ! /* cursor inside an existing text object */ ! Time click_time=Button_Ev->time; ! int double_clicked=FALSE, inherited_attr_left_index=(-1); double_clicked = (pressed_in_same_text && textJustClicked && (click_time-lastClickTime) < doubleClickInterval); ! if (pressed_in_same_text) { obj_ptr = curTextObj; curStr = obj_ptr->detail.t->first; if (textJustClicked && (click_time-lastClickTime) < ! doubleClickInterval) { double_clicked = TRUE; ! } ! } else if (!PrepareEditExistingText(obj_ptr, abs_x, abs_y, ! &x_off,&y_off)) { return; + } textCurY = textOrigY; ! if (pressed_in_same_text) { while (y_off >= textCurY+textCursorH+textVSpace && ! curStr->next != NULL) { textCurY += textCursorH+textVSpace; curStr = curStr->next; } ! } else { tmp_y = textAbsY; while (ABS_Y(y_off)>=tmp_y+textCursorH+textVSpace && ! curStr->next != NULL) { textCurY += textCursorH+textVSpace; tmp_y += textCursorH+textVSpace; *************** *** 1638,1642 **** } ! curStrW = amount = XTextWidth (canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); --- 1616,1620 ---- } ! curStrW = amount = XTextWidth(canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); *************** *** 1644,1652 **** textCurX = textOrigX; ! switch (textJust) ! { ! case JUST_L: break; ! case JUST_C: textCurX -= (amount>>1); break; ! case JUST_R: textCurX -= amount; break; } left = textCurX; --- 1622,1629 ---- textCurX = textOrigX; ! switch (textJust) { ! case JUST_L: break; ! case JUST_C: textCurX -= (amount>>1); break; ! case JUST_R: textCurX -= amount; break; } left = textCurX; *************** *** 1654,1704 **** s[1] = '\0'; c_ptr = curStr->dyn_str.s; ! if (pressed_in_same_text) ! { ! for ( ; *c_ptr != '\0'; c_ptr++) ! { s[0] = *c_ptr; ! amount = XTextWidth (canvasFontPtr, s, 1); ! if (double_clicked) ! { ! if (x_off < textCurX+amount) /* make sure it stops on the left side of the character */ break; ! else textCurX += amount; ! } ! else ! { ! if (x_off < textCurX+(amount>>1)) /* stops on the right side of the clicked */ /* character if the cursor is */ /* closer to the right side */ break; ! else textCurX += amount; } textCurIndex++; } ! } ! else ! { tmp_x = textAbsX; ! switch (textJust) ! { ! case JUST_L: break; ! case JUST_C: tmp_x -= (amount>>1); break; ! case JUST_R: tmp_x -= amount; break; } ! for ( ; *c_ptr != '\0'; c_ptr++) ! { s[0] = *c_ptr; ! amount = XTextWidth (canvasFontPtr, s, 1); ! if (ABS_X(x_off)< tmp_x+(amount>>1)) break; ! else ! { textCurX += amount; tmp_x += amount; --- 1631,1673 ---- s[1] = '\0'; c_ptr = curStr->dyn_str.s; ! if (pressed_in_same_text) { ! for ( ; *c_ptr != '\0'; c_ptr++) { s[0] = *c_ptr; ! amount = XTextWidth(canvasFontPtr, s, 1); ! if (double_clicked) { ! if (x_off < textCurX+amount) { /* make sure it stops on the left side of the character */ break; ! } else { textCurX += amount; ! } ! } else { ! if (x_off < textCurX+(amount>>1)) { /* stops on the right side of the clicked */ /* character if the cursor is */ /* closer to the right side */ break; ! } else { textCurX += amount; + } } textCurIndex++; } ! } else { tmp_x = textAbsX; ! switch (textJust) { ! case JUST_L: break; ! case JUST_C: tmp_x -= (amount>>1); break; ! case JUST_R: tmp_x -= amount; break; } ! for ( ; *c_ptr != '\0'; c_ptr++) { s[0] = *c_ptr; ! amount = XTextWidth(canvasFontPtr, s, 1); ! if (ABS_X(x_off)< tmp_x+(amount>>1)) { break; ! } else { textCurX += amount; tmp_x += amount; *************** *** 1710,1720 **** attr_ptr = obj_ptr->detail.t->attr; if (attr_ptr != NULL && attr_ptr->inherited && textCurY == textOrigY && ! attr_ptr->shown && attr_ptr->nameshown) ! { inherited_attr_left_index = attr_ptr->attr_name.sz-1; ! if (textCurIndex < inherited_attr_left_index) ! { /* clicked in the name of an inherited attribute */ textCurIndex = attr_ptr->attr_name.sz-1; ! textCurX = left + XTextWidth (canvasFontPtr, attr_ptr->attr_name.s, textCurIndex); } --- 1679,1688 ---- attr_ptr = obj_ptr->detail.t->attr; if (attr_ptr != NULL && attr_ptr->inherited && textCurY == textOrigY && ! attr_ptr->shown && attr_ptr->nameshown) { inherited_attr_left_index = attr_ptr->attr_name.sz-1; ! if (textCurIndex < inherited_attr_left_index) { ! /* clicked in the name of an inherited attribute */ textCurIndex = attr_ptr->attr_name.sz-1; ! textCurX = left + XTextWidth(canvasFontPtr, attr_ptr->attr_name.s, textCurIndex); } *************** *** 1723,1730 **** textHighlight = FALSE; ! if (double_clicked) ! { ! char cur_char=curStr->dyn_str.s[textCurIndex]; ! int right_index=curStr->dyn_str.sz-1; highlightStartStr = highlightEndStr = endStr = curStr; --- 1691,1697 ---- textHighlight = FALSE; ! if (double_clicked) { ! char cur_char=curStr->dyn_str.s[textCurIndex]; ! int right_index=curStr->dyn_str.sz-1; highlightStartStr = highlightEndStr = endStr = curStr; *************** *** 1733,1812 **** textEndIndex = textCurIndex; ! if (PartOfAWord (cur_char)) ! { saved_end_index = textCurIndex; ! if (inherited_attr_left_index != (-1)) ! { ! while (textCurIndex > inherited_attr_left_index) ! if (PartOfAWord (curStr->dyn_str.s[textCurIndex-1])) textCurIndex--; ! else break; ! } ! else ! { ! while (textCurIndex > 0) ! if (PartOfAWord (curStr->dyn_str.s[textCurIndex-1])) textCurIndex--; ! else break; } ! SetTextCurX (); highlightStartIndex = highlightEndIndex = textCurIndex; textEndIndex = saved_end_index+1; ! while (textEndIndex < right_index) ! if (PartOfAWord (curStr->dyn_str.s[textEndIndex])) textEndIndex++; ! else break; highlightEndIndex = textEndIndex; ! } ! else if (cur_char != '\0') ! { saved_end_index = textCurIndex; ! if (inherited_attr_left_index != (-1)) ! { ! while (textCurIndex > inherited_attr_left_index) ! if (curStr->dyn_str.s[textCurIndex-1] == cur_char) textCurIndex--; ! else break; ! } ! else ! { ! while (textCurIndex > 0) ! if (curStr->dyn_str.s[textCurIndex-1] == cur_char) textCurIndex--; ! else break; } ! SetTextCurX (); highlightStartIndex = highlightEndIndex = textCurIndex; textEndIndex = saved_end_index+1; ! while (textEndIndex < right_index) ! if (curStr->dyn_str.s[textEndIndex] == cur_char) textEndIndex++; ! else break; highlightEndIndex = textEndIndex; } textHighlight = !(endStr==curStr && textEndIndex==textCurIndex); ! RedrawCurText (); textJustClicked = FALSE; return; } ! RedrawCurText (); textJustClicked = TRUE; lastClickTime = click_time; ! XGrabPointer (mainDisplay, drawWindow, FALSE, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, textCursor, CurrentTime); --- 1700,1782 ---- textEndIndex = textCurIndex; ! if (PartOfAWord(cur_char)) { saved_end_index = textCurIndex; ! if (inherited_attr_left_index != (-1)) { ! while (textCurIndex > inherited_attr_left_index) { ! if (PartOfAWord(curStr->dyn_str.s[textCurIndex-1])) { textCurIndex--; ! } else { break; ! } ! } ! } else { ! while (textCurIndex > 0) { ! if (PartOfAWord(curStr->dyn_str.s[textCurIndex-1])) { textCurIndex--; ! } else { break; + } + } } ! SetTextCurX(); highlightStartIndex = highlightEndIndex = textCurIndex; textEndIndex = saved_end_index+1; ! while (textEndIndex < right_index) { ! if (PartOfAWord(curStr->dyn_str.s[textEndIndex])) { textEndIndex++; ! } else { break; + } + } highlightEndIndex = textEndIndex; ! } else if (cur_char != '\0') { saved_end_index = textCurIndex; ! if (inherited_attr_left_index != (-1)) { ! while (textCurIndex > inherited_attr_left_index) { ! if (curStr->dyn_str.s[textCurIndex-1] == cur_char) { textCurIndex--; ! } else { break; ! } ! } ! } else { ! while (textCurIndex > 0) { ! if (curStr->dyn_str.s[textCurIndex-1] == cur_char) { textCurIndex--; ! } else { break; + } + } } ! SetTextCurX(); highlightStartIndex = highlightEndIndex = textCurIndex; textEndIndex = saved_end_index+1; ! while (textEndIndex < right_index) { ! if (curStr->dyn_str.s[textEndIndex] == cur_char) { textEndIndex++; ! } else { break; + } + } highlightEndIndex = textEndIndex; } textHighlight = !(endStr==curStr && textEndIndex==textCurIndex); ! RedrawCurText(); textJustClicked = FALSE; return; } ! RedrawCurText(); textJustClicked = TRUE; lastClickTime = click_time; ! XGrabPointer(mainDisplay, drawWindow, FALSE, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, textCursor, CurrentTime); *************** *** 1819,1835 **** highlightStartY = textCurY; ! while (!done) ! { ! XNextEvent (mainDisplay, &input); ! if (input.type == Expose || input.type == VisibilityNotify) ! ExposeEventHandler (&input, TRUE); ! else if (input.type == ButtonRelease) ! { ! XUngrabPointer (mainDisplay, CurrentTime); done = TRUE; ! } ! else if (input.type == MotionNotify) ! { x_off = input.xmotion.x; y_off = input.xmotion.y; --- 1789,1801 ---- highlightStartY = textCurY; ! while (!done) { ! XNextEvent(mainDisplay, &input); ! if (input.type == Expose || input.type == VisibilityNotify) { ! ExposeEventHandler(&input, TRUE); ! } else if (input.type == ButtonRelease) { ! XUngrabPointer(mainDisplay, CurrentTime); done = TRUE; ! } else if (input.type == MotionNotify) { x_off = input.xmotion.x; y_off = input.xmotion.y; *************** *** 1840,1883 **** textEndY = textOrigY; while (y_off >= textEndY+textCursorH+textVSpace && ! endStr->next != NULL) ! { textEndY += textCursorH+textVSpace; endStr = endStr->next; } ! endStrW = amount = XTextWidth (canvasFontPtr, endStr->dyn_str.s, endStr->dyn_str.sz-1); textEndX = textOrigX; ! switch (textJust) ! { ! case JUST_L: break; ! case JUST_C: textEndX -= (amount>>1); break; ! case JUST_R: textEndX -= amount; break; } textEndIndex = 0; left = textEndX; ! if (y_off >= textOrigY-2) ! { if (y_off > textEndY+textCursorH+textVSpace+2 && ! endStr->next == NULL) ! { textEndIndex = endStr->dyn_str.sz-1; textEndX += endStrW; ! } ! else ! { s[1] = '\0'; c_ptr = endStr->dyn_str.s; ! for ( ; *c_ptr != '\0'; c_ptr++) ! { s[0] = *c_ptr; ! amount = XTextWidth (canvasFontPtr, s, 1); ! if (x_off < textEndX+(amount>>1)) break; ! else textEndX += amount; textEndIndex++; } --- 1806,1843 ---- textEndY = textOrigY; while (y_off >= textEndY+textCursorH+textVSpace && ! endStr->next != NULL) { textEndY += textCursorH+textVSpace; endStr = endStr->next; } ! endStrW = amount = XTextWidth(canvasFontPtr, endStr->dyn_str.s, endStr->dyn_str.sz-1); textEndX = textOrigX; ! switch (textJust) { ! case JUST_L: break; ! case JUST_C: textEndX -= (amount>>1); break; ! case JUST_R: textEndX -= amount; break; } textEndIndex = 0; left = textEndX; ! if (y_off >= textOrigY-2) { if (y_off > textEndY+textCursorH+textVSpace+2 && ! endStr->next == NULL) { textEndIndex = endStr->dyn_str.sz-1; textEndX += endStrW; ! } else { s[1] = '\0'; c_ptr = endStr->dyn_str.s; ! for ( ; *c_ptr != '\0'; c_ptr++) { s[0] = *c_ptr; ! amount = XTextWidth(canvasFontPtr, s, 1); ! if (x_off < textEndX+(amount>>1)) { break; ! } else { textEndX += amount; + } textEndIndex++; } *************** *** 1889,1921 **** textEndY == textOrigY && attr_ptr->shown && attr_ptr->nameshown && ! textEndIndex < attr_ptr->attr_name.sz-1) ! { textEndIndex = attr_ptr->attr_name.sz-1; ! textEndX = left + XTextWidth (canvasFontPtr, attr_ptr->attr_name.s, textEndIndex); } textHighlight = !(endStr==curStr&&textEndIndex==textCurIndex); ! if (endStr!=saved_end_str || textEndIndex!=saved_end_index) ! { ! XorText (); ! if (textEndY == textCurY) ! { highlightStartStr = highlightEndStr = curStr; highlightStartY = textCurY; ! if (textEndIndex > textCurIndex) ! { highlightStartIndex = textCurIndex; highlightEndIndex = textEndIndex; ! } ! else ! { highlightStartIndex = textEndIndex; highlightEndIndex = textCurIndex; } ! } ! else if (textEndY > textCurY) ! { highlightStartStr = curStr; highlightStartIndex = textCurIndex; --- 1849,1873 ---- textEndY == textOrigY && attr_ptr->shown && attr_ptr->nameshown && ! textEndIndex < attr_ptr->attr_name.sz-1) { textEndIndex = attr_ptr->attr_name.sz-1; ! textEndX = left + XTextWidth(canvasFontPtr, attr_ptr->attr_name.s, textEndIndex); } textHighlight = !(endStr==curStr&&textEndIndex==textCurIndex); ! if (endStr!=saved_end_str || textEndIndex!=saved_end_index) { ! XorText(); ! if (textEndY == textCurY) { highlightStartStr = highlightEndStr = curStr; highlightStartY = textCurY; ! if (textEndIndex > textCurIndex) { highlightStartIndex = textCurIndex; highlightEndIndex = textEndIndex; ! } else { highlightStartIndex = textEndIndex; highlightEndIndex = textCurIndex; } ! } else if (textEndY > textCurY) { highlightStartStr = curStr; highlightStartIndex = textCurIndex; *************** *** 1923,1929 **** highlightEndIndex = textEndIndex; highlightStartY = textCurY; ! } ! else ! { highlightStartStr = endStr; highlightStartIndex = textEndIndex; --- 1875,1879 ---- highlightEndIndex = textEndIndex; highlightStartY = textCurY; ! } else { highlightStartStr = endStr; highlightStartIndex = textEndIndex; *************** *** 1935,1949 **** saved_end_str = endStr; saved_end_index = textEndIndex; ! XorText (); } ! while (XCheckMaskEvent (mainDisplay,PointerMotionMask,&ev)) ; } } } ! } ! else if (Button_Ev->button == Button1 && ! (Button_Ev->state & (ShiftMask|ControlMask))) ! { if (!textCursorShown) return; --- 1885,1897 ---- saved_end_str = endStr; saved_end_index = textEndIndex; ! XorText(); } ! while (XCheckMaskEvent(mainDisplay,PointerMotionMask,&ev)) ; } } } ! } else if (Button_Ev->button == Button1 && ! (Button_Ev->state & (ShiftMask|ControlMask))) { if (!textCursorShown) return; *************** *** 1951,1984 **** y_off = Button_Ev->y; ! switch (textJust) ! { ! case JUST_L: x = textOrigX-2; break; ! case JUST_C: x = textOrigX-textW/2-2; break; ! case JUST_R: x = textOrigX-textW-2; break; } if (!(x_off >= x && x_off <= x+textW+2 && ! y_off >= textOrigY-2 && y_off <= textOrigY+textH+2)) return; ! obj_ptr = curTextObj; endStr = obj_ptr->detail.t->first; textEndY = textOrigY; ! while (y_off >= textEndY+textCursorH+textVSpace && endStr->next != NULL) ! { textEndY += textCursorH+textVSpace; endStr = endStr->next; } ! endStrW = amount = XTextWidth (canvasFontPtr, endStr->dyn_str.s, endStr->dyn_str.sz-1); textEndX = textOrigX; ! switch (textJust) ! { ! case JUST_L: break; ! case JUST_C: textEndX -= (amount>>1); break; ! case JUST_R: textEndX -= amount; break; } textEndIndex = 0; --- 1899,1929 ---- y_off = Button_Ev->y; ! switch (textJust) { ! case JUST_L: x = textOrigX-2; break; ! case JUST_C: x = textOrigX-textW/2-2; break; ! case JUST_R: x = textOrigX-textW-2; break; } if (!(x_off >= x && x_off <= x+textW+2 && ! y_off >= textOrigY-2 && y_off <= textOrigY+textH+2)) { return; ! } obj_ptr = curTextObj; endStr = obj_ptr->detail.t->first; textEndY = textOrigY; ! while (y_off >= textEndY+textCursorH+textVSpace && endStr->next != NULL) { textEndY += textCursorH+textVSpace; endStr = endStr->next; } ! endStrW = amount = XTextWidth(canvasFontPtr, endStr->dyn_str.s, endStr->dyn_str.sz-1); textEndX = textOrigX; ! switch (textJust) { ! case JUST_L: break; ! case JUST_C: textEndX -= (amount>>1); break; ! case JUST_R: textEndX -= amount; break; } textEndIndex = 0; *************** *** 1987,1999 **** s[1] = '\0'; c_ptr = endStr->dyn_str.s; ! for ( ; *c_ptr != '\0'; c_ptr++) ! { s[0] = *c_ptr; ! amount = XTextWidth (canvasFontPtr, s, 1); ! if (x_off < textEndX+(amount>>1)) break; ! else textEndX += amount; textEndIndex++; } --- 1932,1944 ---- s[1] = '\0'; c_ptr = endStr->dyn_str.s; ! for ( ; *c_ptr != '\0'; c_ptr++) { s[0] = *c_ptr; ! amount = XTextWidth(canvasFontPtr, s, 1); ! if (x_off < textEndX+(amount>>1)) { break; ! } else { textEndX += amount; + } textEndIndex++; } *************** *** 2002,2081 **** if (attr_ptr != NULL && attr_ptr->inherited && textEndY == textOrigY && attr_ptr->shown && attr_ptr->nameshown && ! textEndIndex < attr_ptr->attr_name.sz-1) ! { textEndIndex = attr_ptr->attr_name.sz-1; ! textEndX = left + XTextWidth (canvasFontPtr, attr_ptr->attr_name.s, textEndIndex); } textHighlight = !(endStr == curStr && textEndIndex == textCurIndex); ! RedrawCurText (); } } static ! int NumLines () { ! register struct StrRec * str_ptr; ! register int i = 0; for (str_ptr = firstStr; str_ptr != NULL; str_ptr = str_ptr->next, i++) ; ! return (i); } static ! void JustDeleteHighlightedText (need_to_calc_extra_info) ! int * need_to_calc_extra_info; { ! struct StrRec * s_ptr, * s_ptr1, * new_cur_str = NULL; ! int highlighting = FALSE, new_cur_index = 0; ! int second_index, len; ! int i, y, new_cur_y = 0, len1, len2; if (!textHighlight) return; y = textOrigY; ! for (s_ptr = firstStr; s_ptr != NULL; y += textCursorH+textVSpace) ! { ! if (highlighting) ! { /* started deleting already */ ! if (s_ptr == curStr || s_ptr == endStr) ! { ! char buf[MAXSTRING+1], msg[80]; second_index = (s_ptr == curStr) ? textCurIndex : textEndIndex; ! len1 = strlen (new_cur_str->dyn_str.s); ! len2 = strlen (&(s_ptr->dyn_str.s[second_index])); ! if (len1+len2 >= MAXSTRING) ! { ! sprintf (msg, "String length exceeds %1d. %s.", MAXSTRING, "String truncated"); ! Msg (msg); s_ptr->dyn_str.s[MAXSTRING-len1+second_index] = '\0'; s_ptr->dyn_str.sz = MAXSTRING-len1+second_index+1; } ! sprintf (buf, "%s%s", new_cur_str->dyn_str.s, &(s_ptr->dyn_str.s[second_index])); ! DynStrSet (&new_cur_str->dyn_str, buf); ! if (s_ptr == lastStr) lastStr = s_ptr->prev; ! else s_ptr->next->prev = s_ptr->prev; s_ptr->prev->next = s_ptr->next; ! FreeStr (s_ptr); break; ! } ! else ! { /* delete the whole line */ s_ptr1 = s_ptr->next; s_ptr1->prev = s_ptr->prev; ! FreeStr (s_ptr); s_ptr = s_ptr1; } ! } ! else ! { /* looking for the beginning ... */ ! if (s_ptr == curStr && s_ptr == endStr) ! { /* the whole string to be deleted is within s_ptr */ ! char * s; new_cur_str = s_ptr; --- 1947,2020 ---- if (attr_ptr != NULL && attr_ptr->inherited && textEndY == textOrigY && attr_ptr->shown && attr_ptr->nameshown && ! textEndIndex < attr_ptr->attr_name.sz-1) { textEndIndex = attr_ptr->attr_name.sz-1; ! textEndX = left + XTextWidth(canvasFontPtr, attr_ptr->attr_name.s, textEndIndex); } textHighlight = !(endStr == curStr && textEndIndex == textCurIndex); ! RedrawCurText(); } } static ! int NumLines() { ! register struct StrRec *str_ptr; ! register int i=0; for (str_ptr = firstStr; str_ptr != NULL; str_ptr = str_ptr->next, i++) ; ! return i; } static ! void JustDeleteHighlightedText(need_to_calc_extra_info) ! int *need_to_calc_extra_info; { ! struct StrRec *s_ptr, *s_ptr1, *new_cur_str=NULL; ! int highlighting=FALSE, new_cur_index=0; ! int second_index, len, i, y, new_cur_y=0, len1, len2; if (!textHighlight) return; y = textOrigY; ! for (s_ptr = firstStr; s_ptr != NULL; y += textCursorH+textVSpace) { ! if (highlighting) { ! /* started deleting already */ ! if (s_ptr == curStr || s_ptr == endStr) { ! char buf[MAXSTRING+1]; second_index = (s_ptr == curStr) ? textCurIndex : textEndIndex; ! len1 = strlen(new_cur_str->dyn_str.s); ! len2 = strlen(&(s_ptr->dyn_str.s[second_index])); ! if (len1+len2 >= MAXSTRING) { ! sprintf(gszMsgBox, "String length exceeds %1d. %s.", MAXSTRING, "String truncated"); ! Msg(gszMsgBox); s_ptr->dyn_str.s[MAXSTRING-len1+second_index] = '\0'; s_ptr->dyn_str.sz = MAXSTRING-len1+second_index+1; } ! sprintf(buf, "%s%s", new_cur_str->dyn_str.s, &(s_ptr->dyn_str.s[second_index])); ! DynStrSet(&new_cur_str->dyn_str, buf); ! if (s_ptr == lastStr) { lastStr = s_ptr->prev; ! } else { s_ptr->next->prev = s_ptr->prev; + } s_ptr->prev->next = s_ptr->next; ! FreeStr(s_ptr); break; ! } else { ! /* delete the whole line */ s_ptr1 = s_ptr->next; s_ptr1->prev = s_ptr->prev; ! FreeStr(s_ptr); s_ptr = s_ptr1; } ! } else { ! /* looking for the beginning ... */ ! if (s_ptr == curStr && s_ptr == endStr) { ! /* the whole string to be deleted is within s_ptr */ ! char *s; new_cur_str = s_ptr; *************** *** 2085,2100 **** if ((new_cur_index==0 || new_cur_index==new_cur_str->dyn_str.sz-1 || second_index==0 || second_index==new_cur_str->dyn_str.sz-1) && ! need_to_calc_extra_info != NULL) *need_to_calc_extra_info = TRUE; s = new_cur_str->dyn_str.s; ! len = strlen (&(s[second_index])); for (i = 0; i <= len; i++) s[new_cur_index+i] = s[second_index+i]; new_cur_str->dyn_str.sz = strlen(s)+1; break; ! } ! else if (s_ptr == curStr || s_ptr == endStr) ! { /* found the beginning */ ! if (need_to_calc_extra_info != NULL) *need_to_calc_extra_info = TRUE; new_cur_str = s_ptr; new_cur_index = (s_ptr == curStr) ? textCurIndex : textEndIndex; --- 2024,2040 ---- if ((new_cur_index==0 || new_cur_index==new_cur_str->dyn_str.sz-1 || second_index==0 || second_index==new_cur_str->dyn_str.sz-1) && ! need_to_calc_extra_info != NULL) { *need_to_calc_extra_info = TRUE; + } s = new_cur_str->dyn_str.s; ! len = strlen(&(s[second_index])); for (i = 0; i <= len; i++) s[new_cur_index+i] = s[second_index+i]; new_cur_str->dyn_str.sz = strlen(s)+1; break; ! } else if (s_ptr == curStr || s_ptr == endStr) { ! /* found the beginning */ ! if (need_to_calc_extra_info != NULL) { *need_to_calc_extra_info = TRUE; + } new_cur_str = s_ptr; new_cur_index = (s_ptr == curStr) ? textCurIndex : textEndIndex; *************** *** 2103,2109 **** highlighting = TRUE; s_ptr = s_ptr->next; ! } ! else ! { /* still looking */ s_ptr = s_ptr->next; } --- 2043,2048 ---- highlighting = TRUE; s_ptr = s_ptr->next; ! } else { ! /* still looking */ s_ptr = s_ptr->next; } *************** *** 2113,2117 **** curStr = new_cur_str; textCurIndex = new_cur_index; ! curStrW = XTextWidth (canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); if (curStrW > textW) { --- 2052,2056 ---- curStr = new_cur_str; textCurIndex = new_cur_index; ! curStrW = XTextWidth(canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); if (curStrW > textW) { *************** *** 2119,2138 **** } textCurY = new_cur_y; ! SetTextCurX (); } static ! void GetCurStrSizeInfo () { ! register struct StrRec * str_ptr; ! int i, max_len=0, min_lbearing=0, max_rextra=0; curTextObj->detail.t->lines = 0; for (str_ptr=firstStr; str_ptr!=NULL; ! str_ptr=str_ptr->next, curTextObj->detail.t->lines++) ! { ! int w=0, lbearing=0, rextra=0; ! GetStrSizeInfo (str_ptr, &w, &lbearing, &rextra); if (w > max_len) max_len = w; if (lbearing < min_lbearing) min_lbearing = lbearing; --- 2058,2076 ---- } textCurY = new_cur_y; ! SetTextCurX(); } static ! void GetCurStrSizeInfo() { ! register struct StrRec *str_ptr; ! int i, max_len=0, min_lbearing=0, max_rextra=0; curTextObj->detail.t->lines = 0; for (str_ptr=firstStr; str_ptr!=NULL; ! str_ptr=str_ptr->next, curTextObj->detail.t->lines++) { ! int w=0, lbearing=0, rextra=0; ! GetStrSizeInfo(str_ptr, &w, &lbearing, &rextra); if (w > max_len) max_len = w; if (lbearing < min_lbearing) min_lbearing = lbearing; *************** *** 2141,2160 **** } i = curTextObj->detail.t->lines; ! SetTextBBox (curTextObj, textJust, max_len, i*textCursorH+(i-1)*textVSpace, min_lbearing, max_rextra, curRotate); } static ! void SetCurStrExtraInfo () { ! register struct StrRec * str_ptr; textAbsMinLBearing = 0; textAbsMaxRExtra = 0; ! for (str_ptr=firstStr; str_ptr!=NULL; str_ptr=str_ptr->next) ! { ! int lbearing=0, rextra=0; ! GetStrSizeInfo (str_ptr, NULL, &lbearing, &rextra); if (lbearing < textAbsMinLBearing) textAbsMinLBearing = lbearing; if (rextra > textAbsMaxRExtra) textAbsMaxRExtra = rextra; --- 2079,2097 ---- } i = curTextObj->detail.t->lines; ! SetTextBBox(curTextObj, textJust, max_len, i*textCursorH+(i-1)*textVSpace, min_lbearing, max_rextra, curRotate); } static ! void SetCurStrExtraInfo() { ! register struct StrRec *str_ptr; textAbsMinLBearing = 0; textAbsMaxRExtra = 0; ! for (str_ptr=firstStr; str_ptr!=NULL; str_ptr=str_ptr->next) { ! int lbearing=0, rextra=0; ! GetStrSizeInfo(str_ptr, NULL, &lbearing, &rextra); if (lbearing < textAbsMinLBearing) textAbsMinLBearing = lbearing; if (rextra > textAbsMaxRExtra) textAbsMaxRExtra = rextra; *************** *** 2163,2213 **** static ! void HandleCRLF (ColorIndex) ! int ColorIndex; { ! register int i, y; ! struct StrRec * str_ptr; ! int need_redraw = textHighlight; escPressed = FALSE; curTextModified = TRUE; ! if (textHighlight) JustDeleteHighlightedText (NULL); y = textCurY; ! for (str_ptr = curStr; str_ptr != NULL; str_ptr = str_ptr->next) ! { ! PaintCurText (drawWindow, drawGC, str_ptr->dyn_str.s, textJust, textOrigX, y, canvasFontPtr, ColorIndex, penPat, ERASE, INVALID, INVALID); y += textCursorH+textVSpace; } ! str_ptr = NewStr (); ! if (str_ptr == NULL) FailAllocMessage (); ! DynStrSet (&str_ptr->dyn_str, &curStr->dyn_str.s[textCurIndex]); curStr->dyn_str.s[textCurIndex] = '\0'; curStr->dyn_str.sz = textCurIndex+1; ! AddStr (curStr, curStr->next, str_ptr); curStr = str_ptr; textCurY += textCursorH+textVSpace; textCurIndex = 0; ! GetStrSizeInfo (curStr, &curStrW, NULL, NULL); ! SetTextCurX (); ! i = textCursorH*NumLines () + textVSpace*(NumLines ()-1); ! SetCurStrExtraInfo (); ! if (i > textH) ! { UpdateTextH(i, NumLines()); ! RedrawCurText (); ! } ! else if (need_redraw) ! RedrawCurText (); ! else ! { y = textCurY - textCursorH - textVSpace; ! for (str_ptr = curStr->prev; str_ptr != NULL; str_ptr = str_ptr->next) ! { ! PaintCurText (drawWindow, drawGC, str_ptr->dyn_str.s, textJust, textOrigX, y, canvasFontPtr, ColorIndex, penPat, PAINT_NORM, INVALID, INVALID); --- 2100,2145 ---- static ! void HandleCRLF(ColorIndex) ! int ColorIndex; { ! register int i, y; ! struct StrRec *str_ptr; ! int need_redraw=textHighlight; escPressed = FALSE; curTextModified = TRUE; ! if (textHighlight) JustDeleteHighlightedText(NULL); y = textCurY; ! for (str_ptr = curStr; str_ptr != NULL; str_ptr = str_ptr->next) { ! PaintCurText(drawWindow, drawGC, str_ptr->dyn_str.s, textJust, textOrigX, y, canvasFontPtr, ColorIndex, penPat, ERASE, INVALID, INVALID); y += textCursorH+textVSpace; } ! str_ptr = NewStr(); ! if (str_ptr == NULL) FailAllocMessage(); ! DynStrSet(&str_ptr->dyn_str, &curStr->dyn_str.s[textCurIndex]); curStr->dyn_str.s[textCurIndex] = '\0'; curStr->dyn_str.sz = textCurIndex+1; ! AddStr(curStr, curStr->next, str_ptr); curStr = str_ptr; textCurY += textCursorH+textVSpace; textCurIndex = 0; ! GetStrSizeInfo(curStr, &curStrW, NULL, NULL); ! SetTextCurX(); ! i = textCursorH*NumLines() + textVSpace*(NumLines()-1); ! SetCurStrExtraInfo(); ! if (i > textH) { UpdateTextH(i, NumLines()); ! RedrawCurText(); ! } else if (need_redraw) { ! RedrawCurText(); ! } else { y = textCurY - textCursorH - textVSpace; ! for (str_ptr=curStr->prev; str_ptr != NULL; str_ptr=str_ptr->next) { ! PaintCurText(drawWindow, drawGC, str_ptr->dyn_str.s, textJust, textOrigX, y, canvasFontPtr, ColorIndex, penPat, PAINT_NORM, INVALID, INVALID); *************** *** 2216,2229 **** } ! if (curTextObj->detail.t->cached_bitmap != None) ! XFreePixmap (mainDisplay, curTextObj->detail.t->cached_bitmap); ! curTextObj->detail.t->cached_zoom = 0; curTextObj->detail.t->cached_bitmap = None; ! if (zoomScale != 0 || curTextObj->detail.t->rotate != ROTATE0) ! GetCurStrSizeInfo (); ! ! ScrollTo (textCurX, textCurY); } --- 2148,2161 ---- } ! if (curTextObj->detail.t->cached_bitmap != None) { ! XFreePixmap(mainDisplay, curTextObj->detail.t->cached_bitmap); ! } curTextObj->detail.t->cached_zoom = 0; curTextObj->detail.t->cached_bitmap = None; ! if (zoomScale != 0 || curTextObj->detail.t->rotate != ROTATE0) { ! GetCurStrSizeInfo(); ! } ! ScrollTo(textCurX, textCurY); } *************** *** 2239,2243 **** struct AttrRec *attr_ptr; int len1, len2, need_to_calc_extra_info=FALSE; ! int nDeleteNextChar=((key_ev->state & (ControlMask | ShiftMask)) && !((key_ev->state & ControlMask) && (key_sym == XK_h))); --- 2171,2176 ---- struct AttrRec *attr_ptr; int len1, len2, need_to_calc_extra_info=FALSE; ! int nDeleteNextChar=(key_ev != NULL && ! (key_ev->state & (ControlMask | ShiftMask)) && !((key_ev->state & ControlMask) && (key_sym == XK_h))); *************** *** 2376,2380 **** register int amount; int need_redraw=textHighlight, need_to_calc_extra_info=FALSE; ! char msg[80], buf[MAXSTRING+1], tmp_char; XEvent ev; --- 2309,2313 ---- register int amount; int need_redraw=textHighlight, need_to_calc_extra_info=FALSE; ! char buf[MAXSTRING+1], tmp_char; XEvent ev; *************** *** 2393,2398 **** if (textCurIndex+((int)strlen(&(curStr->dyn_str.s[textCurIndex]))) >= MAXSTRING) { ! sprintf(msg, "String length exceeds %1d. Character ignored.",MAXSTRING); ! Msg(msg); RedrawCurText(); while (XCheckWindowEvent(mainDisplay, drawWindow, KeyPressMask, &ev)) ; --- 2326,2332 ---- if (textCurIndex+((int)strlen(&(curStr->dyn_str.s[textCurIndex]))) >= MAXSTRING) { ! sprintf(gszMsgBox, "String length exceeds %1d. Character ignored.", ! MAXSTRING); ! Msg(gszMsgBox); RedrawCurText(); while (XCheckWindowEvent(mainDisplay, drawWindow, KeyPressMask, &ev)) ; *************** *** 2445,2492 **** static ! void HandleTAB (key_ev, ColorIndex) ! XKeyEvent * key_ev; ! int ColorIndex; ! { ! struct AttrRec * attr_ptr, * new_attr; ! struct ObjRec * obj_ptr; ! int abs_x, abs_y, x_off, y_off, left, amount; escPressed = FALSE; ! if ((attr_ptr = curTextObj->detail.t->attr) == NULL) ! { MsgBox("Can not TAB out of a non-attribute text.", TOOL_NAME, INFO_MB); return; } ! CreateTextObj (); curTextModified = FALSE; ! if (key_ev->state & Mod1Mask) ! { /* new_attr will be the next attribute */ ! if (attr_ptr->next == NULL) new_attr = attr_ptr->owner->fattr; ! else new_attr = attr_ptr->next; ! while (!new_attr->shown) ! { ! if (new_attr->next == NULL) new_attr = new_attr->owner->fattr; ! else new_attr = new_attr->next; } ! } ! else ! { /* new_attr will be the previous attribute */ ! if (attr_ptr->prev == NULL) new_attr = attr_ptr->owner->lattr; ! else new_attr = attr_ptr->prev; ! while (!new_attr->shown) ! { ! if (new_attr->prev == NULL) new_attr = new_attr->owner->lattr; ! else new_attr = new_attr->prev; } } --- 2379,2426 ---- static ! void HandleTAB(key_ev, ColorIndex) ! XKeyEvent *key_ev; ! int ColorIndex; ! { ! struct AttrRec *attr_ptr, *new_attr; ! struct ObjRec *obj_ptr; ! int abs_x, abs_y, x_off, y_off, left, amount; escPressed = FALSE; ! if ((attr_ptr = curTextObj->detail.t->attr) == NULL) { MsgBox("Can not TAB out of a non-attribute text.", TOOL_NAME, INFO_MB); return; } ! CreateTextObj(); curTextModified = FALSE; ! if (key_ev->state & Mod1Mask) { ! /* new_attr will be the next attribute */ ! if (attr_ptr->next == NULL) { new_attr = attr_ptr->owner->fattr; ! } else { new_attr = attr_ptr->next; ! } ! while (!new_attr->shown) { ! if (new_attr->next == NULL) { new_attr = new_attr->owner->fattr; ! } else { new_attr = new_attr->next; + } } ! } else { ! /* new_attr will be the previous attribute */ ! if (attr_ptr->prev == NULL) { new_attr = attr_ptr->owner->lattr; ! } else { new_attr = attr_ptr->prev; ! } ! while (!new_attr->shown) { ! if (new_attr->prev == NULL) { new_attr = new_attr->owner->lattr; ! } else { new_attr = new_attr->prev; + } } } *************** *** 2495,2512 **** abs_y = obj_ptr->y; y_off = OFFSET_Y(abs_y); ! if (!PrepareEditExistingText (obj_ptr, abs_x, abs_y, &x_off, &y_off)) return; ! textCurIndex = 0; textCurY = textOrigY; textCurX = textOrigX; ! curStrW = amount = XTextWidth (canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); ! switch (textJust) ! { ! case JUST_L: break; ! case JUST_C: textCurX -= (amount>>1); break; ! case JUST_R: textCurX -= amount; break; } left = textCurX; --- 2429,2445 ---- abs_y = obj_ptr->y; y_off = OFFSET_Y(abs_y); ! if (!PrepareEditExistingText(obj_ptr, abs_x, abs_y, &x_off, &y_off)) { return; ! } textCurIndex = 0; textCurY = textOrigY; textCurX = textOrigX; ! curStrW = amount = XTextWidth(canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); ! switch (textJust) { ! case JUST_L: break; ! case JUST_C: textCurX -= (amount>>1); break; ! case JUST_R: textCurX -= amount; break; } left = textCurX; *************** *** 2515,2522 **** if (attr_ptr != NULL && attr_ptr->inherited && textCurY == textOrigY && attr_ptr->shown && attr_ptr->nameshown && ! textCurIndex < attr_ptr->attr_name.sz-1) ! { /* clicked in the name of an inherited attribute */ textCurIndex = attr_ptr->attr_name.sz-1; ! textCurX = left + XTextWidth (canvasFontPtr, attr_ptr->attr_name.s, textCurIndex); } --- 2448,2455 ---- if (attr_ptr != NULL && attr_ptr->inherited && textCurY == textOrigY && attr_ptr->shown && attr_ptr->nameshown && ! textCurIndex < attr_ptr->attr_name.sz-1) { ! /* clicked in the name of an inherited attribute */ textCurIndex = attr_ptr->attr_name.sz-1; ! textCurX = left + XTextWidth(canvasFontPtr, attr_ptr->attr_name.s, textCurIndex); } *************** *** 2534,2551 **** textEndY = textOrigY; endStr = obj_ptr->detail.t->first; ! while (endStr->next != NULL) ! { textEndY += textCursorH+textVSpace; endStr = endStr->next; } ! endStrW = amount = XTextWidth (canvasFontPtr, endStr->dyn_str.s, endStr->dyn_str.sz-1); left = textEndX = textOrigX; ! switch (textJust) ! { ! case JUST_L: break; ! case JUST_C: textEndX -= (amount>>1); break; ! case JUST_R: textEndX -= amount; break; } textEndIndex = endStr->dyn_str.sz-1; --- 2467,2482 ---- textEndY = textOrigY; endStr = obj_ptr->detail.t->first; ! while (endStr->next != NULL) { textEndY += textCursorH+textVSpace; endStr = endStr->next; } ! endStrW = amount = XTextWidth(canvasFontPtr, endStr->dyn_str.s, endStr->dyn_str.sz-1); left = textEndX = textOrigX; ! switch (textJust) { ! case JUST_L: break; ! case JUST_C: textEndX -= (amount>>1); break; ! case JUST_R: textEndX -= amount; break; } textEndIndex = endStr->dyn_str.sz-1; *************** *** 2555,2574 **** if (attr_ptr != NULL && attr_ptr->inherited && textEndY == textOrigY && attr_ptr->shown && attr_ptr->nameshown && ! textEndIndex < attr_ptr->attr_name.sz-1) ! { textEndIndex = attr_ptr->attr_name.sz-1; ! textEndX = left + XTextWidth (canvasFontPtr, attr_ptr->attr_name.s, textEndIndex); } textHighlight = !(endStr==curStr && textEndIndex==textCurIndex); ! RedrawCurText (); ! ScrollTo (textCurX, textCurY); } static ! void HandleLeft () { ! struct AttrRec * attr_ptr; escPressed = FALSE; --- 2486,2504 ---- if (attr_ptr != NULL && attr_ptr->inherited && textEndY == textOrigY && attr_ptr->shown && attr_ptr->nameshown && ! textEndIndex < attr_ptr->attr_name.sz-1) { textEndIndex = attr_ptr->attr_name.sz-1; ! textEndX = left + XTextWidth(canvasFontPtr, attr_ptr->attr_name.s, textEndIndex); } textHighlight = !(endStr==curStr && textEndIndex==textCurIndex); ! RedrawCurText(); ! ScrollTo(textCurX, textCurY); } static ! void HandleLeft() { ! struct AttrRec *attr_ptr; escPressed = FALSE; *************** *** 2576,2625 **** attr_ptr = curTextObj->detail.t->attr; if (curStr == firstStr && attr_ptr != NULL && attr_ptr->inherited && ! attr_ptr->nameshown && textCurIndex == attr_ptr->attr_name.sz-1) ! { ! if (textHighlight) ! { textHighlight = FALSE; ! RedrawCurText (); } return; } ! if (textCurIndex != 0) ! { textCurIndex--; ! SetTextCurX (); ! } ! else ! { ! if (curStr->prev != NULL) ! { textCurIndex = curStr->prev->dyn_str.sz-1; curStr = curStr->prev; ! curStrW = XTextWidth (canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); textCurY -= textCursorH+textVSpace; ! SetTextCurX (); ! } ! else if (!textHighlight) return; } textHighlight = FALSE; ! RedrawCurText (); ! ScrollTo (textCurX, textCurY); } static ! void HandleUp () { ! int x_off, left, amount; ! char * c_ptr, s[2]; ! struct AttrRec * attr_ptr; escPressed = FALSE; ! if (curStr == firstStr) ! { if (!textHighlight) return; textHighlight = FALSE; ! RedrawCurText (); return; } --- 2506,2548 ---- attr_ptr = curTextObj->detail.t->attr; if (curStr == firstStr && attr_ptr != NULL && attr_ptr->inherited && ! attr_ptr->nameshown && textCurIndex == attr_ptr->attr_name.sz-1) { ! if (textHighlight) { textHighlight = FALSE; ! RedrawCurText(); } return; } ! if (textCurIndex != 0) { textCurIndex--; ! SetTextCurX(); ! } else { ! if (curStr->prev != NULL) { textCurIndex = curStr->prev->dyn_str.sz-1; curStr = curStr->prev; ! curStrW = XTextWidth(canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); textCurY -= textCursorH+textVSpace; ! SetTextCurX(); ! } else if (!textHighlight) { return; + } } textHighlight = FALSE; ! RedrawCurText(); ! ScrollTo(textCurX, textCurY); } static ! void HandleUp() { ! int x_off, left, amount; ! char *c_ptr, s[2]; ! struct AttrRec *attr_ptr; escPressed = FALSE; ! if (curStr == firstStr) { if (!textHighlight) return; textHighlight = FALSE; ! RedrawCurText(); return; } *************** *** 2627,2640 **** x_off = textCurX; curStr = curStr->prev; ! curStrW = XTextWidth (canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); textCurY -= textCursorH+textVSpace; textCurX = textOrigX; ! switch (textJust) ! { ! case JUST_L: break; ! case JUST_C: textCurX -= (curStrW/2); break; ! case JUST_R: textCurX -= curStrW; break; } textCurIndex = 0; --- 2550,2562 ---- x_off = textCurX; curStr = curStr->prev; ! curStrW = XTextWidth(canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); textCurY -= textCursorH+textVSpace; textCurX = textOrigX; ! switch (textJust) { ! case JUST_L: break; ! case JUST_C: textCurX -= (curStrW/2); break; ! case JUST_R: textCurX -= curStrW; break; } textCurIndex = 0; *************** *** 2642,2654 **** s[1] = '\0'; ! for (c_ptr = curStr->dyn_str.s; *c_ptr != '\0'; c_ptr++) ! { s[0] = *c_ptr; ! amount = XTextWidth (canvasFontPtr, s, 1); ! if (x_off < textCurX+(amount>>1)) break; ! else textCurX += amount; textCurIndex++; } --- 2564,2576 ---- s[1] = '\0'; ! for (c_ptr = curStr->dyn_str.s; *c_ptr != '\0'; c_ptr++) { s[0] = *c_ptr; ! amount = XTextWidth(canvasFontPtr, s, 1); ! if (x_off < textCurX+(amount>>1)) { break; ! } else { textCurX += amount; + } textCurIndex++; } *************** *** 2656,2668 **** attr_ptr = curTextObj->detail.t->attr; if (curStr == firstStr && attr_ptr != NULL && attr_ptr->inherited && ! attr_ptr->nameshown && textCurIndex < attr_ptr->attr_name.sz-1) ! { textCurIndex = attr_ptr->attr_name.sz-1; ! textCurX = left + XTextWidth (canvasFontPtr, attr_ptr->attr_name.s, textCurIndex); } textHighlight = FALSE; ! RedrawCurText (); ! ScrollTo (textCurX, textCurY); } --- 2578,2589 ---- attr_ptr = curTextObj->detail.t->attr; if (curStr == firstStr && attr_ptr != NULL && attr_ptr->inherited && ! attr_ptr->nameshown && textCurIndex < attr_ptr->attr_name.sz-1) { textCurIndex = attr_ptr->attr_name.sz-1; ! textCurX = left + XTextWidth(canvasFontPtr, attr_ptr->attr_name.s, textCurIndex); } textHighlight = FALSE; ! RedrawCurText(); ! ScrollTo(textCurX, textCurY); } *************** *** 2695,2709 **** static ! void HandleDown () { ! int x_off, amount; ! char * c_ptr, s[2]; escPressed = FALSE; ! if (curStr == lastStr) ! { if (!textHighlight) return; textHighlight = FALSE; ! RedrawCurText (); return; } --- 2616,2629 ---- static ! void HandleDown() { ! int x_off, amount; ! char *c_ptr, s[2]; escPressed = FALSE; ! if (curStr == lastStr) { if (!textHighlight) return; textHighlight = FALSE; ! RedrawCurText(); return; } *************** *** 2711,2785 **** x_off = textCurX; curStr = curStr->next; ! curStrW = XTextWidth (canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); textCurY += textCursorH+textVSpace; textCurX = textOrigX; ! switch (textJust) ! { ! case JUST_L: break; ! case JUST_C: textCurX -= (curStrW/2); break; ! case JUST_R: textCurX -= curStrW; break; } textCurIndex = 0; s[1] = '\0'; ! for (c_ptr = curStr->dyn_str.s; *c_ptr != '\0'; c_ptr++) ! { s[0] = *c_ptr; ! amount = XTextWidth (canvasFontPtr, s, 1); ! if (x_off < textCurX+(amount>>1)) break; ! else textCurX += amount; textCurIndex++; } textHighlight = FALSE; ! RedrawCurText (); ! ScrollTo (textCurX, textCurY); } static XComposeStatus c_stat; ! void DrawText (input) ! XEvent * input; { ! register char * c_ptr; ! char s[80], * cut_buffer=NULL; ! int xfree_cut_buffer=FALSE, has_ch; ! XKeyEvent * key_ev; ! KeySym key_sym; ! ! if (input->type == ButtonPress) ! HandleButton (&(input->xbutton)); ! else if (input->type == KeyPress) ! { if (!textCursorShown) return; ! if (pasteInDrawTextMode) ! { ! int len; pasteInDrawTextMode = FALSE; ! if (pasteFromFileInDrawTextMode) ! { ! FILE * fp; ! char msg[MAXSTRING+1], inbuf[MAXSTRING+1]; ! int size=0; pasteFromFileInDrawTextMode = FALSE; ! if ((fp = fopen (pasteFromFileName, "r")) == NULL) ! { ! sprintf (msg, "Can not open '%s' for read.", pasteFromFileName); ! MsgBox (msg, TOOL_NAME, INFO_MB); return; } ! while (fgets (inbuf, MAXSTRING, fp) != NULL) size += strlen (inbuf); ! fclose (fp); ! if (size == 0) ! { ! sprintf (msg, "File '%s' is empty.", pasteFromFileName); ! MsgBox (msg, TOOL_NAME, INFO_MB); return; } --- 2631,2699 ---- x_off = textCurX; curStr = curStr->next; ! curStrW = XTextWidth(canvasFontPtr, curStr->dyn_str.s, curStr->dyn_str.sz-1); textCurY += textCursorH+textVSpace; textCurX = textOrigX; ! switch (textJust) { ! case JUST_L: break; ! case JUST_C: textCurX -= (curStrW/2); break; ! case JUST_R: textCurX -= curStrW; break; } textCurIndex = 0; s[1] = '\0'; ! for (c_ptr = curStr->dyn_str.s; *c_ptr != '\0'; c_ptr++) { s[0] = *c_ptr; ! amount = XTextWidth(canvasFontPtr, s, 1); ! if (x_off < textCurX+(amount>>1)) { break; ! } else { textCurX += amount; + } textCurIndex++; } textHighlight = FALSE; ! RedrawCurText(); ! ScrollTo(textCurX, textCurY); } static XComposeStatus c_stat; ! void DrawText(input) ! XEvent *input; { ! register char *c_ptr; ! char s[80], *cut_buffer=NULL; ! int xfree_cut_buffer=FALSE, has_ch; ! XKeyEvent *key_ev; ! KeySym key_sym; ! ! if (input->type == ButtonPress) { ! HandleButton(&(input->xbutton)); ! } else if (input->type == KeyPress) { if (!textCursorShown) return; ! if (pasteInDrawTextMode) { ! int len; pasteInDrawTextMode = FALSE; ! if (pasteFromFileInDrawTextMode) { ! FILE *fp; ! char msg[MAXSTRING+1], inbuf[MAXSTRING+1]; ! int size=0; pasteFromFileInDrawTextMode = FALSE; ! if ((fp=fopen(pasteFromFileName, "r")) == NULL) { ! sprintf(msg, "Can not open '%s' for read.", pasteFromFileName); ! MsgBox(msg, TOOL_NAME, INFO_MB); return; } ! while (fgets(inbuf, MAXSTRING, fp) != NULL) size += strlen(inbuf); ! fclose(fp); ! if (size == 0) { ! sprintf(msg, "File '%s' is empty.", pasteFromFileName); ! MsgBox(msg, TOOL_NAME, INFO_MB); return; } *************** *** 2796,2849 **** } len = 0; ! while (fgets (&cut_buffer[len], MAXSTRING, fp) != NULL) ! len += strlen (&cut_buffer[len]); ! fclose (fp); ! } ! else ! { ! cut_buffer = (char *) FetchCutBuffer (&len); ! if (len == 0) { Msg ("Cut buffer is empty."); return; } xfree_cut_buffer = TRUE; } ! if (escPressed) ! { escPressed = FALSE; ! Msg ("An key press is ignored."); } s[1] = '\0'; ! EraseTextCursor (); ! for (c_ptr = cut_buffer; *c_ptr != '\0'; c_ptr++) ! { s[0] = *c_ptr; ! switch (s[0]) ! { ! case '\r': ! case '\n': HandleCRLF (colorIndex); break; ! ! case '\177': Msg ("Can not paste ."); break; ! case '\b': Msg ("Can not paste ."); break; ! case '\033': Msg ("Can not paste ."); break; ! case '\t': Msg ("Can not paste ."); break; ! ! default: HandleChar (s, colorIndex); break; ! } ! } ! PutTextCursor (); ! MarkRulers (textCurX, textCurY); ! SetFileModified (TRUE); ! if (xfree_cut_buffer) ! XFree (cut_buffer); ! else free(cut_buffer); return; ! } ! else if (copyInDrawTextMode) ! { ! int copy_failed=FALSE, highlighting=FALSE; ! int first_index=0, second_index; ! int cut_buffer_size=0; ! struct StrRec * s_ptr, * tmp_s_ptr, * first_str=NULL; ! char msg[80]; copyInDrawTextMode = FALSE; --- 2710,2760 ---- } len = 0; ! while (fgets(&cut_buffer[len], MAXSTRING, fp) != NULL) { ! len += strlen(&cut_buffer[len]); ! } ! fclose(fp); ! } else { ! cut_buffer = (char*)FetchCutBuffer(&len); ! if (len == 0) { ! Msg("Cut buffer is empty."); ! return; ! } xfree_cut_buffer = TRUE; } ! if (escPressed) { escPressed = FALSE; ! Msg("An key press is ignored."); } s[1] = '\0'; ! EraseTextCursor(); ! for (c_ptr = cut_buffer; *c_ptr != '\0'; c_ptr++) { s[0] = *c_ptr; ! switch (s[0]) { ! case '\r': ! case '\n': HandleCRLF(colorIndex); break; ! ! case '\177': Msg("Can not paste ."); break; ! case '\b': Msg("Can not paste ."); break; ! case '\033': Msg("Can not paste ."); break; ! case '\t': Msg("Can not paste ."); break; ! ! default: HandleChar(s, colorIndex); break; ! } ! } ! PutTextCursor(); ! MarkRulers(textCurX, textCurY); ! SetFileModified(TRUE); ! if (xfree_cut_buffer) { ! XFree(cut_buffer); ! } else { free(cut_buffer); + } return; ! } else if (copyInDrawTextMode) { ! int copy_failed=FALSE, highlighting=FALSE; ! int first_index=0, second_index; ! int cut_buffer_size=0; ! struct StrRec *s_ptr, *tmp_s_ptr, *first_str=NULL; copyInDrawTextMode = FALSE; *************** *** 2851,2865 **** if (!textHighlight) return; ! if (escPressed) ! { escPressed = FALSE; ! Msg ("An key press is ignored."); } ! for (s_ptr = firstStr; s_ptr != NULL; ) ! { ! if (highlighting) ! { ! if (s_ptr == curStr || s_ptr == endStr) ! { second_index = (s_ptr==curStr) ? textCurIndex : textEndIndex; cut_buffer_size += second_index+1; --- 2762,2772 ---- if (!textHighlight) return; ! if (escPressed) { escPressed = FALSE; ! Msg("An key press is ignored."); } ! for (s_ptr=firstStr; s_ptr != NULL; ) { ! if (highlighting) { ! if (s_ptr == curStr || s_ptr == endStr) { second_index = (s_ptr==curStr) ? textCurIndex : textEndIndex; cut_buffer_size += second_index+1; *************** *** 2868,2886 **** c_ptr = cut_buffer; ! strcpy (cut_buffer, &first_str->dyn_str.s[first_index]); c_ptr += strlen(&first_str->dyn_str.s[first_index]); *c_ptr++ = '\n'; ! for (tmp_s_ptr = first_str->next; TRUE; ! tmp_s_ptr = tmp_s_ptr->next) ! { ! if (tmp_s_ptr == s_ptr) ! { ! strncpy (c_ptr, s_ptr->dyn_str.s, second_index); c_ptr[second_index] = '\0'; break; ! } ! else ! { ! strcpy (c_ptr, tmp_s_ptr->dyn_str.s); c_ptr += tmp_s_ptr->dyn_str.sz-1; *c_ptr++ = '\n'; --- 2775,2789 ---- c_ptr = cut_buffer; ! strcpy(cut_buffer, &first_str->dyn_str.s[first_index]); c_ptr += strlen(&first_str->dyn_str.s[first_index]); *c_ptr++ = '\n'; ! for (tmp_s_ptr=first_str->next; TRUE; ! tmp_s_ptr=tmp_s_ptr->next) { ! if (tmp_s_ptr == s_ptr) { ! strncpy(c_ptr, s_ptr->dyn_str.s, second_index); c_ptr[second_index] = '\0'; break; ! } else { ! strcpy(c_ptr, tmp_s_ptr->dyn_str.s); c_ptr += tmp_s_ptr->dyn_str.sz-1; *c_ptr++ = '\n'; *************** *** 2888,2902 **** } break; ! } ! else ! { /* include the whole line */ cut_buffer_size += s_ptr->dyn_str.sz; s_ptr = s_ptr->next; } ! } ! else ! { /* looking for the beginning ... */ ! if (s_ptr == curStr && s_ptr == endStr) ! { /* the whole string to be copied is within s_ptr */ if (textCurIndex == textEndIndex) return; --- 2791,2803 ---- } break; ! } else { ! /* include the whole line */ cut_buffer_size += s_ptr->dyn_str.sz; s_ptr = s_ptr->next; } ! } else { ! /* looking for the beginning ... */ ! if (s_ptr == curStr && s_ptr == endStr) { ! /* the whole string to be copied is within s_ptr */ if (textCurIndex == textEndIndex) return; *************** *** 2906,2916 **** cut_buffer = (char*)malloc((cut_buffer_size+1)*sizeof(char)); if (cut_buffer == NULL) FailAllocMessage(); ! strncpy (cut_buffer, &s_ptr->dyn_str.s[first_index], cut_buffer_size); cut_buffer[cut_buffer_size] = '\0'; break; ! } ! else if (s_ptr == curStr || s_ptr == endStr) ! { /* found the beginning */ first_str = s_ptr; first_index = (s_ptr==curStr) ? textCurIndex : textEndIndex; --- 2807,2816 ---- cut_buffer = (char*)malloc((cut_buffer_size+1)*sizeof(char)); if (cut_buffer == NULL) FailAllocMessage(); ! strncpy(cut_buffer, &s_ptr->dyn_str.s[first_index], cut_buffer_size); cut_buffer[cut_buffer_size] = '\0'; break; ! } else if (s_ptr == curStr || s_ptr == endStr) { ! /* found the beginning */ first_str = s_ptr; first_index = (s_ptr==curStr) ? textCurIndex : textEndIndex; *************** *** 2918,2924 **** highlighting = TRUE; s_ptr = s_ptr->next; ! } ! else ! { /* still looking */ s_ptr = s_ptr->next; } --- 2818,2823 ---- highlighting = TRUE; s_ptr = s_ptr->next; ! } else { ! /* still looking */ s_ptr = s_ptr->next; } *************** *** 2926,2945 **** } copyingToCutBuffer = TRUE; ! XStoreBytes (mainDisplay, cut_buffer, cut_buffer_size); ! XSync (mainDisplay, False); ! if (copyingToCutBuffer == INVALID) ! { ! sprintf (msg, "%s %s", "Copy to cut buffer fails.", "Selected string may be too long."); copy_failed = TRUE; } - else - sprintf (msg, "Copy buffer updated."); copyingToCutBuffer = FALSE; ! Msg (msg); ! if (copy_failed) ! { *cut_buffer = '\0'; ! XStoreBytes (mainDisplay, cut_buffer, 1); } free(cut_buffer); --- 2825,2842 ---- } copyingToCutBuffer = TRUE; ! XStoreBytes(mainDisplay, cut_buffer, cut_buffer_size); ! XSync(mainDisplay, False); ! if (copyingToCutBuffer == INVALID) { ! sprintf(gszMsgBox, "%s %s", "Copy to cut buffer fails.", "Selected string may be too long."); copy_failed = TRUE; + } else { + sprintf(gszMsgBox, "Copy buffer updated."); } copyingToCutBuffer = FALSE; ! Msg(gszMsgBox); ! if (copy_failed) { *cut_buffer = '\0'; ! XStoreBytes(mainDisplay, cut_buffer, 1); } free(cut_buffer); *************** *** 3147,3179 **** } ! void DumpOneStr (FP, FontIndex, Str) ! register FILE * FP; ! int FontIndex; ! register char * Str; ! { ! register char * c_ptr; ! ! for ( ; *Str != '\0'; Str++) ! { ! switch (*Str) ! { ! case '(': ! case ')': ! case '\\': fprintf (FP, "\\"); break; ! } ! if ((*Str) & 0x80) ! { ! if (FontIndex != FONT_SYM && (c_ptr = CharCodeTranslate (Str)) != NULL) ! { ! if (*c_ptr == '\\') ! fprintf (FP, "%s", c_ptr); ! else if (*c_ptr == '8') ! fprintf (FP, "\\%c%c%c", c_ptr[2], c_ptr[3], c_ptr[4]); } ! else ! fprintf (FP, "\\%o", (*Str)&0xff); } - else - fprintf (FP, "%c", *Str); } } --- 3044,3073 ---- } ! void DumpOneStr(FP, FontIndex, Str) ! register FILE *FP; ! int FontIndex; ! register char *Str; ! { ! register char *c_ptr; ! ! for ( ; *Str != '\0'; Str++) { ! switch (*Str) { ! case '(': ! case ')': ! case '\\': fprintf(FP, "\\"); break; ! } ! if ((*Str) & 0x80) { ! if (FontIndex != FONT_SYM && (c_ptr=CharCodeTranslate(Str)) != NULL) { ! if (*c_ptr == '\\') { ! fprintf(FP, "%s", c_ptr); ! } else if (*c_ptr == '8') { ! fprintf(FP, "\\%c%c%c", c_ptr[2], c_ptr[3], c_ptr[4]); ! } ! } else { ! fprintf(FP, "\\%o", (*Str)&0xff); } ! } else { ! fprintf(FP, "%c", *Str); } } } *************** *** 3297,3310 **** static ! int OldFontIndex (dpi_index, font_index, size_index, style_index) register int dpi_index, font_index, size_index, style_index; /* obsoleted procedure, kept to remain compatible with old versions */ { ! if (font_index == FONT_SYM) return (size_index+MAXFONTSIZES*(MAXFONTSTYLES*font_index) + dpi_index*FONTS_PER_DPI); ! else return (size_index+MAXFONTSIZES*(style_index+MAXFONTSTYLES*font_index) + dpi_index*FONTS_PER_DPI); } --- 3191,3205 ---- static ! int OldFontIndex(dpi_index, font_index, size_index, style_index) register int dpi_index, font_index, size_index, style_index; /* obsoleted procedure, kept to remain compatible with old versions */ { ! if (font_index == FONT_SYM) { return (size_index+MAXFONTSIZES*(MAXFONTSTYLES*font_index) + dpi_index*FONTS_PER_DPI); ! } else { return (size_index+MAXFONTSIZES*(style_index+MAXFONTSTYLES*font_index) + dpi_index*FONTS_PER_DPI); + } } *************** *** 3312,3336 **** #define GETSTRNG(val,name) ScanValue("%s", (val), name, "text") ! void ReadTextObj (FP, Inbuf, ObjPtr) ! FILE * FP; ! char * Inbuf; ! struct ObjRec * * ObjPtr; { ! register int i, max_len=0, len; ! struct StrRec * s_ptr; ! struct TextRec * text_ptr; ! char color_str[80], * s, * c_ptr, font_str[80]; ! char * tmp_str, inbuf[MAXSTRING+1]; ! char custom_font_name[MAXSTRING+1]; ! int num_lines, x, y, font, style, size, new_alloc, id=0; ! int text_just, rotate, pen, rotation; ! int obbox_w, obbox_h, dpi, asc, des, fill, v_space; ! int locked=FALSE, max_rextra=0; ! int underline_on=FALSE, underline=2, min_lbearing=0; ! int double_byte=FALSE, compressed=FALSE; ! int transformed=FALSE, invisible=FALSE; ! int direction=FontLeftToRight, real_x=0, real_y=0; ! struct XfrmMtrxRec *ctm=NULL; ! struct BBRec orig_obbox, orig_bbox; dpi = FONT_DPI_75; --- 3207,3231 ---- #define GETSTRNG(val,name) ScanValue("%s", (val), name, "text") ! void ReadTextObj(FP, Inbuf, ObjPtr) ! FILE *FP; ! char *Inbuf; ! struct ObjRec **ObjPtr; { ! register int i, max_len=0, len; ! struct StrRec *s_ptr; ! struct TextRec *text_ptr; ! char color_str[80], *s, *c_ptr, font_str[80]; ! char *tmp_str, inbuf[MAXSTRING+1]; ! char custom_font_name[MAXSTRING+1]; ! int num_lines, x, y, font, style, size, new_alloc, id=0; ! int text_just, rotate, pen, rotation; ! int obbox_w, obbox_h, dpi, asc, des, fill, v_space; ! int locked=FALSE, max_rextra=0; ! int underline_on=FALSE, underline=2, min_lbearing=0; ! int double_byte=FALSE, compressed=FALSE; ! int transformed=FALSE, invisible=FALSE; ! int direction=FontLeftToRight, real_x=0, real_y=0; ! struct XfrmMtrxRec *ctm=NULL; ! struct BBRec orig_obbox, orig_bbox; dpi = FONT_DPI_75; *************** *** 3341,3348 **** *ObjPtr = NULL; ! s = FindChar ((int)'(', Inbuf); ! s = ParseStr (s, (int)',', color_str, sizeof(color_str)); ! InitScan (s, ", \t\n"); rotate = 0; --- 3236,3243 ---- *ObjPtr = NULL; ! s = FindChar((int)'(', Inbuf); ! s = ParseStr(s, (int)',', color_str, sizeof(color_str)); ! InitScan(s, ", \t\n"); rotate = 0; *************** *** 3598,3602 **** } if (id >= objId) objId = id+1; ! len = strlen (custom_font_name); if (len >= 2 && *custom_font_name=='"' && custom_font_name[len-1]=='"') { --- 3493,3497 ---- } if (id >= objId) objId = id+1; ! len = strlen(custom_font_name); if (len >= 2 && *custom_font_name=='"' && custom_font_name[len-1]=='"') { *************** *** 3666,3671 **** } } ! fill = UpgradePenFill (fill); ! pen = UpgradePenFill (pen); *ObjPtr = (struct ObjRec *)malloc(sizeof(struct ObjRec)); --- 3561,3566 ---- } } ! fill = UpgradePenFill(fill); ! pen = UpgradePenFill(pen); *ObjPtr = (struct ObjRec *)malloc(sizeof(struct ObjRec)); *************** *** 3681,3696 **** text_ptr->cached_rotate = ROTATE0; ! if (!PRTGIF) SaveCurFont (); ! if (PRTGIF) ! { ! if (fileVersion <= 29) ! { curFont = text_ptr->font = font; text_ptr->font_name = NULL; ! } ! else ! { ! len = strlen (font_str); text_ptr->font_name = (char *)malloc((len+1)*sizeof(char)); if (text_ptr->font_name == NULL) FailAllocMessage(); --- 3576,3587 ---- text_ptr->cached_rotate = ROTATE0; ! if (!PRTGIF) SaveCurFont(); ! if (PRTGIF) { ! if (fileVersion <= 29) { curFont = text_ptr->font = font; text_ptr->font_name = NULL; ! } else { ! len = strlen(font_str); text_ptr->font_name = (char *)malloc((len+1)*sizeof(char)); if (text_ptr->font_name == NULL) FailAllocMessage(); *************** *** 3702,3733 **** } curFont = text_ptr->font = ! GetFontIndex (text_ptr->font_name, style, FALSE); } ! } ! else ! { text_ptr->font_name = NULL; ! if (fileVersion <= 29) curFont = text_ptr->font = font; ! else ! { ! char *s; ! len = strlen (font_str); ! if (*font_str == '\'' && font_str[len-1] == '\'') ! { font_str[len-1] = '\0'; s = &font_str[1]; ! } ! else s = font_str; ! curFont = text_ptr->font = GetFontIndex (s, style, TRUE); ! if (curFont == INVALID) ! { ! char msg[MAXSTRING]; ! ! sprintf (msg, "Can not find screen font for '%s'.", s); ! TwoLineMsg (msg, " Use Times instead."); ! SetFileModified (TRUE); curFont = text_ptr->font = FONT_TIM; } --- 3593,3617 ---- } curFont = text_ptr->font = ! GetFontIndex(text_ptr->font_name, style, FALSE); } ! } else { text_ptr->font_name = NULL; ! if (fileVersion <= 29) { curFont = text_ptr->font = font; ! } else { ! char *s; ! len = strlen(font_str); ! if (*font_str == '\'' && font_str[len-1] == '\'') { font_str[len-1] = '\0'; s = &font_str[1]; ! } else { s = font_str; ! } ! curFont = text_ptr->font = GetFontIndex(s, style, TRUE); ! if (curFont == INVALID) { ! sprintf(gszMsgBox, "Can not find screen font for '%s'.", s); ! TwoLineMsg(gszMsgBox, " Use Times instead."); ! SetFileModified(TRUE); curFont = text_ptr->font = FONT_TIM; } *************** *** 3736,3740 **** curStyle = text_ptr->style = style; curSize = text_ptr->size = ! (fileVersion<=29 ? GetCompatibleSize (dpi, size) : size); textJust = text_ptr->just = text_just; textVSpace = text_ptr->v_space = v_space; --- 3620,3624 ---- curStyle = text_ptr->style = style; curSize = text_ptr->size = ! (fileVersion<=29 ? GetCompatibleSize(dpi, size) : size); textJust = text_ptr->just = text_just; textVSpace = text_ptr->v_space = v_space; *************** *** 3745,3759 **** curUnderline = text_ptr->underline = underline; ! if (PRTGIF) ! { ! if (fileVersion < 10) ! { canvasFontAsc = pDrawFontAsc[OldFontIndex(dpi,curFont,size,curStyle)]; canvasFontDes = pDrawFontDes[OldFontIndex(dpi,curFont,size,curStyle)]; ! } ! else ! { canvasFontAsc = asc; canvasFontDes = des; --- 3629,3639 ---- curUnderline = text_ptr->underline = underline; ! if (PRTGIF) { ! if (fileVersion < 10) { canvasFontAsc = pDrawFontAsc[OldFontIndex(dpi,curFont,size,curStyle)]; canvasFontDes = pDrawFontDes[OldFontIndex(dpi,curFont,size,curStyle)]; ! } else { canvasFontAsc = asc; canvasFontDes = des; *************** *** 3761,3802 **** textCursorH = canvasFontAsc + canvasFontDes; text_ptr->read_only = FALSE; ! if (fileVersion > 31) ! { canvasFontDoubleByte = double_byte; canvasFontDirection = direction; ! } ! else ! { canvasFontDoubleByte = FALSE; canvasFontDirection = FontLeftToRight; } ! } ! else ! { ! SetCanvasFont (); text_ptr->read_only = (curSize != canvasFontSize); } ! if (text_ptr->read_only) ! { text_ptr->asc = asc; text_ptr->des = des; ! switch (rotate) ! { ! case ROTATE0: ! case ROTATE180: ! text_ptr->orig_w = obbox_w; ! text_ptr->orig_h = obbox_h; ! break; ! case ROTATE90: ! case ROTATE270: ! text_ptr->orig_w = obbox_h; ! text_ptr->orig_h = obbox_w; ! break; } text_ptr->min_lbearing = min_lbearing; text_ptr->max_rextra = max_rextra; ! } ! else ! { text_ptr->asc = canvasFontAsc; text_ptr->des = canvasFontDes; --- 3641,3673 ---- textCursorH = canvasFontAsc + canvasFontDes; text_ptr->read_only = FALSE; ! if (fileVersion > 31) { canvasFontDoubleByte = double_byte; canvasFontDirection = direction; ! } else { canvasFontDoubleByte = FALSE; canvasFontDirection = FontLeftToRight; } ! } else { ! SetCanvasFont(); text_ptr->read_only = (curSize != canvasFontSize); } ! if (text_ptr->read_only) { text_ptr->asc = asc; text_ptr->des = des; ! switch (rotate) { ! case ROTATE0: ! case ROTATE180: ! text_ptr->orig_w = obbox_w; ! text_ptr->orig_h = obbox_h; ! break; ! case ROTATE90: ! case ROTATE270: ! text_ptr->orig_w = obbox_h; ! text_ptr->orig_h = obbox_w; ! break; } text_ptr->min_lbearing = min_lbearing; text_ptr->max_rextra = max_rextra; ! } else { text_ptr->asc = canvasFontAsc; text_ptr->des = canvasFontDes; *************** *** 3806,3816 **** text_ptr->double_byte = canvasFontDoubleByte; text_ptr->direction = canvasFontDirection; ! if (*custom_font_name == '\0') text_ptr->custom_screen_font_name = NULL; ! else ! text_ptr->custom_screen_font_name = UtilStrDup (custom_font_name); ! ! for (i = 0; i < num_lines; i++) ! { char *line; --- 3677,3686 ---- text_ptr->double_byte = canvasFontDoubleByte; text_ptr->direction = canvasFontDirection; ! if (*custom_font_name == '\0') { text_ptr->custom_screen_font_name = NULL; ! } else { ! text_ptr->custom_screen_font_name = UtilStrDup(custom_font_name); ! } ! for (i = 0; i < num_lines; i++) { char *line; *************** *** 3819,3823 **** scanFileName, scanLineNum); if (PRTGIF) { ! fprintf (stderr, "%s\n", gszMsgBox); } else { MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); --- 3689,3693 ---- scanFileName, scanLineNum); if (PRTGIF) { ! fprintf(stderr, "%s\n", gszMsgBox); } else { MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); *************** *** 3828,3848 **** scanLineNum++; ! tmp_str = FindChar ((int)'"', line); ! s = ReadString (tmp_str); *(--s) = '\0'; ! s_ptr = NewStr (); ! if (s_ptr == NULL) FailAllocMessage (); ! DynStrSet (&s_ptr->dyn_str, tmp_str); ! AddStr (lastStr, (struct StrRec *)NULL, s_ptr); ! if (PRTGIF) ! { ! len = strlen (tmp_str); /* assume string width = 1 pixel per char */ if (len > max_len) max_len = len; ! } ! else ! { int w, lbearing, rextra; ! GetStrSizeInfo (s_ptr, &w, &lbearing, &rextra); if (w > max_len) max_len = w; if (lbearing < min_lbearing) min_lbearing = lbearing; --- 3698,3715 ---- scanLineNum++; ! tmp_str = FindChar((int)'"', line); ! s = ReadString(tmp_str); *(--s) = '\0'; ! s_ptr = NewStr(); ! if (s_ptr == NULL) FailAllocMessage(); ! DynStrSet(&s_ptr->dyn_str, tmp_str); ! AddStr(lastStr, (struct StrRec *)NULL, s_ptr); ! if (PRTGIF) { ! len = strlen(tmp_str); /* assume string width = 1 pixel per char */ if (len > max_len) max_len = len; ! } else { int w, lbearing, rextra; ! GetStrSizeInfo(s_ptr, &w, &lbearing, &rextra); if (w > max_len) max_len = w; if (lbearing < min_lbearing) min_lbearing = lbearing; *** tgif.c.orig Tue Sep 30 13:24:19 1997 --- tgif.c Tue Sep 30 13:24:19 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif.c,v 3.5 1997/01/30 04:06:44 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif.c,v 3.8 1997/09/14 20:38:02 william Exp $ */ #include *************** *** 41,46 **** --- 39,46 ---- #include "color.e" #include "file.e" + #include "grid.e" #include "mainloop.e" #include "msg.e" + #include "names.e" #include "obj.e" #include "page.e" *************** *** 146,150 **** struct ObjRec *obj_ptr; char full_name[MAXPATHLENGTH+1], tmp_filename[MAXPATHLENGTH+1]; ! int len, read_status; FILE *fp; int tmp_linenum, obj_ext_len, sym_ext_len; --- 146,150 ---- struct ObjRec *obj_ptr; char full_name[MAXPATHLENGTH+1], tmp_filename[MAXPATHLENGTH+1]; ! int len, read_status, obj_file=TRUE; FILE *fp; int tmp_linenum, obj_ext_len, sym_ext_len; *************** *** 158,166 **** len = strlen(FileName); ! if ((len>=obj_ext_len && ! strcmp(&FileName[len-obj_ext_len], obj_ext_str) == 0) || ! (len>=sym_ext_len && ! strcmp(&FileName[len-sym_ext_len],sym_ext_str)==0)) { strcpy(full_name, FileName); } else { sprintf(full_name, "%s.%s", FileName, OBJ_FILE_EXT); --- 158,168 ---- len = strlen(FileName); ! if (len>=obj_ext_len && ! strcmp(&FileName[len-obj_ext_len], obj_ext_str) == 0) { ! strcpy(full_name, FileName); ! } else if (len>=sym_ext_len && ! strcmp(&FileName[len-sym_ext_len],sym_ext_str)==0) { strcpy(full_name, FileName); + obj_file = FALSE; } else { sprintf(full_name, "%s.%s", FileName, OBJ_FILE_EXT); *************** *** 176,181 **** scanLineNum = 0; ! fprintf(stderr, "Reading '%s' ...\n", full_name); ! while ((read_status = ReadObj(fp, &obj_ptr)) == TRUE) { if (obj_ptr != NULL) { --- 178,184 ---- scanLineNum = 0; ! if (!(PRTGIF && cmdLineStdOut)) { ! fprintf(stderr, "Reading '%s' ...\n", full_name); ! } while ((read_status = ReadObj(fp, &obj_ptr)) == TRUE) { if (obj_ptr != NULL) { *************** *** 195,198 **** --- 198,217 ---- return FALSE; } + if (cmdLineOpenDisplay) { + char file_path[MAXPATHLENGTH+1]; + + if (*full_name == '/') { + strcpy(file_path, full_name); + } else { + sprintf(file_path, "%s/%s", curDir, full_name); + } + curFileDefined = TRUE; + if (obj_file) { + SetCurDir(file_path); + *curSymDir = '\0'; + } else { + SetCurSymDir(file_path); + } + } if (cmdLineHasPageNum) { if (cmdLinePageNum > lastPageNum) { *************** *** 228,231 **** --- 247,255 ---- InitPaperSize(); if (argc <= 0) { + if (cmdLineStdOut) { + fprintf(stderr, + "\nFile name must be specified when -stdout is used.\n"); + return; + } fprintf(stderr, "\nTgif File Name to Print> "); fflush(stderr); *************** *** 238,271 **** } else if (cmdLineDosEpsFilter) { DosEpsFilter(inbuf); ! } else if (PrTgifLoad(inbuf)) { ! colorDump = cmdLineColor; ! if (cmdLineOneFilePerPage) { ! if (pageLayoutMode == PAGE_TILE) { ! fprintf(stderr, "%s %s.\n", ! "Cannot use -one_file_per_page in", ! "TILED page mode"); ! } else { ! if (cmdLineHasPageNum) { ! sprintf(cmdLinePageNumStr, "%1d", cmdLinePageNum); ! GotoPageNum(cmdLinePageNum); ! Dump(*argv); } else { ! cmdLineHasPageNum = TRUE; ! for (cmdLinePageNum=1; cmdLinePageNum <= lastPageNum; ! cmdLinePageNum++) { sprintf(cmdLinePageNumStr, "%1d", cmdLinePageNum); GotoPageNum(cmdLinePageNum); ! Dump(inbuf); } - cmdLineHasPageNum = FALSE; } } } else { ! Dump(inbuf); } - DelAllObj(); - if (cmdLineColor) CleanUpColors(); - } else { - fprintf(stderr, "\n"); } } --- 262,306 ---- } else if (cmdLineDosEpsFilter) { DosEpsFilter(inbuf); ! } else { ! if (cmdLineOpenDisplay) { ! JustInit(NULL, NULL); ! } ! if (PrTgifLoad(inbuf)) { ! colorDump = cmdLineColor; ! if (cmdLineOpenDisplay) { ! whereToPrint = cmdLineWhereToPrint; ! } ! if (cmdLineOneFilePerPage) { ! if (pageLayoutMode == PAGE_TILE) { ! fprintf(stderr, "%s %s.\n", ! "Cannot use -one_file_per_page in", ! "TILED page mode"); } else { ! if (cmdLineHasPageNum) { sprintf(cmdLinePageNumStr, "%1d", cmdLinePageNum); GotoPageNum(cmdLinePageNum); ! Dump(*argv); ! } else { ! cmdLineHasPageNum = TRUE; ! for (cmdLinePageNum=1; cmdLinePageNum <= lastPageNum; ! cmdLinePageNum++) { ! sprintf(cmdLinePageNumStr, "%1d", cmdLinePageNum); ! GotoPageNum(cmdLinePageNum); ! Dump(inbuf); ! } ! cmdLineHasPageNum = FALSE; } } + } else { + Dump(inbuf); + } + DelAllObj(); + if (cmdLineColor) CleanUpColors(); + if (cmdLineOpenDisplay) { + CleanUp(); } } else { ! fprintf(stderr, "\n"); } } } *************** *** 274,277 **** --- 309,317 ---- } } else { + if (cmdLineStdOut && argc > 2) { + fprintf(stderr, + "\nOnly 1 file name caaan be specified with -stdout.\n"); + return; + } for ( ; argc > 0; argc--, argv++) { lastFile = (argc == 1); *************** *** 290,323 **** } break; ! } else if (PrTgifLoad(*argv)) { ! colorDump = cmdLineColor; ! if (cmdLineOneFilePerPage) { ! if (pageLayoutMode == PAGE_TILE) { ! fprintf(stderr, "%s %s.\n", ! "Cannot use -one_file_per_page in", ! "TILED page mode"); ! } else { ! if (cmdLineHasPageNum) { ! sprintf(cmdLinePageNumStr, "%1d", cmdLinePageNum); ! GotoPageNum(cmdLinePageNum); ! Dump(*argv); } else { ! cmdLineHasPageNum = TRUE; ! for (cmdLinePageNum=1; cmdLinePageNum <= lastPageNum; ! cmdLinePageNum++) { sprintf(cmdLinePageNumStr, "%1d", cmdLinePageNum); GotoPageNum(cmdLinePageNum); Dump(*argv); } - cmdLineHasPageNum = FALSE; } } } else { ! Dump(*argv); } - DelAllObj(); - if (cmdLineColor) CleanUpColors(); - } else { - fprintf(stderr, "\n"); } } --- 330,374 ---- } break; ! } else { ! if (cmdLineOpenDisplay) { ! JustInit(NULL, NULL); ! } ! if (PrTgifLoad(*argv)) { ! colorDump = cmdLineColor; ! if (cmdLineOpenDisplay) { ! whereToPrint = cmdLineWhereToPrint; ! } ! if (cmdLineOneFilePerPage) { ! if (pageLayoutMode == PAGE_TILE) { ! fprintf(stderr, "%s %s.\n", ! "Cannot use -one_file_per_page in", ! "TILED page mode"); } else { ! if (cmdLineHasPageNum) { sprintf(cmdLinePageNumStr, "%1d", cmdLinePageNum); GotoPageNum(cmdLinePageNum); Dump(*argv); + } else { + cmdLineHasPageNum = TRUE; + for (cmdLinePageNum=1; cmdLinePageNum <= lastPageNum; + cmdLinePageNum++) { + sprintf(cmdLinePageNumStr, "%1d", cmdLinePageNum); + GotoPageNum(cmdLinePageNum); + Dump(*argv); + } + cmdLineHasPageNum = FALSE; } } + } else { + Dump(*argv); + } + DelAllObj(); + if (cmdLineColor) CleanUpColors(); + if (cmdLineOpenDisplay) { + CleanUp(); } } else { ! fprintf(stderr, "\n"); } } } *** tgif_dbg.c.orig Tue Sep 30 13:24:21 1997 --- tgif_dbg.c Tue Sep 30 13:24:21 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,37 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef _TGIF_DBG - - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif_dbg.c,v 3.1 1996/10/31 03:42:33 william Exp $"; - #endif #include --- 27,34 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif_dbg.c,v 3.2 1997/09/14 20:38:02 william Exp $ */ #ifdef _TGIF_DBG #include *** util.c.orig Tue Sep 30 13:24:22 1997 --- util.c Tue Sep 30 13:24:22 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/util.c,v 3.0 1996/05/06 16:12:44 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/util.c,v 3.4 1997/09/15 19:02:22 william Exp $ */ #include *************** *** 39,45 **** --- 37,47 ---- #include #include + #include #include "const.h" + #include "types.h" + #include "dialog.e" + #include "file.e" #include "remote.e" #ifndef _NO_EXTERN *************** *** 357,361 **** close(fd1); close(fd2); ! chmod(pszToFile, 0777); return TG_REMOTE_STATUS_OK; } --- 359,367 ---- close(fd1); close(fd2); ! if (tmpFileMode != 0 && chmod(pszToFile, tmpFileMode)) { ! sprintf(gszMsgBox, "Can not chmod '%s' to 0%03o.", pszToFile, ! tmpFileMode); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! } return TG_REMOTE_STATUS_OK; } *** version.c.orig Tue Sep 30 13:24:23 1997 --- version.c Tue Sep 30 13:24:23 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/version.c,v 3.1 1996/09/20 13:31:10 william Exp $"; - #endif #ifndef _NO_EXTERN --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/version.c,v 3.4 1997/09/14 20:38:03 william Exp $ */ #ifndef _NO_EXTERN *************** *** 39,44 **** char *versionString="3.0"; char *betaString=""; ! char *copyrightString="Copyright (C) 1990-1996, William Chia-Wei Cheng"; ! char *homePageURL="http://bourbon.cs.columbia.edu:8001/tgif/"; ! char *currentReleaseURL="http://bourbon.cs.columbia.edu:8001/tgif/current.html"; ! char *hyperGraphicsURL="http://bourbon.cs.columbia.edu:8001/tgif/index.obj"; --- 37,42 ---- char *versionString="3.0"; char *betaString=""; ! char *copyrightString="Copyright (C) 1990-1997, William Chia-Wei Cheng"; ! char *homePageURL="http://bourbon.cs.umd.edu:8001/tgif/"; ! char *currentReleaseURL="http://bourbon.cs.umd.edu:8001/tgif/current.html"; ! char *hyperGraphicsURL="http://bourbon.cs.umd.edu:8001/tgif/index.obj"; *** xbitmap.c.orig Tue Sep 30 13:24:25 1997 --- xbitmap.c Tue Sep 30 13:24:25 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/xbitmap.c,v 3.14 1997/01/29 22:45:56 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/xbitmap.c,v 3.20 1997/09/17 05:52:24 william Exp $ */ #include *************** *** 276,280 **** if (xpmOutputVersion != 1 && xpmOutputVersion != 3) { ! fprintf (stderr, "Invalid XPmOutputVersion (%s) in X Defaults. %s\n", c_ptr, "1 is used."); xpmOutputVersion = 1; --- 274,278 ---- if (xpmOutputVersion != 1 && xpmOutputVersion != 3) { ! fprintf(stderr, "Invalid XPmOutputVersion (%s) in X Defaults. %s\n", c_ptr, "1 is used."); xpmOutputVersion = 1; *************** *** 306,310 **** if (bitmapThreshold < 0 || bitmapThreshold > 1) { ! fprintf (stderr, "%s (%s) in X Defaults. %s is used.\n", "Invalid BitmapThreshold", c_ptr, ((halfToneBitmap) ? "0.5" : "1.0")); --- 304,308 ---- if (bitmapThreshold < 0 || bitmapThreshold > 1) { ! fprintf(stderr, "%s (%s) in X Defaults. %s is used.\n", "Invalid BitmapThreshold", c_ptr, ((halfToneBitmap) ? "0.5" : "1.0")); *************** *** 625,630 **** else { ! int abs_offset_x=ObjPtr->obbox.ltx-ObjPtr->x; ! int abs_offset_y=ObjPtr->obbox.lty-ObjPtr->y; target_percent = 5; --- 623,630 ---- else { ! int abs_offset_x=ObjPtr->obbox.ltx-ObjPtr->x; ! int abs_offset_y=ObjPtr->obbox.lty-ObjPtr->y; ! double sx=(((double)xbm_ptr->eps_w)/((double)image_w)); ! double sy=(((double)xbm_ptr->eps_h)/((double)image_h)); target_percent = 5; *************** *** 645,654 **** for (c = 0; c < num_cols; c++) { ! int x=abs_offset_x+ABS_SIZE(c); ! int new_x, new_y; ! ! ReverseTransformPointThroughCTM (x, y, ObjPtr->ctm, &new_x, &new_y); ! new_x += ObjPtr->x-ObjPtr->orig_obbox.ltx; ! new_y += ObjPtr->y-ObjPtr->orig_obbox.lty; if (new_x>=0 && new_x=0 && new_yctm, &new_x, &new_y); ! dx = ((double)new_x)/sx; ! dy = ((double)new_y)/sy; ! new_x = round(dx)+ObjPtr->x-ObjPtr->orig_obbox.ltx; ! new_y = round(dy)+ObjPtr->y-ObjPtr->orig_obbox.lty; if (new_x>=0 && new_x=0 && new_ydetail.r->last)) return TRUE; break; --- 798,804 ---- case OBJ_XBM: return (TRUE); + case OBJ_GROUP: case OBJ_ICON: case OBJ_SYM: if (ObjListInvertable(obj_ptr->detail.r->last)) return TRUE; break; *************** *** 815,821 **** case OBJ_XBM: InvertXBmObject(obj_ptr); break; case OBJ_ICON: case OBJ_SYM: - case OBJ_GROUP: InvertObjListXBitmap(obj_ptr->detail.r->last); break; --- 818,824 ---- case OBJ_XBM: InvertXBmObject(obj_ptr); break; + case OBJ_GROUP: case OBJ_ICON: case OBJ_SYM: InvertObjListXBitmap(obj_ptr->detail.r->last); break; *************** *** 841,847 **** break; case OBJ_ICON: case OBJ_SYM: - case OBJ_GROUP: if (ObjListInvertable(sel_ptr->obj->detail.r->last)) { changed = TRUE; --- 844,850 ---- break; + case OBJ_GROUP: case OBJ_ICON: case OBJ_SYM: if (ObjListInvertable(sel_ptr->obj->detail.r->last)) { changed = TRUE; *************** *** 1004,1008 **** } ! sprintf (gszMsgBox, "%s: [[MAG=]WxH+X+Y] (original size is %1dx%1d)", "Please enter geometry spec", image_w, image_h); Dialog (gszMsgBox, "( : accept, : cancel )", mag_spec); --- 1007,1011 ---- } ! sprintf(gszMsgBox, "%s: [[MAG=]WxH+X+Y] (original size is %1dx%1d)", "Please enter geometry spec", image_w, image_h); Dialog (gszMsgBox, "( : accept, : cancel )", mag_spec); *************** *** 1015,1019 **** if (src_w==0 || src_h==0) { ! Msg ("Bitmap can not have 0 width or height."); return; } --- 1018,1022 ---- if (src_w==0 || src_h==0) { ! Msg("Bitmap can not have 0 width or height."); return; } *************** *** 1028,1033 **** } ! sprintf (gszMsgBox, "New bitmap size is %1dx%1d.", src_w, src_h); ! Msg (gszMsgBox); UnlinkObj (obj_ptr); --- 1031,1036 ---- } ! sprintf(gszMsgBox, "New bitmap size is %1dx%1d.", src_w, src_h); ! Msg(gszMsgBox); UnlinkObj (obj_ptr); *************** *** 1175,1183 **** case OBJ_GROUP: - case OBJ_SYM: case OBJ_ICON: ! for (obj_ptr = ObjPtr->detail.r->first; obj_ptr != NULL; ! obj_ptr = obj_ptr->next) ! BuildObjXPmColors (obj_ptr); break; } --- 1178,1187 ---- case OBJ_GROUP: case OBJ_ICON: ! case OBJ_SYM: ! for (obj_ptr=ObjPtr->detail.r->first; obj_ptr != NULL; ! obj_ptr=obj_ptr->next) { ! BuildObjXPmColors(obj_ptr); ! } break; } *************** *** 1285,1289 **** else if (value < 255) value = 0; ! sprintf (s, "%c%c", hexValue[(value>>4)&0x0f], hexValue[value&0x0f]); strcat (color_str, s); strcat (color_str, s); --- 1289,1293 ---- else if (value < 255) value = 0; ! sprintf(s, "%c%c", hexValue[(value>>4)&0x0f], hexValue[value&0x0f]); strcat (color_str, s); strcat (color_str, s); *************** *** 1294,1298 **** else if (value < 255) value = 0; ! sprintf (s, "%c%c", hexValue[(value>>4)&0x0f], hexValue[value&0x0f]); strcat (color_str, s); strcat (color_str, s); --- 1298,1302 ---- else if (value < 255) value = 0; ! sprintf(s, "%c%c", hexValue[(value>>4)&0x0f], hexValue[value&0x0f]); strcat (color_str, s); strcat (color_str, s); *************** *** 1303,1307 **** else if (value < 255) value = 0; ! sprintf (s, "%c%c", hexValue[(value>>4)&0x0f], hexValue[value&0x0f]); strcat (color_str, s); strcat (color_str, s); --- 1307,1311 ---- else if (value < 255) value = 0; ! sprintf(s, "%c%c", hexValue[(value>>4)&0x0f], hexValue[value&0x0f]); strcat (color_str, s); strcat (color_str, s); *************** *** 1320,1360 **** if (xpmInXGrabSCFormat) { for (i=0; i < numColorsToDump-1; i++) { ! if (fprintf (FP, "\"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf (FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ColorStrToXPmStr (i, s); ! if (fprintf (FP, "\", \"%s\"\n", s) == EOF) writeFileFailed = TRUE; } ! if (fprintf (FP, "\"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf (FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ColorStrToXPmStr (i, s); ! if (fprintf (FP, "\", \"%s\"\n} ;\n", s) == EOF) { writeFileFailed = TRUE; } } else { for (i=0; i < numColorsToDump-1; i++) { ! if (fprintf (FP, " \"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf (FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ! if (fprintf (FP, "\", \"%s\",\n", colorStr[i]) == EOF) writeFileFailed = TRUE; } ! if (fprintf (FP, " \"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf (FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ! if (fprintf (FP, "\", \"%s\"\n};\n", colorStr[i]) == EOF) { writeFileFailed = TRUE; } --- 1324,1364 ---- if (xpmInXGrabSCFormat) { for (i=0; i < numColorsToDump-1; i++) { ! if (fprintf(FP, "\"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf(FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ColorStrToXPmStr (i, s); ! if (fprintf(FP, "\", \"%s\"\n", s) == EOF) writeFileFailed = TRUE; } ! if (fprintf(FP, "\"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf(FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ColorStrToXPmStr (i, s); ! if (fprintf(FP, "\", \"%s\"\n} ;\n", s) == EOF) { writeFileFailed = TRUE; } } else { for (i=0; i < numColorsToDump-1; i++) { ! if (fprintf(FP, " \"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf(FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ! if (fprintf(FP, "\", \"%s\",\n", colorStr[i]) == EOF) writeFileFailed = TRUE; } ! if (fprintf(FP, " \"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf(FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ! if (fprintf(FP, "\", \"%s\"\n};\n", colorStr[i]) == EOF) { writeFileFailed = TRUE; } *************** *** 1363,1373 **** /* xpmOutputVersion is 3 */ for (i=0; i < numColorsToDump; i++) { ! if (fprintf (FP, "\"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf (FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ! if (fprintf (FP, " c %s\",\n", colorStr[i]) == EOF) { writeFileFailed = TRUE; } --- 1367,1377 ---- /* xpmOutputVersion is 3 */ for (i=0; i < numColorsToDump; i++) { ! if (fprintf(FP, "\"") == EOF) writeFileFailed = TRUE; for (j = 0; j < charsPerPixel; j++) { ! if (fprintf(FP, "%c", colorChar[i*charsPerPixel+j]) == EOF) { writeFileFailed = TRUE; } } ! if (fprintf(FP, " c %s\",\n", colorStr[i]) == EOF) { writeFileFailed = TRUE; } *************** *** 1431,1435 **** if (image == NULL) { ! MsgBox ("Can not generate image.\n\nPrint aborted!", TOOL_NAME, INFO_MB); XFreePixmap (mainDisplay, pixmap); return; --- 1435,1439 ---- if (image == NULL) { ! MsgBox("Can not generate image.\n\nPrint aborted!", TOOL_NAME, INFO_MB); XFreePixmap (mainDisplay, pixmap); return; *************** *** 1454,1458 **** } ! fprintf (FP, "%%%%BeginPreview: %1d %1d 1 %1d\n", image_w, image_h, num_lines*image_h); for (row=0; row < image_h; row++) { --- 1458,1462 ---- } ! fprintf(FP, "%%%%BeginPreview: %1d %1d 1 %1d\n", image_w, image_h, num_lines*image_h); for (row=0; row < image_h; row++) { *************** *** 1470,1474 **** int byte_count=0; ! fprintf (FP, "%% "); for (col=0; col < num_image_bytes_per_row; col++) { --- 1474,1478 ---- int byte_count=0; ! fprintf(FP, "%% "); for (col=0; col < num_image_bytes_per_row; col++) { *************** *** 1476,1488 **** { byte_count = 1; ! fprintf (FP, "\n%% "); } ! fprintf (FP, "%c", hexValue[(data[row][col]>>4) & 0xf]); ! fprintf (FP, "%c", hexValue[data[row][col] & 0xf]); } ! fprintf (FP, "\n"); } ! fprintf (FP, "%%%%EndImage\n"); ! fprintf (FP, "%%%%EndPreview\n"); for (row=0; row < image_h; row++) free(data[row]); --- 1480,1492 ---- { byte_count = 1; ! fprintf(FP, "\n%% "); } ! fprintf(FP, "%c", hexValue[(data[row][col]>>4) & 0xf]); ! fprintf(FP, "%c", hexValue[data[row][col] & 0xf]); } ! fprintf(FP, "\n"); } ! fprintf(FP, "%%%%EndImage\n"); ! fprintf(FP, "%%%%EndPreview\n"); for (row=0; row < image_h; row++) free(data[row]); *************** *** 1576,1581 **** if (generateHtmlHref && imageMapFileFormat==IMF_FORMAT_SPYG) { if (value_str[0] == '#' && strchr(value_str, '/') == NULL && ! ((!PRTGIF && dumpOneFilePerPage) || ! (PRTGIF && cmdLineOneFilePerPage))) { char page_spec[MAXSTRING]; int page_num=0; --- 1580,1585 ---- if (generateHtmlHref && imageMapFileFormat==IMF_FORMAT_SPYG) { if (value_str[0] == '#' && strchr(value_str, '/') == NULL && ! (((!(PRTGIF && !cmdLineOpenDisplay)) && dumpOneFilePerPage) || ! (PRTGIF && !cmdLineOpenDisplay && cmdLineOneFilePerPage))) { char page_spec[MAXSTRING]; int page_num=0; *************** *** 1773,1778 **** } switch (ObjPtr->type) { - case OBJ_ICON: case OBJ_GROUP: case OBJ_SYM: for (obj_ptr=ObjPtr->detail.r->last; obj_ptr != NULL; --- 1777,1782 ---- } switch (ObjPtr->type) { case OBJ_GROUP: + case OBJ_ICON: case OBJ_SYM: for (obj_ptr=ObjPtr->detail.r->last; obj_ptr != NULL; *************** *** 2026,2030 **** int bg_pixel=GetDrawingBgPixel(INVALID, INVALID); char xbm_file_name[MAXPATHLENGTH+1], *rest, name[MAXPATHLENGTH+1]; ! FILE *fp; Pixmap pixmap=None; XImage *image=NULL, *bitmap_image=NULL; --- 2030,2034 ---- int bg_pixel=GetDrawingBgPixel(INVALID, INVALID); char xbm_file_name[MAXPATHLENGTH+1], *rest, name[MAXPATHLENGTH+1]; ! FILE *fp=NULL; Pixmap pixmap=None; XImage *image=NULL, *bitmap_image=NULL; *************** *** 2061,2065 **** } if ((short_name=IsPrefix(bootDir, xbm_file_name, &rest))) ++rest; ! if ((fp=fopen(xbm_file_name, "w")) == NULL) { if (short_name) { sprintf(gszMsgBox, "Can not open '%s', print aborted.", rest); --- 2065,2072 ---- } if ((short_name=IsPrefix(bootDir, xbm_file_name, &rest))) ++rest; ! if (PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && !preDumpSetup) { ! fp = stdout; ! } else if ((fp=fopen(xbm_file_name, "w")) == NULL) { if (short_name) { sprintf(gszMsgBox, "Can not open '%s', print aborted.", rest); *************** *** 2077,2082 **** if ((pixmap=DrawAllOnPixmap(<x, <y, &w, &h, !nPageNumInFileName)) == None) { ! fclose(fp); ! unlink(xbm_file_name); return; } --- 2084,2093 ---- if ((pixmap=DrawAllOnPixmap(<x, <y, &w, &h, !nPageNumInFileName)) == None) { ! if (!(PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && ! !preDumpSetup)) { ! fclose(fp); ! unlink(xbm_file_name); ! } return; } *************** *** 2115,2120 **** w-left-right, h-top-bottom, AllPlanes, ZPixmap)) == NULL) { Msg("Can not generate image, print aborted!"); ! fclose(fp); ! unlink(xbm_file_name); XFreePixmap(mainDisplay, pixmap); return; --- 2126,2135 ---- w-left-right, h-top-bottom, AllPlanes, ZPixmap)) == NULL) { Msg("Can not generate image, print aborted!"); ! if (!(PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && ! !preDumpSetup)) { ! fclose(fp); ! unlink(xbm_file_name); ! } XFreePixmap(mainDisplay, pixmap); return; *************** *** 2126,2131 **** w-left-right, h-top-bottom, 1, ZPixmap)) == NULL) { Msg("Can not generate image, print aborted!"); ! fclose(fp); ! unlink(xbm_file_name); XDestroyImage(image); XFreePixmap(mainDisplay, pixmap); --- 2141,2150 ---- w-left-right, h-top-bottom, 1, ZPixmap)) == NULL) { Msg("Can not generate image, print aborted!"); ! if (!(PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && ! !preDumpSetup)) { ! fclose(fp); ! unlink(xbm_file_name); ! } XDestroyImage(image); XFreePixmap(mainDisplay, pixmap); *************** *** 2141,2146 **** if (colorDump && nInImageProc && gnConvolving) { if (!DoConvolution(fp, image, bitmap_image, w, h)) { ! fclose(fp); ! unlink(xbm_file_name); if (bitmap_image != NULL) XDestroyImage(bitmap_image); XDestroyImage(image); --- 2160,2169 ---- if (colorDump && nInImageProc && gnConvolving) { if (!DoConvolution(fp, image, bitmap_image, w, h)) { ! if (!(PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && ! !preDumpSetup)) { ! fclose(fp); ! unlink(xbm_file_name); ! } if (bitmap_image != NULL) XDestroyImage(bitmap_image); XDestroyImage(image); *************** *** 2231,2240 **** } if (index == INVALID) { ! fclose(fp); sprintf(gszMsgBox, "Unrecognized pixel value %1d!\n\n%s!", data, "Print aborted"); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! unlink(xbm_file_name); if (bitmap_image != NULL) XDestroyImage(bitmap_image); XDestroyImage(image); --- 2254,2271 ---- } if (index == INVALID) { ! if (!(PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && ! !preDumpSetup)) { ! fclose(fp); ! } sprintf(gszMsgBox, "Unrecognized pixel value %1d!\n\n%s!", data, "Print aborted"); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! if (!(PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && ! !preDumpSetup)) { ! unlink(xbm_file_name); ! } if (bitmap_image != NULL) XDestroyImage(bitmap_image); XDestroyImage(image); *************** *** 2500,2505 **** } RestoreStatusStrings(); ! fclose(fp); ! XDestroyImage(image); XFreePixmap(mainDisplay, pixmap); --- 2531,2538 ---- } RestoreStatusStrings(); ! if (!(PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && !preDumpSetup)) { ! fclose(fp); ! } XDestroyImage(image); XFreePixmap(mainDisplay, pixmap); *************** *** 2509,2513 **** sprintf(gszMsgBox, "Fail to write to '%s'.\n\nFile system may be full.", xbm_file_name); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } else { if (short_name) { --- 2542,2550 ---- sprintf(gszMsgBox, "Fail to write to '%s'.\n\nFile system may be full.", xbm_file_name); ! if (PRTGIF) { ! fprintf(stderr, "%s\n", gszMsgBox); ! } else { ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! } } else { if (short_name) { *************** *** 2519,2523 **** xbm_file_name); } ! Msg(gszMsgBox); if (colorDump && (whereToPrint==GIF_FILE || whereToPrint==HTML_FILE)) { Msg("Generating imagemap..."); --- 2556,2564 ---- xbm_file_name); } ! if (PRTGIF && !cmdLineStdOut) { ! fprintf(stderr, "%s\n", gszMsgBox); ! } else { ! Msg(gszMsgBox); ! } if (colorDump && (whereToPrint==GIF_FILE || whereToPrint==HTML_FILE)) { Msg("Generating imagemap..."); *************** *** 2526,2530 **** ltx+w-right, lty+h-bottom, nPageNumInFileName); RestoreStatusStrings(); ! unlink(xbm_file_name); } } --- 2567,2575 ---- ltx+w-right, lty+h-bottom, nPageNumInFileName); RestoreStatusStrings(); ! if (!(PRTGIF && cmdLineStdOut && ! !(whereToPrint == EPSI_FILE && generateTiffEPSI) && ! !preDumpSetup)) { ! unlink(xbm_file_name); ! } } } *************** *** 2538,2553 **** } void DumpXBmObj (FP, ObjPtr) FILE * FP; struct ObjRec * ObjPtr; { /* called when printing in the PostScript format */ ! register int j, data, bit_count; ! int i, ltx, lty, rbx, rby, w, h, block_w, block_h; ! int num_nibbles, nibble_count, fill, h_blocks, v_blocks; ! int row, col, x, y, nibbles_per_row, image_w, image_h; int color_index, rotate, flip; int orig_x=0, orig_y=0; ! Pixmap bitmap; ! char * xbm_data; XImage * image=NULL; struct XBmRec * xbm_ptr=ObjPtr->detail.xbm; --- 2583,2730 ---- } + void DumpBitmap(FP, image, data, image_w, image_h, transformed, orig_x, orig_y, + adj_x, pmtrx, indent) + FILE *FP; + XImage *image; + char *data; + int image_w, image_h, transformed, orig_x, orig_y, adj_x, indent; + struct MtrxRec *pmtrx; + { + register int m; + int row, h_blocks, v_blocks, nibbles_per_row; + + h_blocks = ((image_w&0xff) == 0) ? (image_w>>8) : ((image_w>>8)+1); + v_blocks = ((image_h&0xff) == 0) ? (image_h>>8) : ((image_h>>8)+1); + nibbles_per_row = ((image_w%4)==0) ? (int)(image_w>>2) : (int)(image_w>>2)+1; + + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, "gsave\n"); + + for (m=0; m < indent; m++) fputc(' ', FP); + if (transformed) { + fprintf(FP, " %1d %1d translate\n", orig_x, orig_y); + } else { + fprintf(FP, " %1d %1d translate %.3f %.3f scale %1d rotate\n\n", + orig_x, orig_y, pmtrx->dump_h_scale, pmtrx->dump_v_scale, + pmtrx->degree); + } + + for (row=0; row < v_blocks; row++) { + int y, col, block_h; + + y = row<<8; + block_h = (row == v_blocks-1) ? image_h-y : 0x100; + + for (col=0; col < h_blocks; col++) { + int i, j, x, num_nibbles, nibble_count, block_w; + + x = col<<8; + block_w = (col == h_blocks-1) ? image_w-x : 0x100; + + num_nibbles = ((block_w%4) == 0) ? (int)(block_w>>2) : + (int)(block_w>>2)+1; + + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " gsave\n"); + + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " %1d %1d translate\n", x+adj_x, y); + + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " %1d %1d true [1 0 0 1 0 0]\n", block_w, block_h); + + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " {<"); + + if (PRTGIF && !cmdLineOpenDisplay) { + nibble_count = 0; + for (i=0; i < block_h; i++) { + for (j=0; j < num_nibbles; j++) { + if (nibble_count++ == 64) { + nibble_count = 1; + fprintf(FP, "\n"); + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " "); + } + fprintf(FP, "%c", data[(i+y)*nibbles_per_row+j+(x>>2)]); + } + if ((num_nibbles & 0x1) == 1) { + if (nibble_count++ == 64) { + nibble_count = 1; + fprintf(FP, "\n"); + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " "); + } + fprintf(FP, "0"); + } + } + } else { + nibble_count = 0; + for (i=0; i < block_h; i++) { + int bit_count=0, data; + + data = 0; + for (j=0; j < block_w; j++) { + data = (XGetPixel(image, j+x, i+y) == 1) ? (data<<1) | 1 : + (data<<1); + if (++bit_count == 4) { + if (nibble_count++ == 64) { + nibble_count = 1; + fprintf(FP, "\n"); + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " "); + } + fprintf(FP, "%c", hexValue[data]); + bit_count = 0; + data = 0; + } + } + if ((block_w % 4) != 0) { + data <<= (4 - (block_w % 4)); + if (nibble_count++ == 64) { + nibble_count = 1; + fprintf(FP, "\n"); + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " "); + } + fprintf(FP, "%c", hexValue[data]); + } + if ((num_nibbles & 0x1) == 1) { + if (nibble_count++ == 64) { + nibble_count = 1; + fprintf(FP, "\n"); + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " "); + } + fprintf(FP, "0"); + } + } + } + fprintf(FP, ">}\n"); + + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " imagemask\n"); + + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, " grestore\n"); + + if (row!=v_blocks-1 || col!=h_blocks-1) { + fprintf(FP, "\n"); + } + } + } + for (m=0; m < indent; m++) fputc(' ', FP); + fprintf(FP, "grestore\n"); + } + void DumpXBmObj (FP, ObjPtr) FILE * FP; struct ObjRec * ObjPtr; { /* called when printing in the PostScript format */ ! int ltx, lty, rbx, rby, w, h; ! int fill, image_w, image_h; int color_index, rotate, flip; int orig_x=0, orig_y=0; ! Pixmap bitmap=None; XImage * image=NULL; struct XBmRec * xbm_ptr=ObjPtr->detail.xbm; *************** *** 2582,2595 **** h = rby - lty; ! if (!PRTGIF) { if ((image = xbm_ptr->image) == NULL) if ((image = xbm_ptr->image = XGetImage (mainDisplay, bitmap, 0, 0, image_w, image_h, 1, ZPixmap)) == NULL) { ! Msg ("XGetImage() failed! May have run out of memory!"); ! Msg ("X bitmap object skipped for printing."); return; } } --- 2759,2774 ---- h = rby - lty; ! if (!(PRTGIF && !cmdLineOpenDisplay)) { if ((image = xbm_ptr->image) == NULL) + { if ((image = xbm_ptr->image = XGetImage (mainDisplay, bitmap, 0, 0, image_w, image_h, 1, ZPixmap)) == NULL) { ! Msg("XGetImage() failed! May have run out of memory!"); ! Msg("X bitmap object skipped for printing."); return; } + } } *************** *** 2597,2600 **** --- 2776,2780 ---- if (ObjPtr->ctm == NULL) { + memset(&mtrx, 0, sizeof(struct MtrxRec)); mtrx.image_w = (float)image_w; mtrx.image_h = (float)image_h; mtrx.w = (float)w; mtrx.h = (float)h; *************** *** 2606,2610 **** orig_y = (mtrx.transformed_h >= 0.0) ? lty : lty+h; } ! fprintf (FP, "%% XBM\n"); if (ObjPtr->ctm != NULL) { float m[6]; --- 2786,2790 ---- orig_y = (mtrx.transformed_h >= 0.0) ? lty : lty+h; } ! fprintf(FP, "%% XBM\n"); if (ObjPtr->ctm != NULL) { float m[6]; *************** *** 2615,2623 **** m[CTM_SIN] = ((float)ObjPtr->ctm->m[CTM_SIN])/((float)1000.0); m[CTM_MSIN] = ((float)ObjPtr->ctm->m[CTM_MSIN])/((float)1000.0); ! fprintf (FP, " %1d %1d translate\n", ObjPtr->x, ObjPtr->y); ! fprintf (FP, " [%.3f %.3f %.3f %.3f %1d %1d] concat\n", m[CTM_SX], m[CTM_SIN], m[CTM_MSIN], m[CTM_SY], ObjPtr->ctm->m[CTM_TX], ObjPtr->ctm->m[CTM_TY]); ! fprintf (FP, " %1d neg %1d neg translate\n", ObjPtr->x, ObjPtr->y); } DumpRGBColorLine(FP, color_index, 0, TRUE); --- 2795,2803 ---- m[CTM_SIN] = ((float)ObjPtr->ctm->m[CTM_SIN])/((float)1000.0); m[CTM_MSIN] = ((float)ObjPtr->ctm->m[CTM_MSIN])/((float)1000.0); ! fprintf(FP, " %1d %1d translate\n", ObjPtr->x, ObjPtr->y); ! fprintf(FP, " [%.3f %.3f %.3f %.3f %1d %1d] concat\n", m[CTM_SX], m[CTM_SIN], m[CTM_MSIN], m[CTM_SY], ObjPtr->ctm->m[CTM_TX], ObjPtr->ctm->m[CTM_TY]); ! fprintf(FP, " %1d neg %1d neg translate\n", ObjPtr->x, ObjPtr->y); } DumpRGBColorLine(FP, color_index, 0, TRUE); *************** *** 2627,2657 **** case NONEPAT: break; case SOLIDPAT: ! fprintf (FP, "newpath\n"); ! fprintf (FP, " %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); ! fprintf (FP, "closepath fill\n"); break; case BACKPAT: ! fprintf (FP, "newpath\n"); ! fprintf (FP, " %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); ! fprintf (FP, "closepath 1 setgray fill\n\n"); DumpRGBColorLine(FP, color_index, 0, TRUE); break; default: /* patterned */ ! fprintf (FP, "gsave\n"); if (colorDump || !useGray) { ! fprintf (FP, " newpath\n"); ! fprintf (FP, " %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); ! fprintf (FP, " closepath 1 setgray fill\n\n"); DumpRGBColorLine(FP, color_index, 3, TRUE); } --- 2807,2837 ---- case NONEPAT: break; case SOLIDPAT: ! fprintf(FP, "newpath\n"); ! fprintf(FP, " %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); ! fprintf(FP, "closepath fill\n"); break; case BACKPAT: ! fprintf(FP, "newpath\n"); ! fprintf(FP, " %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); ! fprintf(FP, "closepath 1 setgray fill\n\n"); DumpRGBColorLine(FP, color_index, 0, TRUE); break; default: /* patterned */ ! fprintf(FP, "gsave\n"); if (colorDump || !useGray) { ! fprintf(FP, " newpath\n"); ! fprintf(FP, " %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); ! fprintf(FP, " closepath 1 setgray fill\n\n"); DumpRGBColorLine(FP, color_index, 3, TRUE); } *************** *** 2659,2790 **** { GrayCheck (fill); ! fprintf (FP, " %s setgray\n", GrayStr(fill)); } ! fprintf (FP, " newpath\n"); ! fprintf (FP, " %1d %1d moveto ", ltx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, lty); ! fprintf (FP, "%1d %1d lineto ", rbx, rby); ! fprintf (FP, "%1d %1d lineto\n", ltx, rby); if (colorDump || !useGray) { if (preDumpSetup) PSUseColorPattern(); ! fprintf (FP, " closepath eoclip newpath\n"); DumpPatFill (FP, fill, 8, ObjPtr->bbox, " "); } else ! fprintf (FP, " closepath fill\n"); ! fprintf (FP, "grestore\n"); break; } - h_blocks = ((image_w&0xff) == 0) ? (image_w>>8) : ((image_w>>8)+1); - v_blocks = ((image_h&0xff) == 0) ? (image_h>>8) : ((image_h>>8)+1); - nibbles_per_row = ((image_w%4)==0) ? (int)(image_w>>2) : (int)(image_w>>2)+1; - - fprintf (FP, "gsave\n"); - if (ObjPtr->ctm == NULL) { - fprintf (FP, " %1d %1d translate %.3f %.3f scale %1d rotate\n\n", - orig_x, orig_y, mtrx.dump_h_scale, mtrx.dump_v_scale, mtrx.degree); - } else { - fprintf (FP, " %1d %1d translate\n", ObjPtr->x, ObjPtr->y); - } - - for (row = 0; row < v_blocks; row++) - { - y = row<<8; - block_h = (row == v_blocks-1) ? image_h-y : 0x100; - - for (col = 0; col < h_blocks; col++) - { - x = col<<8; - block_w = (col == h_blocks-1) ? image_w-x : 0x100; - - num_nibbles = ((block_w%4) == 0) ? (int)(block_w>>2) : - (int)(block_w>>2)+1; - - fprintf (FP, " gsave\n"); - fprintf (FP, " %1d %1d translate\n", x, y); - fprintf (FP, " %1d %1d true [1 0 0 1 0 0]\n {<", block_w, block_h); - if (PRTGIF) - { - xbm_data = ObjPtr->detail.xbm->data; - - nibble_count = 0; - for (i = 0; i < block_h; i++) - { - for (j = 0; j < num_nibbles; j++) - { - if (nibble_count++ == 64) - { - nibble_count = 1; - fprintf (FP, "\n "); - } - fprintf (FP, "%c", - xbm_data[(i+y)*nibbles_per_row+j+(x>>2)]); - } - if ((num_nibbles & 0x1) == 1) - { - if (nibble_count++ == 64) - { - nibble_count = 1; - fprintf (FP, "\n "); - } - fprintf (FP, "0"); - } - } - } - else - { - nibble_count = 0; - for (i = 0; i < block_h; i++) - { - bit_count = 0; - data = 0; - for (j = 0; j < block_w; j++) - { - data = (XGetPixel (image, j+x, i+y) == 1) ? (data<<1) | 1 : - (data<<1); - if (++bit_count == 4) - { - if (nibble_count++ == 64) - { - nibble_count = 1; - fprintf (FP, "\n "); - } - fprintf (FP, "%c", hexValue[data]); - bit_count = 0; - data = 0; - } - } - if ((block_w % 4) != 0) - { - data <<= (4 - (block_w % 4)); - if (nibble_count++ == 64) - { - nibble_count = 1; - fprintf (FP, "\n "); - } - fprintf (FP, "%c", hexValue[data]); - } - if ((num_nibbles & 0x1) == 1) - { - if (nibble_count++ == 64) - { - nibble_count = 1; - fprintf (FP, "\n "); - } - fprintf (FP, "0"); - } - } - } - fprintf (FP, ">}\n"); - fprintf (FP, " imagemask\n"); - fprintf (FP, " grestore\n"); - if (row!=v_blocks-1 || col!=h_blocks-1) fprintf (FP, "\n"); - } - } - fprintf (FP, "grestore\n"); if (ObjPtr->ctm != NULL) fprintf(FP, "grestore\n"); ! fprintf (FP, "\n"); } --- 2839,2865 ---- { GrayCheck (fill); ! fprintf(FP, " %s setgray\n", GrayStr(fill)); } ! fprintf(FP, " newpath\n"); ! fprintf(FP, " %1d %1d moveto ", ltx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, lty); ! fprintf(FP, "%1d %1d lineto ", rbx, rby); ! fprintf(FP, "%1d %1d lineto\n", ltx, rby); if (colorDump || !useGray) { if (preDumpSetup) PSUseColorPattern(); ! fprintf(FP, " closepath eoclip newpath\n"); DumpPatFill (FP, fill, 8, ObjPtr->bbox, " "); } else ! fprintf(FP, " closepath fill\n"); ! fprintf(FP, "grestore\n"); break; } + DumpBitmap(FP, image, ObjPtr->detail.xbm->data, image_w, image_h, + (ObjPtr->ctm!=0), orig_x, orig_y, 0, &mtrx, 0); if (ObjPtr->ctm != NULL) fprintf(FP, "grestore\n"); ! fprintf(FP, "\n"); } *************** *** 2834,2838 **** XDrawRectangle (mainDisplay, win, drawGC, x, y, w, h); ! len = strlen (s); str_w = rulerFontWidth*len; if (str_w < w && rulerFontHeight < h) --- 2909,2913 ---- XDrawRectangle (mainDisplay, win, drawGC, x, y, w, h); ! len = strlen(s); str_w = rulerFontWidth*len; if (str_w < w && rulerFontHeight < h) *************** *** 2901,2905 **** else { ! sprintf (s, "(%1dx%1d)", xbm_ptr->image_w, xbm_ptr->image_h); DrawHiddenXBm (win, ObjPtr->ctm, ObjPtr->rotated_obbox, ltx, lty, scr_w, scr_h, s); --- 2976,2980 ---- else { ! sprintf(s, "(%1dx%1d)", xbm_ptr->image_w, xbm_ptr->image_h); DrawHiddenXBm (win, ObjPtr->ctm, ObjPtr->rotated_obbox, ltx, lty, scr_w, scr_h, s); *************** *** 3098,3162 **** } ! static ! void DumpXBmData (FP, bitmap, image, W, H) ! FILE * FP; ! Pixmap bitmap; ! XImage * * image; ! int W, H; { ! register int nibble_count, bit_count, data, i, j; ! if (*image == NULL) ! if ((*image = XGetImage (mainDisplay,bitmap,0,0,W,H,1,ZPixmap)) == NULL) ! { ! Msg ("XGetImage() failed! May have run out of memory!"); ! Msg ("Output file maybe corrupted."); return; } nibble_count = 0; ! for (i = 0; i < H; i++) ! { bit_count = 0; data = 0; ! for (j = 0; j < W; j++) ! { ! data = (XGetPixel (*image, j, i) == 1) ? (data<<1) | 1 : (data<<1); ! if (++bit_count == 4) ! { ! if (nibble_count++ == 64) ! { nibble_count = 1; ! if (fprintf (FP, "\n ") == EOF) writeFileFailed = TRUE; } - if (fprintf (FP, "%c", hexValue[data]) == EOF) writeFileFailed = TRUE; bit_count = 0; data = 0; } } ! if ((W % 4) != 0) ! { data <<= (4 - (W % 4)); ! if (nibble_count++ == 64) ! { nibble_count = 1; ! if (fprintf (FP, "\n ") == EOF) writeFileFailed = TRUE; } ! if (fprintf (FP, "%c", hexValue[data]) == EOF) writeFileFailed = TRUE; } } } ! void SaveXBmObj (FP, ObjPtr) ! FILE * FP; ! struct ObjRec * ObjPtr; { ! register int i; ! int ltx, lty, rbx, rby, image_w, image_h; ! int no_bitmap, compressed=FALSE; ! struct XBmRec * xbm_ptr=ObjPtr->detail.xbm; no_bitmap = (xbm_ptr->real_type==XBM_EPS && --- 3173,3232 ---- } ! void DumpXBmData(FP, bitmap, image, W, H) ! FILE *FP; ! Pixmap bitmap; ! XImage **image; ! int W, H; { ! register int nibble_count, bit_count, data, i, j; ! if (*image == NULL) { ! if ((*image=XGetImage(mainDisplay,bitmap,0,0,W,H,1,ZPixmap)) == NULL) { ! Msg("XGetImage() failed! May have run out of memory!"); ! Msg("Output file maybe corrupted."); return; } + } nibble_count = 0; ! for (i = 0; i < H; i++) { bit_count = 0; data = 0; ! for (j = 0; j < W; j++) { ! data = (XGetPixel(*image, j, i) == 1) ? (data<<1) | 1 : (data<<1); ! if (++bit_count == 4) { ! if (nibble_count++ == 64) { nibble_count = 1; ! if (fprintf(FP, "\n ") == EOF) writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%c", hexValue[data]) == EOF) { ! writeFileFailed = TRUE; } bit_count = 0; data = 0; } } ! if ((W % 4) != 0) { data <<= (4 - (W % 4)); ! if (nibble_count++ == 64) { nibble_count = 1; ! if (fprintf(FP, "\n ") == EOF) writeFileFailed = TRUE; } ! if (fprintf(FP, "%c", hexValue[data]) == EOF) writeFileFailed = TRUE; } } } ! void SaveXBmObj(FP, ObjPtr) ! FILE *FP; ! struct ObjRec *ObjPtr; { ! register int i; ! int ltx, lty, rbx, rby, image_w, image_h; ! int no_bitmap, compressed=FALSE; ! struct XBmRec *xbm_ptr=ObjPtr->detail.xbm; no_bitmap = (xbm_ptr->real_type==XBM_EPS && *************** *** 3165,3181 **** ltx = ObjPtr->obbox.ltx; lty = ObjPtr->obbox.lty; rbx = ObjPtr->obbox.rbx; rby = ObjPtr->obbox.rby; ! if (no_bitmap) ! { image_w = xbm_ptr->eps_w; image_h = xbm_ptr->eps_h; ! } ! else ! { image_w = xbm_ptr->image_w; image_h = xbm_ptr->image_h; } ! if (fprintf (FP, "xbm('%s',", colorMenuItems[ObjPtr->color]) == EOF) writeFileFailed = TRUE; ! if (fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,\n ", ltx, lty, rbx, rby, xbm_ptr->fill, ObjPtr->id, ObjPtr->rotation, --- 3235,3249 ---- ltx = ObjPtr->obbox.ltx; lty = ObjPtr->obbox.lty; rbx = ObjPtr->obbox.rbx; rby = ObjPtr->obbox.rby; ! if (no_bitmap) { image_w = xbm_ptr->eps_w; image_h = xbm_ptr->eps_h; ! } else { image_w = xbm_ptr->image_w; image_h = xbm_ptr->image_h; } ! if (fprintf(FP, "xbm('%s',", colorMenuItems[ObjPtr->color]) == EOF) { writeFileFailed = TRUE; ! } ! if (fprintf(FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,\n ", ltx, lty, rbx, rby, xbm_ptr->fill, ObjPtr->id, ObjPtr->rotation, *************** *** 3186,3214 **** writeFileFailed = TRUE; } ! switch (xbm_ptr->real_type) ! { ! case XBM_XBM: ! if (fprintf (FP, "\"\",\"\",") == EOF) writeFileFailed = TRUE; ! break; ! case XBM_EPS: ! if (fprintf (FP, "\"%s\",\"%s\",", xbm_ptr->write_date, ! xbm_ptr->filename) == EOF) ! writeFileFailed = TRUE; ! break; } ! if (xbm_ptr->save_epsf) ! { ! if (fprintf (FP, "%1d,[", xbm_ptr->num_epsf_lines) == EOF) writeFileFailed = TRUE; ! for (i = 0; i < xbm_ptr->num_epsf_lines; i++) ! if (fprintf (FP, "\n \"%s\"%s,", xbm_ptr->epsflines[i], ! (i==xbm_ptr->num_epsf_lines-1 ? "]" : "")) == EOF) writeFileFailed = TRUE; } ! if (!no_bitmap) ! { ! if (fprintf (FP, "\n \"") == EOF) writeFileFailed = TRUE; ! DumpXBmData (FP, xbm_ptr->bitmap, &(xbm_ptr->image), image_w, image_h); ! if (fprintf (FP, "\",") == EOF) writeFileFailed = TRUE; } if (ObjPtr->ctm != NULL && fprintf(FP, --- 3254,3283 ---- writeFileFailed = TRUE; } ! switch (xbm_ptr->real_type) { ! case XBM_XBM: ! if (fprintf(FP, "\"\",\"\",") == EOF) writeFileFailed = TRUE; ! break; ! case XBM_EPS: ! if (fprintf(FP, "\"%s\",\"%s\",", xbm_ptr->write_date, ! xbm_ptr->filename) == EOF) { ! writeFileFailed = TRUE; ! } ! break; } ! if (xbm_ptr->save_epsf) { ! if (fprintf(FP, "%1d,[", xbm_ptr->num_epsf_lines) == EOF) { writeFileFailed = TRUE; ! } ! for (i = 0; i < xbm_ptr->num_epsf_lines; i++) { ! if (fprintf(FP, "\n \"%s\"%s,", xbm_ptr->epsflines[i], ! (i==xbm_ptr->num_epsf_lines-1 ? "]" : "")) == EOF) { writeFileFailed = TRUE; + } + } } ! if (!no_bitmap) { ! if (fprintf(FP, "\n \"") == EOF) writeFileFailed = TRUE; ! DumpXBmData(FP, xbm_ptr->bitmap, &(xbm_ptr->image), image_w, image_h); ! if (fprintf(FP, "\",") == EOF) writeFileFailed = TRUE; } if (ObjPtr->ctm != NULL && fprintf(FP, *************** *** 3222,3227 **** writeFileFailed = TRUE; } ! SaveAttrs (FP, ObjPtr->lattr); ! if (fprintf (FP, ")") == EOF) writeFileFailed = TRUE; } --- 3291,3296 ---- writeFileFailed = TRUE; } ! SaveAttrs(FP, ObjPtr->lattr); ! if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; } *************** *** 3395,3403 **** if (fileVersion <= 8) { ! sprintf (inbuf, "Invalid X Bitmap version (%1d).", fileVersion); if (PRTGIF) ! fprintf (stderr, "%s\n", inbuf); else ! Msg (inbuf); return; } --- 3464,3472 ---- if (fileVersion <= 8) { ! sprintf(inbuf, "Invalid X Bitmap version (%1d).", fileVersion); if (PRTGIF) ! fprintf(stderr, "%s\n", inbuf); else ! Msg(inbuf); return; } *************** *** 3569,3581 **** s1++; *(--s) = '\0'; ! len = strlen (tmp_str); if (len > 24) { ! (void) sprintf (gszMsgBox, "%s, %d: %s too long in %s", scanFileName, scanLineNum, "write_date", "xbm"); if (PRTGIF) ! fprintf (stderr, "%s\n", gszMsgBox); else ! Msg (gszMsgBox); } strcpy (write_date, tmp_str); --- 3638,3650 ---- s1++; *(--s) = '\0'; ! len = strlen(tmp_str); if (len > 24) { ! (void) sprintf(gszMsgBox, "%s, %d: %s too long in %s", scanFileName, scanLineNum, "write_date", "xbm"); if (PRTGIF) ! fprintf(stderr, "%s\n", gszMsgBox); else ! Msg(gszMsgBox); } strcpy (write_date, tmp_str); *************** *** 3584,3588 **** s = ReadString (tmp_str); *(--s) = '\0'; ! len = strlen (tmp_str); filename = (char*)malloc((len+1)*sizeof(char)); if (filename == NULL) FailAllocMessage(); --- 3653,3657 ---- s = ReadString (tmp_str); *(--s) = '\0'; ! len = strlen(tmp_str); filename = (char*)malloc((len+1)*sizeof(char)); if (filename == NULL) FailAllocMessage(); *************** *** 3592,3601 **** if (sscanf (&s[2], "%d", &num_epsf_lines) != 1) { ! sprintf (gszMsgBox, "%s, %d: Bad num_epsf_lines in X Bitmap [%s]", scanFileName, scanLineNum, &s[2]); if (PRTGIF) ! fprintf (stderr, "%s\n", gszMsgBox); else ! Msg (gszMsgBox); return; } --- 3661,3670 ---- if (sscanf (&s[2], "%d", &num_epsf_lines) != 1) { ! sprintf(gszMsgBox, "%s, %d: Bad num_epsf_lines in X Bitmap [%s]", scanFileName, scanLineNum, &s[2]); if (PRTGIF) ! fprintf(stderr, "%s\n", gszMsgBox); else ! Msg(gszMsgBox); return; } *************** *** 3614,3626 **** } scanLineNum++; ! len = strlen (inbuf); if ((c_ptr = strchr (inbuf, '"')) == NULL) { ! sprintf (gszMsgBox, "Malformed input at line %d of %s.", scanLineNum, scanFileName); if (PRTGIF) ! fprintf (stderr, "%s\n", gszMsgBox); else ! Msg (gszMsgBox); return; } --- 3683,3695 ---- } scanLineNum++; ! len = strlen(inbuf); if ((c_ptr = strchr (inbuf, '"')) == NULL) { ! sprintf(gszMsgBox, "Malformed input at line %d of %s.", scanLineNum, scanFileName); if (PRTGIF) ! fprintf(stderr, "%s\n", gszMsgBox); else ! Msg(gszMsgBox); return; } *************** *** 3747,3751 **** xbm_ptr->image_h = 0; ! if (!PRTGIF) { transform_read = TRUE; if (!ReadTransformAndAdjustForXBm(FP, ObjPtr, xbm_ptr, transformed, --- 3816,3820 ---- xbm_ptr->image_h = 0; ! if (!(PRTGIF && !cmdLineOpenDisplay)) { transform_read = TRUE; if (!ReadTransformAndAdjustForXBm(FP, ObjPtr, xbm_ptr, transformed, *************** *** 3788,3792 **** nibble_count = 0; ! if (PRTGIF) { xbm_data = (char*)malloc((image_h*num_nibbles)*sizeof(char)); if (xbm_data == NULL) FailAllocMessage(); --- 3857,3861 ---- nibble_count = 0; ! if (PRTGIF && !cmdLineOpenDisplay) { xbm_data = (char*)malloc((image_h*num_nibbles)*sizeof(char)); if (xbm_data == NULL) FailAllocMessage(); *************** *** 3840,3844 **** return; } ! if (!PRTGIF && (*ObjPtr)->ctm == NULL && xbm_ptr->rotate == ROTATE0) { if (xbm_ptr->bitmap == None) { image_w = xbm_ptr->eps_w; --- 3909,3914 ---- return; } ! if ((!(PRTGIF && !cmdLineOpenDisplay)) && ! (*ObjPtr)->ctm == NULL && xbm_ptr->rotate == ROTATE0) { if (xbm_ptr->bitmap == None) { image_w = xbm_ptr->eps_w; *** xpixmap.c.orig Tue Sep 30 13:24:28 1997 --- xpixmap.c Tue Sep 30 13:24:29 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 27,35 **** * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifndef lint - static char RCSid[] = - "@(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/xpixmap.c,v 3.6 1996/10/30 23:31:54 william Exp $"; - #endif #include --- 27,33 ---- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/xpixmap.c,v 3.8 1997/09/15 22:17:50 william Exp $ */ #include *************** *** 83,86 **** --- 81,85 ---- int newColormapUsed=FALSE; int allocColorFailed=FALSE; + int myReadTransparentPixmap=FALSE; double rotatedSine[4] = { 0.0, 1.0, 0.0, -1.0 }; *************** *** 2114,2118 **** float mag; ! *xpm_data = NULL; gnNumNewColorsInPixmapFile = 0; --- 2113,2119 ---- float mag; ! myReadTransparentPixmap = FALSE; ! ! if (xpm_data != NULL) *xpm_data = NULL; gnNumNewColorsInPixmapFile = 0; *************** *** 2182,2187 **** return (BitmapFileInvalid); } ! sscanf(c_ptr, "%d", chars_per_pixel_return); ! chars_per_pixel = *chars_per_pixel_return; if (chars_per_pixel > 2) { sprintf(gszMsgBox, "Can not handle chars_per_pixel=%1d.", --- 2183,2190 ---- return (BitmapFileInvalid); } ! sscanf(c_ptr, "%d", &chars_per_pixel); ! if (chars_per_pixel_return != NULL) { ! *chars_per_pixel_return = chars_per_pixel; ! } if (chars_per_pixel > 2) { sprintf(gszMsgBox, "Can not handle chars_per_pixel=%1d.", *************** *** 2209,2218 **** c_ptr = &inbuf[1]; if (sscanf(c_ptr, "%d %d %d %d", &image_w, &image_h, ! ncolors_return, chars_per_pixel_return) != 4) { return BitmapFileInvalid; } if (image_w_return != NULL) *image_w_return = image_w; if (image_h_return != NULL) *image_h_return = image_h; ! chars_per_pixel = *chars_per_pixel_return; } --- 2212,2223 ---- c_ptr = &inbuf[1]; if (sscanf(c_ptr, "%d %d %d %d", &image_w, &image_h, ! ncolors_return, &chars_per_pixel) != 4) { return BitmapFileInvalid; } if (image_w_return != NULL) *image_w_return = image_w; if (image_h_return != NULL) *image_h_return = image_h; ! if (chars_per_pixel_return != NULL) { ! *chars_per_pixel_return = chars_per_pixel; ! } } *************** *** 2231,2235 **** if (image_return != NULL) *image_return = NULL; if (bitmap_image_return != NULL) *bitmap_image_return = NULL; ! *first_pixel_is_bg_return = FALSE; bg_pixel = GetDrawingBgPixel(INVALID, INVALID); --- 2236,2240 ---- if (image_return != NULL) *image_return = NULL; if (bitmap_image_return != NULL) *bitmap_image_return = NULL; ! if (first_pixel_is_bg_return != NULL) *first_pixel_is_bg_return = FALSE; bg_pixel = GetDrawingBgPixel(INVALID, INVALID); *************** *** 2253,2257 **** myFileBgColorStr)); if (pixels != NULL) (*pixels)[0] = bg_pixel; ! *first_pixel_is_bg_return = TRUE; } else { c_ptr = FindChar((int)'"', c_ptr); --- 2258,2264 ---- myFileBgColorStr)); if (pixels != NULL) (*pixels)[0] = bg_pixel; ! if (first_pixel_is_bg_return != NULL) { ! *first_pixel_is_bg_return = TRUE; ! } } else { c_ptr = FindChar((int)'"', c_ptr); *************** *** 2261,2264 **** --- 2268,2272 ---- if (UtilStrICmp(s, "None") == 0) { (*pixels)[i] = (-1); + myReadTransparentPixmap = TRUE; } else if ((index=QuickFindColorIndex(NULL, s, &new_alloc, TRUE)) == INVALID) { *************** *** 2273,2276 **** --- 2281,2288 ---- (*pixels)[i] = colorPixels[index]; } + } else { + if (UtilStrICmp(s, "None") == 0) { + myReadTransparentPixmap = TRUE; + } } } *************** *** 2328,2332 **** myFileBgColorStr)); if (pixels != NULL) (*pixels)[0] = bg_pixel; ! *first_pixel_is_bg_return = TRUE; } else { char *ptr; --- 2340,2346 ---- myFileBgColorStr)); if (pixels != NULL) (*pixels)[0] = bg_pixel; ! if (first_pixel_is_bg_return != NULL) { ! *first_pixel_is_bg_return = TRUE; ! } } else { char *ptr; *************** *** 2396,2399 **** --- 2410,2414 ---- if (UtilStrICmp(s, "None") == 0) { (*pixels)[i] = (-1); + myReadTransparentPixmap = TRUE; } else if ((index=QuickFindColorIndex(NULL, s, &new_alloc, TRUE)) == INVALID) { *************** *** 2408,2411 **** --- 2423,2430 ---- (*pixels)[i] = colorPixels[index]; } + } else { + if (UtilStrICmp(s, "None") == 0) { + myReadTransparentPixmap = TRUE; + } } } *************** *** 2416,2419 **** --- 2435,2444 ---- } } + if (chars_per_pixel_return == NULL && first_pixel_is_bg_return == NULL && + pixels == NULL && xpm_data == NULL) { + /* just getting the colors, so no need to read data */ + if (pixels_used != NULL) free(pixels_used); + return BitmapSuccess; + } x = 0; *************** *** 2459,2465 **** if (!colorDisplay) { ! xpm_data_ptr = *xpm_data = (char*)malloc( ! image_w*image_h*chars_per_pixel*sizeof(char)); ! if (*xpm_data == NULL) FailAllocMessage(); } line = (char*)malloc((image_w*chars_per_pixel+20)*sizeof(char)); --- 2484,2492 ---- if (!colorDisplay) { ! if (xpm_data != NULL) { ! xpm_data_ptr = *xpm_data = (char*)malloc( ! image_w*image_h*chars_per_pixel*sizeof(char)); ! if (*xpm_data == NULL) FailAllocMessage(); ! } } line = (char*)malloc((image_w*chars_per_pixel+20)*sizeof(char)); *************** *** 2588,2592 **** free(*pixels); *pixels = new_pixels; ! if (*first_pixel_is_bg_return && pixels_used[0]) { *first_pixel_is_bg_return = FALSE; } --- 2615,2620 ---- free(*pixels); *pixels = new_pixels; ! if (first_pixel_is_bg_return != NULL && ! *first_pixel_is_bg_return && pixels_used[0]) { *first_pixel_is_bg_return = FALSE; } *** align.e.orig Tue Sep 30 13:24:31 1997 --- align.e Tue Sep 30 13:24:31 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/align.e,v 3.0 1996/05/06 16:03:33 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/align.e,v 3.1 1997/09/14 20:38:04 william Exp $ */ *** animate.e.orig Tue Sep 30 13:24:32 1997 --- animate.e Tue Sep 30 13:24:32 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/animate.e,v 3.0 1996/05/06 16:03:38 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/animate.e,v 3.1 1997/09/14 20:38:04 william Exp $ */ *** arc.e.orig Tue Sep 30 13:24:34 1997 --- arc.e Tue Sep 30 13:24:34 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/arc.e,v 3.0 1996/05/06 16:03:42 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/arc.e,v 3.1 1997/09/14 20:38:04 william Exp $ */ *** attr.e.orig Tue Sep 30 13:24:35 1997 --- attr.e Tue Sep 30 13:24:35 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/attr.e,v 3.0 1996/05/06 16:03:47 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/attr.e,v 3.1 1997/09/14 20:38:05 william Exp $ */ *** auxtext.e.orig Tue Sep 30 13:24:36 1997 --- auxtext.e Tue Sep 30 13:24:37 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/auxtext.e,v 3.1 1996/09/14 19:19:34 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/auxtext.e,v 3.3 1997/09/14 20:38:05 william Exp $ */ *************** *** 67,70 **** --- 67,72 ---- extern int PixelOnOff ARGS_DECL((XImage *, int Col, int Row, int Scale)); extern void MakeCachedTextBitmap ARGS_DECL((struct ObjRec *)); + extern void CleanOuterInnerSel ARGS_DECL((void)); + extern void UpdateOuterInnerSel ARGS_DECL((struct ObjRec *)); extern struct ObjRec * FindTextObj ARGS_DECL((int XOff, int YOff, struct ObjRec *ObjToBeFound)); *** box.e.orig Tue Sep 30 13:24:38 1997 --- box.e Tue Sep 30 13:24:38 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/box.e,v 3.0 1996/05/06 16:03:55 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/box.e,v 3.1 1997/09/14 20:38:05 william Exp $ */ *** button.e.orig Tue Sep 30 13:24:40 1997 --- button.e Tue Sep 30 13:24:40 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/button.e,v 3.0 1996/05/06 16:03:58 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/button.e,v 3.1 1997/09/14 20:38:05 william Exp $ */ *** choice.e.orig Tue Sep 30 13:24:41 1997 --- choice.e Tue Sep 30 13:24:41 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/choice.e,v 3.1 1996/05/24 22:27:20 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/choice.e,v 3.2 1997/09/14 20:38:05 william Exp $ */ *** choose.e.orig Tue Sep 30 13:24:42 1997 --- choose.e Tue Sep 30 13:24:42 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/choose.e,v 3.2 1996/11/30 00:10:05 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/choose.e,v 3.3 1997/09/14 20:38:05 william Exp $ */ *** cmd.e.orig Tue Sep 30 13:24:44 1997 --- cmd.e Tue Sep 30 13:24:44 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cmd.e,v 3.0 1996/05/06 16:04:11 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cmd.e,v 3.1 1997/09/14 20:38:05 william Exp $ */ *** color.e.orig Tue Sep 30 13:24:45 1997 --- color.e Tue Sep 30 13:24:45 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/color.e,v 3.6 1996/10/28 00:49:55 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/color.e,v 3.7 1997/09/14 20:38:05 william Exp $ */ *** cursor.e.orig Tue Sep 30 13:24:47 1997 --- cursor.e Tue Sep 30 13:24:47 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cursor.e,v 3.0 1996/05/06 16:04:21 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cursor.e,v 3.1 1997/09/14 20:38:05 william Exp $ */ *** cutpaste.e.orig Tue Sep 30 13:24:48 1997 --- cutpaste.e Tue Sep 30 13:24:48 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cutpaste.e,v 3.0 1996/05/06 16:04:25 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/cutpaste.e,v 3.1 1997/09/14 20:38:05 william Exp $ */ *** dialog.e.orig Tue Sep 30 13:24:49 1997 --- dialog.e Tue Sep 30 13:24:49 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/dialog.e,v 3.0 1996/05/06 16:04:33 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/dialog.e,v 3.1 1997/09/14 20:38:05 william Exp $ */ *** drawing.e.orig Tue Sep 30 13:24:51 1997 --- drawing.e Tue Sep 30 13:24:51 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/drawing.e,v 3.3 1996/09/15 04:45:04 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/drawing.e,v 3.4 1997/09/14 20:38:06 william Exp $ */ *** dup.e.orig Tue Sep 30 13:24:52 1997 --- dup.e Tue Sep 30 13:24:52 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/dup.e,v 3.0 1996/05/06 16:04:41 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/dup.e,v 3.1 1997/09/14 20:38:06 william Exp $ */ *** edit.e.orig Tue Sep 30 13:24:54 1997 --- edit.e Tue Sep 30 13:24:54 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/edit.e,v 3.5 1996/12/25 17:12:48 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/edit.e,v 3.6 1997/09/14 20:38:06 william Exp $ */ *** eps.e.orig Tue Sep 30 13:24:55 1997 --- eps.e Tue Sep 30 13:24:55 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/eps.e,v 3.0 1996/05/06 16:04:50 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/eps.e,v 3.1 1997/09/14 20:38:06 william Exp $ */ *** exec.e.orig Tue Sep 30 13:24:57 1997 --- exec.e Tue Sep 30 13:24:57 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/exec.e,v 3.0 1996/05/06 16:04:57 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/exec.e,v 3.1 1997/09/14 20:38:06 william Exp $ */ *** expr.e.orig Tue Sep 30 13:24:59 1997 --- expr.e Tue Sep 30 13:24:59 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/expr.e,v 3.0 1996/05/06 16:05:01 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/expr.e,v 3.1 1997/09/14 20:38:06 william Exp $ */ *** file.e.orig Tue Sep 30 13:25:00 1997 --- file.e Tue Sep 30 13:25:00 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/file.e,v 3.12 1997/01/30 19:12:47 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/file.e,v 3.18 1997/09/18 00:29:18 william Exp $ */ *************** *** 83,86 **** --- 83,97 ---- extern int cmdLineDosEpsFilter; + extern int cmdLinePreviewOnly; + + extern int tmpFileMode; + extern char cmdLineTmpFileModeStr[]; + + extern int cmdLineOpenDisplay; + extern int cmdLineStdOut; + extern int cmdLineWhereToPrint; + extern int cmdLineTiffEPSI; + + extern int generateTiffEPSI; extern int showPageInEPS; *** font.e.orig Tue Sep 30 13:25:02 1997 --- font.e Tue Sep 30 13:25:02 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/font.e,v 3.3 1996/10/28 01:20:51 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/font.e,v 3.4 1997/09/14 20:38:06 william Exp $ */ *** ftp.e.orig Tue Sep 30 13:25:03 1997 --- ftp.e Tue Sep 30 13:25:03 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ftp.e,v 3.3 1996/11/29 23:06:51 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ftp.e,v 3.4 1997/09/14 20:38:06 william Exp $ */ *** grid.e.orig Tue Sep 30 13:25:04 1997 --- grid.e Tue Sep 30 13:25:04 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/grid.e,v 3.1 1996/11/02 23:18:27 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/grid.e,v 3.2 1997/09/14 20:38:06 william Exp $ */ *** group.e.orig Tue Sep 30 13:25:05 1997 --- group.e Tue Sep 30 13:25:05 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/group.e,v 3.0 1996/05/06 16:05:27 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/group.e,v 3.1 1997/09/14 20:38:06 william Exp $ */ *** help.e.orig Tue Sep 30 13:25:06 1997 --- help.e Tue Sep 30 13:25:06 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/help.e,v 3.1 1997/01/30 03:55:56 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/help.e,v 3.3 1997/09/14 20:38:06 william Exp $ */ *************** *** 40,44 **** extern void About ARGS_DECL((void)); extern void Copyright ARGS_DECL((void)); ! extern void CurrentVersionInfo ARGS_DECL((void)); extern void CleanUpHelp ARGS_DECL((void)); --- 40,44 ---- extern void About ARGS_DECL((void)); extern void Copyright ARGS_DECL((void)); ! extern void LatestReleaseInfo ARGS_DECL((void)); extern void CleanUpHelp ARGS_DECL((void)); *** http.e.orig Tue Sep 30 13:25:09 1997 --- http.e Tue Sep 30 13:25:09 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/http.e,v 3.4 1996/11/29 23:54:26 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/http.e,v 3.5 1997/09/14 20:38:06 william Exp $ */ *** imgproc.e.orig Tue Sep 30 13:25:10 1997 --- imgproc.e Tue Sep 30 13:25:10 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/imgproc.e,v 3.0 1996/05/06 16:05:39 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/imgproc.e,v 3.1 1997/09/14 20:38:06 william Exp $ */ *** import.e.orig Tue Sep 30 13:25:11 1997 --- import.e Tue Sep 30 13:25:12 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/import.e,v 3.1 1996/07/05 14:55:11 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/import.e,v 3.2 1997/09/14 20:38:06 william Exp $ */ *** mainloop.e.orig Tue Sep 30 13:25:12 1997 --- mainloop.e Tue Sep 30 13:25:13 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mainloop.e,v 3.2 1997/01/30 04:07:40 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mainloop.e,v 3.6 1997/09/14 20:38:06 william Exp $ */ *************** *** 34,37 **** --- 34,38 ---- #define _MAINLOOP_E_ + extern int x11R6OrAbove; extern int origArgC; extern char * * origArgV; *************** *** 46,51 **** extern char geometrySpec[]; extern char * displayName; - extern char initMsg1[]; - extern char initMsg2[]; extern int numExtraWins; --- 47,50 ---- *************** *** 62,65 **** --- 61,65 ---- extern void CleanUp ARGS_DECL((void)); extern void ExposeEventHandler ARGS_DECL((XEvent *, int Recursive)); + extern int JustInit ARGS_DECL((char *pszFile, int *pnNeedToCheckAutoExec)); extern void MainLoop ARGS_DECL((char *Op, char *FileName, char **Func, char **Str1, char **Menu1, *** mainmenu.e.orig Tue Sep 30 13:25:14 1997 --- mainmenu.e Tue Sep 30 13:25:14 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mainmenu.e,v 3.0 1996/05/06 16:05:55 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mainmenu.e,v 3.2 1997/09/14 20:38:06 william Exp $ */ *************** *** 45,48 **** --- 45,50 ---- extern Window * stackingWins; + extern int titledPinnedMenu; + extern void InitMainMenu ARGS_DECL((void)); extern void CleanUpMainMenu ARGS_DECL((void)); *************** *** 53,56 **** --- 55,59 ---- extern void SaveStackingOrder ARGS_DECL((void)); extern void MoveSubMenuWindow ARGS_DECL((Window)); + extern void RealizeMainMenuWindow ARGS_DECL((int X, int Y)); extern void RealizeSubMenuWindow ARGS_DECL((int X, int Y, int W, int H)); extern int HandleSubMenuEvent ARGS_DECL((Window, int Index, XEvent*)); *** mark.e.orig Tue Sep 30 13:25:15 1997 --- mark.e Tue Sep 30 13:25:15 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mark.e,v 3.0 1996/05/06 16:05:59 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/mark.e,v 3.1 1997/09/14 20:38:06 william Exp $ */ *** menu.e.orig Tue Sep 30 13:25:16 1997 --- menu.e Tue Sep 30 13:25:16 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/menu.e,v 3.0 1996/05/06 16:06:02 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/menu.e,v 3.2 1997/09/14 20:38:07 william Exp $ */ *************** *** 40,43 **** --- 40,44 ---- extern int activeMenu; extern char *mainMenuStr[]; + extern char *mainMenuDescription[]; extern int mainMenuStrWidth[]; extern GC textMenuGC; *** move.e.orig Tue Sep 30 13:25:17 1997 --- move.e Tue Sep 30 13:25:17 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/move.e,v 3.0 1996/05/06 16:06:07 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/move.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** msg.e.orig Tue Sep 30 13:25:18 1997 --- msg.e Tue Sep 30 13:25:18 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/msg.e,v 3.0 1996/05/06 16:06:11 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/msg.e,v 3.2 1997/09/16 00:37:03 william Exp $ */ *************** *** 39,42 **** --- 39,44 ---- extern int FailAllocMessage ARGS_DECL((void)); + extern int FailAllocBitmapMessage ARGS_DECL((int W, int H)); + extern int FailAllocPixmapMessage ARGS_DECL((int W, int H)); extern void CleanUpMsg ARGS_DECL((void)); extern void RedrawMsg ARGS_DECL((void)); *** names.e.orig Tue Sep 30 13:25:19 1997 --- names.e Tue Sep 30 13:25:19 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/names.e,v 3.1 1996/10/30 22:10:09 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/names.e,v 3.2 1997/09/14 20:38:07 william Exp $ */ *** navigate.e.orig Tue Sep 30 13:25:20 1997 --- navigate.e Tue Sep 30 13:25:20 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/navigate.e,v 3.1 1996/07/05 14:55:10 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/navigate.e,v 3.2 1997/09/14 20:38:07 william Exp $ */ *** obj.e.orig Tue Sep 30 13:25:21 1997 --- obj.e Tue Sep 30 13:25:21 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/obj.e,v 3.0 1996/05/06 16:06:27 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/obj.e,v 3.2 1997/09/15 19:33:05 william Exp $ */ *************** *** 39,42 **** --- 39,44 ---- struct ObjRec *)); extern void UnlinkObj ARGS_DECL((struct ObjRec *)); + extern void ReplaceObj ARGS_DECL((struct ObjRec *old_obj, + struct ObjRec *new_obj)); extern void FreeObj ARGS_DECL((struct ObjRec *)); extern void DelObj ARGS_DECL((struct ObjRec *)); *** oval.e.orig Tue Sep 30 13:25:22 1997 --- oval.e Tue Sep 30 13:25:22 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/oval.e,v 3.0 1996/05/06 16:06:32 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/oval.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** page.e.orig Tue Sep 30 13:25:23 1997 --- page.e Tue Sep 30 13:25:23 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/page.e,v 3.2 1996/10/30 22:19:54 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/page.e,v 3.3 1997/09/14 20:38:07 william Exp $ */ *** pattern.e.orig Tue Sep 30 13:25:24 1997 --- pattern.e Tue Sep 30 13:25:24 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/pattern.e,v 3.1 1996/05/30 14:26:52 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/pattern.e,v 3.2 1997/09/14 20:38:07 william Exp $ */ *** poly.e.orig Tue Sep 30 13:25:25 1997 --- poly.e Tue Sep 30 13:25:25 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/poly.e,v 3.0 1996/05/06 16:06:48 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/poly.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** polygon.e.orig Tue Sep 30 13:25:26 1997 --- polygon.e Tue Sep 30 13:25:26 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/polygon.e,v 3.0 1996/05/06 16:06:51 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/polygon.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** prtgif.e.orig Tue Sep 30 13:25:27 1997 --- prtgif.e Tue Sep 30 13:25:27 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/prtgif.e,v 3.0 1996/05/06 16:06:55 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/prtgif.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** ps.e.orig Tue Sep 30 13:25:28 1997 --- ps.e Tue Sep 30 13:25:28 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ps.e,v 3.0 1996/05/06 16:07:00 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ps.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** raster.e.orig Tue Sep 30 13:25:29 1997 --- raster.e Tue Sep 30 13:25:29 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/raster.e,v 3.0 1996/05/06 16:07:04 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/raster.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** rcbox.e.orig Tue Sep 30 13:25:31 1997 --- rcbox.e Tue Sep 30 13:25:31 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/rcbox.e,v 3.0 1996/05/06 16:07:07 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/rcbox.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** rect.e.orig Tue Sep 30 13:25:32 1997 --- rect.e Tue Sep 30 13:25:32 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/rect.e,v 3.3 1997/01/30 22:59:18 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/rect.e,v 3.4 1997/09/14 20:38:07 william Exp $ */ *** remote.e.orig Tue Sep 30 13:25:33 1997 --- remote.e Tue Sep 30 13:25:33 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/remote.e,v 3.1 1996/10/30 00:45:46 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/remote.e,v 3.2 1997/09/14 20:38:07 william Exp $ */ *** ruler.e.orig Tue Sep 30 13:25:34 1997 --- ruler.e Tue Sep 30 13:25:34 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ruler.e,v 3.1 1996/11/30 00:12:26 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/ruler.e,v 3.2 1997/09/14 20:38:07 william Exp $ */ *** scroll.e.orig Tue Sep 30 13:25:35 1997 --- scroll.e Tue Sep 30 13:25:35 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/scroll.e,v 3.0 1996/05/06 16:07:24 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/scroll.e,v 3.1 1997/09/14 20:38:07 william Exp $ */ *** select.e.orig Tue Sep 30 13:25:36 1997 --- select.e Tue Sep 30 13:25:36 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/select.e,v 3.0 1996/05/06 16:07:29 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/select.e,v 3.2 1997/09/16 00:20:12 william Exp $ */ *************** *** 74,78 **** extern void MoveSelToBot ARGS_DECL((void)); extern void DelAllSelObj ARGS_DECL((void)); ! extern void GroupSingleObj ARGS_DECL((void)); extern void GroupSelObj ARGS_DECL((void)); extern void SelectTopObj ARGS_DECL((void)); --- 74,78 ---- extern void MoveSelToBot ARGS_DECL((void)); extern void DelAllSelObj ARGS_DECL((void)); ! extern void GroupSingleObj ARGS_DECL((int ForcePromoteAttrs)); extern void GroupSelObj ARGS_DECL((void)); extern void SelectTopObj ARGS_DECL((void)); *** setup.e.orig Tue Sep 30 13:25:37 1997 --- setup.e Tue Sep 30 13:25:37 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/setup.e,v 3.1 1996/07/08 22:12:42 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/setup.e,v 3.2 1997/09/14 20:38:08 william Exp $ */ *** shape.e.orig Tue Sep 30 13:25:38 1997 --- shape.e Tue Sep 30 13:25:38 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/shape.e,v 3.1 1996/05/30 14:26:45 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/shape.e,v 3.2 1997/09/14 20:38:08 william Exp $ */ *** shortcut.e.orig Tue Sep 30 13:25:39 1997 --- shortcut.e Tue Sep 30 13:25:39 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/shortcut.e,v 3.2 1996/05/15 19:26:51 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/shortcut.e,v 3.3 1997/09/14 20:38:08 william Exp $ */ *** special.e.orig Tue Sep 30 13:25:40 1997 --- special.e Tue Sep 30 13:25:40 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/special.e,v 3.0 1996/05/06 16:07:46 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/special.e,v 3.2 1997/09/16 00:25:20 william Exp $ */ *************** *** 37,43 **** extern char * specialMenuStr[]; ! extern struct ObjRec * ReadSymbol ARGS_DECL((FILE *)); extern struct ObjRec * GetObjRepresentation ARGS_DECL((char *PathName, ! char *SymName)); extern unsigned int PlaceTopObj ARGS_DECL((struct ObjRec *)); extern void Instantiate ARGS_DECL((void)); --- 37,44 ---- extern char * specialMenuStr[]; ! extern struct ObjRec * ReadSymbol ARGS_DECL((FILE *, int FileType)); extern struct ObjRec * GetObjRepresentation ARGS_DECL((char *PathName, ! char *SymName, ! int FileType)); extern unsigned int PlaceTopObj ARGS_DECL((struct ObjRec *)); extern void Instantiate ARGS_DECL((void)); *** spline.e.orig Tue Sep 30 13:25:41 1997 --- spline.e Tue Sep 30 13:25:41 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/spline.e,v 3.1 1997/01/30 23:46:12 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/spline.e,v 3.2 1997/09/14 20:38:08 william Exp $ */ *** stk.e.orig Tue Sep 30 13:25:42 1997 --- stk.e Tue Sep 30 13:25:42 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/stk.e,v 3.0 1996/05/06 16:11:58 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/stk.e,v 3.1 1997/09/14 20:38:09 william Exp $ */ *** stretch.e.orig Tue Sep 30 13:25:43 1997 --- stretch.e Tue Sep 30 13:25:43 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/stretch.e,v 3.0 1996/05/06 16:12:03 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/stretch.e,v 3.1 1997/09/14 20:38:09 william Exp $ */ *** tcp.e.orig Tue Sep 30 13:25:44 1997 --- tcp.e Tue Sep 30 13:25:44 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tcp.e,v 3.0 1996/05/06 16:12:09 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tcp.e,v 3.1 1997/09/14 20:38:09 william Exp $ */ *** text.e.orig Tue Sep 30 13:25:45 1997 --- text.e Tue Sep 30 13:25:45 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/text.e,v 3.4 1996/12/25 21:02:43 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/text.e,v 3.5 1997/09/14 20:38:09 william Exp $ */ *** util.e.orig Tue Sep 30 13:25:46 1997 --- util.e Tue Sep 30 13:25:46 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/util.e,v 3.0 1996/05/06 16:12:46 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/util.e,v 3.1 1997/09/14 20:38:09 william Exp $ */ *** version.e.orig Tue Sep 30 13:25:47 1997 --- version.e Tue Sep 30 13:25:47 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/version.e,v 3.0 1996/05/06 16:12:49 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/version.e,v 3.1 1997/09/14 20:38:09 william Exp $ */ *** xbitmap.e.orig Tue Sep 30 13:25:48 1997 --- xbitmap.e Tue Sep 30 13:25:48 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/xbitmap.e,v 3.2 1996/10/30 23:31:52 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/xbitmap.e,v 3.5 1997/09/17 05:27:55 william Exp $ */ *************** *** 61,65 **** extern void DumpXBitmapFile ARGS_DECL((int nInImageProc, int nPageNumInFileName)); ! extern void DumpXBmObj ARGS_DECL((FILE *, struct ObjRec *)); extern int NeedsToCacheXBmObj ARGS_DECL((struct ObjRec *)); extern void DrawXBmObj ARGS_DECL((Window, int XOff, int YOff, --- 61,69 ---- extern void DumpXBitmapFile ARGS_DECL((int nInImageProc, int nPageNumInFileName)); ! extern void DumpBitmap ARGS_DECL((FILE*, XImage*, char*, int ImageW, ! int ImageH, int Transformed, int OrigX, ! int OrigY, int AdjX, struct MtrxRec *, ! int Indent)); ! extern void DumpXBmObj ARGS_DECL((FILE*, struct ObjRec *)); extern int NeedsToCacheXBmObj ARGS_DECL((struct ObjRec *)); extern void DrawXBmObj ARGS_DECL((Window, int XOff, int YOff, *************** *** 69,72 **** --- 73,78 ---- extern void BreakUpXBitmap ARGS_DECL((struct ObjRec *, int ColsAndRows, int W, int H)); + extern void DumpXBmData ARGS_DECL((FILE*, Pixmap bitmap, XImage**, + int W, int H)); extern void SaveXBmObj ARGS_DECL((FILE *, struct ObjRec *)); extern void ReadXBmObj ARGS_DECL((FILE *, char *Inbuf, struct ObjRec **)); *** xpixmap.e.orig Tue Sep 30 13:25:49 1997 --- xpixmap.e Tue Sep 30 13:25:49 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/xpixmap.e,v 3.2 1996/10/30 23:29:21 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/xpixmap.e,v 3.4 1997/09/15 21:52:37 william Exp $ */ *************** *** 37,40 **** --- 37,41 ---- extern int newColormapUsed; extern int allocColorFailed; + extern int myReadTransparentPixmap; extern double rotatedSine[]; extern double rotatedCosine[]; *** const.h.orig Tue Sep 30 13:25:50 1997 --- const.h Tue Sep 30 13:25:50 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/const.h,v 3.9 1997/01/30 23:24:58 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/const.h,v 3.11 1997/09/16 00:25:08 william Exp $ */ *************** *** 679,684 **** /* file stuff */ ! #define OBJ_FILE_SAVED 0 ! #define SYM_FILE_SAVED 1 /* xbm real_type */ --- 679,684 ---- /* file stuff */ ! #define OBJ_FILE_TYPE 0 ! #define SYM_FILE_TYPE 1 /* xbm real_type */ *** patchlvl.h.orig Tue Sep 30 13:25:51 1997 --- patchlvl.h Tue Sep 30 13:25:51 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/patchlvl.h,v 3.13 1997/01/30 04:43:53 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/patchlvl.h,v 3.15 1997/09/14 20:38:11 william Exp $ */ *************** *** 34,38 **** #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 13 #endif /*_TGIF_PATCHLEVEL_H_*/ --- 34,38 ---- #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 14 #endif /*_TGIF_PATCHLEVEL_H_*/ *** tgif_dbg.h.orig Tue Sep 30 13:25:52 1997 --- tgif_dbg.h Tue Sep 30 13:25:52 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif_dbg.h,v 3.1 1996/10/28 01:01:47 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif_dbg.h,v 3.2 1997/09/14 20:38:11 william Exp $ */ *** types.h.orig Tue Sep 30 13:25:53 1997 --- types.h Tue Sep 30 13:25:53 1997 *************** *** 2,6 **** * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1996, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without --- 2,6 ---- * Author: William Chia-Wei Cheng (william@cs.ucla.edu) * ! * Copyright (C) 1990-1997, William Chia-Wei Cheng. * * Permission limited to the use, copy, display, distribute without *************** *** 28,32 **** * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/types.h,v 3.5 1997/01/30 22:11:42 william Exp $ */ --- 28,32 ---- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/types.h,v 3.6 1997/09/14 20:38:12 william Exp $ */ *** Makefile.noimake.orig Tue Sep 30 13:25:54 1997 --- Makefile.noimake Tue Sep 30 13:25:54 1997 *************** *** 2,6 **** # Author: William Chia-Wei Cheng (william@cs.ucla.edu) # ! # Copyright (C) 1990-1996, William Chia-Wei Cheng. # # Permission limited to the use, copy, modify, and distribute this software --- 2,6 ---- # Author: William Chia-Wei Cheng (william@cs.ucla.edu) # ! # Copyright (C) 1990-1997, William Chia-Wei Cheng. # # Permission limited to the use, copy, modify, and distribute this software *************** *** 24,28 **** # PERFORMANCE OF THIS SOFTWARE. # ! # @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/Makefile.noimake,v 3.10 1997/01/30 04:45:09 william Exp $ # --- 24,28 ---- # PERFORMANCE OF THIS SOFTWARE. # ! # @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/Makefile.noimake,v 3.14 1997/09/15 19:01:50 william Exp $ # *************** *** 77,80 **** --- 77,84 ---- -D_BACKGROUND_DONT_FORK -D_USE_XDRAWPOINT_TO_PUT_A_POINT + #-D_METRIC_PIX_PER_INCH + # Include the above line if you want to use 127 pixels per inch + # when printing in the metric system. If this line is not + # included, 128 pixels per inch is used. #-D_NO_GETTIMEOFDAY # Include the above line if you do not have the gettimeofday() *************** *** 369,373 **** setup.e help.o: const.h tgif_dbg.h types.h patchlvl.h color.e dialog.e file.e \ ! help.e menu.e msg.e setup.e util.e version.e http.o: const.h tgif_dbg.h types.h patchlvl.h file.e http.e msg.e \ remote.e tcp.e util.e version.e --- 373,377 ---- setup.e help.o: const.h tgif_dbg.h types.h patchlvl.h color.e dialog.e file.e \ ! help.e menu.e msg.e navigate.e setup.e util.e version.e http.o: const.h tgif_dbg.h types.h patchlvl.h file.e http.e msg.e \ remote.e tcp.e util.e version.e *************** *** 511,520 **** ruler.e scroll.e select.e setup.e stk.e stretch.e util.e setup.o: const.h tgif_dbg.h types.h attr.e auxtext.e choice.e cmd.e \ ! color.e cursor.e drawing.e dup.e file.e font.e grid.e help.e \ ! imgproc.e import.e mainloop.e mainmenu.e mark.e menu.e move.e \ ! msg.e names.e page.e pattern.e ps.e raster.e remote.e ruler.e \ ! scroll.e select.e setup.e shape.e shortcut.e spline.e stk.e \ ! stretch.e text.e util.e xbitmap.e xpixmap.e tgificon.xbm \ ! xbm/btn1.xbm shape.o: const.h tgif_dbg.h types.h arc.e attr.e auxtext.e box.e cmd.e \ color.e cursor.e dialog.e drawing.e dup.e grid.e group.e \ --- 515,524 ---- ruler.e scroll.e select.e setup.e stk.e stretch.e util.e setup.o: const.h tgif_dbg.h types.h attr.e auxtext.e choice.e cmd.e \ ! color.e cursor.e dialog.e drawing.e dup.e file.e font.e \ ! grid.e help.e imgproc.e import.e mainloop.e mainmenu.e mark.e \ ! menu.e move.e msg.e names.e page.e pattern.e ps.e raster.e \ ! remote.e ruler.e scroll.e select.e setup.e shape.e shortcut.e \ ! spline.e stk.e stretch.e text.e util.e xbitmap.e xpixmap.e \ ! tgificon.xbm xbm/btn1.xbm shape.o: const.h tgif_dbg.h types.h arc.e attr.e auxtext.e box.e cmd.e \ color.e cursor.e dialog.e drawing.e dup.e grid.e group.e \ *************** *** 548,555 **** poly.e prtgif.e raster.e rect.e ruler.e scroll.e select.e \ setup.e stretch.e text.e util.e xpixmap.e ! tgif.o: const.h tgif_dbg.h types.h color.e file.e mainloop.e msg.e \ ! obj.e page.e setup.e util.e tgif_dbg.o: ! util.o: const.h tgif_dbg.h remote.e util.e version.o: vms_comp.o: vms_comp.h --- 552,559 ---- poly.e prtgif.e raster.e rect.e ruler.e scroll.e select.e \ setup.e stretch.e text.e util.e xpixmap.e ! tgif.o: const.h tgif_dbg.h types.h color.e file.e grid.e mainloop.e \ ! msg.e names.e obj.e page.e setup.e util.e tgif_dbg.o: ! util.o: const.h tgif_dbg.h types.h dialog.e file.e remote.e util.e version.o: vms_comp.o: vms_comp.h *** Imakefile.orig Tue Sep 30 13:25:56 1997 --- Imakefile Tue Sep 30 13:25:56 1997 *************** *** 10,14 **** XCOMM Author: William Chia-Wei Cheng (william@cs.ucla.edu) XCOMM ! XCOMM Copyright (C) 1990-1996, William Chia-Wei Cheng. XCOMM XCOMM Permission limited to the use, copy, display, distribute without --- 10,14 ---- XCOMM Author: William Chia-Wei Cheng (william@cs.ucla.edu) XCOMM ! XCOMM Copyright (C) 1990-1997, William Chia-Wei Cheng. XCOMM XCOMM Permission limited to the use, copy, display, distribute without *************** *** 36,40 **** XCOMM PERFORMANCE OF THIS SOFTWARE. XCOMM ! XCOMM @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/Imakefile,v 3.18 1997/01/30 05:41:56 william Exp $ XCOMM --- 36,40 ---- XCOMM PERFORMANCE OF THIS SOFTWARE. XCOMM ! XCOMM @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/Imakefile,v 3.19 1997/09/15 19:00:03 william Exp $ XCOMM *************** *** 45,49 **** XCOMM EXTRA_LDOPTIONS = ! TGIFVERSION = 3.0-p13 PROGRAMS = tgif prtgif XCOMM frontend11.o testdrive XCOMM CDEBUGFLAGS= -g --- 45,49 ---- XCOMM EXTRA_LDOPTIONS = ! TGIFVERSION = 3.0-p14 PROGRAMS = tgif prtgif XCOMM frontend11.o testdrive XCOMM CDEBUGFLAGS= -g *************** *** 79,82 **** --- 79,86 ---- SYS_LIBRARIES = -lm + XCOMM -D_METRIC_PIX_PER_INCH + XCOMM Include the above line if you want to use 127 pixels per inch + XCOMM when printing in the metric system. If this line is not + XCOMM included, 128 pixels per inch is used. XCOMM -D_NO_GETTIMEOFDAY XCOMM Include the above line if you do not have the gettimeofday() *** tgif.man.orig Tue Sep 30 13:25:57 1997 --- tgif.man Tue Sep 30 13:25:57 1997 *************** *** 1,9 **** .\" Tgif's man pages. .\" ! .\" @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif.man,v 3.10 1997/01/30 17:31:52 william Exp $ .\" .\" .\" ! .TH TGIF n "Version 3.0 Patchlevel 13 and Above" "Tgif" .\" .SH NAME --- 1,9 ---- .\" Tgif's man pages. .\" ! .\" @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif.man,v 3.15 1997/09/18 00:44:12 william Exp $ .\" .\" .\" ! .TH TGIF n "Version 3.0 Patchlevel 14 and Above" "Tgif" .\" .SH NAME *************** *** 40,45 **** [\fB-f\fR] [\fB-text\fR] [\fB-raw[+h]\fR] ! [\fB-dosepsfilter\fR] [\fB-status\fR] [\fB-gray\fR] --- 40,53 ---- [\fB-f\fR] [\fB-text\fR] + [\fB-epsi\fR] + [\fB-tiffepsi\fR] + [\fB-gif\fR] + [\fB-xpm\fR] + [\fB-xbm\fR] + [\fB-html\fR] + [\fB-display\fR displayname] + [\fB-stdout\fR] [\fB-raw[+h]\fR] ! [\fB-dosepsfilter\fR [\fB-previewonly\fR]] [\fB-status\fR] [\fB-gray\fR] *************** *** 52,56 **** [\fB-bop_hook ""\fR] [\fB-eop_hook ""\fR] ! [\fB-o\fRdir] [\fIfile1\fR \fIfile2\fR ...] .\" --- 60,65 ---- [\fB-bop_hook ""\fR] [\fB-eop_hook ""\fR] ! [\fB-tmp_file_mode ""\fR] ! [\fB-o\fR] [\fIfile1\fR \fIfile2\fR ...] .\" *************** *** 59,69 **** \fITgif\fR is an interactive drawing tool that allows the user to draw and manipulate objects in the X Window System. Tgif runs interactively in ! the first form. In the second form, tgif just prints files without ! opening windows or fonts, and it is compatible with ! the obsoleted \fIprtgif\fR. ! .PP ! In the first form, the command line arguments ! \fI-fg\fR, \fI-bg\fR, and \fI-bd\fR specify ! the foreground, background, and border colors, respectively. The command line argument \fIfile\fR specifies a file or an Uniform Resource Locator (URL) of --- 68,88 ---- \fITgif\fR is an interactive drawing tool that allows the user to draw and manipulate objects in the X Window System. Tgif runs interactively in ! the first form. ! In the second form shown in the SYNOPSIS section, ! tgif just prints \fIfile1.obj\fR, \fIfile2.obj\fR, ! etc. (generated by \fItgif\fR) ! into PostScript(TM) page description files ! (without opening windows or fonts) ! 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-xpm\fR, \fB-xbm\fR, \fB-html\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, ! any other unrecognized command line options are sent to lpr(1). ! In this mode, tgif is compatible with the obsoleted \fIprtgif\fR. ! A symbol file (see descriptions below) can also be printed by ! specifying the \fI.sym\fR extension explicitly. ! .PP The command line argument \fIfile\fR specifies a file or an Uniform Resource Locator (URL) of *************** *** 72,151 **** (For a more detailed description of URL and the World-Wide-Web, the reader is referred to [1].) ! If \fI-rv\fR (or \fI-nv\fR) is specified, tgif will come up ! in reverse-video (or normal-video) mode. ! If \fI-bw\fR is specified, tgif will come up in the black and white mode. ! Using \fI-reqcolor\fR has the same effect as setting the Tgif.PrintUsingRequestedColor X default to true (see the X DEFAULTS section below). ! If \fI-cwo\fR is specified, only the canvas window (see TGIF SUBWINDOWS section below) will be displayed. This has the same effect as setting the Tgif.CanvasWindowOnly X default to true. ! If \fI-hyper\fR is specified tgif will be started in the \fIhyperspace\fR mode (see HYPERSPACE section below). - Tgif is purely based on \fIXlib\fR. - It is tested under X11R6, and - it requires a 3 button mouse. .PP ! In the second form, tgif prints \fIfile1.obj\fR, \fIfile2.obj\fR, ! etc. (generated by \fItgif\fR) ! into PostScript(TM) page description files ! and pipes them to lpr(1) if none of the ! \fB-eps\fR, \fB-p\fR, \fB-ps\fR, \fB-f\fR, or \fB-text\fR options ! are specified. In this case, ! any other unrecognized command line options are sent to lpr(1). ! A symbol file (see descriptions below) can also be printed by ! specifying the \fI.sym\fR extension explicitly. ! .PP ! In the second form, ! if the \fB-eps\fR or the \fB-p\fR option is specified, ! tgif generates an Encapsulated PostScript(TM) file in \fIfile.eps\fR; ! this file is supposed to be included in a LaTeX file through the \\psfig, \\epsf, or \\psfile construct (see the LATEX FIGURE FORMATS section below). ! If the \fB-ps\fR or the \fB-f\fR option is specified, ! it generates a PostScript file in \fIfile.ps\fR; this file can be printed to a PostScript printer with lpr(1). ! If the \fB-text\fR option is specified, ! it generates a text file in \fIfile.txt\fR; the text file contains all visible text and can be fed to a spell checker. ! (Note that if any of the \fB-eps\fR, \fB-p\fR, \fB-ps\fR, ! \fB-f\fR, or \fB-text\fR options are specified, ! any other command line options are ignored.) ! Using the \fI-raw\fR option causes the content of ! the files to be dumped to stdout. ! If \fI-raw+h\fR is used and if the file is an HTTP URL, the HTTP header is also dumped to stdout. ! Using the \fI-dosepsfilter\fR option makes tgif act as a filter for ! gettting rid of the DOS EPS Binary File Header and the trailing TIFF image in a DOS/Windows EPS file. ! Using the \fI-status\fR option inconjunction with either ! \fI-raw\fR or \fI-raw+h\fR causes a status line to be displayed in stderr. ! Using the \fI-gray\fR option has the same effect as setting the Tgif.UseGrayScale X default to true (see the X DEFAULTS section below). ! To print in color, one can use either the \fI-color\fR or the \fI-reqcolor\fR option. The only difference between the two is that using ! \fI-reqcolor\fR has the same effect as setting the Tgif.PrintUsingRequestedColor X default to true (see the X DEFAULTS section below). ! Using the \fI-adobe\fR or the \fI-adobe=/\fR ! option has the same effect as specifying the Tgif.UsePsAdobeString X default. ! Using the \fI-page\fR option causes a specified page to be printed. ! Using the \fI-print_cmd\fR option has the same effect as specifying the Tgif.PrintCommand X default. ! Using the \fI-one_file_per_page\fR option causes each page to be ! printed into a separate file. ! Using the \fI-pepsc\fR (PreserveEPSComment) option has the same effect as setting the Tgif.StripEPSComment X default to false. ! Using the \fI-bop_hook\fR and -fI-eop_hook\fR options have the same effect as specifying the Tgif.PSBopHook and Tgif.PSEpsHook X defaults. ! If the \fI-o\fR option is not specified, the output file (eps, ps, or txt) ! goes into the same directory as the input file. If \fI-o\fRdir is specified, the output file goes into the directory specified ! by \fIdir\fR. ! .PP ! Please note that only running tgif interactively can generate X11 bitmap ! (XBM), ! X11 pixmap (XPM), GIF, HTML, or color PostScript/EPS files. .\" .SH BASIC FUNCTIONALITIES --- 91,248 ---- (For a more detailed description of URL and the World-Wide-Web, the reader is referred to [1].) ! .PP ! Tgif is purely based on \fIXlib\fR. ! It is tested under X11R6, and ! it requires a 3 button mouse. ! .\" ! .SH OPTIONS ! .\" ! In the first form shown in the SYNOPSIS section, ! the command line arguments can be: ! .TP ! .B -fg ! Foreground color specified in . ! .TP ! .B -bg ! Background color specified in . ! .TP ! .B -bd ! Border color specified in . ! .TP ! .B -rv ! Start tgif in reversed-video mode. ! .TP ! .B -nv ! Start tgif in normal-video mode. ! .TP ! .B -nv ! Start tgif in black and white mode. ! .TP ! .B -reqcolor ! Same effect as setting the Tgif.PrintUsingRequestedColor X default to true (see the X DEFAULTS section below). ! .TP ! .B -cwo ! Canvas Window Only. Only the canvas window (see TGIF SUBWINDOWS section below) will be displayed. This has the same effect as setting the Tgif.CanvasWindowOnly X default to true. ! .TP ! .B -hyper ! Start tgif in the \fIhyperspace\fR mode (see HYPERSPACE section below). .PP ! In the second form shown in the SYNOPSIS section, ! the command line arguments can be: ! .TP ! .B -eps \fR(or\fB -p\fR)\fB ! Generates an Encapsulated PostScript(TM) file in \fIfile.eps\fR; ! this file can be included in a LaTeX file through the \\psfig, \\epsf, or \\psfile construct (see the LATEX FIGURE FORMATS section below). ! .TP ! .B -ps \fR(or\fB -f\fR)\fB ! Generates a PostScript file in \fIfile.ps\fR; this file can be printed to a PostScript printer with lpr(1). ! .TP ! .B -text ! Generates a text file in \fIfile.txt\fR; the text file contains all visible text and can be fed to a spell checker. ! .TP ! .B -epsi ! Generates an Encapsulated PostScript (EPS) file with a preview bitmap ! in \fIfile.eps\fR. ! Tgif aborts if a valid display is not accessible. ! .TP ! .B -tiffepsi ! Generates an EPS file with a ! DOS EPS Binary File Header and a trailing TIFF image in \fIfile.eps\fR. ! See the GENERATING MICROSOFT WINDOWS EPSI FILES section for more details. ! Tgif aborts if a valid display is not accessible. ! .TP ! .B -gif ! Generates a GIF file in \fIfile.gif\fR. ! Please see the notes for Tgif.GifToXpm 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. ! Tgif aborts if a valid display is not accessible. ! .TP ! .B -xbm ! Generates an X11 bitmap (XBM) file in \fIfile.xbm\fR. ! Tgif aborts if a valid display is not accessible. ! .TP ! .B -html ! Generates a GIF file in \fIfile.gif\fR and an HTML file in \fIfile.html\fR. ! Tgif aborts if a valid display is not accessible. ! .TP ! .B -stdout ! Sends the output to the standard output instead of generating the ! output in a file. ! .TP ! .B -raw ! Causes the content of the files to be dumped to stdout. ! .TP ! .B -raw+h ! If \fB-raw+h\fR is used and if the file is an HTTP URL, the HTTP header is also dumped to stdout. ! .TP ! .B -dosepsfilter ! Makes tgif act as a filter for gettting rid of the ! DOS EPS Binary File Header and the trailing TIFF image in a DOS/Windows EPS file. ! .TP ! .B -previewonly ! If \fB-dosepsfilter\fR is specified, \fB-previewonly\fR makes tgif ! act as a filter for extracting the preview bitmap ! from the trailing TIFF image in a DOS/Windows EPS file. ! .TP ! .B -status ! If this option is used in conjunction with either ! \fB-raw\fR or \fB-raw+h\fR causes a status line to be displayed in stderr. ! .TP ! .B -gray ! Using this option has the same effect as setting the Tgif.UseGrayScale X default to true (see the X DEFAULTS section below). ! .TP ! .B -color \fR(or\fB -reqcolor\fR)\fB ! To print in color, one can use either the \fB-color\fR or the \fB-reqcolor\fR option. The only difference between the two is that using ! \fB-reqcolor\fR has the same effect as setting the Tgif.PrintUsingRequestedColor X default to true (see the X DEFAULTS section below). ! .TP ! .B -adobe \fR(or\fB -adobe=/\fR)\fB ! Using this option has the same effect as specifying the Tgif.UsePsAdobeString X default. ! .TP ! .B -page ! Causes a specified page (specified by ) to be printed. ! .TP ! .B -print_cmd ! Using this option has the same effect as specifying the Tgif.PrintCommand X default. ! .TP ! .B -one_file_per_page ! Causes each page to be printed into a separate file. ! .TP ! .B -pepsc ! Preserve EPS Comment. Using option has the same effect as setting the Tgif.StripEPSComment X default to false. ! .TP ! .B -bop_hook \fRand\fB -eop_hook ! Using these options have the same effect as specifying the Tgif.PSBopHook and Tgif.PSEpsHook X defaults. ! .TP ! .B -tmp_file_mode ! Using this option have the same effect ! as specifying the Tgif.TmpFileMode X defaults. ! .TP ! .B -o ! If this option is not specified, the output file (eps, ps, etc.) ! goes into the same directory as the input file. If \fB-o\fRdir is specified, the output file goes into the directory specified ! by \fB\fR. .\" .SH BASIC FUNCTIONALITIES *************** *** 654,658 **** Clicking the right mouse button in a pinned menu will cause it to disappear. Dragging ! the left mouse button in a pinned menu will reposition the menu. Clicking the middle mouse button in it will activate the item right below the mouse. --- 751,758 ---- Clicking the right mouse button in a pinned menu will cause it to disappear. Dragging ! the left mouse button in a pinned menu will reposition the menu ! (except when the Tgif.TitledPinnedMenu X default is set to true ! in which case the left mouse button performs the same function ! as the middle mouse button). Clicking the middle mouse button in it will activate the item right below the mouse. *************** *** 1460,1464 **** .I substr(,,,) This command copies characters, starting from the character index ! , of into . .TP .I strstr(,,) --- 1560,1564 ---- .I substr(,,,) This command copies characters, starting from the character index ! , of into . The is zero-based. .TP .I strstr(,,) *************** *** 1682,1685 **** --- 1782,1811 ---- This command puts a "1" in the attribute specified by if the file specified by exists. It puts a "0" otherwise. + .TP + .I index(,,) + This command finds the first occurrence of in and + copies the zero-based index into . + .TP + .I rindex(,,) + This command finds the last occurrence of in and + copies the zero-based index into . + .TP + .I get_number_of_lines_in_attr(,) + This command counts the number of lines in the attribute specified by + and writes the count into . + .TP + .I get_line_in_attr(,,) + This command copies the \fIn\fRth line of the attribute specified by + into , where \fIn\fR is a zero-based index + specified by . + .TP + .I trim() + This command removes leading and trailing blank characters from + the attribute specified by . + .TP + .I is_attr(,) + This command writes a "1" into if the attribute + specified by exists. It writes a "0" into + otherwise. .\" .SH ARITHMETIC EXPRESSIONS *************** *** 3343,3346 **** --- 3469,3489 ---- This X default is only enabled if Tgif.UseWMIcon is set to true. The default value is ``tgificon.xbm'' (which is compiled into tgif). + .TP + .I Tgif.TmpFileMode: NUMBER (OCTAL) + This specifies file mode for temporary and exported files. + NUMBER must be an octal number. If NUMBER is 0, no attempt is made to + change the file mode. If this value is specified (even if it's 0), it + overrides the PSFILE_MOD compile option. + There is no default value. + .TP + .I Tgif.TitledPinnedMenu: [true,false] + If set to ``true'', pinned menu will have a title bar and left button + is used for selecting menu items in a pinned menu. + The default is false. + .TP + .I Tgif.ColorFromXPixmap: STRING + STRING specifies the path of an XPM file to be used to load the initial + colors. If this X default is specified, the Tgif.Color# X defaults are + ignored. .\" .SH ENVIRONMENT VARIABLE *** tgif.pl.orig Tue Sep 30 13:25:59 1997 --- tgif.pl Tue Sep 30 13:25:59 1997 *************** *** 2,28 **** % Author: William Chia-Wei Cheng (william@cs.ucla.edu) % ! % Copyright (C) 1992-1993, William Cheng. % ! % Permission limited to the use, copy, modify, and distribute this software ! % and its documentation for any purpose is hereby granted by the Author without ! % fee, provided that the above copyright notice appear in all copies and ! % that both the copyright notice and this permission notice appear in ! % supporting documentation, and that the name of the Author not be used ! % in advertising or publicity pertaining to distribution of the software ! % without specific, written prior permission. The Author makes no ! % representations about the suitability of this software for any purpose. ! % It is provided "as is" without express or implied warranty. All other ! % rights (including the right to sell "tgif" and the right to sell derivative ! % works of tgif) are reserved by the Author. % % THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, ! % INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO ! % EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR ! % CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF ! % USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ! % OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ! % PERFORMANCE OF THIS SOFTWARE. % ! % @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif.pl,v 3.1 1996/05/31 00:39:45 william Exp $ % --- 2,32 ---- % Author: William Chia-Wei Cheng (william@cs.ucla.edu) % ! % Copyright (C) 1992-1997, William Chia-Wei Cheng. % ! % Permission limited to the use, copy, display, distribute without ! % charging for a fee, and produce derivative works of "tgif" and ! % its documentation for not-for-profit purpose is hereby granted by ! % the Author, provided that the above copyright notice appears in ! % all copies made of "tgif" and that both the copyright notice ! % and this permission notice appear in supporting documentation, ! % and that the name of the Author not be used in advertising or ! % publicity pertaining to distribution of the software without ! % specific, written prior permission. The Author makes no ! % representations about the suitability of this software for any ! % purpose. It is provided "as is" without express or implied ! % warranty. All other rights (including, but not limited to, the ! % right to sell "tgif", the right to sell derivative works of ! % "tgif", and the right to distribute "tgif" for a fee) are ! % reserved by the Author. % % THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, ! % INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, ! % IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT ! % OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ! % LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, ! % NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN ! % CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. % ! % @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif.pl,v 3.3 1997/09/14 20:55:24 william Exp $ % *** HISTORY.orig Tue Sep 30 13:26:01 1997 --- HISTORY Tue Sep 30 13:26:01 1997 *************** *** 1,2 **** --- 1,50 ---- + -----------------------> tgif-3.0-p13 => tgif-3.0-p14 <----------------------- + Here's a short list of added features/bug fixes. + + 1) Fix a bug in rotating shapes. Thanks to Shinichiro Shiratake + for pointing out the problem. + 2) Fix a bug in Move/JustifyAttr where an attribute name becomes visible + when it should not. Thanks to Heinz Appoyer + for pointing out the problem. + 3) Fix a bug in navigating back. Thanks to Scott W. Turner + for pointing out the problem. + 4) Fix a bug in Find functions to remove the "Undo()/Redo() may crash Tgif" + message. + 5) Fix a memory leak problem in printing EPS objects. Thanks to + Kazuhiko Sumi for the patch. + 6) Add support for "-gif", "-xpm", "-xbm", "-html", "-epsi", and "-tiffepsi" + command line options to work with the "-print" command line options. + Please note that these options require an X server to be accessible + (which can be specified by the "-display" command line option). + Support for "-stdout" command line option is also added. + 7) Add support for the "-previewonly" command line options to work with the + "-print -dosepsfilter" command line options. This makes tgif act as a + filter for extracting the preview bitmap from the trailing TIFF image in + a DOS/Windows EPS file. + 8) Add a new X resource, Tgif.ColorFromXPixmap, to specify an XPM file + to be used to load the initial colors. If this X resource is specified, + the Tgif.Color# X resources are ignored. + 9) Add a new X resource, Tgif.TitledPinnedMenu, so that pinned menu can + have a title bar and left button to be used for selecting menu items + in a pinned menu. + 10) Add a new X resource, Tgif.TmpFileMode, to specify a file mode for + temporary and exported files. A new command option -tmp_file_mode + is also added and recognized when -print is used. These values + overrides the PSFILE_MOD compile option. + 11) Add new internal commands: + + index(,,) + rindex(,,) + get_number_of_lines_in_attr(,) + get_line_in_attr(,,) + trim() + is_attr(,) + + 12) Add support for a new compile option -D_METRIC_PIX_PER_INCH to use + 127 pixels per inch when printing in the metric system to fix round-off + problems (pointed out by Graham Titmus ). + By default, tgif uses 128 pixels per inch. + 13) Handle multiple objects in UpdateEPS(). + -----------------------> tgif-3.0-p12 => tgif-3.0-p13 <----------------------- Here's a short list of added features/bug fixes. *************** *** 256,259 **** /* ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/HISTORY,v 3.16 1997/01/31 00:13:52 william Exp $ */ --- 304,307 ---- /* ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/HISTORY,v 3.17 1997/09/30 17:19:02 william Exp $ */ *** descrip.mms.orig Tue Sep 30 13:26:02 1997 --- descrip.mms Tue Sep 30 13:26:02 1997 *************** *** 6,10 **** ! $ DEFINE SYS SYS$LIBRARY ! ! ! @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/descrip.mms,v 3.9 1997/01/30 04:45:34 william Exp $ ! --- 6,10 ---- ! $ DEFINE SYS SYS$LIBRARY ! ! ! @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/descrip.mms,v 3.12 1997/09/14 20:59:34 william Exp $ ! *************** *** 264,268 **** select.e,setup.e help.obj depends_on help.c,const.h,tgif_dbg.h,types.h,patchlvl.h,color.e,- ! dialog.e,file.e,help.e,menu.e,msg.e,setup.e,util.e,version.e http.obj depends_on http.c,const.h,tgif_dbg.h,types.h,patchlvl.h,file.e,http.e,- msg.e,remote.e,tcp.e,util.e,version.e --- 264,269 ---- select.e,setup.e help.obj depends_on help.c,const.h,tgif_dbg.h,types.h,patchlvl.h,color.e,- ! dialog.e,file.e,help.e,menu.e,msg.e,navigate.e,setup.e,util.e,- ! version.e http.obj depends_on http.c,const.h,tgif_dbg.h,types.h,patchlvl.h,file.e,http.e,- msg.e,remote.e,tcp.e,util.e,version.e *************** *** 410,419 **** util.e setup.obj depends_on setup.c,const.h,tgif_dbg.h,types.h,attr.e,auxtext.e,- ! choice.e,cmd.e,color.e,cursor.e,drawing.e,dup.e,file.e,font.e,- ! grid.e,help.e,imgproc.e,import.e,mainloop.e,mainmenu.e,mark.e,- ! menu.e,move.e,msg.e,names.e,page.e,pattern.e,ps.e,raster.e,- ! remote.e,ruler.e,scroll.e,select.e,setup.e,shape.e,shortcut.e,- ! spline.e,stk.e,stretch.e,text.e,util.e,xbitmap.e,xpixmap.e,- ! tgificon.xbm,xbm/btn1.xbm shape.obj depends_on shape.c,const.h,tgif_dbg.h,types.h,arc.e,attr.e,auxtext.e,- box.e,cmd.e,color.e,cursor.e,dialog.e,drawing.e,dup.e,grid.e,- --- 411,420 ---- util.e setup.obj depends_on setup.c,const.h,tgif_dbg.h,types.h,attr.e,auxtext.e,- ! choice.e,cmd.e,color.e,cursor.e,dialog.e,drawing.e,dup.e,- ! file.e,font.e,grid.e,help.e,imgproc.e,import.e,mainloop.e,- ! mainmenu.e,mark.e,menu.e,move.e,msg.e,names.e,page.e,pattern.e,- ! ps.e,raster.e,remote.e,ruler.e,scroll.e,select.e,setup.e,- ! shape.e,shortcut.e,spline.e,stk.e,stretch.e,text.e,util.e,- ! xbitmap.e,xpixmap.e,tgificon.xbm,xbm/btn1.xbm shape.obj depends_on shape.c,const.h,tgif_dbg.h,types.h,arc.e,attr.e,auxtext.e,- box.e,cmd.e,color.e,cursor.e,dialog.e,drawing.e,dup.e,grid.e,- *************** *** 449,456 **** obj.e,pattern.e,poly.e,prtgif.e,raster.e,rect.e,ruler.e,- scroll.e,select.e,setup.e,stretch.e,text.e,util.e,xpixmap.e ! tgif.obj depends_on tgif.c,const.h,tgif_dbg.h,types.h,color.e,file.e,- ! mainloop.e,msg.e,obj.e,page.e,setup.e,util.e tgif_dbg.obj depends_on tgif_dbg.c ! util.obj depends_on util.c,const.h,tgif_dbg.h,remote.e,util.e version.obj depends_on version.c vms_comp.obj depends_on vms_comp.c, vms_comp.h --- 450,458 ---- obj.e,pattern.e,poly.e,prtgif.e,raster.e,rect.e,ruler.e,- scroll.e,select.e,setup.e,stretch.e,text.e,util.e,xpixmap.e ! tgif.obj depends_on tgif.c,const.h,tgif_dbg.h,types.h,color.e,file.e,grid.e,- ! mainloop.e,msg.e,names.e,obj.e,page.e,setup.e,util.e tgif_dbg.obj depends_on tgif_dbg.c ! util.obj depends_on util.c,const.h,tgif_dbg.h,types.h,dialog.e,file.e,remote.e,- ! util.e version.obj depends_on version.c vms_comp.obj depends_on vms_comp.c, vms_comp.h *** tgif.Xdefaults.orig Tue Sep 30 13:26:03 1997 --- tgif.Xdefaults Tue Sep 30 13:26:03 1997 *************** *** 7,11 **** ! identical to the default values used in tgif. ! ! ! @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif.Xdefaults,v 3.4 1996/12/18 20:27:04 william Exp $ ! Tgif.Geometry: 640x512-40+20 --- 7,11 ---- ! identical to the default values used in tgif. ! ! ! @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/tgif.Xdefaults,v 3.8 1997/09/15 22:48:49 william Exp $ ! Tgif.Geometry: 640x512-40+20 *************** *** 307,308 **** --- 307,312 ---- Tgif.EditTextSize: 0 !Tgif.EditTextSize: 14 + !Tgif.IconPixmap: /usr/local/lib/X11/tgif/tgificon.xpm + Tgif.TmpFileMode: 0664 + Tgif.TitledPinnedMenu: true + !Tgif.ColorFromXPixmap: /usr/local/lib/X11/tgif/tgificon.xpm *** Copyright.orig Tue Sep 30 13:26:04 1997 --- Copyright Tue Sep 30 13:26:04 1997 *************** *** 1,3 **** ! Copyright (C) 1990-1996, William Chia-Wei Cheng This file is part of "tgif". --- 1,3 ---- ! Copyright (C) 1990-1997, William Chia-Wei Cheng This file is part of "tgif". *************** *** 24,27 **** /* ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/Copyright,v 3.0 1996/05/06 16:03:16 william Exp $ */ --- 24,27 ---- /* ! * @(#)$Header: /u/halfmoon/home/william/src/tgif/v3/RCS/Copyright,v 3.1 1997/03/08 21:12:20 william Exp $ */