2009-02-22 21:32:27 +00:00
|
|
|
/**********************
|
2009-11-23 20:18:47 +00:00
|
|
|
* class_base_screen.h
|
2009-02-22 21:32:27 +00:00
|
|
|
**********************/
|
|
|
|
|
|
|
|
/* define :
|
|
|
|
* class BASE_SCREEN to handle how to draw a screen (a board, a schematic ...)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CLASS_BASE_SCREEN_H__
|
|
|
|
#define __CLASS_BASE_SCREEN_H__
|
|
|
|
|
|
|
|
#include "base_struct.h"
|
2009-07-23 15:37:00 +00:00
|
|
|
#include "class_undoredo_container.h"
|
2009-07-25 04:53:39 +00:00
|
|
|
#include "block_commande.h"
|
2010-07-12 14:07:09 +00:00
|
|
|
#include "common.h"
|
2009-02-22 21:32:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Forward declarations:
|
|
|
|
class Ki_PageDescr;
|
|
|
|
|
|
|
|
|
|
|
|
/* Simple class for handling grid arrays. */
|
|
|
|
class GRID_TYPE
|
|
|
|
{
|
|
|
|
public:
|
2009-07-25 04:53:39 +00:00
|
|
|
int m_Id;
|
2009-02-22 21:32:27 +00:00
|
|
|
wxRealPoint m_Size;
|
2009-10-14 19:43:31 +00:00
|
|
|
|
|
|
|
GRID_TYPE& operator=( const GRID_TYPE& item )
|
|
|
|
{
|
|
|
|
if( this != &item )
|
|
|
|
{
|
2009-11-23 20:18:47 +00:00
|
|
|
m_Id = item.m_Id;
|
2009-10-14 19:43:31 +00:00
|
|
|
m_Size = item.m_Size;
|
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
const bool operator==( const GRID_TYPE& item ) const
|
|
|
|
{
|
2009-11-23 20:18:47 +00:00
|
|
|
return m_Size == item.m_Size && m_Id == item.m_Id;
|
2009-10-14 19:43:31 +00:00
|
|
|
}
|
2009-02-22 21:32:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
typedef std::vector< GRID_TYPE > GRIDS;
|
2009-02-22 21:32:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/
|
|
|
|
/* Class to handle how to draw a screen (a board, a schematic ...) */
|
|
|
|
/*******************************************************************/
|
2010-12-08 20:12:46 +00:00
|
|
|
class BASE_SCREEN : public EDA_ITEM
|
2009-02-22 21:32:27 +00:00
|
|
|
{
|
2010-11-03 14:13:15 +00:00
|
|
|
EDA_ITEMS m_items; ///< The drawing items associated with this screen.
|
2010-12-08 20:12:46 +00:00
|
|
|
GRIDS m_grids; ///< List of valid grid sizes.
|
2010-12-13 15:59:00 +00:00
|
|
|
EDA_ITEM* m_drawList; ///< Object list for the screen.
|
2011-01-20 16:34:57 +00:00
|
|
|
wxString m_fileName; ///< File used to load the screen.
|
2011-02-02 19:01:21 +00:00
|
|
|
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
|
|
|
|
char m_FlagModified; ///< Indicates current drawing has been modified.
|
|
|
|
char m_FlagSave; ///< Indicates automatic file save.
|
|
|
|
EDA_ITEM* m_CurrentItem; ///< Currently selected object
|
|
|
|
GRID_TYPE m_Grid; ///< Current grid selection.
|
2011-02-11 20:48:13 +00:00
|
|
|
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
|
2011-02-21 13:54:29 +00:00
|
|
|
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
|
2011-02-11 20:48:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The cross hair position in logical (drawing) units. The cross hair is not the cursor
|
|
|
|
* position. It is an addition indicator typically drawn on grid to indicate to the
|
|
|
|
* user where the current action will be performed.
|
|
|
|
*/
|
|
|
|
wxPoint m_crossHairPosition;
|
2010-11-03 14:13:15 +00:00
|
|
|
|
2009-02-22 21:32:27 +00:00
|
|
|
public:
|
2010-11-03 14:13:15 +00:00
|
|
|
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
|
2011-02-02 19:01:21 +00:00
|
|
|
* in user units. (coordinates from last reset position)*/
|
|
|
|
|
2010-02-14 18:14:33 +00:00
|
|
|
// Scrollbars management:
|
|
|
|
int m_ScrollPixelsPerUnitX; /* Pixels per scroll unit in the horizontal direction. */
|
|
|
|
int m_ScrollPixelsPerUnitY; /* Pixels per scroll unit in the vertical direction. */
|
2011-02-02 19:01:21 +00:00
|
|
|
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units.
|
|
|
|
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
|
|
|
|
* virtual draw area size in pixels */
|
|
|
|
wxPoint m_ScrollbarPos; /* Current scroll bar position in scroll units. */
|
|
|
|
|
|
|
|
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
|
|
|
|
* view position (upper left corner of device)
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool m_Center; /* Center on screen. If TRUE (0.0) is centered
|
|
|
|
* on screen coordinates can be < 0 and
|
|
|
|
* > 0 except for schematics.
|
|
|
|
* FALSE: when coordinates can only be >= 0
|
|
|
|
* Schematic */
|
2009-11-23 20:18:47 +00:00
|
|
|
bool m_FirstRedraw;
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2009-07-23 15:37:00 +00:00
|
|
|
// Undo/redo list of commands
|
2011-02-02 19:01:21 +00:00
|
|
|
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
|
|
|
|
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
|
|
|
|
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
|
2009-02-22 21:32:27 +00:00
|
|
|
|
|
|
|
/* block control */
|
2011-02-02 19:01:21 +00:00
|
|
|
BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
|
2009-02-22 21:32:27 +00:00
|
|
|
|
|
|
|
/* Page description */
|
2009-07-25 04:53:39 +00:00
|
|
|
Ki_PageDescr* m_CurrentSheetDesc;
|
2009-11-23 20:18:47 +00:00
|
|
|
int m_ScreenNumber;
|
|
|
|
int m_NumberOfScreen;
|
|
|
|
|
|
|
|
wxString m_Title;
|
|
|
|
wxString m_Date;
|
|
|
|
wxString m_Revision;
|
|
|
|
wxString m_Company;
|
|
|
|
wxString m_Commentaire1;
|
|
|
|
wxString m_Commentaire2;
|
|
|
|
wxString m_Commentaire3;
|
|
|
|
wxString m_Commentaire4;
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
/* Grid and zoom values. */
|
2010-07-13 10:42:32 +00:00
|
|
|
wxPoint m_GridOrigin;
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2011-07-05 12:46:14 +00:00
|
|
|
wxArrayDouble m_ZoomList; /* Array of standard zoom (i.e. scale) coefficients. */
|
|
|
|
double m_Zoom; /* Current zoom coefficient. */
|
2009-11-23 20:18:47 +00:00
|
|
|
bool m_IsPrinting;
|
2009-02-22 21:32:27 +00:00
|
|
|
|
|
|
|
public:
|
2011-10-01 19:24:27 +00:00
|
|
|
BASE_SCREEN( KICAD_T aType = SCREEN_T );
|
2009-02-22 21:32:27 +00:00
|
|
|
~BASE_SCREEN();
|
|
|
|
|
|
|
|
/**
|
2011-09-20 13:57:40 +00:00
|
|
|
* Function SetCurItem
|
2009-02-22 21:32:27 +00:00
|
|
|
* sets the currently selected object, m_CurrentItem.
|
2011-03-03 19:55:44 +00:00
|
|
|
* @param aItem Any object derived from EDA_ITEM
|
2010-12-08 20:12:46 +00:00
|
|
|
*/
|
2011-03-03 19:55:44 +00:00
|
|
|
void SetCurItem( EDA_ITEM* aItem ) { m_CurrentItem = aItem; }
|
2011-09-20 13:57:40 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* GetCurItem() const { return m_CurrentItem; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetDrawItems().
|
|
|
|
*
|
|
|
|
* @return - A pointer to the first item in the linked list of draw items.
|
2009-02-22 21:32:27 +00:00
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
virtual EDA_ITEM* GetDrawItems() const { return m_drawList; }
|
|
|
|
|
|
|
|
virtual void SetDrawItems( EDA_ITEM* aItem ) { m_drawList = aItem; }
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
void InitDatas();
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
|
|
|
|
|
|
|
|
wxString GetFileName() const { return m_fileName; }
|
|
|
|
|
2010-03-19 20:15:30 +00:00
|
|
|
void SetPageSize( wxSize& aPageSize );
|
2009-11-23 20:18:47 +00:00
|
|
|
wxSize ReturnPageSize( void );
|
|
|
|
virtual int GetInternalUnits( void );
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
/**
|
2011-02-11 20:48:13 +00:00
|
|
|
* Function GetCrossHairPosition
|
|
|
|
* return the current cross hair position in logical (drawing) coordinates.
|
|
|
|
* @param aInvertY Inverts the Y axis position.
|
|
|
|
* @return The cross hair position in drawing coordinates.
|
|
|
|
*/
|
|
|
|
wxPoint GetCrossHairPosition( bool aInvertY = false ) const
|
|
|
|
{
|
|
|
|
if( aInvertY )
|
|
|
|
return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y );
|
|
|
|
|
|
|
|
return wxPoint( m_crossHairPosition.x, m_crossHairPosition.y );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCrossHairPosition
|
|
|
|
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
|
|
|
|
* @param aPosition The new cross hair position.
|
|
|
|
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
|
|
|
|
* \a aPosition.
|
2010-10-20 20:24:26 +00:00
|
|
|
*
|
|
|
|
*/
|
2011-02-11 20:48:13 +00:00
|
|
|
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
|
2010-10-20 20:24:26 +00:00
|
|
|
|
2009-02-22 21:32:27 +00:00
|
|
|
/* general Undo/Redo command control */
|
2009-07-29 13:10:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function ClearUndoORRedoList (virtual).
|
2009-07-29 13:10:36 +00:00
|
|
|
* this function must remove the aItemCount old commands from aList
|
2009-10-14 19:43:31 +00:00
|
|
|
* and delete commands, pickers and picked items if needed
|
2009-11-23 20:18:47 +00:00
|
|
|
* Because picked items must be deleted only if they are not in use, this
|
|
|
|
* is a virtual pure function that must be created for SCH_SCREEN and
|
|
|
|
* PCB_SCREEN
|
2009-07-29 13:10:36 +00:00
|
|
|
* @param aList = the UNDO_REDO_CONTAINER of commands
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aItemCount = number of old commands to delete. -1 to remove all
|
|
|
|
* old commands this will empty the list of commands.
|
2009-07-29 13:10:36 +00:00
|
|
|
* Commands are deleted from the older to the last.
|
|
|
|
*/
|
2010-10-20 20:24:26 +00:00
|
|
|
virtual void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 ) = 0;
|
2009-07-29 13:10:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function ClearUndoRedoList
|
2009-07-29 13:10:36 +00:00
|
|
|
* clear undo and redo list, using ClearUndoORRedoList()
|
2009-11-23 20:18:47 +00:00
|
|
|
* picked items are deleted by ClearUndoORRedoList() according to their
|
|
|
|
* status
|
2009-07-29 13:10:36 +00:00
|
|
|
*/
|
2009-07-25 04:53:39 +00:00
|
|
|
virtual void ClearUndoRedoList();
|
2009-07-29 13:10:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function PushCommandToUndoList
|
2009-07-29 13:10:36 +00:00
|
|
|
* add a command to undo in undo list
|
2009-11-23 20:18:47 +00:00
|
|
|
* delete the very old commands when the max count of undo commands is
|
|
|
|
* reached
|
2009-07-29 13:10:36 +00:00
|
|
|
* ( using ClearUndoORRedoList)
|
|
|
|
*/
|
2009-07-25 04:53:39 +00:00
|
|
|
virtual void PushCommandToUndoList( PICKED_ITEMS_LIST* aItem );
|
2009-07-29 13:10:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function PushCommandToRedoList
|
2009-07-29 13:10:36 +00:00
|
|
|
* add a command to redo in redo list
|
2009-11-23 20:18:47 +00:00
|
|
|
* delete the very old commands when the max count of redo commands is
|
|
|
|
* reached
|
2009-07-29 13:10:36 +00:00
|
|
|
* ( using ClearUndoORRedoList)
|
|
|
|
*/
|
2009-07-25 04:53:39 +00:00
|
|
|
virtual void PushCommandToRedoList( PICKED_ITEMS_LIST* aItem );
|
2009-07-29 13:10:36 +00:00
|
|
|
|
|
|
|
/** PopCommandFromUndoList
|
|
|
|
* return the last command to undo and remove it from list
|
|
|
|
* nothing is deleted.
|
|
|
|
*/
|
2009-07-23 15:37:00 +00:00
|
|
|
virtual PICKED_ITEMS_LIST* PopCommandFromUndoList();
|
2009-07-29 13:10:36 +00:00
|
|
|
|
|
|
|
/** PopCommandFromRedoList
|
|
|
|
* return the last command to undo and remove it from list
|
|
|
|
* nothing is deleted.
|
|
|
|
*/
|
2009-07-23 15:37:00 +00:00
|
|
|
virtual PICKED_ITEMS_LIST* PopCommandFromRedoList();
|
2009-07-25 04:53:39 +00:00
|
|
|
|
|
|
|
int GetUndoCommandCount()
|
2009-07-23 15:37:00 +00:00
|
|
|
{
|
|
|
|
return m_UndoList.m_CommandsList.size();
|
|
|
|
}
|
2009-07-25 04:53:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
int GetRedoCommandCount()
|
2009-07-23 15:37:00 +00:00
|
|
|
{
|
|
|
|
return m_RedoList.m_CommandsList.size();
|
|
|
|
}
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
|
2009-02-22 21:32:27 +00:00
|
|
|
void SetModify() { m_FlagModified = 1; m_FlagSave = 0; }
|
|
|
|
void ClrModify() { m_FlagModified = 0; m_FlagSave = 1; }
|
|
|
|
void SetSave() { m_FlagSave = 1; }
|
|
|
|
void ClrSave() { m_FlagSave = 0; }
|
|
|
|
int IsModify() { return m_FlagModified & 1; }
|
|
|
|
int IsSave() { return m_FlagSave & 1; }
|
|
|
|
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
//----<zoom stuff>---------------------------------------------------------
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetScalingFactor
|
2009-02-22 21:32:27 +00:00
|
|
|
* @return the the current scale used to draw items on screen
|
|
|
|
* draw coordinates are user coordinates * GetScalingFactor( )
|
|
|
|
*/
|
2011-04-01 17:10:16 +00:00
|
|
|
double GetScalingFactor() const;
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetScalingFactor
|
2010-12-28 11:24:42 +00:00
|
|
|
* @param aScale = the the current scale used to draw items on screen
|
2009-02-22 21:32:27 +00:00
|
|
|
* draw coordinates are user coordinates * GetScalingFactor( )
|
|
|
|
*/
|
2009-07-25 04:53:39 +00:00
|
|
|
void SetScalingFactor( double aScale );
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetZoom
|
2009-02-22 21:32:27 +00:00
|
|
|
* @return the current zoom factor
|
|
|
|
* Note: the zoom factor is NOT the scaling factor
|
|
|
|
* the scaling factor is m_ZoomScalar * GetZoom()
|
|
|
|
*/
|
2011-07-05 12:46:14 +00:00
|
|
|
double GetZoom() const;
|
2009-02-22 21:32:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetZoom
|
|
|
|
* adjusts the current zoom factor
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param coeff - Zoom coefficient.
|
2009-02-22 21:32:27 +00:00
|
|
|
*/
|
2011-07-05 12:46:14 +00:00
|
|
|
bool SetZoom( double coeff );
|
2009-02-22 21:32:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetZoomList
|
|
|
|
* sets the list of zoom factors.
|
2010-11-03 14:13:15 +00:00
|
|
|
* @param aZoomList An array of zoom factors in ascending order, zero terminated
|
2009-02-22 21:32:27 +00:00
|
|
|
*/
|
2011-07-05 12:46:14 +00:00
|
|
|
void SetZoomList( const wxArrayDouble& aZoomList );
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
bool SetNextZoom();
|
|
|
|
bool SetPreviousZoom();
|
|
|
|
bool SetFirstZoom();
|
|
|
|
bool SetLastZoom();
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
//----<grid stuff>----------------------------------------------------------
|
2009-10-14 19:43:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the command ID of the currently selected grid.
|
|
|
|
*
|
|
|
|
* @return int - Currently selected grid command ID.
|
|
|
|
*/
|
|
|
|
int GetGridId();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the grid size of the currently selected grid.
|
|
|
|
*
|
|
|
|
* @return wxRealPoint - The currently selected grid size.
|
|
|
|
*/
|
|
|
|
wxRealPoint GetGridSize();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the grid object of the currently selected grid.
|
|
|
|
*
|
|
|
|
* @return GRID_TYPE - The currently selected grid.
|
|
|
|
*/
|
|
|
|
GRID_TYPE GetGrid();
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
const wxPoint& GetGridOrigin();
|
2009-07-25 04:53:39 +00:00
|
|
|
void SetGrid( const wxRealPoint& size );
|
2009-10-14 19:43:31 +00:00
|
|
|
void SetGrid( int id );
|
2010-12-08 20:12:46 +00:00
|
|
|
void SetGridList( GRIDS& sizelist );
|
2009-07-25 04:53:39 +00:00
|
|
|
void AddGrid( const GRID_TYPE& grid );
|
|
|
|
void AddGrid( const wxRealPoint& size, int id );
|
2011-09-06 19:42:46 +00:00
|
|
|
void AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id );
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
/**
|
|
|
|
* Function GetGridCount().
|
|
|
|
* Return the size of the grid list.
|
|
|
|
*
|
|
|
|
* @returns - The size of the grid list.
|
|
|
|
*/
|
|
|
|
size_t GetGridCount() const { return m_grids.size(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetGrid()
|
|
|
|
* Returns the grid object at \a aIndex.
|
|
|
|
*
|
|
|
|
* @param aIndex - The grid list index.
|
|
|
|
* @return - The grid object at \a aIndex or the current grid if the grid list is empty.
|
|
|
|
*/
|
|
|
|
GRID_TYPE& GetGrid( size_t aIndex );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetGrids().
|
|
|
|
* Copy the grid list to \a aList.
|
|
|
|
*
|
|
|
|
* @param aList - List to copy to.
|
|
|
|
*/
|
|
|
|
void GetGrids( GRIDS& aList );
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
void SetMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }
|
|
|
|
|
2009-02-22 21:32:27 +00:00
|
|
|
/**
|
|
|
|
* Function RefPos
|
2009-10-14 19:43:31 +00:00
|
|
|
* Return the reference position, coming from either the mouse position
|
|
|
|
* or the cursor position.
|
|
|
|
*
|
2009-02-22 21:32:27 +00:00
|
|
|
* @param useMouse If true, return mouse position, else cursor's.
|
2009-10-14 19:43:31 +00:00
|
|
|
*
|
2009-02-22 21:32:27 +00:00
|
|
|
* @return wxPoint - The reference point, either the mouse position or
|
2009-10-14 19:43:31 +00:00
|
|
|
* the cursor position.
|
2009-02-22 21:32:27 +00:00
|
|
|
*/
|
|
|
|
wxPoint RefPos( bool useMouse )
|
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
return useMouse ? m_MousePosition : m_crossHairPosition;
|
2009-02-22 21:32:27 +00:00
|
|
|
}
|
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
/**
|
|
|
|
* Function GetCursorPosition
|
|
|
|
* returns the current cursor position in logical (drawing) units.
|
|
|
|
* @param aOnGrid Returns the nearest grid position at the current cursor position.
|
|
|
|
* @param aGridSize Custom grid size instead of the current grid size. Only valid
|
|
|
|
* if \a aOnGrid is true.
|
|
|
|
* @return The current cursor position.
|
|
|
|
*/
|
|
|
|
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL );
|
|
|
|
|
2011-02-09 19:47:33 +00:00
|
|
|
/**
|
|
|
|
* Function GetCursorScreenPosition
|
|
|
|
* returns the cross hair position in device (display) units.b
|
|
|
|
* @return The current cross hair position.
|
|
|
|
*/
|
|
|
|
wxPoint GetCrossHairScreenPosition() const;
|
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
/**
|
|
|
|
* Function GetNearestGridPosition
|
|
|
|
* returns the nearest \a aGridSize location to \a aPosition.
|
|
|
|
* @param aPosition The position to check.
|
|
|
|
* @param aGridSize The grid size to locate to if provided. If NULL then the current
|
|
|
|
* grid size is used.
|
|
|
|
* @return The nearst grid position.
|
|
|
|
*/
|
|
|
|
wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL );
|
2009-02-22 21:32:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetClass
|
|
|
|
* returns the class name.
|
|
|
|
* @return wxString
|
|
|
|
*/
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "BASE_SCREEN" );
|
|
|
|
}
|
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
/**
|
|
|
|
* Helpers for accessing the draw item list.
|
|
|
|
*/
|
|
|
|
EDA_ITEMS::iterator Begin() { return m_items.begin(); }
|
|
|
|
EDA_ITEMS::iterator End() { return m_items.end(); }
|
2010-12-08 20:12:46 +00:00
|
|
|
virtual void AddItem( EDA_ITEM* aItem );
|
|
|
|
virtual void InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem );
|
2009-02-22 21:32:27 +00:00
|
|
|
|
2011-02-05 19:22:58 +00:00
|
|
|
/**
|
|
|
|
* Function IsBlockActive
|
|
|
|
* returns true if a block command is in progress.
|
|
|
|
*/
|
|
|
|
inline bool IsBlockActive() const { return !m_BlockLocate.IsIdle(); }
|
|
|
|
|
|
|
|
void ClearBlockCommand() { m_BlockLocate.Clear(); }
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
wxPoint GetScrollCenterPosition() const { return m_scrollCenter; }
|
|
|
|
void SetScrollCenterPosition( const wxPoint& aCenterPosition )
|
|
|
|
{
|
|
|
|
m_scrollCenter = aCenterPosition;
|
|
|
|
}
|
|
|
|
|
2009-02-22 21:32:27 +00:00
|
|
|
#if defined(DEBUG)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Show
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
*/
|
|
|
|
void Show( int nestLevel, std::ostream& os );
|
|
|
|
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* #ifndef __CLASS_BASE_SCREEN_H__ */
|