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.389 < prev    next >
Encoding:
Internet Message Format  |  2003-03-10  |  44.2 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.389
  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.389 (depends on 6.1.366)
  11. Problem:    Balloon evaluation doesn't work for GTK.
  12.         has("balloon_eval") doesn't work.
  13. Solution:   Add balloon evaluation for GTK.  Also improve displaying of signs.
  14.         (Daniel Elstner)
  15.         Also make ":gui" start the netbeans connection and avoid using
  16.         netbeans functions when the connection is not open.
  17. Files:        src/Makefile, src/feature.h, src/gui.c, src/gui.h,
  18.         src/gui_beval.c, src/gui_beval.h, src/gui_gtk.c,
  19.         src/gui_gtk_x11.c, src/eval.c, src/memline.c, src/menu.c,
  20.         src/netbeans.c, src/proto/gui_beval.pro, src/proto/gui_gtk.pro,
  21.         src/structs.h, src/syntax.c, src/ui.c, src/workshop.c
  22.  
  23.  
  24. *** ../vim61.388/src/Makefile    Sat Mar  8 20:33:31 2003
  25. --- src/Makefile    Mon Mar 10 20:49:41 2003
  26. ***************
  27. *** 977,985 ****
  28.   #GUI_TESTTARGET = $(NONE_TESTTARGET)
  29.   
  30.   ### GTK GUI
  31. ! GTK_SRC        = gui.c gui_gtk.c gui_gtk_x11.c pty.c gui_gtk_f.c
  32.   GTK_OBJ        = objects/gui.o objects/gui_gtk.o objects/gui_gtk_x11.o \
  33. !             objects/pty.o objects/gui_gtk_f.o
  34.   GTK_DEFS    = -DFEAT_GUI_GTK $(NARROW_PROTO)
  35.   GTK_IPATH    = $(GUI_INC_LOC)
  36.   GTK_LIBS_DIR    = $(GUI_LIB_LOC)
  37. --- 983,993 ----
  38.   #GUI_TESTTARGET = $(NONE_TESTTARGET)
  39.   
  40.   ### GTK GUI
  41. ! GTK_SRC        = gui.c gui_gtk.c gui_gtk_x11.c pty.c gui_gtk_f.c \
  42. !               gui_beval.c
  43.   GTK_OBJ        = objects/gui.o objects/gui_gtk.o objects/gui_gtk_x11.o \
  44. !             objects/pty.o objects/gui_gtk_f.o \
  45. !             objects/gui_beval.o
  46.   GTK_DEFS    = -DFEAT_GUI_GTK $(NARROW_PROTO)
  47.   GTK_IPATH    = $(GUI_INC_LOC)
  48.   GTK_LIBS_DIR    = $(GUI_LIB_LOC)
  49. *** ../vim61.388/src/feature.h    Sat Mar  8 20:33:31 2003
  50. --- src/feature.h    Mon Mar 10 22:46:22 2003
  51. ***************
  52. *** 1089,1102 ****
  53.    *            debugger and for tooltips.
  54.    *            Currently only for Athena and Motif.
  55.    */
  56. ! #if (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) \
  57. !     && (   defined(FEAT_TOOLBAR) \
  58.               || defined(FEAT_SUN_WORKSHOP) \
  59.               || defined(FEAT_NETBEANS_INTG))
  60.   # define FEAT_BEVAL
  61. ! # ifndef FEAT_XFONTSET
  62.   #  define FEAT_XFONTSET
  63.   # endif
  64.   #endif
  65.   
  66.   #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
  67. --- 1089,1107 ----
  68.    *            debugger and for tooltips.
  69.    *            Currently only for Athena and Motif.
  70.    */
  71. ! #if (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) \
  72. !                              || defined(FEAT_GUI_GTK)) \
  73. !     && (   (defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_GTK)) \
  74.               || defined(FEAT_SUN_WORKSHOP) \
  75.               || defined(FEAT_NETBEANS_INTG))
  76.   # define FEAT_BEVAL
  77. ! # if !defined(FEAT_XFONTSET) && !defined(FEAT_GUI_GTK)
  78.   #  define FEAT_XFONTSET
  79.   # endif
  80. + #endif
  81. + #if defined(FEAT_BEVAL) && (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA))
  82. + # define FEAT_BEVAL_TIP        /* balloon eval used for toolbar tooltip */
  83.   #endif
  84.   
  85.   #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
  86. *** ../vim61.388/src/gui.c    Sat Mar  8 20:33:32 2003
  87. --- src/gui.c    Mon Mar 10 22:48:00 2003
  88. ***************
  89. *** 253,259 ****
  90.   #if defined(FEAT_FOOTER) && defined(FEAT_GUI_MOTIF)
  91.       gui.footer_height = 0;
  92.   #endif
  93. ! #ifdef FEAT_BEVAL
  94.       gui.tooltip_fontset = NOFONTSET;
  95.   #endif
  96.   
  97. --- 254,260 ----
  98.   #if defined(FEAT_FOOTER) && defined(FEAT_GUI_MOTIF)
  99.       gui.footer_height = 0;
  100.   #endif
  101. ! #ifdef FEAT_BEVAL_TIP
  102.       gui.tooltip_fontset = NOFONTSET;
  103.   #endif
  104.   
  105. ***************
  106. *** 509,514 ****
  107. --- 510,520 ----
  108.       gui_mch_update();
  109.       /* Now make sure the shell fits on the screen. */
  110.       gui_set_shellsize(FALSE, TRUE);
  111. + #endif
  112. + #ifdef FEAT_NETBEANS_INTG
  113. +     if (starting == 0 && usingNetbeans)
  114. +         /* Tell the client that it can start sending commands. */
  115. +         netbeans_startup_done();
  116.   #endif
  117.       return;
  118.       }
  119. *** ../vim61.388/src/gui.h    Sat May  4 22:23:07 2002
  120. --- src/gui.h    Mon Mar 10 22:48:30 2003
  121. ***************
  122. *** 404,410 ****
  123.       int        toolbar_height;        /* height of the toolbar */
  124.   #endif
  125.   
  126. ! #ifdef FEAT_BEVAL
  127.       /* Tooltip properties; also used for balloon evaluation */
  128.       char_u    *rsrc_tooltip_font_name; /* tooltip font name */
  129.       char    *rsrc_tooltip_fg_name;    /* tooltip foreground color name */
  130. --- 404,410 ----
  131.       int        toolbar_height;        /* height of the toolbar */
  132.   #endif
  133.   
  134. ! #ifdef FEAT_BEVAL_TIP
  135.       /* Tooltip properties; also used for balloon evaluation */
  136.       char_u    *rsrc_tooltip_font_name; /* tooltip font name */
  137.       char    *rsrc_tooltip_fg_name;    /* tooltip foreground color name */
  138. *** ../vim61.388/src/gui_beval.c    Sat Mar  8 20:33:32 2003
  139. --- src/gui_beval.c    Tue Mar 11 12:31:15 2003
  140. ***************
  141. *** 12,40 ****
  142.   
  143.   #if defined(FEAT_BEVAL) || defined(PROTO)
  144.   
  145. ! #include <X11/keysym.h>
  146. ! #ifdef FEAT_GUI_MOTIF
  147. ! #include <Xm/PushB.h>
  148. ! #include <Xm/Separator.h>
  149. ! #include <Xm/List.h>
  150. ! #include <Xm/Label.h>
  151. ! #include <Xm/AtomMgr.h>
  152. ! #include <Xm/Protocols.h>
  153.   #else
  154. !     /* Assume Athena */
  155. ! #include <X11/Shell.h>
  156. ! #include <X11/Xaw/Label.h>
  157.   #endif
  158.   
  159.   #include "gui_beval.h"
  160.   
  161.   extern Widget vimShell;
  162.   
  163.   static void addEventHandler __ARGS((Widget, BalloonEval *));
  164.   static void removeEventHandler __ARGS((BalloonEval *));
  165.   static void pointerEventEH __ARGS((Widget, XtPointer, XEvent *, Boolean *));
  166.   static void pointerEvent __ARGS((BalloonEval *, XEvent *));
  167.   static void timerRoutine __ARGS((XtPointer, XtIntervalId *));
  168.   static void cancelBalloon __ARGS((BalloonEval *));
  169.   static void requestBalloon __ARGS((BalloonEval *));
  170.   static void drawBalloon __ARGS((BalloonEval *));
  171. --- 12,59 ----
  172.   
  173.   #if defined(FEAT_BEVAL) || defined(PROTO)
  174.   
  175. ! #ifdef FEAT_GUI_GTK
  176. ! # include <gdk/gdkkeysyms.h>
  177. ! # include <gtk/gtk.h>
  178.   #else
  179. ! # include <X11/keysym.h>
  180. ! # ifdef FEAT_GUI_MOTIF
  181. ! #  include <Xm/PushB.h>
  182. ! #  include <Xm/Separator.h>
  183. ! #  include <Xm/List.h>
  184. ! #  include <Xm/Label.h>
  185. ! #  include <Xm/AtomMgr.h>
  186. ! #  include <Xm/Protocols.h>
  187. ! # else
  188. !    /* Assume Athena */
  189. ! #  include <X11/Shell.h>
  190. ! #  include <X11/Xaw/Label.h>
  191. ! # endif
  192.   #endif
  193.   
  194.   #include "gui_beval.h"
  195.   
  196. + #ifndef FEAT_GUI_GTK
  197.   extern Widget vimShell;
  198. + #endif
  199.   
  200. + #ifdef FEAT_GUI_GTK
  201. + static void addEventHandler __ARGS((GtkWidget *, BalloonEval *));
  202. + static void removeEventHandler __ARGS((BalloonEval *));
  203. + static gint target_event_cb __ARGS((GtkWidget *, GdkEvent *, gpointer));
  204. + static gint mainwin_event_cb __ARGS((GtkWidget *, GdkEvent *, gpointer));
  205. + static void pointer_event __ARGS((BalloonEval *, int, int, unsigned int));
  206. + static void key_event __ARGS((BalloonEval *, unsigned, int));
  207. + static gint timeout_cb __ARGS((gpointer));
  208. + static gint balloon_expose_event_cb __ARGS((GtkWidget *, GdkEventExpose *, gpointer));
  209. + static void balloon_draw_cb __ARGS((GtkWidget *, GdkRectangle *area, gpointer));
  210. + #else
  211.   static void addEventHandler __ARGS((Widget, BalloonEval *));
  212.   static void removeEventHandler __ARGS((BalloonEval *));
  213.   static void pointerEventEH __ARGS((Widget, XtPointer, XEvent *, Boolean *));
  214.   static void pointerEvent __ARGS((BalloonEval *, XEvent *));
  215.   static void timerRoutine __ARGS((XtPointer, XtIntervalId *));
  216. + #endif
  217.   static void cancelBalloon __ARGS((BalloonEval *));
  218.   static void requestBalloon __ARGS((BalloonEval *));
  219.   static void drawBalloon __ARGS((BalloonEval *));
  220. ***************
  221. *** 53,66 ****
  222.    */
  223.       BalloonEval *
  224.   gui_mch_create_beval_area(target, mesg, mesgCB, clientData)
  225. !     Widget    target;
  226.       char_u    *mesg;
  227.       void    (*mesgCB)__ARGS((BalloonEval *, int));
  228. !     XtPointer    clientData;
  229.   {
  230.       char    *display_name;        /* get from gui.dpy */
  231.       int        screen_num;
  232.       char    *p;
  233.       BalloonEval    *beval;
  234.   
  235.       if (mesg != NULL && mesgCB != NULL)
  236. --- 72,87 ----
  237.    */
  238.       BalloonEval *
  239.   gui_mch_create_beval_area(target, mesg, mesgCB, clientData)
  240. !     void    *target;
  241.       char_u    *mesg;
  242.       void    (*mesgCB)__ARGS((BalloonEval *, int));
  243. !     void    *clientData;
  244.   {
  245. + #ifndef FEAT_GUI_GTK
  246.       char    *display_name;        /* get from gui.dpy */
  247.       int        screen_num;
  248.       char    *p;
  249. + #endif
  250.       BalloonEval    *beval;
  251.   
  252.       if (mesg != NULL && mesgCB != NULL)
  253. ***************
  254. *** 72,81 ****
  255.       beval = (BalloonEval *)alloc(sizeof(BalloonEval));
  256.       if (beval != NULL)
  257.       {
  258. !     beval->target = target;
  259.       beval->balloonShell = NULL;
  260.       beval->timerID = (XtIntervalId)NULL;
  261. !     beval->appContext = XtWidgetToApplicationContext(target);
  262.       beval->showState = ShS_NEUTRAL;
  263.       beval->x = 0;
  264.       beval->y = 0;
  265. --- 93,108 ----
  266.       beval = (BalloonEval *)alloc(sizeof(BalloonEval));
  267.       if (beval != NULL)
  268.       {
  269. ! #ifdef FEAT_GUI_GTK
  270. !     beval->target = GTK_WIDGET(target);
  271. !     beval->balloonShell = NULL;
  272. !     beval->timerID = 0;
  273. ! #else
  274. !     beval->target = (Widget)target;
  275.       beval->balloonShell = NULL;
  276.       beval->timerID = (XtIntervalId)NULL;
  277. !     beval->appContext = XtWidgetToApplicationContext((Widget)target);
  278. ! #endif
  279.       beval->showState = ShS_NEUTRAL;
  280.       beval->x = 0;
  281.       beval->y = 0;
  282. ***************
  283. *** 88,112 ****
  284.        * and when the pointer rests in a certain spot for a given time
  285.        * interval, show the beval.
  286.        */
  287. !     addEventHandler(target, beval);
  288.       createBalloonEvalWindow(beval);
  289.   
  290.       /*
  291.        * Now create and save the screen width and height. Used in drawing.
  292.        */
  293.       display_name = DisplayString(gui.dpy);
  294.       p = strrchr(display_name, '.');
  295. !     if (p++ != NULL)
  296. !         screen_num = atoi(p);
  297.       else
  298.           screen_num = 0;
  299.       beval->screen_width = DisplayWidth(gui.dpy, screen_num);
  300.       beval->screen_height = DisplayHeight(gui.dpy, screen_num);
  301.       }
  302.   
  303.       return beval;
  304.   }
  305.   
  306.   /*
  307.    * Destroy a ballon-eval and free its associated memory.
  308.    */
  309. --- 115,142 ----
  310.        * and when the pointer rests in a certain spot for a given time
  311.        * interval, show the beval.
  312.        */
  313. !     addEventHandler(beval->target, beval);
  314.       createBalloonEvalWindow(beval);
  315.   
  316. + #ifndef FEAT_GUI_GTK
  317.       /*
  318.        * Now create and save the screen width and height. Used in drawing.
  319.        */
  320.       display_name = DisplayString(gui.dpy);
  321.       p = strrchr(display_name, '.');
  322. !     if (p != NULL)
  323. !         screen_num = atoi(++p);
  324.       else
  325.           screen_num = 0;
  326.       beval->screen_width = DisplayWidth(gui.dpy, screen_num);
  327.       beval->screen_height = DisplayHeight(gui.dpy, screen_num);
  328. + #endif
  329.       }
  330.   
  331.       return beval;
  332.   }
  333.   
  334. + #if defined(FEAT_BEVAL_TIP) || defined(PROTO)
  335.   /*
  336.    * Destroy a ballon-eval and free its associated memory.
  337.    */
  338. ***************
  339. *** 117,125 ****
  340. --- 147,160 ----
  341.       cancelBalloon(beval);
  342.       removeEventHandler(beval);
  343.       /* Children will automatically be destroyed */
  344. + # ifdef FEAT_GUI_GTK
  345. +     gtk_widget_destroy(beval->balloonShell);
  346. + # else
  347.       XtDestroyWidget(beval->balloonShell);
  348. + # endif
  349.       vim_free(beval);
  350.   }
  351. + #endif
  352.   
  353.       void
  354.   gui_mch_enable_beval_area(beval)
  355. ***************
  356. *** 258,263 ****
  357. --- 293,544 ----
  358.   }
  359.   #endif
  360.   
  361. + #ifdef FEAT_GUI_GTK
  362. + /*
  363. +  * We can unconditionally use ANSI-style prototypes here since
  364. +  * GTK+ requires an ANSI C compiler anyway.
  365. +  */
  366. +     static void
  367. + addEventHandler(GtkWidget *target, BalloonEval *beval)
  368. + {
  369. +     /*
  370. +      * Connect to the generic "event" signal instead of the individual
  371. +      * signals for each event type, because the former is emitted earlier.
  372. +      * This allows us to catch events independently of the signal handlers
  373. +      * in gui_gtk_x11.c.
  374. +      */
  375. +     /* Should use GTK_OBJECT() here, but that causes a lint warning... */
  376. +     gtk_signal_connect((GtkObject*)(target), "event",
  377. +                GTK_SIGNAL_FUNC(target_event_cb),
  378. +                beval);
  379. +     /*
  380. +      * Nasty:  Key press events go to the main window thus the drawing area
  381. +      * will never see them.  This means we have to connect to the main window
  382. +      * as well in order to catch those events.
  383. +      */
  384. +     if (gtk_socket_id == 0 && gui.mainwin != NULL
  385. +         && gtk_widget_is_ancestor(target, gui.mainwin))
  386. +     {
  387. +     gtk_signal_connect((GtkObject*)(gui.mainwin), "event",
  388. +                GTK_SIGNAL_FUNC(mainwin_event_cb),
  389. +                beval);
  390. +     }
  391. + }
  392. +     static void
  393. + removeEventHandler(BalloonEval *beval)
  394. + {
  395. +     gtk_signal_disconnect_by_func((GtkObject*)(beval->target),
  396. +                   GTK_SIGNAL_FUNC(target_event_cb),
  397. +                   beval);
  398. +     if (gtk_socket_id == 0 && gui.mainwin != NULL
  399. +         && gtk_widget_is_ancestor(beval->target, gui.mainwin))
  400. +     {
  401. +     gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin),
  402. +                       GTK_SIGNAL_FUNC(mainwin_event_cb),
  403. +                       beval);
  404. +     }
  405. + }
  406. +     static gint
  407. + target_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
  408. + {
  409. +     BalloonEval *beval = (BalloonEval *)data;
  410. +     switch (event->type)
  411. +     {
  412. +     case GDK_ENTER_NOTIFY:
  413. +         pointer_event(beval, (int)event->crossing.x,
  414. +                  (int)event->crossing.y,
  415. +                  event->crossing.state);
  416. +         break;
  417. +     case GDK_MOTION_NOTIFY:
  418. +         if (event->motion.is_hint)
  419. +         {
  420. +         int        x;
  421. +         int        y;
  422. +         GdkModifierType    state;
  423. +         /*
  424. +          * GDK_POINTER_MOTION_HINT_MASK is set, thus we cannot obtain
  425. +          * the coordinates from the GdkEventMotion struct directly.
  426. +          */
  427. +         gdk_window_get_pointer(widget->window, &x, &y, &state);
  428. +         pointer_event(beval, x, y, (unsigned int)state);
  429. +         }
  430. +         else
  431. +         {
  432. +         pointer_event(beval, (int)event->motion.x,
  433. +                      (int)event->motion.y,
  434. +                      event->motion.state);
  435. +         }
  436. +         break;
  437. +     case GDK_LEAVE_NOTIFY:
  438. +         /*
  439. +          * Ignore LeaveNotify events that are not "normal".
  440. +          * Apparently we also get it when somebody else grabs focus.
  441. +          */
  442. +         if (event->crossing.mode == GDK_CROSSING_NORMAL)
  443. +         cancelBalloon(beval);
  444. +         break;
  445. +     case GDK_BUTTON_PRESS:
  446. +         cancelBalloon(beval);
  447. +         break;
  448. +     case GDK_KEY_PRESS:
  449. +         key_event(beval, event->key.keyval, TRUE);
  450. +         break;
  451. +     case GDK_KEY_RELEASE:
  452. +         key_event(beval, event->key.keyval, FALSE);
  453. +         break;
  454. +     default:
  455. +         break;
  456. +     }
  457. +     return FALSE; /* continue emission */
  458. + }
  459. + /*ARGSUSED*/
  460. +     static gint
  461. + mainwin_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
  462. + {
  463. +     BalloonEval *beval = (BalloonEval *)data;
  464. +     switch (event->type)
  465. +     {
  466. +     case GDK_KEY_PRESS:
  467. +         key_event(beval, event->key.keyval, TRUE);
  468. +         break;
  469. +     case GDK_KEY_RELEASE:
  470. +         key_event(beval, event->key.keyval, FALSE);
  471. +         break;
  472. +     default:
  473. +         break;
  474. +     }
  475. +     return FALSE; /* continue emission */
  476. + }
  477. +     static void
  478. + pointer_event(BalloonEval *beval, int x, int y, unsigned state)
  479. + {
  480. +     int distance;
  481. +     distance = ABS(x - beval->x) + ABS(y - beval->y);
  482. +     if (distance > 4)
  483. +     {
  484. +     /*
  485. +      * Moved out of the balloon location: cancel it.
  486. +      * Remember button state
  487. +      */
  488. +     beval->state = state;
  489. +     cancelBalloon(beval);
  490. +     /* Mouse buttons are pressed - no balloon now */
  491. +     if (!(state & ((int)GDK_BUTTON1_MASK | (int)GDK_BUTTON2_MASK
  492. +                             | (int)GDK_BUTTON3_MASK)))
  493. +     {
  494. +         beval->x = x;
  495. +         beval->y = y;
  496. +         if (state & ((int)GDK_MOD1_MASK | (int)GDK_MOD2_MASK
  497. +                             | (int)GDK_MOD3_MASK))
  498. +         {
  499. +         /*
  500. +          * Alt is pressed -- enter super-evaluate-mode,
  501. +          * where there is no time delay
  502. +          */
  503. +         if (beval->msgCB != NULL)
  504. +         {
  505. +             beval->showState = ShS_PENDING;
  506. +             (*beval->msgCB)(beval, state);
  507. +         }
  508. +         }
  509. +         else
  510. +         {
  511. +         beval->timerID = gtk_timeout_add((unsigned)p_bdlay,
  512. +                               &timeout_cb, beval);
  513. +         }
  514. +     }
  515. +     }
  516. + }
  517. +     static void
  518. + key_event(BalloonEval *beval, unsigned keyval, int is_keypress)
  519. + {
  520. +     if (beval->showState == ShS_SHOWING && beval->msgCB != NULL)
  521. +     {
  522. +     switch (keyval)
  523. +     {
  524. +         case GDK_Shift_L:
  525. +         case GDK_Shift_R:
  526. +         beval->showState = ShS_UPDATE_PENDING;
  527. +         (*beval->msgCB)(beval, (is_keypress)
  528. +                            ? (int)GDK_SHIFT_MASK : 0);
  529. +         break;
  530. +         case GDK_Control_L:
  531. +         case GDK_Control_R:
  532. +         beval->showState = ShS_UPDATE_PENDING;
  533. +         (*beval->msgCB)(beval, (is_keypress)
  534. +                          ? (int)GDK_CONTROL_MASK : 0);
  535. +         break;
  536. +         default:
  537. +         cancelBalloon(beval);
  538. +         break;
  539. +     }
  540. +     }
  541. +     else
  542. +     cancelBalloon(beval);
  543. + }
  544. +     static gint
  545. + timeout_cb(gpointer data)
  546. + {
  547. +     BalloonEval *beval = (BalloonEval *)data;
  548. +     beval->timerID = 0;
  549. +     /*
  550. +      * If the timer event happens then the mouse has stopped long enough for
  551. +      * a request to be started. The request will only send to the debugger if
  552. +      * there the mouse is pointing at real data.
  553. +      */
  554. +     requestBalloon(beval);
  555. +     return FALSE; /* don't call me again */
  556. + }
  557. + /*ARGSUSED*/
  558. +     static gint
  559. + balloon_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
  560. + {
  561. +     gtk_paint_flat_box(widget->style, widget->window,
  562. +                GTK_STATE_NORMAL, GTK_SHADOW_OUT,
  563. +                &event->area, widget, "tooltip",
  564. +                0, 0, -1, -1);
  565. +     return FALSE;
  566. + }
  567. + /*ARGSUSED*/
  568. +     static void
  569. + balloon_draw_cb(GtkWidget *widget, GdkRectangle *area, gpointer data)
  570. + {
  571. +     GtkWidget        *child;
  572. +     GdkRectangle    child_area;
  573. +     gtk_paint_flat_box(widget->style, widget->window,
  574. +                GTK_STATE_NORMAL, GTK_SHADOW_OUT,
  575. +                area, widget, "tooltip",
  576. +                0, 0, -1, -1);
  577. +     child = GTK_BIN(widget)->child;
  578. +     if (gtk_widget_intersect(child, area, &child_area))
  579. +     gtk_widget_draw(child, &child_area);
  580. + }
  581. + #else /* !FEAT_GUI_GTK */
  582.       static void
  583.   addEventHandler(target, beval)
  584.       Widget    target;
  585. ***************
  586. *** 452,457 ****
  587. --- 733,740 ----
  588.       requestBalloon(beval);
  589.   }
  590.   
  591. + #endif /* !FEAT_GUI_GTK */
  592.       static void
  593.   requestBalloon(beval)
  594.       BalloonEval    *beval;
  595. ***************
  596. *** 469,474 ****
  597. --- 752,855 ----
  598.       }
  599.   }
  600.   
  601. + #ifdef FEAT_GUI_GTK
  602. + /*
  603. +  * Draw a balloon.
  604. +  */
  605. +     static void
  606. + drawBalloon(BalloonEval *beval)
  607. + {
  608. +     if (beval->msg != NULL)
  609. +     {
  610. +     GtkRequisition    requisition;
  611. +     int        screen_w;
  612. +     int        screen_h;
  613. +     int        x;
  614. +     int        y;
  615. +     screen_w = gdk_screen_width();
  616. +     screen_h = gdk_screen_height();
  617. +     gtk_widget_ensure_style(beval->balloonShell);
  618. +     gtk_widget_ensure_style(beval->balloonLabel);
  619. +     gtk_label_set_text(GTK_LABEL(beval->balloonLabel),
  620. +                             (const char *)beval->msg);
  621. +     /* Calculate the balloon's width and height */
  622. +     gtk_widget_size_request(beval->balloonShell, &requisition);
  623. +     /* Compute position of the balloon area */
  624. +     gdk_window_get_origin(beval->target->window, &x, &y);
  625. +     x += beval->x + EVAL_OFFSET_X;
  626. +     y += beval->y + EVAL_OFFSET_Y;
  627. +     x  = MIN(x, screen_w - requisition.width);
  628. +     y  = MIN(y, screen_h - requisition.height);
  629. +     /* Show the balloon */
  630. +     gtk_widget_set_uposition(beval->balloonShell, x, y);
  631. +     gtk_widget_show(beval->balloonShell);
  632. +     beval->showState = ShS_SHOWING;
  633. +     }
  634. + }
  635. + /*
  636. +  * Undraw a balloon.
  637. +  */
  638. +     static void
  639. + undrawBalloon(BalloonEval *beval)
  640. + {
  641. +     if (beval->balloonShell != NULL)
  642. +     gtk_widget_hide(beval->balloonShell);
  643. +     beval->showState = ShS_NEUTRAL;
  644. + }
  645. +     static void
  646. + cancelBalloon(BalloonEval *beval)
  647. + {
  648. +     if (beval->showState == ShS_SHOWING
  649. +         || beval->showState == ShS_UPDATE_PENDING)
  650. +     undrawBalloon(beval);
  651. +     if (beval->timerID != 0)
  652. +     {
  653. +     gtk_timeout_remove(beval->timerID);
  654. +     beval->timerID = 0;
  655. +     }
  656. +     beval->showState = ShS_NEUTRAL;
  657. + }
  658. +     static void
  659. + createBalloonEvalWindow(BalloonEval *beval)
  660. + {
  661. +     beval->balloonShell = gtk_window_new(GTK_WINDOW_POPUP);
  662. +     gtk_widget_set_app_paintable(beval->balloonShell, TRUE);
  663. +     gtk_window_set_policy(GTK_WINDOW(beval->balloonShell), FALSE, FALSE, TRUE);
  664. +     gtk_widget_set_name(beval->balloonShell, "gtk-tooltips");
  665. +     gtk_container_border_width(GTK_CONTAINER(beval->balloonShell), 4);
  666. +     gtk_signal_connect((GtkObject*)(beval->balloonShell), "expose_event",
  667. +                GTK_SIGNAL_FUNC(balloon_expose_event_cb), NULL);
  668. +     gtk_signal_connect((GtkObject*)(beval->balloonShell), "draw",
  669. +                GTK_SIGNAL_FUNC(balloon_draw_cb), NULL);
  670. +     beval->balloonLabel = gtk_label_new(NULL);
  671. +     gtk_label_set_line_wrap(GTK_LABEL(beval->balloonLabel), FALSE);
  672. +     gtk_label_set_justify(GTK_LABEL(beval->balloonLabel), GTK_JUSTIFY_LEFT);
  673. +     gtk_misc_set_alignment(GTK_MISC(beval->balloonLabel),
  674. +                               (float)0.5, (float)0.5);
  675. +     gtk_widget_set_name(beval->balloonLabel, "vim-balloon-label");
  676. +     gtk_widget_show(beval->balloonLabel);
  677. +     gtk_container_add(GTK_CONTAINER(beval->balloonShell), beval->balloonLabel);
  678. + }
  679. + #else /* !FEAT_GUI_GTK */
  680.   /*
  681.    * Draw a balloon.
  682.    */
  683. ***************
  684. *** 622,626 ****
  685. --- 1003,1009 ----
  686.               labelWidgetClass, beval->balloonShell, args, n);
  687.   #endif
  688.   }
  689. + #endif /* !FEAT_GUI_GTK */
  690.   
  691.   #endif /* FEAT_BEVAL */
  692. *** ../vim61.388/src/gui_beval.h    Tue Apr 10 16:06:14 2001
  693. --- src/gui_beval.h    Mon Mar 10 20:04:17 2003
  694. ***************
  695. *** 10,16 ****
  696.   #if !defined(GUI_BEVAL_H) && (defined(FEAT_BEVAL) || defined(PROTO))
  697.   #define GUI_BEVAL_H
  698.   
  699. ! #include <X11/Intrinsic.h>
  700.   
  701.   typedef enum
  702.   {
  703. --- 10,20 ----
  704.   #if !defined(GUI_BEVAL_H) && (defined(FEAT_BEVAL) || defined(PROTO))
  705.   #define GUI_BEVAL_H
  706.   
  707. ! #ifdef FEAT_GUI_GTK
  708. ! # include <gtk/gtkwidget.h>
  709. ! #else
  710. ! # include <X11/Intrinsic.h>
  711. ! #endif
  712.   
  713.   typedef enum
  714.   {
  715. ***************
  716. *** 22,31 ****
  717.   
  718.   typedef struct
  719.   {
  720.       Widget        target;        /* widget we are monitoring */
  721.       Widget        balloonShell;
  722.       Widget        balloonLabel;
  723.       XtIntervalId    timerID;    /* timer for run */
  724.       BeState        showState;    /* tells us whats currently going on */
  725.       XtAppContext    appContext;    /* used in event handler */
  726. --- 26,44 ----
  727.   
  728.   typedef struct
  729.   {
  730. + #ifdef FEAT_GUI_GTK
  731. +     GtkWidget        *target;    /* widget we are monitoring */
  732. +     GtkWidget        *balloonShell;
  733. +     GtkWidget        *balloonLabel;
  734. +     unsigned int    timerID;    /* timer for run */
  735. +     BeState        showState;    /* tells us whats currently going on */
  736. +     int            x;
  737. +     int            y;
  738. +     unsigned int    state;        /* Button/Modifier key state */
  739. + #else
  740.       Widget        target;        /* widget we are monitoring */
  741.       Widget        balloonShell;
  742.       Widget        balloonLabel;
  743.       XtIntervalId    timerID;    /* timer for run */
  744.       BeState        showState;    /* tells us whats currently going on */
  745.       XtAppContext    appContext;    /* used in event handler */
  746. ***************
  747. *** 34,45 ****
  748. --- 47,61 ----
  749.       Position        x_root;
  750.       Position        y_root;
  751.       int            state;        /* Button/Modifier key state */
  752. + #endif
  753.       int            ts;        /* tabstop setting for this buffer */
  754.       char_u        *msg;
  755.       void        (*msgCB)();
  756.       void        *clientData;    /* For callback */
  757. + #ifndef FEAT_GUI_GTK
  758.       Dimension        screen_width;    /* screen width in pixels */
  759.       Dimension        screen_height;    /* screen height in pixels */
  760. + #endif
  761.   } BalloonEval;
  762.   
  763.   #define EVAL_OFFSET_X 10 /* displacement of beval topleft corner from pointer */
  764. *** ../vim61.388/src/gui_gtk.c    Sun Oct 27 20:38:46 2002
  765. --- src/gui_gtk.c    Mon Mar 10 20:04:17 2003
  766. ***************
  767. *** 660,665 ****
  768. --- 660,684 ----
  769.   }
  770.   #endif
  771.   
  772. + #if defined(FEAT_TOOLBAR) || defined(PROTO)
  773. +     void
  774. + gui_mch_menu_set_tip(vimmenu_T *menu)
  775. + {
  776. +     if (menu->id != NULL && menu->parent != NULL &&
  777. +         gui.toolbar != NULL && menu_is_toolbar(menu->parent->name))
  778. +     {
  779. +         char_u *tooltip;
  780. +         tooltip = menu->strings[MENU_INDEX_TIP];
  781. +         gtk_tooltips_set_tip(GTK_TOOLBAR(gui.toolbar)->tooltips,
  782. +                              menu->id, (const char *)tooltip, NULL);
  783. +     }
  784. + }
  785. + #endif /* FEAT_TOOLBAR */
  786.   #if defined(FEAT_MENU) || defined(PROTO)
  787.   /*
  788.    * Destroy the machine specific menu widget.
  789. ***************
  790. *** 1415,1427 ****
  791.       if (butcount > 0)
  792.       {
  793.       --def_but;        /* 1 is first button */
  794. -     if (def_but < 0)
  795. -         def_but = 0;
  796.       if (def_but >= butcount)
  797. !         def_but = butcount - 1;
  798. !     gtk_widget_grab_focus(button[def_but]);
  799. !     gtk_widget_grab_default(button[def_but]);
  800.       }
  801.   
  802.       if (textfield != NULL)
  803. --- 1434,1446 ----
  804.       if (butcount > 0)
  805.       {
  806.       --def_but;        /* 1 is first button */
  807.       if (def_but >= butcount)
  808. !         def_but = -1;
  809. !     if (def_but >= 0)
  810. !     {
  811. !         gtk_widget_grab_focus(button[def_but]);
  812. !         gtk_widget_grab_default(button[def_but]);
  813. !     }
  814.       }
  815.   
  816.       if (textfield != NULL)
  817. *** ../vim61.388/src/gui_gtk_x11.c    Sat Mar  8 20:33:32 2003
  818. --- src/gui_gtk_x11.c    Tue Mar 11 10:32:16 2003
  819. ***************
  820. *** 629,636 ****
  821.   }
  822.   
  823.   /*ARGSUSED*/
  824. !     static void
  825. ! enter_notify_event(GtkContainer * container, gpointer data)
  826.   {
  827.       if (blink_state == BLINK_NONE)
  828.       gui_mch_start_blink();
  829. --- 629,636 ----
  830.   }
  831.   
  832.   /*ARGSUSED*/
  833. !     static gint
  834. ! enter_notify_event(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
  835.   {
  836.       if (blink_state == BLINK_NONE)
  837.       gui_mch_start_blink();
  838. ***************
  839. *** 638,651 ****
  840.       /* make sure keyboard input goes there */
  841.       if (gtk_socket_id == 0 || !GTK_WIDGET_HAS_FOCUS(gui.drawarea))
  842.       gtk_widget_grab_focus(gui.drawarea);
  843.   }
  844.   
  845.   /*ARGSUSED*/
  846. !     static void
  847. ! leave_notify_event(GtkContainer * container, gpointer data)
  848.   {
  849.       if (blink_state != BLINK_NONE)
  850.       gui_mch_stop_blink();
  851.   }
  852.   
  853.   /*ARGSUSED*/
  854. --- 638,655 ----
  855.       /* make sure keyboard input goes there */
  856.       if (gtk_socket_id == 0 || !GTK_WIDGET_HAS_FOCUS(gui.drawarea))
  857.       gtk_widget_grab_focus(gui.drawarea);
  858. +     return FALSE;
  859.   }
  860.   
  861.   /*ARGSUSED*/
  862. !     static gint
  863. ! leave_notify_event(GtkWidget* widget, GdkEventCrossing *event, gpointer data)
  864.   {
  865.       if (blink_state != BLINK_NONE)
  866.       gui_mch_stop_blink();
  867. +     return FALSE;
  868.   }
  869.   
  870.   /*ARGSUSED*/
  871. ***************
  872. *** 1976,1981 ****
  873. --- 1980,1987 ----
  874.                 GDK_LEAVE_NOTIFY_MASK |
  875.                 GDK_BUTTON_PRESS_MASK |
  876.                 GDK_BUTTON_RELEASE_MASK |
  877. +               GDK_KEY_PRESS_MASK |
  878. +               GDK_KEY_RELEASE_MASK |
  879.                 GDK_POINTER_MOTION_MASK |
  880.                 GDK_POINTER_MOTION_HINT_MASK);
  881.   
  882. ***************
  883. *** 2252,2259 ****
  884.   
  885.       /* Make this run after any internal handling of the client event happened
  886.        * to make sure that all changes implicated by it are already in place and
  887. !      * we thus can make our own adjustments.
  888. !      */
  889.       gtk_signal_connect_after(GTK_OBJECT(gui.mainwin), "client_event",
  890.               GTK_SIGNAL_FUNC(client_event_cb), NULL);
  891.   
  892. --- 2258,2264 ----
  893.   
  894.       /* Make this run after any internal handling of the client event happened
  895.        * to make sure that all changes implicated by it are already in place and
  896. !      * we thus can make our own adjustments.  */
  897.       gtk_signal_connect_after(GTK_OBJECT(gui.mainwin), "client_event",
  898.               GTK_SIGNAL_FUNC(client_event_cb), NULL);
  899.   
  900. ***************
  901. *** 3744,3760 ****
  902.       GdkVisual        *visual;
  903.       GdkColormap        *cmap;
  904.       GdkColorContext    *cc;
  905. !     GdkColor        c;
  906.   
  907.       visual = gtk_widget_get_visual(gui.mainwin);
  908.       cmap = gtk_widget_get_colormap(gui.mainwin);
  909.       cc = gdk_color_context_new(visual, cmap);
  910.   
  911. !     c.pixel = pixel;
  912. !     gdk_color_context_query_color(cc, &c);
  913. !     return ((c.red & 0xff00) << 8) + (c.green & 0xff00)
  914. !                             + ((unsigned)c.blue >> 8);
  915.   }
  916.   
  917.   /*
  918. --- 3749,3767 ----
  919.       GdkVisual        *visual;
  920.       GdkColormap        *cmap;
  921.       GdkColorContext    *cc;
  922. !     GdkColor        color;
  923.   
  924.       visual = gtk_widget_get_visual(gui.mainwin);
  925.       cmap = gtk_widget_get_colormap(gui.mainwin);
  926.       cc = gdk_color_context_new(visual, cmap);
  927.   
  928. !     color.pixel = pixel;
  929. !     gdk_color_context_query_color(cc, &color);
  930. !     gdk_color_context_free(cc);
  931. !     return (((unsigned)color.red   & 0xff00) << 8)
  932. !      +  ((unsigned)color.green & 0xff00)
  933. !      + (((unsigned)color.blue  & 0xff00) >> 8);
  934.   }
  935.   
  936.   /*
  937. ***************
  938. *** 3882,3950 ****
  939.   #endif
  940.   
  941.   #if defined(FEAT_SIGN_ICONS) || defined(PROTO)
  942. ! /* Signs are currently always 2 chars wide.  Hopefully the font is big enough
  943. !  * to provide room for the bitmap! */
  944. ! # define SIGN_WIDTH (gui.char_width * 2)
  945.   # define SIGN_HEIGHT (gui.char_height)
  946.   
  947. ! #if 0    /* not used */
  948. !     void
  949. ! gui_mch_clearsign(row)
  950. !     int        row;
  951.   {
  952. !     if (gui.in_use)
  953. !     XClearArea(gui.dpy, gui.wid, 0, TEXT_Y(row) - gui.char_height,
  954. !         SIGN_WIDTH, gui.char_height, FALSE);
  955.   }
  956. ! #endif
  957.   
  958.       void
  959. ! gui_mch_drawsign(row, col, typenr)
  960. !     int        row;
  961. !     int        col;
  962. !     int        typenr;
  963.   {
  964. !     GdkPixmap    *sign = 0;
  965. !     gint    width;
  966. !     gint    height;
  967.   
  968. !     if (gui.in_use && (sign = (GdkPixmap *)sign_get_image(typenr)) != NULL)
  969.       {
  970. !     gdk_window_get_size(sign, &width, &height);
  971. !     gdk_window_clear_area(gui.drawarea->window, TEXT_X(col),
  972. !         TEXT_Y(row) - height,
  973. !         SIGN_WIDTH, gui.char_height);
  974. !     gdk_draw_pixmap(gui.drawarea->window, gui.text_gc, sign, 0, 0,
  975. !         TEXT_X(col) + (SIGN_WIDTH - width) / 2,
  976. !         TEXT_Y(row) - (SIGN_HEIGHT - height) / 2 - height,
  977. !         width, height);
  978.       }
  979.   }
  980.   
  981.       void *
  982. ! gui_mch_register_sign(signfile)
  983. !     char_u        *signfile;
  984.   {
  985. !     GdkPixmap        *sign;
  986.   
  987. !     sign = NULL;
  988. !     if (signfile[0] != NUL && signfile[0] != '-')
  989.       {
  990. !     sign = gdk_pixmap_create_from_xpm(gui.drawarea->window, NULL, NULL,
  991. !                        (char *)signfile);
  992. !     if (sign == NULL)
  993. !         EMSG(_("E255: Couldn't read in sign data!"));
  994. !     }
  995.   
  996. !     return (void *)sign;
  997.   }
  998.   
  999. - /*ARGSUSED*/
  1000.       void
  1001. ! gui_mch_destroy_sign(sign)
  1002. !     void *sign;
  1003.   {
  1004. !     /* ??? */
  1005.   }
  1006.   #endif /* FEAT_SIGN_ICONS */
  1007. --- 3889,4009 ----
  1008.   #endif
  1009.   
  1010.   #if defined(FEAT_SIGN_ICONS) || defined(PROTO)
  1011. ! /*
  1012. !  * Signs are currently always 2 chars wide.  The pixmap will be cut off
  1013. !  * if the current font is not big enough, or centered if it's too small.
  1014. !  */
  1015. ! # define SIGN_WIDTH  (2 * gui.char_width)
  1016.   # define SIGN_HEIGHT (gui.char_height)
  1017.   
  1018. ! typedef struct
  1019.   {
  1020. !     GdkPixmap *pixmap;
  1021. !     GdkBitmap *mask;
  1022.   }
  1023. ! signicon_T;
  1024.   
  1025.       void
  1026. ! gui_mch_drawsign(int row, int col, int typenr)
  1027.   {
  1028. !     signicon_T *sign;
  1029.   
  1030. !     sign = (signicon_T *)sign_get_image(typenr);
  1031. !     if (sign != NULL && sign->pixmap != NULL
  1032. !     && gui.drawarea != NULL && gui.drawarea->window != NULL)
  1033.       {
  1034. !     int width;
  1035. !     int height;
  1036. !     int xoffset;
  1037. !     int yoffset;
  1038. !     gdk_window_get_size(sign->pixmap, &width, &height);
  1039. !     /* The origin is the upper-left corner of the pixmap.  Therefore
  1040. !      * these offset may become negative if the pixmap is smaller than
  1041. !      * the 2x1 cells reserved for the sign icon. */
  1042. !     xoffset = (width  - SIGN_WIDTH)  / 2;
  1043. !     yoffset = (height - SIGN_HEIGHT) / 2;
  1044. !     gdk_gc_set_exposures(gui.text_gc,
  1045. !                  gui.visibility != GDK_VISIBILITY_UNOBSCURED);
  1046. !     gdk_gc_set_foreground(gui.text_gc, gui.bgcolor);
  1047. !     gdk_draw_rectangle(gui.drawarea->window,
  1048. !                gui.text_gc,
  1049. !                TRUE,
  1050. !                FILL_X(col),
  1051. !                FILL_Y(row),
  1052. !                SIGN_WIDTH,
  1053. !                SIGN_HEIGHT);
  1054. !     /* Set the clip mask for bilevel transparency */
  1055. !     if (sign->mask != NULL)
  1056. !     {
  1057. !         gdk_gc_set_clip_origin(gui.text_gc,
  1058. !                    FILL_X(col) - xoffset,
  1059. !                    FILL_Y(row) - yoffset);
  1060. !         gdk_gc_set_clip_mask(gui.text_gc, sign->mask);
  1061. !     }
  1062. !     gdk_draw_pixmap(gui.drawarea->window,
  1063. !             gui.text_gc,
  1064. !             sign->pixmap,
  1065. !             MAX(0, xoffset),
  1066. !             MAX(0, yoffset),
  1067. !             FILL_X(col) - MIN(0, xoffset),
  1068. !             FILL_Y(row) - MIN(0, yoffset),
  1069. !             MIN(width,  SIGN_WIDTH),
  1070. !             MIN(height, SIGN_HEIGHT));
  1071. !     gdk_gc_set_clip_mask(gui.text_gc, NULL);
  1072.       }
  1073.   }
  1074.   
  1075.       void *
  1076. ! gui_mch_register_sign(char_u *signfile)
  1077.   {
  1078. !     signicon_T *sign = NULL;
  1079.   
  1080. !     if (signfile[0] != NUL && signfile[0] != '-'
  1081. !     && gui.drawarea != NULL && gui.drawarea->window != NULL)
  1082.       {
  1083. !     sign = (signicon_T *)alloc(sizeof(signicon_T));
  1084.   
  1085. !     if (sign != NULL) /* NULL == OOM == "cannot really happen" */
  1086. !     {
  1087. !         sign->mask = NULL;
  1088. !         sign->pixmap = gdk_pixmap_colormap_create_from_xpm(
  1089. !             gui.drawarea->window, NULL,
  1090. !             &sign->mask, NULL,
  1091. !             (const char *)signfile);
  1092. !         if (sign->pixmap == NULL)
  1093. !         {
  1094. !         vim_free(sign);
  1095. !         sign = NULL;
  1096. !         EMSG(_("E255: Couldn't read in sign data!"));
  1097. !         }
  1098. !     }
  1099. !     }
  1100. !     return sign;
  1101.   }
  1102.   
  1103.       void
  1104. ! gui_mch_destroy_sign(void *sign)
  1105.   {
  1106. !     if (sign != NULL)
  1107. !     {
  1108. !     signicon_T *signicon = (signicon_T *)sign;
  1109. !     if (signicon->pixmap != NULL)
  1110. !         gdk_pixmap_unref(signicon->pixmap);
  1111. !     if (signicon->mask != NULL)
  1112. !         gdk_bitmap_unref(signicon->mask);
  1113. !     vim_free(signicon);
  1114. !     }
  1115.   }
  1116.   #endif /* FEAT_SIGN_ICONS */
  1117. *** ../vim61.388/src/eval.c    Tue Mar 11 12:43:38 2003
  1118. --- src/eval.c    Tue Mar 11 11:59:42 2003
  1119. ***************
  1120. *** 4230,4235 ****
  1121. --- 4231,4239 ----
  1122.   #ifdef FEAT_AUTOCMD
  1123.       "autocmd",
  1124.   #endif
  1125. + #ifdef FEAT_BEVAL
  1126. +     "balloon_eval",
  1127. + #endif
  1128.   #if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS)
  1129.       "builtin_terms",
  1130.   # ifdef ALL_BUILTIN_TCAPS
  1131. ***************
  1132. *** 4469,4474 ****
  1133. --- 4473,4481 ----
  1134.   #ifdef FEAT_SUN_WORKSHOP
  1135.       "sun_workshop",
  1136.   #endif
  1137. + #ifdef FEAT_NETBEANS_INTG
  1138. +     "netbeans_intg",
  1139. + #endif
  1140.   #ifdef FEAT_SYN_HL
  1141.       "syntax",
  1142.   #endif
  1143. *** ../vim61.388/src/memline.c    Sat Mar  8 20:33:32 2003
  1144. --- src/memline.c    Mon Mar 10 22:30:31 2003
  1145. ***************
  1146. *** 2436,2444 ****
  1147.       ml_updatechunk(buf, lnum + 1, (long)len, ML_CHNK_ADDLINE);
  1148.   #endif
  1149.   #ifdef FEAT_NETBEANS_INTG
  1150. !     if (STRLEN(line) > 0)
  1151. !     netbeans_inserted(buf, lnum+1, (colnr_T)0, 0, line, STRLEN(line));
  1152. !     netbeans_inserted(buf, lnum+1, (colnr_T)STRLEN(line), 0, (char_u *)"\n", 1);
  1153.   #endif
  1154.       return OK;
  1155.   }
  1156. --- 2436,2448 ----
  1157.       ml_updatechunk(buf, lnum + 1, (long)len, ML_CHNK_ADDLINE);
  1158.   #endif
  1159.   #ifdef FEAT_NETBEANS_INTG
  1160. !     if (usingNetbeans)
  1161. !     {
  1162. !     if (STRLEN(line) > 0)
  1163. !         netbeans_inserted(buf, lnum+1, (colnr_T)0, 0, line, STRLEN(line));
  1164. !     netbeans_inserted(buf, lnum+1, (colnr_T)STRLEN(line), 0,
  1165. !                                (char_u *)"\n", 1);
  1166. !     }
  1167.   #endif
  1168.       return OK;
  1169.   }
  1170. ***************
  1171. *** 2470,2477 ****
  1172.       if (copy && (line = vim_strsave(line)) == NULL) /* allocate memory */
  1173.       return FAIL;
  1174.   #ifdef FEAT_NETBEANS_INTG
  1175. !     netbeans_removed(curbuf, lnum, 0, (long)STRLEN(ml_get(lnum)));
  1176. !     netbeans_inserted(curbuf, lnum, 0, 0, line, STRLEN(line));
  1177.   #endif
  1178.       if (curbuf->b_ml.ml_line_lnum != lnum)        /* other line buffered */
  1179.       ml_flush_line(curbuf);                /* flush it */
  1180. --- 2474,2484 ----
  1181.       if (copy && (line = vim_strsave(line)) == NULL) /* allocate memory */
  1182.       return FAIL;
  1183.   #ifdef FEAT_NETBEANS_INTG
  1184. !     if (usingNetbeans)
  1185. !     {
  1186. !     netbeans_removed(curbuf, lnum, 0, (long)STRLEN(ml_get(lnum)));
  1187. !     netbeans_inserted(curbuf, lnum, 0, 0, line, STRLEN(line));
  1188. !     }
  1189.   #endif
  1190.       if (curbuf->b_ml.ml_line_lnum != lnum)        /* other line buffered */
  1191.       ml_flush_line(curbuf);                /* flush it */
  1192. ***************
  1193. *** 2574,2580 ****
  1194.       line_size = ((dp->db_index[idx - 1]) & DB_INDEX_MASK) - line_start;
  1195.   
  1196.   #ifdef FEAT_NETBEANS_INTG
  1197. !     netbeans_removed(buf, lnum, 0, line_size);
  1198.   #endif
  1199.   
  1200.   /*
  1201. --- 2581,2588 ----
  1202.       line_size = ((dp->db_index[idx - 1]) & DB_INDEX_MASK) - line_start;
  1203.   
  1204.   #ifdef FEAT_NETBEANS_INTG
  1205. !     if (usingNetbeans)
  1206. !     netbeans_removed(buf, lnum, 0, line_size);
  1207.   #endif
  1208.   
  1209.   /*
  1210. *** ../vim61.388/src/menu.c    Sun Oct 13 20:12:29 2002
  1211. --- src/menu.c    Mon Mar 10 22:48:47 2003
  1212. ***************
  1213. *** 570,576 ****
  1214.   #ifdef FEAT_GUI_MOTIF
  1215.           menu->sensitive = TRUE;        /* the default */
  1216.   #endif
  1217. ! #ifdef FEAT_BEVAL
  1218.           menu->tip = NULL;
  1219.   #endif
  1220.   #ifdef FEAT_GUI_ATHENA
  1221. --- 570,576 ----
  1222.   #ifdef FEAT_GUI_MOTIF
  1223.           menu->sensitive = TRUE;        /* the default */
  1224.   #endif
  1225. ! #ifdef FEAT_BEVAL_TIP
  1226.           menu->tip = NULL;
  1227.   #endif
  1228.   #ifdef FEAT_GUI_ATHENA
  1229. ***************
  1230. *** 764,770 ****
  1231.           menu->silent[i] = menuarg->silent[0];
  1232.           }
  1233.       }
  1234. ! #if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL)
  1235.       /* Need to update the menu tip. */
  1236.       if (modes & MENU_TIP_MODE)
  1237.           gui_mch_menu_set_tip(menu);
  1238. --- 764,770 ----
  1239.           menu->silent[i] = menuarg->silent[0];
  1240.           }
  1241.       }
  1242. ! #if defined(FEAT_TOOLBAR) && (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK))
  1243.       /* Need to update the menu tip. */
  1244.       if (modes & MENU_TIP_MODE)
  1245.           gui_mch_menu_set_tip(menu);
  1246. ***************
  1247. *** 942,948 ****
  1248.       if (modes & MENU_TIP_MODE)
  1249.       {
  1250.           free_menu_string(menu, MENU_INDEX_TIP);
  1251. ! #if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL)
  1252.           /* Need to update the menu tip. */
  1253.           if (gui.in_use)
  1254.           gui_mch_menu_set_tip(menu);
  1255. --- 942,948 ----
  1256.       if (modes & MENU_TIP_MODE)
  1257.       {
  1258.           free_menu_string(menu, MENU_INDEX_TIP);
  1259. ! #if defined(FEAT_TOOLBAR) && (defined(FEAT_BEVAL) || defined(FEAT_GUI_GTK))
  1260.           /* Need to update the menu tip. */
  1261.           if (gui.in_use)
  1262.           gui_mch_menu_set_tip(menu);
  1263. *** ../vim61.388/src/netbeans.c    Sat Mar  8 20:33:32 2003
  1264. --- src/netbeans.c    Mon Mar 10 22:32:25 2003
  1265. ***************
  1266. *** 57,62 ****
  1267. --- 57,65 ----
  1268.   static int  nb_do_cmd __ARGS((int, char_u *, int, int, char_u *));
  1269.   static void nb_send __ARGS((char *buf, char *fun));
  1270.   static void warn __ARGS((char *fmt, ...));
  1271. + #ifdef FEAT_BEVAL
  1272. + static void netbeans_beval_cb __ARGS((BalloonEval *beval, int state));
  1273. + #endif
  1274.   
  1275.   static int sd = -1;            /* socket fd for Netbeans connection */
  1276.   #ifdef FEAT_GUI_MOTIF
  1277. ***************
  1278. *** 72,79 ****
  1279.   static int oldFire = 1;
  1280.   static int exit_delay = 2;        /* exit delay in seconds */
  1281.   
  1282. ! #if defined(FEAT_BEVAL)
  1283.   extern Widget    textArea;
  1284.   BalloonEval    *balloonEval = NULL;
  1285.   #endif
  1286.   
  1287. --- 75,84 ----
  1288.   static int oldFire = 1;
  1289.   static int exit_delay = 2;        /* exit delay in seconds */
  1290.   
  1291. ! #ifdef FEAT_BEVAL
  1292. ! # if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)
  1293.   extern Widget    textArea;
  1294. + # endif
  1295.   BalloonEval    *balloonEval = NULL;
  1296.   #endif
  1297.   
  1298. ***************
  1299. *** 118,123 ****
  1300. --- 123,139 ----
  1301.       void
  1302.   netbeans_gtk_connect(void)
  1303.   {
  1304. + # ifdef FEAT_BEVAL
  1305. +     /*
  1306. +      * Set up the Balloon Expression Evaluation area.
  1307. +      * Always create it but disable it when 'ballooneval' isn't set.
  1308. +      */
  1309. +     balloonEval = gui_mch_create_beval_area(gui.drawarea, NULL,
  1310. +                         &netbeans_beval_cb, NULL);
  1311. +     if (!p_beval)
  1312. +     gui_mch_disable_beval_area(balloonEval);
  1313. + # endif
  1314.       netbeans_connect();
  1315.       if (sd > 0)
  1316.       {
  1317. ***************
  1318. *** 2175,2193 ****
  1319.   {
  1320.       char *cmd = "0:startupDone=0\n";
  1321.   
  1322.       nbdebug(("EVT: %s", cmd));
  1323.       nb_send(cmd, "netbeans_startup_done");
  1324.   
  1325. ! #if defined(FEAT_BEVAL)
  1326. !     /*
  1327. !      * Set up the Balloon Expression Evaluation area.
  1328. !      * Always create it but disable it when 'ballooneval' isn't set.
  1329. !      */
  1330. !     balloonEval = gui_mch_create_beval_area(textArea, NULL,
  1331. !                              netbeans_beval_cb, NULL);
  1332. !     if (!p_beval)
  1333. !     gui_mch_disable_beval_area(balloonEval);
  1334. ! #endif
  1335.   }
  1336.   
  1337.   #if defined(FEAT_GUI_MOTIF) || defined(PROTO)
  1338. --- 2191,2216 ----
  1339.   {
  1340.       char *cmd = "0:startupDone=0\n";
  1341.   
  1342. +     if (!haveConnection)
  1343. +     return;
  1344.       nbdebug(("EVT: %s", cmd));
  1345.       nb_send(cmd, "netbeans_startup_done");
  1346.   
  1347. ! # if defined(FEAT_BEVAL) && defined(FEAT_GUI_MOTIF)
  1348. !     if (gui.in_use)
  1349. !     {
  1350. !     /*
  1351. !      * Set up the Balloon Expression Evaluation area for Motif.
  1352. !      * GTK can do it earlier...
  1353. !      * Always create it but disable it when 'ballooneval' isn't set.
  1354. !      */
  1355. !     balloonEval = gui_mch_create_beval_area(textArea, NULL,
  1356. !                             &netbeans_beval_cb, NULL);
  1357. !     if (!p_beval)
  1358. !         gui_mch_disable_beval_area(balloonEval);
  1359. !     }
  1360. ! # endif
  1361.   }
  1362.   
  1363.   #if defined(FEAT_GUI_MOTIF) || defined(PROTO)
  1364. ***************
  1365. *** 2199,2204 ****
  1366. --- 2222,2230 ----
  1367.   {
  1368.       char buf[128];
  1369.   
  1370. +     if (!haveConnection)
  1371. +     return;
  1372.       sprintf(buf, "0:geometry=%d %d %d %d %d\n",
  1373.               cmdno, (int)Columns, (int)Rows, new_x, new_y);
  1374.       nbdebug(("EVT: %s", buf));
  1375. ***************
  1376. *** 2214,2219 ****
  1377. --- 2240,2248 ----
  1378.   {
  1379.       char buffer[2*MAXPATHLEN];
  1380.   
  1381. +     if (!haveConnection)
  1382. +     return;
  1383.       sprintf(buffer, "0:fileOpened=%d \"%s\" %s %s\n",
  1384.           0,
  1385.           filename,
  1386. ***************
  1387. *** 2237,2242 ****
  1388. --- 2266,2274 ----
  1389.       nbbuf_T    *nbbuf = nb_get_buf(bufno);
  1390.       char    buffer[2*MAXPATHLEN];
  1391.   
  1392. +     if (!haveConnection)
  1393. +     return;
  1394.       if (!netbeansCloseFile)
  1395.       {
  1396.       nbdebug(("ignoring file_closed for %s\n", bufp->b_ffname));
  1397. ***************
  1398. *** 2271,2277 ****
  1399.       int        bufno;
  1400.       nbbuf_T    *nbbuf;
  1401.   
  1402. !     if (!netbeansFireChanges)
  1403.       return NULL;        /* changes are not reported at all */
  1404.   
  1405.       bufno = nb_getbufno(bufp);
  1406. --- 2303,2309 ----
  1407.       int        bufno;
  1408.       nbbuf_T    *nbbuf;
  1409.   
  1410. !     if (!haveConnection || !netbeansFireChanges)
  1411.       return NULL;        /* changes are not reported at all */
  1412.   
  1413.       bufno = nb_getbufno(bufp);
  1414. *** ../vim61.388/src/proto/gui_beval.pro    Sat Mar  8 20:33:32 2003
  1415. --- src/proto/gui_beval.pro    Mon Mar 10 20:04:17 2003
  1416. ***************
  1417. *** 1,5 ****
  1418.   /* gui_beval.c */
  1419. ! BalloonEval *gui_mch_create_beval_area __ARGS((Widget target, char_u *mesg, void (*mesgCB)(BalloonEval *, int), XtPointer clientData));
  1420.   void gui_mch_destroy_beval_area __ARGS((BalloonEval *beval));
  1421.   void gui_mch_enable_beval_area __ARGS((BalloonEval *beval));
  1422.   void gui_mch_disable_beval_area __ARGS((BalloonEval *beval));
  1423. --- 1,5 ----
  1424.   /* gui_beval.c */
  1425. ! BalloonEval *gui_mch_create_beval_area __ARGS((void *target, char_u *mesg, void (*mesgCB)(BalloonEval *, int), void *clientData));
  1426.   void gui_mch_destroy_beval_area __ARGS((BalloonEval *beval));
  1427.   void gui_mch_enable_beval_area __ARGS((BalloonEval *beval));
  1428.   void gui_mch_disable_beval_area __ARGS((BalloonEval *beval));
  1429. *** ../vim61.388/src/proto/gui_gtk.pro    Fri Mar 22 21:41:26 2002
  1430. --- src/proto/gui_gtk.pro    Mon Mar 10 20:04:17 2003
  1431. ***************
  1432. *** 4,9 ****
  1433. --- 4,10 ----
  1434.   void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h));
  1435.   void gui_gtk_set_mnemonics __ARGS((int enable));
  1436.   void gui_mch_toggle_tearoffs __ARGS((int enable));
  1437. + void gui_mch_menu_set_tip __ARGS((vimmenu_T *menu));
  1438.   void gui_mch_destroy_menu __ARGS((vimmenu_T *menu));
  1439.   void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, long max));
  1440.   void gui_mch_set_scrollbar_pos __ARGS((scrollbar_T *sb, int x, int y, int w, int h));
  1441. *** ../vim61.388/src/structs.h    Sun Mar  9 14:35:27 2003
  1442. --- src/structs.h    Mon Mar 10 22:49:53 2003
  1443. ***************
  1444. *** 1614,1620 ****
  1445.   #ifdef FEAT_GUI_MOTIF
  1446.       Pixmap    image_ins;        /* Toolbar image insensitive */
  1447.   #endif
  1448. ! #ifdef FEAT_BEVAL
  1449.       BalloonEval *tip;            /* tooltip for this menu item */
  1450.   #endif
  1451.   #ifdef FEAT_GUI_W16
  1452. --- 1616,1622 ----
  1453.   #ifdef FEAT_GUI_MOTIF
  1454.       Pixmap    image_ins;        /* Toolbar image insensitive */
  1455.   #endif
  1456. ! #ifdef FEAT_BEVAL_TIP
  1457.       BalloonEval *tip;            /* tooltip for this menu item */
  1458.   #endif
  1459.   #ifdef FEAT_GUI_W16
  1460. *** ../vim61.388/src/syntax.c    Sun Mar  9 14:35:27 2003
  1461. --- src/syntax.c    Mon Mar 10 22:51:01 2003
  1462. ***************
  1463. *** 6173,6179 ****
  1464.            */
  1465.           if (gui.in_use)
  1466.           {
  1467. ! # ifdef FEAT_BEVAL
  1468.           gui_init_tooltip_font();
  1469.   # endif
  1470.   # if defined(FEAT_MENU) && (defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF))
  1471. --- 6173,6179 ----
  1472.            */
  1473.           if (gui.in_use)
  1474.           {
  1475. ! # ifdef FEAT_BEVAL_TIP
  1476.           gui_init_tooltip_font();
  1477.   # endif
  1478.   # if defined(FEAT_MENU) && (defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF))
  1479. ***************
  1480. *** 7179,7185 ****
  1481.   #  ifdef FONTSET_ALWAYS
  1482.       || do_menu
  1483.   #  endif
  1484. ! #  ifdef FEAT_BEVAL
  1485.       /* In Athena & Motif, the Tooltip highlight group is always a fontset */
  1486.       || do_tooltip
  1487.   #  endif
  1488. --- 7179,7185 ----
  1489.   #  ifdef FONTSET_ALWAYS
  1490.       || do_menu
  1491.   #  endif
  1492. ! #  ifdef FEAT_BEVAL_TIP
  1493.       /* In Athena & Motif, the Tooltip highlight group is always a fontset */
  1494.       || do_tooltip
  1495.   #  endif
  1496. ***************
  1497. *** 7188,7194 ****
  1498.   #  ifdef FONTSET_ALWAYS
  1499.           || do_menu
  1500.   #  endif
  1501. ! #  ifdef FEAT_BEVAL
  1502.           || do_tooltip
  1503.   #  endif
  1504.           );
  1505. --- 7188,7194 ----
  1506.   #  ifdef FONTSET_ALWAYS
  1507.           || do_menu
  1508.   #  endif
  1509. ! #  ifdef FEAT_BEVAL_TIP
  1510.           || do_tooltip
  1511.   #  endif
  1512.           );
  1513. *** ../vim61.388/src/ui.c    Sun Mar  9 14:08:43 2003
  1514. --- src/ui.c    Mon Mar 10 22:34:08 2003
  1515. ***************
  1516. *** 2682,2688 ****
  1517.       if (col < 0)
  1518.       {
  1519.   #ifdef FEAT_NETBEANS_INTG
  1520. !     netbeans_gutter_click(lnum);
  1521.   #endif
  1522.       col = 0;
  1523.       }
  1524. --- 2682,2689 ----
  1525.       if (col < 0)
  1526.       {
  1527.   #ifdef FEAT_NETBEANS_INTG
  1528. !     if (usingNetbeans)
  1529. !         netbeans_gutter_click(lnum);
  1530.   #endif
  1531.       col = 0;
  1532.       }
  1533. *** ../vim61.388/src/workshop.c    Sat Mar  8 20:33:33 2003
  1534. --- src/workshop.c    Mon Mar 10 20:04:17 2003
  1535. ***************
  1536. *** 226,232 ****
  1537. --- 226,237 ----
  1538.        * Set up the Balloon Expression Evaluation area.
  1539.        * It's enabled by default.  Disable it when 'ballooneval' is off.
  1540.        */
  1541. + # ifdef FEAT_GUI_GTK
  1542. +     balloonEval = gui_mch_create_beval_area(gui.drawarea, NULL,
  1543. +                         &bevalCB, NULL);
  1544. + # else
  1545.       balloonEval = gui_mch_create_beval_area(textArea, NULL, bevalCB, NULL);
  1546. + # endif
  1547.       if (!p_beval)
  1548.           gui_mch_disable_beval_area(balloonEval);
  1549.       }
  1550. *** ../vim61.388/src/version.c    Tue Mar 11 12:43:38 2003
  1551. --- src/version.c    Tue Mar 11 12:45:58 2003
  1552. ***************
  1553. *** 613,614 ****
  1554. --- 613,616 ----
  1555.   {   /* Add new patch number below this line */
  1556. + /**/
  1557. +     389,
  1558.   /**/
  1559.  
  1560. -- 
  1561. How To Keep A Healthy Level Of Insanity:
  1562. 15. Five days in advance, tell your friends you can't attend their
  1563.     party because you're not in the mood.
  1564.  
  1565.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  1566. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  1567. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  1568.  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
  1569.