(font-lock-extend-jit-lock-region-after-change): Better comment.
[emacs.git] / oldXMenu / InsPane.c
blob5f8f334f1849c5d989071ef1189c602b764ae43f
1 #include "copyright.h"
3 /* Copyright Massachusetts Institute of Technology 1985 */
4 /* Copyright (C) 2002, 2003, 2004, 2005,
5 2006 Free Software Foundation, Inc. */
7 /*
8 * XMenu: MIT Project Athena, X Window system menu package
10 * XMenuInsertPane - Inserts a pane into an XMenu object in
11 * a particular position.
13 * Author: Tony Della Fera, DEC
14 * 20-Nov-85
18 #include <config.h>
19 #include "XMenuInt.h"
21 int
22 XMenuInsertPane(menu, p_num, label, active)
23 register XMenu *menu; /* Menu object to be modified. */
24 register int p_num; /* Pane number of new pane. */
25 char *label; /* Selection label. */
26 int active; /* Make selection active? */
28 register XMPane *p_ptr; /* XMPane pointer. */
29 register XMPane *pane; /* Newly created pane. */
30 register XMSelect *select; /* Initial selection for the new pane. */
32 int label_length; /* Label length in characters. */
33 int label_width; /* Label width in pixels. */
36 * Check for NULL pointers!
38 if (label == NULL) {
39 _XMErrorCode = XME_ARG_BOUNDS;
40 return(XM_FAILURE);
44 * Find the pane number one less than the one specified since that
45 * is the pane after which the insertion will occur.
47 p_ptr = _XMGetPanePtr(menu, (p_num - 1));
48 if (p_ptr == NULL) return(XM_FAILURE);
51 * Calloc the XMPane structure and the initial XMSelect.
53 pane = (XMPane *)calloc(1, sizeof(XMPane));
54 if (pane == NULL) {
55 _XMErrorCode = XME_CALLOC;
56 return(XM_FAILURE);
58 select = (XMSelect *)calloc(1, sizeof(XMSelect));
59 if (select == NULL) {
60 _XMErrorCode = XME_CALLOC;
61 return(XM_FAILURE);
65 * Determine label size.
67 label_length = strlen(label);
68 label_width = XTextWidth(menu->p_fnt_info, label, label_length);
71 * Set up the initial selection.
72 * Values not explicitly set are zeroed by calloc.
74 select->next = select;
75 select->prev = select;
76 select->type = SL_HEADER;
77 select->serial = -1;
78 select->parent_p = pane;
81 * Fill the XMPane structure.
83 pane->type = PANE;
84 pane->active = active;
85 pane->serial = -1;
86 pane->label = label;
87 pane->label_width = label_width;
88 pane->label_length = label_length;
89 pane->s_list = select;
92 * Insert the pane after the pane with the pane
93 * number one less than the desired number for the
94 * new pane.
96 emacs_insque(pane, p_ptr);
99 * Update the pane count.
101 menu->p_count++;
104 * Schedule a recompute.
106 menu->recompute = 1;
109 * Return the number of the pane just added.
111 _XMErrorCode = XME_NO_ERROR;
112 return(p_num);
115 /* arch-tag: ab94d53d-f05b-4273-82d3-f1b01eb9dc9e
116 (do not change this comment) */