From f0d0df7fb0658b315f79748e713aa4103c4b335e Mon Sep 17 00:00:00 2001 From: Rr42 Date: Tue, 26 Jun 2018 13:55:10 +0530 Subject: Added UART terminal window. Porting of simulation functionality complete --- ldmicro/lib/linuxUI/linuxUI.cpp | 5 +++++ ldmicro/lib/linuxUI/linuxUI.h | 7 +++++++ 2 files changed, 12 insertions(+) (limited to 'ldmicro/lib/linuxUI') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 46e9a40..e65c7d5 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -507,4 +507,9 @@ BOOL KillTimer(HWID hWid, UINT uIDEvent) timerRecords.erase(record_it); return TRUE; +} + +void DestroyWindow (HWID widget) +{ + gtk_widget_destroy (widget); } \ No newline at end of file diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h index 68d5ef4..b1a3d48 100644 --- a/ldmicro/lib/linuxUI/linuxUI.h +++ b/ldmicro/lib/linuxUI/linuxUI.h @@ -43,6 +43,11 @@ #define SB_THUMBTRACK 0x00000040 #define SB_THUMBPOSITION 0x00000080 +/// UART terminal flags +#define WM_GETTEXT 0x00000001 +#define WM_SETTEXT 0x00000002 +#define WM_SETTEXT_END 0x00000004 + /// List view flags #define LVN_ITEMACTIVATE 0x00000001 #define LVN_GETDISPINFO 0x00000002 @@ -219,4 +224,6 @@ BOOL KillTimer( HWID hWid, UINT uIDEvent); +void DestroyWindow (HWID widget); + #endif \ No newline at end of file -- cgit 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 From c70ccfc936bdb59c4934111db79ea0205d8c5dc8 Mon Sep 17 00:00:00 2001 From: Rr42 Date: Tue, 26 Jun 2018 23:21:33 +0530 Subject: iolist.cpp ported, io pin selection dialog added. --- ldmicro/lib/linuxUI/linuxLD.h | 2 +- ldmicro/lib/linuxUI/linuxUI.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'ldmicro/lib/linuxUI') diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h index 28116b2..ce0b812 100644 --- a/ldmicro/lib/linuxUI/linuxLD.h +++ b/ldmicro/lib/linuxUI/linuxLD.h @@ -182,7 +182,7 @@ typedef struct FontTag { int nOrientation; int fnWeight; DWORD fdwItalic; - LPCTSTR lpszFace; + LPTSTR lpszFace; } *HFONT, FONT; typedef struct tagLOGBRUSH { diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 0d08de5..ba5eb95 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -316,14 +316,15 @@ HBRUSH CreateBrushIndirect(PLOGBRUSH plb) HFONT CreateFont(int nHeight, int nWidth, int nOrientation, int fnWeight, DWORD fdwItalic, LPCTSTR lpszFace) { - HFONT font = new FONT; + HFONT font = (HFONT)malloc(strlen(lpszFace) + 1 + sizeof(FONT)); font->nHeight = nHeight; font->nWidth = nWidth; font->nOrientation = nOrientation; font->fnWeight = fnWeight; font->fdwItalic = fdwItalic; - font->lpszFace = lpszFace; - + font->lpszFace = (char*)malloc(strlen(lpszFace)+1); + strcpy(font->lpszFace, lpszFace); + return font; } -- cgit