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.433 < prev    next >
Encoding:
Internet Message Format  |  2003-03-30  |  10.1 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.433
  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.433
  11. Problem:    ":popup" only works for Win32.
  12. Solution:   Add ":popup" support for GTK.  (Daniel Elstner)
  13. Files:        runtime/doc/gui.txt, src/ex_docmd.c, src/gui_gtk.c, src/menu.c,
  14.         src/proto/gui_gtk.pro
  15.  
  16.  
  17. *** ../vim61.432/runtime/doc/gui.txt    Tue May  7 20:49:56 2002
  18. --- runtime/doc/gui.txt    Fri Mar 28 19:35:32 2003
  19. ***************
  20. *** 1,4 ****
  21. ! *gui.txt*       For Vim version 6.1.  Last change: 2002 May 07
  22.   
  23.   
  24.             VIM REFERENCE MANUAL    by Bram Moolenaar
  25. --- 1,4 ----
  26. ! *gui.txt*       For Vim version 6.1.  Last change: 2003 Mar 28
  27.   
  28.   
  29.             VIM REFERENCE MANUAL    by Bram Moolenaar
  30. ***************
  31. *** 692,700 ****
  32.   29  WinMaxWidth        make current window use many columns
  33.   30  WinMinWidth        make current window use few columns
  34.   
  35. !                             *win32-hidden-menus*
  36. ! In the Win32 GUI, starting a menu name with ']' excludes that menu from the
  37. ! main menu bar.  You must then use the |:tearoff| command to display it.
  38.   
  39.                               *popup-menu*
  40.   In the Win32, GTK, Motif, Athena and Photon GUI, you can define the special
  41. --- 695,704 ----
  42.   29  WinMaxWidth        make current window use many columns
  43.   30  WinMinWidth        make current window use few columns
  44.   
  45. !                     *hidden-menus* *win32-hidden-menus*
  46. ! In the Win32 and GTK+ GUI, starting a menu name with ']' excludes that menu
  47. ! from the main menu bar.  You must then use the |:popup| or |:tearoff| command
  48. ! to display it.
  49.   
  50.                               *popup-menu*
  51.   In the Win32, GTK, Motif, Athena and Photon GUI, you can define the special
  52. ***************
  53. *** 770,780 ****
  54.   If you do not want to remove a menu, but disable it for a moment, this can be
  55.   done by adding the "enable" or "disable" keyword to a ":menu" command.
  56.   Examples: >
  57. !     :menu disable File.Open
  58.       :amenu enable *
  59. !     :amenu disable Tools.*
  60.   
  61. ! The command applies to the modes as used with all menu commands.
  62.   When the argument is "*", all menus are affected.  Otherwise the given menu
  63.   name and all existing submenus below it are affected.
  64.   
  65. --- 774,785 ----
  66.   If you do not want to remove a menu, but disable it for a moment, this can be
  67.   done by adding the "enable" or "disable" keyword to a ":menu" command.
  68.   Examples: >
  69. !     :menu disable &File.&Open\.\.\.
  70.       :amenu enable *
  71. !     :amenu disable &Tools.*
  72.   
  73. ! The command applies to the modes as used with all menu commands.  Note that
  74. ! characters like "&" need to be included for translated names to be found.
  75.   When the argument is "*", all menus are affected.  Otherwise the given menu
  76.   name and all existing submenus below it are affected.
  77.   
  78. ***************
  79. *** 796,802 ****
  80.   the <CR> key.  |<>|)
  81.   
  82.   
  83. ! Tooltips & Menu tips
  84.   
  85.   See section |42.4| in the user manual.
  86.   
  87. --- 801,807 ----
  88.   the <CR> key.  |<>|)
  89.   
  90.   
  91. ! 5.8 Tooltips & Menu tips
  92.   
  93.   See section |42.4| in the user manual.
  94.   
  95. ***************
  96. *** 826,834 ****
  97.   And delete it with: >
  98.       :tunmenu MyMenu.Hello
  99.   
  100. - When using the GTK GUI, and Vim has already opened the GUI window, the tooltip
  101. - must be defined before the ToolBar menu.  Otherwise it won't show up.
  102.   Tooltips are currently only supported for the X11 and Win32 GUI. However, they
  103.   should appear for the other gui platforms in the not too distant future.
  104.   
  105. --- 831,836 ----
  106. ***************
  107. *** 841,850 ****
  108.   a menu item - you don't need to do a :tunmenu as well.
  109.   
  110.   
  111. ! 5.8 Popup Menus
  112.   
  113. ! In the win32 gui, you can cause a menu to popup at the cursor.  This behaves
  114. ! similarly to the PopUp menus except that any menu tree can be popped up.
  115.   
  116.   This command is for backwards compatibility, using it is discouraged, because
  117.   it behaves in a strange way.
  118. --- 843,853 ----
  119.   a menu item - you don't need to do a :tunmenu as well.
  120.   
  121.   
  122. ! 5.9 Popup Menus
  123.   
  124. ! In the Win32 and GTK+ GUI, you can cause a menu to popup at the cursor.
  125. ! This behaves similarly to the PopUp menus except that any menu tree can
  126. ! be popped up.
  127.   
  128.   This command is for backwards compatibility, using it is discouraged, because
  129.   it behaves in a strange way.
  130. ***************
  131. *** 852,859 ****
  132.                               *:popup* *:popu*
  133.   :pop[up] {name}            Popup the menu {name}.  The menu named must
  134.                   have at least one subentry, but need not
  135. !                 appear on the menu-bar (see
  136. !                 |win32-hidden-menus|).
  137.   
  138.   Example: >
  139.       :popup File
  140. --- 855,862 ----
  141.                               *:popup* *:popu*
  142.   :pop[up] {name}            Popup the menu {name}.  The menu named must
  143.                   have at least one subentry, but need not
  144. !                 appear on the menu-bar (see |hidden-menus|).
  145. !                 {only available for Win32 and GTK GUI}
  146.   
  147.   Example: >
  148.       :popup File
  149. *** ../vim61.432/src/ex_docmd.c    Mon Mar 31 21:58:21 2003
  150. --- src/ex_docmd.c    Mon Mar 31 21:50:33 2003
  151. ***************
  152. *** 191,197 ****
  153.   #else
  154.   # define ex_tearoff        ex_ni
  155.   #endif
  156. ! #if defined(FEAT_GUI_MSWIN) && defined(FEAT_MENU)
  157.   static void    ex_popup __ARGS((exarg_T *eap));
  158.   #else
  159.   # define ex_popup        ex_ni
  160. --- 191,197 ----
  161.   #else
  162.   # define ex_tearoff        ex_ni
  163.   #endif
  164. ! #if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)) && defined(FEAT_MENU)
  165.   static void    ex_popup __ARGS((exarg_T *eap));
  166.   #else
  167.   # define ex_popup        ex_ni
  168. ***************
  169. *** 5896,5902 ****
  170.   }
  171.   #endif
  172.   
  173. ! #if defined(FEAT_GUI_MSWIN) && defined(FEAT_MENU)
  174.       static void
  175.   ex_popup(eap)
  176.       exarg_T    *eap;
  177. --- 5896,5902 ----
  178.   }
  179.   #endif
  180.   
  181. ! #if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)) && defined(FEAT_MENU)
  182.       static void
  183.   ex_popup(eap)
  184.       exarg_T    *eap;
  185. *** ../vim61.432/src/gui_gtk.c    Sat Mar 15 17:55:18 2003
  186. --- src/gui_gtk.c    Fri Mar 28 21:13:53 2003
  187. ***************
  188. *** 262,268 ****
  189.   {
  190.       vimmenu_T    *parent = menu->parent;
  191.   
  192. !     if (menu_is_popup(menu->name))
  193.       {
  194.       menu->submenu_id = gtk_menu_new();
  195.       return;
  196. --- 262,268 ----
  197.   {
  198.       vimmenu_T    *parent = menu->parent;
  199.   
  200. !     if (menu->name[0] == ']' || menu_is_popup(menu->name))
  201.       {
  202.       menu->submenu_id = gtk_menu_new();
  203.       return;
  204. ***************
  205. *** 310,318 ****
  206.   
  207.   /*ARGSUSED*/
  208.       static void
  209. ! menu_item_activate(GtkWidget * widget, gpointer data)
  210.   {
  211. !     gui_menu_cb((vimmenu_T *) data);
  212.   
  213.       /* make sure the menu action is taken immediately */
  214.       if (gtk_main_level() > 0)
  215. --- 310,323 ----
  216.   
  217.   /*ARGSUSED*/
  218.       static void
  219. ! menu_item_activate(GtkWidget *widget, gpointer data)
  220.   {
  221. !     gui_menu_cb((vimmenu_T *)data);
  222. !     /* Work around a bug in GTK+ 1: we don't seem to get a focus-in
  223. !      * event after clicking a menu item shown via :popup. */
  224. !     if (!gui.in_focus)
  225. !     gui_focus_change(TRUE);
  226.   
  227.       /* make sure the menu action is taken immediately */
  228.       if (gtk_main_level() > 0)
  229. ***************
  230. *** 592,598 ****
  231.   {
  232.       while (menu != NULL)
  233.       {
  234. !     if (!menu_is_popup(menu->name))
  235.       {
  236.           if (menu->submenu_id != 0)
  237.           {
  238. --- 597,603 ----
  239.   {
  240.       while (menu != NULL)
  241.       {
  242. !     if (menu->name[0] != ']' && !menu_is_popup(menu->name))
  243.       {
  244.           if (menu->submenu_id != 0)
  245.           {
  246. ***************
  247. *** 1486,1492 ****
  248.       gtk_menu_popup(GTK_MENU(menu->submenu_id), NULL, NULL,
  249.              (GtkMenuPositionFunc)NULL, NULL, 3, (guint32)GDK_CURRENT_TIME);
  250.   }
  251. ! #endif
  252.   
  253.   
  254.   /*
  255. --- 1491,1533 ----
  256.       gtk_menu_popup(GTK_MENU(menu->submenu_id), NULL, NULL,
  257.              (GtkMenuPositionFunc)NULL, NULL, 3, (guint32)GDK_CURRENT_TIME);
  258.   }
  259. ! /*
  260. !  * Menu position callback; used by gui_make_popup() to place the menu
  261. !  * at the current text cursor position.
  262. !  */
  263. ! /*ARGSUSED0*/
  264. !     static void
  265. ! popup_menu_position_func(GtkMenu *menu,
  266. !              gint *x, gint *y,
  267. !              gpointer user_data)
  268. ! {
  269. !     if (curwin != NULL && gui.drawarea != NULL && gui.drawarea->window != NULL)
  270. !     {
  271. !     gdk_window_get_origin(gui.drawarea->window, x, y);
  272. !     /* Find the cursor position in the current window */
  273. !     *x += FILL_X(W_WINCOL(curwin) + curwin->w_wcol + 1) + 1;
  274. !     *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1;
  275. !     }
  276. ! }
  277. !     void
  278. ! gui_make_popup(char_u *path_name)
  279. ! {
  280. !     vimmenu_T *menu;
  281. !     menu = gui_find_menu(path_name);
  282. !     if (menu != NULL && menu->submenu_id != NULL)
  283. !     {
  284. !     gtk_menu_popup(GTK_MENU(menu->submenu_id),
  285. !                NULL, NULL,
  286. !                &popup_menu_position_func, NULL,
  287. !                0U, (guint32)GDK_CURRENT_TIME);
  288. !     }
  289. ! }
  290. ! #endif /* FEAT_MENU */
  291.   
  292.   
  293.   /*
  294. *** ../vim61.432/src/menu.c    Tue Mar 11 12:59:06 2003
  295. --- src/menu.c    Fri Mar 28 19:33:39 2003
  296. ***************
  297. *** 2150,2158 ****
  298.       EMSG2(_("E335: Menu not defined for %s mode"), mode);
  299.   }
  300.   
  301. ! #if defined(FEAT_GUI_MSWIN) || (defined(FEAT_BEVAL) \
  302. !         && (defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF))) \
  303. !     || defined(PROTO)
  304.   /*
  305.    * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy.
  306.    */
  307. --- 2150,2158 ----
  308.       EMSG2(_("E335: Menu not defined for %s mode"), mode);
  309.   }
  310.   
  311. ! #if defined(FEAT_GUI_MSWIN) \
  312. !     || (defined(FEAT_GUI_GTK) && defined(FEAT_MENU)) \
  313. !     || defined(FEAT_BEVAL_TIP) || defined(PROTO)
  314.   /*
  315.    * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy.
  316.    */
  317. *** ../vim61.432/src/proto/gui_gtk.pro    Tue Mar 11 12:59:06 2003
  318. --- src/proto/gui_gtk.pro    Fri Mar 28 19:33:39 2003
  319. ***************
  320. *** 13,18 ****
  321. --- 13,19 ----
  322.   char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter));
  323.   int gui_mch_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield));
  324.   void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu));
  325. + void gui_make_popup __ARGS((char_u *path_name));
  326.   void gui_mch_find_dialog __ARGS((exarg_T *eap));
  327.   void gui_mch_replace_dialog __ARGS((exarg_T *eap));
  328.   void gui_gtk_synch_fonts __ARGS((void));
  329. *** ../vim61.432/src/version.c    Mon Mar 31 21:58:22 2003
  330. --- src/version.c    Mon Mar 31 22:01:03 2003
  331. ***************
  332. *** 613,614 ****
  333. --- 613,616 ----
  334.   {   /* Add new patch number below this line */
  335. + /**/
  336. +     433,
  337.   /**/
  338.  
  339. -- 
  340. The software said it requires Windows 95 or better, so I installed Linux.
  341.  
  342.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  343. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  344. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  345.  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
  346.