X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f97c985452b20a8c2f0bbfb1d0275298bf09fb45..77902671753529da1345efb71ff6017cb882bedc:/utils/ogl/src/basic.cpp?ds=sidebyside diff --git a/utils/ogl/src/basic.cpp b/utils/ogl/src/basic.cpp index 1dff73fedc..24a51a3d24 100644 --- a/utils/ogl/src/basic.cpp +++ b/utils/ogl/src/basic.cpp @@ -24,9 +24,7 @@ #include #endif -#ifdef PROLOGIO #include -#endif #if wxUSE_IOSTREAMH #include @@ -177,6 +175,12 @@ void wxShapeEvtHandler::OnLeftClick(double x, double y, int keys, int attachment m_previousHandler->OnLeftClick(x, y, keys, attachment); } +void wxShapeEvtHandler::OnLeftDoubleClick(double x, double y, int keys, int attachment) +{ + if (m_previousHandler) + m_previousHandler->OnLeftDoubleClick(x, y, keys, attachment); +} + void wxShapeEvtHandler::OnRightClick(double x, double y, int keys, int attachment) { if (m_previousHandler) @@ -293,11 +297,11 @@ wxShape::wxShape(wxShapeCanvas *can) m_parent = NULL; m_formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT; m_shadowMode = SHADOW_NONE; - m_shadowOffsetX = 6.0; - m_shadowOffsetY = 6.0; + m_shadowOffsetX = 6; + m_shadowOffsetY = 6; m_shadowBrush = wxBLACK_BRUSH; - m_textMarginX = 5.0; - m_textMarginY = 5.0; + m_textMarginX = 5; + m_textMarginY = 5; m_regionName = "0"; m_centreResize = TRUE; m_maintainAspectRatio = FALSE; @@ -598,10 +602,10 @@ void wxShape::FormatText(wxDC& dc, const wxString& s, int i) wxNode *node = m_regions.Nth(i); if (!node) return; - + wxShapeRegion *region = (wxShapeRegion *)node->Data(); region->SetText(s); - dc.SetFont(region->GetFont()); + dc.SetFont(* region->GetFont()); region->GetSize(&w, &h); @@ -705,7 +709,7 @@ wxShape *wxShape::GetTopAncestor() { if (!GetParent()) return this; - + if (GetParent()->IsKindOf(CLASSINFO(wxDivisionShape))) return this; else return GetParent()->GetTopAncestor(); @@ -915,10 +919,10 @@ void wxShape::OnDrawContents(wxDC& dc) GetBoundingBoxMin(&bound_x, &bound_y); if (m_regions.Number() < 1) return; - if (m_pen) dc.SetPen(m_pen); + if (m_pen) dc.SetPen(* m_pen); wxShapeRegion *region = (wxShapeRegion *)m_regions.First()->Data(); - if (region->GetFont()) dc.SetFont(region->GetFont()); + if (region->GetFont()) dc.SetFont(* region->GetFont()); dc.SetTextForeground(* (region->GetActualColourObject())); dc.SetBackgroundMode(wxTRANSPARENT); @@ -984,8 +988,8 @@ void wxShape::OnEraseContents(wxDC& dc) if (m_pen) penWidth = m_pen->GetWidth(); - dc.SetPen(g_oglWhiteBackgroundPen); - dc.SetBrush(g_oglWhiteBackgroundBrush); + dc.SetPen(* g_oglWhiteBackgroundPen); + dc.SetBrush(* g_oglWhiteBackgroundBrush); dc.DrawRectangle(WXROUND(topLeftX - penWidth), WXROUND(topLeftY - penWidth), WXROUND(maxX + penWidth*2.0 + 4.0), WXROUND(maxY + penWidth*2.0 + 4.0)); } @@ -1178,7 +1182,7 @@ void wxShape::ApplyAttachmentOrdering(wxList& linesToSort) { // This is a temporary store of all the lines. wxList linesStore; - + wxNode *node = m_lines.First(); while (node) { @@ -1220,7 +1224,7 @@ void wxShape::SortLines(int attachment, wxList& linesToSort) // This is a temporary store of all the lines at this attachment // point. We'll tick them off as we've processed them. wxList linesAtThisAttachment; - + wxNode *node = m_lines.First(); while (node) { @@ -1313,7 +1317,7 @@ void wxShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment wxClientDC dc(GetCanvas()); GetCanvas()->PrepareDC(dc); - dc.SetLogicalFunction(wxXOR); + dc.SetLogicalFunction(OGLRBLF); wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); dc.SetPen(dottedPen); @@ -1358,7 +1362,7 @@ void wxShape::OnBeginDragLeft(double x, double y, int keys, int attachment) yy = y + DragOffsetY; m_canvas->Snap(&xx, &yy); // m_xpos = xx; m_ypos = yy; - dc.SetLogicalFunction(wxXOR); + dc.SetLogicalFunction(OGLRBLF); wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); dc.SetPen(dottedPen); @@ -1526,7 +1530,7 @@ void wxShape::Flash() wxClientDC dc(GetCanvas()); GetCanvas()->PrepareDC(dc); - dc.SetLogicalFunction(wxXOR); + dc.SetLogicalFunction(OGLRBLF); Draw(dc); dc.SetLogicalFunction(wxCOPY); Draw(dc); @@ -1726,7 +1730,7 @@ void wxShape::WriteAttributes(wxExpr *clause) } else if (brushColour != "WHITE") clause->AddAttributeValueString("brush_colour", brushColour); - + if (m_brush->GetStyle() != wxSOLID) clause->AddAttributeValue("brush_style", (long)m_brush->GetStyle()); } @@ -1821,8 +1825,8 @@ void wxShape::WriteRegions(wxExpr *clause) // region1 = (regionName regionText x y width height minWidth minHeight proportionX proportionY // formatMode fontSize fontFamily fontStyle fontWeight textColour) wxExpr *regionExpr = new wxExpr(wxExprList); - regionExpr->Append(new wxExpr(wxExprString, (region->m_regionName ? region->m_regionName : ""))); - regionExpr->Append(new wxExpr(wxExprString, (region->m_regionText ? region->m_regionText : ""))); + regionExpr->Append(new wxExpr(wxExprString, region->m_regionName)); + regionExpr->Append(new wxExpr(wxExprString, region->m_regionText)); regionExpr->Append(new wxExpr(region->m_x)); regionExpr->Append(new wxExpr(region->m_y)); @@ -1840,10 +1844,10 @@ 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->GetStyle() : wxDEFAULT))); regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetWeight() : wxNORMAL))); - regionExpr->Append(new wxExpr(wxExprString, region->m_textColour ? region->m_textColour : "BLACK")); + regionExpr->Append(new wxExpr(wxExprString, region->m_textColour)); // New members for pen colour/style - regionExpr->Append(new wxExpr(wxExprString, region->m_penColour ? region->m_penColour : "BLACK")); + regionExpr->Append(new wxExpr(wxExprString, region->m_penColour)); regionExpr->Append(new wxExpr((long)region->m_penStyle)); // Formatted text: @@ -1903,8 +1907,8 @@ void wxShape::ReadAttributes(wxExpr *clause) else if (string_expr->Type() == wxExprList) { wxExpr *first = string_expr->value.first; - wxExpr *second = first ? first->next : NULL; - wxExpr *third = second ? second->next : NULL; + wxExpr *second = first ? first->next : (wxExpr*) NULL; + wxExpr *third = second ? second->next : (wxExpr*) NULL; if (first && second && third && (first->Type() == wxExprReal || first->Type() == wxExprInteger) && @@ -2003,7 +2007,7 @@ void wxShape::ReadAttributes(wxExpr *clause) if (brush_string == "") brush_string = "WHITE"; - if (pen_string[0] == '#') + if (pen_string.GetChar(0) == '#') { wxColour col(oglHexToColour(pen_string.After('#'))); m_pen = wxThePenList->FindOrCreatePen(col, pen_width, pen_style); @@ -2014,7 +2018,7 @@ void wxShape::ReadAttributes(wxExpr *clause) if (!m_pen) m_pen = wxBLACK_PEN; - if (brush_string[0] == '#') + if (brush_string.GetChar(0) == '#') { wxColour col(oglHexToColour(brush_string.After('#'))); m_brush = wxTheBrushList->FindOrCreateBrush(col, brush_style); @@ -2072,7 +2076,7 @@ void wxShape::ReadRegions(wxExpr *clause) m_formatted = TRUE; // Assume text is formatted unless we prove otherwise - while (regionExpr = clause->AttributeValue(regionNameBuf)) + while ((regionExpr = clause->AttributeValue(regionNameBuf))) { /* * Get the region information @@ -2127,7 +2131,7 @@ void wxShape::ReadRegions(wxExpr *clause) width = widthExpr->RealValue(); height = heightExpr->RealValue(); - + minWidth = minWidthExpr->RealValue(); minHeight = minHeightExpr->RealValue(); @@ -2196,8 +2200,8 @@ void wxShape::ReadRegions(wxExpr *clause) else if (string_expr->Type() == wxExprList) { wxExpr *first = string_expr->value.first; - wxExpr *second = first ? first->next : NULL; - wxExpr *third = second ? second->next : NULL; + wxExpr *second = first ? first->next : (wxExpr*) NULL; + wxExpr *third = second ? second->next : (wxExpr*) NULL; if (first && second && third && (first->Type() == wxExprReal || first->Type() == wxExprInteger) && @@ -2388,42 +2392,42 @@ void wxShape::MakeControlPoints() 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, + 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 = 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 = 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 = 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 = 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 = 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 = 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 = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, 0, CONTROL_POINT_HORIZONTAL); m_canvas->AddShape(control); m_controlPoints.Append(control); @@ -2530,9 +2534,9 @@ void wxShape::OnDrawControlPoints(wxDC& dc) { if (!m_drawHandles) return; - - dc.SetBrush(wxBLACK_BRUSH); - dc.SetPen(wxBLACK_PEN); + + dc.SetBrush(* wxBLACK_BRUSH); + dc.SetPen(* wxBLACK_PEN); wxNode *node = m_controlPoints.First(); while (node) @@ -2669,7 +2673,7 @@ bool wxShape::AttachmentIsValid(int attachment) const return FALSE; } -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) { if (m_attachmentMode == ATTACHMENT_MODE_NONE) @@ -3152,7 +3156,7 @@ void wxShape::OnDrawBranches(wxDC& dc, int attachment, bool erase) GetBranchingAttachmentPoint(attachment, i, pt, stemPt); dc.DrawLine((long) stemPt.x, (long) stemPt.y, (long) pt.x, (long) pt.y); - if (GetBranchStyle() & BRANCHING_ATTACHMENT_BLOB) + if ((GetBranchStyle() & BRANCHING_ATTACHMENT_BLOB) && (count > 1)) { long blobSize=6; // dc.DrawEllipse((long) (stemPt.x + 0.5 - (blobSize/2.0)), (long) (stemPt.y + 0.5 - (blobSize/2.0)), blobSize, blobSize);