winmessage() modified

This commit is contained in:
h_vogt 2009-04-12 18:19:24 +00:00
parent ec3c50c09e
commit c9b58436f6
3 changed files with 46 additions and 2 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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 */