Draw panel object refactoring and other minor code cleaning.

* Rename all member variables and methods that reference the cross hair
  code in draw panel object from cursor to cross hair to eliminate confusion
  between the two concepts.
* Rename cursor capture call backs in draw panel object to improve code
  readability.
* Create helper class for turning off the cross hair while drawing.
* Remove redundant block clear code.
* Remove redundant mouse capture call back reset code when end capture
  call back is called.
* Remove unused function definitions in base draw frame object.
* Lots of minor coding policy and doxygen comment fixes.
This commit is contained in:
Wayne Stambaugh
2011-02-11 15:48:13 -05:00
parent 25fe492022
commit 7b8b51b240
110 changed files with 1218 additions and 1307 deletions
+12 -14
View File
@@ -124,8 +124,7 @@ void BLOCK_SELECTOR::InitData( EDA_DRAW_PANEL* aPanel, const wxPoint& startpos )
SetOrigin( startpos );
SetSize( wxSize( 0, 0 ) );
m_ItemsSelection.ClearItemsList();
aPanel->ManageCurseur = DrawAndSizingBlockOutlines;
aPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
aPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
}
@@ -164,6 +163,7 @@ void BLOCK_SELECTOR::Clear()
{
if( m_Command != BLOCK_IDLE )
{
m_Flags = 0;
m_Command = BLOCK_IDLE;
m_State = STATE_NO_BLOCK;
ClearItemsList();
@@ -216,20 +216,20 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
{
DisplayError( this, wxT( "No Block to paste" ), 20 );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->m_mouseCaptureCallback = NULL;
return true;
}
if( DrawPanel->ManageCurseur == NULL )
if( !DrawPanel->IsMouseCaptured() )
{
Block->m_ItemsSelection.ClearItemsList();
DisplayError( this,
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: ManageCurseur NULL" ) );
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
return true;
}
Block->m_State = STATE_BLOCK_MOVE;
DrawPanel->ManageCurseur( DrawPanel, DC, startpos, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, startpos, false );
break;
default:
@@ -265,8 +265,8 @@ void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoin
if( aErase )
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
PtBlock->m_BlockLastCursorPosition = aPanel->GetScreen()->m_Curseur;
PtBlock->SetEnd( aPanel->GetScreen()->m_Curseur );
PtBlock->m_BlockLastCursorPosition = aPanel->GetScreen()->GetCrossHairPosition();
PtBlock->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
@@ -286,12 +286,11 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
BASE_SCREEN* screen = Panel->GetScreen();
if( Panel->ManageCurseur ) /* Erase current drawing
* on screen */
if( Panel->IsMouseCaptured() ) /* Erase current drawing on screen */
{
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false ); /* Clear block outline. */
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
/* Clear block outline. */
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Panel->SetMouseCapture( NULL, NULL );
screen->SetCurItem( NULL );
/* Delete the picked wrapper if this is a picked list. */
@@ -301,7 +300,6 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
screen->m_BlockLocate.m_Flags = 0;
screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
screen->m_BlockLocate.m_Command = BLOCK_ABORT;
Panel->GetParent()->HandleBlockEnd( DC );