| Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
| Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
| Moderator: | STAR::VATNE |
| Created: | Mon Oct 30 1989 |
| Last Modified: | Mon Dec 31 1990 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 3726 |
| Total number of notes: | 19516 |
We are in the middle of a benchmark for a customer and we have
the following problem.
I have created an application using both Xlib grahpics, color
and UIL widgets(menu,popupmenu,dialogbox,...).
The application starts by displaying a menu.
From the menu I can choose an "image" (this is in fact a simulatin
of a chemical dispatching screen).
On the image I can point to e.g. a valve and click MB1 to change
the color of it, or MB2 to display a popup menu to show
information about the valve.
In the meantime with XtAddTimeOut I have an update of some text
graphics on the screen (change color and string).
I have implemented backingstore using a pixmap (by the way, drawing
window is 1000*800 pixs).
Everything is w o r k i n g PERFECTLY so far...
but.
The customer wanted to see the application running twice at the
same time on the same machine (we tried a 2000 and a 3100 vaxstation).
And this gives a problem. I can still start the applications
but only up to the menu display.
I can start one image with events etc., but when I try to activate an image
from the second (same) application it comes with a rate of one valve
every 15 minutes drawn on the screen......
The entire station seems jammed ?
It takes hours to change from window to window.
Why?????????????? I presume there is some locking somewhere, but
I don't know what or how.
It is important that we solve this ASAP. The client had
a good impression of DW, and we may NOT loose this impression due
to some weird bug or misunderstanding somewhere.
I have shown other products running twice etc. but we need to see
the benchmark application twice too.
I include hereafter both source code in c and uil.(replies .1 and .2)
Any help is more then welcome.
For the benchmark group
Dominique Dierick
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 156.1 | Process Control bench source | KETJE::DIERICK | BLACK HOLES ARE OUTASIGHT | Wed Feb 08 1989 12:09 | 2 |
| 156.2 | bench sources ....oops | KETJE::DIERICK | BLACK HOLES ARE OUTASIGHT | Wed Feb 08 1989 12:13 | 871 |
/*
*
* Trasys Benchmark using XUI and XLib
*
*
* D. Dierick februari 1989
*/
#include <stdio.h> /* For printf and so on. */
#include <string.h>
#include <decw$include/DECwDwtApplProg.h> /* DECwindows Toolkit */
/*
* These numbers are matched with corresponding numbers in the
* UIL module.
*/
#define k_menu_bar 1
#define k_file_pdme 2
#define k_file_menu 3
#define k_image_pdme 4
#define k_image_menu 5
#define k_utilities_menu 7
#define k_utilities_pdme 6
#define k_nyi 99
#define k_image_1_drawing 1
#define k_image_2_drawing 2
#define k_image_3_drawing 3
/* widgets id from DRM hierarchy */
#define k_mail_button 4
#define k_card_button 5
#define k_show_1_button 12
#define k_show_2_button 13
#define k_popup_menu 11
#define k_adb 14
#define k_pdb 15
#define k_id 16
#define k_description 17
#define k_status 18
#define k_x 19
#define k_y 20
#define k_dismiss 21
#define Success 1
#define RED 0
#define BLUE 1
#define GREEN 2
#define FIREBRICK 3
#define BLACK 4
#define BORDER 3
/*
* My type_definitions.
*/
typedef unsigned long Color ;
typedef struct
{ int valve_id;
int xo;
int yo;
int vxo;
int vyo;
int w;
int h;
char *description;
int status;
} valve;
typedef struct
{ int text_id;
int xo;
int yo;
int w;
int h;
int status;
char *text;
} simple_text;
/*
* Global data
*/
static int interval; /* event time interval */
static int is_image; /* switch indicating image drawn */
static int selected_valve; /* current valve from popup menu */
static valve valves[100];
static simple_text labels[100];
static Display *display_id; /* The display_id where the application */
/* is running on. */
static Widget toplevel_widget, /* Root widget ID of our application. */
mmi_main_window, /* Root widget ID of main DRM fetch */
popup_menu_widget,
pdb_widget, /* popup box with valve info */
id_widget,
description_widget,
status_widget,
x_widget,
y_widget,
dismiss_widget,
adb_widget, /* attached box containing draw wind*/
show_1_widget,
show_2_widget,
draw_widget;
static Window draw_window; /* Window ID of the Draw_window */
static Pixmap pixmap_id;
Screen *screen_id ;
static GC gc_id,
gc_clear;
static DRMHierarchy s_DRMHierarchy; /* DRM database hierarchy ID */
static DRMType *dummy_class; /* and class variable. */
static DRMType *dummy_class2; /* and class variable. */
static char *mmi_filename_vec[] = /* DRM heirachy file list. */
{ "2nd.uid" }; /* There is only one UID file */
static int mmi_filename_num =
(sizeof mmi_filename_vec / sizeof mmi_filename_vec [0]);
static int window_width, /* Width & Height of the draw_window */
window_height;
XColor exact_color,screen_color;
XColor *colors[] = { "red","blue","green","firebrick","black"};
XColor color[4];
int screen;
/*
* Function declarations
*/
XtTimerCallbackProc timer_proc();
static int give_random();
static char *itoa();
static void set_something();
static void s_error();
static void create_pdb();
static void create_proc();
static void quit_proc();
static void activate_proc();
static void create_display();
static void clear_pixmap();
static void copy_pixmap_to_display();
static void draw_image_1();
static void draw_text();
static void init_image_1();
static void menu_flip_color();
static void flip_color();
static void expose_display();
static void popup_menu();
static void display_dialog();
static void dismiss_box();
/* Make pointers for the callbacks comming from DECToolkit (DRM). */
/* The names and addresses of things that DRM has to bind.
* The names do not have to be in alphabetical order. */
static DRMRegisterArg reglist[] = {
{"create_proc", (caddr_t) create_proc},
{"dismiss_box", (caddr_t) dismiss_box},
{"activate_proc", (caddr_t) activate_proc},
{"menu_flip_color", (caddr_t) menu_flip_color},
{"flip_color", (caddr_t) flip_color},
{"quit_proc", (caddr_t) quit_proc},
{"create_display", (caddr_t) create_display},
{"expose_display", (caddr_t) expose_display},
{"popup_menu", (caddr_t) popup_menu},
{"display_dialog", (caddr_t) display_dialog}
};
/* this will contain the action records for the translation of mouse
button events in the graphics window */
static XtActionsRec trasys_action_table [] =
{
{"flip_color", (caddr_t)flip_color },
{"popup_menu", (caddr_t)popup_menu }
};
static DRMResourceContextPtr context_id;
/* register list for DRM */
static int reglist_num = (sizeof reglist / sizeof reglist [0]);
/*
* The main routine does all the one-time setup and
* then calls XtMainLoop.
*/
unsigned int main(argc, argv)
unsigned int argc; /* Command line argument count. */
char *argv[]; /* Pointers to command line args. */
{
/* first initialize image 1 data */
init_image_1();
DwtInitializeDRM(); /* Initialize DRM before initializing
/* the X Toolkit. */
/* Initialize the X Toolkit. We get back a top level shell widget. */
toplevel_widget = XtInitialize(
"TRASYS BENCHMARK (don't worry, be happy)", /* Main window name. */
"mmi", /* Root class name.
This name is also be used
for the <application>.dat file !!!
so it is in fact <class_name>.dat !*/
NULL, /* No option list. */
0, /* Number of options. */
&argc, /* Address of argc */
argv); /* argv */
/* Open the UID files in the hierarchy*/
if (DwtOpenHierarchy(mmi_filename_num, /* Number of files. */
mmi_filename_vec, /* Array of file names. */
NULL, /* Default OS extenstion. */
&s_DRMHierarchy) /* Pointer to returned DRM ID */
!= DRMSuccess )
/*then*/ s_error("Can't open UID !!!");
if (DwtDrmGetResourceContext (0,0,4 ,&context_id) != DRMSuccess)
s_error("Can't get resource context \n");
if (DwtDrmHGetIndexedLiteral (s_DRMHierarchy,"interval",context_id)
!= DRMSuccess) s_error("Can't get indexed literal\n");
interval = *(context_id->data_buffer);
interval = 999; /* override uil value for test reason */
/* Register the items DRM needs to bind for us. */
DwtRegisterDRMNames(reglist, reglist_num);
/* Go get the application. (from the UID-file (DRManager)) */
if (DwtFetchWidget(s_DRMHierarchy, "S_MAIN_WINDOW", toplevel_widget,
&mmi_main_window, &dummy_class) != DRMSuccess)
s_error("Can't fetch main window !!!\n");
/* because we use translations to get non_standard_toolkit events
(button_events in draw_window) we have to add the actions here */
/* make our action table known to the toolkit */
XtAddActions (trasys_action_table, 2);
/* Manage and realize everything.
* The interface comes up on the display now. */
XtManageChild(mmi_main_window);
XtRealizeWidget(toplevel_widget);
/* initialize graphical context, create pixmaps */
init_application();
/* fetch some popup widgets */
create_pdb();
if (DwtFetchWidget(s_DRMHierarchy, "mpopup",adb_widget,
&popup_menu_widget,&dummy_class) != DRMSuccess)
s_error("Can't get valve popup menu !!!\n");
XtManageChild(show_1_widget);
XtManageChild(show_2_widget);
/* start the timer clock */
XtAddTimeOut (interval, timer_proc,0);
/* Sit around forever waiting to process X-events. We never leave
* XtMainLoop. From here on, we only execute our callback routines. */
XtMainLoop();
/* Normally you can NEVER get here !!! */
s_error("You passed the XtMainLoop call ???");
}
/*
* All errors are fatal.
*/
static void s_error(problem_string)
char *problem_string;
{
exit(0);
}
/*
* The user pushed the quit button, so the application exits.
*/
static void quit_proc(w, tag, reason)
Widget w;
int *tag;
unsigned long *reason;
{ if (tag != NULL)
exit(1);
}
static void create_proc(w, tag, reason)
Widget w;
int *tag;
unsigned long *reason;
{ int our_id = *tag;
switch (our_id)
/* just to get the widget number of the popup menu to manage it */
{
case k_show_1_button:
show_1_widget = w;
break;
case k_show_2_button:
show_2_widget = w;
break;
case k_adb:
adb_widget = w;
break;
case k_pdb:
pdb_widget = w;
break;
case k_id:
id_widget = w;
break;
case k_description:
description_widget = w;
break;
case k_status:
status_widget = w;
break;
case k_x:
x_widget = w;
break;
case k_y:
y_widget = w;
break;
case k_dismiss:
dismiss_widget = w;
break;
default :
break;
}
}
static void activate_proc(w, tag, reason)
Widget w;
int *tag;
unsigned long *reason;
{ int our_id = *tag;
switch (our_id)
{
case k_image_1_drawing:
draw_image_1();
break;
case k_image_2_drawing:
draw_image_1();
break;
default :
break;
}
}
static int init_application()
{ unsigned int screen_depth ;
XtGCMask gc_mask;
XGCValues gc_values;
Color black,
white ;
Window dummy_root;
int dummy_x,dummy_y;
unsigned int border_width;
/* the widget_id is found during the create_display_callback,
which is executed during the fetch */
/* convert the draw_window_widget_id into a draw_window_window_id */
draw_window = XtWindow(draw_widget) ;
/* find now the display_id, we need this when we are going to draw. */
/* display_id is the static variable where we are going to put it in */
display_id = XtDisplay(toplevel_widget);
XGetGeometry(display_id, draw_window,
&dummy_root,
&dummy_x, &dummy_y,
&window_width, &window_height,
&border_width,
&screen_depth) ;
pixmap_id = XCreatePixmap(display_id,
XDefaultRootWindow(display_id),
window_width,window_height,
screen_depth);
/* now init (clear) the pixmap */
/* Set the values in the GCValues structure and set masks for the GC
Then Create the "GC_clear" and get the GC identifier return value */
screen_id = XDefaultScreenOfDisplay (display_id) ;
black = XBlackPixel(display_id,*screen_id);
white = XWhitePixel(display_id,*screen_id);
gc_mask = GCFunction | GCForeground | GCBackground | GCPlaneMask;
gc_values.plane_mask = AllPlanes;
gc_values.function = GXcopy;
gc_values.foreground = white;
gc_values.background = black;
/* create a GC_clear to clear the pixmap */
gc_clear = XCreateGC(display_id, pixmap_id, gc_mask, &gc_values);
/* now clear the pixmap */
clear_pixmap();
/* create a GC for all the drawing stuff */
gc_id = XCreateGC(display_id, pixmap_id, 0, NULL);
color[RED].pixel = define_color(RED);
color[BLUE].pixel = define_color(BLUE);
color[GREEN].pixel = define_color(GREEN);
color[FIREBRICK].pixel = define_color(FIREBRICK);
color[BLACK].pixel = define_color(BLACK);
}
static void create_display(w, tag, reason)
Widget w;
int *tag;
unsigned long *reason;
{
/* draw_widget is the static_variable where we put
the draw_window_widget_i */
draw_widget = w;
}
/*
* Clear_pixmap routine.
*/
static void clear_pixmap()
{
/* now clear the pixmap by drawing a filled_rectangle */
XFillRectangle(display_id, pixmap_id, gc_clear, 0,
0, window_width, window_height);
}
static void draw_valve(id)
int id;
{ XPoint pts[4];
pts[0].x = valves[id].xo+84;
pts[0].y = valves[id].yo-5;
pts[1].x = valves[id].xo+114;
pts[1].y = valves[id].yo+5;
pts[2].x = valves[id].xo+114;
pts[2].y = valves[id].yo-5;
pts[3].x = valves[id].xo+84;
pts[3].y = valves[id].yo+5;
XSetForeground(display_id,gc_id,color[BLACK].pixel);
XDrawLine (display_id,draw_window,gc_id,valves[id].xo,valves[id].yo,
valves[id].xo+84,valves[id].yo);
XDrawLine (display_id,pixmap_id,gc_id,valves[id].xo,valves[id].yo,
valves[id].xo+84,valves[id].yo);
XDrawLine (display_id,draw_window,gc_id,valves[id].xo+114,valves[id].yo,
valves[id].xo+200,valves[id].yo);
XDrawLine (display_id,pixmap_id,gc_id,valves[id].xo+114,valves[id].yo,
valves[id].xo+200,valves[id].yo);
if (valves[id].status ==1 )
XSetForeground(display_id,gc_id,color[GREEN].pixel);
else
XSetForeground(display_id,gc_id,color[RED].pixel);
XFillPolygon(display_id,draw_window,gc_id,pts,4,Complex,
CoordModeOrigin);
XFillPolygon(display_id,pixmap_id,gc_id,pts,4,Complex,
CoordModeOrigin);
}
static void draw_image_1()
{ int count;
int i;
is_image = 1;
clear_pixmap();
XClearWindow(display_id,draw_window);
for (i = 0; i<= 99 ; i++)
draw_valve(i,0); /* only draw to pixmap*/
for ( i = 0 ; i <= 99 ; i++)
draw_text(i);
}
/*
* Copy the pixmap to the display routine.
*/
static void copy_pixmap_to_display()
{
XCopyArea(display_id, pixmap_id, draw_window, gc_id, 0, 0 ,
window_width, window_height, 0, 0 ) ;
}
/*
* Routine to draw simple graphics text in a stupid box
*/
static void draw_text(id)
int id;
{
XtGCMask gc_mask;
XGCValues gc_values;
XSetForeground(display_id,gc_id,color[BLACK].pixel);
XDrawRectangle(display_id,draw_window,gc_id,labels[id].xo,labels[id].yo,
labels[id].w,labels[id].h);
XDrawRectangle(display_id,pixmap_id,gc_id,labels[id].xo,labels[id].yo,
labels[id].w,labels[id].h);
if (labels[id].status == 1)
XSetForeground(display_id,gc_id,color[BLUE].pixel);
else
XSetForeground(display_id,gc_id,color[RED].pixel);
XDrawString(display_id,draw_window,gc_id,labels[id].xo+5,labels[id].yo+16,
labels[id].text,strlen(labels[id].text));
XDrawString(display_id,pixmap_id,gc_id,labels[id].xo+5,labels[id].yo+16,
labels[id].text,strlen(labels[id].text));
}
/*
* Routine to allocate a named color
*/
static int define_color(n)
int n;
{
if ((XDefaultVisualOfScreen(screen_id)->class == PseudoColor
|| (XDefaultVisualOfScreen(screen_id))->class == DirectColor))
if (XAllocNamedColor(display_id,DefaultColormapOfScreen(screen_id),
colors[n],&screen_color,&exact_color))
return screen_color.pixel;
else printf("Color not allocated\n");
}
static void init_image_1()
{ int count,y;
y = 10;
for (count=0;count<=49;count+= 1,y+=16)
{ valves[count].xo = 26;
valves[count].yo = y;
valves[count].status = 1;
valves[count].valve_id = count;
valves[count].vxo = 110;
valves[count].vyo = y - 5;
valves[count].description = " Distrigaz Valve Range A ";
valves[count].w = 30;
valves[count].h = 10;
}
y= 10;
for (count=50;count<=99;count+= 1,y+=16)
{ valves[count].xo = 276;
valves[count].yo = y;
valves[count].status = 1;
valves[count].valve_id = count;
valves[count].vxo = 360;
valves[count].vyo = y - 5;
valves[count].description = " Distrigaz Valve Range B ";
valves[count].w = 30;
valves[count].h = 10;
}
y = 10;
for (count=0;count <= 24; count +=1,y+=32)
{ labels[count].xo = 510;
labels[count].yo = y;
labels[count].text = " STATE IS NORMAL ";
labels[count].status = 1;
labels[count].text_id = count;
labels[count].w = 100;
labels[count].h = 20;
}
y = 10;
for (count=25;count <= 49; count +=1,y+=32)
{ labels[count].xo = 620;
labels[count].yo = y;
labels[count].text = " STATE IS NORMAL ";
labels[count].status = 1;
labels[count].text_id = count;
labels[count].w = 100;
labels[count].h = 20;
}
y = 10;
for (count=50;count <= 74; count +=1,y+=32)
{ labels[count].xo = 730;
labels[count].yo = y;
labels[count].text = " STATE IS NORMAL ";
labels[count].status = 1;
labels[count].text_id = count;
labels[count].w = 100;
labels[count].h = 20;
}
y = 10;
for (count=75;count <= 99; count +=1,y+=32)
{ labels[count].xo = 840;
labels[count].yo = y;
labels[count].text = " STATE IS NORMAL ";
labels[count].status = 1;
labels[count].text_id = count;
labels[count].w = 100;
labels[count].h = 20;
}
}
/* routine to flip color of a valve */
static void flip_color(w,event,params,num_params)
Widget w;
XButtonPressedEvent *event;
char **params;
int num_params;
{ int i;
for (i=0; i <= 99 ;i ++)
{ if (event->x <= (valves[i].vxo+valves[i].w) && event->x >=
valves[i].vxo && event->y <= (valves[i].vyo+valves[i].h
+ BORDER)
&& event->y >= (valves[i].vyo+BORDER))
{ if (valves[i].status)
valves[i].status = 0;
else valves[i].status= 1;
draw_valve(i); /* draw to pixmap and display */
return;
}
};
}
static void menu_flip_color(w,event,params,num_params)
Widget w;
XButtonPressedEvent *event;
char **params;
int num_params;
{
if (valves[selected_valve].status)
valves[selected_valve].status = 0;
else valves[selected_valve].status= 1;
draw_valve(selected_valve); /* draw to pixmap and display */
}
/* routine to handle exposure events in graphical window */
static void expose_display(w,tag,cbdata)
Widget w;
int *tag;
DwtAnyCallbackStruct *cbdata;
{
XExposeEvent *ee;
ee = (XExposeEvent *)cbdata->event;
XCopyArea(display_id,pixmap_id,draw_window,gc_id,ee->x,ee->y,
ee->width,ee->height,ee->x,ee->y);
}
/* routine to manage the popup menu and continu eventually with the
pop dialog box*/
static void popup_menu(w,event,params,num_params)
Widget w;
XButtonPressedEvent *event;
char **params;
int num_params;
{ int i;
for (i=0; i <= 99 ;i ++)
{ if (event->x <= (valves[i].vxo+valves[i].w) && event->x >=
valves[i].vxo && event->y <= (valves[i].vyo+valves[i].h
+ BORDER)
&& event->y >= (valves[i].vyo+BORDER))
{ event->y += BORDER;
DwtMenuPosition(popup_menu_widget,event);
selected_valve = i;
XtManageChild(popup_menu_widget);
}
};
return;
}
/* routine to popup a modal dialog box to show some bloody stupid
info about a valve. In fact it is a simple frame with not much
info, add info as you want */
static void display_dialog()
{
set_something(id_widget,DwtNlabel,DwtLatin1String(itoa(valves[selected_valve].valve_id)));
set_something(y_widget,DwtNlabel,DwtLatin1String(itoa(valves[selected_valve].yo)));
set_something(x_widget,DwtNlabel,DwtLatin1String(itoa(valves[selected_valve].xo)));
set_something(status_widget,DwtNlabel,DwtLatin1String(itoa(valves[selected_valve].status)));
set_something(description_widget,DwtNlabel,DwtLatin1String(valves[selected_valve].descriptio
XtManageChild(pdb_widget);
}
/* routine to dismiss the modal dialog box */
static void dismiss_box()
{
XtUnmanageChild(pdb_widget);
}
/* This routine will create the popup dialog box with valve info */
static void create_pdb()
{
if (DwtFetchWidget(s_DRMHierarchy, "dpopup",adb_widget ,
&pdb_widget, &dummy_class) != DRMSuccess)
s_error("can't fetch valve info box widget");
}
static void set_something(w, resource, value)
Widget w;
char *resource, *value;
{
Arg al[1];
XtSetArg(al[0], resource, value);
XtSetValues(w, al, 1);
}
/*
* Function ITOA
* Converts its int argument to an ASCII string,
* and returns a pointer to a string descriptor for it.
*/
static char *itoa (i)
int i;
{
static char string [12];
sprintf (string, "%d", i);
return string;
}
/* this routine will periodically update a text field on the screen */
XtTimerCallbackProc timer_proc()
{ unsigned int i;
if (is_image)
{ i = give_random(); /* take a random number form 0 - 99 */
XSetFunction(display_id,gc_id,GXxor);
if (labels[i].status == 1)
XSetForeground(display_id,gc_id,color[RED].pixel);
else
XSetForeground(display_id,gc_id,color[BLUE].pixel);
XDrawString(display_id,draw_window,gc_id,labels[i].xo+5,labels[i].yo+16,
labels[i].text,strlen(labels[i].text));
XDrawString(display_id,pixmap_id,gc_id,labels[i].xo+5,labels[i].yo+16,
labels[i].text,strlen(labels[i].text));
XSetFunction(display_id,gc_id,GXcopy);
if (labels[i].status == 1)
{ labels[i].status = 0;
labels[i].text = " STATE IS ALARM ";
}
else
{ labels[i].status = 1;
labels[i].text = " STATE IS NORMAL ";
}
draw_text(i);
}
XtAddTimeOut(interval ,timer_proc,0);
}
/* random function */
static int give_random()
{
static unsigned int i= 10;
unsigned int r;
MTH$RANDOM(&i);
r = i>>25;
if (r >= 100 ) return (r - 28);
else return (r);
}
| |||||
| 156.3 | cutting windows to half helps a bit | KETJE::DIERICK | BLACK HOLES ARE OUTASIGHT | Wed Feb 08 1989 13:24 | 12 |
Well, I tried something out again.
In the UIL file I decreased the size of the windows with half.
So I have both on one half on the screen...and everything goes
well. Both applications runin parallel on the dislplay.
Increasing again causes the jam I had before.
Space limitations with the backingstore pixmaps or what?
I don't know the answer. It seems so.
Help or hints or still very welcome.
Dominique
| |||||
| 156.4 | uil file of benchmark | KETJE::DIERICK | BLACK HOLES ARE OUTASIGHT | Wed Feb 08 1989 13:31 | 626 |
module decburger_demo
version = 'v1.0'
names = case_sensitive
objects = {
separator = gadget ;
push_button = gadget ;
toggle_button = gadget ;
}
include file 'decw$include:DwtAppl.uil';
procedure
dismiss_box();
menu_flip_color();
flip_color();
create_proc(integer);
quit_proc(string);
activate_proc(integer);
create_display();
expose_display();
display_dialog();
value
interval : exported 1000;
value
mmi_h : 864; ! decreasing to 400 helps
mmi_w : 1024;
main_menu_h : 20;
main_menu_w :mmi_w;
draw_win_bw : 3;
draw_win_x : 0;
draw_win_y : 0;
draw_win_h : 820; ! decreasing to 380 helps
draw_win_w : mmi_w - ( 2* draw_win_bw);
mpopup_w : 100;
mpopup_h : 80;
dpopup_w : 250;
dpopup_h : 150;
dpopup_x : 600;
dpopup_y : 300;
value
k_application_title
: compound_string("MMI");
k_dialog_box_title : compound_string
(" Valve Info Panel ");
k_dismiss_label_text : compound_string ("Kill");
k_id_label_text : compound_string ("Valve nr");
k_xo_label_text : compound_string ("X");
k_yo_label_text : compound_string ("Y");
k_status_label_text : compound_string ("Status");
k_description_label_text : compound_string ("Description");
k_popup_label_text : compound_string ("Valve");
k_ss_label_text :compound_string("Start/Stop");
k_show_label_text : compound_string("Valve info");
k_nyi_label_text
: compound_string("Feature is not yet implemented");
k_file_label_text : compound_string("File");
k_quit_label_text : compound_string("Quit");
k_images_label_text : compound_string("Image");
k_image_1_label_text : compound_string("Image 1");
k_image_2_label_text : compound_string("Image 2");
k_image_3_label_text : compound_string("Image 3");
k_utilities_label_text : compound_string("Utilities");
k_mail_label_text : compound_string("VMS Mail");
k_card_label_text : compound_string("Card Filer");
value
k_menu_bar : 1;
k_file_pdme : 2;
k_file_menu : 3;
k_image_pdme : 4;
k_image_menu : 5;
k_utilities_menu : 7;
k_utilities_pdme : 6;
k_mpopup : 8;
k_nyi : 99;
value
k_image_1_drawing : 1;
k_image_2_drawing : 2;
k_image_3_drawing : 3;
k_mail_button : 4;
k_card_button : 5;
k_show_1_button : 12;
k_show_2_button : 13;
k_popup_menu : 11;
k_attached_box : 14;
k_pdb : 15;
k_id : 16;
k_description : 17;
k_status : 18;
k_x : 19;
k_y : 20;
k_dismiss : 21;
value
k_button_font
: font('-Adobe-Courier-Bold-R-Normal--14-140-75-75-M-90-ISO8859-1');
! Colors, color tables, and icons.
value
yellow : color('yellow', foreground);
red : color('red', foreground);
green : color('green', foreground);
magenta : color('magenta', background);
gold : color('gold', foreground);
lightblue : color('lightblue', background);
!value
! button_ct : color_table(
! yellow='o'
! ,red='.'
! ,background color=' ');
!
!value
!
! declare Icons here if you want
! First declare the 'top level' widgets. These are not controlled by
! any other widgets. They are each fetched individually as needed.
object ! The main window widget.
! This displays the current order
! as it is taken.
S_MAIN_WINDOW : main_window {
arguments {
x = 10;
y = 20;
width = mmi_w;
height = mmi_h;
};
controls {
menu_bar s_menu_bar;
attached_dialog_box main_area;
};
};
list
draw_window_translators : arguments
{ translations = translation_table
('<Btn1Down>: flip_color()',
'<Btn2Down>: popup_menu()'
);
};
object
main_area : attached_dialog_box
{
arguments
{ units = DwtPixelUnits;
border_width= 3;
arguments draw_window_translators;
};
controls
{
window mmi_draw_window;
};
callbacks {
create = procedure create_proc (k_attached_box);
};
};
object ! A popup dialog box, called by any
nyi : message_box { ! code that is not finished. Useful
! for prototyping.
arguments {
label_label = k_nyi_label_text;
default_position = true;
};
callbacks {
create = procedure create_proc (k_nyi);
};
};
object dpopup : popup_dialog_box {
arguments {
style = DwtModal;
x = dpopup_x;
y = dpopup_y;
width= dpopup_w;
height= dpopup_h;
background_color = lightblue;
};
controls {
label title_label;
label id_label;
label description_label;
label status_label;
label x_label;
label y_label;
label idv;
label dv;
label sv;
label xv;
label yv;
push_button dismiss_button;
};
callbacks {
create = procedure create_proc (k_pdb);
};
};
object title_label : label {
arguments {
label_label = k_dialog_box_title;
x = 2;
y = 3;
};
};
object id_label : label {
arguments {
label_label = k_id_label_text;
background_color = lightblue;
foreground_color = red;
x = 25;
y = 15;
};
};
object description_label : label {
arguments {
label_label = k_description_label_text;
background_color = lightblue;
foreground_color = red;
x = 25;
y = 25;
};
};
object status_label : label {
arguments {
label_label = k_status_label_text;
background_color = lightblue;
foreground_color = red;
x = 25;
y = 35;
};
};
object x_label : label {
arguments {
label_label = k_xo_label_text;
background_color = lightblue;
foreground_color = red;
x = 25;
y = 45;
};
};
object y_label : label {
arguments {
label_label = k_yo_label_text;
background_color = lightblue;
foreground_color = red;
x = 25;
y = 55;
};
};
object idv : label {
arguments {
background_color = lightblue;
x = 80;
y = 15;
};
callbacks {
create = procedure create_proc (k_id);
};
};
object dv : label {
arguments {
background_color = lightblue;
x = 80;
y = 25;
};
callbacks {
create = procedure create_proc (k_description);
};
};
object sv : label {
arguments {
background_color = lightblue;
x = 80;
y = 35;
};
callbacks {
create = procedure create_proc (k_status);
};
};
object xv : label {
arguments {
background_color = lightblue;
x = 80;
y = 45;
};
callbacks {
create = procedure create_proc (k_x);
};
};
object yv : label {
arguments {
background_color = lightblue;
x = 80;
y = 55;
};
callbacks {
create = procedure create_proc (k_y);
};
};
object
dismiss_button : push_button {
arguments {
label_label = k_dismiss_label_text;
x = 25;
y = 80;
};
callbacks {
activate = procedure dismiss_box();
create = procedure create_proc (k_dismiss);
};
};
object
mpopup : popup_menu {
arguments {
width = mpopup_w;
height = mpopup_h;
orientation = DwtOrientationVertical;
};
controls
{
push_button p_show_1;
push_button p_show_2;
};
callbacks {
create = procedure create_proc (k_popup_menu);
};
};
object
p_show_1 : push_button {
arguments {
label_label = k_ss_label_text;
};
callbacks {
activate = procedure menu_flip_color();
create = procedure create_proc(k_show_1_button);
};
};
object
p_show_2 : push_button {
arguments {
label_label = k_show_label_text;
};
callbacks {
activate = procedure display_dialog();
create = procedure create_proc(k_show_2_button);
};
};
! Now define all remaining widgets alluded to in the definition of the top
! level widgets.
object
mmi_draw_window : window
{
arguments
{
x = draw_win_x;
y = draw_win_y;
height = draw_win_h;
width = draw_win_w;
border_width = draw_win_bw;
};
callbacks
{
create = procedure create_display();
expose = procedure expose_display();
};
};
! Now define the menu bar and the pulldown widgets in the menu bar.
object
s_menu_bar : menu_bar {
arguments {
orientation = DwtOrientationHorizontal;
spacing = 25; ! Pixels between items in menu
height = main_menu_h;
width = main_menu_w;
};
controls {
pulldown_entry file_menu_entry;
pulldown_entry image_menu_entry;
pulldown_entry utilities_menu_entry;
};
callbacks {
create = procedure create_proc (k_menu_bar);
};
};
! The file pulldown menu entry widget (what shows up in the menu bar itself).
! All these pulldown entries can be set up to function in one of two ways by
! removing comment characters:
! 1. If the 'controls' clause specifying the pulldown menu is
! commented out, then the pulldown menus are loaded by the
! pulling callback when the entry is first activated.
! 2. If the 'controls' clause is not commented out, then the pulldown
! menu is loaded when its parent is created.
! Method 1 demonstrates deferred menu creation. The pulldown entry
! creates its pulldown menu at a later time, rather than at the
! time the pulldown entry is created.
! Method 2 demonstrates the standard technique -- creating the pulldown menu at
! the time the pulldown entry is created.
object
file_menu_entry : pulldown_entry {
arguments {
label_label = k_file_label_text;
};
controls {
pulldown_menu file_menu;
};
callbacks {
create = procedure create_proc (k_file_pdme);
};
};
! The pulldown menu with the push buttons it controls.
object
file_menu : pulldown_menu {
controls {
push_button m_quit_button;
};
callbacks {
create = procedure create_proc (k_file_menu);
};
};
object
m_quit_button : push_button {
arguments {
label_label = k_quit_label_text;
};
callbacks {
activate = procedure quit_proc ('normal demo exit');
};
};
! The edit pulldown entry and the associated pulldown menu.
object
image_menu_entry : pulldown_entry {
arguments {
label_label = k_images_label_text;
};
controls {
pulldown_menu image_menu;
};
callbacks {
create = procedure create_proc (k_image_pdme);
};
};
object
image_menu : pulldown_menu {
controls {
push_button m_image_1;
push_button m_image_2;
push_button m_image_3;
};
callbacks {
create = procedure create_proc (k_image_menu);
};
};
object
m_image_1 : push_button {
arguments {
label_label = k_image_1_label_text;
};
callbacks {
activate = procedure activate_proc (k_image_1_drawing);
};
};
object
m_image_2 : push_button {
arguments {
label_label = k_image_2_label_text;
};
callbacks {
activate = procedure activate_proc (k_image_2_drawing);
};
};
object
m_image_3 : push_button {
arguments {
label_label = k_image_3_label_text;
};
callbacks {
activate = procedure activate_proc (k_image_3_drawing);
};
};
! Finally, the pulldown entry for utilities
object
utilities_menu_entry : pulldown_entry {
arguments {
label_label = k_utilities_label_text;
};
controls {
pulldown_menu utilities_menu;
};
};
object
utilities_menu : pulldown_menu {
controls {
push_button m_mail_button;
push_button m_card_button;
};
callbacks {
create = procedure create_proc (k_utilities_menu);
};
};
object
m_mail_button : push_button {
arguments {
label_label = k_mail_label_text;
};
callbacks {
activate = procedure activate_proc (k_mail_button);
};
};
object
m_card_button : push_button {
arguments {
label_label = k_card_label_text;
};
callbacks {
activate = procedure activate_proc (k_card_button);
};
};
end module;
| |||||
| 156.5 | AITG::DERAMO | Daniel V. {AITG,ZFC}:: D'Eramo | Wed Feb 08 1989 19:03 | 11 | |
A guess ...
Could the problem be the *two* 1000 x 800 bitmaps (one for
each application)? It could be that when the first copy of
the application references its bitmap, its bitmap is paged
in and the other copy's is paged out, and vice versa. Then
when you halved the window sizes, both bitmaps fit into
memory, so you didn't see the problem then.
Dan
| |||||