SRGraphView Class

class SRGraphView: public CView

Specialized view class for the display and management of SRGraph objects
This CView-based class simply adds graph feedback, data dragging, and data zooming to your graph and chart applications.

Defined in: GraphVw.h

Developer Notes

The classes for PageSetup, PageSetup2, and CSelectQuery are also in the files of this class.

Class Members

BOOL  m_bUseMaxArea

Set TRUE if the page should be limited in size during printing

int  m_nValign

Vertical alignment code for print pagination

int  m_nHalign

Horizontal alignment code for print pagination

int  m_nPageSizeCode

Code for selected page sizes

int  m_nPrintUnit

Unit for dimensions in PageSetup2 dialog: 0-cm, 1-inch

double  m_dXOffset

Horizontal margin for printing

double  m_dYOffset

Vertical margin for printing

double  m_dXSize

Horizontal chart size for printing

double  m_dYSize

Vertical chart size for printing

int  m_nPageCountX

Number of pages required to print chart in horizontal direction - internal

int  m_nPageCountY

Number of pages required to print chart in vertical direction - internal

SEC_UINT  m_TimerIdent

Mouse timer identifier

SRGraphTip  m_GraphTip

The single graph tip object

int  m_nUnzoomMinIndex

Original minimum index (used for unzooming data)

int  m_nUnzoomMaxIndex

Original maximum index (used for unzooming data)

int  m_nUnzoomMinGroup

Original minimum group (used for unzooming data)

int  m_nUnzoomMaxGroup

Original maximum group (used for unzooming data)

SRGraphComponent *  m_pZoomedDisplay

Pointer to the display which has been zoomed (used in restoration of the original state)

BOOL  m_bZoomed

TRUE if the graph has been zoomed (used to activate the unzoom menu command via the command update interface)

BOOL  m_bShowingTip

TRUE if a graph tip is currently on display

CPoint  m_SelectionPointA

First point in a selection area

CPoint  m_SelectionPointB

Last point in a selection area

BOOL  m_bSelecting

TRUE if the graph is in selection box mode

BOOL  m_bInFeedback

TRUE if the mouse point was clicked inside a feedback area (data dragging will commence)

int  m_nDragIndex

Index of the data item being dragged

int  m_nDragGroup

Group of the data item being dragged

BOOL  m_bDragging

TRUE if dragging is in progress

CPoint  m_MousePoint

Stored mouse position (used to ascertain if the mouse has rested still for the requisite 1.5 seconds)

BOOL  m_bMouseTimerIsRunning

TRUE if the mouse is considered to be "still" and the timeout is waiting to fire

BOOL  m_bZoomable

Flag to define the charts ability to be zoomed -- TRUE enables zooming

BOOL  m_bDragable

Flag which specifies whether data may be dragged

BOOL  m_bHasDocument

Flag to signify whether this view has a document

SRGDisplayBase *  m_pDragDisplay

Pointer to store the graph component

CHART_DECLARE_DYNCREATE(SRGraphView)

Constructor

virtual void  SetDragTips(BOOL v)

Set or resets the m_bDragTips flag

virtual BOOL  GetDragTips()

Return the m_bDragTips flag

virtual void  SetDragable(BOOL v)

Sets or resets the m_bDragable flag

virtual BOOL  GetDragable()

Returns the m_bDragable flag

virtual void  SetZoomable(BOOL v)

Sets or resets the flag signifying whether this chart is able to zoom

virtual BOOL  GetZoomable()

Returns the zoom enable flag

virtual void  DrawSelection(CPoint point)

Draws a selecting box

virtual void  DrawCustomSelection(CPoint point)

Override this function to draw your own selection styles

virtual void  MouseDrag(int nFlags,CPoint point)

Handles data dragging and selection box display

CGraphDoc*  GetDocument()

Returns the document for this view

virtual void  SetHasDocument(BOOL v)

Sets or resets the m_bHasDocument flag

virtual BOOL  GetHasDocument()

Returns the m_bHasDocument flag

inline void  SetUseMaxArea(BOOL b)

Enables or disables the use of the maximum size rectangle

virtual void  OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL)

Draws the graph

virtual void  OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL)

Sets window to viewport mapping

virtual BOOL  OnPreparePrinting(CPrintInfo* pInfo)

Prepares the print job

virtual void  OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)

Performs print pagination and outputs the graph to the printer

virtual void  OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)

Completes printing and terminates print mode

virtual void  DrawToBitmap(CDC* pDC, CBitmap& bmp)

Render the chart into the passed bitmap

virtual SRGraphPosition *  GetPosition(SRGraph *pGraph,CPoint point)

Returns a SRGraphPosition object in response to a mouse event -- override

virtual  ~SRGraphView()

Destructor

virtual void  AssertValid() const

Standard debug code

virtual void  Dump(CDumpContext& dc) const

Standard debug code

virtual SRGraph *  GetGraph()

Returns a pointer to the graph object which this view displays and interfaces to

virtual void  ShowFeedback(SRGraphFeedback *pFeedback)

Displays a feedback chart tip -- override

virtual void  SaveToFileAsDib(LPCTSTR lpszFileName)

Saves current view as a DIB file.

virtual void  SaveToFileAsJpeg(LPCTSTR lpszFileName)

Saves the current view's image as a JPEG

virtual void  GraphZoomout(BOOL bAlltheWay)

Helper function that implements the ZoomOut and ZoomOutAll features

BOOL  m_bDragTips

Semaphore for the draging tips

CObStack  m_ZoomStack

First-in last-out stack of zoomed states

CPalette  m_Palette

Color palette

DWORD  m_dwOldAlignment

Retains the old alignment codes during printing

CRect  m_OldAreaRect

Retains the old alignment rectangle during printing

BOOL  m_bPreserveArea

Set TRUE if the area should be restored after printing

afx_msg BOOL  OnEraseBkgnd(CDC* pDC)

Does nothing

afx_msg void  OnMouseMove(UINT nFlags, CPoint point)

Handles mouse movement and chart tip triggering

afx_msg void  OnLButtonDown(UINT nFlags, CPoint point)

Handles mouse button press

afx_msg void  OnLButtonUp(UINT nFlags, CPoint point)

Handles mouse button release

afx_msg void  OnTimer(SEC_UINT nIDEvent)

Checks to see if a chart tip is needed

afx_msg void  OnEditCopy()

Copies the image to the clipboard

afx_msg void  OnGraphZoomout()

Returns zoomed graph to previous size

afx_msg void  OnUpdateGraphZoomout(CCmdUI* pCmdUI)

Activates or deactivates the zoom out button and menu items

afx_msg void  OnGraphZoomoutAll()

Returns zoomed graph to normal, unzoomed state

afx_msg void  OnUpdateGraphZoomoutAll(CCmdUI* pCmdUI)

Activates or deactivates the Zoom Out All button and menu items

afx_msg void  OnGraphPagesetup()

Runs a simple pagination dialog

afx_msg void  OnGraphEdit()

Edits a graph using the Graph Explorer

afx_msg void  OnSaveAsDib()

Message handler for the Save As DIB menu item

afx_msg void  OnSaveAsJpeg()

Message handler for the Save As JPEG menu item

afx_msg void  OnGraphWizard()

Invokes the chart wizard

afx_msg int  OnCreate( LPCREATESTRUCT lpCreateStruct )

Creation initialization

afx_msg BOOL  OnQueryNewPalette()

Palette management

afx_msg void  OnPaletteChanged(CWnd* pFocusWnd)

Palette management