From 8681e2c68ce1a7cbc4f4c22ed8cbf8f12fd47632 Mon Sep 17 00:00:00 2001 From: Jos Groot Lipman Date: Wed, 9 Sep 2020 19:49:58 +0000 Subject: [PATCH] =?UTF-8?q?Betere=20co=C3=B6rdinaten=20markers=20in=20fac?= =?UTF-8?q?=5Fverify=20Font=20ook=20resetten=20voor=20allereerste=20symboo?= =?UTF-8?q?l=20Symbolen=20commentaar=20iets=20duidelijker=20in=20ASCII=20d?= =?UTF-8?q?wf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/Slnkdwf/trunk/; revision=48107 --- SlnkDWFCom/SLNKSymbolImpl.cpp | 18 ++++++++++++++-- SlnkDWFCom/WhipFile.cpp | 8 ++++++- SlnkDWFImpl/Whip2DCImpl.cpp | 40 ++++++++++++----------------------- 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/SlnkDWFCom/SLNKSymbolImpl.cpp b/SlnkDWFCom/SLNKSymbolImpl.cpp index a413203..85d8884 100644 --- a/SlnkDWFCom/SLNKSymbolImpl.cpp +++ b/SlnkDWFCom/SLNKSymbolImpl.cpp @@ -36,6 +36,20 @@ WT_Result CSLNKSymbolImpl::serialize (WT_File & file, WT_Units & units, { ATLASSERT(symbdef != NULL); + WT_Color().serialize(file); // Op de default zetten. + file.desired_rendition().color() = file.rendition().color() = WT_Color(); + + WT_Fill().serialize(file); // Ook op de default zetten. + file.desired_rendition().fill() = file.rendition().fill() = WT_Fill(); + + WT_Font default_font; + default_font.width_scale() = 0; // Triggert FONT_WIDTH_SCALE_BIT bitje zetten + default_font.rotation() = 0; + default_font.height() = 0; + default_font.flags() = 0; + default_font.serialize(file); // Op de default zetten. + file.desired_rendition().font() = file.rendition().font() = default_font; + WT_Point3D insertion(m_dwgX, m_dwgY); if (symbdef->m_hasBitmap) @@ -177,8 +191,8 @@ WT_Result CSLNKSymbolImpl::serialize (WT_File & file, WT_Units & units, WT_Fill().serialize(file); // Ook op de default zetten. file.desired_rendition().fill() = file.rendition().fill() = WT_Fill(); - WT_Font().serialize(file); // Ook op de default zetten. - file.desired_rendition().font() = file.rendition().font() = WT_Font(); + default_font.serialize(file); // Ook op de default zetten. + file.desired_rendition().font() = file.rendition().font() = default_font; file.heuristics().set_apply_transform(WD_False); // Hebben we al rechtstreeks op de contour gedaan m_SLNKContour.serialize(file, node_num, true, forFind, scale); diff --git a/SlnkDWFCom/WhipFile.cpp b/SlnkDWFCom/WhipFile.cpp index 40cfaa9..ae4a03e 100644 --- a/SlnkDWFCom/WhipFile.cpp +++ b/SlnkDWFCom/WhipFile.cpp @@ -834,7 +834,7 @@ bool CWhipFile::GenerateSymbols(myWT_File &my_file) m_hintScale, m_forFind, scale); else { - CString s; s.Format("About to insert symbol %s", symbol->m_symbolName); + CString s; s.Format("About to insert symbol %d %s (%s)", m_next_node_num, symbol->m_SLNKContour.m_Key, symbol->m_symbolName); comment(my_file, s); symbol->serialize(my_file, m_contunits, m_SLNKSymbolDefinitions[symbol->m_symbolName], m_next_node_num, @@ -1232,6 +1232,12 @@ STDMETHODIMP CWhipFile::DefineW2DSymbol(BSTR symbolName, BSTR WhipPath, ISLNKCon { symb = new CSLNKSymbolDefinition(CString(WhipPath)); } + catch (WT_Result::Enum e) + { + CString err; + err.Format("\nInternal error WT_Result::Enum %d", e); + return myAtlReportError(GetObjectCLSID(), "\nCWhipFile::DefineW2DSymbol('%ls')\n%s", (LPCSTR)WhipPath, err); + } catch (CString &err) { return myAtlReportError (GetObjectCLSID(), "Error defining symbol %ls file %ls:%s\n", symbolName, WhipPath, err); diff --git a/SlnkDWFImpl/Whip2DCImpl.cpp b/SlnkDWFImpl/Whip2DCImpl.cpp index 331ba9f..14f9251 100644 --- a/SlnkDWFImpl/Whip2DCImpl.cpp +++ b/SlnkDWFImpl/Whip2DCImpl.cpp @@ -326,48 +326,34 @@ int CWhip2DCImpl::Paint(VARIANT_BOOL forceBW, LONG markers /* = 0 */) // Het lijkt aantrekkelijk te tonen waar overflow optreedt // de tussen-DWF is echter al richting origin verplaatst, daarna speelt overflow niet meer + int skipLP = 1; // toon op skipLP afstand telkens een marker if (markers > 1) // dan altijd tonen - { - CRect clip; - GetClipBox(m_State.myDC, &clip); // Zichtbaar deel op scherm + skipLP = max(myRound(markers / m_State.m_mul), 1); - for (int x = clip.TopLeft().x; x <= clip.BottomRight().x; x+= markers) - for (int y = clip.TopLeft().y; y <= clip.BottomRight().y; y+= markers) - { - CPoint pt(x, y); - WT_Logical_Point ptl(m_State.LPToDWF(pt)); - - SetPixel(m_State.myDC, pt.x, pt.y, RGB(128, 128, 128)); - // Altijd DWF-coordinaten - CString txt; - txt.Format("%d", ptl.m_x); - TextOut(m_State.myDC, pt.x + 5, pt.y, txt, txt.GetLength()); - txt.Format("%d", ptl.m_y); - TextOut(m_State.myDC, pt.x + 5, pt.y + 10, txt, txt.GetLength()); - } - } - else if (m_State.m_mul > 10.0) + if (markers > 1 || m_State.m_mul > 10.0) { CRect clip; GetClipBox(m_State.myDC, &clip); // Zichtbaar deel op scherm WT_Logical_Point topleft(m_State.LPToDWF(clip.TopLeft())); WT_Logical_Point botright(m_State.LPToDWF(clip.BottomRight())); - for (int x = topleft.m_x; x <= botright.m_x; x++) - for (int y = topleft.m_y; y >= botright.m_y; y--) + for (int x = topleft.m_x; x <= botright.m_x; x += skipLP) + for (int y = topleft.m_y; y >= botright.m_y; y-= skipLP) { CPoint pt = m_State.DWFToLP(WT_Logical_Point(x, y)); - SetPixel(m_State.myDC, pt.x, pt.y, RGB(128, 128, 128)); - // Bij nog sterker inzoomen tonen we DWF-coordinaten - if (m_State.m_mul > 80.0) + // Bij sterk inzoomen tonen we DWF-coordinaten + if (markers > 1 || m_State.m_mul > 80.0) { + m_State.Marker(pt); CString txt; txt.Format("%d", x); - TextOut(m_State.myDC, pt.x + 5, pt.y, txt, txt.GetLength()); + TextOut(m_State.myDC, pt.x + 10, pt.y, txt, txt.GetLength()); txt.Format("%d", y); - TextOut(m_State.myDC, pt.x + 5, pt.y + 10, txt, txt.GetLength()); + TextOut(m_State.myDC, pt.x + 10, pt.y + 10, txt, txt.GetLength()); } - } + else // simpele pixel + SetPixel(m_State.myDC, pt.x, pt.y, RGB(128, 128, 128)); + } } SelectObject(m_State.myDC, oldfont); DeleteObject(fnt);