Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

Jog.cc File Reference

#include "Jog.hh"

Include dependency graph for Jog.cc:

Include dependency graph

Go to the source code of this file.

Defines

#define JOG

Functions

Widget JogControl (Dimension x0, Dimension x1, Dimension y1, Dimension y2, Dimension boxMarginWidth, Dimension boxMarginHeight, Widget parent, int numAxes)
void jogDone (void)
void buttonCB (Widget mw, XtPointer cd, XtPointer cb)
void unbuttonCB (Widget mw, XtPointer cd, XtPointer cb)
int whichAxis (Widget w, int type)
void do_jog (int theAxis, int type)
void stop_jog (int theAxis, int type)


Define Documentation

#define JOG
 

Definition at line 1 of file Jog.cc.


Function Documentation

Widget JogControl Dimension    x0,
Dimension    x1,
Dimension    y1,
Dimension    y2,
Dimension    boxMarginWidth,
Dimension    boxMarginHeight,
Widget    parent,
int    numAxes
 

Definition at line 6 of file Jog.cc.

00009 {
00010   arrowFrame =
00011     XtVaCreateManagedWidget ("arrowFrame", xmFrameWidgetClass, parent,
00012                              XmNfractionBase, 22,
00013                              XmNleftPosition, x0,
00014                              XmNrightPosition, x1,
00015                              XmNtopPosition, y1,
00016                              XmNbottomPosition, y2,
00017                              XmNmarginWidth, boxMarginWidth,
00018                              XmNmarginHeight, boxMarginHeight,
00019                              XmNtopAttachment, XmATTACH_POSITION,
00020                              XmNbottomAttachment, XmATTACH_POSITION,
00021                              XmNleftAttachment, XmATTACH_POSITION,
00022                              XmNrightAttachment, XmATTACH_POSITION,
00023                              XmNmarginWidth, 5,
00024                              XmNmarginHeight, 5,
00025                              XmNmappedWhenManaged, False,
00026                              XmNtraversalOn, False, NULL);
00027 
00028   arrowForm =
00029     XtVaCreateManagedWidget ("arrowForm", xmFormWidgetClass, arrowFrame,
00030                              XmNmarginWidth, 5, XmNmarginHeight, 5, NULL);
00031 
00032   CREATE_PIXMAP (r_arrow, r_pixmap);
00033   CREATE_PIXMAP (r_arrow_in, r_pixmap_in);
00034   CREATE_PIXMAP (l_arrow, l_pixmap);
00035   CREATE_PIXMAP (l_arrow_in, l_pixmap_in);
00036   CREATE_PIXMAP (right_arrows, rr_pixmap);
00037   CREATE_PIXMAP (right_arrows_in, rr_pixmap_in);
00038   CREATE_PIXMAP (left_arrows, ll_pixmap);
00039   CREATE_PIXMAP (left_arrows_in, ll_pixmap_in);
00040 
00041   int i = 0;
00042 
00043   JOG_AXIS (arrowB1[i], XmATTACH_FORM, XmATTACH_FORM, NULL, ll_pixmap,
00044             ARROW_LEFT_FAST);
00045   JOG_AXIS (arrowB2[i], XmATTACH_FORM, XmATTACH_WIDGET, arrowB1[i], l_pixmap,
00046             ARROW_LEFT);
00047 
00048   LABEL_AXIS (i, XmATTACH_FORM);
00049 
00050   JOG_AXIS (arrowB3[i], XmATTACH_FORM, XmATTACH_WIDGET, label[i], r_pixmap,
00051             ARROW_RIGHT);
00052   JOG_AXIS (arrowB4[i], XmATTACH_FORM, XmATTACH_WIDGET, arrowB3[i], rr_pixmap,
00053             ARROW_RIGHT_FAST);
00054 
00055 
00056   for (i = 1; i < numAxes; i++)
00057     {
00058       SEPARATOR ();
00059 
00060       JOG_AXIS (arrowB1[i], XmATTACH_WIDGET, XmATTACH_FORM, NULL, ll_pixmap,
00061                 ARROW_LEFT_FAST);
00062       JOG_AXIS (arrowB2[i], XmATTACH_WIDGET, XmATTACH_WIDGET, arrowB1[i],
00063                 l_pixmap, ARROW_LEFT);
00064 
00065       LABEL_AXIS (i, XmATTACH_WIDGET);
00066 
00067       JOG_AXIS (arrowB3[i], XmATTACH_WIDGET, XmATTACH_WIDGET, label[i],
00068                 r_pixmap, ARROW_RIGHT);
00069       JOG_AXIS (arrowB4[i], XmATTACH_WIDGET, XmATTACH_WIDGET, arrowB3[i],
00070                 rr_pixmap, ARROW_RIGHT_FAST);
00071 
00072     }
00073 
00074   SEPARATOR ();
00075 
00076   XmString JogLabel =
00077     XmStringCreateLtoR ((char *) JOG_LABEL_STR, XmSTRING_DEFAULT_CHARSET);
00078 
00079   jogLabel =
00080     XtVaCreateManagedWidget ("label", xmLabelWidgetClass, arrowForm,
00081                              XmNtopAttachment, XmATTACH_WIDGET,
00082                              XmNtopWidget, separator,
00083                              XmNtopOffset, 5,
00084                              XmNbottomAttachment, XmATTACH_FORM,
00085                              XmNbottomOffset, 10,
00086                              XmNleftAttachment, XmATTACH_FORM,
00087                              XmNleftOffset, 5,
00088                              XmNrightAttachment, XmATTACH_NONE,
00089                              XmNlabelString, JogLabel, NULL);
00090 
00091   XmStringFree (JogLabel);
00092 
00093   doneB =
00094     XtVaCreateManagedWidget (DONE_STR, xmPushButtonWidgetClass, arrowForm,
00095                              XmNtopAttachment, XmATTACH_WIDGET,
00096                              XmNtopWidget, separator,
00097                              XmNtopOffset, 5,
00098                              XmNbottomAttachment, XmATTACH_NONE,
00099                              XmNleftAttachment, XmATTACH_NONE,
00100                              XmNrightAttachment, XmATTACH_FORM,
00101                              XmNmarginWidth, 15,
00102                              XmNmarginHeight, 15,
00103                              XmNshadowThickness, 4, NULL);
00104 
00105   XtAddCallback (doneB, XmNarmCallback, buttonCB, (XtPointer) DONE);
00106 
00107   return arrowFrame;
00108 }

void buttonCB Widget    mw,
XtPointer    cd,
XtPointer    cb
[static]
 

Definition at line 119 of file Jog.cc.

00120 {
00121   int theAxis = -1;
00122   switch ((int) cd)
00123     {
00124     case DONE:
00125       XtVaSetValues (arrowFrame, XmNmappedWhenManaged, False, NULL);
00126       XmPushButtonWidget pb;
00127       pb = (XmPushButtonWidget) mw;
00128       pb->pushbutton.armed = false;
00129       showRunMode ();
00130       return;
00131     case ARROW_LEFT_FAST:
00132       XtVaSetValues (mw, XmNarmPixmap, ll_pixmap_in, NULL);
00133       theAxis = whichAxis (mw, (int) cd);
00134       break;
00135     case ARROW_LEFT:
00136       XtVaSetValues (mw, XmNarmPixmap, l_pixmap_in, NULL);
00137       theAxis = whichAxis (mw, (int) cd);
00138       break;
00139     case ARROW_RIGHT:
00140       XtVaSetValues (mw, XmNarmPixmap, r_pixmap_in, NULL);
00141       theAxis = whichAxis (mw, (int) cd);
00142       break;
00143     case ARROW_RIGHT_FAST:
00144       XtVaSetValues (mw, XmNarmPixmap, rr_pixmap_in, NULL);
00145       theAxis = whichAxis (mw, (int) cd);
00146       break;
00147     default:
00148       return;
00149     }
00150 
00151   do_jog (theAxis, (int) cd);
00152 
00153 }

void do_jog int    theAxis,
int    type
[static]
 

Definition at line 249 of file Jog.cc.

Referenced by buttonCB().

00250 {
00251 
00252 // TODO: call the emc jog interface code here
00253 
00254 #ifdef DEBUG
00255   char *whichWay[4] = { "Left fast", "Left", "Right", "Right fast" };
00256   cout << "Start " << whichWay[type] << " for axis: " << theAxis << endl;
00257 #endif
00258 }

void jogDone void   
 

Definition at line 112 of file Jog.cc.

Referenced by buttonsCB().

00113 {
00114   if (doneB)
00115     buttonCB (doneB, (XtPointer) DONE, (XtPointer) NULL);
00116 }

void stop_jog int    theAxis,
int    type
[static]
 

Definition at line 261 of file Jog.cc.

Referenced by unbuttonCB().

00262 {
00263 
00264 // TODO: call the emc jog interface code here
00265 
00266 #ifdef DEBUG
00267   char *whichWay[4] = { "Left fast", "Left", "Right", "Right fast" };
00268   cout << "Stop " << whichWay[type] << " for axis: " << theAxis << endl;
00269 #endif
00270 }

void unbuttonCB Widget    mw,
XtPointer    cd,
XtPointer    cb
[static]
 

Definition at line 156 of file Jog.cc.

00157 {
00158   int theAxis = -1;
00159   switch ((int) cd)
00160     {
00161     case DONE:
00162       return;
00163     case ARROW_LEFT_FAST:
00164     case ARROW_LEFT:
00165     case ARROW_RIGHT:
00166     case ARROW_RIGHT_FAST:
00167       theAxis = whichAxis (mw, (int) cd);
00168       break;
00169     default:
00170       return;
00171     }
00172 
00173   stop_jog (theAxis, (int) cd);
00174 
00175 }

int whichAxis Widget    w,
int    type
[static]
 

Definition at line 178 of file Jog.cc.

Referenced by buttonCB(), and unbuttonCB().

00179 {
00180   switch (type)
00181     {
00182     case ARROW_LEFT_FAST:
00183       if (w == arrowB1[0])
00184         return 0;
00185       if (w == arrowB1[1])
00186         return 1;
00187       if (w == arrowB1[2])
00188         return 2;
00189       if (w == arrowB1[3])
00190         return 3;
00191       if (w == arrowB1[4])
00192         return 4;
00193       if (w == arrowB1[5])
00194         return 5;
00195       break;
00196 
00197     case ARROW_LEFT:
00198       if (w == arrowB2[0])
00199         return 0;
00200       if (w == arrowB2[1])
00201         return 1;
00202       if (w == arrowB2[2])
00203         return 2;
00204       if (w == arrowB2[3])
00205         return 3;
00206       if (w == arrowB2[4])
00207         return 4;
00208       if (w == arrowB2[5])
00209         return 5;
00210       break;
00211 
00212     case ARROW_RIGHT:
00213       if (w == arrowB3[0])
00214         return 0;
00215       if (w == arrowB3[1])
00216         return 1;
00217       if (w == arrowB3[2])
00218         return 2;
00219       if (w == arrowB3[3])
00220         return 3;
00221       if (w == arrowB3[4])
00222         return 4;
00223       if (w == arrowB3[5])
00224         return 5;
00225       break;
00226 
00227     case ARROW_RIGHT_FAST:
00228       if (w == arrowB4[0])
00229         return 0;
00230       if (w == arrowB4[1])
00231         return 1;
00232       if (w == arrowB4[2])
00233         return 2;
00234       if (w == arrowB4[3])
00235         return 3;
00236       if (w == arrowB4[4])
00237         return 4;
00238       if (w == arrowB4[5])
00239         return 5;
00240       break;
00241 
00242     default:
00243       return -1;
00244     }
00245   return -1;
00246 }


Generated on Sun Dec 2 15:28:07 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001