*** align.c.orig Wed May 19 10:26:25 1999 --- align.c Wed May 19 10:26:25 1999 *************** *** 229,243 **** if (obj_ptr->marked) { count++; ! tmp_sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (tmp_sel_ptr == NULL) FailAllocMessage(); ! tmp_sel_ptr->obj = obj_ptr; ! tmp_sel_ptr->prev = tmp_bot_sel; ! tmp_sel_ptr->next = NULL; ! if (tmp_bot_sel == NULL) { ! tmp_top_sel = tmp_sel_ptr; ! } else { ! tmp_bot_sel->next = tmp_sel_ptr; ! } ! tmp_bot_sel = tmp_sel_ptr; } } --- 229,234 ---- if (obj_ptr->marked) { count++; ! AddObjIntoSel(obj_ptr, tmp_bot_sel, NULL, &tmp_top_sel, ! &tmp_bot_sel); } } *************** *** 1249,1257 **** void AlignSelToGrid() { ! register int x=0, y=0, i; ! struct ObjRec *obj_ptr; ! struct SelRec *sel_ptr; ! struct VSelRec *vsel_ptr; int grid_x, grid_y, dx, dy, ltx, lty, rbx, rby, auto_justifiable; if (topSel == NULL && topVSel == NULL) return; --- 1240,1249 ---- void AlignSelToGrid() { ! int x=0, y=0, i; ! struct ObjRec *obj_ptr=NULL; ! struct SelRec *sel_ptr=NULL; ! struct VSelRec *vsel_ptr=NULL; int grid_x, grid_y, dx, dy, ltx, lty, rbx, rby, auto_justifiable; + int saved_draw_orig_x=0, saved_draw_orig_y=0; if (topSel == NULL && topVSel == NULL) return; *************** *** 1276,1279 **** --- 1268,1277 ---- } PrepareToReplaceAnObj(obj_ptr); + + saved_draw_orig_x = drawOrigX; + saved_draw_orig_y = drawOrigY; + + drawOrigX = drawOrigY = 0; + for (i = 0; i < vsel_ptr->n; i++) { if (horiAlign!=ALIGN_N && horiAlign!=ALIGN_S) x = vsel_ptr->x[i]; *************** *** 1305,1308 **** --- 1303,1309 ---- } } + drawOrigX = saved_draw_orig_x; + drawOrigY = saved_draw_orig_y; + if (changed) { AdjObjSplineVs(obj_ptr); *************** *** 1365,1368 **** --- 1366,1374 ---- case ALIGN_B: y = obj_ptr->obbox.rby; break; } + saved_draw_orig_x = drawOrigX; + saved_draw_orig_y = drawOrigY; + + drawOrigX = drawOrigY = 0; + if (zoomedIn) { GridXY(ZOOMED_SIZE(x), ZOOMED_SIZE(y), &grid_x, &grid_y); *************** *** 1369,1373 **** if (horiAlign==ALIGN_N || horiAlign==ALIGN_S) x = ABS_SIZE(grid_x); if (vertAlign==ALIGN_N || vertAlign==ALIGN_S) y = ABS_SIZE(grid_y); ! dx = ABS_SIZE(grid_x) - x; dy = ABS_SIZE(grid_y) - y; --- 1375,1379 ---- if (horiAlign==ALIGN_N || horiAlign==ALIGN_S) x = ABS_SIZE(grid_x); if (vertAlign==ALIGN_N || vertAlign==ALIGN_S) y = ABS_SIZE(grid_y); ! dx = ABS_SIZE(grid_x) - x; dy = ABS_SIZE(grid_y) - y; *************** *** 1380,1383 **** --- 1386,1392 ---- dy = ABS_SIZE(grid_y) - y; } + drawOrigX = saved_draw_orig_x; + drawOrigY = saved_draw_orig_y; + if (dx != 0 || dy != 0) { if (auto_justifiable) { *** arc.c.orig Wed May 19 10:26:26 1999 --- arc.c Wed May 19 10:26:27 1999 *************** *** 1879,1887 **** int xc, yc, x1, y1, x2, y2, dir, angle1, angle2; int invisible=FALSE, transformed=FALSE; - #ifdef _TGIF_WB - char aux[10000]; - - strcpy(aux,Inbuf); - #endif /* _TGIF_WB */ *ObjPtr = NULL; --- 1879,1882 ---- *************** *** 2183,2200 **** struct XfrmMtrxRec *ctm; - #ifdef _TGIF_WB - - s = FindChar ((int)'[', aux); - s++; - if (!bufferAsFileForWhiteBoard) { - fgets(inbuf, MAXSTRING, FP); - } - - #else /* ~_TGIF_WB */ - fgets(inbuf, MAXSTRING, FP); - - #endif /* _TGIF_WB */ - scanLineNum++; InitScan(inbuf, "\t\n, "); --- 2178,2182 ---- *** attr.c.orig Wed May 19 10:26:28 1999 --- attr.c Wed May 19 10:26:28 1999 *************** *** 191,195 **** if (AttrPtr->nameshown) { ! ParseAttrStr(TextPtr->minilines.first->first_block->seg->dyn_str.s, name, sizeof(name), value, sizeof(value)); DynStrSet(&AttrPtr->attr_value, value); --- 191,195 ---- if (AttrPtr->nameshown) { ! ParseAttrStr(GetTextPtrFirstStrSeg(TextPtr)->dyn_str.s, name, sizeof(name), value, sizeof(value)); DynStrSet(&AttrPtr->attr_value, value); *************** *** 196,204 **** DynStrSet(&AttrPtr->attr_name, name); strcat(name, value); ! DynStrSet(&TextPtr->minilines.first->first_block->seg->dyn_str, name); } else { ! strcpy(value, TextPtr->minilines.first->first_block->seg->dyn_str.s); DynStrSet(&AttrPtr->attr_value, value); ! DynStrSet(&TextPtr->minilines.first->first_block->seg->dyn_str, value); } UpdTextBBox(AttrPtr->obj); --- 196,204 ---- DynStrSet(&AttrPtr->attr_name, name); strcat(name, value); ! DynStrSet(&GetTextPtrFirstStrSeg(TextPtr)->dyn_str, name); } else { ! strcpy(value, GetTextPtrFirstStrSeg(TextPtr)->dyn_str.s); DynStrSet(&AttrPtr->attr_value, value); ! DynStrSet(&GetTextPtrFirstStrSeg(TextPtr)->dyn_str, value); } UpdTextBBox(AttrPtr->obj); *************** *** 279,283 **** text_ptr->cached_bitmap = None; ! pStrSeg = text_ptr->minilines.first->first_block->seg; DynStrSet(&pStrSeg->dyn_str, s); --- 279,283 ---- text_ptr->cached_bitmap = None; ! pStrSeg = GetTextPtrFirstStrSeg(text_ptr); DynStrSet(&pStrSeg->dyn_str, s); *************** *** 405,409 **** text_ptr = TextObjPtr->detail.t; ! ParseAttrStr(text_ptr->minilines.first->first_block->seg->dyn_str.s, name, sizeof(name), value, sizeof(value)); topAttr = ObjPtr->fattr; --- 405,409 ---- text_ptr = TextObjPtr->detail.t; ! ParseAttrStr(GetTextPtrFirstStrSeg(text_ptr)->dyn_str.s, name, sizeof(name), value, sizeof(value)); topAttr = ObjPtr->fattr; *************** *** 503,507 **** if (fprintf(FP, "attr(\"") == EOF) writeFileFailed = TRUE; ! if (text_ptr->minilines.first->first_block->seg->double_byte) { SaveDoubleByteString(FP, AttrPtr->attr_name.s); } else { --- 503,507 ---- if (fprintf(FP, "attr(\"") == EOF) writeFileFailed = TRUE; ! if (GetTextPtrFirstStrSeg(text_ptr)->double_byte) { SaveDoubleByteString(FP, AttrPtr->attr_name.s); } else { *************** *** 509,513 **** } if (fprintf(FP, "\", \"") == EOF) writeFileFailed = TRUE; ! if (text_ptr->minilines.first->first_block->seg->double_byte) { SaveDoubleByteString(FP, AttrPtr->attr_value.s); } else { --- 509,513 ---- } if (fprintf(FP, "\", \"") == EOF) writeFileFailed = TRUE; ! if (GetTextPtrFirstStrSeg(text_ptr)->double_byte) { SaveDoubleByteString(FP, AttrPtr->attr_value.s); } else { *************** *** 698,703 **** int len1=0, len2=0; char buf[MAXSTRING+1]; ! struct DynStrRec *dest_dyn_str= ! (&ObjPtr->detail.t->minilines.first->first_block->seg->dyn_str); DynStrCpy(dest_dyn_str, &AttrPtr->attr_name); --- 698,702 ---- int len1=0, len2=0; char buf[MAXSTRING+1]; ! struct DynStrRec *dest_dyn_str=(&GetTextObjFirstStrSeg(ObjPtr)->dyn_str); DynStrCpy(dest_dyn_str, &AttrPtr->attr_name); *************** *** 926,930 **** attr_ptr->nameshown = FALSE; DynStrCpy( ! &text_ptr->minilines.first->first_block->seg->dyn_str, &attr_ptr->attr_value); UpdTextBBox(attr_ptr->obj); --- 925,929 ---- attr_ptr->nameshown = FALSE; DynStrCpy( ! &GetTextPtrFirstStrSeg(text_ptr)->dyn_str, &attr_ptr->attr_value); UpdTextBBox(attr_ptr->obj); *************** *** 1150,1154 **** struct TextRec *text_ptr=AttrPtr->obj->detail.t; ! DynStrCpy(&text_ptr->minilines.first->first_block->seg->dyn_str, &AttrPtr->attr_value); } --- 1149,1153 ---- struct TextRec *text_ptr=AttrPtr->obj->detail.t; ! DynStrCpy(&GetTextPtrFirstStrSeg(text_ptr)->dyn_str, &AttrPtr->attr_value); } *************** *** 1919,1923 **** if ((blank_str && text_ptr->minilines.first==text_ptr->minilines.last) || ! strcmp(text_ptr->minilines.first->first_block->seg->dyn_str.s, entries[i]) != 0) { modified = TRUE; --- 1918,1922 ---- if ((blank_str && text_ptr->minilines.first==text_ptr->minilines.last) || ! strcmp(GetTextPtrFirstStrSeg(text_ptr)->dyn_str.s, entries[i]) != 0) { modified = TRUE; *************** *** 1928,1932 **** FreeAttr(attr_ptr); } else { ! DynStrSet(&text_ptr->minilines.first->first_block->seg->dyn_str, entries[i]); UpdateAttr(text_ptr, attr_ptr); --- 1927,1931 ---- FreeAttr(attr_ptr); } else { ! DynStrSet(&GetTextPtrFirstStrSeg(text_ptr)->dyn_str, entries[i]); UpdateAttr(text_ptr, attr_ptr); *************** *** 2021,2025 **** attr_ptr->nameshown = check_array.value[NSHOWN_COL][i]; saved_nameshown = attr_ptr->nameshown; ! DynStrSet(&text_ptr->minilines.first->first_block->seg->dyn_str, entries[i]); attr_ptr->nameshown = TRUE; --- 2020,2024 ---- attr_ptr->nameshown = check_array.value[NSHOWN_COL][i]; saved_nameshown = attr_ptr->nameshown; ! DynStrSet(&GetTextPtrFirstStrSeg(text_ptr)->dyn_str, entries[i]); attr_ptr->nameshown = TRUE; *** auxtext.c.orig Wed May 19 10:26:30 1999 --- auxtext.c Wed May 19 10:26:30 1999 *************** *** 54,57 **** --- 54,58 ---- #include "rect.e" #include "setup.e" + #include "select.e" #include "text.e" #include "util.e" *************** *** 570,576 **** { struct TextRec *text_ptr=ObjPtr->detail.t; ! int read_only=FALSE, saved_baseline_y=text_ptr->baseline_y; ! #ifdef _TGIF_DBG if (PRTGIF && !cmdLineOpenDisplay) { fprintf(stderr, "UpdTextBBox() called in PRTGIF!\n"); --- 571,578 ---- { struct TextRec *text_ptr=ObjPtr->detail.t; ! int read_only=FALSE; #ifdef _TGIF_DBG + int saved_baseline_y=text_ptr->baseline_y; + if (PRTGIF && !cmdLineOpenDisplay) { fprintf(stderr, "UpdTextBBox() called in PRTGIF!\n"); *************** *** 1019,1035 **** 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; } --- 1021,1027 ---- void UpdateOuterInnerSel(obj_ptr) struct ObjRec *obj_ptr; + /* outerSel is at the top of the chain and innerSel is at the bottom */ { ! AddObjIntoSel(obj_ptr, NULL, outerSel, &outerSel, &innerSel); } *************** *** 2033,2037 **** { struct TextRec *text_ptr=ObjPtr->detail.t; ! char *s=text_ptr->minilines.first->first_block->seg->dyn_str.s, *s1=Str; char tmp_str[MAXSTRING+1], *c_ptr; int len; --- 2025,2029 ---- { struct TextRec *text_ptr=ObjPtr->detail.t; ! char *s=GetTextPtrFirstStrSeg(text_ptr)->dyn_str.s, *s1=Str; char tmp_str[MAXSTRING+1], *c_ptr; int len; *** box.c.orig Wed May 19 10:26:31 1999 --- box.c Wed May 19 10:26:31 1999 *************** *** 575,584 **** int ltx, lty, rbx, rby, fill, width, pen, dash, w, id=0, trans_pat=FALSE; int new_alloc, rotation, locked=FALSE, transformed=FALSE, invisible=FALSE; - #ifdef _TGIF_WB - char aux[10000]; - strcpy(aux,Inbuf); - #endif /* _TGIF_WB */ - *ObjPtr = NULL; --- 575,579 ---- *************** *** 776,793 **** struct XfrmMtrxRec *ctm; - #ifdef _TGIF_WB - - s = FindChar((int)'[', aux); - s++; - if (!bufferAsFileForWhiteBoard) { - fgets(inbuf, MAXSTRING, FP); - } - - #else /* ~_TGIF_WB */ - fgets(inbuf, MAXSTRING, FP); - - #endif /* _TGIF_WB */ - scanLineNum++; InitScan(inbuf, "\t\n, "); --- 771,775 ---- *** choice.c.orig Wed May 19 10:26:33 1999 --- choice.c Wed May 19 10:26:33 1999 *************** *** 924,927 **** --- 924,936 ---- void ShowPageLayout() { + int image_x=PAGELAYOUT_COL*choiceImageW, image_y=PAGELAYOUT_ROW*choiceImageH; + + if (threeDLook) { + image_x = 1+windowPadding+PAGELAYOUT_COL*(choiceImageW+windowPadding); + image_y = 1+windowPadding+PAGELAYOUT_ROW*(choiceImageH+windowPadding); + } + XClearArea(mainDisplay, choiceWindow, image_x-windowPadding, + image_y-windowPadding, choiceImageW+(windowPadding<<1), + choiceImageH+(windowPadding<<1), FALSE); ShowStipple(mainDisplay, choiceWindow, rasterGC, pageLayoutPixmap[pageLayoutMode], PAGELAYOUT_COL, PAGELAYOUT_ROW, *************** *** 980,984 **** if (curChoice == NewChoice) return; #ifdef _TGIF_WB2 ! if (serializingFile) return; #endif /* _TGIF_WB2 */ --- 989,995 ---- if (curChoice == NewChoice) return; #ifdef _TGIF_WB2 ! if (gstWBInfo.do_whiteboard && (serializingFile || deserializingFile)) { ! return; ! } #endif /* _TGIF_WB2 */ *** choose.c.orig Wed May 19 10:26:34 1999 --- choose.c Wed May 19 10:26:35 1999 *************** *** 106,109 **** --- 106,149 ---- static XComposeStatus c_stat; + int GetWorkingDirectory(buf, buf_sz) + char *buf; + int buf_sz; + { + char *psz_result=NULL; + + #ifdef VMS + psz_result = getcwd(buf, buf_sz, 0); + #else /* ~VMS */ + #ifdef ibm + psz_result = getwd(buf, buf_sz); + #else /* ~ibm */ + #ifdef NeXT + psz_result = getwd(buf, buf_sz); + #else /* ~NeXT */ + #ifdef luna88k + psz_result = getwd(buf); + #else /* ~luna88k */ + #ifdef sequent + psz_result = getwd(buf); + #else /* ~sequent */ + psz_result = getcwd(buf, buf_sz); + #endif /* sequent */ + #endif /* luna88k */ + #endif /* NeXT */ + #endif /* ibm */ + #endif /* VMS */ + if (psz_result == NULL) { + UtilStrCpyN(buf, buf_sz, "."); + return FALSE; + } + return TRUE; + } + + int SetWorkingDirectory(dir) + char *dir; + { + return (chdir(dir) == 0); + } + static void CalcBaseWinWidth(pni) *************** *** 1369,1372 **** --- 1409,1413 ---- } else if (ev.type == ButtonRelease) { XUngrabPointer(mainDisplay, CurrentTime); + if (debugNoPointerGrab) XSync(mainDisplay, False); done = TRUE; } else if (ev.type == MotionNotify) { *************** *** 1803,1806 **** --- 1844,1848 ---- if (ev.type == ButtonRelease) { XUngrabPointer(mainDisplay, CurrentTime); + if (debugNoPointerGrab) XSync(mainDisplay, False); looping = FALSE; } else if (ev.type == MotionNotify) { *************** *** 1962,1965 **** --- 2004,2029 ---- static + int GetParentRealDir(dir, buf, buf_sz) + char *dir, *buf; + int buf_sz; + { + int rc=FALSE; + char saved_cur_dir[MAXPATHLENGTH]; + + if (!GetWorkingDirectory(saved_cur_dir, sizeof(saved_cur_dir))) { + *saved_cur_dir = '\0'; + } + if (SetWorkingDirectory(dir) && SetWorkingDirectory("..")) { + if (GetWorkingDirectory(buf, buf_sz)) { + rc = TRUE; + } + } + if (*saved_cur_dir != '\0') { + SetWorkingDirectory(saved_cur_dir); + } + return rc; + } + + static int BreakForSelectFileAfterLoop() { *************** *** 1978,1981 **** --- 2042,2062 ---- } } else { + if (strcmp(pni->name, "../") == 0) { + /* need to find out what's the real directory */ + char parent_dir[MAXPATHLENGTH]; + + if (GetParentRealDir(pni->dir_name, parent_dir, sizeof(parent_dir))) { + int len=0; + + len = strlen(parent_dir); + if (len > 0 && parent_dir[len-1] == DIR_SEP) { + parent_dir[--len] = '\0'; + } + sprintf(pni->inbuf, "%s/..", parent_dir); + pni->buf_index = strlen(pni->inbuf); + ParseFileName(pni->inbuf, pni->dir_name, pni->name); + return FALSE; + } + } pni->inbuf[--(pni->buf_index)] = '\0'; if (strcmp(pni->name, "../") == 0) { *** cmd.c.orig Wed May 19 10:26:36 1999 --- cmd.c Wed May 19 10:26:36 1999 *************** *** 59,66 **** #include "xpixmap.e" - #ifdef _TGIF_WB - #include "wb1.e" - #endif /* _TGIF_WB */ - int recordCmdIncludeTgifObj=FALSE; int recordCmdUsesNewColormap=FALSE; --- 59,62 ---- *************** *** 72,75 **** --- 68,73 ---- int *stackingPosition=NULL; int stackingCount=0; + int stackingPositionHasIds=FALSE; + int composingCommand=FALSE; Colormap preparedColormap=None; *************** *** 100,111 **** double percent_start, percent_end; { ! register struct SelRec *sel_ptr, *next_sel; ! struct CmdRec *cmd_ptr, *prev_cmd; int num_records=0; double inc=0; ! if (CmdPtr->serialized) { if (CmdPtr->pos_before != NULL) { ! int i; char **s_ptr=(char**)(CmdPtr->pos_before); --- 98,109 ---- double percent_start, percent_end; { ! struct SelRec *sel_ptr=NULL, *next_sel=NULL; ! struct CmdRec *cmd_ptr=NULL, *prev_cmd=NULL; int num_records=0; double inc=0; ! if (CmdPtr->pos_before_has_ids) { if (CmdPtr->pos_before != NULL) { ! int i=0; char **s_ptr=(char**)(CmdPtr->pos_before); *************** *** 148,152 **** for (sel_ptr=CmdPtr->top_before; sel_ptr!=NULL; sel_ptr=next_sel) { next_sel = sel_ptr->next; - if (sel_ptr->obj != NULL) FreeObj(sel_ptr->obj); free(sel_ptr); } --- 146,149 ---- *************** *** 189,195 **** free(sel_ptr); } - if (CmdPtr->serialized && CmdPtr->actual_pos_before != NULL) { - free(CmdPtr->actual_pos_before); - } break; case CMD_MANY_TO_ONE: --- 186,189 ---- *************** *** 204,210 **** free(sel_ptr); } - if (CmdPtr->serialized && CmdPtr->actual_pos_before != NULL) { - free(CmdPtr->actual_pos_before); - } break; case CMD_COMPOSITE: --- 198,201 ---- *************** *** 229,232 **** --- 220,227 ---- break; } + #ifdef _TGIF_WB2 + if (CmdPtr->sender_process_id != NULL) UtilFree(CmdPtr->sender_process_id); + #endif /* _TGIF_WB2 */ + free(CmdPtr); } *************** *** 235,239 **** struct CmdRec *CmdPtr; { ! register struct CmdRec *cmd_ptr, *prev_cmd; for (cmd_ptr=lastCmd; cmd_ptr != curCmd; cmd_ptr=prev_cmd) { --- 230,234 ---- struct CmdRec *CmdPtr; { ! struct CmdRec *cmd_ptr=NULL, *prev_cmd=NULL; for (cmd_ptr=lastCmd; cmd_ptr != curCmd; cmd_ptr=prev_cmd) { *************** *** 247,251 **** void CleanUpCmds() { ! register struct CmdRec *cmd_ptr, *prev_cmd; int num_records=0; --- 242,246 ---- void CleanUpCmds() { ! struct CmdRec *cmd_ptr=NULL, *prev_cmd=NULL; int num_records=0; *************** *** 276,280 **** struct SelRec **to_top_sel, **to_bot_sel; { ! register struct SelRec *sel_ptr, *to_sel_ptr; *to_top_sel = *to_bot_sel = NULL; --- 271,275 ---- struct SelRec **to_top_sel, **to_bot_sel; { ! struct SelRec *sel_ptr=NULL; *to_top_sel = *to_bot_sel = NULL; *************** *** 281,296 **** for (sel_ptr=from_top_sel; sel_ptr!=NULL; sel_ptr=sel_ptr->next, count--) { ! to_sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (to_sel_ptr == NULL) FailAllocMessage(); ! memset(to_sel_ptr, 0, sizeof(struct SelRec)); ! to_sel_ptr->next = NULL; ! to_sel_ptr->prev = *to_bot_sel; ! to_sel_ptr->obj = sel_ptr->obj; ! if (*to_bot_sel == NULL) { ! *to_top_sel = to_sel_ptr; ! } else { ! (*to_bot_sel)->next = to_sel_ptr; ! } ! *to_bot_sel = to_sel_ptr; } if (count != 0) { --- 276,280 ---- for (sel_ptr=from_top_sel; sel_ptr!=NULL; sel_ptr=sel_ptr->next, count--) { ! AddObjIntoSel(sel_ptr->obj, *to_bot_sel, NULL, to_top_sel, to_bot_sel); } if (count != 0) { *************** *** 305,312 **** struct SelRec *TopSel, *BotSel; { ! register struct SelRec *sel_ptr, *sel_ptr_next; ! sel_ptr=TopSel; ! sel_ptr_next=TopSel->next; sel_ptr->obj->prev = NULL; for ( ; sel_ptr_next!=NULL; sel_ptr=sel_ptr_next, --- 289,296 ---- struct SelRec *TopSel, *BotSel; { ! struct SelRec *sel_ptr=NULL, *sel_ptr_next=NULL; ! sel_ptr = TopSel; ! sel_ptr_next = TopSel->next; sel_ptr->obj->prev = NULL; for ( ; sel_ptr_next!=NULL; sel_ptr=sel_ptr_next, *************** *** 322,328 **** struct CmdRec *CmdPtr; { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr, *next_obj; ! int pos, count; topSel = CmdPtr->top_after; --- 306,312 ---- struct CmdRec *CmdPtr; { ! struct SelRec *sel_ptr=NULL; ! struct ObjRec *obj_ptr=NULL, *next_obj=NULL; ! int pos=0, count=0; topSel = CmdPtr->top_after; *************** *** 388,399 **** static void UndoDeleteCmd(CmdPtr) struct CmdRec *CmdPtr; { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr, *next_obj; ! register int pos; ! struct ObjRec *saved_top_obj, *saved_bot_obj; ! int count; CopySel(CmdPtr->top_before, CmdPtr->count_before, &topSel, &botSel); --- 372,406 ---- static + int ObjHasFullID(obj_ptr, psz_full_id) + struct ObjRec *obj_ptr; + char *psz_full_id; + { + if (*psz_full_id != '#') { + #ifdef _TGIF_WB2 + sprintf(gszMsgBox, "%s, psz_full_id = %s, pid = %ld.", + "Unexpected *psz_full_id != '#' in ObjHasFullID()", + psz_full_id, gstWBInfo.pid); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + #endif /* _TGIF_WB2 */ + } + psz_full_id = strchr(psz_full_id, ':'); + psz_full_id++; + if (obj_ptr->creator_full_id == NULL) { + char buf[MAXSTRING]; + + sprintf(buf, "%1d/%s", obj_ptr->id, gszLocalPID); + return strcmp(buf, psz_full_id); + } + return strcmp(obj_ptr->creator_full_id, psz_full_id); + } + + static void UndoDeleteCmd(CmdPtr) struct CmdRec *CmdPtr; { ! struct SelRec *sel_ptr=NULL; ! struct ObjRec *obj_ptr=NULL, *next_obj=NULL; ! struct ObjRec *saved_top_obj=NULL, *saved_bot_obj=NULL; ! int count=0; CopySel(CmdPtr->top_before, CmdPtr->count_before, &topSel, &botSel); *************** *** 413,428 **** curPage->bot = botObj = saved_bot_obj; ! pos = count = 0; sel_ptr = topSel; ! for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=next_obj, pos++) { ! if (pos == CmdPtr->pos_before[count]) { ! AddObj(obj_ptr->prev, obj_ptr, sel_ptr->obj); ! next_obj = obj_ptr; ! count++; ! sel_ptr = sel_ptr->next; ! if (count == CmdPtr->count_before) break; ! } else { ! next_obj = obj_ptr->next; } } for ( ; sel_ptr != NULL; sel_ptr=sel_ptr->next) { --- 420,451 ---- curPage->bot = botObj = saved_bot_obj; ! count = 0; sel_ptr = topSel; ! if (CmdPtr->pos_before_has_ids) { ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj) { ! if (ObjHasFullID(obj_ptr, (char*)(CmdPtr->pos_before[count]))) { ! AddObj(obj_ptr->prev, obj_ptr, sel_ptr->obj); ! next_obj = obj_ptr; ! count++; ! sel_ptr = sel_ptr->next; ! if (count == CmdPtr->count_before) break; ! } else { ! next_obj = obj_ptr->next; ! } } + } else { + int pos=0; + + for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj, pos++) { + if (pos == CmdPtr->pos_before[count]) { + AddObj(obj_ptr->prev, obj_ptr, sel_ptr->obj); + next_obj = obj_ptr; + count++; + sel_ptr = sel_ptr->next; + if (count == CmdPtr->count_before) break; + } else { + next_obj = obj_ptr->next; + } + } } for ( ; sel_ptr != NULL; sel_ptr=sel_ptr->next) { *************** *** 438,462 **** static ! int SetupBeforePointers(CmdPtr, modify_before_pointers, ! modify_actual_pos_before) struct CmdRec *CmdPtr; ! int modify_before_pointers, modify_actual_pos_before; /* * CmdPtr->pos_before is an array of strings containing ! * "\t\t". * CmdPtr->count_before is assumed to be the number of elements in ! * CmdPtr->pos_before. * * if (modify_before_pointers) { ! * Setup CmdPtr->top_before and CmdPtr->bot_before. * } ! * if (modify_actual_pos_before != NULL) { ! * Create an array of integers containing the positions of the ! * objects referenced in CmdPtr->pos_before and return this ! * array in CmdPtr->actual_pos_before. * } */ { ! int index, ok=TRUE, *actual_pos_before=NULL, cur_pos=0; struct ObjRec *obj_ptr=topObj; struct SelRec *sel_ptr=NULL, *next_sel=NULL, *top_sel=NULL, *bot_sel=NULL; --- 461,490 ---- static ! int SetupBeforePointers(CmdPtr, modify_before_pointers, pp_actual_pos_before) struct CmdRec *CmdPtr; ! int modify_before_pointers, **pp_actual_pos_before; /* * CmdPtr->pos_before is an array of strings containing ! * "#:/:". * CmdPtr->count_before is assumed to be the number of elements in ! * CmdPtr->pos_before. * * if (modify_before_pointers) { ! * Setup CmdPtr->top_before and CmdPtr->bot_before. ! * For these cases, /: is used to locate the ! * object positions to build the actual before pointers. ! * } else { ! * This can only happen if (CmdPtr->serialized && ! * CmdPtr->type == CMD_REPLACE && !CmdPtr->undone) ! * In this case, the # should be used to setup up the actual ! * before pointers. * } ! * if (pp_actual_pos_before != NULL) { ! * Create an array of integers containing the positions of the ! * objects referenced in CmdPtr->pos_before and return this array. * } */ { ! int index, ok=TRUE, cur_pos=0; struct ObjRec *obj_ptr=topObj; struct SelRec *sel_ptr=NULL, *next_sel=NULL, *top_sel=NULL, *bot_sel=NULL; *************** *** 469,488 **** CmdPtr->top_before = CmdPtr->bot_before = NULL; } ! if (modify_actual_pos_before) { ! if (CmdPtr->actual_pos_before != NULL) { ! free(CmdPtr->actual_pos_before); ! CmdPtr->actual_pos_before = NULL; ! } ! actual_pos_before = (int*)malloc(CmdPtr->count_before*sizeof(int)); ! if (actual_pos_before == NULL) FailAllocMessage(); ! memset(actual_pos_before, 0, CmdPtr->count_before*sizeof(int)); } for (index=0; index < CmdPtr->count_before; index++) { ! char *psz_full_id=(((char**)CmdPtr->pos_before)[index]); ! char *psz=strchr(psz_full_id, '\t'), pid_and_host[MAXSTRING]; ! int id=(-1), found=FALSE; *pid_and_host = '\0'; if (psz == NULL) { ok = FALSE; break; --- 497,537 ---- CmdPtr->top_before = CmdPtr->bot_before = NULL; } ! if (pp_actual_pos_before != NULL) { ! *pp_actual_pos_before = (int*)malloc(CmdPtr->count_before*sizeof(int)); ! if (*pp_actual_pos_before == NULL) FailAllocMessage(); ! memset(*pp_actual_pos_before, 0, CmdPtr->count_before*sizeof(int)); } for (index=0; index < CmdPtr->count_before; index++) { ! char *psz_full_id=(((char**)CmdPtr->pos_before)[index]), *psz=NULL; ! char pid_and_host[MAXSTRING]; ! int id=(-1), found=FALSE, pos_to_match=INVALID; + if (*psz_full_id == '#') { + psz = strchr(++psz_full_id, ':'); + *psz = '\0'; + if (!modify_before_pointers) { + if (sscanf(psz_full_id, "%d", &pos_to_match) != 1 || + pos_to_match == INVALID) { + #ifdef _TGIF_WB2 + sprintf(gszMsgBox, "%s %s (%s), psz_full_id = %s, pid = %ld.", + "Format error in parsing pos_to_match in", + "SetupBeforePointers()", "cannot get pos_to_match", + psz_full_id, gstWBInfo.pid); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + #endif /* _TGIF_WB2 */ + } + } + *psz++ = ':'; + psz_full_id = psz; + } + psz = strchr(psz_full_id, '/'); *pid_and_host = '\0'; if (psz == NULL) { + #ifdef _TGIF_WB2 + sprintf(gszMsgBox, "%s (%s), psz_full_id = %s, pid = %ld.", + "Format error in parsing id in SetupBeforePointers()", + "cannot find ':'", psz_full_id, gstWBInfo.pid); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + #endif /* _TGIF_WB2 */ ok = FALSE; break; *************** *** 492,529 **** strcpy(pid_and_host, &psz[1]); } else { ok = FALSE; break; } ! *psz = '\t'; } if (ok) { for ( ; ok && obj_ptr != NULL; obj_ptr=obj_ptr->next, cur_pos++) { ! if (obj_ptr->creator_full_id == NULL) { ! if (obj_ptr->id == id && ! strcmp(pid_and_host, gszLocalPID) == 0) { ! found = TRUE; } ! } else { ! if (strcmp(obj_ptr->creator_full_id, psz_full_id) == 0) { ! found = TRUE; ! } } if (found) { if (modify_before_pointers) { ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! memset(sel_ptr, 0, sizeof(struct SelRec)); ! sel_ptr->obj = obj_ptr; ! sel_ptr->prev = bot_sel; ! sel_ptr->next = NULL; ! if (bot_sel == NULL) { ! top_sel = sel_ptr; ! } else { ! bot_sel->next = sel_ptr; ! } ! bot_sel = sel_ptr; } ! if (actual_pos_before != NULL) { ! actual_pos_before[index] = cur_pos; } obj_ptr = obj_ptr->next; --- 541,577 ---- strcpy(pid_and_host, &psz[1]); } else { + #ifdef _TGIF_WB2 + sprintf(gszMsgBox, "%s (%s), psz_full_id = %s, pid = %ld.", + "Format error in parsing id in SetupBeforePointers()", + "cannot find id", psz_full_id, gstWBInfo.pid); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + #endif /* _TGIF_WB2 */ ok = FALSE; break; } ! *psz = '/'; } if (ok) { for ( ; ok && obj_ptr != NULL; obj_ptr=obj_ptr->next, cur_pos++) { ! if (pos_to_match == INVALID) { ! if (obj_ptr->creator_full_id == NULL) { ! if (obj_ptr->id == id && ! strcmp(pid_and_host, gszLocalPID) == 0) { ! found = TRUE; ! } ! } else { ! if (strcmp(obj_ptr->creator_full_id, psz_full_id) == 0) { ! found = TRUE; ! } } ! } else if (pos_to_match == cur_pos) { ! found = TRUE; } if (found) { if (modify_before_pointers) { ! AddObjIntoSel(obj_ptr, bot_sel, NULL, &top_sel, &bot_sel); } ! if (pp_actual_pos_before != NULL) { ! (*pp_actual_pos_before)[index] = cur_pos; } obj_ptr = obj_ptr->next; *************** *** 534,537 **** --- 582,591 ---- } if (ok && !found) { + #ifdef _TGIF_WB2 + sprintf(gszMsgBox, "%s: '%s' %s, pid = %ld.\n\n(%s=%1d, %s='%s')", + "Cannot find object id", psz_full_id, "in SetupBeforePointers()", + gstWBInfo.pid, "id", id, "pid_and_host", pid_and_host); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + #endif /* _TGIF_WB2 */ ok = FALSE; break; *************** *** 539,542 **** --- 593,602 ---- } if (index != CmdPtr->count_before) { + #ifdef _TGIF_WB2 + sprintf(gszMsgBox, "%s (%1d) %s (%1d) %s, pid = %ld.", + "Index", index, "!= CmdPtr->count_before", CmdPtr->count_before, + "in SetupBeforePointers()", gstWBInfo.pid); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + #endif /* _TGIF_WB2 */ ok = FALSE; } *************** *** 546,553 **** free(sel_ptr); } ! if (actual_pos_before != NULL) free(actual_pos_before); #ifdef _TGIF_WB2 sprintf(gszMsgBox, "%s, pid = %ld.", ! "Problem encountered in SetupBeforePointers()", (long)getpid()); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); #endif /* _TGIF_WB2 */ --- 606,616 ---- free(sel_ptr); } ! if (pp_actual_pos_before != NULL) { ! free(*pp_actual_pos_before); ! *pp_actual_pos_before = NULL; ! } #ifdef _TGIF_WB2 sprintf(gszMsgBox, "%s, pid = %ld.", ! "Problem encountered in SetupBeforePointers()", gstWBInfo.pid); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); #endif /* _TGIF_WB2 */ *************** *** 557,563 **** CmdPtr->bot_before = bot_sel; } - if (modify_actual_pos_before) { - CmdPtr->actual_pos_before = actual_pos_before; - } } return ok; --- 620,623 ---- *************** *** 571,575 **** if (CmdPtr->serialized) { ! if (!SetupBeforePointers(CmdPtr, TRUE, FALSE)) { return FALSE; } --- 631,635 ---- if (CmdPtr->serialized) { ! if (!SetupBeforePointers(CmdPtr, TRUE, NULL)) { return FALSE; } *************** *** 584,599 **** } } else { ! struct ObjRec *obj_ptr, *next_obj; ! int pos=0, count=0; ! for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=next_obj, pos++) { ! next_obj = obj_ptr->next; ! if (pos == CmdPtr->pos_before[count]) { ! count++; ! sel_ptr->obj = obj_ptr; ! UnlinkObj(obj_ptr); ! sel_ptr = sel_ptr->next; ! if (count == CmdPtr->count_before) break; } } } --- 644,674 ---- } } else { ! struct ObjRec *obj_ptr=NULL, *next_obj=NULL; ! int count=0; ! if (CmdPtr->pos_before_has_ids) { ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj) { ! next_obj = obj_ptr->next; ! if (ObjHasFullID(obj_ptr, (char*)(CmdPtr->pos_before[count]))) { ! count++; ! sel_ptr->obj = obj_ptr; ! UnlinkObj(obj_ptr); ! sel_ptr = sel_ptr->next; ! if (count == CmdPtr->count_before) break; ! } } + } else { + int pos=0; + + for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj, pos++) { + next_obj = obj_ptr->next; + if (pos == CmdPtr->pos_before[count]) { + count++; + sel_ptr->obj = obj_ptr; + UnlinkObj(obj_ptr); + sel_ptr = sel_ptr->next; + if (count == CmdPtr->count_before) break; + } + } } } *************** *** 618,622 **** if (CmdPtr->serialized) { ! if (!SetupBeforePointers(CmdPtr, TRUE, FALSE)) { return FALSE; } --- 693,697 ---- if (CmdPtr->serialized) { ! if (!SetupBeforePointers(CmdPtr, TRUE, NULL)) { return FALSE; } *************** *** 635,649 **** } else { struct ObjRec *next_obj; ! int pos=0, count=0; ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj, pos++) { ! next_obj = obj_ptr->next; ! if (pos == CmdPtr->pos_before[count]) { ! count++; ! sel_ptr->obj = obj_ptr; ! if (!obj_ptr->locked) MoveObj(obj_ptr, dx, dy); ! sel_ptr = sel_ptr->next; ! if (count == CmdPtr->count_before) break; } } } --- 710,739 ---- } else { struct ObjRec *next_obj; ! int count=0; ! if (CmdPtr->pos_before_has_ids) { ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj) { ! next_obj = obj_ptr->next; ! if (ObjHasFullID(obj_ptr, (char*)(CmdPtr->pos_before[count]))) { ! count++; ! sel_ptr->obj = obj_ptr; ! if (!obj_ptr->locked) MoveObj(obj_ptr, dx, dy); ! sel_ptr = sel_ptr->next; ! if (count == CmdPtr->count_before) break; ! } } + } else { + int pos=0; + + for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj, pos++) { + next_obj = obj_ptr->next; + if (pos == CmdPtr->pos_before[count]) { + count++; + sel_ptr->obj = obj_ptr; + if (!obj_ptr->locked) MoveObj(obj_ptr, dx, dy); + sel_ptr = sel_ptr->next; + if (count == CmdPtr->count_before) break; + } + } } } *************** *** 748,756 **** */ { ! register int i; ! int old_allocated_colors, changed=FALSE, saved_color_layers; ! char **old_color_str; ! struct ObjRec *obj_ptr; ! struct PageRec *page_ptr; Colormap colormap=XCopyColormapAndFree(mainDisplay, mainColormap); --- 838,845 ---- */ { ! int i=0, old_allocated_colors, changed=FALSE, saved_color_layers; ! char **old_color_str=NULL; ! struct ObjRec *obj_ptr=NULL; ! struct PageRec *page_ptr=NULL; Colormap colormap=XCopyColormapAndFree(mainDisplay, mainColormap); *************** *** 843,862 **** int HighLightSingleObj; { ! register struct ObjRec *obj_ptr, *next_obj; ! register struct SelRec *sel_ptr; ! struct SelRec *saved_top_sel, *saved_bot_sel; ! struct ObjRec *saved_top_obj, *saved_bot_obj; int ltx, lty, rbx, rby, pos, count, *pos_table, max_count; int need_clear_and_redraw=FALSE; if (CmdPtr->serialized) { int shuffle=FALSE; ! CmdPtr->actual_pos_before = NULL; ! if (gstWBInfo.first_redo_after_deserialize && CmdPtr->undone) { shuffle = TRUE; } if (shuffle) { ! if (!SetupBeforePointers(CmdPtr, TRUE, FALSE)) { return FALSE; } --- 932,967 ---- int HighLightSingleObj; { ! struct ObjRec *obj_ptr=NULL, *next_obj=NULL; ! struct SelRec *sel_ptr=NULL; ! struct SelRec *saved_top_sel=NULL, *saved_bot_sel=NULL; ! struct ObjRec *saved_top_obj=NULL, *saved_bot_obj=NULL; int ltx, lty, rbx, rby, pos, count, *pos_table, max_count; int need_clear_and_redraw=FALSE; + int *actual_pos_before=NULL; + #ifdef _TGIF_WB2 + #ifdef _TGIF_DBG_WB2 + if (gstWBInfo.do_whiteboard) { + fprintf(stderr, "@@@ Beginning of UndoOrRedoReplaceCmd()...\n"); + fprintf(stderr, "\tCmdPtr->serialized=%1d...\n", CmdPtr->serialized); + } + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ if (CmdPtr->serialized) { int shuffle=FALSE; ! if (CmdPtr->first_redo_after_deserialize && CmdPtr->undone) { ! CmdPtr->first_redo_after_deserialize = FALSE; shuffle = TRUE; } + #ifdef _TGIF_WB2 + #ifdef _TGIF_DBG_WB2 + if (gstWBInfo.do_whiteboard) { + fprintf(stderr, "In UndoOrRedoReplaceCmd(), shuffle=%1d.\n", shuffle); + } + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ if (shuffle) { ! if (!SetupBeforePointers(CmdPtr, TRUE, NULL)) { return FALSE; } *************** *** 882,886 **** saved_bot_sel = CmdPtr->bot_before; CmdPtr->top_before = CmdPtr->bot_before = NULL; ! if (!SetupBeforePointers(CmdPtr, TRUE, FALSE)) { return FALSE; } --- 987,991 ---- saved_bot_sel = CmdPtr->bot_before; CmdPtr->top_before = CmdPtr->bot_before = NULL; ! if (!SetupBeforePointers(CmdPtr, TRUE, NULL)) { return FALSE; } *************** *** 890,894 **** CmdPtr->bot_before = saved_bot_sel; } else { ! if (!SetupBeforePointers(CmdPtr, FALSE, TRUE)) { return FALSE; } --- 995,999 ---- CmdPtr->bot_before = saved_bot_sel; } else { ! if (!SetupBeforePointers(CmdPtr, FALSE, &actual_pos_before)) { return FALSE; } *************** *** 917,922 **** } } else { pos = count = 0; ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj, pos++) { next_obj = obj_ptr->next; if (pos == pos_table[count]) { --- 1022,1030 ---- } } else { + if (CmdPtr->serialized && !CmdPtr->undone) { + pos_table = actual_pos_before; + } pos = count = 0; ! for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=next_obj, pos++) { next_obj = obj_ptr->next; if (pos == pos_table[count]) { *************** *** 957,961 **** sel_ptr = topSel; if (CmdPtr->serialized && !CmdPtr->undone) { ! pos_table = CmdPtr->actual_pos_before; } for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=next_obj, pos++) { --- 1065,1069 ---- sel_ptr = topSel; if (CmdPtr->serialized && !CmdPtr->undone) { ! pos_table = actual_pos_before; } for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=next_obj, pos++) { *************** *** 1009,1016 **** SetFileModified(TRUE); justDupped = FALSE; ! if (CmdPtr->actual_pos_before != NULL) { ! free(CmdPtr->actual_pos_before); ! CmdPtr->actual_pos_before = NULL; ! } return TRUE; } --- 1117,1123 ---- SetFileModified(TRUE); justDupped = FALSE; ! ! if (actual_pos_before != NULL) free(actual_pos_before); ! return TRUE; } *************** *** 1025,1032 **** int ltx, lty, rbx, rby, pos, count, *pos_table, max_count; int need_clear_and_redraw=FALSE; if (CmdPtr->serialized) { if (CmdPtr->undone) { ! if (!SetupBeforePointers(CmdPtr, TRUE, TRUE)) { return FALSE; } --- 1132,1140 ---- int ltx, lty, rbx, rby, pos, count, *pos_table, max_count; int need_clear_and_redraw=FALSE; + int *actual_pos_before=NULL; if (CmdPtr->serialized) { if (CmdPtr->undone) { ! if (!SetupBeforePointers(CmdPtr, TRUE, &actual_pos_before)) { return FALSE; } *************** *** 1047,1052 **** max_count = (CmdPtr->undone) ? CmdPtr->count_before : CmdPtr->count_after; pos = count = 0; ! for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=next_obj, pos++) { next_obj = obj_ptr->next; if (pos == pos_table[count]) { --- 1155,1163 ---- max_count = (CmdPtr->undone) ? CmdPtr->count_before : CmdPtr->count_after; + if (CmdPtr->serialized && !CmdPtr->undone) { + pos_table = actual_pos_before; + } pos = count = 0; ! for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=next_obj, pos++) { next_obj = obj_ptr->next; if (pos == pos_table[count]) { *************** *** 1089,1093 **** sel_ptr = topSel; if (CmdPtr->serialized && !CmdPtr->undone) { ! pos_table = CmdPtr->actual_pos_before; } for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=next_obj, pos++) { --- 1200,1204 ---- sel_ptr = topSel; if (CmdPtr->serialized && !CmdPtr->undone) { ! pos_table = actual_pos_before; } for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=next_obj, pos++) { *************** *** 1137,1140 **** --- 1248,1254 ---- SetFileModified(TRUE); justDupped = FALSE; + + if (actual_pos_before != NULL) free(actual_pos_before); + return TRUE; } *************** *** 1188,1192 **** { if (gstWBInfo.do_whiteboard) { ! MsgBox("Undo is disabled when running in WhiteBoard mode!", TOOL_NAME, INFO_MB); return; --- 1302,1306 ---- { if (gstWBInfo.do_whiteboard) { ! MsgBox("'Undo' is disabled when running in the WhiteBoard mode!", TOOL_NAME, INFO_MB); return; *************** *** 1223,1226 **** --- 1337,1345 ---- } } + if (ok) { + if (!RedoACmd(CmdPtr->first, TRUE)) { + ok = FALSE; + } + } } else { for (cmd_ptr=CmdPtr->first; cmd_ptr!=NULL; cmd_ptr=cmd_ptr->next) { *************** *** 1248,1252 **** { if (gstWBInfo.do_whiteboard) { ! MsgBox("Redo is disabled when running in WhiteBoard mode!", TOOL_NAME, INFO_MB); return; --- 1367,1371 ---- { if (gstWBInfo.do_whiteboard) { ! MsgBox("'Redo' is disabled when running in the WhiteBoard mode!", TOOL_NAME, INFO_MB); return; *************** *** 1366,1369 **** --- 1485,1492 ---- void DisableUndo() { + if (gstWBInfo.do_whiteboard) { + /* ``Undo'' is already disabled in whiteboard mode */ + return; + } CleanUpCmds(); while (composingCommand) { *************** *** 1376,1405 **** void EnableUndo() { RestoreDefaultHistoryDepth(); } ! struct SelRec *PrepareStackingInfo(TopSel, BotSel, NumObjs, ! ppnStackingPosition, pnStackingCount) struct SelRec *TopSel, *BotSel; ! int NumObjs; ! int **ppnStackingPosition; ! int *pnStackingCount; { ! register int pos; ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr; ! *ppnStackingPosition = (int*)malloc(NumObjs*sizeof(int)); ! if (*ppnStackingPosition == NULL) FailAllocMessage(); ! memset(*ppnStackingPosition, 0, NumObjs*sizeof(int)); ! *pnStackingCount = 0; ! pos = 0; ! sel_ptr = TopSel; ! for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=obj_ptr->next, pos++) { ! if (obj_ptr == sel_ptr->obj) { ! (*ppnStackingPosition)[(*pnStackingCount)++] = pos; ! sel_ptr = sel_ptr->next; ! if (*pnStackingCount == NumObjs) break; } } return sel_ptr; --- 1499,1567 ---- void EnableUndo() { + if (gstWBInfo.do_whiteboard) { + /* ``Redo'' is already disabled in whiteboard mode */ + return; + } RestoreDefaultHistoryDepth(); } ! struct SelRec *PrepareStackingInfo(TopSel, BotSel, NumObjs, PreparePhase, ! ppnStackingPosition, pnStackingCount, pnStackingPositionHasIds) struct SelRec *TopSel, *BotSel; ! int NumObjs, PreparePhase; ! int **ppnStackingPosition, *pnStackingCount, *pnStackingPositionHasIds; ! /* ! * In whiteboard mode and PreparePhase, *ppnStackingPosition will ! * be a list of full_ids. Otherwise, it will just be a ! * list of indices. ! */ { ! int pos=0; ! struct SelRec *sel_ptr=NULL; ! struct ObjRec *obj_ptr=NULL; ! if (gstWBInfo.do_whiteboard && PreparePhase) { ! char **ppsz_full_ids=(char**)malloc(NumObjs*sizeof(char*)); ! ! if (ppsz_full_ids == NULL) FailAllocMessage(); ! memset(ppsz_full_ids, 0, NumObjs*sizeof(char*)); ! ! *ppnStackingPosition = NULL; ! *pnStackingCount = 0; ! pos = 0; ! sel_ptr = TopSel; ! for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=obj_ptr->next, pos++) { ! if (obj_ptr == sel_ptr->obj) { ! char buf[MAXSTRING]; ! ! if (obj_ptr->creator_full_id == NULL) { ! sprintf(buf, "#%1d:%1d/%s", pos, obj_ptr->id, gszLocalPID); ! } else { ! sprintf(buf, "#%1d:%s", pos, obj_ptr->creator_full_id); ! } ! ppsz_full_ids[(*pnStackingCount)++] = UtilStrDup(buf); ! if (ppsz_full_ids[(*pnStackingCount)-1] == NULL) FailAllocMessage(); ! ! sel_ptr = sel_ptr->next; ! if (*pnStackingCount == NumObjs) break; ! } } + *ppnStackingPosition = (int*)ppsz_full_ids; + if (pnStackingPositionHasIds != NULL) *pnStackingPositionHasIds = TRUE; + } else { + *ppnStackingPosition = (int*)malloc(NumObjs*sizeof(int)); + if (*ppnStackingPosition == NULL) FailAllocMessage(); + memset(*ppnStackingPosition, 0, NumObjs*sizeof(int)); + *pnStackingCount = 0; + pos = 0; + sel_ptr = TopSel; + for (obj_ptr=topObj; obj_ptr!=NULL; obj_ptr=obj_ptr->next, pos++) { + if (obj_ptr == sel_ptr->obj) { + (*ppnStackingPosition)[(*pnStackingCount)++] = pos; + sel_ptr = sel_ptr->next; + if (*pnStackingCount == NumObjs) break; + } + } + if (pnStackingPositionHasIds != NULL) *pnStackingPositionHasIds = FALSE; } return sel_ptr; *************** *** 1406,1412 **** } ! void PrepareStacking(TopSel, BotSel, NumObjs) struct SelRec *TopSel, *BotSel; ! int NumObjs; { struct SelRec *sel_ptr; --- 1568,1575 ---- } ! static ! void PrepareStacking(TopSel, BotSel, NumObjs, PreparePhase) struct SelRec *TopSel, *BotSel; ! int NumObjs, PreparePhase; { struct SelRec *sel_ptr; *************** *** 1414,1419 **** stackingPosition = NULL; stackingCount = 0; ! sel_ptr = PrepareStackingInfo(TopSel, BotSel, NumObjs, &stackingPosition, ! &stackingCount); if (sel_ptr != NULL || stackingCount != NumObjs) { FatalUnexpectedError( --- 1577,1582 ---- stackingPosition = NULL; stackingCount = 0; ! sel_ptr = PrepareStackingInfo(TopSel, BotSel, NumObjs, PreparePhase, ! &stackingPosition, &stackingCount, &stackingPositionHasIds); if (sel_ptr != NULL || stackingCount != NumObjs) { FatalUnexpectedError( *************** *** 1427,1431 **** struct SelRec *TopSel, *BotSel; { ! register struct SelRec *sel_ptr, *to_sel_ptr; if (historyDepth == 0) return; --- 1590,1594 ---- struct SelRec *TopSel, *BotSel; { ! struct SelRec *sel_ptr=NULL, *to_sel_ptr=NULL; if (historyDepth == 0) return; *************** *** 1436,1439 **** --- 1599,1604 ---- stackingPosition = NULL; stackingCount = 0; + stackingPositionHasIds = FALSE; + switch (CmdType) { case CMD_NEW: break; *************** *** 1443,1452 **** case CMD_STRETCH: case CMD_REPLACE: ! PrepareStacking(TopSel, BotSel, NumObjs); ! DupTheseObjects(TopSel, BotSel, &topSelBeforeInCmd, &botSelBeforeInCmd); ! for (sel_ptr=TopSel, to_sel_ptr=topSelBeforeInCmd; to_sel_ptr!=NULL; ! sel_ptr=sel_ptr->next, to_sel_ptr=to_sel_ptr->next) { ! CopyObjId(sel_ptr->obj, to_sel_ptr->obj); ! CopyObjLocks(sel_ptr->obj, to_sel_ptr->obj); } break; --- 1608,1623 ---- case CMD_STRETCH: case CMD_REPLACE: ! PrepareStacking(TopSel, BotSel, NumObjs, TRUE); ! if (CmdType == CMD_MOVE) { ! CopySel(TopSel, NumObjs, &topSelBeforeInCmd, &botSelBeforeInCmd); ! } else { ! /* stackingPositionHasIds is TRUE if we are doing whiteboard */ ! DupTheseObjects(TopSel, BotSel, &topSelBeforeInCmd, ! &botSelBeforeInCmd); ! for (sel_ptr=TopSel, to_sel_ptr=topSelBeforeInCmd; to_sel_ptr!=NULL; ! sel_ptr=sel_ptr->next, to_sel_ptr=to_sel_ptr->next) { ! CopyObjId(sel_ptr->obj, to_sel_ptr->obj); ! CopyObjLocks(sel_ptr->obj, to_sel_ptr->obj); ! } } break; *************** *** 1453,1456 **** --- 1624,1628 ---- case CMD_GOTO_PAGE: stackingCount = NumObjs; break; + case CMD_WB_CLEARALL: break; } return; *************** *** 1460,1464 **** struct CmdRec *CmdPtr; { ! register struct SelRec *sel_ptr, *next_sel; for (sel_ptr=CmdPtr->top_after; sel_ptr!=NULL; sel_ptr=next_sel) { --- 1632,1636 ---- struct CmdRec *CmdPtr; { ! struct SelRec *sel_ptr=NULL, *next_sel=NULL; for (sel_ptr=CmdPtr->top_after; sel_ptr!=NULL; sel_ptr=next_sel) { *************** *** 1474,1491 **** struct SubCmdRec *SubCmdPtr; { ! #ifdef _TGIF_WB ! if (ClientServer != 0) { /* connection is going on */ ! CheckConForRecord(CmdType, SubCmdPtr, TopSel, NumObjs, topSelBeforeInCmd); ! if (ClientServer == 1) return; /* connection ON and I'm client */ ! } ! #endif /* _TGIF_WB */ - #ifdef _TGIF_WB2 if (gstWBInfo.do_whiteboard) { char *psz_wb_data=NULL; serializingFile = TRUE; if ((psz_wb_data=SerializeCmd(CmdType, SubCmdPtr, TopSel, BotSel, ! NumObjs)) != NULL) { if (!SendWBData(psz_wb_data)) { } --- 1646,1659 ---- struct SubCmdRec *SubCmdPtr; { ! int logical_clock=0; if (gstWBInfo.do_whiteboard) { + #ifdef _TGIF_WB2 char *psz_wb_data=NULL; serializingFile = TRUE; + if ((psz_wb_data=SerializeCmd(CmdType, SubCmdPtr, TopSel, BotSel, ! NumObjs, &logical_clock)) != NULL) { if (!SendWBData(psz_wb_data)) { } *************** *** 1493,1500 **** } serializingFile = FALSE; - } #endif /* _TGIF_WB2 */ ! ! if (!gstWBInfo.do_whiteboard) { if (historyDepth == 0) return; --- 1661,1666 ---- } serializingFile = FALSE; #endif /* _TGIF_WB2 */ ! } else { if (historyDepth == 0) return; *************** *** 1514,1518 **** } } - curCmd = (struct CmdRec *)malloc(sizeof(struct CmdRec)); if (curCmd == NULL) FailAllocMessage(); --- 1680,1683 ---- *************** *** 1520,1525 **** --- 1685,1694 ---- curCmd->top_before = topSelBeforeInCmd; curCmd->bot_before = botSelBeforeInCmd; + if (gstWBInfo.do_whiteboard) { + curCmd->serialized = TRUE; + } curCmd->pos_before = stackingPosition; curCmd->count_before = stackingCount; + curCmd->pos_before_has_ids = stackingPositionHasIds; curCmd->type = CmdType; curCmd->undone = FALSE; *************** *** 1529,1533 **** if (TopSel != NULL) { CopySel(TopSel, NumObjs, &(curCmd->top_after), &(curCmd->bot_after)); ! PrepareStacking(TopSel, BotSel, NumObjs); curCmd->pos_after = stackingPosition; curCmd->count_after = stackingCount; --- 1698,1702 ---- if (TopSel != NULL) { CopySel(TopSel, NumObjs, &(curCmd->top_after), &(curCmd->bot_after)); ! PrepareStacking(TopSel, BotSel, NumObjs, FALSE); curCmd->pos_after = stackingPosition; curCmd->count_after = stackingCount; *************** *** 1537,1543 **** curCmd->count_after = 0; } ! InsertCmd(lastCmd, NULL, curCmd, &firstCmd, &lastCmd); switch (CmdType) { case CMD_NEW: break; --- 1706,1743 ---- curCmd->count_after = 0; } + if (gstWBInfo.do_whiteboard) { + struct CmdRec *immed_right_cmd=NULL; + int cur_cmd_should_block=FALSE; ! curCmd->logical_clock = logical_clock; ! curCmd->sender_process_id = UtilStrDup(gszLocalPID); ! if (curCmd->sender_process_id == NULL) FailAllocMessage(); + /* + * FindCmdInsertionPoint() examine the logical clock of the new command + * and decides where to insert it. + * If the insertion point is beyond first_blocked_cmd, + * cur_cmd_should_block will be set to TRUE. + */ + FindCmdInsertionPoint(curCmd, &immed_right_cmd, &cur_cmd_should_block); + + if (immed_right_cmd == NULL) { + /* append */ + InsertCmd(gstWBInfo.last_cmd, NULL, curCmd, &gstWBInfo.first_cmd, + &gstWBInfo.last_cmd); + } else { + /* insert */ + InsertCmd(immed_right_cmd->prev, immed_right_cmd, curCmd, + &gstWBInfo.first_cmd, &gstWBInfo.last_cmd); + } + if (CmdType == CMD_WB_CLEARALL) { + CleanUpObsoletedWBCmds(curCmd); + } + /* + * curCmd is ALREADY executed! Do we need to check cur_cmd_should_block? + */ + } else { + InsertCmd(lastCmd, NULL, curCmd, &firstCmd, &lastCmd); + } switch (CmdType) { case CMD_NEW: break; *************** *** 1552,1555 **** --- 1752,1756 ---- case CMD_MANY_TO_ONE: break; case CMD_GOTO_PAGE: curCmd->count_after = NumObjs; break; + case CMD_WB_CLEARALL: break; } curCmd = lastCmd; *************** *** 1559,1563 **** int CmdType; { ! register struct SelRec *sel_ptr, *next_sel; if (historyDepth == 0) return; --- 1760,1764 ---- int CmdType; { ! struct SelRec *sel_ptr=NULL, *next_sel=NULL; if (historyDepth == 0) return; *************** *** 1570,1576 **** free(sel_ptr); } ! if (stackingPosition != NULL) free(stackingPosition); stackingPosition = NULL; stackingCount = 0; topSelBeforeInCmd = botSelBeforeInCmd = NULL; } --- 1771,1787 ---- free(sel_ptr); } ! if (stackingPosition != NULL) { ! if (stackingPositionHasIds) { ! int i=0; ! ! for (i=0; i < stackingCount; i++) { ! UtilFree((char*)(stackingPosition[i])); ! } ! } ! free(stackingPosition); ! } stackingPosition = NULL; stackingCount = 0; + stackingPositionHasIds = FALSE; topSelBeforeInCmd = botSelBeforeInCmd = NULL; } *************** *** 1634,1635 **** --- 1845,1853 ---- } + void RecordWBClearAll() + { + if (gstWBInfo.do_whiteboard) { + PrepareToRecord(CMD_WB_CLEARALL, NULL, NULL, 0); + RecordCmd(CMD_WB_CLEARALL, NULL, NULL, NULL, 0); + } + } *** color.c.orig Wed May 19 10:26:38 1999 --- color.c Wed May 19 10:26:38 1999 *************** *** 178,181 **** --- 178,182 ---- int len; + if (p_color != NULL) memset(p_color, 0, sizeof(XColor)); if (!useLocalRGBTxt || *psz_color == '#') { return (int)XParseColor(mainDisplay, mainColormap, psz_color, p_color); *************** *** 454,463 **** } } ! colorDump = FALSE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"InitialPrintInColor")) != ! NULL) { ! if (UtilStrICmp(c_ptr, "true") == 0) { ! colorDump = TRUE; ! } } } --- 455,462 ---- } } ! colorDump = (!PRTGIF); if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"InitialPrintInColor")) != ! NULL && UtilStrICmp(c_ptr, "false") == 0) { ! colorDump = FALSE; } } *** convxim.c.orig Wed May 19 10:26:40 1999 --- convxim.c Wed May 19 10:26:41 1999 *************** *** 130,133 **** --- 130,134 ---- sprintf(buf, "locale is \"%s\".\n", locale==NULL ? "(null)" : locale); Msg(buf); + setlocale(LC_NUMERIC, "C"); #endif /* ~_NO_LOCALE_SUPPORT */ } *** cutpaste.c.orig Wed May 19 10:26:42 1999 --- cutpaste.c Wed May 19 10:26:42 1999 *************** *** 2082,2085 **** --- 2082,2090 ---- nReturn = !DoPasteProperties(*pp_check_array, pProp); } + break; + case RESTORE_PROP: + if (btn_id == RESTORE_BUTTON) { + nReturn = !DoPasteProperties(*pp_check_array, pProp); + } break; } *** drawing.c.orig Wed May 19 10:26:44 1999 --- drawing.c Wed May 19 10:26:44 1999 *************** *** 93,99 **** #include "text.e" #include "util.e" - #ifdef _TGIF_WB - #include "wb1.e" - #endif /* _TGIF_WB */ #include "xbitmap.e" #include "xpixmap.e" --- 93,96 ---- *************** *** 2134,2141 **** } else if (strcmp(name, "SetExportPixelTrim()") == 0) { SetExportPixelTrim(NULL); - #ifdef _TGIF_WB - } else if (strcmp(name, "WhiteBoard()") == 0) { - WhiteBoard(); - #endif /* _TGIF_WB */ } else if (strcmp(name, "ToggleColorLayers()") == 0) { ToggleColorLayers(); --- 2131,2134 ---- *************** *** 2417,2420 **** --- 2410,2417 ---- SetExportBitmapThreshold(NULL); } + } else if (strcmp(name, "PreciseScaleEverything()") == 0) { + PreciseScaleEverything(); + } else if (strcmp(name, "SetPaperColor()") == 0) { + SetPaperColor(); } } *************** *** 2679,2692 **** } return INVALID; ! } else if ((button_ev->button == Button3) && ! (button_ev->state & (ShiftMask | ControlMask))) { SetCurChoice(NOTHING); return INVALID; ! } else if (((button_ev->button == Button2) && curChoice == NOTHING && ! (button_ev->state & (ShiftMask | ControlMask))) || (inHyperSpace && button_ev->button == Button1)) { Teleport(button_ev); return INVALID; ! } else if ((button_ev->button == Button1) && curChoice == NOTHING && ((button_ev->state & (ShiftMask | ControlMask)) == 0) && btn1Warp) { --- 2676,2693 ---- } return INVALID; ! } else if (button_ev->button == Button3 && ! (button_ev->state & ShiftMask)) { SetCurChoice(NOTHING); return INVALID; ! } else if (button_ev->button == Button2 && curChoice == DRAWTEXT && ! textCursorShown && (button_ev->state & ControlMask)) { ! MoveEditText(input); ! return INVALID; ! } else if ((button_ev->button == Button2 && curChoice == NOTHING && ! (button_ev->state & ShiftMask)) || (inHyperSpace && button_ev->button == Button1)) { Teleport(button_ev); return INVALID; ! } else if (button_ev->button == Button1 && curChoice == NOTHING && ((button_ev->state & (ShiftMask | ControlMask)) == 0) && btn1Warp) { *** dup.c.orig Wed May 19 10:26:46 1999 --- dup.c Wed May 19 10:26:46 1999 *************** *** 67,70 **** --- 67,75 ---- ToObjPtr->id = FromObjPtr->id; + if (FromObjPtr->creator_full_id != NULL) { + UtilFree(ToObjPtr->creator_full_id); + ToObjPtr->creator_full_id = UtilStrDup(FromObjPtr->creator_full_id); + if (ToObjPtr->creator_full_id == NULL) FailAllocMessage(); + } switch (FromObjPtr->type) { case OBJ_SYM: *************** *** 162,171 **** sizeof(FromObjPtr->bg_color_str)); ToObjPtr->id = objId++; - if (FromObjPtr->creator_full_id != NULL) { - ToObjPtr->creator_full_id = UtilStrDup(FromObjPtr->creator_full_id); - if (ToObjPtr->creator_full_id == NULL) FailAllocMessage(); - } else { - /* NULL creator_full_id means that it's created locally */ - } ToObjPtr->dirty = FALSE; ToObjPtr->rotation = FromObjPtr->rotation; --- 167,170 ---- *************** *** 758,762 **** } - static void DupMiniLine(pMiniLine, pOwnerMiniLines, pOwnerBlock, ppFirstMiniLine, ppLastMiniLine) --- 757,760 ---- *** edit.c.orig Wed May 19 10:26:47 1999 --- edit.c Wed May 19 10:26:47 1999 *************** *** 499,505 **** static ! void BreakATextObj(ObjPtr, into_words, poli) struct ObjRec *ObjPtr; ! int into_words; ObjListInfo *poli; { --- 499,505 ---- static ! void BreakATextObj(ObjPtr, how, poli) struct ObjRec *ObjPtr; ! int how; ObjListInfo *poli; { *************** *** 529,533 **** TransformPointThroughCTM(0, 0, prototype->ctm, &tx_to_move, &ty_to_move); } ! BreakMiniLines(minilines, into_words, ObjPtr->x, text_ptr->baseline_y, prototype, tx_to_move, ty_to_move, poli); --- 529,533 ---- TransformPointThroughCTM(0, 0, prototype->ctm, &tx_to_move, &ty_to_move); } ! BreakMiniLines(minilines, how, ObjPtr->x, text_ptr->baseline_y, prototype, tx_to_move, ty_to_move, poli); *************** *** 547,551 **** /* return TRUE if breaking into words */ { ! int can_do_words=FALSE; struct SelRec *sel_ptr=NULL; --- 547,552 ---- /* return TRUE if breaking into words */ { ! int how=INVALID, can_do_lines=FALSE, can_do_words=FALSE; ! char spec[MAXSTRING+1]; struct SelRec *sel_ptr=NULL; *************** *** 555,558 **** --- 556,561 ---- if (obj_ptr->type == OBJ_TEXT && !obj_ptr->locked) { struct TextRec *text_ptr=obj_ptr->detail.t; + MiniLinesInfo *minilines=(&text_ptr->minilines); + if (text_ptr->read_only) continue; if (CanBreakMiniLinesIntoWords(&text_ptr->minilines)) { *************** *** 559,577 **** can_do_words = TRUE; } } ! if (can_do_words) break; } ! if (!can_do_words) return FALSE; ! sprintf(gszMsgBox, "%s. %s? (%s %s.)", ! "You may break text at either character or word boundaries", ! "Would you like to break text at word boundaries", ! "Please click on NO to break text at character boundaries", ! "or click on CANCEL to abort"); ! switch (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: return TRUE; ! case MB_ID_NO: return FALSE; ! default: break; } ! return INVALID; } --- 562,616 ---- can_do_words = TRUE; } + if (minilines->first->next != NULL) can_do_lines = TRUE; } ! if (can_do_lines && can_do_words) break; } ! if (can_do_lines) { ! if (can_do_words) { ! sprintf(gszMsgBox, "%s? [cwl](c)", ! "Would you like to break text at char/word/line boundaries"); ! } else { ! sprintf(gszMsgBox, "%s? [cl](c)", ! "Would you like to break text at char/line boundaries"); ! } ! } else if (can_do_words) { ! sprintf(gszMsgBox, "%s? [cw](c)", ! "Would you like to break text at char/word boundaries"); ! } else { ! return BREAK_CHAR; } ! *spec = '\0'; ! if (Dialog(gszMsgBox, NULL, spec) == INVALID) { ! return INVALID; ! } ! UtilTrimBlanks(spec); ! strcpy(gszMsgBox, spec); ! gszMsgBox[1] = '\0'; ! UtilStrLower(gszMsgBox); ! if (can_do_lines) { ! if (can_do_words) { ! switch (*gszMsgBox) { ! case 'c': how = BREAK_CHAR; break; ! case 'w': how = BREAK_WORD; break; ! case 'l': how = BREAK_LINE; break; ! } ! } else { ! switch (*gszMsgBox) { ! case 'c': how = BREAK_CHAR; break; ! case 'l': how = BREAK_LINE; break; ! } ! } ! } else if (can_do_words) { ! switch (*gszMsgBox) { ! case 'c': how = BREAK_CHAR; break; ! case 'w': how = BREAK_WORD; break; ! } ! } ! if (how == INVALID) { ! sprintf(gszMsgBox, "Invalid specification on how to break up text: '%s'.", ! spec); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! } ! return how; } *************** *** 578,586 **** void BreakUpText() { ! struct ObjRec *obj_ptr; ! struct SelRec *sel_ptr, *next_sel; ! int sel_ltx, sel_lty, sel_rbx, sel_rby; ! int changed=FALSE, read_only_text_exists=FALSE; ! int into_words=INVALID; if (topSel == NULL) { --- 617,624 ---- void BreakUpText() { ! struct ObjRec *obj_ptr=NULL; ! struct SelRec *sel_ptr=NULL, *next_sel=NULL; ! int sel_ltx=selLtX, sel_lty=selLtY, sel_rbx=selRbX, sel_rby=selRbY; ! int how=INVALID, changed=FALSE, read_only_text_exists=FALSE; if (topSel == NULL) { *************** *** 589,597 **** return; } ! if ((into_words=GetBreakSpec()) == INVALID) return; HighLightReverse(); - sel_ltx = selLtX; sel_lty = selLtY; - sel_rbx = selRbX; sel_rby = selRbY; StartCompositeCmd(); --- 627,633 ---- return; } ! if ((how=GetBreakSpec()) == INVALID) return; HighLightReverse(); StartCompositeCmd(); *************** *** 611,615 **** PrepareToReplaceAnObj(obj_ptr); ! BreakATextObj(obj_ptr, into_words, &oli); oli.top_sel->obj->prev = obj_ptr->prev; --- 647,651 ---- PrepareToReplaceAnObj(obj_ptr); ! BreakATextObj(obj_ptr, how, &oli); oli.top_sel->obj->prev = obj_ptr->prev; *** eps.c.orig Wed May 19 10:26:49 1999 --- eps.c Wed May 19 10:26:49 1999 *************** *** 989,993 **** { struct EPSLineRec *line_ptr, *next_line; ! int i; char *c_ptr, *line, loc_time[MAXSTRING+1]; char tiff_eps_fname[MAXPATHLENGTH+1]; --- 989,993 ---- { struct EPSLineRec *line_ptr, *next_line; ! int i=0; char *c_ptr, *line, loc_time[MAXSTRING+1]; char tiff_eps_fname[MAXPATHLENGTH+1]; *************** *** 1317,1320 **** --- 1317,1357 ---- } + void SetEPSObjCTM(obj_ptr, p_orig_obbox) + struct ObjRec *obj_ptr; + struct BBRec *p_orig_obbox; + { + struct XBmRec *xbm_ptr=obj_ptr->detail.xbm; + int w=(p_orig_obbox->rbx-p_orig_obbox->ltx); + int h=(p_orig_obbox->rby-p_orig_obbox->lty), image_w=0, image_h=0; + + if (obj_ptr->ctm != NULL) return; + + if (xbm_ptr->real_type == XBM_XBM) { + image_w = xbm_ptr->image_w; + image_h = xbm_ptr->image_h; + } else { + image_w = xbm_ptr->eps_w; + image_h = xbm_ptr->eps_h; + } + if (image_w != w || image_h != h) { + float fval=(float)0; + struct XfrmMtrxRec ctm; + + memset(&ctm, 0, sizeof(struct XfrmMtrxRec)); + obj_ptr->orig_obbox.ltx = p_orig_obbox->ltx; + obj_ptr->orig_obbox.lty = p_orig_obbox->lty; + obj_ptr->orig_obbox.rbx = p_orig_obbox->rbx; + obj_ptr->orig_obbox.rby = p_orig_obbox->rby; + fval = ((float)w)/((float)image_w)*((float)1000.0); + ctm.m[CTM_SX] = (double)fval; + fval = ((float)h)/((float)image_h)*((float)1000.0); + ctm.m[CTM_SY] = (double)fval; + obj_ptr->obbox.rbx = obj_ptr->bbox.rbx = p_orig_obbox->ltx+image_w; + obj_ptr->obbox.rby = obj_ptr->bbox.rby = p_orig_obbox->lty+image_h; + SetCTM(obj_ptr, &ctm); + AdjObjBBox(obj_ptr); + } + } + struct ObjRec *CreateEPSObj(FileName, ImageW, ImageH, bitmap, image, num_lines, lines, epsf_level, llx, lly, urx, ury, write_date) *************** *** 1325,1332 **** float *llx, *lly, *urx, *ury; { ! struct XBmRec *xbm_ptr; ! struct ObjRec *obj_ptr; int len=strlen(FileName), w, h; ! char *name; name = (char*)malloc((len+1)*sizeof(char)); --- 1362,1370 ---- float *llx, *lly, *urx, *ury; { ! struct XBmRec *xbm_ptr=NULL; ! struct ObjRec *obj_ptr=NULL; ! struct BBRec orig_obbox; int len=strlen(FileName), w, h; ! char *name=NULL; name = (char*)malloc((len+1)*sizeof(char)); *************** *** 1380,1385 **** obj_ptr->bbox.ltx = obj_ptr->obbox.ltx = obj_ptr->x = drawOrigX; obj_ptr->bbox.lty = obj_ptr->obbox.lty = obj_ptr->y = drawOrigY; ! obj_ptr->bbox.rbx = obj_ptr->obbox.rbx = w + drawOrigX; ! obj_ptr->bbox.rby = obj_ptr->obbox.rby = h + drawOrigY; obj_ptr->type = OBJ_XBM; obj_ptr->color = colorIndex; --- 1418,1423 ---- obj_ptr->bbox.ltx = obj_ptr->obbox.ltx = obj_ptr->x = drawOrigX; obj_ptr->bbox.lty = obj_ptr->obbox.lty = obj_ptr->y = drawOrigY; ! obj_ptr->bbox.rbx = obj_ptr->obbox.rbx = xbm_ptr->image_w + drawOrigX; ! obj_ptr->bbox.rby = obj_ptr->obbox.rby = xbm_ptr->image_h + drawOrigY; obj_ptr->type = OBJ_XBM; obj_ptr->color = colorIndex; *************** *** 1392,1395 **** --- 1430,1437 ---- obj_ptr->ctm = NULL; + SetBBRec(&orig_obbox, drawOrigX, drawOrigY, drawOrigX+xbm_ptr->image_w, + drawOrigY+xbm_ptr->image_h); + SetEPSObjCTM(obj_ptr, &orig_obbox); + return obj_ptr; } *** exec.c.orig Wed May 19 10:26:51 1999 --- exec.c Wed May 19 10:26:51 1999 *************** *** 100,103 **** --- 100,106 ---- int userAbortExec=FALSE; + static int execInterruptEnabled=TRUE; + static int execInterruptQueued=FALSE; + struct AttrRec *warpToAttr=NULL; *************** *** 175,178 **** --- 178,182 ---- int ExecGetDrawingArea ARGS_DECL((char**, struct ObjRec *, char*)); int ExecGetSelObjBBox ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecGetNamedObjBBox ARGS_DECL((char**, struct ObjRec *, char*)); int ExecMoveSelObjAbs ARGS_DECL((char**, struct ObjRec *, char*)); int ExecAssign ARGS_DECL((char**, struct ObjRec *, char*)); *************** *** 200,203 **** --- 204,208 ---- int ExecGetAttrBBox ARGS_DECL((char**, struct ObjRec *, char*)); int ExecSizeSelObjAbs ARGS_DECL((char**, struct ObjRec *, char*)); + int ExecSizeNamedObjAbs ARGS_DECL((char**, struct ObjRec *, char*)); int ExecMessageBox ARGS_DECL((char**, struct ObjRec *, char*)); int ExecGetUserInput ARGS_DECL((char**, struct ObjRec *, char*)); *************** *** 275,278 **** --- 280,284 ---- void ExecStartCreateGroup ARGS_DECL((struct ObjRec *, char*)); void ExecCreateGroup ARGS_DECL((struct ObjRec *, char*)); + int ExecSetAllowInterrupt ARGS_DECL((char**, struct ObjRec *, char*)); static *************** *** 323,326 **** --- 329,333 ---- { (NLFN*)ExecGetDrawingArea, "get_drawing_area", 4, 0}, { (NLFN*)ExecGetSelObjBBox, "get_selected_obj_bbox", 4, 0}, + { (NLFN*)ExecGetNamedObjBBox, "get_named_obj_bbox", 5, 0}, { (NLFN*)ExecMoveSelObjAbs, "move_selected_obj_absolute", 2, 0}, { (NLFN*)ExecAssign, "assign", 2, 0}, *************** *** 348,351 **** --- 355,359 ---- { (NLFN*)ExecGetAttrBBox, "get_attr_bbox", 5, 0}, { (NLFN*)ExecSizeSelObjAbs, "size_selected_obj_absolute", 2, 0}, + { (NLFN*)ExecSizeNamedObjAbs, "size_named_obj_absolute", 3, 0}, { (NLFN*)ExecMessageBox, "message_box", 4, 0}, { (NLFN*)ExecGetUserInput, "get_user_input", 3, 0}, *************** *** 423,426 **** --- 431,435 ---- { (NLFN*)ExecStartCreateGroup, "start_create_group_obj", 0, 0}, { (NLFN*)ExecCreateGroup, "create_group_obj", 0, 0}, + { (NLFN*)ExecSetAllowInterrupt, "set_allow_interrupt", 1, 0}, { NULL, NULL, 0, 0 } }; *************** *** 1445,1448 **** --- 1454,1475 ---- static + int ReturnInterruptedExec() + { + if (!execInterruptEnabled) { + if (execInterruptQueued) { + sprintf(gszMsgBox, "%s. %s %s.\n\n%s (%s)?", + "User interrupt received", TOOL_NAME, + "is waiting for clean up to complete", + "Are you sure you don't want to wait for clean up to complete", + "this may leave the scripts in an inconsistent state"); + return (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) == MB_ID_YES); + } + execInterruptQueued = TRUE; + return FALSE; + } + return TRUE; + } + + static int CheckExecInterrupt(check_any_button, orig_cmd) int check_any_button; *************** *** 1456,1460 **** (ev.xany.window == mainWindow && ev.type == MapNotify)) { XPutBackEvent(mainDisplay, &ev); ! return TRUE; } } else if ((ev.xany.window == iconBaseWindow && ev.type == MapNotify) || --- 1483,1487 ---- (ev.xany.window == mainWindow && ev.type == MapNotify)) { XPutBackEvent(mainDisplay, &ev); ! return ReturnInterruptedExec(); } } else if ((ev.xany.window == iconBaseWindow && ev.type == MapNotify) || *************** *** 1461,1465 **** (ev.xany.window == mainWindow && ev.type == UnmapNotify)) { XPutBackEvent(mainDisplay, &ev); ! return TRUE; } else if (ev.type == ConfigureNotify) { Reconfigure(FALSE); --- 1488,1492 ---- (ev.xany.window == mainWindow && ev.type == UnmapNotify)) { XPutBackEvent(mainDisplay, &ev); ! return ReturnInterruptedExec(); } else if (ev.type == ConfigureNotify) { Reconfigure(FALSE); *************** *** 1471,1475 **** ev.xvisibility.state == VisibilityUnobscured) { XPutBackEvent(mainDisplay, &ev); ! return TRUE; } else { ExposeEventHandler(&ev, TRUE); --- 1498,1502 ---- ev.xvisibility.state == VisibilityUnobscured) { XPutBackEvent(mainDisplay, &ev); ! return ReturnInterruptedExec(); } else { ExposeEventHandler(&ev, TRUE); *************** *** 1479,1483 **** ev.xvisibility.state == VisibilityUnobscured) { XPutBackEvent(mainDisplay, &ev); ! return TRUE; } else { ExposeEventHandler(&ev, TRUE); --- 1506,1510 ---- ev.xvisibility.state == VisibilityUnobscured) { XPutBackEvent(mainDisplay, &ev); ! return ReturnInterruptedExec(); } else { ExposeEventHandler(&ev, TRUE); *************** *** 1497,1501 **** } Msg(gszMsgBox); ! return TRUE; } if (!check_any_button) { --- 1524,1528 ---- } Msg(gszMsgBox); ! return ReturnInterruptedExec(); } if (!check_any_button) { *************** *** 2354,2358 **** text_ptr = attr_ptr->obj->detail.t; ObjFontInfoToCurFontInfo(text_ptr); ! StrSegInfoToCurFontInfo(text_ptr->minilines.first->first_block->seg); penPat = attr_ptr->obj->detail.t->pen; --- 2381,2385 ---- text_ptr = attr_ptr->obj->detail.t; ObjFontInfoToCurFontInfo(text_ptr); ! StrSegInfoToCurFontInfo(GetTextPtrFirstStrSeg(text_ptr)); penPat = attr_ptr->obj->detail.t->pen; *************** *** 3692,3695 **** --- 3719,3775 ---- } + int ExecGetNamedObjBBox(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* get_named_obj_bbox(obj_name,ltx_attr,lty_attr,rbx_attr,rby_attr); */ + { + char *obj_name=argv[0]; + char *ltx_attr_name=argv[1], *lty_attr_name=argv[2]; + char *rbx_attr_name=argv[3], *rby_attr_name=argv[4], buf[40]; + struct ObjRec *top_owner=NULL, *named_obj=NULL; + struct AttrRec *ltx_attr_ptr, *lty_attr_ptr, *rbx_attr_ptr, *rby_attr_ptr; + struct ObjRec *ltx_attr_owner_obj=NULL, *lty_attr_owner_obj=NULL; + struct ObjRec *rbx_attr_owner_obj=NULL, *rby_attr_owner_obj=NULL; + + UtilRemoveQuotes(obj_name); + UtilTrimBlanks(obj_name); + UtilRemoveQuotes(ltx_attr_name); UtilRemoveQuotes(lty_attr_name); + UtilRemoveQuotes(rbx_attr_name); UtilRemoveQuotes(rby_attr_name); + + named_obj = FindObjWithName(botObj, obj_ptr, obj_name, FALSE, + FALSE, NULL, &top_owner); + if (named_obj == NULL) { + sprintf(execDummyStr, "%s '%s' %s '%s' %s.", + "Cannot find object named", obj_name, "while executing the", + orig_cmd, "command"); + MsgBox(execDummyStr, TOOL_NAME, INFO_MB); + return FALSE; + } + sprintf(execDummyStr, "%s=", ltx_attr_name); + ltx_attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, <x_attr_owner_obj); + if (ltx_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + sprintf(execDummyStr, "%s=", lty_attr_name); + lty_attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, <y_attr_owner_obj); + if (lty_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + sprintf(execDummyStr, "%s=", rbx_attr_name); + rbx_attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &rbx_attr_owner_obj); + if (rbx_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + sprintf(execDummyStr, "%s=", rby_attr_name); + rby_attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &rby_attr_owner_obj); + if (rby_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + + sprintf(buf, "%1d", named_obj->obbox.ltx); + ReplaceAttrFirstValue(ltx_attr_owner_obj, ltx_attr_ptr, buf); + sprintf(buf, "%1d", named_obj->obbox.lty); + ReplaceAttrFirstValue(lty_attr_owner_obj, lty_attr_ptr, buf); + sprintf(buf, "%1d", named_obj->obbox.rbx); + ReplaceAttrFirstValue(rbx_attr_owner_obj, rbx_attr_ptr, buf); + sprintf(buf, "%1d", named_obj->obbox.rby); + ReplaceAttrFirstValue(rby_attr_owner_obj, rby_attr_ptr, buf); + + SetFileModified(TRUE); + return TRUE; + } + int ExecMoveSelObjAbs(argv, obj_ptr, orig_cmd) char **argv, *orig_cmd; *************** *** 4427,4430 **** --- 4507,4523 ---- return FALSE; } + if (abs_w < 0 || abs_h < 0) { + if (abs_w < 0) { + sprintf(gszMsgBox, "%s '%s' %s '%s' %s.", + "Width of", abs_w_str, "is invalid for the", orig_cmd, + "command"); + } else { + sprintf(gszMsgBox, "%s '%s' %s '%s' %s.", + "Height of", abs_h_str, "is invalid for the", orig_cmd, + "command"); + } + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + return FALSE; + } if (abs_w != selObjRbX-selObjLtX || abs_h != selObjRbY-selObjLtY) { SizeAllSelObj(abs_w, abs_h); *************** *** 4433,4436 **** --- 4526,4578 ---- } + int ExecSizeNamedObjAbs(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* size_named_obj_absolute(obj_name,abs_w,abs_h); */ + { + char *obj_name=argv[0], *abs_w_str=argv[1], *abs_h_str=argv[2]; + int abs_w=0, abs_h=0; + struct ObjRec *top_owner=NULL, *named_obj=NULL; + + UtilRemoveQuotes(obj_name); + UtilTrimBlanks(obj_name); + UtilRemoveQuotes(abs_w_str); + UtilRemoveQuotes(abs_h_str); + + named_obj = FindObjWithName(botObj, obj_ptr, obj_name, FALSE, + FALSE, NULL, &top_owner); + if (named_obj == NULL) { + sprintf(execDummyStr, "%s '%s' %s '%s' %s.", + "Cannot find object named", obj_name, "while executing the", + orig_cmd, "command"); + MsgBox(execDummyStr, TOOL_NAME, INFO_MB); + return FALSE; + } + + if (!IntExpression(abs_w_str, &abs_w, orig_cmd) || + !IntExpression(abs_h_str, &abs_h, orig_cmd)) { + return FALSE; + } + if (abs_w < 0 || abs_h < 0) { + if (abs_w < 0) { + sprintf(gszMsgBox, "%s '%s' %s '%s' %s.", + "Width of", abs_w_str, "is invalid for the", orig_cmd, + "command"); + } else { + sprintf(gszMsgBox, "%s '%s' %s '%s' %s.", + "Height of", abs_h_str, "is invalid for the", orig_cmd, + "command"); + } + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + return FALSE; + } + if (abs_w != named_obj->obbox.rbx-named_obj->obbox.ltx || + abs_h != named_obj->obbox.lty-named_obj->obbox.rby) { + /* SizeAnObj() can only be called from within an internal command */ + SizeAnObj(named_obj, top_owner, abs_w, abs_h); + } + return TRUE; + } + int ExecMessageBox(argv, obj_ptr, orig_cmd) char **argv, *orig_cmd; *************** *** 5194,5197 **** --- 5336,5351 ---- static int gnDRand48Seeded=FALSE; + #ifdef _NO_RAND48 + static + int NoRand48(orig_cmd) + char *orig_cmd; + { + sprintf(gszMsgBox, "%s '%s' %s.", + "The", orig_cmd, "command is not available on this platform"); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + return FALSE; + } + #endif /* _NO_RAND48 */ + int ExecSRand48(argv, obj_ptr, orig_cmd) char **argv, *orig_cmd; *************** *** 5199,5202 **** --- 5353,5357 ---- /* srand48(use_cur_time_as_seed); */ { + #ifndef _NO_RAND48 char *use_cur_time_str=argv[0]; int use_cur_time=0; *************** *** 5218,5221 **** --- 5373,5379 ---- return TRUE; + #else /* _NO_RAND48 */ + return NoRand48(orig_cmd); + #endif /* ~_NO_RAND48 */ } *************** *** 5225,5228 **** --- 5383,5387 ---- /* drand48(attr_name); */ { + #ifndef _NO_RAND48 char *attr_name=argv[0], buf[40]; struct AttrRec *attr_ptr; *************** *** 5245,5248 **** --- 5404,5410 ---- return TRUE; + #else /* _NO_RAND48 */ + return NoRand48(orig_cmd); + #endif /* ~_NO_RAND48 */ } *************** *** 6430,6435 **** return TRUE; } MoveAnObj(named_obj, top_owner, dx, dy); - UpdSelBBox(); SetFileModified(TRUE); --- 6592,6597 ---- return TRUE; } + /* MoveAnObj() can only be called from within an internal command */ MoveAnObj(named_obj, top_owner, dx, dy); SetFileModified(TRUE); *************** *** 6467,6473 **** return TRUE; } MoveAnObj(named_obj, top_owner, ltx-named_obj->obbox.ltx, lty-named_obj->obbox.lty); - UpdSelBBox(); SetFileModified(TRUE); --- 6629,6635 ---- return TRUE; } + /* MoveAnObj() can only be called from within an internal command */ MoveAnObj(named_obj, top_owner, ltx-named_obj->obbox.ltx, lty-named_obj->obbox.lty); SetFileModified(TRUE); *************** *** 7473,7478 **** NewCurText(); PrepareToReplaceAnObj(curTextObj); ! DynStrSet(&topObj->detail.t->minilines.first->first_block->seg->dyn_str, ! the_str); curTextModified = TRUE; CreateTextObj(TRUE, FALSE); --- 7635,7639 ---- NewCurText(); PrepareToReplaceAnObj(curTextObj); ! DynStrSet(&GetTextObjFirstStrSeg(topObj)->dyn_str, the_str); curTextModified = TRUE; CreateTextObj(TRUE, FALSE); *************** *** 7974,7977 **** --- 8135,8155 ---- } + int ExecSetAllowInterrupt(argv, obj_ptr, orig_cmd) + char **argv, *orig_cmd; + struct ObjRec *obj_ptr; + /* set_allow_interrupt(true_or_false); */ + { + char *allow_str=argv[0]; + int currently_enabled=execInterruptEnabled; + + UtilRemoveQuotes(allow_str); + execInterruptEnabled = (strcmp(allow_str, "TRUE") == 0); + if (!currently_enabled && execInterruptEnabled && execInterruptQueued) { + gnAbortExec = TRUE; + return FALSE; + } + return TRUE; + } + /* --------------------- End of Exec Routines --------------------- */ *************** *** 8300,8303 **** --- 8478,8483 ---- if (nBegin) { userAbortExec = FALSE; + execInterruptEnabled = TRUE; + execInterruptQueued = FALSE; sSavedXpmOutputVersion = GetXpmOutputVersion(); sTrimBBox.ltx = leftExportPixelTrim; *** expr.c.orig Wed May 19 10:26:56 1999 --- expr.c Wed May 19 10:26:56 1999 *************** *** 70,81 **** #define OP_END 26 - static char *opName[] = { - "BEGIN", "?", ":", "||", "&&", "|", "^", "&", "==", "!=", ">", "<", ">=", - "<=", "<<", ">>", "+", "-", "*", "/", "//", "%", "!", "~", ")", "(", "END", - NULL - }; - - #define MAXOP 27 - struct OpRec { int op_code; --- 70,73 ---- *************** *** 902,905 **** --- 894,904 ---- #ifdef _TGIF_DBG + static char *opName[] = { + "BEGIN", "?", ":", "||", "&&", "|", "^", "&", "==", "!=", ">", "<", ">=", + "<=", "<<", ">>", "+", "-", "*", "/", "//", "%", "!", "~", ")", "(", "END", + NULL + }; + #define MAXOP 27 + static void DebugOpStk() *** file.c.orig Wed May 19 10:26:58 1999 --- file.c Wed May 19 10:26:58 1999 *************** *** 187,190 **** --- 187,196 ---- struct BBRec *gpExportClipBBox=NULL; + int gnNumFilePSFontAliases=0; + KeyValInfo *gaFilePSFontAliases=NULL; + + static int psRegMarksInTiledPageMode=INVALID; + static float psRegMarksGray=(float)0.95; + static int importingPageNum=(-1); static char importingPageName[MAXSTRING+1]; *************** *** 297,303 **** } else { for (psz=pszStart; ! *psz != '\0' && *psz != ' ' && *psz != '\t' && *psz != '('; psz++) { } if (*psz != '\0') { *ppszEnd = psz; --- 303,312 ---- } else { for (psz=pszStart; ! *psz!='\0' && *psz!=' ' && *psz!='\t' && *psz!='(' && *psz!='%'; psz++) { } + if (*psz == '%') { + *psz = '\0'; + } if (*psz != '\0') { *ppszEnd = psz; *************** *** 815,819 **** writeFileFailed = TRUE; } ! if ((BotObjPtr != NULL || tgifObj != NULL) && !copyInDrawTextMode) { if (fprintf(FP, "%%\n") == EOF) { writeFileFailed = TRUE; --- 824,829 ---- writeFileFailed = TRUE; } ! if ((BotObjPtr != NULL || tgifObj != NULL) && !copyInDrawTextMode && ! !serializingFile) { if (fprintf(FP, "%%\n") == EOF) { writeFileFailed = TRUE; *************** *** 1892,1896 **** if (obj_ptr->creator_full_id == NULL) { ! sprintf(buf, "%1d\t%s", obj_ptr->id, gszLocalPID); } else { strcpy(buf, obj_ptr->creator_full_id); --- 1902,1906 ---- if (obj_ptr->creator_full_id == NULL) { ! sprintf(buf, "%1d/%s", obj_ptr->id, gszLocalPID); } else { strcpy(buf, obj_ptr->creator_full_id); *************** *** 3274,3279 **** } ! int ImportGivenFile(file_name) char *file_name; /* returns TRUE if ok */ /* returns FALSE if file_name looks ok, only have temporary problems */ --- 3284,3290 ---- } ! int ImportGivenFile(file_name, group_and_lock) char *file_name; + int group_and_lock; /* returns TRUE if ok */ /* returns FALSE if file_name looks ok, only have temporary problems */ *************** *** 3523,3526 **** --- 3534,3549 ---- justDupped = FALSE; + if (group_and_lock && topObj != NULL) { + if (topObj != botObj || topObj->type==OBJ_POLY || + topObj->type==OBJ_POLYGON) { + struct ObjRec *top_obj=topObj, *bot_obj=botObj; + + SelAllObj(FALSE); + curPage->top = curPage->bot = topObj = botObj = NULL; + CreateGroupObj(top_obj, bot_obj); + RemoveAllSel(); + } + topObj->locked = TRUE; + } SelAllObj(FALSE); *************** *** 3544,3548 **** if (!importFromLibrary && !file_is_remote) { ! SetCurImportDir(file_name); } if (file_is_remote) { --- 3567,3571 ---- if (!importFromLibrary && !file_is_remote) { ! SetCurDir(file_name); } if (file_is_remote) { *************** *** 3584,3588 **** return; } ! ImportGivenFile(file_name); importingFile = FALSE; } --- 3607,3611 ---- return; } ! ImportGivenFile(file_name, FALSE); importingFile = FALSE; } *************** *** 3898,3901 **** --- 3921,3926 ---- while (XCheckWindowEvent(mainDisplay, drawWindow, ExposureMask, &ev)) ; + SaveStatusStrings(); + if (short_name) { sprintf(gszMsgBox, "Loading '%s' ...", rest); *************** *** 3907,3911 **** } } ! Msg(gszMsgBox); SetWatchCursor(drawWindow); SetWatchCursor(mainWindow); --- 3932,3936 ---- } } ! SetStringStatus(gszMsgBox); SetWatchCursor(drawWindow); SetWatchCursor(mainWindow); *************** *** 3966,3972 **** SetDefaultCursor(mainWindow); ShowCursor(); return FALSE; } - if (ObjFile == TRUE) { if (*gzipped_fname == '\0') { --- 3991,3999 ---- SetDefaultCursor(mainWindow); ShowCursor(); + + RestoreStatusStrings(); + return FALSE; } if (ObjFile == TRUE) { if (*gzipped_fname == '\0') { *************** *** 4014,4017 **** --- 4041,4045 ---- } Msg(gszMsgBox); + RestoreStatusStrings(); RedrawTitleWindow(); *************** *** 4805,4808 **** --- 4833,4856 ---- } } + if (psRegMarksInTiledPageMode == INVALID) { + psRegMarksInTiledPageMode = FALSE; + psRegMarksGray = 0.95; + if (!PRTGIF || cmdLineOpenDisplay) { + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME, + "PsRegMarksInTiledPageMode")) != NULL && + UtilStrICmp(c_ptr, "true") == 0) { + psRegMarksInTiledPageMode = TRUE; + } + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PsRegMarksGray")) != + NULL) { + psRegMarksGray = (float)atof(c_ptr); + if (psRegMarksGray < 0.0 || psRegMarksGray > 1.0) { + fprintf(stderr, "Invalid %s*PsRegMarksGray: '%s', %s.\n", + TOOL_NAME, c_ptr, "0.95 used"); + psRegMarksGray = 0.95; + } + } + } + } } *************** *** 5045,5048 **** --- 5093,5113 ---- static + void DumpRegMark(fp, pstem) + FILE *fp; + float *pstem; + { + float fval=(*pstem); + + fprintf(dumpFP, " %s ", gPsCmd[PS_GSAVE]); + fprintf(dumpFP, "%.3f 0 %s ", -fval, gPsCmd[PS_RMOVETO]); + fprintf(dumpFP, "2 %.3f %s 0 %s ", fval, gPsCmd[PS_MUL], gPsCmd[PS_RLINETO]); + fprintf(dumpFP, "%s %s\n", gPsCmd[PS_STROKE], gPsCmd[PS_GRESTORE]); + fprintf(dumpFP, " %s ", gPsCmd[PS_GSAVE]); + fprintf(dumpFP, "0 %.3f %s ", -fval, gPsCmd[PS_RMOVETO]); + fprintf(dumpFP, "0 2 %.3f %s %s ", fval, gPsCmd[PS_MUL], gPsCmd[PS_RLINETO]); + fprintf(dumpFP, "%s %s\n", gPsCmd[PS_STROKE], gPsCmd[PS_GRESTORE]); + } + + static int DoGenDump(FileName) char *FileName; *************** *** 5539,5542 **** --- 5604,5626 ---- ((float)psPageHeightInInch[pageStyle]) * ((float)PIX_PER_INCH) * 100.0 / printMag); + if (psRegMarksInTiledPageMode && tiledPageScaling < (float)1.0) { + float stem=((float)(min(x_dist,y_dist)))*((float)0.5); + + fprintf(dumpFP, "%s\n", gPsCmd[PS_GSAVE]); + fprintf(dumpFP, " 0.1 %s %.3f %s\n", gPsCmd[PS_SETLINEWIDTH], + psRegMarksGray, gPsCmd[PS_SETGRAY]); + + fprintf(dumpFP, " %s %.3f %.3f %s\n", gPsCmd[PS_NEWPATH], + real_ltx, real_lty, gPsCmd[PS_MOVETO]); + DumpRegMark(dumpFP, &stem); + fprintf(dumpFP, " %.3f 0 %s\n", f_rbx, gPsCmd[PS_RMOVETO]); + DumpRegMark(dumpFP, &stem); + fprintf(dumpFP, " 0 %.3f %s\n", f_rby, gPsCmd[PS_RMOVETO]); + DumpRegMark(dumpFP, &stem); + fprintf(dumpFP, " -%.3f 0 %s\n", f_rbx, gPsCmd[PS_RMOVETO]); + DumpRegMark(dumpFP, &stem); + + fprintf(dumpFP, "%s\n", gPsCmd[PS_GRESTORE]); + } fprintf(dumpFP, "%s\n", gPsCmd[PS_NEWPATH]); fprintf(dumpFP, " %.3f %.3f %s\n", real_ltx, real_lty, *************** *** 6462,6471 **** void NewProc() { ! 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; } } --- 6546,6563 ---- void NewProc() { ! if (gstWBInfo.do_whiteboard) { ! XBell(mainDisplay, 0); ! if (MsgBox("Ok to clear WhiteBoard?", TOOL_NAME, YNC_MB) != MB_ID_YES) { ! return; ! } ! } else { ! while (!DirIsRemote(curDir) && fileModified) { ! XBell(mainDisplay, 0); ! 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; + } } } *************** *** 6480,6484 **** Msg("Editing no file."); ! objId = 0; RedrawTitleWindow(); DelAllPages(); --- 6572,6580 ---- Msg("Editing no file."); ! if (gstWBInfo.do_whiteboard) { ! RecordWBClearAll(); ! } else { ! objId = 0; ! } RedrawTitleWindow(); DelAllPages(); *************** *** 6493,6497 **** --- 6589,6599 ---- int do_not_save=FALSE, need_to_check_auto_exec=FALSE; + if (gstWBInfo.do_whiteboard) { + MsgBox("'Open' is disabled when running in the WhiteBoard mode!", + TOOL_NAME, INFO_MB); + return; + } while (!DirIsRemote(curDir) && fileModified) { + XBell(mainDisplay, 0); switch (MsgBox("File modified, save file before open? [ync](y)", TOOL_NAME, YNC_MB)) { *************** *** 6590,6595 **** char file_name[MAXPATHLENGTH+1], *rest=NULL; int short_name, rc; ! FILE *fp; ! struct AttrRec *attr_ptr; if (gstWBInfo.do_whiteboard) { --- 6692,6698 ---- char file_name[MAXPATHLENGTH+1], *rest=NULL; int short_name, rc; ! FILE *fp=NULL; ! struct AttrRec *attr_ptr=NULL; ! struct SelRec *saved_top_sel=NULL, *saved_bot_sel=NULL; if (gstWBInfo.do_whiteboard) { *************** *** 6637,6641 **** StartCompositeCmd(); importingFile = TRUE; ! rc = ImportGivenFile(file_name); importingFile = FALSE; if (rc == BAD) { --- 6740,6744 ---- StartCompositeCmd(); importingFile = TRUE; ! rc = ImportGivenFile(file_name, TRUE); importingFile = FALSE; if (rc == BAD) { *************** *** 6651,6654 **** --- 6754,6763 ---- } } + HighLightReverse(); + saved_top_sel = topSel; + saved_bot_sel = botSel; + topSel = botSel = NULL; + UpdSelBBox(); + if ((attr_ptr=FindAttrWithName(tgifObj, "template=", NULL)) != NULL) { ReplaceAttrFirstValue(tgifObj, attr_ptr, short_name ? rest : file_name); *************** *** 6682,6685 **** --- 6791,6798 ---- sprintf(gszMsgBox, "Template set to '%s'.", short_name ? rest : file_name); Msg(gszMsgBox); + topSel = saved_top_sel; + botSel = saved_bot_sel; + UpdSelBBox(); + HighLightForward(); } *************** *** 6724,6727 **** --- 6837,6841 ---- while (!DirIsRemote(curDir) && fileModified) { + XBell(mainDisplay, 0); switch (MsgBox("File modified, save file before quit? [ync](y)", TOOL_NAME, YNC_MB)) { *** font.c.orig Wed May 19 10:27:01 1999 --- font.c Wed May 19 10:27:01 1999 *************** *** 189,192 **** --- 189,195 ---- int defaultSingleByteFont=FONT_TIM; + int gnNumPSFontAliases=0; + KeyValInfo *gaPSFontAliases=NULL; + static int numFakedFonts=0; static char fontNamePrefix[MAXSTRING+1]; *************** *** 670,673 **** --- 673,707 ---- } + static + char *LookupPSFontAliases(buf) + char *buf; + { + int i=0; + KeyValInfo *pKeyValue=NULL; + + for (i=0; i < gnNumPSFontAliases; i++, pKeyValue++) { + KeyValInfo *pKeyValue=(&gaPSFontAliases[i]); + + if (pKeyValue == NULL) return FALSE; + + if (pKeyValue != NULL && pKeyValue->key != NULL && + strcmp(pKeyValue->key, buf) == 0) { + return pKeyValue->value; + } + } + return NULL; + } + + void MapAliasedPSFontName(buf, buf_sz) + char *buf; + int buf_sz; + { + char *real_ps_font_name=NULL; + + if ((real_ps_font_name=LookupPSFontAliases(&buf[1])) != NULL) { + UtilStrCpyN(&buf[1], buf_sz-1, real_ps_font_name); + } + } + void SetTextExtentsInfo(pTextExtents) TextExtentsInfo *pTextExtents; *************** *** 1165,1168 **** --- 1199,1220 ---- static + void RemovePSFontNameVariations(ps_font_name_str) + char *ps_font_name_str; + /* + * Get rid of the '-' as in 'Zapfchancery-MediumItalic'. + * Also get rid of the '--' as in 'Helvetica-Narrow--Bold' and + * 'Helvetica-Narrow--'. + */ + { + char *psz=NULL; + + if ((psz=strstr(ps_font_name_str, "--")) != NULL) { + *psz = '\0'; + } else if ((psz=strchr(ps_font_name_str, '-')) != NULL) { + *psz = '\0'; + } + } + + static int DontReencode(pszFontName, nFontIndex, nFontStyle) char *pszFontName; *************** *** 1223,1227 **** strcpy(szFontStr, pszFontName); } ! if ((c_ptr=strchr(szFontStr, '-')) != NULL) *c_ptr = '\0'; UtilTrimBlanks(szFontStr); pszFontName = szFontStr; --- 1275,1279 ---- strcpy(szFontStr, pszFontName); } ! RemovePSFontNameVariations(szFontStr); UtilTrimBlanks(szFontStr); pszFontName = szFontStr; *************** *** 1592,1596 **** short *flag_ptr, flag; int font_index, style_index, font_count; - char font_str[MAXSTRING]; font_count = ((PRTGIF && !cmdLineOpenDisplay) ? MAXFONTS+numFakedFonts : --- 1644,1647 ---- *************** *** 1600,1603 **** --- 1651,1657 ---- for (style_index=0; style_index < MAXFONTSTYLES; style_index++) { if (NeedEncode(font_index, style_index)) { + char font_str[MAXSTRING]; + + *font_str = '\0'; GetPSFontStr(font_index, style_index, font_str); if (strncmp(font_str, "/(", 2) == 0) { *************** *** 1604,1607 **** --- 1658,1663 ---- /* bitmapped PS font! */ } else { + char real_font_str[MAXSTRING]; + fprintf(FP, "%s-vec [\n", font_str); flag_ptr = encodeCharFlags[font_index*MAXFONTSTYLES+style_index]; *************** *** 1617,1622 **** } fprintf(FP, " ] def\n"); ! fprintf(FP, "%s %s-8 %s-vec tgifReEncodeSmall\n\n", font_str, ! font_str, &font_str[1]); if (preDumpSetup) PSUseReencode(font_str); } --- 1673,1680 ---- } fprintf(FP, " ] def\n"); ! strcpy(real_font_str, font_str); ! MapAliasedPSFontName(real_font_str, sizeof(real_font_str)); ! fprintf(FP, "%s %s-8 %s-vec tgifReEncodeSmall\n\n", ! real_font_str, font_str, &font_str[1]); if (preDumpSetup) PSUseReencode(font_str); } *************** *** 1842,1852 **** font_name[font_name_len-2] = '\0'; strcpy(ps_font_name, font_name); ! /* get rid of the '-' as in 'Zapfchancery-MediumItalic' */ ! if ((c_ptr=strchr(font_name,'-')) != NULL) *c_ptr='\0'; bitmapped_ps_font = TRUE; } else { strcpy(font_name, ps_font_name); ! /* get rid of the '-' as in 'Zapfchancery-MediumItalic' */ ! if ((c_ptr=strchr(font_name,'-')) != NULL) *c_ptr='\0'; } for (i=0, j=0; i 0) { + while (gnNumPSFontAliases-- > 0) { + UtilFree(gaPSFontAliases[gnNumPSFontAliases].key); + UtilFree(gaPSFontAliases[gnNumPSFontAliases].value); + } + free(gaPSFontAliases); + } + gaPSFontAliases = NULL; + gnNumPSFontAliases = 0; + } + + static + void InitPSFontAliases() + { + char *c_ptr=NULL; + + gaPSFontAliases = NULL; + gnNumPSFontAliases = 0; + + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"PSFontAliases")) != NULL) { + int len=strlen(c_ptr); + char *buf=(char*)malloc((len+1)*sizeof(char)), *fake_font_name=NULL; + + if (buf == NULL) FailAllocMessage(); + strcpy(buf, c_ptr); + for (fake_font_name=strtok(buf, ",\t\n\r"); fake_font_name != NULL; + fake_font_name=strtok(NULL, ",\t\n\r")) { + char *real_font_name=strchr(fake_font_name, '='); + + if (real_font_name == NULL) { + fprintf(stderr, "%s '%s' (%s) in '%s.PSFontAliases', skipped...\n", + "Invalid entry", fake_font_name, "cannot find '='", + TOOL_NAME); + UtilFree(buf); + continue; + } + *real_font_name = '\0'; + if (real_font_name[1] == '\0') { + *real_font_name = '='; + fprintf(stderr, "%s '%s' (%s) in '%s.PSFontAliases', skipped...\n", + "Invalid entry", fake_font_name, "missing font name", + TOOL_NAME); + UtilFree(buf); + continue; + } + if (gaPSFontAliases == NULL) { + gaPSFontAliases = (KeyValInfo*)malloc(sizeof(KeyValInfo)); + } else { + gaPSFontAliases = (KeyValInfo*)realloc(gaPSFontAliases, + (gnNumPSFontAliases+1)*sizeof(KeyValInfo)); + } + if (gaPSFontAliases == NULL) FailAllocMessage(); + memset(&gaPSFontAliases[gnNumPSFontAliases], 0, sizeof(KeyValInfo)); + + gaPSFontAliases[gnNumPSFontAliases].key = + UtilStrDup(fake_font_name); + gaPSFontAliases[gnNumPSFontAliases].value = + UtilStrDup(&real_font_name[1]); + if (gaPSFontAliases[gnNumPSFontAliases].key == NULL || + gaPSFontAliases[gnNumPSFontAliases].value == NULL) { + FailAllocMessage(); + } + *real_font_name = '='; + + UtilTrimBlanks(gaPSFontAliases[gnNumPSFontAliases].key); + UtilTrimBlanks(gaPSFontAliases[gnNumPSFontAliases].value); + gnNumPSFontAliases++; + + } + UtilFree(buf); + } + } + + static void InitAdditionalFonts() { *************** *** 2133,2143 **** s[font_name_len-2] = '\0'; strcpy(initFontInfoStr[i+PS_FONT_NAME], s); ! /* get rid of the '-' as in 'Zapfchancery-MediumItalic' */ ! if ((c_ptr=strchr(s,'-')) != NULL) *c_ptr='\0'; bitmapped_ps_font = TRUE; } else { strcpy(s, initFontInfoStr[i+PS_FONT_NAME]); ! /* get rid of the '-' as in 'Zapfchancery-MediumItalic' */ ! if ((c_ptr=strchr(s,'-')) != NULL) *c_ptr='\0'; } fontMenuStr[fmly_index] = (char*)malloc((strlen(s)+1)*sizeof(char)); --- 2271,2279 ---- s[font_name_len-2] = '\0'; strcpy(initFontInfoStr[i+PS_FONT_NAME], s); ! RemovePSFontNameVariations(s); bitmapped_ps_font = TRUE; } else { strcpy(s, initFontInfoStr[i+PS_FONT_NAME]); ! RemovePSFontNameVariations(s); } fontMenuStr[fmly_index] = (char*)malloc((strlen(s)+1)*sizeof(char)); *************** *** 2324,2327 **** --- 2460,2464 ---- } InitAdditionalFonts(); + InitPSFontAliases(); curFont = FONT_COU; *************** *** 4067,4077 **** if (fontSzUnits[i] == sz_unit) { ChangeFontSize(i); ! break; } } } else { MsgBox("No object selected!", TOOL_NAME, INFO_MB); } - return; } *spec = '\0'; --- 4204,4216 ---- if (fontSzUnits[i] == sz_unit) { ChangeFontSize(i); ! return; } } + } else if (curChoice == DRAWTEXT && textCursorShown) { + /* will call ChangeEditTextProperty() to handle this */ } else { MsgBox("No object selected!", TOOL_NAME, INFO_MB); + return; } } *spec = '\0'; *************** *** 4108,4112 **** return; } ! ChangeAllSelRealSzUnit(sz_unit, TRUE); } --- 4247,4266 ---- return; } ! if (topSel == NULL && curChoice == DRAWTEXT && textCursorShown) { ! if (ChangeEditTextProperty(PROP_MASK_TEXT_SZ_UNIT, sz_unit)) { ! curTextModified = TRUE; ! UpdCurTextBBox(); ! RedrawCurText(); ! SetFileModified(TRUE); ! if (cycleThroughChoice) { ! SetPushedFontValue(PUSH_SZ_UNIT, GetCurSzUnit()); ! } ! } ! ShowCurFont(); ! ShowTextSize(); ! UpdatePinnedMenu(MENU_SIZE); ! } else { ! ChangeAllSelRealSzUnit(sz_unit, TRUE); ! } } *************** *** 4134,4137 **** --- 4288,4292 ---- numFontSizes = 0; + CleanUpPSFontAliases(); CleanUpTmpStrings(); CleanUpEncodeCharFonts(); *** grid.c.orig Wed May 19 10:27:04 1999 --- grid.c Wed May 19 10:27:04 1999 *************** *** 87,92 **** #endif /* RESTRICTED_MOUSE_MOVE */ - static int zoomInDontRedraw=FALSE; - void MyHDotLine(Win, Y, XStart, XEnd) Window Win; --- 87,90 ---- *************** *** 667,683 **** UpdDrawWinBBox(); ! if (!zoomInDontRedraw) { ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! RedrawRulers(); ! RedrawScrollBars(); ! AdjSplineVs(); ! AdjCaches(); ! ShowZoom(); ! /* use to be ClearAndRedrawDrawWindowDontDrawCurText() */ ! ClearAndRedrawDrawWindowNoCurT(); ! SetDefaultCursor(mainWindow); ! ShowCursor(); ! } justDupped = FALSE; if (!(curChoice==DRAWTEXT && textCursorShown)) { --- 665,681 ---- UpdDrawWinBBox(); ! ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! RedrawRulers(); ! RedrawScrollBars(); ! AdjSplineVs(); ! AdjCaches(); ! ShowZoom(); ! /* use to be ClearAndRedrawDrawWindowDontDrawCurText() */ ! ClearAndRedrawDrawWindowNoCurT(); ! SetDefaultCursor(mainWindow); ! ShowCursor(); ! justDupped = FALSE; if (!(curChoice==DRAWTEXT && textCursorShown)) { *************** *** 713,717 **** static int zoomInAbsX=0, zoomInAbsY=0; ! static int useZoomInAtCursor=FALSE; static --- 711,716 ---- static int zoomInAbsX=0, zoomInAbsY=0; ! static int zoomInAtCursor=FALSE; ! static int panAtCursor=FALSE; static *************** *** 724,737 **** int abs_dx=0, abs_dy=0, new_abs_cx=0, new_abs_cy=0; ! if (zooming_in) { ! if (zoomedIn) { ! zoomScale++; ! } else if (zoomScale == 0) { ! zoomedIn = TRUE; ! zoomScale++; ! } else { ! zoomScale--; ! } ! } else { if (!zoomedIn) { zoomScale++; --- 723,729 ---- int abs_dx=0, abs_dy=0, new_abs_cx=0, new_abs_cy=0; ! switch (zooming_in) { ! case INVALID: break; ! case FALSE: if (!zoomedIn) { zoomScale++; *************** *** 742,745 **** --- 734,748 ---- zoomScale--; } + break; + default: + if (zoomedIn) { + zoomScale++; + } else if (zoomScale == 0) { + zoomedIn = TRUE; + zoomScale++; + } else { + zoomScale--; + } + break; } UpdDrawWinWH(); *************** *** 775,781 **** return; } - if (curChoice==DRAWTEXT && textCursorShown) { ! if (useZoomInAtCursor) { sprintf(gszMsgBox, " (%s %s)", "the cursor position is ignored even", --- 778,783 ---- return; } if (curChoice==DRAWTEXT && textCursorShown) { ! if (zoomInAtCursor) { sprintf(gszMsgBox, " (%s %s)", "the cursor position is ignored even", *************** *** 784,791 **** } PrepareZoomCurText(&xc, &yc); ! } else if (useZoomInAtCursor) { xc = zoomInAbsX; yc = zoomInAbsY; ! FixUpZoomCenter(&xc, &yc, TRUE); } else if (queryZoomInPoint==TRUE || (queryZoomInPoint==INVALID && topSel==NULL)) { --- 786,795 ---- } PrepareZoomCurText(&xc, &yc); ! } else if (zoomInAtCursor) { xc = zoomInAbsX; yc = zoomInAbsY; ! if (!panAtCursor) { ! FixUpZoomCenter(&xc, &yc, TRUE); ! } } else if (queryZoomInPoint==TRUE || (queryZoomInPoint==INVALID && topSel==NULL)) { *************** *** 801,805 **** yc = ABS_Y(yc); FixUpZoomCenter(&xc, &yc, TRUE); ! } else if (queryZoomInPoint==BAD) { Window root_win, child_win; int root_x, root_y; --- 805,809 ---- yc = ABS_Y(yc); FixUpZoomCenter(&xc, &yc, TRUE); ! } else if (queryZoomInPoint == BAD) { Window root_win, child_win; int root_x, root_y; *************** *** 819,829 **** SetCurChoice(NOTHING); } ! if (zoomedIn) { ! zoomScale++; ! } else if (zoomScale == 0) { ! zoomedIn = TRUE; ! zoomScale++; ! } else { ! zoomScale--; } if (curChoice==DRAWTEXT && textCursorShown) PreZoomCurText(); --- 823,835 ---- SetCurChoice(NOTHING); } ! if (!panAtCursor) { ! if (zoomedIn) { ! zoomScale++; ! } else if (zoomScale == 0) { ! zoomedIn = TRUE; ! zoomScale++; ! } else { ! zoomScale--; ! } } if (curChoice==DRAWTEXT && textCursorShown) PreZoomCurText(); *************** *** 837,843 **** zoomInAbsX = abs_x; zoomInAbsY = abs_y; ! useZoomInAtCursor = TRUE; ZoomIn(); ! useZoomInAtCursor = FALSE; } --- 843,849 ---- zoomInAbsX = abs_x; zoomInAbsY = abs_y; ! zoomInAtCursor = TRUE; ZoomIn(); ! zoomInAtCursor = FALSE; } *************** *** 891,895 **** if (curChoice==DRAWTEXT && textCursorShown) { PrepareZoomCurText(&xc, &yc); ! } else if (queryZoomInPoint==BAD) { Window root_win, child_win; int root_x, root_y; --- 897,901 ---- if (curChoice==DRAWTEXT && textCursorShown) { PrepareZoomCurText(&xc, &yc); ! } else if (queryZoomInPoint == BAD) { Window root_win, child_win; int root_x, root_y; *************** *** 925,932 **** int abs_x, abs_y; { ! zoomInDontRedraw = TRUE; ZoomInAtCursor(abs_x, abs_y); ! zoomInDontRedraw = FALSE; ! ZoomOut(); } --- 931,937 ---- int abs_x, abs_y; { ! panAtCursor = TRUE; ZoomInAtCursor(abs_x, abs_y); ! panAtCursor = FALSE; } *** group.c.orig Wed May 19 10:27:05 1999 --- group.c Wed May 19 10:27:05 1999 *************** *** 105,109 **** writeFileFailed = TRUE; } ! if (serializingFile) SaveCreatorID(FP, ObjPtr, ""); SaveAttrs(FP, ObjPtr->lattr); if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; --- 105,109 ---- writeFileFailed = TRUE; } ! if (serializingFile) SaveCreatorID(FP, ObjPtr, "\t"); SaveAttrs(FP, ObjPtr->lattr); if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; *************** *** 122,126 **** writeFileFailed = TRUE; } ! if (serializingFile) SaveCreatorID(FP, ObjPtr, ""); SaveAttrs(FP, ObjPtr->lattr); if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; --- 122,126 ---- writeFileFailed = TRUE; } ! if (serializingFile) SaveCreatorID(FP, ObjPtr, "\t"); SaveAttrs(FP, ObjPtr->lattr); if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; *************** *** 140,144 **** writeFileFailed = TRUE; } ! if (serializingFile) SaveCreatorID(FP, ObjPtr, ""); SaveAttrs(FP, ObjPtr->lattr); if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; --- 140,144 ---- writeFileFailed = TRUE; } ! if (serializingFile) SaveCreatorID(FP, ObjPtr, "\t"); SaveAttrs(FP, ObjPtr->lattr); if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; *************** *** 163,167 **** writeFileFailed = TRUE; } ! if (serializingFile) SaveCreatorID(FP, ObjPtr, ""); SaveAttrs(FP, ObjPtr->lattr); if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; --- 163,167 ---- writeFileFailed = TRUE; } ! if (serializingFile) SaveCreatorID(FP, ObjPtr, "\t"); SaveAttrs(FP, ObjPtr->lattr); if (fprintf(FP, ")") == EOF) writeFileFailed = TRUE; *************** *** 398,415 **** /* *BotSelPtr will point to the bottom of the list. */ { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr=ObjPtr->detail.r->last; for ( ; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! sel_ptr->obj = obj_ptr; ! sel_ptr->next = (*TopSelPtr); ! if (*TopSelPtr == NULL) { ! *BotSelPtr = sel_ptr; ! } else { ! (*TopSelPtr)->prev = sel_ptr; ! } ! *TopSelPtr = sel_ptr; } (*TopSelPtr)->prev = NULL; --- 398,405 ---- /* *BotSelPtr will point to the bottom of the list. */ { ! struct ObjRec *obj_ptr=ObjPtr->detail.r->last; for ( ; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { ! AddObjIntoSel(obj_ptr, NULL, *TopSelPtr, TopSelPtr, BotSelPtr); } (*TopSelPtr)->prev = NULL; *************** *** 417,429 **** static ! int NoObjToUngroup() { ! register struct SelRec *sel_ptr; ! for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next) { ! if (sel_ptr->obj->type == OBJ_GROUP) { return FALSE; } } return TRUE; } --- 407,456 ---- static ! int NoObjToUngroup(pn_force_ungroup) ! int *pn_force_ungroup; { ! struct SelRec *sel_ptr=NULL; ! int every_obj_is_sym_or_icon=TRUE; ! if (pn_force_ungroup != NULL && topSel != NULL && topSel == botSel) { ! int obj_type=topSel->obj->type; ! ! *pn_force_ungroup = FALSE; ! if (obj_type==OBJ_ICON || obj_type==OBJ_SYM) { ! /* ! * Need to check for pins. ! */ ! sprintf(gszMsgBox, "%s.\n\n%s?", ! "Selected object is not a (simple) grouped object", ! "Ungroup anyway"); ! if (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) == MB_ID_YES) { ! *pn_force_ungroup = TRUE; ! return FALSE; ! } ! return TRUE; ! } ! } ! for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! int obj_type=sel_ptr->obj->type; ! ! if (obj_type == OBJ_GROUP) { return FALSE; + } else if (obj_type==OBJ_ICON || obj_type==OBJ_SYM) { + /* + * Need to check for pins. + */ + } else { + every_obj_is_sym_or_icon = FALSE; } } + if (every_obj_is_sym_or_icon) { + sprintf(gszMsgBox, "%s.\n\n%s?", + "None of the selected objects are (simple) grouped objects", + "Ungroup anyway"); + if (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) == MB_ID_YES) { + *pn_force_ungroup = TRUE; + return FALSE; + } + } return TRUE; } *************** *** 431,440 **** 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; sel_ltx = selLtX; sel_lty = selLtY; --- 458,467 ---- void UngroupSelObj() { ! struct SelRec *sel_ptr=NULL, *next_sel=NULL; ! struct ObjRec *obj_ptr=NULL; int sel_ltx, sel_lty, sel_rbx, sel_rby; ! int changed=FALSE, force_ungroup_single_obj=FALSE; ! if (topSel==NULL || NoObjToUngroup(&force_ungroup_single_obj)) return; sel_ltx = selLtX; sel_lty = selLtY; *************** *** 443,446 **** --- 470,505 ---- HighLightReverse(); StartCompositeCmd(); + if (force_ungroup_single_obj) { + for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { + struct AttrRec *attr_ptr=NULL; + + obj_ptr = sel_ptr->obj; + + switch (obj_ptr->type) { + case OBJ_ICON: + 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); + break; + case OBJ_SYM: + PrepareToReplaceAnObj(obj_ptr); + obj_ptr->type = OBJ_GROUP; + AdjObjBBox(obj_ptr); + RecordReplaceAnObj(obj_ptr); + break; + case OBJ_PIN: + /* + * Need to check for pins. + */ + break; + default: break; + } + } + } for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=next_sel) { next_sel = sel_ptr->next; *** http.c.orig Wed May 19 10:27:07 1999 --- http.c Wed May 19 10:27:07 1999 *************** *** 475,479 **** static char SZ_CONTENT_TYPE[]="Content-type:"; static char SZ_CONTENT_LENGTH[]="Content-length:"; - static char SZ_DEF_GIF_NAME[]="/tmp/htclient.gif"; static char SZ_POST_CONTENT_TYPE[]="application/x-www-form-urlencoded"; --- 475,478 ---- *************** *** 751,754 **** --- 750,755 ---- #ifdef _TGIF_DBG + static char SZ_DEF_GIF_NAME[]="/tmp/htclient.gif"; + static void DebugHttpDumpResponse(buf) *************** *** 1014,1018 **** if (debugHttp > 0) { if (debugHttp == 99 && cmdLineDumpURL && !cmdLineDumpURLWithHeader) { ! } else { fprintf(fp, "%s\n", line_ptr); } --- 1015,1019 ---- if (debugHttp > 0) { if (debugHttp == 99 && cmdLineDumpURL && !cmdLineDumpURLWithHeader) { ! } else if (!deserializingFile) { fprintf(fp, "%s\n", line_ptr); } *** import.c.orig Wed May 19 10:27:08 1999 --- import.c Wed May 19 10:27:08 1999 *************** *** 432,436 **** justDupped = FALSE; ! if (!importFromLibrary && !remote_file) SetCurImportDir(xbm_fname); sprintf(gszMsgBox, "XBitmap file (%1dx%1d) '%s' imported.", orig_w, orig_h, --- 432,436 ---- justDupped = FALSE; ! if (!importFromLibrary && !remote_file) SetCurDir(xbm_fname); sprintf(gszMsgBox, "XBitmap file (%1dx%1d) '%s' imported.", orig_w, orig_h, *************** *** 522,526 **** RedrawColorWindow(); } ! if (!importFromLibrary && !remote_file) SetCurImportDir(xpm_fname); sprintf(gszMsgBox, "XPixmap file (%1dx%1d) '%s' imported.", image_w, image_h, --- 522,526 ---- RedrawColorWindow(); } ! if (!importFromLibrary && !remote_file) SetCurDir(xpm_fname); sprintf(gszMsgBox, "XPixmap file (%1dx%1d) '%s' imported.", image_w, image_h, *************** *** 635,639 **** justDupped = FALSE; ! if (!importFromLibrary && !remote_file) SetCurImportDir(eps_fname); sprintf(gszMsgBox, "EPS file '%s' imported.", short_name ? rest : eps_fname); --- 635,639 ---- justDupped = FALSE; ! if (!importFromLibrary && !remote_file) SetCurDir(eps_fname); sprintf(gszMsgBox, "EPS file '%s' imported.", short_name ? rest : eps_fname); *************** *** 841,845 **** RedrawColorWindow(); } ! if (!importFromLibrary && !remote_file) SetCurImportDir(szGifPath); if (short_name) { --- 841,845 ---- RedrawColorWindow(); } ! if (!importFromLibrary && !remote_file) SetCurDir(szGifPath); if (short_name) { *************** *** 1093,1097 **** SetFileModified(TRUE); justDupped = FALSE; ! if (!importFromLibrary && !remote_file) SetCurImportDir(szOtherPath); sprintf(gszMsgBox, "%s file (%1dx%1d) '%s' imported.", pii->name, --- 1093,1097 ---- SetFileModified(TRUE); justDupped = FALSE; ! if (!importFromLibrary && !remote_file) SetCurDir(szOtherPath); sprintf(gszMsgBox, "%s file (%1dx%1d) '%s' imported.", pii->name, *************** *** 1420,1424 **** SetFileModified(TRUE); HighLightForward(); ! if (!importFromLibrary && !remote_file) SetCurImportDir(gif_fname); if (colorLayers && needToRedrawColorWindow) { RedrawColorWindow(); --- 1420,1424 ---- SetFileModified(TRUE); HighLightForward(); ! if (!importFromLibrary && !remote_file) SetCurDir(gif_fname); if (colorLayers && needToRedrawColorWindow) { RedrawColorWindow(); *** mainloop.c.orig Wed May 19 10:27:09 1999 --- mainloop.c Wed May 19 10:27:09 1999 *************** *** 91,97 **** #include "version.e" #include "wb.e" - #ifdef _TGIF_WB - #include "wb1.e" - #endif /* _TGIF_WB */ #include "xbitmap.e" #include "xpixmap.e" --- 91,94 ---- *************** *** 188,214 **** } ! static char gszCurLocale[MAXSTRING]; ! ! void SaveAndSetLocale(new_locale, prev_locale) ! char *new_locale, *prev_locale; { #ifndef _NO_LOCALE_SUPPORT ! if (prev_locale != NULL) strcpy(prev_locale, gszCurLocale); ! *gszCurLocale = '\0'; ! UtilStrCpyN(gszCurLocale, sizeof(gszCurLocale), new_locale); ! setlocale(LC_ALL, gszCurLocale); #endif /* ~_NO_LOCALE_SUPPORT */ } - void RestoreLocale(prev_locale) - char *prev_locale; - { - #ifndef _NO_LOCALE_SUPPORT - *gszCurLocale = '\0'; - UtilStrCpyN(gszCurLocale, sizeof(gszCurLocale), prev_locale); - setlocale(LC_ALL, gszCurLocale); - #endif /* ~_NO_LOCALE_SUPPORT */ - } - static void ExecWithFile(CmdName, FileName) --- 185,200 ---- } ! static ! char *MySetLocale(category, new_locale) ! int category; ! char *new_locale; { #ifndef _NO_LOCALE_SUPPORT ! return setlocale(category, new_locale); ! #else /* _NO_LOCALE_SUPPORT */ ! return NULL; #endif /* ~_NO_LOCALE_SUPPORT */ } static void ExecWithFile(CmdName, FileName) *************** *** 608,611 **** --- 594,634 ---- char package[80], *c_ptr=NULL, locale_dir[MAXPATHLENGTH]; + c_ptr = MySetLocale(LC_ALL, ""); + if (c_ptr == NULL) { + fprintf(stderr, "%s.\n", + "Cannot set to the locale specified by the environment variables"); + } + if (x11R6OrAbove) { + #ifdef USE_XT_INITIALIZE + if (XtSetLanguageProc(NULL, NULL, NULL) == NULL) { + fprintf(stderr, "%s %s.\n", + "Xtoolkit cannot set to the locale", + "specified by the environment variables"); + MySetLocale(LC_ALL, "C"); + } + #else /* ~USE_XT_INITIALIZE */ + if (!XSupportsLocale()) { + fprintf(stderr, "%s %s.\n", + "Xlib cannot set to the locale", + "specified by the environment variables"); + MySetLocale(LC_ALL, "C"); + } + if (!XSetLocaleModifiers("")) { + if (getenv("LANG") != NULL) { + fprintf(stderr, "Cannot set locale modifiers.\n"); + } + } + #endif /* USE_XT_INITIALIZE */ + } + MySetLocale(LC_ALL, NULL); + + /* + * Some locale uses "," as decimal point. That won't work in + * saving files or generating EPS files. Must use "." + * as decimal point. + * From this point on, setlocale() should NEVER be called again! + */ + setlocale(LC_NUMERIC, "C"); + *locale_dir = '\0'; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"LocaleDir")) != NULL) { *************** *** 618,624 **** strcpy(package, TOOL_NAME); UtilStrLower(package); - SaveAndSetLocale("", NULL); - bindtextdomain(package, locale_dir); - textdomain(package); if ((dirp=opendir(locale_dir)) == NULL) { --- 641,644 ---- *************** *** 628,631 **** --- 648,653 ---- } else { closedir(dirp); + bindtextdomain(package, locale_dir); + textdomain(package); } } *************** *** 735,738 **** --- 757,761 ---- signal(SIGSEGV, EmergencySave); + MySetLocale(LC_ALL, "C"); #ifndef _NO_LOCALE_SUPPORT #ifdef _ENABLE_NLS *************** *** 740,786 **** #endif /* _ENABLE_NLS */ #endif /* ~_NO_LOCALE_SUPPORT */ - SaveAndSetLocale("C", NULL); - if (x11R6OrAbove) { - #ifndef _NO_LOCALE_SUPPORT - #ifdef USE_XT_INITIALIZE - XtSetLanguageProc(NULL, NULL, NULL); - #else /* ~USE_XT_INITIALIZE */ - char *c_ptr1=NULL; - #ifndef _DONT_USE_PORTABLE_LOCALE - int use_portable_locale=TRUE; - #else /* _DONT_USE_PORTABLE_LOCALE */ - int use_portable_locale=FALSE; - #endif /* ~_DONT_USE_PORTABLE_LOCALE */ - - if (use_portable_locale) { - setlocale(LC_ALL, "C"); - } else { - 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); - } - if (XSupportsLocale()) { - XSetLocaleModifiers(NULL); - } - } - #endif /* USE_XT_INITIALIZE */ - #endif /* ~_NO_LOCALE_SUPPORT */ - } Setup(); InitExtraWinInfo(); --- 763,767 ---- *************** *** 933,936 **** --- 914,918 ---- SetFileModified(FALSE); + SaveStatusStrings(); if (file_is_remote) { sprintf(gszMsgBox, "Loading '%s' ...", remote_fname); *************** *** 946,950 **** } } ! Msg(gszMsgBox); strcpy(tmp_filename, scanFileName); --- 928,932 ---- } } ! SetStringStatus(gszMsgBox); strcpy(tmp_filename, scanFileName); *************** *** 1027,1030 **** --- 1009,1014 ---- Msg(gszMsgBox); } + RestoreStatusStrings(); + GotoPageNum(loadedCurPageNum); SetDefaultCursor(mainWindow); *************** *** 1080,1127 **** XEvent *pXEvent; { - #ifdef _TGIF_WB - if (XPending(mainDisplay)) { - if (gnInputMethod != TGIM_NONE && tgIMExpectNextEvent(mainDisplay, - drawWindow)) { - if (!tgIMHandleNextEvent(mainDisplay, drawWindow, pXEvent)) { - } - } else { - XNextEvent(mainDisplay, pXEvent); - } - CheckClientServer(); - } else { - CheckClientServer(); - return FALSE; - } - #endif /* _TGIF_WB */ - #ifdef _TGIF_WB2 if (!XPending(mainDisplay)) { ! int flag=0, retry=TRUE; ! ! while (retry && WBHasReadData(&flag, &retry)) { ! char *buf=NULL; ! int buf_sz=0; ! ! deserializingFile = TRUE; ! ! if (RecvWBData(flag, &buf, &buf_sz)) { ! char *psz_content=NULL, *psz_content_type=NULL; ! int content_sz=0; ! ! psz_content = HttpExtractText(buf, &content_sz, NULL, ! &psz_content_type); ! if (psz_content != NULL) { ! ProcessRemoteCmd(psz_content, content_sz); ! } ! if (psz_content_type != NULL) UtilFree(psz_content_type); ! if (psz_content != NULL) FreeRemoteBuf(psz_content); ! FreeRemoteBuf(buf); ! } ! deserializingFile = FALSE; ! } return FALSE; } ! gstWBInfo.CanProcessRemoteCmd = TRUE; /* is this right? */ if (gnInputMethod != TGIM_NONE && tgIMExpectNextEvent(mainDisplay, drawWindow)) { --- 1064,1073 ---- XEvent *pXEvent; { #ifdef _TGIF_WB2 if (!XPending(mainDisplay)) { ! TryHandleWBInputData(); return FALSE; } ! gstWBInfo.BlockRemoteCmdDepth--; if (gnInputMethod != TGIM_NONE && tgIMExpectNextEvent(mainDisplay, drawWindow)) { *************** *** 1131,1135 **** XNextEvent(mainDisplay, pXEvent); } ! gstWBInfo.CanProcessRemoteCmd = FALSE; #endif /* _TGIF_WB2 */ --- 1077,1081 ---- XNextEvent(mainDisplay, pXEvent); } ! gstWBInfo.BlockRemoteCmdDepth++; #endif /* _TGIF_WB2 */ *** menu.c.orig Wed May 19 10:27:11 1999 --- menu.c Wed May 19 10:27:11 1999 *************** *** 1308,1311 **** --- 1308,1312 ---- } + static int TgGetTextMenuItemWidths(menu_item, pn_check_w, pn_str_w, pn_shortcut_w) TgMenuItem *menu_item; *** menuinfo.c.orig Wed May 19 10:27:12 1999 --- menuinfo.c Wed May 19 10:27:13 1999 *************** *** 283,286 **** --- 283,288 ---- { N_("SpecifyPaperSize..."), NULL, "Set the physical size of the paper", NULL, CMDID_SPECIFYPAPERSIZE }, + { N_("SetPaperColor..."), NULL, "Set the color of the paper", NULL, + CMDID_SETPAPERCOLOR }, { NULL, NULL, NULL, NULL, INVALID } }; *************** *** 295,300 **** --- 297,305 ---- { N_("PrintOnePage"), NULL, "Select and print one of the pages", NULL, CMDID_PRINTONEPAGE }, + { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, { N_("SpecifyPaperSize..."), NULL, "Set the physical size of the paper", NULL, CMDID_SPECIFYPAPERSIZE }, + { N_("SetPaperColor..."), NULL, "Set the color of the paper", NULL, + CMDID_SETPAPERCOLOR }, { NULL, NULL, NULL, NULL, INVALID } }; *************** *** 575,578 **** --- 580,585 ---- { N_("PreciseScale..."), "Alt+)", "Scale selected objects", NULL, CMDID_PRECISESCALE }, + { "PreciseScaleEverything...", NULL, "Scale everything", NULL, + CMDID_PRECISESCALEEVERYTHING }, { N_("PreciseRotate..."), NULL, "Rotate selected objects by a specified number of degrees", NULL, *************** *** 785,788 **** --- 792,799 ---- { N_("AlignObjsRight"), "Alt+]", "Align right sides of selected objects", NULL, CMDID_ALIGNOBJSRIGHT }, + { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, + { N_("CenterAnEndPoint"), NULL, + "Move an endpoint of a selected poly to the center of another object", + NULL, CMDID_CENTERANENDPOINT }, { NULL, NULL, NULL, NULL, INVALID } }; *************** *** 828,831 **** --- 839,862 ---- CreateDistributeDirectMenu }; + static TgMenuItemInfo flipRotateMenuItemInfo[] = { + { N_("FlipHorizontal"), "Alt+h", "Flip selected objects horizontally", NULL, + CMDID_FLIPHORIZONTAL }, + { N_("FlipVertical"), "Alt+v", "Flip selected objects vertically", NULL, + CMDID_FLIPVERTICAL }, + { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, + { N_("RotateClockWise"), "Alt+w", "Rotate selected objects clockwise", NULL, + CMDID_ROTATECLOCKWISE }, + { N_("RotateCounter"), "Alt+c", "Rotate selected objects counter-clockwise", + NULL, CMDID_ROTATECOUNTER }, + { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, + { N_("SetTextRotation..."), NULL, "Set text rotation in degrees", NULL, + CMDID_SETTEXTROTATION }, + { N_("SetRotationIncrement..."), NULL, "Set rotation increment in degrees", + NULL, CMDID_SETROTATIONINCREMENT }, + { NULL, NULL, NULL, NULL, INVALID } + }; + TgMenuInfo flipRotateMenuInfo={ TGMUTYPE_TEXT, flipRotateMenuItemInfo, + TgCreateMenuFromMenuInfo }; + static TgMenuItemInfo arrangeMenuItemInfo[] = { { N_("Front"), "Cntrl+f", "Bring selected objects to the front", NULL, *************** *** 853,866 **** "Align selected objects with each other using the current alignments", NULL, CMDID_ALIGNOBJS }, { N_("AlignToGrid"), "Cntrl+t", "Align selected objects to grid points using the current alignments", NULL, CMDID_ALIGNTOGRID }, { N_("AlignToPage"), "Alt+&", "Align selected objects to the page using the current alignments", NULL, CMDID_ALIGNTOPAGE }, - { N_("AlignObjsDirect"), TGMUITEM_SUBMENU, - "Align objects direct submenu >>>", &alignObjsDirectMenuInfo, INVALID }, - { N_("AlignToGridDirect"), TGMUITEM_SUBMENU, - "Align to grid direct submenu >>>", &alignToGridDirectMenuInfo, INVALID }, { N_("AlignToPageDirect"), TGMUITEM_SUBMENU, "Align to page direct submenu >>>", &alignToPageDirectMenuInfo, INVALID }, --- 884,897 ---- "Align selected objects with each other using the current alignments", NULL, CMDID_ALIGNOBJS }, + { N_("AlignObjsDirect"), TGMUITEM_SUBMENU, + "Align objects direct submenu >>>", &alignObjsDirectMenuInfo, INVALID }, { N_("AlignToGrid"), "Cntrl+t", "Align selected objects to grid points using the current alignments", NULL, CMDID_ALIGNTOGRID }, + { N_("AlignToGridDirect"), TGMUITEM_SUBMENU, + "Align to grid direct submenu >>>", &alignToGridDirectMenuInfo, INVALID }, { N_("AlignToPage"), "Alt+&", "Align selected objects to the page using the current alignments", NULL, CMDID_ALIGNTOPAGE }, { N_("AlignToPageDirect"), TGMUITEM_SUBMENU, "Align to page direct submenu >>>", &alignToPageDirectMenuInfo, INVALID }, *************** *** 880,898 **** CMDID_LAYOUTONARC }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, - { N_("FlipHorizontal"), "Alt+h", "Flip selected objects horizontally", NULL, - CMDID_FLIPHORIZONTAL }, - { N_("FlipVertical"), "Alt+v", "Flip selected objects vertically", NULL, - CMDID_FLIPVERTICAL }, - { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, - { N_("RotateClockWise"), "Alt+w", "Rotate selected objects clockwise", NULL, - CMDID_ROTATECLOCKWISE }, - { N_("RotateCounter"), "Alt+c", "Rotate selected objects counter-clockwise", - NULL, CMDID_ROTATECOUNTER }, - { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, - { N_("SetTextRotation..."), NULL, "Set text rotation in degrees", NULL, - CMDID_SETTEXTROTATION }, - { N_("SetRotationIncrement..."), NULL, "Set rotation increment in degrees", - NULL, CMDID_SETROTATIONINCREMENT }, - { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, { N_("AbutHorizontal"), "Alt+_", "Squish selected objects together horizontally", --- 911,914 ---- *************** *** 901,907 **** NULL, CMDID_ABUTVERTICAL }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, ! { N_("CenterAnEndPoint"), NULL, ! "Move an endpoint of a selected poly to the center of another object", ! NULL, CMDID_CENTERANENDPOINT }, { NULL, NULL, NULL, NULL, INVALID } }; --- 917,922 ---- NULL, CMDID_ABUTVERTICAL }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, ! { N_("Flip/Rotate"), TGMUITEM_SUBMENU, ! "Flip and rotate submenu >>>", &flipRotateMenuInfo, INVALID }, { NULL, NULL, NULL, NULL, INVALID } }; *************** *** 916,919 **** --- 931,935 ---- { N_("Smooth"), NULL, "Update canvas window smoothly while scrolling", NULL, CMDID_CHANGESCROLLMODE }, + { NULL, NULL, NULL, NULL, INVALID } }; TgMenuInfo scrollModeMenuInfo={ TGMUTYPE_TEXT, scrollModeMenuItemInfo, *************** *** 956,959 **** --- 972,986 ---- CreateSlideShowMenu }; + static TgMenuItemInfo zoomMenuItemInfo[] = { + { N_("ZoomIn"), "Alt+z", "Zoom in", NULL, CMDID_ZOOMIN }, + { N_("ZoomOut"), "Alt+o", "Zoom out", NULL, CMDID_ZOOMOUT }, + { N_("DefaultZoom"), "Alt+:", "No zoom", NULL, CMDID_DEFAULTZOOM }, + { N_("ZoomWayOut"), "Alt+`", "Zoom way out to see the whole drawing", NULL, + CMDID_ZOOMWAYOUT }, + { NULL, NULL, NULL, NULL, INVALID } + }; + static TgMenuInfo zoomMenuInfo={ TGMUTYPE_TEXT, zoomMenuItemInfo, + TgCreateMenuFromMenuInfo }; + static TgMenuItemInfo layoutMenuItemInfo[] = { { N_("+Grid"), "Alt+i", "Increment grid size", NULL, CMDID_INCGRID }, *************** *** 972,980 **** "ScrollMode submenu >>>", &scrollModeMenuInfo, INVALID }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, ! { N_("ZoomIn"), "Alt+z", "Zoom in", NULL, CMDID_ZOOMIN }, ! { N_("ZoomOut"), "Alt+o", "Zoom out", NULL, CMDID_ZOOMOUT }, ! { N_("DefaultZoom"), "Alt+:", "No zoom", NULL, CMDID_DEFAULTZOOM }, ! { N_("ZoomWayOut"), "Alt+`", "Zoom way out to see the whole drawing", NULL, ! CMDID_ZOOMWAYOUT }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, { N_("Portrait"), NULL, "Portrait page style", NULL, CMDID_PORTRAITMODE }, --- 999,1003 ---- "ScrollMode submenu >>>", &scrollModeMenuInfo, INVALID }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, ! { N_("Zoom"), TGMUITEM_SUBMENU, "Zoom submenu >>>", &zoomMenuInfo, INVALID }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, { N_("Portrait"), NULL, "Portrait page style", NULL, CMDID_PORTRAITMODE }, *************** *** 1229,1237 **** { N_("ExecCmdsFromFile..."), NULL, "Execute internal commands from a file", NULL, CMDID_EXECCMDSFROMFILE }, - #ifdef _TGIF_WB - { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, - { N_("WhiteBoard"), NULL, - "Start/Enable the White Board communication", NULL, CMDID_WHITEBOARD }, - #endif /* _TGIF_WB */ { NULL, NULL, NULL, NULL, INVALID } }; --- 1252,1255 ---- *** miniline.c.orig Wed May 19 10:27:14 1999 --- miniline.c Wed May 19 10:27:14 1999 *************** *** 4452,4455 **** --- 4452,4457 ---- int x_pos=x, y_pos=0, w=0, dx=0, dy=0; + minilines->first->v_gap = 0; + new_obj->x = x; text_ptr->baseline_y = baseline_y; *************** *** 4523,4530 **** int w=0; ! FreeStrSeg(new_obj->detail.t->minilines.first->first_block->seg); DupStrSeg(new_obj->detail.t->minilines.first->first_block, pSrcStrSeg); ! pDestStrSeg = new_obj->detail.t->minilines.first->first_block->seg; if (into_words) { word_start = c_ptr; --- 4525,4532 ---- int w=0; ! FreeStrSeg(GetTextObjFirstStrSeg(new_obj)); DupStrSeg(new_obj->detail.t->minilines.first->first_block, pSrcStrSeg); ! pDestStrSeg = GetTextObjFirstStrSeg(new_obj); if (into_words) { word_start = c_ptr; *************** *** 4657,4664 **** } ! void BreakMiniLines(minilines, into_words, x, baseline_y, prototype, tx_to_move, ty_to_move, poli) MiniLinesInfo *minilines; ! int into_words, x, baseline_y; struct ObjRec *prototype; int tx_to_move, ty_to_move; --- 4659,4666 ---- } ! void BreakMiniLines(minilines, how, x, baseline_y, prototype, tx_to_move, ty_to_move, poli) MiniLinesInfo *minilines; ! int how, x, baseline_y; struct ObjRec *prototype; int tx_to_move, ty_to_move; *************** *** 4668,4672 **** */ { ! MiniLineInfo *pMiniLine=NULL; int v_space=minilines->v_space; int saved_x=x; --- 4670,4674 ---- */ { ! MiniLineInfo *pMiniLine=NULL, *pNextMiniLine=NULL; int v_space=minilines->v_space; int saved_x=x; *************** *** 4673,4677 **** for (pMiniLine=minilines->first; pMiniLine != NULL; ! pMiniLine=pMiniLine->next) { baseline_y += pMiniLine->v_gap; --- 4675,4680 ---- for (pMiniLine=minilines->first; pMiniLine != NULL; ! pMiniLine=pNextMiniLine) { ! pNextMiniLine = pMiniLine->next; baseline_y += pMiniLine->v_gap; *************** *** 4681,4687 **** case JUST_R: x = saved_x - pMiniLine->w; break; } ! BreakMiniLine(pMiniLine, into_words, x, baseline_y, prototype, tx_to_move, ! ty_to_move, poli); baseline_y += pMiniLine->des + v_space; if (pMiniLine->next != NULL) { --- 4684,4700 ---- case JUST_R: x = saved_x - pMiniLine->w; break; } ! if (how == BREAK_LINE) { ! struct ObjRec *new_obj=DupObj(prototype); ! MiniLinesInfo *new_minilines=(&new_obj->detail.t->minilines); + FreeMiniLines(new_minilines, FALSE); + DupMiniLine(pMiniLine, new_minilines, NULL, &new_minilines->first, + &new_minilines->last); + FinalizeBreakStrSeg(new_obj, x, baseline_y, prototype, tx_to_move, + ty_to_move, poli); + } else { + BreakMiniLine(pMiniLine, (how==BREAK_WORD), x, baseline_y, prototype, + tx_to_move, ty_to_move, poli); + } baseline_y += pMiniLine->des + v_space; if (pMiniLine->next != NULL) { *************** *** 4721,4725 **** char *font_name; { ! char buf[MAXSTRING], font_str[MAXSTRING]; float fSize=(float)0; --- 4734,4738 ---- char *font_name; { ! char buf[MAXSTRING], font_str[MAXSTRING], real_font_str[MAXSTRING]; float fSize=(float)0; *************** *** 4735,4738 **** --- 4748,4754 ---- GetPSFontStr(font, style, font_str); } + strcpy(real_font_str, font_str); + MapAliasedPSFontName(real_font_str, sizeof(real_font_str)); + #ifdef _PS_USE_EUC_FONT euc_font = (strstr(font_str, "-EUC-") != NULL); *************** *** 4750,4754 **** #else /* ~_PS_USE_EUC_FONT */ fprintf(FP, "%s ", font_str); ! UpdateDocumentFonts(&font_str[1]); #endif /* _PS_USE_EUC_FONT */ } else { --- 4766,4770 ---- #else /* ~_PS_USE_EUC_FONT */ fprintf(FP, "%s ", font_str); ! UpdateDocumentFonts(&real_font_str[1]); #endif /* _PS_USE_EUC_FONT */ } else { *************** *** 4758,4768 **** GetPSFontStr(font, style, font_str); } ! fprintf(FP, "%s", font_str); if (NeedEncode(font, style)) { ! fprintf(FP, "-8 "); } else { ! fprintf(FP, " "); } ! UpdateDocumentFonts(&font_str[1]); } fSize = (float)(((float)sz_unit)/((float)NUM_SZ_UNIT_PER_FONT_SIZE)); --- 4774,4786 ---- GetPSFontStr(font, style, font_str); } ! strcpy(real_font_str, font_str); ! MapAliasedPSFontName(real_font_str, sizeof(real_font_str)); ! if (NeedEncode(font, style)) { ! fprintf(FP, "%s-8 ", font_str); } else { ! fprintf(FP, "%s ", real_font_str); } ! UpdateDocumentFonts(&real_font_str[1]); } fSize = (float)(((float)sz_unit)/((float)NUM_SZ_UNIT_PER_FONT_SIZE)); *** move.c.orig Wed May 19 10:27:17 1999 --- move.c Wed May 19 10:27:17 1999 *************** *** 562,566 **** struct ObjRec *ObjPtr, *TopOwner; int Dx, Dy; ! /* This function is meant to be called within an internal command */ { if (execCurDepth <= 0) { --- 562,566 ---- struct ObjRec *ObjPtr, *TopOwner; int Dx, Dy; ! /* This function is meant to be called from within an internal command */ { if (execCurDepth <= 0) { *** msg.c.orig Wed May 19 10:27:19 1999 --- msg.c Wed May 19 10:27:19 1999 *************** *** 1239,1243 **** whereToPrint = PRINTER; ! usePsAdobeString = FALSE; *adobeString = '\0'; *epsfString = '\0'; --- 1239,1243 ---- whereToPrint = PRINTER; ! usePsAdobeString = TRUE; *adobeString = '\0'; *epsfString = '\0'; *************** *** 1378,1387 **** char tmp_str[80]; ! 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"); ! usePsAdobeString = FALSE; } } else if (strncmp(*argv, "-dontreencode=", 14) == 0) { --- 1378,1388 ---- char tmp_str[80]; ! UtilStrCpyN(tmp_str, sizeof(tmp_str), &(*argv)[7]); ! UtilTrimBlanks(tmp_str); if (!ParsePsAdobeString(tmp_str, &usePsAdobeString, adobeString, epsfString)) { fprintf(stderr, "%s %s*UsePsAdobeString: '%s', %s.\n", ! "Invalid", TOOL_NAME, tmp_str, "'true' is used"); ! usePsAdobeString = TRUE; } } else if (strncmp(*argv, "-dontreencode=", 14) == 0) { *************** *** 1388,1396 **** strcpy(cmdLineDontReencode, &(*argv)[14]); UtilTrimBlanks(cmdLineDontReencode); ! if (*cmdLineDontReencode != '\0' && ! *cmdLineDontReencode == '"' && ! cmdLineDontReencode[strlen(cmdLineDontReencode)-1] == '"') { ! *cmdLineDontReencode = '\0'; ! cmdLineDontReencode[strlen(cmdLineDontReencode)-1] = '\0'; UtilTrimBlanks(cmdLineDontReencode); } --- 1389,1394 ---- strcpy(cmdLineDontReencode, &(*argv)[14]); UtilTrimBlanks(cmdLineDontReencode); ! if (*cmdLineDontReencode != '\0') { ! UtilRemoveQuotes(cmdLineDontReencode); UtilTrimBlanks(cmdLineDontReencode); } *** names.c.orig Wed May 19 10:27:21 1999 --- names.c Wed May 19 10:27:21 1999 *************** *** 64,68 **** char curDir[MAXPATHLENGTH+1]; char curLocalDir[MAXPATHLENGTH+1]; - char curImportDir[MAXPATHLENGTH+1]; char curSymDir[MAXPATHLENGTH+1]; --- 64,67 ---- *************** *** 83,86 **** --- 82,109 ---- static + void CleanUpDirList() + { + DspList *dsp_ptr=NULL, *next_dsp=NULL; + + for (dsp_ptr=topOfDirLinkList; dsp_ptr != NULL; dsp_ptr=next_dsp) { + next_dsp = dsp_ptr->next; + free(dsp_ptr); + } + topOfDirLinkList = NULL; + } + + static + void CleanUpSymList() + { + DspList *dsp_ptr=NULL, *next_dsp=NULL; + + for (dsp_ptr=topOfSymLinkList; dsp_ptr != NULL; dsp_ptr=next_dsp) { + next_dsp = dsp_ptr->next; + free(dsp_ptr); + } + topOfSymLinkList = NULL; + } + + static char *ReadPath(path_str, dir_str) char *path_str, *dir_str; *************** *** 231,235 **** reject = TRUE; break; ! } else if (LargerStr (d->d_name, p->itemstr)) { p1 = p; } else { --- 254,258 ---- reject = TRUE; break; ! } else if (LargerStr(d->d_name, p->itemstr)) { p1 = p; } else { *************** *** 269,293 **** void BuildSymbolList() { ! int i; ! DspList *dsp_ptr, *next_dsp; ! if (symbolList != NULL) free(symbolList); ! symbolList = (DspList*)malloc(numSymbols*sizeof(DspList)); ! if (symbolList == NULL) FailAllocMessage(); ! memset(symbolList, 0, numSymbols*sizeof(DspList)); ! dsp_ptr = topOfSymLinkList; ! for (i=0; i < numSymbols; i++, dsp_ptr = next_dsp) { ! next_dsp = dsp_ptr->next; ! UtilStrCpyN(symbolList[i].itemstr, sizeof(symbolList[i].itemstr), ! dsp_ptr->itemstr); ! UtilStrCpyN(symbolList[i].pathstr, sizeof(symbolList[i].pathstr), ! dsp_ptr->pathstr); ! symbolList[i].directory = dsp_ptr->directory; ! symbolList[i].next = &symbolList[i+1]; ! free(dsp_ptr); } - symbolList[numSymbols-1].next = NULL; - topOfSymLinkList = NULL; } --- 292,329 ---- void BuildSymbolList() { ! int i=0, watch_cursor=watchCursorOnMainWindow; ! DspList *dsp_ptr=NULL, *next_dsp=NULL; ! if (topOfSymLinkList == NULL) { ! if (!watch_cursor) { ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! } ! if ((topOfSymLinkList = SymbolListing()) != NULL) BuildSymbolList(); ! if (!watch_cursor) { ! SetDefaultCursor(mainWindow); ! ShowCursor(); ! } ! } ! if (topOfSymLinkList != NULL) { ! if (symbolList != NULL) free(symbolList); ! symbolList = (DspList*)malloc(numSymbols*sizeof(DspList)); ! if (symbolList == NULL) FailAllocMessage(); ! memset(symbolList, 0, numSymbols*sizeof(DspList)); ! dsp_ptr = topOfSymLinkList; ! for (i=0; i < numSymbols; i++, dsp_ptr = next_dsp) { ! next_dsp = dsp_ptr->next; ! UtilStrCpyN(symbolList[i].itemstr, sizeof(symbolList[i].itemstr), ! dsp_ptr->itemstr); ! UtilStrCpyN(symbolList[i].pathstr, sizeof(symbolList[i].pathstr), ! dsp_ptr->pathstr); ! symbolList[i].directory = dsp_ptr->directory; ! symbolList[i].next = &symbolList[i+1]; ! free(dsp_ptr); ! } ! symbolList[numSymbols-1].next = NULL; ! topOfSymLinkList = NULL; } } *************** *** 340,344 **** --- 376,386 ---- return NULL; } + #ifdef __EMX__ + if (path[strlen(path)-1] != DIR_SEP) { + strcat(path, DIR_SEP_STR); + } + #else /* ~__EMX__ */ strcat(path, DIR_SEP_STR); + #endif /* __EMX__ */ } *************** *** 479,485 **** void BuildDirList() { ! int i; ! DspList *dsp_ptr, *next_dsp; if (topOfDirLinkList != NULL) { if (dirList != NULL) free(dirList); --- 521,545 ---- void BuildDirList() { ! int i=0, watch_cursor=watchCursorOnMainWindow; ! DspList *dsp_ptr=NULL, *next_dsp=NULL; + if (topOfDirLinkList == NULL) { + if (!watch_cursor) { + SetWatchCursor(drawWindow); + SetWatchCursor(mainWindow); + } + if (curDirIsLocal) { + if ((topOfDirLinkList=DirListing(curDir, OBJ_FILE_EXT, "")) != NULL) { + BuildDirList(); + } + } else if ((topOfDirLinkList=DirListing(curLocalDir, OBJ_FILE_EXT, "")) != + NULL) { + BuildDirList(); + } + if (!watch_cursor) { + SetDefaultCursor(mainWindow); + ShowCursor(); + } + } if (topOfDirLinkList != NULL) { if (dirList != NULL) free(dirList); *************** *** 513,516 **** --- 573,580 ---- ignoreDirectoryFlag = FALSE; + symbolList = dirList = NULL; + numSymbols = numDirEntries = 0; + topOfSymLinkList = topOfDirLinkList = NULL; + *curDomainName = '\0'; *curDomainPath = '\0'; *************** *** 518,522 **** strcpy(curDir, bootDir); strcpy(curLocalDir, bootDir); - strcpy(curImportDir, bootDir); if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "DoubleClickInterval")) != --- 582,585 ---- *************** *** 581,585 **** ParseSymPath("."); } - if ((topOfSymLinkList=SymbolListing()) != NULL) BuildSymbolList(); } --- 644,647 ---- *************** *** 586,601 **** void UpdateDirInfo() { ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! if (curDirIsLocal) { ! if ((topOfDirLinkList=DirListing(curDir, OBJ_FILE_EXT, "")) != NULL) { ! BuildDirList(); ! } ! } else if ((topOfDirLinkList=DirListing(curLocalDir, OBJ_FILE_EXT, "")) != ! NULL) { ! BuildDirList(); ! } ! SetDefaultCursor(mainWindow); ! SetDefaultCursor(drawWindow); } --- 648,652 ---- void UpdateDirInfo() { ! CleanUpDirList(); } *************** *** 602,610 **** void UpdateSymInfo() { ! SetWatchCursor(drawWindow); ! SetWatchCursor(mainWindow); ! if ((topOfSymLinkList = SymbolListing()) != NULL) BuildSymbolList(); ! SetDefaultCursor(mainWindow); ! SetDefaultCursor(drawWindow); } --- 653,657 ---- void UpdateSymInfo() { ! CleanUpSymList(); } *************** *** 765,769 **** switch (btn_id) { case BUTTON_OK: break; ! case BUTTON_SETDIR: return FALSE; case BUTTON_CANCEL: break; } --- 812,825 ---- switch (btn_id) { case BUTTON_OK: break; ! case BUTTON_SETDIR: ! if (cur_buf != NULL) { ! int len=strlen(cur_buf); ! ! if (len > 4 && cur_buf[len-4] == DIR_SEP && cur_buf[len-3] == '.' && ! cur_buf[len-2] == '.' && cur_buf[len-1] == DIR_SEP) { ! break; ! } ! } ! return FALSE; case BUTTON_CANCEL: break; } *************** *** 812,817 **** strcat(dirNamesInfo.other_ext_str, ";.tgp"); } ! sprintf(gszMsgBox, ";.obj.gz;.tgo.gz;.%s.gz", OBJ_FILE_EXT); ! strcat(dirNamesInfo.other_ext_str, gszMsgBox); } else if (ExtStr != NULL && strcmp(ExtStr, "gif") == 0) { strcpy(dirNamesInfo.other_ext_str, ".GIF"); --- 868,873 ---- strcat(dirNamesInfo.other_ext_str, ";.tgp"); } ! sprintf(selected_str, ";.obj.gz;.tgo.gz;.%s.gz", OBJ_FILE_EXT); ! strcat(dirNamesInfo.other_ext_str, selected_str); } else if (ExtStr != NULL && strcmp(ExtStr, "gif") == 0) { strcpy(dirNamesInfo.other_ext_str, ".GIF"); *************** *** 828,834 **** NamesSetCallback((GetEntriesFunc*)GetNamesEntries, (AfterLoopFunc*)NamesAfterLoop, NULL); ! if (importingFile) { ! NamesSetDir(curImportDir); ! } else if (curDirIsLocal) { NamesSetDir(curDir); } else { --- 884,888 ---- NamesSetCallback((GetEntriesFunc*)GetNamesEntries, (AfterLoopFunc*)NamesAfterLoop, NULL); ! if (curDirIsLocal) { NamesSetDir(curDir); } else { *************** *** 840,843 **** --- 894,899 ---- Msg("Click on 'SETDIR' to set Open/SaveAs directory."); } + *selected_str = '\0'; + sprintf(win_name, "%s - %s", TOOL_NAME, TopStr); selected_btn_id = Names(win_name, &selected_index, *************** *** 861,866 **** if (len > 0 && selected_str[len-1] == DIR_SEP) { ! selected_str[--len] = '\0'; } strcpy(SelStr, selected_str); *JustSetDir = TRUE; --- 917,933 ---- if (len > 0 && selected_str[len-1] == DIR_SEP) { ! UtilShrinkName(selected_str); ! len = strlen(selected_str); } + if (len > 0) { + if (selected_str[len-1] == DIR_SEP) { + selected_str[--len] = '\0'; + } else { + while (len > 0 && selected_str[len-1] != DIR_SEP) { + selected_str[--len] = '\0'; + } + if (len > 0) selected_str[--len] = '\0'; + } + } strcpy(SelStr, selected_str); *JustSetDir = TRUE; *************** *** 916,922 **** } RedrawTitleWindow(); ! sprintf(gszMsgBox, "%s '%s'.\n\n(%s '%s'.)", ! "Current open/save directory change to", curDir, ! "Current import directory remains", curImportDir); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); Msg(""); --- 983,988 ---- } RedrawTitleWindow(); ! sprintf(gszMsgBox, "%s '%s'.", ! "Current open/save/import directory change to", curDir); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); Msg(""); *************** *** 962,968 **** } RedrawTitleWindow(); ! sprintf(gszMsgBox, "%s '%s'.\n\n(%s '%s'.)", ! "Current open/save directory change to", curDir, ! "Current import directory remains", curImportDir); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); Msg(""); --- 1028,1033 ---- } RedrawTitleWindow(); ! sprintf(gszMsgBox, "%s '%s'.", ! "Current open/save/import directory change to", curDir); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); Msg(""); *************** *** 992,1002 **** if ((index=DirNames(MsgStr, ExtStr, SelStr, &just_set_dir)) == INVALID) { if (just_set_dir) { ! strcpy(curImportDir, SelStr); ! sprintf(gszMsgBox, "Importing directory changed to %s.", ! curImportDir); ! Msg(gszMsgBox); ! sprintf(gszMsgBox, "%s '%s'.\n\n(%s '%s'.)", ! "Current importing directory changed to", curImportDir, ! "Current open/save directory remains", curDir); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } --- 1057,1067 ---- if ((index=DirNames(MsgStr, ExtStr, SelStr, &just_set_dir)) == INVALID) { if (just_set_dir) { ! if (curDirIsLocal) { ! strcpy(curDir, SelStr); ! } else { ! strcpy(curLocalDir, SelStr); ! } ! sprintf(gszMsgBox, "%s '%s'.", ! "Current open/save/import directory change to", curDir); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } *************** *** 1021,1024 **** --- 1086,1092 ---- int i; + if (topOfSymLinkList == NULL) { + if ((topOfSymLinkList=SymbolListing()) != NULL) BuildSymbolList(); + } if (symbolList == NULL) return FALSE; *************** *** 1039,1043 **** int i; ! if (dirList == NULL) return (FALSE); for (i = 0; i < numDirEntries; i++) { --- 1107,1111 ---- int i; ! if (dirList == NULL) return FALSE; for (i = 0; i < numDirEntries; i++) { *************** *** 1097,1101 **** free(head_ptr); } ! return (NULL); } dsp_ptr = (DspList*)malloc(sizeof(DspList)); --- 1165,1169 ---- free(head_ptr); } ! return NULL; } dsp_ptr = (DspList*)malloc(sizeof(DspList)); *************** *** 1494,1516 **** } } - - void SetCurImportDir(FileName) - char *FileName; - { - int i; - char file_name[MAXPATHLENGTH+1]; - - strcpy(file_name, FileName); - UtilShrinkName(file_name); - - for (i = strlen(file_name)-1; i>=0 && file_name[i]!=DIR_SEP; i--) ; - - if (i < 0) { - TwoLineMsg("Error: No directory-separator found in SetCurImportDir().", - " curImportDir set to '.'."); - strcpy(curImportDir, "."); - } else { - file_name[i] = '\0'; - strcpy(curImportDir, file_name); - } - } --- 1562,1563 ---- *** navigate.c.orig Wed May 19 10:27:22 1999 --- navigate.c Wed May 19 10:27:22 1999 *************** *** 630,633 **** --- 630,634 ---- } while (!DirIsRemote(curDir) && fileModified) { + XBell(mainDisplay, 0); switch (MsgBox( "File modified, save file before going back? [ync](y)", *************** *** 657,660 **** --- 658,662 ---- while (!DirIsRemote(curDir) && fileModified) { + XBell(mainDisplay, 0); switch (MsgBox( "File modified, save file before going forward? [ync](y)", *************** *** 705,710 **** } while (!DirIsRemote(curDir) && fileModified) { switch (MsgBox("File modified, save file before reloading? [ync](y)", ! TOOL_NAME, YNC_MB)) { case MB_ID_YES: SaveFile(); break; case MB_ID_NO: SetFileModified(FALSE); break; --- 707,713 ---- } while (!DirIsRemote(curDir) && fileModified) { + XBell(mainDisplay, 0); switch (MsgBox("File modified, save file before reloading? [ync](y)", ! TOOL_NAME, YNC_MB)) { case MB_ID_YES: SaveFile(); break; case MB_ID_NO: SetFileModified(FALSE); break; *************** *** 1193,1196 **** --- 1196,1201 ---- XSetWindowBackground(mainDisplay, mainWindow, colorPixels[index]); } + } else if (myFileBgColorStr != NULL && myFileBgPixel != INVALID) { + XSetWindowBackground(mainDisplay, mainWindow, myFileBgPixel); } if (!inHyperSpace) { *************** *** 1208,1216 **** void EndSlideShow() { XSetWindowBackground(mainDisplay, mainWindow, myBgPixel); ShowPopupMenus(); ! AdjSplineVs(); if (gstSlideShow.in_hyperspace != inHyperSpace) { ToggleHyperSpace(FALSE); --- 1213,1233 ---- void EndSlideShow() { + struct ObjRec *saved_top_obj=topObj, *saved_bot_obj=botObj; + struct PageRec *saved_cur_page=curPage; + XSetWindowBackground(mainDisplay, mainWindow, myBgPixel); ShowPopupMenus(); ! for (curPage=firstPage; curPage != NULL; curPage=curPage->next) { ! topObj = curPage->top; ! botObj = curPage->bot; + AdjCaches(); + AdjSplineVs(); + } + topObj = saved_top_obj; + botObj = saved_bot_obj; + curPage = saved_cur_page; + if (gstSlideShow.in_hyperspace != inHyperSpace) { ToggleHyperSpace(FALSE); *************** *** 1233,1241 **** if (pageLayoutMode != PAGE_STACK) return; } else { ! switch (MsgBox("Ok to enter slideshow mode? [ync](y)", ! TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: break; ! case MB_ID_NO: return; ! case MB_ID_CANCEL: return; } MakeQuiescent(); --- 1250,1282 ---- if (pageLayoutMode != PAGE_STACK) return; } else { ! if (fileModified && ((curFileDefined && !DirIsRemote(curDir)) || ! !curFileDefined)) { ! XBell(mainDisplay, 0); ! sprintf(gszMsgBox, "%s? [ync](y)", ! "File modified, save file before entering slideshow mode"); ! switch (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: SaveFile(); break; ! case MB_ID_NO: ! if (NeedToFixPageNumbersForSlideShow()) { ! sprintf(gszMsgBox, "%s %s %s. %s %s.", ! "Page numbers will be modified by", TOOL_NAME, ! "in slideshow mode", "It's probably a good idea", ! "NOT to do a Save() until you've re-opened the file"); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ! } ! break; ! case MB_ID_CANCEL: return; ! } ! } else if (NeedToFixPageNumbersForSlideShow()) { ! sprintf(gszMsgBox, "%s %s %s. %s %s.\n\n%s? [ync](y)", ! "Page numbers will be modified by", TOOL_NAME, ! "in slideshow mode", "It's probably a good idea", ! "NOT to do a Save() until you've re-opened the file", ! "Ok to enter slideshow mode"); ! switch (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB)) { ! case MB_ID_YES: break; ! case MB_ID_NO: return; ! case MB_ID_CANCEL: return; ! } } MakeQuiescent(); *************** *** 1270,1274 **** if (slideShowBorderColor != NULL) UtilFree(slideShowBorderColor); slideShowBorderColor = NULL; ! sprintf(gszMsgBox, "Slideshow will use default border color"); Msg(gszMsgBox); if (slideShowXOffset == 0 && slideShowYOffset == 0) { --- 1311,1315 ---- if (slideShowBorderColor != NULL) UtilFree(slideShowBorderColor); slideShowBorderColor = NULL; ! sprintf(gszMsgBox, "Slideshow will use default border color."); Msg(gszMsgBox); if (slideShowXOffset == 0 && slideShowYOffset == 0) { *************** *** 1288,1292 **** slideShowInfoValid = TRUE; ! sprintf(gszMsgBox, "Slideshow border color set to: %s", slideShowBorderColor); Msg(gszMsgBox); --- 1329,1333 ---- slideShowInfoValid = TRUE; ! sprintf(gszMsgBox, "Slideshow border color set to '%s'.", slideShowBorderColor); Msg(gszMsgBox); *************** *** 1306,1310 **** if (ParseXYSpec(spec, &slideShowXOffset, &slideShowYOffset)) { ! sprintf(gszMsgBox, "Slideshow window offsets set to: %1d, %1d", slideShowXOffset, slideShowYOffset); Msg(gszMsgBox); --- 1347,1351 ---- if (ParseXYSpec(spec, &slideShowXOffset, &slideShowYOffset)) { ! sprintf(gszMsgBox, "Slideshow window offsets set to: %1d, %1d.", slideShowXOffset, slideShowYOffset); Msg(gszMsgBox); *** obj.c.orig Wed May 19 10:27:23 1999 --- obj.c Wed May 19 10:27:23 1999 *************** *** 916,919 **** --- 916,932 ---- } + int IsTopLevelObject(ObjPtr) + struct ObjRec *ObjPtr; + { + struct ObjRec *obj_ptr=NULL; + + for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=obj_ptr->next) { + if (obj_ptr == ObjPtr) { + return TRUE; + } + } + return FALSE; + } + struct ObjRec *GetTopOwner(ObjPtr) struct ObjRec *ObjPtr; *** oval.c.orig Wed May 19 10:27:25 1999 --- oval.c Wed May 19 10:27:25 1999 *************** *** 774,782 **** int ltx, lty, rbx, rby, trans_pat=FALSE, fill, width, pen, dash, w, id=0; int new_alloc, rotation, locked=FALSE, transformed=FALSE, invisible=FALSE; - #ifdef _TGIF_WB - char aux[10000]; - - strcpy(aux,Inbuf); - #endif /* _TGIF_WB */ *ObjPtr = NULL; --- 774,777 ---- *************** *** 972,989 **** struct XfrmMtrxRec *ctm; - #ifdef _TGIF_WB - - s = FindChar((int)'[', aux); - s++; - if (!bufferAsFileForWhiteBoard) { - fgets(inbuf, MAXSTRING, FP); - } - - #else /* ~_TGIF_WB */ - fgets(inbuf, MAXSTRING, FP); - - #endif /* _TGIF_WB */ - scanLineNum++; InitScan(inbuf, "\t\n, "); --- 967,971 ---- *** page.c.orig Wed May 19 10:27:27 1999 --- page.c Wed May 19 10:27:27 1999 *************** *** 58,61 **** --- 58,62 ---- #include "msg.e" #include "names.e" + #include "navigate.e" #include "obj.e" #include "page.e" *************** *** 68,71 **** --- 69,74 ---- #include "text.e" #include "util.e" + #include "wb.e" + #include "xpixmap.e" #include "xprtfltr.e" *************** *** 477,481 **** } if (curPageNum == lastPageNum) { ! MsgBox("Already at last page.", TOOL_NAME, INFO_MB); return; } --- 480,484 ---- } if (curPageNum == lastPageNum) { ! if (!inSlideShow) MsgBox("Already at last page.", TOOL_NAME, INFO_MB); return; } *************** *** 490,494 **** } if (curPageNum == 1) { ! MsgBox("Already at first page.", TOOL_NAME, INFO_MB); return; } --- 493,497 ---- } if (curPageNum == 1) { ! if (!inSlideShow) MsgBox("Already at first page.", TOOL_NAME, INFO_MB); return; } *************** *** 795,798 **** --- 798,823 ---- } + int OkToFlushUndoBuffer(msg_prefix) + char *msg_prefix; + { + if (firstCmd != NULL) { + int len=strlen(msg_prefix), rc=0; + char *buf=(char*)malloc((len+MAXSTRING)*sizeof(char)); + + if (buf == NULL) FailAllocMessage(); + XBell(mainDisplay, 0); + sprintf(buf, "%s %s. Ok to flush the undo buffer and proceed? [ync](y)", + msg_prefix, "will cause the undo buffer to be flushed"); + rc = MsgBox(buf, TOOL_NAME, YNC_MB); + UtilFree(buf); + if (rc == MB_ID_YES) { + CleanUpCmds(); + return TRUE; + } + return FALSE; + } + return TRUE; + } + #define BEFORE_CUR_PAGE 0 #define AFTER_CUR_PAGE 1 *************** *** 803,808 **** { int n; ! struct PageRec *page_ptr; ! struct AttrRec *attr_ptr; if (pageLayoutMode == PAGE_TILE) { --- 828,833 ---- { int n; ! struct PageRec *page_ptr=NULL; ! struct AttrRec *attr_ptr=NULL; if (pageLayoutMode == PAGE_TILE) { *************** *** 811,818 **** } if (firstCmd != NULL) { ! sprintf(gszMsgBox, "Adding a page %s page %1d cannot be undone. %s", ! (AfterCurPage ? "after" : "before"), curPageNum, ! "Ok to proceed? [ync](y)"); ! if (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) != MB_ID_YES) return; CleanUpCmds(); } --- 836,844 ---- } if (firstCmd != NULL) { ! sprintf(gszMsgBox, "Adding a page %s page %1d", ! (AfterCurPage ? "after" : "before"), curPageNum); ! if (!OkToFlushUndoBuffer(gszMsgBox)) { ! return; ! } CleanUpCmds(); } *************** *** 859,870 **** ShowPage(); if ((attr_ptr=FindAttrWithName(tgifObj, "template=", NULL)) != NULL) { importingFile = TRUE; ! if (ImportGivenFile(attr_ptr->attr_value.s)) { sprintf(gszMsgBox, "Template loaded: '%s'.", attr_ptr->attr_value.s); Msg(gszMsgBox); } else { ! sprintf(gszMsgBox, "Problem loading template file '%s'.", ! attr_ptr->attr_value.s); ! Msg(gszMsgBox); } importingFile = FALSE; --- 885,902 ---- ShowPage(); if ((attr_ptr=FindAttrWithName(tgifObj, "template=", NULL)) != NULL) { + char file_name[MAXPATHLENGTH]; + + if (*attr_ptr->attr_value.s == DIR_SEP) { + UtilStrCpyN(file_name, sizeof(file_name), attr_ptr->attr_value.s); + } else { + sprintf(file_name, "%s%c%s", bootDir, DIR_SEP, attr_ptr->attr_value.s); + } importingFile = TRUE; ! if (ImportGivenFile(file_name, TRUE)) { sprintf(gszMsgBox, "Template loaded: '%s'.", attr_ptr->attr_value.s); Msg(gszMsgBox); } else { ! sprintf(gszMsgBox, "Problem loading template file '%s'.", file_name); ! MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); } importingFile = FALSE; *************** *** 876,879 **** --- 908,916 ---- void AddPageBefore() { + if (gstWBInfo.do_whiteboard) { + MsgBox("'AddPageBefore' is disabled when running in the WhiteBoard mode!", + TOOL_NAME, INFO_MB); + return; + } AddPage(BEFORE_CUR_PAGE); } *************** *** 881,884 **** --- 918,926 ---- void AddPageAfter() { + if (gstWBInfo.do_whiteboard) { + MsgBox("'AddPageAfter' is disabled when running in the WhiteBoard mode!", + TOOL_NAME, INFO_MB); + return; + } AddPage(AFTER_CUR_PAGE); } *************** *** 898,904 **** } if (firstCmd != NULL || topObj != NULL) { ! sprintf(gszMsgBox, "Deleting page %1d cannot be undone. %s", ! curPageNum, "Ok to proceed? [ync](y)"); ! if (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) != MB_ID_YES) return; CleanUpCmds(); } --- 940,947 ---- } if (firstCmd != NULL || topObj != NULL) { ! sprintf(gszMsgBox, "Deleting page %1d", curPageNum); ! if (!OkToFlushUndoBuffer(gszMsgBox)) { ! return; ! } CleanUpCmds(); } *************** *** 1267,1274 **** MsgBox("Cannot delete all pages.", TOOL_NAME, INFO_MB); } else if (ok && num_to_delete > 0) { ! sprintf(gszMsgBox, "Deleting page%s cannot be undone. %s", ! (num_to_delete > 1 ? "s" : ""), "Ok to proceed? [ync](y)"); ! if (firstCmd == NULL || ! MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) == MB_ID_YES) { struct PageRec *page_ptr; int page_num; --- 1310,1315 ---- MsgBox("Cannot delete all pages.", TOOL_NAME, INFO_MB); } else if (ok && num_to_delete > 0) { ! sprintf(gszMsgBox, "Deleting page%s", (num_to_delete > 1 ? "s" : "")); ! if (firstCmd == NULL || OkToFlushUndoBuffer(gszMsgBox)) { struct PageRec *page_ptr; int page_num; *************** *** 1541,1559 **** static - int OkToFlushUndoBuffer() - { - if (firstCmd != NULL) { - sprintf(gszMsgBox, "%s. %s? [ync](y)", - "Changing the page layout mode cannot be undone", "Ok to proceed"); - if (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) == MB_ID_YES) { - CleanUpCmds(); - return TRUE; - } - return FALSE; - } - return TRUE; - } - - static int PreservePageNames() { --- 1582,1585 ---- *************** *** 1584,1591 **** MakeQuiescent(); if (pageLayoutMode != index) { switch (index) { case PAGE_STACK: if (AnyObjOnPageBoundary()) return; ! if (!OkToFlushUndoBuffer()) return; pageLayoutMode = index; --- 1610,1624 ---- MakeQuiescent(); if (pageLayoutMode != index) { + if (gstWBInfo.do_whiteboard) { + sprintf(gszMsgBox, "%s %s!", + "Changing page layout mode is disabled", + "when running in the WhiteBoard mode"); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + return; + } switch (index) { case PAGE_STACK: if (AnyObjOnPageBoundary()) return; ! if (!OkToFlushUndoBuffer("Changing the page layout mode")) return; pageLayoutMode = index; *************** *** 1596,1600 **** if (!PreservePageNames()) return; if (!JustSpecifyDrawingSize()) return; ! if (!OkToFlushUndoBuffer()) return; pageLayoutMode = index; --- 1629,1633 ---- if (!PreservePageNames()) return; if (!JustSpecifyDrawingSize()) return; ! if (!OkToFlushUndoBuffer("Changing the page layout mode")) return; pageLayoutMode = index; *************** *** 2028,2030 **** --- 2061,2180 ---- free(pages_to_fix); + } + + int NeedToFixPageNumbersForSlideShow() + { + struct PageRec *page_ptr=NULL; + struct ObjRec *obj_ptr=NULL; + + 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) { + obj_ptr->tmp_parent = NULL; + if (FixPageNumInObj(obj_ptr, TRUE)) { + return TRUE; + } + } + } + return FALSE; + } + + static + void ClearPaperColor() + { + myFileBgPixel = INVALID; + if (myFileBgColorStr != NULL) { + free(myFileBgColorStr); + myFileBgColorStr = NULL; + XSetWindowBackground(mainDisplay, drawWindow, myBgPixel); + ClearAndRedrawDrawWindow(); + RecalcXorPixels(); + } + } + + static + int RemoveAllBgColorFileAttrs() + /* This cannot be undone! */ + { + struct AttrRec *attr_ptr=NULL; + int modified=FALSE; + + for (attr_ptr=tgifObj->fattr; attr_ptr != NULL; + attr_ptr=attr_ptr->next) { + if (strcmp(attr_ptr->attr_name.s, "bg_color=") == 0) { + UnlinkAttr(attr_ptr); + FreeTextObj(attr_ptr->obj); + FreeAttr(attr_ptr); + + modified = TRUE; + } + } + return modified; + } + + void SetPaperColor() + { + char spec[MAXSTRING+1]; + int new_alloc=FALSE, index=0; + + if (!OkToFlushUndoBuffer("Setting paper color")) { + return; + } + MakeQuiescent(); + *spec = '\0'; + if (myFileBgColorStr == NULL) { + sprintf(gszMsgBox, "Please specify a paper color:"); + Dialog(gszMsgBox, NULL, spec); + } else { + sprintf(gszMsgBox, "%s: [current: %s]", + "Please specify a paper color", myFileBgColorStr); + Dialog(gszMsgBox, "( Enter 'None' to remove the current paper color. )", + spec); + } + UtilTrimBlanks(spec); + if (*spec == '\0') return; + + if (myFileBgColorStr != NULL) { + if (UtilStrICmp(spec, myFileBgColorStr) == 0) { + return; + } + } else if (UtilStrICmp(spec, "none") == 0) { + return; + } + CleanUpCmds(); + + if (myFileBgColorStr != NULL) { + if (UtilStrICmp(spec, myFileBgColorStr) == 0) { + return; + } else if (UtilStrICmp(spec, "none") == 0) { + ClearPaperColor(); + if (RemoveAllBgColorFileAttrs()) { + Msg("Paper color removed."); + SetFileModified(TRUE); + } + return; + } + } + index = QuickFindColorIndex(NULL, spec, &new_alloc, FALSE); + + if (index == INVALID) { + sprintf(gszMsgBox, "%s '%s' %s.", + "Fail to allocate the", spec, "color"); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + return; + } + myFileBgColorStr = UtilStrDup(spec); + if (myFileBgColorStr == NULL) FailAllocMessage(); + if (SetFileBgColor()) { + ClearAndRedrawDrawWindow(); + } else { + ClearPaperColor(); + } + RemoveAllBgColorFileAttrs(); + + AddAttrByNameAndValue(tgifObj, "bg_color=", spec); + + sprintf(gszMsgBox, "Paper color set to '%s'.", spec); + Msg(gszMsgBox); + + SetFileModified(TRUE); } *** pin.c.orig Wed May 19 10:27:28 1999 --- pin.c Wed May 19 10:27:28 1999 *************** *** 183,190 **** for (pSel=(*ppTopSel); pSel != NULL; pSel=pSel->next) { if (nIndex > (int)(pSel->obj->userdata)) { ! return AddObjIntoSel(pObj, pSel->prev, pSel, ppTopSel, ppBotSel); } } ! return AddObjIntoSel(pObj, (*ppBotSel), NULL, ppTopSel, ppBotSel); } --- 183,191 ---- for (pSel=(*ppTopSel); pSel != NULL; pSel=pSel->next) { if (nIndex > (int)(pSel->obj->userdata)) { ! return (AddObjIntoSel(pObj, pSel->prev, pSel, ppTopSel, ppBotSel) != ! NULL); } } ! return (AddObjIntoSel(pObj, (*ppBotSel), NULL, ppTopSel, ppBotSel) != NULL); } *** ps.c.orig Wed May 19 10:27:29 1999 --- ps.c Wed May 19 10:27:29 1999 *************** *** 1025,1060 **** } ! int ParsePsAdobeString(s, use_ps_adobe_string, adobe_str, epsf_str) ! char *s, *adobe_str, *epsf_str; int *use_ps_adobe_string; { ! register char *c_ptr=s, *c_ptr1; ! if (!(strcmp("false", c_ptr) == 0 || strcmp("False", c_ptr) == 0)) { ! if (*c_ptr >= '0' && *c_ptr <= '9') { ! *use_ps_adobe_string = TRUE; ! for (c_ptr1=c_ptr; *c_ptr1 != '\0'; c_ptr1++) { ! if (*c_ptr1 == '/') { ! *c_ptr1 = ' '; ! break; ! } ! } ! sscanf(c_ptr, "%s", adobe_str); ! c_ptr = &c_ptr[strlen(adobe_str)]; ! switch (*c_ptr) { ! case '\0': break; ! case ' ': ! c_ptr++; ! if (*c_ptr >= '0' && *c_ptr <= '9') { ! sscanf(c_ptr, "%s", epsf_str); ! } else { ! return FALSE; ! } break; - default: return FALSE; } - } else { - return FALSE; } } return TRUE; --- 1025,1062 ---- } ! int ParsePsAdobeString(buf, use_ps_adobe_string, adobe_str, epsf_str) ! char *buf, *adobe_str, *epsf_str; int *use_ps_adobe_string; { ! if (UtilStrICmp("false", buf) == 0 || UtilStrICmp("no", buf) == 0) { ! *use_ps_adobe_string = FALSE; ! } else if (UtilStrICmp("true", buf) == 0 || UtilStrICmp("yes", buf) == 0) { ! *use_ps_adobe_string = TRUE; ! } else if (*buf >= '0' && *buf <= '9') { ! char *c_ptr=buf, *c_ptr1=NULL; ! *use_ps_adobe_string = TRUE; ! for (c_ptr1=c_ptr; *c_ptr1 != '\0'; c_ptr1++) { ! if (*c_ptr1 == '/') { ! *c_ptr1 = ' '; break; } } + sscanf(c_ptr, "%s", adobe_str); + c_ptr = &c_ptr[strlen(adobe_str)]; + switch (*c_ptr) { + case '\0': break; + case ' ': + c_ptr++; + if (*c_ptr >= '0' && *c_ptr <= '9') { + sscanf(c_ptr, "%s", epsf_str); + } else { + return FALSE; + } + break; + default: return FALSE; + } + } else { + return FALSE; } return TRUE; *** rcbox.c.orig Wed May 19 10:27:31 1999 --- rcbox.c Wed May 19 10:27:31 1999 *************** *** 771,779 **** int rotation, new_alloc, id=0, w, locked=FALSE; int transformed=FALSE, invisible=FALSE; - #ifdef _TGIF_WB - char aux[10000]; - - strcpy(aux,Inbuf); - #endif /* _TGIF_WB */ *ObjPtr = NULL; --- 771,774 ---- *************** *** 943,960 **** struct XfrmMtrxRec *ctm; - #ifdef _TGIF_WB - - s = FindChar((int)'[', aux); - s++; - if (!bufferAsFileForWhiteBoard) { - fgets(inbuf, MAXSTRING, FP); - } - - #else /* ~_TGIF_WB */ - fgets(inbuf, MAXSTRING, FP); - - #endif /* _TGIF_WB */ - scanLineNum++; InitScan(inbuf, "\t\n, "); --- 938,942 ---- *** remote.c.orig Wed May 19 10:27:32 1999 --- remote.c Wed May 19 10:27:32 1999 *************** *** 2048,2063 **** } ! void InitRemote() { ! char *c_ptr; ! int val, pid=(int)getpid(); ! char sz_host_name[MAXSTRING]; ! *sz_host_name = '\0'; ! if (gethostname(sz_host_name, sizeof(sz_host_name)) < 0) { ! fprintf(stderr, "Cannot gethostname()! \"localhost\" used.\n"); ! strcpy(sz_host_name, "localhost"); } ! sprintf(gszLocalPID, "%1d\t%s", pid, sz_host_name); autoHyperSpaceOnRemote = TRUE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"AutoHyperSpaceOnRemote")) != --- 2048,2077 ---- } ! void InitLocalPID() { ! static int stInitialized=FALSE; ! if (!stInitialized) { ! int pid=(int)getpid(); ! char sz_host_name[MAXSTRING]; ! ! *gszLocalPID = *sz_host_name = '\0'; ! if (gethostname(sz_host_name, sizeof(sz_host_name)) < 0) { ! fprintf(stderr, "Cannot gethostname()! \"localhost\" used.\n"); ! strcpy(sz_host_name, "localhost"); ! } ! sprintf(gszLocalPID, "%1d:%s", pid, sz_host_name); ! ! stInitialized = TRUE; } ! } ! ! void InitRemote() ! { ! char *c_ptr=NULL; ! int val=0; ! ! InitLocalPID(); ! autoHyperSpaceOnRemote = TRUE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"AutoHyperSpaceOnRemote")) != *** select.c.orig Wed May 19 10:27:34 1999 --- select.c Wed May 19 10:27:34 1999 *************** *** 247,255 **** } ! int AddObjIntoSel(pObj, pPrevSel, pNextSel, ppTopSel, ppBotSel) struct ObjRec *pObj; struct SelRec *pPrevSel, *pNextSel, **ppTopSel, **ppBotSel; { - int nReturn=TRUE; struct SelRec *pSel=(struct SelRec *)malloc(sizeof(struct SelRec)); --- 247,254 ---- } ! struct SelRec *AddObjIntoSel(pObj, pPrevSel, pNextSel, ppTopSel, ppBotSel) struct ObjRec *pObj; struct SelRec *pPrevSel, *pNextSel, **ppTopSel, **ppBotSel; { struct SelRec *pSel=(struct SelRec *)malloc(sizeof(struct SelRec)); *************** *** 256,260 **** if (pSel == NULL) { FailAllocMessage(); ! nReturn = FALSE; } memset(pSel, 0, sizeof(struct SelRec)); --- 255,259 ---- if (pSel == NULL) { FailAllocMessage(); ! return NULL; } memset(pSel, 0, sizeof(struct SelRec)); *************** *** 272,276 **** pNextSel->prev = pSel; } ! return nReturn; } --- 271,275 ---- pNextSel->prev = pSel; } ! return pSel; } *************** *** 341,349 **** if (attr_ptr == NULL) return NULL; ! if (found_attr->obj->color == colorIndex) return found_attr; 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; } else { --- 340,350 ---- if (attr_ptr == NULL) return NULL; ! if (GetTextObjFirstStrSeg(found_attr->obj)->color == colorIndex) { ! return found_attr; ! } 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 (GetTextObjFirstStrSeg(attr_ptr->obj)->color == colorIndex) { break; } else { *************** *** 353,357 **** } else { if (strcmp(attr_ptr->attr_value.s, AttrName) == 0) { ! if (attr_ptr->obj->color == colorIndex) { break; } else { --- 354,358 ---- } else { if (strcmp(attr_ptr->attr_value.s, AttrName) == 0) { ! if (GetTextObjFirstStrSeg(attr_ptr->obj)->color == colorIndex) { break; } else { *************** *** 947,952 **** /* X1, Y1, X2, Y2 are absolute coordinates */ { ! register struct ObjRec *obj_ptr; ! register struct SelRec *sel_ptr; *TopSel = *BotSel = NULL; --- 948,952 ---- /* X1, Y1, X2, Y2 are absolute coordinates */ { ! struct ObjRec *obj_ptr=NULL; *TopSel = *BotSel = NULL; *************** *** 959,973 **** if (X1 <= obj_ptr->bbox.ltx && X2 >= obj_ptr->bbox.rbx && Y1 <= obj_ptr->bbox.lty && Y2 >= obj_ptr->bbox.rby) { ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! sel_ptr->next = *TopSel; ! sel_ptr->obj = obj_ptr; ! sel_ptr->prev = NULL; ! if (*TopSel == NULL) { ! *BotSel = sel_ptr; ! } else { ! (*TopSel)->prev = sel_ptr; ! } ! *TopSel = sel_ptr; } } --- 959,963 ---- if (X1 <= obj_ptr->bbox.ltx && X2 >= obj_ptr->bbox.rbx && Y1 <= obj_ptr->bbox.lty && Y2 >= obj_ptr->bbox.rby) { ! AddObjIntoSel(obj_ptr, NULL, *TopSel, TopSel, BotSel); } } *************** *** 1542,1545 **** --- 1532,1563 ---- } + static + int PtInObjAboveSelected(XOff, YOff) + int XOff, YOff; + /* + * returns TRUE if there is an object under the mouse that's above all the + * selected objects -- in this case, that object should be selected + */ + { + struct ObjRec *obj_ptr=NULL, *owner_obj=NULL, *found_obj=NULL; + + found_obj = FindAnObj(XOff, YOff, &owner_obj, NULL, NULL); + if (found_obj == NULL) { + /* no object under the cursor */ + return FALSE; + } + if (owner_obj != NULL) found_obj = owner_obj; + if (topSel == NULL) { + return TRUE; + } + for (obj_ptr=topObj; obj_ptr != NULL && obj_ptr != topSel->obj; + obj_ptr=obj_ptr->next) { + if (obj_ptr == found_obj) { + return TRUE; + } + } + return FALSE; + } + void Select(input) XEvent *input; *************** *** 1626,1631 **** 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; --- 1644,1649 ---- StretchSel(grid_x, grid_y, sel_ptr->obj, corner); return; ! } else if (!PtInObjAboveSelected(mouse_x, mouse_y) && ! (obj_ptr=PtInSelected(mouse_x, mouse_y)) != NULL) { MoveSel(grid_x, grid_y, obj_ptr, button_ev); return; *************** *** 1632,1636 **** } } else if (oneMotionSelectMove && ! SelectOneObj(mouse_x,mouse_y, &inner_obj) != NULL) { HighLightForward(); MoveSel(grid_x, grid_y, --- 1650,1654 ---- } } else if (oneMotionSelectMove && ! SelectOneObj(mouse_x, mouse_y, &inner_obj) != NULL) { HighLightForward(); MoveSel(grid_x, grid_y, *************** *** 1672,1680 **** if (attr_ptr == NULL) return NULL; ! if (found_attr->obj->color == colorIndex) return found_attr; 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; } else { --- 1690,1700 ---- if (attr_ptr == NULL) return NULL; ! if (GetTextObjFirstStrSeg(found_attr->obj)->color == colorIndex) { ! return found_attr; ! } 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 (GetTextObjFirstStrSeg(attr_ptr->obj)->color == colorIndex) { break; } else { *************** *** 1684,1688 **** } else { if (strcmp(attr_ptr->attr_value.s, AttrName) == 0) { ! if (attr_ptr->obj->color == colorIndex) { break; } else { --- 1704,1708 ---- } else { if (strcmp(attr_ptr->attr_value.s, AttrName) == 0) { ! if (GetTextObjFirstStrSeg(attr_ptr->obj)->color == colorIndex) { break; } else { *************** *** 1771,1774 **** --- 1791,1795 ---- while (!DirIsRemote(curDir) && fileModified) { + XBell(mainDisplay, 0); switch (MsgBox("File modified.\n\nSave file before open? [ync](y)", TOOL_NAME, YNC_MB)) { *************** *** 1875,1879 **** fclose(fp); } - navigatingBackAndForth = TRUE; obj_file = FileNameHasExtension(file_name, OBJ_FILE_TYPE, &gzipped, NULL); --- 1896,1899 ---- *************** *** 2101,2106 **** int high_light; { ! register struct SelRec *sel_ptr; ! register struct ObjRec *obj_ptr; TieLooseEnds(); --- 2121,2125 ---- int high_light; { ! struct ObjRec *obj_ptr=NULL; TieLooseEnds(); *************** *** 2115,2129 **** continue; } ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! sel_ptr->next = topSel; ! sel_ptr->obj = obj_ptr; ! sel_ptr->prev = NULL; ! if (topSel == NULL) { ! botSel = sel_ptr; ! } else { ! topSel->prev = sel_ptr; ! } ! topSel = sel_ptr; } UpdSelBBox(); --- 2134,2138 ---- continue; } ! AddObjIntoSel(obj_ptr, NULL, topSel, &topSel, &botSel); } UpdSelBBox(); *************** *** 2155,2159 **** /* 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) { --- 2164,2168 ---- /* and tmpBotObj points to the bottom of the selected objects */ { ! struct SelRec *sel_ptr=NULL; for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { *** setup.c.orig Wed May 19 10:27:35 1999 --- setup.c Wed May 19 10:27:35 1999 *************** *** 41,44 **** --- 41,45 ---- #include "auxtext.e" #include "choice.e" + #include "choose.e" #include "cmd.e" #include "color.e" *************** *** 1042,1050 **** } } ! usePsAdobeString = FALSE; *adobeString = '\0'; *epsfString = '\0'; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"UsePsAdobeString")) != NULL) { ! if (UtilStrICmp("true", c_ptr) == 0) { usePsAdobeString = TRUE; } else { --- 1043,1053 ---- } } ! usePsAdobeString = TRUE; *adobeString = '\0'; *epsfString = '\0'; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"UsePsAdobeString")) != NULL) { ! if (UtilStrICmp("false", c_ptr) == 0) { ! usePsAdobeString = FALSE; ! } else if (UtilStrICmp("true", c_ptr) == 0) { usePsAdobeString = TRUE; } else { *************** *** 1055,1060 **** epsfString)) { fprintf(stderr, "%s %s*UsePsAdobeString: '%s', %s.\n", ! "Invalid", TOOL_NAME, tmp_str, "'false' is used"); ! usePsAdobeString = FALSE; } } --- 1058,1063 ---- epsfString)) { fprintf(stderr, "%s %s*UsePsAdobeString: '%s', %s.\n", ! "Invalid", TOOL_NAME, tmp_str, "'true' is used"); ! usePsAdobeString = TRUE; } } *************** *** 1147,1156 **** 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; --- 1150,1157 ---- if (paper_size_set) UpdPageStyle(pageStyle); ! usePaperSizeStoredInFile = TRUE; if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"UsePaperSizeStoredInFile")) != ! NULL && UtilStrICmp("false", c_ptr) == 0) { ! usePaperSizeStoredInFile = FALSE; } oneMotionSelectMove = FALSE; *************** *** 1224,1231 **** } } ! stretchableText = FALSE; if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "StretchableText")) != NULL && ! UtilStrICmp(c_ptr, "true") == 0) { ! stretchableText = TRUE; } SetEditTextSizeValue(0); --- 1225,1232 ---- } } ! stretchableText = TRUE; if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "StretchableText")) != NULL && ! UtilStrICmp(c_ptr, "false") == 0) { ! stretchableText = FALSE; } SetEditTextSizeValue(0); *************** *** 1389,1415 **** } if (*bootDir == '\0') { ! #ifdef VMS ! if (getcwd(bootDir, MAXPATHLENGTH+2, 0) == NULL) strcpy(bootDir, "."); ! #else ! #ifdef ibm ! if (getwd(bootDir, MAXPATHLENGTH+2) == NULL) strcpy(bootDir, "."); ! #else ! #ifdef NeXT ! if (getwd(bootDir, MAXPATHLENGTH+2) == NULL) strcpy(bootDir, "."); ! #else ! #ifdef luna88k ! if (getwd(bootDir) == NULL) strcpy(bootDir, "."); ! #else ! #ifdef sequent ! if (getwd(bootDir) == NULL) strcpy(bootDir, "."); ! #else ! if (getcwd(bootDir, MAXPATHLENGTH+2) == NULL) strcpy(bootDir, "."); ! #endif ! #endif ! #endif ! #endif ! #endif } - sizehints.flags = PPosition | PSize | PMinSize; sizehints.x = 0; --- 1390,1395 ---- } if (*bootDir == '\0') { ! GetWorkingDirectory(bootDir, sizeof(bootDir)); } sizehints.flags = PPosition | PSize | PMinSize; sizehints.x = 0; *************** *** 1451,1469 **** if (bitmask & YValue) y_in_cmdline = TRUE; } - #ifndef _NO_LOCALE_SUPPORT - #ifdef _ENABLE_NLS - { - char prev_locale[MAXSTRING]; - - SaveAndSetLocale("", prev_locale); - InitFonts(); - RestoreLocale(prev_locale); - } - #else /* ~_ENABLE_NLS */ InitFonts(); - #endif /* _ENABLE_NLS */ - #else /* _NO_LOCALE_SUPPORT */ - InitFonts(); - #endif /* ~_NO_LOCALE_SUPPORT */ initialMenubarWindowH = defaultFontHeight; --- 1431,1435 ---- *************** *** 2059,2063 **** if (modified != fileModified) { fileModified = modified; ! RedrawTitleWindow(); } } --- 2025,2031 ---- if (modified != fileModified) { fileModified = modified; ! if (!PRTGIF) { ! RedrawTitleWindow(); ! } } } *** shortcut.c.orig Wed May 19 10:27:37 1999 --- shortcut.c Wed May 19 10:27:37 1999 *************** *** 228,234 **** { '\0', 0, "ImportGIFFile()", 0, CMDID_IMPORTGIFFILE }, { '\0', 0, "SetExportPixelTrim()", 0, CMDID_SETEXPORTPIXELTRIM }, - #ifdef _TGIF_WB - { '\0', 0, "WhiteBoard()", 0, CMDID_WHITEBOARD }, - #endif /* _TGIF_WB */ { '\0', 0, "ToggleColorLayers()", 0, CMDID_TOGGLECOLORLAYERS }, { '\0', 0, "ToggleStretchableText()", 0, CMDID_TOGGLESTRETCHABLETEXT }, --- 228,231 ---- *************** *** 361,364 **** --- 358,363 ---- { '\0', 0, "ExportThresholdBitmap()", 0, CMDID_EXPORTTHRESHOLDBITMAP }, { '\0', 0, "SetExportBitmapThreshold()", 1, CMDID_SETEXPORTBITMAPTHRESHOLD }, + { '\0', 0, "PreciseScaleEverything()", 0, CMDID_PRECISESCALEEVERYTHING }, + { '\0', 0, "SetPaperColor()", 0, CMDID_SETPAPERCOLOR }, { '\0', 0, "", 0, 0 } }; *** special.c.orig Wed May 19 10:27:38 1999 --- special.c Wed May 19 10:27:38 1999 *************** *** 71,77 **** #include "stk.e" #include "text.e" - #ifdef _TGIF_WB - #include "wb1.e" - #endif /* _TGIF_WB */ #include "util.e" #include "version.e" --- 71,74 ---- *************** *** 1252,1255 **** --- 1249,1253 ---- } while (!DirIsRemote(curDir) && fileModified) { + XBell(mainDisplay, 0); switch (MsgBox("File modified, save file before merge? [ync](y)", TOOL_NAME, YNC_MB)) { *** stk.c.orig Wed May 19 10:27:40 1999 --- stk.c Wed May 19 10:27:40 1999 *************** *** 69,72 **** --- 69,73 ---- #include "util.e" #include "version.e" + #include "wb.e" struct ObjRec *tgifObj=NULL; *************** *** 241,244 **** --- 242,250 ---- char tmp_filename[MAXPATHLENGTH]; + if (gstWBInfo.do_whiteboard) { + MsgBox("'Push' is disabled when running in the WhiteBoard mode!", + TOOL_NAME, INFO_MB); + return FALSE; + } if (topSel == NULL || topSel != botSel || (topSel->obj->type != OBJ_ICON && topSel->obj->type != OBJ_PIN)) { *************** *** 460,464 **** sprintf(gszMsgBox, "Pop back to '%s'.", fname); } ! Msg(gszMsgBox); SetCurDir(fname); --- 466,470 ---- sprintf(gszMsgBox, "Pop back to '%s'.", fname); } ! if (!deserializingFile) Msg(gszMsgBox); SetCurDir(fname); *************** *** 466,470 **** sprintf(gszMsgBox, "Poping back to parent level. Current file undefined."); ! Msg(gszMsgBox); } --- 472,476 ---- sprintf(gszMsgBox, "Poping back to parent level. Current file undefined."); ! if (!deserializingFile) Msg(gszMsgBox); } *************** *** 506,509 **** --- 512,516 ---- } while (fileModified) { + XBell(mainDisplay, 0); switch (MsgBox("File modified, save file before quit? [ync](y)", TOOL_NAME, YNC_MB)) { *** stream.c.orig Wed May 19 10:27:41 1999 --- stream.c Wed May 19 10:27:41 1999 *************** *** 72,76 **** int i=0; ! for (i=0; i < gnMaxStreamFilters; i++) { UtilFree(gaszFilterForContentType[i]); UtilFree(gaszFilterForContentType[++i]); --- 72,76 ---- int i=0; ! for (i=0; i < (gnMaxStreamFilters<<1); i++) { UtilFree(gaszFilterForContentType[i]); UtilFree(gaszFilterForContentType[++i]); *** stretch.c.orig Wed May 19 10:27:42 1999 --- stretch.c Wed May 19 10:27:42 1999 *************** *** 47,50 **** --- 47,51 ---- #include "dup.e" #include "exec.e" + #include "file.e" #include "font.e" #include "grid.e" *************** *** 51,54 **** --- 52,56 ---- #include "mainloop.e" #include "mark.e" + #include "menu.e" #include "miniline.e" #include "move.e" *************** *** 55,58 **** --- 57,61 ---- #include "msg.e" #include "obj.e" + #include "page.e" #include "poly.e" #include "raster.e" *************** *** 59,62 **** --- 62,66 ---- #include "rect.e" #include "ruler.e" + #include "scroll.e" #include "select.e" #include "setup.e" *************** *** 71,74 **** --- 75,80 ---- int rotationIncrement=(45<<6); /* degrees*64 */ + static int stretchingEverything=FALSE; + static int PtIn4Corners(XOff, YOff, BBox, Corner) *************** *** 939,945 **** static ! void SetPivot(Corner, OBBox) int Corner; ! struct BBRec OBBox; /* pivotX, pivotY, moveX, moveY will be set to screen offsets */ { --- 945,951 ---- static ! void SetPivot(Corner, pOBBox) int Corner; ! struct BBRec *pOBBox; /* pivotX, pivotY, moveX, moveY will be set to screen offsets */ { *************** *** 946,991 **** switch (Corner) { case CORNER_NONE: /* same as CORNER_CC */ ! pivotX = moveX = ((OBBox.ltx+OBBox.rbx)>>1); ! pivotY = moveY = ((OBBox.lty+OBBox.rby)>>1); changeX = TRUE; changeY = TRUE; break; case CORNER_LT: ! pivotX = OBBox.rbx; pivotY = OBBox.rby; ! moveX = OBBox.ltx; moveY = OBBox.lty; changeX = changeY = TRUE; break; case CORNER_TOP: ! pivotX = moveX = ((OBBox.ltx+OBBox.rbx)>>1); pivotY = OBBox.rby; ! moveY = OBBox.lty; changeX = FALSE; changeY = TRUE; break; case CORNER_RT: ! pivotX = OBBox.ltx; pivotY = OBBox.rby; ! moveX = OBBox.rbx; moveY = OBBox.lty; changeX = changeY = TRUE; break; case CORNER_RIGHT: ! pivotX = OBBox.ltx; pivotY = moveY = ((OBBox.lty+OBBox.rby)>>1); ! moveX = OBBox.rbx; changeX = TRUE; changeY = FALSE; break; case CORNER_RB: ! pivotX = OBBox.ltx; pivotY = OBBox.lty; ! moveX = OBBox.rbx; moveY = OBBox.rby; changeX = changeY = TRUE; break; case CORNER_BOTTOM: ! pivotX = moveX = ((OBBox.ltx+OBBox.rbx)>>1); pivotY = OBBox.lty; ! moveY = OBBox.rby; changeX = FALSE; changeY = TRUE; break; case CORNER_LB: ! pivotX = OBBox.rbx; pivotY = OBBox.lty; ! moveX = OBBox.ltx; moveY = OBBox.rby; changeX = changeY = TRUE; break; case CORNER_LEFT: ! pivotX = OBBox.rbx; pivotY = moveY = ((OBBox.lty+OBBox.rby)>>1); ! moveX = OBBox.ltx; changeX = TRUE; changeY = FALSE; break; --- 952,997 ---- switch (Corner) { case CORNER_NONE: /* same as CORNER_CC */ ! pivotX = moveX = ((pOBBox->ltx+pOBBox->rbx)>>1); ! pivotY = moveY = ((pOBBox->lty+pOBBox->rby)>>1); changeX = TRUE; changeY = TRUE; break; case CORNER_LT: ! pivotX = pOBBox->rbx; pivotY = pOBBox->rby; ! moveX = pOBBox->ltx; moveY = pOBBox->lty; changeX = changeY = TRUE; break; case CORNER_TOP: ! pivotX = moveX = ((pOBBox->ltx+pOBBox->rbx)>>1); pivotY = pOBBox->rby; ! moveY = pOBBox->lty; changeX = FALSE; changeY = TRUE; break; case CORNER_RT: ! pivotX = pOBBox->ltx; pivotY = pOBBox->rby; ! moveX = pOBBox->rbx; moveY = pOBBox->lty; changeX = changeY = TRUE; break; case CORNER_RIGHT: ! pivotX = pOBBox->ltx; pivotY = moveY = ((pOBBox->lty+pOBBox->rby)>>1); ! moveX = pOBBox->rbx; changeX = TRUE; changeY = FALSE; break; case CORNER_RB: ! pivotX = pOBBox->ltx; pivotY = pOBBox->lty; ! moveX = pOBBox->rbx; moveY = pOBBox->rby; changeX = changeY = TRUE; break; case CORNER_BOTTOM: ! pivotX = moveX = ((pOBBox->ltx+pOBBox->rbx)>>1); pivotY = pOBBox->lty; ! moveY = pOBBox->rby; changeX = FALSE; changeY = TRUE; break; case CORNER_LB: ! pivotX = pOBBox->rbx; pivotY = pOBBox->lty; ! moveX = pOBBox->ltx; moveY = pOBBox->rby; changeX = changeY = TRUE; break; case CORNER_LEFT: ! pivotX = pOBBox->rbx; pivotY = moveY = ((pOBBox->lty+pOBBox->rby)>>1); ! moveX = pOBBox->ltx; changeX = TRUE; changeY = FALSE; break; *************** *** 1203,1217 **** struct AttrRec *attr_ptr=ObjPtr->fattr; ! if (AutoCenterAttr) { ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) { ! if (attr_ptr->shown) { ! CenterObjInOBBox(attr_ptr->obj, ObjPtr->obbox, NULL); ! } else { ! StretchSimpleText(attr_ptr->obj, Corner, XScale, YScale); } } } else { ! for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) { ! StretchSimpleText(attr_ptr->obj, Corner, XScale, YScale); } } --- 1209,1264 ---- struct AttrRec *attr_ptr=ObjPtr->fattr; ! if (attr_ptr == NULL) return; ! ! if (stretchingEverything) { ! struct BBRec final_obbox; ! ! if (AutoCenterAttr) { ! for (attr_ptr=ObjPtr->fattr; attr_ptr != NULL; ! attr_ptr=attr_ptr->next) { ! struct ObjRec *obj_ptr=attr_ptr->obj; ! int ltx=0, lty=0, rbx=0, rby=0; ! ! StretchedAbsXY(obj_ptr->obbox.ltx, obj_ptr->obbox.lty, <x, <y); ! StretchedAbsXY(obj_ptr->obbox.rbx, obj_ptr->obbox.rby, &rbx, &rby); ! CalcBBox(ltx, lty, rbx, rby, &final_obbox.ltx, &final_obbox.lty, ! &final_obbox.rbx, &final_obbox.rby); ! ! ShearObj(attr_ptr->obj, Corner, 0, 0, XScale, YScale, ! &final_obbox.ltx, &final_obbox.lty); ! if (attr_ptr->shown) { ! CenterObjInOBBox(attr_ptr->obj, ObjPtr->obbox, NULL); ! } } + } else { + for (attr_ptr=ObjPtr->fattr; attr_ptr != NULL; + attr_ptr=attr_ptr->next) { + struct ObjRec *obj_ptr=attr_ptr->obj; + int ltx=0, lty=0, rbx=0, rby=0; + + StretchedAbsXY(obj_ptr->obbox.ltx, obj_ptr->obbox.lty, <x, <y); + StretchedAbsXY(obj_ptr->obbox.rbx, obj_ptr->obbox.rby, &rbx, &rby); + CalcBBox(ltx, lty, rbx, rby, &final_obbox.ltx, &final_obbox.lty, + &final_obbox.rbx, &final_obbox.rby); + + ShearObj(obj_ptr, Corner, 0, 0, XScale, YScale, + &final_obbox.ltx, &final_obbox.lty); + } } } else { ! if (AutoCenterAttr) { ! for (attr_ptr=ObjPtr->fattr; attr_ptr != NULL; ! attr_ptr=attr_ptr->next) { ! if (attr_ptr->shown) { ! CenterObjInOBBox(attr_ptr->obj, ObjPtr->obbox, NULL); ! } else { ! StretchSimpleText(attr_ptr->obj, Corner, XScale, YScale); ! } ! } ! } else { ! for (attr_ptr=ObjPtr->fattr; attr_ptr != NULL; ! attr_ptr=attr_ptr->next) { ! StretchSimpleText(attr_ptr->obj, Corner, XScale, YScale); ! } } } *************** *** 1347,1350 **** --- 1394,1398 ---- } + static void StretchObj(ObjPtr, Corner, XScale, YScale) struct ObjRec *ObjPtr; *************** *** 1655,1661 **** EndCompositeCmd(); } else { ! PrepareToRecord(CMD_STRETCH, topSel, botSel, numObjSelected); StretchAllSelObjects(Corner, XScale, YScale); ! RecordCmd(CMD_STRETCH, NULL, topSel, botSel, numObjSelected); UpdSelBBox(); RedrawAreas(botObj, saved_ltx-GRID_ABS_SIZE(1), --- 1703,1709 ---- EndCompositeCmd(); } else { ! PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); StretchAllSelObjects(Corner, XScale, YScale); ! RecordCmd(CMD_REPLACE, NULL, topSel, botSel, numObjSelected); UpdSelBBox(); RedrawAreas(botObj, saved_ltx-GRID_ABS_SIZE(1), *************** *** 1737,1741 **** ExposeEventHandler(&ev, TRUE); } ! SetPivot(Corner, ObjPtr->obbox); stretched_sel_ltx = sel_ltx = OFFSET_X(selNoLockLtX); --- 1785,1789 ---- ExposeEventHandler(&ev, TRUE); } ! SetPivot(Corner, &ObjPtr->obbox); stretched_sel_ltx = sel_ltx = OFFSET_X(selNoLockLtX); *************** *** 1972,1983 **** 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 scaled."); } --- 2020,2033 ---- int Corner, XScale, YScale; { ! struct SelRec *sel_ptr=NULL; for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=sel_ptr->next) { ! if (stretchingEverything || !sel_ptr->obj->locked) { StretchObj(sel_ptr->obj, Corner, XScale, YScale); } } ! if (!stretchingEverything && numObjLocked != 0) { ! Msg("Locked objects are not scaled."); ! } } *************** *** 1992,1996 **** saved_rbx = selRbX; saved_rby = selRbY; ! if (moveMode==CONST_MOVE) { MarkObjectsForStretch(); --- 2042,2046 ---- saved_rbx = selRbX; saved_rby = selRbY; ! if (moveMode == CONST_MOVE) { MarkObjectsForStretch(); *************** *** 2019,2025 **** EndCompositeCmd(); } else { ! PrepareToRecord(CMD_STRETCH, topSel, botSel, numObjSelected); ScaleAllSelObjects(Corner, XScale, YScale); ! RecordCmd(CMD_STRETCH, NULL, topSel, botSel, numObjSelected); UpdSelBBox(); RedrawAreas(botObj, saved_ltx-GRID_ABS_SIZE(1), --- 2069,2075 ---- EndCompositeCmd(); } else { ! PrepareToRecord(CMD_REPLACE, topSel, botSel, numObjSelected); ScaleAllSelObjects(Corner, XScale, YScale); ! RecordCmd(CMD_REPLACE, NULL, topSel, botSel, numObjSelected); UpdSelBBox(); RedrawAreas(botObj, saved_ltx-GRID_ABS_SIZE(1), *************** *** 2041,2045 **** void ScaleAllSelObj() { ! char spec[MAXSTRING], *y_spec, **ppsz_names_to_resize=NULL; int corner=INVALID, saved_h_align=horiAlign, saved_v_align=vertAlign; int num_to_resize=0; --- 2091,2095 ---- void ScaleAllSelObj() { ! char spec[MAXSTRING], *y_spec=NULL, **ppsz_names_to_resize=NULL; int corner=INVALID, saved_h_align=horiAlign, saved_v_align=vertAlign; int num_to_resize=0; *************** *** 2054,2058 **** return; } ! Dialog("Please enter scaling factor: [X:Y] or [Scale]", NULL, spec); UtilTrimBlanks(spec); if (*spec == '\0') return; --- 2104,2108 ---- return; } ! Dialog("Please enter scaling factors: [X:Y] or [Scale]", NULL, spec); UtilTrimBlanks(spec); if (*spec == '\0') return; *************** *** 2060,2110 **** horiAlign = ALIGN_L; vertAlign = ALIGN_T; ! switch (horiAlign) { ! case ALIGN_N: ! case ALIGN_S: ! switch (vertAlign) { ! case ALIGN_N: corner = CORNER_NONE; break; ! case ALIGN_S: corner = CORNER_NONE; break; ! case ALIGN_T: corner = CORNER_BOTTOM; break; ! case ALIGN_M: corner = CORNER_NONE; break; ! case ALIGN_B: corner = CORNER_TOP; break; ! } ! break; ! case ALIGN_L: ! switch (vertAlign) { ! case ALIGN_N: corner = CORNER_RIGHT; break; ! case ALIGN_S: corner = CORNER_RIGHT; break; ! case ALIGN_T: corner = CORNER_RB; break; ! case ALIGN_M: corner = CORNER_RIGHT; break; ! case ALIGN_B: corner = CORNER_RT; break; ! } ! break; ! case ALIGN_C: ! switch (vertAlign) { ! case ALIGN_N: corner = CORNER_NONE; break; ! case ALIGN_S: corner = CORNER_NONE; break; ! case ALIGN_T: corner = CORNER_BOTTOM; break; ! case ALIGN_M: corner = CORNER_NONE; break; ! case ALIGN_B: corner = CORNER_TOP; break; ! } ! break; ! case ALIGN_R: ! switch (vertAlign) { ! case ALIGN_N: corner = CORNER_LEFT; break; ! case ALIGN_S: corner = CORNER_LEFT; break; ! case ALIGN_T: corner = CORNER_LB; break; ! case ALIGN_M: corner = CORNER_LEFT; break; ! case ALIGN_B: corner = CORNER_LT; break; ! } ! break; ! } obbox.ltx = selNoLockObjLtX; obbox.lty = selNoLockObjLtY; obbox.rbx = selNoLockObjRbX; obbox.rby = selNoLockObjRbY; ! SetPivot(corner, obbox); horiAlign = saved_h_align; vertAlign = saved_v_align; if ((y_spec=FindColon(spec)) == NULL) { ! sscanf(spec, "%lf", &multX); ! if (multX <= 0.0) { sprintf(gszMsgBox, "Invalid scaling specification: '%s'.", spec); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); --- 2110,2122 ---- horiAlign = ALIGN_L; vertAlign = ALIGN_T; ! corner = CORNER_RB; ! obbox.ltx = selNoLockObjLtX; obbox.lty = selNoLockObjLtY; obbox.rbx = selNoLockObjRbX; obbox.rby = selNoLockObjRbY; ! SetPivot(corner, &obbox); horiAlign = saved_h_align; vertAlign = saved_v_align; if ((y_spec=FindColon(spec)) == NULL) { ! if (sscanf(spec, "%lf", &multX) != 1 || multX <= 0.0) { sprintf(gszMsgBox, "Invalid scaling specification: '%s'.", spec); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); *************** *** 2114,2120 **** } else { *y_spec++ = '\0'; ! sscanf(spec, "%lf", &multX); ! sscanf(y_spec, "%lf", &multY); ! if (multX <= 0.0 || multY <= 0.0) { sprintf(gszMsgBox, "Invalid scaling specification: '%s'.", spec); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); --- 2126,2132 ---- } else { *y_spec++ = '\0'; ! if (sscanf(spec, "%lf", &multX) != 1 || ! sscanf(y_spec, "%lf", &multY) != 1 || ! multX <= 0.0 || multY <= 0.0) { sprintf(gszMsgBox, "Invalid scaling specification: '%s'.", spec); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); *************** *** 2145,2148 **** --- 2157,2263 ---- } + void PreciseScaleEverything() + { + int corner=CORNER_RB, saved_h_align=horiAlign, saved_v_align=vertAlign; + int saved_cur_page_num=curPageNum, prev_page_num=curPageNum; + int saved_stretchable_text=stretchableText; + char spec[MAXSTRING], buf[MAXSTRING]; + struct BBRec obbox; + + Dialog("Please enter a scaling factor: ", NULL, spec); + UtilTrimBlanks(spec); + if (*spec == '\0') return; + + obbox.ltx = obbox.lty = 0; + obbox.rbx = onePageWidth; obbox.rby = onePageHeight; + SetPivot(corner, &obbox); + + if (FindColon(spec) != NULL) { + MsgBox("Please only input only one numeric value.", TOOL_NAME, INFO_MB); + return; + } else if (sscanf(spec, "%lf", &multX) != 1 || multX <= 0.0) { + sprintf(gszMsgBox, "Invalid scaling specification: '%s'.", spec); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + return; + } else if (fabs(multX-((float)1.0)) < INT_TOL) { + return; + } + if (round(multX) >= 10) { + sprintf(gszMsgBox, "Scaling everything by %g times. Are you sure?", + multX); + if (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB) != MB_ID_YES) { + return; + } + } + MakeQuiescent(); + + multY = multX; + + changeX = (fabs(multX-1.0) > 1.0e-6); + changeY = (fabs(multY-1.0) > 1.0e-6); + if (!changeX && !changeY) return; + + corner = CORNER_RB; + horiAlign = ALIGN_L; + vertAlign = ALIGN_T; + stretchableText = saved_stretchable_text; + + printMag /= multX; + if (UpdPageStyle(pageStyle)) { + UpdDrawWinBBox(); + AdjSplineVs(); + } + FormatFloat(&printMag, buf); + if (printMag <= 100.0) { + sprintf(gszMsgBox, "New reduction is %s%%.", buf); + } else { + sprintf(gszMsgBox, "New enlargement is %s%%.", buf); + } + Msg(gszMsgBox); + + StartCompositeCmd(); + for (curPageNum=1; curPageNum <= lastPageNum; curPageNum++) { + int num_to_resize=0; + char **ppsz_names_to_resize=NULL; + + PrepareToRecord(CMD_GOTO_PAGE, NULL, NULL, prev_page_num); + GotoPageNum(curPageNum); + RecordCmd(CMD_GOTO_PAGE, NULL, NULL, NULL, curPageNum); + prev_page_num = curPageNum; + + SelAllObj(FALSE); + + ppsz_names_to_resize = NeedToProcessOnResize(&num_to_resize); + if (ppsz_names_to_resize == NULL) { + stretchingEverything = TRUE; + ScaleAllSel(corner, (int)(multX * 1000.0), (int)(multY * 1000.0)); + stretchingEverything = FALSE; + } else { + stretchingEverything = TRUE; + ScaleAllSel(corner, (int)(multX * 1000.0), (int)(multY * 1000.0)); + stretchingEverything = FALSE; + DoOnResize(ppsz_names_to_resize, num_to_resize); + } + RemoveAllSel(); + } + PrepareToRecord(CMD_GOTO_PAGE, NULL, NULL, prev_page_num); + GotoPageNum(saved_cur_page_num); + RecordCmd(CMD_GOTO_PAGE, NULL, NULL, NULL, saved_cur_page_num); + + EndCompositeCmd(); + + SetFileModified(TRUE); + justDupped = FALSE; + + stretchableText = saved_stretchable_text; + horiAlign = saved_h_align; + vertAlign = saved_v_align; + + RedrawScrollBars(); + RedrawRulers(); + RedrawTitleWindow(); + ClearAndRedrawDrawWindow(); + } + void SizeAllSelObj(AbsW, AbsH) int AbsW, AbsH; *************** *** 2160,2164 **** obbox.ltx = selObjLtX; obbox.lty = selObjLtY; obbox.rbx = selObjRbX; obbox.rby = selObjRbY; ! SetPivot(CORNER_RB, obbox); horiAlign = ALIGN_L; --- 2275,2279 ---- obbox.ltx = selObjLtX; obbox.lty = selObjLtY; obbox.rbx = selObjRbX; obbox.rby = selObjRbY; ! SetPivot(CORNER_RB, &obbox); horiAlign = ALIGN_L; *************** *** 2187,2190 **** --- 2302,2384 ---- } + void SizeAnObj(ObjPtr, TopOwner, AbsW, AbsH) + struct ObjRec *ObjPtr, *TopOwner; + int AbsW, AbsH; + /* This function is meant to be called from within an internal command */ + { + int obj_w=ObjPtr->obbox.rbx-ObjPtr->obbox.ltx; + int obj_h=ObjPtr->obbox.rby-ObjPtr->obbox.lty; + + if (execCurDepth <= 0) { + #ifdef _TGIF_DBG + TgAssert(FALSE, + "SizeAnObj() called not from an internal command!", NULL); + return; + #endif /* _TGIF_DBG */ + } + if (obj_w == AbsW && obj_h == AbsH) { + return; + } + if (ObjPtr == TopOwner) { + struct SelRec *saved_top_sel=topSel, *saved_bot_sel=botSel; + + topSel = botSel = NULL; + AddObjIntoSel(ObjPtr, NULL, topSel, &topSel, &botSel); + UpdSelBBox(); + + SizeAllSelObj(AbsW, AbsH); + + RemoveAllSel(); + topSel = saved_top_sel; + botSel = saved_bot_sel; + UpdSelBBox(); + } else { + int saved_h_align=horiAlign, saved_v_align=vertAlign; + int ltx=TopOwner->bbox.ltx, lty=TopOwner->bbox.lty; + int rbx=TopOwner->bbox.rbx, rby=TopOwner->bbox.rby; + struct SelRec *saved_top_sel=topSel, *saved_bot_sel=botSel; + + SetPivot(CORNER_RB, &ObjPtr->obbox); + + multX = (obj_w == 0) ? ((double)1.0) : ((double)AbsW) / ((double)obj_w); + multY = (obj_h == 0) ? ((double)1.0) : ((double)AbsH) / ((double)obj_h); + changeX = (fabs(multX-1.0) > 1.0e-6); + changeY = (fabs(multY-1.0) > 1.0e-6); + if (!changeX && !changeY) { + return; + } + horiAlign = ALIGN_L; + vertAlign = ALIGN_T; + + topSel = botSel = NULL; + UpdSelBBox(); + + PrepareToReplaceAnObj(TopOwner); + + StretchObj(ObjPtr, CORNER_RB, (int)(multX*1000.0), (int)(multY*1000.0)); + while (ObjPtr != TopOwner) { + ObjPtr = ObjPtr->tmp_parent; + AdjObjBBox(ObjPtr); + } + RecordReplaceAnObj(TopOwner); + RedrawAreas(botObj, ltx-GRID_ABS_SIZE(1), lty-GRID_ABS_SIZE(1), + rbx+GRID_ABS_SIZE(1), rby+GRID_ABS_SIZE(1), + TopOwner->bbox.ltx-GRID_ABS_SIZE(1), + TopOwner->bbox.lty-GRID_ABS_SIZE(1), + TopOwner->bbox.rbx+GRID_ABS_SIZE(1), + TopOwner->bbox.rby+GRID_ABS_SIZE(1)); + + RemoveAllSel(); + topSel = saved_top_sel; + botSel = saved_bot_sel; + UpdSelBBox(); + + SetFileModified(TRUE); + justDupped = FALSE; + horiAlign = saved_h_align; + vertAlign = saved_v_align; + } + } + static void DoSizeAllSelToGivenWidthHeight(abs_w, abs_h, do_width, do_height) *************** *** 2213,2217 **** UpdSelBBox(); if (do_width && do_height) { ! SetPivot(CORNER_RB, obj_ptr->obbox); multX = (w == 0 ? ((double)1.0) : ((double)abs_w) / ((double)w)); multY = (h == 0 ? ((double)1.0) : ((double)abs_h) / ((double)h)); --- 2407,2411 ---- UpdSelBBox(); if (do_width && do_height) { ! SetPivot(CORNER_RB, &obj_ptr->obbox); multX = (w == 0 ? ((double)1.0) : ((double)abs_w) / ((double)w)); multY = (h == 0 ? ((double)1.0) : ((double)abs_h) / ((double)h)); *************** *** 2220,2224 **** ScaleAllSel(CORNER_RB, (int)(multX * 1000.0), (int)(multY * 1000.0)); } else if (do_width) { ! SetPivot(CORNER_RIGHT, obj_ptr->obbox); multX = (w == 0 ? ((double)1.0) : ((double)abs_w) / ((double)w)); changeX = (fabs(multX-1.0) > 1.0e-6); --- 2414,2418 ---- ScaleAllSel(CORNER_RB, (int)(multX * 1000.0), (int)(multY * 1000.0)); } else if (do_width) { ! SetPivot(CORNER_RIGHT, &obj_ptr->obbox); multX = (w == 0 ? ((double)1.0) : ((double)abs_w) / ((double)w)); changeX = (fabs(multX-1.0) > 1.0e-6); *************** *** 2225,2232 **** ScaleAllSel(CORNER_RIGHT, (int)(multX * 1000.0), 1000); } else { ! SetPivot(CORNER_BOTTOM, obj_ptr->obbox); multY = (h == 0 ? ((double)1.0) : ((double)abs_h) / ((double)h)); changeY = (fabs(multY-1.0) > 1.0e-6); ! ScaleAllSel(CORNER_BOTTOM, 1000, (int)(multX * 1000.0)); } free(topSel); --- 2419,2426 ---- ScaleAllSel(CORNER_RIGHT, (int)(multX * 1000.0), 1000); } else { ! SetPivot(CORNER_BOTTOM, &obj_ptr->obbox); multY = (h == 0 ? ((double)1.0) : ((double)abs_h) / ((double)h)); changeY = (fabs(multY-1.0) > 1.0e-6); ! ScaleAllSel(CORNER_BOTTOM, 1000, (int)(multY * 1000.0)); } free(topSel); *************** *** 2815,2819 **** double angle=AngleInRadian*64.0*180.0/M_PI; ! SetPivot(Corner, ObjPtr->obbox); RotateObj(ObjPtr, Corner, round(angle), NULL, NULL); } --- 3009,3013 ---- double angle=AngleInRadian*64.0*180.0/M_PI; ! SetPivot(Corner, &ObjPtr->obbox); RotateObj(ObjPtr, Corner, round(angle), NULL, NULL); } *************** *** 2961,2965 **** sel_obbox.ltx = selNoLockObjLtX; sel_obbox.lty = selNoLockObjLtY; sel_obbox.rbx = selNoLockObjRbX; sel_obbox.rby = selNoLockObjRbY; ! SetPivot(CORNER_LEFT, sel_obbox); saved_ltx = selLtX; saved_lty = selLtY; --- 3155,3159 ---- sel_obbox.ltx = selNoLockObjLtX; sel_obbox.lty = selNoLockObjLtY; sel_obbox.rbx = selNoLockObjRbX; sel_obbox.rby = selNoLockObjRbY; ! SetPivot(CORNER_LEFT, &sel_obbox); saved_ltx = selLtX; saved_lty = selLtY; *************** *** 3021,3025 **** sel_obbox.ltx = selNoLockObjLtX; sel_obbox.lty = selNoLockObjLtY; sel_obbox.rbx = selNoLockObjRbX; sel_obbox.rby = selNoLockObjRbY; ! SetPivot(CORNER_TOP, sel_obbox); saved_ltx = selLtX; saved_lty = selLtY; --- 3215,3219 ---- sel_obbox.ltx = selNoLockObjLtX; sel_obbox.lty = selNoLockObjLtY; sel_obbox.rbx = selNoLockObjRbX; sel_obbox.rby = selNoLockObjRbY; ! SetPivot(CORNER_TOP, &sel_obbox); saved_ltx = selLtX; saved_lty = selLtY; *************** *** 3680,3684 **** pivotY = OFFSET_Y(absPivotY); } else { ! SetPivot(Corner, ObjPtr->obbox); } SetBBRec(&orig_all_bbox, OFFSET_X(selNoLockLtX)-2, OFFSET_Y(selNoLockLtY)-2, --- 3874,3878 ---- pivotY = OFFSET_Y(absPivotY); } else { ! SetPivot(Corner, &ObjPtr->obbox); } SetBBRec(&orig_all_bbox, OFFSET_X(selNoLockLtX)-2, OFFSET_Y(selNoLockLtY)-2, *************** *** 4248,4252 **** ExposeEventHandler(&ev, TRUE); } ! SetPivot(Corner, ObjPtr->obbox); SetBBRec(&orig_all_bbox, OFFSET_X(selNoLockLtX)-2, OFFSET_Y(selNoLockLtY)-2, --- 4442,4446 ---- ExposeEventHandler(&ev, TRUE); } ! SetPivot(Corner, &ObjPtr->obbox); SetBBRec(&orig_all_bbox, OFFSET_X(selNoLockLtX)-2, OFFSET_Y(selNoLockLtY)-2, *** text.c.orig Wed May 19 10:27:45 1999 --- text.c Wed May 19 10:27:45 1999 *************** *** 78,81 **** --- 78,82 ---- #include "text.e" #include "util.e" + #include "wb.e" #include "xbitmap.e" #include "xpixmap.e" *************** *** 97,101 **** char scriptFractionStr[80]; ! int deleteNextCharWithDelKey=TRUE; static struct ObjRec *justDrawnTextObj=NULL; --- 98,102 ---- char scriptFractionStr[80]; ! static int deleteNextCharWithDelKey=TRUE; static struct ObjRec *justDrawnTextObj=NULL; *************** *** 109,112 **** --- 110,114 ---- static int tmpAdjAbsX=0, tmpAdjAbsY=0; /* absolute coordinates */ + static int curTextMovedAbsX=0, curTextMovedAbsY=0; /* absolute coordinates */ static int lengthLimit256InInsertChar=TRUE; *************** *** 854,857 **** --- 856,873 ---- } + static + void RedrawAreasInCreateText(ltx1, lty1, rbx1, rby1, ltx2, lty2, rbx2, rby2) + int ltx1, lty1, rbx1, rby1, ltx2, lty2, rbx2, rby2; + { + struct BBRec bbox; + + SetBBRec(&bbox, ltx1, lty1, rbx1, rby1); + UnionRect(&bbox, &curTextObj->bbox, &bbox); + RedrawAreas(botObj, bbox.ltx-GRID_ABS_SIZE(2), bbox.lty-GRID_ABS_SIZE(2), + bbox.rbx+GRID_ABS_SIZE(2), bbox.rby+GRID_ABS_SIZE(2), + ltx2-GRID_ABS_SIZE(2), lty2-GRID_ABS_SIZE(2), rbx2+GRID_ABS_SIZE(2), + rby2+GRID_ABS_SIZE(2)); + } + int CreateTextObj(nDeactivateIM, nRedraw) int nDeactivateIM, nRedraw; *************** *** 876,879 **** --- 892,901 ---- if (!textCursorShown) return FALSE; + #ifdef _TGIF_WB2 + if (gstWBInfo.do_whiteboard) { + gstWBInfo.BlockRemoteCmdDepth--; + } + #endif /* _TGIF_WB2 */ + text_ptr = curTextObj->detail.t; minilines = (&text_ptr->minilines); *************** *** 915,918 **** --- 937,949 ---- if (saved_color != colorIndex) UpdatePinnedMenu(MENU_COLOR); + #ifdef _TGIF_WB2 + if (gstWBInfo.do_whiteboard) { + TryHandleWBInputData(); + SetCurChoice(DRAWTEXT); + } + #endif /* _TGIF_WB2 */ + + curTextMovedAbsX = curTextMovedAbsY = 0; + return FALSE; } *************** *** 923,928 **** if (curTextObj->ctm == NULL) { ! curTextObj->x = textAbsX - tmpAdjAbsX; ! text_ptr->baseline_y = textAbsBaselineY - tmpAdjAbsY; curTextObj->y = text_ptr->baseline_y - minilines->first->asc; } else { --- 954,959 ---- if (curTextObj->ctm == NULL) { ! curTextObj->x = textAbsX - tmpAdjAbsX - curTextMovedAbsX; ! text_ptr->baseline_y = textAbsBaselineY - tmpAdjAbsY - curTextMovedAbsY; curTextObj->y = text_ptr->baseline_y - minilines->first->asc; } else { *************** *** 941,946 **** dy = anchor_y - (curTextObj->y + y); } ! curTextObj->x = textAbsX - tmpAdjAbsX; ! curTextObj->y = textAbsY - tmpAdjAbsY; curTextObj->x += dx; --- 972,977 ---- dy = anchor_y - (curTextObj->y + y); } ! curTextObj->x = textAbsX - tmpAdjAbsX - curTextMovedAbsX; ! curTextObj->y = textAbsY - tmpAdjAbsY - curTextMovedAbsY; curTextObj->x += dx; *************** *** 1084,1093 **** } if (nRedraw) { ! RedrawAreas(botObj, beforeEditTextInfo.bbox.ltx-GRID_ABS_SIZE(2), ! beforeEditTextInfo.bbox.lty-GRID_ABS_SIZE(2), ! beforeEditTextInfo.bbox.rbx+GRID_ABS_SIZE(2), ! beforeEditTextInfo.bbox.rby+GRID_ABS_SIZE(2), ! ltx-GRID_ABS_SIZE(2), lty-GRID_ABS_SIZE(2), rbx+GRID_ABS_SIZE(2), ! rby+GRID_ABS_SIZE(2)); } } else { --- 1115,1121 ---- } if (nRedraw) { ! RedrawAreasInCreateText(beforeEditTextInfo.bbox.ltx, ! beforeEditTextInfo.bbox.lty, beforeEditTextInfo.bbox.rbx, ! beforeEditTextInfo.bbox.rby, ltx, lty, rbx, rby); } } else { *************** *** 1100,1105 **** } if (nRedraw) { ! RedrawAreas(botObj, ltx-GRID_ABS_SIZE(2), lty-GRID_ABS_SIZE(2), ! rbx+GRID_ABS_SIZE(2), rby+GRID_ABS_SIZE(2), ABS_X(x-2), ABS_Y(textOrigY-2), ABS_X(x+textW-textAbsMinLBearing+textAbsMaxRExtra+3), --- 1128,1132 ---- } if (nRedraw) { ! RedrawAreasInCreateText(ltx, lty, rbx, rby, ABS_X(x-2), ABS_Y(textOrigY-2), ABS_X(x+textW-textAbsMinLBearing+textAbsMaxRExtra+3), *************** *** 1129,1138 **** rotationIncrement = saved_rotation_increment; if (nRedraw) { ! 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), ! topObj->bbox.rby+GRID_ABS_SIZE(1)); } } --- 1156,1162 ---- rotationIncrement = saved_rotation_increment; if (nRedraw) { ! RedrawAreasInCreateText(saved_ltx, saved_lty, saved_rbx, saved_rby, ! topObj->bbox.ltx, topObj->bbox.lty, topObj->bbox.rbx, ! topObj->bbox.rby); } } *************** *** 1153,1156 **** --- 1177,1198 ---- if (saved_color != colorIndex) UpdatePinnedMenu(MENU_COLOR); + #ifdef _TGIF_WB2 + if (gstWBInfo.do_whiteboard) { + int saved_text_drawn=textDrawn; + + textDrawn = FALSE; + TryHandleWBInputData(); + if (justDrawnTextObj != NULL && !IsTopLevelObject(justDrawnTextObj)) { + justDrawnTextObj = NULL; + textDrawn = FALSE; + } else { + textDrawn = saved_text_drawn; + } + SetCurChoice(DRAWTEXT); + } + #endif /* _TGIF_WB2 */ + + curTextMovedAbsX = curTextMovedAbsY = 0; + return TRUE; } *************** *** 1238,1241 **** --- 1280,1285 ---- void HighLightJustDrawnText() { + if (justDrawnTextObj == NULL) return; + AddNewSelObj(justDrawnTextObj); UpdSelBBox(); *************** *** 1378,1381 **** --- 1422,1433 ---- UpdateCurTextBBoxes(TRUE); + #ifdef _TGIF_WB2 + if (gstWBInfo.do_whiteboard) { + gstWBInfo.BlockRemoteCmdDepth++; + } + #endif /* _TGIF_WB2 */ + + curTextMovedAbsX = curTextMovedAbsY = 0; + return TRUE; } *************** *** 1500,1503 **** --- 1552,1556 ---- textAbsY = textAbsBaselineY-canvasFontAsc; tmpAdjAbsX = tmpAdjAbsY = 0; + curTextMovedAbsX = curTextMovedAbsY = 0; NewCurText(); RedrawCurText(); *************** *** 1510,1513 **** --- 1563,1571 ---- CurFontMsg(FALSE, TRUE, NULL); } + #ifdef _TGIF_WB2 + if (gstWBInfo.do_whiteboard) { + gstWBInfo.BlockRemoteCmdDepth++; + } + #endif /* _TGIF_WB2 */ PrepareToReplaceAnObj(curTextObj); } *************** *** 4106,4110 **** int ReadTextLines(FP, ObjPtr, text_ptr, color_str, num_lines, has_ps_bitmap, cur_sb_font, cur_db_font, double_byte, db_mod_bytes, db_vertical, ! direction, x, baseline_y, pn_max_len, pn_max_h) FILE *FP; struct ObjRec **ObjPtr; --- 4164,4168 ---- int ReadTextLines(FP, ObjPtr, text_ptr, color_str, num_lines, has_ps_bitmap, cur_sb_font, cur_db_font, double_byte, db_mod_bytes, db_vertical, ! direction, x, baseline_y, text_w, pn_max_len, pn_max_h) FILE *FP; struct ObjRec **ObjPtr; *************** *** 4114,4117 **** --- 4172,4178 ---- int double_byte, db_mod_bytes, db_vertical, direction; int x, baseline_y, *pn_max_len, *pn_max_h; + /* + * (Note: text_w is only used for fileVersion <= 36) + */ { int len=0; *************** *** 4202,4205 **** --- 4263,4274 ---- pStrSeg->asc = canvasFontAsc; pStrSeg->des = canvasFontDes; + /* + * pStrSeg->w = text_w; + * + * Well, this doesn't really work here for PRTGIF. But since + * double-byte for version <= 36 is really not supported, + * (and the file does not contain enough information) + * this bug really cannot be fixed. + */ } FreeStrList(pStr); *************** *** 4232,4235 **** --- 4301,4305 ---- pStrSeg->asc = canvasFontAsc; pStrSeg->des = canvasFontDes; + pStrSeg->w = text_w; } memset(&rmi, 0, sizeof(RecalcMetricsInfo)); *************** *** 4912,4916 **** if (!ReadTextLines(FP, ObjPtr, text_ptr, color_str, num_lines, has_ps_bitmap, cur_sb_font, cur_db_font, double_byte, db_mod_bytes, db_vertical, ! direction, x, baseline_y, &max_len, &max_h)) { if (!PRTGIF) RestoreCurFont(); return; --- 4982,4986 ---- if (!ReadTextLines(FP, ObjPtr, text_ptr, color_str, num_lines, has_ps_bitmap, cur_sb_font, cur_db_font, double_byte, db_mod_bytes, db_vertical, ! direction, x, baseline_y, text_w, &max_len, &max_h)) { if (!PRTGIF) RestoreCurFont(); return; *************** *** 5119,5125 **** y = OFFSET_Y(AbsYc)-(textH>>1); AdjustCurText(x-textOrigX, y-textOrigY); ! textAbsX -= tmpAdjAbsX; ! textAbsY -= tmpAdjAbsY; ! textAbsBaselineY -= tmpAdjAbsY; if (editTextSize != 0) { --- 5189,5195 ---- y = OFFSET_Y(AbsYc)-(textH>>1); AdjustCurText(x-textOrigX, y-textOrigY); ! textAbsX -= (tmpAdjAbsX+curTextMovedAbsX); ! textAbsY -= (tmpAdjAbsY+curTextMovedAbsY); ! textAbsBaselineY -= (tmpAdjAbsY+curTextMovedAbsY); if (editTextSize != 0) { *************** *** 5143,5149 **** tmpAdjAbsY = (orig_text_h-ABS_SIZE(textH))/2; ! textAbsX += tmpAdjAbsX; ! textAbsY += tmpAdjAbsY; ! textAbsBaselineY += tmpAdjAbsY; SetTextCurXY(); --- 5213,5219 ---- tmpAdjAbsY = (orig_text_h-ABS_SIZE(textH))/2; ! textAbsX += (tmpAdjAbsX+curTextMovedAbsX); ! textAbsY += (tmpAdjAbsY+curTextMovedAbsY); ! textAbsBaselineY += (tmpAdjAbsY+curTextMovedAbsY); SetTextCurXY(); *************** *** 6296,6297 **** --- 6366,6488 ---- } + /* --------------------- Insert Special Routines --------------------- */ + + static + void DoMoveEditText(dx, dy) + int dx, dy; + { + struct TextRec *text_ptr=curTextObj->detail.t; + int abs_dx=ABS_SIZE(dx), abs_dy=ABS_SIZE(dy), w=0, h=0; + + curTextMovedAbsX += abs_dx; + curTextMovedAbsY += abs_dy; + + textAbsX += abs_dx; + textAbsY += abs_dy; + textAbsBaselineY += abs_dy; + + textOrigX = OFFSET_X(textAbsX); + textOrigY = OFFSET_Y(textAbsY); + textOrigBaselineY = textOrigY + text_ptr->baseline_y - curTextObj->y; + + SetTextCurXY(); + if (textHighlight) SetTextEndXY(); + + w = text_ptr->minilines.w; + h = (textOrigBaselineY - textOrigY) + + (text_ptr->minilines.h - text_ptr->minilines.first->asc); + + SetEditTextArea(w, h, text_ptr->minilines.min_lbearing, + text_ptr->minilines.max_rextra); + } + + static + void ContinueMoveEditText(OrigX, OrigY) + int OrigX, OrigY; + { + int done=FALSE, abort=FALSE, dx=0, dy=0; + int saved_x=OrigX, saved_y=OrigY; + XEvent input, ev; + struct BBRec bbox; + + GetCurTextBBoxes(NULL, &bbox); + InflateBBox(&bbox, -2, -2, &bbox); + + if (!debugNoPointerGrab) { + XGrabPointer(mainDisplay, drawWindow, FALSE, + PointerMotionMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, None, moveCursor, CurrentTime); + } + while (!done) { + XNextEvent(mainDisplay, &input); + + if (input.type == Expose || input.type == VisibilityNotify) { + ExposeEventHandler(&input, TRUE); + } else if (input.type == ButtonRelease) { + XUngrabPointer(mainDisplay, CurrentTime); + SelBox(drawWindow, revDefaultGC, bbox.ltx+dx, bbox.lty+dy, + bbox.rbx+dx, bbox.rby+dy); + done = TRUE; + } else if (input.type == MotionNotify) { + int cur_x=input.xmotion.x, cur_y=input.xmotion.y; + + if (cur_x != saved_x || cur_y != saved_y) { + SelBox(drawWindow, revDefaultGC, bbox.ltx+dx, bbox.lty+dy, + bbox.rbx+dx, bbox.rby+dy); + saved_x = cur_x; + saved_y = cur_y; + dx = saved_x-OrigX; + dy = saved_y-OrigY; + SelBox(drawWindow, revDefaultGC, bbox.ltx+dx, bbox.lty+dy, + bbox.rbx+dx, bbox.rby+dy); + } + while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; + } else if (input.type == KeyPress) { + KeySym key_sym; + char s[80]; + int has_ch; + + has_ch = XLookupString(&(input.xkey), s, sizeof(s), &key_sym, &c_stat); + TranslateKeys(s, &key_sym); + if (CharIsESC(&(input.xkey), s, key_sym, &has_ch)) { + XUngrabPointer(mainDisplay, CurrentTime); + SelBox(drawWindow, revDefaultGC, bbox.ltx+dx, bbox.lty+dy, + bbox.rbx+dx, bbox.rby+dy); + abort = TRUE; + done = TRUE; + } + } + } + SelBox(drawWindow, revDefaultGC, bbox.ltx, bbox.lty, bbox.rbx, bbox.rby); + if (debugNoPointerGrab) XSync(mainDisplay, False); + + if (!abort && OrigX != saved_x && OrigY != saved_y) { + int abs_dx=ABS_SIZE(dx), abs_dy=ABS_SIZE(dy); + struct BBRec new_bbox; + + bbox.ltx = ABS_X(bbox.ltx); bbox.lty = ABS_Y(bbox.lty); + bbox.rbx = ABS_X(bbox.rbx); bbox.rby = ABS_Y(bbox.rby); + SetBBRec(&new_bbox, bbox.ltx+abs_dx, bbox.lty+abs_dy, bbox.rbx+abs_dx, + bbox.rby+abs_dy); + + DoMoveEditText(dx, dy); + + RedrawAreas(botObj, bbox.ltx-GRID_ABS_SIZE(2), bbox.lty-GRID_ABS_SIZE(2), + bbox.rbx+GRID_ABS_SIZE(2), bbox.rby+GRID_ABS_SIZE(2), + new_bbox.ltx-GRID_ABS_SIZE(2), new_bbox.lty-GRID_ABS_SIZE(2), + new_bbox.rbx+GRID_ABS_SIZE(2), new_bbox.rby+GRID_ABS_SIZE(2)); + RedrawCurText(); + } + } + + void MoveEditText(input) + XEvent *input; + { + int mouse_x=input->xbutton.x, mouse_y=input->xbutton.y; + struct BBRec bbox; + + GetCurTextBBoxes(NULL, &bbox); + if (PointInBBox(mouse_x, mouse_y, bbox)) { + ContinueMoveEditText(mouse_x, mouse_y); + } + } *** tgif_dbg.c.orig Wed May 19 10:27:50 1999 --- tgif_dbg.c Wed May 19 10:27:50 1999 *************** *** 366,370 **** } fprintf(gpTraceFile, "p: %6d 0x%08x %d\n", ! gnCreatePixmapCount, (unsigned int)pixmap, width*height*depth); } return pixmap; --- 366,370 ---- } fprintf(gpTraceFile, "p: %6d 0x%08x %d\n", ! gnCreatePixmapCount, (unsigned int)pixmap, width*height*(depth>>3)); } return pixmap; *** wb.c.orig Wed May 19 10:27:51 1999 --- wb.c Wed May 19 10:27:51 1999 *************** *** 44,47 **** --- 44,48 ---- #include "auxtext.e" #include "drawing.e" + #include "choice.e" #include "cmd.e" #include "dialog.e" *************** *** 50,55 **** --- 51,58 ---- #include "http.e" #include "mark.e" + #include "menu.e" #include "msg.e" #include "obj.e" + #include "page.e" #include "remote.e" #include "select.e" *************** *** 67,70 **** --- 70,76 ---- int cmdLineWhiteBoardListenOnly=FALSE; + static int recordCmdLogicalClock=0; + static char recordCmdSenderProcID[MAXSTRING]; + #ifdef _TGIF_WB2 static struct sigaction act_IO; *************** *** 113,117 **** void CleanUpWBCmds() { ! struct CmdRec *cmd_ptr; int num_records=0; --- 119,123 ---- void CleanUpWBCmds() { ! struct CmdRec *cmd_ptr=NULL; int num_records=0; *************** *** 120,124 **** } if (num_records > 0) { ! struct CmdRec *prev_cmd; double inc=(100.0/((double)num_records)), percent_start=0.0; --- 126,130 ---- } if (num_records > 0) { ! struct CmdRec *prev_cmd=NULL; double inc=(100.0/((double)num_records)), percent_start=0.0; *************** *** 135,139 **** } gstWBInfo.first_cmd = gstWBInfo.last_cmd = gstWBInfo.cur_cmd = NULL; ! gstWBInfo.first_stopped_cmd = NULL; } --- 141,145 ---- } gstWBInfo.first_cmd = gstWBInfo.last_cmd = gstWBInfo.cur_cmd = NULL; ! gstWBInfo.first_blocked_cmd = NULL; } *************** *** 142,146 **** --- 148,154 ---- int CreateWBListenSocket() { + #ifdef NOT_DEFINED struct sockaddr_in server; + #endif /* NOT_DEFINED */ gstWBInfo.listening = TRUE; *************** *** 182,185 **** --- 190,194 ---- #ifdef NOT_DEFINED + static int AcceptWBSocket() { *************** *** 217,220 **** --- 226,294 ---- #endif /* NOT_DEFINED */ + void PrintFullIDsOfObjects(psz_prefix) + char *psz_prefix; + { + #ifdef _TGIF_DBG_WB2 + if (wb2DebugLevel > 0) { + struct ObjRec *obj_ptr=NULL; + int stacking_order=0; + + if (psz_prefix != NULL) { + if (strcmp(psz_prefix, "\t") == 0) { + fprintf(stderr, "\tin PrintFullIDsOfObjects():\n"); + } else { + fprintf(stderr, "%s, in PrintFullIDsOfObjects():\n", psz_prefix); + } + } else { + fprintf(stderr, "In PrintFullIDsOfObjects():\n"); + } + for (obj_ptr=topObj; obj_ptr != NULL; obj_ptr=obj_ptr->next, + stacking_order++) { + char buf[MAXSTRING], obj_type[MAXSTRING]; + + if (obj_ptr->creator_full_id == NULL) { + sprintf(buf, "(NULL)%1d/%s", obj_ptr->id, gszLocalPID); + } else { + strcpy(buf, obj_ptr->creator_full_id); + } + switch (obj_ptr->type) { + case OBJ_POLY: strcpy(obj_type, "p"); break; + case OBJ_BOX: strcpy(obj_type, "b"); break; + case OBJ_OVAL: strcpy(obj_type, "o"); break; + case OBJ_TEXT: + strcpy(obj_type, "t"); + { + MiniLinesInfo *minilines=(&obj_ptr->detail.t->minilines); + char *psz=minilines->first->first_block->seg->dyn_str.s; + char buf1[MAXSTRING]; + int len=strlen(psz); + + if (len > 5) { + char saved_ch=psz[5]; + + sprintf(buf1, " - \"%s...\"", psz); + psz[5] = saved_ch; + } else { + sprintf(buf1, " - \"%s\"", psz); + } + strcat(buf, buf1); + } + break; + case OBJ_POLYGON: strcpy(obj_type, "g"); break; + case OBJ_ARC: strcpy(obj_type, "a"); break; + case OBJ_RCBOX: strcpy(obj_type, "rcb"); break; + case OBJ_XBM: strcpy(obj_type, "xbm"); break; + case OBJ_XPM: strcpy(obj_type, "xpm"); break; + case OBJ_GROUP: + case OBJ_ICON: + case OBJ_SYM: + case OBJ_PIN: strcpy(obj_type, "r"); break; + } + fprintf(stderr, "\t%d/%s:\t%s\n", stacking_order, obj_type, buf); + } + } + #endif /* _TGIF_DBG_WB2 */ + } + int WBHasReadData(pn_flag, pn_retry) int *pn_flag, *pn_retry; *************** *** 237,241 **** /* leave *pn_retry alone */ ! return (buff_items(gstWBInfo.bd_commands) > 0); } --- 311,316 ---- /* leave *pn_retry alone */ ! return (gstWBInfo.BlockRemoteCmdDepth <= 1 && ! buff_items(gstWBInfo.bd_commands) > 0); } *************** *** 277,280 **** --- 352,396 ---- } + static + void ProcessWBInputData(buf) + char *buf; + /* + * Here the WB input data is in the HTTP data format. + * So we use HttpExtractText() to convert the data into + * something that can be handled by ProcessRemoteCmd(). + * In the future, if the WB input data is binary, this is + * where the conversion takes place. + */ + { + char *psz_content=NULL, *psz_content_type=NULL; + int content_sz=0; + + psz_content = HttpExtractText(buf, &content_sz, NULL, &psz_content_type); + if (psz_content != NULL) { + ProcessRemoteCmd(psz_content, content_sz); + FreeRemoteBuf(psz_content); + } + if (psz_content_type != NULL) UtilFree(psz_content_type); + FreeRemoteBuf(buf); + } + + void TryHandleWBInputData() + { + int flag=0, retry=TRUE; + + while (retry && WBHasReadData(&flag, &retry)) { + char *buf=NULL; + int buf_sz=0; + + deserializingFile = TRUE; + + if (RecvWBData(flag, &buf, &buf_sz)) { + ProcessWBInputData(buf); + FreeRemoteBuf(buf); + } + deserializingFile = FALSE; + } + } + int SendWBData(pszWBData) char *pszWBData; *************** *** 314,318 **** #ifdef _TGIF_DBG_WB2 ! fprintf(stderr, "SendWBData(), pid = %ld\n", (long)getpid()); #endif /* _TGIF_DBG_WB2 */ --- 430,434 ---- #ifdef _TGIF_DBG_WB2 ! fprintf(stderr, "SendWBData(), pid = %ld\n", gstWBInfo.pid); #endif /* _TGIF_DBG_WB2 */ *************** *** 348,363 **** return FALSE; } else if (CmdType == CMD_MOVE) { ! if (fprintf(FP, "cmd(%1d,%1d,%1d,%1d,%1d).\n", ! CmdType, SubCmdPtr->detail.mv->dx, SubCmdPtr->detail.mv->dy, ! recordCmdIncludeTgifObj, recordCmdUsesNewColormap) == EOF) { writeFileFailed = TRUE; } } else { ! if (fprintf(FP, "cmd(%1d,%1d,%1d).\n", ! CmdType, recordCmdIncludeTgifObj, ! recordCmdUsesNewColormap) == EOF) { writeFileFailed = TRUE; } } if (botSelBeforeInCmd != NULL) { if (fprintf(FP, "before_image(%1d,[\n", stackingCount) == EOF) { --- 464,484 ---- return FALSE; } else if (CmdType == CMD_MOVE) { ! if (fprintf(FP, "cmd(%1d,%1d,%1d,", CmdType, ! SubCmdPtr->detail.mv->dx, SubCmdPtr->detail.mv->dy) == EOF) { writeFileFailed = TRUE; } } else { ! if (fprintf(FP, "cmd(%1d,", CmdType) == EOF) { writeFileFailed = TRUE; } } + if (fprintf(FP, "%1d,%1d,%1d,\"%s\").\n", + recordCmdIncludeTgifObj, recordCmdUsesNewColormap, + gstWBInfo.logical_clock, gszLocalPID) == EOF) { + writeFileFailed = TRUE; + } + /* Lamport's Algorithm increments logical_clock */ + gstWBInfo.logical_clock++; + if (botSelBeforeInCmd != NULL) { if (fprintf(FP, "before_image(%1d,[\n", stackingCount) == EOF) { *************** *** 369,376 **** char buf[MAXSTRING]; ! if (obj_ptr->creator_full_id == NULL) { ! sprintf(buf, "%1d\t%s", obj_ptr->id, gszLocalPID); } else { ! strcpy(buf, obj_ptr->creator_full_id); } if (fprintf(FP, "\t\"") == EOF) writeFileFailed = TRUE; --- 490,501 ---- char buf[MAXSTRING]; ! if (stackingPositionHasIds) { ! sprintf(buf, "%s", ((char**)stackingPosition)[count]); } else { ! if (obj_ptr->creator_full_id == NULL) { ! sprintf(buf, "%1d/%s", obj_ptr->id, gszLocalPID); ! } else { ! strcpy(buf, obj_ptr->creator_full_id); ! } } if (fprintf(FP, "\t\"") == EOF) writeFileFailed = TRUE; *************** *** 388,393 **** int *stacking_pos=NULL, stacking_count=0; ! sel_ptr = PrepareStackingInfo(TopSel, BotSel, NumObjs, &stacking_pos, ! &stacking_count); if (sel_ptr == NULL && stacking_count == NumObjs) { if (fprintf(FP, "after_positions(%1d,[\n", NumObjs) == EOF) { --- 513,518 ---- int *stacking_pos=NULL, stacking_count=0; ! sel_ptr = PrepareStackingInfo(TopSel, BotSel, NumObjs, FALSE, ! &stacking_pos, &stacking_count, NULL); if (sel_ptr == NULL && stacking_count == NumObjs) { if (fprintf(FP, "after_positions(%1d,[\n", NumObjs) == EOF) { *************** *** 429,434 **** } ! char *SerializeCmd(CmdType, SubCmdPtr, TopSel, BotSel, NumObjs) ! int CmdType, NumObjs; struct SubCmdRec *SubCmdPtr; struct SelRec *TopSel, *BotSel; --- 554,578 ---- } ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! static ! void DebugDumpCmd(psz_prefix, cmd_type, logical_clock, psz_process_id) ! char *psz_prefix, *psz_process_id; ! int cmd_type, logical_clock; ! { ! if (psz_prefix == NULL) { ! fprintf(stderr, "cmd(%1d,%1d,\"%s\")\n", cmd_type, logical_clock, ! psz_process_id); ! } else { ! fprintf(stderr, "%s, cmd(%1d,%1d,\"%s\")\n", psz_prefix, cmd_type, ! logical_clock, psz_process_id); ! } ! } ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! ! char *SerializeCmd(CmdType, SubCmdPtr, TopSel, BotSel, NumObjs, ! pnAssignedLogicalClock) ! int CmdType, NumObjs, *pnAssignedLogicalClock; struct SubCmdRec *SubCmdPtr; struct SelRec *TopSel, *BotSel; *************** *** 444,447 **** --- 588,593 ---- return NULL; } + *pnAssignedLogicalClock = gstWBInfo.logical_clock; + rewind(gstWBInfo.send_fp); writeFileFailed = FALSE; *************** *** 468,472 **** content_sz = (int)ftell(gstWBInfo.send_fp); /* ! * From: \t\r\n * Content-Type: application/x-tgif-cmd\r\n * Content-Length: \r\n --- 614,618 ---- content_sz = (int)ftell(gstWBInfo.send_fp); /* ! * From: :\r\n * Content-Type: application/x-tgif-cmd\r\n * Content-Length: \r\n *************** *** 497,505 **** if (wb2DebugLevel == 0) { fprintf(stderr, "Sending %1d bytes, pid = %ld!\n", ! header_sz+content_sz+2, (long)getpid()); } else { fprintf(stderr, "%s\nSending %1d bytes, pid = %ld!\n", buf, ! header_sz+content_sz+2, (long)getpid()); } #endif /* _TGIF_DBG_WB2 */ #endif /* _TGIF_WB2 */ --- 643,654 ---- if (wb2DebugLevel == 0) { fprintf(stderr, "Sending %1d bytes, pid = %ld!\n", ! header_sz+content_sz+2, gstWBInfo.pid); } else { fprintf(stderr, "%s\nSending %1d bytes, pid = %ld!\n", buf, ! header_sz+content_sz+2, gstWBInfo.pid); } + DebugDumpCmd(">>> In SerializeCmd()", + CmdType, *pnAssignedLogicalClock, gszLocalPID); + PrintFullIDsOfObjects("In SerializeCmd()"); #endif /* _TGIF_DBG_WB2 */ #endif /* _TGIF_WB2 */ *************** *** 514,522 **** } - #define GETCMDVALUE(val,name) ScanValue("%d", &(val), name, "cmd") - #define GETBIMGVALUE(val,name) ScanValue("%d", &(val), name, "before_image") - #define GETPOSVALUE(val,name) ScanValue("%d", &(val), name, "after_positions") - #define GETAIMGVALUE(val,name) ScanValue("%d", &(val), name, "after_image") - static struct CmdRec gstDeserializeCmd; --- 663,666 ---- *************** *** 573,581 **** char *Inbuf; { ! char *c_ptr; c_ptr = FindChar((int)'(', Inbuf); ! InitScan(c_ptr, "\t\n, "); ! if (GETCMDVALUE(gstDeserializeCmd.type, "cmd_type") == INVALID) { return FALSE; } --- 717,725 ---- char *Inbuf; { ! char *c_ptr=NULL; c_ptr = FindChar((int)'(', Inbuf); ! InitScan(c_ptr, "\t\n, ()"); ! if (GETINT("cmd", gstDeserializeCmd.type, "cmd_type") == INVALID) { return FALSE; } *************** *** 585,597 **** return FALSE; } else if (gstDeserializeCmd.type == CMD_MOVE) { ! if (GETCMDVALUE(gstDeserializeCmd.dx, "dx") == INVALID || ! GETCMDVALUE(gstDeserializeCmd.dy, "dy") == INVALID) { return FALSE; } } ! if (GETCMDVALUE(recordCmdIncludeTgifObj, "include_tgif_obj") == INVALID || ! GETCMDVALUE(recordCmdUsesNewColormap, "use_new_colormap") == INVALID) { return FALSE; } return TRUE; } --- 729,745 ---- return FALSE; } else if (gstDeserializeCmd.type == CMD_MOVE) { ! if (GETINT("cmd", gstDeserializeCmd.dx, "dx") == INVALID || ! GETINT("cmd", gstDeserializeCmd.dy, "dy") == INVALID) { return FALSE; } } ! *recordCmdSenderProcID = '\0'; ! if (GETINT("cmd", recordCmdIncludeTgifObj, "include_tgif_obj") == INVALID || ! GETINT("cmd", recordCmdUsesNewColormap, "use_new_colormap") == INVALID || ! GETINT("cmd", recordCmdLogicalClock, "logical_clock") == INVALID || ! GETSTR("cmd", recordCmdSenderProcID, "sender_process_id") == INVALID) { return FALSE; } + UtilRemoveQuotes(recordCmdSenderProcID); return TRUE; } *************** *** 606,610 **** c_ptr = FindChar((int)'(', Inbuf); InitScan(c_ptr, "\t\n, "); ! if (GETBIMGVALUE(gnBeforeImageCount, "before_image_count") == INVALID) { return FALSE; } --- 754,759 ---- c_ptr = FindChar((int)'(', Inbuf); InitScan(c_ptr, "\t\n, "); ! if (GETINT("before_image", gnBeforeImageCount, "before_image_count") == ! INVALID) { return FALSE; } *************** *** 659,663 **** c_ptr = FindChar((int)'(', Inbuf); InitScan(c_ptr, "\t\n, "); ! if (GETPOSVALUE(gnAfterPositionsCount, "after_positions_count") == INVALID) { return FALSE; } --- 808,813 ---- c_ptr = FindChar((int)'(', Inbuf); InitScan(c_ptr, "\t\n, "); ! if (GETINT("after_positions", gnAfterPositionsCount, ! "after_positions_count") == INVALID) { return FALSE; } *************** *** 682,686 **** } InitScan(line, "\t\n, "); ! if (GETPOSVALUE(pos, "after_positions_pos") == INVALID) { ok = FALSE; free(line); --- 832,836 ---- } InitScan(line, "\t\n, "); ! if (GETINT("after_positions", pos, "after_positions_pos") == INVALID) { ok = FALSE; free(line); *************** *** 710,714 **** c_ptr = FindChar((int)'(', Inbuf); InitScan(c_ptr, "\t\n, "); ! if (GETAIMGVALUE(count_expected, "after_image_count") == INVALID) { return FALSE; } --- 860,864 ---- c_ptr = FindChar((int)'(', Inbuf); InitScan(c_ptr, "\t\n, "); ! if (GETINT("after_image", count_expected, "after_image_count") == INVALID) { return FALSE; } *************** *** 744,761 **** for (obj_ptr=bot_obj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { - struct SelRec *sel_ptr; - obj_ptr->tmp_parent = NULL; ! sel_ptr = (struct SelRec *)malloc(sizeof(struct SelRec)); ! if (sel_ptr == NULL) FailAllocMessage(); ! sel_ptr->next = topSel; ! sel_ptr->obj = obj_ptr; ! sel_ptr->prev = NULL; ! if (topSel == NULL) { ! botSel = sel_ptr; ! } else { ! topSel->prev = sel_ptr; ! } ! topSel = sel_ptr; } UpdSelBBox(); --- 894,899 ---- for (obj_ptr=bot_obj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { obj_ptr->tmp_parent = NULL; ! AddObjIntoSel(obj_ptr, NULL, topSel, &topSel, &botSel); } UpdSelBBox(); *************** *** 774,781 **** sprintf(gszMsgBox, "Cannot open '%s'.\n\n%s pid=%ld.", gstWBInfo.listen_fname, "Deserialization aborted for", ! (long)getpid()); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); return NULL; } rewind(gstWBInfo.listen_fp); writeFileFailed = FALSE; --- 912,934 ---- sprintf(gszMsgBox, "Cannot open '%s'.\n\n%s pid=%ld.", gstWBInfo.listen_fname, "Deserialization aborted for", ! gstWBInfo.pid); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); return NULL; } + #ifdef _TGIF_WB2 + #ifdef _TGIF_DBG_WB2 + if (wb2DebugLevel == 0) { + fprintf(stderr, "Received %1d bytes, pid = %ld, timestamp = %1d/%s\n", + strlen(pszBuffer), gstWBInfo.pid, recordCmdLogicalClock, + recordCmdSenderProcID); + } else { + fprintf(stderr, "%s\nReceived %1d bytes, pid = %ld, timestamp = %1d/%s\n", + pszBuffer, strlen(pszBuffer), gstWBInfo.pid, recordCmdLogicalClock, + recordCmdSenderProcID); + } + PrintFullIDsOfObjects("In the beginning of DeserializeCmd()"); + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ + rewind(gstWBInfo.listen_fp); writeFileFailed = FALSE; *************** *** 823,826 **** --- 976,997 ---- MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); ok = FALSE; + } else { + #ifdef _TGIF_WB2 + #ifdef _TGIF_DBG_WB2 + fprintf(stderr, "%s, pid = %ld, timestamp = %1d/%s\n", + "Command successfully parsed", gstWBInfo.pid, recordCmdLogicalClock, + recordCmdSenderProcID); + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ + if (recordCmdLogicalClock+1 > gstWBInfo.logical_clock) { + /* Lamport's Algorithm set logical_clock */ + gstWBInfo.logical_clock = recordCmdLogicalClock+1; + #ifdef _TGIF_WB2 + #ifdef _TGIF_DBG_WB2 + fprintf(stderr, "Logical clock for pid = %ld set to %1d.\n", + gstWBInfo.pid, gstWBInfo.logical_clock); + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ + } } if (!ok) { *************** *** 843,847 **** cmd_ptr->pos_before = (int*)gppszBeforeImage; cmd_ptr->count_before = gnBeforeImageCount; - cmd_ptr->actual_pos_before = NULL; cmd_ptr->type = gstDeserializeCmd.type; cmd_ptr->undone = TRUE; --- 1014,1017 ---- *************** *** 848,851 **** --- 1018,1033 ---- cmd_ptr->include_tgif_obj = recordCmdIncludeTgifObj; cmd_ptr->new_colormap = recordCmdUsesNewColormap; + #ifdef _TGIF_WB2 + cmd_ptr->logical_clock = recordCmdLogicalClock; + if (*recordCmdSenderProcID != '\0') { + cmd_ptr->sender_process_id = UtilStrDup(recordCmdSenderProcID); + if (cmd_ptr->sender_process_id == NULL) FailAllocMessage(); + } + cmd_ptr->first_redo_after_deserialize = TRUE; + #ifdef _TGIF_DBG_WB2 + DebugDumpCmd("<<< In DeserializeCmd()", cmd_ptr->type, + cmd_ptr->logical_clock, cmd_ptr->sender_process_id); + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ cmd_ptr->dx = gstDeserializeCmd.dx; cmd_ptr->dy = gstDeserializeCmd.dy; *************** *** 870,876 **** --- 1052,1213 ---- DeserializationCleanUp(); + #ifdef _TGIF_WB2 + #ifdef _TGIF_DBG_WB2 + PrintFullIDsOfObjects("At the end of DeserializeCmd()"); + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ + return cmd_ptr; } + #ifdef NOT_DEFINED + static + int CmdOriginatedFromSelf(cmd_ptr) + struct CmdRec *cmd_ptr; + { + return (strcmp(cmd_ptr->sender_process_id, gszLocalPID) == 0); + } + #endif /* NOT_DEFINED */ + + static + int TotalOrderForTwo(older_cmd, newer_cmd) + struct CmdRec *older_cmd, *newer_cmd; + /* + * Note: If logical clocks and host names are the same, and if pid in + * older_cmd is less than pid in newer_cmd, will return TRUE! + */ + { + int comparison=0; + + if (older_cmd == NULL || newer_cmd == NULL) return TRUE; + + if (older_cmd->logical_clock > newer_cmd->logical_clock) { + return FALSE; + } else if (older_cmd->logical_clock < newer_cmd->logical_clock) { + return TRUE; + } + comparison = strcmp(older_cmd->sender_process_id, + newer_cmd->sender_process_id); + TgAssert(comparison != 0, + "Identical logical clock detected in TotalOrderForTwo()", NULL); + return (comparison < 0); + } + + #ifdef _TGIF_WB2 + #ifdef _TGIF_DBG_WB2 + static + void DumpCmdStack(prefix_string) + char *prefix_string; + /* Dump the command stack, last one first */ + { + struct CmdRec *cmd_ptr=NULL; + + if (prefix_string != NULL) fprintf(stderr, "%s\n", prefix_string); + for (cmd_ptr=gstWBInfo.last_cmd; cmd_ptr != NULL; cmd_ptr=cmd_ptr->prev) { + char buf[80]; + + sprintf(buf, "\tcmd_ptr->next = 0x%08lx", (long)cmd_ptr->next); + DebugDumpCmd(buf, cmd_ptr->type, cmd_ptr->logical_clock, + cmd_ptr->sender_process_id); + } + } + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ + + void FindCmdInsertionPoint(cmd_to_insert, pp_immed_right_cmd, + pn_cur_cmd_should_block) + struct CmdRec *cmd_to_insert, **pp_immed_right_cmd; + int *pn_cur_cmd_should_block; + /* + * On return, cmd_to_insert is to be inserted immediately to the left + * of *pp_immed_right_cmd. + * On return, *pn_cur_cmd_should_block is TRUE means that there's no + * need to execute this command because it's beyond the first + * blocked command. + */ + { + struct CmdRec *cmd_ptr=NULL; + + if (gstWBInfo.first_blocked_cmd == NULL) { + #ifdef _TGIF_WB2 + #ifdef _TGIF_DBG_WB2 + DumpCmdStack("In FindCmdInsertionPoint() for first_blocked_cmd == NULL"); + #endif /* _TGIF_DBG_WB2 */ + #endif /* _TGIF_WB2 */ + if (pn_cur_cmd_should_block != NULL) *pn_cur_cmd_should_block = FALSE; + for (cmd_ptr=gstWBInfo.last_cmd; cmd_ptr != NULL; cmd_ptr=cmd_ptr->prev) { + if (TotalOrderForTwo(cmd_ptr, cmd_to_insert)) { + *pp_immed_right_cmd = cmd_ptr->next; + return; + } + } + *pp_immed_right_cmd = gstWBInfo.first_cmd; + } else { + if (pn_cur_cmd_should_block != NULL) *pn_cur_cmd_should_block = TRUE; + for (cmd_ptr=gstWBInfo.last_cmd; cmd_ptr != NULL; cmd_ptr=cmd_ptr->prev) { + if (TotalOrderForTwo(cmd_ptr, cmd_to_insert)) { + *pp_immed_right_cmd = cmd_ptr->next; + return; + } + if (cmd_ptr == gstWBInfo.first_blocked_cmd) { + if (pn_cur_cmd_should_block != NULL) { + *pn_cur_cmd_should_block = FALSE; + } + } + } + *pp_immed_right_cmd = gstWBInfo.first_cmd; + } + } + + static + void HighLightExistingObjects() + /* + * If select object no longer exists, don't select and highlight it! + */ + { + int something_deleted=FALSE; + struct SelRec *sel_ptr=NULL, *next_sel=NULL; + + for (sel_ptr=topSel; sel_ptr != NULL; sel_ptr=next_sel) { + next_sel = sel_ptr->next; + if (!IsTopLevelObject(sel_ptr->obj)) { + UnlinkSel(sel_ptr, &topSel, &botSel); + free(sel_ptr); + something_deleted = TRUE; + } + } + if (something_deleted) UpdSelBBox(); + HighLightForward(); + } + + void CleanUpObsoletedWBCmds(stopped_cmd_ptr) + struct CmdRec *stopped_cmd_ptr; + { + struct CmdRec *cmd_ptr=NULL; + int num_records=0; + + for (cmd_ptr=stopped_cmd_ptr->prev; cmd_ptr != NULL; cmd_ptr=cmd_ptr->prev) { + num_records++; + } + if (num_records > 0) { + struct CmdRec *prev_cmd=NULL; + double inc=(100.0/((double)num_records)), percent_start=0.0; + + ShowInterrupt(1); + SaveStatusStrings(); + for (cmd_ptr=stopped_cmd_ptr->prev; cmd_ptr != NULL; cmd_ptr=prev_cmd, + percent_start+=inc) { + prev_cmd = cmd_ptr->prev; + DeleteARedoRecord(cmd_ptr, percent_start, + min(((double)percent_start+inc),((double)100.0))); + } + RestoreStatusStrings(); + HideInterrupt(); + } + gstWBInfo.first_cmd = stopped_cmd_ptr; + gstWBInfo.first_cmd->prev = NULL; + gstWBInfo.first_blocked_cmd = NULL; + } + void ProcessRemoteCmd(psz_buf, buf_sz) char *psz_buf; *************** *** 878,881 **** --- 1215,1219 ---- { struct SelRec *saved_top_sel=topSel, *saved_bot_sel=botSel; + struct CmdRec *cmd_ptr=NULL; int highlighted_before=FALSE; *************** *** 888,930 **** if (gstWBInfo.cur_cmd != NULL) { ! int beyond_first_stopped_cmd=FALSE; /* ! * Should look at the timestamp of this message and decides where ! * to insert it. At this time, it's always appended. ! * If the insertion point is after first_stopped_cmd, ! * beyond_first_stopped_cmd should be set to TRUE. */ ! InsertCmd(gstWBInfo.last_cmd, NULL, gstWBInfo.cur_cmd, ! &gstWBInfo.first_cmd, &gstWBInfo.last_cmd); ! gstWBInfo.cur_cmd = gstWBInfo.last_cmd; ! if (!beyond_first_stopped_cmd) { /* ! * If this command is inserted beyond the command pointed to by ! * first_stopped_cmd, it should not even be attempted for ! * execution. */ ! gstWBInfo.first_redo_after_deserialize = TRUE; ! if (RedoACmd(gstWBInfo.cur_cmd, FALSE)) { /* ! * Success! */ ! gstWBInfo.first_redo_after_deserialize = FALSE; ! if (topSel != NULL) RemoveAllSel(); ! UndoACmd(gstWBInfo.cur_cmd, FALSE); ! if (topSel != NULL) RemoveAllSel(); ! RedoACmd(gstWBInfo.cur_cmd, FALSE); ! } else { /* ! * For some reason, can't do it! */ ! gstWBInfo.first_redo_after_deserialize = FALSE; ! /* ! * We should use first_stopped_cmd to point to ! * gstWBInfo.cur_cmd here! ! */ } ! if (topSel != NULL) RemoveAllSel(); } } --- 1226,1376 ---- if (gstWBInfo.cur_cmd != NULL) { ! struct CmdRec *immed_right_cmd=NULL; ! int cur_cmd_should_block=FALSE; ! int cur_cmd_is_wb_clearall=(gstWBInfo.cur_cmd->type == CMD_WB_CLEARALL); /* ! * FindCmdInsertionPoint() examine the logical clock of the new command ! * and decides where to insert it. ! * If the insertion point is beyond first_blocked_cmd, ! * cur_cmd_should_block will be set to TRUE. */ ! FindCmdInsertionPoint(gstWBInfo.cur_cmd, &immed_right_cmd, ! &cur_cmd_should_block); ! if (immed_right_cmd == NULL) { ! /* append */ ! InsertCmd(gstWBInfo.last_cmd, NULL, gstWBInfo.cur_cmd, ! &gstWBInfo.first_cmd, &gstWBInfo.last_cmd); ! } else { ! /* insert */ ! InsertCmd(immed_right_cmd->prev, immed_right_cmd, gstWBInfo.cur_cmd, ! &gstWBInfo.first_cmd, &gstWBInfo.last_cmd); ! } ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! DumpCmdStack("After FindCmdInsertionPoint()"); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! if (cur_cmd_should_block) { /* ! * The command is inserted beyond the command pointed to by ! * first_blocked_cmd, it is not even be attempted for execution. */ ! } else { ! if (gstWBInfo.first_blocked_cmd != NULL) { /* ! * Undo all the commands to the right of gstWBInfo.cur_cmd and to ! * the left of gstWBInfo.first_blocked_cmd. */ ! for (cmd_ptr=gstWBInfo.first_blocked_cmd->prev; cmd_ptr != NULL; ! cmd_ptr=cmd_ptr->prev) { ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! sprintf(gszMsgBox, "%s %s", ! "*** Just before UndoACmd() for", ! "gstWBInfo.first_blocked_cmd != NULL"); ! DebugDumpCmd(gszMsgBox, cmd_ptr->type, cmd_ptr->logical_clock, ! cmd_ptr->sender_process_id); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! UndoACmd(cmd_ptr, FALSE); ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! sprintf(gszMsgBox, "%s %s", ! "&&& Just after UndoACmd() for", ! "gstWBInfo.first_blocked_cmd != NULL"); ! DebugDumpCmd(gszMsgBox, cmd_ptr->type, cmd_ptr->logical_clock, ! cmd_ptr->sender_process_id); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! if (topSel != NULL) RemoveAllSel(); ! if (cmd_ptr == immed_right_cmd) { ! break; ! } ! } ! } else if (immed_right_cmd != NULL) { /* ! * Undo all the commands to the right of gstWBInfo.cur_cmd. */ ! for (cmd_ptr=gstWBInfo.last_cmd; cmd_ptr != gstWBInfo.cur_cmd && ! cmd_ptr->type != CMD_WB_CLEARALL; cmd_ptr=cmd_ptr->prev) { ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! strcpy(gszMsgBox, ! "*** Just before UndoACmd() for immed_right_cmd != NULL"); ! DebugDumpCmd(gszMsgBox, cmd_ptr->type, cmd_ptr->logical_clock, ! cmd_ptr->sender_process_id); ! PrintFullIDsOfObjects("\t"); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! UndoACmd(cmd_ptr, FALSE); ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! DebugDumpCmd("*** After UndoACmd()", ! cmd_ptr->type, cmd_ptr->logical_clock, ! cmd_ptr->sender_process_id); ! PrintFullIDsOfObjects("\t"); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! if (topSel != NULL) RemoveAllSel(); ! } ! if (cmd_ptr != gstWBInfo.cur_cmd) { ! gstWBInfo.cur_cmd = cmd_ptr; ! } } ! /* ! * Redo all the commands starting from gstWBInfo.cur_cmd. ! */ ! gstWBInfo.first_blocked_cmd = NULL; ! if (gstWBInfo.cur_cmd->type == CMD_WB_CLEARALL) { ! CleanUpObsoletedWBCmds(gstWBInfo.cur_cmd); ! if (cur_cmd_is_wb_clearall) { ! CleanUpDrawingWindow(); ! ClearFileInfo(TRUE); ! ClearAndRedrawDrawWindow(); ! CheckFileAttrsInLoad(); ! Msg("WhiteBoard cleared by peer."); ! RedrawTitleWindow(); ! DelAllPages(); ! lastPageNum = 1; ! InitPage(); ! ShowPage(); ! } ! } ! for (cmd_ptr=gstWBInfo.cur_cmd; cmd_ptr != NULL; ! cmd_ptr=cmd_ptr->next) { ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! DebugDumpCmd("--- Just before RedoACmd()", ! cmd_ptr->type, cmd_ptr->logical_clock, ! cmd_ptr->sender_process_id); ! PrintFullIDsOfObjects("\t"); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! if (!RedoACmd(cmd_ptr, FALSE)) { ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! fprintf(stderr, "%s, pid = %ld\n", ! "RedoACmd() failed in ProcessRemoteCmd()", gstWBInfo.pid); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! gstWBInfo.first_blocked_cmd = gstWBInfo.cur_cmd; ! } ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! DebugDumpCmd("=== Just after RedoACmd()", ! cmd_ptr->type, cmd_ptr->logical_clock, ! cmd_ptr->sender_process_id); ! PrintFullIDsOfObjects("\t"); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ ! if (topSel != NULL) RemoveAllSel(); ! } ! #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! PrintFullIDsOfObjects("At end of ProcessRemoteCmd()"); ! #endif /* _TGIF_DBG_WB2 */ ! #endif /* _TGIF_WB2 */ } } *************** *** 932,936 **** botSel = saved_bot_sel; UpdSelBBox(); ! if (highlighted_before) HighLightForward(); } --- 1378,1384 ---- botSel = saved_bot_sel; UpdSelBBox(); ! if (highlighted_before) { ! HighLightExistingObjects(); ! } } *************** *** 945,958 **** { struct WbMessage cmd_received; ! char buf[WB_PACK], aux[WB_PACK], *psz_content=NULL, *psz_content_type=NULL; ! char h_from[100], h_pid[100], h_ip[100], id[300], *WbData=NULL; ! int content_sz=0; #ifdef _TGIF_DBG_WB2 ! fprintf(stderr, "IO_SignalHandler(), pid = %ld\n", (long)getpid()); #endif /* _TGIF_DBG_WB2 */ - deserializingFile = TRUE; - WbData = (char*)malloc(sizeof(struct WbMessage)); --- 1393,1403 ---- { struct WbMessage cmd_received; ! char buf[WB_PACK], aux[WB_PACK]; ! char id[300], *WbData=NULL; #ifdef _TGIF_DBG_WB2 ! fprintf(stderr, "IO_SignalHandler(), pid = %ld\n", gstWBInfo.pid); #endif /* _TGIF_DBG_WB2 */ WbData = (char*)malloc(sizeof(struct WbMessage)); *************** *** 959,963 **** if (PCM_recv(gstWBInfo.MCastSock, WbData, sizeof(struct WbMessage), 0) < 0) { free(WbData) ; - deserializingFile = FALSE; return ; } --- 1404,1407 ---- *************** *** 968,985 **** * (pode ser feito de outra maneira?) */ ! sscanf(buf, "%s %s\t%s\r\n", h_from, h_pid, h_ip); ! sprintf(id, "%s\t%s", h_pid, h_ip); ! printf("Id = %s\n",id); if(strcmp(id, gszLocalPID) == 0) { free(WbData); - deserializingFile = FALSE; return; } /* Verifica se pode processar o comando agora, ou se deve armazenar */ ! if(!gstWBInfo.CanProcessRemoteCmd) { strcpy(aux, buf); buff_ins(gstWBInfo.bd_commands, aux); free(WbData); - deserializingFile = FALSE; return; } --- 1412,1434 ---- * (pode ser feito de outra maneira?) */ ! if (strncmp(buf, "From: ", 6) != 0 || sscanf(&buf[6], "%s\r\n", id) != 1) { ! fprintf(stderr, "%s. %s, pid = %ld\n", ! "Fatal error", "Cannot find the sender id in IO_SignalHandler()", ! gstWBInfo.pid); ! free(WbData); ! return; ! } ! #ifdef _TGIF_DBG_WB2 ! fprintf(stderr, "Id = %s\n", id); ! #endif /* _TGIF_DBG_WB2 */ if(strcmp(id, gszLocalPID) == 0) { free(WbData); return; } /* Verifica se pode processar o comando agora, ou se deve armazenar */ ! if(gstWBInfo.BlockRemoteCmdDepth > 0) { strcpy(aux, buf); buff_ins(gstWBInfo.bd_commands, aux); free(WbData); return; } *************** *** 987,1001 **** localNrCmd = cmd_received.NSeq + 1; } ! if ((psz_content=HttpExtractText(buf, &content_sz, NULL, ! &psz_content_type)) != NULL) { ! ProcessRemoteCmd(psz_content, content_sz); ! FreeRemoteBuf(psz_content); ! } ! if (psz_content_type != NULL) { ! UtilFree(psz_content_type); ! } FreeRemoteBuf(buf); free(WbData); - deserializingFile = FALSE; return; } --- 1436,1443 ---- localNrCmd = cmd_received.NSeq + 1; } ! ProcessWBInputData(buf); FreeRemoteBuf(buf); + free(WbData); return; } *************** *** 1017,1023 **** --- 1459,1469 ---- #endif /* _TGIF_WB2 */ + InitLocalPID(); /* initializes gszLocalPID */ + memset(&gstWBInfo, 0, sizeof(struct WhiteBoardRec)); gstWBInfo.port = 8009; + gstWBInfo.BlockRemoteCmdDepth = 1; + gstWBInfo.pid = (long)getpid(); #ifdef _TGIF_WB2 *************** *** 1042,1049 **** exit(-1); } ! } ! /* fim do trecho */ - if (gstWBInfo.do_whiteboard) { sprintf(gstWBInfo.send_fname, "%sTgifSXXXXXX", TMP_DIR); mktemp(gstWBInfo.send_fname); --- 1488,1493 ---- exit(-1); } ! /* fim do trecho */ sprintf(gstWBInfo.send_fname, "%sTgifSXXXXXX", TMP_DIR); mktemp(gstWBInfo.send_fname); *** wb1.c.orig Wed May 19 10:27:53 1999 --- wb1.c Wed May 19 10:27:53 1999 *************** *** 2,3 **** --- 2,5 ---- * Author: Renato Santana, in January, 1996. * + * (Obsoleted in tgif-4.1.9 by the TangramII group at land.ufrj.br.) + * *************** *** 11,1586 **** #ifdef _TGIF_WB - #include "arc.e" - #include "box.e" - #include "choice.e" - #include "cmd.e" - #include "color.e" - #include "dialog.e" - #include "drawing.e" - #include "file.e" - #include "group.e" - #include "move.e" - #include "msg.e" - #include "obj.e" - #include "oval.e" - #include "page.e" - #include "rcbox.e" - #include "select.e" - #include "setup.e" - #include "tcp.e" #include "wb1.e" - #include "wb2.e" - #include "wb3.e" - #define CUR_VERSION 31 - - struct ObjRec *obj_ptr_aux=NULL; - - int Cmd_Flag_Arrived=(-1); - int sock=(-1); - int ClientServer=0; - int NumAck=(-1); - int NumArrObj=(-1); - - /* prototypes definitions */ - void WhiteBoard ARGS_DECL((void)); - void CheckConForRecord ARGS_DECL((int,struct SubCmdRec*,struct SelRec*,int,struct SelRec*)); - int CheckConForUndo ARGS_DECL((struct CmdRec*)); - void CheckConForRedo ARGS_DECL((void)); - void SendCmdMov ARGS_DECL((void)); - int CheckClientServer ARGS_DECL((void)); - int CountObj ARGS_DECL((struct SelRec*)); - void ClearClient ARGS_DECL((void)); - void CloseCon ARGS_DECL((void)); - void CmdReceived ARGS_DECL((char*)); - void CmdNewRec ARGS_DECL((int,char*)); - void CmdDelRec ARGS_DECL((char*)); - void CmdMovRec ARGS_DECL((int,int,int,char*)); - void CmdRepRec ARGS_DECL((int,char*)); - void CmdMTORec ARGS_DECL((int,char*)); - void CmdOTMRec ARGS_DECL((int,char*)); - void CmdMovRec ARGS_DECL((int,int,int,char*)); - int CmdRepAObj ARGS_DECL((struct ObjRec*,struct ObjRec*)); - void CmdStrRec ARGS_DECL((int,char*)); - void CmdUndoRec ARGS_DECL((void)); - void CmdRedoRec ARGS_DECL((void)); - void StretchAllSelObjects ARGS_DECL((int)); - int FindObjRec ARGS_DECL((struct ObjRec*,struct ObjRec**)); - int ReadObjFromBuff ARGS_DECL((char*,struct ObjRec**)); - void ReadObjAttrsFromBuff ARGS_DECL((int,char*,struct ObjRec**)); - void AddObjFromBuffer ARGS_DECL((struct ObjRec*,struct ObjRec*,struct ObjRec*)); - void RecordObjToBuffer ARGS_DECL((struct ObjRec*,char*)); - void SendCmd ARGS_DECL((int,struct SubCmdRec*,struct SelRec*,int,struct SelRec*)); - void WaitForAck ARGS_DECL((int,struct SubCmdRec*,struct SelRec*,struct SelRec*,int)); - void SendAlreadyDone ARGS_DECL((void)); - void ErrorOnConsist ARGS_DECL((void)); - void NackFromClient ARGS_DECL((void)); - - /* prototypes defined */ - - void WhiteBoard() - { - int sockstr , length=0, port, rc; - char host_port[50], b[100], host[50], *pport; - struct sockaddr_in server; - struct hostent *hp, *gethostbyname(); - u_long aux_addr; - - if (ClientServer != 0) /* there is a already a connection */ - { - sprintf(b, "There is a connection already opened (socket #%d).\nDo you want to close it and start a new one? [ync]",sock ); - switch (MsgBox(b, TOOL_NAME, YNC_MB)) - { - case MB_ID_YES: strcpy(b, "24####"); - write(sock, b, sizeof(b)); - close(sock); - ClientServer=0; - sprintf(b, "The connection has been closed!"); - sprintf(b, "%s \nSave your work and start a NEW connection",b); - MsgBox(b, TOOL_NAME, INFO_MB); - } - return; - } - - host_port[0]='\0'; - Dialog ("Please, enter host: (host:port)","( : Cancel )",host_port); - - if ( (host_port[0] == '\0') && (ClientServer != 0)) { - return; - } - XSync(mainDisplay, False); - - pport = ParseStr(host_port, (int)':', host, sizeof(host_port)); - port = atoi(pport); - - if (port == 0) { - MsgBox("Invalid port number", TOOL_NAME, INFO_MB); - return; - } - - if (sock >= 0) close(sock); - sock = 0; - ClientServer = 0; /* 0 -> no connection 1-> Client 2-> Server */ - - rc = TcpDoConnect(host, port, &sock); - - if (rc == TG_REMOTE_STATUS_OK) { - Msg("Host connected"); - ClientServer = 1; /* I'm client */ - NewProc(); /*clearing all canvas.Client will receive it from server*/ - Msg (" I'M CLIENT "); - fileVersion = CUR_VERSION; - /*SendAlreadyDone(); this is only for server*/ - return; - } else { - Msg("Error connecting host"); - } - - #ifdef NOT_DEFINED - sock = socket(AF_INET, SOCK_STREAM, 0); - if (sock < 0) { - MsgBox("Error opening the Socket.", TOOL_NAME, INFO_MB); - return; - } - server.sin_family = AF_INET; - if (*host >= '0' && *host <= '9') { - aux_addr = inet_addr(host); - hp = gethostbyaddr((char *)&aux_addr,4,AF_INET); - } else { - hp = gethostbyname(host); - } - if (hp == 0) { - Msg ("Host Unknown"); - close(sock); - return; - } - memcpy( (char *)hp->h_addr, (char *)&server.sin_addr, hp->h_length); - server.sin_port=htons(port); - - if (connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) { - Msg("Error connecting host"); - } else { - Msg("Host connected"); - ClientServer = 1; /* I'm client */ - NewProc(); /*clearing all canvas.Client will receive it from server*/ - Msg (" I'M CLIENT "); - fileVersion = CUR_VERSION; - /*SendAlreadyDone(); this is only for server*/ - return; - } - #endif /* NOT_DEFINED */ - - Msg ("Host not connected "); - close(sock); - sockstr = socket(AF_INET, SOCK_STREAM, 0); - if (sockstr < 0) - { - Dialog ("Error opening the Socket.","( : Cancel )",b); - return; - } - - server.sin_family = AF_INET; - server.sin_port=htons(port); - server.sin_addr.s_addr = INADDR_ANY; - - if (bind(sockstr, (struct sockaddr *)&server, sizeof(server)) < 0) - { - Dialog (" Bind Error ","( : Cancel )",b); - close(sockstr); - return; - } - - if (getsockname(sockstr, (struct sockaddr *)&server,&length)< 0) - { - Dialog ("Error on getsockname","( : Cancel )",b); - close(sockstr); - return; - } - - sprintf(b, "Socket port #%d ready,\nokay to go to the listening mode? [ync](y)",ntohs(server.sin_port) ); - switch (MsgBox(b, TOOL_NAME, YNC_MB)) - { - case MB_ID_YES: Msg("Waiting for connection"); break; - case MB_ID_NO: return; - case MB_ID_CANCEL: return; - } - XSync(mainDisplay, False); - - listen(sockstr, 1); - sock = accept(sockstr, (struct sockaddr *)0, (int *)0); - if (sock == -1) - { - Dialog ("Error on accepting socket","( : Cancel )",b); - close(sock); - return; - } - - ClientServer = 2; /* I'm server */ - Msg ("connection OK: I'M SERVER "); - fileVersion = CUR_VERSION; - SendAlreadyDone(); - } - - - void CheckConForRecord(CmdType, SubCmdPtr, TopSel, NumObjs, TopSelBefore) - int CmdType, NumObjs; - struct SelRec * TopSel, *TopSelBefore; - struct SubCmdRec * SubCmdPtr; - { - char b[80]; - - if (ClientServer == 2) /* connection is on and I'm server*/ - { - if (Cmd_Flag_Arrived > 0) /* command came from client */ - { - NumAck++; - if (NumAck == NumArrObj) - { - NumAck = 0; - strcpy(b, "20####"); - if (write(sock, b, sizeof(b)) < 0) /* sending ACK */ - { - sprintf(b, "There is a problem writing to the socket"); - sprintf(b, "%s #%d.\nStart again the connection!", b, sock); - MsgBox(b, TOOL_NAME, INFO_MB); - return; - } - Cmd_Flag_Arrived = -1; /* should send command to other clients*/ - } - } - else - { - SendCmd (CmdType, SubCmdPtr, TopSel, NumObjs, TopSelBefore); - Cmd_Flag_Arrived = -1; - } - } - else if (ClientServer == 1) /* connection is on and I'm Client*/ - { - if (Cmd_Flag_Arrived > 0) /* command came from server */ - { - Cmd_Flag_Arrived = -1; /* should not send it back*/ - } - else - { - SendCmd (CmdType, SubCmdPtr, TopSel, NumObjs, TopSelBefore); - Cmd_Flag_Arrived = -1; /* should not send it back*/ - } - } - - } - - - int CheckConForUndo(cmd_ptr) - struct CmdRec * cmd_ptr; - { - char b[80]; - int NumObjs, status; - struct SubCmdRec * SubCmdAux = NULL; - struct CmdRec * cmd_aux; - - status = TRUE; - strcpy(b, "Undo not Implemented yet!"); - - if (ClientServer == 1) /* I'm client */ - { - - if ( (cmd_ptr->type == CMD_STRETCH) || - (cmd_ptr->type == CMD_ONE_TO_MANY) || - (cmd_ptr->type == CMD_MANY_TO_ONE) || - (cmd_ptr->type == CMD_GOTO_PAGE) ) - { - Msg (b); - return(FALSE); - } - - strcpy(b, "30####"); - - if (write(sock, b, sizeof(b)) < 0) /* sending UNDO to the server */ - { - sprintf(b, "There is a problem writing to the socket #%d.",sock); - sprintf(b, "%s\nStart again the connection!",b); - MsgBox(b, TOOL_NAME, INFO_MB); - status = FALSE; - } - } - else /* I'm server and should send (to the client) command to be undone */ - { - if (cmd_ptr == NULL) return(FALSE); - switch (cmd_ptr->type) - { - case CMD_COMPOSITE: - for (cmd_aux=cmd_ptr->last; cmd_aux!=NULL; cmd_aux=cmd_aux->prev) - CheckConForUndo(cmd_aux); - break; - case CMD_NEW: SendCmd(CMD_DELETE, NULL, NULL,0, - cmd_ptr->top_after); break; - case CMD_DELETE: SendCmd(CMD_NEW, NULL, cmd_ptr->top_before, - CountObj(cmd_ptr->top_before),NULL); break; - case CMD_MOVE: SendCmdMov(); break; - case CMD_STRETCH: Msg (b); status = FALSE; break; - case CMD_REPLACE: SendCmd(CMD_REPLACE, NULL, cmd_ptr->top_before, - CountObj(cmd_ptr->top_before), topSel); break; - /* this above only works when the server starts the undo, if the - server has another object selected and client undo's changes to another - object, it DOES NOT work !! - Why it doesn't work as below */ - /* case CMD_REPLACE: SendCmd(CMD_REPLACE, NULL, cmd_ptr->top_before, - CountObj(cmd_ptr->top_before), cmd_ptr->top_after); break;*/ - case CMD_ONE_TO_MANY: Msg (b); status = FALSE; break; - case CMD_MANY_TO_ONE: Msg (b); status = FALSE; break; - case CMD_GOTO_PAGE: Msg (b); status = FALSE; break; - } - } - return(status); - - } - - void CheckConForRedo() - { - char b[80]; - int NumObjs; - - if (ClientServer == 1) - { - strcpy(b, "30####"); - - if (write(sock, b, sizeof(b)) < 0) /* sending UNDO to the server */ - { - sprintf(b, "3There is a problem writing to the socket #%d.",sock); - sprintf(b, "%s\nStart again the connection!",b); - MsgBox(b, TOOL_NAME, INFO_MB); - return; - } - } - else /* I'm server and should send command to be undone to the client */ - { - if (curCmd == NULL) return; - switch (curCmd->type) - { - case CMD_COMPOSITE: break; - case CMD_NEW: SendCmd(CMD_DELETE, NULL, NULL,0, - curCmd->top_after); break; - case CMD_DELETE: SendCmd(CMD_NEW, NULL, curCmd->top_before, - CountObj(curCmd->top_before),NULL); break; - case CMD_MOVE: SendCmdMov(); break; - /* - case CMD_STRETCH: UndoOrRedoReplaceCmd (CmdPtr, TRUE); break; - case CMD_REPLACE: UndoOrRedoReplaceCmd (CmdPtr, HighLight); break; - case CMD_ONE_TO_MANY: UndoOrRedoOneToManyCmd (CmdPtr); break; - case CMD_MANY_TO_ONE: UndoOrRedoOneToManyCmd (CmdPtr); break; - case CMD_GOTO_PAGE: UndoOrRedoGotoPageCmd (CmdPtr); break; - */ - } - } - - } - - void SendCmdMov() - { - - struct MoveSubCmdRec * move_cmd; - struct SubCmdRec * sub_cmd; - - - move_cmd = (struct MoveSubCmdRec *) malloc (sizeof(struct MoveSubCmdRec)); - if (move_cmd == NULL) FailAllocMessage(); - memset(move_cmd, 0, sizeof(struct MoveSubCmdRec)); - sub_cmd = (struct SubCmdRec *) malloc (sizeof(struct SubCmdRec)); - if (sub_cmd == NULL) FailAllocMessage(); - memset(sub_cmd, 0, sizeof(struct SubCmdRec)); - sub_cmd->detail.mv = move_cmd; - - sub_cmd->detail.mv->dx = -(curCmd->dx); - sub_cmd->detail.mv->dy = -(curCmd->dy); - SendCmd(CMD_MOVE, sub_cmd, topSel, CountObj(topSel) , NULL); - - } - - - int CountObj(SelPtr) - struct SelRec * SelPtr; - { - int i; - - for (i=0 ; SelPtr != NULL ; SelPtr = SelPtr->next) - i++; - return(i); - - } - - - int CheckClientServer() - { - char buff[20000]; - - if (ClientServer == 0) /* no connection */ - { - return(FALSE); - } - - fcntl(sock,F_SETFL,O_NONBLOCK); - - memset(buff, 0, sizeof(buff)); - Cmd_Flag_Arrived = -1; - if (read(sock, buff, sizeof(buff) ) > 0) - { - if ((int)strlen(buff) > 0) - { - CmdReceived(buff); - return(TRUE); - } - else - { - return(FALSE); - } - } - return(FALSE); - } - - - void CmdReceived(buff) - char * buff; - { - int CmdTypeRec,num_obj,dx,dy; - char aux[10000], aux2[10000]; - register struct ObjRec * obj_ptr, * obj_ptr_aux, * obj_ptr_aux2; - register struct SelRec * topSelRec; - register struct SelRec * botSelRec; - - /* - * Added by Bill. This indicates the FILE* passed to the read/write - * functions of OBJ files should be actually (not implemented yet) as char*. - */ - bufferAsFileForWhiteBoard = TRUE; - - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - CmdTypeRec = atoi (aux); - Cmd_Flag_Arrived = CmdTypeRec; - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - num_obj = atoi (aux); - - NumAck = 0; - NumArrObj = num_obj; - if (CmdTypeRec == CMD_MOVE) - { - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - dx = atoi (aux); - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - dy = atoi (aux); - } - else - { - buff = buff + 2; - } - - switch (CmdTypeRec) - { - case CMD_COMPOSITE: break; - case CMD_NEW: CmdNewRec(num_obj, buff); break; - case CMD_DELETE: CmdDelRec(buff); break; - case CMD_MOVE: CmdMovRec(num_obj,dx,dy,buff); break; - case CMD_STRETCH: CmdStrRec(num_obj, buff); break; - case CMD_ONE_TO_MANY: CmdOTMRec(num_obj, buff); break; - case CMD_MANY_TO_ONE: CmdMTORec(num_obj, buff); break; - case CMD_REPLACE: CmdRepRec(num_obj, buff); break; - case CMD_GOTO_PAGE: CmdRepRec(num_obj, buff); break; - case 20: break; /* ACK Server->client*/ - case 21: ErrorOnConsist(); break; /* NACK Server->Client*/ - case 22: NackFromClient(); break; /* NACK Client->Server*/ - case 23: ClearClient(); break; /* Server -> Client */ - case 24: CloseCon(); /* both close_con requ.*/ - case 30: CmdUndoRec(); break; /* UNDO Client->Server*/ - /*case 31: RedoCmd(); break; REDO Client->Server*/ - } - /* - * Added by Bill. This indicates the FILE* passed to the read/write - * functions of OBJ files should be actually (not implemented yet) as char*. - */ - bufferAsFileForWhiteBoard = FALSE; - } - - - void CmdNewRec(num_obj, buff) - int num_obj; - char * buff; - { - struct ObjRec * obj_ptr; - char aux[20000]; - int i; - - for (i=1 ; i <= num_obj ; i++) - { - Cmd_Flag_Arrived = 1; - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - ReadObjFromBuff(aux, &obj_ptr); - numRedrawBBox = 0; - obj_ptr->tmp_parent = NULL; - DrawObj (drawWindow, obj_ptr); - AddObj (NULL, topObj, obj_ptr); - RecordNewObjCmd (); - SetFileModified (TRUE); - } - } - - - void CmdDelRec(buff) /* delete arrived objects */ - char * buff; - { - struct ObjRec * obj_ptr; - struct ObjRec * obj_ptr_aux; - struct SelRec * topSelBefRec; - char aux[10000]; - - topSelBefRec = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (topSelBefRec == NULL) FailAllocMessage(); - memset(topSelBefRec, 0, sizeof(struct SelRec)); - - buff += 1; - for (; ((int)strlen(buff)) > 2 ;) - { - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - ReadObjFromBuff(aux, &obj_ptr); - /*FindObjRec(obj_ptr,&obj_ptr_aux);*/ - if((FindObjRec(obj_ptr,&obj_ptr_aux)) == FALSE) return; - topSelBefRec->next = NULL; - topSelBefRec->obj = obj_ptr_aux; - topSelBefRec->prev = NULL; - PrepareToRecord (CMD_DELETE, topSelBefRec, topSelBefRec, 1); - DelObj(obj_ptr_aux); - Cmd_Flag_Arrived = 2; - RecordCmd (CMD_DELETE, NULL, NULL, NULL, 0); - RedrawAnArea (botObj, obj_ptr->obbox.ltx-GRID_ABS_SIZE(1), - obj_ptr->obbox.lty-GRID_ABS_SIZE(1), - obj_ptr->obbox.rbx+GRID_ABS_SIZE(1), - obj_ptr->obbox.rby+GRID_ABS_SIZE(1)); - } - - } - - void CmdMovRec(num_obj,dx,dy,buff) - int num_obj, dx, dy; - char * buff; - { - - int i; - char aux[10000]; - struct ObjRec * obj_ptr; - struct ObjRec * obj_ptr_aux; - struct SelRec * topSelRec; - struct SelRec * botSelRec; - struct MoveSubCmdRec * move_cmd; - struct SubCmdRec * sub_cmd; - - move_cmd=(struct MoveSubCmdRec *)malloc(sizeof(struct MoveSubCmdRec)); - if (move_cmd == NULL) FailAllocMessage(); - sub_cmd = (struct SubCmdRec *)malloc(sizeof(struct SubCmdRec)); - if (sub_cmd == NULL) FailAllocMessage(); - sub_cmd->detail.mv = move_cmd; - move_cmd->dx = dx; - move_cmd->dy = dy; - - - for (i=1 ; i <= num_obj; i++) - { - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - ReadObjFromBuff(aux, &obj_ptr); - if (obj_ptr != NULL) - { - obj_ptr->obbox.ltx -= dx; obj_ptr->obbox.lty -= dy; - obj_ptr->obbox.rbx -= dx; obj_ptr->obbox.rby -= dy; - obj_ptr->x -= dx; obj_ptr->y -= dy; - } - /*FindObjRec(obj_ptr,&obj_ptr_aux); */ - if( (FindObjRec(obj_ptr,&obj_ptr_aux)) == FALSE) - { - return; - } - topSelRec = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (topSelRec == NULL) FailAllocMessage(); - memset(topSelRec, 0, sizeof(struct SelRec)); - topSelRec->obj = obj_ptr_aux; - topSelRec->next = NULL; - topSelRec->prev = NULL; - botSelRec = topSelRec; - - MoveObj(obj_ptr_aux, dx, dy); - PrepareToRecord (CMD_MOVE, topSelRec, botSelRec, 1); - Cmd_Flag_Arrived = 3; - RecordCmd (CMD_MOVE, sub_cmd, NULL, NULL, 0); /* numobj ta' 1 */ - RedrawAreas (botObj, obj_ptr->obbox.ltx-GRID_ABS_SIZE(3), - obj_ptr->obbox.lty-GRID_ABS_SIZE(3), - obj_ptr->obbox.rbx+GRID_ABS_SIZE(3), - obj_ptr->obbox.rby+GRID_ABS_SIZE(3), - obj_ptr->obbox.ltx+dx-GRID_ABS_SIZE(3), - obj_ptr->obbox.lty+dy-GRID_ABS_SIZE(3), - obj_ptr->obbox.rbx+dx+GRID_ABS_SIZE(3), - obj_ptr->obbox.rby+dy+GRID_ABS_SIZE(3)); - } - } - - void CmdRepRec (num_obj, buff) - int num_obj; - char * buff; - { - struct ObjRec * obj_ptr_from; - struct ObjRec * obj_ptr_to; - char buff_to[10000], buff_from[10000]; - char * s, aux[10000]; - int i; - - - buff_to[0] = '\0'; buff_from[0] = '\0'; - s = buff; - for (i=1; i <= num_obj ; i++) - { - s = FindChar ((int)'#', s); - } - strcpy(aux, s); - s = aux; - - for (i=1; i <= num_obj ; i++) - { - - buff = ParseStr (buff,(int) '#', buff_to, strlen(buff)); - ReadObjFromBuff(buff_to, &obj_ptr_to); - s = ParseStr (s,(int) '#', buff_from, strlen(s)); - ReadObjFromBuff(buff_from, &obj_ptr_from); - - - if( (CmdRepAObj (obj_ptr_from, obj_ptr_to)) == FALSE) return; - - } - } - - int CmdRepAObj (obj_ptr_from, obj_ptr_to) - struct ObjRec * obj_ptr_from; - struct ObjRec * obj_ptr_to; - { - struct ObjRec * obj_ptr_aux; - struct SelRec * sel_ptr_rec, * sel_ptr_bef; - - if( (FindObjRec(obj_ptr_from,&obj_ptr_aux)) == FALSE) return(FALSE); - - StartCompositeCmd (); - sel_ptr_bef = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (sel_ptr_bef == NULL) FailAllocMessage(); - memset(sel_ptr_bef, 0, sizeof(struct SelRec)); - sel_ptr_bef->next = sel_ptr_bef->prev = NULL; - sel_ptr_bef->obj = obj_ptr_aux; - PrepareToRecord (CMD_REPLACE, sel_ptr_bef, sel_ptr_bef, 1); - free(sel_ptr_bef); - obj_ptr_from->next = obj_ptr_aux->next; - obj_ptr_from->prev = obj_ptr_aux->prev; - CopyObj(obj_ptr_to, obj_ptr_aux); /* from this -> to this*/ - - sel_ptr_rec = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (sel_ptr_rec == NULL) FailAllocMessage(); - memset(sel_ptr_rec, 0, sizeof(struct SelRec)); - sel_ptr_rec->next = sel_ptr_rec->prev = NULL; - - obj_ptr_aux->next = obj_ptr_from->next; - obj_ptr_aux->prev = obj_ptr_from->prev; - - sel_ptr_rec->obj = obj_ptr_aux; - - Cmd_Flag_Arrived = 4; - RecordCmd (CMD_REPLACE, NULL, sel_ptr_rec, sel_ptr_rec, 1); - free(sel_ptr_rec); - EndCompositeCmd (); - - if (obj_ptr_aux->type == 0) /* this still to be solved! */ - MoveObj(obj_ptr_aux, 0, 0); - RedrawAreas(botObj, obj_ptr_from->obbox.ltx-GRID_ABS_SIZE(1), - obj_ptr_from->obbox.lty-GRID_ABS_SIZE(1), - obj_ptr_from->obbox.rbx+GRID_ABS_SIZE(1), - obj_ptr_from->obbox.rby+GRID_ABS_SIZE(1), - obj_ptr_to->obbox.ltx-GRID_ABS_SIZE(1), - obj_ptr_to->obbox.lty-GRID_ABS_SIZE(1), - obj_ptr_to->obbox.rbx+GRID_ABS_SIZE(1), - obj_ptr_to->obbox.rby+GRID_ABS_SIZE(1)); - return TRUE; - } - - void CmdStrRec (num_obj, buff) - int num_obj; - char * buff; - { - register struct ObjRec * obj_ptr_aux; - register struct ObjRec * obj_ptr_from; - register struct ObjRec * obj_ptr_to; - register struct SelRec * topSelRec; - register struct SelRec * botSelRec; - struct AttrRec * attr_ptr; - - int i; - char aux1[10000], aux2[10000]; - - - for (i=1 ; i <= num_obj ; i++) - { - buff = ParseStr (buff,(int) '#', aux1, strlen(buff)); - buff = ParseStr (buff,(int) '#', aux2, strlen(buff)); - strcat (aux1, "#"); - strcat (aux2, "#"); - strcat (aux1, aux2); - CmdRepRec (num_obj,aux1); /* this is not wright !! */ - } - - } - - /******** objects should be streched and not replaced... - but, for now, it's working until I finish it... - - ReadObjFromBuff(buff_to, &obj_ptr_to); - ReadObjFromBuff(buff_from, &obj_ptr_from); - FindObjRec(obj_ptr_from,&obj_ptr_aux); - saved_ltx = obj_ptr_aux->obbox.ltx; saved_lty = obj_ptr_aux->obbox.lty; - saved_rbx = obj_ptr_aux->obbox.rbx; saved_rby = obj_ptr_aux->obbox.rby; - topSelRec = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (topSelRec == NULL) FailAllocMessage(); - memset(topSelRec, 0, sizeof(struct SelRec)); - topSelRec->obj = obj_ptr_aux; - topSelRec->next = NULL; - topSelRec->prev = NULL; - botSelRec = topSelRec; - PrepareToRecord (CMD_STRETCH, topSelRec, botSelRec,1);*/ /*numObjSelected);*/ - /* attr_ptr=obj_ptr_aux->fattr; - */ - - - /* 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; - - - PrepareToRecord (CMD_STRETCH, topSel, botSel, numObjSelected); - StretchAllSelObjects (Corner); - - void StretchAllSelObjects (Corner) - int Corner; - { - 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, FALSE); - - { - struct AttrRec * attr_ptr=ObjPtr->fattr; - - if (AutoCenterAttr) - { - for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) - if (attr_ptr->shown) - CenterObjInOBBox (attr_ptr->obj, ObjPtr->obbox, NULL); - else - StretchObj (attr_ptr->obj, Corner, InsideIcon); - } - else - for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next) - StretchObj (attr_ptr->obj, Corner, InsideIcon); - } - - - - - if (numObjLocked != 0) Msg ("Locked objects are not stretched."); - } - - RecordCmd (CMD_STRETCH, NULL, topSel, botSel, numObjSelected); - UpdSelBBox (); - 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), - selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), - selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); - - here is the end of strech command - not implemented yet ***********/ - - - void CmdMTORec(num_obj, buff) - int num_obj; - char * buff; - { - int i,numObjSelectedSaved; - char aux[10000]; - struct ObjRec * obj_ptr; - struct SelRec * topSelAux, * topSelSaved; - - Cmd_Flag_Arrived = 6; - topSelSaved = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (topSelSaved == NULL) FailAllocMessage(); - memset(topSelSaved, 0, sizeof(struct SelRec)); - topSelSaved = topSel; /* saving topSel */ - topSel = NULL; - numObjSelectedSaved = numObjSelected; - numObjSelected = num_obj; - - /* *buff++; */ - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - - for (i=0 ; i < num_obj ; i++) - { - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - ReadObjFromBuff(aux, &obj_ptr); - if((FindObjRec(obj_ptr,&obj_ptr_aux)) == FALSE) return; - topSelAux = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (topSelAux == NULL) FailAllocMessage(); - memset(topSelAux, 0, sizeof(struct SelRec)); - topSelAux->obj = obj_ptr_aux; - topSelAux->prev = NULL; - topSelAux->next = NULL; - - if (topSel == NULL) - { - topSel = topSelAux; - botSel = topSel; - } - else - { - topSel->prev = topSelAux; - topSelAux->next = topSel; - topSel = topSelAux; - } - } - - - GroupSelObj(); - /* topSel = topSelSaved; - numObjSelected = numObjSelectedSaved; - */ - - /* RedrawAnArea (botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), - selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); - */ - - } - - 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; - } - - void CmdOTMRec(num_obj, buff) - int num_obj; - char * buff; - - { - /* GroupSelObj() no select.c */ - /* o problema e' a variavel topSel que nao pode ser alterada! */ - /* talvez seja melhor duplicar pro wb3.c */ - int i; - struct ObjRec * obj_ptr; - struct ObjRec * obj_ptr_aux; - struct SelRec * topSelBefRec, * botSelBefRec, * topSelAux, * sel_ptr; - char aux[10000]; - - topSelBefRec = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (topSelBefRec == NULL) FailAllocMessage(); - memset(topSelBefRec, 0, sizeof(struct SelRec)); - - topSelBefRec->next = NULL; - topSelBefRec->prev = NULL; - - Cmd_Flag_Arrived = 6; - - /* criando o TopSelBefRec para poder dar group nele! */ - /* os objetos estao do bottom ao top! */ - - *buff++; - for (i=0 ; i < num_obj ; i++) - { - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - ReadObjFromBuff(aux, &obj_ptr); - if((FindObjRec(obj_ptr,&obj_ptr_aux)) == FALSE) return; - topSelAux = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (topSelAux == NULL) FailAllocMessage(); - memset(topSelAux, 0, sizeof(struct SelRec)); - topSelAux->obj = obj_ptr_aux; - topSelAux->prev = NULL; - - if (topSelBefRec->obj == NULL) - { - topSelBefRec->obj = obj_ptr_aux; - botSelBefRec = topSelBefRec; - } - else - { - topSelBefRec->prev = topSelAux; - topSelAux->next = topSelBefRec; - topSelBefRec = topSelAux; - } - } - - tmpTopObj = tmpBotObj = NULL; - - PrepareToRecord (CMD_REPLACE, topSelBefRec, botSelBefRec, num_obj); - - for (sel_ptr = botSelBefRec; sel_ptr != NULL; sel_ptr = sel_ptr->prev) - { - UnlinkObj (sel_ptr->obj); - PushTmpObj (sel_ptr->obj); - } - - CreateGroupObj (tmpTopObj, tmpBotObj); - - /* RemoveAllSel (); */ - /* while (topSelBefRec != NULL) - { - sel_ptr = topSelBefRec->next; - free(topSelBefRec); - topSelBefRec = sel_ptr; - } - botSelBefRec = NULL; - */ - - /* topSel = botSel = (struct SelRec *) malloc (sizeof(struct SelRec)); - if (topSel == NULL) FailAllocMessage(); - memset(topSel, 0, sizeof(struct SelRec)); - topSel->obj = topObj; - topSel->next = topSel->prev = NULL; - UpdSelBBox (); - */ - - RecordCmd (CMD_MANY_TO_ONE, NULL, topSelBefRec, botSelBefRec, 1); - - - /* dar free nao top e bot selbefrec */ - - /* RedrawAnArea (botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), - selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); - */ - - } - - void CmdUndoRec() - { - int saved_curChoice; - - saved_curChoice = curChoice; - UndoCmd(); - Cmd_Flag_Arrived = -1; - SetCurChoice (saved_curChoice); - - } - - void CmdRedoRec() - { - int saved_curChoice; - - saved_curChoice = curChoice; - UndoCmd(); - Cmd_Flag_Arrived = -1; - SetCurChoice (saved_curChoice); - - } - - - int FindObjRec(obj_ptr,obj_ptr_aux) - struct ObjRec * obj_ptr; - struct ObjRec * * obj_ptr_aux; - { - int found = 0; - register struct ObjRec * obj_aux; - - if (obj_ptr == NULL) - { - (*obj_ptr_aux) = NULL; - ErrorOnConsist(); - return(FALSE); - } - - for (obj_aux = topObj; obj_aux != NULL; obj_aux = obj_aux->next) - { - if (obj_ptr->type == obj_aux->type) - { - if ((obj_ptr->obbox.ltx == obj_aux->obbox.ltx) && - (obj_ptr->obbox.lty == obj_aux->obbox.lty)) - { - if ((obj_ptr->obbox.rbx == obj_aux->obbox.rbx) && - (obj_ptr->obbox.rby == obj_aux->obbox.rby)) - { - found=1; - break; - } - } - } - } - - if (found == 1) - { - (*obj_ptr_aux) = obj_aux; - } - else - { - (*obj_ptr_aux) = NULL; - ErrorOnConsist(); - return(FALSE); - } - return(TRUE); - - } - - int ReadObjFromBuff (buff, ObjPtr) - char * buff; - struct ObjRec * * ObjPtr; - { - - char obj_name[20], * buffattr, buffaux[10000]; - int allocated; - - strcpy(buffaux, buff); - ParseStr (buff,(int) '(', obj_name, strlen(buff)); - buffattr = FindChar ((int)'[', buffaux); - buffattr++; - - while (buffattr[0] == '\t') /* a waste for text */ - { - strcpy(buffaux, buffattr); - buffattr = FindChar ((int)'[', buffaux); - buffattr++; - } - - if (strcmp (obj_name, "poly") == 0) - { - ReadPoly (buff, ObjPtr); - if (*ObjPtr == NULL) return (FALSE); - ReadObjAttrsFromBuff (INVALID, buffattr, 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); - if (allocated) free(buff); - return (TRUE); - } - if (strcmp (obj_name, "box") == 0) - { - ReadBoxObj (NULL, buff, ObjPtr); - /* if (*ObjPtr == NULL) return (FALSE); */ - ReadObjAttrsFromBuff (START_HAVING_ATTRS-1, buffattr, ObjPtr); - AdjObjBBox (*ObjPtr); - if (allocated) free(buff); - return (TRUE); - } - else if (strcmp (obj_name, "oval") == 0) - { - ReadOvalObj (NULL, buff, ObjPtr); - /* if (*ObjPtr == NULL) return (FALSE); */ - ReadObjAttrsFromBuff (START_HAVING_ATTRS-1, buffattr, ObjPtr); - AdjObjBBox (*ObjPtr); - if (allocated) free(buff); - return (TRUE); - } - else if (strcmp (obj_name, "text") == 0) - { - ReadText (buff, ObjPtr); - /*if (*ObjPtr == NULL) return (FALSE);*/ - if (allocated) free(buff); - return (TRUE); - } - else if (strcmp (obj_name, "polygon") == 0) - { - ReadPolygon (buff, ObjPtr); - if (*ObjPtr == NULL) return (FALSE); - ReadObjAttrsFromBuff (START_HAVING_ATTRS-1, buffattr, ObjPtr); - AdjObjBBox (*ObjPtr); - if (allocated) free(buff); - return (TRUE); - } - else if (strcmp (obj_name, "arc") == 0) - { - ReadArcObj (NULL, buff, ObjPtr); - /* if (*ObjPtr == NULL) return (FALSE); */ - ReadObjAttrsFromBuff (START_HAVING_ATTRS-1, buffattr, ObjPtr); - AdjObjBBox (*ObjPtr); - if (allocated) free(buff); - return (TRUE); - } - else if (strcmp (obj_name, "rcbox") == 0) - { - ReadRCBoxObj (NULL, buff, ObjPtr); - /*if (*ObjPtr == NULL) return (FALSE); */ - ReadObjAttrsFromBuff (START_HAVING_ATTRS-1, buffattr, ObjPtr); - AdjObjBBox (*ObjPtr); - if (allocated) free(buff); - return (TRUE); - } - else if (strcmp (obj_name, "group") == 0) - { - ReadGroup (buff, OBJ_GROUP, ObjPtr); - /*if (*ObjPtr == NULL) return (FALSE); */ - ReadObjAttrsFromBuff (INVALID, buffattr, ObjPtr); - AdjObjBBox (*ObjPtr); - if (allocated) free(buff); - return (TRUE); - } - return FALSE; - } - - void ReadObjAttrsFromBuff (MinFileVersion, buff, ObjPtr) - int MinFileVersion; - char * buff; - struct ObjRec * * ObjPtr; - { - struct AttrRec * top_attr = NULL, * bot_attr = NULL, * attr_ptr; - - if (fileVersion <= MinFileVersion) return; - - while (ReadAttrFromBuff (buff, &attr_ptr)) - { - attr_ptr->owner = *ObjPtr; - attr_ptr->prev = NULL; - attr_ptr->next = top_attr; - if (top_attr == NULL) - bot_attr = attr_ptr; - else - top_attr->prev = attr_ptr; - top_attr = attr_ptr; - } - if (bot_attr != NULL) bot_attr->next = NULL; - (*ObjPtr)->fattr = top_attr; - (*ObjPtr)->lattr = bot_attr; - } - - - void AddObjFromBuffer (PrevPtr, NextPtr, ObjPtr) - struct ObjRec * PrevPtr, * NextPtr, * ObjPtr; - { - ObjPtr->prev = PrevPtr; - ObjPtr->next = NextPtr; - - if (PrevPtr == NULL) - curPage->top = topObj = ObjPtr; - else - PrevPtr->next = ObjPtr; - - if (NextPtr == NULL) - curPage->bot = botObj = ObjPtr; - else - NextPtr->prev = ObjPtr; - } - - - void RecordObjToBuffer(obj_ptr,buff) - struct ObjRec * obj_ptr; - char * buff; - { - - switch (obj_ptr->type) - { - case OBJ_POLY: RecordPolyToBuffer (obj_ptr, buff); break; - case OBJ_BOX: RecordBoxToBuffer (obj_ptr,buff); break; - case OBJ_OVAL: RecordOvalToBuffer (obj_ptr, buff); break; - case OBJ_TEXT: RecordTextToBuffer (obj_ptr, buff); break; - case OBJ_POLYGON: RecordPolygonToBuffer (obj_ptr, buff); break; - case OBJ_ARC: RecordArcToBuffer (obj_ptr, buff); break; - case OBJ_RCBOX: RecordRCBoxToBuffer (obj_ptr, buff); break; - /* case OBJ_XBM: SaveXBmObj (FP, obj_ptr); break; - case OBJ_XPM: SaveXPmObj (FP, obj_ptr); break; */ - case OBJ_GROUP: RecordGroupToBuffer (obj_ptr, buff, 0); break; - /* level was set to 0 like saving file (file.c) */ - /* case OBJ_SYM: SaveCompObj (FP, obj_ptr, Level); break; - case OBJ_ICON: SaveIconObj (FP, obj_ptr, Level); break; - case OBJ_PIN: SavePinObj (FP, obj_ptr, Level); break; */ - } - - } - - void SendCmd(CmdType,SubCmdPtr, TopSel, NumObjs, TopSelBefore) - int CmdType, NumObjs; - struct SelRec * TopSel, * TopSelBefore; - struct SubCmdRec * SubCmdPtr; - { - int i, numobj, CmdTypeRec; - char buff[20000], aux[10]; - struct SelRec * SelAux, * BotSel_aux; - struct ObjRec * obj_ptr; - - memset(buff, 0, sizeof(buff) ); - - /* CmdType#NumObjs#CMD_MOVE->dx#CMD_MOVE->dy#TopSel_Obj#...objs */ - /* CmdType#NumObjs#CMD_MOVE->dx#CMD_MOVE->dy#BotSel_Obj#...until top_obj */ - - sprintf (buff, "%d#", CmdType); - - if ( (CmdType == CMD_DELETE) || (CmdType == CMD_MANY_TO_ONE) ) - { - for (numobj=0,SelAux=TopSelBefore ; SelAux != NULL ; - ++numobj,SelAux = SelAux->next); - sprintf (buff, "%s%d#",buff, numobj); - } - else - { - sprintf (buff, "%s%d#",buff, NumObjs); - } - - if (CmdType == CMD_MOVE) - { - sprintf (buff, "%s%d#%d#",buff,SubCmdPtr->detail.mv->dx, - SubCmdPtr->detail.mv->dy); - } - else - { - sprintf (buff, "%s##" , buff); - } - - if (TopSel == NULL) - { - sprintf (buff, "%s#", buff); - } - else - { - if (TopSel->obj == NULL) - { - close(sock); - exit(1); - } - else - { - SelAux = TopSel; - for (i=1; i <= NumObjs ; i++) /* geting the bottom obj */ - { - obj_ptr = SelAux->obj; - SelAux = SelAux->next; - } - for (i=1; i <= NumObjs ; i++) - { - /*RecordObjToBuffer(SelAux->obj,buff); */ - RecordObjToBuffer(obj_ptr,buff); - sprintf (buff, "%s#" , buff); - /* SelAux = SelAux->next; */ - obj_ptr = obj_ptr->prev; - } - } - } - - if (TopSelBefore != NULL) - { - numobj = 0; - for (SelAux = TopSelBefore; SelAux != NULL ; SelAux = SelAux->next) - { - numobj = numobj + 1; - /*obj_ptr = SelAux->obj;*/ - BotSel_aux = SelAux; - } - for (i=1 ; i <= numobj ; i++) - { - RecordObjToBuffer(BotSel_aux->obj,buff); - /*RecordObjToBuffer(obj_ptr,buff); */ - sprintf (buff, "%s#" , buff); - /*obj_ptr = obj_ptr->prev;*/ - BotSel_aux = BotSel_aux->prev; - } - } - else - { - sprintf (buff, "%s#" , buff); - } - - if (write(sock, buff, sizeof(buff)) < 0) - { - sprintf(buff, "There is a problem writing to the socket #%d.\nStart again the connection!", sock); - MsgBox(buff, TOOL_NAME, INFO_MB); - return; - } - - /* CheckClientServer(); */ - if (ClientServer == 1) /* connection is on and I'm Client! */ - { - WaitForAck(CmdType, SubCmdPtr, TopSel, botSel, NumObjs); - } - - } - - void WaitForAck(CmdType, SubCmdPtr, TopSel, BotSel, NumObjs) - int CmdType, NumObjs; - struct SelRec * TopSel, * BotSel; - struct SubCmdRec * SubCmdPtr; - { - int CmdTypeRec = 0, saved_curChoice; - char buff[20000], aux[10]; - - /* finishing the recording of the last command of client and undoing it - until the ack arrives. In case of a nack it only kills the last command, - otherwise (ack arrives) it REDOs the last command and kills it. - Clients don't keep list of commands only a temporary last one*/ - - if (curCmd == NULL) - ClearRedoRecords (firstCmd); - else if (curCmd != lastCmd) - ClearRedoRecords (curCmd); - - if (++historyCount == historyDepth && !composingCommand) - { - struct CmdRec * new_first_cmd = firstCmd->next; - - new_first_cmd->prev = NULL; - firstCmd->next = NULL; - DeleteARedoRecord (firstCmd, (-1.0), (-1.0)); - historyCount--; - firstCmd = new_first_cmd; - } - - curCmd = (struct CmdRec *) malloc (sizeof(struct CmdRec)); - if (curCmd == NULL) FailAllocMessage(); - memset(curCmd, 0, sizeof(struct CmdRec)); - curCmd->top_before = topSelBeforeInCmd; - curCmd->bot_before = botSelBeforeInCmd; - curCmd->pos_before = stackingPosition; - curCmd->count_before = stackingCount; - curCmd->type = CmdType; - curCmd->undone = FALSE; - curCmd->include_tgif_obj = recordCmdIncludeTgifObj; - - if (TopSel != NULL) - { - CopySel (TopSel, NumObjs, &(curCmd->top_after), &(curCmd->bot_after)); - PrepareStacking (TopSel, BotSel, NumObjs); - curCmd->pos_after = stackingPosition; - curCmd->count_after = stackingCount; - } - else - { - curCmd->top_after = curCmd->bot_after = NULL; - curCmd->pos_after = NULL; - curCmd->count_after = 0; - } - InsertCmd (lastCmd, NULL, curCmd, &firstCmd, &lastCmd); - - switch (CmdType) - { - case CMD_NEW: break; - case CMD_DELETE: break; - case CMD_MOVE: - curCmd->dx = SubCmdPtr->detail.mv->dx; - curCmd->dy = SubCmdPtr->detail.mv->dy; - break; - case CMD_STRETCH: FreeAfterSel (curCmd); break; - case CMD_REPLACE: FreeAfterSel (curCmd); break; - case CMD_ONE_TO_MANY: break; - case CMD_MANY_TO_ONE: break; - case CMD_GOTO_PAGE: curCmd->count_after = NumObjs; break; - } - curCmd = lastCmd; - saved_curChoice = curChoice; - - /* UndoCmd (); */ - TieLooseEnds (); - SetCurChoice (NOTHING); - if (curCmd == NULL) - { - Msg ("No commands to Undo!"); - return; - } - undoingOrRedoing = TRUE; - UndoACmd (curCmd, TRUE); - curCmd = curCmd->prev; - undoingOrRedoing = FALSE; - - - /* now I have the last command of the client recorded and UNDONE */ - - - /* I'll wait for and ack(20) or nack(21) - While other commands arrive from the server I keep executing them */ - - Msg("Waiting for ACK/NACK from server"); - - CmdTypeRec = -1; - while ( (CmdTypeRec != 20) && (CmdTypeRec != 21) ) - { - memset(buff, 0, sizeof(buff)); - if ( (read(sock, buff, sizeof(buff)) > 0) && ((int)strlen(buff) > 0) ) - { - ParseStr (buff,(int) '#', aux, strlen(buff)); - CmdTypeRec = atoi (aux); - Cmd_Flag_Arrived = CmdTypeRec; - if ((CmdTypeRec != 20) && (CmdTypeRec != 21)) - { - CmdReceived(buff); - Msg("Still waiting for ACK/NACK"); - } - } - } - if (CmdTypeRec == 20) /* an ack has arrived, redoing the command */ - { - Msg("An ACK has arrived from server"); - /* RedoCmd (); */ - TieLooseEnds (); - SetCurChoice (NOTHING); - if (firstCmd==NULL || (curCmd!=NULL && curCmd->next==NULL)) - { - Msg ("No commands to Redo!"); - return; - } - - if (curCmd == NULL) - curCmd = firstCmd; - else - curCmd = curCmd->next; - - undoingOrRedoing = TRUE; - RedoACmd (curCmd, TRUE); - undoingOrRedoing = FALSE; - - } - else /* an ACK has arrived */ - { - Msg(" Last command ignored! "); - } - Cmd_Flag_Arrived = -1; - SetCurChoice (saved_curChoice); - - /* should kill here last command */ - } - - void SendAlreadyDone() - { - struct SelRec * TopSelAux; - struct ObjRec * obj_ptr, * topOld; - int status, count; - - if (ClientServer == 1) /* I'm client */ /* never used-only for server */ - { - topOld = topObj; - sleep(2); - while((status = CheckClientServer()) == TRUE) continue; - for (obj_ptr = curPage->bot; obj_ptr != topOld; obj_ptr = obj_ptr->prev) - { - TopSelAux->obj = obj_ptr; - TopSelAux->next = NULL; - TopSelAux->prev = NULL; - /*SendCmd (1, NULL, TopSelAux, 1, NULL);*/ - CheckConForRecord(1, NULL, TopSelAux, 1, NULL); - } - } - else /* I'm server */ - { - count = 0; - SelAllObj(FALSE); - if (topSel == NULL) - { - return; - } - for (obj_ptr = topSel->obj; obj_ptr != NULL; obj_ptr = obj_ptr->next) - count++; - - CheckConForRecord(1, NULL, topSel, count, NULL); - /* - for (obj_ptr = curPage->bot; obj_ptr != NULL; obj_ptr = obj_ptr->prev) - { - Cmd_Flag_Arrived = -1; - TopSelAux->obj = obj_ptr; - TopSelAux->next = NULL; - TopSelAux->prev = NULL; - CheckConForRecord(1, NULL, TopSelAux, 1, NULL); - } - */ - } - - } - - void ErrorOnConsist() - { - char msg[MAXSTRING], b[80]; - - strcpy(b, "21####"); - - Cmd_Flag_Arrived = 21; - - if (ClientServer == 2) /* I'm server and received an inconsistent command */ - { - if (write(sock, b, sizeof(b)) < 0) /* sending NACK */ - { - sprintf(b, "There is a problem writing to the socket #%d.\nStart again the connection!", sock); - MsgBox(b, TOOL_NAME, INFO_MB); - return; - } - } - else /* I'm client */ - { - sprintf(b,"There is an inconsistency between you and the server!"); - sprintf(b,"%s\n Recovering from the server!",b); - MsgBox(b, TOOL_NAME, INFO_MB); - NewProc(); - - strcpy(b, "22####"); - if (write(sock, b, sizeof(b)) < 0) /* sending NACK-inconsist. */ - { - sprintf(b, "There is a problem writing to the socket #%d.\nStart again the connection!", sock); - MsgBox(b, TOOL_NAME, INFO_MB); - return; - } - /* sprintf(b,"There is an inconsistency between you and the server!"); - sprintf(b,"%s\n Recovering from the server!",b); - MsgBox(b, TOOL_NAME, INFO_MB); - NewProc(); */ - } - } - - void NackFromClient() - { - char b[80]; - - sprintf(b,"There is an inconsistency between you and a client!"); - sprintf(b,"%s\nRecovering from your status",b); - MsgBox(b, TOOL_NAME, INFO_MB); - - Cmd_Flag_Arrived = -1; - SendAlreadyDone(); - ClearAndRedrawDrawWindow(); - - } - - void ClearClient() - { - char b[80]; - - Cmd_Flag_Arrived = 23; - sprintf(b,"Recovering from Server status !"); - MsgBox(b, TOOL_NAME, INFO_MB); - - NewProc(); - } - - void CloseCon() - { - char b[80]; - - if (ClientServer == 2) /* connection is on and I'm server*/ - { - sprintf(b," Client requested to close the connection"); - sprintf(b,"%s \n Closing the connection ", b); - } - else - { - sprintf(b," Server requested to close the connection"); - sprintf(b,"%s \n Closing the connection ", b); - } - MsgBox(b, TOOL_NAME, INFO_MB); - close(sock); - ClientServer = 0; - - } - #endif /* _TGIF_WB */ --- 13,17 ---- *** wb2.c.orig Wed May 19 10:27:55 1999 --- wb2.c Wed May 19 10:27:55 1999 *************** *** 2,3 **** --- 2,5 ---- * Author: Renato Santana, in January, 1996. * + * (Obsoleted in tgif-4.1.9 by the TangramII group at land.ufrj.br.) + * *************** *** 11,528 **** #ifdef _TGIF_WB - #include "attr.e" - #include "auxtext.e" - #include "color.e" - #include "dup.e" - #include "file.e" - #include "font.e" - #include "msg.e" #include "wb2.e" - #include "wb3.e" - /* prototypes definitions */ - void RecordPolyToBuffer ARGS_DECL((struct ObjRec*,char*)); - void SaveSmoothHingeToBuff ARGS_DECL((char*,int,int,char*)); - void RecordBoxToBuffer ARGS_DECL((struct ObjRec*,char*)); - void RecordOvalToBuffer ARGS_DECL((struct ObjRec*,char*)); - void RecordTextToBuffer ARGS_DECL((struct ObjRec*,char*)); - void RecordArcToBuffer ARGS_DECL((struct ObjRec*,char*)); - void RecordPolygonToBuffer ARGS_DECL((struct ObjRec*,char*)); - void RecordGroupToBuffer ARGS_DECL((struct ObjRec*,char*, int)); - void RecordRCBoxToBuffer ARGS_DECL((struct ObjRec*,char*)); - void SaveAttrsToBuff ARGS_DECL((char*,struct AttrRec*)); - void SaveAttrToBuff ARGS_DECL((char*,struct AttrRec*)); - void SaveStringToBuff ARGS_DECL((char*,char*)); - void SaveTextObjToBuff ARGS_DECL((char*,struct ObjRec*)); - int ReadAttrFromBuff ARGS_DECL((char*,struct AttrRec**)); - void CopyObj ARGS_DECL((register struct ObjRec*,register struct ObjRec*)); - /* prototypes defined */ - - - void RecordPolyToBuffer (ObjPtr, buff) - struct ObjRec * ObjPtr; - char * buff; - { - register int i, n; - int count; - struct PolyRec * poly_ptr = ObjPtr->detail.p; - - n = poly_ptr->n; - sprintf (buff, "%spoly('%s',%1d,[\n\t", buff, - colorMenuItems[ObjPtr->color], poly_ptr->n); - for (i = 0, count = 0; i < n-1; i++) - { - sprintf (buff, "%s%1d,%1d,", buff, poly_ptr->vlist[i].x, - poly_ptr->vlist[i].y); - if (++count == 8) - { - count = 0; - sprintf (buff, "%s\n\t", buff); - } - } - sprintf (buff, "%s%1d,%1d],", buff, poly_ptr->vlist[n-1].x, - poly_ptr->vlist[n-1].y); - - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", buff, - poly_ptr->style, poly_ptr->width, poly_ptr->pen, ObjPtr->id, - poly_ptr->curved, poly_ptr->fill, poly_ptr->dash, ObjPtr->rotation, - poly_ptr->aw, poly_ptr->ah, ObjPtr->locked); - sprintf (buff, "%s\n \"", buff); - SaveSmoothHingeToBuff (buff,poly_ptr->curved, poly_ptr->n, poly_ptr->smooth); - sprintf (buff, "%s\",", buff); - SaveAttrsToBuff (buff, ObjPtr->lattr); - sprintf (buff, "%s)", buff); - - } - - static char hexValue[] = "0123456789abcdef"; - - void SaveSmoothHingeToBuff (buff, Curved, NumPts, Smooth) - char * buff; - int Curved, NumPts; - char * Smooth; - { - register int nibble_count=0, bit_count=0, data=0, j; - - if (Curved == LT_INTSPLINE || Smooth == NULL) return; - - for (j = 0; j < NumPts; j++) - { - data = (Smooth[j] ? (data<<1) | 1 : (data<<1)); - - if (++bit_count == 4) - { - if (nibble_count++ == 64) - { - nibble_count = 1; - sprintf (buff, "%s\n ", buff); - } - sprintf (buff, "%s%c", buff, hexValue[data]); - bit_count = 0; - data = 0; - } - } - if ((NumPts & 0x3) != 0) - { - data <<= (4 - (NumPts & 0x3)); - if (nibble_count++ == 64) - { - nibble_count = 1; - sprintf (buff, "%s\n ", buff); - } - sprintf (buff, "%s%c", buff, hexValue[data]); - } - } - - - void RecordBoxToBuffer (ObjPtr, buff) - struct ObjRec * ObjPtr; - char * buff; - { - - sprintf (buff, "%sbox('%s',", buff,colorMenuItems[ObjPtr->color]); - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", buff, - ObjPtr->obbox.ltx, ObjPtr->obbox.lty, ObjPtr->obbox.rbx, - ObjPtr->obbox.rby, ObjPtr->detail.b->fill, ObjPtr->detail.b->width, - ObjPtr->detail.b->pen, ObjPtr->id, ObjPtr->detail.b->dash, - ObjPtr->rotation, ObjPtr->locked); - SaveAttrsToBuff (buff, ObjPtr->lattr); - sprintf (buff, "%s)",buff); - } - - void RecordOvalToBuffer (ObjPtr, buff) - struct ObjRec * ObjPtr; - char * buff; - { - sprintf (buff, "%soval('%s',", buff, colorMenuItems[ObjPtr->color]); - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,",buff, - ObjPtr->obbox.ltx, ObjPtr->obbox.lty, ObjPtr->obbox.rbx, - ObjPtr->obbox.rby, ObjPtr->detail.o->fill, ObjPtr->detail.o->width, - ObjPtr->detail.o->pen, ObjPtr->id, ObjPtr->detail.o->dash, - ObjPtr->rotation, ObjPtr->locked); - SaveAttrsToBuff (buff, ObjPtr->lattr); - sprintf (buff, "%s)", buff); - } - - void RecordTextToBuffer (ObjPtr, buff) - struct ObjRec * ObjPtr; - char * buff; - { - - register struct TextRec * text_ptr = ObjPtr->detail.t; - register struct StrRec * s_ptr; - char font_str[MAXSTRING]; - - GetPSFontStr (text_ptr->font, text_ptr->style, font_str); - sprintf (buff, "%stext('%s',", buff, colorMenuItems[ObjPtr->color]); - sprintf (buff, "%s%1d,%1d,'%s',%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,[\n",buff, - ObjPtr->x, ObjPtr->y, &font_str[1], text_ptr->style, text_ptr->size, - text_ptr->lines, text_ptr->just, text_ptr->rotate, text_ptr->pen, - ObjPtr->obbox.rbx-ObjPtr->obbox.ltx, - ObjPtr->obbox.rby-ObjPtr->obbox.lty, ObjPtr->id, 0, /* dummy dpi */ - text_ptr->asc, text_ptr->des, text_ptr->fill, text_ptr->v_space, - ObjPtr->rotation, ObjPtr->locked); - - for (s_ptr = text_ptr->first; s_ptr->next != NULL; s_ptr = s_ptr->next) - { - sprintf (buff, "%s\t\"", buff); - SaveStringToBuff (buff, s_ptr->dyn_str.s); - sprintf (buff, "%s\",\n", buff); - } - - sprintf (buff, "%s\t\"", buff); - SaveStringToBuff (buff, s_ptr->dyn_str.s); - - sprintf (buff, "%s\"])", buff); - } - - - void RecordArcToBuffer (ObjPtr, buff) - struct ObjRec * ObjPtr; - char * buff; - { - register struct ArcRec * arc_ptr = ObjPtr->detail.a; - - sprintf (buff, "%sarc('%s',", buff, colorMenuItems[ObjPtr->color]); - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,\ - %1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", buff, - arc_ptr->fill, arc_ptr->width, arc_ptr->pen, arc_ptr->dash, - arc_ptr->ltx, arc_ptr->lty, arc_ptr->xc, arc_ptr->yc, - arc_ptr->x1, arc_ptr->y1, arc_ptr->x2, arc_ptr->y2, - arc_ptr->dir, arc_ptr->w, arc_ptr->h, arc_ptr->angle1, arc_ptr->angle2, - ObjPtr->id, ObjPtr->rotation, arc_ptr->style, arc_ptr->aw, - arc_ptr->ah, ObjPtr->locked); - - SaveAttrsToBuff (buff, ObjPtr->lattr); - sprintf (buff, "%s)", buff); - } - - void RecordPolygonToBuffer (ObjPtr, buff) - struct ObjRec * ObjPtr; - char * buff; - { - register int i, n; - int count; - struct PolygonRec * polygon_ptr = ObjPtr->detail.g; - - n = polygon_ptr->n; - sprintf (buff , "%spolygon('%s',%1d,[\n\t", buff, - colorMenuItems[ObjPtr->color], polygon_ptr->n); - for (i = 0, count = 0; i < n-1; i++) - { - sprintf (buff , "%s%1d,%1d,", buff, polygon_ptr->vlist[i].x, - polygon_ptr->vlist[i].y); - if (++count == 8) - { - count = 0; - sprintf (buff , "%s\n\t", buff); - } - } - sprintf (buff , "%s%1d,%1d],", buff, polygon_ptr->vlist[n-1].x, - polygon_ptr->vlist[n-1].y); - sprintf (buff , "%s%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", buff, - polygon_ptr->fill, polygon_ptr->width, - polygon_ptr->pen, polygon_ptr->curved, - ObjPtr->id, polygon_ptr->dash, ObjPtr->rotation, - ObjPtr->locked); - sprintf (buff , "%s\n \"", buff); - SaveSmoothHingeToBuff (buff, polygon_ptr->curved, polygon_ptr->n, - polygon_ptr->smooth); - sprintf (buff , "%s\",", buff); - SaveAttrsToBuff (buff , ObjPtr->lattr); - sprintf (buff , "%s)", buff); - } - - void RecordGroupToBuffer (ObjPtr, buff, Level) - struct ObjRec * ObjPtr; - char * buff; - int Level; - { - sprintf (buff, "%sgroup([\n", buff); - SaveToBuffer (buff, ObjPtr->detail.r->last, Level+1, INVALID); - - sprintf (buff, "%s],\n", buff); - sprintf (buff, "%s%1d,%1d,", buff, ObjPtr->id, ObjPtr->locked); - SaveAttrsToBuff (buff, ObjPtr->lattr); - sprintf (buff, "%s)", buff); - - } - - void RecordRCBoxToBuffer (ObjPtr, buff) - struct ObjRec * ObjPtr; - char * buff; - { - - sprintf (buff, "%srcbox('%s',", buff, colorMenuItems[ObjPtr->color]); - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,",buff, - ObjPtr->obbox.ltx, - ObjPtr->obbox.lty, ObjPtr->obbox.rbx, ObjPtr->obbox.rby, - ObjPtr->detail.rcb->fill, ObjPtr->detail.rcb->width, - ObjPtr->detail.rcb->pen, ObjPtr->detail.rcb->dash, - ObjPtr->detail.rcb->radius, ObjPtr->id, ObjPtr->rotation, - ObjPtr->locked); - SaveAttrsToBuff (buff, ObjPtr->lattr); - sprintf (buff, "%s)", buff); - } - - - - void SaveAttrsToBuff (buff, AttrPtr) - char * buff; - struct AttrRec * AttrPtr; - { - - - struct AttrRec * ptr; - - sprintf (buff, "%s[\n", buff); - - for (ptr = AttrPtr; ptr != NULL; ptr = ptr->prev) - { - SaveAttrToBuff (buff, ptr); - if (ptr->prev != NULL) - sprintf (buff, "%s,\n", buff); - } - - if (AttrPtr == NULL) - { - strcat(buff,"]"); - } - else - { - strcat(buff, "\n]"); - } - - } - - - void SaveAttrToBuff (buff, AttrPtr) - char * buff; - struct AttrRec * AttrPtr; - { - - sprintf (buff, "%sattr(\"", buff); - SaveStringToBuff (buff, AttrPtr->attr_name.s); - sprintf (buff, "%s\", \"", buff); - SaveStringToBuff (buff, AttrPtr->attr_value.s); - sprintf (buff, "%s\", %1d, %1d, %1d,\n", buff, - AttrPtr->shown, AttrPtr->nameshown, AttrPtr->inherited); - - SaveTextObjToBuff (buff, AttrPtr->obj); - sprintf (buff, "%s)",buff); - - } - - void SaveStringToBuff (buff, S) - char * buff; - char * S; - { - for ( ; *S != '\0'; S++) - { - if (*S == '\\') - { - strcat(buff,"\\\\"); - } - else if (*S == '"') - { - if (doubleQuoteDoubleQuote) - { - sprintf (buff, "%s%s", buff, "\"\""); - } - else - { - sprintf (buff, "%s%s", buff, "\\\""); - } - } - else if ((*S) & 0x80) - { - sprintf (buff, "%s\\%o", buff, (*S)&0xff); - } - else - { - sprintf(buff, "%s%c", buff, *S); - /*strcat(*buff,*S);*/ - } - - } - - } - - - void SaveTextObjToBuff (buff, ObjPtr) - char * buff; - struct ObjRec * ObjPtr; - { - - register struct TextRec * text_ptr = ObjPtr->detail.t; - register struct StrRec * s_ptr; - char font_str[MAXSTRING]; - - GetPSFontStr (text_ptr->font, text_ptr->style, font_str); - sprintf (buff, "%stext('%s',", buff, colorMenuItems[ObjPtr->color]); - sprintf (buff, - "%s%1d,%1d,'%s',%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,[\n", buff, - ObjPtr->x, ObjPtr->y, &font_str[1], text_ptr->style, text_ptr->size, - text_ptr->lines, text_ptr->just, text_ptr->rotate, text_ptr->pen, - ObjPtr->obbox.rbx-ObjPtr->obbox.ltx, - ObjPtr->obbox.rby-ObjPtr->obbox.lty, ObjPtr->id, 0, - text_ptr->asc, text_ptr->des, text_ptr->fill, text_ptr->v_space, - ObjPtr->rotation, ObjPtr->locked); - - for (s_ptr = text_ptr->first; s_ptr->next != NULL; s_ptr = s_ptr->next) - { - sprintf (buff, "%s\t\"", buff); - sprintf (buff, "%s\",\n", buff); - } - - sprintf (buff, "%s\t\"", buff); - sprintf (buff, "%s\"])", buff); - - } - - - int ReadAttrFromBuff (buff, AttrPtr) - char * buff; - struct AttrRec * * AttrPtr; - { - - char * s, * line, * c_ptr; - char * name, * value; - int len, shown, nameshown, inherited, cur_size; - int done, allocated = FALSE; - - - len = strlen(buff); - if (buff[len-1] != '\r' && buff[len-1] != '\n') - { /* line longer than MAXSTRING characters */ - cur_size = 2*MAXSTRING-1; - line = (char *) malloc ((cur_size+1)*sizeof(char)); - if (line == NULL) FailAllocMessage(); - allocated = TRUE; - strcpy (line, buff); - c_ptr = &(line[MAXSTRING-1]); - - done = FALSE; - } - else - { - line = buff; - line[len-1] = '\0'; - } - - if (line[0] == ']') - { - if (allocated) free(line); - return (FALSE); - } - - *AttrPtr = NULL; - - len = strlen(line) - 1; - line[len] = '\0'; - - name = (char *) malloc ((len+1)*sizeof(char)); - if (name == NULL) FailAllocMessage(); - s = FindChar ('"', line); - strcpy(name, s); - s = ReadAttrString (s); - s = FindChar (',', s); - value = (char *) malloc ((len+1)*sizeof(char)); - if (value == NULL) FailAllocMessage(); - strcpy(value, FindChar ('"', s)); - s = ReadAttrString (value); - s = FindChar (',', s); - - InitScan (s, "\t\n ,"); - if (GETINT("attribute", shown, "shown") == INVALID || - GETINT("attribute", nameshown, "name shown") == INVALID || - GETINT("attribute", inherited, "inherited") == INVALID) - { - if (allocated) free(line); - free(name); - free(value); - return (FALSE); - } - - *AttrPtr = (struct AttrRec *) malloc (sizeof(struct AttrRec)); - if (*AttrPtr == NULL) FailAllocMessage(); - memset(*AttrPtr, 0, sizeof(struct AttrRec)); - - s = ReadString (name); - *(--s) = '\0'; - strcpy ((*AttrPtr)->attr_name.s, name); - s = ReadString (value); - *(--s) = '\0'; - strcpy ((*AttrPtr)->attr_value.s, value); - - free(name); - free(value); - - (*AttrPtr)->shown = shown; - (*AttrPtr)->nameshown = nameshown; - (*AttrPtr)->inherited = inherited; - - if (allocated) free(line); - return (TRUE); - } - - - void CopyObj(obj_from, obj_to) - register struct ObjRec * obj_from, * obj_to; - { - DupObjBasics (obj_from, obj_to); - - switch (obj_to->type) - { - case OBJ_POLY: - DupPolyObj (obj_from->detail.p, obj_to); - break; - case OBJ_BOX: - DupBoxObj (obj_from->detail.b, obj_to); - break; - case OBJ_OVAL: - DupOvalObj (obj_from->detail.o, obj_to); - break; - case OBJ_TEXT: DupTextObj (obj_from->detail.t, obj_from, obj_to); - break; - case OBJ_POLYGON: - DupPolygonObj (obj_from->detail.g, obj_to); - break; - case OBJ_ARC: - DupArcObj (obj_from->detail.a, obj_to); - break; - case OBJ_RCBOX: - DupRCBoxObj (obj_from->detail.rcb, obj_to); - break; - case OBJ_XBM: - DupXBmObj (obj_from->detail.xbm, obj_to); - break; - case OBJ_XPM: - DupXPmObj (obj_from->detail.xpm, obj_to); - break; - case OBJ_SYM: - case OBJ_GROUP: - case OBJ_ICON: - case OBJ_PIN: - DupGroupObj (obj_from->detail.r, obj_to); - if (obj_from->type == OBJ_ICON || obj_from->type == OBJ_PIN) - { - strcpy (obj_to->detail.r->s, obj_from->detail.r->s); - obj_to->detail.r->rotate = obj_from->detail.r->rotate; - obj_to->detail.r->flip = obj_from->detail.r->flip; - obj_to->detail.r->deck_index = (-1); - /* - * Need to check for pins. - * Need to handle the case where connection objects need to be dupped! - */ - obj_to->detail.r->pin_connected = 0; - obj_to->detail.r->first_conn = obj_to->detail.r->last_conn = NULL; - } - break; - } - DupAttrs (obj_from, obj_to); - - } - - #endif /* _TGIF_WB */ --- 13,17 ---- *** wb3.c.orig Wed May 19 10:27:57 1999 --- wb3.c Wed May 19 10:27:57 1999 *************** *** 2,3 **** --- 2,5 ---- * Author: Renato Santana, in January, 1996. * + * (Obsoleted in tgif-4.1.9 by the TangramII group at land.ufrj.br.) + * *************** *** 11,1513 **** #ifdef _TGIF_WB - #include "align.e" - #include "auxtext.e" - #include "color.e" - #include "file.e" - #include "font.e" - #include "grid.e" - #include "msg.e" - #include "obj.e" - #include "page.e" - #include "pattern.e" - #include "poly.e" - #include "prtgif.e" - #include "raster.e" - #include "setup.e" - #include "stk.e" - #include "text.e" - #include "version.e" - #include "wb2.e" #include "wb3.e" - #include "xpixmap.e" - #define CUR_VERSION 32 - - extern int sock; - - static struct StrRec * firstStrRec = NULL, * lastStrRec = NULL; - - /* prototypes definitions */ - void ReadPoly ARGS_DECL((char*,struct ObjRec**)); - void ReadPolygon ARGS_DECL((char*,struct ObjRec**)); - int ReadSmoothHingeFromBuff ARGS_DECL((char*,int,int,char*)); - static int OldFontIndex ARGS_DECL((register int,register int,register int,register int)); - void ReadText ARGS_DECL((char*,struct ObjRec**)); - void AddStrRec ARGS_DECL((struct StrRec*,struct StrRec*,struct StrRec*)); - void SaveToBuffer ARGS_DECL((char*, struct ObjRec*, int, int)); - void ReadGroup ARGS_DECL((char *, int, struct ObjRec * *)); - - /* prototypes defined*/ - - - void ReadPoly (Inbuf, ObjPtr) - char * Inbuf; - struct ObjRec * * ObjPtr; - { - register int i; - struct PolyRec * poly_ptr; - IntPoint * v; - char color_str[40], * s, msg[MAXSTRING]; - int num_pts, ltx=0, lty=0, rbx=0, rby=0, x, y, id=0; - int initialized, rotation, count, new_alloc; - int style, width=0, pen, curved, fill, dash, locked=FALSE; - int aw=origArrowHeadW[6], ah=origArrowHeadH[6]; - char * smooth=NULL, aux[10000], aux2[10000]; - - *ObjPtr = NULL; - - strcpy(aux,Inbuf); - - s = FindChar ((int)'(', Inbuf); - s = ParseStr (s, (int)',', color_str, sizeof(color_str)); - - InitScan (s, "\t\n, []"); - if (GETINT("poly", num_pts, "number of points") == INVALID) - return; - - if (num_pts <= 0) - { - (void) sprintf (msg, "%s, %d: Invalid number of points in poly", - scanFileName, scanLineNum); - if (PRTGIF) - fprintf (stderr, "%s\n", msg); - else - Msg (msg); - return; - } - - *ObjPtr = (struct ObjRec *) malloc (sizeof(struct ObjRec)); - if (*ObjPtr == NULL) FailAllocMessage(); - memset(*ObjPtr, 0, sizeof(struct ObjRec)); - poly_ptr = (struct PolyRec *) malloc (sizeof(struct PolyRec)); - if (poly_ptr == NULL) FailAllocMessage(); - memset(poly_ptr, 0, sizeof(struct PolyRec)); - - if (num_pts == 1) - { - v = (IntPoint *) malloc (4*sizeof(IntPoint)); - if (v == NULL) FailAllocMessage (); - smooth = (char *) malloc (4*sizeof(char)); - if (smooth == NULL) FailAllocMessage (); - } - else - { - v = (IntPoint *) malloc ((num_pts+1)*sizeof(IntPoint)); - if (v == NULL) FailAllocMessage (); - smooth = (char *) malloc ((num_pts+1)*sizeof(char)); - if (smooth == NULL) FailAllocMessage (); - } - - initialized = FALSE; - - if (fileVersion <= 13) - { - for (i = 0; i < num_pts; i++) - { - if (GETINT("poly", x, "x") == INVALID || GETINT("poly", y, "y") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - v[i].x = x; v[i].y = y; - if (!initialized) - { - initialized = TRUE; - ltx = rbx = x; lty = rby = y; - } - else - { - if (x < ltx) ltx = x; if (y < lty) lty = y; - if (x > rbx) rbx = x; if (y > rby) rby = y; - } - } - } - else - { - scanLineNum++; - strcpy(aux2,aux); - s = FindChar ((int)'[', aux); - s++; - - - InitScan (s, "\t\n, []"); - - for (i = 0, count = 0; i < num_pts; ++i, ++count) - { - if (count == 8 && i != num_pts-1) - { - count = 0; - scanLineNum++; - while (*s != '\n') ++s; - ++s; - strcpy(aux,s); - s = aux; - InitScan (s, "\t\n, []"); - } - if (GETINT("poly", x, "x") == INVALID || GETINT("poly", y, "y") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - v[i].x = x; v[i].y = y; - if (!initialized) - { - initialized = TRUE; - ltx = rbx = x; lty = rby = y; - } - else - { - if (x < ltx) ltx = x; if (y < lty) lty = y; - if (x > rbx) rbx = x; if (y > rby) rby = y; - } - } - } - - s = FindChar ((int)']', aux2); - s++; - strcpy(aux, s); - InitScan (s, "\t\n, []"); - - if (num_pts == 1) - { - sprintf (msg, "%s (%1d,%1d) converted to double point poly.", - "Single point poly", v[0].x, v[0].y); - if (PRTGIF) - fprintf (stderr, "%s\n", msg); - else - Msg (msg); - v[1].x = v[0].x; - v[1].y = v[0].y; - num_pts = 2; - } - - poly_ptr->n = num_pts; - - dash = 0; - rotation = 0; - if (fileVersion == INVALID) - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - id = objId++; - fill = NONEPAT; - if (width == LINE_CURVED) - { - width = 0; - curved = TRUE; - } - else - curved = FALSE; - switch (width) - { - case 1: width = 3; break; - case 2: width = 6; break; - } - } - else if (fileVersion <= 3) - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", id, "id") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - /*if (id >= objId) objId = id+1;*/ - objId = id+1; - fill = NONEPAT; - if (width == LINE_CURVED) - { - width = 0; - curved = TRUE; - } - else - curved = FALSE; - switch (width) - { - case 1: width = 3; break; - case 2: width = 6; break; - } - } - else if (fileVersion <= 4) - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", curved, "curved") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - fill = NONEPAT; - switch (width) - { - case 1: width = 3; break; - case 2: width = 6; break; - } - } - else if (fileVersion <= 5) - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", fill, "fill") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - switch (width) - { - case 1: width = 3; break; - case 2: width = 6; break; - } - } - else if (fileVersion <= 8) - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", fill, "fill") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - } - else if (fileVersion <= 13) - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", dash, "dash") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - } - else if (fileVersion <= 16) - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", dash, "dash") == INVALID || - GETINT("poly", rotation, "rotation") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - } - else if (fileVersion <= 25) - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", dash, "dash") == INVALID || - GETINT("poly", rotation, "rotation") == INVALID || - GETINT("poly", aw, "arrow head width") == INVALID || - GETINT("poly", ah, "arrow head height") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - } - else - { - if (GETINT("poly", style, "style") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", dash, "dash") == INVALID || - GETINT("poly", rotation, "rotation") == INVALID || - GETINT("poly", aw, "arrow head width") == INVALID || - GETINT("poly", ah, "arrow head height") == INVALID || - GETINT("poly", locked, "locked") == INVALID) - { - free(*ObjPtr); - free(poly_ptr); - free(v); - *ObjPtr = NULL; - return; - } - objId = id+1; - } - - if (fileVersion <= 16 && width <= 6) - { - aw = origArrowHeadW[width]; - ah = origArrowHeadH[width]; - width = origWidthOfLine[width]; - } - if (curved == LT_INTSPLINE && smooth != NULL) - { - free(smooth); - smooth = NULL; - } - if (fileVersion <= 30) - { - switch (curved) - { - case LT_STRAIGHT: - for (i=0; i < num_pts; i++) smooth[i] = FALSE; - break; - case LT_SPLINE: - smooth[0] = smooth[num_pts-1] = FALSE; - for (i=1; i < num_pts-1; i++) smooth[i] = TRUE; - break; - } - } - else if (!ReadSmoothHingeFromBuff (aux, curved, num_pts, smooth)) - return; - - fill = UpgradePenFill (fill); - pen = UpgradePenFill (pen); - - poly_ptr->style = style; - poly_ptr->width = width; - poly_ptr->aw = aw; - poly_ptr->ah = ah; - poly_ptr->pen = pen; - poly_ptr->curved = curved; - poly_ptr->fill = fill; - poly_ptr->dash = dash; - - poly_ptr->vlist = v; - poly_ptr->smooth = smooth; - poly_ptr->svlist = poly_ptr->asvlist = NULL; - poly_ptr->intvlist = NULL; - - (*ObjPtr)->x = ltx; - (*ObjPtr)->y = lty; - (*ObjPtr)->color = QuickFindColorIndex(*ObjPtr, color_str, &new_alloc, TRUE); - (*ObjPtr)->dirty = FALSE; - (*ObjPtr)->id = id; - (*ObjPtr)->rotation = rotation; - (*ObjPtr)->locked = locked; - (*ObjPtr)->type = OBJ_POLY; - (*ObjPtr)->obbox.ltx = ltx; - (*ObjPtr)->obbox.lty = lty; - (*ObjPtr)->obbox.rbx = rbx; - (*ObjPtr)->obbox.rby = rby; - (*ObjPtr)->detail.p = poly_ptr; - - AdjObjSplineVs (*ObjPtr); - if (poly_ptr->curved != LT_INTSPLINE) - UpdPolyBBox (*ObjPtr, poly_ptr->n, poly_ptr->vlist); - else - UpdPolyBBox (*ObjPtr, poly_ptr->intn, poly_ptr->intvlist); - } - - void ReadPolygon (Inbuf, ObjPtr) - char * Inbuf; - struct ObjRec * * ObjPtr; - { - register int i; - struct PolygonRec * polygon_ptr; - IntPoint * v; - char color_str[40], * s, inbuf[MAXSTRING], msg[MAXSTRING]; - int num_pts, ltx=0, lty=0, rbx=0, rby=0, x, y, id=0; - int fill, width, pen, w, new_alloc, locked=FALSE; - int curved, dash, initialized, rotation, count; - char * smooth=NULL, aux[10000], aux2[10000]; - - *ObjPtr = NULL; - - strcpy(aux,Inbuf); - - s = FindChar ((int)'(', Inbuf); - s = ParseStr (s, (int)',', color_str, sizeof(color_str)); - - InitScan (s, "\t\n, []"); - - if (GETINT("poly", num_pts, "number of points") == INVALID) - return; - - if (num_pts <= 0) - { - (void) sprintf (msg, "%s, %d: Invalid number of points in polygon", - scanFileName, scanLineNum); - if (PRTGIF) - fprintf (stderr, "%s\n", msg); - else - Msg (msg); - return; - } - - *ObjPtr = (struct ObjRec *) malloc (sizeof(struct ObjRec)); - if (*ObjPtr == NULL) FailAllocMessage(); - memset(*ObjPtr, 0, sizeof(struct ObjRec)); - polygon_ptr = (struct PolygonRec *) malloc (sizeof(struct PolygonRec)); - if (polygon_ptr == NULL) FailAllocMessage(); - memset(polygon_ptr, 0, sizeof(struct PolygonRec)); - - if (num_pts < 3) - { - v = (IntPoint *) malloc (5*sizeof(IntPoint)); - if (v == NULL) FailAllocMessage (); - smooth = (char *) malloc (5*sizeof(char)); - if (smooth == NULL) FailAllocMessage (); - } - else - { - v = (IntPoint *) malloc ((num_pts+1)*sizeof(IntPoint)); - if (v == NULL) FailAllocMessage (); - smooth = (char *) malloc ((num_pts+1)*sizeof(char)); - if (smooth == NULL) FailAllocMessage (); - } - - initialized = FALSE; - - if (fileVersion <= 13) - { - for (i = 0; i < num_pts; i++) - { - if (GETINT("poly", x, "x") == INVALID || GETINT("poly", y, "y") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - v[i].x = x; v[i].y = y; - if (!initialized) - { - initialized = TRUE; - ltx = rbx = x; lty = rby = y; - } - else - { - if (x < ltx) ltx = x; if (y < lty) lty = y; - if (x > rbx) rbx = x; if (y > rby) rby = y; - } - } - } - else - { - /*fgets (inbuf, MAXSTRING, FP); - scanLineNum++; - s = inbuf; */ - - scanLineNum++; - strcpy(aux2,aux); - s = FindChar ((int)'[', aux); - s++; - - InitScan (s, "\t\n, []"); - - for (i = 0, count = 0; i < num_pts; i++) - { - if (GETINT("poly", x, "x") == INVALID || GETINT("poly", y, "y") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - v[i].x = x; v[i].y = y; - if (!initialized) - { - initialized = TRUE; - ltx = rbx = x; lty = rby = y; - } - else - { - if (x < ltx) ltx = x; if (y < lty) lty = y; - if (x > rbx) rbx = x; if (y > rby) rby = y; - } - if (++count == 8 && i != num_pts-1) - { - /*count = 0; - fgets (inbuf, MAXSTRING, FP); - scanLineNum++; - s = inbuf; - InitScan (s, "\t\n, []");*/ - - count = 0; - scanLineNum++; - while (*s != '\n') ++s; - ++s; - strcpy(aux,s); - s = aux; - InitScan (s, "\t\n, []"); - - } - } - } - - s = FindChar ((int)']', aux2); - s++; - strcpy(aux, s); - InitScan (s, "\t\n, []"); - - - switch (num_pts) - { - case 1: - sprintf (msg, "%s (%1d,%1d) converted to 3-point polygon.", - "1-point polygon", v[0].x, v[0].y); - if (PRTGIF) - fprintf (stderr, "%s\n", msg); - else - Msg (msg); - v[3].x = v[2].x = v[1].x = v[0].x; - v[3].y = v[2].y = v[1].y = v[0].y; - num_pts = 4; - break; - case 2: - sprintf (msg, "%s [%1d,%1d,%1d,%1d] converted to 3-point polygon.", - "2-point polygon", v[0].x, v[0].y, v[1].x, v[1].y); - if (PRTGIF) - fprintf (stderr, "%s\n", msg); - else - Msg (msg); - v[3].x = v[2].x = v[0].x; - v[3].y = v[2].y = v[0].y; - num_pts = 4; - break; - case 3: - sprintf (msg, "%s [%1d,%1d,%1d,%1d] converted to 3-point polygon.", - "2-point polygon", v[0].x, v[0].y, v[1].x, v[1].y); - if (PRTGIF) - fprintf (stderr, "%s\n", msg); - else - Msg (msg); - v[3].x = v[2].x = v[0].x; - v[3].y = v[2].y = v[0].y; - num_pts = 4; - break; - } - - polygon_ptr->n = num_pts; - - dash = 0; - rotation = 0; - if (fileVersion <= 3) - { - if (GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (width == LINE_CURVED) - { - width = 0; - curved = TRUE; - } - else - curved = FALSE; - switch (width) - { - case 1: width = 3; break; - case 2: width = 6; break; - } - id = objId++; - } - else if (fileVersion <= 5) - { - if (GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", curved, "curved") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - switch (width) - { - case 1: width = 3; break; - case 2: width = 6; break; - } - id = objId++; - } - else if (fileVersion <= 7) - { - if (GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", curved, "curved") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - id = objId++; - } - else if (fileVersion <= 8) - { - if (GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", id, "id") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - } - else if (fileVersion <= 13) - { - if (GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", dash, "dash") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - } - else if (fileVersion <= 25) - { - if (GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", dash, "dash") == INVALID || - GETINT("poly", rotation, "rotation") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - } - else - { - if (GETINT("poly", fill, "fill") == INVALID || - GETINT("poly", width, "width") == INVALID || - GETINT("poly", pen, "pen") == INVALID || - GETINT("poly", curved, "curved") == INVALID || - GETINT("poly", id, "id") == INVALID || - GETINT("poly", dash, "dash") == INVALID || - GETINT("poly", rotation, "rotation") == INVALID || - GETINT("poly", locked, "locked") == INVALID) - { - free(*ObjPtr); - free(polygon_ptr); - free(v); - *ObjPtr = NULL; - return; - } - if (id >= objId) objId = id+1; - } - - if (fileVersion <= 16 && width <= 6) width = origWidthOfLine[width]; - - if (fileVersion <= 25 && curved > 1) curved = 0; - if (curved == LT_INTSPLINE && smooth != NULL) - { - free(smooth); - smooth = NULL; - } - if (fileVersion <= 30) - { - switch (curved) - { - case LT_STRAIGHT: - for (i=0; i < num_pts; i++) smooth[i] = FALSE; - break; - case LT_SPLINE: - for (i=0; i < num_pts; i++) smooth[i] = TRUE; - break; - } - } - else if (!ReadSmoothHingeFromBuff (aux, curved, num_pts, smooth)) - return; - - fill = UpgradePenFill (fill); - pen = UpgradePenFill (pen); - - polygon_ptr->fill = fill; - polygon_ptr->width = width; - polygon_ptr->pen = pen; - polygon_ptr->curved = curved; - polygon_ptr->dash = dash; - - polygon_ptr->vlist = v; - polygon_ptr->smooth = smooth; - polygon_ptr->svlist = NULL; - polygon_ptr->intvlist = NULL; - - (*ObjPtr)->x = ltx; - (*ObjPtr)->y = lty; - (*ObjPtr)->color = QuickFindColorIndex(*ObjPtr, color_str, &new_alloc, TRUE); - (*ObjPtr)->dirty = FALSE; - (*ObjPtr)->id = id; - (*ObjPtr)->rotation = rotation; - (*ObjPtr)->locked = locked; - (*ObjPtr)->type = OBJ_POLYGON; - (*ObjPtr)->obbox.ltx = ltx; - (*ObjPtr)->obbox.lty = lty; - (*ObjPtr)->obbox.rbx = rbx; - (*ObjPtr)->obbox.rby = rby; - w = HALF_W(width); - (*ObjPtr)->bbox.ltx = ltx - w; - (*ObjPtr)->bbox.lty = lty - w; - (*ObjPtr)->bbox.rbx = rbx + w; - (*ObjPtr)->bbox.rby = rby + w; - (*ObjPtr)->detail.g = polygon_ptr; - AdjObjSplineVs (*ObjPtr); - if (polygon_ptr->curved != LT_INTSPLINE) - UpdPolyBBox (*ObjPtr, polygon_ptr->n, polygon_ptr->vlist); - else - UpdPolyBBox (*ObjPtr, polygon_ptr->intn, polygon_ptr->intvlist); - } - - - - int ReadSmoothHingeFromBuff (buff, Curved, NumPts, Smooth) - char * buff; - int Curved, NumPts; - char * Smooth; - { - int num_nibbles=NumPts>>2, nibble_count=0, bit_count=0, j, k; - char * c_ptr, inbuf[MAXSTRING+1], msg[MAXSTRING]; - - while (*buff != '\n') ++buff; - buff++; - if ((NumPts & 0x3) != 0) num_nibbles++; - scanLineNum++; - if (Curved == LT_INTSPLINE || Smooth == NULL) return (TRUE); - if ((c_ptr = strchr (buff, '"')) == NULL) - { - (void) sprintf (msg, "%s, %d: Invalid smooth/hinge spec for a poly.", - scanFileName, scanLineNum); - if (PRTGIF) - fprintf (stderr, "%s\n", msg); - else - Msg (msg); - return (FALSE); - } - c_ptr++; - for (j = 0; j < num_nibbles; j++) - { - int data=0; - - if (nibble_count++ == 64) - { - while (*buff != '\n') ++buff; - buff++; - scanLineNum++; - for (c_ptr=buff; *c_ptr == ' '; c_ptr++) ; - nibble_count = 1; - } - if (*c_ptr >= '0' && *c_ptr <= '9') - data = (int)(*c_ptr++) - (int)('0'); - else if (*c_ptr >= 'a' && *c_ptr <= 'f') - data = (int)(*c_ptr++) - (int)('a') + 10; - for (k = 0; k < 4; k++) - { - if (bit_count++ == NumPts) break; - - Smooth[(j<<2)+k] = (data & (1<<(3-k)) ? TRUE : FALSE); - } - } - return (TRUE); - } - - - #define FONTS_PER_DPI (((MAXFONTS-1)*MAXFONTSTYLES+1)*MAXFONTSIZES) - - 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); - } - - - void ReadText (Inbuf, ObjPtr) - char * Inbuf; - struct ObjRec * * ObjPtr; - { - - register int i, len, max_len; - struct StrRec * s_ptr; - struct TextRec * text_ptr; - char color_str[80], * s, * c_ptr, font_str[MAXSTRING]; - char * tmp_str, inbuf[MAXSTRING+1], * line; - int num_lines, x, y, font, style, size, new_alloc, id=0; - int text_just, rotate, pen, cur_size, done, rotation; - int bbox_w, bbox_h, dpi, asc, des, fill, allocated, v_space; - int locked=FALSE, min_lbearing=0, max_rextra=0; - int has_ps_bitmap=FALSE, double_byte=FALSE; - char aux[10000], aux2[10000], *t, sb_font_str[MAXSTRING]; - - dpi = FONT_DPI_75; - fill = NONEPAT; - v_space = 0; - - *ObjPtr = NULL; - - t = FindChar ((int)'[', Inbuf); - strcpy(aux, ++t); - - s = FindChar ((int)'(', Inbuf); - s = ParseStr (s, (int)',', color_str, sizeof(color_str)); - InitScan (s, ", \t\n"); - - rotate = 0; - pen = 1; - rotation = 0; - - if (GETINT("text", x, "x") == INVALID || - GETINT("text", y, "y") == INVALID || - GETSTR("text", font_str, "font_str") == INVALID || - GETINT("text", style, "style") == INVALID || - GETINT("text", size, "size") == INVALID || - GETINT("text", num_lines, "num_lines") == INVALID || - GETINT("text", text_just, "text_just") == INVALID || - GETINT("text", rotate, "rotate") == INVALID || - GETINT("text", pen, "pen") == INVALID || - GETINT("text", bbox_w, "bbox w") == INVALID || - GETINT("text", bbox_h, "bbox h") == INVALID || - GETINT("text", id, "id") == INVALID || - GETINT("text", dpi, "dpi") == INVALID || - GETINT("text", asc, "ascent") == INVALID || - GETINT("text", des, "descent") == INVALID || - GETINT("text", fill, "fill") == INVALID || - GETINT("text", v_space, "vertical spacing") == INVALID || - GETINT("text", rotation, "rotation") == INVALID || - GETINT("text", locked, "locked") == INVALID) - { - return; - } - - - /*if (id >= objId) objId = id+1; */ - objId++; - fill = UpgradePenFill (fill); - pen = UpgradePenFill (pen); - - *ObjPtr = (struct ObjRec *) malloc (sizeof(struct ObjRec)); - if (*ObjPtr == NULL) FailAllocMessage(); - memset(*ObjPtr, 0, sizeof(struct ObjRec)); - - text_ptr = (struct TextRec *) malloc (sizeof(struct TextRec)); - if (text_ptr == NULL) FailAllocMessage(); - memset(text_ptr, 0, sizeof(struct TextRec)); - text_ptr->lines = num_lines; - text_ptr->cached_bitmap = None; - text_ptr->cached_zoom = 0; - text_ptr->cached_rotate = ROTATE0; - - len = strlen(font_str); - if (len > 1 && *font_str == '\'' && font_str[len-1] == '\'') { - char *psz1=(&font_str[1]); - - font_str[len-1] = '\0'; - psz = font_str; - while (*psz1 != '\0') *psz++ = *psz1++; - *psz = '\0'; - } - if (double_byte) { - if ((psz=strchr(font_str, '%')) != NULL) { - *psz++ = '\0'; - strcpy(sb_font_str, font_str); - strcpy(font_str, psz); - } - } - - if (!PRTGIF) SaveCurFont (); - - if (PRTGIF) - { - if (fileVersion <= 29) - { - curFont = text_ptr->font = font; - text_ptr->font_name = NULL; - } - else - { - text_ptr->font_name = UtilStrDup(font_str); - if (text_ptr->font_name == NULL) FailAllocMessage(); - 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 - { - curFont = text_ptr->font = GetFontIndex (font_str, style, TRUE); - if (curFont == INVALID) - { - char msg[MAXSTRING]; - - sprintf (msg, "Cannot find screen font for '%s'.", s); - TwoLineMsg (msg, " Use Times instead."); - SetFileModified (TRUE); - curFont = text_ptr->font = FONT_TIM; - if (double_byte) { - /* - * curFont would have been the double-byte font. - * But since it can't be found and Times is used, it should - * not be double-byte any more. - */ - double_byte = FALSE; - } - } - } - } - - 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; - penPat = text_ptr->pen = pen; - objFill = text_ptr->fill = fill; - - if (PRTGIF) - { - if (fileVersion < 10) - { - canvasFontAsc = - pDrawFontAsc[OldFontIndex(dpi,curFont,size,curStyle)]; - canvasFontDes = - pDrawFontDes[OldFontIndex(dpi,curFont,size,curStyle)]; - } - else - { - canvasFontAsc = asc; - canvasFontDes = des; - } - textCursorH = canvasFontAsc + canvasFontDes; - text_ptr->read_only = FALSE; - } - else - { - text_ptr->read_only = SetCanvasFont(); - } - if (text_ptr->read_only) - { - text_ptr->asc = asc; - text_ptr->des = des; - switch (rotate) - { - case ROTATE0: - case ROTATE180: - text_ptr->orig_w = bbox_w; - text_ptr->orig_h = bbox_h; - break; - case ROTATE90: - case ROTATE270: - text_ptr->orig_w = bbox_h; - text_ptr->orig_h = bbox_w; - break; - } - } - else - { - text_ptr->asc = canvasFontAsc; - text_ptr->des = canvasFontDes; - text_ptr->orig_w = text_ptr->orig_h = 0; - } - s = aux; - for (i = 0; i < num_lines; i++) - { - /*fgets (inbuf, MAXSTRING, FP); */ - scanLineNum++; - allocated = FALSE; - - strcpy(aux2,aux); - tmp_str = FindChar ((int)'"', aux2); - t = tmp_str; - while ((*t != '\n') && (*t != '\r')) t++; - *t = '\0'; - t++; - strcpy(aux,t); - s = ReadString (tmp_str); - *(--s) = '\0'; - s_ptr = (struct StrRec *) malloc (sizeof(struct StrRec)); - if (s_ptr == NULL) FailAllocMessage(); - memset(s_ptr, 0, sizeof(struct StrRec)); - strcpy (s_ptr->dyn_str.s, tmp_str); - AddStrRec (lastStrRec, (struct StrRec *)NULL, s_ptr); - if (PRTGIF) - len = strlen (tmp_str); /* assume string width = 1 pixel per char */ - else - len = MyTextWidth(canvasFontPtr, tmp_str, strlen (tmp_str)); - if (len > max_len) max_len = len; - - /* if (allocated) free (line); */ - } - text_ptr->first = firstStrRec; - text_ptr->last = lastStrRec; - - firstStrRec = lastStrRec = NULL; - - (*ObjPtr)->x = x; - (*ObjPtr)->y = y; - - if (PRTGIF && fileVersion > 6) - { - switch (rotate) - { - case ROTATE0: - case ROTATE180: - SetTextBBox (*ObjPtr, text_just, bbox_w, bbox_h, - min_lbearing, max_rextra, rotate); - break; - case ROTATE90: - case ROTATE270: - SetTextBBox (*ObjPtr, text_just, bbox_h, bbox_w, - min_lbearing, max_rextra, rotate); - break; - } - } - else if (!PRTGIF && text_ptr->read_only) - SetTextBBox (*ObjPtr, text_just, text_ptr->orig_w, text_ptr->orig_h, - min_lbearing, max_rextra, rotate); - else - SetTextBBox (*ObjPtr, text_just, max_len, - num_lines*textCursorH+(num_lines-1)*textVSpace, - min_lbearing, max_rextra, rotate); - - (*ObjPtr)->type = OBJ_TEXT; - (*ObjPtr)->color = QuickFindColorIndex(*ObjPtr, color_str, &new_alloc, TRUE); - (*ObjPtr)->dirty = FALSE; - (*ObjPtr)->id = id; - (*ObjPtr)->rotation = rotation; - (*ObjPtr)->locked = locked; - (*ObjPtr)->detail.t = text_ptr; - - if (!PRTGIF) RestoreCurFont (); - } - - void AddStrRec (PrevPtr, NextPtr, StrPtr) - struct StrRec * PrevPtr, * NextPtr, * StrPtr; - { - StrPtr->prev = PrevPtr; - StrPtr->next = NextPtr; - - if (PrevPtr == NULL) - firstStrRec = StrPtr; - else - PrevPtr->next = StrPtr; - - if (NextPtr == NULL) - lastStrRec = StrPtr; - else - NextPtr->prev = StrPtr; - } - - - void SaveToBuffer(buff, BotObjPtr, Level, PageNumber) - char *buff; - struct ObjRec *BotObjPtr; - int Level; - int PageNumber; - { - struct ObjRec * obj_ptr; - char font_str[81]; - - if (Level == 0 && PageNumber == 1) - { - ResetXPmErrorMessage (); - GetPSFontStr (curFont, curStyle, font_str); - SetFullVersionString(); - sprintf (buff, "%s%%TGIF %s\n", buff, fullVersionString); - - sprintf (buff, "%sstate(%1d,%1d,%.3f,", buff, pageStyle, CUR_VERSION, - printMag); - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,%1d,", buff, drawOrigX, drawOrigY, - zoomScale, xyEnglishGrid, snapOn, colorIndex); - sprintf (buff, "%s%1d,%1d,%1d,", buff, horiAlign, vertAlign, lineWidth); - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,'%s',%1d,%1d,", buff, curSpline, - lineStyle, objFill, penPat,textJust, &font_str[1], - curStyle, curSize); - - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,%1d,", buff, 0, curDash, - gridSystem, xyMetricGrid, textVSpace, zoomedIn); - sprintf (buff, "%s%1d,%1d,0,%1d,%1d,", buff, gridShown, moveMode, - rcbRadius, useGray); - sprintf (buff, "%s%1d,%1d,%1d,%1d,%1d,%1d,%1d).\n", buff, pageLayoutMode, - (pageLayoutMode == PAGE_STACK) ? curPageNum : paperCol, - (pageLayoutMode == PAGE_STACK) ? lastPageNum : paperRow, - pageLineShownInTileMode, colorDump, - round(((float)onePageWidth)*printMag/100.0), - round(((float)onePageHeight)*printMag/100.0)); - sprintf (buff, "%s%%\n%% @%s%s\n", buff, "(#)$H", "eader$"); - sprintf (buff, "%s%% %s\n%%\n", buff, "%W%"); - - if (savedComments != NULL) - sprintf(buff, "%s%s", buff, savedComments); - - if (tgifObj->lattr != NULL) - { - sprintf (buff, "%sfile_attr(", buff); - - SaveAttrsToBuff (buff, tgifObj->lattr); - sprintf (buff, "%s).\n", buff); - } - } - if (Level == 0) - { - sprintf (buff, "%spage(%1d,\"%s\").\n", buff, PageNumber, ((pageLayoutMode==PAGE_TILE || curPage->name==NULL) ? "" : curPage->name) ); - } - for (obj_ptr = BotObjPtr; obj_ptr != NULL; obj_ptr = obj_ptr->prev) - { - switch (obj_ptr->type) - { - case OBJ_POLY: RecordPolyToBuffer (obj_ptr, buff); break; - case OBJ_BOX: RecordBoxToBuffer (obj_ptr,buff); break; - case OBJ_OVAL: RecordOvalToBuffer (obj_ptr, buff); break; - case OBJ_TEXT: RecordTextToBuffer (obj_ptr, buff); break; - case OBJ_POLYGON: break; - case OBJ_ARC: RecordArcToBuffer (obj_ptr, buff); break; - case OBJ_RCBOX: RecordRCBoxToBuffer (obj_ptr, buff); break; - case OBJ_XBM: break; - case OBJ_XPM: break; - case OBJ_GROUP: RecordGroupToBuffer (obj_ptr, buff, Level); break; - case OBJ_SYM: break; - case OBJ_ICON: break; - case OBJ_PIN: break; - } - if (obj_ptr->prev == NULL) - { - if (Level == 0) - { - sprintf (buff, "%s.\n", buff); - } - else - { - sprintf (buff, "%s\n", buff); - } - } - else - { - if (Level == 0) - { - sprintf (buff , "%s.\n", buff); - } - else - { - sprintf (buff, "%s,\n", buff); - } - } - } - /* SetCurChoice (NOTHING); - SetDefaultCursor (mainWindow); - ShowCursor ();*/ - } - - - void ReadGroup( Inbuf, ObjType, ObjPtr) - char * Inbuf; - 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; - char line[MAXSTRING+1], * s, * s1, tmp_str[MAXSTRING+1]; - */ - int pin_connected=0, invisible=FALSE; - - char *t, aux[10000], aux2[10000]; - - *ObjPtr = NULL; - - - t = FindChar ((int)'[', Inbuf); - strcpy(aux, ++t); - t = ParseStr (t, (int)')', aux2, sizeof(aux2)); - t = t+3; - - - /* - s = FindChar ((int)'(', Inbuf); - s = ParseStr (s, (int)',', color_str, sizeof(color_str)); - InitScan (s, ", \t\n"); - - while (ReadObj (FP, &obj_ptr)) - { - buff = ParseStr (buff,(int) '#', aux, strlen(buff)); - ReadObjFromBuff(aux, &obj_ptr); - - if (obj_ptr == NULL) return; - - obj_ptr->next = top_obj; - if (top_obj == NULL) - bot_obj = obj_ptr; - else - top_obj->prev = obj_ptr; - top_obj = obj_ptr; - } - if (top_obj == NULL) return; - - if (fileVersion <= 20 && (ObjType==OBJ_GROUP || ObjType==OBJ_SYM)) - id = objId++; - else - { - if (fgets (line, MAXSTRING, FP) == NULL) return; - scanLineNum++; - - switch (ObjType) - { - case OBJ_GROUP: - InitScan (line, "\t\n, []"); - if (fileVersion <= 25) - { - if (ScanValue ("%d", &id, "id", "group") == INVALID) return; - - if (id >= objId) objId = id+1; - } - else - { - if (ScanValue ("%d", &id, "id", "group") == INVALID || - ScanValue ("%d", &locked, "locked", "group") == INVALID) - return; - - if (id >= objId) objId = id+1; - } - break; - case OBJ_SYM: - InitScan (line, "\t\n, []"); - if (fileVersion <= 25) - { - if (ScanValue ("%d", &id, "id", "sym") == INVALID) return; - - if (id >= objId) objId = id+1; - } - else - { - if (ScanValue ("%d", &id, "id", "sym") == INVALID || - ScanValue ("%d", &locked, "locked", "sym") == INVALID) - return; - - if (id >= objId) objId = id+1; - } - break; - case OBJ_ICON: - strcpy(tmp_str, FindChar ((int)'"', line)); - s = FindChar ((int)'"', tmp_str); - if (fileVersion == INVALID) return; - - if (fileVersion <= 12) - { - s1 = FindChar ((int)',', s); - InitScan (s1, "\t\n, "); - if (ScanValue ("%d", &id, "id", "icon") == INVALID) return; - - if (id >= objId) objId = id+1; - } - else if (fileVersion <= 25) - { - s1 = FindChar ((int)',', s); - InitScan (s1, "\t\n, "); - if (ScanValue ("%d", &id, "id", "icon") == INVALID || - ScanValue ("%d", &rotate, "rotation", "icon") == INVALID || - ScanValue ("%d", &flip, "flip", "icon") == INVALID) - { - return; - } - if (id >= objId) objId = id+1; - } - else - { - s1 = FindChar ((int)',', s); - InitScan (s1, "\t\n, "); - if (ScanValue ("%d", &id, "id", "icon") == INVALID || - ScanValue ("%d", &rotate, "rotation", "icon") == INVALID || - ScanValue ("%d", &flip, "flip", "icon") == INVALID || - ScanValue ("%d", &locked, "locked", "icon") == INVALID) - { - return; - } - if (id >= objId) objId = id+1; - } - *(--s) = '\0'; - break; - case OBJ_PIN: - strcpy(tmp_str, FindChar ((int)'"', line)); - s = FindChar ((int)'"', tmp_str); - if (fileVersion == INVALID) return; - - if (fileVersion >= 24) - { - s1 = FindChar ((int)',', s); - InitScan (s1, "\t\n, "); - if (ScanValue ("%d", &id, "id", "icon") == INVALID || - ScanValue ("%d", &rotate, "rotation", "icon") == INVALID || - ScanValue ("%d", &flip, "flip", "icon") == INVALID || - ScanValue ("%d", &locked, "locked", "icon") == INVALID || - ScanValue ("%d", &invisible, "invisible", - "icon") == INVALID || - ScanValue ("%d", &pin_connected, "pin_connected", - "icon") == INVALID) - { - return; - } - if (id >= objId) objId = id+1; - } - *(--s) = '\0'; - break; - } - } - - *ObjPtr = (struct ObjRec *) malloc (sizeof(struct ObjRec)); - if (*ObjPtr == NULL) FailAllocMessage(); - memset(*ObjPtr, 0, sizeof(struct ObjRec)); - - top_obj->prev = NULL; - - group_ptr = (struct GroupRec *) malloc (sizeof(struct GroupRec)); - if (group_ptr == NULL) FailAllocMessage(); - memset(group_ptr, 0, sizeof(struct GroupRec)); - group_ptr->first = top_obj; - group_ptr->last = bot_obj; - group_ptr->rotate = rotate; - group_ptr->flip = flip; - group_ptr->deck_index = (-1); - group_ptr->pin_connected = pin_connected; - group_ptr->first_conn = group_ptr->last_conn = NULL; - if (ObjType == OBJ_ICON || ObjType == OBJ_PIN) { - strcpy (group_ptr->s, tmp_str); - } - - ltx = top_obj->bbox.ltx; - lty = top_obj->bbox.lty; - rbx = top_obj->bbox.rbx; - rby = top_obj->bbox.rby; - obj_ltx = top_obj->obbox.ltx; - obj_lty = top_obj->obbox.lty; - obj_rbx = top_obj->obbox.rbx; - obj_rby = top_obj->obbox.rby; - for (obj_ptr = top_obj->next; obj_ptr != NULL; obj_ptr = obj_ptr->next) - { - 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; - if (obj_ptr->obbox.ltx < obj_ltx) obj_ltx = obj_ptr->obbox.ltx; - if (obj_ptr->obbox.lty < obj_lty) obj_lty = obj_ptr->obbox.lty; - if (obj_ptr->obbox.rbx > obj_rbx) obj_rbx = obj_ptr->obbox.rbx; - if (obj_ptr->obbox.rby > obj_rby) obj_rby = obj_ptr->obbox.rby; - } - - (*ObjPtr)->x = obj_ltx; - (*ObjPtr)->y = obj_lty; - (*ObjPtr)->dirty = FALSE; - (*ObjPtr)->id = id; - (*ObjPtr)->locked = locked; - (*ObjPtr)->type = ObjType; - (*ObjPtr)->bbox.ltx = ltx; - (*ObjPtr)->bbox.lty = lty; - (*ObjPtr)->bbox.rbx = rbx; - (*ObjPtr)->bbox.rby = rby; - (*ObjPtr)->obbox.ltx = obj_ltx; - (*ObjPtr)->obbox.lty = obj_lty; - (*ObjPtr)->obbox.rbx = obj_rbx; - (*ObjPtr)->obbox.rby = obj_rby; - (*ObjPtr)->detail.r = group_ptr; - - */ - } - - #endif /* _TGIF_WB */ --- 13,17 ---- *** wb_buff.c.orig Wed May 19 10:27:58 1999 --- wb_buff.c Wed May 19 10:27:58 1999 *************** *** 9,12 **** --- 9,14 ---- #include "tgifdefs.h" + #include "wb_buff.e" + #ifdef _TGIF_WB2 *************** *** 15,20 **** #endif - #include "wb_buff.e" - /* Structure of each component from the buffer --- 17,20 ---- *** wb_mcast.c.orig Wed May 19 10:27:59 1999 --- wb_mcast.c Wed May 19 10:27:59 1999 *************** *** 9,12 **** --- 9,14 ---- #include "tgifdefs.h" + #include "wb_mcast.e" + #ifdef _TGIF_WB2 *************** *** 14,19 **** #include - #include "wb_mcast.e" - struct PCM_session_message PCM_SM[SM_TABLE_SIZE]; struct PCM_pack_struct PCM_hist[HIST_SIZE]; --- 16,19 ---- *** xbitmap.c.orig Wed May 19 10:28:01 1999 --- xbitmap.c Wed May 19 10:28:01 1999 *************** *** 3709,3727 **** for (i=0, obj_ptr=topObj; obj_ptr != NULL && i < total_chunks; i++, obj_ptr=obj_ptr->next) { ! struct SelRec *sel_ptr=(struct SelRec *)malloc(sizeof(struct SelRec)); ! ! if (sel_ptr == NULL) { ! FailAllocMessage(); ! return FALSE; ! } ! sel_ptr->obj = obj_ptr; ! if (botSel != NULL) { ! botSel->next = sel_ptr; ! } else { ! topSel = sel_ptr; ! } ! sel_ptr->prev = botSel; ! sel_ptr->next = NULL; ! botSel = sel_ptr; } } --- 3709,3713 ---- for (i=0, obj_ptr=topObj; obj_ptr != NULL && i < total_chunks; i++, obj_ptr=obj_ptr->next) { ! AddObjIntoSel(obj_ptr, botSel, NULL, &topSel, &botSel); } } *************** *** 4416,4421 **** (int)(file_ury-file_lly) : (int)(file_lly-file_ury); } else { ! xbm_ptr->eps_w = xbm_ptr->image_w = image_w; ! xbm_ptr->eps_h = xbm_ptr->image_h = image_h; } xbm_ptr->llx = (int)(file_llx*1000.0); --- 4402,4412 ---- (int)(file_ury-file_lly) : (int)(file_lly-file_ury); } else { ! xbm_ptr->image_w = image_w; ! xbm_ptr->image_h = image_h; ! /* same as above! */ ! xbm_ptr->eps_w = (file_urx >= file_llx) ? ! (int)(file_urx-file_llx) : (int)(file_llx-file_urx); ! xbm_ptr->eps_h = (file_ury >= file_lly) ? ! (int)(file_ury-file_lly) : (int)(file_lly-file_ury); } xbm_ptr->llx = (int)(file_llx*1000.0); *************** *** 4426,4431 **** } else { if (xbm_ptr->real_type == XBM_EPS) { ! xbm_ptr->eps_w = xbm_ptr->image_w; ! xbm_ptr->eps_h = xbm_ptr->image_h; } else { xbm_ptr->eps_w = xbm_ptr->eps_h = 0; --- 4417,4430 ---- } else { if (xbm_ptr->real_type == XBM_EPS) { ! float file_llx=((float)xbm_ptr->llx)/1000.0; ! float file_lly=((float)xbm_ptr->lly)/1000.0; ! float file_urx=((float)xbm_ptr->urx)/1000.0; ! float file_ury=((float)xbm_ptr->ury)/1000.0; ! ! /* same as above! */ ! xbm_ptr->eps_w = (file_urx >= file_llx) ? ! (int)(file_urx-file_llx) : (int)(file_llx-file_urx); ! xbm_ptr->eps_h = (file_ury >= file_lly) ? ! (int)(file_ury-file_lly) : (int)(file_lly-file_ury); } else { xbm_ptr->eps_w = xbm_ptr->eps_h = 0; *************** *** 4491,4520 **** return; } ! if ((!(PRTGIF && !cmdLineOpenDisplay)) && (*ObjPtr)->ctm == NULL) { ! if (xbm_ptr->bitmap == None) { ! 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 (image_w != rbx-ltx || image_h != rby-lty) { ! float fval; ! struct XfrmMtrxRec ctm; ! memset(&ctm, 0, sizeof(struct XfrmMtrxRec)); ! (*ObjPtr)->orig_obbox.ltx = ltx; ! (*ObjPtr)->orig_obbox.lty = lty; ! (*ObjPtr)->orig_obbox.rbx = rbx; ! (*ObjPtr)->orig_obbox.rby = rby; ! fval = ((float)(rbx-ltx))/((float)image_w)*((float)1000.0); ! ctm.m[CTM_SX] = (double)fval; ! fval = ((float)(rby-lty))/((float)image_h)*((float)1000.0); ! ctm.m[CTM_SY] = (double)fval; ! (*ObjPtr)->obbox.rbx = (*ObjPtr)->bbox.rbx = ltx+image_w; ! (*ObjPtr)->obbox.rby = (*ObjPtr)->bbox.rby = lty+image_h; ! SetCTM(*ObjPtr, &ctm); ! } } } --- 4490,4499 ---- return; } ! if (!transform_read && (!(PRTGIF && !cmdLineOpenDisplay)) && (*ObjPtr)->ctm == NULL) { ! struct BBRec orig_obbox; ! SetBBRec(&orig_obbox, ltx, lty, rbx, rby); ! SetEPSObjCTM(*ObjPtr, &orig_obbox); } } *** xpixmap.c.orig Wed May 19 10:28:03 1999 --- xpixmap.c Wed May 19 10:28:03 1999 *************** *** 1516,1520 **** if (PRTGIF && cmdLineColor && (prTgifFoundColorInfo || !cmdLineOpenDisplay)) { ! return PrTgifFindColorIndex(ObjPtr, s); } if (ObjPtr != NULL) { --- 1516,1524 ---- if (PRTGIF && cmdLineColor && (prTgifFoundColorInfo || !cmdLineOpenDisplay)) { ! int color_index=PrTgifFindColorIndex(ObjPtr, s); ! ! if (color_index != INVALID || !cmdLineOpenDisplay) { ! return color_index; ! } } if (ObjPtr != NULL) { *************** *** 1835,1853 **** for (i=0, obj_ptr=topObj; obj_ptr != NULL && i < total_chunks; i++, obj_ptr=obj_ptr->next) { ! struct SelRec *sel_ptr=(struct SelRec *)malloc(sizeof(struct SelRec)); ! ! if (sel_ptr == NULL) { ! FailAllocMessage(); ! return FALSE; ! } ! sel_ptr->obj = obj_ptr; ! if (botSel != NULL) { ! botSel->next = sel_ptr; ! } else { ! topSel = sel_ptr; ! } ! sel_ptr->prev = botSel; ! sel_ptr->next = NULL; ! botSel = sel_ptr; } } --- 1839,1843 ---- for (i=0, obj_ptr=topObj; obj_ptr != NULL && i < total_chunks; i++, obj_ptr=obj_ptr->next) { ! AddObjIntoSel(obj_ptr, botSel, NULL, &topSel, &botSel); } } *** choose.e.orig Wed May 19 10:28:05 1999 --- choose.e Wed May 19 10:28:05 1999 *************** *** 40,43 **** --- 40,45 ---- #endif /*_INCLUDE_FROM_CHOOSE_C_*/ + extern int GetWorkingDirectory ARGS_DECL((char *buf, int buf_sz)); + extern int SetWorkingDirectory ARGS_DECL((char *dir)); extern void CleanUpCheckArray ARGS_DECL((struct CheckArrayRec *)); extern int CopyCheckArray ARGS_DECL((struct CheckArrayRec *pTo, *** cmd.e.orig Wed May 19 10:28:06 1999 --- cmd.e Wed May 19 10:28:06 1999 *************** *** 44,47 **** --- 44,49 ---- extern int *stackingPosition; extern int stackingCount; + extern int stackingPositionHasIds; + extern int composingCommand; extern Colormap preparedColormap; *************** *** 73,83 **** extern void DisableUndo ARGS_DECL((void)); extern void EnableUndo ARGS_DECL((void)); ! extern struct SelRec * PrepareStackingInfo ARGS_DECL((struct SelRec *TopSel, ! struct SelRec *BotSel, ! int NumObjs, ! int **ppnStackingPosition, ! int *pnStackingCount)); ! extern void PrepareStacking ARGS_DECL((struct SelRec *TopSel, ! struct SelRec *BotSel, int NumObjs)); extern void PrepareToRecord ARGS_DECL((int, struct SelRec *Top, struct SelRec *Bot, int NumObjs)); --- 75,86 ---- extern void DisableUndo ARGS_DECL((void)); extern void EnableUndo ARGS_DECL((void)); ! extern struct SelRec * PrepareStackingInfo ARGS_DECL(( ! struct SelRec *TopSel, ! struct SelRec *BotSel, ! int NumObjs, ! int PreparePhase, ! int **ppnStackingPosition, ! int *pnStackingCount, ! int *pnStackingPositionHasIds)); extern void PrepareToRecord ARGS_DECL((int, struct SelRec *Top, struct SelRec *Bot, int NumObjs)); *************** *** 91,94 **** --- 94,98 ---- extern void RecordReplaceAnObj ARGS_DECL((struct ObjRec *)); extern void ChangeReplaceOneCmdToDeleteCmd ARGS_DECL((void)); + extern void RecordWBClearAll ARGS_DECL((void)); #ifdef _INCLUDE_FROM_CMD_C_ *** dup.e.orig Wed May 19 10:28:07 1999 --- dup.e Wed May 19 10:28:07 1999 *************** *** 64,67 **** --- 64,72 ---- extern void DupStrBlock ARGS_DECL((StrBlockInfo*, MiniLineInfo*, StrBlockInfo**, StrBlockInfo**)); + extern void DupMiniLine ARGS_DECL((MiniLineInfo *pMiniLine, + MiniLinesInfo *pOwnerMiniLines, + StrBlockInfo *pOwnerBlock, + MiniLineInfo **ppFirstMiniLine, + MiniLineInfo **ppLastMiniLine)); extern void DupMiniLines ARGS_DECL((MiniLinesInfo *minilines, StrBlockInfo *pOwnerBlock, *** eps.e.orig Wed May 19 10:28:08 1999 --- eps.e Wed May 19 10:28:08 1999 *************** *** 52,55 **** --- 52,56 ---- char *Date)); extern void DumpEPSObj ARGS_DECL((FILE *, struct ObjRec *)); + extern void SetEPSObjCTM ARGS_DECL((struct ObjRec *, struct BBRec *)); extern struct ObjRec * CreateEPSObj ARGS_DECL((char *FileName, int ImageW, int ImageH, Pixmap, *** file.e.orig Wed May 19 10:28:09 1999 --- file.e Wed May 19 10:28:09 1999 *************** *** 123,126 **** --- 123,129 ---- extern struct BBRec *gpExportClipBBox; + extern int gnNumFilePSFontAliases; + extern KeyValInfo *gaFilePSFontAliases; + #ifdef _INCLUDE_FROM_FILE_C_ #undef extern *************** *** 163,167 **** char *final_url, int cb_final_url)); ! extern int ImportGivenFile ARGS_DECL((char*)); extern void ImportFile ARGS_DECL((void)); extern int ClearBgColorInfo ARGS_DECL((int nRedraw)); --- 166,170 ---- char *final_url, int cb_final_url)); ! extern int ImportGivenFile ARGS_DECL((char*, int group_and_lock)); extern void ImportFile ARGS_DECL((void)); extern int ClearBgColorInfo ARGS_DECL((int nRedraw)); *** font.e.orig Wed May 19 10:28:10 1999 --- font.e Wed May 19 10:28:10 1999 *************** *** 114,117 **** --- 114,120 ---- extern int defaultSingleByteFont; + extern int gnNumPSFontAliases; + extern KeyValInfo *gaPSFontAliases; + #ifdef _INCLUDE_FROM_FONT_C_ #undef extern *************** *** 130,133 **** --- 133,137 ---- extern char * GetCurFontInfoStr ARGS_DECL((char *retstr)); extern void GetPSFontStr ARGS_DECL((int FontIndex, int Style, char *)); + extern void MapAliasedPSFontName ARGS_DECL((char *buf, int buf_sz)); extern void SetTextExtentsInfo ARGS_DECL((TextExtentsInfo*)); extern struct StrRec *SegmentDoubleByteString ARGS_DECL((char*)); *************** *** 162,165 **** --- 166,170 ---- extern void ObjFontInfoToCurFontInfo ARGS_DECL((struct TextRec *)); extern void StrSegInfoToCurFontInfo ARGS_DECL((StrSegInfo*)); + extern char *FindPSFontAlias ARGS_DECL((char *psz_key)); extern void InitFonts ARGS_DECL((void)); extern void SaveCurFont ARGS_DECL((void)); *** mainloop.e.orig Wed May 19 10:28:11 1999 --- mainloop.e Wed May 19 10:28:11 1999 *************** *** 64,70 **** void (*CleanUpRoutine)(), void *userdata)); - extern void SaveAndSetLocale ARGS_DECL((char *new_locale, - char *prev_locale)); - extern void RestoreLocale ARGS_DECL((char *prev_locale)); extern void DeallocStrings ARGS_DECL((char **Func, char **Str1, char **Menu1, --- 64,67 ---- *** menu.e.orig Wed May 19 10:28:12 1999 --- menu.e Wed May 19 10:28:12 1999 *************** *** 72,79 **** extern int TgMenuLoop ARGS_DECL((TgMenu*)); extern TgMenu *TgDestroyMenu ARGS_DECL((TgMenu*, int free_menu)); - extern int TgGetTextMenuItemWidths ARGS_DECL((TgMenuItem*, - int *pn_check_w, - int *pn_str_w, - int *pn_shortcut_w)); extern int TgSetMenuItemInfo ARGS_DECL((TgMenuItem *to_menu_item, int mask, TgMenuItem *from_menu_item)); --- 72,75 ---- *** miniline.e.orig Wed May 19 10:28:13 1999 --- miniline.e Wed May 19 10:28:13 1999 *************** *** 244,248 **** extern int CanBreakMiniLinesIntoWords ARGS_DECL((MiniLinesInfo*)); ! extern void BreakMiniLines ARGS_DECL((MiniLinesInfo*, int into_words, int x, int baseline_y, struct ObjRec *prototype, --- 244,248 ---- extern int CanBreakMiniLinesIntoWords ARGS_DECL((MiniLinesInfo*)); ! extern void BreakMiniLines ARGS_DECL((MiniLinesInfo*, int how, int x, int baseline_y, struct ObjRec *prototype, *** names.e.orig Wed May 19 10:28:14 1999 --- names.e Wed May 19 10:28:14 1999 *************** *** 39,43 **** extern char curDir[]; extern char curLocalDir[]; - extern char curImportDir[]; extern char curSymDir[]; --- 39,42 ---- *************** *** 78,82 **** extern void SetCurDir ARGS_DECL((char *FileName)); extern void SetCurSymDir ARGS_DECL((char *FileName)); - extern void SetCurImportDir ARGS_DECL((char *FileName)); #ifdef _INCLUDE_FROM_NAMES_C_ --- 77,80 ---- *** obj.e.orig Wed May 19 10:28:15 1999 --- obj.e Wed May 19 10:28:15 1999 *************** *** 62,65 **** --- 62,66 ---- extern void AdjObjHotSpot ARGS_DECL((void)); extern void AdjHotSpots ARGS_DECL((void)); + extern int IsTopLevelObject ARGS_DECL((struct ObjRec *)); extern struct ObjRec *GetTopOwner ARGS_DECL((struct ObjRec *)); *** page.e.orig Wed May 19 10:28:15 1999 --- page.e Wed May 19 10:28:15 1999 *************** *** 57,60 **** --- 57,61 ---- extern void NamePages ARGS_DECL((void)); extern void EditPageFileNames ARGS_DECL((void)); + extern int OkToFlushUndoBuffer ARGS_DECL((char *msg_prefix)); extern void AddPageBefore ARGS_DECL((void)); extern void AddPageAfter ARGS_DECL((void)); *************** *** 87,90 **** --- 88,93 ---- int just_checking)); extern void FixPageNumbersForSlideShow ARGS_DECL((void)); + extern int NeedToFixPageNumbersForSlideShow ARGS_DECL((void)); + extern void SetPaperColor ARGS_DECL((void)); #ifdef _INCLUDE_FROM_PAGE_C_ *** remote.e.orig Wed May 19 10:28:17 1999 --- remote.e Wed May 19 10:28:17 1999 *************** *** 81,84 **** --- 81,85 ---- char *psz_content_type, int buf_sz, int is_html)); + extern void InitLocalPID ARGS_DECL((void)); extern void InitRemote ARGS_DECL((void)); extern void CleanUpRemote ARGS_DECL((void)); *** select.e.orig Wed May 19 10:28:18 1999 --- select.e Wed May 19 10:28:18 1999 *************** *** 69,77 **** struct SelRec **ppTopSel, struct SelRec **ppBotSel)); ! extern int AddObjIntoSel ARGS_DECL((struct ObjRec *pObj, ! struct SelRec *pPrevSel, ! struct SelRec *pNextSel, ! struct SelRec **ppTopSel, ! struct SelRec **ppBotSel)); extern void JustRemoveAllVSel ARGS_DECL((void)); extern void RemoveAllSel ARGS_DECL((void)); --- 69,77 ---- struct SelRec **ppTopSel, struct SelRec **ppBotSel)); ! extern struct SelRec *AddObjIntoSel ARGS_DECL((struct ObjRec *pObj, ! struct SelRec *pPrevSel, ! struct SelRec *pNextSel, ! struct SelRec **ppTopSel, ! struct SelRec **ppBotSel)); extern void JustRemoveAllVSel ARGS_DECL((void)); extern void RemoveAllSel ARGS_DECL((void)); *** stretch.e.orig Wed May 19 10:28:18 1999 --- stretch.e Wed May 19 10:28:19 1999 *************** *** 57,62 **** int YShear, int XScale, int YScale, int *RealLtX, int *RealLtY)); - extern void StretchObj ARGS_DECL((struct ObjRec *, int Corner, int XScale, - int YScale)); extern void StretchSel ARGS_DECL((int XGridOff, int YGridOff, struct ObjRec *, int Corner)); --- 57,60 ---- *************** *** 63,67 **** --- 61,69 ---- extern void ScaleAnEPSObj ARGS_DECL((struct ObjRec *, float * Scale)); extern void ScaleAllSelObj ARGS_DECL((void)); + extern void PreciseScaleEverything ARGS_DECL((void)); extern void SizeAllSelObj ARGS_DECL((int AbsW, int AbsH)); + extern void SizeAnObj ARGS_DECL((struct ObjRec *ObjPtr, + struct ObjRec *TopOwner, + int AbsW, int AbsH)); extern void SizeAllSelToGivenWidthHeight ARGS_DECL((int AbsW, int AbsH)); extern void SizeAllSelToGivenWidth ARGS_DECL((int AbsW)); *** text.e.orig Wed May 19 10:28:19 1999 --- text.e Wed May 19 10:28:19 1999 *************** *** 136,139 **** --- 136,140 ---- extern int ChangeEditTextProperty ARGS_DECL((long lWhich, int nValue)); extern void PasteMiniLinesAtCursor ARGS_DECL((struct ObjRec *)); + extern void MoveEditText ARGS_DECL((XEvent*)); #ifdef _INCLUDE_FROM_TEXT_C_ *** wb.e.orig Wed May 19 10:28:20 1999 --- wb.e Wed May 19 10:28:20 1999 *************** *** 39,43 **** typedef struct WhiteBoardRec { int do_whiteboard; - int first_redo_after_deserialize; int port; /* 8009 */ --- 39,42 ---- *************** *** 55,63 **** int MCastSock; int bd_commands; ! int CanProcessRemoteCmd; struct CmdRec *first_cmd, *last_cmd, *cur_cmd; ! /* don't know how to use first_stopped_cmd yet! */ ! struct CmdRec *first_stopped_cmd; } *WhiteBoardPtr; --- 54,65 ---- int MCastSock; int bd_commands; ! int BlockRemoteCmdDepth; + int logical_clock; + long pid; + struct CmdRec *first_cmd, *last_cmd, *cur_cmd; ! /* don't know how to use first_blocked_cmd yet! */ ! struct CmdRec *first_blocked_cmd; } *WhiteBoardPtr; *************** *** 95,101 **** #ifdef _TGIF_WB2 ! #ifdef _TGIF_DBG_WB2 ! extern int AcceptWBSocket ARGS_DECL((void)); ! #endif /* _TGIF_DBG_WB2 */ extern int WBHasReadData ARGS_DECL((int *pn_flag, int *pn_retry)); --- 97,101 ---- #ifdef _TGIF_WB2 ! extern void PrintFullIDsOfObjects ARGS_DECL((char *psz_prefix)); extern int WBHasReadData ARGS_DECL((int *pn_flag, int *pn_retry)); *************** *** 103,106 **** --- 103,107 ---- int flag, /* *pn_flag of WBHasReadData() */ char **ppsz_buf, int *pn_buf_sz)); + extern void TryHandleWBInputData ARGS_DECL((void)); extern int SendWBData ARGS_DECL((char *pszWBData)); *************** *** 111,115 **** extern char *SerializeCmd ARGS_DECL((int CmdType, struct SubCmdRec *, struct SelRec *Top, struct SelRec *Bot, ! int NumObjs)); extern void SerializeFreeBuf ARGS_DECL((char *psz_buf)); --- 112,117 ---- extern char *SerializeCmd ARGS_DECL((int CmdType, struct SubCmdRec *, struct SelRec *Top, struct SelRec *Bot, ! int NumObjs, ! int *pnAssignedLogicalClock)); extern void SerializeFreeBuf ARGS_DECL((char *psz_buf)); *************** *** 118,121 **** --- 120,127 ---- extern int ReadAfterPositions ARGS_DECL((FILE *FP, char *Inbuf)); extern int ReadAfterImage ARGS_DECL((FILE *FP, char *Inbuf)); + extern void FindCmdInsertionPoint ARGS_DECL((struct CmdRec *cmd_to_insert, + struct CmdRec **pp_immed_right_cmd, + int *pn_cur_cmd_should_block)); + extern void CleanUpObsoletedWBCmds ARGS_DECL((struct CmdRec *)); extern void ProcessRemoteCmd ARGS_DECL((char *psz_buf, int buf_sz)); *** wb1.e.orig Wed May 19 10:28:21 1999 --- wb1.e Wed May 19 10:28:22 1999 *************** *** 2,3 **** --- 2,5 ---- * Author: Renato Santana, in Januray, 1996. * + * (Obsoleted in tgif-4.1.9 by the TangramII group at land.ufrj.br.) + * *************** *** 10,15 **** #define _WB1_E_ - extern int ClientServer; - #ifdef _INCLUDE_FROM_WB1_C_ #undef extern --- 12,15 ---- *************** *** 17,27 **** #endif /*_INCLUDE_FROM_WB1_C_*/ - extern void WhiteBoard ARGS_DECL((void)); - extern void CheckConForRecord ARGS_DECL((int CmdType, - struct SubCmdRec *SubCmdPtr, - struct SelRec *TopSel, int NumObjs, - struct SelRec *TopSelBefore)); - extern int CheckClientServer ARGS_DECL((void)); - #ifdef _INCLUDE_FROM_WB1_C_ #undef extern --- 17,20 ---- *** wb2.e.orig Wed May 19 10:28:22 1999 --- wb2.e Wed May 19 10:28:22 1999 *************** *** 2,3 **** --- 2,5 ---- * Author: Renato Santana, in January, 1996. * + * (Obsoleted in tgif-4.1.9 by the TangramII group at land.ufrj.br.) + * *************** *** 15,34 **** #endif /*_INCLUDE_FROM_WB2_C_*/ - extern void RecordPolyToBuffer ARGS_DECL((struct ObjRec*, char*)); - extern void SaveSmoothHingeToBuff ARGS_DECL((char*, int, int, char*)); - extern void RecordBoxToBuffer ARGS_DECL((struct ObjRec*, char*)); - extern void RecordOvalToBuffer ARGS_DECL((struct ObjRec*, char*)); - extern void RecordTextToBuffer ARGS_DECL((struct ObjRec*, char*)); - extern void RecordArcToBuffer ARGS_DECL((struct ObjRec*, char*)); - extern void RecordPolygonToBuffer ARGS_DECL((struct ObjRec*, char*)); - extern void RecordGroupToBuffer ARGS_DECL((struct ObjRec*, char*, int)); - extern void RecordRCBoxToBuffer ARGS_DECL((struct ObjRec*, char*)); - extern void SaveAttrsToBuff ARGS_DECL((char*, struct AttrRec*)); - extern void SaveAttrToBuff ARGS_DECL((char*, struct AttrRec*)); - extern void SaveStringToBuff ARGS_DECL((char*, char*)); - extern void SaveTextObjToBuff ARGS_DECL((char*, struct ObjRec*)); - extern int ReadAttrFromBuff ARGS_DECL((char*, struct AttrRec**)); - extern void CopyObj ARGS_DECL((struct ObjRec*, struct ObjRec*)); - #ifdef _INCLUDE_FROM_WB2_C_ #undef extern --- 17,20 ---- *** wb3.e.orig Wed May 19 10:28:23 1999 --- wb3.e Wed May 19 10:28:23 1999 *************** *** 2,3 **** --- 2,5 ---- * Author: Renato Santana, in Januray, 1996. * + * (Obsoleted in tgif-4.1.9 by the TangramII group at land.ufrj.br.) + * *************** *** 15,27 **** #endif /*_INCLUDE_FROM_WB3_C_*/ - extern void ReadPoly ARGS_DECL((char*, struct ObjRec**)); - extern void ReadPolygon ARGS_DECL((char*, struct ObjRec**)); - extern int ReadSmoothHingeFromBuff ARGS_DECL((char*, int, int, char*)); - extern void ReadText ARGS_DECL((char*, struct ObjRec**)); - extern void AddStrRec ARGS_DECL((struct StrRec*, struct StrRec*, - struct StrRec*)); - extern void SaveToBuffer ARGS_DECL((char*, struct ObjRec*, int, int)); - extern void ReadGroup ARGS_DECL((char*, int, struct ObjRec**)); - #ifdef _INCLUDE_FROM_WB3_C_ #undef extern --- 17,20 ---- *** cmdids.h.orig Wed May 19 10:28:24 1999 --- cmdids.h Wed May 19 10:28:24 1999 *************** *** 359,364 **** #define CMDID_EXPORTTHRESHOLDBITMAP 406 #define CMDID_SETEXPORTBITMAPTHRESHOLD 407 ! #define MAXCMDIDS 408 #endif /*_CMDIDS_H_*/ --- 359,366 ---- #define CMDID_EXPORTTHRESHOLDBITMAP 406 #define CMDID_SETEXPORTBITMAPTHRESHOLD 407 + #define CMDID_PRECISESCALEEVERYTHING 408 + #define CMDID_SETPAPERCOLOR 409 ! #define MAXCMDIDS 410 #endif /*_CMDIDS_H_*/ *** const.h.orig Wed May 19 10:28:26 1999 --- const.h Wed May 19 10:28:26 1999 *************** *** 204,207 **** --- 204,211 ---- #define GetPinObj(ObjPtr) ((ObjPtr)->detail.r->pin_connected ? \ (ObjPtr)->detail.r->last : (ObjPtr)->detail.r->first) + #define GetTextObjFirstStrSeg(ObjPtr) \ + ((ObjPtr)->detail.t->minilines.first->first_block->seg) + #define GetTextPtrFirstStrSeg(TextPtr) \ + ((TextPtr)->minilines.first->first_block->seg) #define MAXSTRING 256 *************** *** 925,928 **** --- 929,938 ---- #define TGO_USER 4 + /* break up text stuff */ + + #define BREAK_CHAR 0 + #define BREAK_WORD 1 + #define BREAK_LINE 2 + /* choose a file stuff */ *** patchlvl.h.orig Wed May 19 10:28:27 1999 --- patchlvl.h Wed May 19 10:28:27 1999 *************** *** 35,39 **** #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 8 #endif /*_TGIF_PATCHLEVEL_H_*/ --- 35,39 ---- #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 9 #endif /*_TGIF_PATCHLEVEL_H_*/ *** types.h.orig Wed May 19 10:28:28 1999 --- types.h Wed May 19 10:28:28 1999 *************** *** 95,99 **** XPoint rotated_obbox[5]; /* offsets */ void * userdata; ! char * creator_full_id; /* NULL means created locally */ } * ObjRecPtr; --- 95,101 ---- XPoint rotated_obbox[5]; /* offsets */ void * userdata; ! /* for the multicast whiteboard */ ! char *creator_full_id; /* NULL means created locally */ ! int unavailable; /* involved in a long transaction of some sort */ } * ObjRecPtr; *************** *** 201,204 **** --- 203,212 ---- } * OvalRecPtr; + typedef struct KeyValRec { + char *key; + char *value; + struct KeyValRec *next, *prev; + } KeyValInfo; + typedef struct StrRec { struct DynStrRec dyn_str; *************** *** 345,350 **** typedef struct CmdRec { ! int type, dx, dy, undone, include_tgif_obj, new_colormap; ! int * pos_before, count_before; int * pos_after, count_after; struct SelRec * top_before, * bot_before; --- 353,360 ---- typedef struct CmdRec { ! int type, dx, dy, undone; ! int include_tgif_obj, new_colormap, logical_clock; ! char * sender_process_id; ! int * pos_before, count_before, pos_before_has_ids; int * pos_after, count_after; struct SelRec * top_before, * bot_before; *************** *** 354,361 **** /* * if serialized is TRUE, pos_before should be typecasted to (char**) ! * and each entry is which is "id", "\t", ! * "creator_pid", "\t", and "creator_ip" concatenated together. */ ! int serialized, *actual_pos_before; int playback; } * CmdRecPtr; --- 364,372 ---- /* * if serialized is TRUE, pos_before should be typecasted to (char**) ! * and each entry is which is "id", "/", ! * "creator_pid", ":", and "creator_ip" concatenated together. */ ! int serialized; ! int first_redo_after_deserialize; int playback; } * CmdRecPtr; *** Makefile.noimake.orig Wed May 19 10:28:29 1999 --- Makefile.noimake Wed May 19 10:28:29 1999 *************** *** 103,107 **** # Include the above line if you want to enable NLS (Native Language # Support). ! #-D_DONT_USE_PORTABLE_LOCALE # Include the above line if don't want to use the portable locale. # (Portable locale is "C" for all locale categories.) --- 103,107 ---- # Include the above line if you want to enable NLS (Native Language # Support). ! #-D_DONT_USE_PORTABLE_LOCALE (obsoleted) # Include the above line if don't want to use the portable locale. # (Portable locale is "C" for all locale categories.) *************** *** 156,163 **** # Tangram-II team of the Universidade Federal do Rio de Janeiro. These # features are under development and highly experimental. ! #-D_TGIF_WB # Include the above line if you want to include the whiteboard feature ! # by Renato Santana . This flag is being ! # obsoleted by the people at ufrj.br. Please do not use it for tgif-4.x. #-D_TGIF_WB2 # Include the above line if you want to include the whiteboard feature --- 156,162 ---- # Tangram-II team of the Universidade Federal do Rio de Janeiro. These # features are under development and highly experimental. ! #-D_TGIF_WB (obsoleted) # Include the above line if you want to include the whiteboard feature ! # by Renato Santana . #-D_TGIF_WB2 # Include the above line if you want to include the whiteboard feature *************** *** 196,199 **** --- 195,201 ---- # systems, if you see garbage file names when you try to open files, # try this flag to make direct and dirent equivalent (in ). + #-D_NO_RAND48 + # Include the above line in the DEFINES if you do not have the + # srand48() or drand48() functions in your system's library. #-DNO_STRSTR # Include the above line in the DEFINES if you do not have the strstr() *** Imakefile.orig Wed May 19 10:28:30 1999 --- Imakefile Wed May 19 10:28:30 1999 *************** *** 53,57 **** $(MOREDEFINES) ! TGIFVERSION = 4.1.8 XCOMM Things to try to add to the DEFINES line above: --- 53,57 ---- $(MOREDEFINES) ! TGIFVERSION = 4.1.9 XCOMM Things to try to add to the DEFINES line above: *************** *** 70,74 **** XCOMM Include the above line if you want to enable NLS (Native Language XCOMM Support). ! XCOMM -D_DONT_USE_PORTABLE_LOCALE XCOMM Include the above line if you don't want to use the portable locale. XCOMM (Portable locale is "C" for all locale categories.) --- 70,74 ---- XCOMM Include the above line if you want to enable NLS (Native Language XCOMM Support). ! XCOMM -D_DONT_USE_PORTABLE_LOCALE (obsoleted) XCOMM Include the above line if you don't want to use the portable locale. XCOMM (Portable locale is "C" for all locale categories.) *************** *** 123,130 **** XCOMM Tangram-II team of the Universidade Federal do Rio de Janeiro. These XCOMM features are under development and highly experimental. ! XCOMM -D_TGIF_WB XCOMM Include the above line if you want to include the whiteboard feature ! XCOMM by Renato Santana . This flag is being ! XCOMM obsoleted by the people at ufrj.br. Please do not use it for tgif-4.x. XCOMM -D_TGIF_WB2 XCOMM Include the above line if you want to include the whiteboard feature --- 123,129 ---- XCOMM Tangram-II team of the Universidade Federal do Rio de Janeiro. These XCOMM features are under development and highly experimental. ! XCOMM -D_TGIF_WB (obsoleted) XCOMM Include the above line if you want to include the whiteboard feature ! XCOMM by Renato Santana . XCOMM -D_TGIF_WB2 XCOMM Include the above line if you want to include the whiteboard feature *************** *** 163,166 **** --- 162,168 ---- XCOMM systems, if you see garbage file names when you try to open files, XCOMM try this flag to make direct and dirent equivalent (in ). + XCOMM -D_NO_RAND48 + XCOMM Include the above line in the DEFINES if you do not have the + XCOMM srand48() or drand48() functions in your system's library. XCOMM -DNO_STRSTR XCOMM Include the above line in the DEFINES if you do not have the strstr() *** tgif.man.orig Wed May 19 10:28:32 1999 --- tgif.man Wed May 19 10:28:32 1999 *************** *** 9,13 **** .\" .\" ! .TH tgif n "Version 4.1 Patchlevel 5 and Above" "Tgif" .\" .SH NAME --- 9,13 ---- .\" .\" ! .TH tgif n "Version 4.1 Patchlevel 9 and Above" "Tgif" .\" .SH NAME *************** *** 60,64 **** [\fB-gray\fR] [\fB-color | -reqcolor\fR] ! [\fB-adobe\fR | -adobe=/] [\fB-page \fR] [\fB-print_cmd ""\fR] --- 60,64 ---- [\fB-gray\fR] [\fB-color | -reqcolor\fR] ! [\fB-adobe | -adobe=/ | -adobe=false \fR] [\fB-page \fR] [\fB-print_cmd ""\fR] *************** *** 246,250 **** (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. --- 246,250 ---- (see the X DEFAULTS section below). .TP ! .B -adobe \fR(or\fB -adobe=/ -adobe=false\fR)\fB Using this option has the same effect as specifying the Tgif.UsePsAdobeString X default. *************** *** 564,572 **** .I Canvas Window This is the drawing area. The effects of the actions of the mouse are ! determined by the current drawing mode. Normally, dragging the right mouse ! button will generate the Mode Menu. The drawing modes are (in order, as they appear in the Mode Menu) select, text, rectangle, ! oval, polyline (open-spline), polygon (closed-spline), ! arc, rounded-corner rectangle, freehand polyline (open-spline), select vertices, and rotate/shear. When drawing a rectangle, an oval, or a rounded-corner --- 564,579 ---- .I Canvas Window This is the drawing area. The effects of the actions of the mouse are ! determined by the current drawing mode. Before tgif-4.x, ! dragging the right mouse button will generate the Mode Menu. ! This is disabled by default in tgif-4.x, but you can turn it on using ! the Tgif.Btn3PopupModeMenu X default. ! .PP ! .RS ! The drawing modes are (in order, as they appear in the Mode Menu) select, text, rectangle, ! corner oval, center oval, edge circle, ! polyline (open-spline), polygon (closed-spline), ! arc (center first), arc (endpoints first), rounded-corner rectangle, ! freehand polyline (open-spline), select vertices, and rotate/shear. When drawing a rectangle, an oval, or a rounded-corner *************** *** 574,577 **** --- 581,585 ---- key is held down, a square, a circle, or a rounded-corner square is drawn. Dragging the middle mouse button will generate the Main Menu. + .RE .PP .RS *************** *** 605,609 **** is being performed). In non-stretchable text mode, text objects can not be stretched or scaled. ! Clicking the middle mouse button while the key is held down will activate the \fIteleport\fR (or \fItravel\fR), the \fIlaunch\fR, --- 613,620 ---- is being performed). In non-stretchable text mode, text objects can not be stretched or scaled. ! .RE ! .PP ! .RS ! Double-clicking or clicking the middle mouse button while the key is held down will activate the \fIteleport\fR (or \fItravel\fR), the \fIlaunch\fR, *************** *** 612,615 **** --- 623,632 ---- Teleporting has precedence over launching, which has precedence over executing an internal command. + In the text drawing mode, dragging the middle mouse button + while the key is held down inside the edit text area + will move the edit text area. + .RE + .PP + .RS The arrow keys can also be used to move selected objects. However, if no objects *************** *** 693,697 **** All intermediate points are specified by moving the mouse (as opposed to clicking the mouse buttons as in the polyline mode). The ! second end point is specified by releasing the mouse button. .RE .PP --- 710,714 ---- All intermediate points are specified by moving the mouse (as opposed to clicking the mouse buttons as in the polyline mode). The ! second endpoint is specified by releasing the mouse button. .RE .PP *************** *** 1216,1220 **** Tgif provides the mechanism to travel between .obj and .sym files. If the middle mouse button is clicked on an object with the ! key held down, tgif looks for an attribute named \fIwarp_to\fR (by default) or \fIhref\fR of that object. The only difference between \fIwarp_to\fR and \fIhref\fR is that --- 1233,1238 ---- Tgif provides the mechanism to travel between .obj and .sym files. If the middle mouse button is clicked on an object with the ! key held down (or double-clicking such an object), tgif ! looks for an attribute named \fIwarp_to\fR (by default) or \fIhref\fR of that object. The only difference between \fIwarp_to\fR and \fIhref\fR is that *************** *** 1261,1265 **** Tgif provides the mechanism to launch applications. If the middle mouse button is clicked on an object with the ! key held down, tgif looks for an attribute named \fIlaunch\fR (by default) of that object. If such an attribute is found, the value part of --- 1279,1283 ---- Tgif provides the mechanism to launch applications. If the middle mouse button is clicked on an object with the ! key held down (or double-clicking such an object), tgif looks for an attribute named \fIlaunch\fR (by default) of that object. If such an attribute is found, the value part of *************** *** 1300,1304 **** Tgif provides the mechanism to execute internal commands. If the middle mouse button ! is clicked on an object with the key held down, tgif looks for an attribute named \fIexec\fR (by default) of that object. If such an attribute is found, the value part of the attribute is interpreted as --- 1318,1323 ---- Tgif provides the mechanism to execute internal commands. If the middle mouse button ! is clicked on an object with the key held down ! (or double-clicking such an object), tgif looks for an attribute named \fIexec\fR (by default) of that object. If such an attribute is found, the value part of the attribute is interpreted as *************** *** 1647,1650 **** --- 1666,1678 ---- The bounding box is computed assuming that all lines are of width 0. .TP + .I get_named_obj_bbox(,,,,) + This command stores the absolute coordinate of the bounding box + of the object named in the specified attributes. + stores the left-top X coordinate, + stores the left-top Y coordinate, + stores the right-bottom X coordinate, and + stores the right-bottom Y coordinate. + The bounding box is computed assuming that all lines are of width 0. + .TP .I move_selected_obj_absolute(,) This command moves left-top corner of the selected object to (,). *************** *** 1746,1749 **** --- 1774,1781 ---- so that its width becomes and height becomes . .TP + .I size_named_obj_absolute(,,) + This command stretches the right-bottom corner of the object named + so that its width becomes and height becomes . + .TP .I message_box(,,,<style>) This command displays a messagebox with <title> as the title and <msg> *************** *** 2161,2165 **** .TP .I create_edge_oval_obj(<abs_ltx>,<abs_lty>,<abs_rbx>,<abs_rby>) ! This command creates an edge oval defined by (<abs_ltx>,<abs_lty>) and (<abs_rbx>,<abs_rby>). .TP --- 2193,2197 ---- .TP .I create_edge_oval_obj(<abs_ltx>,<abs_lty>,<abs_rbx>,<abs_rby>) ! This command creates an edge circle defined by (<abs_ltx>,<abs_lty>) and (<abs_rbx>,<abs_rby>). .TP *************** *** 2215,2218 **** --- 2247,2259 ---- This command groups all objects created since the last start_create_group_obj() call into a grouped object. + .TP + .I set_allow_interrupt(<true_or_false>) + If <true_or_false> is \fIFALSE\fR (case-sensitive), + this command is used to temporarily disable an user interrupt when tgif + is executing internal commands. If a user interrupt is received + when interrupt is disabled, it will be queued and will interrupt + the execution of internal commands when + set_allow_interrupt() is called again with <true_or_false> being \fITRUE\fR + (case-sensitive). .\" .SH ARITHMETIC EXPRESSIONS *************** *** 2463,2466 **** --- 2504,2565 ---- must be present). The font name prefix (please see Tgif.FontNamePrefix entry in the X DEFAULTS section) is also ignored. + + Sometimes, different encodings of the same PS font is needed. + This can be accomplished with the Tgif.PSFontAliases and + Tgif.DontReencode X defaults. + For example, if one wants to use the adobe-fontspecific encoding + of the Utopia font (instead of ISO-Latin-1), one can use the following + X defaults: + .PP + Tgif.AdditionalFonts: \\n\\ + .br + utopia-medium-r-normal \\n\\ + .br + adobe-fontspecific \\n\\ + .br + UtopiaFS-Regular \\n\\ + .br + \\n\\ + .br + utopia-bold-r-normal \\n\\ + .br + adobe-fontspecific \\n\\ + .br + UtopiaFS-Bold \\n\\ + .br + \\n\\ + .br + utopia-medium-i-normal \\n\\ + .br + adobe-fontspecific \\n\\ + .br + UtopiaFS-Italic \\n\\ + .br + \\n\\ + .br + utopia-bold-i-normal \\n\\ + .br + adobe-fontspecific \\n\\ + .br + UtopiaFS-BoldItalic + .br + Tgif.PSFontAliases: \\n\\ + .br + UtopiaFS-Regular=Utopia-Regular \\n\\ + .br + UtopiaFS-Bold=Utopia-Bold \\n\\ + .br + UtopiaFS-Italic=Utopia-Italic \\n\\ + .br + UtopiaFS-BoldItalic=Utopia-BoldItalic + .br + Tgif.DontReencode: UtopiaFS + .br + .PP + In the above example, a fake PS font name prefix of UtopiaFS is + used to represent the adobe-fontspecific encoding of the Utopia + font. Tgif.PSFontAliases maps the fake PS font names to their + real PS font names and Tgif.DontReencode tells tgif that do not + use ISO-Latin-1 reencodings for the specified font (or list of fonts). .\" .SH SQUARE DOUBLE BYTE FONTS *************** *** 3458,3465 **** If set to ``true'', the first line in the PS or EPS file will be "%!PS-Adobe-2.0 EPSF-1.2". If set to ``false'', it is just "%!". If the third form is used,, the first line will be "%!PS-Adobe-NUMBER_1 EPSF-NUMBER_2". ! The default is false. The PS-Adobe string might confuse Transcript, ! but it is needed to work with groff. .TP .I Tgif.HalfToneBitmap: [true,false] --- 3557,3566 ---- If set to ``true'', the first line in the PS or EPS file will be "%!PS-Adobe-2.0 EPSF-1.2". If set to ``false'', it is just "%!". + If the PS-Adobe string confuses the document + manager (such as Transcript) on your site, you should set it to + ``false''. If the third form is used,, the first line will be "%!PS-Adobe-NUMBER_1 EPSF-NUMBER_2". ! The default is true. .TP .I Tgif.HalfToneBitmap: [true,false] *************** *** 3573,3577 **** .I Tgif.InitialPrintInColor: [true,false] If set to ``true'', color output (printing) mode is enabled on startup. ! The default is false. .TP .I Tgif.InitialShowGrid: [true,false] --- 3674,3682 ---- .I Tgif.InitialPrintInColor: [true,false] If set to ``true'', color output (printing) mode is enabled on startup. ! Please note that in black and white PS/EPS/EPSI printing mode, the ! \fIwhite\fR color will be be printed as black (only \fIbackground\fR ! will be printed as white). ! The default is true (except when the \fB-print\fR command line option ! is used). .TP .I Tgif.InitialShowGrid: [true,false] *************** *** 3679,3683 **** If set to ``true'', the paper size information stored in a just opened file is used. ! The default is false. .TP .I Tgif.OneMotionSelMove: [true,false] --- 3784,3788 ---- If set to ``true'', the paper size information stored in a just opened file is used. ! The default is true. .TP .I Tgif.OneMotionSelMove: [true,false] *************** *** 4018,4022 **** .I Tgif.StretchableText: [true,false] If set to ``true'', stretchable text mode is the initial mode. ! The default is false. .TP .I Tgif.EditTextSize: NUMBER --- 4123,4127 ---- .I Tgif.StretchableText: [true,false] If set to ``true'', stretchable text mode is the initial mode. ! The default is true. .TP .I Tgif.EditTextSize: NUMBER *************** *** 4097,4100 **** --- 4202,4206 ---- For example, if STRING is "Times:Courier:Helvetica", PostScript fonts that begins with "Times", "Courier", or "Helvetica" will not be reencoded. + Please also see the ADDITIONAL FONTS section for an example. .TP .I Tgif.UnsignedInXBmExport: [true,false] *************** *** 4155,4158 **** --- 4261,4269 ---- <URL:http://www.lcdf.org/gifsicle/>. .TP + .I Tgif.Btn3PopupModeMenu: [true,false] + If set to ``true'', pressing the right mouse button in the canvas window + will generate the Mode Menu. + The default is false. + .TP .I Tgif.ScriptFraction: NUMBER This specifies the size of the super/subscript relative to the size *************** *** 4259,4262 **** --- 4370,4389 ---- This X default is only used if tgif is compiled with the _ENABLE_NLS compiler option. The STRING specifies a full path name of a locale directory. + .TP + .I Tgif.PsRegMarksInTiledPageMode: [true,false] + If set to ``true'', small crosshairs will be drawn at the + corners defining the clipping regions when printing/exporting + PS/EPS files in the tiled page mode. The greyness of the cross + hairs will be determined by the Tgif.PsRegMarksGray X default. + The default is false. + .TP + .I Tgif.PsRegMarksGray: NUMBER + This specifies the greyness of the crosshairs used when + Tgif.PsRegMarksInTiledPageMode is set to true. + The default value is 0.95 + .TP + .I Tgif.PSFontAliases: PSFONTALIAS_SPEC1 PSFONTALIAS_SPEC2 ... + Font aliases can be used to represent different encoding, etc. + Please see the ADDITIONAL FONTS section for details. .\" .SH ENVIRONMENT VARIABLE *** HISTORY.orig Wed May 19 10:28:35 1999 --- HISTORY Wed May 19 10:28:35 1999 *************** *** 1,2 **** --- 1,55 ---- + -----------------------> tgif-4.1.8 => tgif-4.1.9 <----------------------- + Here's a short list of added features/bug fixes. + + 1) Fix a bug in handling the importing of PS files generated by xv. Thanks + to Michal Bulik <mbulik@mecalog.fr> for pointing out the problem. + 2) Fix locale bugs. Thanks to Atsushi Shimizu + <shimizu@nttvdt.hil.ntt.co.jp> for pointing out the problems. + 3) Fix a bug with "-print -gif". Thanks to David Richerby + <David.Richerby@cl.cam.ac.uk> for pointing out the problem. + 4) Fix a bug in printing/exporting condensed PS/EPS files when the drawing + contains certain EPS files (such as the ones generated by Adobe + Illustrator). Thanks to Ambrose Li <acli@mingpaoxpress.com> + for the patch. + 5) Fix a memory hogging bug when objects are moved. Thanks to Robert Schwebel + <r.schwebel@tu-bs.de> for pointing out the problem and Jason White + <jdwhite@iastate.edu> for looking into the problem. + 6) Fix a bug in the File Open dialogbox that if SetDir is pressed when + something is selected, a bad directory name is used. Thanks to + Andreas Scherbaum <ads@htl.de> for pointing out the problem. + 7) Fix a bug so that the actual directory will be used when the user + select "../" from a file dialogbox. Thanks to + Andreas Scherbaum <ads@htl.de> for pointing out the problem. + 8) Fix bugs with panning using <Cntrl><Shift><Btn2> and zooming using + <Cntrl><Shift><Btn3>. Thanks to Kyle Bateman + <kyle@actarg.com> for pointing out the problems. + 9) When in the edit text mode, dragging <Cntrl><Btn2>, will now move the + edit text (but not the object being edited). Thanks to + Shinichiro Shiratake <shinichiro.shiratake@toshiba.co.jp> for + pointing out the problem with editing text at the left or top edge + of the paper. + 10) Allow text objects to be broken into lines in BreakUpText(). + 11) Set the default stretchable text mode to TRUE. + 12) Set the default value of Tgif.UsePaperSizeStoredInFile to TRUE. + 13) Set the default print-in-color mode to TRUE (when the "-print" command + line option is not used). + 14) Remove the concept of a current import directory. + 15) New Tgif.tmpl-os2 for OS/2. Also fix some OS/2 dependent stuff. Thanks + to Alexander Mai <st002279@hrzpub.tu-darmstadt.de> for the patch. + 16) Add new X defaults, Tgif.PsRegMarksInTiledPageMode and Tgif.PsRegMarksGray + to draw small crosshairs at the corners defining the clipping regions when + printing/exporting PS/EPS files in the tiled page mode. + 17) Add a new X default, Tgif.PSFontAliases to allow fake font names in + Tgif.AdditionalFonts. Using this X default, different encodings of + the same PS font can be used. Please see the ADDITIONAL FONTS section + of the mane pages for details. Thanks to Johan Vromans + <JVromans@squirrel.nl> for many helpful suggestions. + 18) Add the following new internal command: + + set_allow_interrupt(<true_or_false>) + size_named_obj_absolute(<obj_name>,<abs_w>,<abs_h>) + get_named_obj_bbox(<obj_name>,<ltx_attr>,<lty_attr>,<rbx_attr>, + <rby_attr>) + -----------------------> tgif-4.1.7 => tgif-4.1.8 <----------------------- Here's a short list of added features/bug fixes. *** tgif.Xdefaults.orig Wed May 19 10:28:36 1999 --- tgif.Xdefaults Wed May 19 10:28:36 1999 *************** *** 305,309 **** Tgif.PSA4PaperSize: false Tgif.ShapeShadowSpec: 2,2 ! Tgif.StretchableText: false Tgif.EditTextSize: 0 !Tgif.EditTextSize: 14 --- 305,309 ---- Tgif.PSA4PaperSize: false Tgif.ShapeShadowSpec: 2,2 ! Tgif.StretchableText: true Tgif.EditTextSize: 0 !Tgif.EditTextSize: 14 *************** *** 408,409 **** --- 408,419 ---- !Tgif.MenuFontSet: a14,k14,r14 !Tgif.LocaleDir: /usr/share/lib + ! + ! Added in version 4.1.9 + ! + Tgif.PsRegMarksInTiledPageMode: false + Tgif.PsRegMarksGray: 0.95 + Tgif.PSFontAliases: \n\ + UtopiaSE-Regular=Utopia-Regular \n\ + UtopiaSE-Bold=Utopia-Bold \n\ + UtopiaSE-Italic=Utopia-Italic \n\ + UtopiaSE-BoldItalic=Utopia-BoldItalic *** make.comdep.orig Wed May 19 10:28:37 1999 --- make.comdep Wed May 19 10:28:37 1999 *************** *** 29,33 **** color.e cursor.e cutpaste.e dialog.e drawing.e file.e font.e \ miniline.e msg.e obj.e pattern.e prtgif.e ps.e raster.e \ ! rect.e setup.e text.e util.e xbitmap.e xpixmap.e box$(O) : tgifdefs.h const.h tgif_dbg.h types.h attr.e auxtext.e box.e \ cmd.e color.e cursor.e cutpaste.e file.e grid.e mainloop.e \ --- 29,33 ---- color.e cursor.e cutpaste.e dialog.e drawing.e file.e font.e \ miniline.e msg.e obj.e pattern.e prtgif.e ps.e raster.e \ ! rect.e setup.e select.e text.e util.e xbitmap.e xpixmap.e box$(O) : tgifdefs.h const.h tgif_dbg.h types.h attr.e auxtext.e box.e \ cmd.e color.e cursor.e cutpaste.e file.e grid.e mainloop.e \ *************** *** 224,230 **** auxtext.e button.e cmd.e choice.e choose.e color.e cursor.e \ dialog.e drawing.e file.e font.e grid.e mark.e mainloop.e \ ! mainmenu.e menu.e menuinfo.e move.e msg.e names.e obj.e \ ! page.e raster.e rect.e scroll.e select.e setup.e stk.e text.e \ ! util.e xprtfltr.e $(XBM)leftend.xbm pattern$(O) : tgifdefs.h const.h tgif_dbg.h types.h cmdids.h arc.e choice.e \ color.e cmd.e cutpaste.e dialog.e drawing.e file.e font.e \ --- 224,230 ---- auxtext.e button.e cmd.e choice.e choose.e color.e cursor.e \ dialog.e drawing.e file.e font.e grid.e mark.e mainloop.e \ ! mainmenu.e menu.e menuinfo.e move.e msg.e names.e navigate.e \ ! obj.e page.e raster.e rect.e scroll.e select.e setup.e stk.e \ ! text.e util.e wb.e xpixmap.e xprtfltr.e $(XBM)leftend.xbm pattern$(O) : tgifdefs.h const.h tgif_dbg.h types.h cmdids.h arc.e choice.e \ color.e cmd.e cutpaste.e dialog.e drawing.e file.e font.e \ *************** *** 336,347 **** setup.e stk.e stretch.e util.e setup$(O) : tgifdefs.h const.h tgif_dbg.h types.h cmdids.h expfdefs.h \ ! attr.e auxtext.e choice.e cmd.e color.e cursor.e cutpaste.e \ ! dialog.e drawing.e dup.e edit.e exec.e file.e font.e grid.e \ ! help.e imgproc.e import.e inmethod.e mainloop.e mainmenu.e \ ! mark.e menu.e miniline.e move.e msg.e names.e navigate.e \ ! nkf.e page.e pattern.e pin.e poly.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 tangram2.e text.e util.e version.e wb.e \ ! xbitmap.e xpixmap.e xprtfltr.e tgificon.xbm $(XBM)btn1.xbm shape$(O) : tgifdefs.h const.h tgif_dbg.h types.h cmdids.h arc.e attr.e \ auxtext.e box.e cmd.e color.e cursor.e dialog.e drawing.e \ --- 336,348 ---- setup.e stk.e stretch.e util.e setup$(O) : tgifdefs.h const.h tgif_dbg.h types.h cmdids.h expfdefs.h \ ! attr.e auxtext.e choice.e choose.e cmd.e color.e cursor.e \ ! cutpaste.e dialog.e drawing.e dup.e edit.e exec.e file.e \ ! font.e grid.e help.e imgproc.e import.e inmethod.e mainloop.e \ ! mainmenu.e mark.e menu.e miniline.e move.e msg.e names.e \ ! navigate.e nkf.e page.e pattern.e pin.e poly.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 tangram2.e text.e util.e version.e \ ! wb.e xbitmap.e xpixmap.e xprtfltr.e tgificon.xbm \ ! $(XBM)btn1.xbm shape$(O) : tgifdefs.h const.h tgif_dbg.h types.h cmdids.h arc.e attr.e \ auxtext.e box.e cmd.e color.e cursor.e dialog.e drawing.e \ *************** *** 365,369 **** names.e navigate.e obj.e page.e pattern.e raster.e rect.e \ ruler.e scroll.e select.e setup.e stk.e text.e util.e \ ! version.e stream$(O) : tgifdefs.h const.h tgif_dbg.h types.h dialog.e drawing.e \ file.e http.e import.e menu.e move.e msg.e navigate.e obj.e \ --- 366,370 ---- names.e navigate.e obj.e page.e pattern.e raster.e rect.e \ ruler.e scroll.e select.e setup.e stk.e text.e util.e \ ! version.e wb.e stream$(O) : tgifdefs.h const.h tgif_dbg.h types.h dialog.e drawing.e \ file.e http.e import.e menu.e move.e msg.e navigate.e obj.e \ *************** *** 371,377 **** stretch$(O) : tgifdefs.h const.h tgif_dbg.h types.h align.e arc.e auxtext.e \ choice.e cmd.e color.e cursor.e dialog.e drawing.e dup.e \ ! exec.e font.e grid.e mainloop.e mark.e miniline.e move.e \ ! msg.e obj.e poly.e raster.e rect.e ruler.e select.e setup.e \ ! spline.e stretch.e text.e util.e xbitmap.e xpixmap.e tangram2$(O) : tgifdefs.h const.h tgif_dbg.h types.h dialog.e exec.e menu.e \ msg.e obj.e select.e tangram2.e util.e --- 372,379 ---- stretch$(O) : tgifdefs.h const.h tgif_dbg.h types.h align.e arc.e auxtext.e \ choice.e cmd.e color.e cursor.e dialog.e drawing.e dup.e \ ! exec.e file.e font.e grid.e mainloop.e mark.e menu.e \ ! miniline.e move.e msg.e obj.e page.e poly.e raster.e rect.e \ ! ruler.e scroll.e select.e setup.e spline.e stretch.e text.e \ ! util.e xbitmap.e xpixmap.e tangram2$(O) : tgifdefs.h const.h tgif_dbg.h types.h dialog.e exec.e menu.e \ msg.e obj.e select.e tangram2.e util.e *************** *** 385,389 **** move.e msg.e names.e nkf.e 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 xbitmap.e xpixmap.e $(XBM)text_cur.xbm tgif$(O) : tgifdefs.h 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 --- 387,391 ---- move.e msg.e names.e nkf.e 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 wb.e xbitmap.e xpixmap.e $(XBM)text_cur.xbm tgif$(O) : tgifdefs.h 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 *************** *** 394,400 **** vms_comp$(O) : vms_comp.h wb$(O) : tgifdefs.h const.h tgif_dbg.h types.h auxtext.e drawing.e \ ! cmd.e dialog.e file.e grid.e http.e mark.e msg.e obj.e \ ! remote.e select.e setup.e stk.e tcp.e util.e wb.e wb_buff.e \ ! wb_mcast.e wb1$(O) : tgifdefs.h const.h tgif_dbg.h types.h wb2$(O) : tgifdefs.h const.h tgif_dbg.h types.h --- 396,402 ---- vms_comp$(O) : vms_comp.h wb$(O) : tgifdefs.h const.h tgif_dbg.h types.h auxtext.e drawing.e \ ! choice.e cmd.e dialog.e file.e grid.e http.e mark.e menu.e \ ! msg.e obj.e page.e remote.e select.e setup.e stk.e tcp.e \ ! util.e wb.e wb_buff.e wb_mcast.e wb1$(O) : tgifdefs.h const.h tgif_dbg.h types.h wb2$(O) : tgifdefs.h const.h tgif_dbg.h types.h *** Tgif.tmpl-hpux.orig Wed May 19 10:28:38 1999 --- Tgif.tmpl-hpux Wed May 19 10:28:38 1999 *************** *** 73,76 **** --- 73,77 ---- XCOMM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ XCOMM XCOMM This file has been tested under (uname -s -r -m): XCOMM + XCOMM HP-UX A.09.05 9000/715 XCOMM XCOMM HP-UX A.09.07 9000/735 XCOMM XCOMM HP-UX B.10.20 9000/735 XCOMM *** Tgif.tmpl-os2.orig Wed May 19 10:28:39 1999 --- Tgif.tmpl-os2 Wed May 19 10:28:39 1999 *************** *** 0 **** --- 1,75 ---- + XCOMM + XCOMM Author: William Chia-Wei Cheng (william@cs.ucla.edu) + XCOMM + XCOMM Copyright (C) 1990-1999, William Chia-Wei Cheng. + XCOMM + XCOMM Permission limited to the use, copy, display, distribute without + XCOMM charging for a fee, and produce derivative works of "tgif" and + XCOMM its documentation for not-for-profit purpose is hereby granted by + XCOMM the Author, provided that the above copyright notice appears in + XCOMM all copies made of "tgif" and that both the copyright notice + XCOMM and this permission notice appear in supporting documentation, + XCOMM and that the name of the Author not be used in advertising or + XCOMM publicity pertaining to distribution of the software without + XCOMM specific, written prior permission. The Author makes no + XCOMM representations about the suitability of this software for any + XCOMM purpose. It is provided "as is" without express or implied + XCOMM warranty. All other rights (including, but not limited to, the + XCOMM right to sell "tgif", the right to sell or distribute derivative + XCOMM works of "tgif", the right to distribute "tgif" for a fee, and + XCOMM the right to include "tgif" or derivative works of "tgif" in a + XCOMM for-sale product) are reserved by the Author. + XCOMM + XCOMM THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + XCOMM EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR + XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + XCOMM PERFORMANCE OF THIS SOFTWARE. + XCOMM + XCOMM @(#)$Header: /mm/src/tgif/v4/RCS/Tgif.tmpl-os2,v 4.2 1999/04/24 21:06:13 william Exp $ + XCOMM + + #if ProjectX == 5 + #if BuildXimp + XIMPDEFINES = + #else + XIMPDEFINES = -D_NO_XIMP + #endif + #elif ProjectX > 5 + XIMPDEFINES = + #endif + + PROGRAMS = tgif XCOMM prtgif frontend11.o testdrive + XCOMM CDEBUGFLAGS= -g -Wall + XCOMM INSTPGMFLAGS= -s + XCOMM BINDIR = /u/halfmoon/bin + XCOMM MANPATH = /u/halfmoon/man + XCOMM TGIFDIR = /u/halfmoon/lib/X11/tgif + TGIFDIR = $(LIBDIR)/tgif + LOCALEDIR = /usr/share/locale + DIRDEFINES = -DTGIF_PATH=\"$(TGIFDIR)\" -DPSFILE_MOD=0664 \@@\ + -DLOCALEDIR=\"$(LOCALEDIR)\" \@@\ + -DTELEPORT_ATTR=\"warp_to=\" -DTMP_DIR=\"/tmp/\" \@@\ + -DLAUNCH_ATTR=\"launch=\" -DEXEC_ATTR=\"exec=\" + EXTDEFINES = -DEPSF_FILE_EXT=\"eps\" -DPS_FILE_EXT=\"ps\" \@@\ + -DXBM_FILE_EXT=\"xbm\" -DXPM_FILE_EXT=\"xpm\" \@@\ + -DOBJ_FILE_EXT=\"obj\" -DSYM_FILE_EXT=\"sym\" \@@\ + -DTEXT_FILE_EXT=\"txt\" -DPIN_FILE_EXT=\"pin\" + MISCDEFINES = -D_BACKGROUND_DONT_FORK -D_USE_XDRAWPOINT_TO_PUT_A_POINT + MOREDEFINES = -D_NO_DL_SUPPORT -D_NO_LOCALE_SUPPORT -D_NO_LSTAT -D_NO_RAND48 + + XCOMM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + XCOMM Please see Imakefile for more defines to be added to MOREDEFINES above + XCOMM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + DEPLIBS = $(DEPXLIB) + LOCAL_LIBRARIES = $(XLIB) + XCOMM LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) $(XLIB) + SYS_LIBRARIES = + + XCOMM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ XCOMM + XCOMM This file has been tested under (uname -s -r): XCOMM + XCOMM OS/2 4.0 XCOMM + XCOMM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ XCOMM *** Tgif.tmpl-solaris.orig Wed May 19 10:28:40 1999 --- Tgif.tmpl-solaris Wed May 19 10:28:40 1999 *************** *** 47,50 **** --- 47,57 ---- EXTRA_LIBRARIES = -lsocket -lnsl -lgen LDCOMBINEFLAGS = -r + XCOMM ----------------------------------------------- + XCOMM For gcc-2.7.2, you may need -lbind on solaris: + XCOMM CC = gcc -Wall + XCOMM PREPROCESSCMD = gcc -E $(STD_CPP_DEFINES) + XCOMM CCOPTIONS = + XCOMM EXTRA_LIBRARIES = -lsocket -lnsl -lgen -lbind + XCOMM ----------------------------------------------- PROGRAMS = tgif XCOMM prtgif frontend11.o testdrive