//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "RichView.hpp"
#include "RVEdit.hpp"
#include "RVScroll.hpp"
#include "RVStyle.hpp"
#include "SVFontCombos.hpp"
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <Dialogs.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
    TPanel *Panel1;
    TSpeedButton *btnBold;
    TSpeedButton *btnItalic;
    TSpeedButton *btnUnderline;
    TSpeedButton *btnFont;
    TSpeedButton *btnLeft;
    TSpeedButton *btnCenter;
    TSpeedButton *btnRight;
    TSpeedButton *btnJustify;
    TSpeedButton *btnOpen;
    TSpeedButton *btnSave;
    TSpeedButton *btnSaveAs;
    TSpeedButton *btnNew;
    TLabel *Label1;
    TLabel *Label2;
    TLabel *Label3;
    TComboBox *cmbFont;
    TComboBox *cmbTextStyles;
    TFontSizeComboBox *cmbFontSize;
    TStatusBar *StatusBar1;
    TRichViewEdit *rve;
    TRVStyle *rvs;
    TMainMenu *MainMenu1;
    TMenuItem *File1;
    TMenuItem *mitNew;
    TMenuItem *mitOpen;
    TMenuItem *mitSave;
    TMenuItem *mitSaveAs;
    TMenuItem *N1;
    TMenuItem *mitExit;
    TMenuItem *Edit1;
    TMenuItem *mitUndo;
    TMenuItem *mitRedo;
    TMenuItem *N2;
    TMenuItem *mitCut;
    TMenuItem *mitCopy;
    TMenuItem *mitPaste;
    TMenuItem *mitDelete;
    TMenuItem *Format1;
    TMenuItem *mitBold;
    TMenuItem *mitItalic;
    TMenuItem *mitUnderline;
    TMenuItem *N3;
    TMenuItem *mitFont;
    TOpenDialog *od;
    TSaveDialog *sd;
    TFontDialog *fd;
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall mitNewClick(TObject *Sender);
    void __fastcall mitOpenClick(TObject *Sender);
    void __fastcall mitSaveClick(TObject *Sender);
    void __fastcall mitSaveAsClick(TObject *Sender);
    void __fastcall mitExitClick(TObject *Sender);
    void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
    void __fastcall mitUndoClick(TObject *Sender);
    void __fastcall mitRedoClick(TObject *Sender);
    void __fastcall mitCutClick(TObject *Sender);
    void __fastcall mitCopyClick(TObject *Sender);
    void __fastcall mitPasteClick(TObject *Sender);
    void __fastcall mitDeleteClick(TObject *Sender);
    void __fastcall mitBoldClick(TObject *Sender);
    void __fastcall mitItalicClick(TObject *Sender);
    void __fastcall mitUnderlineClick(TObject *Sender);
    void __fastcall mitFontClick(TObject *Sender);
    void __fastcall rveChange(TObject *Sender);
    void __fastcall rveCurTextStyleChanged(TObject *Sender);
    void __fastcall rveCurParaStyleChanged(TObject *Sender);
    void __fastcall cmbTextStylesClick(TObject *Sender);
    
    void __fastcall cmbFontClick(TObject *Sender);
    void __fastcall cmbFontSizeClick(TObject *Sender);
    
    void __fastcall rveStyleConversion(TCustomRichViewEdit *Sender,
          int StyleNo, int UserData, bool AppliedToText, int &NewStyleNo);
    void __fastcall btnApplyPara(TObject *Sender);
    void __fastcall cmbFontSizeKeyPress(TObject *Sender, char &Key);
    void __fastcall cmbFontSizeExit(TObject *Sender);
private:	// User declarations
    bool Modified;
    AnsiString FileName, FontName;
    bool IgnoreChanges;
    int FontSize;
    bool SaveIfNeeded();
    bool Save();
    bool SaveAs();
    void Open();
    void New();
    void UpdateFontButtons();
public:		// User declarations
    __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
