Mercurial > vim
comparison src/netbeans.c @ 944:b2dcb8457067 v7.0.070
updated for version 7.0-070
author | vimboss |
---|---|
date | Tue, 29 Aug 2006 15:30:07 +0000 |
parents | ba9375e24d49 |
children | 7df2d171ef1c |
comparison
equal
deleted
inserted
replaced
943:e70aad5761b5 | 944:b2dcb8457067 |
---|---|
101 #endif | 101 #endif |
102 #ifdef FEAT_GUI_W32 | 102 #ifdef FEAT_GUI_W32 |
103 static int inputHandler = -1; /* simply ret.value of WSAAsyncSelect() */ | 103 static int inputHandler = -1; /* simply ret.value of WSAAsyncSelect() */ |
104 extern HWND s_hwnd; /* Gvim's Window handle */ | 104 extern HWND s_hwnd; /* Gvim's Window handle */ |
105 #endif | 105 #endif |
106 static int cmdno; /* current command number for reply */ | 106 static int r_cmdno; /* current command number for reply */ |
107 static int haveConnection = FALSE; /* socket is connected and | 107 static int haveConnection = FALSE; /* socket is connected and |
108 initialization is done */ | 108 initialization is done */ |
109 #ifdef FEAT_GUI_MOTIF | 109 #ifdef FEAT_GUI_MOTIF |
110 static void netbeans_Xt_connect __ARGS((void *context)); | 110 static void netbeans_Xt_connect __ARGS((void *context)); |
111 #endif | 111 #endif |
830 { | 830 { |
831 EMSG2("E628: missing ! or / in: %s", cmd); | 831 EMSG2("E628: missing ! or / in: %s", cmd); |
832 return; | 832 return; |
833 } | 833 } |
834 | 834 |
835 cmdno = strtol(q, &q, 10); | 835 r_cmdno = strtol(q, &q, 10); |
836 | 836 |
837 q = (char *)skipwhite((char_u *)q); | 837 q = (char *)skipwhite((char_u *)q); |
838 | 838 |
839 if (nb_do_cmd(bufno, (char_u *)verb, isfunc, cmdno, (char_u *)q) == FAIL) | 839 if (nb_do_cmd(bufno, (char_u *)verb, isfunc, r_cmdno, (char_u *)q) == FAIL) |
840 { | 840 { |
841 #ifdef NBDEBUG | 841 #ifdef NBDEBUG |
842 /* | 842 /* |
843 * This happens because the ExtEd can send a cammand or 2 after | 843 * This happens because the ExtEd can send a cammand or 2 after |
844 * doing a stopDocumentListen command. It doesn't harm anything | 844 * doing a stopDocumentListen command. It doesn't harm anything |
1006 if (!buf_list[i].bufp) | 1006 if (!buf_list[i].bufp) |
1007 continue; | 1007 continue; |
1008 if (netbeansForcedQuit) | 1008 if (netbeansForcedQuit) |
1009 { | 1009 { |
1010 /* mark as unmodified so NetBeans won't put up dialog on "killed" */ | 1010 /* mark as unmodified so NetBeans won't put up dialog on "killed" */ |
1011 sprintf(buf, "%d:unmodified=%d\n", i, cmdno); | 1011 sprintf(buf, "%d:unmodified=%d\n", i, r_cmdno); |
1012 nbdebug(("EVT: %s", buf)); | 1012 nbdebug(("EVT: %s", buf)); |
1013 nb_send(buf, "netbeans_end"); | 1013 nb_send(buf, "netbeans_end"); |
1014 } | 1014 } |
1015 sprintf(buf, "%d:killed=%d\n", i, cmdno); | 1015 sprintf(buf, "%d:killed=%d\n", i, r_cmdno); |
1016 nbdebug(("EVT: %s", buf)); | 1016 nbdebug(("EVT: %s", buf)); |
1017 /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ | 1017 /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ |
1018 if (sd >= 0) | 1018 if (sd >= 0) |
1019 sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */ | 1019 sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */ |
1020 } | 1020 } |
2561 { | 2561 { |
2562 p = nb_quote(text); | 2562 p = nb_quote(text); |
2563 if (p != NULL) | 2563 if (p != NULL) |
2564 { | 2564 { |
2565 vim_snprintf(buf, sizeof(buf), | 2565 vim_snprintf(buf, sizeof(buf), |
2566 "0:balloonText=%d \"%s\"\n", cmdno, p); | 2566 "0:balloonText=%d \"%s\"\n", r_cmdno, p); |
2567 vim_free(p); | 2567 vim_free(p); |
2568 } | 2568 } |
2569 nbdebug(("EVT: %s", buf)); | 2569 nbdebug(("EVT: %s", buf)); |
2570 nb_send(buf, "netbeans_beval_cb"); | 2570 nb_send(buf, "netbeans_beval_cb"); |
2571 } | 2571 } |
2615 { | 2615 { |
2616 char buf[128]; | 2616 char buf[128]; |
2617 | 2617 |
2618 if (haveConnection) | 2618 if (haveConnection) |
2619 { | 2619 { |
2620 sprintf(buf, "0:disconnect=%d\n", cmdno); | 2620 sprintf(buf, "0:disconnect=%d\n", r_cmdno); |
2621 nbdebug(("EVT: %s", buf)); | 2621 nbdebug(("EVT: %s", buf)); |
2622 nb_send(buf, "netbeans_disconnect"); | 2622 nb_send(buf, "netbeans_disconnect"); |
2623 } | 2623 } |
2624 } | 2624 } |
2625 | 2625 |
2634 | 2634 |
2635 if (!haveConnection) | 2635 if (!haveConnection) |
2636 return; | 2636 return; |
2637 | 2637 |
2638 sprintf(buf, "0:geometry=%d %d %d %d %d\n", | 2638 sprintf(buf, "0:geometry=%d %d %d %d %d\n", |
2639 cmdno, (int)Columns, (int)Rows, new_x, new_y); | 2639 r_cmdno, (int)Columns, (int)Rows, new_x, new_y); |
2640 /*nbdebug(("EVT: %s", buf)); happens too many times during a move */ | 2640 /*nbdebug(("EVT: %s", buf)); happens too many times during a move */ |
2641 nb_send(buf, "netbeans_frame_moved"); | 2641 nb_send(buf, "netbeans_frame_moved"); |
2642 } | 2642 } |
2643 #endif | 2643 #endif |
2644 | 2644 |
2743 } | 2743 } |
2744 | 2744 |
2745 if (bufno <= 0) | 2745 if (bufno <= 0) |
2746 return; | 2746 return; |
2747 | 2747 |
2748 sprintf(buffer, "%d:killed=%d\n", bufno, cmdno); | 2748 sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno); |
2749 | 2749 |
2750 nbdebug(("EVT: %s", buffer)); | 2750 nbdebug(("EVT: %s", buffer)); |
2751 | 2751 |
2752 nb_send(buffer, "netbeans_file_closed"); | 2752 nb_send(buffer, "netbeans_file_closed"); |
2753 | 2753 |
2817 vim_strncpy(newtxt, txt, newlen); | 2817 vim_strncpy(newtxt, txt, newlen); |
2818 p = nb_quote(newtxt); | 2818 p = nb_quote(newtxt); |
2819 if (p != NULL) | 2819 if (p != NULL) |
2820 { | 2820 { |
2821 buf = alloc(128 + 2*newlen); | 2821 buf = alloc(128 + 2*newlen); |
2822 sprintf((char *)buf, "%d:insert=%d %ld \"%s\"\n", bufno, cmdno, off, p); | 2822 sprintf((char *)buf, "%d:insert=%d %ld \"%s\"\n", |
2823 bufno, r_cmdno, off, p); | |
2823 nbdebug(("EVT: %s", buf)); | 2824 nbdebug(("EVT: %s", buf)); |
2824 nb_send((char *)buf, "netbeans_inserted"); | 2825 nb_send((char *)buf, "netbeans_inserted"); |
2825 vim_free(p); | 2826 vim_free(p); |
2826 vim_free(buf); | 2827 vim_free(buf); |
2827 } | 2828 } |
2859 pos.lnum = linenr; | 2860 pos.lnum = linenr; |
2860 pos.col = col; | 2861 pos.col = col; |
2861 | 2862 |
2862 off = pos2off(bufp, &pos); | 2863 off = pos2off(bufp, &pos); |
2863 | 2864 |
2864 sprintf((char *)buf, "%d:remove=%d %ld %ld\n", bufno, cmdno, off, len); | 2865 sprintf((char *)buf, "%d:remove=%d %ld %ld\n", bufno, r_cmdno, off, len); |
2865 nbdebug(("EVT: %s", buf)); | 2866 nbdebug(("EVT: %s", buf)); |
2866 nb_send((char *)buf, "netbeans_removed"); | 2867 nb_send((char *)buf, "netbeans_removed"); |
2867 } | 2868 } |
2868 | 2869 |
2869 /* | 2870 /* |
2884 if (nbbuf == NULL) | 2885 if (nbbuf == NULL) |
2885 return; | 2886 return; |
2886 | 2887 |
2887 nbbuf->modified = 0; | 2888 nbbuf->modified = 0; |
2888 | 2889 |
2889 sprintf((char *)buf, "%d:unmodified=%d\n", bufno, cmdno); | 2890 sprintf((char *)buf, "%d:unmodified=%d\n", bufno, r_cmdno); |
2890 nbdebug(("EVT: %s", buf)); | 2891 nbdebug(("EVT: %s", buf)); |
2891 nb_send((char *)buf, "netbeans_unmodified"); | 2892 nb_send((char *)buf, "netbeans_unmodified"); |
2892 #endif | 2893 #endif |
2893 } | 2894 } |
2894 | 2895 |
2908 { | 2909 { |
2909 int col = mouse_col - W_WINCOL(curwin) - (curwin->w_p_nu ? 9 : 1); | 2910 int col = mouse_col - W_WINCOL(curwin) - (curwin->w_p_nu ? 9 : 1); |
2910 long off = pos2off(curbuf, &curwin->w_cursor); | 2911 long off = pos2off(curbuf, &curwin->w_cursor); |
2911 | 2912 |
2912 /* sync the cursor position */ | 2913 /* sync the cursor position */ |
2913 sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, cmdno, off, off); | 2914 sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, r_cmdno, off, off); |
2914 nbdebug(("EVT: %s", buf)); | 2915 nbdebug(("EVT: %s", buf)); |
2915 nb_send(buf, "netbeans_button_release[newDotAndMark]"); | 2916 nb_send(buf, "netbeans_button_release[newDotAndMark]"); |
2916 | 2917 |
2917 sprintf(buf, "%d:buttonRelease=%d %d %ld %d\n", bufno, cmdno, | 2918 sprintf(buf, "%d:buttonRelease=%d %d %ld %d\n", bufno, r_cmdno, |
2918 button, (long)curwin->w_cursor.lnum, col); | 2919 button, (long)curwin->w_cursor.lnum, col); |
2919 nbdebug(("EVT: %s", buf)); | 2920 nbdebug(("EVT: %s", buf)); |
2920 nb_send(buf, "netbeans_button_release"); | 2921 nb_send(buf, "netbeans_button_release"); |
2921 } | 2922 } |
2922 } | 2923 } |
2973 return; | 2974 return; |
2974 } | 2975 } |
2975 | 2976 |
2976 /* sync the cursor position */ | 2977 /* sync the cursor position */ |
2977 off = pos2off(curbuf, &curwin->w_cursor); | 2978 off = pos2off(curbuf, &curwin->w_cursor); |
2978 sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, cmdno, off, off); | 2979 sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, r_cmdno, off, off); |
2979 nbdebug(("EVT: %s", buf)); | 2980 nbdebug(("EVT: %s", buf)); |
2980 nb_send(buf, "netbeans_keycommand"); | 2981 nb_send(buf, "netbeans_keycommand"); |
2981 | 2982 |
2982 /* To work on Win32 you must apply patch to ExtEditor module | 2983 /* To work on Win32 you must apply patch to ExtEditor module |
2983 * from ExtEdCaret.java.diff - make EVT_newDotAndMark handler | 2984 * from ExtEdCaret.java.diff - make EVT_newDotAndMark handler |
2984 * more synchronous | 2985 * more synchronous |
2985 */ | 2986 */ |
2986 | 2987 |
2987 /* now send keyCommand event */ | 2988 /* now send keyCommand event */ |
2988 vim_snprintf(buf, sizeof(buf), "%d:keyCommand=%d \"%s\"\n", | 2989 vim_snprintf(buf, sizeof(buf), "%d:keyCommand=%d \"%s\"\n", |
2989 bufno, cmdno, keyName); | 2990 bufno, r_cmdno, keyName); |
2990 nbdebug(("EVT: %s", buf)); | 2991 nbdebug(("EVT: %s", buf)); |
2991 nb_send(buf, "netbeans_keycommand"); | 2992 nb_send(buf, "netbeans_keycommand"); |
2992 | 2993 |
2993 /* New: do both at once and include the lnum/col. */ | 2994 /* New: do both at once and include the lnum/col. */ |
2994 vim_snprintf(buf, sizeof(buf), "%d:keyAtPos=%d \"%s\" %ld %ld/%ld\n", | 2995 vim_snprintf(buf, sizeof(buf), "%d:keyAtPos=%d \"%s\" %ld %ld/%ld\n", |
2995 bufno, cmdno, keyName, | 2996 bufno, r_cmdno, keyName, |
2996 off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col); | 2997 off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col); |
2997 nbdebug(("EVT: %s", buf)); | 2998 nbdebug(("EVT: %s", buf)); |
2998 nb_send(buf, "netbeans_keycommand"); | 2999 nb_send(buf, "netbeans_keycommand"); |
2999 } | 3000 } |
3000 | 3001 |
3013 if (nbbuf == NULL) | 3014 if (nbbuf == NULL) |
3014 return; | 3015 return; |
3015 | 3016 |
3016 nbbuf->modified = 0; | 3017 nbbuf->modified = 0; |
3017 | 3018 |
3018 sprintf((char *)buf, "%d:save=%d\n", bufno, cmdno); | 3019 sprintf((char *)buf, "%d:save=%d\n", bufno, r_cmdno); |
3019 nbdebug(("EVT: %s", buf)); | 3020 nbdebug(("EVT: %s", buf)); |
3020 nb_send((char *)buf, "netbeans_save_buffer"); | 3021 nb_send((char *)buf, "netbeans_save_buffer"); |
3021 } | 3022 } |
3022 | 3023 |
3023 | 3024 |
3037 | 3038 |
3038 /* Don't mark as modified for initial read */ | 3039 /* Don't mark as modified for initial read */ |
3039 if (nbbuf->insertDone) | 3040 if (nbbuf->insertDone) |
3040 nbbuf->modified = 1; | 3041 nbbuf->modified = 1; |
3041 | 3042 |
3042 sprintf((char *)buf, "%d:remove=%d 0 -1\n", bufno, cmdno); | 3043 sprintf((char *)buf, "%d:remove=%d 0 -1\n", bufno, r_cmdno); |
3043 nbdebug(("EVT(suppressed): %s", buf)); | 3044 nbdebug(("EVT(suppressed): %s", buf)); |
3044 /* nb_send(buf, "netbeans_deleted_all_lines"); */ | 3045 /* nb_send(buf, "netbeans_deleted_all_lines"); */ |
3045 } | 3046 } |
3046 | 3047 |
3047 | 3048 |