//----------------------------------------------------------------------------//
//    module: FOptions.cpp                                                    //
//                                                                            //
//    Options dialog: Set those parameters of the PNC2 algorithm, that are    //
//    not tuned within the parameter tuning.                                  //
//                                                                            //
//    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 optionsH
#define optionsH

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

#include "projectG.h"

//----------------------------------------------------------------------------------------------------------------------
class TFOptions : public TForm
{
__published:
   TBitBtn *BtOk;
   TBitBtn *BtDefaults;
   TBitBtn *BtSave;
   TLabel *LaGroupSize;
   TEdit *EGroupSize;
   TBitBtn *BtGroupSizeDown;
   TBitBtn *BtGroupSizeUp;
   TGroupBox *GbNormalization;
   TLabel *LaOverlapFac;
   TBitBtn *BtOverlapFacDown;
   TBitBtn *BtOverlapFacUp;
   TEdit *EOverlapFac;
   TRadioGroup *RadioGroup2;
   TGroupBox *GbDiscretization;
   TLabel *LaBins;
   TEdit *EBins;
   TBitBtn *BtBinsDown;
   TBitBtn *BtBinsUp;
   TRadioGroup *RgDiscretization;
   TRadioButton *RbRange;
   TRadioButton *RbDeviation;
   TRadioButton *RbEqualFrequency;
   TRadioButton *RbEqualWidth;
   TBitBtn *BtLoad;
   TLabel *LaOverlapFac2;
   TLabel *LaExplanation1;
   TLabel *LaExplanation2;
   void __fastcall BtGroupSizeUpClick(TObject *Sender);
   void __fastcall BtBinsUpClick(TObject *Sender);
   void __fastcall BtBinsDownClick(TObject *Sender);
   void __fastcall EBinsKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
   void __fastcall EBinsExit(TObject *Sender);
   void __fastcall FormShow(TObject *Sender);
   void __fastcall BtGroupSizeDownClick(TObject *Sender);
   void __fastcall EGroupSizeKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
   void __fastcall EGroupSizeExit(TObject *Sender);
   void __fastcall BtOverlapFacUpClick(TObject *Sender);
   void __fastcall BtOverlapFacDownClick(TObject *Sender);
   void __fastcall EOverlapFacExit(TObject *Sender);
   void __fastcall EOverlapFacKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
   void __fastcall BtOkClick(TObject *Sender);
   void __fastcall BtSaveClick(TObject *Sender);
   void __fastcall RbRangeClick(TObject *Sender);
   void __fastcall RbEqualFrequencyClick(TObject *Sender);
   void __fastcall RbDeviationClick(TObject *Sender);
   void __fastcall RbEqualWidthClick(TObject *Sender);
   void __fastcall BtLoadClick(TObject *Sender);
   void __fastcall BtDefaultsClick(TObject *Sender);
   void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:

   TProjectG* prj;                              // associated project

   void Set_N_Bins(const int& N_Bins);          // set parameter in project and write back to GUI
   void Set_N_G_Max(const int& N_G_Max);
   void SetOverlapFac(const float& fac);
   void SetNormalizeByRange(const bool& f_Set);
   void SetEqualWidth(const bool& f_Set);

   void OverlapFacToGUI();

   bool f_SomethingChanged;                     // flag indicates that something has changed
   void SomeThingChanged();

public:

   __fastcall TFOptions(TComponent* Owner);

   void SetProject(TProjectG* _prj) { prj = _prj; };
   const bool& SomethingChanged() const { return f_SomethingChanged; };
};
extern PACKAGE TFOptions *FOptions;
#endif