summaryrefslogtreecommitdiff
path: root/src/dispextern.h
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2019-08-31 23:40:07 +0300
committerJuri Linkov <juri@linkov.net>2019-08-31 23:40:07 +0300
commit3e0ad29a607c8c085de3b74c7505e417ad7f9062 (patch)
treefeff537233e67c705d67b280023c623192c3d95b /src/dispextern.h
parent7791005544836f93542e8277ad5897f8f5920f05 (diff)
downloademacs-3e0ad29a607c8c085de3b74c7505e417ad7f9062.tar.gz
Frame-local tab-bar and window-local tab-line.
* etc/NEWS: Add 'tab-bar-mode' and 'global-tab-line-mode'. * etc/TODO: Remove tab-related items. * lisp/cus-start.el: Add tab-bar-mode, tab-bar-max-label-size. * lisp/frame.el (frame-notice-user-settings): handle tab-bar-lines. * lisp/loadup.el: Load "tab-bar". * lisp/menu-bar.el (menu-bar-options-save): Add tab-bar-mode. (menu-bar-showhide-menu): Define showhide-tab-bar. * lisp/startup.el (tab-bar-images-pixel-height): New defconst. (command-line): Reset tab-bar-mode. (x-apply-session-resources): Add "tabBar", "TabBar". * lisp/subr.el (read-key): Add tab-bar. * lisp/tab-bar.el: New file. * lisp/tab-line.el: New file. * lisp/window.el (window--dump-frame): Add tab-bar-height. * src/dispextern.h (enum window_part): Add ON_TAB_LINE. (struct glyph_matrix): Add tab_line_p. (struct glyph_row): Add tab_line_p. (MATRIX_TAB_LINE_ROW): New macro. (MATRIX_FIRST_TEXT_ROW): Handle more mode lines. (MR_PARTIALLY_VISIBLE_AT_TOP): Add WINDOW_TAB_LINE_HEIGHT. (MATRIX_TAB_LINE_HEIGHT, CURRENT_TAB_LINE_HEIGHT) (DESIRED_TAB_LINE_HEIGHT): New macros. (enum face_id): Add TAB_BAR_FACE_ID and TAB_LINE_FACE_ID. (struct it): Add tab_line_p. (tab_bar_item_idx, tab_bar_item_image): New enums. (DEFAULT_TAB_BAR_LABEL_SIZE, DEFAULT_TAB_BAR_BUTTON_MARGIN) (DEFAULT_TAB_BAR_BUTTON_RELIEF, DEFAULT_TAB_BAR_IMAGE_HEIGHT): New constants. * src/dispnew.c (adjust_glyph_matrix): Use window_wants_tab_line. (shift_glyph_matrix): Add WINDOW_TAB_LINE_HEIGHT. (clear_current_matrices, clear_desired_matrices): Call clear_glyph_matrix on tab_bar_window. (blank_row): Add WINDOW_TAB_LINE_HEIGHT. (required_matrix_height): Change 2 to 3. (fake_current_matrices): Reset tab_line_p. (adjust_frame_glyphs_for_window_redisplay): Handle tab_bar_window. Add FRAME_TAB_BAR_HEIGHT and FRAME_TAB_BAR_LINES. (free_glyphs): Handle tab_bar_window. (update_frame): Handle tab_bar_window. (update_window): Handle row->tab_line_p. (scrolling_window): Change arg type from bool to int. Change header_line_p to tab_line_p. (buffer_posn_from_coords): Add window_wants_tab_line. (mode_line_string): Use MATRIX_TAB_LINE_ROW for part ON_TAB_LINE. * src/frame.c (frame_default_tab_bar_height): New internal variable. (adjust_frame_size): Handle tab_bar_window. (make_frame): Reset tab_bar_redisplayed, tab_bar_resized and last_tab_bar_item. (Ftab_bar_pixel_width): New function. (frame_parms): Add tab-bar-lines. (gui_figure_window_size): Add new arg tabbar_p. (syms_of_frame): Add Qtab_bar_size, Qupdate_frame_tab_bar, Qfree_frame_tab_bar, Qtab_bar_lines, Stab_bar_pixel_width. Add Qtab_bar_lines to frame_inhibit_implied_resize. (tab-bar-mode): New variable. * src/frame.h (GCALIGNED_STRUCT): Add tab_bar_window, desired_tab_bar_string, current_tab_bar_string. (GCALIGNED_STRUCT): Add tab_bar_items, last_tab_bar_item, minimize_tab_bar_window_p, tab_bar_redisplayed, tab_bar_resized, tab_bar_lines, tab_bar_height, n_tab_bar_rows, n_tab_bar_items. (fset_tab_bar_items, fset_tab_bar_window) (fset_current_tab_bar_string, fset_desired_tab_bar_string): New inlines. (FRAME_TAB_BAR_LINES, FRAME_TAB_BAR_HEIGHT): New macros. (FRAME_TOP_MARGIN, FRAME_TOP_MARGIN_HEIGHT): Use FRAME_TAB_BAR_LINES. * src/fringe.c (draw_fringe_bitmap_1, update_window_fringes): Add WINDOW_TAB_LINE_HEIGHT. * src/gtkutil.c (xg_frame_set_char_size): Add FRAME_TABBAR_WIDTH. (x_wm_set_size_hint): Add FRAME_TABBAR_WIDTH. * src/keyboard.c (read_char): Handle Qtab_bar. (kbd_buffer_get_event): Handle TAB_BAR_EVENT. (make_lispy_position): Add WINDOW_TAB_LINE_HEIGHT. Handle TAB_BAR_EVENT. (tab_bar_items_vector, tab_bar_item_properties, ntab_bar_items): New internal variables. (tab_bar_items, process_tab_bar_item, set_prop_tab_bar) (parse_tab_bar_item, init_tab_bar_items, append_tab_bar_item): New functions. (read_char_x_menu_prompt, read_key_sequence): Handle Qtab_bar. (tab-bar-separator-image-expression): New variable. * src/keymap.c (syms_of_keymap): Add Qtab_bar and Qtab_line. * src/menu.c (x_popup_menu_1, Fx_popup_dialog): Handle Qtab_bar. * src/termhooks.h (enum event_kind): Add TAB_BAR_EVENT. (GCALIGNED_STRUCT): Add change_tab_bar_height_hook. * src/w32fns.c (w32_frame_parm_handlers): Add w32_set_tab_bar_lines. * src/w32term.c (w32_draw_window_cursor): Add WINDOW_TAB_LINE_HEIGHT. * src/window.c (window_body_height): Add WINDOW_TAB_LINE_HEIGHT. (Fwindow_tab_line_height): New function. (coordinates_in_window): Use window_wants_tab_line with CURRENT_TAB_LINE_HEIGHT. (window_relative_x_coord): Add ON_TAB_LINE. (Fcoordinates_in_window_p): Add ON_TAB_LINE. (window_from_coordinates): Add new arg tab_bar_p. (Fwindow_line_height): Use window_wants_tab_line with WINDOW_TAB_LINE_HEIGHT. (Fwindow_lines_pixel_dimensions): Add WINDOW_TAB_LINE_HEIGHT. (make_window): Set tab_line_height to -1. (window_wants_tab_line): New function. (window_internal_height): Use window_wants_tab_line. (window_scroll_pixel_based): Add WINDOW_TAB_LINE_HEIGHT. (Frecenter): Set minimize_tab_bar_window_p to 1. (GCALIGNED_STRUCT): Add frame_tab_bar_lines and frame_tab_bar_height. (Fcurrent_window_configuration): Set frame_tab_bar_lines and frame_tab_bar_height. (set_window_scroll_bars): Add WINDOW_TAB_LINE_HEIGHT. (syms_of_window): Add Qtab_line_format and Swindow_tab_line_height. * src/window.h (GCALIGNED_STRUCT): Add tab_line_height. (WINDOW_TAB_BAR_P, WINDOW_TAB_LINE_HEIGHT, WINDOW_TAB_LINE_LINES): New macros. (WINDOW_TOP_EDGE_Y, WINDOW_BOTTOM_EDGE_Y, WINDOW_TAB_LINE_HEIGHT): Add WINDOW_TAB_BAR_P. * src/xdisp.c (window_box_height): Add window_wants_tab_line with MATRIX_TAB_LINE_ROW and CURRENT_TAB_LINE_HEIGHT. (pos_visible_p): Use window_wants_tab_line. Add WINDOW_TAB_LINE_HEIGHT. (get_glyph_string_clip_rects): Add WINDOW_TAB_LINE_HEIGHT. (get_phys_cursor_geometry): Add WINDOW_TAB_LINE_HEIGHT. (remember_mouse_glyph): Use MATRIX_TAB_LINE_ROW for part ON_TAB_LINE. (init_iterator): Use MATRIX_TAB_LINE_ROW for TAB_LINE_FACE_ID. Add WINDOW_TAB_LINE_HEIGHT. Add window_wants_tab_line. (Fwindow_text_pixel_size): Add WINDOW_TAB_LINE_HEIGHT. (prepare_menu_bars): Call update_tab_bar. (update_tab_bar, build_desired_tab_bar_string) (display_tab_bar_line, tab_bar_height, Ftab_bar_height) (redisplay_tab_bar, tab_bar_item_info, get_tab_bar_item) (handle_tab_bar_click, note_tab_bar_highlight): New functions. (compute_window_start_on_continuation_line): Use window_wants_tab_line. (try_cursor_movement): Use window_wants_tab_line with CURRENT_TAB_LINE_HEIGHT. (redisplay_window): Use window_wants_tab_line with CURRENT_TAB_LINE_HEIGHT. (try_window_reusing_current_matrix): Use window_wants_tab_line with WINDOW_TAB_LINE_HEIGHT. (Fdump_tab_bar_row): New function. (compute_line_metrics): Add WINDOW_TAB_LINE_HEIGHT. (display_line): Use window_wants_tab_line. (display_mode_line): Set tab_line_p to true if face_id is TAB_LINE_FACE_ID. (Fformat_mode_line): Handle Qtab_line and Qtab_bar. (gui_clear_end_of_line): Add WINDOW_TAB_LINE_HEIGHT. (erase_phys_cursor): Use WINDOW_TAB_LINE_HEIGHT. (show_mouse_face): Use tab_bar_window. (note_mode_line_or_margin_highlight): Use MATRIX_TAB_LINE_ROW for area ON_TAB_LINE. (note_mouse_highlight): Call note_tab_bar_highlight, (expose_frame): Handle tab_bar_window. (syms_of_xdisp): Add Sdump_tab_bar_row and Stab_bar_height. (auto-resize-tab-bars, auto-raise-tab-bar-buttons) (tab-bar-border, tab-bar-button-margin, tab-bar-button-relief) (tab-bar-max-label-size): New variables. * src/xfaces.c (lookup_basic_face): Add TAB_LINE_FACE_ID and TAB_BAR_FACE_ID. (syms_of_xfaces): Define Qtab_bar and Qtab_line. * src/xfns.c (x_set_tab_bar_lines, x_change_tab_bar_height): New functions. (xic_set_statusarea): Add FRAME_TABBAR_TOP_HEIGHT. (frame_geometry): Add FRAME_TAB_BAR_HEIGHT and Qtab_bar_size. * src/xterm.c (x_draw_image_relief): Use tab_bar_button_relief. (x_draw_image_relief): Use TAB_BAR_FACE_ID. (handle_one_xevent): Handle tab_bar_window. (x_set_window_size_1): Add FRAME_TABBAR_WIDTH. (x_create_terminal): Set change_tab_bar_height_hook. * src/xterm.h (struct x_output): Add tabbar_top_height, tabbar_bottom_height, tabbar_left_width, tabbar_right_width tabbar_widget, tabbar_in_hbox, tabbar_is_packed. (FRAME_TABBAR_TOP_HEIGHT): Add FRAME_TABBAR_TOP_HEIGHT, FRAME_TABBAR_BOTTOM_HEIGHT, FRAME_TABBAR_HEIGHT, FRAME_TABBAR_LEFT_WIDTH, FRAME_TABBAR_RIGHT_WIDTH, FRAME_TABBAR_WIDTH.
Diffstat (limited to 'src/dispextern.h')
-rw-r--r--src/dispextern.h136
1 files changed, 131 insertions, 5 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 05f199ff353..02aba05ccb4 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -166,6 +166,7 @@ enum window_part
ON_MODE_LINE,
ON_VERTICAL_BORDER,
ON_HEADER_LINE,
+ ON_TAB_LINE,
ON_LEFT_FRINGE,
ON_RIGHT_FRINGE,
ON_LEFT_MARGIN,
@@ -762,6 +763,9 @@ struct glyph_matrix
which do their own scrolling. */
bool_bf no_scrolling_p : 1;
+ /* True means window displayed in this matrix has a tab line. */
+ bool_bf tab_line_p : 1;
+
/* True means window displayed in this matrix has a header
line. */
bool_bf header_line_p : 1;
@@ -1001,9 +1005,12 @@ struct glyph_row
implies that the row doesn't have marginal areas. */
bool_bf full_width_p : 1;
- /* True means row is a mode or header-line. */
+ /* True means row is a mode or header/tab-line. */
bool_bf mode_line_p : 1;
+ /* True means row is a tab-line. */
+ bool_bf tab_line_p : 1;
+
/* True in a current row means this row is overlapped by another row. */
bool_bf overlapped_p : 1;
@@ -1084,16 +1091,25 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
#define MATRIX_MODE_LINE_ROW(MATRIX) \
((MATRIX)->rows + (MATRIX)->nrows - 1)
-/* Return a pointer to the row reserved for the header line in MATRIX.
+/* Return a pointer to the row reserved for the tab line in MATRIX.
This is always the first row in MATRIX because that's the only
way that works in frame-based redisplay. */
-#define MATRIX_HEADER_LINE_ROW(MATRIX) (MATRIX)->rows
+#define MATRIX_TAB_LINE_ROW(MATRIX) (MATRIX)->rows
+
+/* Return a pointer to the row reserved for the header line in MATRIX.
+ This is always the second row in MATRIX because that's the only
+ way that works in frame-based redisplay. */
+
+#define MATRIX_HEADER_LINE_ROW(MATRIX) \
+ ((MATRIX)->tab_line_p ? ((MATRIX)->rows + 1) : (MATRIX)->rows)
/* Return a pointer to first row in MATRIX used for text display. */
#define MATRIX_FIRST_TEXT_ROW(MATRIX) \
- ((MATRIX)->rows->mode_line_p ? (MATRIX)->rows + 1 : (MATRIX)->rows)
+ ((MATRIX)->rows->mode_line_p ? \
+ (((MATRIX)->rows + 1)->mode_line_p ? \
+ (MATRIX)->rows + 2 : (MATRIX)->rows + 1) : (MATRIX)->rows)
/* Return a pointer to the first glyph in the text area of a row.
MATRIX is the glyph matrix accessed, and ROW is the row index in
@@ -1162,7 +1178,7 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
((ROW)->height != (ROW)->visible_height)
#define MR_PARTIALLY_VISIBLE_AT_TOP(W, ROW) \
- ((ROW)->y < WINDOW_HEADER_LINE_HEIGHT ((W)))
+ ((ROW)->y < (WINDOW_TAB_LINE_HEIGHT ((W)) + WINDOW_HEADER_LINE_HEIGHT ((W))))
#define MR_PARTIALLY_VISIBLE_AT_BOTTOM(W, ROW) \
(((ROW)->y + (ROW)->height - (ROW)->extra_line_spacing) \
@@ -1433,6 +1449,15 @@ struct glyph_string
? MATRIX_HEADER_LINE_ROW (MATRIX)->height \
: 0)
+/* Return the height of the tab line in glyph matrix MATRIX, or zero
+ if not known. This macro is called under circumstances where
+ MATRIX might not have been allocated yet. */
+
+#define MATRIX_TAB_LINE_HEIGHT(MATRIX) \
+ ((MATRIX) && (MATRIX)->rows \
+ ? MATRIX_TAB_LINE_ROW (MATRIX)->height \
+ : 0)
+
/* Return the desired face id for the mode line of a window, depending
on whether the window is selected or not, or if the window is the
scrolling window for the currently active minibuffer window.
@@ -1485,6 +1510,19 @@ struct glyph_string
: estimate_mode_line_height \
(XFRAME (W->frame), HEADER_LINE_FACE_ID))))
+/* Return the current height of the tab line of window W. If not known
+ from W->tab_line_height, look at W's current glyph matrix, or return
+ an estimation based on the height of the font of the face `tab-line'. */
+
+#define CURRENT_TAB_LINE_HEIGHT(W) \
+ (W->tab_line_height >= 0 \
+ ? W->tab_line_height \
+ : (W->tab_line_height \
+ = (MATRIX_TAB_LINE_HEIGHT (W->current_matrix) \
+ ? MATRIX_TAB_LINE_HEIGHT (W->current_matrix) \
+ : estimate_mode_line_height \
+ (XFRAME (W->frame), TAB_LINE_FACE_ID))))
+
/* Return the height of the desired mode line of window W. */
#define DESIRED_MODE_LINE_HEIGHT(W) \
@@ -1495,6 +1533,11 @@ struct glyph_string
#define DESIRED_HEADER_LINE_HEIGHT(W) \
MATRIX_HEADER_LINE_HEIGHT ((W)->desired_matrix)
+/* Return the height of the desired tab line of window W. */
+
+#define DESIRED_TAB_LINE_HEIGHT(W) \
+ MATRIX_TAB_LINE_HEIGHT ((W)->desired_matrix)
+
/* Return proper value to be used as baseline offset of font that has
ASCENT and DESCENT to draw characters by the font at the vertical
center of the line of frame F.
@@ -1780,6 +1823,8 @@ enum face_id
WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID,
WINDOW_DIVIDER_LAST_PIXEL_FACE_ID,
INTERNAL_BORDER_FACE_ID,
+ TAB_BAR_FACE_ID,
+ TAB_LINE_FACE_ID,
BASIC_FACE_ID_SENTINEL
};
@@ -2283,6 +2328,9 @@ struct it
/* True means multibyte characters are enabled. */
bool_bf multibyte_p : 1;
+ /* True means window has a tab line at its top. */
+ bool_bf tab_line_p : 1;
+
/* True means window has a mode line at its top. */
bool_bf header_line_p : 1;
@@ -3130,6 +3178,81 @@ struct image_cache
/***********************************************************************
+ Tab-bars
+ ***********************************************************************/
+
+/* Enumeration defining where to find tab-bar item information in
+ tab-bar items vectors stored with frames. Each tab-bar item
+ occupies TAB_BAR_ITEM_NSLOTS elements in such a vector. */
+
+enum tab_bar_item_idx
+{
+ /* The key of the tab-bar item. Used to remove items when a binding
+ for `undefined' is found. */
+ TAB_BAR_ITEM_KEY,
+
+ /* Non-nil if item is enabled. */
+ TAB_BAR_ITEM_ENABLED_P,
+
+ /* Non-nil if item is selected (pressed). */
+ TAB_BAR_ITEM_SELECTED_P,
+
+ /* Caption. */
+ TAB_BAR_ITEM_CAPTION,
+
+ /* Image(s) to display. This is either a single image specification
+ or a vector of specifications. */
+ TAB_BAR_ITEM_IMAGES,
+
+ /* The binding. */
+ TAB_BAR_ITEM_BINDING,
+
+ /* Button type. One of nil (default button), t (a separator),
+ `:radio', or `:toggle'. The latter two currently do nothing. */
+ TAB_BAR_ITEM_TYPE,
+
+ /* Help string. */
+ TAB_BAR_ITEM_HELP,
+
+ /* Icon file name of right to left image when an RTL locale is used. */
+ TAB_BAR_ITEM_RTL_IMAGE,
+
+ /* Label to show when text labels are enabled. */
+ TAB_BAR_ITEM_LABEL,
+
+ /* If we shall show the label only below the icon and not beside it. */
+ TAB_BAR_ITEM_VERT_ONLY,
+
+ /* Sentinel = number of slots in tab_bar_items occupied by one
+ tab-bar item. */
+ TAB_BAR_ITEM_NSLOTS
+};
+
+
+/* An enumeration for the different images that can be specified
+ for a tab-bar item. */
+
+enum tab_bar_item_image
+{
+ TAB_BAR_IMAGE_ENABLED_SELECTED,
+ TAB_BAR_IMAGE_ENABLED_DESELECTED,
+ TAB_BAR_IMAGE_DISABLED_SELECTED,
+ TAB_BAR_IMAGE_DISABLED_DESELECTED
+};
+
+#define DEFAULT_TAB_BAR_LABEL_SIZE 14
+
+/* Default values of the above variables. */
+
+#define DEFAULT_TAB_BAR_BUTTON_MARGIN 4
+#define DEFAULT_TAB_BAR_BUTTON_RELIEF 1
+
+/* The height in pixels of the default tab-bar images. */
+
+#define DEFAULT_TAB_BAR_IMAGE_HEIGHT 18
+
+
+/***********************************************************************
Tool-bars
***********************************************************************/
@@ -3285,6 +3408,7 @@ extern bool help_echo_showing_p;
extern Lisp_Object help_echo_string, help_echo_window;
extern Lisp_Object help_echo_object, previous_help_echo_string;
extern ptrdiff_t help_echo_pos;
+extern int last_tab_bar_item;
extern int last_tool_bar_item;
extern void reseat_at_previous_visible_line_start (struct it *);
extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
@@ -3332,6 +3456,8 @@ extern void get_glyph_string_clip_rect (struct glyph_string *,
NativeRectangle *nr);
extern Lisp_Object find_hot_spot (Lisp_Object, int, int);
+extern void handle_tab_bar_click (struct frame *,
+ int, int, bool, int);
extern void handle_tool_bar_click (struct frame *,
int, int, bool, int);