  TK Soh's Toolbar patch

  Available as a patch here:

    http://sourceforge.net/tracker/index.php?func=detail&aid=714489&group_id=11005&atid=311005
	    [ 714489 ] toolbars
	    nedit-toolbar-patch-v1.0b.txt.gz 2006-07-29 16:28

    This patch adds toolbar below the main menu.

diff -r 54247d349a7d source/Makefile.common
--- a/source/Makefile.common	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/Makefile.common	Sat Nov 19 18:01:45 2005 +0800
@@ -7,7 +7,7 @@ OBJS =	nedit.o file.o menu.o window.o se
 	help.o preferences.o tags.o userCmds.o shell.o regularExp.o macro.o \
 	text.o textSel.o textDisp.o textBuf.o textDrag.o server.o highlight.o \
 	highlightData.o interpret.o parse.o smartIndent.o regexConvert.o \
-	rbTree.o windowTitle.o calltips.o server_common.o rangeset.o
+	rbTree.o windowTitle.o calltips.o server_common.o rangeset.o toolbar.o
 
 XLTLIB = ../Xlt/libXlt.a
 XMLLIB = ../Microline/XmL/libXmL.a
diff -r 54247d349a7d source/Makefile.dependencies
--- a/source/Makefile.dependencies	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/Makefile.dependencies	Sat Nov 19 18:01:45 2005 +0800
@@ -25,7 +25,7 @@ menu.o: menu.c menu.h nedit.h textBuf.h 
 menu.o: menu.c menu.h nedit.h textBuf.h text.h file.h window.h search.h \
   selection.h undo.h shift.h help.h help_topic.h preferences.h tags.h \
   userCmds.h shell.h macro.h highlight.h highlightData.h interpret.h \
-  rbTree.h smartIndent.h windowTitle.h ../util/getfiles.h \
+  rbTree.h smartIndent.h windowTitle.h toolbar.h ../util/getfiles.h \
   ../util/DialogF.h ../util/misc.h ../util/fileUtils.h ../util/utils.h
 nc.o: nc.c server_common.h ../util/fileUtils.h ../util/utils.h \
   ../util/prefFile.h ../util/system.h ../util/clearcase.h
@@ -85,3 +85,4 @@ windowTitle.o: windowTitle.c windowTitle
   preferences.h help.h help_topic.h ../util/prefFile.h ../util/misc.h \
   ../util/DialogF.h ../util/utils.h ../util/fileUtils.h \
   ../util/clearcase.h
+toolbar.o: toolbar.c toolbar.h preferences.h nedit.h
diff -r 54247d349a7d source/menu.c
--- a/source/menu.c	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/menu.c	Sat Jul 29 17:43:23 2006 +0800
@@ -52,6 +52,8 @@ static const char CVSID[] = "$Id: menu.c
 #include "interpret.h"
 #include "smartIndent.h"
 #include "windowTitle.h"
+#include "toolbar.h"
+#include "toolbar_icons.h"
 #include "../util/getfiles.h"
 #include "../util/DialogF.h"
 #include "../util/misc.h"
@@ -151,6 +153,7 @@ static void toolTipsDefCB(Widget w, Wind
 static void toolTipsDefCB(Widget w, WindowInfo *window, caddr_t callData);
 static void tabNavigateDefCB(Widget w, WindowInfo *window, caddr_t callData);
 static void statsLineDefCB(Widget w, WindowInfo *window, caddr_t callData);
+static void toolBarDefCB(Widget w, WindowInfo *window, caddr_t callData);
 static void iSearchLineDefCB(Widget w, WindowInfo *window, caddr_t callData);
 static void lineNumsDefCB(Widget w, WindowInfo *window, caddr_t callData);
 static void pathInWindowsMenuDefCB(Widget w, WindowInfo *window, caddr_t callData);
@@ -594,6 +597,74 @@ static WindowInfo *ShortMenuWindow;
 static WindowInfo *ShortMenuWindow;
 #endif
 
+/* define the buttons on toolbar */
+ToolButton MainToolBar[] = {
+    {TOOL_BTN, doActionCB, "new", "New", 
+    	    {new_bits, new_width, new_height}},
+    {TOOL_BTN, doActionCB, "open_dialog", "Open ...", 
+    	    {open_bits, open_width, open_height}},
+    {TOOL_BTN, doActionCB, "save", "Save",
+    	    {save_bits, save_width, save_height}},
+    {TOOL_IGNORE, doActionCB, "revert_to_saved_dialog", "Revert to saved ...",
+    	    {reload_bits, reload_width, reload_height}},
+    {TOOL_IGNORE, doActionCB, "print", "Print ...",
+    	    {print_bits, print_width, print_height}},
+
+    { TOOL_SEP },	/* separotor */
+    {TOOL_BTN,  doActionCB, "cut_clipboard", "Cut",
+    	    {cut_bits, cut_width, cut_height}},
+    {TOOL_BTN, doActionCB, "copy_clipboard", "Copy", 
+    	    {copy_bits, copy_width, copy_height}},
+    {TOOL_BTN, doActionCB, "paste_clipboard", "Paste", 
+    	    {paste_bits, paste_width, paste_height}},
+
+    { TOOL_SEP },	/* separotor */
+    {TOOL_BTN, doActionCB, "undo", "Undo", 
+    	    {undo_bits, undo_width, undo_height}},
+    {TOOL_BTN, doActionCB, "redo", "Redo", 
+    	    {redo_bits, redo_width, redo_height}},
+
+    { TOOL_SEP },	/* separotor */
+    {TOOL_BTN, findCB, NULL, "Find ...", 
+    	    {find_bits, find_width, find_height}},
+    {TOOL_BTN, findSelCB, NULL, "Find Selection",
+    	    {findsel_bits, findsel_width, findsel_height}},
+    {TOOL_BTN, findSameCB, NULL, "Find Again",
+    	    {findnext_bits, findnext_width, findnext_height}},
+    {TOOL_BTN, replaceCB, NULL, "Replace ...", 
+    	    {replace_bits, replace_width, replace_height}},
+
+    { TOOL_SEP },	/* separotor */
+    {TOOL_BTN, doActionCB, "find_definition", "Find Definition (Tag)", 
+    	    {pushtag_bits, pushtag_width, pushtag_height}},
+    {TOOL_IGNORE, doActionCB, "pop_tagstack", "Pop Tagstack", 
+    	    {poptag_bits, poptag_width, poptag_height}},
+    {TOOL_BTN, gotoMatchingCB, NULL, "Goto Matching (..)", 
+    	    {matchbrace_bits, matchbrace_width, matchbrace_height}},
+    {TOOL_BTN, doActionCB, "mark_dialog", "Bookmark ...", 
+    	    {bookmark_bits, bookmark_width, bookmark_height}},
+    {TOOL_BTN, doActionCB, "goto_mark_dialog", "Goto Boomark ...", 
+    	    {gotomark_bits, gotomark_width, gotomark_height}},
+
+    { TOOL_SEP },	/* separotor */
+    {TOOL_BTN, shiftLeftCB, NULL, "Outdent (Shift Left)", 
+    	    {outdent_bits, outdent_width, outdent_height}},
+    {TOOL_BTN, shiftRightCB, NULL, "Indent (Shift Right)", 
+    	    {indent_bits, indent_width, indent_height}},
+
+    { TOOL_SEP },	/* separotor */
+    {TOOL_BTN, doActionCB, "split_pane", "Split Pane", 
+    	    {split_bits, split_width, split_height}},
+    {TOOL_BTN,  doActionCB, "close_pane", "Close Pane", 
+    	    {join_bits, join_width, join_height}},
+
+    { TOOL_SEP },	/* separotor */
+    {TOOL_BTN,  doActionCB, "show_tip", "Show Calltips", 
+    	    {calltip_bits, calltip_width, calltip_height}},
+    
+    { TOOL_NONE }
+};
+
 void HidePointerOnKeyedEvent(Widget w, XEvent *event)
 {
     if (event && (event->type == KeyPress || event->type == KeyRelease)) {
@@ -981,6 +1052,9 @@ Widget CreateMenuBar(Widget parent, Wind
     	    "Sort Tabs Alphabetically", 'S', tabSortDefCB, window,
 	    GetPrefSortTabs(), FULL);
     
+    window->toolBarDefItem = createMenuToggle(subPane, "toolBarMenu",
+    	    "Tool Bar", 0, toolBarDefCB, window, GetPrefToolBar(),
+    	    SHORT);    
     window->toolTipsDefItem = createMenuToggle(subPane, "showTooltips",
     	    "Show Tooltips", 0, toolTipsDefCB, window, GetPrefToolTips(),
 	    FULL);
@@ -2363,6 +2437,21 @@ static void tabSortDefCB(Widget w, Windo
     }
 }
 
+static void toolBarDefCB(Widget w, WindowInfo *window, caddr_t callData)
+{
+    WindowInfo *win;
+    int state = XmToggleButtonGetState(w);
+
+    /* Set the preference and make the other windows' menus agree */
+    SetPrefToolBar(state);
+    for (win=WindowList; win!=NULL; win=win->next) {
+    	if (!IsTopDocument(win))
+	    continue;
+    	XmToggleButtonSetState(win->toolBarDefItem, state, False);
+    	ShowWindowToolBar(win, state);
+    }
+}
+
 static void statsLineDefCB(Widget w, WindowInfo *window, caddr_t callData)
 {
     WindowInfo *win;
diff -r 54247d349a7d source/nedit.c
--- a/source/nedit.c	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/nedit.c	Sat Nov 19 18:02:05 2005 +0800
@@ -215,6 +215,8 @@ static char *fallbackResources[] = {
     "*statsLine.FontList: " NEDIT_DEFAULT_FONT,
     "*calltip.background: LemonChiffon1",
     "*calltip.foreground: black",
+    "*toolTip.background: LemonChiffon1",
+    "*toolTip.foreground: black",
     "*iSearchForm*highlightThickness: 1",
     "*fileMenu.tearOffModel: XmTEAR_OFF_ENABLED",
     "*editMenu.tearOffModel: XmTEAR_OFF_ENABLED",
diff -r 54247d349a7d source/nedit.h
--- a/source/nedit.h	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/nedit.h	Sat Jul 29 17:43:23 2006 +0800
@@ -286,6 +286,7 @@ typedef struct _WindowInfo {
     Widget	menuBar;    	    	/* the main menu bar */
     Widget	tabBar;			/* tab bar for tabbed window */
     Widget	tab;			/* tab for this document */
+    Widget	toolBar;		/* toolbar for toolbar */
     Widget	replaceDlog;		/* replace dialog */
     Widget	replaceText;		/* replace dialog settable widgets... */
     Widget	replaceWithText;
@@ -351,6 +352,8 @@ typedef struct _WindowInfo {
     Widget	statsLineItem;
     Widget	iSearchLineItem;
     Widget	lineNumsItem;
+    Widget	toolBarDefItem;
+    Widget	toolTipsDefItem;
     Widget	showMatchingOffItem;
     Widget	showMatchingDelimitItem;
     Widget	showMatchingRangeItem;
@@ -398,7 +401,6 @@ typedef struct _WindowInfo {
     Widget	openInTabDefItem;
     Widget	tabBarDefItem;
     Widget	tabBarHideDefItem;
-    Widget	toolTipsDefItem;
     Widget	tabNavigateDefItem;
     Widget      tabSortDefItem;
     Widget	statsLineDefItem;
diff -r 54247d349a7d source/preferences.c
--- a/source/preferences.c	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/preferences.c	Sat Jul 29 17:43:23 2006 +0800
@@ -246,6 +246,7 @@ static struct prefData {
     int searchWrapBeep;     	/* 1=beep when search restarts at begin/end */
     int keepSearchDlogs;	/* whether to retain find and replace dialogs */
     int searchWraps;	/* whether to attempt search again if reach bof or eof */
+    int toolBar;		/* whether to show the tool bar */
     int statsLine;		/* whether to show the statistics line */
     int iSearchLine;	    	/* whether to show the incremental search line*/
     int tabBar;			/* whether to show the tab bar */
@@ -798,6 +799,10 @@ static PrefDescripRec PrefDescrip[] = {
     	&PrefData.sortOpenPrevMenu, NULL, True},
     {"statisticsLine", "StatisticsLine", PREF_BOOLEAN, "False",
     	&PrefData.statsLine, NULL, True},
+    {"toolBar", "ToolBar", PREF_BOOLEAN, "True",
+    	&PrefData.toolBar, NULL, True},
+    {"toolTips", "ToolTips", PREF_BOOLEAN, "True",
+    	&PrefData.toolTips, NULL, True},
     {"iSearchLine", "ISearchLine", PREF_BOOLEAN, "False",
     	&PrefData.iSearchLine, NULL, True},
     {"sortTabs", "SortTabs", PREF_BOOLEAN, "False",
@@ -1548,6 +1553,16 @@ int GetPrefSearchWraps(void)
     return PrefData.searchWraps;
 }
 
+void SetPrefToolBar(int state)
+{
+    setIntPref(&PrefData.toolBar, state);
+}
+
+int GetPrefToolBar(void)
+{
+    return PrefData.toolBar;
+}
+
 void SetPrefStatsLine(int state)
 {
     setIntPref(&PrefData.statsLine, state);
diff -r 54247d349a7d source/preferences.h
--- a/source/preferences.h	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/preferences.h	Sat Jul 29 17:43:23 2006 +0800
@@ -65,6 +65,10 @@ int GetPrefKeepSearchDlogs(void);
 int GetPrefKeepSearchDlogs(void);
 void SetPrefSearchWraps(int state);
 int GetPrefSearchWraps(void);
+void SetPrefToolBar(int state);
+int GetPrefToolBar(void);
+void SetPrefToolTips(int state);
+int GetPrefToolTips(void);
 void SetPrefStatsLine(int state);
 int GetPrefStatsLine(void);
 void SetPrefISearchLine(int state);
diff -r 54247d349a7d source/toolbar.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/toolbar.c	Sat Nov 19 18:01:45 2005 +0800
@@ -0,0 +1,192 @@
+/*******************************************************************************
+*									       *
+* toolbar.c -- Nirvana Editor toolbars					       *
+*									       *
+* Copyright (C) 1999 Mark Edel						       *
+*									       *
+* This is free software; you can redistribute it and/or modify it under the    *
+* terms of the GNU General Public License as published by the Free Software    *
+* Foundation; either version 2 of the License, or (at your option) any later   *
+* version.							               *
+* 									       *
+* This software is distributed in the hope that it will be useful, but WITHOUT *
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License        *
+* for more details.							       *
+* 									       *
+* You should have received a copy of the GNU General Public License along with *
+* software; if not, write to the Free Software Foundation, Inc., 59 Temple     *
+* Place, Suite 330, Boston, MA  02111-1307 USA		                       *
+*									       *
+* Nirvana Text Editor	    						       *
+* May 10, 1991								       *
+*									       *
+* Written by Mark Edel							       *
+*									       *
+*******************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "../config.h"
+#endif
+
+#include "highlight.h"
+#include "preferences.h"
+#include "toolbar.h"
+#include "../Xlt/BubbleButton.h"
+
+#include <Xm/PushB.h>
+#include <Xm/Separator.h>
+#include <Xm/RowColumnP.h>
+
+#ifdef HAVE_DEBUG_H
+#include "../debug.h"
+#endif
+
+/*
+** flatten toolbutton
+*/
+static void flattenToolBtn(Widget btn)
+{
+    Pixel background;
+
+    XtVaGetValues(XtParent(btn), XmNbackground, &background, NULL);
+    XtVaSetValues(btn, 
+	    XmNbottomShadowColor, background,
+	    XmNtopShadowColor, background,
+	    NULL);
+}
+
+/*
+** unflatten toolbutton
+*/
+static void unflattenToolBtn(Widget btn)
+{
+    Pixel topShadow, btmShadow;
+    
+    XtVaGetValues(XtParent(btn), 
+            XmNbottomShadowColor, &btmShadow,
+            XmNtopShadowColor, &topShadow,
+            NULL);
+            
+    XtVaSetValues(btn, 
+	    XmNbottomShadowColor, btmShadow,
+	    XmNtopShadowColor, topShadow,
+	    NULL);
+}
+
+static void toolBtnEventHandler(Widget btn, WindowInfo *window,
+	XKeyEvent *event)
+{
+    if (!GetPrefToolTips())
+    	return;
+	
+    switch (event->type) {
+	case EnterNotify:
+	    unflattenToolBtn(btn);
+	    break;
+	    
+    	case LeaveNotify:
+	    flattenToolBtn(btn);
+	    break;
+	    
+	default:
+	    break;
+    }
+}
+
+static void AddToolBtnEventHandler(Widget btn, XtPointer client_data)
+{
+    EventMask event_mask = EnterWindowMask | LeaveWindowMask;
+
+    XtAddEventHandler(btn, event_mask, False, 
+	    (XtEventHandler)toolBtnEventHandler, client_data);
+}
+
+/*
+** add tool buttons to toolbar (XmRowColumn) according to the
+** null-terminated toolButton arrays.
+*/
+void CreateToolButtons(Widget toolbar, ToolButton *toolButtons)
+{
+    Widget button, tooltipLabel;
+    int i, dummy;
+    XmString toolTipString;
+	
+    for (i=0; toolButtons[i].type; i++) {
+    	switch (toolButtons[i].type) {
+	  case TOOL_BTN:
+	    button = XtVaCreateManagedWidget("toolButton",
+      		    xrwsBubbleButtonWidgetClass, toolbar,
+    		    XmNhighlightThickness, 1,
+    		    XmNshadowThickness, 1,
+        	    XmNtraversalOn, False,
+		    XltNautoParkBubble, True,
+	            XltNslidingBubble, False,
+		    NULL);
+
+	    /* BubbleButton simply use reversed video for tooltips,
+	       we try to use the 'standard' color */
+	    tooltipLabel = XtNameToWidget(button, "*BubbleLabel");
+	    XtVaSetValues(tooltipLabel,
+    		    XmNbackground, AllocColor(button, GetPrefTooltipBgColor(),
+	    		    &dummy, &dummy, &dummy),
+    		    XmNforeground, AllocColor(button, NEDIT_DEFAULT_FG,
+	    		    &dummy, &dummy, &dummy),
+		    NULL);
+
+	    /* put borders around tooltip. BubbleButton use 
+	       transientShellWidgetClass as tooltip shell, which
+	       came without borders */
+	    XtVaSetValues(XtParent(tooltipLabel), XmNborderWidth, 1, NULL);
+
+	    if (!toolButtons[i].bitmap.pixmap) {
+    		Pixel fg, bg;
+		int depth;
+		/* create pixmap per the color depth setting. This fixes a
+		   BadMatch (X_CopyArea) error due to mismatching of color
+		   depth between the bitmap (depth of 1) and the screen,
+		   specifically on when linked to LessTif (0.93.x) on
+		   ASPLinux 7.1 */
+    		XtVaGetValues (button, XmNforeground, &fg, XmNbackground, &bg,
+	    		XmNdepth, &depth, NULL);
+		toolButtons[i].bitmap.pixmap = XCreatePixmapFromBitmapData(TheDisplay,
+                	RootWindowOfScreen(XtScreen(button)), 
+			(char *)toolButtons[i].bitmap.bit_data,
+                	toolButtons[i].bitmap.width,
+			toolButtons[i].bitmap.height,
+			fg, bg, depth);
+	    }
+
+	    /* setup tooltip for tool button */
+	    toolTipString = XmStringCreateSimple(toolButtons[i].toolTip);
+	    XtVaSetValues(button, 
+	    	    XmNlabelType, XmPIXMAP,
+		    XmNlabelPixmap, toolButtons[i].bitmap.pixmap, 
+		    XltNbubbleString, toolTipString,
+		    NULL);
+	    XmStringFree(toolTipString);
+
+    	    XtAddCallback(button, XmNactivateCallback, 
+	    	    (XtCallbackProc)toolButtons[i].callback,
+		    toolButtons[i].cbArg);
+	    
+	    /* tool buttons are flattened to begin with */
+	    AddToolBtnEventHandler(button, NULL);
+	    flattenToolBtn(button);
+
+
+	    break;
+	  case TOOL_SEP:
+	    /* separator */
+    	    button = XtVaCreateManagedWidget("toolButton",
+	    	    xmSeparatorWidgetClass, toolbar,
+		    XmNorientation, XmVERTICAL,
+		    XmNseparatorType, XmSHADOW_ETCHED_IN,
+		    XmNmargin, 1,
+		    XmNhighlightThickness, 2,
+	    	    NULL);
+	    break;
+	}
+    }
+}
+
diff -r 54247d349a7d source/toolbar.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/toolbar.h	Sat Nov 19 18:01:45 2005 +0800
@@ -0,0 +1,35 @@
+#ifndef NEDIT_TOOLBAR_H_INCLUDED
+#define NEDIT_TOOLBAR_H_INCLUDED
+
+#include "nedit.h"
+
+#include <X11/X.h>
+#include <Xm/Xm.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
+
+enum toolButtonType {TOOL_NONE, TOOL_SEP, TOOL_BTN, TOOL_IGNORE};
+
+typedef void (*callbackProc)();
+
+typedef struct _toolBarBitmap {
+    unsigned char *bit_data;
+    int width;
+    int height;
+    Pixmap pixmap;  	    	/* static storage for pixmap data.
+                                   Must init to NULL */
+} toolBarBitmap;
+
+typedef struct _ToolButton {
+    int type;
+    callbackProc callback;
+    void *cbArg;
+    char *toolTip;
+    toolBarBitmap bitmap;
+} ToolButton;
+
+void CreateToolButtons(Widget parent, ToolButton *toolButtons);
+
+extern ToolButton MainToolBar[];
+
+#endif /* NEDIT_TOOLBAR_H_INCLUDED */
diff -r 54247d349a7d source/toolbar_icons.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/toolbar_icons.h	Sat Nov 19 18:01:45 2005 +0800
@@ -0,0 +1,150 @@
+#ifndef NEDIT_TOOLBAR_ICON_H_INCLUDED
+#define NEDIT_TOOLBAR_ICON_H_INCLUDED
+
+/* bitmap data for tool buttons */
+#define bookmark_width 16
+#define bookmark_height 16
+static unsigned char bookmark_bits[] = {
+   0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x73, 0x36, 0x00,
+   0x3a, 0x00, 0x3e, 0x3b, 0x1c, 0x00, 0x10, 0x00, 0x10, 0x39, 0x20, 0x00,
+   0x20, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00};
+#define calltip_width 16
+#define calltip_height 16
+static unsigned char calltip_bits[] = {
+   0x00, 0x00, 0x00, 0x01, 0x08, 0x21, 0x10, 0x10, 0x80, 0x03, 0x40, 0x04,
+   0x20, 0x08, 0x26, 0xc8, 0x20, 0x08, 0x40, 0x04, 0xc0, 0x07, 0x48, 0x24,
+   0x84, 0x42, 0x80, 0x03, 0x00, 0x01, 0x00, 0x00};
+#define copy_width 16
+#define copy_height 16
+static unsigned char copy_bits[] = {
+   0x00, 0x00, 0xfe, 0x00, 0x02, 0x01, 0x7a, 0x02, 0x02, 0x02, 0x1a, 0x02,
+   0xc2, 0x1f, 0x5a, 0x20, 0x42, 0x4f, 0x7e, 0x40, 0x40, 0x4f, 0x40, 0x40,
+   0x40, 0x4f, 0x40, 0x40, 0xc0, 0x7f, 0x00, 0x00};
+#define cut_width 16
+#define cut_height 16
+static unsigned char cut_bits[] = {
+   0x00, 0x00, 0x20, 0x04, 0x20, 0x04, 0x60, 0x06, 0x60, 0x06, 0x60, 0x03,
+   0xc0, 0x03, 0xc0, 0x01, 0x80, 0x01, 0xc0, 0x0f, 0xa0, 0x12, 0x90, 0x22,
+   0x90, 0x24, 0xd0, 0x18, 0x60, 0x00, 0x00, 0x00};
+#define find_width 16
+#define find_height 16
+static unsigned char find_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x70, 0x0e, 0x70, 0x0e, 0x70, 0x0e, 0xf8, 0x1f,
+   0xfc, 0x3f, 0xb4, 0x3d, 0xb6, 0x7d, 0xfe, 0x7f, 0xfa, 0x7b, 0x7a, 0x7a,
+   0x7a, 0x7a, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00};
+#define findnext_width 16
+#define findnext_height 16
+static unsigned char findnext_bits[] = {
+   0x00, 0x00, 0x80, 0x07, 0x40, 0x28, 0x20, 0x30, 0x20, 0x38, 0x40, 0x00,
+   0x00, 0x00, 0x38, 0x07, 0x38, 0x07, 0xfc, 0x0f, 0xde, 0x1f, 0xfe, 0x1d,
+   0xfa, 0x1d, 0x3a, 0x1d, 0x3e, 0x1f, 0x00, 0x00};
+#define findsel_width 16
+#define findsel_height 16
+static unsigned char findsel_bits[] = {
+   0x00, 0x00, 0x38, 0x07, 0x38, 0x07, 0xf4, 0x0e, 0xde, 0x1f, 0xde, 0x1d,
+   0xfa, 0x1d, 0x3a, 0x1d, 0x3e, 0x1f, 0x00, 0x00, 0xa8, 0x2a, 0x50, 0x15,
+   0xa8, 0x2a, 0x50, 0x15, 0xa8, 0x2a, 0x00, 0x00};
+#define gotomark_width 16
+#define gotomark_height 16
+static unsigned char gotomark_bits[] = {
+   0x00, 0x00, 0x80, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x80, 0x0d,
+   0x80, 0x0e, 0x88, 0x6f, 0x18, 0x07, 0x3e, 0x04, 0x18, 0x64, 0x08, 0x08,
+   0x00, 0x08, 0x80, 0x63, 0x00, 0x00, 0x00, 0x00};
+#define indent_width 16
+#define indent_height 16
+static unsigned char indent_bits[] = {
+   0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x10, 0x7f,
+   0x30, 0x7f, 0x7e, 0x00, 0x30, 0x1f, 0x10, 0x1f, 0x00, 0x00, 0xfc, 0x7f,
+   0x00, 0x00, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00};
+#define join_width 16
+#define join_height 16
+static unsigned char join_bits[] = {
+   0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, 0x02, 0x40, 0x3a, 0x5f, 0x02, 0x40,
+   0xfe, 0x7f, 0x80, 0x00, 0xce, 0x79, 0xe6, 0x73, 0xf2, 0x47, 0xc2, 0x41,
+   0xce, 0x79, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00};
+#define matchbrace_width 16
+#define matchbrace_height 16
+static unsigned char matchbrace_bits[] = {
+   0x00, 0x00, 0xc0, 0x00, 0x20, 0x00, 0x40, 0x3c, 0x20, 0x00, 0x40, 0x3c,
+   0x20, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x10, 0x04, 0x08, 0x3e, 0x10, 0x3f,
+   0x08, 0x3e, 0x10, 0x04, 0x0c, 0x00, 0x00, 0x00};
+#define new_width 16
+#define new_height 16
+static unsigned char new_bits[] = {
+   0x00, 0x00, 0xfc, 0x03, 0x04, 0x06, 0x04, 0x0a, 0x04, 0x12, 0x04, 0x3e,
+   0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20,
+   0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f, 0x00, 0x00};
+#define open_width 16
+#define open_height 16
+static unsigned char open_bits[] = {
+   0x00, 0x00, 0x00, 0x0f, 0x80, 0x50, 0x40, 0x60, 0x00, 0x70, 0x1c, 0x00,
+   0xe2, 0x0f, 0x02, 0x08, 0x02, 0x08, 0xc2, 0x7f, 0xe2, 0x7f, 0xf2, 0x3f,
+   0xfa, 0x1f, 0xfe, 0x0f, 0xfe, 0x07, 0x00, 0x00};
+#define outdent_width 16
+#define outdent_height 16
+static unsigned char outdent_bits[] = {
+   0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x7f,
+   0x0c, 0x7f, 0x7e, 0x00, 0x0c, 0x1f, 0x08, 0x1f, 0x00, 0x00, 0xfc, 0x7f,
+   0x00, 0x00, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00};
+#define paste_width 16
+#define paste_height 16
+static unsigned char paste_bits[] = {
+   0x00, 0x00, 0xe0, 0x01, 0x3c, 0x0f, 0x1a, 0x1a, 0x16, 0x16, 0xea, 0x1b,
+   0x56, 0x15, 0xaa, 0x1f, 0xd6, 0x20, 0xaa, 0x40, 0xd6, 0x4e, 0xaa, 0x40,
+   0xd6, 0x4e, 0xfc, 0x40, 0x80, 0x7f, 0x00, 0x00};
+#define poptag_width 16
+#define poptag_height 16
+static unsigned char poptag_bits[] = {
+   0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0x80, 0x03, 0x84, 0x03, 0x82, 0x03,
+   0x02, 0x00, 0xf2, 0x1f, 0xac, 0x3a, 0x5c, 0x55, 0xaa, 0x5a, 0x56, 0x55,
+   0xac, 0x5a, 0xf8, 0x5f, 0x10, 0x40, 0xe0, 0x7f};
+#define print_width 16
+#define print_height 16
+static unsigned char print_bits[] = {
+   0x00, 0x00, 0xc0, 0x7f, 0x40, 0x40, 0x20, 0x27, 0x20, 0x20, 0x90, 0x13,
+   0x18, 0x70, 0xfc, 0x5f, 0x04, 0x60, 0xfe, 0x5f, 0x82, 0x53, 0x02, 0x30,
+   0xfe, 0x1f, 0x04, 0x10, 0xf8, 0x0f, 0x00, 0x00};
+#define pushtag_width 16
+#define pushtag_height 16
+static unsigned char pushtag_bits[] = {
+   0x80, 0x00, 0xc0, 0x00, 0xe0, 0x0f, 0xf0, 0x0f, 0xe0, 0x0f, 0xc4, 0x00,
+   0x82, 0x00, 0x02, 0x00, 0xf2, 0x3f, 0xac, 0x2a, 0x5c, 0x35, 0xaa, 0x2a,
+   0x54, 0x35, 0xa8, 0x2a, 0xf0, 0x3f, 0x00, 0x00};
+#define redo_width 16
+#define redo_height 16
+static unsigned char redo_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
+   0x88, 0x01, 0x04, 0x12, 0x04, 0x1c, 0x04, 0x1c, 0x08, 0x1c, 0x10, 0x1e,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+#define reload_width 16
+#define reload_height 16
+static unsigned char reload_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xf0, 0x07, 0x38, 0x0e, 0x18, 0x18,
+   0x0c, 0x18, 0x0c, 0x00, 0x0c, 0x1f, 0x0c, 0x1e, 0x18, 0x1e, 0x38, 0x1f,
+   0xf0, 0x13, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00};
+#define replace_width 16
+#define replace_height 16
+static unsigned char replace_bits[] = {
+   0x00, 0x00, 0x38, 0x07, 0x38, 0x07, 0xf4, 0x0e, 0xde, 0x1f, 0xde, 0x1d,
+   0xfa, 0x1d, 0x3a, 0x1d, 0x3e, 0x1f, 0x00, 0x00, 0x0c, 0x71, 0xd2, 0x93,
+   0xde, 0x77, 0xd2, 0x93, 0x12, 0x71, 0x00, 0x00};
+#define save_width 16
+#define save_height 16
+static unsigned char save_bits[] = {
+   0x00, 0x00, 0xfe, 0x7f, 0x0a, 0x50, 0x0e, 0x70, 0x0a, 0x50, 0x0e, 0x70,
+   0x0a, 0x50, 0xfe, 0x7f, 0x5a, 0x55, 0xf6, 0x7f, 0xea, 0x59, 0xf6, 0x79,
+   0xec, 0x59, 0xf8, 0x79, 0xf0, 0x7f, 0x00, 0x00};
+#define split_width 16
+#define split_height 16
+static unsigned char split_bits[] = {
+   0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, 0x02, 0x40, 0x3a, 0x5f, 0x02, 0x40,
+   0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40,
+   0xfa, 0x59, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00};
+#define undo_width 16
+#define undo_height 16
+static unsigned char undo_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e,
+   0x80, 0x11, 0x48, 0x20, 0x38, 0x20, 0x38, 0x20, 0x38, 0x10, 0x78, 0x08,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+#endif /* NEDIT_TOOLBAR_ICON_H_INCLUDED */
diff -r 54247d349a7d source/window.c
--- a/source/window.c	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/window.c	Sat Jul 29 17:43:23 2006 +0800
@@ -55,6 +55,7 @@ static const char CVSID[] = "$Id: window
 #include "windowTitle.h"
 #include "interpret.h"
 #include "rangeset.h"
+#include "toolbar.h"
 #include "../util/clearcase.h"
 #include "../util/misc.h"
 #include "../util/fileUtils.h"
@@ -104,6 +105,7 @@ static const char CVSID[] = "$Id: window
 #include <Xm/ScrolledW.h>
 #include <Xm/ScrollBar.h>
 #include <Xm/PrimitiveP.h>
+#include <Xm/Separator.h>
 #include <Xm/Frame.h>
 #include <Xm/CascadeB.h>
 #ifdef EDITRES
@@ -201,7 +203,7 @@ WindowInfo *CreateWindow(const char *nam
 WindowInfo *CreateWindow(const char *name, char *geometry, int iconic)
 {
     Widget winShell, mainWin, menuBar, pane, text, stats, statsAreaForm;
-    Widget closeTabBtn, tabForm, form;
+    Widget closeTabBtn, tabForm, form, toolBar;
     WindowInfo *window;
     Pixel bgpix, fgpix;
     Arg al[20];
@@ -390,6 +392,32 @@ WindowInfo *CreateWindow(const char *nam
             /* XmNautoUnmanage, False, */
             NULL);
     
+    toolBar = XtVaCreateWidget("toolBar", 
+	    xmRowColumnWidgetClass, statsAreaForm,
+	    XmNorientation, XmHORIZONTAL, 
+	    XmNpacking, XmPACK_TIGHT,
+	    XmNmarginWidth, 0,
+	    XmNmarginHeight, 0,
+	    XmNspacing, 0,
+	    XmNentryBorder, 0,
+	    XmNshadowThickness, 0,
+            XmNleftAttachment, XmATTACH_FORM,
+            XmNrightAttachment, XmATTACH_FORM,	    
+	    NULL);
+    CreateToolButtons(toolBar, MainToolBar);
+    window->toolBar = toolBar;
+    if (GetPrefToolBar())
+        XtManageChild(toolBar);
+
+    /* put a line below the tabs (tabbar) */
+    XtVaCreateManagedWidget("TOOLBAR_SEP", xmSeparatorWidgetClass,
+    	    statsAreaForm,
+	    XmNseparatorType, XmSHADOW_ETCHED_IN,
+	    XmNmargin, 0,
+            XmNleftAttachment, XmATTACH_FORM,
+            XmNrightAttachment, XmATTACH_FORM,
+    	    NULL);
+
     /* NOTE: due to a bug in openmotif 2.1.30, NEdit used to crash when
        the i-search bar was active, and the i-search text widget was focussed,
        and the window's width was resized to nearly zero. 
@@ -743,7 +771,7 @@ WindowInfo *CreateWindow(const char *nam
     manageToolBars(statsAreaForm);
 
     if (showTabBar || window->showISearchLine || 
-    	    window->showStats)
+    	    window->showStats || GetPrefToolBar())
         XtManageChild(statsAreaForm);
     
     /* realize all of the widgets in the new window */
@@ -1488,6 +1516,26 @@ void ShowTabBar(WindowInfo *window, int 
     if (XtIsManaged(XtParent(window->tabBar)) == state)
         return;
     showTabBar(window, state);
+}
+
+static void showToolBar(WindowInfo *window, int state)
+{
+    if (state) {
+	XtManageChild(window->toolBar);
+	showStatsForm(window, True);
+    } else {
+	XtUnmanageChild(window->toolBar);
+	showStatsForm(window, False);
+    }
+}
+
+/*
+*/
+void ShowWindowToolBar(WindowInfo *window, int state)
+{
+    if (XtIsManaged(window->toolBar) == state)
+        return;
+    showToolBar(window, state);
 }
 
 /*
diff -r 54247d349a7d source/window.h
--- a/source/window.h	Sat Jul 29 17:42:10 2006 +0800
+++ b/source/window.h	Sat Nov 19 18:01:45 2005 +0800
@@ -102,6 +102,7 @@ void ShowWindowTabBar(WindowInfo *window
 void ShowWindowTabBar(WindowInfo *window);
 void RefreshMenuToggleStates(WindowInfo *window);
 void RefreshWindowStates(WindowInfo *window);
+void ShowWindowToolBar(WindowInfo *window, int state);
 void AllWindowsBusy(const char* message);
 void AllWindowsUnbusy(void);
 void SortTabBar(WindowInfo *window);
