! UIMX ascii DTSCRIPT key: 7137 ! @(#)38 1.1 src/dtuimx/ibmr2/dtscriptdir/contrib/FileBrowser/FileBrowser.i, uimx, dtuimx720 8/8/94 20:09:39 ! COMPONENT_NAME: DT UIM/X ! ! ORIGINS: 58 ! ! ! Copyright IBM Corporation 1991, 1994 ! ! All Rights Reserved ! ! Permission to use, copy, modify, and distribute this software and its ! documentation for any purpose and without fee is hereby granted, ! provided that the above copyright notice appear in all copies and that ! both that copyright notice and this permission notice appear in ! supporting documentation, and that the name of IBM not be ! used in advertising or publicity pertaining to distribution of the ! software without specific, written prior permission. ! ! IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ! PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR ! CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF ! USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ! OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE ! OR PERFORMANCE OF THIS SOFTWARE. *dialogWindow1.class: form *dialogWindow1.gbldecl: #include \ *dialogWindow1.funcdecl: swidget create_dialogWindow1(swidget UxParent) *dialogWindow1.funcdecl: swidget create_dialogWindow1() *dialogWindow1.funcname: create_dialogWindow1 *dialogWindow1.funcdef: "swidget", "(%)" *dialogWindow1.fcode: return(rtrn);\ *dialogWindow1.static: true *dialogWindow1.static: true *dialogWindow1.name: dialogWindow1 *dialogWindow1.parent: NO_PARENT *dialogWindow1.parentExpression: UxParent *dialogWindow1.defaultShell: topLevelShell *dialogWindow1.resizePolicy: "resize_none" *dialogWindow1.isCompound: "true" *dialogWindow1.compoundIcon: "dialogW.xpm" *dialogWindow1.compoundName: "dialog_Window" *dialogWindow1.isDuplicatable: "false" *dialogWindow1.unitType: "pixels" *dialogWindow1.width: 607 *dialogWindow1.height: 820 *dialogWindow1.x: 637 *dialogWindow1.y: 0 *dialogWindow1.dialogTitle: "File Browser" *label1.class: label *label1.static: true *label1.name: label1 *label1.parent: dialogWindow1 *label1.isCompound: "true" *label1.compoundIcon: "label.xpm" *label1.compoundName: "label_" *label1.canBeTopLevel: "false" *label1.canHaveChildren: "false" *label1.width: 56 *label1.height: 26 *label1.x: 20 *label1.y: 234 *label1.labelString: "File:" *textField1.class: textField *textField1.static: true *textField1.name: textField1 *textField1.parent: dialogWindow1 *textField1.isCompound: "true" *textField1.compoundIcon: "textfield.xpm" *textField1.compoundName: "text_Field" *textField1.canBeTopLevel: "false" *textField1.canHaveChildren: "false" *textField1.width: 420 *textField1.height: 34 *textField1.x: 130 *textField1.y: 230 *textField1.activateCallback: # Get the character string the user typed for "File:"\ XtGetValues $textField1 value:DTS_FILE_NAME\ \ # Check for valid file name, if valid, load the "File Contents:" Scrolled Text area,\ # otherwise report error.\ if [[ -f $DTS_FILE_NAME ]]\ then \ XtSetValues $scrolledText1 value:" `cat $DTS_FILE_NAME` "\ else \ DtDisplayErrorDialog "File Browser: Error" "$DTS_FILE_NAME is not a valid file name."\ fi \ *label2.class: label *label2.static: true *label2.name: label2 *label2.parent: dialogWindow1 *label2.isCompound: "true" *label2.compoundIcon: "label.xpm" *label2.compoundName: "label_" *label2.canBeTopLevel: "false" *label2.canHaveChildren: "false" *label2.width: 100 *label2.height: 26 *label2.x: 20 *label2.y: 24 *label2.alignment: "alignment_beginning" *label2.labelString: "Directory:" *textField2.class: textField *textField2.static: true *textField2.name: textField2 *textField2.parent: dialogWindow1 *textField2.isCompound: "true" *textField2.compoundIcon: "textfield.xpm" *textField2.compoundName: "text_Field" *textField2.canBeTopLevel: "false" *textField2.canHaveChildren: "false" *textField2.width: 420 *textField2.height: 34 *textField2.x: 130 *textField2.y: 20 *textField2.activateCallback: # Check for valid directory in "Directory:" Text Field\ XtGetValues $textField2 value:DTS_DIR\ if [[ -d /$DTS_DIR ]]\ then\ \ # Change directories \ cd $DTS_DIR\ \ # Remove all items from the "Directory:" Text Field\ XmListDeleteAllItems $scrolledList2\ \ # Update the "Directory:" Scrolled List\ for i in ` ls -alc | grep "^d" | cut -c55-90`\ do\ XmListAddItem $scrolledList2 0 $i\ done\ \ # Clear out "File:" Text Field \ XtSetValues $textField1 value:""\ \ # Remove all items from the "File:" Scrolled List\ XmListDeleteAllItems $scrolledList1\ \ # Update the "File:" Scrolled List\ for i in ` ls -alc | grep -v "^d" | cut -c55-90`\ do\ XmListAddItem $scrolledList1 0 $i\ done \ \ # Clear out "File Contents:" Scrolled Text \ XtSetValues $scrolledText1 value:""\ \ else\ # Report error.\ DtDisplayErrorDialog "File Browser: Error" "$DTS_DIR is not a valid directory name."\ fi\ *textField2.createCallback: # Initialize "Directory:" Text Field\ XtSetValues $textField2 cursorPosition:30\ XtSetValues $textField2 value:`/bin/pwd` *scrolledListWindow1.class: scrolledWindow *scrolledListWindow1.static: true *scrolledListWindow1.name: scrolledListWindow1 *scrolledListWindow1.parent: dialogWindow1 *scrolledListWindow1.scrollingPolicy: "application_defined" *scrolledListWindow1.visualPolicy: "variable" *scrolledListWindow1.scrollBarDisplayPolicy: "static" *scrolledListWindow1.shadowThickness: 0 *scrolledListWindow1.isCompound: "true" *scrolledListWindow1.compoundIcon: "scrllist.xpm" *scrolledListWindow1.compoundName: "scrolled_List" *scrolledListWindow1.isRegion: "true" *scrolledListWindow1.canBeTopLevel: "false" *scrolledListWindow1.canHaveChildren: "false" *scrolledListWindow1.compoundResourceSet: "Background:scrolledListWindow1.background;CreateCallback:scrolledList1.createCallback;FontList:scrolledList1.fontList;Foreground:scrolledListWindow1.foreground,scrolledList1.foreground;ItemCount:scrolledList1.itemCount;Items:scrolledList1.items;ListBackground:scrolledList1.background;SingleSelectionCallback:scrolledList1.singleSelectionCallback" *scrolledListWindow1.background.lock: true *scrolledListWindow1.foreground.lock: true *scrolledListWindow1.createCallback.lock: true *scrolledListWindow1.width: 500 *scrolledListWindow1.height: 170 *scrolledListWindow1.x: 50 *scrolledListWindow1.y: 280 *scrolledList1.class: scrolledList *scrolledList1.static: true *scrolledList1.name: scrolledList1 *scrolledList1.parent: scrolledListWindow1 *scrolledList1.listSizePolicy: "constant" *scrolledList1.scrollBarDisplayPolicy: "static" *scrolledList1.selectionPolicy: "single_select" *scrolledList1.isCompound: "false" *scrolledList1.isInCompound: "true" *scrolledList1.isRegion: "false" *scrolledList1.isSelectable: "false" *scrolledList1.usePropEditor: "false" *scrolledList1.canHaveChildren: "false" *scrolledList1.singleSelectionCallback: # Fill in the "File:" Text Field\ XtSetValues $textField1 value:${CB_CALL_DATA.ITEM}\ XtSetValues $textField1 cursorPosition:50\ \ # Load the "Field Contents:" Scrolled Text widget\ XtSetValues $scrolledText1 value:"`cat ${CB_CALL_DATA.ITEM}`"\ *separator1.class: separator *separator1.static: true *separator1.name: separator1 *separator1.parent: dialogWindow1 *separator1.isCompound: "true" *separator1.compoundIcon: "sep.xpm" *separator1.compoundName: "separator_" *separator1.canBeTopLevel: "false" *separator1.canHaveChildren: "false" *separator1.width: 610 *separator1.height: 20 *separator1.x: 0 *separator1.y: 760 *separator2.class: separator *separator2.static: true *separator2.name: separator2 *separator2.parent: dialogWindow1 *separator2.isCompound: "true" *separator2.compoundIcon: "sep.xpm" *separator2.compoundName: "separator_" *separator2.canBeTopLevel: "false" *separator2.canHaveChildren: "false" *separator2.width: 610 *separator2.height: 20 *separator2.x: 0 *separator2.y: 460 *separator3.class: separator *separator3.static: true *separator3.name: separator3 *separator3.parent: dialogWindow1 *separator3.isCompound: "true" *separator3.compoundIcon: "sep.xpm" *separator3.compoundName: "separator_" *separator3.canBeTopLevel: "false" *separator3.canHaveChildren: "false" *separator3.width: 610 *separator3.height: 20 *separator3.x: 0 *separator3.y: 200 *scrolledListWindow2.class: scrolledWindow *scrolledListWindow2.static: true *scrolledListWindow2.name: scrolledListWindow2 *scrolledListWindow2.parent: dialogWindow1 *scrolledListWindow2.scrollingPolicy: "application_defined" *scrolledListWindow2.visualPolicy: "variable" *scrolledListWindow2.scrollBarDisplayPolicy: "static" *scrolledListWindow2.shadowThickness: 0 *scrolledListWindow2.isCompound: "true" *scrolledListWindow2.compoundIcon: "scrllist.xpm" *scrolledListWindow2.compoundName: "scrolled_List" *scrolledListWindow2.isRegion: "true" *scrolledListWindow2.canBeTopLevel: "false" *scrolledListWindow2.canHaveChildren: "false" *scrolledListWindow2.compoundResourceSet: "Background:scrolledListWindow2.background;CreateCallback:scrolledList2.createCallback;FontList:scrolledList2.fontList;Foreground:scrolledListWindow2.foreground,scrolledList2.foreground;ItemCount:scrolledList2.itemCount;Items:scrolledList2.items;ListBackground:scrolledList2.background;SingleSelectionCallback:scrolledList2.singleSelectionCallback" *scrolledListWindow2.background.lock: true *scrolledListWindow2.foreground.lock: true *scrolledListWindow2.createCallback.lock: true *scrolledListWindow2.width: 500 *scrolledListWindow2.height: 120 *scrolledListWindow2.x: 50 *scrolledListWindow2.y: 70 *scrolledList2.class: scrolledList *scrolledList2.static: true *scrolledList2.name: scrolledList2 *scrolledList2.parent: scrolledListWindow2 *scrolledList2.listSizePolicy: "constant" *scrolledList2.scrollBarDisplayPolicy: "static" *scrolledList2.selectionPolicy: "single_select" *scrolledList2.isCompound: "false" *scrolledList2.isInCompound: "true" *scrolledList2.isRegion: "false" *scrolledList2.isSelectable: "false" *scrolledList2.usePropEditor: "false" *scrolledList2.canHaveChildren: "false" *scrolledList2.createCallback: # Add all directories in current directory to list\ for i in ` ls -alc | grep "^d" | cut -c55-90`\ do \ XmListAddItem $scrolledList2 0 $i\ done \ *scrolledList2.singleSelectionCallback: # Change directories and update "Directory:" Text Field\ cd ${CB_CALL_DATA.ITEM}\ XtSetValues $textField2 value:`/bin/pwd`\ \ # Remove all items from the "Directory:" Scrolled List\ XmListDeleteAllItems $scrolledList2\ \ # Update the directory list\ for i in ` ls -alc | grep "^d" | cut -c55-90`\ do\ XmListAddItem $scrolledList2 0 $i\ done\ \ # Clear out the "File:" Text Field\ XtSetValues $textField1 value:""\ \ # Remove all items from the "File:" Scrolled List\ XmListDeleteAllItems $scrolledList1\ \ # Update the "File:" Scrolled List\ for i in ` ls -alc | grep -v "^d" | grep -v "^l" | cut -c55-90`\ do \ XmListAddItem $scrolledList1 0 $i\ done\ \ # Clear out scrolled Text data\ XtSetValues $scrolledText1 value:""\ *label3.class: label *label3.static: true *label3.name: label3 *label3.parent: dialogWindow1 *label3.isCompound: "true" *label3.compoundIcon: "label.xpm" *label3.compoundName: "label_" *label3.canBeTopLevel: "false" *label3.canHaveChildren: "false" *label3.width: 146 *label3.height: 26 *label3.x: 20 *label3.y: 480 *label3.labelString: "File Contents:" *scrolledTextWindow1.class: scrolledWindow *scrolledTextWindow1.static: true *scrolledTextWindow1.name: scrolledTextWindow1 *scrolledTextWindow1.parent: dialogWindow1 *scrolledTextWindow1.scrollingPolicy: "application_defined" *scrolledTextWindow1.visualPolicy: "variable" *scrolledTextWindow1.scrollBarDisplayPolicy: "static" *scrolledTextWindow1.isCompound: "true" *scrolledTextWindow1.compoundIcon: "scrltext.xpm" *scrolledTextWindow1.compoundName: "scrolled_Text" *scrolledTextWindow1.isRegion: "true" *scrolledTextWindow1.canBeTopLevel: "false" *scrolledTextWindow1.canHaveChildren: "false" *scrolledTextWindow1.compoundResourceSet: "ActivateCallback:scrolledText1.activateCallback;Background:scrolledTextWindow1.background;CreateCallback:scrolledText1.createCallback;EditMode:scrolledText1.editMode;FontList:scrolledText1.fontList;Foreground:scrolledTextWindow1.foreground,scrolledText1.foreground;Text:scrolledText1.text;TextBackground:scrolledText1.background;ValueChangedCallback:scrolledText1.valueChangedCallback" *scrolledTextWindow1.background.lock: true *scrolledTextWindow1.foreground.lock: true *scrolledTextWindow1.createCallback.lock: true *scrolledTextWindow1.width: 500 *scrolledTextWindow1.height: 200 *scrolledTextWindow1.x: 50 *scrolledTextWindow1.y: 510 *scrolledText1.class: scrolledText *scrolledText1.static: true *scrolledText1.name: scrolledText1 *scrolledText1.parent: scrolledTextWindow1 *scrolledText1.isCompound: "false" *scrolledText1.isInCompound: "true" *scrolledText1.isRegion: "false" *scrolledText1.isSelectable: "false" *scrolledText1.usePropEditor: "false" *scrolledText1.canHaveChildren: "false" *scrolledText1.editMode: "multi_line_edit" *scrolledText1.resizeHeight: "true" *scrolledText1.resizeWidth: "true" *scrolledText1.createCallback: # Prevent the user from editting the text\ XtSetValues $scrolledText1 editable:False *pushButton1.class: pushButton *pushButton1.static: true *pushButton1.name: pushButton1 *pushButton1.parent: dialogWindow1 *pushButton1.isCompound: "true" *pushButton1.compoundIcon: "push.xpm" *pushButton1.compoundName: "push_Button" *pushButton1.canBeTopLevel: "false" *pushButton1.canHaveChildren: "false" *pushButton1.unitType: "pixels" *pushButton1.defaultButtonShadowThickness.lock: true *pushButton1.width: 110 *pushButton1.height: 28 *pushButton1.x: 240 *pushButton1.y: 730 *pushButton1.background: "#5050a0" *pushButton1.foreground: "white" *pushButton1.labelString: " Clear " *pushButton1.activateCallback: # Clear out the "File Contents:" Scrolled Text area\ XtSetValues $scrolledText1 value:""\ *pushButton2.class: pushButton *pushButton2.static: true *pushButton2.name: pushButton2 *pushButton2.parent: dialogWindow1 *pushButton2.isCompound: "true" *pushButton2.compoundIcon: "push.xpm" *pushButton2.compoundName: "push_Button" *pushButton2.canBeTopLevel: "false" *pushButton2.canHaveChildren: "false" *pushButton2.unitType: "pixels" *pushButton2.defaultButtonShadowThickness.lock: true *pushButton2.width: 111 *pushButton2.height: 28 *pushButton2.x: 240 *pushButton2.y: 780 *pushButton2.background: "#a05050" *pushButton2.foreground: "white" *pushButton2.labelString: " Exit " *pushButton2.activateCallback: # Exit the shell\ exit