summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-04-09 21:54:49 +0000
committerBram Moolenaar <Bram@vim.org>2006-04-09 21:54:49 +0000
commitc6fe919573e82727a7de014daab122ffc5001854 (patch)
tree237b3cac7ceeee2c16d574a99f1c37e9bd94ea53 /src
parent61660eadced09491ef8ee0a7d4af73cc75fdc349 (diff)
updated for version 7.0c13v7.0c13
Diffstat (limited to 'src')
-rw-r--r--src/gui.c21
-rw-r--r--src/gui_gtk_x11.c9
-rw-r--r--src/gui_motif.c109
-rw-r--r--src/gui_w32.c12
-rw-r--r--src/gui_w48.c10
-rw-r--r--src/option.c2
-rw-r--r--src/proto/gui.pro1
-rw-r--r--src/proto/window.pro114
-rw-r--r--src/structs.h2
-rw-r--r--src/version.h6
-rw-r--r--src/window.c29
11 files changed, 199 insertions, 116 deletions
diff --git a/src/gui.c b/src/gui.c
index 4c7c775846..208b72154f 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -591,7 +591,7 @@ gui_init()
/* When 'cmdheight' was set during startup it may not have taken
* effect yet. */
if (p_ch != 1L)
- command_height(-1L);
+ command_height();
return;
}
@@ -3497,6 +3497,25 @@ send_tabline_event(nr)
return TRUE;
}
+/*
+ * Send a tabline menu event
+ */
+ void
+send_tabline_menu_event(tabidx, event)
+ int tabidx;
+ int event;
+{
+ char_u string[3];
+
+ string[0] = CSI;
+ string[1] = KS_TABMENU;
+ string[2] = KE_FILLER;
+ add_to_input_buf(string, 3);
+ string[0] = tabidx;
+ string[1] = (char_u)(long)event;
+ add_to_input_buf_csi(string, 2);
+}
+
#endif
/*
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 832933a554..adb603a6c9 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -3128,16 +3128,9 @@ static int clicked_page; /* page clicked in tab line */
static void
tabline_menu_handler(GtkMenuItem *item, gpointer user_data)
{
- char_u string[3];
/* Add the string cmd into input buffer */
- string[0] = CSI;
- string[1] = KS_TABMENU;
- string[2] = KE_FILLER;
- add_to_input_buf(string, 3);
- string[0] = clicked_page;
- string[1] = (char_u)(long)user_data;
- add_to_input_buf_csi(string, 2);
+ send_tabline_menu_event(clicked_page, (int)(long)user_data);
if (gtk_main_level() > 0)
gtk_main_quit();
diff --git a/src/gui_motif.c b/src/gui_motif.c
index a98c9d1c60..4caecc308d 100644
--- a/src/gui_motif.c
+++ b/src/gui_motif.c
@@ -27,6 +27,7 @@
#include <Xm/ToggleBG.h>
#include <Xm/SeparatoG.h>
#include <Xm/Notebook.h>
+#include <Xm/XmP.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
@@ -151,19 +152,52 @@ tabline_button_cb(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
{
- char_u string[3];
int cmd, tab_idx;
XtVaGetValues(w, XmNuserData, &cmd, NULL);
XtVaGetValues(tabLine_menu, XmNuserData, &tab_idx, NULL);
- string[0] = CSI;
- string[1] = KS_TABMENU;
- string[2] = KE_FILLER;
- add_to_input_buf(string, 3);
- string[0] = tab_idx;
- string[1] = (char_u)(long)cmd;
- add_to_input_buf_csi(string, 2);
+ send_tabline_menu_event(tab_idx, cmd);
+}
+
+/*
+ * Tabline single mouse click timeout handler
+ */
+/*ARGSUSED*/
+ static void
+motif_tabline_timer_cb (timed_out, interval_id)
+ XtPointer timed_out;
+ XtIntervalId *interval_id;
+{
+ *((int *)timed_out) = TRUE;
+}
+
+/*
+ * check if the tabline tab scroller is clicked
+ */
+ static int
+tabline_scroller_clicked(scroller_name, event)
+ char *scroller_name;
+ XButtonPressedEvent *event;
+{
+ Widget tab_scroll_w;
+ Position pos_x, pos_y;
+ Dimension width, height;
+
+ tab_scroll_w = XtNameToWidget(tabLine, scroller_name);
+ if (tab_scroll_w != (Widget)0) {
+ XtVaGetValues(tab_scroll_w, XmNx, &pos_x, XmNy, &pos_y, XmNwidth,
+ &width, XmNheight, &height, NULL);
+ if (pos_x >= 0) {
+ /* Tab scroller (next) is visible */
+ if ((event->x >= pos_x) && (event->x <= pos_x + width) &&
+ (event->y >= pos_y) && (event->y <= pos_y + height)) {
+ /* Clicked on the scroller */
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
}
/*ARGSUSED*/
@@ -179,15 +213,47 @@ tabline_menu_cb(w, closure, e, continue_dispatch)
int tab_idx = 0;
WidgetList children;
Cardinal numChildren;
+ static XtIntervalId timer = (XtIntervalId)0;
+ static int timed_out = TRUE;
event = (XButtonPressedEvent *)e;
+ if (event->button == Button1)
+ {
+ if (tabline_scroller_clicked("MajorTabScrollerNext", event)
+ || tabline_scroller_clicked("MajorTabScrollerPrevious", event))
+ return;
+
+ if (!timed_out)
+ {
+ XtRemoveTimeOut(timer);
+ timed_out = TRUE;
+
+ /*
+ * Double click on the tabline gutter, add a new tab
+ */
+ send_tabline_menu_event(0, TABLINE_MENU_NEW);
+ }
+ else
+ {
+ /*
+ * Single click on the tabline gutter, start a timer to check
+ * for double clicks
+ */
+ timer = XtAppAddTimeOut(app_context, (long_u)p_mouset,
+ motif_tabline_timer_cb, &timed_out);
+ timed_out = FALSE;
+ }
+ return;
+ }
+
if (event->button != Button3)
return;
if (event->subwindow != None)
{
tab_w = XtWindowToWidget(XtDisplay(w), event->subwindow);
+ /* LINTED: avoid warning: dubious operation on enum */
if (tab_w != (Widget)0 && XmIsPushButton(tab_w))
XtVaGetValues(tab_w, XmNpageNumber, &tab_idx, NULL);
}
@@ -3169,6 +3235,9 @@ gui_mch_show_tabline(int showit)
{
XtManageChild(tabLine);
XtUnmanageChild(XtNameToWidget(tabLine, "PageScroller"));
+ XtUnmanageChild(XtNameToWidget(tabLine, "MinorTabScrollerNext"));
+ XtUnmanageChild(XtNameToWidget(tabLine,
+ "MinorTabScrollerPrevious"));
#ifdef FEAT_MENU
# ifdef FEAT_TOOLBAR
if (XtIsManaged(XtParent(toolBar)))
@@ -3237,6 +3306,8 @@ gui_mch_update_tabline(void)
XmNotebookPageInfo page_info;
XmNotebookPageStatus page_status;
int last_page, tab_count;
+ XmString label_str;
+ char *label_cstr;
if (tabLine == (Widget)0)
return;
@@ -3265,9 +3336,25 @@ gui_mch_update_tabline(void)
tab = page_info.major_tab_widget;
XtVaSetValues(tab, XmNpageNumber, nr, NULL);
- get_tabline_label(tp);
- XtVaSetValues(tab, XtVaTypedArg, XmNlabelString, XmRString,
- NameBuff, STRLEN(NameBuff) + 1, NULL);
+
+ /*
+ * Change the label text only if it is different
+ */
+ XtVaGetValues(tab, XmNlabelString, &label_str, NULL);
+ if (XmStringGetLtoR(label_str, XmSTRING_DEFAULT_CHARSET, &label_cstr))
+ {
+ get_tabline_label(tp);
+ if (STRCMP(label_cstr, NameBuff) != 0) {
+ XtVaSetValues(tab, XtVaTypedArg, XmNlabelString, XmRString,
+ NameBuff, STRLEN(NameBuff) + 1, NULL);
+ /*
+ * Force a resize of the tab label button
+ */
+ XtUnmanageChild(tab);
+ XtManageChild(tab);
+ }
+ XtFree(label_cstr);
+ }
}
tab_count = nr - 1;
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 0e6e857046..21b757b609 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -740,17 +740,7 @@ _WndProc(
GetCursorPos((LPPOINT)&pt);
GetWindowRect(s_textArea, &rect);
if (pt.y < rect.top)
- {
- char_u string[3];
-
- string[0] = CSI;
- string[1] = KS_TABMENU;
- string[2] = KE_FILLER;
- add_to_input_buf(string, 3);
- string[0] = 0;
- string[1] = (char_u)(long)TABLINE_MENU_NEW;
- add_to_input_buf_csi(string, 2);
- }
+ send_tabline_menu_event(0, TABLINE_MENU_NEW);
}
return MyWindowProc(hwnd, uMsg, wParam, lParam);
}
diff --git a/src/gui_w48.c b/src/gui_w48.c
index b940a27351..7592c7f714 100644
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -1120,6 +1120,7 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h)
if (showing_tabline)
{
int top = 0;
+ RECT rect;
#ifdef FEAT_TOOLBAR
if (vim_strchr(p_go, GO_TOOLBAR) != NULL)
@@ -2191,7 +2192,6 @@ show_tabline_popup_menu(void)
MENUITEMINFO minfo;
long rval;
POINT pt;
- char_u string[3];
tab_pmenu = CreatePopupMenu();
if (tab_pmenu == NULL)
@@ -2236,13 +2236,7 @@ show_tabline_popup_menu(void)
else
idx += 1;
- string[0] = CSI;
- string[1] = KS_TABMENU;
- string[2] = KE_FILLER;
- add_to_input_buf(string, 3);
- string[0] = idx;
- string[1] = (char_u)(long)rval;
- add_to_input_buf_csi(string, 2);
+ send_tabline_menu_event(idx, (int)rval);
}
}
diff --git a/src/option.c b/src/option.c
index f809a736db..8ed4f3469f 100644
--- a/src/option.c
+++ b/src/option.c
@@ -7743,7 +7743,7 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
&& !gui.starting
#endif
)
- command_height(old_value);
+ command_height();
}
/* when 'updatecount' changes from zero to non-zero, open swap files */
diff --git a/src/proto/gui.pro b/src/proto/gui.pro
index b926eb0bdb..7105a6f834 100644
--- a/src/proto/gui.pro
+++ b/src/proto/gui.pro
@@ -38,6 +38,7 @@ extern int gui_use_tabline __ARGS((void));
extern void gui_update_tabline __ARGS((void));
extern void get_tabline_label __ARGS((tabpage_T *tp));
extern int send_tabline_event __ARGS((int nr));
+extern void send_tabline_menu_event __ARGS((int tabidx, int event));
extern void gui_remove_scrollbars __ARGS((void));
extern void gui_create_scrollbar __ARGS((scrollbar_T *sb, int type, win_T *wp));
extern scrollbar_T *gui_find_scrollbar __ARGS((long ident));
diff --git a/src/proto/window.pro b/src/proto/window.pro
index 362f00a451..f0ca77bba4 100644
--- a/src/proto/window.pro
+++ b/src/proto/window.pro
@@ -1,59 +1,59 @@
/* window.c */
-extern void do_window __ARGS((int nchar, long Prenum, int xchar));
-extern int win_split __ARGS((int size, int flags));
-extern int win_valid __ARGS((win_T *win));
-extern int win_count __ARGS((void));
-extern int make_windows __ARGS((int count, int vertical));
-extern void win_move_after __ARGS((win_T *win1, win_T *win2));
-extern void win_equal __ARGS((win_T *next_curwin, int current, int dir));
-extern void close_windows __ARGS((buf_T *buf, int keep_curwin));
-extern void win_close __ARGS((win_T *win, int free_buf));
-extern void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
-extern void win_free_all __ARGS((void));
-extern void close_others __ARGS((int message, int forceit));
-extern void curwin_init __ARGS((void));
-extern int win_alloc_first __ARGS((void));
-extern void win_init_size __ARGS((void));
-extern int win_new_tabpage __ARGS((int after));
-extern int may_open_tabpage __ARGS((void));
-extern int make_tabpages __ARGS((int maxcount));
-extern int valid_tabpage __ARGS((tabpage_T *tpc));
-extern tabpage_T *find_tabpage __ARGS((int n));
-extern int tabpage_index __ARGS((tabpage_T *ftp));
-extern void goto_tabpage __ARGS((int n));
-extern void goto_tabpage_tp __ARGS((tabpage_T *tp));
-extern void tabpage_move __ARGS((int nr));
-extern void win_goto __ARGS((win_T *wp));
-extern win_T *win_find_nr __ARGS((int winnr));
-extern void win_enter __ARGS((win_T *wp, int undo_sync));
-extern win_T *buf_jump_open_win __ARGS((buf_T *buf));
-extern int win_alloc_lines __ARGS((win_T *wp));
-extern void win_free_lsize __ARGS((win_T *wp));
-extern void shell_new_rows __ARGS((void));
-extern void shell_new_columns __ARGS((void));
-extern void win_size_save __ARGS((garray_T *gap));
-extern void win_size_restore __ARGS((garray_T *gap));
-extern int win_comp_pos __ARGS((void));
-extern void win_setheight __ARGS((int height));
-extern void win_setheight_win __ARGS((int height, win_T *win));
-extern void win_setwidth __ARGS((int width));
-extern void win_setwidth_win __ARGS((int width, win_T *wp));
-extern void win_setminheight __ARGS((void));
-extern void win_drag_status_line __ARGS((win_T *dragwin, int offset));
-extern void win_drag_vsep_line __ARGS((win_T *dragwin, int offset));
-extern void win_comp_scroll __ARGS((win_T *wp));
-extern void command_height __ARGS((long old_p_ch));
-extern void last_status __ARGS((int morewin));
-extern int tabline_height __ARGS((void));
-extern char_u *grab_file_name __ARGS((long count, linenr_T *file_lnum));
-extern char_u *file_name_at_cursor __ARGS((int options, long count, linenr_T *file_lnum));
-extern char_u *file_name_in_line __ARGS((char_u *line, int col, int options, long count, char_u *rel_fname, linenr_T *file_lnum));
-extern char_u *find_file_name_in_path __ARGS((char_u *ptr, int len, int options, long count, char_u *rel_fname));
-extern int path_with_url __ARGS((char_u *fname));
-extern int vim_isAbsName __ARGS((char_u *name));
-extern int vim_FullName __ARGS((char_u *fname, char_u *buf, int len, int force));
-extern int min_rows __ARGS((void));
-extern int only_one_window __ARGS((void));
-extern void check_lnums __ARGS((int do_curwin));
-extern int win_hasvertsplit __ARGS((void));
+void do_window __ARGS((int nchar, long Prenum, int xchar));
+int win_split __ARGS((int size, int flags));
+int win_valid __ARGS((win_T *win));
+int win_count __ARGS((void));
+int make_windows __ARGS((int count, int vertical));
+void win_move_after __ARGS((win_T *win1, win_T *win2));
+void win_equal __ARGS((win_T *next_curwin, int current, int dir));
+void close_windows __ARGS((buf_T *buf, int keep_curwin));
+void win_close __ARGS((win_T *win, int free_buf));
+void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
+void win_free_all __ARGS((void));
+void close_others __ARGS((int message, int forceit));
+void curwin_init __ARGS((void));
+int win_alloc_first __ARGS((void));
+void win_init_size __ARGS((void));
+int win_new_tabpage __ARGS((int after));
+int may_open_tabpage __ARGS((void));
+int make_tabpages __ARGS((int maxcount));
+int valid_tabpage __ARGS((tabpage_T *tpc));
+tabpage_T *find_tabpage __ARGS((int n));
+int tabpage_index __ARGS((tabpage_T *ftp));
+void goto_tabpage __ARGS((int n));
+void goto_tabpage_tp __ARGS((tabpage_T *tp));
+void tabpage_move __ARGS((int nr));
+void win_goto __ARGS((win_T *wp));
+win_T *win_find_nr __ARGS((int winnr));
+void win_enter __ARGS((win_T *wp, int undo_sync));
+win_T *buf_jump_open_win __ARGS((buf_T *buf));
+int win_alloc_lines __ARGS((win_T *wp));
+void win_free_lsize __ARGS((win_T *wp));
+void shell_new_rows __ARGS((void));
+void shell_new_columns __ARGS((void));
+void win_size_save __ARGS((garray_T *gap));
+void win_size_restore __ARGS((garray_T *gap));
+int win_comp_pos __ARGS((void));
+void win_setheight __ARGS((int height));
+void win_setheight_win __ARGS((int height, win_T *win));
+void win_setwidth __ARGS((int width));
+void win_setwidth_win __ARGS((int width, win_T *wp));
+void win_setminheight __ARGS((void));
+void win_drag_status_line __ARGS((win_T *dragwin, int offset));
+void win_drag_vsep_line __ARGS((win_T *dragwin, int offset));
+void win_comp_scroll __ARGS((win_T *wp));
+void command_height __ARGS((void));
+void last_status __ARGS((int morewin));
+int tabline_height __ARGS((void));
+char_u *grab_file_name __ARGS((long count, linenr_T *file_lnum));
+char_u *file_name_at_cursor __ARGS((int options, long count, linenr_T *file_lnum));
+char_u *file_name_in_line __ARGS((char_u *line, int col, int options, long count, char_u *rel_fname, linenr_T *file_lnum));
+char_u *find_file_name_in_path __ARGS((char_u *ptr, int len, int options, long count, char_u *rel_fname));
+int path_with_url __ARGS((char_u *fname));
+int vim_isAbsName __ARGS((char_u *name));
+int vim_FullName __ARGS((char_u *fname, char_u *buf, int len, int force));
+int min_rows __ARGS((void));
+int only_one_window __ARGS((void));
+void check_lnums __ARGS((int do_curwin));
+int win_hasvertsplit __ARGS((void));
/* vim: set ft=c : */
diff --git a/src/structs.h b/src/structs.h
index ce3bf9b1fe..6710b7218f 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1625,6 +1625,8 @@ struct tabpage_S
win_T *tp_lastwin; /* last window in this Tab page */
long tp_old_Rows; /* Rows when Tab page was left */
long tp_old_Columns; /* Columns when Tab page was left */
+ long tp_ch_used; /* value of 'cmdheight' when frame size
+ was set */
#ifdef FEAT_GUI
int tp_prev_which_scrollbars[3];
/* previous value of which_scrollbars */
diff --git a/src/version.h b/src/version.h
index 993e7475c5..a5c7e88694 100644
--- a/src/version.h
+++ b/src/version.h
@@ -35,6 +35,6 @@
*/
#define VIM_VERSION_NODOT "vim70c"
#define VIM_VERSION_SHORT "7.0c"
-#define VIM_VERSION_MEDIUM "7.0c12 BETA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0c12 BETA (2006 Apr 7)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0c12 BETA (2006 Apr 7, compiled "
+#define VIM_VERSION_MEDIUM "7.0c13 BETA"
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0c13 BETA (2006 Apr 8)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0c13 BETA (2006 Apr 8, compiled "
diff --git a/src/window.c b/src/window.c
index 26003f37ae..5e9553b6e5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -85,8 +85,6 @@ static void win_new_height __ARGS((win_T *, int));
#define NOWIN (win_T *)-1 /* non-exisiting window */
#ifdef FEAT_WINDOWS
-static long p_ch_used = 1L; /* value of 'cmdheight' when frame
- size was set */
# define ROWS_AVAIL (Rows - p_ch - tabline_height())
#else
# define ROWS_AVAIL (Rows - p_ch)
@@ -3087,9 +3085,6 @@ win_alloc_firstwin(oldwin)
topframe->fr_width = Columns;
#endif
topframe->fr_height = Rows - p_ch;
-#ifdef FEAT_WINDOWS
- p_ch_used = p_ch;
-#endif
topframe->fr_win = curwin;
curwin->w_frame = topframe;
@@ -3137,6 +3132,7 @@ alloc_tabpage()
/* init t: variables */
init_var_dict(&tp->tp_vars, &tp->tp_winvar);
#endif
+ tp->tp_ch_used = p_ch;
}
return tp;
}
@@ -3419,7 +3415,9 @@ enter_tabpage(tp, old_curbuf)
/* The tabpage line may have appeared or disappeared, may need to resize
* the frames for that. When the Vim window was resized need to update
- * frame sizes too. */
+ * frame sizes too. Use the stored value of p_ch, so that it can be
+ * different for each tab page. */
+ p_ch = curtab->tp_ch_used;
if (curtab->tp_old_Rows != Rows || (old_off != firstwin->w_winrow
#ifdef FEAT_GUI_TABLINE
&& !gui_use_tabline()
@@ -4215,7 +4213,7 @@ shell_new_rows()
#endif
compute_cmdrow();
#ifdef FEAT_WINDOWS
- p_ch_used = p_ch;
+ curtab->tp_ch_used = p_ch;
#endif
#if 0
@@ -4961,6 +4959,7 @@ win_drag_status_line(dragwin, offset)
p_ch = Rows - cmdline_row;
if (p_ch < 1)
p_ch = 1;
+ curtab->tp_ch_used = p_ch;
redraw_all_later(SOME_VALID);
showmode();
}
@@ -5257,19 +5256,17 @@ win_comp_scroll(wp)
* command_height: called whenever p_ch has been changed
*/
void
-command_height(old_p_ch)
- long old_p_ch;
+command_height()
{
#ifdef FEAT_WINDOWS
int h;
frame_T *frp;
+ int old_p_ch = curtab->tp_ch_used;
- /* When passed a negative value use the value of p_ch that we remembered.
- * This is needed for when the GUI starts up, we can't be sure in what
- * order things happen. */
- if (old_p_ch < 0)
- old_p_ch = p_ch_used;
- p_ch_used = p_ch;
+ /* Use the value of p_ch that we remembered. This is needed for when the
+ * GUI starts up, we can't be sure in what order things happen. And when
+ * p_ch was changed in another tab page. */
+ curtab->tp_ch_used = p_ch;
/* Find bottom frame with width of screen. */
frp = lastwin->w_frame;
@@ -5328,8 +5325,8 @@ command_height(old_p_ch)
if (frp != lastwin->w_frame)
(void)win_comp_pos();
#else
- win_setheight((int)(firstwin->w_height + old_p_ch - p_ch));
cmdline_row = Rows - p_ch;
+ win_setheight(cmdline_row);
#endif
}