/* $Id: dialog.cpp 2.4 1995/07/20 11:24:33 leon Exp leon $
*
* GISEL - G-CODE ISEL CNC driver
*
* Copyright (c) 1994 LECAD
* All Rights Reserved.
*
*/
#define Uses_TInputLong
#define Uses_TInputDouble
#include "input.h"
#include "gisel.h"
#include <stdlib.h>
#include <stdarg.h>
#include <strstrea.h>
#include <iomanip.h>
/*
* Executes dialog ands sets data
*/
ushort execDialog( TDialog *d, void *data )
{
TView *p = TProgram::application->validView( d );
if( p == 0 )
return cmCancel;
else
{
if( data != 0 )
p->setData( data );
ushort result = TProgram::deskTop->execView( p );
if( result != cmCancel && data != 0 )
p->getData( data );
TObject::destroy( p );
return result;
}
}
/*
* Find for editor
*/
TDialog *createFindDialog()
{
TDialog *d = new TDialog( TRect( 0, 0, 38, 12 ), "Find" );
d->options |= ofCentered;
TInputLine *control = new TInputLine( TRect( 3, 3, 32, 4 ), 80 );
d->insert( control );
d->insert(
new TLabel( TRect( 2, 2, 15, 3 ), "~T~ext to find", control ) );
d->insert(
new THistory( TRect( 32, 3, 35, 4 ), control, 10 ) );
d->insert( new TCheckBoxes( TRect( 3, 5, 35, 7 ),
new TSItem( "~C~ase sensitive",
new TSItem( "~W~hole words only", 0 ))));
d->insert(
new TButton( TRect( 14, 9, 24, 11 ), "O~K~", cmOK, bfDefault ) );
d->insert(
new TButton( TRect( 26, 9, 36, 11 ), "Cancel", cmCancel, bfNormal ) );
d->selectNext( False );
return d;
}
/*
* Replace words for editior
*/
TDialog *createReplaceDialog()
{
TDialog *d = new TDialog( TRect( 0, 0, 40, 16 ), "Replace" );
d->options |= ofCentered;
TInputLine *control = new TInputLine( TRect( 3, 3, 34, 4 ), 80 );
d->insert( control );
d->insert(
new TLabel( TRect( 2, 2, 15, 3 ), "~T~ext to find", control ) );
d->insert( new THistory( TRect( 34, 3, 37, 4 ), control, 10 ) );
control = new TInputLine( TRect( 3, 6, 34, 7 ), 80 );
d->insert( control );
d->insert( new TLabel( TRect( 2, 5, 12, 6 ), "~N~ew text", control ) );
d->insert( new THistory( TRect( 34, 6, 37, 7 ), control, 11 ) );
d->insert( new TCheckBoxes( TRect( 3, 8, 37, 12 ),
new TSItem("~C~ase sensitive",
new TSItem("~W~hole words only",
new TSItem("~P~rompt on replace",
new TSItem("~R~eplace all", 0 ))))));
d->insert(
new TButton( TRect( 17, 13, 27, 15 ), "O~K~", cmOK, bfDefault ) );
d->insert( new TButton( TRect( 28, 13, 38, 15 ),
"Cancel", cmCancel, bfNormal ) );
d->selectNext( False );
return d;
}
/*
* Creates settings dialog
*/
TDialog* createSettingsDialog(void)
{
TView *control;
TDialog* dlg = new TDialog(TRect(17, 1, 61, 21), "Settings");
if (!dlg) return 0;
control = new TInputLong(TRect(6, 3, 13, 4), 7, 1, 20000, 0, "Axis steps:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(5, 2, 17, 3), "A~x~is steps:", control));
dlg->insert(new TLabel(TRect(3, 3, 6, 4), "X:", control));
control = new TInputLong(TRect(6, 4, 13, 5), 7, 1, 20000, 0, "Y:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(3, 4, 6, 5), "Y:", control));
control = new TInputLong(TRect(6, 5, 13, 6), 7, 1, 20000, 0, "Z:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(3, 5, 6, 6), "Z:", control));
control = new TInputLong(TRect(26, 3, 33, 4), 7, 30, 10000, 0, "Manual speed:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(25, 2, 39, 3), "~M~anual speed:", control));
dlg->insert(new TLabel(TRect(23, 3, 26, 4), "X:", control));
control = new TInputLong(TRect(26, 4, 33, 5), 7, 30, 10000, 0, "Y:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(23, 4, 26, 5), "Y:", control));
control = new TInputLong(TRect(26, 5, 33, 6), 7, 30, 10000, 0, "Z:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(23, 5, 26, 6), "Z:", control));
control = new TInputLong(TRect(13, 8, 17, 9), 7, 0, 1000, 0, "Device #");
dlg->insert(control);
dlg->insert(new TLabel(TRect(4, 8, 13, 9), "~D~evice #", control));
control = new TRadioButtons(TRect(26, 7, 38, 9),
new TSItem("~b~efore",
new TSItem("~a~fter", 0)));
dlg->insert(control);
dlg->insert(new TLabel(TRect(4, 7, 25, 8), "Command acknowledge:", control));
control = new TInputLong(TRect(26, 9, 34, 10), 7, 0, 100000, 0, "Manual step size:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(8, 9, 26, 10), "Ma~n~ual step size:", control));
control = new TInputLong(TRect(26, 10, 34, 11), 7, 0, 100000, 0, " Max. step size for Z:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(3, 10, 26, 11), "Max. ste~p~ size for Z :", control));
control = new TCheckBoxes(TRect(4, 12, 40, 15),
new TSItem("~W~rite controller Log to file",
new TSItem("~R~estore desktop at startup",
new TSItem("~L~eft handed coordinate system", 0))));
dlg->insert(control);
control = new TInputLine(TRect(18, 15, 40, 16), 57);
dlg->insert(control);
dlg->insert(new TLabel(TRect(4, 15, 18, 16), "~L~og Filename:", control));
control = new TButton(TRect(8, 17, 18, 19), "O~K~", cmOK, bfDefault);
dlg->insert(control);
control = new TButton(TRect(24, 17, 34, 19), "Cancel", cmCancel, bfNormal);
dlg->insert(control);
control = new TStaticText(TRect(34, 3, 41, 4), "steps/s");
dlg->insert(control);
control = new TStaticText(TRect(34, 4, 41, 5), "steps/s");
dlg->insert(control);
control = new TStaticText(TRect(34, 5, 41, 6), "steps/s");
dlg->insert(control);
control = new TStaticText(TRect(14, 3, 22, 4), "steps/mm");
dlg->insert(control);
control = new TStaticText(TRect(14, 4, 22, 5), "steps/mm");
dlg->insert(control);
control = new TStaticText(TRect(14, 5, 22, 6), "steps/mm");
dlg->insert(control);
control = new TStaticText(TRect(35, 9, 41, 10), "steps");
dlg->insert(control);
control = new TStaticText(TRect(35, 10, 38, 11), "mm");
dlg->insert(control);
dlg->selectNext(False);
return dlg;
}
/*
* Homing speed
*/
TDialog* createHomingSpeedDialog(void)
{
TView *control;
TDialog* dlg = new TDialog(TRect(19, 8, 50, 17), "Homing Speed");
if (!dlg) return 0;
control = new TInputLong(TRect(8, 2, 16, 3), 7, 30, 10000, 0, "X:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(5, 2, 8, 3), "~X~:", control));
control = new TInputLong(TRect(8, 3, 16, 4), 7, 30, 10000, 0, "Y:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(5, 3, 8, 4), "~Y~:", control));
control = new TInputLong(TRect(8, 4, 16, 5), 7, 30, 10000, 0, "Z:");
dlg->insert(control);
dlg->insert(new TLabel(TRect(5, 4, 8, 5), "~Z~:", control));
control = new TButton(TRect(5, 6, 15, 8), "O~K~", cmOK, bfDefault);
dlg->insert(control);
control = new TButton(TRect(16, 6, 26, 8), "Cancel", cmCancel, bfNormal);
dlg->insert(control);
control = new TStaticText(TRect(17, 2, 26, 3), "steps/sec");
dlg->insert(control);
control = new TStaticText(TRect(17, 3, 26, 4), "steps/sec");
dlg->insert(control);
control = new TStaticText(TRect(17, 4, 26, 5), "steps/sec");
dlg->insert(control);
dlg->selectNext(False);
return dlg;
}
/*
* About dialog
*/
TDialog *createAboutDialog()
{
TDialog *aboutBox = new TDialog(TRect(0, 0, 39, 13), "About");
aboutBox->insert(
new TStaticText(TRect(1, 2, 38, 9),
"\003ISEL C-Series G-CODE driver\n"
"\003Version 0.3.2\n"
"\003(Build: " __DATE__ ")\n \n"
"\003Copyright (c) 1995,96,97,2002 LECAD\n"
"\003Faculty of Mechanical Engineering\n"
"\003University of Ljubljana\n\003Slovenia"
)
);
aboutBox->insert(
new TButton(TRect(14, 10, 25, 12), " OK", cmOK, bfDefault)
);
aboutBox->options |= ofCentered;
return aboutBox;
}
syntax highlighted by Code2HTML, v. 0.9.1