Previous 15994 Revisions Next

r756 Sunday 29th July, 2007 at 17:34:22 UTC by Nathan Woods
[Windows] Minor cleanups
[src/mess/osd/windows]dialog.c

src/mess/osd/windows/dialog.c
r755r756
105105};
106106
107107// this is the structure that gets associated with each input_seq edit box
108struct seqselect_stuff
108typedef struct _seqselect_info seqselect_info;
109struct _seqselect_info
109110{
110111   WNDPROC oldwndproc;
111112   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
113114   UINT_PTR timer;
114115   WORD pos;
115116   BOOL is_analog;
r755r756
10591060
10601061
10611062//============================================================
1063//   get_seqselect_info
1064//============================================================
1065
1066static 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//============================================================
10621076//   seqselect_settext
10631077//============================================================
10641078
10651079static void seqselect_settext(HWND editwnd)
10661080{
1067   struct seqselect_stuff *stuff;
1068   LONG_PTR lp;
1081   seqselect_info *stuff;
10691082   char buf[512];
10701083
1071   lp = GetWindowLongPtr(editwnd, GWLP_USERDATA);
1072   stuff = (struct seqselect_stuff *) lp;
1084   stuff = get_seqselect_info(editwnd);
10731085   input_seq_name(&stuff->newcode, buf, sizeof(buf) / sizeof(buf[0]));
10741086   win_set_window_text_utf8(editwnd, buf);
10751087
r755r756
10851097
10861098static void seqselect_read_from_main_thread(void *param)
10871099{
1088   struct seqselect_stuff *stuff;
1089   LONG_PTR lp;
1100   seqselect_info *stuff;
10901101   HWND editwnd;
10911102   int ret;
10921103
10931104   // get the basics
10941105   editwnd = (HWND) param;
1095   lp = GetWindowLongPtr(editwnd, GWLP_USERDATA);
1096   stuff = (struct seqselect_stuff *) lp;
1106   stuff = get_seqselect_info(editwnd);
10971107
10981108   // the Win32 OSD code thinks that we are paused, we need to temporarily
10991109   // unpause ourselves or else we will block
r755r756
11231133
11241134static INT_PTR CALLBACK seqselect_wndproc(HWND editwnd, UINT msg, WPARAM wparam, LPARAM lparam)
11251135{
1126   struct seqselect_stuff *stuff;
1136   seqselect_info *stuff;
11271137   INT_PTR result = 0;
1128   LONG_PTR lp;
11291138   BOOL call_baseclass = TRUE;
11301139
1131   lp = GetWindowLongPtr(editwnd, GWLP_USERDATA);
1132   stuff = (struct seqselect_stuff *) lp;
1140   stuff = get_seqselect_info(editwnd);
11331141
11341142   switch(msg) {
11351143   case WM_KEYDOWN:
r755r756
11911199
11921200static LRESULT seqselect_setup(dialog_box *dialog, HWND editwnd, UINT message, WPARAM wparam, LPARAM lparam)
11931201{
1194   struct seqselect_stuff *stuff = (struct seqselect_stuff *) lparam;
1202   seqselect_info *stuff = (seqselect_info *) lparam;
11951203   LONG_PTR lp;
11961204
11971205   memcpy(&stuff->newcode, stuff->code, sizeof(stuff->newcode));
r755r756
12101218
12111219static LRESULT seqselect_apply(dialog_box *dialog, HWND editwnd, UINT message, WPARAM wparam, LPARAM lparam)
12121220{
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);
12181223   memcpy(stuff->code, &stuff->newcode, sizeof(*(stuff->code)));
12191224   return 0;
12201225}
r755r756
12261231static int dialog_add_single_seqselect(struct _dialog_box *di, short x, short y,
12271232   short cx, short cy, input_port_entry *port, int is_analog, int seq)
12281233{
1229   struct seqselect_stuff *stuff;
1234   seqselect_info *stuff;
12301235   input_seq *code;
12311236
12321237   code = input_port_seq(port, seq);
r755r756
12341239   if (dialog_write_item(di, WS_CHILD | WS_VISIBLE | SS_ENDELLIPSIS | ES_CENTER | SS_SUNKEN,
12351240         x, y, cx, cy, NULL, DLGITEM_EDIT, NULL))
12361241      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));
12381243   if (!stuff)
12391244      return 1;
12401245   memset(stuff, 0, sizeof(*stuff));

Previous 15994 Revisions Next


© 1998-2018 The MESS Team