Mercurial > hg > xemacs-beta
comparison src/toolbar-msw.c @ 380:8626e4521993 r21-2-5
Import from CVS: tag r21-2-5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:07:10 +0200 |
parents | 70ad99077275 |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
379:76b7d63099ad | 380:8626e4521993 |
---|---|
85 enum toolbar_pos pos) | 85 enum toolbar_pos pos) |
86 { | 86 { |
87 /* hmm what do we generate an id based on */ | 87 /* hmm what do we generate an id based on */ |
88 int id = TOOLBAR_ITEM_ID_BITS (internal_hash (button->callback, 0)); | 88 int id = TOOLBAR_ITEM_ID_BITS (internal_hash (button->callback, 0)); |
89 while (!NILP (Fgethash (make_int (id), | 89 while (!NILP (Fgethash (make_int (id), |
90 FRAME_MSWINDOWS_TOOLBAR_HASHTABLE (f), Qnil))) | 90 FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE (f), Qnil))) |
91 { | 91 { |
92 id = TOOLBAR_ITEM_ID_BITS (id + 1); | 92 id = TOOLBAR_ITEM_ID_BITS (id + 1); |
93 } | 93 } |
94 return id; | 94 return id; |
95 } | 95 } |
103 HWND toolbarwnd = TOOLBAR_HANDLE(f, pos); | 103 HWND toolbarwnd = TOOLBAR_HANDLE(f, pos); |
104 if (toolbarwnd) | 104 if (toolbarwnd) |
105 { | 105 { |
106 TBBUTTON info; | 106 TBBUTTON info; |
107 | 107 |
108 /* delete the buttons and remove the command from the hashtable*/ | 108 /* Delete the buttons and remove the command from the hash table*/ |
109 i = SendMessage (toolbarwnd, TB_BUTTONCOUNT, 0, 0); | 109 i = SendMessage (toolbarwnd, TB_BUTTONCOUNT, 0, 0); |
110 for (i--; i >= 0; i--) | 110 for (i--; i >= 0; i--) |
111 { | 111 { |
112 SendMessage (toolbarwnd, TB_GETBUTTON, (WPARAM)i, | 112 SendMessage (toolbarwnd, TB_GETBUTTON, (WPARAM)i, |
113 (LPARAM)&info); | 113 (LPARAM)&info); |
114 Fremhash(make_int(info.idCommand), | 114 Fremhash(make_int(info.idCommand), |
115 FRAME_MSWINDOWS_TOOLBAR_HASHTABLE(f)); | 115 FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE(f)); |
116 SendMessage (toolbarwnd, TB_DELETEBUTTON, (WPARAM)i, 0); | 116 SendMessage (toolbarwnd, TB_DELETEBUTTON, (WPARAM)i, 0); |
117 } | 117 } |
118 | 118 |
119 /* finally get rid of the image list assuming it clears up its | 119 /* finally get rid of the image list assuming it clears up its |
120 bitmaps */ | 120 bitmaps */ |
260 { | 260 { |
261 struct Lisp_Image_Instance* p = XIMAGE_INSTANCE (instance); | 261 struct Lisp_Image_Instance* p = XIMAGE_INSTANCE (instance); |
262 | 262 |
263 if (IMAGE_INSTANCE_PIXMAP_TYPE_P (p)) | 263 if (IMAGE_INSTANCE_PIXMAP_TYPE_P (p)) |
264 { | 264 { |
265 /* we are going to honour the toolbar settings | 265 /* we are going to honor the toolbar settings |
266 and resize the bitmaps accordingly if they are | 266 and resize the bitmaps accordingly if they are |
267 too big. If they are too small we leave them | 267 too big. If they are too small we leave them |
268 and pad the difference - unless a different size | 268 and pad the difference - unless a different size |
269 crops up in the middle, at which point we *have* | 269 crops up in the middle, at which point we *have* |
270 to resize since the ImageList won't cope.*/ | 270 to resize since the ImageList won't cope.*/ |
291 if (! (bitmap = mswindows_create_resized_bitmap | 291 if (! (bitmap = mswindows_create_resized_bitmap |
292 (p, f, bmwidth, bmheight))) | 292 (p, f, bmwidth, bmheight))) |
293 { | 293 { |
294 xfree (button_tbl); | 294 xfree (button_tbl); |
295 if (ilist) ImageList_Destroy (ilist); | 295 if (ilist) ImageList_Destroy (ilist); |
296 signal_simple_error ("couldn't resize pixmap", | 296 signal_simple_error ("Couldn't resize pixmap", |
297 instance); | 297 instance); |
298 } | 298 } |
299 /* we don't care if the mask fails */ | 299 /* we don't care if the mask fails */ |
300 mask = mswindows_create_resized_mask | 300 mask = mswindows_create_resized_mask |
301 (p, f, bmwidth, bmheight); | 301 (p, f, bmwidth, bmheight); |
314 (IMAGE_INSTANCE_MSWINDOWS_MASK (p) | 314 (IMAGE_INSTANCE_MSWINDOWS_MASK (p) |
315 ? ILC_MASK : 0) | ILC_COLOR24, | 315 ? ILC_MASK : 0) | ILC_COLOR24, |
316 nbuttons, nbuttons * 2 ))) | 316 nbuttons, nbuttons * 2 ))) |
317 { | 317 { |
318 xfree (button_tbl); | 318 xfree (button_tbl); |
319 signal_simple_error ("couldn't create image list", | 319 signal_simple_error ("Couldn't create image list", |
320 instance); | 320 instance); |
321 } | 321 } |
322 | 322 |
323 /* make the mask actually do something */ | 323 /* make the mask actually do something */ |
324 ImageList_SetBkColor (ilist, CLR_NONE); | 324 ImageList_SetBkColor (ilist, CLR_NONE); |
341 DeleteObject (mask); | 341 DeleteObject (mask); |
342 } | 342 } |
343 } | 343 } |
344 | 344 |
345 Fputhash (make_int (tbbutton->idCommand), | 345 Fputhash (make_int (tbbutton->idCommand), |
346 button, FRAME_MSWINDOWS_TOOLBAR_HASHTABLE (f)); | 346 button, FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE (f)); |
347 } | 347 } |
348 | 348 |
349 /* now fix up the button size */ | 349 /* now fix up the button size */ |
350 tb->x = x; | 350 tb->x = x; |
351 tb->y = y; | 351 tb->y = y; |
580 | 580 |
581 Lisp_Object | 581 Lisp_Object |
582 mswindows_get_toolbar_button_text ( struct frame* f, int command_id ) | 582 mswindows_get_toolbar_button_text ( struct frame* f, int command_id ) |
583 { | 583 { |
584 Lisp_Object button = Fgethash (make_int (command_id), | 584 Lisp_Object button = Fgethash (make_int (command_id), |
585 FRAME_MSWINDOWS_TOOLBAR_HASHTABLE (f), Qnil); | 585 FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE (f), Qnil); |
586 | 586 |
587 if (!NILP (button)) | 587 if (!NILP (button)) |
588 { | 588 { |
589 struct toolbar_button *tb = XTOOLBAR_BUTTON (button); | 589 struct toolbar_button *tb = XTOOLBAR_BUTTON (button); |
590 return tb->help_string; | 590 return tb->help_string; |
603 { | 603 { |
604 /* Try to map the command id through the proper hash table */ | 604 /* Try to map the command id through the proper hash table */ |
605 Lisp_Object button, data, fn, arg, frame; | 605 Lisp_Object button, data, fn, arg, frame; |
606 | 606 |
607 button = Fgethash (make_int (id), | 607 button = Fgethash (make_int (id), |
608 FRAME_MSWINDOWS_TOOLBAR_HASHTABLE (f), Qnil); | 608 FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE (f), Qnil); |
609 | 609 |
610 if (NILP (button)) | 610 if (NILP (button)) |
611 return Qnil; | 611 return Qnil; |
612 | 612 |
613 data = XTOOLBAR_BUTTON (button)->callback; | 613 data = XTOOLBAR_BUTTON (button)->callback; |