//----------------------------------------------------------------------------//
//    module: FVarTypes.h                                                     //
//                                                                            //
//    Dialog (form to be shown with ShowModal()) to show and edit the         //
//    variable types. Symbolic variables can be toggled between nominal       //
//    and nominal (symbolic) type. Additional information like extrema,       //
//    # symbols etc. is displayed for each variable.                          //
//                                                                            //                                                                            //
//    copyright (c) 2003 by Lars Haendel                                      //
//    home: www.newty.de                                                      //
//                                                                            //
//    This program is free software; you can redistribute it and/or modify    //
//    it under the terms of the GNU General Public License as published by    //
//    the Free Software Foundation as version 2 of the License.               //
//                                                                            //
//    This program is distributed in the hope that it will be useful,         //
//    but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
//    GNU General Public License for more details.                            //
//                                                                            //
//    You should have received a copy of the GNU General Public License       //
//    along with this program; if not, write to the Free Software             //
//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               //
//                                                                            //
//----------------------------------------------------------------------------//


#ifndef FVarTypesH
#define FVarTypesH

#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Grids.hpp>


//---------------------------------------------------------------------------
#include "data.h"          // due to:     TData
#include "ProjectG.h"      //             TProjectG
#include "FMain.h"         //             TFMain
#include <Buttons.hpp>

//----------------------------------------------------------------------------------------------------------------------
class TFVarTypes : public TForm
{
__published:
   TGroupBox *GbSpeed;
   TStringGrid *StringGrid;
   TCheckBox *CbNominal;
   TBitBtn *BtOk;
   TCheckBox *CbContinous;
   void __fastcall StringGridClick(TObject *Sender);
   void __fastcall FormShow(TObject *Sender);
   void __fastcall StringGridSelectCell(TObject *Sender, int ACol, int ARow, bool &CanSelect);
   void __fastcall CbNominalClick(TObject *Sender);
   void __fastcall StringGridDrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State);
   void __fastcall FormResize(TObject *Sender);
   void __fastcall BtOkClick(TObject *Sender);
   void __fastcall CbContinousClick(TObject *Sender);
   void __fastcall FormClose(TObject *Sender, TCloseAction &Action);

private:
   TData* data;     // (learn) data object, used to get variable information like extrema, # symbols and variable types
                    // not const because this dialog is used to change variable types
   TFMain* main;    // main (parent) form
   TProjectG* prj;

   void VarTypesToStringGrid();  // write all variable types to string grid
   bool EvVarTypes();            // if all symbolic variables are either nominal or ordinal: check corresponding check box
   void CorrectSelection();

public:
   __fastcall TFVarTypes(TComponent* Owner) : TForm(Owner) { data = NULL; };          // constructor
   void Associate(TData*const& _data, TProjectG*const& _prj, TFMain*const& _main){ data =_data; prj=_prj; main=_main; };        // set (learn) data
};
extern PACKAGE TFVarTypes *FVarTypes;
#endif