Mosaic EditSource Patch

(Thanks to: Eric Bartley <bartley@cc.purdue.edu> for comments and additions)

This a patch for Mosaic (X11) which makes the source window editable. Apply it in the src directory with the following command:
	% patch < editsource.patch
Here is the patch itself:


*** gui-dialogs.c.orig Wed May 4 23:26:28 1994 --- gui-dialogs.c Sun Jun 26 20:31:16 1994 *************** mo_status mo_post_print_window (mo_windo *** 955,960 **** --- 955,964 ---- static XmxCallback (source_win_cb) { + /* patch start */ + XmTextPosition cpos, tpos; + /* patch end */ + mo_window *win = mo_fetch_window_by_id (XmxExtractUniqid ((int)client_data)); switch (XmxExtractToken ((int)client_data)) { *************** static XmxCallback (source_win_cb) *** 967,972 **** --- 971,990 ---- mo_assemble_help_url ("docview-menubar-file.html#documentsource"), NULL, NULL); break; + /* patch start */ + case 2: + XtVaGetValues ( win->source_text, XmNcursorPosition, &cpos, XmNtopCharacter, &tpos, NULL ); + + free (win->current_node->texthead); + win->current_node->texthead = XmxTextGetString (win->source_text); + win->current_node->text = win->current_node->texthead; + mo_refresh_window_text (win); + + /* it's necessary to keep the XtVaSetValues in this order */ + XtVaSetValues ( win->source_text, XmNcursorPosition, cpos, NULL ); + XtVaSetValues ( win->source_text, XmNtopCharacter, tpos, NULL ); + break; + /* patch end */ } return; *************** mo_status mo_post_source_window (mo_wind *** 1002,1009 **** /* Info window: text widget, not editable. */ XmxSetArg (XmNscrolledWindowMarginWidth, 10); XmxSetArg (XmNscrolledWindowMarginHeight, 10); ! XmxSetArg (XmNcursorPositionVisible, False); ! XmxSetArg (XmNeditable, False); XmxSetArg (XmNeditMode, XmMULTI_LINE_EDIT); XmxSetArg (XmNrows, 15); XmxSetArg (XmNcolumns, 80); --- 1020,1030 ---- /* Info window: text widget, not editable. */ XmxSetArg (XmNscrolledWindowMarginWidth, 10); XmxSetArg (XmNscrolledWindowMarginHeight, 10); ! ! /* patch start */ ! XmxSetArg (XmNcursorPositionVisible, True); ! XmxSetArg (XmNeditable, True); ! /* end patch */ XmxSetArg (XmNeditMode, XmMULTI_LINE_EDIT); XmxSetArg (XmNrows, 15); XmxSetArg (XmNcolumns, 80); *************** mo_status mo_post_source_window (mo_wind *** 1011,1018 **** dialog_sep = XmxMakeHorizontalSeparator (source_form); ! buttons_form = XmxMakeFormAndTwoButtonsSqueezed ! (source_form, source_win_cb, "Dismiss", "Help...", 0, 1); /* Constraints for source_form. */ XmxSetOffsets (label, 13, 0, 10, 0); --- 1032,1041 ---- dialog_sep = XmxMakeHorizontalSeparator (source_form); ! /* patch start */ ! buttons_form = XmxMakeFormAndThreeButtonsSqueezed ! (source_form, source_win_cb, "Dismiss", "Update", "Help...", 0, 2, 1); ! /* end patch */ /* Constraints for source_form. */ XmxSetOffsets (label, 13, 0, 10, 0);
Panagiotis Christias, christia@theseas.ntua.gr