From 9673954adfd5a563072e085df5e09d427557466b Mon Sep 17 00:00:00 2001 From: Rr42 Date: Tue, 26 Jun 2018 14:58:14 +0530 Subject: Added "export as text" functionality. --- ldmicro/lib/linuxUI/linuxUI.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ldmicro/lib/linuxUI') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index e65c7d5..0d08de5 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -282,6 +282,9 @@ HANDLE GetStockObject(int fnObject) void SelectObject(HCRDC hcr, HFONT hfont) { + if (hcr ==NULL) + return; + cairo_select_font_face(hcr, hfont->lpszFace, hfont->fdwItalic ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, hfont->fnWeight == FW_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); @@ -326,6 +329,9 @@ HFONT CreateFont(int nHeight, int nWidth, int nOrientation, int fnWeight, void SetBkColor(HWID widget, HCRDC hcr, COLORREF bkCol) { + if (hcr == NULL) + return; + gtk_widget_override_background_color(GTK_WIDGET(widget), GTK_STATE_FLAG_NORMAL, &bkCol); @@ -349,12 +355,18 @@ void SetBkColor(HWID widget, HCRDC hcr, COLORREF bkCol) void SetTextColor(HCRDC hcr, COLORREF color) { + if (hcr == NULL) + return; + HdcCurrentTextColor = color; gdk_cairo_set_source_rgba (hcr, &color); } void TextOut(HWID hWid, HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, int cchString) { + if (hcr == NULL) + return; + nYStart += 30; cairo_text_extents_t extents; @@ -419,6 +431,9 @@ BOOL InvalidateRect(HWID hWid, const RECT *lpRect, BOOL bErase) int FillRect(HCRDC hDC, const RECT *lprc, HBRUSH hbr) { + if (hDC == NULL) + return -1; + GDRECT gdrc; RECT_to_GDRECT(lprc, &gdrc); @@ -432,6 +447,9 @@ int FillRect(HCRDC hDC, const RECT *lprc, HBRUSH hbr) BOOL PatBlt(HCRDC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD dwRop, HBRUSH hbr) { + if (hdc == NULL) + return FALSE; + cairo_set_source_rgb(hdc, hbr->red, hbr->green, hbr->blue); cairo_rectangle(hdc, nXLeft, nYLeft + 20, nWidth, nHeight); cairo_stroke_preserve(hdc); -- cgit