*** arc.c.orig Fri Aug 4 14:03:47 2000 --- arc.c Fri Aug 4 14:03:47 2000 *************** *** 1512,1517 **** } - static XComposeStatus c_stat; - static void HighLightInContinueArc(drawing_arc, OrigX, OrigY, saved_x, saved_y, --- 1512,1515 ---- *************** *** 1652,1663 **** input.type == KeyRelease) { 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); HighLightInContinueArc(drawing_arc, OrigX, OrigY, saved_x, --- 1650,1654 ---- input.type == KeyRelease) { if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { XUngrabPointer(mainDisplay, CurrentTime); HighLightInContinueArc(drawing_arc, OrigX, OrigY, saved_x, *** attr.c.orig Fri Aug 4 14:03:48 2000 --- attr.c Fri Aug 4 14:03:48 2000 *************** *** 254,258 **** for (ptr=AttrPtr; ptr != NULL; ptr=next_attr) { next_attr = ptr->next; ! FreeTextObj(ptr->obj); FreeAttr(ptr); } --- 254,258 ---- for (ptr=AttrPtr; ptr != NULL; ptr=next_attr) { next_attr = ptr->next; ! FreeObj(ptr->obj); FreeAttr(ptr); } *************** *** 1697,1701 **** MiniLinesInfo *minilines=(&attr_ptr1->obj->detail.t->minilines); ! tmp_buf = ConvertMiniLineToString(minilines->first, &need_to_free_tmp_buf); if ((attr_strings[i]=UtilStrDup(tmp_buf)) == NULL) FailAllocMessage(); --- 1697,1701 ---- MiniLinesInfo *minilines=(&attr_ptr1->obj->detail.t->minilines); ! tmp_buf = ConvertAttrNameFirstMiniLineToString(attr_ptr1, &need_to_free_tmp_buf); if ((attr_strings[i]=UtilStrDup(tmp_buf)) == NULL) FailAllocMessage(); *************** *** 2101,2105 **** } - static int BlankStr(s) char *s; --- 2101,2104 ---- *** box.c.orig Fri Aug 4 14:03:49 2000 --- box.c Fri Aug 4 14:03:49 2000 *************** *** 383,388 **** } - static XComposeStatus c_stat; - static void ContinueBox(OrigX, OrigY) --- 383,386 ---- *************** *** 473,483 **** 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); MyBox(drawWindow, drawGC, OrigX, OrigY, saved_x, saved_y); --- 471,475 ---- while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { XUngrabPointer(mainDisplay, CurrentTime); MyBox(drawWindow, drawGC, OrigX, OrigY, saved_x, saved_y); *** choice.c.orig Fri Aug 4 14:03:50 2000 --- choice.c Fri Aug 4 14:03:50 2000 *************** *** 991,995 **** if (topSel != NULL) { if (NewChoice == VERTEXMODE) { ! UnSelNonVertexObjs(TRUE); /* with highlight */ UpdSelBBox(); } else if (NewChoice != ROTATEMODE) { --- 991,995 ---- if (topSel != NULL) { if (NewChoice == VERTEXMODE) { ! UnSelNonVertexObjs(TRUE, TRUE); /* with highlight */ UpdSelBBox(); } else if (NewChoice != ROTATEMODE) { *************** *** 1069,1073 **** if (topSel != NULL) { if (NewChoice == VERTEXMODE) { ! UnSelNonVertexObjs(TRUE); /* with highlight */ UpdSelBBox(); } else if (NewChoice != NOTHING) { --- 1069,1073 ---- if (topSel != NULL) { if (NewChoice == VERTEXMODE) { ! UnSelNonVertexObjs(TRUE, TRUE); /* with highlight */ UpdSelBBox(); } else if (NewChoice != NOTHING) { *************** *** 1975,1980 **** for (i=0; i < MAXCHOICES; i++) { if (threeDLook) { ! values.stipple = choicePixmap[i]; values.ts_x_origin = x+windowPadding; values.ts_y_origin = y+windowPadding; --- 1975,1983 ---- for (i=0; i < MAXCHOICES; i++) { + Pixmap bitmap=((i==DRAWPOLY && connectingPortsByWire) ? wireBitmap : + choicePixmap[i]); + if (threeDLook) { ! values.stipple = bitmap; values.ts_x_origin = x+windowPadding; values.ts_y_origin = y+windowPadding; *************** *** 1997,2005 **** XFillRectangle(mainDisplay, modeWindow, textMenuGC, x+windowPadding, y+windowPadding, choiceImageW, choiceImageH); ! XSetStipple(mainDisplay, rvPixmapMenuGC, choicePixmap[i]); XFillRectangle(mainDisplay, modeWindow, rvPixmapMenuGC, x+windowPadding, y+windowPadding, choiceImageW, choiceImageH); } else { ! XSetStipple(mainDisplay, rasterGC, choicePixmap[i]); XFillRectangle(mainDisplay, modeWindow, rasterGC, x+windowPadding, y+windowPadding, choiceImageW, choiceImageH); --- 2000,2008 ---- XFillRectangle(mainDisplay, modeWindow, textMenuGC, x+windowPadding, y+windowPadding, choiceImageW, choiceImageH); ! XSetStipple(mainDisplay, rvPixmapMenuGC, bitmap); XFillRectangle(mainDisplay, modeWindow, rvPixmapMenuGC, x+windowPadding, y+windowPadding, choiceImageW, choiceImageH); } else { ! XSetStipple(mainDisplay, rasterGC, bitmap); XFillRectangle(mainDisplay, modeWindow, rasterGC, x+windowPadding, y+windowPadding, choiceImageW, choiceImageH); *** color.c.orig Fri Aug 4 14:03:50 2000 --- color.c Fri Aug 4 14:03:51 2000 *************** *** 165,168 **** --- 165,181 ---- } } + + void GetDrawingFgColorStr(index, pixel, color_buf, buf_sz) + int index, pixel, buf_sz; + char *color_buf; + { + if (index != INVALID && index != BACKPAT) { + UtilStrCpyN(color_buf, buf_sz, colorMenuItems[index]); + } else if (myFileBgColorStr == NULL || myFileFgColorStr == NULL) { + UtilStrCpyN(color_buf, buf_sz, myFgColorStr); + } else { + UtilStrCpyN(color_buf, buf_sz, myFileFgColorStr); + } + } struct LocalColorRec { *** cursor.c.orig Fri Aug 4 14:03:51 2000 --- cursor.c Fri Aug 4 14:03:51 2000 *************** *** 337,340 **** --- 337,346 ---- } + void SetHandCursor(window) + Window window; + { + XDefineCursor(mainDisplay, window, handCursor); + } + void SetDefaultCursor(window) Window window; *** cutpaste.c.orig Fri Aug 4 14:03:52 2000 --- cutpaste.c Fri Aug 4 14:03:52 2000 *************** *** 172,177 **** return TRUE; } ! sprintf(tmpfile, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmpfile); if ((fp=fopen(tmpfile, "w+")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANNOT_OPEN_FILE_FOR_WRITING), --- 172,176 ---- return TRUE; } ! MkTempFile(tmpfile, sizeof(tmpfile), tmpDir, TOOL_NAME); if ((fp=fopen(tmpfile, "w+")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANNOT_OPEN_FILE_FOR_WRITING), *************** *** 259,262 **** --- 258,263 ---- /* interpreted as an attempt to copy highlighted text */ { + int rc=TRUE, handle_edit_text_size=FALSE; + if (curChoice == DRAWTEXT) { if (!textHighlight) { *************** *** 267,273 **** --- 268,285 ---- Msg(TgLoadString(STID_ESC_KEY_PRESS_IGNORED)); } + if (editTextSize != 0) { + handle_edit_text_size = TRUE; + if (RestoreEditTextSize(curTextObj, TRUE)) { + UpdTextBBox(curTextObj); + } + } if (CanCopyHighLightedTextAsStrings()) { XEvent ev; + if (handle_edit_text_size && editTextSize != 0) { + if (RestoreEditTextSize(curTextObj, FALSE)) { + UpdTextBBox(curTextObj); + } + } copyInDrawTextMode = TRUE; ev.type = KeyPress; *************** *** 285,289 **** return TRUE; } ! return CopyObjectToCutBuffer(); } --- 297,307 ---- return TRUE; } ! rc = CopyObjectToCutBuffer(); ! if (handle_edit_text_size && editTextSize != 0) { ! if (RestoreEditTextSize(curTextObj, FALSE)) { ! UpdTextBBox(curTextObj); ! } ! } ! return rc; } *************** *** 311,316 **** } ! void PasteString(CutBuffer) char *CutBuffer; { char *c_ptr=NULL, *dest_c_ptr=NULL; --- 329,335 ---- } ! void PasteString(CutBuffer, highlight, record_cmd) char *CutBuffer; + int highlight, record_cmd; { char *c_ptr=NULL, *dest_c_ptr=NULL; *************** *** 386,391 **** PlaceTopObj(obj_ptr); ! SelectTopObj(); ! RecordNewObjCmd(); SetFileModified(TRUE); justDupped = FALSE; --- 405,410 ---- PlaceTopObj(obj_ptr); ! if (highlight) SelectTopObj(); ! if (record_cmd) RecordNewObjCmd(); SetFileModified(TRUE); justDupped = FALSE; *************** *** 497,502 **** (*pp_top_obj) = (*pp_bot_obj) = NULL; ! sprintf(tmpfile, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmpfile); if ((fp=fopen(tmpfile, "w+")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANNOT_OPEN_FILE_FOR_WRITING), --- 516,520 ---- (*pp_top_obj) = (*pp_bot_obj) = NULL; ! MkTempFile(tmpfile, sizeof(tmpfile), tmpDir, TOOL_NAME); if ((fp=fopen(tmpfile, "w+")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANNOT_OPEN_FILE_FOR_WRITING), *************** *** 595,599 **** #endif /* ~_NO_KINPUT */ Msg(TgLoadString(STID_PASTE_FROM_NON_TGIF)); ! PasteString(cut_buffer); XFree(cut_buffer); return TRUE; --- 613,617 ---- #endif /* ~_NO_KINPUT */ Msg(TgLoadString(STID_PASTE_FROM_NON_TGIF)); ! PasteString(cut_buffer, TRUE, TRUE); XFree(cut_buffer); return TRUE; *************** *** 764,768 **** if (out_buffer == NULL) FailAllocMessage(); do_kconv(cut_buffer, out_buffer, size+2, _EUC, _AUTO ); ! PasteString(out_buffer); free(out_buffer); } else { --- 782,786 ---- if (out_buffer == NULL) FailAllocMessage(); do_kconv(cut_buffer, out_buffer, size+2, _EUC, _AUTO ); ! PasteString(out_buffer, TRUE, TRUE); free(out_buffer); } else { *************** *** 772,779 **** } #endif /* ~_NO_KINPUT */ ! PasteString(cut_buffer); } #else /* _NO_NKF */ ! PasteString(cut_buffer); #endif /* ~_NO_NKF */ --- 790,797 ---- } #endif /* ~_NO_KINPUT */ ! PasteString(cut_buffer, TRUE, TRUE); } #else /* _NO_NKF */ ! PasteString(cut_buffer, TRUE, TRUE); #endif /* ~_NO_NKF */ *************** *** 895,899 **** } Msg(TgLoadString(STID_PASTE_COMP_TEXT_FROM_NON_TGIF)); ! PasteString(cut_buffer); XFree(cut_buffer); return TRUE; --- 913,917 ---- } Msg(TgLoadString(STID_PASTE_COMP_TEXT_FROM_NON_TGIF)); ! PasteString(cut_buffer, TRUE, TRUE); XFree(cut_buffer); return TRUE; *** dialog.c.orig Fri Aug 4 14:03:53 2000 --- dialog.c Fri Aug 4 14:03:53 2000 *************** *** 110,120 **** return input.xbutton.button; } else if (input.type == KeyPress) { ! XKeyEvent *key_ev=(&(input.xkey)); ! KeySym key_sym; ! char s[80]; ! int has_ch=XLookupString(key_ev, s, sizeof(s), &key_sym, &c_stat); ! ! TranslateKeys(s, &key_sym); ! if (CharIsESC(key_ev, s, key_sym, &has_ch)) { XUngrabPointer(mainDisplay, CurrentTime); XSync(mainDisplay, False); --- 110,114 ---- return input.xbutton.button; } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { XUngrabPointer(mainDisplay, CurrentTime); XSync(mainDisplay, False); *************** *** 155,165 **** return input.xbutton.button; } else if (input.type == KeyPress) { ! XKeyEvent *key_ev=(&(input.xkey)); ! KeySym key_sym; ! char s[80]; ! int has_ch=XLookupString(key_ev, s, sizeof(s), &key_sym, &c_stat); ! ! TranslateKeys(s, &key_sym); ! if (CharIsESC(key_ev, s, key_sym, &has_ch)) { XUngrabPointer(mainDisplay, CurrentTime); XSync(mainDisplay, False); --- 149,153 ---- return input.xbutton.button; } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { XUngrabPointer(mainDisplay, CurrentTime); XSync(mainDisplay, False); *** drawing.c.orig Fri Aug 4 14:03:54 2000 --- drawing.c Fri Aug 4 14:03:54 2000 *************** *** 532,535 **** --- 532,549 ---- static XComposeStatus c_stat; + int KeyPressEventIsEscape(key_ev) + XKeyEvent *key_ev; + { + KeySym key_sym=(KeySym)0; + char buf[80]; + int has_ch=XLookupString(key_ev, buf, sizeof(buf), &key_sym, &c_stat); + + TranslateKeys(buf, &key_sym); + if (CharIsESC(key_ev, buf, key_sym, &has_ch)) { + return TRUE; + } + return FALSE; + } + static Bool CheckESC(p_display, p_ev, psz_arg) *************** *** 539,549 **** { if (p_ev->type == KeyPress) { ! XKeyEvent *key_ev=(&(p_ev->xkey)); ! KeySym key_sym=(KeySym)0; ! char buf[80]; ! int has_ch=XLookupString(key_ev, buf, sizeof(buf), &key_sym, &c_stat); ! ! TranslateKeys(buf, &key_sym); ! if (CharIsESC(key_ev, buf, key_sym, &has_ch)) { return True; } --- 553,557 ---- { if (p_ev->type == KeyPress) { ! if (KeyPressEventIsEscape(&p_ev->xkey)) { return True; } *************** *** 1892,1896 **** case 'e': /*^e*/ PushCurChoice(); break; case 'f': /*^f*/ FrontProc(); break; ! case 'g': /*^g*/ GroupSelObj(TRUE, TRUE); break; case 'h': /*^h*/ return(INVALID); case 'i': /*^i*/ Instantiate(); break; --- 1900,1904 ---- case 'e': /*^e*/ PushCurChoice(); break; case 'f': /*^f*/ FrontProc(); break; ! case 'g': /*^g*/ GroupSelObj(TRUE, TRUE, TRUE); break; case 'h': /*^h*/ return(INVALID); case 'i': /*^i*/ Instantiate(); break; *************** *** 2555,2558 **** --- 2563,2576 ---- } else if (strcmp(name, "ToggleAutoEPSPreviewBitmap()") == 0) { ToggleAutoEPSPreviewBitmap(); + } else if (strcmp(name, "CreateThumbnails()") == 0) { + CreateThumbnails(); + } else if (strcmp(name, "ConnectTwoPortsByAWire()") == 0) { + ConnectTwoPortsByAWire(); + } else if (strcmp(name, "RenameSignalNameForAPort()") == 0) { + RenameSignalNameForAPort(); + } else if (strcmp(name, "ClearSignalNameForAPort()") == 0) { + ClearSignalNameForAPort(); + } else if (strcmp(name, "ToggleShowWireSignalName()") == 0) { + ToggleShowWireSignalName(); } } *************** *** 2712,2718 **** FILE *fp=NULL; ! sprintf(ptfi->tmp_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(ptfi->tmp_fname); ! unlink(ptfi->tmp_fname); if ((fp=fopen(ptfi->tmp_fname, "w")) == NULL) { --- 2730,2734 ---- FILE *fp=NULL; ! MkTempFile(ptfi->tmp_fname, sizeof(ptfi->tmp_fname), tmpDir, TOOL_NAME); if ((fp=fopen(ptfi->tmp_fname, "w")) == NULL) { *************** *** 3090,3093 **** --- 3106,3189 ---- } + void HandleMotionForPortInDrawWindow(mouse_x, mouse_y) + int mouse_x, mouse_y; + { + int need_to_highlight=FALSE, something_changed=FALSE; + struct ObjRec *owner_obj=NULL, *obj_ptr, *obj_under_cursor=NULL; + char port_name[MAXSTRING]; + + obj_ptr = FindAnObj(mouse_x, mouse_y, &owner_obj, &obj_under_cursor, + port_name); + if (drawPolyHighlightedNode != NULL) { + if (obj_under_cursor != drawPolyHighlightedNode) { + /* un-highlight */ + SelBox(drawWindow, revGrayGC, + OFFSET_X(drawPolyHighlightedNode->bbox.ltx)-2, + OFFSET_Y(drawPolyHighlightedNode->bbox.lty)-2, + OFFSET_X(drawPolyHighlightedNode->bbox.rbx)+2, + OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); + /* do not translate -- program constants */ + if (obj_under_cursor != NULL && ObjIsAPort(obj_under_cursor)) { + drawPolyHighlightedNode = obj_under_cursor; + SetWiringNodeInfo(obj_under_cursor, owner_obj, port_name, TRUE); + } else { + drawPolyHighlightedNode = NULL; + SetWiringNodeInfo(NULL, NULL, NULL, TRUE); + } + if (drawPolyHighlightedNode != NULL) { + need_to_highlight = TRUE; + } + something_changed = TRUE; + } + } else if (obj_under_cursor != NULL) { + if (ObjIsAPort(obj_under_cursor)) { + drawPolyHighlightedNode = obj_under_cursor; + SetWiringNodeInfo(obj_under_cursor, owner_obj, port_name, TRUE); + } else { + drawPolyHighlightedNode = NULL; + SetWiringNodeInfo(NULL, NULL, NULL, TRUE); + } + if (drawPolyHighlightedNode != NULL) { + need_to_highlight = TRUE; + something_changed = TRUE; + } + } + if (need_to_highlight) { + SelBox(drawWindow, revGrayGC, + OFFSET_X(drawPolyHighlightedNode->bbox.ltx)-2, + OFFSET_Y(drawPolyHighlightedNode->bbox.lty)-2, + OFFSET_X(drawPolyHighlightedNode->bbox.rbx)+2, + OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); + } + if (something_changed) { + if (*gstWiringInfo.first_port_name != '\0') { + if (gstWiringInfo.num_ports_to_connect == 99) { + /* rename signal_name */ + SetHyperSpaceCursor(drawWindow); + sprintf(gszMsgBox, + TgLoadCachedString(CSTID_SET_SIGNAME_FOR_NAMED_PORT), + gstWiringInfo.first_port_name); + } else if (gstWiringInfo.num_ports_to_connect == 999) { + /* clear signal_name */ + SetHyperSpaceCursor(drawWindow); + sprintf(gszMsgBox, + TgLoadCachedString(CSTID_CLEAR_SIGNAME_FOR_NAMED_PORT), + gstWiringInfo.first_port_name); + } else { + sprintf(gszMsgBox, + TgLoadCachedString(CSTID_START_A_WIRE_FROM_NAMED_PORT), + gstWiringInfo.first_port_name); + } + SetStringStatus(gszMsgBox); + } else { + if (gstWiringInfo.num_ports_to_connect == 99 || + gstWiringInfo.num_ports_to_connect == 999) { + SetHandCursor(drawWindow); + } + ShowCurChoiceMouseStatus(DRAWPOLY, 0, FALSE); + } + } + } + static int motionCursorIsMoveCursor=FALSE; *************** *** 3108,3170 **** GridXY(mouse_x, mouse_y, &grid_x, &grid_y); MarkRulers(grid_x, grid_y); ! if (curChoice == DRAWPOLY && drawPolyToEndInANode > 0) { ! int need_to_highlight=FALSE, something_changed=FALSE; ! struct ObjRec *owner_obj=NULL, *obj_ptr, *obj_under_cursor=NULL; ! struct AttrRec *attr_ptr; ! ! obj_ptr = FindAnObj(mouse_x, mouse_y, &owner_obj, &obj_under_cursor, ! drawPolyFirstNodeName); ! if (drawPolyHighlightedNode != NULL) { ! if (obj_under_cursor != drawPolyHighlightedNode) { ! /* un-highlight */ ! SelBox(drawWindow, revGrayGC, ! OFFSET_X(drawPolyHighlightedNode->bbox.ltx)-2, ! OFFSET_Y(drawPolyHighlightedNode->bbox.lty)-2, ! OFFSET_X(drawPolyHighlightedNode->bbox.rbx)+2, ! OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); ! /* do not translate -- program constants */ ! if (obj_under_cursor != NULL && ! (attr_ptr=FindAttrWithName(obj_under_cursor, "type=", ! NULL)) != NULL && strcmp(attr_ptr->attr_value.s, ! "port")==0) { ! drawPolyHighlightedNode = obj_under_cursor; ! } else { ! drawPolyHighlightedNode = NULL; ! } ! if (drawPolyHighlightedNode != NULL) { ! need_to_highlight = TRUE; ! } ! something_changed = TRUE; ! } ! } else { ! if (obj_under_cursor != NULL) { ! /* do not translate -- program constants */ ! if ((attr_ptr=FindAttrWithName(obj_under_cursor, "type=", ! NULL)) != NULL && strcmp(attr_ptr->attr_value.s, ! "port")==0) { ! drawPolyHighlightedNode = obj_under_cursor; ! } else { ! drawPolyHighlightedNode = NULL; ! } ! if (drawPolyHighlightedNode != NULL) { ! need_to_highlight = TRUE; ! something_changed = TRUE; ! } ! } ! } ! if (need_to_highlight) { ! SelBox(drawWindow, revGrayGC, ! OFFSET_X(drawPolyHighlightedNode->bbox.ltx)-2, ! OFFSET_Y(drawPolyHighlightedNode->bbox.lty)-2, ! OFFSET_X(drawPolyHighlightedNode->bbox.rbx)+2, ! OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); ! } ! if (something_changed) { ! if (*drawPolyFirstNodeName != '\0') { ! SetStringStatus(drawPolyFirstNodeName); ! } else { ! SetStringStatus(""); ! } ! } } else if (curChoice == DRAWPOLY && drawPolyToConnectPins > 0) { HandlePinHighlights(mouse_x, mouse_y); --- 3204,3214 ---- GridXY(mouse_x, mouse_y, &grid_x, &grid_y); MarkRulers(grid_x, grid_y); ! if (curChoice == DRAWPOLY && gstWiringInfo.num_ports_to_connect > 0) { ! HandleMotionForPortInDrawWindow(mouse_x, mouse_y); ! #ifdef _NOT_DEFINED ! /* ! * drawPolyToConnectPins is only set to > 0 in "pin.c" ! * what's in "pin.c" is not used at this time ! */ } else if (curChoice == DRAWPOLY && drawPolyToConnectPins > 0) { HandlePinHighlights(mouse_x, mouse_y); *************** *** 3172,3175 **** --- 3216,3220 ---- gpStartPin = drawPolyHighlightedNode; } + #endif /* _NOT_DEFINED */ } else if (!inHyperSpace && !btn1Warp && !(inSlideShow && !goHyperSpaceInSlideShow)) { *************** *** 3240,3243 **** --- 3285,3313 ---- } + int HandlePressForPortInDrawWindow(cancel) + int cancel; + { + if (drawPolyHighlightedNode != NULL) { + /* un-highlight */ + SelBox(drawWindow, revGrayGC, + OFFSET_X(drawPolyHighlightedNode->bbox.ltx)-2, + OFFSET_Y(drawPolyHighlightedNode->bbox.lty)-2, + OFFSET_X(drawPolyHighlightedNode->bbox.rbx)+2, + OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); + if (cancel) { + drawPolyHighlightedNode = NULL; + SetWiringNodeInfo(NULL, NULL, NULL, TRUE); + } + } + if (cancel) { + if (connectingPortsByWire) { + MakeQuiescent(); + Msg(TgLoadString(STID_CONNECT_PORTS_CANCEL_BY_USER)); + } + return FALSE; + } + return TRUE; + } + static int HandlePressInDrawWindow(input, pn_status) *************** *** 3295,3298 **** --- 3365,3371 ---- return TRUE; } else if (button_ev->button == Button2) { + if (curChoice == DRAWPOLY && gstWiringInfo.num_ports_to_connect > 0) { + return HandlePressForPortInDrawWindow(TRUE); + } *pn_status = MainMenu(); return TRUE; *************** *** 3299,3302 **** --- 3372,3378 ---- } else if (button_ev->button == Button3) { /* context-sensitive menu? */ + if (curChoice == DRAWPOLY && gstWiringInfo.num_ports_to_connect > 0) { + return HandlePressForPortInDrawWindow(TRUE); + } if (btn3PopupModeMenu) { ModeMenu(button_ev->x_root, button_ev->y_root, FALSE); *** edit.c.orig Fri Aug 4 14:03:55 2000 --- edit.c Fri Aug 4 14:03:55 2000 *************** *** 1088,1093 **** } - static XComposeStatus c_stat; - static int ContinueAddPolyPoint(ObjPtr, MouseX, MouseY, Index, PolyPtr, --- 1088,1091 ---- *************** *** 1444,1454 **** justDupped = FALSE; } 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)) { done = TRUE; *LastMouseX = new_mouse_x; *LastMouseY = new_mouse_y; --- 1442,1446 ---- justDupped = FALSE; } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { done = TRUE; *LastMouseX = new_mouse_x; *LastMouseY = new_mouse_y; *************** *** 1875,1885 **** justDupped = FALSE; } 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)) { done = TRUE; *LastMouseX = new_mouse_x; *LastMouseY = new_mouse_y; --- 1867,1871 ---- justDupped = FALSE; } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { done = TRUE; *LastMouseX = new_mouse_x; *LastMouseY = new_mouse_y; *** eps.c.orig Fri Aug 4 14:03:56 2000 --- eps.c Fri Aug 4 14:03:56 2000 *************** *** 482,488 **** } /* do not translate -- program constants */ ! sprintf(tiff_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tiff_fname); ! unlink(tiff_fname); if ((tiff_fp=fopen(tiff_fname, "w")) == NULL) { return ErrorInConvertTiffToXbm(fp, NULL, NULL, NULL); --- 482,486 ---- } /* do not translate -- program constants */ ! MkTempFile(tiff_fname, sizeof(tiff_fname), tmpDir, TOOL_NAME); if ((tiff_fp=fopen(tiff_fname, "w")) == NULL) { return ErrorInConvertTiffToXbm(fp, NULL, NULL, NULL); *************** *** 504,510 **** /* convert TIFF to XBM */ ! sprintf(xbm_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(xbm_fname); ! unlink(xbm_fname); if ((xbm_fp=fopen(xbm_fname, "w")) == NULL) { return ErrorInConvertTiffToXbm(fp, NULL, NULL, NULL); --- 502,506 ---- /* convert TIFF to XBM */ ! MkTempFile(xbm_fname, sizeof(xbm_fname), tmpDir, TOOL_NAME); if ((xbm_fp=fopen(xbm_fname, "w")) == NULL) { return ErrorInConvertTiffToXbm(fp, NULL, NULL, NULL); *************** *** 557,564 **** static ! FILE *GetTiffEPSIInfo(fp, pszEPS, pnPreviewOK) FILE *fp; char *pszEPS; ! int *pnPreviewOK; { int bytes_to_read=0x1e, tiff_sz, tiff_offset, eps_sz; --- 553,560 ---- static ! FILE *GetTiffEPSIInfo(fp, pszEPS, file_buf_sz, pnPreviewOK) FILE *fp; char *pszEPS; ! int file_buf_sz, *pnPreviewOK; { int bytes_to_read=0x1e, tiff_sz, tiff_offset, eps_sz; *************** *** 617,623 **** return ErrorInGetTiffEPSIInfo(fp, NULL, NULL); } ! sprintf(pszEPS, "%sTgifXXXXXX", TMP_DIR); ! mktemp(pszEPS); ! unlink(pszEPS); if ((eps_fp=fopen(pszEPS, "w")) == NULL) { return ErrorInGetTiffEPSIInfo(fp, NULL, NULL); --- 613,617 ---- return ErrorInGetTiffEPSIInfo(fp, NULL, NULL); } ! MkTempFile(pszEPS, file_buf_sz, tmpDir, TOOL_NAME); if ((eps_fp=fopen(pszEPS, "w")) == NULL) { return ErrorInGetTiffEPSIInfo(fp, NULL, NULL); *************** *** 694,699 **** static ! int ConvertPsToXbm(pszPsPath, pszXbmPath) char *pszPsPath, *pszXbmPath; { FILE *pFile=NULL, *pPipe=NULL; --- 688,694 ---- static ! int ConvertPsToXbm(pszPsPath, pszXbmPath, file_buf_sz) char *pszPsPath, *pszXbmPath; + int file_buf_sz; { FILE *pFile=NULL, *pPipe=NULL; *************** *** 701,707 **** int bytes_read=0; ! sprintf(pszXbmPath, "%sTgifXXXXXX", TMP_DIR); ! mktemp(pszXbmPath); ! unlink(pszXbmPath); pszCmd = (char*)malloc( (strlen(psToXbmCmd)+strlen(pszPsPath)+10)*sizeof(char)); --- 696,700 ---- int bytes_read=0; ! MkTempFile(pszXbmPath, file_buf_sz, tmpDir, TOOL_NAME); pszCmd = (char*)malloc( (strlen(psToXbmCmd)+strlen(pszPsPath)+10)*sizeof(char)); *************** *** 759,764 **** unsigned int tmp_w=0, tmp_h=0; int rc=0, x_hot=0, y_hot=0, empty_image=FALSE, dont_free_orig_bitmap=FALSE; ! Pixmap orig_bitmap=None, bitmap=None; ! XImage *image=NULL; SetWatchCursor(drawWindow); --- 752,756 ---- unsigned int tmp_w=0, tmp_h=0; int rc=0, x_hot=0, y_hot=0, empty_image=FALSE, dont_free_orig_bitmap=FALSE; ! Pixmap orig_bitmap=None; SetWatchCursor(drawWindow); *************** *** 765,769 **** SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertPsToXbm(pszPsPath, xbm_fname); RestoreStatusStrings(); SetDefaultCursor(mainWindow); --- 757,761 ---- SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertPsToXbm(pszPsPath, xbm_fname, sizeof(xbm_fname)); RestoreStatusStrings(); SetDefaultCursor(mainWindow); *************** *** 830,838 **** if (!cmdLineDosEpsFilter) { ! *pn_image_w = *pn_image_h = *pn_num_lines = *pn_epsf_level = 0; *p_bitmap = None; *p_image = NULL; ! *pn_num_lines = 0; ! *ppsz_epsflines = NULL; *pn_epsf_level = 0; *pf_llx = llx; *pf_lly = lly; *pf_urx = urx; *pf_ury = ury; --- 822,830 ---- if (!cmdLineDosEpsFilter) { ! *pn_image_w = *pn_image_h = *pn_epsf_level = 0; *p_bitmap = None; *p_image = NULL; ! if (pn_num_lines != NULL) *pn_num_lines = 0; ! if (ppsz_epsflines != NULL) *ppsz_epsflines = NULL; *pn_epsf_level = 0; *pf_llx = llx; *pf_lly = lly; *pf_urx = urx; *pf_ury = ury; *************** *** 857,861 **** if (cmdLineDosEpsFilter) { if ((fp=GetTiffEPSIInfo(fp, tiff_eps_fname, ! &tiff_preview_ok)) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_FAIL_TO_PARSE_WINEPS_FILE), --- 849,853 ---- if (cmdLineDosEpsFilter) { if ((fp=GetTiffEPSIInfo(fp, tiff_eps_fname, ! sizeof(tiff_eps_fname), &tiff_preview_ok)) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_FAIL_TO_PARSE_WINEPS_FILE), *************** *** 874,878 **** return BitmapSuccess; } else if ((fp=GetTiffEPSIInfo(fp, tiff_eps_fname, ! &tiff_preview_ok)) == NULL || (line=UtilGetALine(fp)) == NULL) { sprintf(gszMsgBox, --- 866,870 ---- return BitmapSuccess; } else if ((fp=GetTiffEPSIInfo(fp, tiff_eps_fname, ! sizeof(tiff_eps_fname), &tiff_preview_ok)) == NULL || (line=UtilGetALine(fp)) == NULL) { sprintf(gszMsgBox, *************** *** 1072,1082 **** *p_bitmap = bitmap; *p_image = image; ! *pn_num_lines = numLines; ! *ppsz_epsflines = (char**)malloc(numLines*sizeof(char*)); ! if (*ppsz_epsflines == NULL) FailAllocMessage(); ! for (i=0, line_ptr=topLine; line_ptr != NULL; line_ptr = next_line, i++) { next_line = line_ptr->next; ! (*ppsz_epsflines)[i] = UtilStrDup(line_ptr->s); free(line_ptr->s); free(line_ptr); --- 1064,1078 ---- *p_bitmap = bitmap; *p_image = image; ! if (pn_num_lines != NULL) *pn_num_lines = numLines; ! if (ppsz_epsflines != NULL) { ! *ppsz_epsflines = (char**)malloc(numLines*sizeof(char*)); ! if (*ppsz_epsflines == NULL) FailAllocMessage(); ! } for (i=0, line_ptr=topLine; line_ptr != NULL; line_ptr = next_line, i++) { next_line = line_ptr->next; ! if (ppsz_epsflines != NULL) { ! (*ppsz_epsflines)[i] = UtilStrDup(line_ptr->s); ! if ((*ppsz_epsflines)[i] == NULL) FailAllocMessage(); ! } free(line_ptr->s); free(line_ptr); *************** *** 1116,1122 **** static ! FILE *JustGetTiffEPSIInfo(fp, pszEPS) FILE *fp; char *pszEPS; { int bytes_to_read=0x1e, eps_sz, need_to_check_ps=TRUE; --- 1112,1119 ---- static ! FILE *JustGetTiffEPSIInfo(fp, pszEPS, file_buf_sz) FILE *fp; char *pszEPS; + int file_buf_sz; { int bytes_to_read=0x1e, eps_sz, need_to_check_ps=TRUE; *************** *** 1134,1140 **** eps_sz = ReadDoubleWord(&buf[0x08]); ! sprintf(pszEPS, "%sTgifXXXXXX", TMP_DIR); ! mktemp(pszEPS); ! unlink(pszEPS); if ((eps_fp=fopen(pszEPS, "w")) == NULL) { fclose(fp); --- 1131,1135 ---- eps_sz = ReadDoubleWord(&buf[0x08]); ! MkTempFile(pszEPS, file_buf_sz, tmpDir, TOOL_NAME); if ((eps_fp=fopen(pszEPS, "w")) == NULL) { fclose(fp); *************** *** 1142,1146 **** return NULL; } - /* copy the EPS content from the original file to the new EPS file */ while (eps_sz > 0) { --- 1137,1140 ---- *************** *** 1185,1189 **** char tiff_eps_fname[MAXPATHLENGTH+1]; char real_fname[MAXPATHLENGTH+1]; ! int first_line=TRUE; int boundingbox_found=FALSE, preview_found=FALSE, found; int boundingbox_atend=FALSE; --- 1179,1183 ---- char tiff_eps_fname[MAXPATHLENGTH+1]; char real_fname[MAXPATHLENGTH+1]; ! int first_line=TRUE, propagated_eps_status=INVALID; int boundingbox_found=FALSE, preview_found=FALSE, found; int boundingbox_atend=FALSE; *************** *** 1232,1236 **** line[4] == ((char)0x1e)) { free(line); ! if ((fp=JustGetTiffEPSIInfo(fp, tiff_eps_fname)) == NULL || (line=UtilGetALine(fp)) == NULL) { if (fp != NULL) fclose(fp); --- 1226,1231 ---- line[4] == ((char)0x1e)) { free(line); ! if ((fp=JustGetTiffEPSIInfo(fp, tiff_eps_fname, ! sizeof(tiff_eps_fname))) == NULL || (line=UtilGetALine(fp)) == NULL) { if (fp != NULL) fclose(fp); *************** *** 1249,1252 **** --- 1244,1248 ---- AddLine(line); need_to_free_line = FALSE; + propagated_eps_status = INVALID; } else if ((!boundingbox_found || boundingbox_atend) && strncmp(line, "%%BoundingBox:", 14) == 0) { *************** *** 1259,1262 **** --- 1255,1259 ---- } } + propagated_eps_status = INVALID; } else if (!preview_found && strncmp(line, "%%BeginPreview:", 15) == 0) { char *preview_line; *************** *** 1287,1294 **** return FALSE; } } else { ! if (line[0] == '%' && line[1] == '!') (xbm_ptr->epsf_level)++; ! if (line[0] == '%' && line[1] == '%' && line[2] != '%') { ! /* Actaully, need to check DCS conformance! */ } else if (!stripEPSComments || line[0] != '%') { AddLine(line); --- 1284,1297 ---- return FALSE; } + propagated_eps_status = INVALID; + } else if (line[0] == '%' && line[1] == '%' && line[2] != '%') { + /* Actaully, need to check DCS conformance! */ + if (propagated_eps_status != INVALID && line[2] != '+') { + propagated_eps_status = INVALID; + } + UpdatePropagatedEPSInfo(line, &propagated_eps_status); } else { ! if (line[0] == '%' && line[1] == '!') { ! (xbm_ptr->epsf_level)++; } else if (!stripEPSComments || line[0] != '%') { AddLine(line); *************** *** 1295,1298 **** --- 1298,1302 ---- need_to_free_line = FALSE; } + propagated_eps_status = INVALID; } if (need_to_free_line) free(line); *************** *** 1352,1356 **** struct XBmRec *xbm_ptr=ObjPtr->detail.xbm; struct MtrxRec mtrx; ! int no_rotate=(ObjPtr->ctm==NULL); /* (ObjPtr->ctm->m[CTM_SIN]== 0 && ObjPtr->ctm->m[CTM_MSIN] == 0); */ --- 1356,1360 ---- struct XBmRec *xbm_ptr=ObjPtr->detail.xbm; struct MtrxRec mtrx; ! int no_rotate=(ObjPtr->ctm==NULL), need_to_free_epsflines=FALSE; /* (ObjPtr->ctm->m[CTM_SIN]== 0 && ObjPtr->ctm->m[CTM_MSIN] == 0); */ *************** *** 1360,1363 **** --- 1364,1368 ---- return; } + need_to_free_epsflines = TRUE; } else { char loc_time[MAXSTRING+1], real_fname[MAXPATHLENGTH+1]; *************** *** 1527,1530 **** --- 1532,1546 ---- fprintf(FP, "tgifdict begin\n"); fprintf(FP, "\n"); + + if (need_to_free_epsflines && xbm_ptr->epsflines != NULL) { + for (i=0; i < xbm_ptr->num_epsf_lines; i++) { + if (xbm_ptr->epsflines[i] != NULL) { + free(xbm_ptr->epsflines[i]); + } + } + if (xbm_ptr->epsflines != NULL) free(xbm_ptr->epsflines); + xbm_ptr->num_epsf_lines = 0; + xbm_ptr->epsflines = NULL; + } } *************** *** 1675,1679 **** struct ObjRec *obj_ptr, *new_obj_ptr; char write_date[32], **lines=NULL; ! int rc, num_lines, epsf_level, image_w, image_h, save_epsf; int transformed; float llx, lly, urx, ury; --- 1691,1695 ---- struct ObjRec *obj_ptr, *new_obj_ptr; char write_date[32], **lines=NULL; ! int rc, num_lines=0, epsf_level, image_w, image_h, save_epsf; int transformed; float llx, lly, urx, ury; *************** *** 1691,1695 **** SetWatchCursor(mainWindow); rc = MyReadEPSFile(xbm_ptr->filename, &image_w, &image_h, &bitmap, ! &image, &num_lines, &lines, &epsf_level, &llx, &lly, &urx, &ury, write_date); SetDefaultCursor(mainWindow); --- 1707,1712 ---- SetWatchCursor(mainWindow); rc = MyReadEPSFile(xbm_ptr->filename, &image_w, &image_h, &bitmap, ! &image, (save_epsf ? &num_lines : NULL), ! (save_epsf ? &lines : NULL), &epsf_level, &llx, &lly, &urx, &ury, write_date); SetDefaultCursor(mainWindow); *************** *** 1711,1714 **** --- 1728,1739 ---- saveEPSLines = FALSE; + if (!save_epsf && lines != NULL) { + int i=0; + + for (i=0; i < num_lines; i++) { + if (lines[i] != NULL) free(lines[i]); + } + free(lines); + } new_obj_ptr->x = obj_ptr->x; new_obj_ptr->y = obj_ptr->y; *** exec.c.orig Fri Aug 4 14:03:57 2000 --- exec.c Fri Aug 4 14:03:58 2000 *************** *** 62,65 **** --- 62,66 ---- #include "ini.e" #include "mainloop.e" + #include "mainmenu.e" #include "menu.e" #include "miniline.e" *************** *** 1287,1290 **** --- 1288,1302 ---- } + static ReplAttrValueCallback *gpfReplaceAttrValueCallback=NULL; + static void *gpvReplAttrValueCallbackUserData=NULL; + + void SetReplaceAttrValueCallback(pf_replace_attr_value, pv_userdata) + ReplAttrValueCallback *pf_replace_attr_value; + void *pv_userdata; + { + gpfReplaceAttrValueCallback = pf_replace_attr_value; + gpvReplAttrValueCallbackUserData = pv_userdata; + } + int ReplaceAttrFirstValue(obj_ptr, attr_ptr, new_value) struct ObjRec *obj_ptr; *************** *** 1351,1354 **** --- 1363,1377 ---- AdjObjBBox(obj_ptr); } + if (gpfReplaceAttrValueCallback != NULL) { + ReplAttrValueCallbackInfo ravci; + + memset(&ravci, 0, sizeof(ReplAttrValueCallbackInfo)); + ravci.obj_ptr = obj_ptr; + ravci.attr_ptr = attr_ptr; + ravci.new_attr_value = new_value; + ravci.pv_userdata = gpvReplAttrValueCallbackUserData; + if ((gpfReplaceAttrValueCallback)(&ravci)) { + } + } if (obj_ptr == tgifObj) recordCmdIncludeTgifObj = TRUE; RecordReplaceAnObj(obj_ptr); *************** *** 1753,1757 **** char **argv, *orig_cmd; struct ObjRec *obj_ptr; ! /* mktemp(tmp_file_template_string,result_attribute); */ { char *file_name=argv[0], *attr_name=argv[1]; --- 1776,1780 ---- char **argv, *orig_cmd; struct ObjRec *obj_ptr; ! /* mktemp(str,result_attribute); */ { char *file_name=argv[0], *attr_name=argv[1]; *************** *** 1762,1769 **** UtilRemoveQuotes(file_name); UtilRemoveQuotes(attr_name); sprintf(execDummyStr, "%s=", attr_name); attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &attr_owner_obj); ! if (attr_ptr == NULL) return (BadAttr (execDummyStr, orig_cmd)); if (mktemp(file_name) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_FAIL_FUNC_CMD_EXEC_ABORT), --- 1785,1795 ---- UtilRemoveQuotes(file_name); UtilRemoveQuotes(attr_name); + UtilTrimBlanks(file_name); + UtilTrimBlanks(attr_name); sprintf(execDummyStr, "%s=", attr_name); attr_ptr = FindAttrWithName(obj_ptr, execDummyStr, &attr_owner_obj); ! if (attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); + #ifndef _DONT_USE_MKTEMP if (mktemp(file_name) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_FAIL_FUNC_CMD_EXEC_ABORT), *************** *** 1795,1798 **** --- 1821,1847 ---- } } + #else /* _DONT_USE_MKTEMP */ + { + int len=0; + char *psz=NULL, fname[MAXPATHLENGTH], path[MAXPATHLENGTH]; + + UtilStrCpyN(fname, sizeof(fname), file_name); + len = strlen(fname); + while (len > 0 && fname[len-1] == 'X') { + fname[--len] = '\0'; + } + psz = UtilStrRChr(fname, DIR_SEP); + if (psz == NULL) { + UtilStrCpyN(path, sizeof(path), (char*)tempnam(NULL, fname)); + } else { + *psz = '\0'; + UtilStrCpyN(path, sizeof(path), (char*)tempnam(fname, &psz[1])); + *psz = DIR_SEP; + } + UtilTrimBlanks(path); + unlink(path); + ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, path); + } + #endif /* ~_DONT_USE_MKTEMP */ return rc; } *************** *** 4746,4750 **** { char *attr_name=argv[0], *msg=argv[1], *title=argv[2], *style_str=argv[3]; ! char buf[10]; struct AttrRec *attr_ptr=NULL; struct ObjRec *attr_owner_obj=NULL; --- 4795,4799 ---- { char *attr_name=argv[0], *msg=argv[1], *title=argv[2], *style_str=argv[3]; ! char buf[MAXSTRING]; struct AttrRec *attr_ptr=NULL; struct ObjRec *attr_owner_obj=NULL; *************** *** 5020,5023 **** --- 5069,5073 ---- return FALSE; } + ResetWiringNodeInfo(); SetCurChoice(DRAWPOLY); SetStringStatus(TgLoadString(STID_END_AN_EDGE_AT_A_PORT)); *************** *** 5030,5036 **** polyDrawn = FALSE; ! drawPolyToEndInANode = 1; DrawPoly(&ev); ! drawPolyToEndInANode = 0; poly_created = polyDrawn; SetCurChoice(NOTHING); --- 5080,5086 ---- polyDrawn = FALSE; ! gstWiringInfo.num_ports_to_connect = 1; DrawPoly(&ev); ! gstWiringInfo.num_ports_to_connect = 0; poly_created = polyDrawn; SetCurChoice(NOTHING); *************** *** 5038,5045 **** if (attr_ptr != NULL) { ! /* do not translate -- program constants */ ! ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, poly_created ? ! (strncmp(drawPolyLastNodeName,"NodeName: ",10) == 0 ? ! &drawPolyLastNodeName[10] : drawPolyLastNodeName) : ""); } return TRUE; --- 5088,5093 ---- if (attr_ptr != NULL) { ! ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, ! (poly_created ? gstWiringInfo.last_port_name : "")); } return TRUE; *************** *** 5074,5077 **** --- 5122,5129 ---- RemoveAllSel(); } + ResetWiringNodeInfo(); + connectingPortsByWire = TRUE; + UseWireMenuItemInModeItem(TRUE); + values.line_width = 3; XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); *************** *** 5078,5084 **** SetCurChoice(DRAWPOLY); ! drawPolyToEndInANode = 2; drawPolyHighlightedNode = NULL; SetStringStatus(TgLoadString(STID_DRAW_AN_EDGE_BETWEEN_PORTS)); for (;;) { XEvent input; --- 5130,5137 ---- SetCurChoice(DRAWPOLY); ! gstWiringInfo.num_ports_to_connect = 2; drawPolyHighlightedNode = NULL; SetStringStatus(TgLoadString(STID_DRAW_AN_EDGE_BETWEEN_PORTS)); + polyDrawn = FALSE; for (;;) { XEvent input; *************** *** 5093,5097 **** if (polyDrawn) { break; ! } else if (drawPolyToEndInANode == (-1)) { break; } --- 5146,5150 ---- if (polyDrawn) { break; ! } else if (gstWiringInfo.num_ports_to_connect == (-1)) { break; } *************** *** 5102,5123 **** } } ! drawPolyToEndInANode = 0; poly_created = polyDrawn; - SetCurChoice(NOTHING); values.line_width = 1; XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); if (already_in_hyperspace && !inHyperSpace) ToggleHyperSpace(TRUE); if (start_attr_ptr != NULL) { ! /* do not translate -- program constants */ ! ReplaceAttrFirstValue(start_attr_owner_obj, start_attr_ptr, poly_created ? ! (strncmp(drawPolyFirstNodeName,"NodeName: ",10) == 0 ? ! &drawPolyFirstNodeName[10] : drawPolyFirstNodeName) : ""); } if (end_attr_ptr != NULL) { ! /* do not translate -- program constants */ ! ReplaceAttrFirstValue(end_attr_owner_obj, end_attr_ptr, poly_created ? ! (strncmp(drawPolyLastNodeName,"NodeName: ",10) == 0 ? ! &drawPolyLastNodeName[10] : drawPolyLastNodeName) : ""); } return TRUE; --- 5155,5177 ---- } } ! gstWiringInfo.num_ports_to_connect = 0; poly_created = polyDrawn; values.line_width = 1; XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); + connectingPortsByWire = FALSE; + SetCurChoice(NOTHING); + RedrawModeWindow(); + UseWireMenuItemInModeItem(FALSE); + UpdatePinnedMenu(MENU_MODE); + if (already_in_hyperspace && !inHyperSpace) ToggleHyperSpace(TRUE); if (start_attr_ptr != NULL) { ! ReplaceAttrFirstValue(start_attr_owner_obj, start_attr_ptr, ! (poly_created ? gstWiringInfo.first_port_name : "")); } if (end_attr_ptr != NULL) { ! ReplaceAttrFirstValue(end_attr_owner_obj, end_attr_ptr, ! (poly_created ? gstWiringInfo.last_port_name : "")); } return TRUE; *************** *** 5367,5371 **** return FALSE; } ! fnameForPostingCGIQuery = (char*)malloc((strlen(TMP_DIR)+20)*sizeof(char)); if (fnameForPostingCGIQuery == NULL) { FailAllocMessage(); --- 5421,5425 ---- return FALSE; } ! fnameForPostingCGIQuery = (char*)malloc((strlen(tmpDir)+20)*sizeof(char)); if (fnameForPostingCGIQuery == NULL) { FailAllocMessage(); *************** *** 5372,5378 **** return FALSE; } ! sprintf(fnameForPostingCGIQuery, "%sTgifXXXXXX", TMP_DIR); ! mktemp(fnameForPostingCGIQuery); ! unlink(fnameForPostingCGIQuery); if ((fp=fopen(fnameForPostingCGIQuery, "w")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANT_OPEN_FILE_WRITE_EXEC_CMD), --- 5426,5430 ---- return FALSE; } ! MkTempFile(fnameForPostingCGIQuery, strlen(tmpDir)+19, tmpDir, TOOL_NAME); if ((fp=fopen(fnameForPostingCGIQuery, "w")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANT_OPEN_FILE_WRITE_EXEC_CMD), *************** *** 6031,6037 **** if (replace_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); ! sprintf(tmp_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmp_fname); ! unlink(tmp_fname); if ((fp=fopen(tmp_fname, "w")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANT_OPEN_FILE_WRITE_EXEC_CMD), --- 6083,6087 ---- if (replace_attr_ptr == NULL) return BadAttr(execDummyStr, orig_cmd); ! MkTempFile(tmp_fname, sizeof(tmp_fname), tmpDir, TOOL_NAME); if ((fp=fopen(tmp_fname, "w")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANT_OPEN_FILE_WRITE_EXEC_CMD), *************** *** 7405,7409 **** import_type = FILE_IMPORTXPM; *xpm_fname = '\0'; ! if (!ConvertGifToXpm(file_name, xpm_fname)) { sprintf(gszMsgBox, TgLoadString(STID_CONVERT_FORMAT_WHILE_EXEC_CMD), file_name, format, orig_cmd); --- 7455,7459 ---- import_type = FILE_IMPORTXPM; *xpm_fname = '\0'; ! if (!ConvertGifToXpm(file_name, xpm_fname, sizeof(xpm_fname))) { sprintf(gszMsgBox, TgLoadString(STID_CONVERT_FORMAT_WHILE_EXEC_CMD), file_name, format, orig_cmd); *************** *** 7420,7424 **** import_type = FILE_IMPORTXPM; *xpm_fname = '\0'; ! if (!ConvertPngToXpm(file_name, xpm_fname)) { sprintf(gszMsgBox, TgLoadString(STID_CONVERT_FORMAT_WHILE_EXEC_CMD), file_name, format, orig_cmd); --- 7470,7474 ---- import_type = FILE_IMPORTXPM; *xpm_fname = '\0'; ! if (!ConvertPngToXpm(file_name, xpm_fname, sizeof(xpm_fname))) { sprintf(gszMsgBox, TgLoadString(STID_CONVERT_FORMAT_WHILE_EXEC_CMD), file_name, format, orig_cmd); *************** *** 7435,7439 **** import_type = FILE_IMPORTXPM; *xpm_fname = '\0'; ! if (!ConvertJpegToXpm(file_name, xpm_fname)) { sprintf(gszMsgBox, TgLoadString(STID_CONVERT_FORMAT_WHILE_EXEC_CMD), file_name, format, orig_cmd); --- 7485,7489 ---- import_type = FILE_IMPORTXPM; *xpm_fname = '\0'; ! if (!ConvertJpegToXpm(file_name, xpm_fname, sizeof(xpm_fname))) { sprintf(gszMsgBox, TgLoadString(STID_CONVERT_FORMAT_WHILE_EXEC_CMD), file_name, format, orig_cmd); *************** *** 7450,7454 **** import_type = FILE_IMPORTXPM; *xpm_fname = '\0'; ! if (!ConvertOtherToXpm(file_name, format, xpm_fname)) { sprintf(gszMsgBox, TgLoadString(STID_CONVERT_FORMAT_WHILE_EXEC_CMD), file_name, format, orig_cmd); --- 7500,7504 ---- import_type = FILE_IMPORTXPM; *xpm_fname = '\0'; ! if (!ConvertOtherToXpm(file_name, format, xpm_fname, sizeof(xpm_fname))) { sprintf(gszMsgBox, TgLoadString(STID_CONVERT_FORMAT_WHILE_EXEC_CMD), file_name, format, orig_cmd); *************** *** 8308,8312 **** } UpdSelBBox(); ! GroupSelObj(TRUE, TRUE); RemoveAllSel(); justDupped = FALSE; --- 8358,8362 ---- } UpdSelBBox(); ! GroupSelObj(TRUE, TRUE, TRUE); RemoveAllSel(); justDupped = FALSE; *** file.c.orig Fri Aug 4 14:04:00 2000 --- file.c Fri Aug 4 14:04:01 2000 *************** *** 216,219 **** --- 216,252 ---- static struct DocFontRec *firstDocFont=NULL; + char *MkTempFile(buf, buf_sz, psz_dir, psz_prefix) + char *buf, *psz_dir, *psz_prefix; + int buf_sz; + { + #ifndef _DONT_USE_MKTEMP + sprintf(buf, "%s%sXXXXXX", psz_dir, psz_prefix); + mktemp(buf); + #else /* _DONT_USE_MKTEMP */ + UtilStrCpyN(buf, buf_sz, (char*)tempnam(psz_dir, psz_prefix)); + #endif /* ~_DONT_USE_MKTEMP */ + + #ifdef O_EXCL + { + int fd=open(buf, O_CREAT|O_EXCL|O_WRONLY); + + if (fd == -1) { + /* barf loudly that someone is trying to hack the box */ + sprintf(gszMsgBox, TgLoadString(STID_RACE_IN_CREATE_TMP_FILE), buf); + if (PRTGIF) { + fprintf(stderr, "%s\n", gszMsgBox); + } else { + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + } + } else { + close(fd); + } + } + #endif /* O_EXCL */ + unlink(buf); + + return buf; + } + int IsFiletUnSavable() { *************** *** 247,250 **** --- 280,475 ---- } + static + void DumpDocumentFonts(dump_fp) + FILE *dump_fp; + { + struct DocFontRec *next_df=NULL; + + if (fprintf(dump_fp, "%%%%DocumentFonts: ") == EOF) { + writeFileFailed = TRUE; + } + for ( ; firstDocFont != NULL; firstDocFont=next_df) { + next_df = firstDocFont->next; + if (fprintf(dump_fp, "%s", firstDocFont->name) == EOF) { + writeFileFailed = TRUE; + } + if (next_df != NULL) { + if (fprintf(dump_fp, "\n%%%%+ ") == EOF) { + writeFileFailed = TRUE; + } + } + free(firstDocFont); + } + if (fprintf(dump_fp, "\n") == EOF) writeFileFailed = TRUE; + } + + #define LANGUAGELEVEL 0 + #define EXTENSIONS 1 + #define DOCUMENTFONTS 2 + #define DOCUMENTNEEDEDRESOURCES 3 + #define DOCUMENTNEEDEDFONTS 4 + + #define MAXPROPAGATEDEPSINFO 5 + + struct tagPropagatedEPSInfoRec { + char *name; + int status; + } gstPropagatedEPSInfo[] = { + { "%%LanguageLevel", LANGUAGELEVEL }, + { "%%Extensions", EXTENSIONS }, + { "%%DocumentFonts", DOCUMENTFONTS }, + { "%%DocumentNeededResources", DOCUMENTNEEDEDRESOURCES }, + { "%%DocumentNeededFonts", DOCUMENTNEEDEDFONTS }, + { NULL, INVALID } + }; + + static KeyValInfo *gPropagatedEPSInfo[MAXPROPAGATEDEPSINFO]; + static int maxLanguageLevel=0; + + static + int FindPropagatedEPSInfo(buf) + char *buf; + { + struct tagPropagatedEPSInfoRec *ppei=gstPropagatedEPSInfo; + + for (ppei=gstPropagatedEPSInfo; ppei->name != NULL; ppei++) { + if (strcmp(buf, ppei->name) == 0) { + return ppei->status; + } + } + return INVALID; + } + + static + void CleanUpPropagatedEPSInfo() + { + int i=0; + + maxLanguageLevel = 0; + for (i=0; i < MAXPROPAGATEDEPSINFO; i++) { + KeyValInfo *pkvi=NULL, *p_next_kvi=NULL; + + for (pkvi=gPropagatedEPSInfo[i]; pkvi != NULL; pkvi=p_next_kvi) { + p_next_kvi = pkvi->next; + UtilFree(pkvi->value); + free(pkvi); + } + } + memset(gPropagatedEPSInfo, 0, MAXPROPAGATEDEPSINFO*sizeof(KeyValInfo*)); + } + + static + void DumpPropagatedEPSInfo(dump_fp) + FILE *dump_fp; + { + int i=0; + + if (maxLanguageLevel > 0) { + if (fprintf(dump_fp, "%%%%LanguageLevel: %1d\n", maxLanguageLevel) == + EOF) { + writeFileFailed = TRUE; + } + } + for (i=0; i < MAXPROPAGATEDEPSINFO; i++) { + if (gPropagatedEPSInfo[i] != NULL) { + KeyValInfo *pkvi=NULL, *p_next_kvi=NULL; + + if (fprintf(dump_fp, "%s: ", gstPropagatedEPSInfo[i].name) == EOF) { + writeFileFailed = TRUE; + } + for (pkvi=gPropagatedEPSInfo[i]; pkvi != NULL; pkvi=p_next_kvi) { + p_next_kvi = pkvi->next; + if (fprintf(dump_fp, "%s", pkvi->value) == EOF) { + writeFileFailed = TRUE; + } + if (p_next_kvi != NULL) { + if (fprintf(dump_fp, "\n%%%%+ ") == EOF) { + writeFileFailed = TRUE; + } + } + UtilFree(pkvi->value); + free(pkvi); + } + if (fprintf(dump_fp, "\n") == EOF) writeFileFailed = TRUE; + gPropagatedEPSInfo[i] = NULL; + } + } + } + + static + void DoUpdatePropagatedEPSInfo(index, psz_value) + int index; + char *psz_value; + { + int len=strlen(psz_value); + KeyValInfo *pkvi=NULL, *p_last_kvi=NULL; + + for (pkvi=gPropagatedEPSInfo[index]; pkvi != NULL; pkvi=pkvi->next) { + if (pkvi->key == ((char*)len) && strcmp(pkvi->value, psz_value) == 0) { + return; + } + p_last_kvi = pkvi; + } + pkvi = (KeyValInfo *)malloc(sizeof(KeyValInfo)); + if (pkvi == NULL) FailAllocMessage(); + memset(pkvi, 0, sizeof(KeyValInfo)); + pkvi->key = ((char*)len); + pkvi->value = UtilStrDup(psz_value); + if (pkvi->value == NULL) FailAllocMessage(); + if (p_last_kvi == NULL) { + gPropagatedEPSInfo[index] = pkvi; + } else { + p_last_kvi->next = pkvi; + } + } + + void UpdatePropagatedEPSInfo(line, pn_status) + char *line; + int *pn_status; + { + int propagated_eps_status=INVALID, level=0; + char *arg=NULL; + + if (*pn_status == INVALID) { + arg = strchr(line, ':'); + + if (arg == NULL) return; + *arg++ = '\0'; + propagated_eps_status = FindPropagatedEPSInfo(line); + if (propagated_eps_status == INVALID) return; + } else { + propagated_eps_status = (*pn_status); + arg = (&line[3]); + } + #ifdef _TGIF_DBG /* debug, do not translate */ + TgAssert(propagated_eps_status != INVALID, + "propagated_eps_status != INVALID in UpdatePropagatedEPSInfo()", + NULL); + #endif /* _TGIF_DBG */ + UtilTrimBlanks(arg); + if (arg[0] == '(' && UtilStrICmp(arg, "(atend)") == 0) { + *pn_status = INVALID; + return; + } + switch (propagated_eps_status) { + case LANGUAGELEVEL: + if (sscanf(arg, "%d", &level) == 1) { + if (level > maxLanguageLevel) { + maxLanguageLevel = level; + } + } + break; + case EXTENSIONS: + case DOCUMENTNEEDEDFONTS: + case DOCUMENTNEEDEDRESOURCES: + DoUpdatePropagatedEPSInfo(propagated_eps_status, arg); + break; + case DOCUMENTFONTS: + UpdateDocumentFonts(arg); + break; + } + *pn_status = propagated_eps_status; + } + static int dontUseShortHandPS=INVALID; static int dontCondense=INVALID; *************** *** 414,420 **** FILE *read_fp=NULL, *write_fp=NULL; ! sprintf(write_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(write_fname); ! unlink(write_fname); if ((read_fp=fopen(read_fname, "r")) == NULL) { --- 639,643 ---- FILE *read_fp=NULL, *write_fp=NULL; ! MkTempFile(write_fname, sizeof(write_fname), tmpDir, TOOL_NAME); if ((read_fp=fopen(read_fname, "r")) == NULL) { *************** *** 1272,1278 **** char tmp_fname[MAXPATHLENGTH]; ! sprintf(tmp_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmp_fname); ! unlink(tmp_fname); strcpy(gzipped_fname, new_full_name); strcpy(new_full_name, tmp_fname); --- 1495,1499 ---- char tmp_fname[MAXPATHLENGTH]; ! MkTempFile(tmp_fname, sizeof(tmp_fname), tmpDir, TOOL_NAME); strcpy(gzipped_fname, new_full_name); strcpy(new_full_name, tmp_fname); *************** *** 1774,1780 **** char tmp_fname[MAXPATHLENGTH]; ! sprintf(tmp_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmp_fname); ! unlink(tmp_fname); strcpy(gzipped_fname, full_name); strcpy(full_name, tmp_fname); --- 1995,1999 ---- char tmp_fname[MAXPATHLENGTH]; ! MkTempFile(tmp_fname, sizeof(tmp_fname), tmpDir, TOOL_NAME); strcpy(gzipped_fname, full_name); strcpy(full_name, tmp_fname); *************** *** 3320,3326 **** } ! 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 */ --- 3539,3545 ---- } ! int ImportGivenFile(file_name, group_and_lock, highlight) char *file_name; ! int group_and_lock, highlight; /* returns TRUE if ok */ /* returns FALSE if file_name looks ok, only have temporary problems */ *************** *** 3566,3570 **** } if (file_is_remote) { ! if (!foundGoodStateObject) PasteString(remote_buf); unlink(tmp_remote_fname); --- 3785,3789 ---- } if (file_is_remote) { ! if (!foundGoodStateObject) PasteString(remote_buf, TRUE, TRUE); unlink(tmp_remote_fname); *************** *** 3606,3610 **** RecordCmd(CMD_NEW, NULL, topSel, botSel, numObjSelected); } ! HighLightForward(); if (!importFromLibrary && !file_is_remote) { --- 3825,3829 ---- RecordCmd(CMD_NEW, NULL, topSel, botSel, numObjSelected); } ! if (highlight) HighLightForward(); if (!importFromLibrary && !file_is_remote) { *************** *** 3649,3653 **** return; } ! ImportGivenFile(file_name, FALSE); importingFile = FALSE; SetCurChoice(curChoiceBeforeMakeQuiescent); --- 3868,3872 ---- return; } ! ImportGivenFile(file_name, FALSE, TRUE); importingFile = FALSE; SetCurChoice(curChoiceBeforeMakeQuiescent); *************** *** 3760,3764 **** SetWatchCursor(mainWindow); SaveStatusStrings(); ! ok = ConvertGifToXpm(tmp_gif_fname, tmp_xpm_fname); RestoreStatusStrings(); SetDefaultCursor(mainWindow); --- 3979,3984 ---- SetWatchCursor(mainWindow); SaveStatusStrings(); ! ok = ConvertGifToXpm(tmp_gif_fname, tmp_xpm_fname, ! sizeof(tmp_xpm_fname)); RestoreStatusStrings(); SetDefaultCursor(mainWindow); *************** *** 3775,3779 **** SetWatchCursor(mainWindow); SaveStatusStrings(); ! ok = ConvertGifToXpm(myFileBgGifURL, tmp_xpm_fname); RestoreStatusStrings(); SetDefaultCursor(mainWindow); --- 3995,4000 ---- SetWatchCursor(mainWindow); SaveStatusStrings(); ! ok = ConvertGifToXpm(myFileBgGifURL, tmp_xpm_fname, ! sizeof(tmp_xpm_fname)); RestoreStatusStrings(); SetDefaultCursor(mainWindow); *************** *** 4642,4645 **** --- 4863,5108 ---- } + static + int SetPortName(name, buf, buf_sz, pn_buf_index) + char *name, *buf; + int buf_sz, *pn_buf_index; + { + int len=strlen(name)+1, index=(*pn_buf_index); + + if (index+len+1 > buf_sz) { + sprintf(gszMsgBox, TgLoadCachedString(CSTID_PORTNAME_TOO_LONG_SKIPPED), + buf); + if (PRTGIF) { + fprintf(stderr, "%s\n", gszMsgBox); + } else { + Msg(gszMsgBox); + } + return FALSE; + } + buf[index] = '!'; + strcpy(&buf[index+1], name); + (*pn_buf_index) = index+len; + buf[(*pn_buf_index)] = '\0'; + + return TRUE; + } + + static + void DumpNetlListLine(FP, port_name, pMiniLine) + FILE *FP; + char *port_name; + MiniLineInfo *pMiniLine; + { + int need_to_free_tmp_buf=FALSE; + char *tmp_buf=ConvertMiniLineToString(pMiniLine, &need_to_free_tmp_buf); + char *c_ptr=strchr(tmp_buf, '='); + + if (fprintf(FP, "\"%s\",\t\"%s\"\n", port_name, ++c_ptr) == EOF) { + writeFileFailed = TRUE; + } + if (need_to_free_tmp_buf) UtilFree(tmp_buf); + } + + static + void DumpNetListForAPort(FP, ObjPtr, buf, buf_sz, pn_buf_index) + FILE *FP; + struct ObjRec *ObjPtr; + char *buf; + int buf_sz, *pn_buf_index; + { + struct AttrRec *attr_ptr=FindObjAttrWithName(ObjPtr, "name="); + int ok=TRUE; + + if (attr_ptr != NULL) { + if (BlankStr(attr_ptr->attr_value.s)) { + /* do not translate -- program constants */ + ok = SetPortName("(unknown)", buf, buf_sz, pn_buf_index); + } else { + ok = SetPortName(attr_ptr->attr_value.s, buf, buf_sz, + pn_buf_index); + } + } + if (ok) { + attr_ptr = FindAttrWithName(ObjPtr, "signal_name=", NULL); + DumpNetlListLine(FP, buf, attr_ptr->obj->detail.t->minilines.first); + } + } + + static + void DoDumpNetListForAnObj(FP, ObjPtr) + FILE *FP; + struct ObjRec *ObjPtr; + { + struct ObjRec *obj_ptr=NULL; + struct AttrRec *attr_ptr=NULL; + char port_name[MAXSTRING]; + + switch (ObjPtr->type) { + case OBJ_SYM: + case OBJ_ICON: + if ((attr_ptr=FindObjAttrWithName(ObjPtr, "name=")) != NULL) { + int index=0, ok=TRUE; + + if (BlankStr(attr_ptr->attr_value.s)) { + /* do not translate -- program constants */ + ok = SetPortName("(unknown)", port_name, sizeof(port_name), &index); + } else { + ok = SetPortName(attr_ptr->attr_value.s, port_name, + sizeof(port_name), &index); + } + if (ok) { + if (ObjIsAPort(ObjPtr)) { + attr_ptr = FindAttrWithName(ObjPtr, "signal_name=", NULL); + DumpNetlListLine(FP, port_name, + attr_ptr->obj->detail.t->minilines.first); + } else { + for (obj_ptr=ObjPtr->detail.r->last; obj_ptr != NULL; + obj_ptr=obj_ptr->prev) { + obj_ptr->tmp_parent = ObjPtr; + if (obj_ptr->type != OBJ_TEXT && ObjIsAPort(obj_ptr)) { + int saved_index=index; + + port_name[saved_index] = '\0'; + DumpNetListForAPort(FP, obj_ptr, port_name, + sizeof(port_name), &index); + index = saved_index; + } + } + } + } + } + break; + case OBJ_GROUP: + for (obj_ptr=ObjPtr->detail.r->last; obj_ptr != NULL; + obj_ptr=obj_ptr->prev) { + obj_ptr->tmp_parent = ObjPtr; + DoDumpNetListForAnObj(FP, obj_ptr); + } + break; + case OBJ_PIN: + obj_ptr = GetPinObj(ObjPtr); + if ((attr_ptr=FindObjAttrWithName(obj_ptr, "name=")) != NULL) { + int index=0, ok=TRUE; + + if (BlankStr(attr_ptr->attr_value.s)) { + /* do not translate -- program constants */ + ok = SetPortName("(unknown)", port_name, sizeof(port_name), &index); + } else { + ok = SetPortName(attr_ptr->attr_value.s, port_name, + sizeof(port_name), &index); + } + if (ok) { + if (ObjIsAPort(obj_ptr)) { + attr_ptr = FindAttrWithName(obj_ptr, "signal_name=", NULL); + DumpNetlListLine(FP, port_name, + attr_ptr->obj->detail.t->minilines.first); + } + } + } + break; + } + } + + static + void DumpComponentAttrs(FP, ObjPtr) + FILE *FP; + struct ObjRec *ObjPtr; + { + struct AttrRec *attr_ptr=NULL; + + for (attr_ptr=ObjPtr->fattr; attr_ptr != NULL; attr_ptr=attr_ptr->next) { + if (strcmp(attr_ptr->attr_name.s, "name=") != 0 && + strcmp(attr_ptr->attr_name.s, "type=") != 0) { + int need_to_free_tmp_buf=FALSE; + char *tmp_buf; + + tmp_buf = ConvertAttrNameFirstMiniLineToString(attr_ptr, + &need_to_free_tmp_buf); + if (fprintf(FP, "\t%s\n", tmp_buf) == EOF) writeFileFailed = TRUE; + if (need_to_free_tmp_buf) UtilFree(tmp_buf); + } + } + } + + static + void DoDumpComponentForAnObj(FP, ObjPtr) + FILE *FP; + struct ObjRec *ObjPtr; + { + struct ObjRec *obj_ptr=NULL; + struct AttrRec *attr_ptr=NULL; + char port_name[MAXSTRING]; + + switch (ObjPtr->type) { + case OBJ_SYM: + case OBJ_ICON: + if ((attr_ptr=FindObjAttrWithName(ObjPtr, "name=")) != NULL) { + char *comp_name=NULL; + + if (BlankStr(attr_ptr->attr_value.s)) { + /* do not translate -- program constants */ + comp_name = "(unknown)"; + } else { + comp_name = attr_ptr->attr_value.s; + } + attr_ptr = FindAttrWithName(ObjPtr, "type=", NULL); + if (attr_ptr != NULL) { + char *comp_type=attr_ptr->attr_value.s; + + if (fprintf(FP, "%s: %s\n", comp_name, comp_type) == EOF) { + writeFileFailed = TRUE; + } + DumpComponentAttrs(FP, ObjPtr); + } + } + break; + case OBJ_GROUP: + for (obj_ptr=ObjPtr->detail.r->last; obj_ptr != NULL; + obj_ptr=obj_ptr->prev) { + obj_ptr->tmp_parent = ObjPtr; + DoDumpComponentForAnObj(FP, obj_ptr); + } + break; + case OBJ_PIN: + obj_ptr = GetPinObj(ObjPtr); + if ((attr_ptr=FindObjAttrWithName(obj_ptr, "name=")) != NULL) { + char *comp_name=NULL; + + if (BlankStr(attr_ptr->attr_value.s)) { + /* do not translate -- program constants */ + comp_name = "(unknown)"; + } else { + comp_name = attr_ptr->attr_value.s; + } + attr_ptr = FindAttrWithName(obj_ptr, "type=", NULL); + if (attr_ptr != NULL) { + char *comp_type=attr_ptr->attr_value.s; + + if (fprintf(FP, "%s: %s\n", comp_name, comp_type) == EOF) { + writeFileFailed = TRUE; + } + DumpComponentAttrs(FP, ObjPtr); + } + } + break; + } + } + + static + void DumpNetListForAnObj(FP, ObjPtr) + FILE *FP; + struct ObjRec *ObjPtr; + { + connectingPortsFromInternalCommand = FALSE; + if (preDumpSetup) { + /* dumping components */ + DoDumpComponentForAnObj(FP, ObjPtr); + } else { + /* dumping netlist */ + DoDumpNetListForAnObj(FP, ObjPtr); + } + connectingPortsFromInternalCommand = TRUE; + } + #define WRITEBYTE(fp,byte) fputc((byte),(fp)) *************** *** 5177,5181 **** int i, len, short_name=FALSE, export_cap=0; time_t tloc; - struct DocFontRec *next_df; if (!curDirIsLocal) { --- 5640,5643 ---- *************** *** 5267,5277 **** } /* ! * At this point, whereToPrint can only be PostScript, ASCII Text, * or external export type (if whereToPrint >= MAXDEFWHERETOPRINT). */ if (printingPageNum == printingFirstPageNum) { ! sprintf(tmpFile, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmpFile); ! unlink(tmpFile); if ((dumpFP=fopen(tmpFile, "w")) == NULL) { --- 5729,5737 ---- } /* ! * At this point, whereToPrint can only be PostScript, ASCII Text, NetList, * or external export type (if whereToPrint >= MAXDEFWHERETOPRINT). */ if (printingPageNum == printingFirstPageNum) { ! MkTempFile(tmpFile, sizeof(tmpFile), tmpDir, TOOL_NAME); if ((dumpFP=fopen(tmpFile, "w")) == NULL) { *************** *** 5285,5289 **** return FALSE; } - if (PRTGIF && !cmdLineStdOut) { fprintf(stderr, TgLoadString(STID_WRITING_TO_DOTS), tmpFile); --- 5745,5748 ---- *************** *** 5295,5299 **** if (whereToPrint < MAXDEFWHERETOPRINT && printingPageNum == printingFirstPageNum && ! whereToPrint != TEXT_FILE) { PSUseShortHand(); if (dontUseShortHandPS) { --- 5754,5758 ---- if (whereToPrint < MAXDEFWHERETOPRINT && printingPageNum == printingFirstPageNum && ! whereToPrint != TEXT_FILE && whereToPrint != NETLIST_FILE) { PSUseShortHand(); if (dontUseShortHandPS) { *************** *** 5449,5452 **** --- 5908,5917 ---- } } + if (whereToPrint == NETLIST_FILE && !preDumpSetup && + printingPageNum == printingFirstPageNum) { + if (fprintf(dumpFP, "PORTNAME\tSIGNALNAME\n") == EOF) { + writeFileFailed = TRUE; + } + } if (pageLayoutMode == PAGE_STACK || (pageLayoutMode == PAGE_TILE && ((paperCol == 1 && paperRow == 1) || *************** *** 5469,5472 **** --- 5934,5942 ---- DumpAnObjInAscii(dumpFP, obj_ptr); } + } else if (whereToPrint == NETLIST_FILE) { + for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { + obj_ptr->tmp_parent = NULL; + DumpNetListForAnObj(dumpFP, obj_ptr); + } } else { if ((whereToPrint != LATEX_FIG && whereToPrint != EPSI_FILE) || *************** *** 5594,5597 **** --- 6064,6072 ---- DumpAnObjInAscii(dumpFP, obj_ptr); } + } else if (whereToPrint == NETLIST_FILE) { + for (obj_ptr=botObj; obj_ptr != NULL; obj_ptr=obj_ptr->prev) { + obj_ptr->tmp_parent = NULL; + DumpNetListForAnObj(dumpFP, obj_ptr); + } } else { int row, col; *************** *** 5802,5806 **** return TRUE; } ! if (whereToPrint < MAXDEFWHERETOPRINT && whereToPrint != TEXT_FILE) { if ((whereToPrint != LATEX_FIG && whereToPrint != EPSI_FILE) || !minimalEPS) { --- 6277,6282 ---- return TRUE; } ! if (whereToPrint < MAXDEFWHERETOPRINT && whereToPrint != TEXT_FILE && ! whereToPrint != NETLIST_FILE) { if ((whereToPrint != LATEX_FIG && whereToPrint != EPSI_FILE) || !minimalEPS) { *************** *** 5821,5840 **** if ((whereToPrint != LATEX_FIG && whereToPrint != EPSI_FILE) || !minimalEPS) { ! if (fprintf(dumpFP, "%%%%DocumentFonts: ") == EOF) { ! writeFileFailed = TRUE; ! } ! for ( ; firstDocFont != NULL; firstDocFont = next_df) { ! next_df = firstDocFont->next; ! if (fprintf(dumpFP, "%s", firstDocFont->name) == EOF) { ! writeFileFailed = TRUE; ! } ! if (next_df != NULL) { ! if (fprintf(dumpFP, "\n%%%%+ ") == EOF) { ! writeFileFailed = TRUE; ! } ! } ! free(firstDocFont); ! } ! if (fprintf(dumpFP, "\n") == EOF) writeFileFailed = TRUE; if (fprintf(dumpFP, "%%%%EOF\n") == EOF) writeFileFailed = TRUE; } --- 6297,6302 ---- if ((whereToPrint != LATEX_FIG && whereToPrint != EPSI_FILE) || !minimalEPS) { ! DumpDocumentFonts(dumpFP); ! DumpPropagatedEPSInfo(dumpFP); if (fprintf(dumpFP, "%%%%EOF\n") == EOF) writeFileFailed = TRUE; } *************** *** 5846,5850 **** if (whereToPrint < MAXDEFWHERETOPRINT && whereToPrint != TEXT_FILE && ! !totalBBoxValid) { strcpy(gszMsgBox, TgLoadString(STID_NO_OBJ_TO_PRINT)); if (PRTGIF) { --- 6308,6312 ---- if (whereToPrint < MAXDEFWHERETOPRINT && whereToPrint != TEXT_FILE && ! whereToPrint != NETLIST_FILE && !totalBBoxValid) { strcpy(gszMsgBox, TgLoadString(STID_NO_OBJ_TO_PRINT)); if (PRTGIF) { *************** *** 5865,5869 **** return FALSE; } ! if (preDumpSetup) { unlink(tmpFile); return TRUE; --- 6327,6331 ---- return FALSE; } ! if (preDumpSetup && whereToPrint != NETLIST_FILE) { unlink(tmpFile); return TRUE; *************** *** 6151,6155 **** default: /* ! * whereToPrint >= MAXDEFWHERETOPRINT */ if (PRTGIF) { --- 6613,6617 ---- default: /* ! * whereToPrint >= MAXDEFWHERETOPRINT or whereToPrint == NETLIST_FILE */ if (PRTGIF) { *************** *** 6238,6241 **** --- 6700,6704 ---- if (preDumpSetup) { + CleanUpPropagatedEPSInfo(); saved_dont_condense = dontCondense; hasReadHexString = FALSE; *************** *** 6268,6274 **** INFO_MB); } ! if (!preDumpSetup && hasReadHexString) { ! dontCondense = saved_dont_condense; ! hasReadHexString = FALSE; } return rc; --- 6731,6740 ---- INFO_MB); } ! if (!preDumpSetup) { ! if (hasReadHexString) { ! dontCondense = saved_dont_condense; ! hasReadHexString = FALSE; ! } ! CleanUpPropagatedEPSInfo(); } return rc; *************** *** 6312,6316 **** if (whereToPrint == PRINTER || whereToPrint == PS_FILE || whereToPrint == PDF_FILE || whereToPrint == TEXT_FILE || ! (whereToPrint >= MAXDEFWHERETOPRINT && (GetExportFilterCapability(whereToPrint) & TGEF_CAP_MULTI_PAGE) != 0)) { --- 6778,6782 ---- if (whereToPrint == PRINTER || whereToPrint == PS_FILE || whereToPrint == PDF_FILE || whereToPrint == TEXT_FILE || ! whereToPrint == NETLIST_FILE || (whereToPrint >= MAXDEFWHERETOPRINT && (GetExportFilterCapability(whereToPrint) & TGEF_CAP_MULTI_PAGE) != 0)) { *************** *** 6320,6324 **** if (whereToPrint==PRINTER || whereToPrint==LATEX_FIG || whereToPrint==PS_FILE || whereToPrint==PDF_FILE || ! whereToPrint==EPSI_FILE || whereToPrint==TIFFEPSI_FILE) { ResetPSInfo(); --- 6786,6791 ---- if (whereToPrint==PRINTER || whereToPrint==LATEX_FIG || whereToPrint==PS_FILE || whereToPrint==PDF_FILE || ! whereToPrint==EPSI_FILE || whereToPrint==TIFFEPSI_FILE || ! whereToPrint==NETLIST_FILE) { ResetPSInfo(); *************** *** 6335,6339 **** if (whereToPrint==PRINTER || whereToPrint==LATEX_FIG || whereToPrint==PS_FILE || whereToPrint==PDF_FILE || ! whereToPrint==EPSI_FILE || whereToPrint==TIFFEPSI_FILE) { ResetPSInfo(); --- 6802,6807 ---- if (whereToPrint==PRINTER || whereToPrint==LATEX_FIG || whereToPrint==PS_FILE || whereToPrint==PDF_FILE || ! whereToPrint==EPSI_FILE || whereToPrint==TIFFEPSI_FILE || ! whereToPrint==NETLIST_FILE) { ResetPSInfo(); *************** *** 7034,7038 **** StartCompositeCmd(); importingFile = TRUE; ! rc = ImportGivenFile(file_name, TRUE); importingFile = FALSE; if (rc == BAD) { --- 7502,7506 ---- StartCompositeCmd(); importingFile = TRUE; ! rc = ImportGivenFile(file_name, TRUE, TRUE); importingFile = FALSE; if (rc == BAD) { *************** *** 7241,7244 **** --- 7709,7713 ---- case XBM_FILE: case TEXT_FILE: + case NETLIST_FILE: case EPSI_FILE: case GIF_FILE: *** grid.c.orig Fri Aug 4 14:04:03 2000 --- grid.c Fri Aug 4 14:04:03 2000 *************** *** 547,550 **** --- 547,553 ---- case PNG_FILE: Msg(TgLoadString(STID_WILL_EXPORT_PNG_FILE)); break; case JPEG_FILE: Msg(TgLoadString(STID_WILL_EXPORT_JPEG_FILE)); break; + case NETLIST_FILE: + Msg(TgLoadString(STID_WILL_EXPORT_NETLIST_FILE)); + break; } } *** imgproc.c.orig Fri Aug 4 14:04:04 2000 --- imgproc.c Fri Aug 4 14:04:04 2000 *************** *** 1397,1409 **** /* ----------------------- ProcessImage ----------------------- */ ! FILE *GetImageProcOutputFileName(pszPath, pnShortName, ppszRest) char *pszPath, **ppszRest; ! int *pnShortName; { FILE *fp=NULL; ! sprintf(pszPath, "%sTgifXXXXXX", TMP_DIR); ! mktemp(pszPath); ! unlink(pszPath); if ((*pnShortName=IsPrefix(bootDir, pszPath, ppszRest))) { *ppszRest = (&(*ppszRest)[1]); --- 1397,1407 ---- /* ----------------------- ProcessImage ----------------------- */ ! FILE *GetImageProcOutputFileName(pszPath, path_buf_sz, pnShortName, ppszRest) char *pszPath, **ppszRest; ! int path_buf_sz, *pnShortName; { FILE *fp=NULL; ! MkTempFile(pszPath, path_buf_sz, tmpDir, TOOL_NAME); if ((*pnShortName=IsPrefix(bootDir, pszPath, ppszRest))) { *ppszRest = (&(*ppszRest)[1]); *************** *** 1446,1450 **** struct XPmRec *xpm_ptr=NULL; ! if ((fp=GetImageProcOutputFileName(path, &short_name, &rest)) == NULL) { return FALSE; } --- 1444,1449 ---- struct XPmRec *xpm_ptr=NULL; ! if ((fp=GetImageProcOutputFileName(path, sizeof(path), &short_name, ! &rest)) == NULL) { return FALSE; } *************** *** 5039,5044 **** static ! int BggenGenerateXpm(image_w, image_h, sz_spec, sz_path) ! int image_w, image_h; char *sz_spec, *sz_path; { --- 5038,5043 ---- static ! int BggenGenerateXpm(image_w, image_h, sz_spec, sz_path, path_buf_sz) ! int image_w, image_h, path_buf_sz; char *sz_spec, *sz_path; { *************** *** 5047,5053 **** int bytes_read; ! sprintf(sz_path, "%sTgifXXXXXX", TMP_DIR); ! mktemp(sz_path); ! unlink(sz_path); sprintf(sz_geom, "%1dx%1d", image_w, image_h); sprintf(gszMsgBox, bggenToXpmCmd, sz_spec, sz_geom); --- 5046,5050 ---- int bytes_read; ! MkTempFile(sz_path, path_buf_sz, tmpDir, TOOL_NAME); sprintf(sz_geom, "%1dx%1d", image_w, image_h); sprintf(gszMsgBox, bggenToXpmCmd, sz_spec, sz_geom); *************** *** 5133,5137 **** } SaveStatusStrings(); ! if (!BggenGenerateXpm(image_w, image_h, szSpec, szPath)) { RestoreStatusStrings(); if (use_obj_pos) HighLightForward(); --- 5130,5134 ---- } SaveStatusStrings(); ! if (!BggenGenerateXpm(image_w, image_h, szSpec, szPath, sizeof(szPath))) { RestoreStatusStrings(); if (use_obj_pos) HighLightForward(); *************** *** 5185,5190 **** static ! int CircularBggenGenerateXpm(image_w, image_h, ncolors, sz_path) ! int image_w, image_h, ncolors; char *sz_path; { --- 5182,5187 ---- static ! int CircularBggenGenerateXpm(image_w, image_h, ncolors, sz_path, path_buf_sz) ! int image_w, image_h, ncolors, path_buf_sz; char *sz_path; { *************** *** 5194,5200 **** double max_dist; ! sprintf(sz_path, "%sTgifXXXXXX", TMP_DIR); ! mktemp(sz_path); ! unlink(sz_path); gpHistogram = (XColor*)malloc(ncolors*sizeof(XColor)); gnFinalImageIndex = (int**)malloc(image_h*sizeof(int*)); --- 5191,5195 ---- double max_dist; ! MkTempFile(sz_path, path_buf_sz, tmpDir, TOOL_NAME); gpHistogram = (XColor*)malloc(ncolors*sizeof(XColor)); gnFinalImageIndex = (int**)malloc(image_h*sizeof(int*)); *************** *** 5330,5334 **** } SaveStatusStrings(); ! if (!CircularBggenGenerateXpm(image_w, image_h, ncolors, szPath)) { RestoreStatusStrings(); if (use_obj_pos) HighLightForward(); --- 5325,5330 ---- } SaveStatusStrings(); ! if (!CircularBggenGenerateXpm(image_w, image_h, ncolors, szPath, ! sizeof(szPath))) { RestoreStatusStrings(); if (use_obj_pos) HighLightForward(); *************** *** 5382,5387 **** static ! int SimpleRectBggenGenerateXpm(image_w, image_h, pxcolor, sz_path) ! int image_w, image_h; XColor *pxcolor; char *sz_path; --- 5378,5383 ---- static ! int SimpleRectBggenGenerateXpm(image_w, image_h, pxcolor, sz_path, path_buf_sz) ! int image_w, image_h, path_buf_sz; XColor *pxcolor; char *sz_path; *************** *** 5390,5396 **** int i, target_percent; ! sprintf(sz_path, "%sTgifXXXXXX", TMP_DIR); ! mktemp(sz_path); ! unlink(sz_path); gpHistogram = (XColor*)malloc(sizeof(XColor)); gnFinalImageIndex = (int**)malloc(image_h*sizeof(int*)); --- 5386,5390 ---- int i, target_percent; ! MkTempFile(sz_path, path_buf_sz, tmpDir, TOOL_NAME); gpHistogram = (XColor*)malloc(sizeof(XColor)); gnFinalImageIndex = (int**)malloc(image_h*sizeof(int*)); *************** *** 5505,5509 **** } SaveStatusStrings(); ! if (!SimpleRectBggenGenerateXpm(image_w, image_h, &xcolor, szPath)) { RestoreStatusStrings(); if (use_obj_pos) HighLightForward(); --- 5499,5504 ---- } SaveStatusStrings(); ! if (!SimpleRectBggenGenerateXpm(image_w, image_h, &xcolor, szPath, ! sizeof(szPath))) { RestoreStatusStrings(); if (use_obj_pos) HighLightForward(); *************** *** 6091,6096 **** /* ----------------------- ReplaceColor ----------------------- */ - static XComposeStatus c_stat; - static unsigned int FillReplacePickAPoint(OrigX, OrigY, EndX, EndY, AllowDrag, cursor) --- 6086,6089 ---- *************** *** 6150,6160 **** SelBox(drawWindow, revDefaultGC, *OrigX, *OrigY, *EndX, *EndY); } else if (input.type == KeyPress) { ! XKeyEvent *key_ev=(&(input.xkey)); ! KeySym key_sym; ! char s[80]; ! int has_ch=XLookupString(key_ev, s, sizeof(s), &key_sym, &c_stat); ! ! TranslateKeys(s, &key_sym); ! if (CharIsESC(key_ev, s, key_sym, &has_ch)) { if (AllowDrag && dragging) { SelBox(drawWindow, revDefaultGC, *OrigX, *OrigY, *EndX, *EndY); --- 6143,6147 ---- SelBox(drawWindow, revDefaultGC, *OrigX, *OrigY, *EndX, *EndY); } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { if (AllowDrag && dragging) { SelBox(drawWindow, revDefaultGC, *OrigX, *OrigY, *EndX, *EndY); *** import.c.orig Fri Aug 4 14:04:05 2000 --- import.c Fri Aug 4 14:04:05 2000 *************** *** 39,42 **** --- 39,43 ---- #include "attr.e" #include "auxtext.e" + #include "box.e" #include "choice.e" #include "choose.e" *************** *** 44,47 **** --- 45,49 ---- #include "color.e" #include "cursor.e" + #include "cutpaste.e" #include "dialog.e" #include "drawing.e" *************** *** 50,53 **** --- 52,57 ---- #include "file.e" #include "font.e" + #include "grid.e" + #include "imgproc.e" #include "import.e" #include "mainloop.e" *************** *** 58,61 **** --- 62,66 ---- #include "move.e" #include "names.e" + #include "navigate.e" #include "obj.e" #include "page.e" *************** *** 83,86 **** --- 88,99 ---- static int showFileNameOnBrowse=TRUE; + static int thumbnailW=160; + static int thumbnailH=120; + static int thumbnailPadding=8; + static int thumbnailXGap=16; + static int thumbnailYGap=0; + static int thumbnailX=32; + static int thumbnailY=32; + void MillisecondSleep(ms) int ms; *************** *** 352,355 **** --- 365,461 ---- } } + thumbnailW = 160; + thumbnailH = 120; + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ThumbnailGeometry")) != NULL) { + int w=0, h=0; + + if (ParseWHSpec(c_ptr, &w, &h) && w >= 40 && h >= 30) { + if (w >= 40 && h >= 30) { + thumbnailW = w; + thumbnailH = h; + } else { + fprintf(stderr, TgLoadString(STID_INVALID_GEOM_USE_ALT_GEOM), + TOOL_NAME, "ThumbnailGeometry", c_ptr, "40x30", "160x120"); + fprintf(stderr, "\n"); + } + } + } + thumbnailPadding = 8; + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ThumbnailPadding")) != NULL) { + int padding=0; + + UtilTrimBlanks(c_ptr); + if (sscanf(c_ptr, "%d", &padding) != 1) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_VALUE), + TOOL_NAME, "ThumbnailPadding", c_ptr, 8); + fprintf(stderr, "\n"); + } else if (padding < 0 || padding > 100) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_RNG_USE_ALT_VAL), + TOOL_NAME, "ThumbnailPadding", c_ptr, 0, 100, 8); + fprintf(stderr, "\n"); + } else { + thumbnailPadding = padding; + } + } + thumbnailXGap = 16; + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ThumbnailXGap")) != NULL) { + int gap=0; + + UtilTrimBlanks(c_ptr); + if (sscanf(c_ptr, "%d", &gap) != 1) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_VALUE), + TOOL_NAME, "ThumbnailXGap", c_ptr, 16); + fprintf(stderr, "\n"); + } else if (gap < 0) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_VALUE), + TOOL_NAME, "ThumbnailXGap", c_ptr, 16); + fprintf(stderr, "\n"); + } else { + thumbnailXGap = gap; + } + } + thumbnailYGap = 0; + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ThumbnailYGap")) != NULL) { + int gap=0; + + UtilTrimBlanks(c_ptr); + if (sscanf(c_ptr, "%d", &gap) != 1) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_VALUE), + TOOL_NAME, "ThumbnailYGap", c_ptr, 16); + fprintf(stderr, "\n"); + } else if (gap < 0) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_VALUE), + TOOL_NAME, "ThumbnailYGap", c_ptr, 16); + fprintf(stderr, "\n"); + } else { + thumbnailYGap = gap; + } + } + thumbnailX = 32; + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ThumbnailX")) != NULL) { + int x=0; + + UtilTrimBlanks(c_ptr); + if (sscanf(c_ptr, "%d", &x) != 1) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_VALUE), + TOOL_NAME, "ThumbnailX", c_ptr, 32); + fprintf(stderr, "\n"); + } else { + thumbnailX = x; + } + } + thumbnailY = 32; + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ThumbnailY")) != NULL) { + int y=0; + + UtilTrimBlanks(c_ptr); + if (sscanf(c_ptr, "%d", &y) != 1) { + fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_VALUE), + TOOL_NAME, "ThumbnailY", c_ptr, 32); + fprintf(stderr, "\n"); + } else { + thumbnailY = y; + } + } } *************** *** 585,589 **** char eps_fname[MAXPATHLENGTH+1], *rest=NULL, tmp_fname[MAXPATHLENGTH+1]; char **lines=NULL, write_date[32]; ! int rc, short_name, num_lines, epsf_level, image_w, image_h; int remote_file=FALSE; float llx, lly, urx, ury; --- 691,695 ---- char eps_fname[MAXPATHLENGTH+1], *rest=NULL, tmp_fname[MAXPATHLENGTH+1]; char **lines=NULL, write_date[32]; ! int i, rc, short_name, num_lines=0, epsf_level, image_w, image_h; int remote_file=FALSE; float llx, lly, urx, ury; *************** *** 635,640 **** SetWatchCursor(mainWindow); rc = MyReadEPSFile(remote_file ? tmp_fname : eps_fname, &image_w, &image_h, ! &bitmap, &image, &num_lines, &lines, &epsf_level, ! &llx, &lly, &urx, &ury, write_date); if (remote_file) { --- 741,746 ---- SetWatchCursor(mainWindow); rc = MyReadEPSFile(remote_file ? tmp_fname : eps_fname, &image_w, &image_h, ! &bitmap, &image, (Embed ? &num_lines : NULL), (Embed ? &lines : NULL), ! &epsf_level, &llx, &lly, &urx, &ury, write_date); if (remote_file) { *************** *** 665,668 **** --- 771,780 ---- saveEPSLines = FALSE; + if (!Embed && lines != NULL) { + for (i=0; i < num_lines; i++) { + if (lines[i] != NULL) free(lines[i]); + } + free(lines); + } if (strcmp(defaultEPSScalingStr,"1") != 0) { ScaleAnEPSObj(obj_ptr, &defaultEPSScaling); *************** *** 774,779 **** } ! int ConvertGifToXpm(pszGifPath, pszXpmPath) char *pszGifPath, *pszXpmPath; { FILE *pFile=NULL, *pPipe=NULL; --- 886,892 ---- } ! int ConvertGifToXpm(pszGifPath, pszXpmPath, xpm_path_sz) char *pszGifPath, *pszXpmPath; + int xpm_path_sz; { FILE *pFile=NULL, *pPipe=NULL; *************** *** 782,788 **** InitGifToXpm(); ! sprintf(pszXpmPath, "%sTgifXXXXXX", TMP_DIR); ! mktemp(pszXpmPath); ! unlink(pszXpmPath); pszCmd = (char*)malloc( (strlen(gifToXpmCmd)+strlen(pszGifPath)+10)*sizeof(char)); --- 895,899 ---- InitGifToXpm(); ! MkTempFile(pszXpmPath, xpm_path_sz, tmpDir, TOOL_NAME); pszCmd = (char*)malloc( (strlen(gifToXpmCmd)+strlen(pszGifPath)+10)*sizeof(char)); *************** *** 871,875 **** SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertGifToXpm(remote_file ? tmp_fname : szGifPath, file_name); RestoreStatusStrings(); SetDefaultCursor(mainWindow); --- 982,987 ---- SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertGifToXpm((remote_file ? tmp_fname : szGifPath), file_name, ! sizeof(file_name)); RestoreStatusStrings(); SetDefaultCursor(mainWindow); *************** *** 907,912 **** } ! int ConvertPngToXpm(pszPngPath, pszXpmPath) char *pszPngPath, *pszXpmPath; { FILE *pFile=NULL, *pPipe=NULL; --- 1019,1025 ---- } ! int ConvertPngToXpm(pszPngPath, pszXpmPath, xpm_path_sz) char *pszPngPath, *pszXpmPath; + int xpm_path_sz; { FILE *pFile=NULL, *pPipe=NULL; *************** *** 915,921 **** InitGifToXpm(); ! sprintf(pszXpmPath, "%sTgifXXXXXX", TMP_DIR); ! mktemp(pszXpmPath); ! unlink(pszXpmPath); pszCmd = (char*)malloc( (strlen(pngToXpmCmd)+strlen(pszPngPath)+10)*sizeof(char)); --- 1028,1032 ---- InitGifToXpm(); ! MkTempFile(pszXpmPath, xpm_path_sz, tmpDir, TOOL_NAME); pszCmd = (char*)malloc( (strlen(pngToXpmCmd)+strlen(pszPngPath)+10)*sizeof(char)); *************** *** 1004,1008 **** SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertPngToXpm(remote_file ? tmp_fname : szPngPath, file_name); RestoreStatusStrings(); SetDefaultCursor(mainWindow); --- 1115,1120 ---- SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertPngToXpm((remote_file ? tmp_fname : szPngPath), file_name, ! sizeof(file_name)); RestoreStatusStrings(); SetDefaultCursor(mainWindow); *************** *** 1040,1045 **** } ! int ConvertJpegToXpm(pszJpegPath, pszXpmPath) char *pszJpegPath, *pszXpmPath; { FILE *pFile=NULL, *pPipe=NULL; --- 1152,1158 ---- } ! int ConvertJpegToXpm(pszJpegPath, pszXpmPath, xpm_path_sz) char *pszJpegPath, *pszXpmPath; + int xpm_path_sz; { FILE *pFile=NULL, *pPipe=NULL; *************** *** 1048,1054 **** InitGifToXpm(); ! sprintf(pszXpmPath, "%sTgifXXXXXX", TMP_DIR); ! mktemp(pszXpmPath); ! unlink(pszXpmPath); pszCmd = (char*)malloc( (strlen(jpegToXpmCmd)+strlen(pszJpegPath)+10)*sizeof(char)); --- 1161,1165 ---- InitGifToXpm(); ! MkTempFile(pszXpmPath, xpm_path_sz, tmpDir, TOOL_NAME); pszCmd = (char*)malloc( (strlen(jpegToXpmCmd)+strlen(pszJpegPath)+10)*sizeof(char)); *************** *** 1137,1141 **** SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertJpegToXpm(remote_file ? tmp_fname : szJpegPath, file_name); RestoreStatusStrings(); SetDefaultCursor(mainWindow); --- 1248,1253 ---- SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertJpegToXpm((remote_file ? tmp_fname : szJpegPath), file_name, ! sizeof(file_name)); RestoreStatusStrings(); SetDefaultCursor(mainWindow); *************** *** 1254,1260 **** static ! int ConvertAnyToXpm(pii, pszAnyPath, pszXpmPath) struct ImportInfoRec *pii; char *pszAnyPath, *pszXpmPath; { FILE *pFile=NULL, *pPipe=NULL; --- 1366,1373 ---- static ! int ConvertAnyToXpm(pii, pszAnyPath, pszXpmPath, xpm_path_sz) struct ImportInfoRec *pii; char *pszAnyPath, *pszXpmPath; + int xpm_path_sz; { FILE *pFile=NULL, *pPipe=NULL; *************** *** 1262,1268 **** int bytes_read; ! sprintf(pszXpmPath, "%sTgifXXXXXX", TMP_DIR); ! mktemp(pszXpmPath); ! unlink(pszXpmPath); pszCmd = (char*)malloc((strlen(pii->cmd)+strlen(pszAnyPath)+10)*sizeof(char)); --- 1375,1379 ---- int bytes_read; ! MkTempFile(pszXpmPath, xpm_path_sz, tmpDir, TOOL_NAME); pszCmd = (char*)malloc((strlen(pii->cmd)+strlen(pszAnyPath)+10)*sizeof(char)); *************** *** 1363,1367 **** SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertAnyToXpm(pii, remote_file ? tmp_fname : szOtherPath, szXpmPath); RestoreStatusStrings(); SetDefaultCursor(mainWindow); --- 1474,1479 ---- SetWatchCursor(mainWindow); SaveStatusStrings(); ! rc = ConvertAnyToXpm(pii, (remote_file ? tmp_fname : szOtherPath), szXpmPath, ! sizeof(szXpmPath)); RestoreStatusStrings(); SetDefaultCursor(mainWindow); *************** *** 1484,1489 **** } ! int ConvertOtherToXpm(pszFile, pszFormat, pszXpmPath) char *pszFile, *pszFormat, *pszXpmPath; { struct ImportInfoRec *pii=NULL; --- 1596,1602 ---- } ! int ConvertOtherToXpm(pszFile, pszFormat, pszXpmPath, xpm_path_sz) char *pszFile, *pszFormat, *pszXpmPath; + int xpm_path_sz; { struct ImportInfoRec *pii=NULL; *************** *** 1500,1504 **** return FALSE; } ! return ConvertAnyToXpm(pii, pszFile, pszXpmPath); } --- 1613,1617 ---- return FALSE; } ! return ConvertAnyToXpm(pii, pszFile, pszXpmPath, xpm_path_sz); } *************** *** 1548,1554 **** } if (!remote_file) { ! sprintf(tmp_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmp_fname); ! unlink(tmp_fname); if (UtilCopyFile(gif_fname, tmp_fname) != TG_REMOTE_STATUS_OK) { sprintf(gszMsgBox, TgLoadString(STID_CANT_CREATE_NAMED_TMP_FILE), --- 1661,1665 ---- } if (!remote_file) { ! MkTempFile(tmp_fname, sizeof(tmp_fname), tmpDir, TOOL_NAME); if (UtilCopyFile(gif_fname, tmp_fname) != TG_REMOTE_STATUS_OK) { sprintf(gszMsgBox, TgLoadString(STID_CANT_CREATE_NAMED_TMP_FILE), *************** *** 1562,1566 **** /* explode the animated GIF file into parts */ InitGifToXpm(); ! sprintf(cmd, "cd %s; %s %s", TMP_DIR, gifAnimExplodeCmd, (remote_file ? tmp_fname : gif_fname)); SetWatchCursor(drawWindow); --- 1673,1677 ---- /* explode the animated GIF file into parts */ InitGifToXpm(); ! sprintf(cmd, "cd %s; %s %s", tmpDir, gifAnimExplodeCmd, (remote_file ? tmp_fname : gif_fname)); SetWatchCursor(drawWindow); *************** *** 1644,1648 **** if (!UtilPathExists(part_fname)) { sprintf(gszMsgBox, TgLoadString(STID_CANT_IMP_ANIM_GIF_TMP_DIR), ! part_fname, TMP_DIR); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); break; --- 1755,1759 ---- if (!UtilPathExists(part_fname)) { sprintf(gszMsgBox, TgLoadString(STID_CANT_IMP_ANIM_GIF_TMP_DIR), ! part_fname, tmpDir); MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); break; *************** *** 1653,1657 **** break; } ! rc = ConvertAnyToXpm(&ii, part_fname, xpm_fname); if (!rc) { unlink(part_fname); --- 1764,1768 ---- break; } ! rc = ConvertAnyToXpm(&ii, part_fname, xpm_fname, sizeof(xpm_fname)); if (!rc) { unlink(part_fname); *************** *** 1724,1728 **** historyDepth = 0; ! GroupSelObj(TRUE, TRUE); historyDepth = saved_history_depth; --- 1835,1839 ---- historyDepth = 0; ! GroupSelObj(TRUE, TRUE, TRUE); historyDepth = saved_history_depth; *************** *** 1762,1776 **** static int curBrowseX=0, curBrowseY=0, curBrowseRowHeight=0; static int savedDirNameLen=0; static char savedDirName[MAXPATHLENGTH+1]; static ! void InitBrowse(pszDir) char *pszDir; { ! curBrowseX = origBrowseX = drawOrigX+ABS_SIZE(EIGHTH_INCH); ! maxBrowseX = drawOrigX+drawWinW; ! curBrowseY = origBrowseY = drawOrigY+ABS_SIZE(EIGHTH_INCH); ! maxBrowseY = drawOrigY+drawWinH; ! curBrowseRowHeight = 0; if (pszDir != NULL) { strcpy(savedDirName, pszDir); --- 1873,1898 ---- static int curBrowseX=0, curBrowseY=0, curBrowseRowHeight=0; static int savedDirNameLen=0; + static int browseObjType=INVALID; static char savedDirName[MAXPATHLENGTH+1]; static ! void InitBrowse(pszDir, ObjType) char *pszDir; + int ObjType; { ! browseObjType = ObjType; ! if (ObjType == OBJ_ICON) { ! curBrowseX = origBrowseX = thumbnailX; ! maxBrowseX = paperWidth - curBrowseX; ! curBrowseY = origBrowseY = thumbnailY; ! maxBrowseY = paperHeight - curBrowseY; ! curBrowseRowHeight = 0; ! } else { ! curBrowseX = origBrowseX = drawOrigX+ABS_SIZE(EIGHTH_INCH); ! maxBrowseX = drawOrigX+drawWinW; ! curBrowseY = origBrowseY = drawOrigY+ABS_SIZE(EIGHTH_INCH); ! maxBrowseY = drawOrigY+drawWinH; ! curBrowseRowHeight = 0; ! } if (pszDir != NULL) { strcpy(savedDirName, pszDir); *************** *** 1797,1801 **** } else if (ev.type == ConfigureNotify) { Reconfigure(FALSE); ! maxBrowseX = drawOrigX+drawWinW; } } --- 1919,1925 ---- } else if (ev.type == ConfigureNotify) { Reconfigure(FALSE); ! if (browseObjType != OBJ_ICON) { ! maxBrowseX = drawOrigX+drawWinW; ! } } } *************** *** 1831,1834 **** --- 1955,2162 ---- static + struct ObjRec *ImportForThumbnails(fname, p_bbox_w, p_bbox_h) + char *fname; + int *p_bbox_w, *p_bbox_h; + { + struct ObjRec *imported_obj=NULL; + struct ObjRec *saved_top_obj=topObj, *saved_bot_obj=botObj; + struct BBRec saved_draw_win_bbox; + + (*p_bbox_w) = (*p_bbox_h) = 0; + curPage->top = curPage->bot = topObj = botObj = NULL; + + importingFile = TRUE; + pastingFile = TRUE; + memcpy(&saved_draw_win_bbox, &drawWinBBox, sizeof(struct BBRec)); + drawWinBBox.ltx = drawWinBBox.rbx = drawOrigX-128; + drawWinBBox.lty = drawWinBBox.rby = drawOrigY-128; + if (ImportGivenFile(fname, FALSE, FALSE) == TRUE) { + if (numObjSelected > 0) { + struct BoxRec *box_ptr=NULL; + + CreateBoxObj(selLtX, selLtY, selRbX, selRbY, TRUE); + box_ptr = topObj->detail.b; + box_ptr->fill = NONEPAT; + box_ptr->pen = NONEPAT; + RemoveAllSel(); + SelAllObj(FALSE); + GroupSelObj(FALSE, FALSE, FALSE); + + imported_obj = topObj; + *p_bbox_w = imported_obj->bbox.rbx-imported_obj->bbox.ltx; + *p_bbox_h = imported_obj->bbox.rby-imported_obj->bbox.lty; + #ifdef _TGIF_DBG /* debug, do not translate */ + TgAssert(topObj == botObj, + "too many objects found in ImportForThumbnails()", NULL); + #endif /* _TGIF_DBG */ + RemoveAllSel(); + } + MakeQuiescent(); + } + memcpy(&drawWinBBox, &saved_draw_win_bbox, sizeof(struct BBRec)); + importingFile = FALSE; + pastingFile = FALSE; + + curPage->top = topObj = saved_top_obj; + curPage->bot = botObj = saved_bot_obj; + + return imported_obj; + } + + static + int RegenerateImageFile(pszPath) + char *pszPath; + { + int saved_colordump=colorDump, saved_wheretoprint=whereToPrint; + + *gszImageProcXPmFile = '\0'; + gnConvolving = FALSE; + + colorDump = TRUE; + whereToPrint = XBM_FILE; + gnInImageProc = TRUE; + + SetWatchCursor(drawWindow); + SetWatchCursor(mainWindow); + DumpXBitmapFile(gnInImageProc, TRUE); + SetDefaultCursor(mainWindow); + ShowCursor(); + + gnInImageProc = FALSE; + whereToPrint = saved_wheretoprint; + colorDump = saved_colordump; + if (*gszImageProcXPmFile == '\0') return FALSE; + strcpy(pszPath, gszImageProcXPmFile); + return TRUE; + } + + static + struct ObjRec *MyRegenerateImage(obj_ptr) + struct ObjRec *obj_ptr; + { + int image_w=0, image_h=0, w=0, h=0, short_name=FALSE, rc=INVALID; + int ltx=0, lty=0; + int ncolors=0, chars_per_pixel=0, first_pixel_is_bg=0, *pixels=NULL; + char *color_char=NULL, **color_str=NULL, *xpm_data=NULL, *rest=NULL; + char szPath[MAXPATHLENGTH+1]; + Pixmap pixmap=None, bitmap=None; + XImage *image=NULL, *bitmap_image=NULL; + struct ObjRec *new_obj=NULL; + + ltx = obj_ptr->obbox.ltx; + lty = obj_ptr->obbox.lty; + + AddObj(NULL, topObj, obj_ptr); + PushPageInfo(); + + rc = RegenerateImageFile(szPath); + + DelAllObj(); + PopPageInfo(); + if (!rc) { + return NULL; + } + SetWatchCursor(drawWindow); + SetWatchCursor(mainWindow); + rc = MyReadPixmapFile(szPath, &image_w, &image_h, &w, &h, &pixmap, + &image, &bitmap, &bitmap_image, &ncolors, &chars_per_pixel, + &first_pixel_is_bg, &color_char, &color_str, &pixels, &xpm_data); + SetDefaultCursor(mainWindow); + ShowCursor(); + + if ((short_name=IsPrefix(bootDir, szPath, &rest))) ++rest; + if (rc != BitmapSuccess) { + sprintf(gszMsgBox, TgLoadString(STID_CANNOT_IMPORT_XPM_FILE), + (short_name ? rest : szPath)); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + unlink(szPath); + return NULL; + } + unlink(szPath); + new_obj = CreateXPmObj(image_w, image_h, w, h, pixmap, image, bitmap, + bitmap_image, ncolors, chars_per_pixel, first_pixel_is_bg, color_char, + color_str, pixels, xpm_data); + MoveObj(new_obj, ltx-new_obj->obbox.ltx, lty-new_obj->obbox.lty); + new_obj->tmp_parent = NULL; + SetFileModified(TRUE); + justDupped = FALSE; + + return new_obj; + } + + static + struct ObjRec *GenerateXpmThumbnail(imported_obj) + struct ObjRec *imported_obj; + { + struct ObjRec *saved_top_obj=topObj, *saved_bot_obj=botObj, *new_obj=NULL; + double orig_aspect_ratio=(double)0, aspect_ratio=(double)0; + struct BBRec saved_draw_win_bbox; + int bbox_w=(imported_obj->bbox.rbx-imported_obj->bbox.ltx); + int bbox_h=(imported_obj->bbox.rby-imported_obj->bbox.lty); + int final_w=0, final_h=0; + + curPage->top = curPage->bot = topObj = botObj = NULL; + + aspect_ratio = (((double)thumbnailW)/((double)thumbnailH)); + orig_aspect_ratio = (((double)bbox_w)/((double)bbox_h)); + + memcpy(&saved_draw_win_bbox, &drawWinBBox, sizeof(struct BBRec)); + drawWinBBox.ltx = drawWinBBox.rbx = drawOrigX-128; + drawWinBBox.lty = drawWinBBox.rby = drawOrigY-128; + + if (bbox_w <= thumbnailW && bbox_h <= thumbnailH) { + /* do not scale */ + final_w = thumbnailW; + final_h = thumbnailH; + } else { + double scale=(double)0; + + if (orig_aspect_ratio > aspect_ratio) { + final_w = thumbnailW; + final_h = round(((double)thumbnailW) / orig_aspect_ratio); + scale = ((double)bbox_w) / ((double)thumbnailW); + } else { + final_h = thumbnailH; + final_w = round(((double)thumbnailH) * orig_aspect_ratio); + scale = ((double)bbox_h) / ((double)thumbnailH); + } + ScaleObjLikeScaleEverything(imported_obj, scale, FALSE); + } + new_obj = MyRegenerateImage(imported_obj); /* imported_obj is freed here */ + if (new_obj != NULL) { + struct BoxRec *box_ptr=NULL; + int obj_w=(new_obj->obbox.rbx-new_obj->obbox.ltx); + int obj_h=(new_obj->obbox.rby-new_obj->obbox.lty); + int new_ltx=((thumbnailW+(thumbnailPadding<<1)-obj_w)>>1); + int new_lty=((thumbnailH+(thumbnailPadding<<1)-obj_h)>>1); + + CreateBoxObj(0, 0, thumbnailW+(thumbnailPadding<<1), + thumbnailH+(thumbnailPadding<<1), TRUE); + box_ptr = topObj->detail.b; + box_ptr->fill = BACKPAT; + box_ptr->pen = SOLIDPAT; + box_ptr->dash = 0; + box_ptr->width = 0; + strcpy(box_ptr->width_spec, "0"); + AdjObjBBox(topObj); + MoveObj(new_obj, new_ltx-new_obj->obbox.ltx, new_lty-new_obj->obbox.lty); + + AddObj(NULL, topObj, new_obj); + SelAllObj(FALSE); + GroupSelObj(FALSE, FALSE, FALSE); + + RemoveAllSel(); + new_obj = topObj; + UnlinkObj(topObj); + } + memcpy(&drawWinBBox, &saved_draw_win_bbox, sizeof(struct BBRec)); + + curPage->top = topObj = saved_top_obj; + curPage->bot = botObj = saved_bot_obj; + + return new_obj; + } + + static int BrowseDir(DirName, ExtStr, ExtStrLen, ObjType, pii) char *DirName, *ExtStr; *************** *** 1838,1842 **** { char name[MAXPATHLENGTH+1]; ! int interrupted=FALSE; #ifdef VMS int len; --- 2166,2170 ---- { char name[MAXPATHLENGTH+1]; ! int interrupted=FALSE, esave_len=0; #ifdef VMS int len; *************** *** 1846,1849 **** --- 2174,2178 ---- if ((dirp=opendir(DirName)) == NULL) return interrupted; + esave_len = strlen("EmergencySave."); if (pii == NULL) { sprintf(gszMsgBox, TgLoadString(STID_BROWSING_DIR_FOR_TYPE_FILES), *************** *** 1856,1860 **** while ((d=readdir(dirp)) != NULL) { int ncolors, chars_per_pixel, first_pixel_is_bg, * pixels; ! int image_w=0, image_h=0, w=0, h=0, x_hot, y_hot, rc; unsigned int tmp_w, tmp_h; char *color_char, **color_str, *xpm_data=NULL; --- 2185,2189 ---- while ((d=readdir(dirp)) != NULL) { int ncolors, chars_per_pixel, first_pixel_is_bg, * pixels; ! int image_w=0, image_h=0, w=0, h=0, x_hot, y_hot, rc=INVALID; unsigned int tmp_w, tmp_h; char *color_char, **color_str, *xpm_data=NULL; *************** *** 1861,1864 **** --- 2190,2194 ---- Pixmap bitmap=None, pixmap=None; XImage *image=NULL, *bitmap_image=NULL; + struct ObjRec *imported_obj=NULL; if (CheckExecInterrupt()) { *************** *** 1869,1872 **** --- 2199,2205 ---- continue; } + if (strncmp(d->d_name, "EmergencySave.", esave_len) == 0) { + continue; + } sprintf(name, "%s%c%s", DirName, DIR_SEP, d->d_name); sprintf(gszMsgBox, TgLoadCachedString(CSTID_OPENING_GIVEN), *************** *** 1877,1881 **** &bitmap, &x_hot, &y_hot); w = (int)tmp_w; h = (int)tmp_h; ! } else { if (pii != NULL) { char szXpmPath[MAXPATHLENGTH+1]; --- 2210,2214 ---- &bitmap, &x_hot, &y_hot); w = (int)tmp_w; h = (int)tmp_h; ! } else if (ObjType == OBJ_XPM) { if (pii != NULL) { char szXpmPath[MAXPATHLENGTH+1]; *************** *** 1882,1886 **** SaveStatusStrings(); ! rc = ConvertAnyToXpm(pii, name, szXpmPath); RestoreStatusStrings(); if (!rc) continue; --- 2215,2219 ---- SaveStatusStrings(); ! rc = ConvertAnyToXpm(pii, name, szXpmPath, sizeof(szXpmPath)); RestoreStatusStrings(); if (!rc) continue; *************** *** 1896,1911 **** &color_str, &pixels, &xpm_data); } } if (rc == BitmapSuccess) { ! struct ObjRec *obj_ptr; int short_name; ! char *rest; if (ObjType == OBJ_XBM) { obj_ptr = CreateXBmObj(w, h, w, h, bitmap, NULL); ! } else { obj_ptr = CreateXPmObj(image_w, image_h, w, h, pixmap, image, bitmap, bitmap_image, ncolors, chars_per_pixel, first_pixel_is_bg, color_char, color_str, pixels, xpm_data); } if ((short_name=IsPrefix((curDirIsLocal ? curDir : curLocalDir), name, --- 2229,2260 ---- &color_str, &pixels, &xpm_data); } + } else if (ObjType == OBJ_ICON) { + imported_obj = ImportForThumbnails(name, &tmp_w, &tmp_h); + if (imported_obj == NULL) continue; + rc = BitmapSuccess; + w = (int)tmp_w; + h = (int)tmp_h; + } else { } if (rc == BitmapSuccess) { ! struct ObjRec *obj_ptr=NULL; int short_name; ! char *rest=NULL; if (ObjType == OBJ_XBM) { obj_ptr = CreateXBmObj(w, h, w, h, bitmap, NULL); ! } else if (ObjType == OBJ_XPM) { obj_ptr = CreateXPmObj(image_w, image_h, w, h, pixmap, image, bitmap, bitmap_image, ncolors, chars_per_pixel, first_pixel_is_bg, color_char, color_str, pixels, xpm_data); + } else if (ObjType == OBJ_ICON) { + obj_ptr = GenerateXpmThumbnail(imported_obj); + /* imported_obj is deleted in GenerateXpmThumbnail() */ + if (obj_ptr == NULL) { + continue; + } + w = (int)(obj_ptr->obbox.rbx-obj_ptr->obbox.ltx); + h = (int)(obj_ptr->obbox.rby-obj_ptr->obbox.lty); + } else { } if ((short_name=IsPrefix((curDirIsLocal ? curDir : curLocalDir), name, *************** *** 1913,1917 **** ++rest; } ! AddAttrByNameAndValue(obj_ptr, "file_name=", short_name ? rest : name); if (showFileNameOnBrowse && obj_ptr->fattr != NULL && obj_ptr->fattr == obj_ptr->lattr) { --- 2262,2274 ---- ++rest; } ! if (ObjType == OBJ_ICON) { ! if (imported_obj->type != OBJ_TEXT) { ! AddAttrByNameAndValue(obj_ptr, "href=", ! (short_name ? rest : name)); ! } ! } else { ! AddAttrByNameAndValue(obj_ptr, "file_name=", ! (short_name ? rest : name)); ! } if (showFileNameOnBrowse && obj_ptr->fattr != NULL && obj_ptr->fattr == obj_ptr->lattr) { *************** *** 1929,1946 **** MoveObj(attr_ptr->obj, attr_ltx-attr_ptr->obj->obbox.ltx, attr_lty-attr_ptr->obj->obbox.lty); ! if (attr_w > w) w = attr_w; h += attr_h; } AdjObjBBox(obj_ptr); ! if (curBrowseX+w > maxBrowseX) { ! curBrowseX = origBrowseX; ! curBrowseY += curBrowseRowHeight; ! while (curBrowseY > maxBrowseY) { ! ForceScrollDown(TRUE); ! maxBrowseY = drawOrigY+drawWinH; } ! curBrowseRowHeight = h; ! } else if (h > curBrowseRowHeight) { ! curBrowseRowHeight = h; } obj_ptr->tmp_parent = NULL; --- 2286,2318 ---- MoveObj(attr_ptr->obj, attr_ltx-attr_ptr->obj->obbox.ltx, attr_lty-attr_ptr->obj->obbox.lty); ! if (attr_w > w && ObjType != OBJ_ICON) w = attr_w; h += attr_h; } AdjObjBBox(obj_ptr); ! if (ObjType == OBJ_ICON) { ! fprintf(stderr, "maxBrowseX = %1d\n", maxBrowseX); ! if (curBrowseX+w > maxBrowseX-origBrowseX) { ! curBrowseX = origBrowseX; ! curBrowseY += curBrowseRowHeight+thumbnailYGap; ! while (curBrowseY > maxBrowseY) { ! ForceScrollDown(TRUE); ! maxBrowseY = drawOrigY+drawWinH; ! } ! curBrowseRowHeight = h; ! } else if (h > curBrowseRowHeight) { ! curBrowseRowHeight = h; } ! } else { ! if (curBrowseX+w > maxBrowseX) { ! curBrowseX = origBrowseX; ! curBrowseY += curBrowseRowHeight; ! while (curBrowseY > maxBrowseY) { ! ForceScrollDown(TRUE); ! maxBrowseY = drawOrigY+drawWinH; ! } ! curBrowseRowHeight = h; ! } else if (h > curBrowseRowHeight) { ! curBrowseRowHeight = h; ! } } obj_ptr->tmp_parent = NULL; *************** *** 1947,1952 **** AddObj(NULL, topObj, obj_ptr); ! MoveObj(topObj, curBrowseX-topObj->bbox.ltx, ! curBrowseY-topObj->bbox.lty); numRedrawBBox = 0; DrawObj(drawWindow, topObj); --- 2319,2324 ---- AddObj(NULL, topObj, obj_ptr); ! MoveObj(topObj, curBrowseX-topObj->obbox.ltx, ! curBrowseY-topObj->obbox.lty); numRedrawBBox = 0; DrawObj(drawWindow, topObj); *************** *** 1955,1959 **** justDupped = FALSE; XSync(mainDisplay, False); ! curBrowseX += w; } } --- 2327,2336 ---- justDupped = FALSE; XSync(mainDisplay, False); ! if (ObjType == OBJ_ICON) { ! curBrowseX += w + thumbnailXGap; ! } else { ! curBrowseX += w; ! } ! } else { } } *************** *** 2019,2023 **** MakeQuiescent(); SaveStatusStrings(); ! InitBrowse(DirName); StartCompositeCmd(); ShowInterrupt(1); --- 2396,2400 ---- MakeQuiescent(); SaveStatusStrings(); ! InitBrowse(DirName, ObjType); StartCompositeCmd(); ShowInterrupt(1); *************** *** 2038,2041 **** --- 2415,2452 ---- } + void CreateThumbnails() + { + static char stszObjFileExt[20], stszGzObjFileExt[20]; + static char stszSymFileExt[20], stszPinFileExt[20]; + static int initialized=FALSE; + char buf[MAXSTRING]; + int len=0; + + MakeQuiescent(); + + if (firstCmd != NULL) { + if (!OkToFlushUndoBuffer( + TgLoadString(STID_CREATE_THUMBNAIL_CAUSE_FLUSH))) { + SetCurChoice(curChoiceBeforeMakeQuiescent); + return; + } + } + if (!initialized) { + sprintf(stszObjFileExt, ".%s", OBJ_FILE_EXT); + sprintf(stszGzObjFileExt, ".%s.gz", OBJ_FILE_EXT); + initialized = TRUE; + } + sprintf(buf, "%s;%s;%s;%s", stszObjFileExt, stszGzObjFileExt, + stszSymFileExt, stszPinFileExt); + len = strlen(buf); + if (strcmp(OBJ_FILE_EXT,"obj") != 0) { + strcat(buf, ";.obj"); + } + strcat(buf, ";.obj.gz;.tgo;.tgo.gz"); + StartBrowse((curDirIsLocal ? curDir : curLocalDir), buf, strlen(buf), + OBJ_ICON, NULL); + CleanUpCmds(); + } + void BrowseXBitmap() { *************** *** 2219,2225 **** SetWatchCursor(mainWindow); ! sprintf(tmp_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmp_fname); ! unlink(tmp_fname); if (installedColormaps != NULL) { --- 2630,2634 ---- SetWatchCursor(mainWindow); ! MkTempFile(tmp_fname, sizeof(tmp_fname), tmpDir, TOOL_NAME); if (installedColormaps != NULL) { *** mainloop.c.orig Fri Aug 4 14:04:06 2000 --- mainloop.c Fri Aug 4 14:04:06 2000 *************** *** 86,89 **** --- 86,90 ---- #include "shape.e" #include "shortcut.e" + #include "special.e" #include "stk.e" #include "strtbl.e" *************** *** 348,351 **** --- 349,353 ---- CleanUpRecentFiles(); CleanUpMeasureTooltip(); + CleanUpSpecial(); if (iconWindowCreated) { *************** *** 523,527 **** char *uncompress_cmd=gunzipCmd, *tmp_fname=NULL, *cmd=NULL; ! tmp_fname = (char*)malloc((strlen(TMP_DIR)+20)*sizeof(char)); if (tmp_fname == NULL) { FailAllocMessage(); --- 525,529 ---- char *uncompress_cmd=gunzipCmd, *tmp_fname=NULL, *cmd=NULL; ! tmp_fname = (char*)malloc((strlen(tmpDir)+20)*sizeof(char)); if (tmp_fname == NULL) { FailAllocMessage(); *************** *** 528,534 **** return NULL; } ! sprintf(tmp_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmp_fname); ! unlink(tmp_fname); if ((out_fp=fopen(tmp_fname, "w")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANNOT_OPEN_FILE_FOR_WRITING), --- 530,534 ---- return NULL; } ! MkTempFile(tmp_fname, strlen(tmpDir)+19, tmpDir, TOOL_NAME); if ((out_fp=fopen(tmp_fname, "w")) == NULL) { sprintf(gszMsgBox, TgLoadString(STID_CANNOT_OPEN_FILE_FOR_WRITING), *************** *** 923,927 **** if (file_is_remote) { SetCurDir(remote_fname); ! if (!foundGoodStateObject) PasteString(remote_buf); } else { if (*gzipped_fname == '\0') { --- 923,927 ---- if (file_is_remote) { SetCurDir(remote_fname); ! if (!foundGoodStateObject) PasteString(remote_buf, TRUE, TRUE); } else { if (*gzipped_fname == '\0') { *** mainmenu.c.orig Fri Aug 4 14:04:07 2000 --- mainmenu.c Fri Aug 4 14:04:07 2000 *************** *** 1020,1023 **** --- 1020,1053 ---- } + void UseWireMenuItemInModeItem(connecting) + int connecting; + { + Window win=subMenuInfo[MENU_MODE].win; + + if (win != None) { + int extra_win_info_index=subMenuInfo[MENU_MODE].extra_index; + + if (extra_win_info_index >= 0 && extra_win_info_index < numExtraWins && + extraWinInfo[extra_win_info_index].window == win) { + TgMenu *menu=(TgMenu*)(extraWinInfo[extra_win_info_index].userdata); + + if (menu != NULL) { + TgMenuItem stMenuItem; + + memset(&stMenuItem, 0, sizeof(TgMenuItem)); + if (connecting) { + stMenuItem.menu_str = (char*)(&wireBitmap); + } else { + stMenuItem.menu_str = (char*)(&choicePixmap[DRAWPOLY]); + } + if (!TgSetMenuItemInfo(&menu->menuitems[DRAWPOLY], + TGMU_MASK_MENUSTR, &stMenuItem)) { + } + return; + } + } + } + } + void DestroyPinnedMenu(menu_index) int menu_index; *** menuinfo.c.orig Fri Aug 4 14:04:09 2000 --- menuinfo.c Fri Aug 4 14:04:09 2000 *************** *** 55,58 **** --- 55,59 ---- #include "scroll.e" #include "shape.e" + #include "special.e" #include "stream.e" #include "tangram2.e" *************** *** 465,468 **** --- 466,473 ---- static TgMenuItemInfo browseMenuItemInfo[] = { + { N_("Create Thumbnails"), NULL, + N_("Create a thumbnail map of all object files"), NULL, + CMDID_CREATETHUMBNAILS }, + { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, { N_("Browse X Bitmap"), NULL, N_("Recursively read in all X11 bitmap files"), NULL, *************** *** 1330,1333 **** --- 1335,1369 ---- TgCreateMenuFromMenuInfo }; + static TgMenuItemInfo portMenuItemInfo[] = { + { N_("Connect Two Ports by a Wire..."), NULL, + N_("Connect two ports by a wire"), NULL, + CMDID_CONNECT2PORTSBYWIRE }, + { N_("Show Wire Signal Name"), NULL, + N_("Toggle between showing (with placing) and hiding the wire signal name when connecting ports"), NULL, + CMDID_TOGGLESHOWWIRESIGNALNAME }, + { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, + { N_("Clear Signal Name for a Port..."), NULL, + N_("Clear the 'signal_name=' attribute for a port"), NULL, + CMDID_CLEARSIGNAMEFORAPORT }, + { N_("Rename Signal Name for a Port..."), NULL, + N_("Rename the 'signal_name=' attribute for a port"), NULL, + CMDID_RENAMESIGNAMEFORAPORT }, + { NULL, NULL, NULL, NULL, INVALID } + }; + static TgMenuInfo portMenuInfo={ TGMUTYPE_TEXT, portMenuItemInfo, + CreatePortMenu }; + + static TgMenuItemInfo tableMenuItemInfo[] = { + { N_("Merge With Table..."), NULL, + N_("Merge selected object with a table file"), NULL, + CMDID_MERGEWITHTABLE }, + { N_("Export To Table..."), NULL, + N_("Export attributes of selected objects to a table file"), NULL, + CMDID_EXPORTTOTABLE }, + { NULL, NULL, NULL, NULL, INVALID } + }; + static TgMenuInfo tableMenuInfo={ TGMUTYPE_TEXT, tableMenuItemInfo, + TgCreateMenuFromMenuInfo }; + static TgMenuItemInfo specialMenuItemInfo[] = { { N_("Make Symbolic"), "Alt+Cntrl+m", *************** *** 1373,1376 **** --- 1409,1416 ---- { N_("Domain"), TGMUITEM_SUBMENU, N_("Domain submenu >>>"), &domainMenuInfo, INVALID }, + { N_("Ports and Signals"), TGMUITEM_SUBMENU, + N_("Ports and Signal submenu >>>"), &portMenuInfo, INVALID }, + { N_("Table"), TGMUITEM_SUBMENU, + N_("Table submenu >>>"), &tableMenuInfo, INVALID }, { N_("Misc"), TGMUITEM_SUBMENU, N_("Misc submenu >>>"), &animateMenuInfo, INVALID }, *************** *** 1378,1388 **** N_("Return submenu >>>"), &driverMenuInfo, INVALID }, { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, - { N_("Merge With Table..."), NULL, - N_("Merge selected object with a table file"), NULL, - CMDID_MERGEWITHTABLE }, - { N_("Export To Table..."), NULL, - N_("Export attributes of selected objects to a table file"), NULL, - CMDID_EXPORTTOTABLE }, - { TGMUITEM_SEPARATOR, NULL, NULL, NULL, INVALID }, { N_("Exec Cmds From File..."), NULL, N_("Execute internal commands from a file"), NULL, --- 1418,1421 ---- *** miniline.c.orig Fri Aug 4 14:04:10 2000 --- miniline.c Fri Aug 4 14:04:10 2000 *************** *** 3606,3612 **** static int CheckStrSegProperties(pStrSeg, pn_valid, pn_font, pn_style, pn_sz_unit, ! pn_color) StrSegInfo *pStrSeg; ! int *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color; /* return FALSE if any property is different */ { --- 3606,3612 ---- static int CheckStrSegProperties(pStrSeg, pn_valid, pn_font, pn_style, pn_sz_unit, ! pn_color, pn_underline_on) StrSegInfo *pStrSeg; ! int *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color, *pn_underline_on; /* return FALSE if any property is different */ { *************** *** 3615,3619 **** *pn_style == pStrSeg->style && *pn_sz_unit == pStrSeg->sz_unit && ! *pn_color == pStrSeg->color); } else { *pn_valid = TRUE; --- 3615,3620 ---- *pn_style == pStrSeg->style && *pn_sz_unit == pStrSeg->sz_unit && ! *pn_color == pStrSeg->color && ! *pn_underline_on == pStrSeg->underline_on); } else { *pn_valid = TRUE; *************** *** 3622,3625 **** --- 3623,3627 ---- *pn_sz_unit = pStrSeg->sz_unit; *pn_color = pStrSeg->color; + *pn_underline_on = pStrSeg->underline_on; } return TRUE; *************** *** 3628,3634 **** static int CheckStrBlockProperties(pStrBlock, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color) StrBlockInfo *pStrBlock; ! int *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color; /* return FALSE if any property is different */ { --- 3630,3636 ---- static int CheckStrBlockProperties(pStrBlock, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color, pn_underline_on) StrBlockInfo *pStrBlock; ! int *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color, *pn_underline_on; /* return FALSE if any property is different */ { *************** *** 3636,3640 **** case SB_SIMPLE: return CheckStrSegProperties(pStrBlock->seg, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color); case SB_CHAR_SPACE: --- 3638,3642 ---- case SB_SIMPLE: return CheckStrSegProperties(pStrBlock->seg, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color, pn_underline_on); case SB_CHAR_SPACE: *************** *** 3646,3650 **** if (pStrBlock->sup != NULL) { if (!CheckMiniLinesProperties(pStrBlock->sup, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color)) { return FALSE; } --- 3648,3652 ---- if (pStrBlock->sup != NULL) { if (!CheckMiniLinesProperties(pStrBlock->sup, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color, pn_underline_on)) { return FALSE; } *************** *** 3652,3656 **** if (pStrBlock->sub != NULL) { if (!CheckMiniLinesProperties(pStrBlock->sub, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color)) { return FALSE; } --- 3654,3658 ---- if (pStrBlock->sub != NULL) { if (!CheckMiniLinesProperties(pStrBlock->sub, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color, pn_underline_on)) { return FALSE; } *************** *** 3658,3662 **** if (pStrBlock->type == SB_SUPSUB_CENTER) { if (!CheckStrSegProperties(pStrBlock->seg, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color)) { return FALSE; } --- 3660,3664 ---- if (pStrBlock->type == SB_SUPSUB_CENTER) { if (!CheckStrSegProperties(pStrBlock->seg, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color, pn_underline_on)) { return FALSE; } *************** *** 3669,3675 **** static int CheckMiniLineProperties(pMiniLine, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color) MiniLineInfo *pMiniLine; ! int *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color; /* return FALSE if any property is different */ { --- 3671,3677 ---- static int CheckMiniLineProperties(pMiniLine, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color, pn_underline_on) MiniLineInfo *pMiniLine; ! int *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color, *pn_underline_on; /* return FALSE if any property is different */ { *************** *** 3679,3683 **** pStrBlock=pStrBlock->next) { if (!CheckStrBlockProperties(pStrBlock, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color)) { return FALSE; } --- 3681,3685 ---- pStrBlock=pStrBlock->next) { if (!CheckStrBlockProperties(pStrBlock, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color, pn_underline_on)) { return FALSE; } *************** *** 3687,3693 **** int CheckMiniLinesProperties(minilines, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color) MiniLinesInfo *minilines; ! int *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color; /* return FALSE if any property is different */ { --- 3689,3695 ---- int CheckMiniLinesProperties(minilines, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color, pn_underline_on) MiniLinesInfo *minilines; ! int *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color, *pn_underline_on; /* return FALSE if any property is different */ { *************** *** 3697,3701 **** pMiniLine=pMiniLine->next) { if (!CheckMiniLineProperties(pMiniLine, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color)) { return FALSE; } --- 3699,3703 ---- pMiniLine=pMiniLine->next) { if (!CheckMiniLineProperties(pMiniLine, pn_valid, pn_font, pn_style, ! pn_sz_unit, pn_color, pn_underline_on)) { return FALSE; } *************** *** 3708,3714 **** static int CheckHighlightedStrSegProperties(pStrBlock, mode, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color) StrBlockInfo *pStrBlock; int mode, *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color; /* return FALSE if any property is different */ { --- 3710,3717 ---- static int CheckHighlightedStrSegProperties(pStrBlock, mode, pn_valid, pn_font, ! pn_style, pn_sz_unit, pn_color, pn_underline_on) StrBlockInfo *pStrBlock; int mode, *pn_valid, *pn_font, *pn_style, *pn_sz_unit, *pn_color; + int *pn_underline_on; /* return FALSE if any property is different */ { *************** *** 3719,3723 **** rc = CheckStrSegProperties(pStrSeg, pn_valid, pn_font, pn_style, pn_sz_unit, ! pn_color); switch (mode) { case PAINT_INV: break; --- 3722,3726 ---- rc = CheckStrSegProperties(pStrSeg, pn_valid, pn_font, pn_style, pn_sz_unit, ! pn_color, pn_underline_on); switch (mode) { case PAINT_INV: break; *************** *** 3737,3740 **** --- 3740,3744 ---- int first_index=0, second_index=0, mode=PAINT_NORM, valid=FALSE; int font=INVALID, style=INVALID, sz_unit=INVALID, color=INVALID; + int underline_on=INVALID; /* setup gstTextHighlightInfo */ *************** *** 3749,3753 **** GetPaintMode(pStrBlock, &mode, &first_index, &second_index); if (!CheckHighlightedStrSegProperties(pStrBlock, mode, &valid, &font, &style, ! &sz_unit, &color)) { return FALSE; } --- 3753,3757 ---- GetPaintMode(pStrBlock, &mode, &first_index, &second_index); if (!CheckHighlightedStrSegProperties(pStrBlock, mode, &valid, &font, &style, ! &sz_unit, &color, &underline_on)) { return FALSE; } *************** *** 3771,3775 **** if (pStrBlock->type == SB_SIMPLE) { if (!CheckStrBlockProperties(pStrBlock, &valid, &font, &style, ! &sz_unit, &color)) { return FALSE; } --- 3775,3779 ---- if (pStrBlock->type == SB_SIMPLE) { if (!CheckStrBlockProperties(pStrBlock, &valid, &font, &style, ! &sz_unit, &color, &underline_on)) { return FALSE; } *************** *** 3788,3792 **** #endif /* _TGIF_DBG */ if (!CheckHighlightedStrSegProperties(pStrBlock, mode, &valid, &font, ! &style, &sz_unit, &color)) { return FALSE; } --- 3792,3796 ---- #endif /* _TGIF_DBG */ if (!CheckHighlightedStrSegProperties(pStrBlock, mode, &valid, &font, ! &style, &sz_unit, &color, &underline_on)) { return FALSE; } *** msg.c.orig Fri Aug 4 14:04:11 2000 --- msg.c Fri Aug 4 14:04:11 2000 *************** *** 1550,1553 **** --- 1550,1555 ---- } else if (strcmp(*argv, "-text") == 0) { whereToPrint = cmdLineWhereToPrint = TEXT_FILE; + } else if (strcmp(*argv, "-netlist") == 0) { + whereToPrint = cmdLineWhereToPrint = NETLIST_FILE; } else if (strcmp(*argv, "-raw") == 0) { cmdLineDumpURL = TRUE; *** oval.c.orig Fri Aug 4 14:04:12 2000 --- oval.c Fri Aug 4 14:04:12 2000 *************** *** 541,546 **** } - static XComposeStatus c_stat; - static void ContinueOval(OrigX, OrigY) --- 541,544 ---- *************** *** 592,603 **** input.type == KeyRelease) { 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); MyContinueOval(drawWindow, drawGC, &bbox); --- 590,594 ---- input.type == KeyRelease) { if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { XUngrabPointer(mainDisplay, CurrentTime); MyContinueOval(drawWindow, drawGC, &bbox); *** page.c.orig Fri Aug 4 14:04:13 2000 --- page.c Fri Aug 4 14:04:13 2000 *************** *** 611,622 **** } - static - int BlankStr(s) - register char *s; - { - while (*s == ' ') s++; - return (*s == '\0'); - } - void GotoPage() { --- 611,614 ---- *************** *** 940,944 **** } importingFile = TRUE; ! if (ImportGivenFile(file_name, TRUE)) { sprintf(gszMsgBox, TgLoadString(STID_NAMED_TEMPLATE_LOADED), attr_ptr->attr_value.s); --- 932,936 ---- } importingFile = TRUE; ! if (ImportGivenFile(file_name, TRUE, TRUE)) { sprintf(gszMsgBox, TgLoadString(STID_NAMED_TEMPLATE_LOADED), attr_ptr->attr_value.s); *************** *** 1108,1111 **** --- 1100,1104 ---- case XBM_FILE: case TEXT_FILE: + case NETLIST_FILE: case GIF_FILE: case HTML_FILE: *************** *** 1477,1480 **** --- 1470,1474 ---- case XBM_FILE: case TEXT_FILE: + case NETLIST_FILE: case EPSI_FILE: case GIF_FILE: *** pattern.c.orig Fri Aug 4 14:04:14 2000 --- pattern.c Fri Aug 4 14:04:14 2000 *************** *** 2051,2052 **** --- 2051,2053 ---- width_spec, aw_spec, ah_spec, TRUE); } + *** pin.c.orig Fri Aug 4 14:04:15 2000 --- pin.c Fri Aug 4 14:04:15 2000 *************** *** 53,56 **** --- 53,58 ---- #include "strtbl.e" + int drawPolyToConnectPins=0; + struct ObjRec *gpStartPin=NULL, *gpEndPin=NULL; *************** *** 315,320 **** --- 317,324 ---- if (obj_under_cursor != NULL) { drawPolyHighlightedNode = obj_under_cursor; + /* may need to call something like SetWiringNodeInfo()!? */ } else { drawPolyHighlightedNode = NULL; + /* may need to call something like SetWiringNodeInfo()!? */ } if (drawPolyHighlightedNode != NULL) { *************** *** 326,329 **** --- 330,334 ---- if (obj_under_cursor != NULL) { drawPolyHighlightedNode = obj_under_cursor; + /* may need to call something like SetWiringNodeInfo()!? */ need_to_highlight = TRUE; something_changed = TRUE; *************** *** 382,387 **** } - static XComposeStatus c_stat; - void ConnectPins() { --- 387,390 ---- *************** *** 397,400 **** --- 400,404 ---- MakeQuiescent(); + ResetWiringNodeInfo(); values.line_width = 3; XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); *************** *** 401,405 **** SetCurChoice(DRAWPOLY); ! drawPolyToEndInANode = 0; while (connecting) { --- 405,409 ---- SetCurChoice(DRAWPOLY); ! gstWiringInfo.num_ports_to_connect = 0; while (connecting) { *************** *** 415,425 **** ExposeEventHandler(&input, TRUE); } else if (input.type == KeyPress) { ! XKeyEvent *key_ev=(&(input.xkey)); ! KeySym key_sym; ! char s[80]; ! int has_ch=XLookupString(key_ev, s, sizeof(s), &key_sym, &c_stat); ! ! TranslateKeys(s, &key_sym); ! if (CharIsESC(key_ev, s, key_sym, &has_ch)) { connecting = FALSE; break; --- 419,423 ---- ExposeEventHandler(&input, TRUE); } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { connecting = FALSE; break; *************** *** 443,446 **** --- 441,445 ---- if (gpHighLightedPin != NULL) { drawPolyHighlightedNode = gpHighLightedPin; + /* may need to call something like SetWiringNodeInfo()!? */ HighLightAPin(FALSE); } *** poly.c.orig Fri Aug 4 14:04:15 2000 --- poly.c Fri Aug 4 14:04:16 2000 *************** *** 52,55 **** --- 52,56 ---- #include "msg.e" #include "obj.e" + #include "page.e" #include "pattern.e" #include "pin.e" *************** *** 62,65 **** --- 63,67 ---- #include "select.e" #include "setup.e" + #include "special.e" #include "spline.e" #include "stretch.e" *************** *** 70,73 **** --- 72,77 ---- #define RETREAT (0.8) + WiringInfo gstWiringInfo; + int polyDrawn=FALSE; int queryPolyNameOnConnect=TRUE; *************** *** 89,97 **** char **curArrowHeadWSpec=NULL; - int drawPolyToEndInANode=0; - char drawPolyFirstNodeName[MAXSTRING+1]; - char drawPolyLastNodeName[MAXSTRING+1]; - int drawPolyToConnectPins=0; - int numPtsInPoly=0; --- 93,96 ---- *************** *** 442,447 **** } - static XComposeStatus c_stat; - static void ContinuePoly(OrigX, OrigY) --- 441,444 ---- *************** *** 519,524 **** GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); } ! if (drawPolyToEndInANode > 0 || drawPolyToConnectPins > 0) { ! *drawPolyLastNodeName = '\0'; drawPolyHighlightedNode = NULL; SaveStatusStringsIntoBuf(status_buf, &one_line_status); --- 516,521 ---- GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime); } ! if (gstWiringInfo.num_ports_to_connect > 0 || drawPolyToConnectPins > 0) { ! *gstWiringInfo.last_port_name = '\0'; drawPolyHighlightedNode = NULL; SaveStatusStringsIntoBuf(status_buf, &one_line_status); *************** *** 535,546 **** input.type == KeyRelease) { 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)) { if (curChoice == FREEHAND) { PixelToMeasurementUnit(x_buf, ABS_X(grid_x)); --- 532,536 ---- input.type == KeyRelease) { if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { if (curChoice == FREEHAND) { PixelToMeasurementUnit(x_buf, ABS_X(grid_x)); *************** *** 686,697 **** ShowMeasureCursor(grid_x, grid_y, buf, TRUE); } else { ! if (drawPolyToEndInANode > 0) { int need_to_highlight=FALSE, something_changed=FALSE; struct ObjRec *owner_obj=NULL, *obj_ptr, *obj_under_cursor=NULL; ! struct AttrRec *attr_ptr; - *drawPolyLastNodeName = '\0'; obj_ptr = FindAnObj(end_x, end_y, &owner_obj, &obj_under_cursor, ! drawPolyLastNodeName); if (drawPolyHighlightedNode != NULL) { if (obj_under_cursor != drawPolyHighlightedNode) { --- 676,686 ---- ShowMeasureCursor(grid_x, grid_y, buf, TRUE); } else { ! if (gstWiringInfo.num_ports_to_connect > 0) { int need_to_highlight=FALSE, something_changed=FALSE; struct ObjRec *owner_obj=NULL, *obj_ptr, *obj_under_cursor=NULL; ! char port_name[MAXSTRING]; obj_ptr = FindAnObj(end_x, end_y, &owner_obj, &obj_under_cursor, ! port_name); if (drawPolyHighlightedNode != NULL) { if (obj_under_cursor != drawPolyHighlightedNode) { *************** *** 703,712 **** OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); if (obj_under_cursor != NULL && ! (attr_ptr=FindAttrWithName(obj_under_cursor, "type=", ! NULL)) != NULL && strcmp(attr_ptr->attr_value.s, ! "port")==0) { drawPolyHighlightedNode = obj_under_cursor; } else { drawPolyHighlightedNode = NULL; } if (drawPolyHighlightedNode != NULL) { --- 692,702 ---- OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); if (obj_under_cursor != NULL && ! ObjIsAPort(obj_under_cursor)) { drawPolyHighlightedNode = obj_under_cursor; + SetWiringNodeInfo(obj_under_cursor, owner_obj, + port_name, FALSE); } else { drawPolyHighlightedNode = NULL; + SetWiringNodeInfo(NULL, NULL, NULL, FALSE); } if (drawPolyHighlightedNode != NULL) { *************** *** 717,726 **** } else { if (obj_under_cursor != NULL) { ! if ((attr_ptr=FindAttrWithName(obj_under_cursor, "type=", ! NULL)) != NULL && strcmp(attr_ptr->attr_value.s, ! "port")==0) { drawPolyHighlightedNode = obj_under_cursor; } else { drawPolyHighlightedNode = NULL; } if (drawPolyHighlightedNode != NULL) { --- 707,717 ---- } else { if (obj_under_cursor != NULL) { ! if (ObjIsAPort(obj_under_cursor)) { drawPolyHighlightedNode = obj_under_cursor; + SetWiringNodeInfo(obj_under_cursor, owner_obj, + port_name, FALSE); } else { drawPolyHighlightedNode = NULL; + SetWiringNodeInfo(NULL, NULL, NULL, FALSE); } if (drawPolyHighlightedNode != NULL) { *************** *** 738,745 **** } if (something_changed) { ! if (*drawPolyLastNodeName != '\0') { ! SetStringStatus(drawPolyLastNodeName); } else { RestoreStatusStringsFromBuf(status_buf, one_line_status); } } --- 729,742 ---- } if (something_changed) { ! if (*gstWiringInfo.last_port_name != '\0') { ! sprintf(gszMsgBox, ! TgLoadCachedString(CSTID_END_A_WIRE_AT_NAMED_PORT), ! gstWiringInfo.last_port_name); ! SetStringStatus(gszMsgBox); } else { RestoreStatusStringsFromBuf(status_buf, one_line_status); + SetMouseStatus(TgLoadCachedString(CSTID_ADD_A_VERTEX), + TgLoadCachedString(CSTID_ADD_LAST_VERTEX), + TgLoadCachedString(CSTID_ADD_LAST_VERTEX)); } } *************** *** 752,757 **** GridXY(end_x, end_y, &grid_x, &grid_y); } } else if (drawPolyToConnectPins > 0) { - *drawPolyLastNodeName = '\0'; HandlePinHighlights(end_x, end_y); if (drawPolyHighlightedNode != NULL) { --- 749,758 ---- GridXY(end_x, end_y, &grid_x, &grid_y); } + #ifdef _NOT_DEFINED + /* + * drawPolyToConnectPins is only set to > 0 in "pin.c" + * what's in "pin.c" is not used at this time + */ } else if (drawPolyToConnectPins > 0) { HandlePinHighlights(end_x, end_y); if (drawPolyHighlightedNode != NULL) { *************** *** 763,766 **** --- 764,768 ---- GridXY(end_x, end_y, &grid_x, &grid_y); } + #endif /* _NOT_DEFINED */ } else { GridXY(end_x, end_y, &grid_x, &grid_y); *************** *** 864,868 **** switch (button_ev->button) { case Button1: ! if (drawPolyToConnectPins > 0 && drawPolyHighlightedNode != NULL) { gpEndPin = drawPolyHighlightedNode; done = TRUE; --- 866,873 ---- switch (button_ev->button) { case Button1: ! if ((drawPolyToConnectPins > 0 && ! drawPolyHighlightedNode != NULL) || ! (gstWiringInfo.num_ports_to_connect > 0 && ! drawPolyHighlightedNode != NULL)) { gpEndPin = drawPolyHighlightedNode; done = TRUE; *************** *** 880,883 **** --- 885,893 ---- case Button2: case Button3: + #ifdef _NOT_DEFINED + /* + * drawPolyToConnectPins is only set to > 0 in "pin.c" + * what's in "pin.c" is not used at this time + */ if (drawPolyToConnectPins > 0) { if (drawPolyHighlightedNode == NULL) { *************** *** 887,890 **** --- 897,901 ---- } } + #endif /* _NOT_DEFINED */ done = TRUE; break; *************** *** 911,915 **** } if (drawPolyHighlightedNode != NULL) { ! if (drawPolyToEndInANode > 0) { SelBox(drawWindow, revGrayGC, OFFSET_X(drawPolyHighlightedNode->bbox.ltx)-2, --- 922,926 ---- } if (drawPolyHighlightedNode != NULL) { ! if (gstWiringInfo.num_ports_to_connect > 0) { SelBox(drawWindow, revGrayGC, OFFSET_X(drawPolyHighlightedNode->bbox.ltx)-2, *************** *** 917,927 **** OFFSET_X(drawPolyHighlightedNode->bbox.rbx)+2, OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); } else if (drawPolyToConnectPins > 0) { HighLightAPin(FALSE); } drawPolyHighlightedNode = NULL; } XUngrabPointer(mainDisplay, CurrentTime); ! if (drawPolyToEndInANode > 0 || drawPolyToConnectPins > 0) { values.line_width = 1; XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); --- 928,948 ---- OFFSET_X(drawPolyHighlightedNode->bbox.rbx)+2, OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); + #ifdef _NOT_DEFINED + /* + * drawPolyToConnectPins is only set to > 0 in "pin.c" + * what's in "pin.c" is not used at this time + */ } else if (drawPolyToConnectPins > 0) { HighLightAPin(FALSE); + #endif /* _NOT_DEFINED */ } drawPolyHighlightedNode = NULL; + } else if (!abort && gstWiringInfo.num_ports_to_connect > 0) { + XBell(mainDisplay, 0); + SetStringStatus(TgLoadString(STID_TRY_AGAIN_AND_END_IN_A_PORT)); + abort = TRUE; } XUngrabPointer(mainDisplay, CurrentTime); ! if (gstWiringInfo.num_ports_to_connect > 0 || drawPolyToConnectPins > 0) { values.line_width = 1; XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); *************** *** 975,984 **** polyDrawn = FALSE; } ! if (drawPolyToEndInANode == 2 && !polyDrawn) { ! drawPolyToEndInANode = (-1); } if (drawPolyToConnectPins == 2 && !polyDrawn) { drawPolyToConnectPins = (-1); } } --- 996,1011 ---- polyDrawn = FALSE; } ! if (gstWiringInfo.num_ports_to_connect == 2 && !polyDrawn) { ! gstWiringInfo.num_ports_to_connect = (-1); } + #ifdef _NOT_DEFINED + /* + * drawPolyToConnectPins is only set to > 0 in "pin.c" + * what's in "pin.c" is not used at this time + */ if (drawPolyToConnectPins == 2 && !polyDrawn) { drawPolyToConnectPins = (-1); } + #endif /* _NOT_DEFINED */ } *************** *** 989,992 **** --- 1016,1026 ---- XButtonEvent *button_ev; + if (input->type == KeyPress && curChoice == DRAWPOLY && + gstWiringInfo.num_ports_to_connect > 0) { + if (KeyPressEventIsEscape(&input->xkey)) { + HandlePressForPortInDrawWindow(TRUE); + } + return; + } if (input->type != ButtonPress) return; *************** *** 997,1001 **** mouse_x = input->xbutton.x; mouse_y = input->xbutton.y; ! if (drawPolyToEndInANode > 0 || drawPolyToConnectPins > 0 || curChoice == FREEHAND) { if (drawPolyHighlightedNode != NULL) { --- 1031,1035 ---- mouse_x = input->xbutton.x; mouse_y = input->xbutton.y; ! if (gstWiringInfo.num_ports_to_connect > 0 || drawPolyToConnectPins > 0 || curChoice == FREEHAND) { if (drawPolyHighlightedNode != NULL) { *************** *** 1004,1017 **** grid_y = OFFSET_Y((drawPolyHighlightedNode->obbox.lty + drawPolyHighlightedNode->obbox.rby)>>1); ! if (drawPolyToEndInANode > 0 || curChoice == FREEHAND) { ! SelBox(drawWindow, revGrayGC, ! OFFSET_X(drawPolyHighlightedNode->bbox.ltx)-2, ! OFFSET_Y(drawPolyHighlightedNode->bbox.lty)-2, ! OFFSET_X(drawPolyHighlightedNode->bbox.rbx)+2, ! OFFSET_Y(drawPolyHighlightedNode->bbox.rby)+2); } else if (drawPolyToConnectPins > 0) { HighLightAPin(TRUE); } drawPolyHighlightedNode = NULL; } else { grid_x = mouse_x; --- 1038,1059 ---- grid_y = OFFSET_Y((drawPolyHighlightedNode->obbox.lty + drawPolyHighlightedNode->obbox.rby)>>1); ! if (gstWiringInfo.num_ports_to_connect > 0 || ! curChoice == FREEHAND) { ! HandlePressForPortInDrawWindow(FALSE); ! #ifdef _NOT_DEFINED ! /* ! * drawPolyToConnectPins is only set to > 0 in "pin.c" ! * what's in "pin.c" is not used at this time ! */ } else if (drawPolyToConnectPins > 0) { HighLightAPin(TRUE); + #endif /* _NOT_DEFINED */ } drawPolyHighlightedNode = NULL; + } else if (gstWiringInfo.num_ports_to_connect > 0 || + drawPolyToConnectPins > 0) { + XBell(mainDisplay, 0); + SetStringStatus(TgLoadString(STID_TRY_AGAIN_AND_CLICK_IN_A_PORT)); + return; } else { grid_x = mouse_x; *************** *** 1038,1041 **** --- 1080,1114 ---- } + void SetWiringNodeInfo(port_obj, port_owner_obj, port_name, first) + struct ObjRec *port_obj, *port_owner_obj; + char *port_name; + int first; + { + if (first) { + gstWiringInfo.first_port_obj = port_obj; + gstWiringInfo.first_port_owner_obj = port_owner_obj; + if (port_name == NULL) { + *gstWiringInfo.first_port_name = '\0'; + } else { + UtilStrCpyN(gstWiringInfo.first_port_name, + sizeof(gstWiringInfo.first_port_name), port_name); + } + } else { + gstWiringInfo.last_port_obj = port_obj; + gstWiringInfo.last_port_owner_obj = port_owner_obj; + if (port_name == NULL) { + *gstWiringInfo.last_port_name = '\0'; + } else { + UtilStrCpyN(gstWiringInfo.last_port_name, + sizeof(gstWiringInfo.last_port_name), port_name); + } + } + } + + void ResetWiringNodeInfo() + { + memset(&gstWiringInfo, 0, sizeof(WiringInfo)); + } + void InputPolyPts() { *************** *** 1146,1150 **** if (num_polys > 1 || started_composite) { SelectAndHighLightNewObjects(saved_top_obj); ! GroupSelObj(TRUE, TRUE); EndCompositeCmd(); --- 1219,1223 ---- if (num_polys > 1 || started_composite) { SelectAndHighLightNewObjects(saved_top_obj); ! GroupSelObj(TRUE, TRUE, TRUE); EndCompositeCmd(); *************** *** 1949,1952 **** --- 2022,2228 ---- } + static + void CopyPolySegmentProperties(obj_ptr, poly_ptr) + struct ObjRec *obj_ptr; + struct PolyRec *poly_ptr; + { + struct PolyRec *new_poly_ptr=topObj->detail.p; + + new_poly_ptr->style = LS_PLAIN; + new_poly_ptr->width = poly_ptr->width; + new_poly_ptr->aw = poly_ptr->aw; + new_poly_ptr->ah = poly_ptr->ah; + strcpy(new_poly_ptr->width_spec, poly_ptr->width_spec); + strcpy(new_poly_ptr->aw_spec, poly_ptr->aw_spec); + strcpy(new_poly_ptr->ah_spec, poly_ptr->ah_spec); + new_poly_ptr->pen = poly_ptr->pen; + new_poly_ptr->fill = poly_ptr->fill; + new_poly_ptr->curved = LT_STRAIGHT; + new_poly_ptr->dash = poly_ptr->dash; + + topObj->color = obj_ptr->color; + topObj->bg_color = obj_ptr->bg_color; + memcpy(topObj->color_str, obj_ptr->color_str, sizeof(obj_ptr->color_str)); + memcpy(topObj->bg_color_str, obj_ptr->bg_color_str, + sizeof(obj_ptr->bg_color_str)); + topObj->trans_pat = obj_ptr->trans_pat; + + AdjObjSplineVs(topObj); + AdjObjBBox(topObj); + } + + static + void CopyPolygonSegmentProperties(obj_ptr, polygon_ptr) + struct ObjRec *obj_ptr; + struct PolygonRec *polygon_ptr; + { + struct PolyRec *new_poly_ptr=topObj->detail.p; + int index=0; + + new_poly_ptr->style = LS_PLAIN; + new_poly_ptr->width = polygon_ptr->width; + strcpy(new_poly_ptr->width_spec, polygon_ptr->width_spec); + index = GetBestLineWidthIndex(new_poly_ptr->width, INVALID, INVALID); + new_poly_ptr->aw = curArrowHeadW[index]; + new_poly_ptr->ah = curArrowHeadH[index]; + strcpy(new_poly_ptr->aw_spec, curArrowHeadWSpec[index]); + strcpy(new_poly_ptr->ah_spec, curArrowHeadHSpec[index]); + new_poly_ptr->pen = polygon_ptr->pen; + new_poly_ptr->fill = polygon_ptr->fill; + new_poly_ptr->curved = LT_STRAIGHT; + new_poly_ptr->dash = polygon_ptr->dash; + + topObj->color = obj_ptr->color; + topObj->bg_color = obj_ptr->bg_color; + memcpy(topObj->color_str, obj_ptr->color_str, sizeof(obj_ptr->color_str)); + memcpy(topObj->bg_color_str, obj_ptr->bg_color_str, + sizeof(obj_ptr->bg_color_str)); + topObj->trans_pat = obj_ptr->trans_pat; + + AdjObjSplineVs(topObj); + AdjObjBBox(topObj); + } + + static + int CreateSegmentsFromObject(obj_ptr, pp_top_obj, pp_bot_obj) + struct ObjRec *obj_ptr, **pp_top_obj, **pp_bot_obj; + { + int i=0, num_pts=0, saved_line_style=0, saved_spline=0; + IntPoint *vs=NULL, *tmp_vs=NULL; + struct ObjRec *saved_top_obj=topObj, *saved_bot_obj=botObj; + + switch (obj_ptr->type) { + case OBJ_POLY: + num_pts = obj_ptr->detail.p->n; + if (num_pts <= 2) return FALSE; + vs = obj_ptr->detail.p->vlist; + break; + case OBJ_POLYGON: + num_pts = obj_ptr->detail.g->n; + if (num_pts <= 2) return FALSE; + vs = obj_ptr->detail.g->vlist; + break; + } + curPage->top = topObj = (*pp_top_obj); + curPage->bot = botObj = (*pp_bot_obj); + + tmp_vs = (IntPoint*)malloc(num_pts*sizeof(IntPoint)); + if (tmp_vs == NULL) FailAllocMessage(); + memset(tmp_vs, 0, num_pts*sizeof(IntPoint)); + for (i=0; i < num_pts; i++) { + IntPoint tmp_p; + + if (obj_ptr->ctm == NULL) { + memcpy(&tmp_vs[i], &vs[i], sizeof(IntPoint)); + } else { + TransformObjectV(obj_ptr, &vs[i], &tmp_p); + memcpy(&tmp_vs[i], &tmp_p, sizeof(IntPoint)); + } + } + saved_line_style = lineStyle; + saved_spline = curSpline; + lineStyle = LS_PLAIN; + curSpline = LT_STRAIGHT; + for (i=0; i < num_pts-1; i++) { + ResetCreatePoly(); + AddPtToCreatePoly(tmp_vs[i].x, tmp_vs[i].y); + AddPtToCreatePoly(tmp_vs[i+1].x, tmp_vs[i+1].y); + CreatePolyObj(2, TRUE); + switch (obj_ptr->type) { + case OBJ_POLY: + CopyPolySegmentProperties(obj_ptr, obj_ptr->detail.p); + break; + case OBJ_POLYGON: + CopyPolygonSegmentProperties(obj_ptr, obj_ptr->detail.g); + break; + } + } + free(tmp_vs); + + lineStyle = saved_line_style; + curSpline = saved_spline; + (*pp_top_obj) = topObj; + (*pp_bot_obj) = botObj; + curPage->top = topObj = saved_top_obj; + curPage->bot = botObj = saved_bot_obj; + + return TRUE; + } + + static + void CutPolyIntoSegments() + { + struct SelRec *sel_ptr=NULL, *new_top_sel=NULL, *new_bot_sel=NULL; + int something_changed=FALSE; + + UnSelNonVertexObjs(TRUE, FALSE); /* with highlight */ + UpdSelBBox(); + if (topSel == NULL) { + MsgBox(TgLoadString(STID_NO_POLY_OBJ_SELECTED), TOOL_NAME, INFO_MB); + return; + } + HighLightReverse(); + StartCompositeCmd(); + + for (sel_ptr=botSel; sel_ptr != NULL; sel_ptr=sel_ptr->prev) { + struct ObjRec *new_top_obj=NULL, *new_bot_obj=NULL; + + PrepareToReplaceAnObj(sel_ptr->obj); + if (CreateSegmentsFromObject(sel_ptr->obj, &new_top_obj, &new_bot_obj)) { + struct ObjRec *obj_ptr=NULL; + struct SelRec *saved_top_sel=topSel, *saved_bot_sel=botSel; + int count=0; + + something_changed = TRUE; + UnlinkObj(sel_ptr->obj); + FreeObj(sel_ptr->obj); + + /* add newly created line segments to the top of the object chain */ + new_bot_obj->next = topObj; + if (topObj == NULL) { + curPage->bot = botObj = new_bot_obj; + } else { + topObj->prev = new_bot_obj; + } + curPage->top = topObj = new_top_obj; + + topSel = botSel = NULL; + for (obj_ptr=new_bot_obj; obj_ptr != NULL; obj_ptr=obj_ptr->prev, + count++) { + AddSel(NULL, topSel, SelectThisObject(obj_ptr)); + } + UpdSelBBox(); + RecordCmd(CMD_ONE_TO_MANY, NULL, topSel, botSel, numObjSelected); + + botSel->next = new_top_sel; + if (new_top_sel == NULL) { + new_bot_sel = botSel; + } else { + new_top_sel->prev = botSel; + } + new_top_sel = topSel; + + topSel = saved_top_sel; + botSel = saved_bot_sel; + } else { + AbortPrepareCmd(CMD_REPLACE); + } + } + EndCompositeCmd(); + + if (something_changed) { + RemoveAllSel(); + topSel = new_top_sel; + botSel = new_bot_sel; + UpdSelBBox(); + + RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), + selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); + SetFileModified(TRUE); + justDupped = FALSE; + } + HighLightForward(); + } + void CutPoly() { *************** *** 1956,1960 **** int index; ! if (curChoice != VERTEXMODE) { MsgBox(TgLoadString(STID_CMD_ONLY_AVAIL_IN_VERTEX_MODE), TOOL_NAME, INFO_MB); --- 2232,2247 ---- int index; ! if (curChoice == NOTHING) { ! if (topSel == NULL) { ! MsgBox(TgLoadCachedString(CSTID_NO_OBJ_SELECTED), TOOL_NAME, INFO_MB); ! return; ! } ! if (MsgBox(TgLoadString(STID_Q_OK_TO_CUT_INTO_SEGMENTS), TOOL_NAME, ! YNC_MB) != MB_ID_YES) { ! return; ! } ! CutPolyIntoSegments(); ! return; ! } else if (curChoice != VERTEXMODE) { MsgBox(TgLoadString(STID_CMD_ONLY_AVAIL_IN_VERTEX_MODE), TOOL_NAME, INFO_MB); *************** *** 3860,3862 **** --- 4147,4154 ---- free(ObjPtr->detail.p); free(ObjPtr); + } + + void InitPoly() + { + ResetWiringNodeInfo(); } *** polygon.c.orig Fri Aug 4 14:04:17 2000 --- polygon.c Fri Aug 4 14:04:17 2000 *************** *** 1051,1055 **** if (num_polygons > 1 || started_composite) { SelectAndHighLightNewObjects(saved_top_obj); ! GroupSelObj(TRUE, TRUE); EndCompositeCmd(); --- 1051,1055 ---- if (num_polygons > 1 || started_composite) { SelectAndHighLightNewObjects(saved_top_obj); ! GroupSelObj(TRUE, TRUE, TRUE); EndCompositeCmd(); *** raster.c.orig Fri Aug 4 14:04:18 2000 --- raster.c Fri Aug 4 14:04:18 2000 *************** *** 227,230 **** --- 227,231 ---- #include "xbm/png.xbm" #include "xbm/jpeg.xbm" + #include "xbm/netlist.xbm" #include "xbm/file.xbm" *************** *** 266,269 **** --- 267,271 ---- #include "xbm/rot_270.xbm" + #include "xbm/wire.xbm" #include "xbm/run.xbm" #include "xbm/check.xbm" *************** *** 330,333 **** --- 332,336 ---- Pixmap shortDashPixmap[MAXDASHES]; + Pixmap wireBitmap=None; Pixmap runBitmap=None; Pixmap checkBitmap=None; *************** *** 945,948 **** --- 948,953 ---- whereToPrintPixmap[JPEG_FILE] = XCreateBitmapFromData(mainDisplay, mainWindow, (char *)jpeg_bits, jpeg_width, jpeg_height); + whereToPrintPixmap[NETLIST_FILE] = XCreateBitmapFromData(mainDisplay, + mainWindow, (char *)netlist_bits, netlist_width, netlist_height); shortLineTypePixmap[0] = XCreateBitmapFromData(mainDisplay, mainWindow, *************** *** 1016,1019 **** --- 1021,1027 ---- (char *)rot_mode_bits, rot_mode_width, rot_mode_height); + wireBitmap = XCreateBitmapFromData(mainDisplay, mainWindow, + (char *)wire_bits, wire_width, wire_height); + runBitmap = XCreateBitmapFromData(mainDisplay, mainWindow, (char *)run_bits, run_width, run_height); *************** *** 1169,1172 **** --- 1177,1181 ---- XFreePixmap(mainDisplay, shortDashPixmap[i]); } + XFreePixmap(mainDisplay, wireBitmap); XFreePixmap(mainDisplay, runBitmap); XFreePixmap(mainDisplay, checkBitmap); *** rcbox.c.orig Fri Aug 4 14:04:18 2000 --- rcbox.c Fri Aug 4 14:04:19 2000 *************** *** 575,580 **** } - static XComposeStatus c_stat; - static void ContinueRCBox(OrigX, OrigY) --- 575,578 ---- *************** *** 668,678 **** 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); MyRCBox(drawWindow,drawGC,OrigX,OrigY,saved_x,saved_y,radius); --- 666,670 ---- while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { XUngrabPointer(mainDisplay, CurrentTime); MyRCBox(drawWindow,drawGC,OrigX,OrigY,saved_x,saved_y,radius); *** remote.c.orig Fri Aug 4 14:04:19 2000 --- remote.c Fri Aug 4 14:04:19 2000 *************** *** 553,557 **** int fd=(-1); ! tmp_fname = (char*)malloc((strlen(TMP_DIR)+20)*sizeof(char)); if (tmp_fname == NULL) { FailAllocMessage(); --- 553,557 ---- int fd=(-1); ! tmp_fname = (char*)malloc((strlen(tmpDir)+20)*sizeof(char)); if (tmp_fname == NULL) { FailAllocMessage(); *************** *** 558,563 **** return NULL; } ! sprintf(tmp_fname, "%sTgifXXXXXX", TMP_DIR); ! mktemp(tmp_fname); if (psz_ext != NULL) strcat(tmp_fname, psz_ext); unlink(tmp_fname); --- 558,562 ---- return NULL; } ! MkTempFile(tmp_fname, sizeof(tmp_fname), tmpDir, TOOL_NAME); if (psz_ext != NULL) strcat(tmp_fname, psz_ext); unlink(tmp_fname); *************** *** 2046,2050 **** if (!rc_loadfile) { NewProc(); ! PasteString(psz_buf); } SetCurDir(psz_url); --- 2045,2049 ---- if (!rc_loadfile) { NewProc(); ! PasteString(psz_buf, TRUE, TRUE); } SetCurDir(psz_url); *** select.c.orig Fri Aug 4 14:04:20 2000 --- select.c Fri Aug 4 14:04:20 2000 *************** *** 36,39 **** --- 36,40 ---- #include "tgifdefs.h" + #include "attr.e" #include "auxtext.e" #include "button.e" *************** *** 70,73 **** --- 71,75 ---- #include "select.e" #include "setup.e" + #include "special.e" #include "stk.e" #include "stretch.e" *************** *** 157,162 **** } ! void UnSelNonVertexObjs(highlight) ! int highlight; { register struct ObjRec *obj_ptr; --- 159,164 ---- } ! void UnSelNonVertexObjs(highlight, no_locked_obj_only) ! int highlight, no_locked_obj_only; { register struct ObjRec *obj_ptr; *************** *** 168,175 **** if ((obj_ptr->type==OBJ_POLY || obj_ptr->type==OBJ_POLYGON) && ! !obj_ptr->locked) { continue; } - if (highlight) HighLightAnObj(obj_ptr); --- 170,176 ---- if ((obj_ptr->type==OBJ_POLY || obj_ptr->type==OBJ_POLYGON) && ! (!no_locked_obj_only || !obj_ptr->locked)) { continue; } if (highlight) HighLightAnObj(obj_ptr); *************** *** 331,335 **** } - static struct AttrRec *FindObjAttrWithName(ObjPtr, AttrName) struct ObjRec *ObjPtr; --- 332,335 ---- *************** *** 584,600 **** char *c_ptr; ! strcpy(ReturnedObjName, "NodeName: "); ! c_ptr = &ReturnedObjName[10]; if (returned_obj != NULL) { struct ObjRec *prev_obj=NULL; for (obj_ptr=actual_obj; obj_ptr != NULL; obj_ptr=obj_ptr->tmp_child) { ! if ((attr_ptr=FindObjAttrWithName(obj_ptr, "name=")) != NULL) { ! *c_ptr++ = '!'; ! strcpy(c_ptr, attr_ptr->attr_value.s); ! c_ptr = &c_ptr[strlen(c_ptr)]; } else { ! if (prev_obj != NULL) prev_obj->tmp_child = NULL; ! break; } prev_obj = obj_ptr; --- 584,638 ---- char *c_ptr; ! *ReturnedObjName = '\0'; ! c_ptr = ReturnedObjName; if (returned_obj != NULL) { struct ObjRec *prev_obj=NULL; + int see_sym_or_icon=FALSE; for (obj_ptr=actual_obj; obj_ptr != NULL; obj_ptr=obj_ptr->tmp_child) { ! /* do not translate -- program constants */ ! if (connectingPortsFromInternalCommand) { ! /* this is pretty much left for compatibility only */ ! if ((attr_ptr=FindObjAttrWithName(obj_ptr, "name=")) != NULL) { ! *c_ptr++ = '!'; ! strcpy(c_ptr, attr_ptr->attr_value.s); ! c_ptr = &c_ptr[strlen(c_ptr)]; ! } else { ! if (prev_obj != NULL) prev_obj->tmp_child = NULL; ! break; ! } } else { ! int just_seen_sym_or_icon=FALSE; ! ! if (!see_sym_or_icon) { ! if (obj_ptr->type == OBJ_SYM || obj_ptr->type == OBJ_ICON) { ! see_sym_or_icon = TRUE; ! just_seen_sym_or_icon = TRUE; ! } ! } ! if (see_sym_or_icon) { ! if ((attr_ptr=FindObjAttrWithName(obj_ptr, "name=")) == ! NULL) { ! /* broken name is invalid */ ! c_ptr = ReturnedObjName; ! if (prev_obj != NULL) prev_obj->tmp_child = NULL; ! break; ! } else if (BlankStr(attr_ptr->attr_value.s)) { ! /* do not translate -- program constants */ ! *c_ptr++ = '!'; ! strcpy(c_ptr, "(unknown)"); ! c_ptr = &c_ptr[strlen(c_ptr)]; ! } else { ! *c_ptr++ = '!'; ! strcpy(c_ptr, attr_ptr->attr_value.s); ! c_ptr = &c_ptr[strlen(c_ptr)]; ! } ! if (!just_seen_sym_or_icon && (obj_ptr->type == OBJ_SYM || ! obj_ptr->type == OBJ_ICON)) { ! obj_ptr->tmp_child = NULL; ! prev_obj = obj_ptr; ! break; ! } ! } } prev_obj = obj_ptr; *************** *** 602,606 **** if (ConnectObj != NULL) *ConnectObj = prev_obj; } ! if (c_ptr == &ReturnedObjName[10]) { *ReturnedObjName = '\0'; } else { --- 640,644 ---- if (ConnectObj != NULL) *ConnectObj = prev_obj; } ! if (c_ptr == ReturnedObjName) { *ReturnedObjName = '\0'; } else { *************** *** 1389,1393 **** topSel = top_sel_ptr; botSel = bot_sel_ptr; ! UnSelNonVertexObjs(FALSE); /* do not highlight */ UpdSelBBox(); HighLightForward(); --- 1427,1431 ---- topSel = top_sel_ptr; botSel = bot_sel_ptr; ! UnSelNonVertexObjs(FALSE, TRUE); /* do not highlight */ UpdSelBBox(); HighLightForward(); *************** *** 2489,2494 **** } ! void GroupSelObj(highlight, record_cmd) ! int highlight, record_cmd; { if (topSel == NULL) { --- 2527,2532 ---- } ! void GroupSelObj(highlight, record_cmd, redraw) ! int highlight, record_cmd, redraw; { if (topSel == NULL) { *************** *** 2522,2527 **** if (record_cmd) RecordCmd(CMD_MANY_TO_ONE, NULL, topSel, botSel, 1); ! RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), ! selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); if (highlight) HighLightForward(); SetFileModified(TRUE); --- 2560,2567 ---- if (record_cmd) RecordCmd(CMD_MANY_TO_ONE, NULL, topSel, botSel, 1); ! if (redraw) { ! RedrawAnArea(botObj, selLtX-GRID_ABS_SIZE(1), selLtY-GRID_ABS_SIZE(1), ! selRbX+GRID_ABS_SIZE(1), selRbY+GRID_ABS_SIZE(1)); ! } if (highlight) HighLightForward(); SetFileModified(TRUE); *** setup.c.orig Fri Aug 4 14:04:21 2000 --- setup.c Fri Aug 4 14:04:21 2000 *************** *** 83,86 **** --- 83,87 ---- #include "shape.e" #include "shortcut.e" + #include "special.e" #include "spline.e" #include "stk.e" *************** *** 241,244 **** --- 242,246 ---- char homeDir[MAXPATHLENGTH]; char tgifDir[MAXPATHLENGTH]; + char tmpDir[MAXPATHLENGTH]; int symPathNumEntries = INVALID; *************** *** 847,851 **** int bg_pixel=(-1); char *c_ptr=NULL; ! int def_x_neg=0, def_y_neg=0, paper_size_set; struct stat stat_buf; XWMHints wmhints; --- 849,853 ---- int bg_pixel=(-1); char *c_ptr=NULL; ! int def_x_neg=0, def_y_neg=0, paper_size_set, tmp_dir_in_x_def=FALSE; struct stat stat_buf; XWMHints wmhints; *************** *** 921,927 **** --- 923,932 ---- } else if (UtilStrICmp(c_ptr, "JPEG") == 0) { whereToPrint = JPEG_FILE; + } else if (UtilStrICmp(c_ptr, "NetList") == 0) { + whereToPrint = NETLIST_FILE; } else { fprintf(stderr, TgLoadString(STID_INVALID_XDEF_USE_ALT_STR), TOOL_NAME, "WhereToPrint", c_ptr, "EPS"); + fprintf(stderr, "\n"); } } *************** *** 1443,1446 **** --- 1448,1487 ---- GetWorkingDirectory(bootDir, sizeof(bootDir)); } + /* do not translate -- program constants */ + if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "TmpDir")) != NULL) { + UtilTrimBlanks(c_ptr); + if (*c_ptr == '\0') { + fprintf(stderr, TgLoadString(STID_INVALID_DIR_IN_X_DEFAULT), + c_ptr, TOOL_NAME, "TmpDir"); + fprintf(stderr, "\n"); + } else { + UtilStrCpyN(tmpDir, sizeof(tmpDir)-1, c_ptr); + strcat(tmpDir, DIR_SEP_STR); + if (UtilIsDirectory(tmpDir)) { + tmp_dir_in_x_def = TRUE; + } else { + fprintf(stderr, TgLoadString(STID_TMP_DIR_NOT_EXIST_USE_XDEF), + tmpDir, TOOL_NAME, "TmpDir"); + fprintf(stderr, "\n"); + } + } + } + if (!tmp_dir_in_x_def) { + #ifndef _TMP_DIR_IN_HOME_DIR + UtilStrCpyN(tmpDir, sizeof(tmpDir), TMP_DIR); + if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "TmpDirInHomeDir")) != + NULL && UtilStrICmp(c_ptr, "true") == 0) { + UtilStrCpyN(tmpDir, sizeof(tmpDir)-1, tgifDir); + strcat(tmpDir, DIR_SEP_STR); + } + #else /* _TMP_DIR_IN_HOME_DIR */ + UtilStrCpyN(tmpDir, sizeof(tmpDir)-1, tgifDir); + strcat(tmpDir, DIR_SEP_STR); + if ((c_ptr=XGetDefault(mainDisplay, TOOL_NAME, "TmpDirInHomeDir")) != + NULL && UtilStrICmp(c_ptr, "false") == 0) { + UtilStrCpyN(tmpDir, sizeof(tmpDir), TMP_DIR); + } + #endif /* ~_TMP_DIR_IN_HOME_DIR */ + } InitFonts(); *************** *** 1786,1789 **** --- 1827,1832 ---- InitRecentFiles(); InitMeasureTooltip(); + InitPoly(); + InitSpecial(); #ifdef MAPBEFORESELECT *** shape.c.orig Fri Aug 4 14:04:22 2000 --- shape.c Fri Aug 4 14:04:22 2000 *************** *** 1006,1011 **** } - static XComposeStatus c_stat; - static void ContinueCreateShape(orig_x, orig_y) --- 1006,1009 ---- *************** *** 1030,1036 **** while (!done) { XEvent input, ev; - KeySym key_sym; - char s[80]; - int has_ch; XNextEvent(mainDisplay, &input); --- 1028,1031 ---- *************** *** 1065,1071 **** break; case KeyPress: ! 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)) { done = TRUE; } --- 1060,1064 ---- break; case KeyPress: ! if (KeyPressEventIsEscape(&input.xkey)) { done = TRUE; } *** shortcut.c.orig Fri Aug 4 14:04:23 2000 --- shortcut.c Fri Aug 4 14:04:23 2000 *************** *** 388,391 **** --- 388,396 ---- { '\0', 0, "ToggleAutoEPSPreviewBitmap()", 0, CMDID_TOGGLEAUTOEPSPREVIEWBITMAP }, + { '\0', 0, "CreateThumbnails()", 0, CMDID_CREATETHUMBNAILS }, + { '\0', 0, "ConnectTwoPortsByAWire()", 0, CMDID_CONNECT2PORTSBYWIRE }, + { '\0', 0, "RenameSignalNameForAPort()", 0, CMDID_RENAMESIGNAMEFORAPORT }, + { '\0', 0, "ClearSignalNameForAPort()", 0, CMDID_CLEARSIGNAMEFORAPORT }, + { '\0', 0, "ToggleShowWireSignalName()", 0, CMDID_TOGGLESHOWWIRESIGNALNAME }, { '\0', 0, "", 0, 0 } }; *** special.c.orig Fri Aug 4 14:04:24 2000 --- special.c Fri Aug 4 14:04:24 2000 *************** *** 35,38 **** --- 35,39 ---- #include "tgifdefs.h" + #include "cmdids.h" #include "animate.e" *************** *** 53,56 **** --- 54,58 ---- #include "group.e" #include "mainloop.e" + #include "mainmenu.e" #include "mark.e" #include "menu.e" *************** *** 62,66 **** --- 64,70 ---- #include "obj.e" #include "page.e" + #include "poly.e" #include "raster.e" + #include "rect.e" #include "remote.e" #include "ruler.e" *************** *** 76,80 **** --- 80,87 ---- int placingTopObj=FALSE; + int connectingPortsByWire=FALSE; + int connectingPortsFromInternalCommand=TRUE; + static int showWireSignalName=TRUE; static int gnPinWarning=FALSE; *************** *** 574,577 **** --- 581,1129 ---- } + int ObjIsAPort(obj_ptr) + struct ObjRec *obj_ptr; + { + struct AttrRec *attr_ptr=NULL; + + attr_ptr = FindAttrWithName(obj_ptr, "type=", NULL); + if (attr_ptr != NULL && strcmp(attr_ptr->attr_value.s, "port") == 0) { + /* + * if this is not called from ConnectTwoPortsByAWire() but from + * an internal command, "type=port" is enough for a point + */ + if (connectingPortsFromInternalCommand) return TRUE; + + if (FindAttrWithName(obj_ptr, "signal_name=", NULL) != NULL && + FindAttrWithName(obj_ptr, "name=", NULL) != NULL) { + struct ObjRec *owner_obj=obj_ptr->tmp_parent, *tmp_obj=NULL; + + owner_obj = obj_ptr->tmp_parent; + if (owner_obj == NULL) { + /* obj_ptr is a top-level object */ + return (obj_ptr->type == OBJ_ICON || obj_ptr->type == OBJ_SYM); + } else { + if (owner_obj->type == OBJ_ICON || owner_obj->type == OBJ_SYM) { + if (FindAttrWithName(owner_obj, "name=", NULL) == NULL) { + return FALSE; + } + } else { + return FALSE; + } + } + for (tmp_obj=owner_obj->tmp_parent; tmp_obj != NULL; + tmp_obj=tmp_obj->tmp_parent) { + if (tmp_obj->type == OBJ_ICON || tmp_obj->type == OBJ_SYM) { + return FALSE; + } + } + return TRUE; + } + } + return FALSE; + } + + static + int DoConnectTwoPorts() + { + int poly_created=FALSE; + XGCValues values; + + MakeQuiescent(); + + ResetWiringNodeInfo(); + connectingPortsByWire = TRUE; + connectingPortsFromInternalCommand = FALSE; + UseWireMenuItemInModeItem(TRUE); + + values.line_width = 3; + XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); + SetCurChoice(DRAWPOLY); + gstWiringInfo.num_ports_to_connect = 2; + drawPolyHighlightedNode = NULL; + SetStringStatus(TgLoadString(STID_DRAW_AN_EDGE_BETWEEN_PORTS)); + polyDrawn = FALSE; + for (;;) { + XEvent input; + + XNextEvent(mainDisplay, &input); + if (input.type == Expose || input.type == VisibilityNotify) { + ExposeEventHandler(&input, TRUE); + } else if (input.type == ConfigureNotify) { + Reconfigure(FALSE); + } else if (input.xany.window == drawWindow) { + polyDrawn = FALSE; + DrawingEventHandler(&input); + if (curChoice == DRAWPOLY) { + if (polyDrawn) { + break; + } else if (gstWiringInfo.num_ports_to_connect == (-1)) { + break; + } + } else { + polyDrawn = FALSE; + break; + } + } + } + gstWiringInfo.num_ports_to_connect = 0; + poly_created = polyDrawn; + values.line_width = 1; + XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); + connectingPortsByWire = FALSE; + connectingPortsFromInternalCommand = TRUE; + SetCurChoice(NOTHING); + RedrawModeWindow(); + UseWireMenuItemInModeItem(FALSE); + UpdatePinnedMenu(MENU_MODE); + + return poly_created; + } + + static + void AddWireAttributes(poly_obj_ptr, signal_name, p_obbox, auto_center) + struct ObjRec *poly_obj_ptr; + char *signal_name; + struct BBRec *p_obbox; + int auto_center; + { + struct ObjRec *text_obj_ptr=NULL; + + PrepareToReplaceAnObj(poly_obj_ptr); + + AddAttrByNameAndValue(poly_obj_ptr, "signal_name=", signal_name); + poly_obj_ptr->fattr->shown = TRUE; + poly_obj_ptr->fattr->nameshown = FALSE; + UpdAttr(poly_obj_ptr->fattr); + text_obj_ptr = poly_obj_ptr->fattr->obj; + if (auto_center) { + CenterObjInOBBox(text_obj_ptr, *p_obbox, NULL); + memcpy(p_obbox, &text_obj_ptr->obbox, sizeof(struct BBRec)); + poly_obj_ptr->fattr->shown = FALSE; + } else { + MoveObj(text_obj_ptr, p_obbox->ltx-text_obj_ptr->obbox.ltx, + p_obbox->lty-text_obj_ptr->obbox.lty); + } + AddAttrByNameAndValue(poly_obj_ptr, "type=", "tgWire"); + text_obj_ptr = poly_obj_ptr->fattr->obj; + MoveObj(text_obj_ptr, p_obbox->ltx-text_obj_ptr->obbox.ltx, + p_obbox->rby-text_obj_ptr->obbox.lty); + + AdjObjBBox(poly_obj_ptr); + + RecordReplaceAnObj(poly_obj_ptr); + } + + typedef struct tagChangeConnectionViewInfo { + int change_to_connect_view; + struct ObjRec *conn_view_obj, *disconn_view_obj; + int conn_fill, conn_pen, disconn_fill, disconn_pen; + } ChangeConnectionViewInfo; + + static + int ChangeConnectionView(pravci) + ReplAttrValueCallbackInfo *pravci; + { + ChangeConnectionViewInfo *pccvi=( + (ChangeConnectionViewInfo*)pravci->pv_userdata); + + if (pccvi->change_to_connect_view) { + ChangeObjFill(pccvi->disconn_view_obj, NONEPAT); + ChangeObjPen(pccvi->disconn_view_obj, NONEPAT); + ChangeObjFill(pccvi->conn_view_obj, pccvi->conn_fill); + ChangeObjPen(pccvi->conn_view_obj, pccvi->conn_pen); + } else { + ChangeObjFill(pccvi->conn_view_obj, NONEPAT); + ChangeObjPen(pccvi->conn_view_obj, NONEPAT); + ChangeObjFill(pccvi->disconn_view_obj, pccvi->disconn_fill); + ChangeObjPen(pccvi->disconn_view_obj, pccvi->disconn_pen); + } + } + + static + int HasConnAndDisConnViewObjSubObjs(obj_ptr, pccvi) + struct ObjRec *obj_ptr; + ChangeConnectionViewInfo *pccvi; + { + struct ObjRec *subobj=NULL; + + if (obj_ptr == NULL) return FALSE; + if (obj_ptr->type != OBJ_SYM && obj_ptr->type != OBJ_ICON && + obj_ptr->type != OBJ_GROUP) { + return FALSE; + } + for (subobj=obj_ptr->detail.r->first; subobj != NULL; subobj=subobj->next) { + struct AttrRec *attr_ptr=FindAttrWithName(subobj, "view=", NULL); + + if (attr_ptr != NULL) { + char *psz_fill=NULL, *psz_pen=NULL, buf[MAXSTRING]; + + UtilStrCpyN(buf, sizeof(buf), attr_ptr->attr_value.s); + psz_fill = strchr(buf, ','); + if (psz_fill != NULL) { + *psz_fill++ = '\0'; + psz_pen = strchr(psz_fill, ','); + if (psz_pen != NULL) *psz_pen++ = '\0'; + } + if (psz_fill != NULL && psz_pen != NULL) { + int fill=0, pen=0, ok=TRUE; + + UtilTrimBlanks(buf); + UtilTrimBlanks(psz_fill); + UtilTrimBlanks(psz_pen); + if (sscanf(psz_fill, "%d", &fill) != 1) ok = FALSE; + if (sscanf(psz_pen, "%d", &pen) != 1) ok = FALSE; + if (ok) { + fill = fill % MAXPATTERNS; + pen = pen % MAXPATTERNS; + if (ok && UtilStrICmp(buf, "conn") == 0) { + pccvi->conn_fill = fill; + pccvi->conn_pen = pen; + pccvi->conn_view_obj = subobj; + } else if (ok && UtilStrICmp(buf, "disconn") == 0) { + pccvi->disconn_fill = fill; + pccvi->disconn_pen = pen; + pccvi->disconn_view_obj = subobj; + } + } + } + } + } + return (pccvi->conn_view_obj != NULL && pccvi->disconn_view_obj != NULL); + } + + static + int SetPortSignalName(attr_ptr, attr_owner_obj, new_signal_name) + struct AttrRec *attr_ptr; + struct ObjRec *attr_owner_obj; + char *new_signal_name; + { + if (attr_ptr != NULL && + strcmp(new_signal_name, attr_ptr->attr_value.s) != 0) { + char *old_signal_name=attr_ptr->attr_value.s; + ChangeConnectionViewInfo ccvi; + + memset(&ccvi, 0, sizeof(ChangeConnectionViewInfo)); + if ((*old_signal_name == '\0' || *new_signal_name == '\0') && + HasConnAndDisConnViewObjSubObjs(attr_ptr->owner, &ccvi)) { + if (*old_signal_name == '\0') { + /* the port will become connected */ + ccvi.change_to_connect_view = TRUE; + } else { + /* the port will become disconnected */ + ccvi.change_to_connect_view = TRUE; + } + SetReplaceAttrValueCallback( + (ReplAttrValueCallback*)ChangeConnectionView, &ccvi); + } + ReplaceAttrFirstValue(attr_owner_obj, attr_ptr, new_signal_name); + SetReplaceAttrValueCallback(NULL, NULL); + RecursivelyAdjObjBBox(attr_ptr->owner, attr_ptr->owner, + attr_owner_obj); + return TRUE; + } + return FALSE; + } + + static + void DoNameWire() + { + struct AttrRec *first_attr_ptr=NULL, *last_attr_ptr=NULL; + struct ObjRec *first_attr_owner_obj=NULL, *last_attr_owner_obj=NULL; + struct BBRec bbox; + char signal_name[MAXSTRING], *existing_signal_name=NULL; + int need_to_clear=FALSE, do_prompt=TRUE, need_to_redraw=FALSE; + + memcpy(&bbox, &topObj->bbox, sizeof(struct BBRec)); + first_attr_ptr = FindAttrWithName(gstWiringInfo.first_port_obj, + "signal_name=", &first_attr_owner_obj); + while (first_attr_owner_obj != NULL && + first_attr_owner_obj->tmp_parent != NULL) { + first_attr_owner_obj = first_attr_owner_obj->tmp_parent; + } + last_attr_ptr = FindAttrWithName(gstWiringInfo.last_port_obj, + "signal_name=", &last_attr_owner_obj); + while (last_attr_owner_obj != NULL && + last_attr_owner_obj->tmp_parent != NULL) { + last_attr_owner_obj = last_attr_owner_obj->tmp_parent; + } + if (first_attr_ptr == NULL && last_attr_ptr == NULL) return; + if (first_attr_ptr != NULL && last_attr_ptr != NULL) { + if (strcmp(first_attr_ptr->attr_value.s, last_attr_ptr->attr_value.s) != + 0) { + if (*first_attr_ptr->attr_value.s == '\0' && + *last_attr_ptr->attr_value.s == '\0') { + do_prompt = TRUE; + } else if (*first_attr_ptr->attr_value.s == '\0') { + existing_signal_name = last_attr_ptr->attr_value.s; + } else if (*last_attr_ptr->attr_value.s == '\0') { + existing_signal_name = first_attr_ptr->attr_value.s; + } else { + sprintf(gszMsgBox, TgLoadString(STID_Q_CNFLCT_SIG_NAME_OKAY_TO_CLR), + first_attr_ptr->attr_value.s, gstWiringInfo.first_port_name, + last_attr_ptr->attr_value.s, gstWiringInfo.last_port_name); + switch (MsgBox(gszMsgBox, TOOL_NAME, YNC_MB)) { + case MB_ID_YES: + need_to_clear = TRUE; + do_prompt = TRUE; + break; + case MB_ID_NO: + case MB_ID_CANCEL: + return; + } + } + } else { + existing_signal_name = first_attr_ptr->attr_value.s; + } + } else if (first_attr_ptr == NULL) { + if (*last_attr_ptr->attr_value.s != '\0') { + existing_signal_name = last_attr_ptr->attr_value.s; + } + } else { + if (*first_attr_ptr->attr_value.s != '\0') { + existing_signal_name = first_attr_ptr->attr_value.s; + } + } + StartCompositeCmd(); + if (need_to_clear) { + if (SetPortSignalName(first_attr_ptr, first_attr_owner_obj, "")) { + UnionRect(&bbox, &first_attr_owner_obj->bbox, &bbox); + need_to_redraw = TRUE; + } + if (SetPortSignalName(last_attr_ptr, last_attr_owner_obj, "")) { + UnionRect(&bbox, &last_attr_owner_obj->bbox, &bbox); + need_to_redraw = TRUE; + } + } + if (do_prompt) { + struct ObjRec *signal_name_obj=NULL; + struct BBRec obbox; + XEvent ev; + + *signal_name = '\0'; + if (existing_signal_name != NULL) { + UtilStrCpyN(signal_name, sizeof(signal_name), existing_signal_name); + } + Dialog(TgLoadString(STID_PLS_ENT_SIG_NAME), NULL, signal_name); + UtilTrimBlanks(signal_name); + if (*signal_name == '\0') { + if (need_to_clear) { + sprintf(gszMsgBox, TgLoadString(STID_SIGNAL_NAMES_CLEARED), + gstWiringInfo.first_port_name, gstWiringInfo.last_port_name); + MsgBox(gszMsgBox, TOOL_NAME, INFO_MB); + } + EndCompositeCmd(); + + if (need_to_redraw) { + SetFileModified(TRUE); + justDupped = FALSE; + RedrawAnArea(botObj, + bbox.ltx-QUARTER_INCH-GRID_ABS_SIZE(1), + bbox.lty-QUARTER_INCH-GRID_ABS_SIZE(1), + bbox.rbx+QUARTER_INCH+GRID_ABS_SIZE(1), + bbox.rby+QUARTER_INCH+GRID_ABS_SIZE(1)); + } + return; + } + if (showWireSignalName) { + SaveStatusStrings(); + sprintf(gszMsgBox, TgLoadString(STID_PLACING_NAMED_SIGNAL), + signal_name); + SetStringStatus(gszMsgBox); + PasteString(signal_name, FALSE, FALSE); + RestoreStatusStrings(); + + memcpy(&obbox, &topObj->obbox, sizeof(struct BBRec)); + signal_name_obj = topObj; + UnlinkObj(signal_name_obj); + FreeObj(signal_name_obj); + + XSync(mainDisplay, False); + if (XCheckMaskEvent(mainDisplay, ExposureMask, &ev)) { + ExposeEventHandler(&ev, TRUE); + } + } else { + memcpy(&obbox, &topObj->obbox, sizeof(struct BBRec)); + } + AddWireAttributes(topObj, signal_name, &obbox, !showWireSignalName); + UnionRect(&bbox, &topObj->bbox, &bbox); + if (SetPortSignalName(first_attr_ptr, first_attr_owner_obj, + signal_name)) { + UnionRect(&bbox, &first_attr_owner_obj->bbox, &bbox); + need_to_redraw = TRUE; + } + if (SetPortSignalName(last_attr_ptr, last_attr_owner_obj, signal_name)) { + UnionRect(&bbox, &last_attr_owner_obj->bbox, &bbox); + need_to_redraw = TRUE; + } + } + EndCompositeCmd(); + + if (need_to_redraw) { + SetFileModified(TRUE); + justDupped = FALSE; + RedrawAnArea(botObj, + bbox.ltx-QUARTER_INCH-GRID_ABS_SIZE(1), + bbox.lty-QUARTER_INCH-GRID_ABS_SIZE(1), + bbox.rbx+QUARTER_INCH+GRID_ABS_SIZE(1), + bbox.rby+QUARTER_INCH+GRID_ABS_SIZE(1)); + } + } + + void ConnectTwoPortsByAWire() + { + if (DoConnectTwoPorts()) { + DoNameWire(); + } + } + + #define DO_RENAME_SIGNAL_NAME 99 + #define DO_CLEAR_SIGNAL_NAME 999 + + static + void DoNameOrClearAPort(which) + int which; + { + struct AttrRec *first_attr_ptr=NULL; + struct ObjRec *first_attr_owner_obj=NULL; + char signal_name[MAXSTRING]; + ChangeConnectionViewInfo ccvi; + + memset(&ccvi, 0, sizeof(ChangeConnectionViewInfo)); + first_attr_ptr = FindAttrWithName(gstWiringInfo.first_port_obj, + "signal_name=", &first_attr_owner_obj); + while (first_attr_owner_obj != NULL && + first_attr_owner_obj->tmp_parent != NULL) { + first_attr_owner_obj = first_attr_owner_obj->tmp_parent; + } + if (first_attr_ptr == NULL) { + #ifdef _TGIF_DBG /* debug, do not translate */ + TgAssert(FALSE, + "first_attr_ptr is NULL in DoNameOrClearAPort()", NULL); + return; + #endif /* _TGIF_DBG */ + } + *signal_name = '\0'; + if (which == DO_CLEAR_SIGNAL_NAME && *first_attr_ptr->attr_value.s == '\0') { + /* already cleared */ + return; + } + if (which == DO_RENAME_SIGNAL_NAME) { + UtilStrCpyN(signal_name, sizeof(signal_name), + first_attr_ptr->attr_value.s); + sprintf(gszMsgBox, TgLoadString(STID_PLS_ENT_SIG_NAME_FOR_PORT), + gstWiringInfo.first_port_name); + if (Dialog(gszMsgBox, NULL, signal_name) == INVALID) return; + UtilTrimBlanks(signal_name); + } + if (strcmp(signal_name, first_attr_ptr->attr_value.s) == 0) { + return; + } + if (HasConnAndDisConnViewObjSubObjs(first_attr_ptr->owner, &ccvi)) { + ccvi.change_to_connect_view = FALSE; + SetReplaceAttrValueCallback( + (ReplAttrValueCallback*)ChangeConnectionView, &ccvi); + } + ReplaceAttrFirstValue(first_attr_owner_obj, first_attr_ptr, + signal_name); + RecursivelyAdjObjBBox(first_attr_ptr->owner, first_attr_ptr->owner, + first_attr_owner_obj); + + SetFileModified(TRUE); + justDupped = FALSE; + RedrawAnArea(botObj, + first_attr_owner_obj->bbox.ltx-QUARTER_INCH-GRID_ABS_SIZE(1), + first_attr_owner_obj->bbox.lty-QUARTER_INCH-GRID_ABS_SIZE(1), + first_attr_owner_obj->bbox.rbx+QUARTER_INCH+GRID_ABS_SIZE(1), + first_attr_owner_obj->bbox.rby+QUARTER_INCH+GRID_ABS_SIZE(1)); + } + + static + void DoRenameOrClearSignalNameForAPort(which) + int which; + { + int naming=TRUE; + + ShowCurChoiceMouseStatus(DRAWPOLY, 0, FALSE); + SetHandCursor(drawWindow); + while (naming) { + XEvent input; + + XNextEvent(mainDisplay, &input); + if (input.type == Expose || input.type == VisibilityNotify) { + ExposeEventHandler(&input, TRUE); + } else if (input.type == ConfigureNotify) { + Reconfigure(FALSE); + } else if (input.type == ButtonPress) { + if (input.xbutton.button == Button1) { + if (drawPolyHighlightedNode != NULL) { + HandlePressForPortInDrawWindow(FALSE); + DoNameOrClearAPort(which); + drawPolyHighlightedNode = NULL; + SetWiringNodeInfo(NULL, NULL, NULL, TRUE); + SetHandCursor(drawWindow); + ShowCurChoiceMouseStatus(DRAWPOLY, 0, FALSE); + } + } else { + XUngrabPointer(mainDisplay, CurrentTime); + naming = FALSE; + HandlePressForPortInDrawWindow(TRUE); + } + } else if (input.type == MotionNotify) { + XEvent ev; + + HandleMotionForPortInDrawWindow(input.xmotion.x, input.xmotion.y); + while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; + } else if (input.type == KeyPress) { + if (KeyPressEventIsEscape(&input.xkey)) { + XUngrabPointer(mainDisplay, CurrentTime); + naming = FALSE; + HandlePressForPortInDrawWindow(TRUE); + } + } + } + SetDefaultCursor(drawWindow); + } + + static + void RenameOrClearSignalNameForAPort(which) + int which; + { + XGCValues values; + + MakeQuiescent(); + + ResetWiringNodeInfo(); + connectingPortsByWire = TRUE; + connectingPortsFromInternalCommand = FALSE; + gstWiringInfo.num_ports_to_connect = which; + drawPolyHighlightedNode = NULL; + + values.line_width = 3; + XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); + + SaveStatusStrings(); + DoRenameOrClearSignalNameForAPort(which); + RestoreStatusStrings(); + + values.line_width = 1; + XChangeGC(mainDisplay, revGrayGC, GCLineWidth, &values); + + gstWiringInfo.num_ports_to_connect = 0; + connectingPortsByWire = FALSE; + connectingPortsFromInternalCommand = TRUE; + ResetWiringNodeInfo(); + drawPolyHighlightedNode = NULL; + } + + void RenameSignalNameForAPort() + { + RenameOrClearSignalNameForAPort(DO_RENAME_SIGNAL_NAME); + } + + void ClearSignalNameForAPort() + { + RenameOrClearSignalNameForAPort(DO_CLEAR_SIGNAL_NAME); + } + void MakeSymbolic() { *************** *** 1290,1294 **** while (val_ptr != NULL) { if (c_ptr != NULL) *c_ptr = '\0'; ! if (strlen(val_ptr) == 0) { free(spec); fclose(fp); --- 1842,1846 ---- while (val_ptr != NULL) { if (c_ptr != NULL) *c_ptr = '\0'; ! if (*val_ptr == '\0') { free(spec); fclose(fp); *************** *** 1771,1774 **** --- 2323,2363 ---- } + void ToggleShowWireSignalName() + { + showWireSignalName = !showWireSignalName; + sprintf(gszMsgBox, TgLoadString(showWireSignalName ? + STID_WILL_SHOW_WIRE_SIGNAL_NAME : STID_WILL_HIDE_WIRE_SIGNAL_NAME)); + Msg(gszMsgBox); + } + + int RefreshPortMenu(menu) + TgMenu *menu; + { + int ok=TRUE; + + /* Show Wire Signal Name */ + ok &= TgSetMenuItemCheckById(menu, CMDID_TOGGLESHOWWIRESIGNALNAME, + showWireSignalName); + + return ok; + } + + TgMenu *CreatePortMenu(parent_menu, x, y, menu_info, status_str_xlated) + TgMenu *parent_menu; + int x, y; + TgMenuInfo *menu_info; + int status_str_xlated; /* ignored, always 0 */ + { + TgMenu *menu=TgCreateMenuFromMenuInfo(parent_menu, x, y, menu_info, FALSE); + + if (menu != NULL) { + if (!RefreshPortMenu(menu)) { + return TgDestroyMenu(menu, TRUE); + } + menu->refresh_proc = ((RefreshMenuFunc*)RefreshPortMenu); + } + return menu; + } + void RefreshSpecialMenu(menu) TgMenu *menu; *************** *** 1791,1793 **** --- 2380,2398 ---- } return rc; + } + + void CleanUpSpecial() + { + } + + int InitSpecial() + { + char *c_ptr=NULL; + + showWireSignalName = TRUE; + if ((c_ptr=XGetDefault(mainDisplay,TOOL_NAME,"ShowWireSignalName")) != + NULL && UtilStrICmp(c_ptr, "false") == 0) { + showWireSignalName = FALSE; + } + return TRUE; } *** stretch.c.orig Fri Aug 4 14:04:25 2000 --- stretch.c Fri Aug 4 14:04:25 2000 *************** *** 2161,2166 **** static ! void ScaleAllSel(Corner, dxScale, dyScale) ! int Corner; double dxScale, dyScale; { --- 2161,2166 ---- static ! void ScaleAllSel(Corner, dxScale, dyScale, redraw) ! int Corner, redraw; double dxScale, dyScale; { *************** *** 2181,2197 **** ScaleAllSelObjects(Corner, dxScale, dyScale); UpdSelBBox(); ! if (poly_stretched) { ! ltx = min(ltx,min(selLtX,saved_ltx)); ! lty = min(lty,min(selLtY,saved_lty)); ! rbx = max(rbx,max(selRbX,saved_rbx)); ! rby = max(rby,max(selRbY,saved_rby)); ! RedrawAnArea(botObj, ltx-GRID_ABS_SIZE(1), lty-GRID_ABS_SIZE(1), ! rbx+GRID_ABS_SIZE(1), rby+GRID_ABS_SIZE(1)); ! } else { ! RedrawAreas(botObj, 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)); } EndCompositeCmd(); --- 2181,2199 ---- ScaleAllSelObjects(Corner, dxScale, dyScale); UpdSelBBox(); ! if (redraw) { ! if (poly_stretched) { ! ltx = min(ltx,min(selLtX,saved_ltx)); ! lty = min(lty,min(selLtY,saved_lty)); ! rbx = max(rbx,max(selRbX,saved_rbx)); ! rby = max(rby,max(selRbY,saved_rby)); ! RedrawAnArea(botObj, ltx-GRID_ABS_SIZE(1), lty-GRID_ABS_SIZE(1), ! rbx+GRID_ABS_SIZE(1), rby+GRID_ABS_SIZE(1)); ! } else { ! RedrawAreas(botObj, 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)); ! } } EndCompositeCmd(); *************** *** 2201,2209 **** RecordCmd(CMD_REPLACE, 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)); } } --- 2203,2213 ---- RecordCmd(CMD_REPLACE, NULL, topSel, botSel, numObjSelected); UpdSelBBox(); ! if (redraw) { ! 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)); ! } } } *************** *** 2272,2279 **** ppsz_names_to_resize = NeedToProcessOnResize(&num_to_resize); if (ppsz_names_to_resize == NULL) { ! ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0)); } else { StartCompositeCmd(); ! ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0)); DoOnResize(ppsz_names_to_resize, num_to_resize); EndCompositeCmd(); --- 2276,2283 ---- ppsz_names_to_resize = NeedToProcessOnResize(&num_to_resize); if (ppsz_names_to_resize == NULL) { ! ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0), TRUE); } else { StartCompositeCmd(); ! ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0), TRUE); DoOnResize(ppsz_names_to_resize, num_to_resize); EndCompositeCmd(); *************** *** 2372,2380 **** if (ppsz_names_to_resize == NULL) { stretchingEverything = TRUE; ! ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0)); stretchingEverything = FALSE; } else { stretchingEverything = TRUE; ! ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0)); stretchingEverything = FALSE; DoOnResize(ppsz_names_to_resize, num_to_resize); --- 2376,2386 ---- if (ppsz_names_to_resize == NULL) { stretchingEverything = TRUE; ! ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0), ! TRUE); stretchingEverything = FALSE; } else { stretchingEverything = TRUE; ! ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0), ! TRUE); stretchingEverything = FALSE; DoOnResize(ppsz_names_to_resize, num_to_resize); *************** *** 2404,2407 **** --- 2410,2487 ---- } + void ScaleObjLikeScaleEverything(obj_ptr, scale, redraw) + struct ObjRec *obj_ptr; + double scale; + int redraw; + { + int corner=CORNER_RB, saved_h_align=horiAlign, saved_v_align=vertAlign; + int saved_stretchable_text=stretchableText, saved_move_mode=moveMode; + float saved_print_mag=printMag; + struct BBRec obbox; + + obbox.ltx = obbox.lty = 0; + obbox.rbx = onePageWidth; obbox.rby = onePageHeight; + SetPivot(corner, &obbox); + + if (fabs(scale-((float)1.0)) < INT_TOL) { + return; + } + multX = multY = ((double)1)/scale; + + 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 = TRUE; + moveMode = UNCONST_MOVE; + + printMag /= multX; + if (UpdPageStyle(pageStyle)) { + UpdDrawWinBBox(); + AdjSplineVs(); + } + if (multX < 100.0) { + sprintf(gszMsgBox, TgLoadString(STID_REDUCE_BY_FACTOR), multX); + } else { + sprintf(gszMsgBox, TgLoadString(STID_ENLARGE_BY_FACTOR), multX); + } + SetStringStatus(gszMsgBox); + SaveStatusStrings(); + + AddObj(NULL, topObj, obj_ptr); + topSel = botSel = SelectThisObject(obj_ptr); + UpdSelBBox(); + + StartCompositeCmd(); + + stretchingEverything = TRUE; + ScaleAllSel(corner, (double)(multX*1000.0), (double)(multY*1000.0), redraw); + stretchingEverything = FALSE; + RemoveAllSel(); + + EndCompositeCmd(); + CleanUpCmds(); + + UnlinkObj(topObj); + + RestoreStatusStrings(); + SetFileModified(TRUE); + justDupped = FALSE; + + moveMode = saved_move_mode; + stretchableText = saved_stretchable_text; + horiAlign = saved_h_align; + vertAlign = saved_v_align; + printMag = saved_print_mag; + + if (UpdPageStyle(pageStyle)) { + UpdDrawWinBBox(); + AdjSplineVs(); + } + } + void SizeAllSelObj(AbsW, AbsH) int AbsW, AbsH; *************** *** 2431,2438 **** ppsz_names_to_resize = NeedToProcessOnResize(&num_to_resize); if (ppsz_names_to_resize == NULL) { ! ScaleAllSel(CORNER_RB, (double)(multX*1000.0), (double)(multY*1000.0)); } else { StartCompositeCmd(); ! ScaleAllSel(CORNER_RB, (double)(multX*1000.0), (double)(multY*1000.0)); DoOnResize(ppsz_names_to_resize, num_to_resize); EndCompositeCmd(); --- 2511,2520 ---- ppsz_names_to_resize = NeedToProcessOnResize(&num_to_resize); if (ppsz_names_to_resize == NULL) { ! ScaleAllSel(CORNER_RB, (double)(multX*1000.0), (double)(multY*1000.0), ! TRUE); } else { StartCompositeCmd(); ! ScaleAllSel(CORNER_RB, (double)(multX*1000.0), (double)(multY*1000.0), ! TRUE); DoOnResize(ppsz_names_to_resize, num_to_resize); EndCompositeCmd(); *************** *** 2557,2561 **** changeX = (fabs(multX-1.0) > 1.0e-6); changeY = (fabs(multY-1.0) > 1.0e-6); ! ScaleAllSel(CORNER_RB, (double)(multX*1000.0), (double)(multY*1000.0)); } else if (do_width) { SetPivot(CORNER_RIGHT, &obj_ptr->obbox); --- 2639,2644 ---- changeX = (fabs(multX-1.0) > 1.0e-6); changeY = (fabs(multY-1.0) > 1.0e-6); ! ScaleAllSel(CORNER_RB, (double)(multX*1000.0), (double)(multY*1000.0), ! TRUE); } else if (do_width) { SetPivot(CORNER_RIGHT, &obj_ptr->obbox); *************** *** 2562,2566 **** multX = (w == 0 ? ((double)1.0) : ((double)abs_w) / ((double)w)); changeX = (fabs(multX-1.0) > 1.0e-6); ! ScaleAllSel(CORNER_RIGHT, (double)(multX*1000.0), (double)1000); } else { SetPivot(CORNER_BOTTOM, &obj_ptr->obbox); --- 2645,2649 ---- multX = (w == 0 ? ((double)1.0) : ((double)abs_w) / ((double)w)); changeX = (fabs(multX-1.0) > 1.0e-6); ! ScaleAllSel(CORNER_RIGHT, (double)(multX*1000.0), (double)1000, TRUE); } else { SetPivot(CORNER_BOTTOM, &obj_ptr->obbox); *************** *** 2567,2571 **** multY = (h == 0 ? ((double)1.0) : ((double)abs_h) / ((double)h)); changeY = (fabs(multY-1.0) > 1.0e-6); ! ScaleAllSel(CORNER_BOTTOM, (double)1000, (double)(multY*1000.0)); } free(topSel); --- 2650,2654 ---- multY = (h == 0 ? ((double)1.0) : ((double)abs_h) / ((double)h)); changeY = (fabs(multY-1.0) > 1.0e-6); ! ScaleAllSel(CORNER_BOTTOM, (double)1000, (double)(multY*1000.0), TRUE); } free(topSel); *** strtbl.c.orig Fri Aug 4 14:04:26 2000 --- strtbl.c Fri Aug 4 14:04:26 2000 *************** *** 38,42 **** --- 38,44 ---- #include "choice.e" #include "msg.e" + #include "poly.e" #include "strtbl.e" + #include "special.e" #include "text.e" #include "util.e" *************** *** 475,478 **** --- 477,498 ---- /* CSTID_GET_NAMED_PROP_FROM_SEL_OBJ */ N_("Get the current '%s' property from the selected object"), + /* CSTID_START_AN_EDGE_FROM_A_PORT */ + N_("start an edge from a port"), + /* CSTID_ABORT */ + N_("abort"), + /* CSTID_START_A_WIRE_FROM_NAMED_PORT */ + N_("Start a wire from port '%s'... (Btn2 or Btn3 to abort)"), + /* CSTID_END_A_WIRE_AT_NAMED_PORT */ + N_("End the wire at port '%s'... (press to abort)"), + /* CSTID_SET_SIGNAME_FOR_NAMED_PORT */ + N_("Set signal name for port '%s'..."), + /* CSTID_CLK_ON_PORT_TO_RENAME_SIGNAME */ + N_("Please click on a port to rename its signal name..."), + /* CSTID_CLK_ON_PORT_TO_CLEAR_SIGNAME */ + N_("Please click on a port to clear its signal name..."), + /* CSTID_PORTNAME_TOO_LONG_SKIPPED */ + N_("Port/pin name '%s...' too long. It is skipped in net-list generation."), + /* CSTID_CLEAR_SIGNAME_FOR_NAMED_PORT */ + N_("Clear signal name for port '%s'..."), NULL }; *************** *** 3144,3150 **** --- 3164,3218 ---- /* STID_WONT_AUTO_GEN_PREVIEW_BITMAP */ N_("Will not auto-generate a preview bitmap when importing/embedding a PS/EPS file."), + /* STID_TMP_DIR_NOT_EXIST_USE_XDEF */ + N_("Temporary directory '%s' does not exist. Please fix the %s.%s X default."), + /* STID_INVALID_DIR_IN_X_DEFAULT */ + N_("Invalid directory '%s' specified by X default %s.%s."), + /* STID_RACE_IN_CREATE_TMP_FILE */ + N_("Race condition detected in creating the '%s' temporary file. Possible causes are network problems, security problems, etc. This file will be removed before proceeding."), + /* STID_INVALID_GEOM_USE_ALT_GEOM */ + N_("Invalid %s.%s: '%s', the geometry must be at last '%s', '%s' is used instead."), + /* STID_REDUCE_BY_FACTOR */ + N_("Reducing by a factor of %.2f..."), + /* STID_ENLARGE_BY_FACTOR */ + N_("Enlarging by a factor of %.2f..."), + /* STID_CREATE_THUMBNAIL_CAUSE_FLUSH */ + N_("Create Thumbnails will cause the undo buffer to be flushed."), + /* STID_CONNECT_PORTS_CANCEL_BY_USER */ + N_("Connect ports canceled by the user."), + /* STID_Q_CNFLCT_SIG_NAME_OKAY_TO_CLR */ + N_("Conflicting signal names '%s' (at '%s') and '%s' (at '%s').\n\nOkay to clear both signal names? [ync](y)"), + /* STID_PLS_ENT_SIG_NAME */ + N_("Please enter a signal name:"), + /* STID_SIGNAL_NAMES_CLEARED */ + N_("Signal names at '%s' and '%s' have been cleared."), + /* STID_PLACING_NAMED_SIGNAL */ + N_("Click to place signal name '%s'"), + /* STID_PLS_ENT_SIG_NAME_FOR_PORT */ + N_("Please enter a signal name for the '%s' port:"), NULL }; + static char *gaszEnglishStrTable1300[] = { + /* STID_NO_CUR_FILE_CANNOT_GEN_NETLST */ + N_("No current file.\n\nCannot generate a net list."), + /* STID_NO_SIGNAME_FOUND_EMPTY_NETLST */ + N_("No signal name found.\n\nNet list not generated."), + /* STID_WILL_EXPORT_NETLIST_FILE */ + N_("Will export net-list file."), + /* STID_Q_OK_TO_CUT_INTO_SEGMENTS */ + N_("Okay to cut selected polyline/polygon objects into segments? [ync](y)\n\n(If you would like to cut at a specific vertex of the polyline/polygon, please use the vertex mode.)"), + /* STID_NO_POLY_OBJ_SELECTED */ + N_("No polyline/polygon object selected."), + /* STID_WILL_SHOW_WIRE_SIGNAL_NAME */ + N_("Will show (and place) wire signal name when connecting ports."), + /* STID_WILL_HIDE_WIRE_SIGNAL_NAME */ + N_("Will hide wire signal name when connecting ports."), + /* STID_TRY_AGAIN_AND_CLICK_IN_A_PORT */ + N_("Please try again and click in a port."), + /* STID_TRY_AGAIN_AND_END_IN_A_PORT */ + N_("The last vertex did not end in a port, please try again."), + NULL + }; + char *TgLoadString(nID) int nID; *************** *** 3157,3188 **** { if (nID >= MINNONCACHEDSTIDS && nID < MAXNONCACHEDSTIDS) { ! int index=nID-MINNONCACHEDSTIDS; ! if (index < 100) { ! return _(gaszEnglishStrTable[index]); ! } else if (index < 200) { ! return _(gaszEnglishStrTable100[index-100]); ! } else if (index < 300) { ! return _(gaszEnglishStrTable200[index-200]); ! } else if (index < 400) { ! return _(gaszEnglishStrTable300[index-300]); ! } else if (index < 500) { ! return _(gaszEnglishStrTable400[index-400]); ! } else if (index < 600) { ! return _(gaszEnglishStrTable500[index-500]); ! } else if (index < 700) { ! return _(gaszEnglishStrTable600[index-600]); ! } else if (index < 800) { ! return _(gaszEnglishStrTable700[index-700]); ! } else if (index < 900) { ! return _(gaszEnglishStrTable800[index-800]); ! } else if (index < 1000) { ! return _(gaszEnglishStrTable900[index-900]); ! } else if (index < 1100) { ! return _(gaszEnglishStrTable1000[index-1000]); ! } else if (index < 1200) { ! return _(gaszEnglishStrTable1100[index-1100]); ! } else { ! return _(gaszEnglishStrTable1200[index-1200]); } } --- 3225,3246 ---- { if (nID >= MINNONCACHEDSTIDS && nID < MAXNONCACHEDSTIDS) { ! int index=(nID-MINNONCACHEDSTIDS); ! int which=(int)(index/100); ! switch (which) { ! case 0: return _(gaszEnglishStrTable[index]); ! case 1: return _(gaszEnglishStrTable100[index-100]); ! case 2: return _(gaszEnglishStrTable200[index-200]); ! case 3: return _(gaszEnglishStrTable300[index-300]); ! case 4: return _(gaszEnglishStrTable400[index-400]); ! case 5: return _(gaszEnglishStrTable500[index-500]); ! case 6: return _(gaszEnglishStrTable600[index-600]); ! case 7: return _(gaszEnglishStrTable700[index-700]); ! case 8: return _(gaszEnglishStrTable800[index-800]); ! case 9: return _(gaszEnglishStrTable900[index-900]); ! case 10: return _(gaszEnglishStrTable1000[index-1000]); ! case 11: return _(gaszEnglishStrTable1100[index-1100]); ! case 12: return _(gaszEnglishStrTable1200[index-1200]); ! default: return _(gaszEnglishStrTable1300[index-1300]); } } *************** *** 3449,3456 **** if (choiceMouseStatus[choice].m == NULL) FailAllocMessage(); } ! if (cur_text_under_mouse && (state & ControlMask) == ControlMask) { if (obj_under_mouse == NULL) { /* if obj_under_mouse is NULL, we are at the boundary of curTextObj */ ! SetMouseStatus(TgLoadCachedString(CSTID_MOVE_EDIT_TEXT_BOX), TgLoadCachedString(CSTID_MOVE_EDIT_TEXT_BOX), TgLoadCachedString(CSTID_CONTEXT_MENU)); --- 3507,3530 ---- if (choiceMouseStatus[choice].m == NULL) FailAllocMessage(); } ! if (choice == DRAWPOLY && connectingPortsByWire) { ! if (gstWiringInfo.num_ports_to_connect == 99) { ! /* rename signal_name */ ! SetMouseStatus(TgLoadCachedString(CSTID_CLK_ON_PORT_TO_RENAME_SIGNAME), ! TgLoadCachedString(CSTID_ABORT), ! TgLoadCachedString(CSTID_ABORT)); ! } else if (gstWiringInfo.num_ports_to_connect == 999) { ! /* clear signal_name */ ! SetMouseStatus(TgLoadCachedString(CSTID_CLK_ON_PORT_TO_CLEAR_SIGNAME), ! TgLoadCachedString(CSTID_ABORT), ! TgLoadCachedString(CSTID_ABORT)); ! } else { ! SetMouseStatus(TgLoadCachedString(CSTID_START_AN_EDGE_FROM_A_PORT), ! TgLoadCachedString(CSTID_ABORT), ! TgLoadCachedString(CSTID_ABORT)); ! } ! } else if (cur_text_under_mouse && (state & ControlMask) == ControlMask) { if (obj_under_mouse == NULL) { /* if obj_under_mouse is NULL, we are at the boundary of curTextObj */ ! SetMouseStatus(TgLoadCachedString(CSTID_START_AN_EDGE_FROM_A_PORT), TgLoadCachedString(CSTID_MOVE_EDIT_TEXT_BOX), TgLoadCachedString(CSTID_CONTEXT_MENU)); *************** *** 3828,3831 **** --- 3902,3906 ---- { N_("Set printing mode to generate PNG files"), NULL, NULL }, { N_("Set printing mode to generate JPEG files"), NULL, NULL }, + { N_("Set printing mode to generate NetList files"), NULL, NULL }, { N_("Set printing mode to generate %s files"), NULL, NULL }, { NULL, NULL, NULL } *** text.c.orig Fri Aug 4 14:04:27 2000 --- text.c Fri Aug 4 14:04:27 2000 *************** *** 6436,6439 **** --- 6436,6444 ---- EndChangeCurText(FALSE); } + if (editTextSize != 0) { + if (RestoreEditTextSize(curTextObj, TRUE)) { + UpdTextBBox(curTextObj); + } + } SplitCurStrBlock(); *************** *** 6480,6483 **** --- 6485,6493 ---- curStrBlock->owner_mini_line->last_block = pLastStrBlock; } + if (editTextSize != 0) { + if (RestoreEditTextSize(curTextObj, FALSE)) { + UpdTextBBox(curTextObj); + } + } EndChangeCurText(TRUE); MarkRulers(textCurX, textCurY); *************** *** 6568,6578 **** 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, --- 6578,6582 ---- while (XCheckMaskEvent(mainDisplay, PointerMotionMask, &ev)) ; } else if (input.type == KeyPress) { ! if (KeyPressEventIsEscape(&input.xkey)) { XUngrabPointer(mainDisplay, CurrentTime); SelBox(drawWindow, revDefaultGC, bbox.ltx+dx, bbox.lty+dy, *** tgif.c.orig Fri Aug 4 14:04:29 2000 --- tgif.c Fri Aug 4 14:04:29 2000 *************** *** 351,354 **** --- 351,355 ---- UrlDump(inbuf); } else if (cmdLineDosEpsFilter) { + UtilStrCpyN(cmdLineOpenFile, sizeof(cmdLineOpenFile), inbuf); DosEpsFilter(inbuf); } else { *************** *** 384,387 **** --- 385,389 ---- break; } else if (cmdLineDosEpsFilter) { + UtilStrCpyN(cmdLineOpenFile, sizeof(cmdLineOpenFile), *argv); DosEpsFilter(*argv); if (argc > 1) { *** wb.c.orig Fri Aug 4 14:04:30 2000 --- wb.c Fri Aug 4 14:04:30 2000 *************** *** 150,156 **** gstWBInfo.listening = TRUE; ! sprintf(gstWBInfo.listen_fname, "%sTgifLXXXXXX", TMP_DIR); ! mktemp(gstWBInfo.listen_fname); ! unlink(gstWBInfo.listen_fname); if ((gstWBInfo.listen_fp=fopen(gstWBInfo.listen_fname, "w+")) == NULL) { fprintf(stderr, "Fail to create '%s' for deserialization.\n", --- 150,155 ---- gstWBInfo.listening = TRUE; ! MkTempFile(gstWBInfo.listen_fname, sizeof(gstWBInfo.listen_fname), tmpDir, ! TOOL_NAME); if ((gstWBInfo.listen_fp=fopen(gstWBInfo.listen_fname, "w+")) == NULL) { fprintf(stderr, "Fail to create '%s' for deserialization.\n", *************** *** 1335,1341 **** /* fim do trecho */ ! sprintf(gstWBInfo.send_fname, "%sTgifSXXXXXX", TMP_DIR); ! mktemp(gstWBInfo.send_fname); ! unlink(gstWBInfo.send_fname); if ((gstWBInfo.send_fp=fopen(gstWBInfo.send_fname, "w+")) == NULL) { fprintf(stderr, "Fail to create '%s' for serialization.\n", --- 1334,1339 ---- /* fim do trecho */ ! MkTempFile(gstWBInfo.send_fname, sizeof(gstWBInfo.send_fname), tmpDir, ! TOOL_NAME); if ((gstWBInfo.send_fp=fopen(gstWBInfo.send_fname, "w+")) == NULL) { fprintf(stderr, "Fail to create '%s' for serialization.\n", *************** *** 1344,1348 **** } /* Creation of multicast socket */ ! sprintf(logfile, "%snome.txt", TMP_DIR); PCM_initialize(logfile); PCM_setoption(SM_INTERVAL,3); --- 1342,1346 ---- } /* Creation of multicast socket */ ! sprintf(logfile, "%snome.txt", tmpDir); PCM_initialize(logfile); PCM_setoption(SM_INTERVAL,3); *** xbitmap.c.orig Fri Aug 4 14:04:31 2000 --- xbitmap.c Fri Aug 4 14:04:31 2000 *************** *** 1335,1338 **** --- 1335,1354 ---- case OBJ_XBM: UpdateColorsLookupTable(ObjPtr->color); + if (ObjPtr->type == OBJ_XBM) { + if (ObjPtr->detail.xbm->real_type==XBM_EPS && + ObjPtr->detail.xbm->bitmap==None) { + char color_str[COLORSTRLEN]; + + new_alloc = FALSE; + GetDrawingFgColorStr(INVALID, INVALID, color_str, + sizeof(color_str)); + color_index = QuickFindColorIndex(NULL, color_str, &new_alloc, + FALSE); + if (color_index != INVALID) { + if (new_alloc) ExpandTmpStorage(); + UpdateColorsLookupTable(color_index); + } + } + } break; *************** *** 1601,1605 **** } ! for (i = 0; i < maxColors; i++) colorIndexToDumpIndex[i] = INVALID; pixelValue[0] = GetDrawingBgPixel(INVALID, INVALID); --- 1617,1621 ---- } ! for (i = 0; i < maxColors+3; i++) colorIndexToDumpIndex[i] = INVALID; pixelValue[0] = GetDrawingBgPixel(INVALID, INVALID); *************** *** 2907,2913 **** if (nInImageProc) { *gszImageProcXPmFile = '\0'; ! sprintf(xbm_file_name, "%sTgifXXXXXX", TMP_DIR); ! mktemp(xbm_file_name); ! unlink(xbm_file_name); strcpy(name, "unnamed"); if ((short_name=IsPrefix(bootDir, xbm_file_name, &rest))) ++rest; --- 2923,2927 ---- if (nInImageProc) { *gszImageProcXPmFile = '\0'; ! MkTempFile(xbm_file_name, sizeof(xbm_file_name), tmpDir, TOOL_NAME); strcpy(name, "unnamed"); if ((short_name=IsPrefix(bootDir, xbm_file_name, &rest))) ++rest; *************** *** 3504,3508 **** for (i = 0; i < maxColors+3; i++) colorStr[i] = NULL; ! for (i = 0; i < maxColors; i++) colorIndexToDumpIndex[i] = INVALID; pixelValue[0] = GetDrawingBgPixel(INVALID, INVALID); --- 3518,3522 ---- for (i = 0; i < maxColors+3; i++) colorStr[i] = NULL; ! for (i = 0; i < maxColors+3; i++) colorIndexToDumpIndex[i] = INVALID; pixelValue[0] = GetDrawingBgPixel(INVALID, INVALID); *************** *** 5107,5111 **** if (MyReadEPSFile(xbm_ptr->filename, &image_w, &image_h, &(xbm_ptr->bitmap), &(xbm_ptr->image), ! &(xbm_ptr->num_epsf_lines), &(xbm_ptr->epsflines), &(xbm_ptr->epsf_level), &file_llx, &file_lly, &file_urx, &file_ury, xbm_ptr->write_date) != BitmapSuccess) { --- 5121,5126 ---- if (MyReadEPSFile(xbm_ptr->filename, &image_w, &image_h, &(xbm_ptr->bitmap), &(xbm_ptr->image), ! (save_epsf ? &(xbm_ptr->num_epsf_lines) : NULL), ! (save_epsf ? &(xbm_ptr->epsflines) : NULL), &(xbm_ptr->epsf_level), &file_llx, &file_lly, &file_urx, &file_ury, xbm_ptr->write_date) != BitmapSuccess) { *** xpixmap.c.orig Fri Aug 4 14:04:32 2000 --- xpixmap.c Fri Aug 4 14:04:32 2000 *************** *** 69,73 **** struct BucketRec { int pixel, index; ! char s[10]; }; --- 69,73 ---- struct BucketRec { int pixel, index; ! char s[40]; }; *** xprtfltr.c.orig Fri Aug 4 14:04:33 2000 --- xprtfltr.c Fri Aug 4 14:04:33 2000 *************** *** 46,49 **** --- 46,50 ---- #include "obj.e" #include "page.e" + #include "ps.e" #include "raster.e" #include "setup.e" *************** *** 347,351 **** static char *gpszColorExportName[MAXDEFWHERETOPRINT] = { "Printer", "EPS", "PS", "XPM", "ASCII", "EPSI", "GIF/ISMAP", "HTML/USEMAP", ! "PDF", "TiffEPSI", "PNG", "JPEG" }; --- 348,352 ---- static char *gpszColorExportName[MAXDEFWHERETOPRINT] = { "Printer", "EPS", "PS", "XPM", "ASCII", "EPSI", "GIF/ISMAP", "HTML/USEMAP", ! "PDF", "TiffEPSI", "PNG", "JPEG", "NetList" }; *************** *** 352,356 **** static char *gpszBWExportName[MAXDEFWHERETOPRINT] = { "Printer", "EPS", "PS", "XBM", "ASCII", "EPSI", "GIF/ISMAP", "HTML/USEMAP", ! "PDF", "TiffEPSI", "PNG", "JPEG" }; --- 353,357 ---- static char *gpszBWExportName[MAXDEFWHERETOPRINT] = { "Printer", "EPS", "PS", "XBM", "ASCII", "EPSI", "GIF/ISMAP", "HTML/USEMAP", ! "PDF", "TiffEPSI", "PNG", "JPEG", "NetList" }; *************** *** 357,361 **** static char *gpszColorExportExt[MAXDEFWHERETOPRINT] = { NULL, EPSF_FILE_EXT, PS_FILE_EXT, XPM_FILE_EXT, TEXT_FILE_EXT, ! EPSF_FILE_EXT, "gif", "html", "pdf", EPSF_FILE_EXT, "png", "jpg" }; --- 358,363 ---- static char *gpszColorExportExt[MAXDEFWHERETOPRINT] = { NULL, EPSF_FILE_EXT, PS_FILE_EXT, XPM_FILE_EXT, TEXT_FILE_EXT, ! EPSF_FILE_EXT, "gif", "html", "pdf", EPSF_FILE_EXT, "png", "jpg", ! NETLIST_FILE_EXT }; *************** *** 362,366 **** static char *gpszBWExportExt[MAXDEFWHERETOPRINT] = { NULL, EPSF_FILE_EXT, PS_FILE_EXT, XBM_FILE_EXT, TEXT_FILE_EXT, ! EPSF_FILE_EXT, "gif", "html", "pdf", EPSF_FILE_EXT, "png", "jpg" }; --- 364,369 ---- static char *gpszBWExportExt[MAXDEFWHERETOPRINT] = { NULL, EPSF_FILE_EXT, PS_FILE_EXT, XBM_FILE_EXT, TEXT_FILE_EXT, ! EPSF_FILE_EXT, "gif", "html", "pdf", EPSF_FILE_EXT, "png", "jpg", ! NETLIST_FILE_EXT }; *************** *** 385,389 **** if (nWhereToPrint < MAXDEFWHERETOPRINT) { ! if (colorDump) { return gpszColorExportName[nWhereToPrint]; } else { --- 388,395 ---- if (nWhereToPrint < MAXDEFWHERETOPRINT) { ! if (nWhereToPrint == NETLIST_FILE && preDumpSetup) { ! /* do not translate -- program constants */ ! return "Component"; ! } else if (colorDump) { return gpszColorExportName[nWhereToPrint]; } else { *************** *** 412,416 **** if (nWhereToPrint < MAXDEFWHERETOPRINT) { ! if (colorDump) { return gpszColorExportExt[nWhereToPrint]; } else { --- 418,424 ---- if (nWhereToPrint < MAXDEFWHERETOPRINT) { ! if (nWhereToPrint == NETLIST_FILE && preDumpSetup) { ! return COMP_FILE_EXT; ! } else if (colorDump) { return gpszColorExportExt[nWhereToPrint]; } else { *** attr.e.orig Fri Aug 4 14:04:34 2000 --- attr.e Fri Aug 4 14:04:34 2000 *************** *** 90,93 **** --- 90,94 ---- extern void AddFileAttrs ARGS_DECL((void)); extern void DetachFileAttrs ARGS_DECL((void)); + extern int BlankStr ARGS_DECL((char*)); extern void EditFileAttrs ARGS_DECL((void)); extern void EditAttrs ARGS_DECL((void)); *** color.e.orig Fri Aug 4 14:04:34 2000 --- color.e Fri Aug 4 14:04:35 2000 *************** *** 76,79 **** --- 76,81 ---- extern int GetDrawingBgPixel ARGS_DECL((int index, int pixel)); extern int GetDrawingFgPixel ARGS_DECL((int index, int pixel)); + extern void GetDrawingFgColorStr ARGS_DECL((int index, int pixel, + char *color_buf, int buf_sz)); extern int TgifParseColor ARGS_DECL((char*, XColor*)); extern void RecalcXorPixels ARGS_DECL((void)); *** cursor.e.orig Fri Aug 4 14:04:35 2000 --- cursor.e Fri Aug 4 14:04:35 2000 *************** *** 75,78 **** --- 75,79 ---- extern void SetFloodFillCursor ARGS_DECL((Window)); extern void SetDripCursor ARGS_DECL((Window)); + extern void SetHandCursor ARGS_DECL((Window)); extern void SetDefaultCursor ARGS_DECL((Window)); extern void ShowCursor ARGS_DECL((void)); *** cutpaste.e.orig Fri Aug 4 14:04:36 2000 --- cutpaste.e Fri Aug 4 14:04:36 2000 *************** *** 51,55 **** extern int CopyPlainTextAsObject ARGS_DECL((void)); extern void CutToCutBuffer ARGS_DECL((void)); ! extern void PasteString ARGS_DECL((char *)); extern void AssignNewObjIds ARGS_DECL((struct ObjRec *)); extern char * FetchCutBuffer ARGS_DECL((int *)); --- 51,55 ---- extern int CopyPlainTextAsObject ARGS_DECL((void)); extern void CutToCutBuffer ARGS_DECL((void)); ! extern void PasteString ARGS_DECL((char*, int highlight, int record_cmd)); extern void AssignNewObjIds ARGS_DECL((struct ObjRec *)); extern char * FetchCutBuffer ARGS_DECL((int *)); *** drawing.e.orig Fri Aug 4 14:04:36 2000 --- drawing.e Fri Aug 4 14:04:37 2000 *************** *** 65,69 **** extern void RedrawDummyWindow1 ARGS_DECL((void)); extern void RedrawDummyWindow2 ARGS_DECL((void)); ! extern void DummiesEventHandler ARGS_DECL((XEvent *)); extern int ESCPressed ARGS_DECL((void)); extern int CheckInterrupt ARGS_DECL((int check_esc)); --- 65,70 ---- extern void RedrawDummyWindow1 ARGS_DECL((void)); extern void RedrawDummyWindow2 ARGS_DECL((void)); ! extern void DummiesEventHandler ARGS_DECL((XEvent*)); ! extern int KeyPressEventIsEscape ARGS_DECL((XKeyEvent*)); extern int ESCPressed ARGS_DECL((void)); extern int CheckInterrupt ARGS_DECL((int check_esc)); *************** *** 115,118 **** --- 116,122 ---- int status_str_xlated)); extern int ContextMenu ARGS_DECL((int X, int Y, int TrackMenubar)); + extern void HandleMotionForPortInDrawWindow ARGS_DECL((int mouse_x, + int mouse_y)); + extern int HandlePressForPortInDrawWindow ARGS_DECL((int cancel)); extern int DrawingEventHandler ARGS_DECL((XEvent *)); *** exec.e.orig Fri Aug 4 14:04:37 2000 --- exec.e Fri Aug 4 14:04:37 2000 *************** *** 49,52 **** --- 49,61 ---- extern struct StrRec * botTmpStr; + typedef struct tagReplAttrValueCallbackInfo { + struct ObjRec *obj_ptr; /* a top level object */ + struct AttrRec *attr_ptr; + char *new_attr_value; + void *pv_userdata; + } ReplAttrValueCallbackInfo; + + typedef int (ReplAttrValueCallback)ARGS_DECL((ReplAttrValueCallbackInfo*)); + #ifdef _INCLUDE_FROM_EXEC_C_ #undef extern *************** *** 70,73 **** --- 79,84 ---- AbortCallbackFunc*, void*)); extern int DoLaunch ARGS_DECL((struct AttrRec *, struct ObjRec *)); + extern void SetReplaceAttrValueCallback ARGS_DECL((ReplAttrValueCallback*, + void *pv_userdata)); extern int ReplaceAttrFirstValue ARGS_DECL((struct ObjRec *, struct AttrRec *, char *)); *** file.e.orig Fri Aug 4 14:04:38 2000 --- file.e Fri Aug 4 14:04:38 2000 *************** *** 139,145 **** --- 139,148 ---- #endif /*_INCLUDE_FROM_FILE_C_*/ + extern char * MkTempFile ARGS_DECL((char *buf, int buf_sz, char *psz_dir, + char *psz_prefix)); extern int IsFiletUnSavable ARGS_DECL((void)); extern void SetUnSavableFile ARGS_DECL((int unsavable)); extern void UpdateDocumentFonts ARGS_DECL((char*)); + extern void UpdatePropagatedEPSInfo ARGS_DECL((char *line, int *status)); extern void SetCmdLineDontCondense ARGS_DECL((void)); extern void SetCmdLineCondensedPS ARGS_DECL((void)); *************** *** 176,180 **** 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)); --- 179,184 ---- char *final_url, int cb_final_url)); ! extern int ImportGivenFile ARGS_DECL((char*, int group_and_lock, ! int highlight)); extern void ImportFile ARGS_DECL((void)); extern int ClearBgColorInfo ARGS_DECL((int nRedraw)); *** imgproc.e.orig Fri Aug 4 14:04:38 2000 --- imgproc.e Fri Aug 4 14:04:38 2000 *************** *** 52,55 **** --- 52,56 ---- XImage *bitmap_image, int W, int H)); extern FILE *GetImageProcOutputFileName ARGS_DECL((char *pszPath, + int path_buf_sz, int *pnShortName, char **ppszRest)); *** import.e.orig Fri Aug 4 14:04:39 2000 --- import.e Fri Aug 4 14:04:39 2000 *************** *** 49,58 **** extern void ImportXPixmapFile ARGS_DECL((void)); extern void ImportEPSFile ARGS_DECL((int Embed)); ! extern int ConvertGifToXpm ARGS_DECL((char *pszGifPath, char *pszXpmPath)); extern void ImportGIFFile ARGS_DECL((void)); ! extern int ConvertPngToXpm ARGS_DECL((char *pszPngPath, char *pszXpmPath)); extern void ImportPNGFile ARGS_DECL((void)); ! extern int ConvertJpegToXpm ARGS_DECL((char *pszJpegPath, ! char *pszXpmPath)); extern void ImportJPEGFile ARGS_DECL((void)); extern DspList *ImportFilterListing ARGS_DECL((int *pnEntries)); --- 49,60 ---- extern void ImportXPixmapFile ARGS_DECL((void)); extern void ImportEPSFile ARGS_DECL((int Embed)); ! extern int ConvertGifToXpm ARGS_DECL((char *pszGifPath, char *pszXpmPath, ! int xpm_path_sz)); extern void ImportGIFFile ARGS_DECL((void)); ! extern int ConvertPngToXpm ARGS_DECL((char *pszPngPath, char *pszXpmPath, ! int xpm_path_sz)); extern void ImportPNGFile ARGS_DECL((void)); ! extern int ConvertJpegToXpm ARGS_DECL((char *pszJpegPath, char *pszXpmPath, ! int xpm_path_sz)); extern void ImportJPEGFile ARGS_DECL((void)); extern DspList *ImportFilterListing ARGS_DECL((int *pnEntries)); *************** *** 62,67 **** char *psz_filter)); extern int ConvertOtherToXpm ARGS_DECL((char *pszFile, char *pszFormat, ! char *pszXpmPath)); extern void ImportGIFToXPixmapDeck ARGS_DECL((void)); extern void BrowseXBitmap ARGS_DECL((void)); extern void BrowseXPixmap ARGS_DECL((void)); --- 64,71 ---- char *psz_filter)); extern int ConvertOtherToXpm ARGS_DECL((char *pszFile, char *pszFormat, ! char *pszXpmPath, ! int xpm_path_sz)); extern void ImportGIFToXPixmapDeck ARGS_DECL((void)); + extern void CreateThumbnails ARGS_DECL((void)); extern void BrowseXBitmap ARGS_DECL((void)); extern void BrowseXPixmap ARGS_DECL((void)); *** mainmenu.e.orig Fri Aug 4 14:04:40 2000 --- mainmenu.e Fri Aug 4 14:04:40 2000 *************** *** 65,68 **** --- 65,69 ---- extern void UpdatePinnedMenu ARGS_DECL((int Index)); extern void UpdateAllPinnedMenus ARGS_DECL((void)); + extern void UseWireMenuItemInModeItem ARGS_DECL((int connecting)); extern void DestroyPinnedMenu ARGS_DECL((int Index)); extern void HidePopupMenusForSlideShow ARGS_DECL((void)); *** miniline.e.orig Fri Aug 4 14:04:40 2000 --- miniline.e Fri Aug 4 14:04:40 2000 *************** *** 229,233 **** int *pn_style, int *pn_sz_unit, ! int *pn_color)); extern int CanCopyHighLightedTextAsStrings ARGS_DECL((void)); extern void GatherHighLightedTextAsStrings ARGS_DECL((char **ppsz_buf, --- 229,234 ---- int *pn_style, int *pn_sz_unit, ! int *pn_color, ! int *pn_underline_on)); extern int CanCopyHighLightedTextAsStrings ARGS_DECL((void)); extern void GatherHighLightedTextAsStrings ARGS_DECL((char **ppsz_buf, *** pattern.e.orig Fri Aug 4 14:04:41 2000 --- pattern.e Fri Aug 4 14:04:41 2000 *************** *** 112,120 **** extern void ChangeAllSelRCBRadius ARGS_DECL((int Radius)); extern void UpdateSelObjs ARGS_DECL((void)); ! extern void ChangeAllSelRealLineWidth ARGS_DECL((int nMask, int Width, int AW, int AH, char*, char*, char*, int HighLight)); ! extern void SetSelLineWidth ARGS_DECL((char*)); #ifdef _INCLUDE_FROM_PATTERN_C_ --- 112,120 ---- extern void ChangeAllSelRCBRadius ARGS_DECL((int Radius)); extern void UpdateSelObjs ARGS_DECL((void)); ! extern void ChangeAllSelRealLineWidth ARGS_DECL((int nMask, int Width, int AW, int AH, char*, char*, char*, int HighLight)); ! extern void SetSelLineWidth ARGS_DECL((char*)); #ifdef _INCLUDE_FROM_PATTERN_C_ *** pin.e.orig Fri Aug 4 14:04:42 2000 --- pin.e Fri Aug 4 14:04:42 2000 *************** *** 35,38 **** --- 35,40 ---- #define _PIN_E_ + extern int drawPolyToConnectPins; + extern struct ObjRec *gpStartPin, *gpEndPin; *** poly.e.orig Fri Aug 4 14:04:42 2000 --- poly.e Fri Aug 4 14:04:42 2000 *************** *** 35,38 **** --- 35,50 ---- #define _POLY_E_ + typedef struct tagWiringInfo { + int num_ports_to_connect; /* this used to be drawPolyToEndInANode */ + + struct ObjRec *first_port_obj, *first_port_owner_obj; + char first_port_name[MAXSTRING]; /* this used to be drawPolyFirstNodeName */ + + struct ObjRec *last_port_obj, *last_port_owner_obj; + char last_port_name[MAXSTRING]; /* this used to be drawPolyLastNodeName */ + } WiringInfo; + + extern WiringInfo gstWiringInfo; + extern int polyDrawn; extern int queryPolyNameOnConnect; *************** *** 50,58 **** extern char **curArrowHeadWSpec; - extern int drawPolyToEndInANode; - extern char drawPolyFirstNodeName[]; - extern char drawPolyLastNodeName[]; - extern int drawPolyToConnectPins; - extern int numPtsInPoly; --- 62,65 ---- *************** *** 74,77 **** --- 81,88 ---- extern void AddPtToCreatePoly ARGS_DECL((int AbsX, int AbsY)); extern void DrawPoly ARGS_DECL((XEvent *)); + extern void SetWiringNodeInfo ARGS_DECL((struct ObjRec *port_obj, + struct ObjRec *port_owner_obj, + char *port_name, int first)); + extern void ResetWiringNodeInfo ARGS_DECL((void)); extern void InputPolyPts ARGS_DECL((void)); extern void JoinPoly ARGS_DECL((void)); *************** *** 101,104 **** --- 112,116 ---- struct PropertiesRec *pProp)); extern void FreePolyObj ARGS_DECL((struct ObjRec *)); + extern void InitPoly ARGS_DECL((void)); #ifdef _INCLUDE_FROM_POLY_C_ *** raster.e.orig Fri Aug 4 14:04:44 2000 --- raster.e Fri Aug 4 14:04:44 2000 *************** *** 83,86 **** --- 83,87 ---- extern Pixmap shortDashPixmap[]; + extern Pixmap wireBitmap; extern Pixmap runBitmap; extern Pixmap checkBitmap; *** select.e.orig Fri Aug 4 14:04:44 2000 --- select.e Fri Aug 4 14:04:44 2000 *************** *** 57,61 **** extern void CalcVertexBBox ARGS_DECL((int *LtX, int *LtY, int *RbX, int *RbY)); ! extern void UnSelNonVertexObjs ARGS_DECL((int HighLight)); extern void FreeTopSel ARGS_DECL((void)); extern void JustFreeSel ARGS_DECL((struct SelRec *pTopSel, --- 57,62 ---- extern void CalcVertexBBox ARGS_DECL((int *LtX, int *LtY, int *RbX, int *RbY)); ! extern void UnSelNonVertexObjs ARGS_DECL((int HighLight, ! int NoLockedObjOnly)); extern void FreeTopSel ARGS_DECL((void)); extern void JustFreeSel ARGS_DECL((struct SelRec *pTopSel, *************** *** 77,80 **** --- 78,83 ---- extern void JustRemoveAllVSel ARGS_DECL((void)); extern void RemoveAllSel ARGS_DECL((void)); + extern struct AttrRec * FindObjAttrWithName ARGS_DECL((struct ObjRec *ObjPtr, + char *AttrName)); extern struct ObjRec * FindAnObj ARGS_DECL((int XOff, int YOff, struct ObjRec **OwnerObj, *************** *** 105,109 **** extern void DelAllSelObj ARGS_DECL((void)); extern void GroupSingleObj ARGS_DECL((int ForcePromoteAttrs)); ! extern void GroupSelObj ARGS_DECL((int highlight, int record_cmd)); extern void SelectTopObj ARGS_DECL((void)); --- 108,113 ---- extern void DelAllSelObj ARGS_DECL((void)); extern void GroupSingleObj ARGS_DECL((int ForcePromoteAttrs)); ! extern void GroupSelObj ARGS_DECL((int highlight, int record_cmd, ! int redraw)); extern void SelectTopObj ARGS_DECL((void)); *** setup.e.orig Fri Aug 4 14:04:45 2000 --- setup.e Fri Aug 4 14:04:45 2000 *************** *** 139,142 **** --- 139,143 ---- extern char homeDir[]; extern char tgifDir[]; + extern char tmpDir[]; extern int symPathNumEntries; *** special.e.orig Fri Aug 4 14:04:46 2000 --- special.e Fri Aug 4 14:04:46 2000 *************** *** 36,39 **** --- 36,41 ---- extern int placingTopObj; + extern int connectingPortsByWire; + extern int connectingPortsFromInternalCommand; #ifdef _INCLUDE_FROM_SPECIAL_C_ *************** *** 48,51 **** --- 50,57 ---- extern unsigned int PlaceTopObj ARGS_DECL((struct ObjRec *)); extern void Instantiate ARGS_DECL((void)); + extern int ObjIsAPort ARGS_DECL((struct ObjRec *)); + extern void ConnectTwoPortsByAWire ARGS_DECL((void)); + extern void RenameSignalNameForAPort ARGS_DECL((void)); + extern void ClearSignalNameForAPort ARGS_DECL((void)); extern void MakeSymbolic ARGS_DECL((void)); extern void UnMakeSymbolic ARGS_DECL((void)); *************** *** 56,61 **** --- 62,73 ---- extern void MergeWithTable ARGS_DECL((void)); extern void ExportToTable ARGS_DECL((void)); + extern void ToggleShowWireSignalName ARGS_DECL((void)); + extern int RefreshPortMenu ARGS_DECL((TgMenu*)); + extern TgMenu *CreatePortMenu ARGS_DECL((TgMenu*, int X, int Y, TgMenuInfo*, + int status_str_xlated)); extern void RefreshSpecialMenu ARGS_DECL((TgMenu*)); extern int SpecialMenu ARGS_DECL((int X, int Y, int TrackMenubar)); + extern void CleanUpSpecial ARGS_DECL((void)); + extern int InitSpecial ARGS_DECL((void)); #ifdef _INCLUDE_FROM_SPECIAL_C_ *** stretch.e.orig Fri Aug 4 14:04:46 2000 --- stretch.e Fri Aug 4 14:04:46 2000 *************** *** 63,66 **** --- 63,69 ---- extern void ScaleAllSelObj ARGS_DECL((void)); extern void PreciseScaleEverything ARGS_DECL((void)); + extern void ScaleObjLikeScaleEverything ARGS_DECL((struct ObjRec *, + double Scale, + int Redraw)); extern void SizeAllSelObj ARGS_DECL((int AbsW, int AbsH)); extern void SizeAnObj ARGS_DECL((struct ObjRec *ObjPtr, *** strtbl.e.orig Fri Aug 4 14:04:47 2000 --- strtbl.e Fri Aug 4 14:04:47 2000 *************** *** 257,262 **** #define CSTID_EDIT_ATTR_IN_EDITOR 309 #define CSTID_GET_NAMED_PROP_FROM_SEL_OBJ 310 ! #define MAXCACHEDSTIDS 311 /* ===================== Non-cached ===================== */ --- 257,271 ---- #define CSTID_EDIT_ATTR_IN_EDITOR 309 #define CSTID_GET_NAMED_PROP_FROM_SEL_OBJ 310 + #define CSTID_START_AN_EDGE_FROM_A_PORT 311 + #define CSTID_ABORT 312 + #define CSTID_START_A_WIRE_FROM_NAMED_PORT 313 + #define CSTID_END_A_WIRE_AT_NAMED_PORT 314 + #define CSTID_SET_SIGNAME_FOR_NAMED_PORT 315 + #define CSTID_CLK_ON_PORT_TO_RENAME_SIGNAME 316 + #define CSTID_CLK_ON_PORT_TO_CLEAR_SIGNAME 317 + #define CSTID_PORTNAME_TOO_LONG_SKIPPED 318 + #define CSTID_CLEAR_SIGNAME_FOR_NAMED_PORT 319 ! #define MAXCACHEDSTIDS 320 /* ===================== Non-cached ===================== */ *************** *** 1563,1569 **** #define STID_WILL_AUTO_GEN_PREVIEW_BITMAP 2285 #define STID_WONT_AUTO_GEN_PREVIEW_BITMAP 2286 ! #define MAXNONCACHEDSTIDS 2287 extern struct MouseStatusStrRec colorMouseStatus[]; extern struct MouseStatusStrRec hAlignMouseStatus[]; --- 1572,1601 ---- #define STID_WILL_AUTO_GEN_PREVIEW_BITMAP 2285 #define STID_WONT_AUTO_GEN_PREVIEW_BITMAP 2286 + #define STID_TMP_DIR_NOT_EXIST_USE_XDEF 2287 + #define STID_INVALID_DIR_IN_X_DEFAULT 2288 + #define STID_RACE_IN_CREATE_TMP_FILE 2289 + #define STID_INVALID_GEOM_USE_ALT_GEOM 2290 + #define STID_REDUCE_BY_FACTOR 2291 + #define STID_ENLARGE_BY_FACTOR 2292 + #define STID_CREATE_THUMBNAIL_CAUSE_FLUSH 2293 + #define STID_CONNECT_PORTS_CANCEL_BY_USER 2294 + #define STID_Q_CNFLCT_SIG_NAME_OKAY_TO_CLR 2295 + #define STID_PLS_ENT_SIG_NAME 2296 + #define STID_SIGNAL_NAMES_CLEARED 2297 + #define STID_PLACING_NAMED_SIGNAL 2298 + #define STID_PLS_ENT_SIG_NAME_FOR_PORT 2299 ! #define STID_NO_CUR_FILE_CANNOT_GEN_NETLST 2300 ! #define STID_NO_SIGNAME_FOUND_EMPTY_NETLST 2301 ! #define STID_WILL_EXPORT_NETLIST_FILE 2302 ! #define STID_Q_OK_TO_CUT_INTO_SEGMENTS 2303 ! #define STID_NO_POLY_OBJ_SELECTED 2304 ! #define STID_WILL_SHOW_WIRE_SIGNAL_NAME 2305 ! #define STID_WILL_HIDE_WIRE_SIGNAL_NAME 2306 ! #define STID_TRY_AGAIN_AND_CLICK_IN_A_PORT 2307 ! #define STID_TRY_AGAIN_AND_END_IN_A_PORT 2308 + #define MAXNONCACHEDSTIDS 2309 + extern struct MouseStatusStrRec colorMouseStatus[]; extern struct MouseStatusStrRec hAlignMouseStatus[]; *** cmdids.h.orig Fri Aug 4 14:04:48 2000 --- cmdids.h Fri Aug 4 14:04:48 2000 *************** *** 384,389 **** #define CMDID_IMPORTJPEGFILE 431 #define CMDID_TOGGLEAUTOEPSPREVIEWBITMAP 432 ! #define MAXCMDIDS 433 #endif /*_CMDIDS_H_*/ --- 384,394 ---- #define CMDID_IMPORTJPEGFILE 431 #define CMDID_TOGGLEAUTOEPSPREVIEWBITMAP 432 + #define CMDID_CREATETHUMBNAILS 433 + #define CMDID_CONNECT2PORTSBYWIRE 434 + #define CMDID_RENAMESIGNAMEFORAPORT 435 + #define CMDID_CLEARSIGNAMEFORAPORT 436 + #define CMDID_TOGGLESHOWWIRESIGNALNAME 437 ! #define MAXCMDIDS 438 #endif /*_CMDIDS_H_*/ *** const.h.orig Fri Aug 4 14:04:48 2000 --- const.h Fri Aug 4 14:04:48 2000 *************** *** 465,470 **** #define PNG_FILE 10 #define JPEG_FILE 11 ! #define MAXDEFWHERETOPRINT 12 /* measurement */ --- 465,471 ---- #define PNG_FILE 10 #define JPEG_FILE 11 + #define NETLIST_FILE 12 ! #define MAXDEFWHERETOPRINT 13 /* measurement */ *** patchlvl.h.orig Fri Aug 4 14:04:49 2000 --- patchlvl.h Fri Aug 4 14:04:49 2000 *************** *** 35,39 **** #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 34 #endif /*_TGIF_PATCHLEVEL_H_*/ --- 35,39 ---- #define _TGIF_PATCHLEVEL_H_ ! #define TGIF_PATCHLEVEL 35 #endif /*_TGIF_PATCHLEVEL_H_*/ *** Makefile.noimake.orig Fri Aug 4 14:04:50 2000 --- Makefile.noimake Fri Aug 4 14:04:50 2000 *************** *** 100,103 **** --- 100,110 ---- -D_BACKGROUND_DONT_FORK -D_USE_XDRAWPOINT_TO_PUT_A_POINT + #-D_TMP_DIR_IN_HOME_DIR + # Include the above line if you want the temporary directory to be + # a user's $HOME/.Tgif directory by default. + #-D_DONT_USE_MKTEMP + # Include the above line if you do not want to use mktemp() and your + # system supports tempnam(). The use of mktemp() is not recommanded + # due to some security considerations. #-D_PS_SEVENBIT_DOUBLEBYTE_TEXT # Include the above line if bit 7 in both bytes of a double-byte *** Imakefile.orig Fri Aug 4 14:04:50 2000 --- Imakefile Fri Aug 4 14:04:50 2000 *************** *** 54,58 **** $(MOREDEFINES) ! TGIFVERSION = 4.1.34 XCOMM Things to try to add to the DEFINES line above: --- 54,58 ---- $(MOREDEFINES) ! TGIFVERSION = 4.1.35 XCOMM Things to try to add to the DEFINES line above: *************** *** 68,71 **** --- 68,78 ---- XCOMM SCO: -DPRINT_CMD=\""lp -o raw -o nobanner"\" + XCOMM -D_TMP_DIR_IN_HOME_DIR + XCOMM Include the above line if you want the temporary directory to be + XCOMM a user's $HOME/.Tgif directory by default. + XCOMM -D_DONT_USE_MKTEMP + XCOMM Include the above line if you do not want to use mktemp() and your + XCOMM system supports tempnam(). The use of mktemp() is not recommanded + XCOMM due to some security considerations. XCOMM -D_PS_SEVENBIT_DOUBLEBYTE_TEXT XCOMM Include the above line if bit 7 in both bytes of a double-byte *************** *** 314,319 **** SYMDEMO = flip-flop.sym nand2.sym pin.sym tangram.sym $(SPICEDIR)*.sym \ eq4.sym eq4-2x.sym eq4-ps2epsi.sym eq4-epstool.sym ! MISCTAR = /**/*.man README README.tgwb Copyright tgif.pl $(SPICEDIR)*.mod \ ! example.tex HISTORY /**/*.uu testdrive.pl frontend.pl BACKUPDIR = /mnt/halfmoon/home/william/src/tgif/v4/backup --- 321,327 ---- SYMDEMO = flip-flop.sym nand2.sym pin.sym tangram.sym $(SPICEDIR)*.sym \ eq4.sym eq4-2x.sym eq4-ps2epsi.sym eq4-epstool.sym ! MISCTAR = /**/*.man README README.tgwb Copyright License $(SPICEDIR)*.mod \ ! tgif.pl example.tex HISTORY /**/*.uu testdrive.pl frontend.pl \ ! Imakefile.tgwb BACKUPDIR = /mnt/halfmoon/home/william/src/tgif/v4/backup *************** *** 375,379 **** (cd $(BACKUPDIR); tar xvpf -) ! MAN_1 = README /**/*.man Imakefile Copyright BASIC_1 = Makefile.noimake descrip./**/* make./**/* HISTORY tgif.Xdefaults \ Tgif.tmpl Tgif.tmpl-/**/* VMS_MAKE_TGIF.COM --- 383,387 ---- (cd $(BACKUPDIR); tar xvpf -) ! MAN_1 = README /**/*.man Imakefile Copyright License BASIC_1 = Makefile.noimake descrip./**/* make./**/* HISTORY tgif.Xdefaults \ Tgif.tmpl Tgif.tmpl-/**/* VMS_MAKE_TGIF.COM *************** *** 441,445 **** tgificon.xbm tgificon.xpm tgif.Xdefaults tgificon.eps \ VMS_MAKE_TGIF.COM launch-demo.obj launch-demo-1.obj \ ! Copyright make./**/* Tgif.tmpl-/**/* tgif.spec.in \ Imakefile.tgwb README.tgwb Target.tmpl \ > VersionInfo/Distribution/tgif-$(TGIFVERSION) --- 449,453 ---- tgificon.xbm tgificon.xpm tgif.Xdefaults tgificon.eps \ VMS_MAKE_TGIF.COM launch-demo.obj launch-demo-1.obj \ ! Copyright License make./**/* Tgif.tmpl-/**/* tgif.spec.in \ Imakefile.tgwb README.tgwb Target.tmpl \ > VersionInfo/Distribution/tgif-$(TGIFVERSION) *** Tgif.tmpl.orig Fri Aug 4 14:04:51 2000 --- Tgif.tmpl Fri Aug 4 14:04:51 2000 *************** *** 49,52 **** --- 49,53 ---- XCOMM MANPATH = /u/halfmoon/man XCOMM TGIFDIR = /u/halfmoon/lib/X11/tgif + XCOMM MOREDEFINES = -D_HAS_STREAMS_SUPPORT -DENABLE_NLS -D_TGIF_DBG LOCALEDIR = /usr/share/locale DIRDEFINES = -DTGIF_PATH=\"$(TGIFDIR)\" -DPSFILE_MOD=0664 \@@\ *************** *** 57,63 **** -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 \@@\ ! -D_USE_PS_ADOBE_STRING=\"3.0/3.0\" MOREDEFINES = --- 58,65 ---- -DXBM_FILE_EXT=\"xbm\" -DXPM_FILE_EXT=\"xpm\" \@@\ -DOBJ_FILE_EXT=\"obj\" -DSYM_FILE_EXT=\"sym\" \@@\ ! -DTEXT_FILE_EXT=\"txt\" -DPIN_FILE_EXT=\"pin\" \@@\ ! -DNETLIST_FILE_EXT=\"net\" -DCOMP_FILE_EXT=\"cmp\" MISCDEFINES = -D_BACKGROUND_DONT_FORK -D_USE_XDRAWPOINT_TO_PUT_A_POINT \@@\ ! -D_USE_PS_ADOBE_STRING=\"3.0/3.0\" -D_DONT_USE_MKTEMP MOREDEFINES = *** tgif.man.orig Fri Aug 4 14:04:52 2000 --- tgif.man Fri Aug 4 14:04:52 2000 *************** *** 9,13 **** .\" .\" ! .TH tgif n "Version 4.1 Patchlevel 34 and Above" "Tgif" .\" .SH NAME --- 9,13 ---- .\" .\" ! .TH tgif n "Version 4.1 Patchlevel 35 and Above" "Tgif" .\" .SH NAME *************** *** 57,60 **** --- 57,61 ---- [\fB-html\fR] [\fB-pdf\fR] + [\fB-netlist\fR] [\fB-display\fR displayname] [\fB-stdout\fR] *************** *** 92,96 **** \fB-eps\fR, \fB-p\fR, \fB-epsi\fR, \fB-tiffepsi\fR, \fB-gif\fR, \fB-png\fR, \fB-jpeg\fR, \fB-xpm\fR, \fB-xbm\fR, \fB-html\fR, ! \fB-pdf\fR, \fB-ps\fR, \fB-f\fR, or \fB-text\fR options are specified. This form of \fIprinting\fR is tgif's way of \fIexporting\fR a tgif file to another format. In this case, --- 93,97 ---- \fB-eps\fR, \fB-p\fR, \fB-epsi\fR, \fB-tiffepsi\fR, \fB-gif\fR, \fB-png\fR, \fB-jpeg\fR, \fB-xpm\fR, \fB-xbm\fR, \fB-html\fR, ! \fB-pdf\fR, \fB-ps\fR, \fB-f\fR, \fB-text\fR, or \fB-netlist\fR options are specified. This form of \fIprinting\fR is tgif's way of \fIexporting\fR a tgif file to another format. In this case, *************** *** 227,230 **** --- 228,242 ---- Please see the notes for Tgif.PsToPdf in the X DEFAULTS section below. .TP + .B -netlist + Generates a text file in \fIfile.net\fR and a text file in \fIfile.cmp\fR. + \fIfile.net\fR contains netlist information stored in a table. + The first line in it contains column names and + each line in it is a port name (surrounded by double-quotes), + followed by a comma and a character, followed by a signal name + (also surrounded by double-quotes). + \fIfile.cmp\fR contains information about components in the file. + Each component begins with its name followed by its type. The attributes + of a component are printed afterwards (indented by characters). + .TP .B -stdout Sends the output to the standard output instead of generating the *************** *** 1043,1047 **** in popup menus which the COMMAND would correspond to. .PP ! CyclePrintFormat() Printer, LaTeXFig, RawPSFile, XBitmap, TextFile, EPSI, GIF/ISMAP, TiffEPSI ToggleBW/ColorPS() BlkWhtPS, ColorPS ToggleGridSystem() EnglishGrid, MetricGrid --- 1055,1059 ---- in popup menus which the COMMAND would correspond to. .PP ! CyclePrintFormat() Printer, LaTeXFig, RawPSFile, XBitmap, TextFile, EPSI, GIF/ISMAP, TiffEPSI, NetList ToggleBW/ColorPS() BlkWhtPS, ColorPS ToggleGridSystem() EnglishGrid, MetricGrid *************** *** 1411,1418 **** .I mktemp(,) This command makes a unique file name. ! The argument is a template string, e.g., "/tmp/TgifXXXXXX". ! The result of mktemp is stored as the value of the attribute specified by . ! Please see the man pages of the C library function on mktemp for more details. .TP .I create_file_using_simple_template(