home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
tplab009.zip
/
tl_main.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-05
|
3KB
|
144 lines
/*
tl_main.cpp (emx+gcc)
Tape Label Editor Version 0.09
1995 1996 Giovanni Iachello
This is freeware software. You can use or modify it as you wish,
provided that the part of code that I wrote remains freeware.
Freeware means that the source code must be available on request
to anyone.
You must also include this notice in all files derived from this
file.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "tapelab.h"
#include "pmstdres.h"
#include "pmhelp.h"
PMApp* App;
PMHelpWin *helpwin;
/////////////////////////////////////////////////////////////////////////////
//
// this help hook services requests of help from message boxes.
//
//
BOOL helpHook ( HAB habAnchor, SHORT sMode, USHORT usTopic, USHORT usSubTopic, PRECTL prclPos )
{
if ( (sMode == HLPM_WINDOW ) &&
helpwin &&
( usTopic>=PMHLP_DLG_ERRMSG && usTopic<=PMHLP_DLG_ASSERTFAIL)
) {
helpwin->sendMsg(HM_DISPLAY_HELP,
MPFROMLONG (MAKELONG (usTopic, 0)), MPFROMSHORT( HM_RESOURCEID) );
return TRUE;
}
return FALSE;
}
////////////////////////////////////////////////////////////////////////////
BOOL InfoDlg::command(USHORT id,USHORT cmddev) {
switch (id) {
case DINFO_PB_CURRDATE1:
case DINFO_PB_CURRDATE2:
char buf[64];
time_t t;
t=time(NULL);
strftime(buf,64,"%D",localtime(&t));
if (id == DINFO_PB_CURRDATE1) controlFromID(DINFO_EF_DATE1)->setText(buf);
else controlFromID(DINFO_EF_DATE2)->setText(buf);
return TRUE;
}
return PMModalDialog::command(id,cmddev);
}
BOOL InfoDlg::initdlg()
{
PMSpinButton* sp;
sp=(PMSpinButton*)controlFromID(DINFO_SB_SOURCE1);
sp->setArray(apchSources,5); sp->set();
sp=(PMSpinButton*)controlFromID(DINFO_SB_SOURCE2);
sp->setArray(apchSources,5); sp->set();
sp=(PMSpinButton*)controlFromID(DINFO_SB_NR1);
sp->setArray(apchNR,6); sp->set();
sp=(PMSpinButton*)controlFromID(DINFO_SB_NR2);
sp->setArray(apchNR,6); sp->set();
return TRUE;
}
BOOL SizeDlg::initdlg()
{
PMSpinButton* sp=(PMSpinButton*)controlFromID(DSIZE_SB_FLAPS);
sp->setLimits(4,2);
sp->set();
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////
void PMPrintLabelThread::main(void* arg=NULL)
{
PMPrinterDC printer(hab);
printer.open();
printer.startDoc(buf);
PMPresSpace *prnps=new PMPresSpace(&printer,0,0,PU_LOMETRIC|GPIF_DEFAULT|GPIT_NORMAL|GPIA_ASSOC,hab);
tl->paintlabel(*prnps);
delete prnps;
printer.endDoc(buf);
}
//////////////////////////////////////////////////////////////////////////////
int main (int argc,char* argv[])
{
char* file=NULL;
if (argc>1) file=argv[1];
PMAnchorBlock ab;
PMMessageQueue mq;
ab.init();
mq.create(ab);
App=new PMApp(ab,mq,argc,argv);
helpwin=new PMHelpWin("Tape Label Editor Help","tapelab.hlp",ID_TAPELAB,ab);
helpwin->createWin();
TapeLab * tl=new TapeLab(ab,file); // load also a file specified on the command line
tl->createWin();
ab.setHook(mq,HK_HELP,(PFN)helpHook,NULLHANDLE);
App->run();
ab.releaseHook(mq,HK_HELP,(PFN)helpHook,NULLHANDLE);
tl->destroyWin();
mq.destroy();
ab.uninit();
return (0);
}