Создание редактора входных воздействий цифровых сигналов для САПР OrCad 9.1, страница 11

#include <Controls.hpp>

#include <StdCtrls.hpp>

#include <Forms.hpp>

#include <Buttons.hpp>

//---------------------------------------------------------------------------

class TNewBusform : public TForm

{

__published:  // IDE-managed Components

        TEdit *NameEd;

        TEdit *StartTimeEd;

        TLabel *Label1;

        TLabel *Label2;

        TLabel *Label3;

        TLabel *Label4;

        TSpeedButton *OKBtn;

        TEdit *InitValEd;

        void __fastcall OKBtnClick(TObject *Sender);

        void __fastcall FormActivate(TObject *Sender);

private:   // User declarations

public:           // User declarations

        __fastcall TNewBusform(TComponent* Owner);

};

//---------------------------------------------------------------------------

extern PACKAGE TNewBusform *NewBusform;

//---------------------------------------------------------------------------

#endif

newbus.cpp

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "newbus.h"

#include "newsig.h"

#include "main.h"

#include "newbasic.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TNewBusform *NewBusform;

//---------------------------------------------------------------------------

__fastcall TNewBusform::TNewBusform(TComponent* Owner)

        : TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TNewBusform::OKBtnClick(TObject *Sender)

{

  int error=0;

  if(NameEd->Text.AnsiPos(".")==0)

    error=1;

  try

  {

    StartTimeEd->Text.ToInt();

  }

  catch(const Exception &E)

  {

    error=2;

  }

  try

  {

    InitValEd->Text.ToInt();

  }

  catch(const Exception &E)

  {

    error=3;

  }

  if (!error)

  {

    StmForm->AddSignal(2);

    Close();

  }

  else

    NewBasicForm->err(error);

}

//---------------------------------------------------------------------------

void __fastcall TNewBusform::FormActivate(TObject *Sender)

{

  NewStimForm->Close();       

}

//---------------------------------------------------------------------------

newclock.h

//---------------------------------------------------------------------------

#ifndef newclockH

#define newclockH

//---------------------------------------------------------------------------

#include <Classes.hpp>

#include <Controls.hpp>

#include <StdCtrls.hpp>

#include <Forms.hpp>

#include <Buttons.hpp>

//---------------------------------------------------------------------------

class TNewClockForm : public TForm

{

__published:  // IDE-managed Components

        TEdit *NameEd;

        TLabel *Label1;

        TLabel *Label2;

        TLabel *Label3;

        TLabel *Label4;

        TSpeedButton *OKBtn;

        TComboBox *ValCB1;

        TComboBox *ValCB2;

        TLabel *Label5;

        TLabel *Label6;

        TEdit *T1Ed;

        TEdit *T2Ed;

        TLabel *Label7;

        void __fastcall FormActivate(TObject *Sender);

        void __fastcall OKBtnClick(TObject *Sender);

private:   // User declarations

public:           // User declarations

        __fastcall TNewClockForm(TComponent* Owner);

};

//---------------------------------------------------------------------------

extern PACKAGE TNewClockForm *NewClockForm;

//---------------------------------------------------------------------------

#endif

newclock.cpp

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "newclock.h"

#include "newsig.h"

#include "main.h"

#include "newbasic.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TNewClockForm *NewClockForm;

//---------------------------------------------------------------------------

__fastcall TNewClockForm::TNewClockForm(TComponent* Owner)

        : TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TNewClockForm::FormActivate(TObject *Sender)

{

  NewStimForm->Close();       

}

//---------------------------------------------------------------------------

void __fastcall TNewClockForm::OKBtnClick(TObject *Sender)

{

  int error=0;

  if(NameEd->Text.AnsiPos(".")==0)

    error=1;

  try

  {

    T1Ed->Text.ToInt();

    T2Ed->Text.ToInt();

  }

  catch(const Exception &E)

  {

    error=2;

  }

  if (!error)

  {

    StmForm->AddSignal(3);

    Close();

  }

  else

    NewBasicForm->err(error);

}

//---------------------------------------------------------------------------

about.h

//---------------------------------------------------------------------------

#ifndef aboutH

#define aboutH

//---------------------------------------------------------------------------

#include <Classes.hpp>

#include <Controls.hpp>

#include <StdCtrls.hpp>

#include <Forms.hpp>

#include <Buttons.hpp>

#include <ExtCtrls.hpp>

#include <Graphics.hpp>

//---------------------------------------------------------------------------

class TAboutForm : public TForm

{

__published:  // IDE-managed Components

        TListBox *ListBox1;

        TButton *Button1;

        TImage *Image1;

        void __fastcall Button1Click(TObject *Sender);

private:   // User declarations

public:           // User declarations

        __fastcall TAboutForm(TComponent* Owner);

};

extern PACKAGE TAboutForm *AboutForm;

#endif

about.cpp

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "about.h"

#pragma package(smart_init)

#pragma resource "*.dfm"

TAboutForm *AboutForm;

__fastcall TAboutForm::TAboutForm(TComponent* Owner)

        : TForm(Owner)

{

}

void __fastcall TAboutForm::Button1Click(TObject *Sender)

{

  Close();       

}