/* Draw in drag mode when moving a pad. */ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { TRACK* Track; BASE_SCREEN* screen = aPanel->GetScreen(); D_PAD* pad = s_CurrentSelectedPad; if( pad == NULL ) // Should not occur return; if( aErase ) pad->Draw( aPanel, aDC, GR_XOR ); pad->SetPosition( screen->GetCrossHairPosition() ); pad->Draw( aPanel, aDC, GR_XOR ); for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) { Track = g_DragSegmentList[ii].m_Track; if( aErase ) Track->Draw( aPanel, aDC, GR_XOR ); g_DragSegmentList[ii].SetTrackEndsCoordinates( wxPoint(0, 0) ); Track->Draw( aPanel, aDC, GR_XOR ); } }
void EDA_DRAW_FRAME::SetPresetGrid( int aIndex ) { BASE_SCREEN * screen = GetScreen(); if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) ) aIndex = screen->GetGrids()[0].m_CmdId; // aIndex is a Command Id relative to ID_POPUP_GRID_LEVEL_1000 comand id code. // we need an index in grid list (the cmd id in list is is screen->GetGrids()[0].m_CmdId): int glistIdx = aIndex + ID_POPUP_GRID_LEVEL_1000 - screen->GetGrids()[0].m_CmdId; if( m_gridSelectBox ) { if( glistIdx < 0 || glistIdx >= (int) m_gridSelectBox->GetCount() ) { wxASSERT_MSG( false, "Invalid grid index" ); return; } m_gridSelectBox->SetSelection( glistIdx ); } // Be sure m_LastGridSizeId is up to date. m_LastGridSizeId = aIndex; GetScreen()->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 ); // Put cursor on new grid SetCrossHairPosition( RefPos( true ) ); }
/* Traces the outline of the search block structures * The entire block follows the cursor */ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); BLOCK_SELECTOR* block = &screen->m_BlockLocate; SCH_ITEM* schitem; /* Erase old block contents. */ if( aErase ) { block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color ); for( unsigned ii = 0; ii < block->GetCount(); ii++ ) { schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, g_GhostColor ); } } /* Repaint new view. */ block->m_MoveVector = screen->GetCrossHairPosition() - block->m_BlockLastCursorPosition; block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color ); for( unsigned ii = 0; ii < block->GetCount(); ii++ ) { schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, g_GhostColor ); } }
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC ) { BASE_SCREEN* screen = Panel->GetScreen(); PCB_TARGET* target = (PCB_TARGET*) screen->GetCurItem(); ( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL ); Panel->SetMouseCapture( NULL, NULL ); if( target == NULL ) return; target->Draw( Panel, DC, GR_XOR ); if( target->IsNew() ) // If it is new, delete it { target->Draw( Panel, DC, GR_XOR ); target->DeleteStructure(); target = NULL; } else // it is an existing item: retrieve initial values of parameters { if( ( target->GetFlags() & (IN_EDIT | IS_MOVED) ) ) { target->SetPosition( s_TargetCopy.GetPosition() ); target->SetWidth( s_TargetCopy.GetWidth() ); target->SetSize( s_TargetCopy.GetSize() ); target->SetShape( s_TargetCopy.GetShape() ); } target->ClearFlags(); target->Draw( Panel, DC, GR_OR ); } }
/** * Abort text move in progress. * * If a text is selected, its initial coordinates are regenerated. */ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) { BASE_SCREEN* screen = Panel->GetScreen(); TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() ); MODULE* Module; Panel->SetMouseCapture( NULL, NULL ); if( Text == NULL ) return; Module = static_cast<MODULE*>( Text->GetParent() ); Text->DrawUmbilical( Panel, DC, GR_XOR, -MoveVector ); Text->Draw( Panel, DC, GR_XOR, MoveVector ); // If the text was moved (the move does not change internal data) // it could be rotated while moving. So set old value for orientation if( Text->IsMoving() ) Text->SetTextAngle( TextInitialOrientation ); // Redraw the text Panel->RefreshDrawingRect( Text->GetBoundingBox() ); // leave it at (0,0) so we can use it Rotate when not moving. MoveVector.x = MoveVector.y = 0; Text->ClearFlags(); Module->ClearFlags(); screen->SetCurItem( NULL ); }
static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() ); if( Text == NULL ) return; // Erase umbilical and text if necessary if( aErase ) { Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector ); Text->Draw( aPanel, aDC, GR_XOR, MoveVector ); } MoveVector = TextInitialPosition - aPanel->GetParent()->GetCrossHairPosition(); // Draw umbilical if text moved if( MoveVector.x || MoveVector.y ) Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector ); // Redraw text Text->Draw( aPanel, aDC, GR_XOR, MoveVector ); }
static void Move_Segment(WinEDA_DrawPanel * panel, wxDC * DC, bool erase) /************************************************************************/ /* redessin du contour du Segment Edge lors des deplacements de la souris */ { BASE_SCREEN * screen = panel->GetScreen(); EDGE_MODULE * Edge = (EDGE_MODULE * ) screen->m_CurrentItem; if( Edge == NULL ) return; MODULE * Module = (MODULE*) Edge->m_Parent; screen->Trace_Curseur(panel, DC); if( erase ) { Edge->Draw(panel, DC, MoveVector, GR_XOR); } MoveVector.x = -(screen->m_Curseur.x - CursorInitialPosition.x); MoveVector.y = -(screen->m_Curseur.y - CursorInitialPosition.y); Edge->Draw(panel, DC, MoveVector, GR_XOR); screen->Trace_Curseur(panel, DC); Module->Set_Rectangle_Encadrement(); }
static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); if( aErase ) { if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, GR_XOR, BLOCK_OUTLINE_COLOR ); if( blockDrawItems ) drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); } } if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP ) { screen->m_BlockLocate.m_MoveVector = screen->GetCrossHairPosition() - screen->m_BlockLocate.m_BlockLastCursorPosition; } if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, GR_XOR, BLOCK_OUTLINE_COLOR ); if( blockDrawItems ) drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); } }
static void ShowEdgeModule(WinEDA_DrawPanel * panel, wxDC * DC, bool erase) /************************************************************************/ /* Affiche le segment Edge Module en cours de trace */ { BASE_SCREEN * screen = panel->GetScreen(); EDGE_MODULE * Edge = (EDGE_MODULE * ) screen->m_CurrentItem; if( Edge == NULL ) return; MODULE * Module = (MODULE*) Edge->m_Parent; screen->Trace_Curseur(panel, DC); // if( erase ) { Edge->Draw(panel, DC, wxPoint(0, 0), GR_XOR); } Edge->m_End = screen->m_Curseur; /* Mise a jour des coord relatives */ Edge->m_End0.x = Edge->m_End.x - Module->m_Pos.x; Edge->m_End0.y = Edge->m_End.y - Module->m_Pos.y ; RotatePoint((int*)&Edge->m_End0.x, (int*)&Edge->m_End0.y, - Module->m_Orient); Edge->Draw(panel, DC, wxPoint(0, 0), GR_XOR); screen->Trace_Curseur(panel, DC); Module->Set_Rectangle_Encadrement(); }
/* Redraw the current graphic item during its creation * Use this function to show a new outline, in begin command */ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); EDGE_MODULE* edge = (EDGE_MODULE*) screen->GetCurItem(); if( edge == NULL ) return; MODULE* module = (MODULE*) edge->GetParent(); // if( erase ) { edge->Draw( aPanel, aDC, GR_XOR ); } edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() ); // Update relative coordinate. edge->SetEnd0( edge->GetEnd() - module->GetPosition() ); wxPoint pt( edge->GetEnd0() ); RotatePoint( &pt, -module->GetOrientation() ); edge->SetEnd0( pt ); edge->Draw( aPanel, aDC, GR_XOR ); module->CalculateBoundingBox(); }
void PCBNEW_CONTROL::updateGrid() { BASE_SCREEN* screen = m_frame->GetScreen(); //GRID_TYPE grid = screen->GetGrid( idx ); getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) ); getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); }
void EDA_DRAW_FRAME::SetPrevGrid() { BASE_SCREEN * screen = GetScreen(); int grid_cnt = screen->GetGridCount(); int new_grid_idx = screen->GetGridId() - ID_POPUP_GRID_LEVEL_1000 - 1; if( new_grid_idx < 0 ) new_grid_idx = grid_cnt - 1; SetPresetGrid( new_grid_idx ); }
void EDA_DRAW_FRAME::SetPrevGrid() { BASE_SCREEN * screen = GetScreen(); int new_grid_cmd = screen->GetGridCmdId(); // if the grid id is the not the first, increment it if( screen->GridExists( new_grid_cmd - 1 ) ) new_grid_cmd -= 1; SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 ); }
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) { KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::GAL* gal = GetGalCanvas()->GetGAL(); double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); // Display the same view after canvas switching if( aEnable ) { BASE_SCREEN* screen = GetScreen(); // Switch to GAL rendering if( !IsGalCanvasActive() ) { // Set up viewport double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() ); view->SetScale( zoom ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); } // Set up grid settings gal->SetGridVisibility( IsGridVisible() ); gal->SetGridSize( VECTOR2D( screen->GetGridSize().x, screen->GetGridSize().y ) ); gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) ); } else { // Switch to standard rendering if( IsGalCanvasActive() ) { // Change view settings only if GAL was active previously double zoom = 1.0 / ( zoomFactor * view->GetScale() ); m_canvas->SetZoom( zoom ); VECTOR2D center = view->GetCenter(); RedrawScreen( wxPoint( center.x, center.y ), false ); } } m_canvas->SetEvtHandlerEnabled( !aEnable ); GetGalCanvas()->SetEvtHandlerEnabled( aEnable ); // Switch panes m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable ); m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable ); m_auimgr.Update(); // Reset current tool on switch(); SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString ); m_galCanvasActive = aEnable; }
int PCBNEW_CONTROL::GridPreset( const TOOL_EVENT& aEvent ) { long idx = aEvent.Parameter<long>(); m_frame->SetPresetGrid( idx ); BASE_SCREEN* screen = m_frame->GetScreen(); GRID_TYPE grid = screen->GetGrid( idx ); getView()->GetGAL()->SetGridSize( VECTOR2D( grid.m_Size ) ); getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); return 0; }
void WinEDA_DrawPanel::OnKeyEvent(wxKeyEvent& event) /****************************************************/ { long key, localkey; bool escape = FALSE; key = localkey = event.m_keyCode; switch( localkey ) { case WXK_CONTROL: case WXK_CAPITAL: case WXK_SHIFT: case WXK_NUMLOCK: case WXK_LBUTTON: case WXK_RBUTTON: case 0x0135: /* Alt key */ return; case WXK_ESCAPE: escape = m_AbortRequest = TRUE; break; } if( event.ControlDown() ) localkey |= GR_KB_CTRL; if( event.AltDown() ) localkey |= GR_KB_ALT; if( event.ShiftDown() && (key > 256) ) localkey |= GR_KB_SHIFT; wxClientDC DC(this); BASE_SCREEN * Screen = GetScreen(); PrepareGraphicContext(&DC); g_KeyPressed = localkey; if ( escape ) { if( Screen->ManageCurseur && Screen->ForceCloseManageCurseur ) { SetCursor(m_PanelCursor = m_PanelDefaultCursor); Screen->ForceCloseManageCurseur(m_Parent, &DC); SetCursor(m_PanelCursor = m_PanelDefaultCursor); } else m_Parent->SetToolID(0, m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW, wxEmptyString); } m_Parent->GeneralControle(&DC, Screen->m_MousePosition); }
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition( bool aInvertY ) const { // subject to change, borrow from old BASE_SCREEN for now. if( IsGalCanvasActive() ) { VECTOR2I cursor = GetGalCanvas()->GetViewControls()->GetCursorPosition(); return wxPoint( cursor.x, cursor.y ); } else { BASE_SCREEN* screen = GetScreen(); // virtual call return screen->getCrossHairPosition( aInvertY ); } }
const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const { BASE_SCREEN* screen = GetScreen(); wxString Line; if( screen ) { // returns a human readable value which can be displayed as zoom // level indicator in dialogs. double level = m_zoomLevelCoeff / (double)screen->GetZoom(); Line.Printf( wxT( "Z %.2f" ), level ); } return Line; }
GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : m_parent( aParent ) { BASE_SCREEN* screen = aParent->GetScreen(); SetTitle( _( "Grid" ) ); SetIcon( grid_select_xpm ); wxArrayString gridsList; screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES ); for( unsigned int i = 0; i < gridsList.GetCount(); ++i ) { GRID_TYPE& grid = screen->GetGrid( i ); Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK ); } }
// Redraw the contour of the track while moving the mouse static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); PCB_TARGET* target = (PCB_TARGET*) screen->GetCurItem(); if( target == NULL ) return; if( aErase ) target->Draw( aPanel, aDC, GR_XOR ); target->SetPosition( aPanel->GetParent()->GetCrossHairPosition() ); target->Draw( aPanel, aDC, GR_XOR ); }
void GRID_MENU::update() { BASE_SCREEN* screen = m_parent->GetScreen(); int currentId = screen->GetGridCmdId(); wxArrayString gridsList; screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES ); for( unsigned int i = 0; i < GetMenuItemCount(); ++i ) { int menuId = ID_POPUP_GRID_SELECT + 1 + i; SetLabel( menuId, gridsList[i] ); // Refresh label in case units have changed Check( menuId, menuId == currentId ); // Refresh checkmark } }
// JEY TODO: Obsolete; replace with ACTIONS::zoomFitScreen void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) { BASE_SCREEN* screen = GetScreen(); // Set the best zoom and get center point. // BestZoom() can compute an illegal zoom if the client window size // is small, say because frame is not maximized. So use the clamping form // of SetZoom(): double bestzoom = BestZoom(); screen->SetScalingFactor( bestzoom ); if( !screen->m_Initialized ) SetCrossHairPosition( GetScrollCenterPosition() ); m_toolManager->RunAction( "common.Control.zoomFitScreen", true ); }
void ZOOM_MENU::update() { BASE_SCREEN* screen = m_parent->GetScreen(); double zoom = screen->GetZoom(); const std::vector<double>& zoomList = m_parent->GetScreen()->m_ZoomList; // Check the current zoom int maxZoomIds = std::min( ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START, (int) screen->m_ZoomList.size() ); for( int i = 0; i < maxZoomIds; ++i ) { // Search for a value near the current zoom setting: double rel_error = std::fabs( zoomList[i] - zoom )/zoom; Check( ID_POPUP_ZOOM_LEVEL_START+1 + i, rel_error < 0.1 ); } }
bool PCB_BASE_FRAME::InvokeDialogGrid() { wxPoint grid_origin = GetGridOrigin(); DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize, &grid_origin, &m_FastGrid1, &m_FastGrid2, m_gridSelectBox->GetStrings() ); int ret = dlg.ShowModal(); if( ret == wxID_OK ) { if( GetGridOrigin() != grid_origin && IsType( FRAME_PCB ) ) OnModify(); // because grid origin is saved in board, show as modified SetGridOrigin( grid_origin ); BASE_SCREEN* screen = GetScreen(); screen->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); // If the user grid is the current option, recall SetGrid() // to force new values put in list as current grid value if( screen->GetGridCmdId() == ID_POPUP_GRID_USER ) screen->SetGrid( ID_POPUP_GRID_USER ); // Notify GAL TOOL_MANAGER* mgr = GetToolManager(); if( mgr && IsGalCanvasActive() ) { mgr->RunAction( "common.Control.gridPreset", true, screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 ); TOOL_EVENT gridOriginUpdate = COMMON_ACTIONS::gridSetOrigin.MakeEvent(); gridOriginUpdate.SetParameter( new VECTOR2D( grid_origin ) ); mgr->ProcessEvent( gridOriginUpdate ); } m_canvas->Refresh(); return true; } return false; }
void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect ) { wxRect clipBox; // Use the entire visible device area if no clip area was defined. if( aRect == NULL ) { BASE_SCREEN* Screen = GetScreen(); if( !Screen ) return; Screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) ); clipBox.SetSize( GetClientSize() ); int scrollX, scrollY; double scalar = Screen->GetScalingFactor(); scrollX = KiROUND( Screen->GetGridSize().x * scalar ); scrollY = KiROUND( Screen->GetGridSize().y * scalar ); m_scrollIncrementX = std::max( GetClientSize().x / 8, scrollX ); m_scrollIncrementY = std::max( GetClientSize().y / 8, scrollY ); Screen->m_ScrollbarPos.x = GetScrollPos( wxHORIZONTAL ); Screen->m_ScrollbarPos.y = GetScrollPos( wxVERTICAL ); } else { clipBox = *aRect; } // Pad clip box in device units. clipBox.Inflate( CLIP_BOX_PADDING ); // Convert from device units to drawing units. m_ClipBox.SetOrigin( wxPoint( aDC.DeviceToLogicalX( clipBox.x ), aDC.DeviceToLogicalY( clipBox.y ) ) ); m_ClipBox.SetSize( wxSize( aDC.DeviceToLogicalXRel( clipBox.width ), aDC.DeviceToLogicalYRel( clipBox.height ) ) ); wxLogTrace( kicadTraceCoords, wxT( "Device clip box=(%d, %d, %d, %d), Logical clip box=(%d, %d, %d, %d)" ), clipBox.x, clipBox.y, clipBox.width, clipBox.height, m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetWidth(), m_ClipBox.GetHeight() ); }
/* Move selected sheet with the cursor. * Callback function use by m_mouseCaptureCallback. */ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { wxPoint moveVector; BASE_SCREEN* screen = aPanel->GetScreen(); SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem(); if( aErase ) sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); wxPoint pos = sheet->GetPosition(); if( sheet->IsResized() ) { int width = aPanel->GetParent()->GetCrossHairPosition().x - sheet->GetPosition().x; int height = aPanel->GetParent()->GetCrossHairPosition().y - sheet->GetPosition().y; // If the sheet doesn't have any pins, clamp the minimum size to the default values. width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width; height = ( height < MIN_SHEET_HEIGHT ) ? MIN_SHEET_HEIGHT : height; if( sheet->HasPins() ) { int gridSizeX = KiROUND( screen->GetGridSize().x ); int gridSizeY = KiROUND( screen->GetGridSize().y ); // If the sheet has pins, use the pin positions to clamp the minimum height. height = ( height < sheet->GetMinHeight() + gridSizeY ) ? sheet->GetMinHeight() + gridSizeY : height; width = ( width < sheet->GetMinWidth() + gridSizeX ) ? sheet->GetMinWidth() + gridSizeX : width; } wxPoint grid = aPanel->GetParent()->GetNearestGridPosition( wxPoint( pos.x + width, pos.y + height ) ); sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) ); } else if( sheet->IsMoving() ) { moveVector = aPanel->GetParent()->GetCrossHairPosition() - pos; sheet->Move( moveVector ); } sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); }
static void ExitTrace(WinEDA_DrawFrame * frame, wxDC * DC) /**********************************************************/ /* Routine de sortie des menus de trace */ { BASE_SCREEN * Screen = frame->GetScreen(); if( Screen->m_CurrentItem) /* trace en cours */ { Screen->ManageCurseur(frame->DrawPanel, DC, FALSE); Screen->ManageCurseur = NULL; Screen->ForceCloseManageCurseur = NULL; EraseStruct(Screen->m_CurrentItem,(SCH_SCREEN*) Screen); Screen->m_CurrentItem = NULL; return; } else g_ItemToRepeat = NULL; // Fin de commande generale }
void EDA_DRAW_FRAME::UpdateStatusBar() { wxString Line; BASE_SCREEN* screen = GetScreen(); if( !screen ) return; // Display Zoom level: zoom = zoom_coeff/ZoomScalar Line.Printf( wxT( "Z %g" ), screen->GetZoom() ); SetStatusText( Line, 1 ); // Absolute and relative cursor positions are handled by overloading this function and // handling the internal to user units conversion at the appropriate level. // refresh units display DisplayUnitsMsg(); }
static void ClearUsedFlags(void) /*******************************/ /* Clear flag FlagControlMulti, used in netlist generation */ { BASE_SCREEN *CurrScreen; EDA_BaseStruct *DrawList; for(CurrScreen = ScreenSch; CurrScreen != NULL; CurrScreen = CurrScreen->Next() ) { DrawList = CurrScreen->EEDrawList; while ( DrawList ) { if( DrawList->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE) { EDA_SchComponentStruct * Component = (EDA_SchComponentStruct *) DrawList; Component->m_FlagControlMulti = 0; } DrawList = DrawList->Pnext; } } }
bool PCB_BASE_FRAME::InvokeDialogGrid() { wxPoint grid_origin = GetGridOrigin(); DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize, &grid_origin, &m_FastGrid1, &m_FastGrid2, m_gridSelectBox->GetStrings() ); int ret = dlg.ShowModal(); if( ret == wxID_OK ) { if( GetGridOrigin() != grid_origin && IsType( FRAME_PCB ) ) OnModify(); // because grid origin is saved in board, show as modified SetGridOrigin( grid_origin ); BASE_SCREEN* screen = GetScreen(); screen->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); // If the user grid is the current option, recall SetGrid() // to force new values put in list as current grid value if( screen->GetGridId() == ID_POPUP_GRID_USER ) screen->SetGrid( ID_POPUP_GRID_USER ); if( IsGalCanvasActive() ) { GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x, screen->GetGrid().m_Size.y ) ); GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); } m_canvas->Refresh(); return true; } return false; }