diff --git a/ChangeLog b/ChangeLog index 31c15d83e..5cf7c9603 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ message * runcoms.c: enter do_measure() only if ft_curckt->ci_last_an has a value (bug no. 2751855) + * winmain.c: winmessage() only if message not into log file 2009-04-10 Holger Vogt * spicenum.c: memory leak removed diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index 4d7d5a21b..b795fcfa9 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -676,7 +676,7 @@ int WIN_Arc(int x0, int y0, int radius, double theta1, double theta2) return 0; } -int WIN_Text( char * text, int x, int y, int degrees) +int WIN_Text_old( char * text, int x, int y, int degrees) { tpWindowData wd; if (!currentgraph) return 0; @@ -690,6 +690,46 @@ int WIN_Text( char * text, int x, int y, int degrees) } +int WIN_Text( char * text, int x, int y, int CentiDegrees) +{ + tpWindowData wd; + HFONT hfont; + LOGFONT lf; + + CentiDegrees = 0; + + if (!currentgraph) return 0; + wd = pWindowData(currentgraph); + if (!wd) return 0; + + lf.lfHeight = (int) (1.1 * currentgraph->fontheight) ; + lf.lfWidth = 0 ; + lf.lfEscapement = CentiDegrees ; + lf.lfOrientation = CentiDegrees ; + lf.lfWeight = 500 ; + lf.lfItalic = 0 ; + lf.lfUnderline = 0 ; + lf.lfStrikeOut = 0 ; + lf.lfCharSet = 0 ; + lf.lfOutPrecision = 0 ; + lf.lfClipPrecision = 0 ; + lf.lfQuality = 0 ; + lf.lfPitchAndFamily = 0 ; + + lstrcpy (lf.lfFaceName, "Courier"/*"Times New Roman"*/) ; + + hfont = CreateFontIndirect (&lf); + SelectObject(wd->hDC, hfont); + + SetTextColor( wd->hDC, ColorTable[wd->ColorIndex]); + TextOut( wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight, text, strlen(text)); + + DeleteObject(SelectObject(wd->hDC, GetStockObject(SYSTEM_FONT))); + + return (0); +} + + int WIN_DefineColor(int red, int green, int blue, int num) { /* nothing */ diff --git a/src/winmain.c b/src/winmain.c index 231b51385..7e688d18f 100644 --- a/src/winmain.c +++ b/src/winmain.c @@ -853,6 +853,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi outheap = HeapCreate(0, 10000000, 0); if (!outheap) { fprintf(stderr,"HeapCreate: Internal Error: can't allocate private output heap"); + winmessage("HeapCreate: Internal Error: can't allocate private output heap"); exit(1); } @@ -1344,7 +1345,9 @@ char* rlead(char *s) void winmessage(char* new_msg) { - MessageBox(NULL, new_msg, "Ngspice error", MB_OK|MB_ICONERROR); + /* open a message box only if message is not written into -o xxx.log */ + if (oflag == FALSE) + MessageBox(NULL, new_msg, "Ngspice Info", MB_OK|MB_ICONERROR); } #endif /* HAS_WINDOWS */