• R/O
  • SSH

wp2latex: Commit

WP2LaTeX sources.


Commit MetaInfo

Revisiona8149bf544781d002782b2021710e7c8dc9b5ce9 (tree)
Zeit2022-08-21 07:02:43
AutorFojtik
CommiterFojtik

Log Message

SaveDC and RestoreDC should work in WMF and also EMF.

Ändern Zusammenfassung

Diff

diff -r 6d09b5fe1058 -r a8149bf54478 trunk/msvc/wp2latex.vcproj
--- a/trunk/msvc/wp2latex.vcproj Sat Aug 20 12:13:59 2022 +0200
+++ b/trunk/msvc/wp2latex.vcproj Sun Aug 21 00:02:43 2022 +0200
@@ -1858,6 +1858,10 @@
18581858 </FileConfiguration>
18591859 </File>
18601860 <File
1861+ RelativePath="..\sources.cc\wmfsupp.cc"
1862+ >
1863+ </File>
1864+ <File
18611865 RelativePath="..\sources.cc\wp2l_lib.cc"
18621866 >
18631867 </File>
@@ -2699,7 +2703,6 @@
26992703 </FileConfiguration>
27002704 <FileConfiguration
27012705 Name="Release|Win32"
2702- ExcludedFromBuild="true"
27032706 >
27042707 <Tool
27052708 Name="VCCLCompilerTool"
@@ -2708,7 +2711,6 @@
27082711 </FileConfiguration>
27092712 <FileConfiguration
27102713 Name="Release|x64"
2711- ExcludedFromBuild="true"
27122714 >
27132715 <Tool
27142716 Name="VCCLCompilerTool"
diff -r 6d09b5fe1058 -r a8149bf54478 trunk/sources.cc/images/vecimage.h
--- a/trunk/sources.cc/images/vecimage.h Sat Aug 20 12:13:59 2022 +0200
+++ b/trunk/sources.cc/images/vecimage.h Sun Aug 21 00:02:43 2022 +0200
@@ -172,6 +172,7 @@
172172 public:
173173 void AddRef(void) {RefCounter++;}
174174 void Release(void) {if(--RefCounter<=0) delete this;}
175+ int getRefCounter(void) const {return RefCounter;}
175176
176177 VectorAttribute() {RefCounter=1;}
177178 virtual ~VectorAttribute() {}
diff -r 6d09b5fe1058 -r a8149bf54478 trunk/sources.cc/makefile
--- a/trunk/sources.cc/makefile Sat Aug 20 12:13:59 2022 +0200
+++ b/trunk/sources.cc/makefile Sun Aug 21 00:02:43 2022 +0200
@@ -118,6 +118,7 @@
118118
119119 #mandatory components
120120 OBJECTS+=wp2latex$(OBJ) wp2l_lib$(OBJ) pass1$(OBJ) pass2$(OBJ) wp2lfuti$(OBJ) formulas$(OBJ) images$(OBJ) charactr$(OBJ) $(IGETTEXTOBJ)
121+OBJECTS+=wmfsupp$(OBJ)
121122
122123
123124 OBJECTS+=word/bintree$(OBJ)
diff -r 6d09b5fe1058 -r a8149bf54478 trunk/sources.cc/makefile.gen
--- a/trunk/sources.cc/makefile.gen Sat Aug 20 12:13:59 2022 +0200
+++ b/trunk/sources.cc/makefile.gen Sun Aug 21 00:02:43 2022 +0200
@@ -118,6 +118,7 @@
118118
119119 #mandatory components
120120 OBJECTS+=wp2latex$(OBJ) wp2l_lib$(OBJ) pass1$(OBJ) pass2$(OBJ) wp2lfuti$(OBJ) formulas$(OBJ) images$(OBJ) charactr$(OBJ) $(IGETTEXTOBJ)
121+OBJECTS+=wmfsupp$(OBJ)
121122
122123
123124 OBJECTS+=word/bintree$(OBJ)
diff -r 6d09b5fe1058 -r a8149bf54478 trunk/sources.cc/makefile.in
--- a/trunk/sources.cc/makefile.in Sat Aug 20 12:13:59 2022 +0200
+++ b/trunk/sources.cc/makefile.in Sun Aug 21 00:02:43 2022 +0200
@@ -102,6 +102,7 @@
102102
103103 #mandatory components
104104 OBJECTS+=wp2latex$(OBJ) wp2l_lib$(OBJ) pass1$(OBJ) pass2$(OBJ) wp2lfuti$(OBJ) formulas$(OBJ) images$(OBJ) charactr$(OBJ)
105+OBJECTS+=wmfsupp$(OBJ)
105106
106107
107108 OBJECTS+=word/bintree$(OBJ)
diff -r 6d09b5fe1058 -r a8149bf54478 trunk/sources.cc/pass1wmf.cc
--- a/trunk/sources.cc/pass1wmf.cc Sat Aug 20 12:13:59 2022 +0200
+++ b/trunk/sources.cc/pass1wmf.cc Sun Aug 21 00:02:43 2022 +0200
@@ -11,15 +11,8 @@
1111 #include <string.h>
1212 #include <stdio.h>
1313 #include <stdlib.h>
14+#define _USE_MATH_DEFINES
1415 #include <math.h>
15-#ifndef M_PI
16- #define M_PI 3.14159265358979323846
17-#endif
18-
19-#ifndef MAX
20- #define MAX(value1,value2) ((value1 > value2) ? value1 : value2)
21-#endif
22-
2316
2417 //Atoms library
2518 #include "stringa.h"
@@ -31,6 +24,17 @@
3124 #include "images.h"
3225 #include "cp_lib/cptran.h"
3326
27+#include "wmfsupp.h"
28+
29+
30+#ifndef M_PI
31+ #define M_PI 3.14159265358979323846
32+#endif
33+
34+#ifndef MAX
35+ #define MAX(value1,value2) ((value1 > value2) ? value1 : value2)
36+#endif
37+
3438
3539 void WMF_STRETCHDIB(Image &Img, FILE *f, DWORD ParamFilePos);
3640 void WMF_DIBSTRETCHBLT(Image &Img, FILE *f, DWORD ParamFilePos);
@@ -114,18 +118,6 @@
114118 } HatchStyle;
115119
116120
117-typedef enum
118-{
119- MM_TEXT = 0x0001,
120- MM_LOMETRIC = 0x0002,
121- MM_HIMETRIC = 0x0003,
122- MM_LOENGLISH = 0x0004,
123- MM_HIENGLISH = 0x0005,
124- MM_TWIPS = 0x0006,
125- MM_ISOTROPIC = 0x0007,
126- MM_ANISOTROPIC = 0x0008
127-} TMapMode;
128-
129121 /// Get scalling factor for a given map mode.
130122 /// @return Scalling factor.
131123 float GetScale2PSU(const TMapMode MapM)
@@ -145,17 +137,7 @@
145137 }
146138
147139
148-/** This functor class is used for flipping image data. */
149-class vFlip: public AbstractTransformXY
150-{
151-public:
152- vFlip(float Top, float Bottom) {TopPBottom=Top+Bottom;}
153-
154- virtual void ApplyTransform(float &x, float &y) const {y = -y+TopPBottom;}
155-
156- float TopPBottom;
157-};
158-
140+////////////////////////////////////////////////
159141
160142
161143 typedef struct _StandardMetaRecord
@@ -167,196 +149,6 @@
167149 } WMFRECORD;
168150
169151
170-class ObjectTable
171-{
172-public:
173- VectorAttribute **Attributes;
174- unsigned Count;
175-
176- ObjectTable() {Count=0; Attributes=NULL;}
177- ObjectTable(ObjectTable &OT);
178- ~ObjectTable();
179-
180- void AddObject(VectorAttribute *NewAttr);
181- void DeleteObject(unsigned ObjectIndex);
182- const VectorAttribute *GetObjectAt(unsigned ObjectIndex) const;
183-};
184-
185-
186-ObjectTable::ObjectTable(ObjectTable &OT)
187-{
188- if(OT.Count==0 || OT.Attributes==NULL)
189- {
190- Attributes = NULL;
191-AllocationError:
192- Count = 0;
193- return;
194- }
195- Attributes = (VectorAttribute**)malloc(OT.Count*sizeof(VectorAttribute*));
196- if(Attributes==NULL) goto AllocationError;
197- for(Count=0; Count<OT.Count; Count++)
198- {
199- Attributes[Count] = OT.Attributes[Count];
200- if(Attributes[Count]!=NULL) Attributes[Count]->AddRef();
201- }
202-}
203-
204-
205-ObjectTable::~ObjectTable()
206-{
207- if(Count>0)
208- {
209- if(Attributes!=NULL)
210- {
211- for(unsigned i=0; i<Count; i++)
212- {
213- Attributes[i]->Release();
214- Attributes[i] = NULL;
215- }
216- free(Attributes);
217- Attributes = NULL;
218- }
219- Count = 0;
220- }
221-}
222-
223-
224-void ObjectTable::AddObject(VectorAttribute *NewAttr)
225-{
226- if(NewAttr==NULL) return;
227-
228- if(Attributes==NULL || Count<=0)
229- {
230- Attributes = (VectorAttribute**)malloc(sizeof(VectorAttribute*));
231- if(Attributes==NULL)
232- {
233- NewAttr->Release();
234- return;
235- }
236- Attributes[0] = NewAttr;
237- Count = 1;
238- return;
239- }
240-
241- for(unsigned i=0; i<Count; i++)
242- {
243- if(Attributes[i]==NULL)
244- {
245- Attributes[i] = NewAttr;
246- return;
247- }
248- }
249-
250- Count++;
251- VectorAttribute **tmp = (VectorAttribute**)realloc(Attributes, Count*sizeof(VectorAttribute*));
252- if(tmp==NULL) // memory exhausted, but Attributes contains original array.
253- {ReportNoMemory();return;}
254- Attributes = tmp;
255- Attributes[Count-1] = NewAttr;
256-}
257-
258-
259-void ObjectTable::DeleteObject(unsigned ObjectIndex)
260-{
261- if(ObjectIndex>=Count || Attributes==NULL) return;
262- Attributes[ObjectIndex]->Release();
263- Attributes[ObjectIndex] = NULL;
264-}
265-
266-
267-const VectorAttribute *ObjectTable::GetObjectAt(unsigned ObjectIndex) const
268-{
269- if(ObjectIndex>=Count || Attributes==NULL) return NULL;
270- return Attributes[ObjectIndex];
271-}
272-
273-
274-////////////////////////////////////////////////
275-
276-class TconvertedPass1_xMF: public TconvertedPass1
277-{
278-protected:
279- int NoConvertImage;
280-
281-public:
282- TconvertedPass1_xMF(void);
283- void PutImageIncluder(const char *NewFilename);
284- void PleaseReport(const char *Feature) {TconvertedPass1::PleaseReport(Feature,"WMF");}
285-
286- SWORD YOffset, XOffset;
287- SWORD YExtent, XExtent;
288-
289- Image Img;
290- WORD MapMode;
291- char MixMode;
292- FloatBBox bbx;
293- PS_State PSS;
294- string PSData;
295- ObjectTable ObjTab;
296- CpTranslator *PsNativeCP;
297- CpTranslator *PsNativeSym;
298-};
299-
300-
301-TconvertedPass1_xMF::TconvertedPass1_xMF(void)
302-{
303- MixMode = 1; // Transparent
304- NoConvertImage = 0;
305- YOffset = XOffset = 0;
306- YExtent = XExtent = 0;
307- InitBBox(bbx);
308- // PSS has its own CTOR.
309- PSS.FillPattern = FILL_SOLID;
310- PSS.FontSizeW = PSS.FontSize = 1100/2.66; // Default font size [mm]
311- MapMode = MM_ANISOTROPIC;
312- PsNativeCP = GetTranslator("internalTOcp1276");
313- PsNativeSym = GetTranslator("internalTOsymbol");
314-}
315-
316-
317-void TconvertedPass1_xMF::PutImageIncluder(const char *NewFilename)
318-{
319- if(InputPS & IMG_graphicx) //graphicx.sty
320- {
321- fprintf(strip," \\begin{center}");
322- fprintf(strip,"\\includegraphics");
323- fprintf(strip,"[width=\\textwidth]");
324- fprintf(strip,"{\\FigDir/%s.eps}",NewFilename);
325- fprintf(strip," \\end{center}");
326- putc('\n',strip); rownum++;
327- }
328- else if(InputPS & IMG_epsfig) //epsfig.sty
329- {
330- fprintf(strip," \\begin{center}");
331- fprintf(strip,"\\epsfig{file=\\FigDir/%s.eps,",NewFilename);
332- fprintf(strip,"width=\\textwidth");
333- putc('}',strip);
334- fprintf(strip," \\end{center}");
335- putc('\n',strip); rownum++;
336- }
337- else if(InputPS & IMG_graphics) //graphics.sty
338- {
339- fprintf(strip," \\begin{center}");
340- fprintf(strip,"\\includegraphics");
341- fprintf(strip,"{\\FigDir/%s.eps}",NewFilename);
342- fprintf(strip," \\end{center}");
343- putc('\n',strip); rownum++;
344- }
345- else //InputPS.sty
346- {
347- fprintf(strip,"\\begin{forcewidth}");
348- fprintf(strip,"{\\textwidth}\n"); rownum++;
349- fprintf(strip," \\begin{center}");
350- fprintf(strip,"\\InputPS{\\FigDir/%s.eps}",NewFilename);
351- putc('\n',strip); rownum++;
352- fprintf(strip," \\end{center}");
353- putc('\n',strip); rownum++;
354- fprintf(strip,"\\end{forcewidth}\n"); rownum++;
355- }
356-}
357-
358-
359-////////////////////////////////////////////////
360152
361153 class TconvertedPass1_WMF: public TconvertedPass1_xMF
362154 {
@@ -393,7 +185,9 @@
393185 void wmf_ESCAPE(void);
394186 void parse_ExtTextOut(VectorList &VectList);
395187 void parse_Rectangle(VectorList &VectList);
188+ void parse_RestoreDC(void);
396189 void parse_RoundRect(VectorList &VectList);
190+ void parse_SaveDC(void);
397191 void parse_SelectObject(void);
398192 void parse_SelectPalette(void);
399193 void parse_SetPixel(VectorList &VectList);
@@ -1266,6 +1060,30 @@
12661060 }
12671061
12681062
1063+void TconvertedPass1_WMF::parse_SaveDC(void)
1064+{
1065+#ifdef DEBUG
1066+ fprintf(log,"\n#TconvertedPass1_WMF::parse_SaveDC() ");fflush(log);
1067+#endif
1068+static const char ObjName[] = "!SaveDC";
1069+
1070+ PushDC();
1071+ strcpy(ObjType,ObjName+1);
1072+}
1073+
1074+
1075+void TconvertedPass1_WMF::parse_RestoreDC(void)
1076+{
1077+#ifdef DEBUG
1078+ fprintf(log,"\n#TconvertedPass1_WMF::parse_RestoreDC() ");fflush(log);
1079+#endif
1080+static const char ObjName[] = "!RestoreDC";
1081+
1082+ PopDC();
1083+ strcpy(ObjType,ObjName+1);
1084+}
1085+
1086+
12691087 void TconvertedPass1_WMF::parse_SetWindowExt(void)
12701088 {
12711089 #ifdef DEBUG
@@ -1872,7 +1690,7 @@
18721690 {
18731691 case 0x0000: strcpy(ObjType,"WMF End"); break;
18741692
1875- case 0x001E: strcpy(ObjType,"!SaveDC"); break; //?
1693+ case 0x001E: parse_SaveDC(); break;
18761694
18771695 case 0x0035: strcpy(ObjType,"!RealizePalette"); break;
18781696 case 0x0037: strcpy(ObjType,"!SetPalEntries"); break;
@@ -1894,7 +1712,7 @@
18941712 case 0x0107: strcpy(ObjType,"!SetStretchBltMode"); break;
18951713 case 0x0108: strcpy(ObjType,"!SetTextCharExtra"); break;
18961714
1897- case 0x0127: strcpy(ObjType,"!RestoreDC"); break;
1715+ case 0x0127: parse_RestoreDC(); break;
18981716
18991717 case 0x012A: strcpy(ObjType,"!InvertRegion"); break;
19001718 case 0x012B: strcpy(ObjType,"!PaintRegion"); break;
@@ -2079,8 +1897,8 @@
20791897 if(YExtent>=0)
20801898 VectList.Transform(flipTrx);
20811899
2082- if(PSData.length() > 0)
2083- VectList.AddObject(new PsBlob(PSData.ExtractString()));
1900+ //if(PSData.length() > 0)
1901+ // VectList.AddObject(new PsBlob(PSData.ExtractString()));
20841902
20851903 if(VectList.VectorObjects>0 && Img.VecImage==NULL)
20861904 {
@@ -2287,6 +2105,7 @@
22872105 void parse_PolyPolygon16(VectorList &VectList);
22882106 void parse_PolyPolyLine16(VectorList &VectList);
22892107 void parse_Rectangle(VectorList &VectList);
2108+ void parse_RestoreDC(void);
22902109 void parse_SaveDC(void);
22912110 void parse_SelectObject(void);
22922111 void parse_SelectPalette(void);
@@ -3748,7 +3567,26 @@
37483567 return;
37493568 }
37503569
3751- strcpy(ObjType,ObjName);
3570+ PushDC();
3571+ strcpy(ObjType,ObjName+1);
3572+}
3573+
3574+
3575+void TconvertedPass1_EMF::parse_RestoreDC(void)
3576+{
3577+#ifdef DEBUG
3578+ fprintf(log,"\n#TconvertedPass1_EMF::parse_RestoreDC() ");fflush(log);
3579+#endif
3580+static const char ObjName[] = "!RESTOREDC";
3581+
3582+ if(EmfRec.Size < 8)
3583+ {
3584+ strcpy(ObjType,ObjName);
3585+ return;
3586+ }
3587+
3588+ PopDC();
3589+ strcpy(ObjType,ObjName+1);
37523590 }
37533591
37543592
@@ -3981,7 +3819,7 @@
39813819 case EMR_SCALEVIEWPORTEXTEX: strcpy(ObjType,"!SCALEVIEWPORTEXTEX"); break; // 0x0000001F
39823820 case EMR_SCALEWINDOWEXTEX: strcpy(ObjType,"!SCALEWINDOWEXTEX"); break; // 0x00000020
39833821 case EMR_SAVEDC: parse_SaveDC(); break; // 0x00000021
3984- case EMR_RESTOREDC: strcpy(ObjType,"!RESTOREDC"); break; // 0x00000022
3822+ case EMR_RESTOREDC: parse_RestoreDC(); break; // 0x00000022
39853823 case EMR_SETWORLDTRANSFORM: parse_SetWorldTransform(); break; // 0x00000023
39863824 case EMR_MODIFYWORLDTRANSFORM: parse_ModifyWorldTransform(); break; // 0x00000024
39873825 case EMR_SELECTOBJECT: parse_SelectObject(); break; // 0x00000025
@@ -4118,8 +3956,8 @@
41183956 if(YExtent>=0)
41193957 VectList.Transform(flipTrx);
41203958
4121- if(PSData.length() > 0)
4122- VectList.AddObject(new PsBlob(PSData.ExtractString()));
3959+ //if(PSData.length() > 0)
3960+ // VectList.AddObject(new PsBlob(PSData.ExtractString()));
41233961
41243962 if(VectList.VectorObjects>0 && Img.VecImage==NULL)
41253963 {
diff -r 6d09b5fe1058 -r a8149bf54478 trunk/sources.cc/wmfsupp.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/sources.cc/wmfsupp.cc Sun Aug 21 00:02:43 2022 +0200
@@ -0,0 +1,248 @@
1+#include <string.h>
2+#include <stdio.h>
3+#include <stdlib.h>
4+
5+//Atoms library
6+#include "stringa.h"
7+
8+#include "wp2latex.h"
9+#include "images/raster.h"
10+#include "images/vecimage.h"
11+#include "images.h"
12+#include "cp_lib/cptran.h"
13+
14+#include "wmfsupp.h"
15+
16+
17+DeviceContext_xMF & DeviceContext_xMF::operator=(const DeviceContext_xMF & BaseDC)
18+{
19+ PSS = BaseDC.PSS;
20+ MapMode = BaseDC.MapMode;
21+ MixMode = BaseDC.MixMode;
22+return *this;
23+}
24+
25+
26+////////////////////////////////////////////////
27+
28+
29+ObjectTable::ObjectTable(const ObjectTable &OT)
30+{
31+ if(OT.Count==0 || OT.Attributes==NULL)
32+ {
33+ Attributes = NULL;
34+AllocationError:
35+ Count = 0;
36+ return;
37+ }
38+ Attributes = (VectorAttribute**)malloc(OT.Count*sizeof(VectorAttribute*));
39+ if(Attributes==NULL) goto AllocationError;
40+ for(Count=0; Count<OT.Count; Count++)
41+ {
42+ Attributes[Count] = OT.Attributes[Count];
43+ if(Attributes[Count]!=NULL) Attributes[Count]->AddRef();
44+ }
45+}
46+
47+
48+ObjectTable::~ObjectTable()
49+{
50+ Erase();
51+}
52+
53+void ObjectTable::Erase(void)
54+{
55+ if(Count>0)
56+ {
57+ if(Attributes!=NULL)
58+ {
59+ for(unsigned i=0; i<Count; i++)
60+ {
61+ if(Attributes[i] != NULL)
62+ {
63+ Attributes[i]->Release();
64+ Attributes[i] = NULL;
65+ }
66+ }
67+ free(Attributes);
68+ Attributes = NULL;
69+ }
70+ Count = 0;
71+ }
72+}
73+
74+
75+ObjectTable &ObjectTable::operator=(const ObjectTable &OT)
76+{
77+ if(&OT==this) return *this;
78+
79+ Erase();
80+ if(OT.Count==0 || OT.Attributes==NULL) return *this;
81+
82+ Attributes = (VectorAttribute**)malloc(OT.Count*sizeof(VectorAttribute*));
83+ if(Attributes==NULL) return *this;
84+ for(Count=0; Count<OT.Count; Count++)
85+ {
86+ Attributes[Count] = OT.Attributes[Count];
87+ if(Attributes[Count]!=NULL) Attributes[Count]->AddRef();
88+ }
89+return *this;
90+}
91+
92+
93+void ObjectTable::AddObject(VectorAttribute *NewAttr)
94+{
95+ if(NewAttr==NULL) return;
96+
97+ if(Attributes==NULL || Count<=0)
98+ {
99+ Attributes = (VectorAttribute**)malloc(sizeof(VectorAttribute*));
100+ if(Attributes==NULL)
101+ {
102+ ReportNoMemory();
103+ NewAttr->Release();
104+ return;
105+ }
106+ Attributes[0] = NewAttr;
107+ Count = 1;
108+ //printf("\nAdded object at index #%u, ref count %u", 0, NewAttr->getRefCounter());
109+ return;
110+ }
111+
112+ for(unsigned i=0; i<Count; i++)
113+ {
114+ if(Attributes[i]==NULL)
115+ {
116+ Attributes[i] = NewAttr;
117+ //printf("\nAdded object at index #%u, ref count %u", i, NewAttr->getRefCounter());
118+ return;
119+ }
120+ }
121+
122+ Count++;
123+ VectorAttribute **tmp = (VectorAttribute**)realloc(Attributes, Count*sizeof(VectorAttribute*));
124+ if(tmp==NULL) // memory exhausted, but Attributes contains original array.
125+ {ReportNoMemory();NewAttr->Release();return;}
126+ Attributes = tmp;
127+ Attributes[Count-1] = NewAttr;
128+ //printf("\nAdded object at index #%u, ref count %u", Count-1, NewAttr->getRefCounter());
129+}
130+
131+
132+void ObjectTable::DeleteObject(unsigned ObjectIndex)
133+{
134+ if(ObjectIndex>=Count || Attributes==NULL) return;
135+ if(Attributes[ObjectIndex]!=NULL)
136+ {
137+ //printf("\nDeleted object at index #%u, ref count %u", ObjectIndex, Attributes[ObjectIndex]->getRefCounter());
138+ Attributes[ObjectIndex]->Release();
139+ Attributes[ObjectIndex] = NULL;
140+ }
141+}
142+
143+
144+const VectorAttribute *ObjectTable::GetObjectAt(unsigned ObjectIndex) const
145+{
146+ if(ObjectIndex>=Count || Attributes==NULL) return NULL;
147+ return Attributes[ObjectIndex];
148+}
149+
150+
151+////////////////////////////////////////////////
152+
153+
154+TconvertedPass1_xMF::TconvertedPass1_xMF(void)
155+{
156+ NoConvertImage = 0;
157+ YOffset = XOffset = 0;
158+ YExtent = XExtent = 0;
159+ InitBBox(bbx);
160+ // PSS has its own CTOR.
161+ PSS.FillPattern = FILL_SOLID;
162+ PSS.FontSizeW = PSS.FontSize = 1100/2.66; // Default font size [mm]
163+ PsNativeCP = GetTranslator("internalTOcp1276");
164+ PsNativeSym = GetTranslator("internalTOsymbol");
165+
166+ DcList = NULL;
167+}
168+
169+
170+TconvertedPass1_xMF::~TconvertedPass1_xMF()
171+{
172+ while(DcList != NULL)
173+ {
174+ DeviceContextList *pOldDC = DcList;
175+ DcList = pOldDC->Next;
176+ delete pOldDC;
177+ }
178+}
179+
180+
181+void TconvertedPass1_xMF::PutImageIncluder(const char *NewFilename)
182+{
183+ if(InputPS & IMG_graphicx) //graphicx.sty
184+ {
185+ fprintf(strip," \\begin{center}");
186+ fprintf(strip,"\\includegraphics");
187+ fprintf(strip,"[width=\\textwidth]");
188+ fprintf(strip,"{\\FigDir/%s.eps}",NewFilename);
189+ fprintf(strip," \\end{center}");
190+ putc('\n',strip); rownum++;
191+ }
192+ else if(InputPS & IMG_epsfig) //epsfig.sty
193+ {
194+ fprintf(strip," \\begin{center}");
195+ fprintf(strip,"\\epsfig{file=\\FigDir/%s.eps,",NewFilename);
196+ fprintf(strip,"width=\\textwidth");
197+ putc('}',strip);
198+ fprintf(strip," \\end{center}");
199+ putc('\n',strip); rownum++;
200+ }
201+ else if(InputPS & IMG_graphics) //graphics.sty
202+ {
203+ fprintf(strip," \\begin{center}");
204+ fprintf(strip,"\\includegraphics");
205+ fprintf(strip,"{\\FigDir/%s.eps}",NewFilename);
206+ fprintf(strip," \\end{center}");
207+ putc('\n',strip); rownum++;
208+ }
209+ else //InputPS.sty
210+ {
211+ fprintf(strip,"\\begin{forcewidth}");
212+ fprintf(strip,"{\\textwidth}\n"); rownum++;
213+ fprintf(strip," \\begin{center}");
214+ fprintf(strip,"\\InputPS{\\FigDir/%s.eps}",NewFilename);
215+ putc('\n',strip); rownum++;
216+ fprintf(strip," \\end{center}");
217+ putc('\n',strip); rownum++;
218+ fprintf(strip,"\\end{forcewidth}\n"); rownum++;
219+ }
220+}
221+
222+
223+void TconvertedPass1_xMF::PushDC(void)
224+{
225+DeviceContextList *pNewDC = new DeviceContextList(*this);
226+ pNewDC->Next = DcList;
227+ DcList = pNewDC;
228+}
229+
230+
231+void TconvertedPass1_xMF::PopDC(void)
232+{
233+DeviceContextList *pOldDC = DcList;
234+ if(pOldDC != NULL)
235+ {
236+ DcList = pOldDC->Next;
237+
238+ *(DeviceContext_xMF*)this = *pOldDC;
239+ delete pOldDC;
240+ }
241+ else
242+ {
243+ if(err != NULL)
244+ fprintf(err, _("\nError: DC stack is empty."));
245+ }
246+}
247+
248+
diff -r 6d09b5fe1058 -r a8149bf54478 trunk/sources.cc/wmfsupp.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/sources.cc/wmfsupp.h Sun Aug 21 00:02:43 2022 +0200
@@ -0,0 +1,110 @@
1+#ifndef __WMF_SUPPORT_H__
2+#define __WMF_SUPPORT_H__
3+
4+
5+/** This functor class is used for flipping image data. */
6+class vFlip: public AbstractTransformXY
7+{
8+public:
9+ vFlip(float Top, float Bottom) {TopPBottom=Top+Bottom;}
10+
11+ virtual void ApplyTransform(float &x, float &y) const {y = -y+TopPBottom;}
12+
13+ float TopPBottom;
14+};
15+
16+
17+////////////////////////////////////////////////
18+
19+
20+class ObjectTable
21+{
22+public:
23+ VectorAttribute **Attributes;
24+ unsigned Count;
25+
26+ ObjectTable() {Count=0; Attributes=NULL;}
27+ ObjectTable(const ObjectTable &OT);
28+ ~ObjectTable();
29+ ObjectTable &operator=(const ObjectTable &OT);
30+
31+ void Erase(void);
32+ void AddObject(VectorAttribute *NewAttr);
33+ void DeleteObject(unsigned ObjectIndex);
34+ const VectorAttribute *GetObjectAt(unsigned ObjectIndex) const;
35+};
36+
37+
38+////////////////////////////////////////////////
39+
40+
41+typedef enum
42+{
43+ MM_TEXT = 0x0001,
44+ MM_LOMETRIC = 0x0002,
45+ MM_HIMETRIC = 0x0003,
46+ MM_LOENGLISH = 0x0004,
47+ MM_HIENGLISH = 0x0005,
48+ MM_TWIPS = 0x0006,
49+ MM_ISOTROPIC = 0x0007,
50+ MM_ANISOTROPIC = 0x0008
51+} TMapMode;
52+
53+
54+/** Device context: A collection of properties and objects that defines a dynamic environment for
55+processes on a device. For graphics output, properties include brush style, line style, text layout,
56+foreground and background colors, and mapping mode; and objects include a brush, pen, font,
57+palette, region, and transform matrix. Multiple device contexts can exist simultaneously, but a
58+single device context specifies the environment for graphics output at a particular point in time. */
59+class DeviceContext_xMF
60+{
61+public:
62+ DeviceContext_xMF(const DeviceContext_xMF & BaseDC) {PSS=BaseDC.PSS; MapMode=BaseDC.MapMode; MixMode=BaseDC.MixMode;}
63+ DeviceContext_xMF() {MapMode=MM_ANISOTROPIC; MixMode=1;/*Transparent*/}
64+ DeviceContext_xMF &operator=(const DeviceContext_xMF & BaseDC);
65+
66+ PS_State PSS;
67+ WORD MapMode;
68+ char MixMode;
69+};
70+
71+
72+class DeviceContextList: public DeviceContext_xMF
73+{
74+public:
75+ DeviceContextList(): DeviceContext_xMF() {Next=NULL;}
76+ DeviceContextList(const DeviceContext_xMF & BaseDC): DeviceContext_xMF(BaseDC) {Next=NULL;}
77+
78+ DeviceContextList *Next;
79+};
80+
81+
82+class TconvertedPass1_xMF: public TconvertedPass1, public DeviceContext_xMF
83+{
84+protected:
85+ int NoConvertImage;
86+
87+public:
88+ TconvertedPass1_xMF(void);
89+ ~TconvertedPass1_xMF();
90+
91+ void PutImageIncluder(const char *NewFilename);
92+ void PleaseReport(const char *Feature) {TconvertedPass1::PleaseReport(Feature,"WMF");}
93+ void PushDC(void);
94+ void PopDC(void);
95+
96+ SWORD YOffset, XOffset;
97+ SWORD YExtent, XExtent;
98+
99+ Image Img;
100+ FloatBBox bbx;
101+ const CpTranslator *PsNativeCP;
102+ const CpTranslator *PsNativeSym;
103+
104+ ObjectTable ObjTab;
105+ DeviceContextList *DcList;
106+};
107+
108+
109+
110+#endif
diff -r 6d09b5fe1058 -r a8149bf54478 trunk/sources.cc/wp2latex.h
--- a/trunk/sources.cc/wp2latex.h Sat Aug 20 12:13:59 2022 +0200
+++ b/trunk/sources.cc/wp2latex.h Sun Aug 21 00:02:43 2022 +0200
@@ -17,8 +17,8 @@
1717
1818 #define LineLength 80 /* Split lines after more than LineLength charcters */
1919
20-#define VersionWP2L "3.108"
21-#define VersionDate "5 Jul 2022" /* day (space) month (space) full year */
20+#define VersionWP2L "3.pre109"
21+#define VersionDate "20 Aug 2022" /* day (space) month (space) full year */
2222
2323
2424 /* Constants for a flag InputPS */
Show on old repository browser