From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

/*----------------------------------------------------------*/
/* */
/* Copyright (c) 1991 by Borland International */
/* */
/*----------------------------------------------------------*/
/*
* Turbo Vision - Version 2.0
*
* Copyright (c) 1994 by Borland International
* All Rights Reserved.
*
*/
#define Uses_TDialog
#define Uses_TDeskTop
#define Uses_TProgram
#define Uses_TApplication
#define Uses_TObject
#define Uses_TInputLine
#define Uses_TLabel
#define Uses_THistory
#define Uses_TRect
#define Uses_TCheckBoxes
#define Uses_TButton
#define Uses_TButton
#define Uses_MsgBox
#define Uses_TSItem
#define Uses_TEditor
#include <tvision/tv.h>
#include "tvedit.h"
#include <stdlib.h>
#include <strstrea.h>
#include <iomanip.h>
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;
}
}
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;
}
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;
}