mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
Work around apparent limitation to smartphone/ppc, that ownerdraw
buttons don't generate WM_MESSAGE events and ownerdraw static controls don't get drawn: have one disabled ownerdraw button as the color sample and a real button to trigger the edit.
This commit is contained in:
parent
e178b7ccf5
commit
3d6f26cc3d
3 changed files with 75 additions and 65 deletions
|
@ -275,8 +275,8 @@ typedef struct ColorsDlgState {
|
||||||
XP_Bool inited;
|
XP_Bool inited;
|
||||||
} ColorsDlgState;
|
} ColorsDlgState;
|
||||||
|
|
||||||
#define FIRST_BUTTON DLBLTR_BUTTON
|
#define FIRST_BUTTON DLBLTR_SAMPLE
|
||||||
#define LAST_BUTTON PLAYER4_BUTTON
|
#define LAST_BUTTON PLAYER4_SAMPLE
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initColorData( ColorsDlgState* cState )
|
initColorData( ColorsDlgState* cState )
|
||||||
|
@ -287,9 +287,11 @@ initColorData( ColorsDlgState* cState )
|
||||||
|
|
||||||
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
for ( i = 0; i < CE_NUM_EDITABLE_COLORS; ++i ) {
|
||||||
COLORREF ref = cState->inColors[i];
|
COLORREF ref = cState->inColors[i];
|
||||||
|
HWND button = GetDlgItem( cState->hDlg, FIRST_BUTTON + i );
|
||||||
cState->colors[i] = ref;
|
cState->colors[i] = ref;
|
||||||
cState->brushes[i] = CreateSolidBrush( ref );
|
cState->brushes[i] = CreateSolidBrush( ref );
|
||||||
cState->buttons[i] = GetDlgItem( cState->hDlg, FIRST_BUTTON + i );
|
cState->buttons[i] = button;
|
||||||
|
EnableWindow( button, FALSE );
|
||||||
}
|
}
|
||||||
} /* initColorData */
|
} /* initColorData */
|
||||||
|
|
||||||
|
@ -375,16 +377,9 @@ ceDrawColorButton( ColorsDlgState* cState, DRAWITEMSTRUCT* dis )
|
||||||
XP_ASSERT( !!brush );
|
XP_ASSERT( !!brush );
|
||||||
|
|
||||||
RECT rect = dis->rcItem;
|
RECT rect = dis->rcItem;
|
||||||
XP_Bool hasFocus = ((dis->itemAction & ODA_FOCUS) != 0)
|
|
||||||
&& ((dis->itemState & ODS_FOCUS) != 0);
|
|
||||||
|
|
||||||
Rectangle( dis->hDC, rect.left, rect.top, rect.right, rect.bottom );
|
Rectangle( dis->hDC, rect.left, rect.top, rect.right, rect.bottom );
|
||||||
InsetRect( &rect, 1, 1 );
|
InsetRect( &rect, 1, 1 );
|
||||||
if ( hasFocus ) {
|
|
||||||
Rectangle( dis->hDC, rect.left, rect.top, rect.right, rect.bottom );
|
|
||||||
(void)SendMessage( cState->hDlg, DM_SETDEFID, dis->CtlID, 0 );
|
|
||||||
}
|
|
||||||
InsetRect( &rect, 1, 1 );
|
|
||||||
FillRect( dis->hDC, &rect, brush );
|
FillRect( dis->hDC, &rect, brush );
|
||||||
} /* ceDrawColorButton */
|
} /* ceDrawColorButton */
|
||||||
|
|
||||||
|
@ -415,8 +410,8 @@ ColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
state->inited = XP_TRUE;
|
state->inited = XP_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XP_LOGF( "%s: event=%s (%d); wParam=0x%x; lParam=0x%lx", */
|
/* XP_LOGF( "%s: event=%s (%d); wParam=0x%x; lParam=0x%lx", */
|
||||||
/* __func__, messageToStr(message), message, */
|
/* __func__, messageToStr(message), message, */
|
||||||
/* wParam, lParam ); */
|
/* wParam, lParam ); */
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
|
@ -425,11 +420,7 @@ ColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
ceDoDlgScroll( state->globals, hDlg, wParam );
|
ceDoDlgScroll( state->globals, hDlg, wParam );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_DRAWITEM: /* passed when button has BS_OWNERDRAW style */
|
case WM_DRAWITEM:
|
||||||
ceDoDlgFocusScroll( state->globals, hDlg,
|
|
||||||
/* Fake out ceDoDlgFocusScroll, passing ctrl itself */
|
|
||||||
(WPARAM)((DRAWITEMSTRUCT*)lParam)->hwndItem,
|
|
||||||
(LPARAM)TRUE );
|
|
||||||
ceDrawColorButton( state, (DRAWITEMSTRUCT*)lParam );
|
ceDrawColorButton( state, (DRAWITEMSTRUCT*)lParam );
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -114,64 +114,76 @@
|
||||||
#define PLAYER3_LABEL 1078
|
#define PLAYER3_LABEL 1078
|
||||||
#define PLAYER4_LABEL 1079
|
#define PLAYER4_LABEL 1079
|
||||||
|
|
||||||
|
#define DLBLTR_SAMPLE 1080
|
||||||
|
#define DBLWRD_SAMPLE 1081
|
||||||
|
#define TPLLTR_SAMPLE 1082
|
||||||
|
#define TPLWRD_SAMPLE 1083
|
||||||
|
#define EMPCELL_SAMPLE 1084
|
||||||
|
#define TBACK_SAMPLE 1085
|
||||||
|
#define FOCUSCLR_SAMPLE 1086
|
||||||
|
#define PLAYER1_SAMPLE 1087
|
||||||
|
#define PLAYER2_SAMPLE 1088
|
||||||
|
#define PLAYER3_SAMPLE 1089
|
||||||
|
#define PLAYER4_SAMPLE 1090
|
||||||
|
|
||||||
#define CLRSEL_LABEL_OFFSET (DLBLTR_LABEL-DLBLTR_BUTTON)
|
#define CLRSEL_LABEL_OFFSET (DLBLTR_LABEL-DLBLTR_BUTTON)
|
||||||
|
|
||||||
/* editor dlg: assumption is that the edit field's ID is one more
|
/* editor dlg: assumption is that the edit field's ID is one more
|
||||||
than the corresponding slider's */
|
than the corresponding slider's */
|
||||||
#ifdef MY_COLOR_SEL
|
#ifdef MY_COLOR_SEL
|
||||||
# define CLREDT_SLIDER1 1080
|
# define CLREDT_SLIDER1 1091
|
||||||
# define RED_EDIT 1081
|
# define RED_EDIT 1092
|
||||||
# define CLREDT_SLIDER2 1082
|
# define CLREDT_SLIDER2 1093
|
||||||
# define GREEN_EDIT 1083
|
# define GREEN_EDIT 1094
|
||||||
# define CLREDT_SLIDER3 1084
|
# define CLREDT_SLIDER3 1095
|
||||||
# define BLUE_EDIT 1085
|
# define BLUE_EDIT 1096
|
||||||
|
|
||||||
# define RED_LABEL 1086
|
# define RED_LABEL 1097
|
||||||
# define GREEN_LABEL 1087
|
# define GREEN_LABEL 1098
|
||||||
# define BLUE_LABEL 1088
|
# define BLUE_LABEL 1099
|
||||||
#endif // MY_COLOR_SEL
|
#endif // MY_COLOR_SEL
|
||||||
|
|
||||||
#define HC_MIN_COMBO 1089
|
#define HC_MIN_COMBO 1100
|
||||||
#define HC_MAX_COMBO 1090
|
#define HC_MAX_COMBO 1101
|
||||||
|
|
||||||
#define IDC_CCONVIA_LAB 1091
|
#define IDC_CCONVIA_LAB 1102
|
||||||
|
|
||||||
#define IDC_COOKIE_LAB 1092
|
#define IDC_COOKIE_LAB 1103
|
||||||
#ifdef XWFEATURE_RELAY
|
#ifdef XWFEATURE_RELAY
|
||||||
# define IDC_CRELAYNAME_LAB 1093
|
# define IDC_CRELAYNAME_LAB 1104
|
||||||
# define IDC_CRELAYPORT_LAB 1094
|
# define IDC_CRELAYPORT_LAB 1105
|
||||||
# define IDC_CRELAYHINT_LAB 1095
|
# define IDC_CRELAYHINT_LAB 1106
|
||||||
|
|
||||||
# define IDC_CONNECTCOMBO 1096
|
# define IDC_CONNECTCOMBO 1107
|
||||||
# define RELAYNAME_EDIT 1097
|
# define RELAYNAME_EDIT 1108
|
||||||
# define RELAYPORT_EDIT 1098
|
# define RELAYPORT_EDIT 1109
|
||||||
# define COOKIE_EDIT 1099
|
# define COOKIE_EDIT 1110
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IDC_BLUET_ADDR_LAB 1100
|
#define IDC_BLUET_ADDR_LAB 1111
|
||||||
#ifdef XWFEATURE_BLUETOOTH
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
# define IDC_BLUET_ADDR_EDIT 1101
|
# define IDC_BLUET_ADDR_EDIT 1112
|
||||||
# define IDC_BLUET_ADDR_BROWSE 1102
|
# define IDC_BLUET_ADDR_BROWSE 1113
|
||||||
#endif
|
#endif
|
||||||
#define IDS_UPDOWN 1103
|
#define IDS_UPDOWN 1114
|
||||||
#define IDC_NPLAYERSUPDOWN 1104
|
#define IDC_NPLAYERSUPDOWN 1115
|
||||||
#define IDC_PHONIESUPDOWN 1105
|
#define IDC_PHONIESUPDOWN 1116
|
||||||
#define IDC_SVGM_UPDOWN 1106
|
#define IDC_SVGM_UPDOWN 1117
|
||||||
|
|
||||||
|
|
||||||
#define IDC_SVGM_SELLAB 1109
|
#define IDC_SVGM_SELLAB 1118
|
||||||
#define IDC_SVGM_GAMELIST 1110
|
#define IDC_SVGM_GAMELIST 1119
|
||||||
/* Let's remove these until they're implemented */
|
/* Let's remove these until they're implemented */
|
||||||
/* #define IDC_SVGM_EDITLAB 1111 */
|
/* #define IDC_SVGM_EDITLAB 1111 */
|
||||||
/* #define IDC_SVGM_CHANGE 1112 */
|
/* #define IDC_SVGM_CHANGE 1112 */
|
||||||
/* #define IDC_SVGM_EDIT 1113 */
|
/* #define IDC_SVGM_EDIT 1113 */
|
||||||
/* #define IDC_SVGM_DUP 1114 */
|
/* #define IDC_SVGM_DUP 1114 */
|
||||||
/* #define IDC_SVGM_DEL 1115 */
|
/* #define IDC_SVGM_DEL 1115 */
|
||||||
#define IDC_SVGM_OPEN 1116
|
#define IDC_SVGM_OPEN 1120
|
||||||
|
|
||||||
#define IDC_SVGN_SELLAB 1117
|
#define IDC_SVGN_SELLAB 1121
|
||||||
#define IDC_SVGN_EDIT 1118
|
#define IDC_SVGN_EDIT 1122
|
||||||
|
|
||||||
|
|
||||||
#define ID_FILE_EXIT 40002
|
#define ID_FILE_EXIT 40002
|
||||||
|
@ -228,7 +240,7 @@
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 125
|
#define _APS_NEXT_RESOURCE_VALUE 125
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40029
|
#define _APS_NEXT_COMMAND_VALUE 40029
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1087
|
#define _APS_NEXT_CONTROL_VALUE 1123
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -622,7 +622,8 @@ END
|
||||||
#define CLR_WIDTH 114
|
#define CLR_WIDTH 114
|
||||||
#define CLR_OK_LEFT ((CLR_WIDTH/2)-10-REPOS_BUTTON_WIDTH)
|
#define CLR_OK_LEFT ((CLR_WIDTH/2)-10-REPOS_BUTTON_WIDTH)
|
||||||
#define CLR_CANCEL_LEFT ((CLR_WIDTH/2)+10)
|
#define CLR_CANCEL_LEFT ((CLR_WIDTH/2)+10)
|
||||||
#define CLR_LAB_WIDTH 50
|
#define CLR_LAB_WIDTH 45
|
||||||
|
#define CLR_SAMPLE_WIDTH 12
|
||||||
#define CLR_LAB_HT 12
|
#define CLR_LAB_HT 12
|
||||||
#define CLR_BUT_WIDTH 12
|
#define CLR_BUT_WIDTH 12
|
||||||
#define CLR_BUT_HT 10
|
#define CLR_BUT_HT 10
|
||||||
|
@ -657,9 +658,15 @@ END
|
||||||
|
|
||||||
#define COLOR_BUTTON(txt,id,xx,yy) \
|
#define COLOR_BUTTON(txt,id,xx,yy) \
|
||||||
LTEXT txt,id,xx,yy,CLR_LAB_WIDTH,CLR_LAB_HT
|
LTEXT txt,id,xx,yy,CLR_LAB_WIDTH,CLR_LAB_HT
|
||||||
#define COLOR_SAMPLE(id,xx,yy) \
|
/* Hack alert. Smartphone isn't delivering WM_COMMAND events for
|
||||||
PUSHBUTTON "",id,xx,yy,CLR_BUT_WIDTH,CLR_BUT_HT, \
|
clicks on BS_OWNERDRAW buttons, and WinMo (PPC and Smartphone)
|
||||||
BS_OWNERDRAW
|
won't deliver WM_DRAWITEM events for SS_OWNERDRAW static
|
||||||
|
controls. The solution: use an OWNERDRAW button as the color
|
||||||
|
sample (must disable it in code; WS_DISABLED doesn't work here)
|
||||||
|
and have a separate button to trigger the edit dialog. */
|
||||||
|
#define COLOR_SAMPLE(id1,id2,xx,yy) \
|
||||||
|
PUSHBUTTON "",id2,xx,yy,CLR_BUT_WIDTH,CLR_BUT_HT,BS_OWNERDRAW \
|
||||||
|
PUSHBUTTON "Edit",id1,xx+CLR_SAMPLE_WIDTH+4,yy,20,CLR_BUT_HT
|
||||||
|
|
||||||
IDD_COLORSDLG DIALOG DISCARDABLE 0, 20, CLR_WIDTH, COLORSDLG_HT
|
IDD_COLORSDLG DIALOG DISCARDABLE 0, 20, CLR_WIDTH, COLORSDLG_HT
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER | WS_VSCROLL
|
||||||
|
@ -667,29 +674,29 @@ CAPTION "Color preferences"
|
||||||
FONT 8, "System"
|
FONT 8, "System"
|
||||||
BEGIN
|
BEGIN
|
||||||
COLOR_BUTTON("Double letter:",DLBLTR_LABEL,CLR_COL_1,CLR_ROW_1)
|
COLOR_BUTTON("Double letter:",DLBLTR_LABEL,CLR_COL_1,CLR_ROW_1)
|
||||||
COLOR_SAMPLE(DLBLTR_BUTTON,CLR_COL_2,CLR_ROW_1)
|
COLOR_SAMPLE(DLBLTR_BUTTON,DLBLTR_SAMPLE,CLR_COL_2,CLR_ROW_1)
|
||||||
|
|
||||||
COLOR_BUTTON("Double word:",DBLWRD_LABEL,CLR_COL_1,CLR_ROW_2 )
|
COLOR_BUTTON("Double word:",DBLWRD_LABEL,CLR_COL_1,CLR_ROW_2 )
|
||||||
COLOR_SAMPLE(DBLWRD_BUTTON,CLR_COL_2,CLR_ROW_2)
|
COLOR_SAMPLE(DBLWRD_BUTTON,DBLWRD_SAMPLE,CLR_COL_2,CLR_ROW_2)
|
||||||
COLOR_BUTTON("Triple letter:",TPLLTR_LABEL,CLR_COL_1,CLR_ROW_3 )
|
COLOR_BUTTON("Triple letter:",TPLLTR_LABEL,CLR_COL_1,CLR_ROW_3 )
|
||||||
COLOR_SAMPLE(TPLLTR_BUTTON,CLR_COL_2,CLR_ROW_3)
|
COLOR_SAMPLE(TPLLTR_BUTTON,TPLLTR_SAMPLE,CLR_COL_2,CLR_ROW_3)
|
||||||
|
|
||||||
COLOR_BUTTON("Triple word:",TPLWRD_LABEL,CLR_COL_3,CLR_ROW_4)
|
COLOR_BUTTON("Triple word:",TPLWRD_LABEL,CLR_COL_3,CLR_ROW_4)
|
||||||
COLOR_SAMPLE(TPLWRD_BUTTON,CLR_COL_4,CLR_ROW_4)
|
COLOR_SAMPLE(TPLWRD_BUTTON,TPLWRD_SAMPLE,CLR_COL_4,CLR_ROW_4)
|
||||||
COLOR_BUTTON("Empty cell:",EMPCELL_LABEL,CLR_COL_1,CLR_ROW_5)
|
COLOR_BUTTON("Empty cell:",EMPCELL_LABEL,CLR_COL_1,CLR_ROW_5)
|
||||||
COLOR_SAMPLE(EMPCELL_BUTTON,CLR_COL_2,CLR_ROW_5)
|
COLOR_SAMPLE(EMPCELL_BUTTON,EMPCELL_SAMPLE,CLR_COL_2,CLR_ROW_5)
|
||||||
COLOR_BUTTON("Tile back:",TBACK_LABEL,CLR_COL_3,CLR_ROW_6)
|
COLOR_BUTTON("Tile back:",TBACK_LABEL,CLR_COL_3,CLR_ROW_6)
|
||||||
COLOR_SAMPLE(TBACK_BUTTON,CLR_COL_4,CLR_ROW_6)
|
COLOR_SAMPLE(TBACK_BUTTON,TBACK_SAMPLE,CLR_COL_4,CLR_ROW_6)
|
||||||
COLOR_BUTTON("Focus color:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_7)
|
COLOR_BUTTON("Focus color:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_7)
|
||||||
COLOR_SAMPLE(FOCUSCLR_BUTTON,CLR_COL_2,CLR_ROW_7)
|
COLOR_SAMPLE(FOCUSCLR_BUTTON,FOCUSCLR_SAMPLE,CLR_COL_2,CLR_ROW_7)
|
||||||
COLOR_BUTTON("Player 1:",PLAYER1_LABEL,CLR_COL_1,CLR_ROW_8)
|
COLOR_BUTTON("Player 1:",PLAYER1_LABEL,CLR_COL_1,CLR_ROW_8)
|
||||||
COLOR_SAMPLE(PLAYER1_BUTTON,CLR_COL_2,CLR_ROW_8)
|
COLOR_SAMPLE(PLAYER1_BUTTON,PLAYER1_SAMPLE,CLR_COL_2,CLR_ROW_8)
|
||||||
COLOR_BUTTON("Player 2:",PLAYER2_LABEL,CLR_COL_3,CLR_ROW_9)
|
COLOR_BUTTON("Player 2:",PLAYER2_LABEL,CLR_COL_3,CLR_ROW_9)
|
||||||
COLOR_SAMPLE(PLAYER2_BUTTON,CLR_COL_4,CLR_ROW_9)
|
COLOR_SAMPLE(PLAYER2_BUTTON,PLAYER2_SAMPLE,CLR_COL_4,CLR_ROW_9)
|
||||||
COLOR_BUTTON("Player 3:",PLAYER3_LABEL,CLR_COL_1,CLR_ROW_10)
|
COLOR_BUTTON("Player 3:",PLAYER3_LABEL,CLR_COL_1,CLR_ROW_10)
|
||||||
COLOR_SAMPLE(PLAYER3_BUTTON,CLR_COL_2,CLR_ROW_10)
|
COLOR_SAMPLE(PLAYER3_BUTTON,PLAYER3_SAMPLE,CLR_COL_2,CLR_ROW_10)
|
||||||
COLOR_BUTTON("Player 4:",PLAYER4_LABEL,CLR_COL_3,CLR_ROW_11)
|
COLOR_BUTTON("Player 4:",PLAYER4_LABEL,CLR_COL_3,CLR_ROW_11)
|
||||||
COLOR_SAMPLE(PLAYER4_BUTTON,CLR_COL_4,CLR_ROW_11)
|
COLOR_SAMPLE(PLAYER4_BUTTON,PLAYER4_SAMPLE,CLR_COL_4,CLR_ROW_11)
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
DEFPUSHBUTTON "OK",IDOK,CLR_OK_LEFT,CLR_BUTTON_ROW,
|
DEFPUSHBUTTON "OK",IDOK,CLR_OK_LEFT,CLR_BUTTON_ROW,
|
||||||
|
|
Loading…
Add table
Reference in a new issue