// Matt Streeter
// 2/27/00
// HEREDITY.H
// Header for class THeredityWindow; base class for TGenerationWindow and
// TFamilyTreeWindow.
// Copyright Matt Streeter, 2000. All rights reserved
#ifndef __HEREDITY_H__
#define __HEREDITY_H__
#include "Chrom.hpp"
#include "eswindow.h"
#include "network.h"
#include "types.h"
#include "matrix.h"
#include <owl\button.h>
struct TGeneration
{
Chromosome *pSurvivors,*pDead;
int iSurvivors,iDead;
TGeneration *pNext;
};
struct TNetworkRect
{
Chromosome *pChromosome;
int x,y;
};
enum ZoomFactor {
ZOOM_25_PERCENT=1,
ZOOM_50_PERCENT,
ZOOM_100_PERCENT,
ZOOM_200_PERCENT,
ZOOM_400_PERCENT,
ZOOM_800_PERCENT,
ZOOM_CUSTOM,
};
class THeredityWindow: public TESWindow
{
public:
THeredityWindow(TWindow *pParent,char *pTitle,TGeneration *pGenerationList,
Network *pNetwork,double dMaxWeight,Parameter *pParam);
static TColor mParentHighlightColor;
static TColor mSelectedHighlightColor;
static TColor mBoxColor;
protected:
TMatrixView mMatrix;
ZoomFactor mZoom;
TGeneration *mpGenerationList;
Network *mpNetwork;
double mdMaxWeight;
TNetworkRect *mpNetworkRects;
int miNetworkRects;
int miSelectedNetwork;
TWindow *mpParent;
Parameter *mpParam;
void DrawHighlight(int iNetwork,TColor& Color);
int FindNetworkRect(TPoint& point);
int FindNetworkRect(int iGeneration,int iIndex);
int SetZoomFactor(ZoomFactor Zoom);
void CmViewFamilyTree();
void CmEditNetwork();
void CeViewFamilyTree(TCommandEnabler& ce);
void CeEditNetwork(TCommandEnabler& ce);
void CmZoom25Percent();
void CmZoom50Percent();
void CmZoom100Percent();
void CmZoom200Percent();
void CmZoom400Percent();
void CmZoom800Percent();
void CmZoomCustom();
void CeZoom25Percent(TCommandEnabler& ce);
void CeZoom50Percent(TCommandEnabler& ce);
void CeZoom100Percent(TCommandEnabler& ce);
void CeZoom200Percent(TCommandEnabler& ce);
void CeZoom400Percent(TCommandEnabler& ce);
void CeZoom800Percent(TCommandEnabler& ce);
void CeZoomCustom(TCommandEnabler& ce);
DECLARE_RESPONSE_TABLE(THeredityWindow);
};
// useful macros for extracting information from TScroller
#define X_SCROLL_OFFSET (Scroller?(int(Scroller->XPos*Scroller->XUnit)):0)
#define Y_SCROLL_OFFSET (Scroller?(int(Scroller->YPos*Scroller->YUnit)):0)
// The number of pixels used in each square of the compact matrix display,
// when zoomed at 100%.
#define BASE_PIXELS_PER_WEIGHT 4
#endif