fix motifless build, keep original LIBS variable
[nedit-bw.git] / newTabTab.patch
blob18060b76cf2db59964d5b7fb5f4243a3e2faebc5
1 ---
3 Microline/XmL/Folder.c | 2 -
4 Microline/XmL/Makefile.common | 2 -
5 Microline/XmL/Makefile.dependencies | 4 ++
6 source/window.c | 60 ++++++++++++++++++++++++++----------
7 4 files changed, 50 insertions(+), 18 deletions(-)
9 diff --quilt old/Microline/XmL/Folder.c new/Microline/XmL/Folder.c
10 --- old/Microline/XmL/Folder.c
11 +++ new/Microline/XmL/Folder.c
12 @@ -1658,7 +1658,7 @@ ConstraintInitialize(Widget req,
13 /* add child to tabs list */
14 if (f->folder.tabAllocCount < f->folder.tabCount + 1)
16 - f->folder.tabAllocCount *= 2;
17 + f->folder.tabAllocCount += 32;
18 f->folder.tabs = (Widget *)realloc((char *)f->folder.tabs,
19 sizeof(Widget) * f->folder.tabAllocCount);
21 diff --quilt old/source/window.c new/source/window.c
22 --- old/source/window.c
23 +++ new/source/window.c
24 @@ -155,7 +155,7 @@ static Pixmap createBitmapWithDepth(Widg
25 unsigned int height);
26 static WindowInfo *getNextTabWindow(WindowInfo *window, int direction,
27 int crossWin, int wrap);
28 -static Widget addTab(Widget folder, const char *string);
29 +static Widget addTab(Widget folder, const char *string, int isNewTabTab);
30 static int compareWindowNames(const void *windowA, const void *windowB);
31 static Widget manageToolBars(Widget toolBarsForm);
32 static void hideTearOffs(Widget menuPane);
33 @@ -601,7 +601,7 @@ WindowInfo *CreateWindow(const char *nam
34 /* create the tab bar */
35 window->tabBar = XtVaCreateManagedWidget("tabBar",
36 xmlFolderWidgetClass, tabForm,
37 - XmNresizePolicy, XmRESIZE_PACK,
38 + XmNresizePolicy, XmRESIZE_DYNAMIC,
39 XmNleftAttachment, XmATTACH_FORM,
40 XmNleftOffset, 0,
41 XmNrightAttachment, XmATTACH_WIDGET,
42 @@ -629,7 +629,8 @@ WindowInfo *CreateWindow(const char *nam
43 XtAddCallback(window->tabBar, XmNactivateCallback,
44 raiseTabCB, NULL);
46 - window->tab = addTab(window->tabBar, name);
47 + addTab(window->tabBar, " + ", True);
48 + window->tab = addTab(window->tabBar, name, False);
50 /* A form to hold the stats line text and line/col widgets */
51 window->statsLineForm = XtVaCreateWidget("statsLineForm",
52 @@ -838,19 +839,23 @@ static void tabClickEH(Widget w, XtPoint
54 ** add a tab to the tab bar for the new document.
56 -static Widget addTab(Widget folder, const char *string)
57 +static Widget addTab(Widget folder, const char *string, int isNewTabTab)
59 Widget tooltipLabel, tab;
60 - XmString s1;
61 + XmString s1, s2;
63 s1 = XmStringCreateSimple((char *)string);
64 + if (isNewTabTab)
65 + s2 = XmStringCreateSimple("New Document");
66 + else
67 + s2 = s1;
68 tab = XtVaCreateManagedWidget("tab",
69 xrwsBubbleButtonWidgetClass, folder,
70 /* XmNmarginWidth, <default@nedit.c>, */
71 /* XmNmarginHeight, <default@nedit.c>, */
72 /* XmNalignment, <default@nedit.c>, */
73 XmNlabelString, s1,
74 - XltNbubbleString, s1,
75 + XltNbubbleString, s2,
76 XltNshowBubble, GetPrefToolTips(),
77 XltNautoParkBubble, True,
78 XltNslidingBubble, False,
79 @@ -858,6 +863,8 @@ static Widget addTab(Widget folder, cons
80 /* XltNbubbleDuration, 8000,*/
81 NULL);
82 XmStringFree(s1);
83 + if (isNewTabTab)
84 + XmStringFree(s2);
86 /* there's things to do as user click on the tab */
87 XtAddEventHandler(tab, ButtonPressMask, False,
88 @@ -881,10 +888,23 @@ static Widget addTab(Widget folder, cons
89 AddTabContextMenuAction(tab);
90 #endif /* LESSTIF_VERSION */
92 - if (GetPerfDragDropTabs()) {
93 + if (GetPerfDragDropTabs() && !isNewTabTab) {
94 addTabDragAction(tab);
95 registerDropSite(tab);
98 + /* maintain newTab-tab as last tab in tablist */
99 + if (!isNewTabTab) {
100 + WidgetList tabList;
101 + int tabCount;
102 + Widget t;
103 + XtVaGetValues(folder, XmNtabWidgetList, &tabList,
104 + XmNtabCount, &tabCount, NULL);
105 + t = tabList[tabCount - 1];
106 + tabList[tabCount - 1] = tabList[tabCount - 2];
107 + tabList[tabCount - 2] = t;
110 return tab;
113 @@ -936,7 +956,7 @@ void SortTabBar(WindowInfo *window)
114 XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList,
115 XmNtabCount, &tabCount, NULL);
117 - for (i=0, j=0; i<tabCount && j<nDoc; i++) {
118 + for (i=0, j=0; i<(tabCount-1) && j<nDoc; i++) {
119 if (tabList[i]->core.being_destroyed)
120 continue;
122 @@ -2645,7 +2665,7 @@ static void saveYourselfCB(Widget w, Wid
123 XtVaGetValues(topWin->tabBar, XmNtabWidgetList, &tabs,
124 XmNtabCount, &tabCount, NULL);
126 - for (i=0; i< tabCount; i++) {
127 + for (i=0; i< (tabCount-1); i++) {
128 win = TabToWindow(tabs[i]);
129 if (win->filenameSet) {
130 /* add filename */
131 @@ -3646,7 +3666,7 @@ WindowInfo* CreateDocument(WindowInfo* s
132 /* Set the requested hardware tab distance and useTabs in the text buffer */
133 BufSetTabDistance(window->buffer, GetPrefTabDist(PLAIN_LANGUAGE_MODE));
134 window->buffer->useTabs = GetPrefInsertTabs();
135 - window->tab = addTab(window->tabBar, name);
136 + window->tab = addTab(window->tabBar, name, False);
138 /* add the window to the global window list, update the Windows menus */
139 InvalidateWindowMenus();
140 @@ -3719,7 +3739,7 @@ static WindowInfo *getNextTabWindow(Wind
141 XtVaGetValues(win->tabBar, XmNtabWidgetList, &tabList,
142 XmNtabCount, &tabCount, NULL);
144 - for (i=0; i< tabCount; i++) {
145 + for (i=0; i< (tabCount-1); i++) {
146 tabs[tabTotalCount++] = tabList[i];
149 @@ -3729,7 +3749,7 @@ static WindowInfo *getNextTabWindow(Wind
150 XtVaGetValues(window->tabBar, XmNtabWidgetList, &tabList,
151 XmNtabCount, &tabCount, NULL);
153 - for (i=0; i< tabCount; i++) {
154 + for (i=0; i< (tabCount-1); i++) {
155 if (TabToWindow(tabList[i])) /* make sure tab is valid */
156 tabs[tabTotalCount++] = tabList[i];
158 @@ -3777,7 +3797,7 @@ int getTabPosition(Widget tab)
159 XtVaGetValues(tabBar, XmNtabWidgetList, &tabList,
160 XmNtabCount, &tabCount, NULL);
162 - for (i=0; i< tabCount; i++) {
163 + for (i=0; i< (tabCount-1); i++) {
164 if (tab == tabList[i])
165 return i;
167 @@ -4989,10 +5009,18 @@ static void raiseTabCB(Widget w, XtPoint
168 XmLFolderCallbackStruct *cbs = (XmLFolderCallbackStruct *)callData;
169 WidgetList tabList;
170 Widget tab;
171 + int tabCount;
173 - XtVaGetValues(w, XmNtabWidgetList, &tabList, NULL);
174 - tab = tabList[cbs->pos];
175 - RaiseDocument(TabToWindow(tab));
176 + XtVaGetValues(w, XmNtabWidgetList, &tabList, XmNtabCount, &tabCount, NULL);
177 + if (cbs->pos < (tabCount-1)) {
178 + tab = tabList[cbs->pos];
179 + RaiseDocument(TabToWindow(tab));
180 + } else {
181 + WindowInfo *window = GetTopDocument(w);
182 + EditNewFile(window, NULL, False, NULL, window->path, False);
183 + CheckCloseDim();
184 + cbs->allowActivate = 0;
188 static Widget containingPane(Widget w)
189 diff --quilt old/Microline/XmL/Makefile.common new/Microline/XmL/Makefile.common
190 --- old/Microline/XmL/Makefile.common
191 +++ new/Microline/XmL/Makefile.common
192 @@ -7,7 +7,7 @@
193 .c.o:
194 $(CC) -c -I.. $(CFLAGS) -o $@ $<
196 -OBJS = Folder.o XmL.o
197 +OBJS = XmL.o Folder.o Grid.o GridUtil.o Progress.o Tree.o
199 all: libXmL.a
201 diff --quilt old/Microline/XmL/Makefile.dependencies new/Microline/XmL/Makefile.dependencies
202 --- old/Microline/XmL/Makefile.dependencies
203 +++ new/Microline/XmL/Makefile.dependencies
204 @@ -1,2 +1,6 @@
205 XmL.o: XmL.c XmL.h
206 Folder.o: Folder.c Folder.h FolderP.h XmL.h
207 +Grid.o: Grid.c Grid.h GridP.h XmL.h
208 +GridUtil.o: GridUtil.c Grid.h GridP.h XmL.h
209 +Progress.o: Progress.c Progress.h ProgressP.h XmL.h
210 +Tree.o: Tree.c Tree.h TreeP.h XmL.h