mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
Add name of color edited to title of color edited. Clean up names and constants in support.
This commit is contained in:
parent
a6575b1a2c
commit
dfe0249490
3 changed files with 47 additions and 25 deletions
|
@ -32,6 +32,8 @@ typedef struct ClrEditDlgState {
|
|||
CEAppGlobals* globals;
|
||||
|
||||
RECT clrRect;
|
||||
HWND parent;
|
||||
XP_U16 labelID;
|
||||
|
||||
XP_U8 r;
|
||||
XP_U8 b;
|
||||
|
@ -150,6 +152,17 @@ EditColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
|||
|
||||
ceStackButtonsRight( eState->globals, hDlg );
|
||||
|
||||
wchar_t label[32];
|
||||
XP_U16 len = SendDlgItemMessage( eState->parent, eState->labelID,
|
||||
WM_GETTEXT, VSIZE(label),
|
||||
(long)label );
|
||||
if ( len > 0 ) {
|
||||
label[len-1] = 0; /* hack: overwrite ':' */
|
||||
}
|
||||
wchar_t buf[64];
|
||||
swprintf( buf, L"Edit color for %s", label );
|
||||
SendMessage( hDlg, WM_SETTEXT, 0, buf );
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
eState = (ClrEditDlgState*)GetWindowLong( hDlg, GWL_USERDATA );
|
||||
|
@ -215,7 +228,8 @@ EditColorsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
|||
} /* EditColorsDlg */
|
||||
|
||||
static XP_Bool
|
||||
myChooseColor( CEAppGlobals* globals, HWND hwnd, COLORREF* cref )
|
||||
myChooseColor( CEAppGlobals* globals, HWND parent, XP_U16 labelID,
|
||||
COLORREF* cref )
|
||||
{
|
||||
ClrEditDlgState state;
|
||||
int result;
|
||||
|
@ -225,11 +239,13 @@ myChooseColor( CEAppGlobals* globals, HWND hwnd, COLORREF* cref )
|
|||
state.r = GetRValue(*cref);
|
||||
state.g = GetGValue(*cref);
|
||||
state.b = GetBValue(*cref);
|
||||
state.labelID = labelID;
|
||||
state.parent = parent;
|
||||
|
||||
XP_LOGF( "setting up IDD_COLOREDITDLG" );
|
||||
|
||||
result = DialogBoxParam( globals->hInst, (LPCTSTR)IDD_COLOREDITDLG, hwnd,
|
||||
(DLGPROC)EditColorsDlg, (long)&state );
|
||||
result = DialogBoxParam( globals->hInst, (LPCTSTR)IDD_COLOREDITDLG,
|
||||
parent, (DLGPROC)EditColorsDlg, (long)&state );
|
||||
|
||||
XP_LOGF( "DialogBoxParam=>%d", result );
|
||||
|
||||
|
@ -295,14 +311,15 @@ deleteButtonBrushes( ColorsDlgState* cState )
|
|||
} /* deleteButtonBrushes */
|
||||
|
||||
static void
|
||||
wrapChooseColor( ColorsDlgState* cState, HWND owner, XP_U16 button )
|
||||
wrapChooseColor( ColorsDlgState* cState, HWND parent, XP_U16 button )
|
||||
{
|
||||
XP_U16 index = button-FIRST_BUTTON;
|
||||
XP_U16 labelID = button + CLRSEL_LABEL_OFFSET;
|
||||
|
||||
#ifdef MY_COLOR_SEL
|
||||
COLORREF clrref = cState->colors[index];
|
||||
|
||||
if ( myChooseColor( cState->globals, owner, &clrref ) ) {
|
||||
if ( myChooseColor( cState->globals, parent, labelID, &clrref ) ) {
|
||||
cState->colors[index] = clrref;
|
||||
DeleteObject( cState->brushes[index] );
|
||||
cState->brushes[index] = CreateSolidBrush( clrref );
|
||||
|
@ -323,7 +340,7 @@ wrapChooseColor( ColorsDlgState* cState, HWND owner, XP_U16 button )
|
|||
}
|
||||
|
||||
ccs.lStructSize = sizeof(ccs);
|
||||
ccs.hwndOwner = owner;
|
||||
ccs.hwndOwner = parent;
|
||||
ccs.rgbResult = cState->colors[index];
|
||||
ccs.lpCustColors = arr;
|
||||
|
||||
|
|
|
@ -88,28 +88,33 @@
|
|||
# define IDC_CHECKHINTSLIMITS 1057
|
||||
#endif
|
||||
|
||||
/* buttons and lables must be parallel arrays so CLRSEL_LABEL_OFFSET
|
||||
works. */
|
||||
#define DLBLTR_BUTTON 1058
|
||||
#define DBLWRD_BUTTON 1059
|
||||
#define TPLLTR_BUTTON 1060
|
||||
#define TPLWRD_BUTTON 1061
|
||||
#define EMPCELL_BUTTON 1062
|
||||
#define TBACK_BUTTON 1063
|
||||
#define FOCUS_BUTTON 1064
|
||||
#define FOCUSCLR_BUTTON 1064
|
||||
#define PLAYER1_BUTTON 1065
|
||||
#define PLAYER2_BUTTON 1066
|
||||
#define PLAYER3_BUTTON 1067
|
||||
#define PLAYER4_BUTTON 1068
|
||||
#define PLAYER1_LABEL 1069
|
||||
#define PLAYER2_LABEL 1070
|
||||
#define PLAYER3_LABEL 1071
|
||||
#define PLAYER4_LABEL 1072
|
||||
#define DLBLTR_LABEL 1073
|
||||
#define DBLWRD_LABEL 1074
|
||||
#define TPLLTR_LABEL 1075
|
||||
#define TPLWRD_LABEL 1076
|
||||
#define EMPTYCELL_LABEL 1077
|
||||
#define TILEBACK_LABEL 1078
|
||||
#define FOCUSCLR_LABEL 1079
|
||||
|
||||
#define DLBLTR_LABEL 1069
|
||||
#define DBLWRD_LABEL 1070
|
||||
#define TPLLTR_LABEL 1071
|
||||
#define TPLWRD_LABEL 1072
|
||||
#define EMPCELL_LABEL 1073
|
||||
#define TBACK_LABEL 1074
|
||||
#define FOCUSCLR_LABEL 1075
|
||||
#define PLAYER1_LABEL 1076
|
||||
#define PLAYER2_LABEL 1077
|
||||
#define PLAYER3_LABEL 1078
|
||||
#define PLAYER4_LABEL 1079
|
||||
|
||||
#define CLRSEL_LABEL_OFFSET (DLBLTR_LABEL-DLBLTR_BUTTON)
|
||||
|
||||
/* editor dlg: assumption is that the edit field's ID is one more
|
||||
than the corresponding slider's */
|
||||
|
|
|
@ -531,19 +531,19 @@ BEGIN
|
|||
PUSHBUTTON "",TPLWRD_BUTTON,CLR_COL_4,CLR_ROW_2,CLR_BUT_WIDTH,
|
||||
CLR_BUT_HT,BS_OWNERDRAW
|
||||
|
||||
LTEXT "Empty cell:",EMPTYCELL_LABEL,CLR_COL_1,CLR_ROW_3,
|
||||
LTEXT "Empty cell:",EMPCELL_LABEL,CLR_COL_1,CLR_ROW_3,
|
||||
CLR_LAB_WIDTH,CLR_LAB_HT
|
||||
PUSHBUTTON "",EMPCELL_BUTTON,CLR_COL_2,CLR_ROW_3,CLR_BUT_WIDTH,
|
||||
CLR_BUT_HT,BS_OWNERDRAW
|
||||
|
||||
LTEXT "Tile bkgnd:",TILEBACK_LABEL,CLR_COL_3,CLR_ROW_3,
|
||||
LTEXT "Tile bkgnd:",TBACK_LABEL,CLR_COL_3,CLR_ROW_3,
|
||||
CLR_LAB_WIDTH,CLR_LAB_HT
|
||||
PUSHBUTTON "",TBACK_BUTTON,CLR_COL_4,CLR_ROW_3,CLR_BUT_WIDTH,
|
||||
CLR_BUT_HT,BS_OWNERDRAW
|
||||
|
||||
LTEXT "Focus color:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_4,
|
||||
CLR_LAB_WIDTH,CLR_LAB_HT
|
||||
PUSHBUTTON "",FOCUS_BUTTON,CLR_COL_2,CLR_ROW_4,CLR_BUT_WIDTH,
|
||||
PUSHBUTTON "",FOCUSCLR_BUTTON,CLR_COL_2,CLR_ROW_4,CLR_BUT_WIDTH,
|
||||
CLR_BUT_HT,BS_OWNERDRAW
|
||||
|
||||
LTEXT "Player 1:",PLAYER1_LABEL,CLR_COL_1,CLR_ROW_5,
|
||||
|
@ -592,14 +592,14 @@ END
|
|||
|
||||
IDD_COLOREDITDLG DIALOG DISCARDABLE 0, 0, CLRE_WIDTH, 72
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | DS_CENTER
|
||||
CAPTION "Edit color"
|
||||
CAPTION "" /* set by code */
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
LTEXT "Red:",RED_LABEL,CLRELABEL_COL,CLREDIT_ROW_1,
|
||||
CLRE_LAB_WIDTH,CLRE_LAB_HT
|
||||
EDITTEXT RED_EDIT,CLREEDIT_COL,CLREDIT_ROW_1,18,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "foo",CLREDT_SLIDER1,"msctls_trackbar32",
|
||||
CONTROL "",CLREDT_SLIDER1,"msctls_trackbar32",
|
||||
TBS_BOTH|TBS_NOTICKS|WS_TABSTOP,
|
||||
CLRESLIDER_COL,CLREDIT_ROW_1,SLIDER_WIDTH,15
|
||||
|
||||
|
@ -607,7 +607,7 @@ BEGIN
|
|||
CLRE_LAB_WIDTH,CLRE_LAB_HT
|
||||
EDITTEXT GREEN_EDIT,CLREEDIT_COL,CLREDIT_ROW_2,18,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "foo",CLREDT_SLIDER2,"msctls_trackbar32",
|
||||
CONTROL "",CLREDT_SLIDER2,"msctls_trackbar32",
|
||||
TBS_BOTH|TBS_NOTICKS|WS_TABSTOP,
|
||||
CLRESLIDER_COL,CLREDIT_ROW_2,SLIDER_WIDTH,15
|
||||
|
||||
|
@ -615,7 +615,7 @@ BEGIN
|
|||
CLRE_LAB_WIDTH,CLRE_LAB_HT
|
||||
EDITTEXT BLUE_EDIT,CLREEDIT_COL,CLREDIT_ROW_3,18,12,
|
||||
ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "foo",CLREDT_SLIDER3,"msctls_trackbar32",
|
||||
CONTROL "",CLREDT_SLIDER3,"msctls_trackbar32",
|
||||
TBS_BOTH|TBS_NOTICKS|WS_TABSTOP,
|
||||
CLRESLIDER_COL,CLREDIT_ROW_3,SLIDER_WIDTH,15
|
||||
|
||||
|
|
Loading…
Reference in a new issue