home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.1.238 (extra)
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.1.238 (extra)
- Problem: Win32: The "icon=" argument for the ":menu" command does not
- search for the bitmap file.
- Solution: Expand environment variables and search for the bitmap file.
- (Vince Negri)
- Make it consistent, use the same mechanism for X11 and GTK.
- Files: src/gui.c src/gui_gtk.c, src/gui_w32.c, src/gui_x11.c,
- src/proto/gui.pro
-
-
- *** ../vim61.237/src/gui.c Fri Sep 27 20:44:09 2002
- --- src/gui.c Sun Oct 20 22:57:29 2002
- ***************
- *** 3991,3996 ****
- --- 3997,4022 ----
- if (do_in_runtimepath(buffer, FALSE, gfp_setname) == FAIL || *buffer == NUL)
- return FAIL;
- return OK;
- + }
- +
- + /*
- + * Given the name of the "icon=" argument, try finding the bitmap file for the
- + * icon. If it is an absolute path name, use it as it is. Otherwise append
- + * "ext" and search for it in 'runtimepath'.
- + * The result is put in "buffer[MAXPATHL]". If something fails "buffer"
- + * contains "name".
- + */
- + void
- + gui_find_iconfile(name, buffer, ext)
- + char_u *name;
- + char_u *buffer;
- + char *ext;
- + {
- + char_u buf[MAXPATHL + 1];
- +
- + expand_env(name, buffer, MAXPATHL);
- + if (!mch_isFullName(buffer) && gui_find_bitmap(buffer, buf, ext) == OK)
- + STRCPY(buffer, buf);
- }
- #endif
-
- *** ../vim61.237/src/gui_gtk.c Wed May 1 21:20:47 2002
- --- src/gui_gtk.c Sun Oct 20 16:35:09 2002
- ***************
- *** 403,422 ****
- }
-
- /*
- ! * Creates a pixmap by using the pixmap "file".
- */
- static void
- ! pixmap_create_from_file(char_u *file, GdkPixmap **pixmap, GdkBitmap **mask)
- {
- - char_u full_pathname[MAXPATHL + 1];
- -
- - expand_env(file, full_pathname, MAXPATHL);
- *pixmap = gdk_pixmap_colormap_create_from_xpm(
- NULL,
- gtk_widget_get_colormap(gui.mainwin),
- mask,
- &gui.mainwin->style->bg[GTK_STATE_NORMAL],
- ! (const char *)full_pathname);
- }
- #endif
-
- --- 403,419 ----
- }
-
- /*
- ! * Creates a pixmap by using the pixmap "fname".
- */
- static void
- ! pixmap_create_from_file(char_u *fname, GdkPixmap **pixmap, GdkBitmap **mask)
- {
- *pixmap = gdk_pixmap_colormap_create_from_xpm(
- NULL,
- gtk_widget_get_colormap(gui.mainwin),
- mask,
- &gui.mainwin->style->bg[GTK_STATE_NORMAL],
- ! (const char *)fname);
- }
- #endif
-
- ***************
- *** 440,446 ****
-
- /* First try user specified bitmap, then builtin, the a blank. */
- if (menu->iconfile != NULL)
- ! pixmap_create_from_file(menu->iconfile, &pixmap, &mask);
- if (pixmap == NULL && !menu->icon_builtin)
- pixmap_create_by_dir(menu->name, &pixmap, &mask);
- if (pixmap == NULL && menu->iconidx >= 0)
- --- 437,448 ----
-
- /* First try user specified bitmap, then builtin, the a blank. */
- if (menu->iconfile != NULL)
- ! {
- ! char_u buf[MAXPATHL + 1];
- !
- ! gui_find_iconfile(menu->iconfile, buf, "xpm");
- ! pixmap_create_from_file(buf, &pixmap, &mask);
- ! }
- if (pixmap == NULL && !menu->icon_builtin)
- pixmap_create_by_dir(menu->name, &pixmap, &mask);
- if (pixmap == NULL && menu->iconidx >= 0)
- *** ../vim61.237/src/gui_w32.c Tue Oct 15 21:05:16 2002
- --- src/gui_w32.c Sun Oct 20 16:47:24 2002
- ***************
- *** 3238,3244 ****
- char_u fname[MAXPATHL];
- HANDLE hbitmap = NULL;
-
- ! if (gui_find_bitmap(menu->name, fname, "bmp") == OK)
- hbitmap = LoadImage(
- NULL,
- fname,
- --- 3238,3263 ----
- char_u fname[MAXPATHL];
- HANDLE hbitmap = NULL;
-
- ! if (menu->iconfile != NULL)
- ! {
- ! gui_find_iconfile(menu->iconfile, fname, "bmp");
- ! hbitmap = LoadImage(
- ! NULL,
- ! fname,
- ! IMAGE_BITMAP,
- ! TOOLBAR_BUTTON_WIDTH,
- ! TOOLBAR_BUTTON_HEIGHT,
- ! LR_LOADFROMFILE |
- ! LR_LOADMAP3DCOLORS
- ! );
- ! }
- !
- ! /*
- ! * If the LoadImage call failed, or the "icon=" file
- ! * didn't exist or wasn't specified, try the menu name
- ! */
- ! if (hbitmap == NULL
- ! && (gui_find_bitmap(menu->name, fname, "bmp") == OK))
- hbitmap = LoadImage(
- NULL,
- fname,
- ***************
- *** 3248,3253 ****
- --- 3267,3273 ----
- LR_LOADFROMFILE |
- LR_LOADMAP3DCOLORS
- );
- +
- if (hbitmap != NULL)
- {
- TBADDBITMAP tbAddBitmap;
- *** ../vim61.237/src/gui_x11.c Sun Jul 21 20:47:17 2002
- --- src/gui_x11.c Sun Oct 20 16:48:50 2002
- ***************
- *** 3447,3459 ****
-
- if (menu->iconfile != NULL)
- {
- ! /* Use the file argument: first as an absolute path (with extension),
- ! * then as a file name (without extension). */
- ! expand_env(menu->iconfile, buf, MAXPATHL);
- createXpmImages(buf, NULL, sen, insen);
- ! if (*sen == (Pixmap)0
- ! && gui_find_bitmap(menu->name, buf, "xpm") == OK
- ! && buf[0] != NUL)
- createXpmImages(buf, NULL, sen, insen);
- if (*sen != (Pixmap)0)
- return;
- --- 3447,3458 ----
-
- if (menu->iconfile != NULL)
- {
- ! /* Use the "icon=" argument. */
- ! gui_find_iconfile(menu->iconfile, buf, "xpm");
- createXpmImages(buf, NULL, sen, insen);
- !
- ! /* If it failed, try using the menu name. */
- ! if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK)
- createXpmImages(buf, NULL, sen, insen);
- if (*sen != (Pixmap)0)
- return;
- *** ../vim61.237/src/proto/gui.pro Wed May 1 21:20:47 2002
- --- src/proto/gui.pro Sun Oct 20 16:46:02 2002
- ***************
- *** 51,56 ****
- --- 51,57 ----
- void gui_mouse_correct __ARGS((void));
- void ex_gui __ARGS((exarg_T *eap));
- int gui_find_bitmap __ARGS((char_u *name, char_u *buffer, char *ext));
- + void gui_find_iconfile __ARGS((char_u *name, char_u *buffer, char *ext));
- void display_errors __ARGS((void));
- int no_console_input __ARGS((void));
- void gui_update_screen __ARGS((void));
- *** ../vim61.237/src/version.c Sun Oct 27 20:32:20 2002
- --- src/version.c Sun Oct 27 20:35:06 2002
- ***************
- *** 608,609 ****
- --- 608,611 ----
- { /* Add new patch number below this line */
- + /**/
- + 238,
- /**/
-
- --
- A mathematician is a device for turning coffee into theorems.
- Paul Erdos
- A computer programmer is a device for turning coffee into bugs.
- Bram Moolenaar
-
- /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\
- /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
- \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
- \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
-