diff --git a/include/minigui.h b/include/minigui.h
index 17b368fb..58766bc8 100644
--- a/include/minigui.h
+++ b/include/minigui.h
@@ -2728,12 +2728,6 @@ MG_EXPORT HCURSOR GUIAPI GetSystemCursor (int csrid);
MG_EXPORT HCURSOR GUIAPI GetCurrentCursor (void);
#else
-// #define LoadCursorFromFile(filename) (do_nothing(), 0)
-// #define CreateCursor(x, y, w, h, ANDbs, XORbs, cr) (do_nothing(), 0)
-// #define DestroyCursor(hcsr) (do_nothing(), 0)
-//// #define GetSystemCursor(csrid) (do_nothing(), 0)
-// #define GetCurrentCursor() (do_nothing(), 0)
-//static inline HCURSOR GetSystemCursor(int csrid) { return (HCURSOR) 0;}
static inline HCURSOR LoadCursorFromFile(const char* filename) {
return (HCURSOR)0;
diff --git a/src/control/edit.c b/src/control/edit.c
index 3baafb33..639bae00 100644
--- a/src/control/edit.c
+++ b/src/control/edit.c
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -69,7 +69,7 @@ static LRESULT SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
static void sledit_refresh_caret (HWND hWnd, PSLEDITDATA sled, BOOL bInited);
static BOOL make_charpos_visible (HWND hWnd, PSLEDITDATA sled, int charPos, int *cx);
-/*
+/*
* for bug 4894, when select text don't hide caret, because this will close
* the ime window. by humingming 2010.8.17
*/
@@ -154,7 +154,7 @@ static int sledit_settext (PSLEDITDATA sled, const char *newtext)
if (sled->hardLimit >= 0 && txtlen > sled->hardLimit) {
return -1;
}
-
+
/* free the old text */
if (sled->content.string)
testr_free (&sled->content);
@@ -191,7 +191,7 @@ static void recalcSize (HWND hWnd, PSLEDITDATA sled, BOOL bInited)
set_line_width (hWnd, sled);
- sled->starty = sled->topMargin + ( sled->rcVis.bottom -
+ sled->starty = sled->topMargin + ( sled->rcVis.bottom -
sled->rcVis.top - GetWindowFont (hWnd)->size - 1 ) / 2;
sledit_refresh_caret (hWnd, sled, bInited);
@@ -225,7 +225,7 @@ static int sledit_init (HWND hWnd, PSLEDITDATA sled)
sled->nBlockSize = DEF_LINE_BLOCK_SIZE;
sled->hardLimit = -1;
-
+
if (pCtrl->dwStyle & ES_TIP) {
sled->tiptext = FixStrAlloc (DEF_TIP_LEN + 1);
sled->tiptext[0] = 0;
@@ -297,7 +297,7 @@ static void mySetCaretPos (HWND hWnd, PSLEDITDATA sled, int x)
sleVisibleToWindow (sled, &x);
SetCaretPos (hWnd, x, sled->starty);
ActiveCaret (hWnd);
- /* fix bug 4349: CENTER style does not work when startup*/
+ /* fix bug 4349: CENTER style does not work when startup*/
if (sled->status & EST_FOCUSED) {
ShowCaret (hWnd);
}
@@ -322,12 +322,12 @@ static void slePaint (HWND hWnd, HDC hdc, PSLEDITDATA sled)
int starty = sled->starty;
int outw = 0;
int startx;
-
+
//FIXME, normal case of ES_TIP?
- if (dwStyle & ES_TIP && content->txtlen <= 0 &&
+ if (dwStyle & ES_TIP && content->txtlen <= 0 &&
GetFocus(GetParent(hWnd)) != hWnd) {
setup_dc (hWnd, sled, hdc, FALSE);
- TextOut (hdc, sled->leftMargin, starty,
+ TextOut (hdc, sled->leftMargin, starty,
sled->tiptext);
return;
}
@@ -347,8 +347,8 @@ static void slePaint (HWND hWnd, HDC hdc, PSLEDITDATA sled)
MoveTo (hdc, sled->leftMargin, sled->rcVis.bottom);
LineTo (hdc, sled->rcVis.right, sled->rcVis.bottom);
#else
- DrawHDotLine (hdc,
- sled->leftMargin,
+ DrawHDotLine (hdc,
+ sled->leftMargin,
sled->rcVis.bottom,
sled->rcVis.right - sled->rcVis.left);
#endif
@@ -369,14 +369,14 @@ static void slePaint (HWND hWnd, HDC hdc, PSLEDITDATA sled)
/* draw selected chars */
setup_dc (hWnd, sled, hdc, TRUE);
- outw += TextOutLen (hdc, startx + outw, starty, dispBuffer,
+ outw += TextOutLen (hdc, startx + outw, starty, dispBuffer,
sled->selEnd - sled->selStart);
dispBuffer += sled->selEnd - sled->selStart;
-
+
/* draw others */
if (sled->selEnd < content->txtlen) {
setup_dc (hWnd, sled, hdc, FALSE);
- outw += TextOutLen (hdc, startx + outw, starty, dispBuffer,
+ outw += TextOutLen (hdc, startx + outw, starty, dispBuffer,
content->txtlen - sled->selEnd);
}
}
@@ -413,7 +413,7 @@ static int sleSetSel (HWND hWnd, PSLEDITDATA sled, int sel_start, int sel_end)
mySetCaretPos (hWnd, sled, cx);
}
- /*
+ /*
* for bug 4894, when select text don't hide caret, because this will close
* the ime window. by humingming 2010.8.17
*/
@@ -423,7 +423,7 @@ static int sleSetSel (HWND hWnd, PSLEDITDATA sled, int sel_start, int sel_end)
return sled->selEnd - sled->selStart;
}
-/*
+/*
* set caret position according to the new desired x coordinate.
*/
static void set_caret_pos (HWND hWnd, PSLEDITDATA sled, int x, BOOL bSel)
@@ -439,22 +439,22 @@ static void set_caret_pos (HWND hWnd, PSLEDITDATA sled, int x, BOOL bSel)
txtsize.cx = 0;
}
else {
- /* DK [10/05/07] for fix bug4542: Replace content of edit to a same length
- * string which is made up of '*' character when the edit control include
+ /* DK [10/05/07] for fix bug4542: Replace content of edit to a same length
+ * string which is made up of '*' character when the edit control include
* ES_PASSWORD style, for take the right content width. */
if ((GetWindowStyle(hWnd) & ES_PASSWORD)) {
int sled_width = x - sled->startx;
int max_char_len = 0;
GetTextExtent(hdc, "*", 1, &txtsize);
max_char_len = sled_width / txtsize.cx;
- out_chars = sled->content.txtlen > max_char_len ?
+ out_chars = sled->content.txtlen > max_char_len ?
max_char_len : sled->content.txtlen;
txtsize.cx *= out_chars;
}
else {
const char* sled_string = (const char*)sled->content.string;
out_chars = GetTextExtentPoint (hdc, sled_string,
- sled->content.txtlen,
+ sled->content.txtlen,
x - sled->startx,
NULL, NULL, NULL, &txtsize);
}
@@ -498,7 +498,7 @@ static BOOL make_pos_visible (HWND hWnd, PSLEDITDATA sled, int x)
return FALSE;
}
-static BOOL
+static BOOL
make_charpos_visible (HWND hWnd, PSLEDITDATA sled, int charPos, int *cx)
{
SIZE txtsize;
@@ -514,7 +514,7 @@ make_charpos_visible (HWND hWnd, PSLEDITDATA sled, int charPos, int *cx)
string = FixStrAlloc (sled->content.txtlen);
memset (string, sled->passwdChar, sled->content.txtlen);
}
- GetTextExtent (hdc, (const char*)string,
+ GetTextExtent (hdc, (const char*)string,
charPos, &txtsize);
if (dwStyle & ES_PASSWORD)
FreeFixStr (string);
@@ -525,7 +525,7 @@ make_charpos_visible (HWND hWnd, PSLEDITDATA sled, int charPos, int *cx)
return make_pos_visible (hWnd, sled, sled->startx + txtsize.cx);
}
-static void
+static void
calc_content_width(HWND hWnd, PSLEDITDATA sled, int charPos, int *cx)
{
SIZE txtsize;
@@ -535,16 +535,16 @@ calc_content_width(HWND hWnd, PSLEDITDATA sled, int charPos, int *cx)
txtsize.cx = 0;
else {
hdc = GetClientDC (hWnd);
- GetTextExtent (hdc, (const char*)sled->content.string,
+ GetTextExtent (hdc, (const char*)sled->content.string,
charPos, &txtsize);
ReleaseDC (hdc);
}
if (cx)
*cx = txtsize.cx;
-
+
}
-static void
+static void
calc_charpos_cx (HWND hWnd, PSLEDITDATA sled, int charPos, int *cx)
{
SIZE txtsize;
@@ -554,13 +554,13 @@ calc_charpos_cx (HWND hWnd, PSLEDITDATA sled, int charPos, int *cx)
txtsize.cx = 0;
else {
hdc = GetClientDC (hWnd);
- GetTextExtent (hdc, (const char*)sled->content.string,
+ GetTextExtent (hdc, (const char*)sled->content.string,
charPos, &txtsize);
ReleaseDC (hdc);
}
if (cx)
*cx = sled->startx + txtsize.cx;
-
+
}
/*
@@ -598,7 +598,7 @@ static int sleMouseMove (HWND hWnd, PSLEDITDATA sled, LPARAM lParam)
ScreenToClient(hWnd, &mouseX, &mouseY);
GetClientRect(hWnd, &rcClient);
-
+
selStart = sled->selStart;
selEnd = sled->selEnd;
if (mouseX < 0) {
@@ -639,7 +639,7 @@ static void set_line_width (HWND hWnd, PSLEDITDATA sled)
hdc = GetClientDC (hWnd);
SelectFont (hdc, GetWindowFont(hWnd));
- GetTextExtent(hdc, (const char*)(sled->content.string),
+ GetTextExtent(hdc, (const char*)(sled->content.string),
sled->content.txtlen, &txtsize);
ReleaseDC (hdc);
@@ -716,15 +716,15 @@ sleInsertText (HWND hWnd, PSLEDITDATA sled, char *newtext, int inserting)
inserting = 0;
}
- if ( !(sled->status & EST_REPLACE) && inserting > 0
- && sled->hardLimit >= 0
+ if ( !(sled->status & EST_REPLACE) && inserting > 0
+ && sled->hardLimit >= 0
&& ((sled->content.txtlen + inserting) > sled->hardLimit)) {
Ping ();
NotifyParent (hWnd, GetDlgCtrlID(hWnd), EN_MAXTEXT);
inserting = sled->hardLimit - sled->content.txtlen;
return 0;
}
- else if ( (sled->status & EST_REPLACE) && inserting > 0
+ else if ( (sled->status & EST_REPLACE) && inserting > 0
&& sled->hardLimit >= 0
&& (sled->editPos + inserting > sled->hardLimit) ) {
Ping ();
@@ -733,19 +733,19 @@ sleInsertText (HWND hWnd, PSLEDITDATA sled, char *newtext, int inserting)
}
if (inserting > 0) {
- content = testr_realloc (&sled->content, sled->content.txtlen +
+ content = testr_realloc (&sled->content, sled->content.txtlen +
inserting);
pIns = content + sled->editPos;
if ( !(sled->status & EST_REPLACE) )
- memmove (pIns + inserting, pIns,
+ memmove (pIns + inserting, pIns,
sled->content.txtlen+1 - sled->editPos);
memcpy (pIns, newtext, inserting);
}
else if (inserting < 0) {
pIns = content + sled->editPos;
- memmove (pIns + inserting, pIns,
+ memmove (pIns + inserting, pIns,
sled->content.txtlen+1 - sled->editPos);
- content = testr_realloc (&sled->content, sled->content.txtlen +
+ content = testr_realloc (&sled->content, sled->content.txtlen +
inserting);
}
@@ -775,7 +775,7 @@ sleInsertText (HWND hWnd, PSLEDITDATA sled, char *newtext, int inserting)
}
static int
-sleInsertText_refresh (HWND hWnd,
+sleInsertText_refresh (HWND hWnd,
PSLEDITDATA sled, char *newtext, int inserting)
{
int deleted;
@@ -799,14 +799,14 @@ sleInsertText_refresh (HWND hWnd,
inserting = 0;
}
- if ( !(sled->status & EST_REPLACE) && inserting > 0 && sled->hardLimit >= 0
+ if ( !(sled->status & EST_REPLACE) && inserting > 0 && sled->hardLimit >= 0
&& ((sled->content.txtlen + inserting) > sled->hardLimit)) {
Ping ();
NotifyParent (hWnd, GetDlgCtrlID(hWnd), EN_MAXTEXT);
inserting = sled->hardLimit - sled->content.txtlen;
//return 0;
}
- else if ( (sled->status & EST_REPLACE) && inserting > 0
+ else if ( (sled->status & EST_REPLACE) && inserting > 0
&& sled->hardLimit >= 0
&& (sled->editPos + inserting > sled->hardLimit) ) {
Ping ();
@@ -815,19 +815,19 @@ sleInsertText_refresh (HWND hWnd,
}
if (inserting > 0) {
- content = testr_realloc (&sled->content, sled->content.txtlen +
+ content = testr_realloc (&sled->content, sled->content.txtlen +
inserting);
pIns = content + sled->editPos;
if ( !(sled->status & EST_REPLACE) )
- memmove (pIns + inserting, pIns,
+ memmove (pIns + inserting, pIns,
sled->content.txtlen+1 - sled->editPos);
memcpy (pIns, newtext, inserting);
}
else if (inserting < 0) {
pIns = content + sled->editPos;
- memmove (pIns + inserting, pIns,
+ memmove (pIns + inserting, pIns,
sled->content.txtlen+1 - sled->editPos);
- content = testr_realloc (&sled->content, sled->content.txtlen +
+ content = testr_realloc (&sled->content, sled->content.txtlen +
inserting);
}
@@ -886,9 +886,9 @@ static int sleInsertCbText (HWND hWnd, PSLEDITDATA sled)
GetClipBoardData (CBNAME_TEXT, txtBuffer, inserting);
txtBuffer[inserting]=0;
- if (GetWindowStyle(hWnd) & ES_UPPERCASE)
+ if (GetWindowStyle(hWnd) & ES_UPPERCASE)
sleCaseText((char *)txtBuffer, TRUE);
- else if (GetWindowStyle(hWnd) & ES_LOWERCASE)
+ else if (GetWindowStyle(hWnd) & ES_LOWERCASE)
sleCaseText((char *)txtBuffer, FALSE);
sleInsertText (hWnd, sled, (char *)txtBuffer, inserting);
@@ -932,7 +932,7 @@ static void esright_backspace_refresh(HWND hWnd, PSLEDITDATA sled, int del)
calc_charpos_cx(hWnd, sled, sled->editPos, &old_editpos_x);
scroll_rc.left = sled->rcVis.left;
calc_charpos_cx(hWnd, sled, sled->editPos + del, &cur_editpos_x);
-
+
sleInsertText_refresh (hWnd, sled, NULL, del);
edtSetCaretPos (hWnd, sled);
@@ -946,7 +946,7 @@ static void esright_backspace_refresh(HWND hWnd, PSLEDITDATA sled, int del)
}
else{
- if (sled->nContX <= 0){//left scroll window while the head of text is in the sled->rcVis
+ if (sled->nContX <= 0){//left scroll window while the head of text is in the sled->rcVis
if (sled->selStart != sled->selEnd){
refresh_rc.top = sled->rcVis.top;
@@ -1045,7 +1045,7 @@ static void esright_backspace_refresh(HWND hWnd, PSLEDITDATA sled, int del)
old_ncontw = sled->nContW;
sleInsertText_refresh (hWnd, sled, NULL, del);
edtSetCaretPos (hWnd, sled);
- cur_caret_x = get_caretpos_x(hWnd);
+ cur_caret_x = get_caretpos_x(hWnd);
scroll_rc.right = cur_caret_x;
scroll_len = abs(sled->nContW - old_ncontw);
@@ -1105,7 +1105,7 @@ static void esright_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
scroll_rc.left = sled->rcVis.left;
sleInsertText_refresh (hWnd, sled, NULL, del);
edtSetCaretPos (hWnd, sled);
- cur_caret_x = get_caretpos_x(hWnd);
+ cur_caret_x = get_caretpos_x(hWnd);
scroll_rc.right = cur_caret_x;
scroll_len = cur_caret_x - old_caret_x;
@@ -1115,7 +1115,7 @@ static void esright_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
}
else{
- if (sled->nContX <=0){//left scroll window while the head of text is in the sled->rcVis
+ if (sled->nContX <=0){//left scroll window while the head of text is in the sled->rcVis
if (sled->selStart != sled->selEnd){
refresh_rc.top = sled->rcVis.top;
@@ -1153,7 +1153,7 @@ static void esright_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
scroll_rc.right = sled->rcVis.right;
- scroll_rc.left = get_caretpos_x(hWnd);
+ scroll_rc.left = get_caretpos_x(hWnd);
calc_charpos_cx(hWnd, sled, sled->editPos, &old_editpos_x);
sleInsertText_refresh (hWnd, sled, NULL, del);
@@ -1217,7 +1217,7 @@ static void esright_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
scroll_rc.left = sled->rcVis.left;
sleInsertText_refresh (hWnd, sled, NULL, del);
edtSetCaretPos (hWnd, sled);
- cur_caret_x = get_caretpos_x(hWnd);
+ cur_caret_x = get_caretpos_x(hWnd);
scroll_rc.right = cur_caret_x;
scroll_len = cur_caret_x - old_caret_x;
@@ -1245,7 +1245,7 @@ static void esleft_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
{
int old_nContX = sled->nContX;
RECT scroll_rc, del_rc, refresh_rc;
- int txtlen_x;
+ int txtlen_x;
int sel_start_x, sel_end_x;
int old_caret_x, cur_caret_x;
int scroll_len;
@@ -1255,7 +1255,7 @@ static void esleft_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
scroll_rc.top = sled->rcVis.top;
scroll_rc.bottom = sled->rcVis.bottom;
del_rc.bottom = sled->rcVis.bottom;
- del_rc.top = sled->rcVis.top;
+ del_rc.top = sled->rcVis.top;
refresh_rc.top = sled->rcVis.top;
refresh_rc.bottom = sled->rcVis.bottom;
@@ -1285,7 +1285,7 @@ static void esleft_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
calc_charpos_cx(hWnd, sled, sled->editPos, &del_rc.left);
del_rc.left = del_rc.left - old_nContX;
- del_rc.right = scroll_rc.left;
+ del_rc.right = scroll_rc.left;
scroll_len = del_rc.left - scroll_rc.left;
@@ -1294,33 +1294,33 @@ static void esleft_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
}
else{
if ((old_nContX > 0) && ((txtlen_x - old_nContX) <= sled->rcVis.right)){
- cur_caret_x = get_caretpos_x(hWnd);
+ cur_caret_x = get_caretpos_x(hWnd);
if (cur_caret_x != old_caret_x){
- scroll_len = cur_caret_x - old_caret_x;
+ scroll_len = cur_caret_x - old_caret_x;
scroll_rc.left = sled->rcVis.left;
scroll_rc.right = old_caret_x;
ScrollWindow(hWnd, scroll_len, 0, &scroll_rc, NULL);
-
+
refresh_rc.left = old_caret_x;
refresh_rc.right = cur_caret_x;
InvalidateRect(hWnd, &refresh_rc, TRUE);
}
else if (sled->selStart != sled->selEnd) {
- scroll_len = sel_start_x - sel_end_x;
+ scroll_len = sel_start_x - sel_end_x;
scroll_rc.left = sled->rcVis.left;
scroll_rc.right = old_caret_x;
ScrollWindow(hWnd, scroll_len, 0, &scroll_rc, NULL);
-
+
refresh_rc.left = old_caret_x;
refresh_rc.right = cur_caret_x;
InvalidateRect(hWnd, &refresh_rc, TRUE);
}
else{
- InvalidateRect(hWnd, NULL, TRUE);
+ InvalidateRect(hWnd, NULL, TRUE);
}
}
else{
@@ -1331,7 +1331,7 @@ static void esleft_del_refresh(HWND hWnd, PSLEDITDATA sled, int del)
calc_charpos_cx(hWnd, sled, sled->content.txtlen, &rl);
if (((sled->nContW - sled->nContX) == sled->nVisW) && (old_nContX > 0)){
- InvalidateRect(hWnd, NULL, TRUE);
+ InvalidateRect(hWnd, NULL, TRUE);
}
else if (rl < sled->nVisW){
refresh_rc.left = rl;
@@ -1381,7 +1381,7 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
return 0;
}
-
+
if (sled->selStart != sled->selEnd) {
ShowCaret(hWnd);
refresh = TRUE;
@@ -1397,11 +1397,11 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
return 0;
}
-
+
case SCANCODE_END:
{
BOOL refresh = FALSE;
-
+
if(lParam & KS_SHIFT) {
sled->selStart = sled->editPos;
sled->selEnd = sled->content.txtlen;
@@ -1479,7 +1479,7 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
return 0;
}
-
+
case SCANCODE_CURSORBLOCKRIGHT:
{
BOOL refresh = FALSE;
@@ -1488,7 +1488,7 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
if(sled->selStart == sled->selEnd)
sled->selStart = sled->selEnd = sled->editPos;
- if (sled->selStart == sled->selEnd ||
+ if (sled->selStart == sled->selEnd ||
sled->selEnd > sled->editPos) {
if (sled->selEnd < sled->content.txtlen)
shift_one_char_r (selEnd);
@@ -1526,7 +1526,7 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
InvalidateRect (hWnd, NULL, TRUE);
}
return 0;
-
+
case SCANCODE_REMOVE:
{
int del;
@@ -1534,11 +1534,11 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
if ((dwStyle & ES_READONLY))
return 0;
- if (sled->editPos == sled->content.txtlen
+ if (sled->editPos == sled->content.txtlen
&& sled->selStart == sled->selEnd)
return 0;
- if (sled->selStart == sled->selEnd &&
+ if (sled->selStart == sled->selEnd &&
sled->editPos < sled->content.txtlen) {
shift_one_char_r(editPos);
}
@@ -1553,7 +1553,7 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
sled->changed = TRUE;
NotifyParent (hWnd, GetDlgCtrlID(hWnd), EN_CHANGE);
- }
+ }
else if (dwStyle & ES_RIGHT) {
esright_del_refresh(hWnd, sled, del);
//sleInsertText (hWnd, sled, NULL, del);
@@ -1578,7 +1578,7 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
if (sled->editPos == 0 && sled->selStart == sled->selEnd)
return 0;
- del = - CHLENPREV( sled->content.string,
+ del = - CHLENPREV( sled->content.string,
(sled->content.string + sled->editPos) );
sleInsertText (hWnd, sled, NULL, del);
}
@@ -1597,7 +1597,7 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
case SCANCODE_X:
{
if ((lParam & KS_CTRL) && (sled->selEnd - sled->selStart > 0)) {
- SetClipBoardData (CBNAME_TEXT, sled->content.string + sled->selStart,
+ SetClipBoardData (CBNAME_TEXT, sled->content.string + sled->selStart,
sled->selEnd - sled->selStart, CBOP_NORMAL);
if (wParam == SCANCODE_X && !(GetWindowStyle(hWnd) & ES_READONLY)) {
sleInsertText (hWnd, sled, NULL, 0);
@@ -1621,7 +1621,7 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
default:
break;
} //end switch
-
+
if (bChange){
sled->changed = TRUE;
NotifyParent (hWnd, pCtrl->id, EN_CHANGE);
@@ -1629,8 +1629,8 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
return 0;
}
-static void
-esright_input_char_refresh (HWND hWnd,
+static void
+esright_input_char_refresh (HWND hWnd,
PSLEDITDATA sled, char *charBuffer, int chars)
{
RECT scroll_rc;
@@ -1648,7 +1648,7 @@ esright_input_char_refresh (HWND hWnd,
sleInsertText_refresh (hWnd, sled, (char* )charBuffer, chars);
calc_content_width(hWnd, sled, sled->content.txtlen, &cur_ncontw);
- scroll_len = abs(old_ncontw- cur_ncontw);
+ scroll_len = abs(old_ncontw- cur_ncontw);
cur_caret_x = get_caretpos_x(hWnd);
scroll_rc.left = sled->rcVis.left;
scroll_rc.right = cur_caret_x;
@@ -1662,23 +1662,23 @@ esright_input_char_refresh (HWND hWnd,
}
}
-static void
-esleft_input_char_refresh (HWND hWnd,
+static void
+esleft_input_char_refresh (HWND hWnd,
PSLEDITDATA sled, char *charBuffer, int chars)
{
int old_caretpos_x;
- int old_sel_start, old_sel_end;
+ int old_sel_start, old_sel_end;
int old_sel_start_x, old_sel_end_x, cur_sel_start_x;
RECT scroll_rc, refresh_rc;
int scroll_len;
int old_edit_pos_x, cur_edit_pos_x;
int old_nContX;
- //char_size is width of input chars; sel_size is width of the selected area
+ //char_size is width of input chars; sel_size is width of the selected area
int char_size, sel_size;
int txtlen_x;
old_sel_start = sled->selStart;
- old_sel_end = sled->selEnd;
+ old_sel_end = sled->selEnd;
old_caretpos_x = get_caretpos_x(hWnd);
calc_charpos_cx(hWnd, sled, sled->editPos, &old_edit_pos_x);
@@ -1703,27 +1703,27 @@ esleft_input_char_refresh (HWND hWnd,
char_size = cur_edit_pos_x - cur_sel_start_x;
sel_size = abs(old_sel_start_x - old_sel_end_x);
- scroll_rc.top = sled->rcVis.top;
- scroll_rc.bottom = sled->rcVis.bottom;
+ scroll_rc.top = sled->rcVis.top;
+ scroll_rc.bottom = sled->rcVis.bottom;
refresh_rc.top = sled->rcVis.top;
refresh_rc.bottom = sled->rcVis.bottom;
if (char_size >= sled->nVisW){
- InvalidateRect(hWnd, NULL, TRUE);
+ InvalidateRect(hWnd, NULL, TRUE);
}
else{
if (old_sel_start != old_sel_end){
- if (sel_size >= sled->nVisW){
+ if (sel_size >= sled->nVisW){
InvalidateRect(hWnd, NULL, TRUE);
}
else{
if (char_size < sel_size){
- //right scroll window
- if ((old_nContX > 0)
+ //right scroll window
+ if ((old_nContX > 0)
&& ((txtlen_x - old_nContX) <= sled->rcVis.right)) {
- scroll_len = sel_size - char_size;
- scroll_rc.left = sled->rcVis.left;
+ scroll_len = sel_size - char_size;
+ scroll_rc.left = sled->rcVis.left;
scroll_rc.right = old_sel_start_x < old_sel_end_x
? old_sel_start_x : old_sel_end_x;
@@ -1733,46 +1733,46 @@ esleft_input_char_refresh (HWND hWnd,
refresh_rc.right = refresh_rc.left + sel_size + scroll_len;
InvalidateRect(hWnd, &refresh_rc, TRUE);
- }
- else{//left scroll window
- scroll_len = -(sel_size - char_size);
- scroll_rc.left = old_sel_start_x < old_sel_end_x
- ? old_sel_end_x : old_sel_start_x;
+ }
+ else{//left scroll window
+ scroll_len = -(sel_size - char_size);
+ scroll_rc.left = old_sel_start_x < old_sel_end_x
+ ? old_sel_end_x : old_sel_start_x;
scroll_rc.right = sled->rcVis.right;
ScrollWindow(hWnd, scroll_len, 0, &scroll_rc, NULL);
- refresh_rc.left = scroll_rc.left - sel_size;
- refresh_rc.right = scroll_rc.left;
+ refresh_rc.left = scroll_rc.left - sel_size;
+ refresh_rc.right = scroll_rc.left;
InvalidateRect(hWnd, &refresh_rc, TRUE);
}
}
- else{//when char_size > sel_size right scroll window
- scroll_len = char_size - sel_size;
- scroll_rc.left = old_sel_start_x < old_sel_end_x
- ? old_sel_end_x : old_sel_start_x;
- scroll_rc.right = sled->rcVis.right;
+ else{//when char_size > sel_size right scroll window
+ scroll_len = char_size - sel_size;
+ scroll_rc.left = old_sel_start_x < old_sel_end_x
+ ? old_sel_end_x : old_sel_start_x;
+ scroll_rc.right = sled->rcVis.right;
ScrollWindow(hWnd, scroll_len, 0, &scroll_rc, NULL);
refresh_rc.left = scroll_rc.left - sel_size;
- refresh_rc.right = refresh_rc.left + char_size + 1;
+ refresh_rc.right = refresh_rc.left + char_size + 1;
InvalidateRect(hWnd, &refresh_rc, TRUE);
}
}
}
else{
- int right;
- char_size = cur_edit_pos_x - old_edit_pos_x;
+ int right;
+ char_size = cur_edit_pos_x - old_edit_pos_x;
calc_charpos_cx(hWnd, sled, sled->content.txtlen, &right);
- if (old_caretpos_x < sled->rcVis.right){//right scroll window
- scroll_len = cur_edit_pos_x - old_edit_pos_x;
+ if (old_caretpos_x < sled->rcVis.right){//right scroll window
+ scroll_len = cur_edit_pos_x - old_edit_pos_x;
if ((sled->rcVis.right - old_caretpos_x) < scroll_len){//
- scroll_len = -(scroll_len - (sled->rcVis.right- old_caretpos_x));
- scroll_rc.left = sled->rcVis.left;
- scroll_rc.right = old_caretpos_x;
+ scroll_len = -(scroll_len - (sled->rcVis.right- old_caretpos_x));
+ scroll_rc.left = sled->rcVis.left;
+ scroll_rc.right = old_caretpos_x;
ScrollWindow(hWnd, scroll_len, 0, &scroll_rc, NULL);
refresh_rc.left = sled->rcVis.right - char_size;
@@ -1781,9 +1781,9 @@ esleft_input_char_refresh (HWND hWnd,
InvalidateRect(hWnd, &refresh_rc, TRUE);
}
else{
- scroll_rc.left = old_caretpos_x;
- scroll_rc.right = (right < sled->rcVis.right)
- ? right+1 : sled->rcVis.right;
+ scroll_rc.left = old_caretpos_x;
+ scroll_rc.right = (right < sled->rcVis.right)
+ ? right+1 : sled->rcVis.right;
ScrollWindow(hWnd, scroll_len, 0, &scroll_rc, NULL);
refresh_rc.left = sled->rcVis.right - char_size;
@@ -1792,8 +1792,8 @@ esleft_input_char_refresh (HWND hWnd,
InvalidateRect(hWnd, &refresh_rc, TRUE);
}
}
- else{//left scroll window
- scroll_len = old_edit_pos_x - cur_edit_pos_x;
+ else{//left scroll window
+ scroll_len = old_edit_pos_x - cur_edit_pos_x;
ScrollWindow(hWnd, scroll_len, 0, &sled->rcVis, NULL);
refresh_rc.left = sled->rcVis.right - char_size;
@@ -1802,9 +1802,9 @@ esleft_input_char_refresh (HWND hWnd,
InvalidateRect(hWnd, &refresh_rc, TRUE);
}
- if (((sled->nContW - sled->nContX) == sled->nVisW)
+ if (((sled->nContW - sled->nContX) == sled->nVisW)
&& (old_nContX > 0)){
- InvalidateRect(hWnd, NULL, TRUE);
+ InvalidateRect(hWnd, NULL, TRUE);
}
}
}
@@ -1821,8 +1821,8 @@ static void sledit_refresh_caret (HWND hWnd, PSLEDITDATA sled, BOOL bInited)
return;
hdc= GetClientDC (hWnd);
- outchar = GetTextExtentPoint (hdc, (const char*)sled->content.string,
- sled->content.txtlen,
+ outchar = GetTextExtentPoint (hdc, (const char*)sled->content.string,
+ sled->content.txtlen,
0,
NULL, NULL, NULL, &txtsize);
ReleaseDC (hdc);
@@ -1853,8 +1853,8 @@ static int sledit_reset_text (HWND hWnd, PSLEDITDATA sled, char* str)
check_valid_passwd (buffer);
}
- //we must retain the status of this control, it include is ETS_FOCUS state, that
- //tell this control whether the caret is need
+ //we must retain the status of this control, it include is ETS_FOCUS state, that
+ //tell this control whether the caret is need
//sled->status = 0;
sled->selStart = 0;
sled->selEnd = 0;
@@ -1879,7 +1879,7 @@ static int sledit_reset_text (HWND hWnd, PSLEDITDATA sled, char* str)
return 0;
}
-static int
+static int
sledit_insert_text (HWND hWnd, PSLEDITDATA sled, const char* newtext, int len)
{
int i, realen = strlen (newtext);
@@ -1893,16 +1893,14 @@ sledit_insert_text (HWND hWnd, PSLEDITDATA sled, const char* newtext, int len)
return -1;
if (dwStyle & ES_READONLY)
- {
return 0;
- }
- tempstr = (char*) malloc(realen+1);
+ tempstr = (char*) malloc(realen+1);
for (i = 0; i < len && newtext[i] != '\0'; i ++)
{
if (dwStyle & ES_UPPERCASE) {
- tempstr[i] = toupper (newtext[i]);
+ tempstr[i] = toupper (newtext[i]);
}
else if (dwStyle & ES_LOWERCASE) {
tempstr[i] = tolower (newtext[i]);
@@ -1914,13 +1912,13 @@ sledit_insert_text (HWND hWnd, PSLEDITDATA sled, const char* newtext, int len)
sleInsertText (hWnd, sled, (char* )newbuffer, len);
- free(tempstr);
+ free(tempstr);
return 0;
}
static LRESULT
SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
+{
DWORD dwStyle;
HDC hdc;
PSLEDITDATA sled = NULL;
@@ -1970,7 +1968,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case MSG_FONTCHANGED:
{
- sled->starty = sled->topMargin + (sled->rcVis.bottom
+ sled->starty = sled->topMargin + (sled->rcVis.bottom
- sled->rcVis.top - GetWindowFont(hWnd)->size - 1)/2;
DestroyCaret (hWnd);
@@ -1997,13 +1995,13 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
//HideCaret (hWnd);
if (pWin->pCaretInfo) {
sled->bShowCaret = FALSE;
- SetRect (&rcCaret, pWin->pCaretInfo->x, pWin->pCaretInfo->y,
- pWin->pCaretInfo->x + pWin->pCaretInfo->nWidth,
+ SetRect (&rcCaret, pWin->pCaretInfo->x, pWin->pCaretInfo->y,
+ pWin->pCaretInfo->x + pWin->pCaretInfo->nWidth,
pWin->pCaretInfo->y + pWin->pCaretInfo->nHeight);
InvalidateRect (hWnd, &rcCaret, FALSE);
}
- if ( sled->selStart != sled->selEnd
+ if ( sled->selStart != sled->selEnd
|| (dwStyle & ES_TIP && sled->content.txtlen <= 0)) {
refresh = TRUE;
}
@@ -2023,11 +2021,11 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
}
break;
-
+
case MSG_SETFOCUS:
if (sled->status & EST_FOCUSED)
break;
-
+
sled->status |= EST_FOCUSED;
/*[humingming/2010/10/19]:bug 5158:
@@ -2036,14 +2034,14 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
//ShowCaret(hWnd);
if (pWin->pCaretInfo) {
sled->bShowCaret = TRUE;
- SetRect (&rcCaret, pWin->pCaretInfo->x, pWin->pCaretInfo->y,
- pWin->pCaretInfo->x + pWin->pCaretInfo->nWidth,
+ SetRect (&rcCaret, pWin->pCaretInfo->x, pWin->pCaretInfo->y,
+ pWin->pCaretInfo->x + pWin->pCaretInfo->nWidth,
pWin->pCaretInfo->y + pWin->pCaretInfo->nHeight);
InvalidateRect (hWnd, &rcCaret, FALSE);
}
if (dwStyle & ES_AUTOSELECT) {
- if (sleSetSel (hWnd, sled, 0,
+ if (sleSetSel (hWnd, sled, 0,
sled->content.txtlen) <= 0 && dwStyle & ES_TIP)
InvalidateRect (hWnd, NULL, TRUE);
if (lParam == 1)
@@ -2056,7 +2054,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
NotifyParent (hWnd, GetDlgCtrlID(hWnd), EN_SETFOCUS);
break;
-
+
case MSG_ENABLE:
if ( (!(dwStyle & WS_DISABLED) && !wParam)
|| ((dwStyle & WS_DISABLED) && wParam) ) {
@@ -2071,7 +2069,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case MSG_GETTEXTLENGTH:
return sled->content.txtlen;
-
+
case MSG_GETTEXT:
{
char* buffer = (char*)lParam;
@@ -2102,7 +2100,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (dwStyle & ES_READONLY)
return 0;
-
+
charBuffer [0] = FIRSTBYTE (wParam);
charBuffer [1] = SECONDBYTE (wParam);
charBuffer [2] = THIRDBYTE (wParam);
@@ -2130,7 +2128,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
charBuffer [0] = tolower (charBuffer[0]);
}
}
-
+
if (chars == 1) {
if (charBuffer [0] < 0x20 && charBuffer[0] != '\b') //FIXME
return 0;
@@ -2141,7 +2139,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (sled->editPos == 0 && sled->selStart == sled->selEnd)
return 0;
- del = -CHLENPREV((const char *)(sled->content.string),
+ del = -CHLENPREV((const char *)(sled->content.string),
(sled->content.string + sled->editPos) );
if (dwStyle & ES_LEFT) {
@@ -2163,14 +2161,14 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
else{
if (dwStyle & ES_LEFT) {
- esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
+ esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
set_edit_caret_pos(hWnd, sled);
sled->changed = TRUE;
NotifyParent (hWnd, GetDlgCtrlID(hWnd), EN_CHANGE);
}
else if (dwStyle & ES_RIGHT) {
- esright_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
+ esright_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
}
else if (dwStyle & ES_CENTER) {
sleInsertText (hWnd, sled, (char* )charBuffer, chars);
@@ -2187,7 +2185,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleSetSel (hWnd, sled, 0, sled->content.txtlen);
NotifyParent (hWnd, GetDlgCtrlID(hWnd), EN_DBLCLK);
break;
-
+
case MSG_LBUTTONDOWN:
{
if ( sled->status & EST_TMP) {
@@ -2195,7 +2193,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
}
- if (HISWORD(lParam) < sled->rcVis.top
+ if (HISWORD(lParam) < sled->rcVis.top
|| HISWORD(lParam) > sled->rcVis.bottom)
break;
@@ -2208,7 +2206,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
}
-
+
case MSG_NCLBUTTONUP:
case MSG_LBUTTONUP:
if (GetCapture() == hWnd)
@@ -2226,7 +2224,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleMouseMove (hWnd, sled, lParam);
return 0;
}
-
+
case MSG_GETDLGCODE:
return DLGC_WANTCHARS| DLGC_HASSETSEL| DLGC_WANTARROWS| DLGC_WANTENTER;
@@ -2237,7 +2235,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return IME_WINDOW_TYPE_PASSWORD;
else
return IME_WINDOW_TYPE_EDITABLE;
-
+
case EM_GETCARETPOS:
case EM_GETSELPOS:
{
@@ -2246,11 +2244,11 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int* char_pos = (int *)lParam;
if (message == EM_GETSELPOS)
- pos = (sled->editPos == sled->selStart)
+ pos = (sled->editPos == sled->selStart)
? sled->selEnd : sled->selStart;
else
pos = sled->editPos;
- nr_chars = GetTextMCharInfo (GetWindowFont (hWnd),
+ nr_chars = GetTextMCharInfo (GetWindowFont (hWnd),
(const char* )(sled->content.string), pos, NULL);
if (line_pos) *line_pos = 0;
@@ -2270,7 +2268,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return -1;
pos_chars = ALLOCATE_LOCAL (sled->content.txtlen * sizeof(int));
- nr_chars = GetTextMCharInfo (GetWindowFont (hWnd),
+ nr_chars = GetTextMCharInfo (GetWindowFont (hWnd),
(const char* )sled->content.string, sled->content.txtlen, pos_chars);
if (char_pos > nr_chars) {
DEALLOCATE_LOCAL (pos_chars);
@@ -2315,7 +2313,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else
ExcludeWindowStyle (hWnd, ES_READONLY);
return 0;
-
+
case EM_SETPASSWORDCHAR:
if (sled->passwdChar != (int)wParam) {
sled->passwdChar = (int)wParam;
@@ -2324,14 +2322,14 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
}
return 0;
-
+
case EM_GETPASSWORDCHAR:
{
if (lParam)
*((int*)lParam) = sled->passwdChar;
return 0;
}
-
+
case EM_GETMAXLIMIT:
return sled->hardLimit;
@@ -2351,7 +2349,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
return -1;
}
-
+
case EM_GETTIPTEXT:
{
int len, tip_len;
@@ -2409,8 +2407,8 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else
len = MIN(sled->selEnd - sled->selStart, (int)wParam);
- strncpy (buffer,
- (const char*)(sled->content.string + sled->selStart), len);
+ strncpy (buffer,
+ (const char*)(sled->content.string + sled->selStart), len);
return len;
}
@@ -2427,10 +2425,10 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
#ifdef _MGHAVE_CLIPBOARD
if (sled->selEnd - sled->selStart > 0) {
- SetClipBoardData (CBNAME_TEXT,
- sled->content.string + sled->selStart,
+ SetClipBoardData (CBNAME_TEXT,
+ sled->content.string + sled->selStart,
sled->selEnd - sled->selStart, CBOP_NORMAL);
- if (message == EM_CUTTOCB
+ if (message == EM_CUTTOCB
&& !(GetWindowStyle(hWnd) & ES_READONLY)) {
sleInsertText (hWnd, sled, NULL, 0);
}
diff --git a/src/control/newtoolbar.c b/src/control/newtoolbar.c
index f4b0daae..a7c25a76 100644
--- a/src/control/newtoolbar.c
+++ b/src/control/newtoolbar.c
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -98,18 +98,18 @@ static void draw_left_right_line_vert (HWND hwnd, HDC hdc, RECT *rc)
DWORD darker_dword;
DWORD lighter_dword;
DWORD bgc_dword;
-
+
gal_pixel darker_pixel;
gal_pixel lighter_pixel;
-
+
PCONTROL pWin = (PCONTROL) hwnd;
if (!pWin || !pWin->we_rdr) return;
bgc_dword = PIXEL2DWORD (hdc, pWin->iBkColor);
- darker_dword = pWin->we_rdr->calc_3dbox_color
+ darker_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
- lighter_dword = pWin->we_rdr->calc_3dbox_color
+ lighter_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST);
darker_pixel = DWORD2Pixel (hdc, darker_dword);
@@ -154,17 +154,17 @@ static int get_max_right_in_col (NTBITEM *item, NTBCTRLDATA *ntbar)
{
NTBITEM *it;
int maxr = 0;
-
+
it = item;
-
+
if (!(ntbar->style & NTBS_WITHTEXT)) {
return it->rc_item.right;
- }
-
+ }
+
while (it && ((it->flags & NTBIF_TYPEMASK) != NTBIF_NEWLINE)) {
-
+
if (it->rc_text.right > maxr) {
- if ((it->flags & NTBIF_TYPEMASK) != NTBIF_SEPARATOR
+ if ((it->flags & NTBIF_TYPEMASK) != NTBIF_SEPARATOR
&& (it->flags & NTBIF_TYPEMASK) != NTBIF_NEWLINE) {
maxr = it->rc_text.right;
}
@@ -174,9 +174,9 @@ static int get_max_right_in_col (NTBITEM *item, NTBCTRLDATA *ntbar)
it = item;
while (it && ((it->flags & NTBIF_TYPEMASK) != NTBIF_NEWLINE)) {
-
+
if (it->rc_text.right > maxr) {
- if ((it->flags & NTBIF_TYPEMASK) != NTBIF_SEPARATOR
+ if ((it->flags & NTBIF_TYPEMASK) != NTBIF_SEPARATOR
&& (it->flags & NTBIF_TYPEMASK) != NTBIF_NEWLINE) {
maxr = it->rc_text.right;
}
@@ -193,18 +193,18 @@ static void draw_separator_vert (HWND hwnd, HDC hdc, int l, int t, NTBCTRLDATA *
DWORD darker_dword;
DWORD lighter_dword;
DWORD bgc_dword;
-
+
gal_pixel darker_pixel;
gal_pixel lighter_pixel;
-
+
PCONTROL pWin = (PCONTROL) hwnd;
if (!pWin || !pWin->we_rdr) return;
bgc_dword = PIXEL2DWORD (hdc, pWin->iBkColor);
- darker_dword = pWin->we_rdr->calc_3dbox_color
+ darker_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
- lighter_dword = pWin->we_rdr->calc_3dbox_color
+ lighter_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST);
darker_pixel = DWORD2Pixel (hdc, darker_dword);
@@ -214,7 +214,7 @@ static void draw_separator_vert (HWND hwnd, HDC hdc, int l, int t, NTBCTRLDATA *
pta.y = t + 1;
ptb.x = get_max_right_in_col (it, ntbar) - MARGIN_V_HORZ * 2;
ptb.y = pta.y;
- line_a2b (hdc, &pta, &ptb, darker_pixel);
+ line_a2b (hdc, &pta, &ptb, darker_pixel);
pta.x = l;
pta.y += 1;
@@ -225,7 +225,7 @@ static void draw_separator_vert (HWND hwnd, HDC hdc, int l, int t, NTBCTRLDATA *
-static void draw_checked_item_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
+static void draw_checked_item_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
NTBITEM *item, int l, int t, int w, int h)
{
gal_pixel bgc_pixel;
@@ -239,20 +239,20 @@ static void draw_checked_item_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
w * 2, h * item->bmp_cell);
} else {
if (ntb_data->nr_cols >=2 ) {
- FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
+ FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
w, h * item->bmp_cell);
} else {
POINT pta, ptb;
int r, b;
-
- FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
+
+ FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
0, h * item->bmp_cell);
r = l + w ;
b = t + h ;
bgc_dword = PIXEL2DWORD (hdc, pWin->iBkColor);
- bgc_dword = pWin->we_rdr->calc_3dbox_color
+ bgc_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
bgc_pixel = DWORD2Pixel (hdc, bgc_dword);
@@ -263,7 +263,7 @@ static void draw_checked_item_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
pta.x = l; pta.y = t;
ptb.x = r; ptb.y = t;
line_a2b (hdc, &pta, &ptb, bgc_pixel);
-
+
pta.x = r; pta.y = t;
ptb.x = r; ptb.y = b;
line_a2b (hdc, &pta, &ptb, bgc_pixel);
@@ -276,7 +276,7 @@ static void draw_checked_item_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
-static void draw_normal_item_vert (HDC hdc, PNTBCTRLDATA ntb_data,
+static void draw_normal_item_vert (HDC hdc, PNTBCTRLDATA ntb_data,
NTBITEM *item, int l, int t, int w, int h)
{
if (item == ntb_data->sel_item) {
@@ -299,21 +299,21 @@ static void draw_normal_item_vert (HDC hdc, PNTBCTRLDATA ntb_data,
-static void draw_disabled_item_vert (HDC hdc, PNTBCTRLDATA ntb_data,
+static void draw_disabled_item_vert (HDC hdc, PNTBCTRLDATA ntb_data,
NTBITEM *item, int l, int t, int w, int h)
{
if (ntb_data->nr_cols == 4) {
- FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
+ FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
w * 3, h * item->bmp_cell);
} else {
- FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
+ FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
0, h * item->bmp_cell);
}
}
-static void draw_item_state_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
+static void draw_item_state_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
NTBITEM *item, int l, int t, int w, int h, int r, int b)
{
DWORD bgc_dword;
@@ -336,11 +336,11 @@ static void draw_item_state_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
rect.bottom = b;
bgc_dword = PIXEL2DWORD (hdc, pWin->iBkColor);
if (ntb_data->btn_down) {
- pWin->we_rdr->draw_3dbox (hdc, &rect, bgc_dword,
+ pWin->we_rdr->draw_3dbox (hdc, &rect, bgc_dword,
LFRDR_BTN_STATUS_PRESSED);
}
else {
- pWin->we_rdr->draw_3dbox (hdc, &rect, bgc_dword,
+ pWin->we_rdr->draw_3dbox (hdc, &rect, bgc_dword,
LFRDR_BTN_STATUS_HILITE);
}
}
@@ -352,7 +352,7 @@ static void draw_item_text_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data, NTBI
{
DWORD format = DT_SINGLELINE | DT_VCENTER;
gal_pixel bk_pixel;
-
+
if (ntb_data->style & NTBS_TEXTRIGHT)
format |= DT_LEFT;
else
@@ -374,13 +374,13 @@ static void draw_tool_bar_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data)
NTBITEM *item;
GetClientRect (hwnd, &rc);
-
+
draw_left_right_line_vert (hwnd, hdc, &rc);
item = ntb_data->head;
while (item) {
-
+
if ((item->flags & NTBIF_TYPEMASK) == NTBIF_NEWLINE) {
/*
* if new line just skip it :)
@@ -390,39 +390,39 @@ static void draw_tool_bar_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data)
}
item = item->next;
}
-
+
l = item->rc_item.left;
t = item->rc_item.top;
r = item->rc_item.right;
b = item->rc_item.bottom;
w = ntb_data->w_cell;
h = ntb_data->h_cell;
-
- if ((item->flags & NTBIF_TYPEMASK) == NTBIF_SEPARATOR) {
- /*
- * draw separator
+
+ if ((item->flags & NTBIF_TYPEMASK) == NTBIF_SEPARATOR) {
+ /*
+ * draw separator
*/
if (ntb_data->style & NTBS_DRAWSEPARATOR) {
draw_separator_vert (hwnd, hdc, l, t, ntb_data, item);
}
item = item->next;
continue;
- }
+ }
- if (item->flags & NTBIF_DISABLED) {
+ if (item->flags & NTBIF_DISABLED) {
/*
- * draw disabled item
+ * draw disabled item
*/
draw_disabled_item_vert (hdc, ntb_data, item, l, t, w, h);
-
+
} else {
-
- if (item->flags & NTBIF_CHECKED) {
+
+ if (item->flags & NTBIF_CHECKED) {
/*
* draw checked item
*/
draw_checked_item_vert (hwnd, hdc, ntb_data, item, l, t, w, h);
-
+
} else {
/*
* draw normal item
@@ -440,7 +440,7 @@ static void draw_tool_bar_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data)
if (ntb_data->style & NTBS_WITHTEXT) {
/*
- * draw item's text
+ * draw item's text
*/
draw_item_text_vert (hwnd, hdc, ntb_data, item);
}
@@ -457,18 +457,18 @@ static void draw_top_bottom_line_horz (HWND hwnd, HDC hdc, RECT *rc)
DWORD darker_dword;
DWORD lighter_dword;
DWORD bgc_dword;
-
+
gal_pixel darker_pixel;
gal_pixel lighter_pixel;
-
+
PCONTROL pWin = (PCONTROL) hwnd;
if (!pWin || !pWin->we_rdr) return;
bgc_dword = PIXEL2DWORD (hdc, pWin->iBkColor);
- darker_dword = pWin->we_rdr->calc_3dbox_color
+ darker_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
- lighter_dword = pWin->we_rdr->calc_3dbox_color
+ lighter_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST);
darker_pixel = DWORD2Pixel (hdc, darker_dword);
@@ -517,18 +517,18 @@ static void draw_separator_horz (HWND hwnd, HDC hdc, int l, int t, NTBITEM *it)
DWORD darker_dword;
DWORD lighter_dword;
DWORD bgc_dword;
-
+
gal_pixel darker_pixel;
gal_pixel lighter_pixel;
-
+
PCONTROL pWin = (PCONTROL) hwnd;
if (!pWin || !pWin->we_rdr) return;
bgc_dword = PIXEL2DWORD (hdc, pWin->iBkColor);
- darker_dword = pWin->we_rdr->calc_3dbox_color
+ darker_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
- lighter_dword = pWin->we_rdr->calc_3dbox_color
+ lighter_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST);
darker_pixel = DWORD2Pixel (hdc, darker_dword);
@@ -539,7 +539,7 @@ static void draw_separator_horz (HWND hwnd, HDC hdc, int l, int t, NTBITEM *it)
ptb.x = pta.x;
ptb.y = it->rc_item.bottom;
line_a2b (hdc, &pta, &ptb, darker_pixel);
-
+
pta.x += 1;
pta.y = t;
ptb.x = pta.x;
@@ -549,21 +549,21 @@ static void draw_separator_horz (HWND hwnd, HDC hdc, int l, int t, NTBITEM *it)
-static void draw_disabled_item_horz (HDC hdc, PNTBCTRLDATA ntb_data,
+static void draw_disabled_item_horz (HDC hdc, PNTBCTRLDATA ntb_data,
NTBITEM *item, int l, int t, int w, int h)
{
if (ntb_data->nr_cols == 4) {
- FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
+ FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
w * 3, h * item->bmp_cell);
} else {
- FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
+ FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
0, h * item->bmp_cell);
}
}
-static void draw_checked_item_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
+static void draw_checked_item_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
NTBITEM *item, int l, int t, int w, int h)
{
gal_pixel bgc_pixel;
@@ -577,20 +577,20 @@ static void draw_checked_item_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
w * 2, h * item->bmp_cell);
} else {
if (ntb_data->nr_cols >=2 ) {
- FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
+ FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
w, h * item->bmp_cell);
} else {
int r, b;
POINT pta, ptb;
- FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
+ FillBoxWithBitmapPart (hdc, l, t, w, h, 0, 0, ntb_data->image,
0, h * item->bmp_cell);
r = l + w ;
b = t + h ;
bgc_dword = PIXEL2DWORD (hdc, pWin->iBkColor);
- bgc_dword = pWin->we_rdr->calc_3dbox_color
+ bgc_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
bgc_pixel = DWORD2Pixel (hdc, bgc_dword);
@@ -601,7 +601,7 @@ static void draw_checked_item_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
pta.x = l; pta.y = t;
ptb.x = r; ptb.y = t;
line_a2b (hdc, &pta, &ptb, bgc_pixel);
-
+
pta.x = r; pta.y = t;
ptb.x = r; ptb.y = b;
line_a2b (hdc, &pta, &ptb, bgc_pixel);
@@ -610,12 +610,12 @@ static void draw_checked_item_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
line_a2b (hdc, &pta, &ptb, bgc_pixel);
}
}
-
+
}
-static void draw_normal_item_horz (HDC hdc, PNTBCTRLDATA ntb_data,
+static void draw_normal_item_horz (HDC hdc, PNTBCTRLDATA ntb_data,
NTBITEM *item, int l, int t, int w, int h)
{
if (item == ntb_data->sel_item) {
@@ -639,7 +639,7 @@ static void draw_normal_item_horz (HDC hdc, PNTBCTRLDATA ntb_data,
-static void draw_item_state_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
+static void draw_item_state_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
NTBITEM *item, int l, int t, int w, int h, int r, int b)
{
DWORD bgc_dword;
@@ -662,11 +662,11 @@ static void draw_item_state_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data,
rect.bottom = b;
bgc_dword = PIXEL2DWORD (hdc, pWin->iBkColor);
if (ntb_data->btn_down) {
- pWin->we_rdr->draw_3dbox (hdc, &rect, bgc_dword,
+ pWin->we_rdr->draw_3dbox (hdc, &rect, bgc_dword,
LFRDR_BTN_STATUS_PRESSED);
}
else {
- pWin->we_rdr->draw_3dbox (hdc, &rect, bgc_dword,
+ pWin->we_rdr->draw_3dbox (hdc, &rect, bgc_dword,
LFRDR_BTN_STATUS_HILITE);
}
}
@@ -678,7 +678,7 @@ static void draw_item_text_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data, NTBI
{
DWORD format = DT_SINGLELINE | DT_VCENTER;
gal_pixel bk_pixel;
-
+
if (ntb_data->style & NTBS_TEXTRIGHT)
format |= DT_LEFT;
else
@@ -697,15 +697,15 @@ static void draw_tool_bar_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data)
{
int l, t, r, b, w, h;
RECT rc;
-
+
NTBITEM* item = NULL;
-
+
GetClientRect (hwnd, &rc);
draw_top_bottom_line_horz (hwnd, hdc, &rc);
item = ntb_data->head;
-
+
while (item) {
-
+
if ((item->flags & NTBIF_TYPEMASK) == NTBIF_NEWLINE) {
/*
* if new line just skip it :)
@@ -715,17 +715,17 @@ static void draw_tool_bar_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data)
}
item = item->next;
}
-
+
l = item->rc_item.left;
t = item->rc_item.top;
r = item->rc_item.right;
b = item->rc_item.bottom;
w = ntb_data->w_cell;
h = ntb_data->h_cell;
-
+
if ((item->flags & NTBIF_TYPEMASK) == NTBIF_SEPARATOR) {
- /*
- * draw separator
+ /*
+ * draw separator
*/
if (ntb_data->style & NTBS_DRAWSEPARATOR) {
draw_separator_horz (hwnd, hdc, l, t, item);
@@ -736,27 +736,27 @@ static void draw_tool_bar_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data)
if (item->flags & NTBIF_DISABLED) {
/*
- * draw disalbed item
+ * draw disalbed item
*/
draw_disabled_item_horz (hdc, ntb_data, item, l, t, w, h);
} else {
-
+
if (item->flags & NTBIF_CHECKED) {
- /*
- * draw checked item
+ /*
+ * draw checked item
*/
draw_checked_item_horz (hwnd, hdc, ntb_data, item, l, t, w, h);
-
+
} else {
/*
- * draw normal item
+ * draw normal item
*/
draw_normal_item_horz (hdc, ntb_data, item, l, t, w, h);
}
- }
+ }
if (ntb_data->style & NTBS_DRAWSTATES) {
- /*
+ /*
* draw item's state
*/
draw_item_state_horz (hwnd, hdc, ntb_data, item, l, t, w, h, r, b);
@@ -770,7 +770,7 @@ static void draw_tool_bar_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data)
}
item = item->next;
- }
+ }
}
@@ -795,15 +795,15 @@ static int get_last_col_max_right (NTBCTRLDATA *ntbar)
{
NTBITEM *it;
int maxr = 0;
-
+
it = ntbar->tail->prev;
while (it && ((it->flags & NTBIF_TYPEMASK) != NTBIF_NEWLINE)) {
- if (it->rc_item.right > maxr) {
- maxr = it->rc_item.right;
+ if (it->rc_item.right > maxr) {
+ maxr = it->rc_item.right;
}
it = it->prev;
}
-
+
return maxr;
}
@@ -814,34 +814,34 @@ static void append_new_item (HWND hwnd, NTBCTRLDATA* ntbar, NTBITEM* new_item)
hdc = GetClientDC (hwnd);
if (!(ntbar->style & NTBS_VERTICAL)) {
-
+
//horizontal
if (ntbar->tail == NULL) {
-
+
new_item->rc_item.top = MARGIN_VERT;
new_item->rc_item.left = MARGIN_HORZ;
-
+
} else {
-
+
if ((new_item->flags & NTBIF_TYPEMASK ) == NTBIF_NEWLINE) {
new_item->rc_item.top = ntbar->tail->rc_item.bottom + GAP_ITEM_ITEM_VERT;
new_item->rc_item.left = MARGIN_HORZ;
new_item->rc_item.bottom = new_item->rc_item.top;
new_item->rc_item.right = new_item->rc_item.left;
goto end;
-
+
} else {
-
+
new_item->rc_item.top = ntbar->tail->rc_item.top;
if ((ntbar->tail->flags & NTBIF_TYPEMASK) == NTBIF_NEWLINE)
new_item->rc_item.left = MARGIN_HORZ;
else
new_item->rc_item.left = ntbar->tail->rc_item.right + GAP_ITEM_ITEM_HORZ;
-
+
}
}
-
-
+
+
switch (new_item->flags & NTBIF_TYPEMASK) {
case NTBIF_PUSHBUTTON:
case NTBIF_CHECKBUTTON:
@@ -852,7 +852,7 @@ static void append_new_item (HWND hwnd, NTBCTRLDATA* ntbar, NTBITEM* new_item)
SIZE sz_text;
GetTextExtent (hdc, new_item->text, -1, &sz_text);
- new_item->rc_item.bottom
+ new_item->rc_item.bottom
= new_item->rc_item.top + ntbar->h_cell + 1;
new_item->rc_text.left = new_item->rc_item.left + ntbar->w_cell + GAP_BMP_TEXT_HORZ;
@@ -866,7 +866,7 @@ static void append_new_item (HWND hwnd, NTBCTRLDATA* ntbar, NTBITEM* new_item)
new_item->rc_text.left = new_item->rc_item.left;
new_item->rc_text.right = new_item->rc_item.right;
- new_item->rc_text.top
+ new_item->rc_text.top
= new_item->rc_item.top + ntbar->h_cell + GAP_BMP_TEXT_VERT;
new_item->rc_text.bottom = new_item->rc_text.top + GetFontHeight (hdc);
@@ -877,7 +877,7 @@ static void append_new_item (HWND hwnd, NTBCTRLDATA* ntbar, NTBITEM* new_item)
new_item->rc_item.bottom = new_item->rc_item.top + ntbar->h_cell + 1;
}
break;
-
+
case NTBIF_NEWLINE:
case NTBIF_SEPARATOR:
default:
@@ -892,32 +892,32 @@ static void append_new_item (HWND hwnd, NTBCTRLDATA* ntbar, NTBITEM* new_item)
}
else
{
- // vertical
-
+ // vertical
+
if (ntbar->tail == NULL) {
/*
- * It is the first item of the bar!
+ * It is the first item of the bar!
*/
new_item->rc_item.top = MARGIN_V_VERT;
new_item->rc_item.left = MARGIN_V_HORZ;
} else {
-
+
if ((new_item->flags & NTBIF_TYPEMASK ) == NTBIF_NEWLINE) {
- new_item->rc_item.left = ntbar->tail->rc_item.right + GAP_ITEM_ITEM_HORZ;
+ new_item->rc_item.left = ntbar->tail->rc_item.right + GAP_ITEM_ITEM_HORZ;
new_item->rc_item.top = MARGIN_V_VERT;
new_item->rc_item.bottom = new_item->rc_item.top;
new_item->rc_item.right = new_item->rc_item.left;
goto end;
} else {
if ((ntbar->tail->flags & NTBIF_TYPEMASK) == NTBIF_NEWLINE) {
- new_item->rc_item.top = MARGIN_V_VERT;
+ new_item->rc_item.top = MARGIN_V_VERT;
new_item->rc_item.left = get_last_col_max_right (ntbar) + GAP_ITEM_ITEM_HORZ; /**/
} else {
new_item->rc_item.top = ntbar->tail->rc_item.bottom + GAP_ITEM_ITEM_VERT;
- new_item->rc_item.left = ntbar->tail->rc_item.left;
+ new_item->rc_item.left = ntbar->tail->rc_item.left;
}
//new_item->rc_item.left = ntbar->tail->rc_item.left;
-
+
}
}
switch (new_item->flags & NTBIF_TYPEMASK) {
@@ -929,8 +929,8 @@ static void append_new_item (HWND hwnd, NTBCTRLDATA* ntbar, NTBITEM* new_item)
SIZE sz_text;
GetTextExtent (hdc, new_item->text, -1, &sz_text);
-
- new_item->rc_item.bottom
+
+ new_item->rc_item.bottom
= new_item->rc_item.top + ntbar->h_cell + 1;
new_item->rc_text.left = new_item->rc_item.left + ntbar->w_cell + GAP_BMP_TEXT_HORZ;
@@ -944,7 +944,7 @@ static void append_new_item (HWND hwnd, NTBCTRLDATA* ntbar, NTBITEM* new_item)
new_item->rc_text.left = new_item->rc_item.left;
new_item->rc_text.right = new_item->rc_item.right;
- new_item->rc_text.top
+ new_item->rc_text.top
= new_item->rc_item.top + ntbar->h_cell + GAP_BMP_TEXT_VERT;
new_item->rc_text.bottom = new_item->rc_text.top + GetFontHeight (hdc);
@@ -956,7 +956,7 @@ static void append_new_item (HWND hwnd, NTBCTRLDATA* ntbar, NTBITEM* new_item)
new_item->rc_item.bottom = new_item->rc_item.top + ntbar->h_cell + 1;
}
break;
-
+
case NTBIF_SEPARATOR:
default:
if (ntbar->style & NTBS_DRAWSEPARATOR) {
@@ -1000,7 +1000,7 @@ static void recalc_items (HWND hwnd, NTBCTRLDATA* ntb_data)
{
while (item) {
//horizontal
-
+
if (prev == NULL )
{
item->rc_item.top = MARGIN_VERT;
@@ -1034,7 +1034,7 @@ static void recalc_items (HWND hwnd, NTBCTRLDATA* ntb_data)
SIZE sz_text;
GetTextExtent (hdc, item->text, -1, &sz_text);
- item->rc_item.bottom
+ item->rc_item.bottom
= item->rc_item.top + ntb_data->h_cell + 1;
item->rc_text.left = item->rc_item.left + ntb_data->w_cell + GAP_BMP_TEXT_HORZ + 1;
@@ -1049,7 +1049,7 @@ static void recalc_items (HWND hwnd, NTBCTRLDATA* ntb_data)
item->rc_text.left = item->rc_item.left;
item->rc_text.right = item->rc_item.right;
- item->rc_text.top
+ item->rc_text.top
= item->rc_item.top + ntb_data->h_cell + GAP_BMP_TEXT_VERT;
item->rc_text.bottom = item->rc_text.top + GetFontHeight (hdc);
@@ -1061,7 +1061,7 @@ static void recalc_items (HWND hwnd, NTBCTRLDATA* ntb_data)
item->rc_item.bottom = item->rc_item.top + ntb_data->h_cell + 1;
}
break;
-
+
case NTBIF_SEPARATOR:
default:
if (ntb_data->style & NTBS_DRAWSEPARATOR)
@@ -1096,7 +1096,7 @@ static void recalc_items (HWND hwnd, NTBCTRLDATA* ntb_data)
else
{
if ( (prev->flags & NTBIF_TYPEMASK) == NTBIF_NEWLINE )
- item->rc_item.top = MARGIN_V_VERT;
+ item->rc_item.top = MARGIN_V_VERT;
else
item->rc_item.top = prev->rc_item.bottom + GAP_ITEM_ITEM_VERT;
item->rc_item.left = prev->rc_item.left;
@@ -1112,7 +1112,7 @@ static void recalc_items (HWND hwnd, NTBCTRLDATA* ntb_data)
SIZE sz_text;
GetTextExtent (hdc, item->text, -1, &sz_text);
- item->rc_item.bottom
+ item->rc_item.bottom
= item->rc_item.top + ntb_data->h_cell + 1;
item->rc_text.left = item->rc_item.left + ntb_data->w_cell + GAP_BMP_TEXT_HORZ + 1;
@@ -1127,7 +1127,7 @@ static void recalc_items (HWND hwnd, NTBCTRLDATA* ntb_data)
item->rc_text.left = item->rc_item.left;
item->rc_text.right = item->rc_item.right;
- item->rc_text.top
+ item->rc_text.top
= item->rc_item.top + ntb_data->h_cell + GAP_BMP_TEXT_VERT;
item->rc_text.bottom = item->rc_text.top + GetFontHeight (hdc);
@@ -1139,7 +1139,7 @@ static void recalc_items (HWND hwnd, NTBCTRLDATA* ntb_data)
item->rc_item.bottom = item->rc_item.top + ntb_data->h_cell + 1;
}
break;
-
+
case NTBIF_SEPARATOR:
default:
if (ntb_data->style & NTBS_DRAWSEPARATOR)
@@ -1161,9 +1161,9 @@ end:
/*
- *
- * helper functions for NewToolbarCtrlProc ()
- *
+ *
+ * helper functions for NewToolbarCtrlProc ()
+ *
*/
static void bar_size_changing_horz (HWND hwnd, PNTBCTRLDATA ntb_data, const RECT *expect, RECT *result)
@@ -1207,23 +1207,23 @@ static int bar_add_item (HWND hwnd, PNTBCTRLDATA ntb_data, NTBITEMINFO* item_inf
new_item->flags = item_info->flags;
new_item->id = item_info->id;
new_item->bmp_cell = item_info->bmp_cell;
-
+
if (item_info->text == NULL) {
new_item->text[0] = '\0';
} else {
text_len = strlen (item_info->text);
strncpy (new_item->text, item_info->text, NTB_TEXT_LEN);
-
+
if (text_len > NTB_TEXT_LEN + 1) {
int i, fit[2 * NTB_TEXT_LEN + 1], pos[2 * NTB_TEXT_LEN + 1], dx[2 * NTB_TEXT_LEN + 1];
char buff [2 * NTB_TEXT_LEN + 1];
SIZE size;
HDC hdc = GetClientDC (hwnd);
-
+
memset (fit, 0, sizeof (fit));
memset (pos, 0, sizeof (pos));
memset (dx, 0, sizeof (dx));
-
+
if (text_len > 2 * NTB_TEXT_LEN) {
memcpy (buff, item_info->text, NTB_TEXT_LEN * 2);
buff[2 * NTB_TEXT_LEN] = 0;
@@ -1233,13 +1233,13 @@ static int bar_add_item (HWND hwnd, PNTBCTRLDATA ntb_data, NTBITEMINFO* item_inf
}
GetTextExtentPoint (hdc, buff, strlen (buff), 0xfffffff, fit, pos, dx, &size);
ReleaseDC (hdc);
- for (i = 0; pos[i] <= NTB_TEXT_LEN; i++)
+ for (i = 0; pos[i] <= NTB_TEXT_LEN; i++)
;
-
+
memcpy (new_item->text, buff, pos[i-1]);
new_item->text[pos[i-1]] = '\0';
-
+
}
}
@@ -1248,11 +1248,11 @@ static int bar_add_item (HWND hwnd, PNTBCTRLDATA ntb_data, NTBITEMINFO* item_inf
} else {
new_item->tip [0] = '\0';
}
-
+
new_item->rc_hotspot = item_info->rc_hotspot;
new_item->hotspot_proc = item_info->hotspot_proc;
new_item->add_data = item_info->add_data;
-
+
append_new_item (hwnd, ntb_data, new_item);
InvalidateRect (hwnd, &new_item->rc_item, TRUE);
return 0;
@@ -1260,19 +1260,17 @@ static int bar_add_item (HWND hwnd, PNTBCTRLDATA ntb_data, NTBITEMINFO* item_inf
static void ShowCurItemHintText (HWND hWnd, NTBCTRLDATA *ntb_data , NTBITEM * pitem)
{
- int x,y;
+ int x,y;
- if(!pitem)
- return;
+ if(!pitem)
+ return;
if (pitem->tip[0] == '\0')
- {
return;
- }
- x = pitem->rc_item.right;
- y = pitem->rc_item.bottom;
- ClientToScreen (hWnd, &x, &y);
+ x = pitem->rc_item.right;
+ y = pitem->rc_item.bottom;
+ ClientToScreen (hWnd, &x, &y);
if (!IsWindow(ntb_data->hToolTip)) {
ntb_data->hToolTip = CreateToolTipWin (hWnd, x, y, 1000, pitem->tip);
@@ -1291,86 +1289,86 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
ntb_data = (PNTBCTRLDATA) myself->dwAddData2;
switch (message) {
-
+
case MSG_CREATE: {
NTBINFO* data = (NTBINFO*)myself->dwAddData;
-
+
ntb_data = (NTBCTRLDATA*) calloc (1, sizeof (NTBCTRLDATA));
if (ntb_data == NULL)
return -1;
-
+
ntb_data->head = NULL;
ntb_data->style = myself->dwStyle;
-
+
ntb_data->image = data->image;
ntb_data->nr_cells = data->nr_cells;
ntb_data->nr_cols = data->nr_cols;
if (data->nr_cols == 0)
ntb_data->nr_cols = 4;
-
+
ntb_data->w_cell = data->w_cell;
if (data->w_cell == 0)
ntb_data->w_cell = data->image->bmWidth / ntb_data->nr_cols;
-
+
ntb_data->h_cell = data->h_cell;
if (data->h_cell == 0)
ntb_data->h_cell = data->image->bmHeight / ntb_data->nr_cells;
-
+
ntb_data->nr_items = 0;
ntb_data->sel_item = NULL;
-
+
myself->dwAddData2 = (DWORD)ntb_data;
break;
}
-
+
case MSG_DESTROY: {
NTBITEM *item, *tmp;
-
- if (ntb_data->hToolTip)
- {
- DestroyToolTipWin(ntb_data->hToolTip);
- ntb_data->hToolTip = 0;
- }
-
+
+ if (ntb_data->hToolTip)
+ {
+ DestroyToolTipWin(ntb_data->hToolTip);
+ ntb_data->hToolTip = 0;
+ }
+
item = ntb_data->head;
while (item) {
tmp = item->next;
free (item);
item = tmp;
}
-
+
free (ntb_data);
break;
}
-
+
case MSG_FONTCHANGED: {
RECT rc;
-
+
recalc_items (hwnd, ntb_data);
GetWindowRect (hwnd, &rc);
MoveWindow (hwnd, rc.left, rc.top, RECTW(rc), RECTH(rc), TRUE);
break;
}
-
-
-
+
+
+
case MSG_NCPAINT:
return 0;
-
- case MSG_SIZECHANGING:
-
+
+ case MSG_SIZECHANGING:
+
if (!(ntb_data->style & NTBS_VERTICAL)) {
/*
* size changing , style == HORZ
*/
bar_size_changing_horz (hwnd, ntb_data, (const RECT *)(wParam), (RECT*)(lParam));
-
+
} else {
/*
* style == Vertical ;
@@ -1378,65 +1376,65 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
bar_size_changing_vert (ntb_data, (const RECT *)(wParam), (RECT*)(lParam));
}
return 0;
-
-
-
+
+
+
case NTBM_ADDITEM:
-
+
return bar_add_item (hwnd, ntb_data, (NTBITEMINFO*)lParam);
-
-
-
+
+
+
case NTBM_GETITEM: {
int id = wParam;
PNTBITEMINFO item_info = (PNTBITEMINFO) lParam;
NTBITEM* item = NULL;
-
+
if (!item_info)
return NTB_ERR;
-
+
item = ntb_data->head;
-
+
while (item) {
if (id == item->id) {
if (item_info->which & MTB_WHICH_FLAGS)
item_info->flags = item->flags;
-
+
if (item_info->which & MTB_WHICH_ID)
item_info->id = item->id;
-
+
if (item_info->which & MTB_WHICH_CELL)
item_info->bmp_cell = item->bmp_cell;
-
+
if (item_info->which & MTB_WHICH_HOTSPOT) {
item_info->hotspot_proc = item->hotspot_proc;
item_info->rc_hotspot = item->rc_hotspot;
}
-
+
if (item_info->which & MTB_WHICH_ADDDATA)
item_info->add_data = item->add_data;
-
+
if (item_info->which & MTB_WHICH_TEXT)
strncpy (item_info->text, item->text, NTB_TEXT_LEN);
-
+
if (item_info->which & MTB_WHICH_TIP)
strncpy (item_info->tip, item->tip, NTB_TIP_LEN);
-
+
return NTB_OKAY;
}
item = item->next;
}
-
+
return NTB_ERR;
}
-
+
case NTBM_SETITEM:
{
int id = wParam;
PNTBITEMINFO item_info = (PNTBITEMINFO) lParam;
NTBITEM* item = NULL;
-
+
if (!item_info) {
return NTB_ERR;
}
@@ -1515,7 +1513,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
return NTB_ERR;
}
-
+
case NTBM_SETBITMAP:
{
NTBINFO *ntb_newdata = NULL;
@@ -1537,7 +1535,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
ntb_data->h_cell = ntb_newdata->h_cell;
if (ntb_newdata->h_cell == 0)
ntb_data->h_cell = ntb_newdata->image->bmHeight / ntb_data->nr_cells;
-
+
InvalidateRect(hwnd, NULL, TRUE);
break;
//return NTB_OKAY;
@@ -1546,7 +1544,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
case MSG_PAINT: {
HDC hdc = BeginPaint (hwnd);
-
+
if (!(ntb_data->style & NTBS_VERTICAL)) {
draw_tool_bar_horz (hwnd, hdc, ntb_data);
} else {
@@ -1561,20 +1559,20 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
if (!wParam && ntb_data->sel_item) {
InvalidateRect (hwnd, &ntb_data->sel_item->rc_item, TRUE);
ntb_data->sel_item = NULL;
- ShowWindow(ntb_data->hToolTip, SW_HIDE);
+ ShowWindow(ntb_data->hToolTip, SW_HIDE);
+ }
+ else
+ {
+ ShowWindow(ntb_data->hToolTip, SW_HIDE);
}
- else
- {
- ShowWindow(ntb_data->hToolTip, SW_HIDE);
- }
break;
}
case MSG_MOUSEMOVE: {
-
+
PNTBITEM item;
int x = LOSWORD(lParam), y = HISWORD(lParam);
-
+
if (GetCapture () == hwnd) {
break;
}
@@ -1586,12 +1584,12 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
}
ntb_data->sel_item = item;
InvalidateRect (hwnd, &ntb_data->sel_item->rc_item, TRUE);
- ShowCurItemHintText(hwnd, ntb_data, item);
+ ShowCurItemHintText(hwnd, ntb_data, item);
}
break;
} else {
if (ntb_data->sel_item) {
- ShowWindow(ntb_data->hToolTip, SW_HIDE);
+ ShowWindow(ntb_data->hToolTip, SW_HIDE);
InvalidateRect (hwnd, &ntb_data->sel_item->rc_item, TRUE);
ntb_data->sel_item = NULL;
}
@@ -1599,7 +1597,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
break;
}
-
+
case MSG_LBUTTONDOWN: {
int posx, posy;
NTBITEM* item;
@@ -1609,7 +1607,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
if ((item = get_item_by_pos (ntb_data, posx, posy)) == NULL)
break;
-
+
if (GetCapture () == hwnd)
break;
SetCapture (hwnd);
@@ -1619,7 +1617,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
InvalidateRect (hwnd, &item->rc_item, TRUE);
break;
}
-
+
case MSG_LBUTTONUP: {
int sx, sy, x, y;
@@ -1636,9 +1634,9 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
ScreenToClient (hwnd, &x, &y);
- if ((item = get_item_by_pos (ntb_data, x, y))
+ if ((item = get_item_by_pos (ntb_data, x, y))
&& item == ntb_data->sel_item) {
- if ((item->flags & NTBIF_TYPEMASK) == NTBIF_HOTSPOTBUTTON
+ if ((item->flags & NTBIF_TYPEMASK) == NTBIF_HOTSPOTBUTTON
&& item->hotspot_proc) {
RECT rc_hotspot = item->rc_hotspot;
@@ -1646,7 +1644,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
if (PtInRect (&rc_hotspot, x, y)) {
RECT rc_item = item->rc_item;
-
+
ClientToScreen (hwnd, &rc_item.left, &rc_item.top);
ClientToScreen (hwnd, &rc_item.right, &rc_item.bottom);
@@ -1711,9 +1709,9 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
ScreenToClient (hwnd, &x, &y);
- if ((item = get_item_by_pos (ntb_data, x, y))
+ if ((item = get_item_by_pos (ntb_data, x, y))
&& item == ntb_data->sel_item) {
- if ((item->flags & NTBIF_TYPEMASK) == NTBIF_HOTSPOTBUTTON
+ if ((item->flags & NTBIF_TYPEMASK) == NTBIF_HOTSPOTBUTTON
&& item->hotspot_proc) {
RECT rc_hotspot = item->rc_hotspot;
@@ -1721,7 +1719,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
if (PtInRect (&rc_hotspot, x, y)) {
RECT rc_item = item->rc_item;
-
+
ClientToScreen (hwnd, &rc_item.left, &rc_item.top);
ClientToScreen (hwnd, &rc_item.right, &rc_item.bottom);
@@ -1741,7 +1739,7 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
}
break;
}
-
+
default:
break;
}
diff --git a/src/gui/menu.c b/src/gui/menu.c
index 3e093088..2a1c7c4b 100644
--- a/src/gui/menu.c
+++ b/src/gui/menu.c
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -96,7 +96,7 @@ inline static PMENUBAR MenuBarAlloc (void)
inline static void FreeMenuBar (PMENUBAR pmb)
{
- pmb->category = TYPE_UNDEFINED;
+ pmb->category = TYPE_UNDEFINED;
BlockDataFree (&MBHeap, pmb);
}
@@ -119,7 +119,7 @@ inline static PMENUITEM MenuItemAlloc (void)
inline static void FreeMenuItem (MENUITEM* pmi)
{
- pmi->category = TYPE_UNDEFINED;
+ pmi->category = TYPE_UNDEFINED;
BlockDataFree (&MIHeap, pmi);
}
@@ -187,7 +187,7 @@ HMENU GUIAPI CreateMenu (void)
if (!(pmb = MenuBarAlloc ()))
return 0;
-
+
pmb->category = TYPE_HMENU;
pmb->type = TYPE_MENUBAR;
pmb->head = NULL;
@@ -233,7 +233,7 @@ HMENU GUIAPI CreatePopupMenu (PMENUITEMINFO pmii)
if (!(pmi = MenuItemAlloc ()))
return 0;
-
+
pmi->category = TYPE_HMENU;
pmi->type = TYPE_PPPMENU;
pmi->next = NULL;
@@ -352,14 +352,14 @@ static BOOL mnuInsertMenuItem (PMENUITEM pmi, PMENUITEM pnewmi,
{
PMENUITEM ptmpmi;
int index;
-
+
if (flag) {
// Insert this new menu item at the start.
if (item == 0) {
pnewmi->next = pmi;
return TRUE;
}
-
+
index = 1;
while (pmi->next) {
@@ -369,7 +369,7 @@ static BOOL mnuInsertMenuItem (PMENUITEM pmi, PMENUITEM pnewmi,
pnewmi->next = ptmpmi;
return FALSE;
}
-
+
index ++;
pmi = pmi->next;
}
@@ -379,7 +379,7 @@ static BOOL mnuInsertMenuItem (PMENUITEM pmi, PMENUITEM pnewmi,
pnewmi->next = pmi;
return TRUE;
}
-
+
while (pmi->next) {
if (pmi->next->id == item) {
@@ -388,7 +388,7 @@ static BOOL mnuInsertMenuItem (PMENUITEM pmi, PMENUITEM pnewmi,
pnewmi->next = ptmpmi;
return FALSE;
}
-
+
pmi = pmi->next;
}
}
@@ -399,7 +399,7 @@ static BOOL mnuInsertMenuItem (PMENUITEM pmi, PMENUITEM pnewmi,
return FALSE;
}
-int GUIAPI InsertMenuItem (HMENU hmnu, LINT item,
+int GUIAPI InsertMenuItem (HMENU hmnu, LINT item,
UINT flag, PMENUITEMINFO pmii)
{
PMENUBAR pmb;
@@ -440,9 +440,9 @@ int GUIAPI InsertMenuItem (HMENU hmnu, LINT item,
pmb = (PMENUBAR) hmnu;
if (pmb->category != TYPE_HMENU)
- return ERR_INVALID_HANDLE;
-
- if (!(pnewmi = MenuItemAlloc ()))
+ return ERR_INVALID_HANDLE;
+
+ if (!(pnewmi = MenuItemAlloc ()))
return ERR_RES_ALLOCATION;
pnewmi->category = TYPE_HMENU;
@@ -488,7 +488,7 @@ int GUIAPI InsertMenuItem (HMENU hmnu, LINT item,
break;
}
#endif
-
+
if (pnewmi->mnutype == MFT_BITMAP) {
if (pnewmi->uncheckedbmp == NULL)
pnewmi->uncheckedbmp = (BITMAP*)pnewmi->typedata;
@@ -502,7 +502,7 @@ int GUIAPI InsertMenuItem (HMENU hmnu, LINT item,
if (pmb->type == TYPE_MENUBAR) {
pmi = pmb->head;
-
+
if (!pmi)
pmb->head = pnewmi;
else {
@@ -553,7 +553,7 @@ static void mnuDeleteMenuItem (PMENUITEM pmi)
break;
}
#endif
-
+
FreeMenuItem (pmi);
}
@@ -561,18 +561,18 @@ static PMENUITEM mnuRemoveMenuItem (PMENUITEM phead, LINT item, BOOL flag)
{
int index;
PMENUITEM pmi, ptmpmi;
-
+
if (!phead) return NULL;
-
+
if (flag) {
-
+
if (item == 0) {
pmi = phead->next;
- if (!phead->submenu)
+ if (!phead->submenu)
mnuDeleteMenuItem (phead);
return pmi;
}
-
+
pmi = phead;
index = 1;
while (pmi->next) {
@@ -580,7 +580,7 @@ static PMENUITEM mnuRemoveMenuItem (PMENUITEM phead, LINT item, BOOL flag)
if (index == item) {
ptmpmi = pmi->next;
pmi->next = pmi->next->next;
-
+
if (!ptmpmi->submenu)
mnuDeleteMenuItem (ptmpmi);
@@ -594,18 +594,18 @@ static PMENUITEM mnuRemoveMenuItem (PMENUITEM phead, LINT item, BOOL flag)
else {
if (phead->id == item) {
pmi = phead->next;
- if (!phead->submenu)
+ if (!phead->submenu)
mnuDeleteMenuItem (phead);
return pmi;
}
-
+
pmi = phead;
while (pmi->next) {
if (pmi->next->id == item) {
ptmpmi = pmi->next;
pmi->next = pmi->next->next;
-
+
if (!ptmpmi->submenu)
mnuDeleteMenuItem (ptmpmi);
@@ -628,13 +628,13 @@ int GUIAPI RemoveMenu (HMENU hmnu, LINT item, UINT flags)
if (pmb->category != TYPE_HMENU)
return ERR_INVALID_HANDLE;
-
+
if (pmb->type == TYPE_MENUBAR)
- pmb->head = mnuRemoveMenuItem (pmb->head, item,
+ pmb->head = mnuRemoveMenuItem (pmb->head, item,
flags & MF_BYPOSITION);
else if (pmb->type == TYPE_PPPMENU) {
pmi = (PMENUITEM) hmnu;
- pmi->submenu = mnuRemoveMenuItem (pmi->submenu, item,
+ pmi->submenu = mnuRemoveMenuItem (pmi->submenu, item,
flags & MF_BYPOSITION);
}
else
@@ -647,17 +647,17 @@ static PMENUITEM mnuDeleteMenu (PMENUITEM phead, LINT item, BOOL flag)
{
int index;
PMENUITEM pmi, ptmpmi;
-
+
if (!phead) return NULL;
-
+
if (flag) {
-
+
if (item == 0) {
pmi = phead->next;
mnuDeleteMenuItem (phead);
return pmi;
}
-
+
pmi = phead;
index = 1;
while (pmi->next) {
@@ -679,7 +679,7 @@ static PMENUITEM mnuDeleteMenu (PMENUITEM phead, LINT item, BOOL flag)
mnuDeleteMenuItem (phead);
return pmi;
}
-
+
pmi = phead;
while (pmi->next) {
@@ -706,17 +706,17 @@ int GUIAPI DeleteMenu (HMENU hmnu, LINT item, UINT flags)
if (pmb->category != TYPE_HMENU)
return ERR_INVALID_HANDLE;
-
+
if (pmb->type == TYPE_MENUBAR){
- pmb->head = mnuDeleteMenu (pmb->head, item,
+ pmb->head = mnuDeleteMenu (pmb->head, item,
flags & MF_BYPOSITION);
- SendMessage (HWND_DESKTOP,
+ SendMessage (HWND_DESKTOP,
MSG_PAINT, 0, 0);
}
else if (pmb->type == TYPE_PPPMENU) {
pmi = (PMENUITEM) hmnu;
- pmi->submenu = mnuDeleteMenu (pmi->submenu, item,
+ pmi->submenu = mnuDeleteMenu (pmi->submenu, item,
flags & MF_BYPOSITION);
}
else
@@ -734,7 +734,7 @@ int GUIAPI DestroyMenu (HMENU hmnu)
if (pmb->category != TYPE_HMENU)
return ERR_INVALID_HANDLE;
-
+
if (pmb->type == TYPE_MENUBAR) {
pmi = pmb->head;
while (pmi) {
@@ -772,7 +772,7 @@ int GUIAPI GetMenuItemCount (HMENU hmnu)
if (pmb->category != TYPE_HMENU)
return ERR_INVALID_HANDLE;
-
+
if (pmb->type == TYPE_MENUBAR)
pmi = pmb->head;
else if (pmb->type == TYPE_PPPMENU) {
@@ -781,13 +781,13 @@ int GUIAPI GetMenuItemCount (HMENU hmnu)
}
else
pmi = (PMENUITEM) hmnu;
-
+
count = 0;
while (pmi) {
count ++;
pmi = pmi->next;
}
-
+
return count;
}
@@ -800,8 +800,8 @@ static PMENUITEM mnuGetMenuItem (HMENU hmnu, LINT item, BOOL flag)
pmb = (PMENUBAR) hmnu;
if (pmb->category != TYPE_HMENU)
- return NULL;
-
+ return NULL;
+
if (pmb->type == TYPE_MENUBAR)
pmi = pmb->head;
else if (pmb->type == TYPE_PPPMENU) {
@@ -830,7 +830,7 @@ static PMENUITEM mnuGetMenuItem (HMENU hmnu, LINT item, BOOL flag)
}
}
- return NULL;
+ return NULL;
}
LINT GUIAPI GetMenuItemID (HMENU hmnu, int pos)
@@ -843,7 +843,7 @@ LINT GUIAPI GetMenuItemID (HMENU hmnu, int pos)
if (pmb->category != TYPE_HMENU)
return ERR_INVALID_HANDLE;
-
+
if (pmb->type == TYPE_MENUBAR)
pmi = pmb->head;
else if (pmb->type == TYPE_PPPMENU) {
@@ -852,7 +852,7 @@ LINT GUIAPI GetMenuItemID (HMENU hmnu, int pos)
}
else
pmi = (PMENUITEM) hmnu;
-
+
index = 0;
while (pmi) {
@@ -862,7 +862,7 @@ LINT GUIAPI GetMenuItemID (HMENU hmnu, int pos)
index ++;
pmi = pmi->next;
}
-
+
return ERR_INVALID_POS;
}
@@ -874,7 +874,7 @@ HMENU GUIAPI GetPopupSubMenu (HMENU hpppmnu)
if (pmi->category != TYPE_HMENU)
return 0;
-
+
if (pmi->type != TYPE_PPPMENU)
return 0;
@@ -890,7 +890,7 @@ HMENU GUIAPI StripPopupHead (HMENU hpppmnu)
if (pmi->category != TYPE_HMENU)
return 0;
-
+
if (pmi->type != TYPE_PPPMENU)
return 0;
@@ -925,7 +925,7 @@ HMENU GUIAPI GetSubMenu (HMENU hmnu, int pos)
if (pmb->category != TYPE_HMENU)
return 0;
-
+
if (pmb->type == TYPE_MENUBAR)
pmi = pmb->head;
else if (pmb->type == TYPE_PPPMENU) {
@@ -933,8 +933,8 @@ HMENU GUIAPI GetSubMenu (HMENU hmnu, int pos)
pmi = pmi->submenu;
}
else
- return 0; // this is a normal menu item.
-
+ return 0; // this is a normal menu item.
+
index = 0;
while (pmi) {
@@ -944,11 +944,11 @@ HMENU GUIAPI GetSubMenu (HMENU hmnu, int pos)
index ++;
pmi = pmi->next;
}
-
+
return 0;
}
-int GUIAPI GetMenuItemInfo (HMENU hmnu, LINT item,
+int GUIAPI GetMenuItemInfo (HMENU hmnu, LINT item,
UINT flag, PMENUITEMINFO pmii)
{
PMENUITEM pmi;
@@ -981,7 +981,7 @@ int GUIAPI GetMenuItemInfo (HMENU hmnu, LINT item,
pmii->type = pmi->mnutype;
#ifdef SHOW_BUG4491
if (pmii->type == MFT_STRING)
- strncpy ((char*)(pmii->typedata), (char*)(pmi->typedata),
+ strncpy ((char*)(pmii->typedata), (char*)(pmi->typedata),
pmii->cch);
else
pmii->typedata = pmi->typedata;
@@ -991,7 +991,7 @@ int GUIAPI GetMenuItemInfo (HMENU hmnu, LINT item,
case MFT_RADIOCHECK:
case MFT_MARKCHECK:
case MFT_BMPSTRING:
- strncpy ((char*)(pmii->typedata), (char*)(pmi->typedata),
+ strncpy ((char*)(pmii->typedata), (char*)(pmi->typedata),
pmii->cch);
break;
@@ -1005,7 +1005,7 @@ int GUIAPI GetMenuItemInfo (HMENU hmnu, LINT item,
return 0;
}
-int GUIAPI SetMenuItemInfo (HMENU hmnu, LINT item,
+int GUIAPI SetMenuItemInfo (HMENU hmnu, LINT item,
UINT flag, PMENUITEMINFO pmii)
{
PMENUITEM pmi;
@@ -1053,12 +1053,12 @@ int GUIAPI SetMenuItemInfo (HMENU hmnu, LINT item,
break;
}
#endif
-
+
pmi->mnutype = pmii->type;
#ifdef SHOW_BUG4491
- if ((pmi->mnutype == MFT_STRING
- || pmi->mnutype == MFT_BMPSTRING
+ if ((pmi->mnutype == MFT_STRING
+ || pmi->mnutype == MFT_BMPSTRING
|| pmi->mnutype == MFT_BITMAP)
&& pmii->typedata == 0)
return ERR_INVALID_ARGS;
@@ -1078,7 +1078,7 @@ int GUIAPI SetMenuItemInfo (HMENU hmnu, LINT item,
case MFT_MARKCHECK:
case MFT_BMPSTRING:
{
- int len;
+ int len;
if (pmii->typedata == 0) {
pmi->typedata = 0;
return ERR_INVALID_ARGS;
@@ -1120,7 +1120,7 @@ int GUIAPI SetMenuItemInfo (HMENU hmnu, LINT item,
UINT GUIAPI EnableMenuItem (HMENU hmnu, LINT item, UINT flags)
{
PMENUITEM pmi;
- UINT prevstate = 0xFFFFFFFF;
+ UINT prevstate = 0xFFFFFFFF;
if (!(pmi = mnuGetMenuItem (hmnu, item, flags & MF_BYPOSITION)))
return prevstate;
@@ -1132,7 +1132,7 @@ UINT GUIAPI EnableMenuItem (HMENU hmnu, LINT item, UINT flags)
return prevstate;
}
-int GUIAPI CheckMenuRadioItem (HMENU hmnu, LINT first, LINT last,
+int GUIAPI CheckMenuRadioItem (HMENU hmnu, LINT first, LINT last,
LINT checkitem, UINT flags)
{
PMENUITEM pmi;
@@ -1152,7 +1152,7 @@ int GUIAPI CheckMenuRadioItem (HMENU hmnu, LINT first, LINT last,
pmi->mnustate = (0xFFFFFFF0 & pmi->mnustate) | MFS_CHECKED;
else
pmi->mnustate = (0xFFFFFFF0 & pmi->mnustate) | MFS_UNCHECKED;
-
+
if (index == last)
break;
@@ -1170,7 +1170,7 @@ int GUIAPI CheckMenuRadioItem (HMENU hmnu, LINT first, LINT last,
pmi->mnustate = (0xFFFFFFF0 & pmi->mnustate) | MFS_CHECKED;
else
pmi->mnustate = (0xFFFFFFF0 & pmi->mnustate) | MFS_UNCHECKED;
-
+
if (pmi->id == last)
break;
@@ -1181,7 +1181,7 @@ int GUIAPI CheckMenuRadioItem (HMENU hmnu, LINT first, LINT last,
return 0;
}
-int GUIAPI SetMenuItemBitmaps (HMENU hmnu, LINT item, UINT flags,
+int GUIAPI SetMenuItemBitmaps (HMENU hmnu, LINT item, UINT flags,
PBITMAP hBmpUnchecked, PBITMAP hBmpChecked)
{
PMENUITEM pmi;
@@ -1214,7 +1214,7 @@ int GUIAPI SetMenuItemBitmaps (HMENU hmnu, LINT item, UINT flags,
void mnuDumpMenuItem (PMENUITEM pmi)
{
PMENUITEM ptmpmi;
-
+
printf ("Menu Item (0x%p) Information:\n", pmi);
printf ("\tdata category: %d\n", pmi->category);
@@ -1230,7 +1230,7 @@ void mnuDumpMenuItem (PMENUITEM pmi)
else
printf ("\ttype data: %p\n", (PVOID)pmi->typedata);
printf ("\tnext item: 0x%p\n", pmi->next);
-
+
if (pmi->submenu) {
ptmpmi = pmi->submenu;
while (ptmpmi) {
@@ -1252,10 +1252,10 @@ void DumpMenu (HMENU hmnu)
printf ("hmnu is not a valid menu handle.\n");
return;
}
-
+
if (pmb->type == TYPE_MENUBAR) {
printf ("hmnu is a menu bar.\n");
-
+
pmi = pmb->head;
while (pmi) {
mnuDumpMenuItem (pmi);
@@ -1327,12 +1327,12 @@ static void mnuGetMenuBarItemSize (HWND hwnd, PMENUITEM pmi, SIZE* size)
size->cx = pmi->checkedbmp->bmWidth;
}
else if (pmi->mnutype == MFT_SEPARATOR) {
- size->cx = LFRDR_MENUSEPARATORX;
+ size->cx = LFRDR_MENUSEPARATORX;
}
else if (pmi->mnutype == MFT_OWNERDRAW) {
}
else {
- SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
+ SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
(hwnd, WE_FONT_MENU));
GetTextExtent (HDC_SCREEN_SYS, (char*) pmi->typedata, -1, size);
if (pmi->mnutype == MFT_BMPSTRING) {
@@ -1345,7 +1345,7 @@ static void mnuGetMenuBarItemSize (HWND hwnd, PMENUITEM pmi, SIZE* size)
return;
}
-static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi,
+static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi,
int x, int y, int w, int h, int rect_y, int rect_h)
{
PBITMAP bmp;
@@ -1364,7 +1364,7 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi,
gal_pixel lighter_pixel;
pWin = (PMAINWIN) hwnd;
- if (NULL == pWin)
+ if (NULL == pWin)
return;
if (!pWin->we_rdr) {
@@ -1398,7 +1398,7 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi,
else if (pmi->mnustate & MFS_HILITE)
{
/** render a hilite item */
- SetTextColor (hdc, GetWindowElementPixelEx
+ SetTextColor (hdc, GetWindowElementPixelEx
(hwnd, hdc, WE_FGC_HIGHLIGHT_ITEM));
pWin->we_rdr->draw_hilite_menu_item (hwnd, hdc, &rect,
GetWindowElementAttr (hwnd, WE_BGC_HIGHLIGHT_ITEM));
@@ -1406,7 +1406,7 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi,
else
{
/** render a normal item as unhilite */
- SetTextColor (hdc, GetWindowElementPixelEx
+ SetTextColor (hdc, GetWindowElementPixelEx
(hwnd, hdc, WE_FGC_MENU));
pWin->we_rdr->draw_normal_menu_item (hwnd, hdc, &rect,
GetWindowElementAttr (hwnd, WE_MAINC_THREED_BODY));
@@ -1414,22 +1414,22 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi,
/* fix bug #4491: use == instead of & for mnutype. */
if (pmi->mnutype == MFT_BITMAP) {
-
+
if (pmi->mnustate & MFS_CHECKED)
bmp = pmi->checkedbmp;
else
bmp = pmi->uncheckedbmp;
-
+
FillBoxWithBitmap (hdc, x, y, pmi->h, height, bmp);
}
else if (pmi->mnutype == MFT_SEPARATOR) {
-
+
/** two vertical separator */
bgc_dword = GetWindowElementAttr (hwnd, WE_BGC_MENU);
- darker_dword = pWin->we_rdr->calc_3dbox_color
+ darker_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
- lighter_dword = pWin->we_rdr->calc_3dbox_color
+ lighter_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST);
darker_pixel = DWORD2Pixel (hdc, darker_dword);
@@ -1437,16 +1437,16 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi,
if (rect.top < rect.bottom - 2)
{
- SetPenColor (hdc, darker_pixel);
- MoveTo (hdc,
+ SetPenColor (hdc, darker_pixel);
+ MoveTo (hdc,
x + (pmi->h>>1), rect.top);
- LineTo (hdc,
+ LineTo (hdc,
x + (pmi->h>>1), rect.bottom - 2);
SetPenColor (hdc, lighter_pixel);
- MoveTo (hdc,
+ MoveTo (hdc,
x + (pmi->h>>1) + 1, rect.top);
- LineTo (hdc,
+ LineTo (hdc,
x + (pmi->h>>1) + 1, rect.bottom - 2);
}
}
@@ -1458,16 +1458,16 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi,
bmp = pmi->checkedbmp;
else
bmp = pmi->uncheckedbmp;
-
+
FillBoxWithBitmap (hdc, x, y, height, height, bmp);
x += bmp->bmWidth + inter;
}
- SelectFont (hdc, (PLOGFONT)GetWindowElementAttr
+ SelectFont (hdc, (PLOGFONT)GetWindowElementAttr
(hwnd, WE_FONT_MENU));
-
+
old_mode = SetBkMode (hdc, BM_TRANSPARENT);
- TextOut (hdc, x, y, (char *)pmi->typedata);
+ TextOut (hdc, x, y, (char *)pmi->typedata);
SetBkMode (hdc, old_mode);
}
}
@@ -1557,7 +1557,7 @@ HMENU GUIAPI GetMenuBarItemRect (HWND hwnd, int pos, RECT* prc)
x = pWin->cl - pWin->left;
x += LFRDR_MENUBAROFFX;
- y = pWin->ct - pWin->top;
+ y = pWin->ct - pWin->top;
h = GetWindowElementAttr (hwnd, WE_METRICS_MENU);
y -= h;
@@ -1574,7 +1574,7 @@ HMENU GUIAPI GetMenuBarItemRect (HWND hwnd, int pos, RECT* prc)
x = x + inter + size.cx;
count ++;
-
+
pmi = pmi->next;
}
@@ -1594,11 +1594,11 @@ static BOOL mnuGetMenuBarRect (HWND hwnd, RECT* prc)
int h;
if (!(pWin = gui_CheckAndGetMainWindowPtr (hwnd))) return FALSE;
-
+
prc->left = pWin->cl - pWin->left;
h = GetWindowElementAttr (hwnd, WE_METRICS_MENU);
- prc->top = pWin->ct - pWin->top - h;
+ prc->top = pWin->ct - pWin->top - h;
prc->right = pWin->right - pWin->left - prc->left;
prc->bottom = pWin->bottom - pWin->top - prc->top;
@@ -1627,7 +1627,7 @@ BOOL GUIAPI HiliteMenuBarItem (HWND hwnd, int pos, UINT flags)
if (!pmi) return FALSE;
if (pmi->mnutype == MFT_SEPARATOR)
- return TRUE;
+ return TRUE;
hdc = GetDC (hwnd);
@@ -1660,7 +1660,7 @@ BOOL GUIAPI HiliteMenuBarItem (HWND hwnd, int pos, UINT flags)
break;
}
- mnuDrawMenuBarItem (hwnd, hdc, pmi, rc.left, font_y,
+ mnuDrawMenuBarItem (hwnd, hdc, pmi, rc.left, font_y,
RECTW (rc) , font_h, rc.top, RECTH (rc));
/** reset draw state */
@@ -1690,7 +1690,7 @@ int MenuBarHitTest (HWND hwnd, int mx, int my)
x = pWin->cl;
x += LFRDR_MENUBAROFFX;
- y = pWin->ct;
+ y = pWin->ct;
h = GetWindowElementAttr (hwnd, WE_METRICS_MENU);
y -= h;
@@ -1716,7 +1716,7 @@ int MenuBarHitTest (HWND hwnd, int mx, int my)
x = x + inter + size.cx;
count ++;
-
+
pmi = pmi->next;
}
@@ -1741,12 +1741,12 @@ void DrawMenuBarHelper (const MAINWIN* pWin, HDC hdc, const RECT* pClipRect)
HWND hwnd;
SIZE size;
- if (!pWin->hMenu)
+ if (!pWin->hMenu)
return;
hwnd = (HWND)pWin;
pmb = (PMENUBAR) (pWin->hMenu);
- if (pmb->category != TYPE_HMENU)
+ if (pmb->category != TYPE_HMENU)
return;
x = pWin->cl - pWin->left;
@@ -1800,7 +1800,7 @@ void GUIAPI DrawMenuBar (HWND hwnd)
if (!(pWin = gui_CheckAndGetMainWindowPtr (hwnd))) return;
if (!pWin->hMenu) return;
-
+
hdc = GetDC (hwnd);
DrawMenuBarHelper (pWin, hdc, NULL);
ReleaseDC (hdc);
@@ -1820,17 +1820,17 @@ static void mnuGetPopupMenuExtent (PTRACKMENUINFO ptmi)
BOOL has_sub = FALSE;
BOOL has_txt = FALSE;
- menu_font_size = ((PLOGFONT)GetWindowElementAttr
+ menu_font_size = ((PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU))->size;
menu_size = GetWindowElementAttr (ptmi->hwnd, WE_METRICS_MENU);
inter = GetMenuOffy (ptmi->hwnd, menu_size);
mioffx = LFRDR_MENUITEMOFFX;
minx = LFRDR_MENUITEMMINX;
-
+
ptmi->rc.right = ptmi->rc.left;
ptmi->rc.bottom = ptmi->rc.top + LFRDR_MENUTOPMARGIN;
-
+
/* fix bug #4491: use == instead of & for mnutype. */
if (pmi->mnutype == MFT_OWNERDRAW) {
}
@@ -1846,7 +1846,7 @@ static void mnuGetPopupMenuExtent (PTRACKMENUINFO ptmi)
w = bmp->bmWidth;
}
else {
- SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
+ SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU));
GetTabbedTextExtent (HDC_SCREEN_SYS, (char*)pmi->typedata, -1, &size);
@@ -1866,7 +1866,7 @@ static void mnuGetPopupMenuExtent (PTRACKMENUINFO ptmi)
has_txt = TRUE;
}
ptmi->rc.bottom += pmi->h;
-
+
if (pmi->type == TYPE_PPPMENU) {
psubmi = pmi->submenu;
}
@@ -1893,13 +1893,13 @@ static void mnuGetPopupMenuExtent (PTRACKMENUINFO ptmi)
w = bmp->bmWidth;
}
else {
- SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
+ SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU));
- GetTabbedTextExtent (HDC_SCREEN_SYS,
+ GetTabbedTextExtent (HDC_SCREEN_SYS,
(char*)psubmi->typedata, -1, &size);
if (psubmi->mnutype == MFT_BMPSTRING) {
- psubmi->h = MAX (psubmi->uncheckedbmp->bmHeight, menu_font_size)
+ psubmi->h = MAX (psubmi->uncheckedbmp->bmHeight, menu_font_size)
+ (inter<<1);
size.cx += psubmi->uncheckedbmp->bmWidth;
@@ -1988,7 +1988,7 @@ static void mnuGetPopupMenuExtent (PTRACKMENUINFO ptmi)
*
* param hwnd : handle of window
* param hdc : handle of HDC
- * param rect : the rectangle in which to draw
+ * param rect : the rectangle in which to draw
* param pic_type : type of menu picture
* param menu_state : state of menu
*
@@ -1997,7 +1997,7 @@ static void mnuGetPopupMenuExtent (PTRACKMENUINFO ptmi)
* Author : zhounuohua
* Date : 2007-11-27
*/
-static int mnuDrawMenuPic (HWND hwnd, HDC hdc, RECT* rect,
+static int mnuDrawMenuPic (HWND hwnd, HDC hdc, RECT* rect,
int pic_type, int menu_state)
{
DWORD rgb_font;
@@ -2021,11 +2021,11 @@ static int mnuDrawMenuPic (HWND hwnd, HDC hdc, RECT* rect,
switch (pic_type & LFRDR_MENU_PIC_MASK)
{
case LFRDR_MENU_PIC_RADIO:
- pWin->we_rdr->draw_radio (hdc, rect, rgb_font, flag);
+ pWin->we_rdr->draw_radio (hdc, rect, rgb_font, flag);
break;
case LFRDR_MENU_PIC_MARK:
- pWin->we_rdr->draw_checkmark (hdc, rect, rgb_font, flag);
+ pWin->we_rdr->draw_checkmark (hdc, rect, rgb_font, flag);
break;
case LFRDR_MENU_PIC_SUB:
@@ -2034,35 +2034,35 @@ static int mnuDrawMenuPic (HWND hwnd, HDC hdc, RECT* rect,
{
if (menu_state & MFS_HILITE)
{
- SetBkColor (hdc, GetWindowElementPixelEx
+ SetBkColor (hdc, GetWindowElementPixelEx
(hwnd, hdc, WE_BGC_DISABLED_ITEM));
- pWin->we_rdr->draw_arrow (hwnd, hdc, rect,
- GetWindowElementAttr (hwnd, WE_FGC_DISABLED_ITEM),
- LFRDR_ARROW_RIGHT);
+ pWin->we_rdr->draw_arrow (hwnd, hdc, rect,
+ GetWindowElementAttr (hwnd, WE_FGC_DISABLED_ITEM),
+ LFRDR_ARROW_RIGHT);
}
else
{
- SetBkColor (hdc, GetWindowElementPixelEx
+ SetBkColor (hdc, GetWindowElementPixelEx
(hwnd, hdc, WE_BGC_MENU));
- pWin->we_rdr->draw_arrow (hwnd, hdc, rect,
- GetWindowElementAttr (hwnd, WE_FGC_DISABLED_ITEM),
- LFRDR_ARROW_RIGHT);
+ pWin->we_rdr->draw_arrow (hwnd, hdc, rect,
+ GetWindowElementAttr (hwnd, WE_FGC_DISABLED_ITEM),
+ LFRDR_ARROW_RIGHT);
}
}
else if (menu_state & MFS_HILITE)
{
- SetBkColor (hdc, GetWindowElementPixelEx
+ SetBkColor (hdc, GetWindowElementPixelEx
(hwnd, hdc, WE_BGC_HIGHLIGHT_ITEM));
- pWin->we_rdr->draw_arrow (hwnd, hdc, rect,
- GetWindowElementAttr (hwnd, WE_FGC_HIGHLIGHT_ITEM),
- LFRDR_ARROW_RIGHT);
+ pWin->we_rdr->draw_arrow (hwnd, hdc, rect,
+ GetWindowElementAttr (hwnd, WE_FGC_HIGHLIGHT_ITEM),
+ LFRDR_ARROW_RIGHT);
}
else
{
- SetBkColor (hdc, GetWindowElementPixelEx
+ SetBkColor (hdc, GetWindowElementPixelEx
(hwnd, hdc, WE_BGC_MENU));
- pWin->we_rdr->draw_arrow (hwnd, hdc, rect, rgb_font,
- LFRDR_ARROW_RIGHT);
+ pWin->we_rdr->draw_arrow (hwnd, hdc, rect, rgb_font,
+ LFRDR_ARROW_RIGHT);
}
SetBkColor (hdc, old_bgc);
break;
@@ -2081,7 +2081,7 @@ static int mnuDrawMenuPic (HWND hwnd, HDC hdc, RECT* rect,
* Author : zhounuohua
* Date : 2007-11-27
*/
-static int DrawMenuPic (HWND hwnd, HDC hdc, int x, int y,
+static int DrawMenuPic (HWND hwnd, HDC hdc, int x, int y,
PMENUITEM pmi, BOOL draw_sub, int * bmp_w)
{
RECT mp_rect; /** rect of menu pic*/
@@ -2100,7 +2100,7 @@ static int DrawMenuPic (HWND hwnd, HDC hdc, int x, int y,
bmp = pmi->checkedbmp;
else
bmp = pmi->uncheckedbmp;
-
+
if (bmp) {
bmp_offy = (pmi->h - bmp->bmHeight)>>1;
FillBoxWithBitmap (hdc, x, y + bmp_offy,
@@ -2110,7 +2110,7 @@ static int DrawMenuPic (HWND hwnd, HDC hdc, int x, int y,
}
return 0;
}
- else
+ else
return -1;
}
}
@@ -2147,9 +2147,9 @@ static int DrawMenuPic (HWND hwnd, HDC hdc, int x, int y,
else {
/* draw menu radio or menu check */
/* fix bug #4491: use == instead of & for mnutype. */
- if (pmi->mnutype == MFT_RADIOCHECK)
- mp_type = LFRDR_MENU_PIC_RADIO;
- else if (pmi->mnutype == MFT_MARKCHECK)
+ if (pmi->mnutype == MFT_RADIOCHECK)
+ mp_type = LFRDR_MENU_PIC_RADIO;
+ else if (pmi->mnutype == MFT_MARKCHECK)
mp_type = LFRDR_MENU_PIC_MARK;
}
@@ -2161,7 +2161,7 @@ static int DrawMenuPic (HWND hwnd, HDC hdc, int x, int y,
static void do_save_box (TRACKMENUINFO* ptmi)
{
memset (&ptmi->savedbox, 0, sizeof (BITMAP));
- if (!GetBitmapFromDC (HDC_SCREEN_SYS, ptmi->rc.left, ptmi->rc.top,
+ if (!GetBitmapFromDC (HDC_SCREEN_SYS, ptmi->rc.left, ptmi->rc.top,
RECTW (ptmi->rc), RECTH (ptmi->rc), &ptmi->savedbox))
return -1;
}
@@ -2219,15 +2219,15 @@ static void draw_down_arrowhead(PTRACKMENUINFO ptmi, HDC hdc)
int l, t, r, b, cx, cy;
l = ptmi->bottom_scroll_rc.left;
- t = ptmi->bottom_scroll_rc.top;
+ t = ptmi->bottom_scroll_rc.top;
r = ptmi->bottom_scroll_rc.right;
- b = ptmi->bottom_scroll_rc.bottom;
+ b = ptmi->bottom_scroll_rc.bottom;
cx = (l + r) / 2;
cy = (t + b) / 2;
SetPenColor(hdc, GetWindowElementPixelEx (ptmi->hwnd, hdc, WE_FGC_MENU));
-
+
MoveTo(hdc, cx-4, cy-2);
LineTo(hdc, cx+4, cy-2);
@@ -2260,7 +2260,7 @@ static void draw_bottom_scroll_button(PTRACKMENUINFO ptmi)
bgc = GetWindowElementAttr (ptmi->hwnd, WE_BGC_MENU);
- pWin->we_rdr->draw_3dbox (HDC_SCREEN_SYS, &ptmi->bottom_scroll_rc, bgc,
+ pWin->we_rdr->draw_3dbox (HDC_SCREEN_SYS, &ptmi->bottom_scroll_rc, bgc,
LFRDR_3DBOX_FILLED | LFRDR_3DBOX_THICKFRAME);
draw_down_arrowhead(ptmi, HDC_SCREEN_SYS);
@@ -2271,7 +2271,7 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
PMENUITEM pmi = ptmi->pmi;
PMENUITEM psubmi;
int x, y, offy;
-
+
int inter;
int mioffx;
int marginlx, marginrx;
@@ -2311,22 +2311,22 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
/*add*/
ptmi->pstart_show_mi = ptmi->pmi;
- ptmi->show_rc.top = ptmi->rc.top;
- ptmi->show_rc.left = ptmi->rc.left;
- ptmi->show_rc.right = ptmi->rc.right;
+ ptmi->show_rc.top = ptmi->rc.top;
+ ptmi->show_rc.left = ptmi->rc.left;
+ ptmi->show_rc.right = ptmi->rc.right;
ptmi->show_rc.bottom = ptmi->rc.bottom;
- ptmi->selected_rc.top = ptmi->show_rc.top;
- ptmi->selected_rc.left = ptmi->show_rc.left;
- ptmi->selected_rc.right = ptmi->show_rc.right;
- ptmi->selected_rc.bottom = ptmi->show_rc.top + ptmi->pmi->h;
+ ptmi->selected_rc.top = ptmi->show_rc.top;
+ ptmi->selected_rc.left = ptmi->show_rc.left;
+ ptmi->selected_rc.right = ptmi->show_rc.right;
+ ptmi->selected_rc.bottom = ptmi->show_rc.top + ptmi->pmi->h;
ptmi->top_scroll_rc.top = 0;
ptmi->top_scroll_rc.left= 0;
ptmi->top_scroll_rc.right= 0;
ptmi->top_scroll_rc.bottom= 0;
- ptmi->bottom_scroll_rc.top = 0;
+ ptmi->bottom_scroll_rc.top = 0;
ptmi->bottom_scroll_rc.left = 0;
ptmi->bottom_scroll_rc.right = 0;
ptmi->bottom_scroll_rc.bottom = 0;
@@ -2337,28 +2337,28 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
/** get darker and lighter color according to backgroup color */
bgc_dword = GetWindowElementAttr (ptmi->hwnd, WE_BGC_MENU);
- darker_dword = pWin->we_rdr->calc_3dbox_color
+ darker_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
- lighter_dword = pWin->we_rdr->calc_3dbox_color
+ lighter_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST);
darker_pixel = DWORD2Pixel (HDC_SCREEN_SYS, darker_dword);
lighter_pixel = DWORD2Pixel (HDC_SCREEN_SYS, lighter_dword);
- if ((ptmi->rc.bottom > g_rcScr.bottom)
+ if ((ptmi->rc.bottom > g_rcScr.bottom)
&& ((ptmi->rc.bottom - ptmi->rc.top) > g_rcScr.bottom)){
- ptmi->show_rc.top = ptmi->rc.top;
- ptmi->show_rc.left = ptmi->rc.left;
- ptmi->show_rc.right = ptmi->rc.right;
- ptmi->show_rc.bottom = g_rcScr.bottom -
- GetSysFontHeight(SYSLOGFONT_MENU) + SHORTEN;
+ ptmi->show_rc.top = ptmi->rc.top;
+ ptmi->show_rc.left = ptmi->rc.left;
+ ptmi->show_rc.right = ptmi->rc.right;
+ ptmi->show_rc.bottom = g_rcScr.bottom -
+ GetSysFontHeight(SYSLOGFONT_MENU) + SHORTEN;
ptmi->bottom_scroll_rc.top = ptmi->show_rc.bottom;
ptmi->bottom_scroll_rc.left = ptmi->rc.left;
ptmi->bottom_scroll_rc.right = ptmi->rc.right;
ptmi->bottom_scroll_rc.bottom = g_rcScr.bottom;
-
+
ptmi->draw_bottom_flag = TRUE;
}
/*add end*/
@@ -2367,51 +2367,51 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
x = ptmi->rc.left;
y = ptmi->rc.top;
- pWin->we_rdr->draw_3dbox (HDC_SCREEN_SYS, &ptmi->show_rc, bgc,
+ pWin->we_rdr->draw_3dbox (HDC_SCREEN_SYS, &ptmi->show_rc, bgc,
LFRDR_3DBOX_FILLED | LFRDR_3DBOX_THICKFRAME);
-
+
x = ptmi->show_rc.left + marginlx;
y = ptmi->show_rc.top + marginy;
/* fix bug #4491: use == instead of & for mnutype. */
if (pmi->mnutype == MFT_BITMAP) {
-
+
if (pmi->mnustate & MFS_CHECKED)
bmp = pmi->checkedbmp;
else
bmp = (BITMAP*)pmi->typedata;
-
+
offy = (pmi->h - bmp->bmHeight) >> 1;
-
- FillBoxWithBitmap (HDC_SCREEN_SYS, x, y + offy,
- ((BITMAP*)pmi->typedata)->bmWidth,
+
+ FillBoxWithBitmap (HDC_SCREEN_SYS, x, y + offy,
+ ((BITMAP*)pmi->typedata)->bmWidth,
pmi->h - (offy << 1), bmp);
}
else if (pmi->mnutype == MFT_SEPARATOR) {
-
+
/** two horizontal separator */
- SetPenColor (HDC_SCREEN_SYS, darker_pixel);
- MoveTo (HDC_SCREEN_SYS,
+ SetPenColor (HDC_SCREEN_SYS, darker_pixel);
+ MoveTo (HDC_SCREEN_SYS,
x, y + (pmi->h>>1) - inter + 1);
- LineTo (HDC_SCREEN_SYS,
+ LineTo (HDC_SCREEN_SYS,
ptmi->show_rc.right - marginrx, y + (pmi->h>>1) - inter + 1);
- SetPenColor (HDC_SCREEN_SYS, lighter_pixel);
- MoveTo (HDC_SCREEN_SYS,
+ SetPenColor (HDC_SCREEN_SYS, lighter_pixel);
+ MoveTo (HDC_SCREEN_SYS,
x, y + (pmi->h>>1) - inter + 2);
- LineTo (HDC_SCREEN_SYS,
+ LineTo (HDC_SCREEN_SYS,
ptmi->show_rc.right - marginrx, y + (pmi->h>>1) - inter + 2);
}
else if (pmi->mnutype == MFT_OWNERDRAW) {
}
else {
- font_offy = (pmi->h - ((PLOGFONT)GetWindowElementAttr
+ font_offy = (pmi->h - ((PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU))->size) >> 1;
- SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
+ SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU));
-
+
if (pmi->type == TYPE_PPPMENU) {
old_mode = SetBkMode (HDC_SCREEN_SYS, BM_TRANSPARENT);
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
@@ -2420,14 +2420,14 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
(char*)pmi->typedata);
SetBkMode (HDC_SCREEN_SYS, old_mode);
- SetPenColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
+ SetPenColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_MENU));
MoveTo (HDC_SCREEN_SYS, x, y + pmi->h - (inter<<1));
- LineTo (HDC_SCREEN_SYS, ptmi->show_rc.right - marginrx,
+ LineTo (HDC_SCREEN_SYS, ptmi->show_rc.right - marginrx,
y + pmi->h - (inter<<1));
MoveTo (HDC_SCREEN_SYS, x, y + pmi->h - inter);
- LineTo (HDC_SCREEN_SYS, ptmi->show_rc.right - marginrx,
+ LineTo (HDC_SCREEN_SYS, ptmi->show_rc.right - marginrx,
y + pmi->h - inter);
}
else {
@@ -2442,26 +2442,26 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_DISABLED_ITEM));
else if (pmi->mnustate & MFS_HILITE)
- SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
+ SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_HIGHLIGHT_ITEM));
else
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_MENU));
- TextOut (HDC_SCREEN_SYS, x + bmp_w, y + font_offy,
+ TextOut (HDC_SCREEN_SYS, x + bmp_w, y + font_offy,
(char*)pmi->typedata);
SetBkMode (HDC_SCREEN_SYS, old_mode);
/** draw menu sub */
if (pmi->submenu) {
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
- ptmi->show_rc.right - mioffx - marginrx,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ ptmi->show_rc.right - mioffx - marginrx,
y, pmi, TRUE, 0);
}
}
}
y += pmi->h;
-
+
if (pmi->type == TYPE_PPPMENU)
psubmi = pmi->submenu;
else
@@ -2476,37 +2476,37 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
/* fix bug #4491: use == instead of & for mnutype. */
if (psubmi->mnutype == MFT_BITMAP) {
-
+
if (psubmi->mnustate & MFS_CHECKED)
bmp = psubmi->checkedbmp;
else
bmp = (BITMAP*)psubmi->typedata;
offy = (psubmi->h - bmp->bmHeight) >> 1;
-
+
FillBoxWithBitmap (HDC_SCREEN_SYS, x, y + offy,
- ((BITMAP*)psubmi->typedata)->bmWidth,
+ ((BITMAP*)psubmi->typedata)->bmWidth,
psubmi->h - (offy << 1), bmp);
/** draw menu sub */
if (psubmi->submenu) {
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
- ptmi->show_rc.right - mioffx - marginrx,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ ptmi->show_rc.right - mioffx - marginrx,
y, psubmi, TRUE, 0);
}
}
else if (psubmi->mnutype == MFT_SEPARATOR) {
-
+
/** two horizontal separator */
SetPenColor (HDC_SCREEN_SYS, darker_pixel);
MoveTo (HDC_SCREEN_SYS, x, y + (psubmi->h>>1) - inter + 1);
- LineTo (HDC_SCREEN_SYS, ptmi->show_rc.right - marginrx,
+ LineTo (HDC_SCREEN_SYS, ptmi->show_rc.right - marginrx,
y + (psubmi->h>>1) - inter + 1);
-
+
SetPenColor (HDC_SCREEN_SYS, lighter_pixel);
MoveTo (HDC_SCREEN_SYS, x, y + (psubmi->h>>1) - inter + 2);
- LineTo (HDC_SCREEN_SYS, ptmi->show_rc.right - marginrx,
+ LineTo (HDC_SCREEN_SYS, ptmi->show_rc.right - marginrx,
y + (psubmi->h>>1) - inter + 2);
}
else if (pmi->mnutype == MFT_OWNERDRAW) {
@@ -2518,30 +2518,30 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS, x + 1, y, psubmi, FALSE, &bmp_w);
/** menu text */
- SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
+ SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU));
old_mode = SetBkMode (HDC_SCREEN_SYS, BM_TRANSPARENT);
if (psubmi->mnustate & MFS_DISABLED)
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_DISABLED_ITEM));
else if (psubmi->mnustate & MFS_HILITE)
- SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
+ SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_HIGHLIGHT_ITEM));
else
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_MENU));
- offy = (psubmi->h - ((PLOGFONT)GetWindowElementAttr
+ offy = (psubmi->h - ((PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU))->size) >> 1;
- TextOut (HDC_SCREEN_SYS, x + bmp_w, y + offy,
+ TextOut (HDC_SCREEN_SYS, x + bmp_w, y + offy,
(char*)psubmi->typedata);
SetBkMode (HDC_SCREEN_SYS, old_mode);
/** draw menu sub */
if (psubmi->submenu) {
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
- ptmi->show_rc.right - mioffx - marginrx,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ ptmi->show_rc.right - mioffx - marginrx,
y, psubmi, TRUE, 0);
}
}
@@ -2563,11 +2563,11 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
static int get_start_to_end_height(PTRACKMENUINFO ptmi)
{
- PMENUITEM pmi = ptmi->pstart_show_mi;
+ PMENUITEM pmi = ptmi->pstart_show_mi;
int h = 0;
while (pmi != NULL){
- h = h + pmi->h;
+ h = h + pmi->h;
pmi = pmi->next;
}
@@ -2579,9 +2579,9 @@ static void draw_up_arrowhead(PTRACKMENUINFO ptmi, HDC hdc)
int l, t, r, b, cx, cy;
l = ptmi->top_scroll_rc.left;
- t = ptmi->top_scroll_rc.top;
+ t = ptmi->top_scroll_rc.top;
r = ptmi->top_scroll_rc.right;
- b = ptmi->top_scroll_rc.bottom;
+ b = ptmi->top_scroll_rc.bottom;
cx = (l + r) / 2;
cy = (t + b) / 2;
@@ -2620,7 +2620,7 @@ static void draw_top_scroll_button(PTRACKMENUINFO ptmi)
bgc = GetWindowElementAttr (ptmi->hwnd, WE_BGC_MENU);
- pWin->we_rdr->draw_3dbox (HDC_SCREEN_SYS, &ptmi->top_scroll_rc, bgc,
+ pWin->we_rdr->draw_3dbox (HDC_SCREEN_SYS, &ptmi->top_scroll_rc, bgc,
LFRDR_3DBOX_FILLED | LFRDR_3DBOX_THICKFRAME);
draw_up_arrowhead(ptmi, HDC_SCREEN_SYS);
@@ -2632,7 +2632,7 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
PMENUITEM pmi = ptmi->pstart_show_mi;
PMENUITEM psubmi;
int x, y, offy;
-
+
int inter;
int mioffx;
int marginlx, marginrx;
@@ -2643,10 +2643,10 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
int old_mode;
PBITMAP bmp;
-
+
PMAINWIN pWin;
DWORD bgc;
-
+
DWORD darker_dword;
DWORD lighter_dword;
DWORD bgc_dword;
@@ -2672,9 +2672,9 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
/** get darker and lighter color according to backgroup color */
bgc_dword = GetWindowElementAttr (ptmi->hwnd, WE_BGC_MENU);
- darker_dword = pWin->we_rdr->calc_3dbox_color
+ darker_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_DARKEST);
- lighter_dword = pWin->we_rdr->calc_3dbox_color
+ lighter_dword = pWin->we_rdr->calc_3dbox_color
(bgc_dword, LFRDR_3DBOX_COLOR_LIGHTEST);
darker_pixel = DWORD2Pixel (HDC_SCREEN_SYS, darker_dword);
@@ -2682,7 +2682,7 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
h = get_start_to_end_height(ptmi);
if ( (h + ptmi->top_scroll_rc.bottom) <= ptmi->bottom_scroll_rc.bottom){
- ptmi->show_rc.bottom = ptmi->bottom_scroll_rc.bottom;
+ ptmi->show_rc.bottom = ptmi->bottom_scroll_rc.bottom;
ptmi->bottom_scroll_rc.left = 0;
ptmi->bottom_scroll_rc.top = 0;
@@ -2693,7 +2693,7 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
}
if (ptmi->pstart_show_mi == ptmi->pmi ){
- ptmi->show_rc.top = ptmi->rc.top;
+ ptmi->show_rc.top = ptmi->rc.top;
ptmi->top_scroll_rc.left = 0;
ptmi->top_scroll_rc.top = 0;
@@ -2708,52 +2708,52 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
x = ptmi->show_rc.left;
y = ptmi->show_rc.top;
- pWin->we_rdr->draw_3dbox (HDC_SCREEN_SYS, &ptmi->show_rc, bgc,
+ pWin->we_rdr->draw_3dbox (HDC_SCREEN_SYS, &ptmi->show_rc, bgc,
LFRDR_3DBOX_FILLED | LFRDR_3DBOX_THICKFRAME);
x = ptmi->show_rc.left + marginlx;
y = ptmi->show_rc.top + marginy;
if (pmi->mnutype == MFT_BITMAP) {
-
+
if (pmi->mnustate & MFS_CHECKED)
bmp = pmi->checkedbmp;
else
bmp = (BITMAP*)pmi->typedata;
offy = (pmi->h - bmp->bmHeight) >> 1;
-
+
FillBoxWithBitmap (HDC_SCREEN_SYS, x, y + offy,
((BITMAP*)pmi->typedata)->bmWidth, pmi->h - (offy << 1), bmp);
}
else if (pmi->mnutype == MFT_SEPARATOR) {
-
+
/** two horizontal separator */
- SetPenColor (HDC_SCREEN_SYS, darker_pixel);
- MoveTo (HDC_SCREEN_SYS,
+ SetPenColor (HDC_SCREEN_SYS, darker_pixel);
+ MoveTo (HDC_SCREEN_SYS,
x, y + (pmi->h>>1) - inter + 1);
- LineTo (HDC_SCREEN_SYS,
+ LineTo (HDC_SCREEN_SYS,
ptmi->show_rc.right - marginrx, y + (pmi->h>>1) - inter + 1);
- SetPenColor (HDC_SCREEN_SYS, lighter_pixel);
- MoveTo (HDC_SCREEN_SYS,
+ SetPenColor (HDC_SCREEN_SYS, lighter_pixel);
+ MoveTo (HDC_SCREEN_SYS,
x, y + (pmi->h>>1) - inter + 2);
- LineTo (HDC_SCREEN_SYS,
+ LineTo (HDC_SCREEN_SYS,
ptmi->show_rc.right - marginrx, y + (pmi->h>>1) - inter + 2);
}
else if (pmi->mnutype == MFT_OWNERDRAW) {
}
else {
- font_offy = (pmi->h - ((PLOGFONT)GetWindowElementAttr
+ font_offy = (pmi->h - ((PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU))->size) >> 1;
-
- SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
+
+ SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU));
-
+
if (pmi->type == TYPE_PPPMENU) {
old_mode = SetBkMode (HDC_SCREEN_SYS, BM_TRANSPARENT);
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_MENU));
- TextOut (HDC_SCREEN_SYS, x + mioffx, y + font_offy,
+ TextOut (HDC_SCREEN_SYS, x + mioffx, y + font_offy,
(char*)pmi->typedata);
SetBkMode (HDC_SCREEN_SYS, old_mode);
@@ -2761,17 +2761,17 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_MENU));
/** two horizontal separator */
- MoveTo (HDC_SCREEN_SYS,
- x,
+ MoveTo (HDC_SCREEN_SYS,
+ x,
y + pmi->h - (inter<<1));
- LineTo (HDC_SCREEN_SYS,
- ptmi->show_rc.right - marginrx,
+ LineTo (HDC_SCREEN_SYS,
+ ptmi->show_rc.right - marginrx,
y + pmi->h - (inter<<1));
- MoveTo (HDC_SCREEN_SYS,
- x,
+ MoveTo (HDC_SCREEN_SYS,
+ x,
y + pmi->h - inter);
LineTo (HDC_SCREEN_SYS,
- ptmi->show_rc.right - marginrx,
+ ptmi->show_rc.right - marginrx,
y + pmi->h - inter);
}
else {
@@ -2786,20 +2786,20 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_DISABLED_ITEM));
else if (pmi->mnustate & MFS_HILITE)
- SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
+ SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_HIGHLIGHT_ITEM));
else
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_MENU));
- TextOut (HDC_SCREEN_SYS, x + bmp_w, y + font_offy,
+ TextOut (HDC_SCREEN_SYS, x + bmp_w, y + font_offy,
(char*)pmi->typedata);
SetBkMode (HDC_SCREEN_SYS, old_mode);
/** draw menu sub */
if (pmi->submenu) {
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
- ptmi->show_rc.right - mioffx - marginrx,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ ptmi->show_rc.right - mioffx - marginrx,
y, pmi, TRUE, 0);
}
}
@@ -2819,38 +2819,38 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
/*add end*/
if (psubmi->mnutype == MFT_BITMAP) {
-
+
if (psubmi->mnustate & MFS_CHECKED)
bmp = psubmi->checkedbmp;
else
bmp = (BITMAP*)psubmi->typedata;
offy = (psubmi->h - bmp->bmHeight) >> 1;
-
- FillBoxWithBitmap (HDC_SCREEN_SYS, x, y + offy,
- ((BITMAP*)psubmi->typedata)->bmWidth,
+
+ FillBoxWithBitmap (HDC_SCREEN_SYS, x, y + offy,
+ ((BITMAP*)psubmi->typedata)->bmWidth,
psubmi->h - (offy << 1), bmp);
/** draw menu sub */
if (psubmi->submenu) {
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
- ptmi->show_rc.right - mioffx - marginrx,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ ptmi->show_rc.right - mioffx - marginrx,
y, psubmi, TRUE, 0);
}
}
else if (psubmi->mnutype == MFT_SEPARATOR) {
-
+
/** tow horizontal separator */
- SetPenColor (HDC_SCREEN_SYS, darker_pixel);
- MoveTo (HDC_SCREEN_SYS,
+ SetPenColor (HDC_SCREEN_SYS, darker_pixel);
+ MoveTo (HDC_SCREEN_SYS,
x, y + (psubmi->h>>1) - inter + 1);
- LineTo (HDC_SCREEN_SYS,
+ LineTo (HDC_SCREEN_SYS,
ptmi->show_rc.right - marginrx, y + (psubmi->h>>1) - inter + 1);
-
- SetPenColor (HDC_SCREEN_SYS, lighter_pixel);
- MoveTo (HDC_SCREEN_SYS,
+
+ SetPenColor (HDC_SCREEN_SYS, lighter_pixel);
+ MoveTo (HDC_SCREEN_SYS,
x, y + (psubmi->h>>1) - inter + 2);
- LineTo (HDC_SCREEN_SYS,
+ LineTo (HDC_SCREEN_SYS,
ptmi->show_rc.right - marginrx, y + (psubmi->h>>1) - inter + 2);
}
else if (pmi->mnutype == MFT_OWNERDRAW) {
@@ -2862,30 +2862,30 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS, x + 1, y, psubmi, FALSE, &bmp_w);
/** menu text*/
- SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
+ SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU));
old_mode = SetBkMode (HDC_SCREEN_SYS, BM_TRANSPARENT);
if (psubmi->mnustate & MFS_DISABLED)
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_DISABLED_ITEM));
else if (psubmi->mnustate & MFS_HILITE)
- SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
+ SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_HIGHLIGHT_ITEM));
else
SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(ptmi->hwnd, HDC_SCREEN_SYS, WE_FGC_MENU));
- offy = (psubmi->h - ((PLOGFONT)GetWindowElementAttr
+ offy = (psubmi->h - ((PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU))->size) >> 1;
- TextOut (HDC_SCREEN_SYS, x + bmp_w, y + offy,
+ TextOut (HDC_SCREEN_SYS, x + bmp_w, y + offy,
(char*)psubmi->typedata);
SetBkMode (HDC_SCREEN_SYS, old_mode);
/** draw menu sub */
if (psubmi->submenu) {
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
- ptmi->show_rc.right - mioffx - marginrx,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ ptmi->show_rc.right - mioffx - marginrx,
y, psubmi, TRUE, 0);
}
}
@@ -2937,7 +2937,7 @@ static void mnuCloseMenu (PTRACKMENUINFO ptmi)
HWND hwnd;
PMENUBAR pmb;
int barPos;
-
+
flags = ptmi->flags;
hmnu = (HMENU)ptmi->pmi;
@@ -2949,7 +2949,7 @@ static void mnuCloseMenu (PTRACKMENUINFO ptmi)
pmb = phead->pmb;
hwnd = phead->hwnd;
barPos = phead->barPos;
-
+
// get last tracking menu.
plast = ptmi;
while (plast->next) {
@@ -2961,7 +2961,7 @@ static void mnuCloseMenu (PTRACKMENUINFO ptmi)
mnuUnhiliteMenu (plast->pmi);
- SendMessage (HWND_DESKTOP,
+ SendMessage (HWND_DESKTOP,
MSG_ENDTRACKMENU, 0, (LPARAM)plast);
plast = ptemp;
@@ -2969,7 +2969,7 @@ static void mnuCloseMenu (PTRACKMENUINFO ptmi)
if (pmb && barPos >= 0)
HiliteMenuBarItem (hwnd, barPos, LFRDR_MENU_STATE_NORMAL);
-
+
if (flags & TPM_DESTROY)
DestroyMenu (hmnu);
}
@@ -2977,7 +2977,7 @@ static void mnuCloseMenu (PTRACKMENUINFO ptmi)
static PTRACKMENUINFO mnuHitTestMenu (PTRACKMENUINFO plast, int x, int y)
{
PTRACKMENUINFO ptemp;
-
+
// which popup menu mouse in.
ptemp = plast;
while (ptemp) {
@@ -2997,7 +2997,7 @@ static PMENUITEM mnuHitTestMenuItem (PTRACKMENUINFO ptmi, int x, int y)
PMENUITEM pmi = ptmi->pmi;
PMENUITEM psubmi;
RECT rc;
-
+
rc.left = ptmi->rc.left;
rc.right = ptmi->rc.right;
rc.top = ptmi->rc.top + LFRDR_MENUTOPMARGIN;
@@ -3011,9 +3011,9 @@ static PMENUITEM mnuHitTestMenuItem (PTRACKMENUINFO ptmi, int x, int y)
psubmi = pmi->submenu;
else
psubmi = pmi->next;
-
+
while (psubmi) {
-
+
rc.bottom = rc.top + psubmi->h;
if (PtInRect (&rc, x, y))
@@ -3025,14 +3025,14 @@ static PMENUITEM mnuHitTestMenuItem (PTRACKMENUINFO ptmi, int x, int y)
return NULL;
}
-#endif
+#endif
static PMENUITEM get_selected_mi(PTRACKMENUINFO ptmi, int x, int y)
{
PMENUITEM pmi = ptmi->pstart_show_mi;
PMENUITEM psubmi;
RECT rc;
-
+
rc.left = ptmi->show_rc.left;
rc.right = ptmi->show_rc.right;
rc.top = ptmi->show_rc.top + LFRDR_MENUTOPMARGIN;
@@ -3046,17 +3046,17 @@ static PMENUITEM get_selected_mi(PTRACKMENUINFO ptmi, int x, int y)
psubmi = pmi->submenu;
else
psubmi = pmi->next;
-
+
while (psubmi) {
-
+
rc.bottom = rc.top + psubmi->h;
if (PtInRect (&rc, x, y)){
/*add*/
- ptmi->selected_rc.left = rc.left;
+ ptmi->selected_rc.left = rc.left;
ptmi->selected_rc.top = rc.top;
- ptmi->selected_rc.right = rc.right;
- ptmi->selected_rc.bottom = rc.bottom;
+ ptmi->selected_rc.right = rc.right;
+ ptmi->selected_rc.bottom = rc.bottom;
/*add end*/
return psubmi;
}
@@ -3112,7 +3112,7 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite)
ptemp = ptemp->next;
while (ptemp != pmi) {
- if (ptemp == NULL) return;
+ if (ptemp == NULL) return;
rc.top += ptemp->h;
ptemp = ptemp->next;
}
@@ -3138,7 +3138,7 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite)
if (ptemp->mnustate & MFS_DISABLED)
{
/** render a disabled item */
- SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
+ SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(hwnd, HDC_SCREEN_SYS, WE_FGC_DISABLED_ITEM));
if (ptemp->mnustate & MFS_HILITE)
pWin->we_rdr->draw_disabled_menu_item (hwnd, HDC_SCREEN_SYS, &rect,
@@ -3150,7 +3150,7 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite)
else if (ptemp->mnustate & MFS_HILITE)
{
/** render a hilite item */
- SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
+ SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(hwnd, HDC_SCREEN_SYS, WE_FGC_HIGHLIGHT_ITEM));
pWin->we_rdr->draw_hilite_menu_item (hwnd, HDC_SCREEN_SYS, &rect,
GetWindowElementAttr (hwnd, WE_BGC_HIGHLIGHT_ITEM));
@@ -3158,7 +3158,7 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite)
else
{
/** render a normal item as unhilite */
- SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
+ SetTextColor (HDC_SCREEN_SYS, GetWindowElementPixelEx
(hwnd, HDC_SCREEN_SYS, WE_FGC_MENU));
pWin->we_rdr->draw_normal_menu_item (hwnd, HDC_SCREEN_SYS, &rect,
@@ -3176,14 +3176,14 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite)
bmp = (BITMAP*)ptemp->typedata;
offy = (ptemp->h - bmp->bmHeight) >> 1;
-
+
FillBoxWithBitmap (HDC_SCREEN_SYS, rc.left + marginlx, rc.top + offy,
- ((BITMAP*)ptemp->typedata)->bmWidth,
+ ((BITMAP*)ptemp->typedata)->bmWidth,
ptemp->h - (offy << 1), bmp);
/** draw menu sub */
if (ptemp->submenu) {
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
rc.right - mioffx - marginrx,
rc.top, ptemp, TRUE, 0);
}
@@ -3194,35 +3194,35 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite)
int old_mode, bmp_w = mioffx;
/** draw radio, checkmark or bitmap */
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
rc.left + marginlx + 1, rc.top, ptemp, FALSE, &bmp_w);
/** menu text */
- SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
+ SelectFont (HDC_SCREEN_SYS, (PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU));
old_mode = SetBkMode (HDC_SCREEN_SYS, BM_TRANSPARENT);
- offy = (ptemp->h - ((PLOGFONT)GetWindowElementAttr
+ offy = (ptemp->h - ((PLOGFONT)GetWindowElementAttr
(ptmi->hwnd, WE_FONT_MENU))->size) >> 1;
-
+
TextOut (HDC_SCREEN_SYS, rc.left + bmp_w + marginlx, rc.top + offy,
(char*)ptemp->typedata);
SetBkMode (HDC_SCREEN_SYS, old_mode);
-
+
/** draw menu sub */
if (ptemp->submenu) {
- DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
+ DrawMenuPic (ptmi->hwnd, HDC_SCREEN_SYS,
rc.right - mioffx - marginrx, rc.top, ptemp, TRUE, 0);
}
}
}
-static int mnuOpenNewSubMenu (PTRACKMENUINFO ptmi, PMENUITEM pmi,
+static int mnuOpenNewSubMenu (PTRACKMENUINFO ptmi, PMENUITEM pmi,
int x, int y)
{
PTRACKMENUINFO pnewtmi;
pnewtmi = TrackMenuInfoAlloc ();
-
+
pnewtmi->rc.left = x;
pnewtmi->rc.top = y;
pnewtmi->pmi = pmi;
@@ -3232,7 +3232,7 @@ static int mnuOpenNewSubMenu (PTRACKMENUINFO ptmi, PMENUITEM pmi,
pnewtmi->flags = ptmi->flags;
pnewtmi->next = NULL;
pnewtmi->prev = NULL;
-
+
if (SendMessage (HWND_DESKTOP, MSG_TRACKPOPUPMENU,
0, (LPARAM)(pnewtmi)) < 0) {
FreeTrackMenuInfo (pnewtmi);
@@ -3319,7 +3319,7 @@ static PMENUITEM mnuGetPrevMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi)
}
else
break;
-
+
prev = mnuGetPrevItem (head, prev);
}while (TRUE);
@@ -3335,9 +3335,9 @@ static int mnuGetMenuItemY (PTRACKMENUINFO ptmi, PMENUITEM pmi)
int y = ptmi->show_rc.top + LFRDR_MENUTOPMARGIN;
if (pmi == head) return y;
-
+
y += head->h;
-
+
if (head->type == TYPE_PPPMENU)
head = head->submenu;
else
@@ -3361,9 +3361,9 @@ static int get_menu_item_y_from_pstart (PTRACKMENUINFO ptmi, PMENUITEM pmi)
int y = head->h;
if (pmi == head) return y;
-
+
y += head->h;
-
+
if (head->type == TYPE_PPPMENU)
head = head->submenu;
else
@@ -3387,7 +3387,7 @@ static void cursor_block_down(PTRACKMENUINFO pcurtmi, PMENUITEM pcurmi)
{
PMENUITEM pnewmi;
int y;
-
+
pnewmi = mnuGetNextMenuItem (pcurtmi, pcurmi);
@@ -3395,16 +3395,16 @@ static void cursor_block_down(PTRACKMENUINFO pcurtmi, PMENUITEM pcurmi)
if (pcurtmi->rc.bottom > g_rcScr.bottom){
- if (pcurmi != NULL){
+ if (pcurmi != NULL){
if (pcurmi->next == NULL){
- mnuShowPopupMenu (pcurtmi);
+ mnuShowPopupMenu (pcurtmi);
mnuHiliteMenuItem (pcurtmi, pnewmi, TRUE);
pcurtmi->philite = pnewmi;
return;
}
if (pnewmi == pcurtmi->pmi){
- mnuShowPopupMenu (pcurtmi);
+ mnuShowPopupMenu (pcurtmi);
mnuHiliteMenuItem (pcurtmi, pnewmi, TRUE);
pcurtmi->philite = pnewmi;
return;
@@ -3412,14 +3412,14 @@ static void cursor_block_down(PTRACKMENUINFO pcurtmi, PMENUITEM pcurmi)
}
if ((y + pcurtmi->top_scroll_rc.bottom) >= pcurtmi->show_rc.bottom){
- mnu_scroll_menu(pcurtmi, (pcurtmi->rc.left + pcurtmi->rc.right) /2,
+ mnu_scroll_menu(pcurtmi, (pcurtmi->rc.left + pcurtmi->rc.right) /2,
g_rcScr.bottom - 1);
}
else{
if (pnewmi != pcurmi) {
- if (pcurmi){
+ if (pcurmi){
mnuHiliteMenuItem (pcurtmi, pcurmi, FALSE);
}
@@ -3433,7 +3433,7 @@ static void cursor_block_down(PTRACKMENUINFO pcurtmi, PMENUITEM pcurmi)
}
else{
if (pnewmi != pcurmi) {
- if (pcurmi){
+ if (pcurmi){
mnuHiliteMenuItem (pcurtmi, pcurmi, FALSE);
}
@@ -3459,15 +3459,15 @@ static void cursor_block_up(PTRACKMENUINFO pcurtmi, PMENUITEM pcurmi)
if (pcurtmi->rc.bottom > g_rcScr.bottom){
if (pnewmi == mnuGetPrevMenuItem(pcurtmi, pcurtmi->pmi)){
- mnuShowPopupMenu (pcurtmi);
+ mnuShowPopupMenu (pcurtmi);
mnuHiliteMenuItem (pcurtmi, pcurmi, TRUE);
pcurtmi->philite = pcurmi;
return;
}
if (pnewmi == pcurtmi->pmi){
- mnuShowPopupMenu (pcurtmi);
- if (pcurmi){
+ mnuShowPopupMenu (pcurtmi);
+ if (pcurmi){
mnuHiliteMenuItem (pcurtmi, pcurmi, FALSE);
}
mnuHiliteMenuItem (pcurtmi, pnewmi, TRUE);
@@ -3476,13 +3476,13 @@ static void cursor_block_up(PTRACKMENUINFO pcurtmi, PMENUITEM pcurmi)
}
if (pcurmi == pcurtmi->pstart_show_mi){
- mnu_scroll_menu(pcurtmi, (pcurtmi->rc.left + pcurtmi->rc.right) /2,
+ mnu_scroll_menu(pcurtmi, (pcurtmi->rc.left + pcurtmi->rc.right) /2,
pcurtmi->top_scroll_rc.top + 1);
}
else {
if (pnewmi != pcurmi) {
- if (pcurmi){
+ if (pcurmi){
mnuHiliteMenuItem (pcurtmi, pcurmi, FALSE);
draw_bottom_scroll_button(pcurtmi);
}
@@ -3497,7 +3497,7 @@ static void cursor_block_up(PTRACKMENUINFO pcurtmi, PMENUITEM pcurmi)
else {
if (pnewmi != pcurmi) {
- if (pcurmi){
+ if (pcurmi){
mnuHiliteMenuItem (pcurtmi, pcurmi, FALSE);
}
@@ -3510,7 +3510,7 @@ static void cursor_block_up(PTRACKMENUINFO pcurtmi, PMENUITEM pcurmi)
}
-static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi,
+static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi,
int message, int scan, DWORD status)
{
PTRACKMENUINFO phead, pcurtmi, pprevtmi;
@@ -3520,15 +3520,15 @@ static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi,
UINT flags;
int barItem;
int id;
-
+
flags = ptmi->flags;
hmnu = (HMENU)ptmi->pmi;
-
+
phead = ptmi;
while (phead->prev) {
phead = phead->prev;
}
-
+
// get last tracking menu, the last menu is the current menu.
pcurtmi = ptmi;
while (pcurtmi->next) {
@@ -3544,23 +3544,23 @@ static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi,
case SCANCODE_CURSORBLOCKDOWN:
case SCANCODE_CURSORBLOCKUP:
if (scan == SCANCODE_CURSORBLOCKDOWN){
- cursor_block_down(pcurtmi, pcurmi);
+ cursor_block_down(pcurtmi, pcurmi);
}
else{// scan == SCANCODE_CURSORBLOCKUP:
- cursor_block_up(pcurtmi, pcurmi);
+ cursor_block_up(pcurtmi, pcurmi);
}
-
+
break;
-
+
case SCANCODE_CURSORBLOCKRIGHT:
if (pcurmi && pcurmi->submenu)
- mnuOpenNewSubMenu (pcurtmi,
- pcurmi->submenu,
+ mnuOpenNewSubMenu (pcurtmi,
+ pcurmi->submenu,
pcurtmi->rc.right,
mnuGetMenuItemY (pcurtmi, pcurmi));
else {
if (phead->pmb) {
- barItem = mnuGetNextMenuBarItem (phead->pmb,
+ barItem = mnuGetNextMenuBarItem (phead->pmb,
phead->barPos);
if (barItem != phead->barPos) {
hwnd = phead->hwnd;
@@ -3574,10 +3574,10 @@ static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi,
}
}
break;
-
+
case SCANCODE_ESCAPE:
if (pprevtmi) {
- SendMessage (HWND_DESKTOP,
+ SendMessage (HWND_DESKTOP,
MSG_ENDTRACKMENU, 0, (LPARAM)pcurtmi);
}else{
SendMessage (HWND_DESKTOP, MSG_CLOSEMENU, 0, 1);
@@ -3586,11 +3586,11 @@ static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi,
case SCANCODE_CURSORBLOCKLEFT:
if (pprevtmi)
- SendMessage (HWND_DESKTOP,
+ SendMessage (HWND_DESKTOP,
MSG_ENDTRACKMENU, 0, (LPARAM)pcurtmi);
else {
if (phead->pmb) {
- barItem = mnuGetPrevMenuBarItem (phead->pmb,
+ barItem = mnuGetPrevMenuBarItem (phead->pmb,
phead->barPos);
if (barItem != phead->barPos) {
hwnd = phead->hwnd;
@@ -3604,15 +3604,15 @@ static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi,
}
}
break;
-
+
case SCANCODE_ENTER:
if (pcurmi == NULL) return;
if (pcurmi->mnutype == MFT_SEPARATOR) return;
if (pcurmi->mnustate & MFS_DISABLED) return;
-
+
if (pcurmi->submenu) {
- mnuOpenNewSubMenu (pcurtmi,
- pcurmi->submenu,
+ mnuOpenNewSubMenu (pcurtmi,
+ pcurmi->submenu,
pcurtmi->rc.right,
mnuGetMenuItemY (pcurtmi, pcurmi));
return;
@@ -3623,9 +3623,9 @@ static void mnuTrackMenuWithKey (PTRACKMENUINFO ptmi,
hwnd = ptmi->hwnd;
id = pcurmi->id;
-
+
SendMessage (HWND_DESKTOP, MSG_CLOSEMENU, 0, 1);
-
+
if (flags & TPM_SYSCMD)
SendNotifyMessage (hwnd, MSG_SYSCOMMAND, id, 0);
else
@@ -3658,13 +3658,13 @@ static void mnu_scroll_menu (PTRACKMENUINFO ptmi, int x, int y)
PMENUITEM philite;
int barItem;
HWND hwnd;
-
+
// get first tracking menu.
phead = ptmi;
while (phead->prev) {
phead = phead->prev;
}
-
+
// get last tracking menu.
plast = ptmi;
while (plast->next) {
@@ -3693,7 +3693,7 @@ static void mnu_scroll_menu (PTRACKMENUINFO ptmi, int x, int y)
TrackMenuBar (hwnd, barItem);
}
}
-
+
return;
}
@@ -3704,21 +3704,21 @@ static void mnu_scroll_menu (PTRACKMENUINFO ptmi, int x, int y)
pcurtmi->top_scroll_rc.left = pcurtmi->rc.left;
pcurtmi->top_scroll_rc.top = 0;
pcurtmi->top_scroll_rc.right = pcurtmi->rc.right;
- //pcurtmi->top_scroll_rc.bottom = pcurtmi->top_scroll_rc.top +
+ //pcurtmi->top_scroll_rc.bottom = pcurtmi->top_scroll_rc.top +
//pcurtmi->pmi->h - SHORTEN;
- pcurtmi->top_scroll_rc.bottom = pcurtmi->top_scroll_rc.top +
- GetSysFontHeight(SYSLOGFONT_MENU) - SHORTEN;
+ pcurtmi->top_scroll_rc.bottom = pcurtmi->top_scroll_rc.top +
+ GetSysFontHeight(SYSLOGFONT_MENU) - SHORTEN;
ptmi->show_rc.top = pcurtmi->top_scroll_rc.bottom;
- ptmi->show_rc.left = pcurtmi->rc.left;
- ptmi->show_rc.right = pcurtmi->rc.right;
- //ptmi->show_rc.bottom = g_rcScr.bottom - ptmi->pmi->h + SHORTEN;
- ptmi->show_rc.bottom = g_rcScr.bottom -
- GetSysFontHeight(SYSLOGFONT_MENU) + SHORTEN;
+ ptmi->show_rc.left = pcurtmi->rc.left;
+ ptmi->show_rc.right = pcurtmi->rc.right;
+ //ptmi->show_rc.bottom = g_rcScr.bottom - ptmi->pmi->h + SHORTEN;
+ ptmi->show_rc.bottom = g_rcScr.bottom -
+ GetSysFontHeight(SYSLOGFONT_MENU) + SHORTEN;
pcurmi = get_selected_mi(pcurtmi, x, y);
- pcurtmi->pstart_show_mi =
- mnuGetNextMenuItem(pcurtmi, pcurtmi->pstart_show_mi);
+ pcurtmi->pstart_show_mi =
+ mnuGetNextMenuItem(pcurtmi, pcurtmi->pstart_show_mi);
pcurtmi->draw_top_flag = TRUE;
@@ -3727,18 +3727,18 @@ static void mnu_scroll_menu (PTRACKMENUINFO ptmi, int x, int y)
if (PtInRect(&pcurtmi->top_scroll_rc, x, y)){
- pnewmi = mnuGetPrevMenuItem(pcurtmi, pcurtmi->pstart_show_mi);
-
+ pnewmi = mnuGetPrevMenuItem(pcurtmi, pcurtmi->pstart_show_mi);
+
if (pnewmi == mnuGetPrevMenuItem(pcurtmi, pcurtmi->pmi)){
- mnuShowPopupMenu (pcurtmi);
+ mnuShowPopupMenu (pcurtmi);
//mnuHiliteMenuItem (pcurtmi, pcurtmi->pmi, TRUE);
//pcurtmi->philite = pcurmi;
return;
}
if (pnewmi == pcurtmi->pmi){
- mnuShowPopupMenu (pcurtmi);
- if (pcurtmi->philite) {
+ mnuShowPopupMenu (pcurtmi);
+ if (pcurtmi->philite) {
mnuHiliteMenuItem (pcurtmi, pcurtmi->philite, FALSE);
}
mnuHiliteMenuItem (pcurtmi, pnewmi, TRUE);
@@ -3747,15 +3747,15 @@ static void mnu_scroll_menu (PTRACKMENUINFO ptmi, int x, int y)
}
//pcurtmi->pstart_show_mi = mnuGetPrevMenuItem
- //(pcurtmi, pcurtmi->pstart_show_mi);
+ //(pcurtmi, pcurtmi->pstart_show_mi);
pcurtmi->pstart_show_mi = pnewmi;
pcurtmi->show_rc.top = pcurtmi->top_scroll_rc.bottom;
- pcurtmi->show_rc.left = pcurtmi->rc.left;
- pcurtmi->show_rc.right = pcurtmi->rc.right;
- //pcurtmi->show_rc.bottom = g_rcScr.bottom - pcurtmi->pmi->h + SHORTEN;
- ptmi->show_rc.bottom = g_rcScr.bottom -
- GetSysFontHeight(SYSLOGFONT_MENU) + SHORTEN;
+ pcurtmi->show_rc.left = pcurtmi->rc.left;
+ pcurtmi->show_rc.right = pcurtmi->rc.right;
+ //pcurtmi->show_rc.bottom = g_rcScr.bottom - pcurtmi->pmi->h + SHORTEN;
+ ptmi->show_rc.bottom = g_rcScr.bottom -
+ GetSysFontHeight(SYSLOGFONT_MENU) + SHORTEN;
pcurtmi->bottom_scroll_rc.top = pcurtmi->show_rc.bottom;
pcurtmi->bottom_scroll_rc.left = pcurtmi->rc.left;
@@ -3766,12 +3766,12 @@ static void mnu_scroll_menu (PTRACKMENUINFO ptmi, int x, int y)
pcurmi = pcurtmi->pstart_show_mi;
show_scroll_popup_menu(pcurtmi);
-
+
}
if (pcurtmi != plast) {
pclose = pcurtmi->next->next;
-
+
if (pclose != NULL) {
while (pclose != plast) {
ptemp = plast->prev;
@@ -3781,7 +3781,7 @@ static void mnu_scroll_menu (PTRACKMENUINFO ptmi, int x, int y)
SendMessage (HWND_DESKTOP, MSG_ENDTRACKMENU, 0, (LPARAM)plast);
plast = pcurtmi->next;
}
-
+
if (plast->philite) {
mnuHiliteMenuItem (plast, plast->philite, FALSE);
plast->philite = NULL;
@@ -3811,13 +3811,13 @@ static void mnu_scroll_menu (PTRACKMENUINFO ptmi, int x, int y)
mnuHiliteMenuItem (pcurtmi, pcurmi, TRUE);
-
+
if (pcurtmi->draw_bottom_flag){
draw_bottom_scroll_button(ptmi);
}
if (pcurmi->submenu)
- mnuOpenNewSubMenu (pcurtmi, pcurmi->submenu,
+ mnuOpenNewSubMenu (pcurtmi, pcurmi->submenu,
pcurtmi->rc.right, mnuGetMenuItemY (pcurtmi, pcurmi));
}
@@ -3830,13 +3830,13 @@ static void mnuTrackMenu (PTRACKMENUINFO ptmi, int x, int y)
PMENUITEM philite;
int barItem;
HWND hwnd;
-
+
// get first tracking menu.
phead = ptmi;
while (phead->prev) {
phead = phead->prev;
}
-
+
// get last tracking menu.
plast = ptmi;
while (plast->next) {
@@ -3854,7 +3854,7 @@ static void mnuTrackMenu (PTRACKMENUINFO ptmi, int x, int y)
if (phead->pmb) {
barItem = MenuBarHitTest (phead->hwnd, x, y);
if (barItem >= 0 && barItem != phead->barPos) {
-
+
hwnd = phead->hwnd;
// close current popup menu.
@@ -3864,21 +3864,21 @@ static void mnuTrackMenu (PTRACKMENUINFO ptmi, int x, int y)
TrackMenuBar (hwnd, barItem);
}
}
-
+
return;
}
pcurmi = get_selected_mi(pcurtmi, x, y);
if (PtInRect(&pcurtmi->bottom_scroll_rc, x, y)){
-
+
pcurtmi->pstart_show_mi = pcurtmi->pstart_show_mi->next;
show_scroll_popup_menu(pcurtmi);
-
+
}
if (pcurtmi != plast) {
pclose = pcurtmi->next->next;
-
+
if (pclose != NULL) {
while (pclose != plast) {
ptemp = plast->prev;
@@ -3888,7 +3888,7 @@ static void mnuTrackMenu (PTRACKMENUINFO ptmi, int x, int y)
SendMessage (HWND_DESKTOP, MSG_ENDTRACKMENU, 0, (LPARAM)plast);
plast = pcurtmi->next;
}
-
+
if (plast->philite) {
mnuHiliteMenuItem (plast, plast->philite, FALSE);
plast->philite = NULL;
@@ -3913,12 +3913,12 @@ static void mnuTrackMenu (PTRACKMENUINFO ptmi, int x, int y)
mnuHiliteMenuItem (pcurtmi, pcurmi, TRUE);
if (pcurmi->submenu)
- mnuOpenNewSubMenu (pcurtmi, pcurmi->submenu,
+ mnuOpenNewSubMenu (pcurtmi, pcurmi->submenu,
pcurtmi->rc.right, mnuGetMenuItemY (pcurtmi, pcurmi));
}
-#endif
+#endif
-static int mnuTrackMenuOnButtonDown (PTRACKMENUINFO ptmi,
+static int mnuTrackMenuOnButtonDown (PTRACKMENUINFO ptmi,
int message, int x, int y)
{
PTRACKMENUINFO plast, phead;
@@ -3926,10 +3926,10 @@ static int mnuTrackMenuOnButtonDown (PTRACKMENUINFO ptmi,
HMENU hmnu;
UINT flags;
int barItem;
-
+
flags = ptmi->flags;
hmnu = (HMENU)ptmi->pmi;
-
+
// get first tracking menu.
phead = ptmi;
while (phead->prev) {
@@ -3962,7 +3962,7 @@ static int mnuTrackMenuOnButtonDown (PTRACKMENUINFO ptmi,
return 0;
}
-static int mnuTrackMenuOnButtonUp (PTRACKMENUINFO ptmi,
+static int mnuTrackMenuOnButtonUp (PTRACKMENUINFO ptmi,
int message, int x, int y)
{
PTRACKMENUINFO plast;
@@ -3972,7 +3972,7 @@ static int mnuTrackMenuOnButtonUp (PTRACKMENUINFO ptmi,
UINT flags;
int id;
HMENU hmnu;
-
+
// get last tracking menu.
plast = ptmi;
while (plast->next) {
@@ -3983,14 +3983,14 @@ static int mnuTrackMenuOnButtonUp (PTRACKMENUINFO ptmi,
if (pcurtmi == NULL || pcurtmi->philite == NULL) return 0;
- /*add*/
+ /*add*/
pcurmi = get_selected_mi(pcurtmi, x, y);
if (pcurmi == NULL) return 0;
/*add end*/
if (pcurmi->mnutype == MFT_SEPARATOR) return 0;
if (pcurmi->mnustate & MFS_DISABLED) return 0;
-
+
if (pcurmi->type != TYPE_PPPMENU &&
pcurmi->submenu == NULL)
{
@@ -3998,7 +3998,7 @@ static int mnuTrackMenuOnButtonUp (PTRACKMENUINFO ptmi,
flags = ptmi->flags;
id = pcurmi->id;
hmnu = (HMENU)ptmi->pmi;
-
+
SendMessage (HWND_DESKTOP, MSG_CLOSEMENU, 0, 1);
@@ -4009,14 +4009,14 @@ static int mnuTrackMenuOnButtonUp (PTRACKMENUINFO ptmi,
if (flags & TPM_DESTROY)
DestroyMenu (hmnu);
-
+
return id;
}
return 0;
}
-int PopupMenuTrackProc (PTRACKMENUINFO ptmi,
+int PopupMenuTrackProc (PTRACKMENUINFO ptmi,
int message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
@@ -4025,9 +4025,9 @@ int PopupMenuTrackProc (PTRACKMENUINFO ptmi,
break;
case MSG_SHOWMENU:
- if ((HCURSOR)GetCurrentCursor() != GetSystemCursor(IDC_ARROW))
+ if (GetCurrentCursor() != GetSystemCursor(IDC_ARROW))
SetCursor(GetSystemCursor(IDC_ARROW));
- return mnuShowPopupMenu (ptmi);
+ return mnuShowPopupMenu (ptmi);
break;
case MSG_HIDEMENU:
@@ -4038,7 +4038,7 @@ int PopupMenuTrackProc (PTRACKMENUINFO ptmi,
case MSG_ENDTRACKMENU:
do_free_box (ptmi);
if (ptmi->hwnd != HWND_DESKTOP)
- SendNotifyMessage (ptmi->hwnd, MSG_ENDTRACKMENU,
+ SendNotifyMessage (ptmi->hwnd, MSG_ENDTRACKMENU,
(WPARAM)ptmi->pmi, (LPARAM)ptmi->pmb);
FreeTrackMenuInfo (ptmi);
break;
@@ -4049,7 +4049,7 @@ int PopupMenuTrackProc (PTRACKMENUINFO ptmi,
case MSG_LBUTTONDOWN:
case MSG_RBUTTONDOWN:
- if (mnuTrackMenuOnButtonDown (ptmi,
+ if (mnuTrackMenuOnButtonDown (ptmi,
message, (int)wParam, (int)lParam) < 0)
return 1;
break;
@@ -4074,7 +4074,7 @@ int PopupMenuTrackProc (PTRACKMENUINFO ptmi,
return 0;
}
-
+
int GUIAPI TrackPopupMenu (HMENU hmnu, UINT uFlags, int x, int y, HWND hwnd)
{
PTRACKMENUINFO ptmi;
@@ -4083,7 +4083,7 @@ int GUIAPI TrackPopupMenu (HMENU hmnu, UINT uFlags, int x, int y, HWND hwnd)
SendMessage (HWND_DESKTOP, MSG_CLOSEMENU, 0, 1);
ptmi = TrackMenuInfoAlloc ();
-
+
ptmi->rc.left = x;
ptmi->rc.top = y;
ptmi->pmi = (PMENUITEM)hmnu;
@@ -4094,10 +4094,10 @@ int GUIAPI TrackPopupMenu (HMENU hmnu, UINT uFlags, int x, int y, HWND hwnd)
ptmi->flags = uFlags;
ptmi->next = NULL;
ptmi->prev = NULL;
-
+
if (ptmi->pmi == NULL) return ERR_INVALID_HANDLE;
if (ptmi->pmi->category != TYPE_HMENU) return ERR_INVALID_HANDLE;
-
+
SendMessage (hwnd, MSG_ACTIVEMENU, 0, (LPARAM)hmnu);
if (SendMessage (HWND_DESKTOP, MSG_TRACKPOPUPMENU,
0, (LPARAM)(ptmi)) < 0) {
@@ -4117,7 +4117,7 @@ int GUIAPI TrackMenuBar (HWND hwnd, int pos)
menuBar = (PMENUBAR)GetMenu (hwnd);
if (!menuBar) return ERR_INVALID_HANDLE;
-
+
if (!(pppMenu = mnuGetMenuItem ((HMENU)menuBar, pos, MF_BYPOSITION))) {
return ERR_INVALID_HANDLE;
}
@@ -4127,15 +4127,15 @@ int GUIAPI TrackMenuBar (HWND hwnd, int pos)
pppMenu = pppMenu->submenu;
if (!pppMenu) return ERR_INVALID_HANDLE;
-
+
// close current menu firstly.
SendMessage (HWND_DESKTOP, MSG_CLOSEMENU, 0, 1);
ptmi = TrackMenuInfoAlloc ();
-
+
GetMenuBarItemRect (hwnd, pos, &rcMenuItem);
WindowToScreen (hwnd, &rcMenuItem.left, &rcMenuItem.bottom);
-
+
ptmi->rc.left = rcMenuItem.left - (LFRDR_MENUITEMOFFX>>1);
ptmi->rc.top = rcMenuItem.bottom;
ptmi->pmi = pppMenu;
@@ -4146,7 +4146,7 @@ int GUIAPI TrackMenuBar (HWND hwnd, int pos)
ptmi->flags = TPM_DEFAULT;
ptmi->next = NULL;
ptmi->prev = NULL;
-
+
HiliteMenuBarItem (hwnd, pos, LFRDR_MENU_STATE_NORMAL);
HiliteMenuBarItem (hwnd, pos, LFRDR_MENU_STATE_HILITE);
diff --git a/src/ial/netial/netial.c b/src/ial/netial/netial.c
index ae101888..2258eae0 100644
--- a/src/ial/netial/netial.c
+++ b/src/ial/netial/netial.c
@@ -35,22 +35,23 @@
#include
#include
#include
-//#include
-#include
-#include
#include "common.h"
#ifdef _MGIAL_NET
+#include
+#include
+#include
+
#include "minigui.h"
#include "netial.h"
#include
-//#include
+#include
#include
#include
-//#include
+#include
#include
#include
diff --git a/src/kernel/timer.c b/src/kernel/timer.c
index d0a39f47..40d408e4 100644
--- a/src/kernel/timer.c
+++ b/src/kernel/timer.c
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -37,7 +37,7 @@
** Current maintainer: Wei Yongming.
**
** Create date: 1999/04/21
-*/
+*/
#include
#include
@@ -127,15 +127,14 @@ static OS_TIMER_ID __mg_os_timer = 0;
#else /* __AOS__ */
static void* TimerEntry (void* data)
{
- sem_post ((sem_t*)data);
+ sem_post ((sem_t*)data);
#ifdef _MG_USE_BETTER_TIMER
g_timer_started = times(NULL);
g_last_tick = 0;
#endif /* _MG_USE_BETTER_TIMER */
- while (__mg_quiting_stage > _MG_QUITING_STAGE_TIMER)
- {
+ while (__mg_quiting_stage > _MG_QUITING_STAGE_TIMER) {
__mg_os_time_delay (10);
__mg_timer_action (NULL);
}
@@ -152,14 +151,14 @@ int __mg_timer_init (void)
}
#ifdef __AOS__
- __mg_os_timer = tp_os_timer_create ("mgtimer", __mg_timer_action,
- NULL, AOS_TIMER_TICKT,
+ __mg_os_timer = tp_os_timer_create ("mgtimer", __mg_timer_action,
+ NULL, AOS_TIMER_TICKT,
OS_AUTO_ACTIVATE | OS_AUTO_LOAD);
#else /* NOT __AOS__ */
{
- sem_t wait;
+ sem_t wait;
sem_init (&wait, 0, 0);
-
+
pthread_create (&__mg_timer, NULL, TimerEntry, &wait);
sem_wait (&wait);
sem_destroy (&wait);
@@ -196,7 +195,7 @@ BOOL mg_InstallIntervalTimer (void)
{
struct itimerval timerv;
struct sigaction siga;
-
+
sigaction (SIGALRM, NULL, &old_alarm_handler);
siga = old_alarm_handler;
@@ -307,7 +306,7 @@ void mg_dispatch_timer_message (DWORD inter)
timerstr[i]->tick_count = __mg_timer_counter;
#endif
/* setting timer flag is simple, we do not need to lock msgq,
- or else we may encounter dead lock here */
+ or else we may encounter dead lock here */
SetMsgQueueTimerFlag (timerstr[i]->msg_queue, i);
timerstr[i]->count -= timerstr[i]->speed;
}
@@ -378,7 +377,7 @@ void __mg_move_timer_last (TIMER* timer, int slot)
}
#endif
-BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed,
+BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed,
TIMERPROC timer_proc)
{
int i;
@@ -439,7 +438,7 @@ BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed,
TIMER_UNLOCK ();
return TRUE;
-
+
badret:
TIMER_UNLOCK ();
return FALSE;
@@ -520,7 +519,7 @@ int GUIAPI KillTimer (HWND hWnd, LINT id)
TIMER_LOCK ();
for (i = 0; i < DEF_NR_TIMERS; i++) {
- if ((timerstr [i] && timerstr [i]->hWnd == hWnd) &&
+ if ((timerstr [i] && timerstr [i]->hWnd == hWnd) &&
(id == 0 || timerstr [i]->id == id)) {
RemoveMsgQueueTimerFlag (pMsgQueue, i);
free (timerstr[i]);
@@ -540,7 +539,7 @@ int GUIAPI KillTimer (HWND hWnd, LINT id)
return killed;
}
-BOOL GUIAPI ResetTimerEx (HWND hWnd, LINT id, DWORD speed,
+BOOL GUIAPI ResetTimerEx (HWND hWnd, LINT id, DWORD speed,
TIMERPROC timer_proc)
{
int i;
diff --git a/src/mybmp/gif.c b/src/mybmp/gif.c
index 1e986211..1a3ad9b8 100644
--- a/src/mybmp/gif.c
+++ b/src/mybmp/gif.c
@@ -1,39 +1,39 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
/*
** gif.c: Low-level GIF file read/save routines.
-**
+**
** Current maintainer: Wei Yongming
**
** Create date: 2000/08/29
@@ -98,7 +98,7 @@ static int ReadColorMap(MG_RWops* src, int number, unsigned char buffer[3][MAXCO
static int GetDataBlock(MG_RWops* src, unsigned char *buf ,void * info_data);
static int GetCode(MG_RWops* src, int code_size, int flag , void * info);
static int LWZReadByte(MG_RWops* src, int flag, int input_code_size, void * info_data);
-static int ReadImage(MG_RWops* src, MYBITMAP* bmp, int len, int height,
+static int ReadImage(MG_RWops* src, MYBITMAP* bmp, int len, int height,
int interlace , CB_ONE_SCANLINE cb, void* context , void * info);
/*
*
@@ -132,7 +132,7 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal)
info->width = 0;
info->height = 0;
info->interlace = 0;
-
+
info->gif89.transparent = -1;
info->gif89.delayTime = -1;
info->gif89.inputFlag = -1;
@@ -168,10 +168,10 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal)
_MG_PRINTF ("MYBMP>Gif: no image \n" );
goto fini;
}
-
+
if ('!' == c) /* Start of the Extension*/
{
- if (!ReadOK (fp, &c, 1))
+ if (!ReadOK (fp, &c, 1))
goto fini;
if (0xfe == c) {
while (GetDataBlock(fp, (unsigned char *) buf , info) != 0);
@@ -179,18 +179,18 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal)
if (0xff == c) {
while (GetDataBlock(fp, (unsigned char *) buf , info) != 0);
}
-
+
if (0xf9 == c) {
GetDataBlock (fp, (unsigned char *) buf , info);
info->gif89.disposal = (buf[0] >> 2) & 0x7;//000 000 0 0 the middle 2 bit is disposal
- info->gif89.inputFlag = (buf[0] >> 1) & 0x1;//000 000 0 0 the secand last bit
+ info->gif89.inputFlag = (buf[0] >> 1) & 0x1;//000 000 0 0 the secand last bit
//is user input flag
info->gif89.delayTime = LM_to_uint(buf[1], buf[2]);
if ((buf[0] & 0x1) != 0)// 000 000 0 0 the last bit is transparent flag
info->gif89.transparent = buf[3];
}
}
-
+
if (',' == c) /* Start of the Image Descriptor*/
break;
@@ -227,13 +227,13 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal)
info->width = LM_to_uint(buf[4], buf[5]);
info->height = LM_to_uint(buf[6], buf[7]);
info->interlace = BitSet(buf[8], INTERLACE);
-
+
gif->w = info->width;
gif->h = info->height;
gif->frames = 1;
gif->depth = 8;
bmp_ComputePitch (8, info->width, &gif->pitch, TRUE);
-
+
gif->flags |= MYBMP_FLOW_DOWN;
if ( info->gif89.transparent > 0 ) {
gif->flags |= MYBMP_TRANSPARENT;
@@ -254,7 +254,7 @@ int __mg_load_gif (MG_RWops* fp, void* init_info, MYBITMAP *gif, CB_ONE_SCANLINE
GifInfo * info = (GifInfo *)init_info;
if (!info ->useGColormap) {
- ok = ReadImage (fp, gif, info->width,
+ ok = ReadImage (fp, gif, info->width,
info->height,
info->interlace,
cb, context, info);
@@ -273,7 +273,7 @@ int __mg_load_gif (MG_RWops* fp, void* init_info, MYBITMAP *gif, CB_ONE_SCANLINE
void __mg_cleanup_gif (void* init_info)
{
- free (init_info); /* free the GifInfo struct */
+ free (init_info); /* free the GifInfo struct */
}
static int
@@ -371,7 +371,7 @@ LWZReadByte(MG_RWops *src, int flag, int input_code_size , void * info_data)
static int clear_code, end_code;
static int table[2][(1 << MAX_LWZ_BITS)];
static int stack[(1 << (MAX_LWZ_BITS)) * 2], *sp;
-
+
GifInfo * info = info_data;
if (flag) {
@@ -470,7 +470,7 @@ LWZReadByte(MG_RWops *src, int flag, int input_code_size , void * info_data)
}
static int
-ReadImage(MG_RWops* src, MYBITMAP* bmp, int len, int height,
+ReadImage(MG_RWops* src, MYBITMAP* bmp, int len, int height,
int interlace , CB_ONE_SCANLINE cb, void* context , void * info)
{
unsigned char c;
@@ -539,9 +539,7 @@ ReadImage(MG_RWops* src, MYBITMAP* bmp, int len, int height,
else {
/* emit line at here */
if (bmp->flags &= MYBMP_LOAD_ALLOCATE_ONE)
- {
(*cb)(context, bmp, ypos);
- }
++ypos;
}
}
diff --git a/src/newgal/commlcd/commlcd.c b/src/newgal/commlcd/commlcd.c
index eeb96e13..3f5a5bfb 100644
--- a/src/newgal/commlcd/commlcd.c
+++ b/src/newgal/commlcd/commlcd.c
@@ -246,9 +246,9 @@ static GAL_Surface *COMMLCD_SetVideoMode(_THIS, GAL_Surface *current,
Bmask = 0x001F;
break;
case COMMLCD_TRUE_RGB565:
- Rmask = 0x07E0;
- Gmask = 0x001F;
- Bmask = 0xF800;
+ Rmask = 0xF800;
+ Gmask = 0x07E0;
+ Bmask = 0x001F;
break;
case COMMLCD_TRUE_RGB888:
case COMMLCD_TRUE_RGB0888:
diff --git a/src/newgal/commlcd/commlcd.h b/src/newgal/commlcd/commlcd.h
index b7172afd..45b86c00 100644
--- a/src/newgal/commlcd/commlcd.h
+++ b/src/newgal/commlcd/commlcd.h
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -58,27 +58,6 @@ struct GAL_PrivateVideoData {
pthread_mutex_t update_lock;
};
-/* The pixel format defined by depth */
-//#define COMMLCD_PSEUDO_RGB332 1
-//#define COMMLCD_TRUE_RGB555 2
-//#define COMMLCD_TRUE_RGB565 3
-//#define COMMLCD_TRUE_RGB888 4
-//#define COMMLCD_TRUE_RGB0888 5
-//#define COMMLCD_TRUE_ARGB1555 6
-//#define COMMLCD_TRUE_ARGB8888 7
-//#define COMMLCD_TRUE_AGBR8888 8
-
-//struct commlcd_info {
-// short height; // vertical resolution of the screen
-// short width; // horinzontal resolution of the screen
-// short bpp; // Depth (bits-per-pixel)
-// short type; // Pixel type
-// short rlen; // Length of one scan line in bytes
-// void *fb; // Frame buffer
-
-// short async_update; // update asynchronously or synchronously. 0 for synchronously; others for asynchronously.
-//};
-
struct commlcd_ops {
/* return value: zero for OK */
int (*init) (void);
diff --git a/src/newgal/commlcd/extern.c b/src/newgal/commlcd/extern.c
index a2a9a7eb..623d2589 100644
--- a/src/newgal/commlcd/extern.c
+++ b/src/newgal/commlcd/extern.c
@@ -38,9 +38,6 @@
#include "common.h"
-//#ifdef _MGGAL_COMMLCD
-
-//#if defined (__VXWORKS__) || defined (__TARGET_UNKNOWN__) || defined(__RTEMS__)
#if defined(_MGGAL_COMMLCD) && defined(__TARGET_EXTERNAL__)
#include "minigui.h"
diff --git a/src/newgal/pixels.c b/src/newgal/pixels.c
index 3b53a846..daf4d32f 100644
--- a/src/newgal/pixels.c
+++ b/src/newgal/pixels.c
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -219,7 +219,7 @@ GAL_PixelFormat *GAL_AllocFormat(int bpp,
format->Amask = Amask;
break;
}
- /* Calculate some standard bitmasks, if necessary
+ /* Calculate some standard bitmasks, if necessary
* Note: This could conflict with an alpha mask, if given.
*/
if ( (bpp > 8) && !format->Rmask && !format->Gmask && !format->Bmask ) {
@@ -248,7 +248,7 @@ GAL_PixelFormat *GAL_ReallocFormat(GAL_Surface *surface, int bpp,
GAL_FormatChanged(surface);
}
- surface->format = GAL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
+ surface->format = GAL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
return surface->format;
}
@@ -327,7 +327,7 @@ Uint8 GAL_FindDitheredColor (int bpp, Uint8 r, Uint8 g, Uint8 b)
return r | g | b;
}
-/*
+/*
* Calculate the pad-aligned scanline width of a surface
*/
Uint32 GAL_CalculatePitch(GAL_Surface *surface)
@@ -361,7 +361,7 @@ Uint8 GAL_FindColor(GAL_Palette *pal, Uint8 r, Uint8 g, Uint8 b)
int rd, gd, bd;
int i;
Uint8 pixel=0;
-
+
smallest = ~0;
for ( i=0; incolors; ++i ) {
rd = pal->colors[i].r - r;
diff --git a/src/newgal/surface.c b/src/newgal/surface.c
index 01ace89a..d295833b 100644
--- a/src/newgal/surface.c
+++ b/src/newgal/surface.c
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -135,7 +135,7 @@ GAL_Surface * GAL_CreateRGBSurface (Uint32 flags,
/* Get the pixels */
if ( surface->w && surface->h ) {
- if ( ((flags&GAL_HWSURFACE) == GAL_SWSURFACE) ||
+ if ( ((flags&GAL_HWSURFACE) == GAL_SWSURFACE) ||
(video->AllocHWSurface(this, surface) < 0) ) {
surface->pixels = malloc(surface->h*surface->pitch);
if ( surface->pixels == NULL ) {
@@ -247,9 +247,9 @@ int GAL_SetAlpha (GAL_Surface *surface, Uint32 flag, Uint8 value)
} else {
flag = GAL_SRCALPHA;
}
-
+
/* Optimize away operations that don't change anything */
- if ( (flag == (surface->flags & (GAL_SRCALPHA|GAL_RLEACCELOK)))
+ if ( (flag == (surface->flags & (GAL_SRCALPHA|GAL_RLEACCELOK)))
&& (!flag || value == oldalpha) ) {
return(0);
}
@@ -275,9 +275,9 @@ int GAL_SetAlpha (GAL_Surface *surface, Uint32 flag, Uint8 value)
surface->format->alpha = value;
} else if ( flag & GAL_SRCPIXELALPHA ){
surface->flags |= GAL_SRCPIXELALPHA;
- }
+ }
+
-
if ( (surface->flags & GAL_HWACCEL) == GAL_HWACCEL ) {
if ( (video->SetHWAlpha == NULL) ||
(video->SetHWAlpha(this, surface, value) < 0) ) {
@@ -409,7 +409,7 @@ int own_overlapped_bitblit(GAL_blit real_blit, struct GAL_Surface *src, GAL_Rect
GAL_Rect src1, dst1;
- /* vertical overlapped.
+ /* vertical overlapped.
* if left-up right-up left-down right-down, horizontal is faster than vertical than use horizonatl mode. */
if ((dst_rc.top != src_rc.top) && (RECTH(intersect) <= RECTW(intersect))) {
h = RECTH(intersect);
@@ -425,10 +425,10 @@ int own_overlapped_bitblit(GAL_blit real_blit, struct GAL_Surface *src, GAL_Rect
}
src1.x = src_rc.left;
src1.y = src_rc.top + y - delta;
-
+
dst1.x = dst_rc.left;
dst1.y = dst_rc.top + y - delta;
-
+
src1.w = dst1.w = srcrect->w;
src1.h = dst1.h = delta;
@@ -443,10 +443,10 @@ int own_overlapped_bitblit(GAL_blit real_blit, struct GAL_Surface *src, GAL_Rect
}
src1.x = src_rc.left;
src1.y = src_rc.top + y;
-
+
dst1.x = dst_rc.left;
dst1.y = dst_rc.top + y;
-
+
src1.w = dst1.w = srcrect->w;
src1.h = dst1.h = delta;
@@ -459,7 +459,7 @@ int own_overlapped_bitblit(GAL_blit real_blit, struct GAL_Surface *src, GAL_Rect
w = RECTW(intersect);
W = RECTW(src_rc);
delta = W - w;
-
+
/* horizontal right overlapped, separate into per not-Intersect rect to blit,
* from right to left */
if (dst_rc.left > src_rc.left) {
@@ -469,10 +469,10 @@ int own_overlapped_bitblit(GAL_blit real_blit, struct GAL_Surface *src, GAL_Rect
}
src1.x = src_rc.left + x - delta;
src1.y = src_rc.top;
-
+
dst1.x = dst_rc.left + x - delta;
dst1.y = dst_rc.top;
-
+
src1.w = dst1.w = delta;
src1.h = dst1.h = srcrect->h;
@@ -488,10 +488,10 @@ int own_overlapped_bitblit(GAL_blit real_blit, struct GAL_Surface *src, GAL_Rect
}
src1.x = src_rc.left + x;
src1.y = src_rc.top;
-
+
dst1.x = dst_rc.left + x;
dst1.y = dst_rc.top;
-
+
src1.w = dst1.w = delta;
src1.h = dst1.h = srcrect->h;
@@ -504,13 +504,13 @@ int own_overlapped_bitblit(GAL_blit real_blit, struct GAL_Surface *src, GAL_Rect
}
#endif
-/*
+/*
* Set up a blit between two surfaces -- split into three parts:
- * The upper part, GAL_UpperBlit(), performs clipping and rectangle
+ * The upper part, GAL_UpperBlit(), performs clipping and rectangle
* verification. The lower part is a pointer to a low level
* accelerated blitting function.
*
- * These parts are separated out and each used internally by this
+ * These parts are separated out and each used internally by this
* library in the optimimum places. They are exported so that if
* you know exactly what you are doing, you can optimize your code
* by calling the one(s) you need.
@@ -601,7 +601,7 @@ int GAL_UpperBlit (GAL_Surface *src, GAL_Rect *srcrect,
/* clip the source rectangle to the source surface */
if(srcrect) {
int maxw, maxh;
-
+
srcx = srcrect->x;
w = srcrect->w;
if(srcx < 0) {
@@ -623,7 +623,7 @@ int GAL_UpperBlit (GAL_Surface *src, GAL_Rect *srcrect,
maxh = src->h - srcy;
if(maxh < h)
h = maxh;
-
+
} else {
srcx = srcy = 0;
w = src->w;
@@ -668,7 +668,7 @@ int GAL_UpperBlit (GAL_Surface *src, GAL_Rect *srcrect,
return 0;
}
-/*
+/*
* This function performs a fast fill of the given rectangle with 'color'
*/
int GAL_FillRect(GAL_Surface *dst, const GAL_Rect *dstrect, Uint32 color)
@@ -829,7 +829,7 @@ int GAL_FillRect(GAL_Surface *dst, const GAL_Rect *dstrect, Uint32 color)
return(0);
}
-/*
+/*
* Calculate the pad-aligned box sizew in a surface
*/
Uint32 GAL_GetBoxSize (GAL_Surface *surface, Uint32 w, Uint32 h, Uint32* pitch_p)
@@ -857,7 +857,7 @@ Uint32 GAL_GetBoxSize (GAL_Surface *surface, Uint32 w, Uint32 h, Uint32* pitch_p
return pitch * h;
}
-/*
+/*
* This function performs a fast HW -> SW box copying.
*/
int GAL_GetBox (GAL_Surface *src, const GAL_Rect *rect, BITMAP* box)
@@ -907,7 +907,7 @@ int GAL_GetBox (GAL_Surface *src, const GAL_Rect *rect, BITMAP* box)
switch (box->bmBytesPerPixel) {
case 1:
- if (((DWORD)srcrow & 3) || ((DWORD)dstrow & 3)
+ if (((DWORD)srcrow & 3) || ((DWORD)dstrow & 3)
|| (linelen & 3) || (box->bmPitch & 3) || (src->pitch & 3))
goto slow_copy;
else {
@@ -921,7 +921,7 @@ int GAL_GetBox (GAL_Surface *src, const GAL_Rect *rect, BITMAP* box)
break;
case 2:
- if ((((DWORD)srcrow & 3) != ((DWORD)dstrow & 3))
+ if ((((DWORD)srcrow & 3) != ((DWORD)dstrow & 3))
|| (box->bmPitch & 3) || (src->pitch & 3))
goto slow_copy;
@@ -970,7 +970,7 @@ slow_copy:
return(0);
}
-/*
+/*
* This function performs a fast SW -> HW box copying.
*/
@@ -997,11 +997,11 @@ static int _PutBoxAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow,
if (bpp == 1)
- {
+ {
return -1;
- }
+ }
- if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) {
+ if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) {
while ( h-- ) {
dstpixels = dstrow;
srcpixels = srcrow;
@@ -1026,9 +1026,9 @@ static int _PutBoxAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow,
srcrow += box->bmPitch;
dstrow += dst->pitch;
}
- } else {
+ } else {
/* for aligned 32-bits bound */
- int alpha_mask_index;
+ int alpha_mask_index;
int alpha_mask_pitch;
int alpha_mask_row;
GET_ALPHA_MASK_INDEX (srcrow, box, alpha_mask_pitch, alpha_mask_row);
@@ -1036,7 +1036,7 @@ static int _PutBoxAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow,
while ( h-- ) {
dstpixels = dstrow;
srcpixels = srcrow;
- alpha_mask_index = alpha_mask_row;
+ alpha_mask_index = alpha_mask_row;
DUFFS_LOOP(
{
Uint32 pixel;
@@ -1049,19 +1049,19 @@ static int _PutBoxAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow,
unsigned dB;
DISEMBLE_RGB (srcpixels, bpp, dstfmt, pixel, sR, sG, sB);
DISEMBLE_RGB (dstpixels, bpp, dstfmt, pixel, dR, dG, dB);
- sA = box->bmAlphaMask[alpha_mask_index];
+ sA = box->bmAlphaMask[alpha_mask_index];
ALPHA_BLEND (sR, sG, sB, (alpha*sA)/255, dR, dG, dB);
ASSEMBLE_RGBA (dstpixels, bpp, dstfmt, dR, dG, dB, alpha);
dstpixels += bpp;
srcpixels += bpp;
- alpha_mask_index++;
+ alpha_mask_index++;
},
w);
srcrow += box->bmPitch;
dstrow += dst->pitch;
- alpha_mask_row += alpha_mask_pitch;
+ alpha_mask_row += alpha_mask_pitch;
}
- }
+ }
return 0;
}
@@ -1074,13 +1074,13 @@ static int _PutBoxAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32 w,
int bpp = dstfmt->BytesPerPixel;
unsigned alpha = dstfmt->Amask ? GAL_ALPHA_OPAQUE : 0;
-
- if (bpp == 1)
- {
- return -1;
- }
- if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) {
+ if (bpp == 1)
+ {
+ return -1;
+ }
+
+ if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) {
if (dstfmt->Amask == 0xff000000 && dstfmt->BitsPerPixel == 32)
{
while(h--) {
@@ -1132,7 +1132,7 @@ static int _PutBoxAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32 w,
unsigned dR = 0;
unsigned dG = 0;
unsigned dB = 0;
- unsigned dA = 0;
+ unsigned dA = 0;
DISEMBLE_RGBA (srcpixels, bpp, dstfmt, pixel, sR, sG, sB, sA);
DISEMBLE_RGBA (dstpixels, bpp, dstfmt, pixel, dR, dG, dB, dA);
ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB);
@@ -1147,42 +1147,42 @@ static int _PutBoxAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32 w,
dstrow += dst->pitch;
}
}
- } else {
+ } else {
/* for aligned 32-bits bound */
int alpha_mask_index;
int alpha_mask_pitch;
int alpha_mask_row;
GET_ALPHA_MASK_INDEX (srcrow, box, alpha_mask_pitch, alpha_mask_row);
-
- while ( h-- ) {
- dstpixels = dstrow;
- srcpixels = srcrow;
- alpha_mask_index = alpha_mask_row;
- DUFFS_LOOP(
- {
- Uint32 pixel;
- unsigned sR;
- unsigned sG;
- unsigned sB;
- unsigned sA;
- unsigned dR;
- unsigned dG;
- unsigned dB;
+
+ while ( h-- ) {
+ dstpixels = dstrow;
+ srcpixels = srcrow;
+ alpha_mask_index = alpha_mask_row;
+ DUFFS_LOOP(
+ {
+ Uint32 pixel;
+ unsigned sR;
+ unsigned sG;
+ unsigned sB;
+ unsigned sA;
+ unsigned dR;
+ unsigned dG;
+ unsigned dB;
DISEMBLE_RGB (srcpixels, bpp, dstfmt, pixel, sR, sG, sB);
- DISEMBLE_RGB (dstpixels, bpp, dstfmt, pixel, dR, dG, dB);
+ DISEMBLE_RGB (dstpixels, bpp, dstfmt, pixel, dR, dG, dB);
sA = box->bmAlphaMask[alpha_mask_index];
- ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB);
- ASSEMBLE_RGBA (dstpixels, bpp, dstfmt, dR, dG, dB, alpha);
- dstpixels += bpp;
- srcpixels += bpp;
- alpha_mask_index++;
- },
- w);
- srcrow += box->bmPitch;
- dstrow += dst->pitch;
- alpha_mask_row += alpha_mask_pitch;
- }
- }
+ ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB);
+ ASSEMBLE_RGBA (dstpixels, bpp, dstfmt, dR, dG, dB, alpha);
+ dstpixels += bpp;
+ srcpixels += bpp;
+ alpha_mask_index++;
+ },
+ w);
+ srcrow += box->bmPitch;
+ dstrow += dst->pitch;
+ alpha_mask_row += alpha_mask_pitch;
+ }
+ }
return 0;
}
@@ -1232,16 +1232,14 @@ static int _PutBoxKeyAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcro
Uint32 ckey = box->bmColorKey;
GAL_PixelFormat *dstfmt = dst->format;
int bpp = dstfmt->BytesPerPixel;
- Uint32 rgbmask = ~dstfmt->Amask;
+ Uint32 rgbmask = ~dstfmt->Amask;
unsigned alpha = box->bmAlpha;
if (bpp == 1)
- {
- return -1;
- }
+ return -1;
- if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) {
+ if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) {
while ( h-- ) {
dstpixels = dstrow;
srcpixels = srcrow;
@@ -1257,7 +1255,7 @@ static int _PutBoxKeyAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcro
unsigned dB;
RETRIEVE_RGB_PIXEL (srcpixels, bpp, pixel);
if ((pixel & rgbmask) != ckey ) {
- RGBA_FROM_PIXEL (pixel, dstfmt, sR, sG, sB, sA);
+ RGBA_FROM_PIXEL (pixel, dstfmt, sR, sG, sB, sA);
DISEMBLE_RGB (dstpixels, bpp, dstfmt, pixel, dR, dG, dB);
ALPHA_BLEND (sR, sG, sB, (alpha*sA)/255, dR, dG, dB);
ASSEMBLE_RGBA (dstpixels, bpp, dstfmt, dR, dG, dB, alpha);
@@ -1269,9 +1267,9 @@ static int _PutBoxKeyAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcro
srcrow += box->bmPitch;
dstrow += dst->pitch;
}
- } else {
+ } else {
/* for aligned 32-bits bound */
- int alpha_mask_index;
+ int alpha_mask_index;
int alpha_mask_pitch;
int alpha_mask_row;
GET_ALPHA_MASK_INDEX (srcrow, box, alpha_mask_pitch, alpha_mask_row);
@@ -1279,7 +1277,7 @@ static int _PutBoxKeyAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcro
while ( h-- ) {
dstpixels = dstrow;
srcpixels = srcrow;
- alpha_mask_index = alpha_mask_row;
+ alpha_mask_index = alpha_mask_row;
DUFFS_LOOP(
{
Uint32 pixel;
@@ -1292,22 +1290,22 @@ static int _PutBoxKeyAlphaChannelEx (GAL_Surface* dst, BYTE* dstrow, BYTE* srcro
unsigned dB;
RETRIEVE_RGB_PIXEL (srcpixels, bpp, pixel);
if ((pixel & rgbmask) != ckey ) {
- RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
+ RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
DISEMBLE_RGB (dstpixels, bpp, dstfmt, pixel, dR, dG, dB);
- sA = box->bmAlphaMask[alpha_mask_index];
+ sA = box->bmAlphaMask[alpha_mask_index];
ALPHA_BLEND (sR, sG, sB, (alpha*sA)/255, dR, dG, dB);
ASSEMBLE_RGBA (dstpixels, bpp, dstfmt, dR, dG, dB, alpha);
}
dstpixels += bpp;
srcpixels += bpp;
- alpha_mask_index++;
+ alpha_mask_index++;
},
w);
srcrow += box->bmPitch;
dstrow += dst->pitch;
- alpha_mask_row += alpha_mask_pitch;
+ alpha_mask_row += alpha_mask_pitch;
}
- }
+ }
return 0;
}
@@ -1319,7 +1317,7 @@ static int _PutBoxKeyAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32
Uint32 ckey = box->bmColorKey;
GAL_PixelFormat *dstfmt = dst->format;
int bpp = dstfmt->BytesPerPixel;
- Uint32 rgbmask = ~dstfmt->Amask;
+ Uint32 rgbmask = ~dstfmt->Amask;
unsigned alpha = dstfmt->Amask ? GAL_ALPHA_OPAQUE : 0;
@@ -1327,7 +1325,7 @@ static int _PutBoxKeyAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32
return -1;
if (!(box->bmType & BMP_TYPE_ALPHA_MASK)) {
- while ( h-- ) {
+ while ( h-- ) {
dstpixels = dstrow;
srcpixels = srcrow;
DUFFS_LOOP(
@@ -1354,7 +1352,7 @@ static int _PutBoxKeyAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32
srcrow += box->bmPitch;
dstrow += dst->pitch;
}
- } else {
+ } else {
/* for aligned 32-bits bound */
int alpha_mask_index;
int alpha_mask_pitch;
@@ -1364,7 +1362,7 @@ static int _PutBoxKeyAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32
while ( h-- ) {
dstpixels = dstrow;
srcpixels = srcrow;
- alpha_mask_index = alpha_mask_row;
+ alpha_mask_index = alpha_mask_row;
DUFFS_LOOP(
{
Uint32 pixel;
@@ -1377,22 +1375,22 @@ static int _PutBoxKeyAlpha (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32
unsigned dB;
RETRIEVE_RGB_PIXEL (srcpixels, bpp, pixel);
if ((pixel & rgbmask) != ckey ) {
- RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
+ RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
DISEMBLE_RGB (dstpixels, bpp, dstfmt, pixel, dR, dG, dB);
- sA = box->bmAlphaMask[alpha_mask_index];
+ sA = box->bmAlphaMask[alpha_mask_index];
ALPHA_BLEND (sR, sG, sB, sA, dR, dG, dB);
ASSEMBLE_RGBA (dstpixels, bpp, dstfmt, dR, dG, dB, alpha);
}
dstpixels += bpp;
srcpixels += bpp;
- alpha_mask_index++;
+ alpha_mask_index++;
},
w);
srcrow += box->bmPitch;
dstrow += dst->pitch;
- alpha_mask_row += alpha_mask_pitch;
+ alpha_mask_row += alpha_mask_pitch;
}
- }
+ }
return 0;
}
@@ -1582,7 +1580,7 @@ int GAL_PutBox (GAL_Surface *dst, const GAL_Rect *dstrect, BITMAP* box)
switch (dst->format->BytesPerPixel) {
case 1:
- if (((DWORD)srcrow & 3) || ((DWORD)dstrow & 3)
+ if (((DWORD)srcrow & 3) || ((DWORD)dstrow & 3)
|| (linelen & 3) || (box->bmPitch & 3) || (dst->pitch & 3))
goto slow_copy;
else {
@@ -1596,7 +1594,7 @@ int GAL_PutBox (GAL_Surface *dst, const GAL_Rect *dstrect, BITMAP* box)
break;
case 2:
- if ((((DWORD)dstrow & 3) != ((DWORD)srcrow & 3))
+ if ((((DWORD)dstrow & 3) != ((DWORD)srcrow & 3))
|| (box->bmPitch & 3) || (dst->pitch & 3))
goto slow_copy;
@@ -1645,7 +1643,7 @@ slow_copy:
return 0;
}
-/*
+/*
* Convert a surface into the specified pixel format.
*/
GAL_Surface * GAL_ConvertSurface (GAL_Surface *surface,
@@ -1799,7 +1797,7 @@ void GAL_RequestHWSurface (const REQ_HWSURFACE* request, REP_HWSURFACE* reply)
#endif
-BYTE* gal_PutPixelKeyAlpha (GAL_Surface* dst, BYTE* dstrow,
+BYTE* gal_PutPixelKeyAlpha (GAL_Surface* dst, BYTE* dstrow,
Uint32 pixel, MYBITMAP_CONTXT* mybmp)
{
//BYTE* dstpixels = dstrow;
@@ -1845,7 +1843,7 @@ BYTE* gal_PutPixelKeyAlpha (GAL_Surface* dst, BYTE* dstrow,
return dstrow;
}
-BYTE* gal_PutPixelAlpha (GAL_Surface* dst, BYTE* dstrow,
+BYTE* gal_PutPixelAlpha (GAL_Surface* dst, BYTE* dstrow,
Uint32 pixel, MYBITMAP_CONTXT* mybmp)
{
//BYTE* dstpixels = dstrow;
@@ -1889,7 +1887,7 @@ BYTE* gal_PutPixelAlpha (GAL_Surface* dst, BYTE* dstrow,
return dstrow;
}
-BYTE* gal_PutPixelKeyAlphaChannel (GAL_Surface* dst, BYTE* dstrow,
+BYTE* gal_PutPixelKeyAlphaChannel (GAL_Surface* dst, BYTE* dstrow,
Uint32 pixel, MYBITMAP_CONTXT* mybmp)
{
//BYTE* dstpixels = dstrow;
@@ -1932,7 +1930,7 @@ BYTE* gal_PutPixelKeyAlphaChannel (GAL_Surface* dst, BYTE* dstrow,
return dstrow;
}
-BYTE* gal_PutPixelKey (GAL_Surface* dst, BYTE* dstrow,
+BYTE* gal_PutPixelKey (GAL_Surface* dst, BYTE* dstrow,
Uint32 pixel, MYBITMAP_CONTXT* mybmp)
{
//BYTE* dstpixels = dstrow;
@@ -2009,7 +2007,7 @@ BYTE* gal_PutPixelKey (GAL_Surface* dst, BYTE* dstrow,
return dstrow;
}
-BYTE* gal_PutPixelAlphaChannel (GAL_Surface* dst, BYTE* dstrow,
+BYTE* gal_PutPixelAlphaChannel (GAL_Surface* dst, BYTE* dstrow,
Uint32 pixel, MYBITMAP_CONTXT* mybmp)
{
//BYTE* dstpixels = dstrow;
diff --git a/src/newgal/video.c b/src/newgal/video.c
index e7f1d3c8..5c17b277 100644
--- a/src/newgal/video.c
+++ b/src/newgal/video.c
@@ -668,7 +668,6 @@ GAL_Surface *GAL_DisplayFormatAlpha(GAL_Surface *surface)
optimised alpha format is written, add the converter here */
break;
}
-printf("============================================================================================== in GAL_DisplayFormatAlpha\n");
format = GAL_AllocFormat(32, rmask, gmask, bmask, amask);
flags = GAL_PublicSurface->flags & GAL_HWSURFACE;
flags |= surface->flags & (GAL_SRCALPHA | GAL_RLEACCELOK);
@@ -1072,7 +1071,6 @@ static GAL_Surface *Slave_CreateSurface (GAL_VideoDevice *this,
if (Amask){
surface->flags |= GAL_SRCPIXELALPHA;
}
-printf("============================================================================================== in Slave_CreateSurface\n");
surface->format = GAL_AllocFormat(depth, Rmask, Gmask, Bmask, Amask);
if ( surface->format == NULL ) {
diff --git a/src/sysres/resmgr.c b/src/sysres/resmgr.c
index 53ccf280..955ef67f 100644
--- a/src/sysres/resmgr.c
+++ b/src/sysres/resmgr.c
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -367,15 +367,15 @@ BOOL InitializeResManager(int hash_table_size)
#if !defined(__NOUNIX__) || defined(WIN32) || !defined(__RTEMS__)
char* p = NULL;
#endif
- pwd_res_path = strdup("./");
+ pwd_res_path = strdup("./");
//initialize paths
-#if !defined(__NOUNIX__) || defined(WIN32)
+#if !defined(__NOUNIX__) || defined(WIN32) || !defined(__RTEMS__)
if ((p = getenv ("MG_RES_PATH"))) {
int len = strlen(p);
- if (p[len-1] == '/')
+ if (p[len-1] == '/')
sprintf(szpath, "%s", p);
- else
+ else
sprintf(szpath, "%s/", p);
cfg_res_path = strdup(szpath);
}
@@ -636,20 +636,17 @@ int UnregisterResType(int type)
static char* get_res_file(const char* res_name, char* filename)
{
-#ifndef __RTEMS__
+#ifndef _MGINCORE_RES
+
int i;
-#endif
if (res_name == NULL || filename == NULL)
return NULL;
-#ifdef __RTEMS__
- return NULL;
-#else
-
//test it is a full path or not
- for(i=0; res_name[i] && res_name[i] == '/'; i++);
- if(i>0) //is full path
- {
+ for (i=0; res_name[i] && res_name[i] == '/'; i++)
+ ;
+
+ if (i > 0) {
#ifndef __NOUNIX__
struct stat buf;
if(stat(res_name, &buf) == 0
@@ -661,8 +658,8 @@ static char* get_res_file(const char* res_name, char* filename)
}
}
- for(i=0; res_paths[i]; i++)
- {
+ for(i=0; res_paths[i]; i++) {
+
#ifndef __NOUNIX__
struct stat buf;
sprintf(filename,"%s/%s", res_paths[i], res_name);
@@ -678,7 +675,8 @@ static char* get_res_file(const char* res_name, char* filename)
return filename;
}
}
-#endif
+#endif /* !_MGINCORE_RES */
+
return NULL;
}
@@ -709,7 +707,7 @@ void* LoadResource(const char* res_name, int type, DWORD usr_param)
RES_ENTRY * entry;
RES_KEY key;
RES_TYPE_INFO *ti = NULL;
- int src_type = 0;
+ int src_type = 0;
void *data = NULL;
char szfilename[MAX_PATH+1]={0};
@@ -760,11 +758,11 @@ void* LoadResource(const char* res_name, int type, DWORD usr_param)
{
//add type info's
ti->ops_ref ++;
- src_type = GetSourceType(entry);
- if(src_type == REF_SRC_NOTYPE){
- src_type = ti->def_source;
- SetSourceType(entry, src_type);
- }
+ src_type = GetSourceType(entry);
+ if(src_type == REF_SRC_NOTYPE){
+ src_type = ti->def_source;
+ SetSourceType(entry, src_type);
+ }
switch(src_type)
{
case REF_SRC_FILE:
@@ -845,7 +843,7 @@ static void delete_entry(HASH_TABLE *table, RES_ENTRY* entry)
int ReleaseRes(RES_KEY key)
{
- int ref = 0;
+ int ref = 0;
RES_ENTRY *entry = NULL;
RES_LOCK();
entry = get_entry(&hash_table, key, FALSE);
@@ -853,7 +851,7 @@ int ReleaseRes(RES_KEY key)
RES_UNLOCK();
return -1;
}
- ref = --entry->refcnt;
+ ref = --entry->refcnt;
if(ref <= 0)
delete_entry(&hash_table, entry);
RES_UNLOCK();
diff --git a/src/textedit/object.c b/src/textedit/object.c
index cbfc959d..77715427 100644
--- a/src/textedit/object.c
+++ b/src/textedit/object.c
@@ -1,33 +1,33 @@
/*
- * This file is part of MiniGUI, a mature cross-platform windowing
+ * This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
- *
+ *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* Or,
- *
+ *
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
- *
+ *
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
- *
+ *
* For more information about the commercial license, please refer to
* .
*/
@@ -51,134 +51,134 @@
static void mObject_construct(mObject* self, DWORD addData)
{
- //do nothing
- //to avoid NULL pointer
+ //do nothing
+ //to avoid NULL pointer
}
static void mObject_destroy(mObject* self)
{
-/* ncsRemoveObjectBindProps(self);
- ncsRemoveEventSource(self);
- ncsRemoveEventListener(self);
-*/
+/* ncsRemoveObjectBindProps(self);
+ ncsRemoveEventSource(self);
+ ncsRemoveEventListener(self);
+*/
}
static DWORD mObject_hash(mObject *self)
{
- return (DWORD)self;
+ return (DWORD)self;
}
static const char* mObject_toString(mObject *self, char* str, int max)
{
- if(!str)
- return NULL;
+ if(!str)
+ return NULL;
- snprintf(str, max, "NCS Object %s[@%p]", TYPENAME(self),self);
- return str;
+ snprintf(str, max, "NCS Object %s[@%p]", TYPENAME(self),self);
+ return str;
}
static mObjectClass* mObjectClassConstructor(mObjectClass* _class)
{
- _class->super = NULL;
- _class->typeName = "mObject";
- _class->objSize = sizeof(mObject);
+ _class->super = NULL;
+ _class->typeName = "mObject";
+ _class->objSize = sizeof(mObject);
- CLASS_METHOD_MAP(mObject, construct)
- CLASS_METHOD_MAP(mObject, destroy)
- CLASS_METHOD_MAP(mObject, hash)
- CLASS_METHOD_MAP(mObject, toString)
- return _class;
+ CLASS_METHOD_MAP(mObject, construct)
+ CLASS_METHOD_MAP(mObject, destroy)
+ CLASS_METHOD_MAP(mObject, hash)
+ CLASS_METHOD_MAP(mObject, toString)
+ return _class;
}
mObjectClass Class(mObject) = {
- (PClassConstructor)mObjectClassConstructor
+ (PClassConstructor)mObjectClassConstructor
};
mObject * mg_newObject(mObjectClass *_class)
{
- mObject * obj;
+ mObject * obj;
- if(_class == NULL)
- return NULL;
+ if(_class == NULL)
+ return NULL;
- obj = (mObject*)calloc(1, _class->objSize);
+ obj = (mObject*)calloc(1, _class->objSize);
- if(!obj)
- return NULL;
+ if(!obj)
+ return NULL;
- return initObject(obj, _class);
+ return initObject(obj, _class);
}
mObject * mgNewObject(mObjectClass *_class,DWORD addData){
- mObject * obj = newObject(_class);
- if(!obj)
- return NULL;
+ mObject * obj = newObject(_class);
+ if(!obj)
+ return NULL;
- _class->construct(obj, addData);
- return obj;
+ _class->construct(obj, addData);
+ return obj;
}
mObject * mgNewObjectArgs(mObjectClass* _class, ...)
{
- va_list va;
- mObject * obj;
- va_start(va, _class);
- obj = newObject(_class);
- if(obj)
- ((PCONSTRUCT_VALIST)(_class->construct))(obj, va);
- va_end(va);
- return obj;
+ va_list va;
+ mObject * obj;
+ va_start(va, _class);
+ obj = newObject(_class);
+ if(obj)
+ ((PCONSTRUCT_VALIST)(_class->construct))(obj, va);
+ va_end(va);
+ return obj;
}
void mgDeleteObject(mObject *obj)
{
- if(obj == NULL || obj->_class == NULL)
- return;
+ if(obj == NULL || obj->_class == NULL)
+ return;
- _c(obj)->destroy(obj);
+ _c(obj)->destroy(obj);
- free(obj);
+ free(obj);
}
mObject* mgInitObject(mObject* pobj, mObjectClass* _class) {
- IInterface* piobj;
- IInterfaceVTable* _ivtable;
- int next_intf_offset ;
- pobj->_class = _class;
+ IInterface* piobj;
+ IInterfaceVTable* _ivtable;
+ int next_intf_offset ;
+ pobj->_class = _class;
- next_intf_offset = _class->intfOffset;
- while(next_intf_offset > 0)
- {
- _ivtable = (IInterfaceVTable*)((unsigned char*)_class + next_intf_offset);
- piobj = (IInterface*)((unsigned char*)pobj + _ivtable->_obj_offset);
- piobj->_vtable = _ivtable;
- next_intf_offset = _ivtable->_next_offset;
- }
+ next_intf_offset = _class->intfOffset;
+ while(next_intf_offset > 0)
+ {
+ _ivtable = (IInterfaceVTable*)((unsigned char*)_class + next_intf_offset);
+ piobj = (IInterface*)((unsigned char*)pobj + _ivtable->_obj_offset);
+ piobj->_vtable = _ivtable;
+ next_intf_offset = _ivtable->_next_offset;
+ }
- return pobj;
+ return pobj;
}
-mObject* mg_initObject(mObject* pobj, mObjectClass* _class,DWORD param)
+mObject* mg_initObject(mObject* pobj, mObjectClass* _class,DWORD param)
{
- memset(pobj, 0, _class->objSize);
- initObject(pobj, _class);
- _class->construct(pobj, param);
- return pobj;
+ memset(pobj, 0, _class->objSize);
+ initObject(pobj, _class);
+ _class->construct(pobj, param);
+ return pobj;
}
mObject* mgInitObjectArgs(mObject* pobj, mObjectClass* _class, ...)
{
- va_list va;
- va_start(va, _class);
- memset(pobj, 0, _class->objSize);
- initObject(pobj, _class);
- ((PCONSTRUCT_VALIST)(_class->construct))(pobj, va);
- va_end(va);
- return pobj;
+ va_list va;
+ va_start(va, _class);
+ memset(pobj, 0, _class->objSize);
+ initObject(pobj, _class);
+ ((PCONSTRUCT_VALIST)(_class->construct))(pobj, va);
+ va_end(va);
+ return pobj;
}
@@ -188,60 +188,60 @@ mObject* mgInitObjectArgs(mObject* pobj, mObjectClass* _class, ...)
mObjectClass *ncsSafeCastClass(mObjectClass* clss, mObjectClass* castCls)
{
- mObjectClass * clssSuper;
- if(clss == castCls)
- return NULL;
+ mObjectClass * clssSuper;
+ if(clss == castCls)
+ return NULL;
- clssSuper = clss;
- while(clssSuper && clssSuper != castCls)
- clssSuper = clssSuper->super;
+ clssSuper = clss;
+ while(clssSuper && clssSuper != castCls)
+ clssSuper = clssSuper->super;
- return clssSuper?clss:NULL;
+ return clssSuper?clss:NULL;
}
mObject* ncsSafeCast(mObject* obj, mObjectClass *clss)
{
- mObjectClass * objClass;
- if(obj == NULL || clss == NULL)
- return NULL;
+ mObjectClass * objClass;
+ if(obj == NULL || clss == NULL)
+ return NULL;
- objClass = _c(obj);
+ objClass = _c(obj);
- while(objClass && objClass != clss)
- objClass = objClass->super;
+ while(objClass && objClass != clss)
+ objClass = objClass->super;
- return objClass?obj:NULL;
+ return objClass?obj:NULL;
}
BOOL ncsInstanceOf(mObject *object, mObjectClass* clss)
{
- mObjectClass* objClss;
- if(object == NULL || clss == NULL)
- return FALSE;
+ mObjectClass* objClss;
+ if(object == NULL || clss == NULL)
+ return FALSE;
- objClss = _c(object);
+ objClss = _c(object);
- while(objClss && clss != objClss){
- objClss = objClss->super;
- }
+ while(objClss && clss != objClss){
+ objClss = objClss->super;
+ }
- return objClss != NULL;
+ return objClss != NULL;
}
static inline int _va_check (va_list va)
{
#if 0
- union {
- va_list va;
- DWORD dva;
- } _va;
+ union {
+ va_list va;
+ DWORD dva;
+ } _va;
if (va == 0)
return 0;
- va_copy (_va.va, va);
- if(_va.dva == 0)
- return 0;
+ va_copy (_va.va, va);
+ if(_va.dva == 0)
+ return 0;
return 1;
#else
@@ -258,69 +258,63 @@ static inline int _va_check (va_list va)
int ncsParseConstructParams(va_list args, const char* signature, ...)
{
- va_list params;
- int argc;
- int i;
+ va_list params;
+ int argc;
+ int i;
/*
** the implementation of GET_ARG_COUNT is bad, because some systems
- ** define va_list as a pointer, and others define it as an array of
+ ** define va_list as a pointer, and others define it as an array of
** pointers (of length 1).
- if(GET_ARG_COUNT(args) <= 0)
- return 0;
+ if(GET_ARG_COUNT(args) <= 0)
+ return 0;
*/
if (_va_check (args) == 0)
- {
return 0;
- }
- argc = va_arg(args, int);
+ argc = va_arg(args, int);
if(argc <= 0)
- {
return 0;
- }
- va_start(params, signature);
+ va_start(params, signature);
- i = 0;
- while(i < argc)
- {
- switch(signature[i])
- {
- case 'd': //double
- *(va_arg(params, double*)) = va_arg(args, double);
- break;
- case 'f': //float
+ i = 0;
+ while(i < argc) {
+ switch(signature[i]) {
+ case 'd': //double
+ *(va_arg(params, double*)) = va_arg(args, double);
+ break;
+ case 'f': //float
/* FIXME gcc says:
** warning: 'float' is promoted to 'double' when passed through '...'
** warning: (so you should pass 'double' not 'float' to 'va_arg')
** note: if this code is reached, the program will abort.
*/
- *(va_arg(params, float*)) = va_arg(args, double);
- break;
- case 'i': //integer
- *(va_arg(params, int*)) = va_arg(args, int);
- break;
- case 's': //const char*
- *(va_arg(params, const char**)) = va_arg(args, const char*);
- break;
- case 'u': //unsigned int
- *(va_arg(params, unsigned int*)) = va_arg(args, unsigned int);
- break;
- case 'p': //void *
- *(va_arg(params, void**)) = va_arg(args, void*);
- break;
- default:
- *(va_arg(params, void**)) = va_arg(args, void*);
- }
-
- i ++;
- }
+ *(va_arg(params, float*)) = va_arg(args, double);
+ break;
+ case 'i': //integer
+ *(va_arg(params, int*)) = va_arg(args, int);
+ break;
+ case 's': //const char*
+ *(va_arg(params, const char**)) = va_arg(args, const char*);
+ break;
+ case 'u': //unsigned int
+ *(va_arg(params, unsigned int*)) = va_arg(args, unsigned int);
+ break;
+ case 'p': //void *
+ *(va_arg(params, void**)) = va_arg(args, void*);
+ break;
+ default:
+ *(va_arg(params, void**)) = va_arg(args, void*);
+ }
- va_end(params);
+ i ++;
+ }
- return i;
+ va_end(params);
+
+ return i;
}
#endif /* defined(_MGCTRL_TEXTEDIT_USE_NEW_IMPL) || defined(__MGNCS_TEXTEDITOR) */