home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.238 < prev    next >
Encoding:
Internet Message Format  |  2002-10-26  |  6.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.238 (extra)
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.238 (extra)
  11. Problem:    Win32: The "icon=" argument for the ":menu" command does not
  12.         search for the bitmap file.
  13. Solution:   Expand environment variables and search for the bitmap file.
  14.         (Vince Negri)
  15.         Make it consistent, use the same mechanism for X11 and GTK.
  16. Files:        src/gui.c src/gui_gtk.c, src/gui_w32.c, src/gui_x11.c,
  17.         src/proto/gui.pro
  18.  
  19.  
  20. *** ../vim61.237/src/gui.c    Fri Sep 27 20:44:09 2002
  21. --- src/gui.c    Sun Oct 20 22:57:29 2002
  22. ***************
  23. *** 3991,3996 ****
  24. --- 3997,4022 ----
  25.       if (do_in_runtimepath(buffer, FALSE, gfp_setname) == FAIL || *buffer == NUL)
  26.       return FAIL;
  27.       return OK;
  28. + }
  29. + /*
  30. +  * Given the name of the "icon=" argument, try finding the bitmap file for the
  31. +  * icon.  If it is an absolute path name, use it as it is.  Otherwise append
  32. +  * "ext" and search for it in 'runtimepath'.
  33. +  * The result is put in "buffer[MAXPATHL]".  If something fails "buffer"
  34. +  * contains "name".
  35. +  */
  36. +     void
  37. + gui_find_iconfile(name, buffer, ext)
  38. +     char_u    *name;
  39. +     char_u    *buffer;
  40. +     char    *ext;
  41. + {
  42. +     char_u    buf[MAXPATHL + 1];
  43. +     expand_env(name, buffer, MAXPATHL);
  44. +     if (!mch_isFullName(buffer) && gui_find_bitmap(buffer, buf, ext) == OK)
  45. +     STRCPY(buffer, buf);
  46.   }
  47.   #endif
  48.   
  49. *** ../vim61.237/src/gui_gtk.c    Wed May  1 21:20:47 2002
  50. --- src/gui_gtk.c    Sun Oct 20 16:35:09 2002
  51. ***************
  52. *** 403,422 ****
  53.   }
  54.   
  55.   /*
  56. !  * Creates a pixmap by using the pixmap "file".
  57.    */
  58.       static void
  59. ! pixmap_create_from_file(char_u *file, GdkPixmap **pixmap, GdkBitmap **mask)
  60.   {
  61. -     char_u full_pathname[MAXPATHL + 1];
  62. -     expand_env(file, full_pathname, MAXPATHL);
  63.       *pixmap = gdk_pixmap_colormap_create_from_xpm(
  64.           NULL,
  65.           gtk_widget_get_colormap(gui.mainwin),
  66.           mask,
  67.           &gui.mainwin->style->bg[GTK_STATE_NORMAL],
  68. !         (const char *)full_pathname);
  69.   }
  70.   #endif
  71.   
  72. --- 403,419 ----
  73.   }
  74.   
  75.   /*
  76. !  * Creates a pixmap by using the pixmap "fname".
  77.    */
  78.       static void
  79. ! pixmap_create_from_file(char_u *fname, GdkPixmap **pixmap, GdkBitmap **mask)
  80.   {
  81.       *pixmap = gdk_pixmap_colormap_create_from_xpm(
  82.           NULL,
  83.           gtk_widget_get_colormap(gui.mainwin),
  84.           mask,
  85.           &gui.mainwin->style->bg[GTK_STATE_NORMAL],
  86. !         (const char *)fname);
  87.   }
  88.   #endif
  89.   
  90. ***************
  91. *** 440,446 ****
  92.   
  93.           /* First try user specified bitmap, then builtin, the a blank. */
  94.           if (menu->iconfile != NULL)
  95. !         pixmap_create_from_file(menu->iconfile, &pixmap, &mask);
  96.           if (pixmap == NULL && !menu->icon_builtin)
  97.           pixmap_create_by_dir(menu->name, &pixmap, &mask);
  98.           if (pixmap == NULL && menu->iconidx >= 0)
  99. --- 437,448 ----
  100.   
  101.           /* First try user specified bitmap, then builtin, the a blank. */
  102.           if (menu->iconfile != NULL)
  103. !         {
  104. !         char_u buf[MAXPATHL + 1];
  105. !         gui_find_iconfile(menu->iconfile, buf, "xpm");
  106. !         pixmap_create_from_file(buf, &pixmap, &mask);
  107. !         }
  108.           if (pixmap == NULL && !menu->icon_builtin)
  109.           pixmap_create_by_dir(menu->name, &pixmap, &mask);
  110.           if (pixmap == NULL && menu->iconidx >= 0)
  111. *** ../vim61.237/src/gui_w32.c    Tue Oct 15 21:05:16 2002
  112. --- src/gui_w32.c    Sun Oct 20 16:47:24 2002
  113. ***************
  114. *** 3238,3244 ****
  115.       char_u fname[MAXPATHL];
  116.       HANDLE hbitmap = NULL;
  117.   
  118. !     if (gui_find_bitmap(menu->name, fname, "bmp") == OK)
  119.           hbitmap = LoadImage(
  120.               NULL,
  121.               fname,
  122. --- 3238,3263 ----
  123.       char_u fname[MAXPATHL];
  124.       HANDLE hbitmap = NULL;
  125.   
  126. !     if (menu->iconfile != NULL)
  127. !     {
  128. !         gui_find_iconfile(menu->iconfile, fname, "bmp");
  129. !         hbitmap = LoadImage(
  130. !             NULL,
  131. !             fname,
  132. !             IMAGE_BITMAP,
  133. !             TOOLBAR_BUTTON_WIDTH,
  134. !             TOOLBAR_BUTTON_HEIGHT,
  135. !             LR_LOADFROMFILE |
  136. !             LR_LOADMAP3DCOLORS
  137. !             );
  138. !     }
  139. !     /*
  140. !      * If the LoadImage call failed, or the "icon=" file
  141. !      * didn't exist or wasn't specified, try the menu name
  142. !      */
  143. !     if (hbitmap == NULL
  144. !         && (gui_find_bitmap(menu->name, fname, "bmp") == OK))
  145.           hbitmap = LoadImage(
  146.               NULL,
  147.               fname,
  148. ***************
  149. *** 3248,3253 ****
  150. --- 3267,3273 ----
  151.               LR_LOADFROMFILE |
  152.               LR_LOADMAP3DCOLORS
  153.           );
  154.       if (hbitmap != NULL)
  155.       {
  156.           TBADDBITMAP tbAddBitmap;
  157. *** ../vim61.237/src/gui_x11.c    Sun Jul 21 20:47:17 2002
  158. --- src/gui_x11.c    Sun Oct 20 16:48:50 2002
  159. ***************
  160. *** 3447,3459 ****
  161.   
  162.       if (menu->iconfile != NULL)
  163.       {
  164. !     /* Use the file argument: first as an absolute path (with extension),
  165. !      * then as a file name (without extension). */
  166. !     expand_env(menu->iconfile, buf, MAXPATHL);
  167.       createXpmImages(buf, NULL, sen, insen);
  168. !     if (*sen == (Pixmap)0
  169. !         && gui_find_bitmap(menu->name, buf, "xpm") == OK
  170. !         && buf[0] != NUL)
  171.           createXpmImages(buf, NULL, sen, insen);
  172.       if (*sen != (Pixmap)0)
  173.           return;
  174. --- 3447,3458 ----
  175.   
  176.       if (menu->iconfile != NULL)
  177.       {
  178. !     /* Use the "icon="  argument. */
  179. !     gui_find_iconfile(menu->iconfile, buf, "xpm");
  180.       createXpmImages(buf, NULL, sen, insen);
  181. !     /* If it failed, try using the menu name. */
  182. !     if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK)
  183.           createXpmImages(buf, NULL, sen, insen);
  184.       if (*sen != (Pixmap)0)
  185.           return;
  186. *** ../vim61.237/src/proto/gui.pro    Wed May  1 21:20:47 2002
  187. --- src/proto/gui.pro    Sun Oct 20 16:46:02 2002
  188. ***************
  189. *** 51,56 ****
  190. --- 51,57 ----
  191.   void gui_mouse_correct __ARGS((void));
  192.   void ex_gui __ARGS((exarg_T *eap));
  193.   int gui_find_bitmap __ARGS((char_u *name, char_u *buffer, char *ext));
  194. + void gui_find_iconfile __ARGS((char_u *name, char_u *buffer, char *ext));
  195.   void display_errors __ARGS((void));
  196.   int no_console_input __ARGS((void));
  197.   void gui_update_screen __ARGS((void));
  198. *** ../vim61.237/src/version.c    Sun Oct 27 20:32:20 2002
  199. --- src/version.c    Sun Oct 27 20:35:06 2002
  200. ***************
  201. *** 608,609 ****
  202. --- 608,611 ----
  203.   {   /* Add new patch number below this line */
  204. + /**/
  205. +     238,
  206.   /**/
  207.  
  208. -- 
  209. A mathematician is a device for turning coffee into theorems.
  210.                     Paul Erdos
  211. A computer programmer is a device for turning coffee into bugs.
  212.                     Bram Moolenaar
  213.  
  214.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  215. ///          Creator of Vim - Vi IMproved -- http://www.vim.org          \\\
  216. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  217.  \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
  218.