[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-dev] Patch for Line Endcap and options dialog bug fix
- From: JLM <jsado_sc5@xxxxxxxxxxxxx>
- Date: Sat, 16 Jun 2007 12:00:59 -0400
- Subject: [XaraXtreme-dev] Patch for Line Endcap and options dialog bug fix
Attached are two patches. The first fixes a wxAssertFail in wxWidgets
2.8. When opening the options dialog, two assertions are triggered. It
appears that wxWidgets 2.8 does not like it when you add a notebook page
to a notebook with an empty image list. This fix simply moves the line
that adds the image to the image list just before adding the notebook
page to the notebook.
I have tested this fix in both wx 2.8 and 2.6. I think this fix should
go into subversion at the same time as the rest of my wx 2.8 changes.
The second patch adds line endcap styles to the SVG importer. Works the
same as the line join type style patch. This patch was created from
within the filters/SVGFilter directory, so the file names are relative
to that location.
Index: wxOil/dlgmgr.cpp
===================================================================
--- wxOil/dlgmgr.cpp (revision 1768)
+++ wxOil/dlgmgr.cpp (working copy)
@@ -7084,13 +7086,11 @@
}
+ if (pImageList)
+ pImageList->Add(b);
pNoteBook->AddPage( pNewPage, Title );
- // add our image
if (pImageList)
- {
- pImageList->Add(b);
pNoteBook->SetPageImage(pNoteBook->GetPageCount()-1, pImageList->GetImageCount()-1);
- }
return true;
}
Index: xargenerator.cpp
===================================================================
--- xargenerator.cpp (revision 1768)
+++ xargenerator.cpp (working copy)
@@ -977,7 +977,7 @@
if (witch & STYLE_STROKE_LINEJOIN && style.IsStrokeLineJoinDefined()) {
JointType jt=style.GetStrokeLineJoin();
Rec.Reinit(TAG_JOINSTYLE, TAG_JOINSTYLE_SIZE);
- ok = Rec.WriteBYTE(jt);
+ ok = Rec.WriteBYTE(BYTE(jt));
ok = m_pExporter->WriteRecord(&Rec);
#if SVGDEBUG
@@ -997,6 +997,33 @@
}
+ if (witch & STYLE_STROKE_LINECAP && style.IsStrokeLineCapDefined()) {
+ LineCapType lct=style.GetStrokeLineCap();
+ Rec.Reinit(TAG_STARTCAP, TAG_STARTCAP_SIZE);
+ ok = Rec.WriteBYTE(BYTE(lct));
+ ok = m_pExporter->WriteRecord(&Rec);
+
+ Rec.Reinit(TAG_ENDCAP, TAG_ENDCAP_SIZE);
+ ok = Rec.WriteBYTE(BYTE(lct));
+ ok = m_pExporter->WriteRecord(&Rec);
+
+#if SVGDEBUG
+ switch(lct)
+ {
+ case LineCapButt:
+ svgtrace(DBGTRACE_STYLES, "stroke cap butt\n");
+ break;
+ case LineCapRound:
+ svgtrace(DBGTRACE_STYLES, "stroke cap round\n");
+ break;
+ case LineCapSquare:
+ svgtrace(DBGTRACE_STYLES, "stroke cap square\n");
+ break;
+ }
+#endif
+
+ }
+
if (witch & STYLE_STROKE_OPACITY && style.IsStrokeOpacityDefined()) {
double opacity = style.GetStrokeOpacity();
if (opacity < 1.0) {
Index: styles.h
===================================================================
--- styles.h (revision 1768)
+++ styles.h (working copy)
@@ -208,6 +208,7 @@
m_strokeOpacity = 1.0;
m_strokeWidth = 1;
m_strokeLineJoin = MitreJoin;
+ m_strokeLineCap = LineCapButt;
m_strokeGradient = NULL;
m_opacity = 1.0;
m_stopOffset = 0.0;
@@ -230,6 +231,7 @@
m_strokeOpacity = copy.m_strokeOpacity;
m_strokeWidth = copy.m_strokeWidth;
m_strokeLineJoin = copy.m_strokeLineJoin;
+ m_strokeLineCap = copy.m_strokeLineCap;
m_strokeGradient = copy.m_strokeGradient;
m_opacity = copy.m_opacity;
m_stopOffset = copy.m_stopOffset;
@@ -293,6 +295,13 @@
m_strokeLineJoin = jt;
}
+ bool IsStrokeLineCapDefined() const { return m_defined & STYLE_STROKE_LINECAP; }
+ LineCapType GetStrokeLineCap() const { return m_strokeLineCap; }
+ void SetStrokeLineCap(LineCapType lct ) {
+ m_defined |= STYLE_STROKE_LINECAP;
+ m_strokeLineCap = lct;
+ }
+
bool IsStrokeGradientDefined() const { return m_defined & STYLE_STROKE_GRADIENT; }
Gradient* GetStrokeGradient() const { return m_strokeGradient; }
void SetStrokeGradient(Gradient* value) {
@@ -340,6 +349,7 @@
double m_strokeOpacity;
INT32 m_strokeWidth;
JointType m_strokeLineJoin;
+ LineCapType m_strokeLineCap;
Gradient* m_strokeGradient;
double m_opacity;
double m_stopOffset;
Index: svgimporter.cpp
===================================================================
--- svgimporter.cpp (revision 1768)
+++ svgimporter.cpp (working copy)
@@ -1528,6 +1528,19 @@
}
}
+ sValue = GetStringProperty(cur, "stroke-linecap");
+ if (!sValue.IsEmpty()) {
+ if(sValue.CmpNoCase(_T("butt"))==0) {
+ style.SetStrokeLineCap(LineCapButt);
+ }
+ else if(sValue.CmpNoCase(_T("round"))==0) {
+ style.SetStrokeLineCap(LineCapRound);
+ }
+ else if(sValue.CmpNoCase(_T("square"))==0) {
+ style.SetStrokeLineCap(LineCapSquare);
+ }
+ }
+
if (IsPropertyDefined(cur, "opacity")) {
double fOpacity = GetClampedDoubleProperty(cur, "opacity");
style.SetOpacity(fOpacity);