Index: src/winhugs/DlgMain.c
===================================================================
RCS file: /cvs/hugs98/src/winhugs/DlgMain.c,v
retrieving revision 1.4
diff -u -r1.4 DlgMain.c
--- src/winhugs/DlgMain.c	6 Sep 2005 09:36:10 -0000	1.4
+++ src/winhugs/DlgMain.c	7 Sep 2005 10:41:29 -0000
@@ -143,23 +143,24 @@
     tbi.dwMask = TBIF_STATE;
     tbi.fsState = (Enable ? TBSTATE_ENABLED : 0);
     SendDlgItemMessage(hThisWindow, ID_TOOLBAR, TB_SETBUTTONINFO, id, (LPARAM) &tbi);
+
+    EnableMenuItem(GetMenu(hThisWindow), id,
+	    MF_BYCOMMAND | (Enable ? MF_ENABLED : MF_GRAYED));
 }
 
 void EnableButtons()
 {
+    int CopyState = (Running ? 0 : RtfWindowCanCutCopy());
+
     EnableButton(ID_STOP, Running);
     EnableButton(ID_RUN, !Running);
 
-    if (Running) {
-	EnableButton(ID_CUT, FALSE);
-	EnableButton(ID_COPY, FALSE);
-	EnableButton(ID_PASTE, FALSE);
-    } else {
-	int CopyState = RtfWindowCanCutCopy();
-	EnableButton(ID_CUT, CopyState & DROPEFFECT_MOVE);
-	EnableButton(ID_COPY, CopyState & DROPEFFECT_COPY);
-	EnableButton(ID_PASTE, TRUE);
-    }
+    EnableButton(ID_CUT, CopyState & DROPEFFECT_MOVE);
+    EnableButton(ID_DELETE, CopyState & DROPEFFECT_MOVE);
+    EnableButton(ID_COPY, CopyState & DROPEFFECT_COPY);
+    EnableButton(ID_PASTE, !Running);
+    EnableButton(ID_CLEARSCREEN, !Running);
+    EnableButton(ID_SELECTALL, !Running);
 }
 
 void FireCommand(LPCSTR Command)
@@ -246,49 +247,11 @@
 	    EndDialog(hWnd, 0);
 	    break;
 
-	case IDOK:
-	    MessageBox(hWnd, "OK", "OK", 0);
-	    break;
-
-	/* Load a sript file from disk */
-	case ID_OPEN:
-	    MainOpenFile(hWnd);
-
-		/*	{ CHAR *ScriptName;
-		      CHAR Command[2048];
-
-		      if ((ScriptName = GetaFileName(GetFocus(), IDS_FILTERFILE)) != NULL) {
-			wsprintf(Command, ":l %s\n", ExpandFileName((String)ScriptName));
-			AbortInterpreter;
-			SetInterpreterCommand(Command);
-			GotoInterpreter;
-		      }
-		    }*/
-		    break;
-
-	/* Enter Script Manager */
-	case ID_SCRIPTMAN:
-	    ShowScriptMan();
-	    break;
-
-	/* Load a sript file from disk (the name of the script is currently selected) */
-	case ID_OPENSELECTED:/*	{ CHAR *ScriptName;
-		      CHAR Command[2048];
-
-		      ScriptName = GetSelectedText(hWndText);
-		      wsprintf(Command, ":l %s\n", ExpandFileName((String)ScriptName));
-		      AbortInterpreter;
-		      SetInterpreterCommand(Command);
-		      GotoInterpreter;
-		    }*/
-		    break;
+	case ID_OPEN: MainOpenFile(hWnd); break;
+	case ID_SCRIPTMAN: ShowScriptMan(); break;
+	case ID_EXIT: FireCommand(":quit\n"); break;
 
-	/* Exit Hugs interpreter */
-	case ID_EXIT:
-	    FireCommand(":q\n");
-	    break;
-
-	/* Load one of the last 10 open files */
+	// Load one of the last 10 open files
 	case ID_MRU+0: case ID_MRU+1: case ID_MRU+2: case ID_MRU+3:
 	case ID_MRU+4: case ID_MRU+5: case ID_MRU+6: case ID_MRU+7:
 	case ID_MRU+8: case ID_MRU+9:
@@ -299,89 +262,30 @@
 	    }
 	    break;
 
-	// Clilpboard operations
+	// EDIT MENU
 	case ID_CUT: RtfWindowClipboard(WM_CUT); break;
 	case ID_COPY: RtfWindowClipboard(WM_COPY); break;
 	case ID_PASTE: RtfWindowClipboard(WM_PASTE); break;
+	case ID_CLEARSCREEN: RtfWindowClear(); break;
+	case ID_DELETE: RtfWindowDelete(); break;
+	case ID_SELECTALL: RtfWindowSelectAll(); break;
+	case ID_GOPREVIOUS: RtfWindowHistory(-1); break;
+	case ID_GONEXT: RtfWindowHistory(+1); break;
 
-	/* Clipboard clear */
-	//case ID_CLEAR:		SendMessage(hWndText, WM_CLEAR, 0, 0L);
-	//			break;
-
-	/* Edit previous line */
-	//case ID_GOPREVIOUS: 	SendMessage(hWndText, WM_KEYDOWN, (WPARAM) VK_UP, 0x1000000L);
-	//			SendMessage(hWndText, WM_KEYUP,   (WPARAM) VK_UP, 0x1000000L);
-	//			break;
-
-	/* Edit next line */
-	//case ID_GONEXT:		SendMessage(hWndText, WM_KEYDOWN, (WPARAM) VK_DOWN, 0x1000000L);
-	//			SendMessage(hWndText, WM_KEYUP,   (WPARAM) VK_DOWN, 0x1000000L);
-	//			break;
-
-	/* Open text editor */
-	case ID_GOEDIT:
-	    FireCommand(":edit");
-	    break;
-
-	/* Open text editor for selected text */
-	case ID_EDITSELECTED:
-	    /* { CHAR Command[2048];
-
-		wsprintf(Command, ":e %s\n", ExpandFileName((String)GetSelectedText(hWndText)));
-		AbortInterpreter;
-		SetInterpreterCommand(Command);
-		GotoInterpreter;
-	    } */
-	    break;
-
-	/* Find definition of selected text */
-	case ID_FIND:
-	    /* { String SelectedText;
-
-		SelectedText = GetSelectedText(hWndText);
-		AbortInterpreter;
-		SetInterpreterCommand(":f %s\n",(LPSTR)SelectedText);
-		GotoInterpreter;
-	    } */
-	    break;
-
-	/* Show type of selected text */
-	case ID_TYPE:
-	    /* { String SelectedText;
-		SelectedText = GetSelectedText(hWndText);
-		AbortInterpreter;
-		SetInterpreterCommand(":t %s\n",(LPSTR)SelectedText);
-		GotoInterpreter;
-	    } */
-	    break;
-
-	/* Show info on selected text */
-	case ID_INFO:
-	    /* { String SelectedText;
-		SelectedText = GetSelectedText(hWndText);
-		AbortInterpreter;
-		SetInterpreterCommand(":i %s\n",(LPSTR)SelectedText);
-		GotoInterpreter;
-	    } */
-	    break;
-
-	/* Eval selected text */
-	case ID_EVAL:
-	    /* { String SelectedText;
-		SelectedText = GetSelectedText(hWndText);
-		AbortInterpreter;
-		SetInterpreterCommand("%s\n",(LPSTR)SelectedText);
-		GotoInterpreter;
-	    } */
-	    break;
 
-	/* Stop program execution */
+        // ACTIONS MENU
+	// Reload script files
+	case ID_COMPILE: case ID_MAKE: FireCommand(":reload"); break;
+	case ID_CLEARALL: FireCommand(":load"); break;
+	case ID_GOEDIT: FireCommand(":edit"); break;
+
+	// Stop program execution
 	case ID_STOP:
 	    MessageBeep(0xFFFFFFFF);
 	    raise(SIGINT);
 	    break;
 
-	/* Evaluate main expression */
+	// Evaluate main expression
 	case ID_RUN:
 	    {
 		char Buffer[1000];
@@ -393,22 +297,12 @@
 	    }
 	    break;
 
-	/* Set interpreter options using dialog box */
+	// Set interpreter options using dialog box
 	case ID_SETOPTIONS:
 	    if (ShowOptionsDialog(hWnd))
 		RtfWindowUpdateFont();
 	    break;
 
-	/* Reload script files */
-	case ID_COMPILE:
-	case ID_MAKE:
-	    FireCommand(":reload");
-	    break;
-
-	/* Clear all files loaded but Prelude */
-	case ID_CLEARALL:
-	    FireCommand(":load");
-	    break;
 
 	// BROWSE MENU
 	case ID_BROWSEHIERARCHY: DrawClassesHierarchy(); break;
Index: src/winhugs/RtfWindow.c
===================================================================
RCS file: /cvs/hugs98/src/winhugs/RtfWindow.c,v
retrieving revision 1.2
diff -u -r1.2 RtfWindow.c
--- src/winhugs/RtfWindow.c	6 Sep 2005 23:38:16 -0000	1.2
+++ src/winhugs/RtfWindow.c	7 Sep 2005 10:52:14 -0000
@@ -61,6 +61,47 @@
 	return DROPEFFECT_COPY;
 }
 
+void RtfWindowClear()
+{
+    CHARRANGE cr;
+    int Lines = SendMessage(hRTF, EM_GETLINECOUNT, 0, 0);
+    int ThisLine = SendMessage(hRTF, EM_LINEINDEX, Lines-1, 0);
+
+    SendMessage(hRTF, EM_EXGETSEL, 0, (LPARAM) &cr);
+    SendMessage(hRTF, EM_SETSEL, 0, ThisLine);
+    PuttingChar = TRUE;
+    SendMessage(hRTF, EM_REPLACESEL, FALSE, (LPARAM) "");
+    PuttingChar = FALSE;
+
+    cr.cpMax -= ThisLine;
+    cr.cpMin -= ThisLine;
+
+    Length -= ThisLine;
+    if (cr.cpMin < 0)
+        SendMessage(hRTF, EM_SETSEL, Length, Length);
+    else
+	SendMessage(hRTF, EM_EXSETSEL, 0, (LPARAM) &cr);
+}
+
+void RtfWindowDelete()
+{
+    SendMessage(hRTF, EM_REPLACESEL, FALSE, (LPARAM) "");
+}
+
+void RtfWindowHistory(int Delta)
+{
+    LPCSTR x = GetHistory(Delta);
+    if (x == NULL)
+	MessageBeep((UINT) -1);
+    else
+	RtfWindowSetCommand(x);
+}
+
+void RtfWindowSelectAll()
+{
+    SendMessage(hRTF, EM_SETSEL, 0, -1);
+}
+
 BOOL RtfNotify(HWND hDlg, NMHDR* nmhdr)
 {
     if (nmhdr->code == EN_PROTECTED && !PuttingChar) {
@@ -128,11 +169,7 @@
 		CHARRANGE cr;
 		SendMessage(hRTF, EM_EXGETSEL, 0, (LPARAM) &cr);
 		if ((DWORD) cr.cpMin >= Length) {
-		    LPCSTR x = GetHistory(mf->wParam == VK_UP ? -1 : +1);
-		    if (x == NULL)
-			MessageBeep((UINT) -1);
-		    else
-			RtfWindowSetCommand(x);
+		    RtfWindowHistory(mf->wParam == VK_UP ? -1 : +1);
 		    SetWindowLong(hDlg, DWL_MSGRESULT, 1);
 		    return TRUE;
 		}
Index: src/winhugs/RtfWindow.h
===================================================================
RCS file: /cvs/hugs98/src/winhugs/RtfWindow.h,v
retrieving revision 1.1
diff -u -r1.1 RtfWindow.h
--- src/winhugs/RtfWindow.h	1 Sep 2005 12:22:19 -0000	1.1
+++ src/winhugs/RtfWindow.h	7 Sep 2005 10:32:28 -0000
@@ -8,3 +8,8 @@
 BOOL RtfNotify(HWND hDlg, NMHDR* nmhdr);
 int RtfWindowCanCutCopy();
 void RtfWindowClipboard(UINT Msg);
+
+void RtfWindowClear();
+void RtfWindowDelete();
+void RtfWindowHistory(int Delta);
+void RtfWindowSelectAll();
Index: src/winhugs/resrc1.h
===================================================================
RCS file: /cvs/hugs98/src/winhugs/resrc1.h,v
retrieving revision 1.3
diff -u -r1.3 resrc1.h
--- src/winhugs/resrc1.h	5 Sep 2005 15:23:33 -0000	1.3
+++ src/winhugs/resrc1.h	7 Sep 2005 10:33:20 -0000
@@ -44,13 +44,17 @@
 #define ID_WWWHUGS                      40008
 #define ID_WWWHASKELL                   40009
 #define ID_HELPCONTENTS                 40010
+#define ID_Menu                         40016
+#define ID_DELETE                       40020
+#define ID_CLEARSCREEN                  40021
+#define ID_SELECTALL                    40022
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        110
-#define _APS_NEXT_COMMAND_VALUE         40015
+#define _APS_NEXT_COMMAND_VALUE         40023
 #define _APS_NEXT_CONTROL_VALUE         1037
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
Index: src/winhugs/winhugs.rc
===================================================================
RCS file: /cvs/hugs98/src/winhugs/winhugs.rc,v
retrieving revision 1.17
diff -u -r1.17 winhugs.rc
--- src/winhugs/winhugs.rc	5 Sep 2005 15:23:33 -0000	1.17
+++ src/winhugs/winhugs.rc	7 Sep 2005 10:33:20 -0000
@@ -95,6 +95,7 @@
     BEGIN
         MENUITEM "&Open...\tCtrl+O",            ID_OPEN
         MENUITEM "&Module Manager...",          ID_SCRIPTMAN
+        MENUITEM "Options",                     ID_SETOPTIONS
         MENUITEM SEPARATOR
         MENUITEM "&Exit",                       ID_EXIT
         MENUITEM SEPARATOR
@@ -105,25 +106,23 @@
         MENUITEM "Cu&t\tCtrl+X",                ID_CUT
         MENUITEM "&Copy\tCtrl+C",               ID_COPY
         MENUITEM "&Paste\tCtrl+V",              ID_PASTE
-        MENUITEM "Delete\tDel",                 ID_CLEAR
+        MENUITEM SEPARATOR
+        MENUITEM "Delete\tDel",                 ID_DELETE
+        MENUITEM "Select All\tCtrl+A",          ID_SELECTALL
+        MENUITEM "Clear Screen",                ID_CLEARSCREEN
         MENUITEM SEPARATOR
         MENUITEM "Previous line\t&Up arrow",    ID_GOPREVIOUS
         MENUITEM "Next line\t&Down arrow",      ID_GONEXT
     END
-    POPUP "&Interpreter"
+    POPUP "&Actions"
     BEGIN
         MENUITEM "&Run\tF5",                    ID_RUN
-        MENUITEM "&Stop program",               ID_STOP
-        MENUITEM SEPARATOR
-        MENUITEM "&Compile      Alt+F9",        ID_COMPILE, GRAYED
-        MENUITEM "C&lear all",                  ID_CLEARALL, GRAYED
+        MENUITEM "&Stop",                       ID_STOP
         MENUITEM SEPARATOR
-        MENUITEM "&Evaluate",                   ID_EVAL
-        MENUITEM "&Type",                       ID_TYPE
-        MENUITEM "&Info",                       ID_INFO
-        MENUITEM "&Find",                       ID_FIND
+        MENUITEM "Re&load",                     ID_COMPILE
+        MENUITEM "&Clear Modules",              ID_CLEARALL
         MENUITEM SEPARATOR
-        MENUITEM "&Options ...",                ID_SETOPTIONS
+        MENUITEM "Open Text Editor",            ID_GOEDIT
     END
     POPUP "&Browse"
     BEGIN
