Misc OGL changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@739 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,39 +1,43 @@
|
|||||||
src/*.cpp
|
utils/ogl/src/*.cpp
|
||||||
src/*.h
|
utils/ogl/src/*.h
|
||||||
src/*.rc
|
utils/ogl/src/*.rc
|
||||||
src/*.def
|
utils/ogl/src/*.def
|
||||||
src/*.xbm
|
utils/ogl/src/*.xbm
|
||||||
src/*.xpm
|
utils/ogl/src/*.xpm
|
||||||
src/makefile*
|
utils/ogl/src/makefile*
|
||||||
src/*.txt
|
utils/ogl/src/*.txt
|
||||||
src/*.ico
|
utils/ogl/src/*.ico
|
||||||
src/*.bmp
|
utils/ogl/src/*.bmp
|
||||||
|
|
||||||
samples/ogledit/*.cpp
|
utils/ogl/samples/ogledit/*.cpp
|
||||||
samples/ogledit/*.h
|
utils/ogl/samples/ogledit/*.h
|
||||||
samples/ogledit/*.rc
|
utils/ogl/samples/ogledit/*.rc
|
||||||
samples/ogledit/*.def
|
utils/ogl/samples/ogledit/*.def
|
||||||
samples/ogledit/*.xbm
|
utils/ogl/samples/ogledit/*.xbm
|
||||||
samples/ogledit/makefile*
|
utils/ogl/samples/ogledit/makefile*
|
||||||
samples/ogledit/*.txt
|
utils/ogl/samples/ogledit/*.txt
|
||||||
|
|
||||||
samples/ogledit/*.ico
|
utils/ogl/samples/ogledit/*.ico
|
||||||
samples/ogledit/*.bmp
|
utils/ogl/samples/ogledit/*.bmp
|
||||||
samples/ogledit/bitmaps/*.bmp
|
utils/ogl/samples/ogledit/bitmaps/*.bmp
|
||||||
samples/ogledit/bitmaps/*.gif
|
utils/ogl/samples/ogledit/bitmaps/*.gif
|
||||||
samples/ogledit/bitmaps/*.xbm
|
utils/ogl/samples/ogledit/bitmaps/*.xbm
|
||||||
samples/ogledit/bitmaps/*.xpm
|
utils/ogl/samples/ogledit/bitmaps/*.xpm
|
||||||
|
|
||||||
distrib/*.rsp
|
utils/ogl/distrib/*.rsp
|
||||||
distrib/*.bat
|
utils/ogl/distrib/*.bat
|
||||||
|
|
||||||
|
utils/ogl/docs/*.txt
|
||||||
|
utils/ogl/docs/*.tex
|
||||||
|
utils/ogl/docs/*.ini
|
||||||
|
utils/ogl/docs/*.hpj
|
||||||
|
utils/ogl/docs/*.ps
|
||||||
|
utils/ogl/docs/*.eps
|
||||||
|
utils/ogl/docs/*.bmp
|
||||||
|
utils/ogl/docs/*.gif
|
||||||
|
|
||||||
|
docs/html/ogl/*.*
|
||||||
|
docs/winhelp/ogl.hlp
|
||||||
|
docs/winhelp/ogl.cnt
|
||||||
|
docs/pdf/ogl.pdf
|
||||||
|
|
||||||
docs/*.txt
|
|
||||||
docs/*.tex
|
|
||||||
docs/*.ini
|
|
||||||
docs/*.hpj
|
|
||||||
docs/*.ps
|
|
||||||
docs/*.eps
|
|
||||||
docs/*.cnt
|
|
||||||
docs/*.bmp
|
|
||||||
docs/*.gif
|
|
||||||
docs/*.hlp
|
|
||||||
|
@@ -1,19 +1,21 @@
|
|||||||
@echo off
|
@echo off
|
||||||
rem Zip up an external distribution of OGL
|
rem Zip up an external distribution of OGL
|
||||||
set src=d:\wx2\wxWindows\utils\ogl
|
set src=d:\wx2\wxWindows
|
||||||
set dest=%src\deliver
|
set dest=%src\utils\ogl\deliver
|
||||||
|
|
||||||
if "%src" == "" goto usage
|
if "%src" == "" goto usage
|
||||||
if "%dest" == "" goto usage
|
if "%dest" == "" goto usage
|
||||||
echo About to archive an external OGL distribution:
|
echo About to archive an external OGL distribution:
|
||||||
echo From %src
|
echo From %src
|
||||||
echo To %dest\ogl.zip
|
echo To %dest\ogl3.zip
|
||||||
echo CTRL-C if this is not correct.
|
echo CTRL-C if this is not correct.
|
||||||
inkey /W4 `Press any key to continue...` %%input
|
inkey /W4 `Press any key to continue...` %%input
|
||||||
|
|
||||||
erase %dest\ogl.zip
|
erase %dest\ogl3.zip
|
||||||
cd %src
|
cd %src
|
||||||
zip32 -@ %dest\ogl.zip < %src\distrib\ogl.rsp
|
zip32 -@ %dest\ogl3.zip < %src\utils\ogl\distrib\ogl.rsp
|
||||||
|
|
||||||
|
cd %dest
|
||||||
|
|
||||||
echo OGL archived.
|
echo OGL archived.
|
||||||
goto end
|
goto end
|
||||||
@@ -21,7 +23,7 @@ goto end
|
|||||||
:usage
|
:usage
|
||||||
echo DOS OGL distribution.
|
echo DOS OGL distribution.
|
||||||
echo Usage: zipogl source destination
|
echo Usage: zipogl source destination
|
||||||
echo e.g. zipogl c:\wx\utils\ogl c:\wx\utils\ogl\deliver
|
echo e.g. zipogl d:\wx2\wxWindows d:\wx2\wxWindows\utils\ogl\deliver
|
||||||
|
|
||||||
:end
|
:end
|
||||||
|
|
||||||
|
@@ -225,12 +225,24 @@ Removes and deletes all shapes in the diagram.
|
|||||||
|
|
||||||
Draws an outline rectangle on the current device context.
|
Draws an outline rectangle on the current device context.
|
||||||
|
|
||||||
|
\membersection{wxDiagram::FindShape}\label{wxdiagramfindshape}
|
||||||
|
|
||||||
|
\constfunc{wxShape*}{FindShape}{\param{long}{ id}}
|
||||||
|
|
||||||
|
Returns the shape for the given identifier.
|
||||||
|
|
||||||
\membersection{wxDiagram::GetCanvas}
|
\membersection{wxDiagram::GetCanvas}
|
||||||
|
|
||||||
\constfunc{wxShapeCanvas*}{GetCanvas}{\void}
|
\constfunc{wxShapeCanvas*}{GetCanvas}{\void}
|
||||||
|
|
||||||
Returns the shape canvas associated with this diagram.
|
Returns the shape canvas associated with this diagram.
|
||||||
|
|
||||||
|
\membersection{wxDiagram::GetCount}\label{wxdiagramgetcount}
|
||||||
|
|
||||||
|
\constfunc{int}{GetCount}{\void}
|
||||||
|
|
||||||
|
Returns the number of shapes in the diagram.
|
||||||
|
|
||||||
\membersection{wxDiagram::GetGridSpacing}
|
\membersection{wxDiagram::GetGridSpacing}
|
||||||
|
|
||||||
\constfunc{double}{GetGridSpacing}{\void}
|
\constfunc{double}{GetGridSpacing}{\void}
|
||||||
@@ -1474,7 +1486,7 @@ Destructor.
|
|||||||
|
|
||||||
\membersection{wxShape::AddLine}
|
\membersection{wxShape::AddLine}
|
||||||
|
|
||||||
\func{void}{AddLine}{\param{wxLineShape *}{line}, \param{wxShape *}{other}, \param{int}{attachFrom = 0}, \param{int}{ attachTo = 0},
|
\func{void}{AddLine}{\param{wxLineShape*}{ line}, \param{wxShape*}{ other}, \param{int}{ attachFrom = 0}, \param{int}{ attachTo = 0},
|
||||||
\param{int}{ positionFrom = -1}, \param{int}{ positionTo = -1}}
|
\param{int}{ positionFrom = -1}, \param{int}{ positionTo = -1}}
|
||||||
|
|
||||||
Adds a line between the specified canvas shapes, at the specified attachment points.
|
Adds a line between the specified canvas shapes, at the specified attachment points.
|
||||||
@@ -1847,6 +1859,13 @@ Gets the zero-based position of {\it line} in the list of lines for this shape.
|
|||||||
|
|
||||||
Returns a reference to the list of lines connected to this shape.
|
Returns a reference to the list of lines connected to this shape.
|
||||||
|
|
||||||
|
\membersection{wxShape::GetMaintainAspectRatio}\label{wxshapegetmaintainaspectratio}
|
||||||
|
|
||||||
|
\constfunc{bool}{GetMaintainAspectRatio}{\void}
|
||||||
|
|
||||||
|
If returns TRUE, resizing the shape will not change the aspect ratio
|
||||||
|
(width and height will be in the original proportion).
|
||||||
|
|
||||||
\membersection{wxShape::GetNumberOfAttachments}\label{wxshapegetnumberofattachments}
|
\membersection{wxShape::GetNumberOfAttachments}\label{wxshapegetnumberofattachments}
|
||||||
|
|
||||||
\constfunc{int}{GetNumberOfAttachments}{\void}
|
\constfunc{int}{GetNumberOfAttachments}{\void}
|
||||||
@@ -2197,6 +2216,13 @@ Sets the highlight for a shape. Shape highlighting is unimplemented.
|
|||||||
|
|
||||||
Set the integer identifier for this shape.
|
Set the integer identifier for this shape.
|
||||||
|
|
||||||
|
\membersection{wxShape::SetMaintainAspectRatio}\label{wxshapesetmaintainaspectratio}
|
||||||
|
|
||||||
|
\func{void}{SetMaintainAspectRatio}{\param{bool}{ flag}}
|
||||||
|
|
||||||
|
If the argument is TRUE, tells the shape that resizes should not change the aspect ratio
|
||||||
|
(width and height should be in the original proportion).
|
||||||
|
|
||||||
\membersection{wxShape::SetPen}
|
\membersection{wxShape::SetPen}
|
||||||
|
|
||||||
\func{void}{SetPen}{\param{wxPen *}{pen}}
|
\func{void}{SetPen}{\param{wxPen *}{pen}}
|
||||||
@@ -2652,7 +2678,7 @@ image, and again to allow drawing at the new position.
|
|||||||
|
|
||||||
\membersection{wxShapeEvtHandler::OnDraw}
|
\membersection{wxShapeEvtHandler::OnDraw}
|
||||||
|
|
||||||
\func{void}{OnDraw}{\void}
|
\func{void}{OnDraw}{\param{wxDC\&}{ dc}}
|
||||||
|
|
||||||
Defined for each class to draw the main graphic, but
|
Defined for each class to draw the main graphic, but
|
||||||
not the contents.
|
not the contents.
|
||||||
|
@@ -294,6 +294,7 @@ wxShape::wxShape(wxShapeCanvas *can)
|
|||||||
m_textMarginY = 5.0;
|
m_textMarginY = 5.0;
|
||||||
m_regionName = "0";
|
m_regionName = "0";
|
||||||
m_centreResize = TRUE;
|
m_centreResize = TRUE;
|
||||||
|
m_maintainAspectRatio = FALSE;
|
||||||
m_highlighted = FALSE;
|
m_highlighted = FALSE;
|
||||||
m_rotation = 0.0;
|
m_rotation = 0.0;
|
||||||
|
|
||||||
@@ -1590,6 +1591,43 @@ void wxShape::AddLine(wxLineShape *line, wxShape *other,
|
|||||||
// The line ordering
|
// The line ordering
|
||||||
int positionFrom, int positionTo)
|
int positionFrom, int positionTo)
|
||||||
{
|
{
|
||||||
|
if (positionFrom == -1)
|
||||||
|
{
|
||||||
|
if (!m_lines.Member(line))
|
||||||
|
m_lines.Append(line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Don't preserve old ordering if we have new ordering instructions
|
||||||
|
m_lines.DeleteObject(line);
|
||||||
|
if (positionFrom < m_lines.Number())
|
||||||
|
{
|
||||||
|
wxNode* node = m_lines.Nth(positionFrom);
|
||||||
|
m_lines.Insert(node, line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_lines.Append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (positionTo == -1)
|
||||||
|
{
|
||||||
|
if (!other->m_lines.Member(line))
|
||||||
|
other->m_lines.Append(line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Don't preserve old ordering if we have new ordering instructions
|
||||||
|
other->m_lines.DeleteObject(line);
|
||||||
|
if (positionTo < other->m_lines.Number())
|
||||||
|
{
|
||||||
|
wxNode* node = other->m_lines.Nth(positionTo);
|
||||||
|
other->m_lines.Insert(node, line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
other->m_lines.Append(line);
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
// Wrong: doesn't preserve ordering of shape already linked
|
||||||
m_lines.DeleteObject(line);
|
m_lines.DeleteObject(line);
|
||||||
other->m_lines.DeleteObject(line);
|
other->m_lines.DeleteObject(line);
|
||||||
|
|
||||||
@@ -1618,6 +1656,7 @@ void wxShape::AddLine(wxLineShape *line, wxShape *other,
|
|||||||
else
|
else
|
||||||
other->m_lines.Append(line);
|
other->m_lines.Append(line);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
line->SetFrom(this);
|
line->SetFrom(this);
|
||||||
line->SetTo(other);
|
line->SetTo(other);
|
||||||
@@ -1682,7 +1721,7 @@ void wxShape::WriteAttributes(wxExpr *clause)
|
|||||||
int n_lines = m_lines.Number();
|
int n_lines = m_lines.Number();
|
||||||
if (n_lines > 0)
|
if (n_lines > 0)
|
||||||
{
|
{
|
||||||
wxExpr *list = new wxExpr(PrologList);
|
wxExpr *list = new wxExpr(wxExprList);
|
||||||
wxNode *node = m_lines.First();
|
wxNode *node = m_lines.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -1709,6 +1748,7 @@ void wxShape::WriteAttributes(wxExpr *clause)
|
|||||||
clause->AddAttributeValue("shadow_mode", (long)m_shadowMode);
|
clause->AddAttributeValue("shadow_mode", (long)m_shadowMode);
|
||||||
if (m_centreResize != TRUE)
|
if (m_centreResize != TRUE)
|
||||||
clause->AddAttributeValue("centre_resize", (long)0);
|
clause->AddAttributeValue("centre_resize", (long)0);
|
||||||
|
clause->AddAttributeValue("maintain_aspect_ratio", (long) m_maintainAspectRatio);
|
||||||
if (m_highlighted != FALSE)
|
if (m_highlighted != FALSE)
|
||||||
clause->AddAttributeValue("hilite", (long)m_highlighted);
|
clause->AddAttributeValue("hilite", (long)m_highlighted);
|
||||||
|
|
||||||
@@ -1721,12 +1761,12 @@ void wxShape::WriteAttributes(wxExpr *clause)
|
|||||||
// Write user-defined attachment points, if any
|
// Write user-defined attachment points, if any
|
||||||
if (m_attachmentPoints.Number() > 0)
|
if (m_attachmentPoints.Number() > 0)
|
||||||
{
|
{
|
||||||
wxExpr *attachmentList = new wxExpr(PrologList);
|
wxExpr *attachmentList = new wxExpr(wxExprList);
|
||||||
wxNode *node = m_attachmentPoints.First();
|
wxNode *node = m_attachmentPoints.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data();
|
wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data();
|
||||||
wxExpr *pointExpr = new wxExpr(PrologList);
|
wxExpr *pointExpr = new wxExpr(wxExprList);
|
||||||
pointExpr->Append(new wxExpr((long)point->m_id));
|
pointExpr->Append(new wxExpr((long)point->m_id));
|
||||||
pointExpr->Append(new wxExpr(point->m_x));
|
pointExpr->Append(new wxExpr(point->m_x));
|
||||||
pointExpr->Append(new wxExpr(point->m_y));
|
pointExpr->Append(new wxExpr(point->m_y));
|
||||||
@@ -1757,9 +1797,9 @@ void wxShape::WriteRegions(wxExpr *clause)
|
|||||||
// Original text and region attributes:
|
// Original text and region attributes:
|
||||||
// region1 = (regionName regionText x y width height minWidth minHeight proportionX proportionY
|
// region1 = (regionName regionText x y width height minWidth minHeight proportionX proportionY
|
||||||
// formatMode fontSize fontFamily fontStyle fontWeight textColour)
|
// formatMode fontSize fontFamily fontStyle fontWeight textColour)
|
||||||
wxExpr *regionExpr = new wxExpr(PrologList);
|
wxExpr *regionExpr = new wxExpr(wxExprList);
|
||||||
regionExpr->Append(new wxExpr(PrologString, (region->m_regionName ? region->m_regionName : "")));
|
regionExpr->Append(new wxExpr(wxExprString, (region->m_regionName ? region->m_regionName : "")));
|
||||||
regionExpr->Append(new wxExpr(PrologString, (region->m_regionText ? region->m_regionText : "")));
|
regionExpr->Append(new wxExpr(wxExprString, (region->m_regionText ? region->m_regionText : "")));
|
||||||
|
|
||||||
regionExpr->Append(new wxExpr(region->m_x));
|
regionExpr->Append(new wxExpr(region->m_x));
|
||||||
regionExpr->Append(new wxExpr(region->m_y));
|
regionExpr->Append(new wxExpr(region->m_y));
|
||||||
@@ -1777,24 +1817,24 @@ void wxShape::WriteRegions(wxExpr *clause)
|
|||||||
regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetFamily() : wxDEFAULT)));
|
regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetFamily() : wxDEFAULT)));
|
||||||
regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetStyle() : wxDEFAULT)));
|
regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetStyle() : wxDEFAULT)));
|
||||||
regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetWeight() : wxNORMAL)));
|
regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetWeight() : wxNORMAL)));
|
||||||
regionExpr->Append(new wxExpr(PrologString, region->m_textColour ? region->m_textColour : "BLACK"));
|
regionExpr->Append(new wxExpr(wxExprString, region->m_textColour ? region->m_textColour : "BLACK"));
|
||||||
|
|
||||||
// New members for pen colour/style
|
// New members for pen colour/style
|
||||||
regionExpr->Append(new wxExpr(PrologString, region->m_penColour ? region->m_penColour : "BLACK"));
|
regionExpr->Append(new wxExpr(wxExprString, region->m_penColour ? region->m_penColour : "BLACK"));
|
||||||
regionExpr->Append(new wxExpr((long)region->m_penStyle));
|
regionExpr->Append(new wxExpr((long)region->m_penStyle));
|
||||||
|
|
||||||
// Formatted text:
|
// Formatted text:
|
||||||
// text1 = ((x y string) (x y string) ...)
|
// text1 = ((x y string) (x y string) ...)
|
||||||
wxExpr *textExpr = new wxExpr(PrologList);
|
wxExpr *textExpr = new wxExpr(wxExprList);
|
||||||
|
|
||||||
wxNode *textNode = region->m_formattedText.First();
|
wxNode *textNode = region->m_formattedText.First();
|
||||||
while (textNode)
|
while (textNode)
|
||||||
{
|
{
|
||||||
wxShapeTextLine *line = (wxShapeTextLine *)textNode->Data();
|
wxShapeTextLine *line = (wxShapeTextLine *)textNode->Data();
|
||||||
wxExpr *list2 = new wxExpr(PrologList);
|
wxExpr *list2 = new wxExpr(wxExprList);
|
||||||
list2->Append(new wxExpr(line->GetX()));
|
list2->Append(new wxExpr(line->GetX()));
|
||||||
list2->Append(new wxExpr(line->GetY()));
|
list2->Append(new wxExpr(line->GetY()));
|
||||||
list2->Append(new wxExpr(PrologString, line->GetText()));
|
list2->Append(new wxExpr(wxExprString, line->GetText()));
|
||||||
textExpr->Append(list2);
|
textExpr->Append(list2);
|
||||||
textNode = textNode->Next();
|
textNode = textNode->Next();
|
||||||
}
|
}
|
||||||
@@ -1819,7 +1859,7 @@ void wxShape::ReadAttributes(wxExpr *clause)
|
|||||||
// Input text strings (FOR COMPATIBILITY WITH OLD FILES ONLY. SEE REGION CODE BELOW.)
|
// Input text strings (FOR COMPATIBILITY WITH OLD FILES ONLY. SEE REGION CODE BELOW.)
|
||||||
ClearText();
|
ClearText();
|
||||||
wxExpr *strings = clause->AttributeValue("text");
|
wxExpr *strings = clause->AttributeValue("text");
|
||||||
if (strings && strings->Type() == PrologList)
|
if (strings && strings->Type() == wxExprList)
|
||||||
{
|
{
|
||||||
m_formatted = TRUE; // Assume text is formatted unless we prove otherwise
|
m_formatted = TRUE; // Assume text is formatted unless we prove otherwise
|
||||||
wxExpr *node = strings->value.first;
|
wxExpr *node = strings->value.first;
|
||||||
@@ -1832,27 +1872,27 @@ void wxShape::ReadAttributes(wxExpr *clause)
|
|||||||
|
|
||||||
// string_expr can either be a string, or a list of
|
// string_expr can either be a string, or a list of
|
||||||
// 3 elements: x, y, and string.
|
// 3 elements: x, y, and string.
|
||||||
if (string_expr->Type() == PrologString)
|
if (string_expr->Type() == wxExprString)
|
||||||
{
|
{
|
||||||
the_string = string_expr->StringValue();
|
the_string = string_expr->StringValue();
|
||||||
m_formatted = FALSE;
|
m_formatted = FALSE;
|
||||||
}
|
}
|
||||||
else if (string_expr->Type() == PrologList)
|
else if (string_expr->Type() == wxExprList)
|
||||||
{
|
{
|
||||||
wxExpr *first = string_expr->value.first;
|
wxExpr *first = string_expr->value.first;
|
||||||
wxExpr *second = first ? first->next : NULL;
|
wxExpr *second = first ? first->next : NULL;
|
||||||
wxExpr *third = second ? second->next : NULL;
|
wxExpr *third = second ? second->next : NULL;
|
||||||
|
|
||||||
if (first && second && third &&
|
if (first && second && third &&
|
||||||
(first->Type() == PrologReal || first->Type() == PrologInteger) &&
|
(first->Type() == wxExprReal || first->Type() == wxExprInteger) &&
|
||||||
(second->Type() == PrologReal || second->Type() == PrologInteger) &&
|
(second->Type() == wxExprReal || second->Type() == wxExprInteger) &&
|
||||||
third->Type() == PrologString)
|
third->Type() == wxExprString)
|
||||||
{
|
{
|
||||||
if (first->Type() == PrologReal)
|
if (first->Type() == wxExprReal)
|
||||||
the_x = first->RealValue();
|
the_x = first->RealValue();
|
||||||
else the_x = (double)first->IntegerValue();
|
else the_x = (double)first->IntegerValue();
|
||||||
|
|
||||||
if (second->Type() == PrologReal)
|
if (second->Type() == wxExprReal)
|
||||||
the_y = second->RealValue();
|
the_y = second->RealValue();
|
||||||
else the_y = (double)second->IntegerValue();
|
else the_y = (double)second->IntegerValue();
|
||||||
|
|
||||||
@@ -1911,6 +1951,10 @@ void wxShape::ReadAttributes(wxExpr *clause)
|
|||||||
clause->GetAttributeValue("centre_resize", iVal);
|
clause->GetAttributeValue("centre_resize", iVal);
|
||||||
m_centreResize = (iVal != 0);
|
m_centreResize = (iVal != 0);
|
||||||
|
|
||||||
|
iVal = (int) m_maintainAspectRatio;
|
||||||
|
clause->GetAttributeValue("maintain_aspect_ratio", iVal);
|
||||||
|
m_maintainAspectRatio = (iVal != 0);
|
||||||
|
|
||||||
iVal = (int) m_highlighted;
|
iVal = (int) m_highlighted;
|
||||||
clause->GetAttributeValue("hilite", iVal);
|
clause->GetAttributeValue("hilite", iVal);
|
||||||
m_highlighted = (iVal != 0);
|
m_highlighted = (iVal != 0);
|
||||||
@@ -2017,7 +2061,7 @@ void wxShape::ReadRegions(wxExpr *clause)
|
|||||||
wxString penColour("");
|
wxString penColour("");
|
||||||
int penStyle = wxSOLID;
|
int penStyle = wxSOLID;
|
||||||
|
|
||||||
if (regionExpr->Type() == PrologList)
|
if (regionExpr->Type() == wxExprList)
|
||||||
{
|
{
|
||||||
wxExpr *nameExpr = regionExpr->Nth(0);
|
wxExpr *nameExpr = regionExpr->Nth(0);
|
||||||
wxExpr *textExpr = regionExpr->Nth(1);
|
wxExpr *textExpr = regionExpr->Nth(1);
|
||||||
@@ -2095,7 +2139,7 @@ void wxShape::ReadRegions(wxExpr *clause)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
textExpr = clause->AttributeValue(textNameBuf);
|
textExpr = clause->AttributeValue(textNameBuf);
|
||||||
if (textExpr && (textExpr->Type() == PrologList))
|
if (textExpr && (textExpr->Type() == wxExprList))
|
||||||
{
|
{
|
||||||
wxExpr *node = textExpr->value.first;
|
wxExpr *node = textExpr->value.first;
|
||||||
while (node)
|
while (node)
|
||||||
@@ -2107,27 +2151,27 @@ void wxShape::ReadRegions(wxExpr *clause)
|
|||||||
|
|
||||||
// string_expr can either be a string, or a list of
|
// string_expr can either be a string, or a list of
|
||||||
// 3 elements: x, y, and string.
|
// 3 elements: x, y, and string.
|
||||||
if (string_expr->Type() == PrologString)
|
if (string_expr->Type() == wxExprString)
|
||||||
{
|
{
|
||||||
the_string = string_expr->StringValue();
|
the_string = string_expr->StringValue();
|
||||||
m_formatted = FALSE;
|
m_formatted = FALSE;
|
||||||
}
|
}
|
||||||
else if (string_expr->Type() == PrologList)
|
else if (string_expr->Type() == wxExprList)
|
||||||
{
|
{
|
||||||
wxExpr *first = string_expr->value.first;
|
wxExpr *first = string_expr->value.first;
|
||||||
wxExpr *second = first ? first->next : NULL;
|
wxExpr *second = first ? first->next : NULL;
|
||||||
wxExpr *third = second ? second->next : NULL;
|
wxExpr *third = second ? second->next : NULL;
|
||||||
|
|
||||||
if (first && second && third &&
|
if (first && second && third &&
|
||||||
(first->Type() == PrologReal || first->Type() == PrologInteger) &&
|
(first->Type() == wxExprReal || first->Type() == wxExprInteger) &&
|
||||||
(second->Type() == PrologReal || second->Type() == PrologInteger) &&
|
(second->Type() == wxExprReal || second->Type() == wxExprInteger) &&
|
||||||
third->Type() == PrologString)
|
third->Type() == wxExprString)
|
||||||
{
|
{
|
||||||
if (first->Type() == PrologReal)
|
if (first->Type() == wxExprReal)
|
||||||
the_x = first->RealValue();
|
the_x = first->RealValue();
|
||||||
else the_x = (double)first->IntegerValue();
|
else the_x = (double)first->IntegerValue();
|
||||||
|
|
||||||
if (second->Type() == PrologReal)
|
if (second->Type() == wxExprReal)
|
||||||
the_y = second->RealValue();
|
the_y = second->RealValue();
|
||||||
else the_y = (double)second->IntegerValue();
|
else the_y = (double)second->IntegerValue();
|
||||||
|
|
||||||
@@ -2186,6 +2230,7 @@ void wxShape::Copy(wxShape& copy)
|
|||||||
copy.m_brush = m_brush;
|
copy.m_brush = m_brush;
|
||||||
copy.m_textColour = m_textColour;
|
copy.m_textColour = m_textColour;
|
||||||
copy.m_centreResize = m_centreResize;
|
copy.m_centreResize = m_centreResize;
|
||||||
|
copy.m_maintainAspectRatio = m_maintainAspectRatio;
|
||||||
copy.m_attachmentMode = m_attachmentMode;
|
copy.m_attachmentMode = m_attachmentMode;
|
||||||
copy.m_spaceAttachments = m_spaceAttachments;
|
copy.m_spaceAttachments = m_spaceAttachments;
|
||||||
copy.m_highlighted = m_highlighted;
|
copy.m_highlighted = m_highlighted;
|
||||||
@@ -2567,8 +2612,10 @@ int wxShape::GetNumberOfAttachments() const
|
|||||||
|
|
||||||
bool wxShape::AttachmentIsValid(int attachment) const
|
bool wxShape::AttachmentIsValid(int attachment) const
|
||||||
{
|
{
|
||||||
if ((attachment >= 0) && (attachment < 4))
|
if (m_attachmentPoints.Number() == 0)
|
||||||
return TRUE;
|
{
|
||||||
|
return ((attachment >= 0) && (attachment < 4)) ;
|
||||||
|
}
|
||||||
|
|
||||||
wxNode *node = m_attachmentPoints.First();
|
wxNode *node = m_attachmentPoints.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -2584,28 +2631,87 @@ bool wxShape::AttachmentIsValid(int attachment) const
|
|||||||
bool wxShape::GetAttachmentPosition(int attachment, double *x, double *y,
|
bool wxShape::GetAttachmentPosition(int attachment, double *x, double *y,
|
||||||
int nth, int no_arcs, wxLineShape *line)
|
int nth, int no_arcs, wxLineShape *line)
|
||||||
{
|
{
|
||||||
if (!m_attachmentMode)
|
if (!m_attachmentMode)
|
||||||
{
|
|
||||||
*x = m_xpos; *y = m_ypos;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxNode *node = m_attachmentPoints.First();
|
|
||||||
while (node)
|
|
||||||
{
|
{
|
||||||
wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data();
|
*x = m_xpos; *y = m_ypos;
|
||||||
if (point->m_id == attachment)
|
|
||||||
{
|
|
||||||
*x = (double)(m_xpos + point->m_x);
|
|
||||||
*y = (double)(m_ypos + point->m_y);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
*x = m_xpos; *y = m_ypos;
|
else
|
||||||
|
{
|
||||||
|
if (m_attachmentPoints.Number() > 0)
|
||||||
|
{
|
||||||
|
wxNode *node = m_attachmentPoints.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data();
|
||||||
|
if (point->m_id == attachment)
|
||||||
|
{
|
||||||
|
*x = (double)(m_xpos + point->m_x);
|
||||||
|
*y = (double)(m_ypos + point->m_y);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
*x = m_xpos; *y = m_ypos;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Assume is rectangular
|
||||||
|
double w, h;
|
||||||
|
GetBoundingBoxMax(&w, &h);
|
||||||
|
double top = (double)(m_ypos + h/2.0);
|
||||||
|
double bottom = (double)(m_ypos - h/2.0);
|
||||||
|
double left = (double)(m_xpos - w/2.0);
|
||||||
|
double right = (double)(m_xpos + w/2.0);
|
||||||
|
|
||||||
|
bool isEnd = (line && line->IsEnd(this));
|
||||||
|
|
||||||
|
// Simplified code
|
||||||
|
switch (attachment)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
wxRealPoint pt = CalcSimpleAttachment(wxRealPoint(left, bottom), wxRealPoint(right, bottom),
|
||||||
|
nth, no_arcs, line);
|
||||||
|
|
||||||
|
*x = pt.x; *y = pt.y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
wxRealPoint pt = CalcSimpleAttachment(wxRealPoint(right, bottom), wxRealPoint(right, top),
|
||||||
|
nth, no_arcs, line);
|
||||||
|
|
||||||
|
*x = pt.x; *y = pt.y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
wxRealPoint pt = CalcSimpleAttachment(wxRealPoint(left, top), wxRealPoint(right, top),
|
||||||
|
nth, no_arcs, line);
|
||||||
|
|
||||||
|
*x = pt.x; *y = pt.y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
wxRealPoint pt = CalcSimpleAttachment(wxRealPoint(left, bottom), wxRealPoint(left, top),
|
||||||
|
nth, no_arcs, line);
|
||||||
|
|
||||||
|
*x = pt.x; *y = pt.y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return wxShape::GetAttachmentPosition(attachment, x, y, nth, no_arcs, line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxShape::GetBoundingBoxMax(double *w, double *h)
|
void wxShape::GetBoundingBoxMax(double *w, double *h)
|
||||||
|
@@ -269,6 +269,8 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
virtual bool HitTest(double x, double y, int *attachment, double *distance);
|
virtual bool HitTest(double x, double y, int *attachment, double *distance);
|
||||||
inline void SetCentreResize(bool cr) { m_centreResize = cr; }
|
inline void SetCentreResize(bool cr) { m_centreResize = cr; }
|
||||||
inline bool GetCentreResize() const { return m_centreResize; }
|
inline bool GetCentreResize() const { return m_centreResize; }
|
||||||
|
inline void SetMaintainAspectRatio(bool ar) { m_maintainAspectRatio = ar; }
|
||||||
|
inline bool GetMaintainAspectRatio() const { return m_maintainAspectRatio; }
|
||||||
inline wxList& GetLines() const { return (wxList&) m_lines; }
|
inline wxList& GetLines() const { return (wxList&) m_lines; }
|
||||||
inline void SetDisableLabel(bool flag) { m_disableLabel = flag; }
|
inline void SetDisableLabel(bool flag) { m_disableLabel = flag; }
|
||||||
inline bool GetDisableLabel() const { return m_disableLabel; }
|
inline bool GetDisableLabel() const { return m_disableLabel; }
|
||||||
@@ -482,6 +484,7 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
int m_textMarginX; // Gap between text and border
|
int m_textMarginX; // Gap between text and border
|
||||||
int m_textMarginY;
|
int m_textMarginY;
|
||||||
wxString m_regionName;
|
wxString m_regionName;
|
||||||
|
bool m_maintainAspectRatio;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxPolygonShape: public wxShape
|
class wxPolygonShape: public wxShape
|
||||||
@@ -532,7 +535,6 @@ class wxPolygonShape: public wxShape
|
|||||||
virtual void CalculatePolygonCentre();
|
virtual void CalculatePolygonCentre();
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
|
||||||
void WriteAttributes(wxExpr *clause);
|
void WriteAttributes(wxExpr *clause);
|
||||||
void ReadAttributes(wxExpr *clause);
|
void ReadAttributes(wxExpr *clause);
|
||||||
#endif
|
#endif
|
||||||
@@ -546,6 +548,9 @@ class wxPolygonShape: public wxShape
|
|||||||
|
|
||||||
inline wxList *GetPoints() { return m_points; }
|
inline wxList *GetPoints() { return m_points; }
|
||||||
|
|
||||||
|
// Rotate about the given axis by the given amount in radians
|
||||||
|
virtual void Rotate(double x, double y, double theta);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxList* m_points;
|
wxList* m_points;
|
||||||
wxList* m_originalPoints;
|
wxList* m_originalPoints;
|
||||||
@@ -569,7 +574,6 @@ class wxRectangleShape: public wxShape
|
|||||||
void SetCornerRadius(double rad); // If > 0, rounded corners
|
void SetCornerRadius(double rad); // If > 0, rounded corners
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
|
||||||
void WriteAttributes(wxExpr *clause);
|
void WriteAttributes(wxExpr *clause);
|
||||||
void ReadAttributes(wxExpr *clause);
|
void ReadAttributes(wxExpr *clause);
|
||||||
#endif
|
#endif
|
||||||
@@ -622,7 +626,6 @@ class wxEllipseShape: public wxShape
|
|||||||
void SetSize(double x, double y, bool recursive = TRUE);
|
void SetSize(double x, double y, bool recursive = TRUE);
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
|
||||||
void WriteAttributes(wxExpr *clause);
|
void WriteAttributes(wxExpr *clause);
|
||||||
void ReadAttributes(wxExpr *clause);
|
void ReadAttributes(wxExpr *clause);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -557,62 +557,6 @@ void wxPolygonShape::MakeControlPoints()
|
|||||||
m_controlPoints.Append(control);
|
m_controlPoints.Append(control);
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
double maxX, maxY, minX, minY;
|
|
||||||
|
|
||||||
GetBoundingBoxMax(&maxX, &maxY);
|
|
||||||
GetBoundingBoxMin(&minX, &minY);
|
|
||||||
|
|
||||||
double widthMin = (double)(minX + CONTROL_POINT_SIZE + 2);
|
|
||||||
double heightMin = (double)(minY + CONTROL_POINT_SIZE + 2);
|
|
||||||
|
|
||||||
// Offsets from main object
|
|
||||||
double top = (double)(- (heightMin / 2.0));
|
|
||||||
double bottom = (double)(heightMin / 2.0 + (maxY - minY));
|
|
||||||
double left = (double)(- (widthMin / 2.0));
|
|
||||||
double right = (double)(widthMin / 2.0 + (maxX - minX));
|
|
||||||
|
|
||||||
wxControlPoint *control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, top,
|
|
||||||
CONTROL_POINT_DIAGONAL);
|
|
||||||
m_canvas->AddShape(control);
|
|
||||||
m_controlPoints.Append(control);
|
|
||||||
|
|
||||||
control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, 0, top,
|
|
||||||
CONTROL_POINT_VERTICAL);
|
|
||||||
m_canvas->AddShape(control);
|
|
||||||
m_controlPoints.Append(control);
|
|
||||||
|
|
||||||
control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, top,
|
|
||||||
CONTROL_POINT_DIAGONAL);
|
|
||||||
m_canvas->AddShape(control);
|
|
||||||
m_controlPoints.Append(control);
|
|
||||||
|
|
||||||
control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, 0,
|
|
||||||
CONTROL_POINT_HORIZONTAL);
|
|
||||||
m_canvas->AddShape(control);
|
|
||||||
m_controlPoints.Append(control);
|
|
||||||
|
|
||||||
control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, bottom,
|
|
||||||
CONTROL_POINT_DIAGONAL);
|
|
||||||
m_canvas->AddShape(control);
|
|
||||||
m_controlPoints.Append(control);
|
|
||||||
|
|
||||||
control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, 0, bottom,
|
|
||||||
CONTROL_POINT_VERTICAL);
|
|
||||||
m_canvas->AddShape(control);
|
|
||||||
m_controlPoints.Append(control);
|
|
||||||
|
|
||||||
control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, bottom,
|
|
||||||
CONTROL_POINT_DIAGONAL);
|
|
||||||
m_canvas->AddShape(control);
|
|
||||||
m_controlPoints.Append(control);
|
|
||||||
|
|
||||||
control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, 0,
|
|
||||||
CONTROL_POINT_HORIZONTAL);
|
|
||||||
m_canvas->AddShape(control);
|
|
||||||
m_controlPoints.Append(control);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPolygonShape::ResetControlPoints()
|
void wxPolygonShape::ResetControlPoints()
|
||||||
@@ -631,50 +575,6 @@ void wxPolygonShape::ResetControlPoints()
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
controlPointNode = controlPointNode->Next();
|
controlPointNode = controlPointNode->Next();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
|
||||||
if (m_controlPoints.Number() < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
double maxX, maxY, minX, minY;
|
|
||||||
|
|
||||||
GetBoundingBoxMax(&maxX, &maxY);
|
|
||||||
GetBoundingBoxMin(&minX, &minY);
|
|
||||||
|
|
||||||
double widthMin = (double)(minX + CONTROL_POINT_SIZE + 2);
|
|
||||||
double heightMin = (double)(minY + CONTROL_POINT_SIZE + 2);
|
|
||||||
|
|
||||||
// Offsets from main object
|
|
||||||
double top = (double)(- (heightMin / 2.0));
|
|
||||||
double bottom = (double)(heightMin / 2.0 + (maxY - minY));
|
|
||||||
double left = (double)(- (widthMin / 2.0));
|
|
||||||
double right = (double)(widthMin / 2.0 + (maxX - minX));
|
|
||||||
|
|
||||||
wxNode *node = m_controlPoints.First();
|
|
||||||
wxControlPoint *control = (wxControlPoint *)node->Data();
|
|
||||||
control->xoffset = left; control->yoffset = top;
|
|
||||||
|
|
||||||
node = node->Next(); control = (wxControlPoint *)node->Data();
|
|
||||||
control->xoffset = 0; control->yoffset = top;
|
|
||||||
|
|
||||||
node = node->Next(); control = (wxControlPoint *)node->Data();
|
|
||||||
control->xoffset = right; control->yoffset = top;
|
|
||||||
|
|
||||||
node = node->Next(); control = (wxControlPoint *)node->Data();
|
|
||||||
control->xoffset = right; control->yoffset = 0;
|
|
||||||
|
|
||||||
node = node->Next(); control = (wxControlPoint *)node->Data();
|
|
||||||
control->xoffset = right; control->yoffset = bottom;
|
|
||||||
|
|
||||||
node = node->Next(); control = (wxControlPoint *)node->Data();
|
|
||||||
control->xoffset = 0; control->yoffset = bottom;
|
|
||||||
|
|
||||||
node = node->Next(); control = (wxControlPoint *)node->Data();
|
|
||||||
control->xoffset = left; control->yoffset = bottom;
|
|
||||||
|
|
||||||
node = node->Next(); control = (wxControlPoint *)node->Data();
|
|
||||||
control->xoffset = left; control->yoffset = 0;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -687,12 +587,12 @@ void wxPolygonShape::WriteAttributes(wxExpr *clause)
|
|||||||
clause->AddAttributeValue("y", m_ypos);
|
clause->AddAttributeValue("y", m_ypos);
|
||||||
|
|
||||||
// Make a list of lists for the coordinates
|
// Make a list of lists for the coordinates
|
||||||
wxExpr *list = new wxExpr(PrologList);
|
wxExpr *list = new wxExpr(wxExprList);
|
||||||
wxNode *node = m_points->First();
|
wxNode *node = m_points->First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxRealPoint *point = (wxRealPoint *)node->Data();
|
wxRealPoint *point = (wxRealPoint *)node->Data();
|
||||||
wxExpr *point_list = new wxExpr(PrologList);
|
wxExpr *point_list = new wxExpr(wxExprList);
|
||||||
wxExpr *x_expr = new wxExpr((double)point->x);
|
wxExpr *x_expr = new wxExpr((double)point->x);
|
||||||
wxExpr *y_expr = new wxExpr((double)point->y);
|
wxExpr *y_expr = new wxExpr((double)point->y);
|
||||||
|
|
||||||
@@ -705,12 +605,12 @@ void wxPolygonShape::WriteAttributes(wxExpr *clause)
|
|||||||
clause->AddAttributeValue("points", list);
|
clause->AddAttributeValue("points", list);
|
||||||
|
|
||||||
// Save the original (unscaled) points
|
// Save the original (unscaled) points
|
||||||
list = new wxExpr(PrologList);
|
list = new wxExpr(wxExprList);
|
||||||
node = m_originalPoints->First();
|
node = m_originalPoints->First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxRealPoint *point = (wxRealPoint *)node->Data();
|
wxRealPoint *point = (wxRealPoint *)node->Data();
|
||||||
wxExpr *point_list = new wxExpr(PrologList);
|
wxExpr *point_list = new wxExpr(wxExprList);
|
||||||
wxExpr *x_expr = new wxExpr((double) point->x);
|
wxExpr *x_expr = new wxExpr((double) point->x);
|
||||||
wxExpr *y_expr = new wxExpr((double) point->y);
|
wxExpr *y_expr = new wxExpr((double) point->y);
|
||||||
point_list->Append(x_expr);
|
point_list->Append(x_expr);
|
||||||
@@ -915,6 +815,53 @@ bool wxPolygonShape::AttachmentIsValid(int attachment)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rotate about the given axis by the given amount in radians
|
||||||
|
void wxPolygonShape::Rotate(double x, double y, double theta)
|
||||||
|
{
|
||||||
|
double actualTheta = theta-m_rotation;
|
||||||
|
|
||||||
|
// Rotate attachment points
|
||||||
|
double sinTheta = (double)sin(actualTheta);
|
||||||
|
double cosTheta = (double)cos(actualTheta);
|
||||||
|
wxNode *node = m_attachmentPoints.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data();
|
||||||
|
double x1 = point->m_x;
|
||||||
|
double y1 = point->m_y;
|
||||||
|
point->m_x = x1*cosTheta - y1*sinTheta + x*(1.0 - cosTheta) + y*sinTheta;
|
||||||
|
point->m_y = x1*sinTheta + y1*cosTheta + y*(1.0 - cosTheta) + x*sinTheta;
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
node = m_points->First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxRealPoint *point = (wxRealPoint *)node->Data();
|
||||||
|
double x1 = point->x;
|
||||||
|
double y1 = point->y;
|
||||||
|
point->x = x1*cosTheta - y1*sinTheta + x*(1.0 - cosTheta) + y*sinTheta;
|
||||||
|
point->y = x1*sinTheta + y1*cosTheta + y*(1.0 - cosTheta) + x*sinTheta;
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
node = m_originalPoints->First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxRealPoint *point = (wxRealPoint *)node->Data();
|
||||||
|
double x1 = point->x;
|
||||||
|
double y1 = point->y;
|
||||||
|
point->x = x1*cosTheta - y1*sinTheta + x*(1.0 - cosTheta) + y*sinTheta;
|
||||||
|
point->y = x1*sinTheta + y1*cosTheta + y*(1.0 - cosTheta) + x*sinTheta;
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_rotation = theta;
|
||||||
|
|
||||||
|
CalculatePolygonCentre();
|
||||||
|
CalculateBoundingBox();
|
||||||
|
ResetControlPoints();
|
||||||
|
}
|
||||||
|
|
||||||
// Rectangle object
|
// Rectangle object
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRectangleShape, wxShape)
|
IMPLEMENT_DYNAMIC_CLASS(wxRectangleShape, wxShape)
|
||||||
@@ -1093,106 +1040,6 @@ bool wxRectangleShape::GetAttachmentPosition(int attachment, double *x, double *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Old code
|
|
||||||
#if 0
|
|
||||||
switch (attachment)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
if (m_spaceAttachments)
|
|
||||||
{
|
|
||||||
if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE))
|
|
||||||
{
|
|
||||||
// Align line according to the next handle along
|
|
||||||
wxRealPoint *point = line->GetNextControlPoint(this);
|
|
||||||
if (point->x < left)
|
|
||||||
*x = left;
|
|
||||||
else if (point->x > right)
|
|
||||||
*x = right;
|
|
||||||
else
|
|
||||||
*x = point->x;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*x = left + (nth + 1)*m_width/(no_arcs + 1);
|
|
||||||
}
|
|
||||||
else *x = m_xpos;
|
|
||||||
|
|
||||||
*y = bottom;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
*x = right;
|
|
||||||
if (m_spaceAttachments)
|
|
||||||
{
|
|
||||||
if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE))
|
|
||||||
{
|
|
||||||
// Align line according to the next handle along
|
|
||||||
wxRealPoint *point = line->GetNextControlPoint(this);
|
|
||||||
if (point->y < bottom)
|
|
||||||
*y = bottom;
|
|
||||||
else if (point->y > top)
|
|
||||||
*y = top;
|
|
||||||
else
|
|
||||||
*y = point->y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*y = bottom + (nth + 1)*m_height/(no_arcs + 1);
|
|
||||||
}
|
|
||||||
else *y = m_ypos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
if (m_spaceAttachments)
|
|
||||||
{
|
|
||||||
if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE))
|
|
||||||
{
|
|
||||||
// Align line according to the next handle along
|
|
||||||
wxRealPoint *point = line->GetNextControlPoint(this);
|
|
||||||
if (point->x < left)
|
|
||||||
*x = left;
|
|
||||||
else if (point->x > right)
|
|
||||||
*x = right;
|
|
||||||
else
|
|
||||||
*x = point->x;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*x = left + (nth + 1)*m_width/(no_arcs + 1);
|
|
||||||
}
|
|
||||||
else *x = m_xpos;
|
|
||||||
*y = top;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
*x = left;
|
|
||||||
if (m_spaceAttachments)
|
|
||||||
{
|
|
||||||
if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE))
|
|
||||||
{
|
|
||||||
// Align line according to the next handle along
|
|
||||||
wxRealPoint *point = line->GetNextControlPoint(this);
|
|
||||||
if (point->y < bottom)
|
|
||||||
*y = bottom;
|
|
||||||
else if (point->y > top)
|
|
||||||
*y = top;
|
|
||||||
else
|
|
||||||
*y = point->y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*y = bottom + (nth + 1)*m_height/(no_arcs + 1);
|
|
||||||
}
|
|
||||||
else *y = m_ypos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
return wxShape::GetAttachmentPosition(attachment, x, y, nth, no_arcs, line);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1397,6 +1244,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxCircleShape, wxEllipseShape)
|
|||||||
|
|
||||||
wxCircleShape::wxCircleShape(double diameter):wxEllipseShape(diameter, diameter)
|
wxCircleShape::wxCircleShape(double diameter):wxEllipseShape(diameter, diameter)
|
||||||
{
|
{
|
||||||
|
SetMaintainAspectRatio(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCircleShape::Copy(wxShape& copy)
|
void wxCircleShape::Copy(wxShape& copy)
|
||||||
@@ -1418,14 +1266,14 @@ bool wxCircleShape::GetPerimeterPoint(double x1, double y1,
|
|||||||
|
|
||||||
// Control points
|
// Control points
|
||||||
|
|
||||||
double wxControlPoint::controlPointDragStartX = 0.0;
|
double wxControlPoint::sm_controlPointDragStartX = 0.0;
|
||||||
double wxControlPoint::controlPointDragStartY = 0.0;
|
double wxControlPoint::sm_controlPointDragStartY = 0.0;
|
||||||
double wxControlPoint::controlPointDragStartWidth = 0.0;
|
double wxControlPoint::sm_controlPointDragStartWidth = 0.0;
|
||||||
double wxControlPoint::controlPointDragStartHeight = 0.0;
|
double wxControlPoint::sm_controlPointDragStartHeight = 0.0;
|
||||||
double wxControlPoint::controlPointDragEndWidth = 0.0;
|
double wxControlPoint::sm_controlPointDragEndWidth = 0.0;
|
||||||
double wxControlPoint::controlPointDragEndHeight = 0.0;
|
double wxControlPoint::sm_controlPointDragEndHeight = 0.0;
|
||||||
double wxControlPoint::controlPointDragPosX = 0.0;
|
double wxControlPoint::sm_controlPointDragPosX = 0.0;
|
||||||
double wxControlPoint::controlPointDragPosY = 0.0;
|
double wxControlPoint::sm_controlPointDragPosY = 0.0;
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxControlPoint, wxRectangleShape)
|
IMPLEMENT_DYNAMIC_CLASS(wxControlPoint, wxRectangleShape)
|
||||||
|
|
||||||
@@ -1517,9 +1365,23 @@ void wxShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y
|
|||||||
|
|
||||||
// Constrain sizing according to what control point you're dragging
|
// Constrain sizing according to what control point you're dragging
|
||||||
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
||||||
new_height = bound_y;
|
{
|
||||||
|
if (GetMaintainAspectRatio())
|
||||||
|
{
|
||||||
|
new_height = bound_y*(new_width/bound_x);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
new_height = bound_y;
|
||||||
|
}
|
||||||
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
||||||
new_width = bound_x;
|
{
|
||||||
|
if (GetMaintainAspectRatio())
|
||||||
|
{
|
||||||
|
new_width = bound_x*(new_height/bound_y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
new_width = bound_x;
|
||||||
|
}
|
||||||
else if (pt->m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT))
|
else if (pt->m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT))
|
||||||
new_height = bound_y*(new_width/bound_x);
|
new_height = bound_y*(new_width/bound_x);
|
||||||
|
|
||||||
@@ -1529,8 +1391,8 @@ void wxShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y
|
|||||||
if (this->GetFixedHeight())
|
if (this->GetFixedHeight())
|
||||||
new_height = bound_y;
|
new_height = bound_y;
|
||||||
|
|
||||||
pt->controlPointDragEndWidth = new_width;
|
pt->sm_controlPointDragEndWidth = new_width;
|
||||||
pt->controlPointDragEndHeight = new_height;
|
pt->sm_controlPointDragEndHeight = new_height;
|
||||||
|
|
||||||
this->GetEventHandler()->OnDrawOutline(dc, this->GetX(), this->GetY(),
|
this->GetEventHandler()->OnDrawOutline(dc, this->GetX(), this->GetY(),
|
||||||
new_width, new_height);
|
new_width, new_height);
|
||||||
@@ -1538,24 +1400,24 @@ void wxShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Don't maintain the same centre point!
|
// Don't maintain the same centre point!
|
||||||
double newX1 = wxMin(pt->controlPointDragStartX, x);
|
double newX1 = wxMin(pt->sm_controlPointDragStartX, x);
|
||||||
double newY1 = wxMin(pt->controlPointDragStartY, y);
|
double newY1 = wxMin(pt->sm_controlPointDragStartY, y);
|
||||||
double newX2 = wxMax(pt->controlPointDragStartX, x);
|
double newX2 = wxMax(pt->sm_controlPointDragStartX, x);
|
||||||
double newY2 = wxMax(pt->controlPointDragStartY, y);
|
double newY2 = wxMax(pt->sm_controlPointDragStartY, y);
|
||||||
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
||||||
{
|
{
|
||||||
newY1 = pt->controlPointDragStartY;
|
newY1 = pt->sm_controlPointDragStartY;
|
||||||
newY2 = newY1 + pt->controlPointDragStartHeight;
|
newY2 = newY1 + pt->sm_controlPointDragStartHeight;
|
||||||
}
|
}
|
||||||
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
||||||
{
|
{
|
||||||
newX1 = pt->controlPointDragStartX;
|
newX1 = pt->sm_controlPointDragStartX;
|
||||||
newX2 = newX1 + pt->controlPointDragStartWidth;
|
newX2 = newX1 + pt->sm_controlPointDragStartWidth;
|
||||||
}
|
}
|
||||||
else if (pt->m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT))
|
else if (pt->m_type == CONTROL_POINT_DIAGONAL && ((keys & KEY_SHIFT) || GetMaintainAspectRatio()))
|
||||||
{
|
{
|
||||||
double newH = (double)((newX2 - newX1)*(pt->controlPointDragStartHeight/pt->controlPointDragStartWidth));
|
double newH = (double)((newX2 - newX1)*(pt->sm_controlPointDragStartHeight/pt->sm_controlPointDragStartWidth));
|
||||||
if (GetY() > pt->controlPointDragStartY)
|
if (GetY() > pt->sm_controlPointDragStartY)
|
||||||
newY2 = (double)(newY1 + newH);
|
newY2 = (double)(newY1 + newH);
|
||||||
else
|
else
|
||||||
newY1 = (double)(newY2 - newH);
|
newY1 = (double)(newY2 - newH);
|
||||||
@@ -1563,17 +1425,27 @@ void wxShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y
|
|||||||
double newWidth = (double)(newX2 - newX1);
|
double newWidth = (double)(newX2 - newX1);
|
||||||
double newHeight = (double)(newY2 - newY1);
|
double newHeight = (double)(newY2 - newY1);
|
||||||
|
|
||||||
pt->controlPointDragPosX = (double)(newX1 + (newWidth/2.0));
|
if (pt->m_type == CONTROL_POINT_VERTICAL && GetMaintainAspectRatio())
|
||||||
pt->controlPointDragPosY = (double)(newY1 + (newHeight/2.0));
|
{
|
||||||
|
newWidth = bound_x * (newHeight/bound_y) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pt->m_type == CONTROL_POINT_HORIZONTAL && GetMaintainAspectRatio())
|
||||||
|
{
|
||||||
|
newHeight = bound_y * (newWidth/bound_x) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
pt->sm_controlPointDragPosX = (double)(newX1 + (newWidth/2.0));
|
||||||
|
pt->sm_controlPointDragPosY = (double)(newY1 + (newHeight/2.0));
|
||||||
if (this->GetFixedWidth())
|
if (this->GetFixedWidth())
|
||||||
newWidth = bound_x;
|
newWidth = bound_x;
|
||||||
|
|
||||||
if (this->GetFixedHeight())
|
if (this->GetFixedHeight())
|
||||||
newHeight = bound_y;
|
newHeight = bound_y;
|
||||||
|
|
||||||
pt->controlPointDragEndWidth = newWidth;
|
pt->sm_controlPointDragEndWidth = newWidth;
|
||||||
pt->controlPointDragEndHeight = newHeight;
|
pt->sm_controlPointDragEndHeight = newHeight;
|
||||||
this->GetEventHandler()->OnDrawOutline(dc, pt->controlPointDragPosX, pt->controlPointDragPosY, newWidth, newHeight);
|
this->GetEventHandler()->OnDrawOutline(dc, pt->sm_controlPointDragPosX, pt->sm_controlPointDragPosY, newWidth, newHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1597,23 +1469,23 @@ void wxShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int
|
|||||||
// Choose the 'opposite corner' of the object as the stationary
|
// Choose the 'opposite corner' of the object as the stationary
|
||||||
// point in case this is non-centring resizing.
|
// point in case this is non-centring resizing.
|
||||||
if (pt->GetX() < this->GetX())
|
if (pt->GetX() < this->GetX())
|
||||||
pt->controlPointDragStartX = (double)(this->GetX() + (bound_x/2.0));
|
pt->sm_controlPointDragStartX = (double)(this->GetX() + (bound_x/2.0));
|
||||||
else
|
else
|
||||||
pt->controlPointDragStartX = (double)(this->GetX() - (bound_x/2.0));
|
pt->sm_controlPointDragStartX = (double)(this->GetX() - (bound_x/2.0));
|
||||||
|
|
||||||
if (pt->GetY() < this->GetY())
|
if (pt->GetY() < this->GetY())
|
||||||
pt->controlPointDragStartY = (double)(this->GetY() + (bound_y/2.0));
|
pt->sm_controlPointDragStartY = (double)(this->GetY() + (bound_y/2.0));
|
||||||
else
|
else
|
||||||
pt->controlPointDragStartY = (double)(this->GetY() - (bound_y/2.0));
|
pt->sm_controlPointDragStartY = (double)(this->GetY() - (bound_y/2.0));
|
||||||
|
|
||||||
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
||||||
pt->controlPointDragStartY = (double)(this->GetY() - (bound_y/2.0));
|
pt->sm_controlPointDragStartY = (double)(this->GetY() - (bound_y/2.0));
|
||||||
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
||||||
pt->controlPointDragStartX = (double)(this->GetX() - (bound_x/2.0));
|
pt->sm_controlPointDragStartX = (double)(this->GetX() - (bound_x/2.0));
|
||||||
|
|
||||||
// We may require the old width and height.
|
// We may require the old width and height.
|
||||||
pt->controlPointDragStartWidth = bound_x;
|
pt->sm_controlPointDragStartWidth = bound_x;
|
||||||
pt->controlPointDragStartHeight = bound_y;
|
pt->sm_controlPointDragStartHeight = bound_y;
|
||||||
|
|
||||||
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
|
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
|
||||||
dc.SetPen(dottedPen);
|
dc.SetPen(dottedPen);
|
||||||
@@ -1626,9 +1498,23 @@ void wxShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int
|
|||||||
|
|
||||||
// Constrain sizing according to what control point you're dragging
|
// Constrain sizing according to what control point you're dragging
|
||||||
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
||||||
new_height = bound_y;
|
{
|
||||||
|
if (GetMaintainAspectRatio())
|
||||||
|
{
|
||||||
|
new_height = bound_y*(new_width/bound_x);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
new_height = bound_y;
|
||||||
|
}
|
||||||
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
||||||
new_width = bound_x;
|
{
|
||||||
|
if (GetMaintainAspectRatio())
|
||||||
|
{
|
||||||
|
new_width = bound_x*(new_height/bound_y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
new_width = bound_x;
|
||||||
|
}
|
||||||
else if (pt->m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT))
|
else if (pt->m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT))
|
||||||
new_height = bound_y*(new_width/bound_x);
|
new_height = bound_y*(new_width/bound_x);
|
||||||
|
|
||||||
@@ -1638,32 +1524,32 @@ void wxShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int
|
|||||||
if (this->GetFixedHeight())
|
if (this->GetFixedHeight())
|
||||||
new_height = bound_y;
|
new_height = bound_y;
|
||||||
|
|
||||||
pt->controlPointDragEndWidth = new_width;
|
pt->sm_controlPointDragEndWidth = new_width;
|
||||||
pt->controlPointDragEndHeight = new_height;
|
pt->sm_controlPointDragEndHeight = new_height;
|
||||||
this->GetEventHandler()->OnDrawOutline(dc, this->GetX(), this->GetY(),
|
this->GetEventHandler()->OnDrawOutline(dc, this->GetX(), this->GetY(),
|
||||||
new_width, new_height);
|
new_width, new_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Don't maintain the same centre point!
|
// Don't maintain the same centre point!
|
||||||
double newX1 = wxMin(pt->controlPointDragStartX, x);
|
double newX1 = wxMin(pt->sm_controlPointDragStartX, x);
|
||||||
double newY1 = wxMin(pt->controlPointDragStartY, y);
|
double newY1 = wxMin(pt->sm_controlPointDragStartY, y);
|
||||||
double newX2 = wxMax(pt->controlPointDragStartX, x);
|
double newX2 = wxMax(pt->sm_controlPointDragStartX, x);
|
||||||
double newY2 = wxMax(pt->controlPointDragStartY, y);
|
double newY2 = wxMax(pt->sm_controlPointDragStartY, y);
|
||||||
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
if (pt->m_type == CONTROL_POINT_HORIZONTAL)
|
||||||
{
|
{
|
||||||
newY1 = pt->controlPointDragStartY;
|
newY1 = pt->sm_controlPointDragStartY;
|
||||||
newY2 = newY1 + pt->controlPointDragStartHeight;
|
newY2 = newY1 + pt->sm_controlPointDragStartHeight;
|
||||||
}
|
}
|
||||||
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
else if (pt->m_type == CONTROL_POINT_VERTICAL)
|
||||||
{
|
{
|
||||||
newX1 = pt->controlPointDragStartX;
|
newX1 = pt->sm_controlPointDragStartX;
|
||||||
newX2 = newX1 + pt->controlPointDragStartWidth;
|
newX2 = newX1 + pt->sm_controlPointDragStartWidth;
|
||||||
}
|
}
|
||||||
else if (pt->m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT))
|
else if (pt->m_type == CONTROL_POINT_DIAGONAL && ((keys & KEY_SHIFT) || GetMaintainAspectRatio()))
|
||||||
{
|
{
|
||||||
double newH = (double)((newX2 - newX1)*(pt->controlPointDragStartHeight/pt->controlPointDragStartWidth));
|
double newH = (double)((newX2 - newX1)*(pt->sm_controlPointDragStartHeight/pt->sm_controlPointDragStartWidth));
|
||||||
if (pt->GetY() > pt->controlPointDragStartY)
|
if (pt->GetY() > pt->sm_controlPointDragStartY)
|
||||||
newY2 = (double)(newY1 + newH);
|
newY2 = (double)(newY1 + newH);
|
||||||
else
|
else
|
||||||
newY1 = (double)(newY2 - newH);
|
newY1 = (double)(newY2 - newH);
|
||||||
@@ -1671,17 +1557,27 @@ void wxShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int
|
|||||||
double newWidth = (double)(newX2 - newX1);
|
double newWidth = (double)(newX2 - newX1);
|
||||||
double newHeight = (double)(newY2 - newY1);
|
double newHeight = (double)(newY2 - newY1);
|
||||||
|
|
||||||
pt->controlPointDragPosX = (double)(newX1 + (newWidth/2.0));
|
if (pt->m_type == CONTROL_POINT_VERTICAL && GetMaintainAspectRatio())
|
||||||
pt->controlPointDragPosY = (double)(newY1 + (newHeight/2.0));
|
{
|
||||||
|
newWidth = bound_x * (newHeight/bound_y) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pt->m_type == CONTROL_POINT_HORIZONTAL && GetMaintainAspectRatio())
|
||||||
|
{
|
||||||
|
newHeight = bound_y * (newWidth/bound_x) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
pt->sm_controlPointDragPosX = (double)(newX1 + (newWidth/2.0));
|
||||||
|
pt->sm_controlPointDragPosY = (double)(newY1 + (newHeight/2.0));
|
||||||
if (this->GetFixedWidth())
|
if (this->GetFixedWidth())
|
||||||
newWidth = bound_x;
|
newWidth = bound_x;
|
||||||
|
|
||||||
if (this->GetFixedHeight())
|
if (this->GetFixedHeight())
|
||||||
newHeight = bound_y;
|
newHeight = bound_y;
|
||||||
|
|
||||||
pt->controlPointDragEndWidth = newWidth;
|
pt->sm_controlPointDragEndWidth = newWidth;
|
||||||
pt->controlPointDragEndHeight = newHeight;
|
pt->sm_controlPointDragEndHeight = newHeight;
|
||||||
this->GetEventHandler()->OnDrawOutline(dc, pt->controlPointDragPosX, pt->controlPointDragPosY, newWidth, newHeight);
|
this->GetEventHandler()->OnDrawOutline(dc, pt->sm_controlPointDragPosX, pt->sm_controlPointDragPosY, newWidth, newHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1701,7 +1597,7 @@ void wxShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int ke
|
|||||||
this->Show(FALSE);
|
this->Show(FALSE);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this->SetSize(pt->controlPointDragEndWidth, pt->controlPointDragEndHeight);
|
this->SetSize(pt->sm_controlPointDragEndWidth, pt->sm_controlPointDragEndHeight);
|
||||||
|
|
||||||
// The next operation could destroy this control point (it does for label objects,
|
// The next operation could destroy this control point (it does for label objects,
|
||||||
// via formatting the text), so save all values we're going to use, or
|
// via formatting the text), so save all values we're going to use, or
|
||||||
@@ -1713,7 +1609,7 @@ void wxShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int ke
|
|||||||
if (theObject->GetCentreResize())
|
if (theObject->GetCentreResize())
|
||||||
theObject->Move(dc, theObject->GetX(), theObject->GetY());
|
theObject->Move(dc, theObject->GetX(), theObject->GetY());
|
||||||
else
|
else
|
||||||
theObject->Move(dc, pt->controlPointDragPosX, pt->controlPointDragPosY);
|
theObject->Move(dc, pt->sm_controlPointDragPosX, pt->sm_controlPointDragPosY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (!eraseIt)
|
if (!eraseIt)
|
||||||
|
@@ -78,14 +78,14 @@ public:
|
|||||||
* Store original top-left, bottom-right coordinates
|
* Store original top-left, bottom-right coordinates
|
||||||
* in case we're doing non-vertical resizing.
|
* in case we're doing non-vertical resizing.
|
||||||
*/
|
*/
|
||||||
static double controlPointDragStartX;
|
static double sm_controlPointDragStartX;
|
||||||
static double controlPointDragStartY;
|
static double sm_controlPointDragStartY;
|
||||||
static double controlPointDragStartWidth;
|
static double sm_controlPointDragStartWidth;
|
||||||
static double controlPointDragStartHeight;
|
static double sm_controlPointDragStartHeight;
|
||||||
static double controlPointDragEndWidth;
|
static double sm_controlPointDragEndWidth;
|
||||||
static double controlPointDragEndHeight;
|
static double sm_controlPointDragEndHeight;
|
||||||
static double controlPointDragPosX;
|
static double sm_controlPointDragPosX;
|
||||||
static double controlPointDragPosY;
|
static double sm_controlPointDragPosY;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxPolygonShape;
|
class wxPolygonShape;
|
||||||
|
@@ -620,15 +620,15 @@ void wxCompositeShape::WriteAttributes(wxExpr *clause)
|
|||||||
|
|
||||||
// Each constraint is stored in the form
|
// Each constraint is stored in the form
|
||||||
// (type name id xspacing yspacing m_constrainingObjectId constrainedObjectIdList)
|
// (type name id xspacing yspacing m_constrainingObjectId constrainedObjectIdList)
|
||||||
wxExpr *constraintExpr = new wxExpr(PrologList);
|
wxExpr *constraintExpr = new wxExpr(wxExprList);
|
||||||
constraintExpr->Append(new wxExpr((long)constraint->m_constraintType));
|
constraintExpr->Append(new wxExpr((long)constraint->m_constraintType));
|
||||||
constraintExpr->Append(new wxExpr(PrologString, constraint->m_constraintName));
|
constraintExpr->Append(new wxExpr(wxExprString, constraint->m_constraintName));
|
||||||
constraintExpr->Append(new wxExpr(constraint->m_constraintId));
|
constraintExpr->Append(new wxExpr(constraint->m_constraintId));
|
||||||
constraintExpr->Append(new wxExpr(constraint->m_xSpacing));
|
constraintExpr->Append(new wxExpr(constraint->m_xSpacing));
|
||||||
constraintExpr->Append(new wxExpr(constraint->m_ySpacing));
|
constraintExpr->Append(new wxExpr(constraint->m_ySpacing));
|
||||||
constraintExpr->Append(new wxExpr(constraint->m_constrainingObject->GetId()));
|
constraintExpr->Append(new wxExpr(constraint->m_constrainingObject->GetId()));
|
||||||
|
|
||||||
wxExpr *objectList = new wxExpr(PrologList);
|
wxExpr *objectList = new wxExpr(wxExprList);
|
||||||
wxNode *node1 = constraint->m_constrainedObjects.First();
|
wxNode *node1 = constraint->m_constrainedObjects.First();
|
||||||
while (node1)
|
while (node1)
|
||||||
{
|
{
|
||||||
@@ -645,7 +645,7 @@ void wxCompositeShape::WriteAttributes(wxExpr *clause)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write the ids of all the child images
|
// Write the ids of all the child images
|
||||||
wxExpr *childrenExpr = new wxExpr(PrologList);
|
wxExpr *childrenExpr = new wxExpr(wxExprList);
|
||||||
node = m_children.First();
|
node = m_children.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -658,7 +658,7 @@ void wxCompositeShape::WriteAttributes(wxExpr *clause)
|
|||||||
// Write the ids of all the division images
|
// Write the ids of all the division images
|
||||||
if (m_divisions.Number() > 0)
|
if (m_divisions.Number() > 0)
|
||||||
{
|
{
|
||||||
wxExpr *divisionsExpr = new wxExpr(PrologList);
|
wxExpr *divisionsExpr = new wxExpr(wxExprList);
|
||||||
node = m_divisions.First();
|
node = m_divisions.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
|
@@ -78,7 +78,6 @@ public:
|
|||||||
void CalculateSize();
|
void CalculateSize();
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
|
||||||
void WriteAttributes(wxExpr *clause);
|
void WriteAttributes(wxExpr *clause);
|
||||||
void ReadAttributes(wxExpr *clause);
|
void ReadAttributes(wxExpr *clause);
|
||||||
// In case the object has constraints it needs to read in in a different pass
|
// In case the object has constraints it needs to read in in a different pass
|
||||||
@@ -154,7 +153,6 @@ class wxDivisionShape: public wxCompositeShape
|
|||||||
void ResetMandatoryControlPoints();
|
void ResetMandatoryControlPoints();
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
|
||||||
void WriteAttributes(wxExpr *clause);
|
void WriteAttributes(wxExpr *clause);
|
||||||
void ReadAttributes(wxExpr *clause);
|
void ReadAttributes(wxExpr *clause);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -47,7 +47,6 @@ class wxDividedShape: public wxRectangleShape
|
|||||||
void ResetMandatoryControlPoints();
|
void ResetMandatoryControlPoints();
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
|
||||||
void WriteAttributes(wxExpr *clause);
|
void WriteAttributes(wxExpr *clause);
|
||||||
void ReadAttributes(wxExpr *clause);
|
void ReadAttributes(wxExpr *clause);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -240,6 +240,7 @@ void wxDrawnShape::WriteAttributes(wxExpr *clause)
|
|||||||
{
|
{
|
||||||
wxRectangleShape::WriteAttributes(clause);
|
wxRectangleShape::WriteAttributes(clause);
|
||||||
|
|
||||||
|
clause->AddAttributeValue("current_angle", (long)m_currentAngle);
|
||||||
clause->AddAttributeValue("save_metafile", (long)m_saveToFile);
|
clause->AddAttributeValue("save_metafile", (long)m_saveToFile);
|
||||||
if (m_saveToFile)
|
if (m_saveToFile)
|
||||||
{
|
{
|
||||||
@@ -257,7 +258,8 @@ void wxDrawnShape::ReadAttributes(wxExpr *clause)
|
|||||||
wxRectangleShape::ReadAttributes(clause);
|
wxRectangleShape::ReadAttributes(clause);
|
||||||
|
|
||||||
int iVal = (int) m_saveToFile;
|
int iVal = (int) m_saveToFile;
|
||||||
clause->AssignAttributeValue("save_metafile", &iVal);
|
clause->GetAttributeValue("save_metafile", iVal);
|
||||||
|
clause->GetAttributeValue("current_angle", m_currentAngle);
|
||||||
m_saveToFile = (iVal != 0);
|
m_saveToFile = (iVal != 0);
|
||||||
|
|
||||||
if (m_saveToFile)
|
if (m_saveToFile)
|
||||||
@@ -521,7 +523,7 @@ wxDrawOp *wxOpSetGDI::Copy(wxPseudoMetaFile *newImage)
|
|||||||
|
|
||||||
wxExpr *wxOpSetGDI::WriteExpr(wxPseudoMetaFile *image)
|
wxExpr *wxOpSetGDI::WriteExpr(wxPseudoMetaFile *image)
|
||||||
{
|
{
|
||||||
wxExpr *expr = new wxExpr(PrologList);
|
wxExpr *expr = new wxExpr(wxExprList);
|
||||||
expr->Append(new wxExpr((long)m_op));
|
expr->Append(new wxExpr((long)m_op));
|
||||||
switch (m_op)
|
switch (m_op)
|
||||||
{
|
{
|
||||||
@@ -635,7 +637,7 @@ void wxOpSetClipping::Translate(double x, double y)
|
|||||||
|
|
||||||
wxExpr *wxOpSetClipping::WriteExpr(wxPseudoMetaFile *image)
|
wxExpr *wxOpSetClipping::WriteExpr(wxPseudoMetaFile *image)
|
||||||
{
|
{
|
||||||
wxExpr *expr = new wxExpr(PrologList);
|
wxExpr *expr = new wxExpr(wxExprList);
|
||||||
expr->Append(new wxExpr((long)m_op));
|
expr->Append(new wxExpr((long)m_op));
|
||||||
switch (m_op)
|
switch (m_op)
|
||||||
{
|
{
|
||||||
@@ -879,7 +881,7 @@ void wxOpDraw::Rotate(double x, double y, double theta, double sinTheta, double
|
|||||||
|
|
||||||
wxExpr *wxOpDraw::WriteExpr(wxPseudoMetaFile *image)
|
wxExpr *wxOpDraw::WriteExpr(wxPseudoMetaFile *image)
|
||||||
{
|
{
|
||||||
wxExpr *expr = new wxExpr(PrologList);
|
wxExpr *expr = new wxExpr(wxExprList);
|
||||||
expr->Append(new wxExpr((long)m_op));
|
expr->Append(new wxExpr((long)m_op));
|
||||||
switch (m_op)
|
switch (m_op)
|
||||||
{
|
{
|
||||||
@@ -912,7 +914,7 @@ wxExpr *wxOpDraw::WriteExpr(wxPseudoMetaFile *image)
|
|||||||
{
|
{
|
||||||
expr->Append(new wxExpr(m_x1));
|
expr->Append(new wxExpr(m_x1));
|
||||||
expr->Append(new wxExpr(m_y1));
|
expr->Append(new wxExpr(m_y1));
|
||||||
expr->Append(new wxExpr(PrologString, m_textString));
|
expr->Append(new wxExpr(wxExprString, m_textString));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DRAWOP_DRAW_ARC:
|
case DRAWOP_DRAW_ARC:
|
||||||
@@ -1103,7 +1105,7 @@ void wxOpPolyDraw::Rotate(double x, double y, double theta, double sinTheta, dou
|
|||||||
|
|
||||||
wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image)
|
wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image)
|
||||||
{
|
{
|
||||||
wxExpr *expr = new wxExpr(PrologList);
|
wxExpr *expr = new wxExpr(wxExprList);
|
||||||
expr->Append(new wxExpr((long)m_op));
|
expr->Append(new wxExpr((long)m_op));
|
||||||
expr->Append(new wxExpr((long)m_noPoints));
|
expr->Append(new wxExpr((long)m_noPoints));
|
||||||
|
|
||||||
@@ -1140,7 +1142,7 @@ wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image)
|
|||||||
strcat(oglBuffer, buf3);
|
strcat(oglBuffer, buf3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expr->Append(new wxExpr(PrologString, oglBuffer));
|
expr->Append(new wxExpr(wxExprString, oglBuffer));
|
||||||
return expr;
|
return expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1480,7 +1482,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
|
|||||||
if (obj->IsKindOf(CLASSINFO(wxPen)))
|
if (obj->IsKindOf(CLASSINFO(wxPen)))
|
||||||
{
|
{
|
||||||
wxPen *thePen = (wxPen *)obj;
|
wxPen *thePen = (wxPen *)obj;
|
||||||
expr = new wxExpr(PrologList);
|
expr = new wxExpr(wxExprList);
|
||||||
expr->Append(new wxExpr((long)gyTYPE_PEN));
|
expr->Append(new wxExpr((long)gyTYPE_PEN));
|
||||||
expr->Append(new wxExpr((long)thePen->GetWidth()));
|
expr->Append(new wxExpr((long)thePen->GetWidth()));
|
||||||
expr->Append(new wxExpr((long)thePen->GetStyle()));
|
expr->Append(new wxExpr((long)thePen->GetStyle()));
|
||||||
@@ -1491,7 +1493,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
|
|||||||
else if (obj->IsKindOf(CLASSINFO(wxBrush)))
|
else if (obj->IsKindOf(CLASSINFO(wxBrush)))
|
||||||
{
|
{
|
||||||
wxBrush *theBrush = (wxBrush *)obj;
|
wxBrush *theBrush = (wxBrush *)obj;
|
||||||
expr = new wxExpr(PrologList);
|
expr = new wxExpr(wxExprList);
|
||||||
expr->Append(new wxExpr((long)gyTYPE_BRUSH));
|
expr->Append(new wxExpr((long)gyTYPE_BRUSH));
|
||||||
expr->Append(new wxExpr((long)theBrush->GetStyle()));
|
expr->Append(new wxExpr((long)theBrush->GetStyle()));
|
||||||
expr->Append(new wxExpr((long)theBrush->GetColour().Red()));
|
expr->Append(new wxExpr((long)theBrush->GetColour().Red()));
|
||||||
@@ -1501,7 +1503,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
|
|||||||
else if (obj->IsKindOf(CLASSINFO(wxFont)))
|
else if (obj->IsKindOf(CLASSINFO(wxFont)))
|
||||||
{
|
{
|
||||||
wxFont *theFont = (wxFont *)obj;
|
wxFont *theFont = (wxFont *)obj;
|
||||||
expr = new wxExpr(PrologList);
|
expr = new wxExpr(wxExprList);
|
||||||
expr->Append(new wxExpr((long)gyTYPE_FONT));
|
expr->Append(new wxExpr((long)gyTYPE_FONT));
|
||||||
expr->Append(new wxExpr((long)theFont->GetPointSize()));
|
expr->Append(new wxExpr((long)theFont->GetPointSize()));
|
||||||
expr->Append(new wxExpr((long)theFont->GetFamily()));
|
expr->Append(new wxExpr((long)theFont->GetFamily()));
|
||||||
@@ -1513,7 +1515,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If no recognised GDI object, append a place holder anyway.
|
// If no recognised GDI object, append a place holder anyway.
|
||||||
expr = new wxExpr(PrologList);
|
expr = new wxExpr(wxExprList);
|
||||||
expr->Append(new wxExpr((long)0));
|
expr->Append(new wxExpr((long)0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1544,7 +1546,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
|
|||||||
// Write outline and fill GDI op lists (if any)
|
// Write outline and fill GDI op lists (if any)
|
||||||
if (m_outlineColours.Number() > 0)
|
if (m_outlineColours.Number() > 0)
|
||||||
{
|
{
|
||||||
wxExpr *outlineExpr = new wxExpr(PrologList);
|
wxExpr *outlineExpr = new wxExpr(wxExprList);
|
||||||
node = m_outlineColours.First();
|
node = m_outlineColours.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -1558,7 +1560,7 @@ void wxPseudoMetaFile::WriteAttributes(wxExpr *clause, int whichAngle)
|
|||||||
}
|
}
|
||||||
if (m_fillColours.Number() > 0)
|
if (m_fillColours.Number() > 0)
|
||||||
{
|
{
|
||||||
wxExpr *fillExpr = new wxExpr(PrologList);
|
wxExpr *fillExpr = new wxExpr(wxExprList);
|
||||||
node = m_fillColours.First();
|
node = m_fillColours.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
|
@@ -1393,12 +1393,12 @@ void wxLineShape::WriteAttributes(wxExpr *clause)
|
|||||||
clause->AddAttributeValue("keep_lines_straight", (long)m_maintainStraightLines);
|
clause->AddAttributeValue("keep_lines_straight", (long)m_maintainStraightLines);
|
||||||
|
|
||||||
// Make a list of lists for the (sp)line controls
|
// Make a list of lists for the (sp)line controls
|
||||||
wxExpr *list = new wxExpr(PrologList);
|
wxExpr *list = new wxExpr(wxExprList);
|
||||||
wxNode *node = m_lineControlPoints->First();
|
wxNode *node = m_lineControlPoints->First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxRealPoint *point = (wxRealPoint *)node->Data();
|
wxRealPoint *point = (wxRealPoint *)node->Data();
|
||||||
wxExpr *point_list = new wxExpr(PrologList);
|
wxExpr *point_list = new wxExpr(wxExprList);
|
||||||
wxExpr *x_expr = new wxExpr((double) point->x);
|
wxExpr *x_expr = new wxExpr((double) point->x);
|
||||||
wxExpr *y_expr = new wxExpr((double) point->y);
|
wxExpr *y_expr = new wxExpr((double) point->y);
|
||||||
point_list->Append(x_expr);
|
point_list->Append(x_expr);
|
||||||
@@ -1414,17 +1414,17 @@ void wxLineShape::WriteAttributes(wxExpr *clause)
|
|||||||
// (arrowType arrowEnd xOffset arrowSize)
|
// (arrowType arrowEnd xOffset arrowSize)
|
||||||
if (m_arcArrows.Number() > 0)
|
if (m_arcArrows.Number() > 0)
|
||||||
{
|
{
|
||||||
wxExpr *arrow_list = new wxExpr(PrologList);
|
wxExpr *arrow_list = new wxExpr(wxExprList);
|
||||||
node = m_arcArrows.First();
|
node = m_arcArrows.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxArrowHead *head = (wxArrowHead *)node->Data();
|
wxArrowHead *head = (wxArrowHead *)node->Data();
|
||||||
wxExpr *head_list = new wxExpr(PrologList);
|
wxExpr *head_list = new wxExpr(wxExprList);
|
||||||
head_list->Append(new wxExpr((long)head->_GetType()));
|
head_list->Append(new wxExpr((long)head->_GetType()));
|
||||||
head_list->Append(new wxExpr((long)head->GetArrowEnd()));
|
head_list->Append(new wxExpr((long)head->GetArrowEnd()));
|
||||||
head_list->Append(new wxExpr(head->GetXOffset()));
|
head_list->Append(new wxExpr(head->GetXOffset()));
|
||||||
head_list->Append(new wxExpr(head->GetArrowSize()));
|
head_list->Append(new wxExpr(head->GetArrowSize()));
|
||||||
head_list->Append(new wxExpr(PrologString, (head->GetName() ? head->GetName() : "")));
|
head_list->Append(new wxExpr(wxExprString, (head->GetName() ? head->GetName() : "")));
|
||||||
head_list->Append(new wxExpr(head->GetId()));
|
head_list->Append(new wxExpr(head->GetId()));
|
||||||
|
|
||||||
// New members of wxArrowHead
|
// New members of wxArrowHead
|
||||||
|
@@ -300,7 +300,7 @@ bool wxDiagram::LoadFile(const wxString& filename)
|
|||||||
{
|
{
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
wxExprDatabase database(PrologInteger, "id");
|
wxExprDatabase database(wxExprInteger, "id");
|
||||||
if (!database.Read(filename))
|
if (!database.Read(filename))
|
||||||
{
|
{
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
@@ -578,4 +578,17 @@ void wxDiagram::SetCanvas(wxShapeCanvas *can)
|
|||||||
m_diagramCanvas = can;
|
m_diagramCanvas = can;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find a shape by its id
|
||||||
|
wxShape* wxDiagram::FindShape(long id) const
|
||||||
|
{
|
||||||
|
wxNode* node = GetShapeList()->First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxShape* shape = (wxShape*) node->Data();
|
||||||
|
if (shape->GetId() == id)
|
||||||
|
return shape;
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -56,15 +56,18 @@ public:
|
|||||||
virtual void DeleteAllShapes();
|
virtual void DeleteAllShapes();
|
||||||
virtual void ShowAll(bool show);
|
virtual void ShowAll(bool show);
|
||||||
|
|
||||||
|
// Find a shape by its id
|
||||||
|
wxShape* FindShape(long id) const;
|
||||||
|
|
||||||
inline void SetMouseTolerance(int tol) { m_mouseTolerance = tol; }
|
inline void SetMouseTolerance(int tol) { m_mouseTolerance = tol; }
|
||||||
inline int GetMouseTolerance() const { return m_mouseTolerance; }
|
inline int GetMouseTolerance() const { return m_mouseTolerance; }
|
||||||
inline wxList *GetShapeList() const { return m_shapeList; }
|
inline wxList *GetShapeList() const { return m_shapeList; }
|
||||||
|
inline int GetCount() const { return m_shapeList->Number(); }
|
||||||
|
|
||||||
// Make sure all text that should be centred, is centred.
|
// Make sure all text that should be centred, is centred.
|
||||||
void RecentreAll(wxDC& dc);
|
void RecentreAll(wxDC& dc);
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
|
||||||
virtual bool SaveFile(const wxString& filename);
|
virtual bool SaveFile(const wxString& filename);
|
||||||
virtual bool LoadFile(const wxString& filename);
|
virtual bool LoadFile(const wxString& filename);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user