#include <unistd.h>#include <Xm/Xm.h>#include <Xm/Frame.h>#include <Xm/Form.h>#include <Xm/PushB.h>#include <Xm/PushBP.h>#include <Xm/Separator.h>#include <X11/xpm.h>#include <stdio.h>#include "GuiStrings.hh"#include "r_arrow.xpm"#include "r_arrow_in.xpm"#include "l_arrow.xpm"#include "l_arrow_in.xpm"#include "right_arrows.xpm"#include "right_arrows_in.xpm"#include "left_arrows.xpm"#include "left_arrows_in.xpm"Include dependency graph for Spindle.hh:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | INITIAL_SPINDLE_SPEED (3000.00) |
Functions | |
| void | updateSpindleSpeed () |
| void | setSpindleSpeed (double) |
| void | showSpindle (void) |
| void | hideSpindle (void) |
| void | changeDirection (void) |
| void | stopSpindle (void) |
| Widget | SpindleControl (Dimension x0, Dimension x1, Dimension y1, Dimension y2, Dimension boxMarginWidth, Dimension boxMarginHeight, Widget parent) |
|
|
Definition at line 21 of file Spindle.hh. |
|
||||||||||||||||||||||||||||||||
|
Definition at line 6 of file Spindle.cc. Referenced by main().
00009 {
00010 arrowFrame =
00011 XtVaCreateManagedWidget ("arrowFrame", xmFrameWidgetClass, parent,
00012 XmNfractionBase, 5,
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 Dimension width = 100;
00032 Dimension height = 50;
00033 XmPushButtonWidget pb;
00034
00035 reverseButton = XtVaCreateManagedWidget (SPINDLE_REVERSE_STR,
00036 xmPushButtonWidgetClass, arrowForm,
00037 XmNtopAttachment, XmATTACH_FORM,
00038 XmNbottomAttachment, XmATTACH_NONE,
00039 XmNleftAttachment, XmATTACH_FORM,
00040 XmNrightAttachment, XmATTACH_NONE,
00041 XmNshadowThickness, 4,
00042 XmNwidth, width,
00043 XmNheight, height, NULL);
00044
00045 pb = (XmPushButtonWidget) reverseButton;
00046 pb->pushbutton.armed = false;
00047
00048 XtAddCallback (reverseButton, XmNarmCallback,
00049 buttonCB, (XtPointer) SPINDLE_REVERSE);
00050
00051 XmString SpindleLabel =
00052 XmStringCreateLtoR ((char *) SPINDLE_LABEL_STR, XmSTRING_DEFAULT_CHARSET);
00053
00054 spindleButton =
00055 XtVaCreateManagedWidget ("button", xmPushButtonWidgetClass, arrowForm,
00056 XmNtopAttachment, XmATTACH_FORM,
00057 XmNbottomAttachment, XmATTACH_NONE,
00058 XmNleftAttachment, XmATTACH_WIDGET,
00059 XmNleftWidget, reverseButton,
00060 XmNleftOffset, 50,
00061 XmNrightAttachment, XmATTACH_NONE,
00062 XmNshadowThickness, 4,
00063 XmNwidth, width,
00064 XmNheight, height,
00065 XmNlabelString, SpindleLabel, NULL);
00066
00067 XmStringFree (SpindleLabel);
00068
00069 pb = (XmPushButtonWidget) spindleButton;
00070 pb->pushbutton.armed = false;
00071
00072 XtAddCallback (spindleButton, XmNarmCallback,
00073 buttonCB, (XtPointer) SPINDLE_ON_OFF);
00074
00075 forwardButton = XtVaCreateManagedWidget (SPINDLE_FORWARD_STR,
00076 xmPushButtonWidgetClass, arrowForm,
00077 XmNtopAttachment, XmATTACH_FORM,
00078 XmNbottomAttachment, XmATTACH_NONE,
00079 XmNleftAttachment, XmATTACH_WIDGET,
00080 XmNleftWidget, spindleButton,
00081 XmNleftOffset, 50,
00082 XmNrightAttachment, XmATTACH_NONE,
00083 XmNshadowThickness, 4,
00084 XmNwidth, width,
00085 XmNheight, height, NULL);
00086
00087 pb = (XmPushButtonWidget) forwardButton;
00088 pb->pushbutton.armed = false;
00089
00090 XtAddCallback (forwardButton, XmNarmCallback,
00091 buttonCB, (XtPointer) SPINDLE_FORWARD);
00092 // Save the original colors so we can go back to this state.
00093 XtVaGetValues (forwardButton, XmNtopShadowColor, &original_tsc,
00094 XmNbottomShadowColor, &original_bsc,
00095 XmNarmColor, &original_ac,
00096 XmNbackground, &original_bg, NULL);
00097
00098 if (get_speed () >= 0)
00099 {
00100 PRESS (forwardButton);
00101 UNPRESS (reverseButton);
00102 }
00103 else
00104 {
00105 PRESS (reverseButton);
00106 UNPRESS (forwardButton);
00107 }
00108
00109
00110 SEPARATOR ();
00111
00112 CREATE_PIXMAP (r_arrow, r_pixmap);
00113 CREATE_PIXMAP (r_arrow_in, r_pixmap_in);
00114 CREATE_PIXMAP (l_arrow, l_pixmap);
00115 CREATE_PIXMAP (l_arrow_in, l_pixmap_in);
00116 CREATE_PIXMAP (right_arrows, rr_pixmap);
00117 CREATE_PIXMAP (right_arrows_in, rr_pixmap_in);
00118 CREATE_PIXMAP (left_arrows, ll_pixmap);
00119 CREATE_PIXMAP (left_arrows_in, ll_pixmap_in);
00120
00121 SPINDLE_AXIS (arrowB1, XmATTACH_FORM, NULL, 0, ll_pixmap, ARROW_LEFT_FAST);
00122 SPINDLE_AXIS (arrowB2, XmATTACH_WIDGET, arrowB1, 5, l_pixmap, ARROW_LEFT);
00123
00124 SPINDLE_AXIS (arrowB3, XmATTACH_WIDGET, arrowB2, 225, r_pixmap,
00125 ARROW_RIGHT);
00126 SPINDLE_AXIS (arrowB4, XmATTACH_WIDGET, arrowB3, 5, rr_pixmap,
00127 ARROW_RIGHT_FAST);
00128
00129 double mySpeed = get_speed ();
00130 LABEL_SPEED (mySpeed);
00131
00132 updateSpindleSpeed ();
00133
00134 return arrowFrame;
00135 }
|
|
|
Definition at line 335 of file Spindle.cc. 00336 {
00337 // Dummy: for now, assume instant reversal of spindle with same speed
00338 theSpeed = -(theSpeed);
00339 }
|
|
|
Definition at line 349 of file Spindle.cc. 00350 {
00351 if (arrowFrame)
00352 XtVaSetValues (arrowFrame, XmNmappedWhenManaged, False, NULL);
00353 }
|
|
|
Definition at line 327 of file Spindle.cc. Referenced by buttonsCB().
00328 {
00329 theSpeed = speed;
00330 LABEL_SPEED_UPDATE (speed);
00331 }
|
|
|
Definition at line 342 of file Spindle.cc. 00343 {
00344 if (arrowFrame)
00345 XtVaSetValues (arrowFrame, XmNmappedWhenManaged, True, NULL);
00346 }
|
|
|
Definition at line 356 of file Spindle.cc. 00357 {
00358 isSpindleOn = False;
00359 UNPRESS (spindleButton);
00360 turnSpindleOff ();
00361 }
|
|
|
Definition at line 299 of file Spindle.cc. 00300 {
00301 double newSpeed = get_speed ();
00302 LABEL_SPEED_UPDATE (newSpeed);
00303
00304 // Don't let them change spindle direction while moving
00305 if (isSpindleOn)
00306 {
00307 LOCK (forwardButton);
00308 LOCK (reverseButton);
00309 }
00310 else
00311 {
00312 if (wasForward)
00313 {
00314 LOCK (forwardButton);
00315 UNLOCK (reverseButton);
00316 }
00317 else
00318 {
00319 LOCK (reverseButton);
00320 UNLOCK (forwardButton);
00321 }
00322 }
00323 }
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001