Browse Source

* edit.h: Get rid of WIDGET_COMMAND, update all dependencies.

Pavel Roskin 21 years ago
parent
commit
38265d418d
5 changed files with 19 additions and 16 deletions
  1. 4 0
      edit/ChangeLog
  2. 10 8
      edit/edit.c
  3. 1 2
      edit/edit.h
  4. 4 2
      edit/editmenu.c
  5. 0 4
      edit/editwidget.c

+ 4 - 0
edit/ChangeLog

@@ -1,3 +1,7 @@
+2003-09-07  Pavel Roskin  <proski@gnu.org>
+
+	* edit.h: Get rid of WIDGET_COMMAND, update all dependencies.
+
 2003-07-31  Andrew V. Samoilov  <sav@bcs.zp.ua>
 
 	* edit-widget.h: Resurrect "dir" field in WEdit to store

+ 10 - 8
edit/edit.c

@@ -2124,14 +2124,16 @@ static void edit_goto_matching_bracket (WEdit *edit)
     edit_cursor_move (edit, q - edit->curs1);
 }
 
-/* this executes a command as though the user initiated it through a key press. */
-/* callback with WIDGET_KEY as a message calls this after translating the key
-   press */
-/* this can be used to pass any command to the editor. Same as sendevent with
-   msg = WIDGET_COMMAND and par = command  except the screen wouldn't update */
-/* one of command or char_for_insertion must be passed as -1 */
-/* commands are executed, and char_for_insertion is inserted at the cursor */
-/* returns 0 if the command is a macro that was not found, 1 otherwise */
+/*
+ * This executes a command as though the user initiated it through a key
+ * press.  Callback with WIDGET_KEY as a message calls this after
+ * translating the key press.  This function can be used to pass any
+ * command to the editor.  Note that the screen wouldn't update
+ * automatically.  Either of command or char_for_insertion must be
+ * passed as -1.  Commands are executed, and char_for_insertion is
+ * inserted at the cursor.  0 is returned if the command is an undefined
+ * macro, 1 otherwise.
+ */
 int edit_execute_key_command (WEdit * edit, int command, int char_for_insertion)
 {
     int r;

+ 1 - 2
edit/edit.h

@@ -39,8 +39,7 @@
 
 #include "src/global.h"
 
-#    define WIDGET_COMMAND (WIDGET_USER + 10)
-#    define N_menus 5
+#define N_menus 5
 
 #define SEARCH_DIALOG_OPTION_NO_SCANF	1
 #define SEARCH_DIALOG_OPTION_NO_REGEX	2

+ 4 - 2
edit/editmenu.c

@@ -37,9 +37,11 @@
 #define edit_message_dialog(w,x,y,h,s) query_dialog (h, s, 0, 1, _("&OK"))
 #define CFocus(x) 
 
-static void menu_cmd (int i)
+static void
+menu_cmd (int command)
 {
-    send_message ((Widget *) wedit, WIDGET_COMMAND, i);
+    edit_execute_key_command (wedit, command, -1);
+    edit_update_screen (wedit);
 }
 
 static void menu_key (int i)

+ 0 - 4
edit/editwidget.c

@@ -337,10 +337,6 @@ static int edit_callback (WEdit *e, int msg, int par)
 	    edit_update_screen (e);
 	}
 	return 1;
-    case WIDGET_COMMAND:
-	edit_execute_key_command (e, par, -1);
-	edit_update_screen (e);
-	return 1;
     case WIDGET_CURSOR:
 	widget_move (&e->widget, e->curs_row + EDIT_TEXT_VERTICAL_OFFSET, e->curs_col + e->start_col);
 	return 1;