home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 22
/
CD_ASCQ_22_0695.iso
/
win
/
fr
/
yrtrace
/
x_bcppap.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-27
|
6KB
|
269 lines
/* Project ex_bcpp
D. Heiderich
Copyright ⌐ 1995. All Rights Reserved.
SUBSYSTEM: ex_bcpp.exe Application
FILE: x_bcppap.cpp
AUTHOR: D. Heiderich
OVERVIEW
========
Source file for implementation of ex_bcppApp (TApplication).
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include <dir.h>
#include <string.h>
#include "x_bcppap.h"
#include "ex_btdlg.h" // Definition of about dialog.
#include "yr_dll.h" // YRTRACE
char directory[255];
//{{ex_bcppApp Implementation}}
//
// Build a response table for all messages/commands handled
// by the application.
//
DEFINE_RESPONSE_TABLE1(ex_bcppApp, TApplication)
//{{ex_bcppAppRSP_TBL_BEGIN}}
EV_COMMAND(CM_FILENEW, CmFileNew),
EV_COMMAND(CM_FILEOPEN, CmFileOpen),
EV_COMMAND(CM_FILECLOSE, CmFileClose),
EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
EV_COMMAND(101,yrtest),
EV_COMMAND(102,yraddline),
EV_COMMAND(103,yrclear),
EV_COMMAND(104,yrrun),
EV_COMMAND(105,yrstop),
EV_COMMAND(106,yrmacro),
EV_COMMAND(107,yrhide),
EV_COMMAND(108,yrshow),
//{{ex_bcppAppRSP_TBL_END}}
END_RESPONSE_TABLE;
//////////////////////////////////////////////////////////
// ex_bcppApp
// =====
//
ex_bcppApp::ex_bcppApp () : TApplication("ex_bcpp")
{
// Common file file flags and filters for Open/Save As dialogs. Filename and directory are
// computed in the member functions CmFileOpen, and CmFileSaveAs.
FileData.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
FileData.SetFilter("All Files (*.*)|*.*|");
strcpy(directory, "X:\\");
directory[0] = 'A' + getdisk();
getcurdir(0, directory+3);
// INSERT>> Your constructor code here.
ActiveYR(TRUE);
YRAddline("DΘbut de x_bcapp (exemple de lien)");
}
ex_bcppApp::~ex_bcppApp ()
{
// INSERT>> Your destructor code here.
}
//////////////////////////////////////////////////////////
// ex_bcppApp
// =====
// Application intialization.
//
void ex_bcppApp::InitMainWindow ()
{
SDIDecFrame *frame = new SDIDecFrame(0, GetName(), 0, FALSE);
nCmdShow = nCmdShow != SW_SHOWMINIMIZED ? SW_SHOWNORMAL : nCmdShow;
//
// Assign ICON w/ this application.
//
frame->SetIcon(this, IDI_SDIAPPLICATION);
//
// Menu associated with window and accelerator table associated with table.
//
frame->AssignMenu(SDI_MENU);
//
// Associate with the accelerator table.
//
frame->Attr.AccelTable = SDI_MENU;
SetMainWindow(frame);
}
///////////////////////////////////////////////////////////
// menu YRTRACE
//
//
void ex_bcppApp::yrtest()
{
if (IsYRTRACE()) MessageBox(GetActiveWindow(),"YRTRACE est chargΘ","",0);
else MessageBox(GetActiveWindow(),"YRTRACE n'est pas chargΘ","",0);
}
void ex_bcppApp::yraddline()
{
YRAddline("Ajout d'une ligne dans YRTRACE !");
}
void ex_bcppApp::yrclear()
{
ClearList();
}
void ex_bcppApp::yrrun()
{
if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
StartCapture();
}
void ex_bcppApp::yrstop()
{
if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
StopCapture();
}
void ex_bcppApp::yrmacro()
{
if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
char buf[255];
strcpy(buf,directory);
strcat(buf,"\\");
strcat(buf,"ex_link.byr");
YRAddline(buf);
RunYRBASIC(buf);
}
void ex_bcppApp::yrhide()
{
if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
HideYRTrace();
}
void ex_bcppApp::yrshow()
{
if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
ShowYRTrace();
}
//////////////////////////////////////////////////////////
// ex_bcppApp
// ===========
// Menu File New command
void ex_bcppApp::CmFileNew ()
{
TEditFile *client = TYPESAFE_DOWNCAST(GetMainWindow()->GetClientWindow(), TEditFile); // Client window for the frame.
client->NewFile();
ActiveYR(TRUE);
YRAddline("x_bcapp:Nouveau fichier");
}
//////////////////////////////////////////////////////////
// ex_bcppApp
// ===========
// Menu File Open command
void ex_bcppApp::CmFileOpen ()
{
//
// Display standard Open dialog box to select a file name.
//
*FileData.FileName = 0;
TEditFile *client = TYPESAFE_DOWNCAST(GetMainWindow()->GetClientWindow(), TEditFile); // Client window for the frame.
if (client->CanClose())
if (TFileOpenDialog(GetMainWindow(), FileData).Execute() == IDOK)
OpenFile();
}
void ex_bcppApp::OpenFile (const char *fileName)
{
if (fileName)
lstrcpy(FileData.FileName, fileName);
TEditFile *client = TYPESAFE_DOWNCAST(GetMainWindow()->GetClientWindow(), TEditFile); // Client window for the frame.
client->ReplaceWith(FileData.FileName);
YRAddline("x_bcapp:Ouverture fichier");
}
//////////////////////////////////////////////////////////
// ex_bcppApp
// =====
// Menu File Close command
void ex_bcppApp::CmFileClose ()
{
CmFileNew();
}
//{{SDIDecFrame Implementation}}
SDIDecFrame::SDIDecFrame (TWindow *parent, const char far *title, TWindow *clientWnd, BOOL trackMenuSelection, TModule *module)
: TDecoratedFrame(parent, title, clientWnd == 0 ? new TEditFile(0, 0, 0) : clientWnd, trackMenuSelection, module)
{
// INSERT>> Your constructor code here.
}
SDIDecFrame::~SDIDecFrame ()
{
// INSERT>> Your destructor code here.
}
//////////////////////////////////////////////////////////
// ex_bcppApp
// ===========
// Menu Help About ex_bcpp.exe command
void ex_bcppApp::CmHelpAbout ()
{
//
// Show the modal dialog.
//
ex_aboutdlg(MainWindow).Execute();
YRAddline("x_bcapp:a propos...");
}
int OwlMain (int , char* [])
{
ex_bcppApp App;
int result;
result = App.Run();
return result;
}