" Module : XW-TEXT-DEFS.ST Date : 17-Dec-1990 Version : 2.00-00 Modified : 03-Apr-1991 This module provides the basic X-Window interface. " " | Change Log | ============================================================================ | Author Date Change | KAREN 03 Apr 91 Changed class definition to inherit from general | class XWindow | | KAREN 25 Feb 91 Changed name of main object to XTextWindow. Added | link to TextWindowController object. Added methods | for returning window-id (view) and controller-id | | ALISTAIR 30 Jan 91 V2.00-00 | Added key methods for new version of | XWST_SHR.EXE | | ALISTAIR 8 Jan 91 Added code so that all IO to standard input/output | now goes to the transcript window. | " XWindow subclass: #XTextWindow instanceVariableNames: '' classVariableNames: 'windowTitle' poolDictionaries: '' category: 'X-Windows'. ! !XTextWindow class methodsFor: 'creation'! new | newWindow newId newController| newWindow := super new. newId := newWindow newTextWindow: windowTitle. newWindow setId: newId. newController := XTextWindowController newControllerFor: newWindow. newWindow setController: newController. ^newWindow !! !XTextWindow class methodsFor: 'class initialization'! initialize windowTitle := 'TEXT WINDOW'. !! !XTextWindow methodsFor: 'using'! hasFocus ^ true ! print: aString self in: wId put: aString. ^self ! nextPut: aChar self in: wId putCh: aChar. ^self ! getLineNumber ^self getLineNumber: wId ! getNumberOfLines ^self getNumberOfLines: wId ! getLine: aNumber ^self from: wId getLine: aNumber ! getCommand ^self getCommand: wId ! getText ^self getText: wId ! definePopUp: aLabels with: aSelectors self in: wId define: aLabels with: aSelectors. ^self ! getPopupSelection ^self getPopupSelection: wId ! getKeypress: dataType self getKeypress: dataType. ^self ! appendText ^self appendText: wId ! copyText ^self copyText: wId ! cutText ^self cutText: wId ! deleteCurrentChar ^self deleteCurrentChar: wId ! deleteCurrentLine ^self deleteCurrentLine: wId ! deletePreviousChar ^self deletePreviousChar: wId ! deleteText ^self deleteText: wId ! endOfLine ^self endOfLine: wId ! gotoBottom ^self gotoBottom: wId ! gotoTop ^self gotoTop: wId ! insertChar: aChar self in: wId insertChar: aChar. ^self ! insertReturn ^self insertReturn: wId ! moveCursor: aDirection self in: wId moveCursor: aDirection. ^self ! pasteText ^self pasteText: wId ! selectAll ^self selectAll: wId ! startOfLine ^self startOfLine: wId ! getQuitWindow ^self getQuitWindow ! "Key definitions" key65293 self insertReturn ! key65361 self moveCursor: 4 ! key65362 self moveCursor: 1 ! key65363 self moveCursor: 3 ! key65364 self moveCursor: 2 ! key65535 self deletePreviousChar !! | dynfun | dynfun := VmsDynamicFunction new. dynfun addLibrary: 'XWST_SHR'. dynfun defineExternFunc: 'create_text_window' withSelectorArgs: 'newTextWindow: aTitle' forClass: XTextWindow returning: #int args: #(string). dynfun defineExternFunc: 'get_command' withSelectorArgs: 'getCommand: aWindow' forClass: XTextWindow returning: #int args: #(int). dynfun defineExternFunc: 'get_selected_text' withSelectorArgs: 'getText: aWindow' forClass: XTextWindow returning: #string args: #(int). dynfun defineExternFunc: 'put_string_at_current' withSelectorArgs: 'in: aWindow put: aString' forClass: XTextWindow returning: #void args: #(int string). dynfun defineExternFunc: 'put_string_at_end' withSelectorArgs: 'in: aWindow putAtEnd: aString' forClass: XTextWindow returning: #void args: #(int string). dynfun defineExternFunc: 'create_popup_menu' withSelectorArgs: 'in: aWindow define: aPopUp with: aSelector' forClass: XTextWindow returning: #void args: #(int string string). dynfun defineExternFunc: 'get_popup_selection' withSelectorArgs: 'getPopupSelection: aWindow' forClass: XTextWindow returning: #string args: #(int). dynfun defineExternFunc: 'put_character' withSelectorArgs: 'in: aWindow putCh: aCharacter' forClass: XTextWindow returning: #void args: #(int char). ! | dynfun | dynfun := VmsDynamicFunction new. dynfun addLibrary: 'XWST_SHR'. dynfun defineExternFunc: 'get_last_keypress' withSelectorArgs: 'getKeypress: dataType' forClass: XTextWindow returning: #int args: #(int). dynfun defineExternFunc: 'get_quit_window_id' withSelectorArgs: 'getQuitWindow' forClass: XTextWindow returning: #int args: #(). dynfun defineExternFunc: 'xwst_append_text' withSelectorArgs: 'appendText: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_copy_text' withSelectorArgs: 'copyText: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_cut_text' withSelectorArgs: 'cutText: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_delete_current_char' withSelectorArgs: 'deleteCurrentChar: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_delete_current_line' withSelectorArgs: 'deleteCurrentLine: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_delete_prev_char' withSelectorArgs: 'deletePreviousChar: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_delete_text' withSelectorArgs: 'deleteText: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_end_of_line' withSelectorArgs: 'endOfLine: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_goto_bottom' withSelectorArgs: 'gotoBottom: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_goto_top' withSelectorArgs: 'gotoTop: aWindow' forClass: XTextWindow returning: #void args: #(int). ! | dynfun | dynfun := VmsDynamicFunction new. dynfun addLibrary: 'XWST_SHR'. dynfun defineExternFunc: 'xwst_insert_char' withSelectorArgs: 'in: aWindow insertChar: aCharacter' forClass: XTextWindow returning: #void args: #(int char). dynfun defineExternFunc: 'xwst_insert_return' withSelectorArgs: 'insertReturn: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_move_cursor' withSelectorArgs: 'in: aWindow moveCursor: adirection' forClass: XTextWindow returning: #void args: #(int int). dynfun defineExternFunc: 'xwst_paste_text' withSelectorArgs: 'pasteText: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_select_all' withSelectorArgs: 'selectAll: aWindow' forClass: XTextWindow returning: #void args: #(int). dynfun defineExternFunc: 'xwst_start_of_line' withSelectorArgs: 'startOfLine: aWindow' forClass: XTextWindow returning: #void args: #(int). ! | dynfun | dynfun := VmsDynamicFunction new. dynfun addLibrary: 'XWST_SHR'. dynfun defineExternFunc: 'number_lines' withSelectorArgs: 'getNumberOfLines: aWindow' forClass: XTextWindow returning: #int args: #(int). dynfun defineExternFunc: 'get_current_line_no' withSelectorArgs: 'getLineNumber: aWindow' forClass: XTextWindow returning: #int args: #(int). dynfun defineExternFunc: 'get_line' withSelectorArgs: 'from: aWindow getLine: aNumber' forClass: XTextWindow returning: #string args: #(int int). !