X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0fc1a7137cccc829a34b3527c768db7d7ac83437..cd8b9f13c7ad6990f59b655138ac1d5128d3201d:/utils/ogl/src/misc.h diff --git a/utils/ogl/src/misc.h b/utils/ogl/src/misc.h index fb4ca0144b..4e6abfb6b2 100644 --- a/utils/ogl/src/misc.h +++ b/utils/ogl/src/misc.h @@ -18,7 +18,7 @@ // List to use when copying objects; may need to associate elements of new objects // with elements of old objects, e.g. when copying constraint.s -extern wxList wxObjectCopyMapping; +extern wxList oglObjectCopyMapping; /* * TEXT FORMATTING FUNCTIONS @@ -27,55 +27,55 @@ extern wxList wxObjectCopyMapping; // Centres the given list of wxShapeTextLine strings in the given box // (changing the positions in situ). Doesn't actually draw into the DC. -void CentreText(wxDC& dc, wxList *text, float m_xpos, float m_ypos, - float width, float height, +void oglCentreText(wxDC& dc, wxList *text, double m_xpos, double m_ypos, + double width, double height, int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT); // Given a string, returns a list of strings that fit within the given // width of box. Height is ignored. -wxList *FormatText(wxDC& dc, const wxString& text, float width, float height, int formatMode = 0); +wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double height, int formatMode = 0); // Centres the list of wxShapeTextLine strings, doesn't clip. // Doesn't actually draw into the DC. -void CentreTextNoClipping(wxDC& dc, wxList *text_list, - float m_xpos, float m_ypos, float width, float height); +void oglCentreTextNoClipping(wxDC& dc, wxList *text_list, + double m_xpos, double m_ypos, double width, double height); // Gets the maximum width and height of the given list of wxShapeTextLines. -void GetCentredTextExtent(wxDC& dc, wxList *text_list, - float m_xpos, float m_ypos, float width, float height, - float *actual_width, float *actual_height); +void oglGetCentredTextExtent(wxDC& dc, wxList *text_list, + double m_xpos, double m_ypos, double width, double height, + double *actual_width, double *actual_height); // Actually draw the preformatted list of wxShapeTextLines. -void DrawFormattedText(wxDC& context, wxList *text_list, - float m_xpos, float m_ypos, float width, float height, +void oglDrawFormattedText(wxDC& context, wxList *text_list, + double m_xpos, double m_ypos, double width, double height, int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT); // Give it a list of points, finds the centre. -void find_polyline_centroid(wxList *points, float *x, float *y); +void oglFindPolylineCentroid(wxList *points, double *x, double *y); -void check_line_intersection(float x1, float y1, float x2, float y2, - float x3, float y3, float x4, float y4, - float *ratio1, float *ratio2); +void oglCheckLineIntersection(double x1, double y1, double x2, double y2, + double x3, double y3, double x4, double y4, + double *ratio1, double *ratio2); -void find_end_for_polyline(float n, float xvec[], float yvec[], - float x1, float y1, float x2, float y2, float *x3, float *y3); +void oglFindEndForPolyline(double n, double xvec[], double yvec[], + double x1, double y1, double x2, double y2, double *x3, double *y3); -void find_end_for_box(float width, float height, - float x1, float y1, // Centre of box (possibly) - float x2, float y2, // other end of line - float *x3, float *y3); // End on box edge +void oglFindEndForBox(double width, double height, + double x1, double y1, // Centre of box (possibly) + double x2, double y2, // other end of line + double *x3, double *y3); // End on box edge -void find_end_for_circle(float radius, - float x1, float y1, // Centre of circle - float x2, float y2, // Other end of line - float *x3, float *y3); +void oglFindEndForCircle(double radius, + double x1, double y1, // Centre of circle + double x2, double y2, // Other end of line + double *x3, double *y3); -void get_arrow_points(float x1, float y1, float x2, float y2, - float length, float width, - float *tip_x, float *tip_y, - float *side1_x, float *side1_y, - float *side2_x, float *side2_y); +void oglGetArrowPoints(double x1, double y1, double x2, double y2, + double length, double width, + double *tip_x, double *tip_y, + double *side1_x, double *side1_y, + double *side2_x, double *side2_y); /* * Given an ellipse and endpoints of a line, returns the point at which @@ -88,20 +88,26 @@ void get_arrow_points(float x1, float y1, float x2, float y2, * Author: Ian Harrison */ -void draw_arc_to_ellipse(float x1, float y1, float a1, float b1, float x2, float y2, float x3, float y3, - float *x4, float *y4); +void oglDrawArcToEllipse(double x1, double y1, double a1, double b1, double x2, double y2, double x3, double y3, + double *x4, double *y4); -extern wxFont *g_oglNormalFont; -extern wxPen *black_pen; +bool oglRoughlyEqual(double val1, double val2, double tol = 0.00001); -extern wxPen *white_background_pen; -extern wxPen *transparent_pen; -extern wxBrush *white_background_brush; -extern wxPen *black_foreground_pen; +extern wxFont* g_oglNormalFont; +extern wxPen* g_oglBlackPen; +extern wxPen* g_oglWhiteBackgroundPen; +extern wxPen* g_oglTransparentPen; +extern wxBrush* g_oglWhiteBackgroundBrush; +extern wxPen* g_oglBlackForegroundPen; +extern wxCursor* g_oglBullseyeCursor; -extern wxCursor *GraphicsBullseyeCursor; +extern wxFont* oglMatchFont(int point_size); + +extern wxString oglColourToHex(const wxColour& colour); +extern wxColour oglHexToColour(const wxString& hex); +extern void oglDecToHex(unsigned int dec, char *buf); +extern unsigned int oglHexToDec(char* buf); -extern wxFont *MatchFont(int point_size); #endif // _OGL_MISC_H_