src/mess/osd/windows/dialog.c
| r755 | r756 | |
| 105 | 105 | }; |
| 106 | 106 | |
| 107 | 107 | // this is the structure that gets associated with each input_seq edit box |
| 108 | | struct seqselect_stuff |
| 108 | typedef struct _seqselect_info seqselect_info; |
| 109 | struct _seqselect_info |
| 109 | 110 | { |
| 110 | 111 | WNDPROC oldwndproc; |
| 111 | 112 | input_seq *code; // pointer to the input_seq |
| 112 | | input_seq newcode; // the new input_seq; committed to *code when we are done |
| 113 | input_seq newcode; // the new input_seq; committed to *code when we are done |
| 113 | 114 | UINT_PTR timer; |
| 114 | 115 | WORD pos; |
| 115 | 116 | BOOL is_analog; |
| r755 | r756 | |
| 1059 | 1060 | |
| 1060 | 1061 | |
| 1061 | 1062 | //============================================================ |
| 1063 | // get_seqselect_info |
| 1064 | //============================================================ |
| 1065 | |
| 1066 | static seqselect_info *get_seqselect_info(HWND editwnd) |
| 1067 | { |
| 1068 | LONG_PTR lp; |
| 1069 | lp = GetWindowLongPtr(editwnd, GWLP_USERDATA); |
| 1070 | return (seqselect_info *) lp; |
| 1071 | } |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | //============================================================ |
| 1062 | 1076 | // seqselect_settext |
| 1063 | 1077 | //============================================================ |
| 1064 | 1078 | |
| 1065 | 1079 | static void seqselect_settext(HWND editwnd) |
| 1066 | 1080 | { |
| 1067 | | struct seqselect_stuff *stuff; |
| 1068 | | LONG_PTR lp; |
| 1081 | seqselect_info *stuff; |
| 1069 | 1082 | char buf[512]; |
| 1070 | 1083 | |
| 1071 | | lp = GetWindowLongPtr(editwnd, GWLP_USERDATA); |
| 1072 | | stuff = (struct seqselect_stuff *) lp; |
| 1084 | stuff = get_seqselect_info(editwnd); |
| 1073 | 1085 | input_seq_name(&stuff->newcode, buf, sizeof(buf) / sizeof(buf[0])); |
| 1074 | 1086 | win_set_window_text_utf8(editwnd, buf); |
| 1075 | 1087 | |
| r755 | r756 | |
| 1085 | 1097 | |
| 1086 | 1098 | static void seqselect_read_from_main_thread(void *param) |
| 1087 | 1099 | { |
| 1088 | | struct seqselect_stuff *stuff; |
| 1089 | | LONG_PTR lp; |
| 1100 | seqselect_info *stuff; |
| 1090 | 1101 | HWND editwnd; |
| 1091 | 1102 | int ret; |
| 1092 | 1103 | |
| 1093 | 1104 | // get the basics |
| 1094 | 1105 | editwnd = (HWND) param; |
| 1095 | | lp = GetWindowLongPtr(editwnd, GWLP_USERDATA); |
| 1096 | | stuff = (struct seqselect_stuff *) lp; |
| 1106 | stuff = get_seqselect_info(editwnd); |
| 1097 | 1107 | |
| 1098 | 1108 | // the Win32 OSD code thinks that we are paused, we need to temporarily |
| 1099 | 1109 | // unpause ourselves or else we will block |
| r755 | r756 | |
| 1123 | 1133 | |
| 1124 | 1134 | static INT_PTR CALLBACK seqselect_wndproc(HWND editwnd, UINT msg, WPARAM wparam, LPARAM lparam) |
| 1125 | 1135 | { |
| 1126 | | struct seqselect_stuff *stuff; |
| 1136 | seqselect_info *stuff; |
| 1127 | 1137 | INT_PTR result = 0; |
| 1128 | | LONG_PTR lp; |
| 1129 | 1138 | BOOL call_baseclass = TRUE; |
| 1130 | 1139 | |
| 1131 | | lp = GetWindowLongPtr(editwnd, GWLP_USERDATA); |
| 1132 | | stuff = (struct seqselect_stuff *) lp; |
| 1140 | stuff = get_seqselect_info(editwnd); |
| 1133 | 1141 | |
| 1134 | 1142 | switch(msg) { |
| 1135 | 1143 | case WM_KEYDOWN: |
| r755 | r756 | |
| 1191 | 1199 | |
| 1192 | 1200 | static LRESULT seqselect_setup(dialog_box *dialog, HWND editwnd, UINT message, WPARAM wparam, LPARAM lparam) |
| 1193 | 1201 | { |
| 1194 | | struct seqselect_stuff *stuff = (struct seqselect_stuff *) lparam; |
| 1202 | seqselect_info *stuff = (seqselect_info *) lparam; |
| 1195 | 1203 | LONG_PTR lp; |
| 1196 | 1204 | |
| 1197 | 1205 | memcpy(&stuff->newcode, stuff->code, sizeof(stuff->newcode)); |
| r755 | r756 | |
| 1210 | 1218 | |
| 1211 | 1219 | static LRESULT seqselect_apply(dialog_box *dialog, HWND editwnd, UINT message, WPARAM wparam, LPARAM lparam) |
| 1212 | 1220 | { |
| 1213 | | struct seqselect_stuff *stuff; |
| 1214 | | LONG_PTR lp; |
| 1215 | | |
| 1216 | | lp = GetWindowLongPtr(editwnd, GWLP_USERDATA); |
| 1217 | | stuff = (struct seqselect_stuff *) lp; |
| 1221 | seqselect_info *stuff; |
| 1222 | stuff = get_seqselect_info(editwnd); |
| 1218 | 1223 | memcpy(stuff->code, &stuff->newcode, sizeof(*(stuff->code))); |
| 1219 | 1224 | return 0; |
| 1220 | 1225 | } |
| r755 | r756 | |
| 1226 | 1231 | static int dialog_add_single_seqselect(struct _dialog_box *di, short x, short y, |
| 1227 | 1232 | short cx, short cy, input_port_entry *port, int is_analog, int seq) |
| 1228 | 1233 | { |
| 1229 | | struct seqselect_stuff *stuff; |
| 1234 | seqselect_info *stuff; |
| 1230 | 1235 | input_seq *code; |
| 1231 | 1236 | |
| 1232 | 1237 | code = input_port_seq(port, seq); |
| r755 | r756 | |
| 1234 | 1239 | if (dialog_write_item(di, WS_CHILD | WS_VISIBLE | SS_ENDELLIPSIS | ES_CENTER | SS_SUNKEN, |
| 1235 | 1240 | x, y, cx, cy, NULL, DLGITEM_EDIT, NULL)) |
| 1236 | 1241 | return 1; |
| 1237 | | stuff = (struct seqselect_stuff *) pool_malloc(di->mempool, sizeof(struct seqselect_stuff)); |
| 1242 | stuff = (seqselect_info *) pool_malloc(di->mempool, sizeof(seqselect_info)); |
| 1238 | 1243 | if (!stuff) |
| 1239 | 1244 | return 1; |
| 1240 | 1245 | memset(stuff, 0, sizeof(*stuff)); |