home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 22 / CD_ASCQ_22_0695.iso / win / fr / yrtrace / x_bcppap.cpp < prev    next >
C/C++ Source or Header  |  1995-04-27  |  6KB  |  269 lines

  1. /*  Project ex_bcpp
  2.     D. Heiderich
  3.     Copyright ⌐ 1995. All Rights Reserved.
  4.  
  5.     SUBSYSTEM:    ex_bcpp.exe Application
  6.     FILE:         x_bcppap.cpp
  7.     AUTHOR:       D. Heiderich
  8.  
  9.  
  10.     OVERVIEW
  11.     ========
  12.     Source file for implementation of ex_bcppApp (TApplication).      
  13. */
  14.  
  15.  
  16. #include <owl\owlpch.h>
  17. #pragma hdrstop
  18.  
  19. #include <dir.h>
  20. #include <string.h>
  21. #include "x_bcppap.h"
  22. #include "ex_btdlg.h"                        // Definition of about dialog.       
  23.  
  24.  
  25. #include "yr_dll.h" // YRTRACE
  26.  
  27. char directory[255];
  28.  
  29. //{{ex_bcppApp Implementation}}
  30.  
  31.  
  32. //
  33. // Build a response table for all messages/commands handled
  34. // by the application.
  35. //
  36. DEFINE_RESPONSE_TABLE1(ex_bcppApp, TApplication)
  37. //{{ex_bcppAppRSP_TBL_BEGIN}}
  38.      EV_COMMAND(CM_FILENEW, CmFileNew),
  39.      EV_COMMAND(CM_FILEOPEN, CmFileOpen),
  40.      EV_COMMAND(CM_FILECLOSE, CmFileClose),
  41.      EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
  42.      EV_COMMAND(101,yrtest),
  43.      EV_COMMAND(102,yraddline),
  44.      EV_COMMAND(103,yrclear),
  45.      EV_COMMAND(104,yrrun),
  46.      EV_COMMAND(105,yrstop),
  47.      EV_COMMAND(106,yrmacro),
  48.      EV_COMMAND(107,yrhide),
  49.      EV_COMMAND(108,yrshow),
  50. //{{ex_bcppAppRSP_TBL_END}}
  51. END_RESPONSE_TABLE;
  52.  
  53.  
  54.  
  55.  
  56. //////////////////////////////////////////////////////////
  57. // ex_bcppApp
  58. // =====
  59. //
  60. ex_bcppApp::ex_bcppApp () : TApplication("ex_bcpp")
  61. {
  62.  
  63.     // Common file file flags and filters for Open/Save As dialogs.  Filename and directory are
  64.     // computed in the member functions CmFileOpen, and CmFileSaveAs.
  65.     FileData.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
  66.      FileData.SetFilter("All Files (*.*)|*.*|");
  67.      strcpy(directory, "X:\\");
  68.      directory[0] = 'A' + getdisk();
  69.      getcurdir(0, directory+3);
  70.  
  71.     // INSERT>> Your constructor code here.
  72.      ActiveYR(TRUE);
  73.      YRAddline("DΘbut de x_bcapp (exemple de lien)");
  74. }
  75.  
  76.  
  77. ex_bcppApp::~ex_bcppApp ()
  78. {
  79.     // INSERT>> Your destructor code here.
  80.  
  81. }
  82.  
  83.  
  84. //////////////////////////////////////////////////////////
  85. // ex_bcppApp
  86. // =====
  87. // Application intialization.
  88. //
  89. void ex_bcppApp::InitMainWindow ()
  90. {
  91.     SDIDecFrame *frame = new SDIDecFrame(0, GetName(), 0, FALSE);
  92.  
  93.      nCmdShow = nCmdShow != SW_SHOWMINIMIZED ? SW_SHOWNORMAL : nCmdShow;
  94.  
  95.     //
  96.      // Assign ICON w/ this application.
  97.      //
  98.     frame->SetIcon(this, IDI_SDIAPPLICATION);
  99.  
  100.      //
  101.      // Menu associated with window and accelerator table associated with table.
  102.     //
  103.      frame->AssignMenu(SDI_MENU);
  104.     
  105.      //
  106.     // Associate with the accelerator table.
  107.      //
  108.     frame->Attr.AccelTable = SDI_MENU;
  109.  
  110.   
  111.     SetMainWindow(frame);
  112.  
  113. }
  114.  
  115.  
  116. ///////////////////////////////////////////////////////////
  117. //  menu YRTRACE
  118. //
  119. //
  120.  
  121. void ex_bcppApp::yrtest()
  122. {
  123.  if (IsYRTRACE()) MessageBox(GetActiveWindow(),"YRTRACE est chargΘ","",0);
  124.                 else  MessageBox(GetActiveWindow(),"YRTRACE n'est pas chargΘ","",0);
  125. }
  126.  
  127. void ex_bcppApp::yraddline()
  128. {
  129.   YRAddline("Ajout d'une ligne dans YRTRACE !");
  130. }
  131.  
  132. void ex_bcppApp::yrclear()
  133. {
  134.  ClearList();
  135. }
  136.  
  137. void ex_bcppApp::yrrun()
  138. {
  139.  if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
  140.  StartCapture();
  141. }
  142.  
  143. void ex_bcppApp::yrstop()
  144. {
  145.  if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
  146.  StopCapture();
  147. }
  148.  
  149. void ex_bcppApp::yrmacro()
  150. {
  151.  if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
  152.  char buf[255];
  153.  strcpy(buf,directory);
  154.  strcat(buf,"\\");
  155.  strcat(buf,"ex_link.byr");
  156.  YRAddline(buf);
  157.  RunYRBASIC(buf);
  158. }
  159.  
  160. void ex_bcppApp::yrhide()
  161. {
  162.  if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
  163.  HideYRTrace();
  164. }
  165.  
  166. void ex_bcppApp::yrshow()
  167. {
  168.  if (!IsRegister()) MessageBox(GetActiveWindow(),"YRTRACE doit Ωtre lancΘ et enregistrΘ","",0);
  169.  ShowYRTrace();
  170. }
  171.  
  172.  
  173.  
  174. //////////////////////////////////////////////////////////
  175. // ex_bcppApp
  176. // ===========
  177. // Menu File New command
  178. void ex_bcppApp::CmFileNew ()
  179. {
  180.      TEditFile *client = TYPESAFE_DOWNCAST(GetMainWindow()->GetClientWindow(), TEditFile);     // Client window for the frame.
  181.      client->NewFile();
  182.      ActiveYR(TRUE);
  183.      YRAddline("x_bcapp:Nouveau fichier");
  184. }
  185.  
  186.  
  187. //////////////////////////////////////////////////////////
  188. // ex_bcppApp
  189. // ===========
  190. // Menu File Open command
  191. void ex_bcppApp::CmFileOpen ()
  192. {
  193.      //
  194.      // Display standard Open dialog box to select a file name.
  195.      //
  196.      *FileData.FileName = 0;
  197.  
  198.      TEditFile *client = TYPESAFE_DOWNCAST(GetMainWindow()->GetClientWindow(), TEditFile);     // Client window for the frame.
  199.      if (client->CanClose())
  200.           if (TFileOpenDialog(GetMainWindow(), FileData).Execute() == IDOK)
  201.                 OpenFile();
  202. }
  203.  
  204.  
  205. void ex_bcppApp::OpenFile (const char *fileName)
  206. {
  207.      if (fileName)
  208.           lstrcpy(FileData.FileName, fileName);
  209.  
  210.      TEditFile *client = TYPESAFE_DOWNCAST(GetMainWindow()->GetClientWindow(), TEditFile);     // Client window for the frame.
  211.      client->ReplaceWith(FileData.FileName);
  212.      YRAddline("x_bcapp:Ouverture fichier");
  213.  
  214. }
  215.  
  216.  
  217. //////////////////////////////////////////////////////////
  218. // ex_bcppApp
  219. // =====
  220. // Menu File Close command
  221. void ex_bcppApp::CmFileClose ()
  222. {
  223.      CmFileNew();
  224. }
  225.  
  226.  
  227. //{{SDIDecFrame Implementation}}
  228.  
  229.  
  230. SDIDecFrame::SDIDecFrame (TWindow *parent, const char far *title, TWindow *clientWnd, BOOL trackMenuSelection, TModule *module)
  231.      : TDecoratedFrame(parent, title, clientWnd == 0 ? new TEditFile(0, 0, 0) : clientWnd, trackMenuSelection, module)
  232. {
  233.      // INSERT>> Your constructor code here.
  234.  
  235. }
  236.  
  237.  
  238. SDIDecFrame::~SDIDecFrame ()
  239. {
  240.      // INSERT>> Your destructor code here.
  241.  
  242. }
  243.  
  244.  
  245. //////////////////////////////////////////////////////////
  246. // ex_bcppApp
  247. // ===========
  248. // Menu Help About ex_bcpp.exe command
  249. void ex_bcppApp::CmHelpAbout ()
  250. {
  251.      //
  252.      // Show the modal dialog.
  253.      //
  254.      ex_aboutdlg(MainWindow).Execute();
  255.       YRAddline("x_bcapp:a propos...");
  256.  
  257. }
  258.  
  259.  
  260. int OwlMain (int , char* [])
  261. {
  262.      ex_bcppApp     App;
  263.      int             result;
  264.  
  265.      result = App.Run();
  266.  
  267.      return result;
  268. }
  269.