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
+23 -27
View File
@@ -103,14 +103,13 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
{
BlockState state = GetScreen()->m_BlockLocate.m_State;
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC );
GetScreen()->m_BlockLocate.m_State = state;
GetScreen()->m_BlockLocate.m_Command = command;
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
DrawPanel->MouseToCursorSchema();
DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_BlockLocate.GetBottom() ) );
DrawPanel->MoveCursorToCrossHair();
}
switch( GetScreen()->m_BlockLocate.m_Command )
@@ -127,12 +126,14 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
if( itemsCount )
{
nextcmd = true;
if( DrawPanel->ManageCurseur != NULL )
if( DrawPanel->IsMouseCaptured() )
{
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE );
}
@@ -140,7 +141,7 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
nextcmd = true;
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
break;
@@ -189,16 +190,13 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
{
ClearMarkItems( currentModule );
}
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh( TRUE );
}
GetScreen()->ClearBlockCommand();
SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh( true );
}
return nextcmd;
}
@@ -217,10 +215,10 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
bool err = FALSE;
MODULE* currentModule = GetBoard()->m_Modules;
if( DrawPanel->ManageCurseur == NULL )
if( !DrawPanel->IsMouseCaptured() )
{
err = TRUE;
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
@@ -272,14 +270,12 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
OnModify();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
SetCurItem( NULL );
DrawPanel->Refresh( TRUE );
DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->Refresh( true );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
}
@@ -339,7 +335,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
}
/* Repaint new view. */
PtBlock->m_MoveVector = screen->m_Curseur - PtBlock->m_BlockLastCursorPosition;
PtBlock->m_MoveVector = screen->GetCrossHairPosition() - PtBlock->m_BlockLastCursorPosition;
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );