1 /***********************************************************************
2 *
3 *               *****   ***    ***
4 *                  *   *   *  *   *
5 *                 *     ***    ***
6 *                *     *   *  *   *
7 *               *****   ***    ***
8 *
9 * A FREE Finite Elements Analysis Program in ANSI C for the Windows OS.
10 *
11 * Composed and edited and copyright by
12 * Professor Dr.-Ing. Frank Rieg, University of Bayreuth, Germany
13 *
14 * eMail:
15 * frank.rieg@uni-bayreuth.de
16 * dr.frank.rieg@t-online.de
17 *
18 * V15.0  November 18, 2015
19 *
20 * Z88 should compile and run under any Windows release.
21 *
22 * This program is free software; you can redistribute it and/or modify
23 * it under the terms of the GNU General Public License as published by
24 * the Free Software Foundation; either version 2, or (at your option)
25 * any later version.
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30 * GNU General Public License for more details.
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; see the file COPYING.  If not, write to
34 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
35 ***********************************************************************/
36 /**********************************************************************
37 *  Z88X
38 *  7.3.2017 Rieg
39 ***********************************************************************/
40 
41 /***********************************************************************
42 * Fuer Windows
43 ***********************************************************************/
44 #ifdef FR_WIN
45 #include <z88x.h>
46 #include <windows.h>
47 #include <commctrl.h>
48 #include <stdio.h>    /* FILE */
49 #include <stdlib.h>   /* exit */
50 #include <string.h>   /* strcpy */
51 #endif
52 
53 /***********************************************************************
54 *  Window- Function-Declarationen
55 ***********************************************************************/
56 LRESULT CALLBACK WndProc            (HWND, UINT, WPARAM, LPARAM);
57 
58 BOOL    CALLBACK TextSDiaProc       (HWND, UINT, WPARAM, LPARAM);
59 
60 HWND    InitToolBar   (HWND hParent);
61 
62 HFONT   EzCreateFont (HDC hdc, char * szFaceName, int iDeciPtHeight,
63                     int iDeciPtWidth, int iAttributes, BOOL fLogRes);
64 
65 /***********************************************************************
66 *  externe Variable
67 ***********************************************************************/
68 HDC        hDC;
69 HINSTANCE  hInstance;
70 HFONT      hFont;
71 
72 HWND       hToolBar;
73 HMENU      hMenuGer,hMenuEng;
74 
75 HCURSOR    waitcur;
76 
77 /***********************************************************************
78 *  Function-Declarationen
79 ***********************************************************************/
80 int dyn88x(void);
81 int ale88x(int);
82 int rea88x(void);
83 int rdxf88x(void);
84 int z88tx(void);
85 int z88fx(void);
86 int wrim88x(FR_INT4,int);
87 int wlog88x(FR_INT4,int);
88 void sub88x(FR_INT4);
89 int lan88x(void);
90 
91 /***********************************************************************
92 *  globale Variable
93 ***********************************************************************/
94 /*--------------------------------------------------------------------------
95 * Files
96 *-------------------------------------------------------------------------*/
97 FILE *fdyn,*fwlo,*fz88,*fdxf,*fi2,*fi5,*fcfg;
98 
99 /*
100 **   fdyn= z88.dyn
101 **   fwlo= z88x.log
102 **   fz88= z88ni.txt oder z88i1.txt
103 **   fdxf= z88x.dxf oder z88x.dxf
104 **   fi2 = z88i2.txt
105 **   fi5 = z88i5.txt
106 **   fcfg= z88com.cfg
107 */
108 
109 char cdyn[8] = "z88.dyn";
110 char clgd[9] = "z88x.log";
111 char ci1[10] = "z88i1.txt";
112 char ci2[10] = "z88i2.txt";
113 char ci5[10] = "z88i5.txt";
114 char cni[10] = "z88ni.txt";
115 char cxx[10] = "z88x.dxf";
116 char cfg[11] = "z88com.cfg";
117 
118 /*--------------------------------------------------------------------------
119 * Pointer
120 *-------------------------------------------------------------------------*/
121 FR_DOUBLEAY x;
122 FR_DOUBLEAY y;
123 FR_DOUBLEAY z;
124 FR_DOUBLEAY wert;
125 FR_DOUBLEAY pres;
126 FR_DOUBLEAY tr1;
127 FR_DOUBLEAY tr2;
128 
129 FR_INT4AY koi;
130 FR_INT4AY ifrei;
131 FR_INT4AY ioffs;
132 FR_INT4AY koffs;
133 FR_INT4AY ityp;
134 FR_INT4AY itypfe;
135 FR_INT4AY jel;
136 FR_INT4AY iel;
137 FR_INT4AY kel;
138 FR_INT4AY nkn;
139 FR_INT4AY ifg;
140 FR_INT4AY irflag;
141 FR_INT4AY noi;
142 FR_INT4AY noffs;
143 FR_INT4AY nep;
144 
145 FR_CHARAY cjmode;
146 FR_CHARAY cimode;
147 FR_CHARAY ckmode;
148 
149 /*--------------------------------------------------------------------------
150 * Char-Arrays
151 *-------------------------------------------------------------------------*/
152 char cstore[256];
153 char cbcall[128];
154 char cbpref[128];
155 char callbrow[512];
156 char cbhelp[512];
157 char cmess [512];
158 char cbytes[128];
159 char *comli;
160 
161 /*--------------------------------------------------------------------------
162 * Variable
163 *-------------------------------------------------------------------------*/
164 double epsx,epsy,epsz;
165 
166 FR_INT4 intore,nel,ktyp;
167 FR_INT4 IDYNMEM,ICFLAG,LANG=2;
168 FR_INT4 ndim,nkp,ne,nfg,nkoi,kflagss,kflag,iqflag,niflag;
169 FR_INT4 nrb,ianz,ifrej;
170 
171 int     *pp;
172 
173 char    cflag[10];
174 
175 /*--------------------------------------------------------------------------
176 * vorbelegte Variable
177 *-------------------------------------------------------------------------*/
178 double texts= 1.0;                     /* Startwert Textsize */
179 
180 FR_INT4 MAXNFG=0,MAXK=0,MAXE=0,MAXKOI=0,MAXPR=0,npr=0;
181 FR_INT4 ITSFLAG= 0;                    /* berechneten Textsize nehmen */
182 
183 int ifmode= IDM_IAFX;
184 
185 /***********************************************************************
186 * WinMain
187 ***********************************************************************/
WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR lpszCmdLine,int nCmdShow)188 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
189                    PSTR lpszCmdLine, int nCmdShow)
190 {
191 HWND       hWnd;
192 MSG        msg;
193 WNDCLASSEX wndclass;
194 
195 char       capname[10];
196 
197 /***********************************************************************
198 * Handles kommen lassen, window oeffnen
199 ***********************************************************************/
200 comli= (char *)calloc(256,sizeof(char));
201 comli= lpszCmdLine;
202 
203 strcpy(capname, "Z88X");
204 
205 wndclass.cbSize        = sizeof(wndclass);
206 wndclass.style         = CS_HREDRAW | CS_VREDRAW;
207 wndclass.lpfnWndProc   = WndProc;
208 wndclass.cbClsExtra    = 0;
209 wndclass.cbWndExtra    = 0;
210 wndclass.hInstance     = hInstance;
211 wndclass.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(ICO_Z88X));
212 wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
213 wndclass.hbrBackground = CreateSolidBrush(RGB(255,255,255));
214 wndclass.lpszMenuName  = capname;
215 wndclass.lpszClassName = capname;
216 wndclass.hIconSm       = LoadIcon(hInstance, MAKEINTRESOURCE(ICO_Z88X));
217 
218 RegisterClassEx(&wndclass);
219 
220 hWnd = CreateWindow(capname,"Z88 DXF Converter Z88X",
221                     WS_OVERLAPPEDWINDOW,
222                     0,150,
223                     420,426,
224                     NULL, NULL, hInstance, NULL);
225 
226 InitCommonControls();
227 
228 ShowWindow(hWnd, nCmdShow);
229 UpdateWindow(hWnd);
230 
231 while(GetMessage(&msg, NULL, 0, 0))
232   {
233   TranslateMessage(&msg);
234   DispatchMessage(&msg);
235   }
236 
237 DeleteObject(hFont);
238 
239 return msg.wParam;
240 }
241 
242 /***********************************************************************
243 * Main Window Procedure
244 ***********************************************************************/
WndProc(HWND hWnd,UINT Message,WPARAM wParam,LPARAM lParam)245 LRESULT CALLBACK WndProc(HWND hWnd, UINT Message,
246                          WPARAM wParam, LPARAM lParam)
247 {
248 extern HDC        hDC;
249 extern HINSTANCE  hInstance;
250 extern HFONT      hFont;
251 
252 extern HWND       hToolBar;
253 extern HMENU      hMenuGer,hMenuEng;
254 
255 extern HCURSOR    waitcur;
256 
257 extern FR_INT4    ICFLAG,LANG,ITSFLAG;
258 extern int        ifmode;
259 
260 extern char       cstore[];
261 extern char       cbcall[];
262 extern char       cbpref[];
263 extern char       callbrow[];
264 extern char       cbhelp[];
265 extern char       cmess[];
266 extern char       *comli;
267 
268 HMENU             hMenu;
269 
270 PAINTSTRUCT       ps;
271 
272 static int        ixClient,iyClient;
273 
274 int               imess,iret,ipara1=0;
275 
276 
277 size_t            laenge;
278 
279 /*----------------------------------------------------------------------
280 * Los gehts
281 *---------------------------------------------------------------------*/
282 switch (Message)
283   {
284 /*----------------------------------------------------------------------
285 * case WM_CREATE
286 *---------------------------------------------------------------------*/
287   case WM_CREATE:
288     if(ifmode == IDM_IAFX) ICFLAG = 5;
289 
290 /*======================================================================
291 * hInstance kommen lassen
292 *=====================================================================*/
293 #ifdef FR_XWIN64
294     hInstance= (HINSTANCE)GetWindowLongPtr(hWnd,GWLP_HINSTANCE);
295 #endif
296 #ifdef FR_XWIN32
297     hInstance= (HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE);
298 #endif
299 
300 /*======================================================================
301 * Wartecursor anlegen
302 *=====================================================================*/
303     waitcur= LoadCursor(hInstance,MAKEINTRESOURCE(CUR_Z88X));
304 
305 /*======================================================================
306 * Sprache feststellen
307 *=====================================================================*/
308     iret= lan88x();
309     if(iret != 0)
310       {
311       ale88x(iret);
312       PostQuitMessage(0);
313       return(1);
314       }
315 
316     hMenuGer= LoadMenu(hInstance,"GERMAN");
317     hMenuEng= LoadMenu(hInstance,"ENGLISH");
318 
319     if(LANG == 1) SetMenu(hWnd,hMenuGer);
320     if(LANG == 2) SetMenu(hWnd,hMenuEng);
321 
322 /*======================================================================
323 * dynamischen Speicher anfordern
324 *=====================================================================*/
325     iret= dyn88x();
326     if(iret != 0)
327       {
328       ale88x(iret);
329       PostQuitMessage(0);
330       return 0;
331       }
332 
333 /*======================================================================
334 * Toolbar
335 *=====================================================================*/
336     hToolBar= InitToolBar(hWnd);
337 
338 /*======================================================================
339 * Commandline auswerten
340 *=====================================================================*/
341     if( (strstr(comli,"-i1tx"))!= NULL)
342       {
343       ipara1= 1;
344       ICFLAG= 1;
345       }
346     if( (strstr(comli,"-iatx"))!= NULL)
347       {
348       ipara1= 1;
349       ICFLAG= 2;
350       }
351     if( (strstr(comli,"-nitx"))!= NULL)
352       {
353       ipara1= 1;
354       ICFLAG= 3;
355       }
356     if( (strstr(comli,"-i1fx"))!= NULL)
357       {
358       ipara1= 1;
359       ICFLAG= 4;
360       }
361     if( (strstr(comli,"-iafx"))!= NULL)
362       {
363       ipara1= 1;
364       ICFLAG= 5;
365       }
366     if( (strstr(comli,"-nifx"))!= NULL)
367       {
368       ipara1= 1;
369       ICFLAG= 6;
370       }
371 
372 
373     if(ipara1 == 1)
374       PostMessage(hWnd,WM_COMMAND,IDM_GO,0);
375 
376   return 0; /* Ende WM_CREATE */
377 
378 /*----------------------------------------------------------------------
379 * case WM_INITMENU
380 *---------------------------------------------------------------------*/
381   case WM_INITMENU:
382     hMenu= GetMenu(hWnd); /* muss rein */
383 
384     CheckMenuItem(hMenu,IDM_I1TX, MF_UNCHECKED | MF_BYCOMMAND);
385     CheckMenuItem(hMenu,IDM_IATX, MF_UNCHECKED | MF_BYCOMMAND);
386     CheckMenuItem(hMenu,IDM_NITX, MF_UNCHECKED | MF_BYCOMMAND);
387     CheckMenuItem(hMenu,IDM_I1FX, MF_UNCHECKED | MF_BYCOMMAND);
388     CheckMenuItem(hMenu,IDM_IAFX, MF_UNCHECKED | MF_BYCOMMAND);
389     CheckMenuItem(hMenu,IDM_NIFX, MF_UNCHECKED | MF_BYCOMMAND);
390     CheckMenuItem(hMenu,ifmode,     MF_CHECKED   | MF_BYCOMMAND);
391   return 0;
392 
393 /*----------------------------------------------------------------------
394 * case WM_MOVE
395 *---------------------------------------------------------------------*/
396   case WM_MOVE:
397   return 0;
398 
399 /*----------------------------------------------------------------------
400 * case WM_SIZE
401 *---------------------------------------------------------------------*/
402   case WM_SIZE:
403     iyClient= HIWORD(lParam);
404     ixClient= LOWORD(lParam);
405   return 0;
406 
407 /*----------------------------------------------------------------------
408 * WM_NOTIFY
409 *---------------------------------------------------------------------*/
410   case WM_NOTIFY:
411     {
412     LPNMHDR pnmh= (LPNMHDR) lParam;
413     LPSTR   pReply;
414 
415     if(pnmh->code == TTN_NEEDTEXT)
416       {
417       LPTOOLTIPTEXT lpttt= (LPTOOLTIPTEXT) lParam;
418 
419       switch(lpttt->hdr.idFrom)
420         {
421         case ITC_GO:
422           if(LANG == 1) pReply= "Berechne";
423           if(LANG == 2) pReply= "Run";
424         break;
425 
426         case ITC_HELP:
427           if(LANG == 1) pReply= "OnLine-Hilfe";
428           if(LANG == 2) pReply= "OnLine Help";
429         break;
430 
431         case ITC_I1TX:
432           if(LANG == 1) pReply= "Konvertiere Z88I1.TXT in Z88X.DXF";
433           if(LANG == 2) pReply= "Convert Z88I1.TXT into Z88X.DXF";
434         break;
435 
436         case ITC_IATX:
437           if(LANG == 1) pReply= "Konvertiere Z88I*.TXT in Z88X.DXF";
438           if(LANG == 2) pReply= "Convert Z88I*.TXT into Z88X.DXF";
439         break;
440 
441         case ITC_NITX:
442           if(LANG == 1) pReply= "Konvertiere Z88NI.TXT in Z88X.DXF";
443           if(LANG == 2) pReply= "Convert Z88NI.TXT into Z88X.DXF";
444         break;
445 
446         case ITC_I1FX:
447           if(LANG == 1) pReply= "Konvertiere Z88X.DXF in Z88I1.TXT";
448           if(LANG == 2) pReply= "Convert Z88X.DXF into Z88I1.TXT";
449         break;
450 
451         case ITC_IAFX:
452           if(LANG == 1) pReply= "Konvertiere Z88X.DXF in Z88I*.TXT";
453           if(LANG == 2) pReply= "Convert Z88X.DXF into Z88I*.TXT";
454         break;
455 
456         case ITC_NIFX:
457           if(LANG == 1) pReply= "Konvertiere Z88X.DXF in Z88NI.TXT";
458           if(LANG == 2) pReply= "Convert Z88X.DXF into Z88NI.TXT";
459         break;
460 
461         case ITC_XIT:
462           if(LANG == 1) pReply= "Beende";
463           if(LANG == 2) pReply= "Exit";
464         break;
465 
466         }
467       lstrcpy(lpttt->szText,pReply);
468       }
469     return 0;  /* sehr wichtig */
470     }
471 
472 /*----------------------------------------------------------------------
473 * case WM_COMMAND
474 *---------------------------------------------------------------------*/
475   case WM_COMMAND:
476     switch (LOWORD(wParam))
477       {
478 
479 /*======================================================================
480 * COMMAND : Wer ist es
481 *=====================================================================*/
482       case IDM_WER:
483         if(LANG == 1) strcpy(cmess,
484 "DXF-Konverter Z88X fuer Windows\n\
485 Version 15OS\n\
486 Copyright Univ.-Prof.Dr.-Ing. Frank Rieg,\n\
487 Universitaet Bayreuth, 2017\n\
488 Alle Rechte vorbehalten\n");
489 
490           if(LANG == 2) strcpy(cmess,
491 "DXF Converter Z88X for Windows\n\
492 Version 15OS\n\
493 Copyright Prof.Dr. Frank Rieg,\n\
494 University of Bayreuth, Germany 2017\n\
495 All rights reserved\n");
496 
497 #ifdef FR_XQUAD
498         sprintf(cbytes,"Floats: %d Bytes\n",(int)sizeof(long double));
499         strcat(cmess,cbytes);
500 #endif
501 #ifdef FR_XDOUB
502         sprintf(cbytes,"Floats: %d Bytes\n",(int)sizeof(double));
503         strcat(cmess,cbytes);
504 #endif
505 #ifdef FR_XINT
506         sprintf(cbytes,"Integers: %d Bytes\n",(int)sizeof(int));
507         strcat(cmess,cbytes);
508 #endif
509 #ifdef FR_XLONG
510         sprintf(cbytes,"Integers: %d Bytes\n",(int)sizeof(long));
511         strcat(cmess,cbytes);
512 #endif
513 #ifdef FR_XLOLO
514         sprintf(cbytes,"Integers: %d Bytes\n",(int)sizeof(long long));
515         strcat(cmess,cbytes);
516 #endif
517         sprintf(cbytes,"Pointers: %d Bytes\n",(int)sizeof(pp));
518         strcat(cmess,cbytes);
519 
520         MessageBox(NULL,cmess,"Z88X", MB_OK | MB_ICONINFORMATION);
521       return 0;
522 
523 /*======================================================================
524 * COMMAND : Textsize
525 *=====================================================================*/
526       case IDM_TEXTSIZE:
527         if(LANG == 1) DialogBox(hInstance,"Dlg_TextS88G",hWnd,TextSDiaProc);
528         if(LANG == 2) DialogBox(hInstance,"Dlg_TextS88E",hWnd,TextSDiaProc);
529         InvalidateRect(hWnd,NULL,TRUE);
530       return 0;
531 
532 /*======================================================================
533 * COMMAND : Xit
534 *=====================================================================*/
535       case IDM_XIT:
536       case ITC_XIT:
537         PostQuitMessage(0);
538       return 0;
539 
540 /*======================================================================
541 * COMMAND : Hilfe
542 *=====================================================================*/
543       case ITC_HELP:
544         fcfg= fopen(cfg,"r");          /* Z88COM.CFG oeffnen */
545         if(fcfg == NULL)
546           {
547           if(LANG == 1) strcpy(cmess,
548           "Datei Z88COM.CFG nicht vorhanden oder zerschossen !");
549           if(LANG == 2) strcpy(cmess,
550           "File Z88COM.CFG not available or destroyed !");
551           MessageBox(NULL,cmess,"Z88X", MB_OK | MB_ICONHAND);
552           }
553 
554         rewind(fcfg);
555 
556         fgets(cstore,128,fcfg);
557         fgets(cstore,128,fcfg);
558 
559         fgets(cstore,128,fcfg);
560         laenge= strlen(cstore);
561         strncpy(cbpref,cstore,laenge-1);
562         strcat (cbpref,"\0");
563 
564         fgets(cstore,128,fcfg);
565         laenge= strlen(cstore);
566         strncpy(cbcall,cstore,laenge-1);
567         strcat (cbcall,"\0");
568 
569         fclose(fcfg);
570 
571         strcpy(callbrow,cbcall);
572         strcat(callbrow," ");
573         strcat(callbrow,cbpref);
574         if(LANG == 1) strcat(callbrow,"z88mang.pdf");
575         if(LANG == 2) strcat(callbrow,"z88mane.pdf");
576         imess= WinExec(callbrow,SW_SHOW);
577         if(imess < 33)
578           {
579           wlog88x(0L,LOG_NOACROBAT);
580           ale88x(AL_NOACROBAT);
581           }
582       return 0;
583 
584 /*======================================================================
585 * COMMAND : Mode aus Menue
586 *=====================================================================*/
587       case IDM_I1TX:
588       case IDM_IATX:
589       case IDM_NITX:
590       case IDM_I1FX:
591       case IDM_IAFX:
592       case IDM_NIFX:
593         hMenu= GetMenu(hWnd);
594         CheckMenuItem(hMenu,ifmode,MF_UNCHECKED | MF_BYCOMMAND);
595         ifmode= (int)wParam;
596         CheckMenuItem(hMenu,ifmode,MF_CHECKED | MF_BYCOMMAND);
597 
598         if     (ifmode == IDM_I1TX)
599           {
600           ICFLAG = 1;
601           SendMessage(hToolBar,TB_CHECKBUTTON,
602           (WPARAM)ITC_I1TX,(LPARAM) MAKELONG(TRUE,0) );
603           SendMessage(hToolBar,TB_CHECKBUTTON,
604           (WPARAM)ITC_IATX,(LPARAM) MAKELONG(FALSE,0) );
605           SendMessage(hToolBar,TB_CHECKBUTTON,
606           (WPARAM)ITC_NITX,(LPARAM) MAKELONG(FALSE,0) );
607           SendMessage(hToolBar,TB_CHECKBUTTON,
608           (WPARAM)ITC_I1FX,(LPARAM) MAKELONG(FALSE,0) );
609           SendMessage(hToolBar,TB_CHECKBUTTON,
610           (WPARAM)ITC_IAFX,(LPARAM) MAKELONG(FALSE,0) );
611           SendMessage(hToolBar,TB_CHECKBUTTON,
612           (WPARAM)ITC_NIFX,(LPARAM) MAKELONG(FALSE,0) );
613           }
614 
615         else if(ifmode == IDM_IATX)
616           {
617           ICFLAG = 2;
618           SendMessage(hToolBar,TB_CHECKBUTTON,
619           (WPARAM)ITC_I1TX,(LPARAM) MAKELONG(FALSE,0) );
620           SendMessage(hToolBar,TB_CHECKBUTTON,
621           (WPARAM)ITC_IATX,(LPARAM) MAKELONG(TRUE,0) );
622           SendMessage(hToolBar,TB_CHECKBUTTON,
623           (WPARAM)ITC_NITX,(LPARAM) MAKELONG(FALSE,0) );
624           SendMessage(hToolBar,TB_CHECKBUTTON,
625           (WPARAM)ITC_I1FX,(LPARAM) MAKELONG(FALSE,0) );
626           SendMessage(hToolBar,TB_CHECKBUTTON,
627           (WPARAM)ITC_IAFX,(LPARAM) MAKELONG(FALSE,0) );
628           SendMessage(hToolBar,TB_CHECKBUTTON,
629           (WPARAM)ITC_NIFX,(LPARAM) MAKELONG(FALSE,0) );
630           }
631 
632         else if(ifmode == IDM_NITX)
633           {
634           ICFLAG = 3;
635           SendMessage(hToolBar,TB_CHECKBUTTON,
636           (WPARAM)ITC_I1TX,(LPARAM) MAKELONG(FALSE,0) );
637           SendMessage(hToolBar,TB_CHECKBUTTON,
638           (WPARAM)ITC_IATX,(LPARAM) MAKELONG(FALSE,0) );
639           SendMessage(hToolBar,TB_CHECKBUTTON,
640           (WPARAM)ITC_NITX,(LPARAM) MAKELONG(TRUE,0) );
641           SendMessage(hToolBar,TB_CHECKBUTTON,
642           (WPARAM)ITC_I1FX,(LPARAM) MAKELONG(FALSE,0) );
643           SendMessage(hToolBar,TB_CHECKBUTTON,
644           (WPARAM)ITC_IAFX,(LPARAM) MAKELONG(FALSE,0) );
645           SendMessage(hToolBar,TB_CHECKBUTTON,
646           (WPARAM)ITC_NIFX,(LPARAM) MAKELONG(FALSE,0) );
647           }
648 
649         else if(ifmode == IDM_I1FX)
650           {
651           ICFLAG = 4;
652           SendMessage(hToolBar,TB_CHECKBUTTON,
653           (WPARAM)ITC_I1TX,(LPARAM) MAKELONG(FALSE,0) );
654           SendMessage(hToolBar,TB_CHECKBUTTON,
655           (WPARAM)ITC_IATX,(LPARAM) MAKELONG(FALSE,0) );
656           SendMessage(hToolBar,TB_CHECKBUTTON,
657           (WPARAM)ITC_NITX,(LPARAM) MAKELONG(FALSE,0) );
658           SendMessage(hToolBar,TB_CHECKBUTTON,
659           (WPARAM)ITC_I1FX,(LPARAM) MAKELONG(TRUE,0) );
660           SendMessage(hToolBar,TB_CHECKBUTTON,
661           (WPARAM)ITC_IAFX,(LPARAM) MAKELONG(FALSE,0) );
662           SendMessage(hToolBar,TB_CHECKBUTTON,
663           (WPARAM)ITC_NIFX,(LPARAM) MAKELONG(FALSE,0) );
664           }
665 
666         else if(ifmode == IDM_IAFX)
667           {
668           ICFLAG = 5;
669           SendMessage(hToolBar,TB_CHECKBUTTON,
670           (WPARAM)ITC_I1TX,(LPARAM) MAKELONG(FALSE,0) );
671           SendMessage(hToolBar,TB_CHECKBUTTON,
672           (WPARAM)ITC_IATX,(LPARAM) MAKELONG(FALSE,0) );
673           SendMessage(hToolBar,TB_CHECKBUTTON,
674           (WPARAM)ITC_NITX,(LPARAM) MAKELONG(FALSE,0) );
675           SendMessage(hToolBar,TB_CHECKBUTTON,
676           (WPARAM)ITC_I1FX,(LPARAM) MAKELONG(FALSE,0) );
677           SendMessage(hToolBar,TB_CHECKBUTTON,
678           (WPARAM)ITC_IAFX,(LPARAM) MAKELONG(TRUE,0) );
679           SendMessage(hToolBar,TB_CHECKBUTTON,
680           (WPARAM)ITC_NIFX,(LPARAM) MAKELONG(FALSE,0) );
681           }
682 
683         else if(ifmode == IDM_NIFX)
684           {
685           ICFLAG = 6;
686           SendMessage(hToolBar,TB_CHECKBUTTON,
687           (WPARAM)ITC_I1TX,(LPARAM) MAKELONG(FALSE,0) );
688           SendMessage(hToolBar,TB_CHECKBUTTON,
689           (WPARAM)ITC_IATX,(LPARAM) MAKELONG(FALSE,0) );
690           SendMessage(hToolBar,TB_CHECKBUTTON,
691           (WPARAM)ITC_NITX,(LPARAM) MAKELONG(FALSE,0) );
692           SendMessage(hToolBar,TB_CHECKBUTTON,
693           (WPARAM)ITC_I1FX,(LPARAM) MAKELONG(FALSE,0) );
694           SendMessage(hToolBar,TB_CHECKBUTTON,
695           (WPARAM)ITC_IAFX,(LPARAM) MAKELONG(FALSE,0) );
696           SendMessage(hToolBar,TB_CHECKBUTTON,
697           (WPARAM)ITC_NIFX,(LPARAM) MAKELONG(TRUE,0) );
698           }
699 
700         else MessageBox(NULL,"No Mode !","Z88X", MB_OK | MB_ICONHAND);
701 
702         InvalidateRect(hWnd,NULL,TRUE);
703       return 0;
704 
705 /*======================================================================
706 * COMMAND : Mode aus Toolbar
707 *=====================================================================*/
708       case ITC_I1TX:
709         ICFLAG = 1;
710         ifmode = IDM_I1TX;
711         InvalidateRect(hWnd,NULL,TRUE);
712       return 0;
713 
714       case ITC_IATX:
715         ICFLAG = 2;
716         ifmode = IDM_IATX;
717         InvalidateRect(hWnd,NULL,TRUE);
718       return 0;
719 
720       case ITC_NITX:
721         ICFLAG = 3;
722         ifmode = IDM_NITX;
723         InvalidateRect(hWnd,NULL,TRUE);
724       return 0;
725 
726       case ITC_I1FX:
727         ICFLAG = 4;
728         ifmode = IDM_I1FX;
729         InvalidateRect(hWnd,NULL,TRUE);
730       return 0;
731 
732       case ITC_IAFX:
733         ICFLAG = 5;
734         ifmode = IDM_IAFX;
735         InvalidateRect(hWnd,NULL,TRUE);
736       return 0;
737 
738       case ITC_NIFX:
739         ICFLAG = 6;
740         ifmode = IDM_NIFX;
741         InvalidateRect(hWnd,NULL,TRUE);
742       return 0;
743 
744 /*======================================================================
745 * COMMAND : Go
746 *=====================================================================*/
747       case IDM_GO:
748       case ITC_GO:
749         SetCursor(waitcur);
750         ShowCursor(TRUE);
751 
752         hDC= GetDC(hWnd);
753         hFont= EzCreateFont(hDC,"Times New Roman",120,0,2,TRUE);
754         SelectObject(hDC,hFont);
755         SetBkColor(hDC,RGB(255,255,255));
756 
757         laenge= strlen(comli);
758         TextOut(hDC,10,30,comli,laenge);
759 
760         if     (ICFLAG == 1) wlog88x(1L,LOG_CFLAGI1TX);
761         else if(ICFLAG == 2) wlog88x(2L,LOG_CFLAGIATX);
762         else if(ICFLAG == 3) wlog88x(3L,LOG_CFLAGNITX);
763         else if(ICFLAG == 4) wlog88x(4L,LOG_CFLAGI1FX);
764         else if(ICFLAG == 5) wlog88x(5L,LOG_CFLAGIAFX);
765         else if(ICFLAG == 6) wlog88x(6L,LOG_CFLAGNIFX);
766 
767 /*---------------------------------------------------------------------------
768 * Entscheiden, welcher Berechnungsgang
769 *--------------------------------------------------------------------------*/
770         if(ICFLAG == 1 || ICFLAG == 2)
771           {                            /* Start -I1TX oder -IATX */
772 
773 /*---------------------------------------------------------------------------
774 * Berechnungsgang 1: von Z88I1.TXT nach Z88X.DXF
775 * Berechnungsgang 2: von Z88I1.TXT, Z88I2.TXT, Z88I3.TXT nach Z88X.DXF
776 *--------------------------------------------------------------------------*/
777 /*===========================================================================
778 * Einlesen Z88I1.TXT
779 *==========================================================================*/
780           iret= rea88x();
781           if(iret != 0)
782             {
783             ale88x(iret);
784             PostQuitMessage(0);
785             return(0);
786             }
787 
788 /*===========================================================================
789 * Rechnen
790 *==========================================================================*/
791           iret= z88tx();
792           if(iret != 0)
793             {
794             ale88x(iret);
795             PostQuitMessage(0);
796             return(0);
797             }
798 
799           }                            /* Ende -I1TX und -IATX */
800 /*---------------------------------------------------------------------------
801 * Ende Berechnungsgang 1 und 2
802 *--------------------------------------------------------------------------*/
803 
804         if(ICFLAG == 3)
805           {                            /* Start -NITX */
806 
807 /*---------------------------------------------------------------------------
808 * Berechnungsgang 3: von Z88NI.TXT nach Z88X.DXF
809 *--------------------------------------------------------------------------*/
810 /*===========================================================================
811 * Einlesen Z88NI.TXT
812 *==========================================================================*/
813           iret= rea88x();
814           if(iret != 0)
815             {
816             ale88x(iret);
817             PostQuitMessage(0);
818             return(0);
819             }
820 
821 /*===========================================================================
822 * Rechnen
823 *==========================================================================*/
824           iret= z88tx();
825           if(iret != 0)
826             {
827             ale88x(iret);
828             PostQuitMessage(0);
829             return(0);
830             }
831 
832           }                            /* Ende -NITX */
833 /*---------------------------------------------------------------------------
834 * Ende Berechnungsgang 3
835 *--------------------------------------------------------------------------*/
836 
837         if(ICFLAG == 4 || ICFLAG == 5)
838           {                            /* Start -I1FX oder -IAFX */
839 
840 /*---------------------------------------------------------------------------
841 * Berechnungsgang 4: von Z88X.DXF nach Z88I1.TXT
842 * Berechnungsgang 5: von Z88X.DXF nach Z88I1.TXT, Z88I2.TXT, Z88I3.TXT
843 *--------------------------------------------------------------------------*/
844 /*===========================================================================
845 * Rechnen
846 *==========================================================================*/
847           iret= z88fx();
848           if(iret != 0)
849             {
850             ale88x(iret);
851             PostQuitMessage(0);
852             return(0);
853             }
854 
855           }                            /* Ende -I1FX oder -IAFX */
856 /*---------------------------------------------------------------------------
857 * Ende Berechnungsgang 4 und 5
858 *--------------------------------------------------------------------------*/
859 
860         if(ICFLAG == 6)
861           {                            /* Start -NIFX */
862 
863 /*---------------------------------------------------------------------------
864 * Berechnungsgang 6: von Z88X.DXF nach Z88NI.TXT
865 *--------------------------------------------------------------------------*/
866 /*===========================================================================
867 * Rechnen
868 *==========================================================================*/
869           iret= z88fx();
870           if(iret != 0)
871             {
872             ale88x(iret);
873             PostQuitMessage(0);
874             return(0);
875             }
876 
877           }                            /* Ende -NIFX */
878 /*---------------------------------------------------------------------------
879 * Ende Berechnungsgang 6
880 * und Ende Case Go
881 *--------------------------------------------------------------------------*/
882         ReleaseDC(hWnd,hDC);
883         SetCursor(LoadCursor(NULL,IDC_ARROW));
884         if(LANG == 1) strcpy(cmess,"DXF-Converter Z88X gelaufen");
885         if(LANG == 2) strcpy(cmess,"DXF Coverter Z88X done");
886         MessageBox(NULL,cmess,"Z88X", MB_OK | MB_ICONINFORMATION);
887         PostQuitMessage(0);
888       return 0;                           /* end case GO */
889 
890       default:
891         return DefWindowProc(hWnd, Message, wParam, lParam);
892       }                                /* end switch command */
893 
894 /*----------------------------------------------------------------------
895 * case WM_PAINT
896 *---------------------------------------------------------------------*/
897   case WM_PAINT:
898     memset(&ps, 0x00, sizeof(PAINTSTRUCT));
899     hDC = BeginPaint(hWnd, &ps);
900 
901     SetBkMode(hDC, TRANSPARENT);
902 
903     EndPaint(hWnd, &ps);
904   return 0;
905 
906 /*----------------------------------------------------------------------
907 * case WM_CLOSE
908 *---------------------------------------------------------------------*/
909   case WM_CLOSE:
910     PostQuitMessage(0);
911   return 0;
912 
913 /*----------------------------------------------------------------------
914 * case WM_DESTROY
915 *---------------------------------------------------------------------*/
916   case WM_DESTROY:
917     PostQuitMessage(0);
918   return 0;
919 
920   default:
921     return DefWindowProc(hWnd, Message, wParam, lParam);
922   }
923 }
924 
925 /*****************************************************************************
926 * Function TextSDiaProc zeigt Dialog- Box fuer Textsize an
927 *****************************************************************************/
TextSDiaProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)928 BOOL CALLBACK TextSDiaProc(HWND hDlg, UINT message,
929                            WPARAM wParam, LPARAM lParam)
930 {
931 extern double texts;
932 
933 int  idigit= 20;
934 
935 char ctexts[31];
936 
937 /*---------------------------------------------------------------------------
938 * beim allerersten Start geht texts mit 1. rein
939 *--------------------------------------------------------------------------*/
940 gcvt(texts,idigit,ctexts);
941 
942 switch (message)
943   {
944   case WM_INITDIALOG:
945     SetDlgItemText(hDlg,IDDLG_V_TEXT,ctexts);
946   return(TRUE);
947 
948   case WM_COMMAND:
949     switch (LOWORD(wParam))
950       {
951       case IDOK:
952         GetDlgItemText(hDlg,IDDLG_V_TEXT,ctexts,30);
953         texts= (double) atof(ctexts);
954         ITSFLAG= 1;
955         EndDialog(hDlg,0);
956       return TRUE;
957 
958       case IDCANCEL:
959         EndDialog(hDlg,0);
960       return TRUE;
961       }
962   }
963 return FALSE;
964 }
965 
966