DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦7aed6561c⟧ TextFile

    Length: 12685 (0x318d)
    Types: TextFile
    Notes: UNIX file
    Names: »mre_c.uil«

Derivation

└─⟦a85bd4a7c⟧ Bits:30004636/disk2.imd INTERACTIVE Motif Environment Development System
└─⟦a85bd4a7c⟧ UNIX Filesystem
    └─⟦this⟧ »xt/new/usr/lib/X11/examples/mre/mre_c.uil« 

TextFile

!OSF/Motif: @(#)mre_c.uil	1.1 - 89/08/30 - 12:00:26
!++
! Motif Demo Resource Editor -- color selection uil file
!				included by mre.uil
!
! Created June 89 Mitch Trachtenberg
!
!	The color form widget takes advantage of Motif's 
!	resolution independence mechanism; values provided
!	for the form and its children are specified in
!	Xm100TH_FONT_UNITS, causing the form to appear at
!	the proper size for the font with which MRE is run.
!--

value color_h_offset: 200;
value color_v_offset: 150;
value scales_left_offset: 700;

procedure destroy_colorform();

object
    color_form : XmFormDialog {
	arguments {
	    XmNdialogTitle = 'Color Selection';
	    XmNdialogStyle = XmDIALOG_MODELESS;
	    XmNunitType = Xm100TH_FONT_UNITS;
	    XmNx = stagger_x;
	    XmNy = stagger_y;
	    XmNwidth = 5000;
	    XmNheight = 7000;
	    XmNautoUnmanage = false;
	    XmNresizable = true;
	    XmNrubberPositioning = true;
	    XmNresizePolicy = XmRESIZE_ANY;
	    XmNdefaultPosition = false;
	    XmNtranslations = translation_table(
				'<Btn3Down>:popup_popup_menu()');

	};
	controls {
	    XmLabel	label_icon;
	    XmPushButton	color_patch;
	    XmLabel	color_resource_label;
	    XmLabel	color_patch_label;
	    XmForm	slider_box;
	    XmLabel	color_db_label;
	    XmScrolledWindow color_db_window;	
!	    push_button color_add;
	    XmText	color_text;
	    XmSeparator   color_sep;
	    XmPushButton color_ok;
	    XmPushButton color_cancel;
	    XmPushButton color_help;
	    XmPushButton color_setbg;
	};
	callbacks {
	    XmNdestroyCallback = procedure destroy_colorform();
	};
};

object label_icon: XmLabel {
	arguments {
		XmNleftAttachment = XmATTACH_FORM;
		XmNtopAttachment = XmATTACH_FORM;
		XmNtopOffset = color_h_offset*2;
		XmNleftOffset = color_h_offset;
		XmNlabelPixmap = palette;
		XmNlabelType = XmPIXMAP;
		XmNalignment = XmALIGNMENT_BEGINNING;
	};
};

! the bottom of the color patch button is attached to a position
! 30% into the form; the top is attached to a fixed offset from
! the top of the form.
object color_patch: XmPushButton {
	arguments {
		XmNtranslations = translation_table(
				'<Btn3Down>:popup_popup_menu()');
		XmNleftAttachment = XmATTACH_WIDGET;
		XmNleftWidget = XmLabel label_icon;
		XmNrightAttachment = XmATTACH_FORM;
		XmNleftOffset = color_h_offset;
		XmNrightOffset = color_h_offset;
		XmNtopAttachment = XmATTACH_FORM;
		XmNtopOffset = color_h_offset*2;
		XmNbottomAttachment = XmATTACH_POSITION;
		XmNbottomPosition = 30;
		XmNbottomOffset = color_h_offset;
		XmNlabelString = compound_string('Press MB3 for popup menu.');
	};
};

! this label will indicate the resource being modified;
! its label string is set by the program
object color_resource_label: XmLabel {
	arguments{
		XmNleftAttachment = XmATTACH_WIDGET;
		XmNleftWidget = XmLabel label_icon;
		XmNrightAttachment = XmATTACH_FORM;
		XmNleftOffset = color_h_offset;
		XmNrightOffset = color_h_offset;
		XmNtopAttachment = XmATTACH_FORM;
		XmNtopOffset = color_h_offset/2;
	};
};

! this label will indicate the current color of the color_patch;
! its label string is set by the program
object color_patch_label: XmLabel {
	arguments{
		XmNleftAttachment = XmATTACH_WIDGET;
		XmNleftWidget = XmLabel label_icon;
		XmNrightAttachment = XmATTACH_FORM;
		XmNleftOffset = color_h_offset;
		XmNrightOffset = color_h_offset;
		XmNtopAttachment = XmATTACH_WIDGET;
		XmNtopWidget = XmPushButton color_patch;
		XmNlabelString = " ";
	};
};

! the top of the slider group is attached to the bottom of the color patch;
! this is equivalent to attaching it to the form's 30% position
object slider_box : XmForm {
	arguments {
	    XmNleftAttachment = XmATTACH_FORM;
	    XmNrightAttachment = XmATTACH_FORM;
	    XmNtopAttachment = XmATTACH_WIDGET;
	    XmNtopWidget = XmLabel color_patch_label;
	    XmNtopOffset = color_v_offset;
	    XmNbottomAttachment = XmATTACH_WIDGET;
	    XmNbottomWidget = XmLabel color_db_label;
	    XmNbottomOffset = color_v_offset;
	};
	controls {
	    XmScale       scale1;
	    XmScale       scale2;
	    XmScale       scale3;
	    XmForm      labelbox;   
	};
};

object color_db_label : XmLabel {
	arguments {
		XmNbottomAttachment = XmATTACH_WIDGET;
		XmNbottomWidget = XmScrolledWindow color_db_window;
		XmNleftAttachment = XmATTACH_FORM;
		XmNrightAttachment = XmATTACH_FORM;
		XmNleftOffset = color_h_offset;
		XmNrightOffset = color_h_offset;
		XmNalignment = XmALIGNMENT_BEGINNING;
		XmNlabelString = compound_string('Predefined colors:');
	};
};

object color_db_window: XmScrolledWindow {
	arguments {
	    XmNbottomAttachment = XmATTACH_WIDGET;
	    XmNbottomWidget = XmText color_text;
	    XmNtopAttachment = XmATTACH_NONE;
	    XmNleftAttachment = XmATTACH_FORM;
	    XmNrightAttachment = XmATTACH_FORM;
	    XmNleftOffset = color_h_offset;
	    XmNrightOffset = color_h_offset;
	    XmNbottomOffset = color_h_offset;
	};
	controls {
		XmList color_db;
	};
};

object color_text : XmText {
	arguments {
	    XmNleftAttachment = XmATTACH_FORM;
	    XmNrightAttachment = XmATTACH_FORM;
	    XmNbottomAttachment = XmATTACH_WIDGET;
	    XmNbottomWidget = XmSeparator color_sep;
	    XmNleftOffset = color_h_offset;
	    XmNrightOffset = color_h_offset;
	    XmNbottomOffset = color_v_offset/2;
!	    right_widget = push_button color_add;
	};
};

! a separator widget is used to provide visual separation between
! the body of the color form and the control buttons beneath
object color_sep: XmSeparator {
	arguments {
		XmNleftAttachment = XmATTACH_FORM;
		XmNrightAttachment = XmATTACH_FORM;
		XmNbottomAttachment = XmATTACH_WIDGET;
		XmNbottomOffset = color_v_offset/2;
		XmNbottomWidget = XmPushButton color_ok;
	};
};

object color_ok: XmPushButton{
	arguments {
		XmNbottomAttachment = XmATTACH_FORM;
		XmNbottomOffset = color_v_offset;
		XmNx = color_h_offset;
		XmNlabelString = compound_string('OK');
! note that, due to our use of Xm100TH_FONT_UNITS, 
! showAsDefault must be set larger than would otherwise be necessary
		XmNshowAsDefault = 20;
	};
	callbacks {
		XmNactivateCallback = procedure ok_button_pressed('C');
	};
};

object color_cancel: XmPushButton{
	arguments {
		XmNbottomAttachment = XmATTACH_OPPOSITE_WIDGET;
		XmNleftAttachment = XmATTACH_WIDGET;
		XmNleftWidget = XmPushButton color_ok;
		XmNbottomWidget = XmPushButton color_ok;
		XmNleftOffset = color_h_offset;
! center with the OK button, which is larger
		XmNbottomOffset = 75;
		XmNlabelString = compound_string('Cancel');
	};
	callbacks {
		XmNactivateCallback = procedure cancel_button_pressed('C');
	};
};

object color_help: XmPushButton{
	arguments {
		XmNbottomAttachment = XmATTACH_OPPOSITE_WIDGET;
		XmNleftAttachment = XmATTACH_WIDGET;
		XmNleftWidget = XmPushButton color_cancel;
		XmNbottomWidget = XmPushButton color_cancel;
		XmNleftOffset = color_h_offset;
	    	XmNlabelString = compound_string('Help');
	};
	callbacks {
		XmNactivateCallback = procedure help_proc('Color');
	};
};

object color_setbg: XmPushButton{
	arguments {
		XmNbottomAttachment = XmATTACH_OPPOSITE_WIDGET;
		XmNleftAttachment = XmATTACH_WIDGET;
		XmNbottomWidget = XmPushButton color_help;
		XmNleftWidget = XmPushButton color_help;
		XmNleftOffset = color_h_offset;
	    	XmNlabelString = compound_string('Set Root Background');
	};
	callbacks {
		XmNactivateCallback = procedure setbg_button_pressed();
	};
};

object color_db: XmList {
	arguments {
		XmNitems = string_table("red");
		XmNitemCount = 1;
		XmNvisibleItemCount = 5;
	};
	callbacks {
		XmNcreateCallback = procedure load_rgb_text();
	};
};


! arguments common to all 3 color scales (horizontal)
list scale_args : arguments {
	    XmNshowValue = true;
	    XmNtopAttachment = XmATTACH_POSITION;
	    XmNbottomAttachment = XmATTACH_POSITION;
	    XmNleftAttachment = XmATTACH_FORM;
	    XmNrightAttachment = XmATTACH_FORM;
	    XmNorientation = XmHORIZONTAL;
	    XmNprocessingDirection = XmMAX_ON_RIGHT;
	    XmNleftOffset = scales_left_offset;
	    XmNrightOffset = color_h_offset;
};

! arguments common to all 3 color scales (vertical)
list vscale_args : arguments {
	    XmNtopAttachment = XmATTACH_FORM;
	    XmNbottomAttachment = XmATTACH_FORM;
	    XmNleftOffset = color_h_offset;
	    XmNleftAttachment = XmATTACH_POSITION;
	    XmNrightAttachment = XmATTACH_POSITION;
	    XmNorientation = XmVERTICAL;
	    XmNprocessingDirection = XmMAX_ON_RIGHT;
};

object
    scale1 : XmScale {
	arguments { 
	    XmNbackground = color('red');
	    XmNtopPosition = 0;
	    XmNbottomPosition = 30;
	    arguments scale_args;
!	arguments below are for vertical scale orientation
!	    left_position = 0;
!	    right_position = 33;
!	    arguments vscale_args;
	};
	callbacks {
		XmNvalueChangedCallback = procedure scale_value_changed('r');
		XmNdragCallback = procedure scale_value_changed('r');
	};
    };

object
    scale2 : XmScale {
	arguments { 
	    XmNbackground = color('green');
	    XmNtopPosition = 35;
	    XmNbottomPosition = 65;
	    arguments scale_args;
!	arguments below are for vertical scale orientation
!	    left_position = 36;
!	    right_position = 70;
!	    arguments vscale_args;
	};
	callbacks {
		XmNvalueChangedCallback = procedure scale_value_changed('g');
		XmNdragCallback = procedure scale_value_changed('g');
	};
    };

object
    scale3 : XmScale {
	arguments { 
	    XmNbackground = color('blue');
	    XmNtopPosition = 70;
	    XmNbottomPosition = 100;
	    arguments scale_args;
!	arguments below are for vertical scale orientation
!	    left_position = 73;
!	    right_position = 100;
!	    arguments vscale_args;
	};
	callbacks {
		XmNvalueChangedCallback = procedure scale_value_changed('b');
		XmNdragCallback = procedure scale_value_changed('b');
	};
    };

! the labelbox resizes with its parent form, so that its children,
! which are anchored to positions in the labelbox, track their scales
! after resize.
object labelbox: XmForm {
	arguments { 
		XmNtopAttachment = XmATTACH_FORM;
		XmNbottomAttachment = XmATTACH_FORM;
		XmNrightAttachment = XmATTACH_WIDGET;
		XmNrightOffset = 15;
		XmNtopWidget = XmScale scale1;
		XmNrightWidget = XmScale scale1;
	};
	controls {
		XmLabel  label1;
		XmLabel  label2;
		XmLabel  label3;
	};
};

object label1: XmLabel {
	arguments {
		XmNtopAttachment = XmATTACH_NONE;
		XmNlabelString = compound_string('Red');
		XmNforeground = white;
	};
};

object label2: XmLabel {
	arguments {
		XmNtopAttachment = XmATTACH_POSITION;
		XmNtopPosition = 35;
		XmNlabelString = compound_string('Green');
		XmNforeground = white;
	};
};

object label3: XmLabel  {
	arguments {
		XmNtopAttachment = XmATTACH_POSITION;
		XmNtopPosition = 70;
		XmNlabelString = compound_string('Blue');
		XmNforeground = white;
	};
};

! this popup menu is not specified in the color form's controls list,
! but is tied to the form via a translation table in the form's arguments list
object popup_menu_widget: XmPopupMenu{
	arguments { 
		XmNwidth = 100;
		XmNheight = 100;
	};
	controls {
		XmPushButton{
			arguments {
			    	XmNlabelString = 
				compound_string('Set Root Window Background');
			};
			callbacks {
				XmNactivateCallback = procedure setbg_button_pressed();
			};
		};
		XmPushButton{
			arguments {
			    	XmNlabelString = 
				compound_string('Set Foreground');
			};
			callbacks {
				XmNactivateCallback = 
				procedure setcolor_button_pressed('F');
			};
		};
		XmPushButton{
			arguments {
			    	XmNlabelString = 
				compound_string('Set Bottom Shadow');
			};
			callbacks {
				XmNactivateCallback = 
				procedure setcolor_button_pressed('S');
			};
		};
		XmPushButton{
			arguments {
			    	XmNlabelString = 
				compound_string('Set Top Shadow');
			};
			callbacks {
				XmNactivateCallback = 
				procedure setcolor_button_pressed('T');
			};
		};
	};
};



! this is an example of how to create an option menu in uil
! it is not used in mre
!object om1_pull :  pulldown_menu {
!	arguments { 
!		width = 100;
!		height = 100;
!	};
!	controls {
!		push_button {};
!		push_button {};
!	};
!};
!object om1: option_menu
! {
!	arguments {
!		label_string = compound_string('W:');
!	};
!	controls {
!		pulldown_menu om1_pull;
!	};
!};

! the following identifiers allow the color dialog to initially appear 
! with scale values and color patch reflecting the current color of the
! resource being modified

!identifier init_red ;
!identifier init_green ;
!identifier init_blue ;
!identifier init_background ;

!object color_add : push_button {
!	arguments {
!	    right_attachment = XmATTACH_FORM;
!	    bottom_attachment = XmATTACH_WIDGET;
!	    bottom_widget = separator color_sep;
!	    bottom_offset = color_v_offset/2;
!	    right_offset = color_h_offset;
!	    label_string = compound_string('Add');
!	};
!};