// $Source: /usr/local/SimSoft/Sfx3D/src/gts/gtspal.h,v $
// $Revision: 1.2 $
// $Author: baum $
// $Date: 2001/11/29 15:18:10 $
//
// Login name of the user who locked the revision
// $Locker:  $
// Tag name used to checkout the file
// $Name: Release-14 $
// State assigned to revision
// $State: Exp $
//
//
// $Log: gtspal.h,v $
// Revision 1.2  2001/11/29 15:18:10  baum
// -Realzeitsteuerung eingebaut
// -Handsteuerung eingebaut
//

#ifndef _GTSPAL_H
#define _GTSPAL_H     1

#include "List.h"
#include "gtsglob.h"
#include "gtsgraf.h"
#include "gtsbst.h"

//==================================================================
//		Definition
//		for class Variante
//==================================================================

class Variante {
  public:
    Variante  (const unsigned typ, const unsigned variante);
    ~Variante ();

    bool gelesen () const { return ObjGelesen; };
    void read (InputFile& fin);

    void setName (const char *name);
    void setName (const Ustring& name);

    unsigned getTyp       () const;
    unsigned getVariante  () const;

    const Ustring& getName    () const;
    const DynArray<Pattern> Konturen () const;

  private:
    Ustring     ObjName;
    unsigned    ObjTyp;
    unsigned    ObjVariante;
    Angle       ObjFlusswinkel;
    DynArray<Pattern> ObjKonturen;
    bool        ObjGelesen;
    

    // NOT und VOID*-Operatoren
    bool operator ! () const;
    operator void*  () const;
    
    // both declared, but not defined
    Variante (const Variante& bv);
    const Variante& operator = (const Variante& bv);

    void readKontur   (InputFile& fin);

    static Attribute* ClassPermAttribute;
    static Attribute* findAttribute (const float& r, const float& g, const float& b);
};

//==================================================================
//		Definition
//		for class Basis
//==================================================================

class Basis {
  public:
    Basis  (unsigned typ);
    ~Basis ();

    void read (InputFile *fin, const unsigned beginSatz, const unsigned variantSatz);
    void append (const Variante& newVariante);

    Variante* findVariante      (const unsigned variante) const;
    void AusgabeInhaltsverzeichnis ();

    void  setName (const char *name);
    void  setName (const Ustring& name);

    unsigned       getTyp  () const;
    const Ustring& getName () const;

  private:
    Ustring  ObjName;
    unsigned ObjTyp;
    List<Variante> ObjVariantListe;

    // both declared, but not defined
    Basis (const Basis& bv);
    const Basis& operator = (const Basis& bv);
};  // ENDE Basis

//==================================================================
//		Definition
//		for class Bibliothek
//==================================================================

class Bibliothek {
   public:
      Bibliothek (Ustring name);
      ~Bibliothek ();
      void Oeffnen    ();
      void Schliessen ();
      Variante *findObject (const unsigned btyp, const unsigned vtyp);
      bool leseObject (const unsigned btyp, const unsigned vtyp);
      unsigned  getTypOffset()    { return ObjTypOffset;    };
      unsigned  getTypMulti()     { return ObjTypMulti;     };
      unsigned  getVarMulti()     { return ObjVarMulti;     };
      unsigned  getSegOffset()    { return ObjSegOffset;    };
      unsigned  getNumPosOffset() { return ObjNumPosOffset; };
      unsigned  getTextOffset()   { return ObjTextOffset;   };
      unsigned  getInfo3Offset()  { return ObjInfo3Offset;  };
      Ustring   getPalettenInfos  (const int ptyp = -1);
      
   private:
      void leseBasisNamen ();
      void leseInhaltverzeichnis ();
      void erzeugeInhaltsverzeichnis (const unsigned Btyp, const unsigned Vtyp);
      void setVarianteInListe (Basis &zhilfe, 
                               const unsigned btyp, const unsigned vtyp);

      void EndeGliedern (Basis &Z) { BasisListe.append(Z); };
      Basis *Letztes () { return BasisListe.Last(); };

      void leseOffset (void);
      LCursor<Basis> isObjectInListe (const unsigned btyp);
      void AusgabeInhaltsverzeichnis ();
      
      InputFile *fbib;
      Ustring   DatName;
      unsigned  ObjTypOffset;
      unsigned  ObjTypMulti;
      unsigned  ObjVarMulti;
      unsigned  ObjSegOffset;
      unsigned  ObjNumPosOffset;
      unsigned  ObjSymPosOffset;
      unsigned  ObjInfo1Offset;
      unsigned  ObjInfo2Offset;
      unsigned  ObjInfo3Offset;
      unsigned  ObjTextOffset;
      List<Basis> BasisListe;
};  // ENDE Bibliothek

#endif /* _GTSPAL_H */
