Rev 140 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 140 | Rev 193 | ||
---|---|---|---|
Line 59... | Line 59... | ||
59 | // message handler for the dialog box |
59 | // message handler for the dialog box |
60 | 60 | ||
61 | unsigned short wParam_hiword; |
61 | unsigned short wParam_hiword; |
62 | unsigned short wParam_loword; |
62 | unsigned short wParam_loword; |
63 | HWND hComboBoxWnd; |
63 | HWND hComboBoxWnd; |
- | 64 | int selected_index; |
|
64 | int theme_index; |
65 | int theme_index; |
65 | 66 | ||
66 | // filter out the commonly used message values |
67 | // filter out the commonly used message values |
67 | wParam_hiword = HIWORD (wParam); |
68 | wParam_hiword = HIWORD (wParam); |
68 | wParam_loword = LOWORD (wParam); |
69 | wParam_loword = LOWORD (wParam); |
Line 91... | Line 92... | ||
91 | hComboBoxWnd = GetDlgItem (hWnd, COMBOBOX_THEMES); |
92 | hComboBoxWnd = GetDlgItem (hWnd, COMBOBOX_THEMES); |
92 | 93 | ||
93 | // populate the themes combo box |
94 | // populate the themes combo box |
94 | ComboBox_ResetContent (hComboBoxWnd); |
95 | ComboBox_ResetContent (hComboBoxWnd); |
95 | for (theme_index = 0; theme_index < theme_count; theme_index++) |
96 | for (theme_index = 0; theme_index < theme_count; theme_index++) |
- | 97 | { |
|
96 | ComboBox_AddString (hComboBoxWnd, themes[theme_index].name); |
98 | selected_index = ComboBox_AddString (hComboBoxWnd, themes[theme_index].name); |
97 | - | ||
98 | // cycle through all the themes now... |
- | |
99 |
|
99 | ComboBox_SetItemData (hComboBoxWnd, selected_index, theme_index); // save the theme index along with its name in the combo box |
100 | if (_wcsicmp (themes[theme_index].name, theme->name) == 0) |
100 | if (_wcsicmp (themes[theme_index].name, theme->name) == 0) |
101 | { |
- | |
102 | ComboBox_SetCurSel (hComboBoxWnd, |
101 | ComboBox_SetCurSel (hComboBoxWnd, selected_index); // put the user selection back on the fly |
103 | break; // and stop searching as soon as we've found it again |
- | |
104 |
|
102 | } |
105 | 103 | ||
106 | // initialize the checkboxes |
104 | // initialize the checkboxes |
107 | Button_SetCheck (GetDlgItem (hWnd, CHECKBOX_CHANGEAPPEARANCE_SHOWGRID), (want_grid ? BST_CHECKED : BST_UNCHECKED)); |
105 | Button_SetCheck (GetDlgItem (hWnd, CHECKBOX_CHANGEAPPEARANCE_SHOWGRID), (want_grid ? BST_CHECKED : BST_UNCHECKED)); |
108 | Button_SetCheck (GetDlgItem (hWnd, CHECKBOX_CHANGEAPPEARANCE_SHOWICONSRATHER), (want_flaticons ? BST_CHECKED : BST_UNCHECKED)); |
106 | Button_SetCheck (GetDlgItem (hWnd, CHECKBOX_CHANGEAPPEARANCE_SHOWICONSRATHER), (want_flaticons ? BST_CHECKED : BST_UNCHECKED)); |
109 | Button_SetCheck (GetDlgItem (hWnd, CHECKBOX_CHANGEAPPEARANCE_CUSTOMBACKGROUND), (want_custombackground ? BST_CHECKED : BST_UNCHECKED)); |
107 | Button_SetCheck (GetDlgItem (hWnd, CHECKBOX_CHANGEAPPEARANCE_CUSTOMBACKGROUND), (want_custombackground ? BST_CHECKED : BST_UNCHECKED)); |
Line 124... | Line 122... | ||
124 | EndDialog (hWnd, 0); // close the dialog box |
122 | EndDialog (hWnd, 0); // close the dialog box |
125 | 123 | ||
126 | // else given the control that's clicked, update the relevant skin |
124 | // else given the control that's clicked, update the relevant skin |
127 | else if ((wParam_loword == COMBOBOX_THEMES) && (wParam_hiword == CBN_SELCHANGE)) |
125 | else if ((wParam_loword == COMBOBOX_THEMES) && (wParam_hiword == CBN_SELCHANGE)) |
128 | { |
126 | { |
- | 127 | // get a quick access to the themes combo box |
|
129 |
|
128 | hComboBoxWnd = GetDlgItem (hWnd, COMBOBOX_THEMES); |
- | 129 | ||
- | 130 | selected_index = ComboBox_GetCurSel (hComboBoxWnd); // as the combo box is sorted, the selected index is NOT the theme index |
|
130 | if (( |
131 | if ((selected_index >= 0) && (selected_index < theme_count)) |
131 | { |
132 | { |
- | 133 | theme_index = ComboBox_GetItemData (hComboBoxWnd, selected_index); // retrieve the actual theme index from the combo box's user data |
|
132 | while (!themes[theme_index].is_loaded) |
134 | while (!themes[theme_index].is_loaded) |
133 | Sleep (100); // wait until theme is fully loaded |
135 | Sleep (100); // wait until theme is fully loaded |
134 | theme = &themes[theme_index]; // update the selected theme (WARNING: race condition ?) |
136 | theme = &themes[theme_index]; // update the selected theme (WARNING: race condition ?) |
135 | 137 | ||
136 | // update the theme info text |
138 | // update the theme info text |