本文整理汇总了C++中GetGalCanvas函数的典型用法代码示例。如果您正苦于以下问题:C++ GetGalCanvas函数的具体用法?C++ GetGalCanvas怎么用?C++ GetGalCanvas使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetGalCanvas函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveFootprint
void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( GetScreen()->IsModify() && GetBoard()->m_Modules )
{
if( !HandleUnsavedChanges( this, _( "Save changes to footprint before closing?" ),
[&]()->bool { return SaveFootprint( GetBoard()->m_Modules ); } ) )
{
Event.Veto();
return;
}
}
GetGalCanvas()->SetEventDispatcher( NULL );
GetGalCanvas()->StopDrawing();
// Do not show the layer manager during closing to avoid flicker
// on some platforms (Windows) that generate useless redraw of items in
// the Layer Manger
m_auimgr.GetPane( "LayersManager" ).Show( false );
Clear_Pcb( false );
//close the editor
Destroy();
}
示例2: GetGalCanvas
void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
{
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
if( m_toolManager )
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
if( aEnable )
{
SetBoard( m_Pcb );
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
galCanvas->GetView()->RecacheAllItems();
galCanvas->SetEventDispatcher( m_toolDispatcher );
galCanvas->StartDrawing();
}
else
{
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
// Redirect all events to the legacy canvas
galCanvas->SetEventDispatcher( NULL );
}
}
示例3: GetGalCanvas
void EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
{
GetGalCanvas()->SwitchBackend( aCanvasType );
m_canvasType = GetGalCanvas()->GetBackend();
UseGalCanvas();
}
示例4: GetGalCanvas
void PCB_BASE_FRAME::UseGalCanvas()
{
EDA_DRAW_FRAME::UseGalCanvas();
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
if( m_toolManager )
{
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
}
SetBoard( m_Pcb );
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
// Transfer latest current display options from legacy to GAL canvas:
auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
auto settings = painter->GetSettings();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
galCanvas->GetView()->RecacheAllItems();
galCanvas->SetEventDispatcher( m_toolDispatcher );
galCanvas->StartDrawing();
}
示例5: GetGalCanvas
void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
{
bool new_board = ( aBoard != m_Pcb );
// The active tool might store a reference to the BOARD that is about to be deleted.
if( m_toolManager )
m_toolManager->DeactivateTool();
// It has to be done before the previous board is destroyed by SetBoard()
if( new_board )
GetGalCanvas()->GetView()->Clear();
PCB_BASE_FRAME::SetBoard( aBoard );
GetGalCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetGridOrigin() ) );
// update the tool manager with the new board and its view.
if( m_toolManager )
{
PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
drawPanel->DisplayBoard( aBoard );
m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(),
drawPanel->GetViewControls(), this );
if( new_board )
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
}
}
示例6: GetGalCanvas
void PL_EDITOR_FRAME::setupTools()
{
// Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( nullptr, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
m_actions = new PL_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
GetGalCanvas()->SetEventDispatcher( m_toolDispatcher );
// Register tools
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new PL_SELECTION_TOOL );
m_toolManager->RegisterTool( new PL_EDITOR_CONTROL );
m_toolManager->RegisterTool( new PL_DRAWING_TOOLS );
m_toolManager->RegisterTool( new PL_EDIT_TOOL );
m_toolManager->RegisterTool( new PL_POINT_EDITOR );
m_toolManager->RegisterTool( new PL_PICKER_TOOL );
m_toolManager->InitTools();
// Run the selection tool, it is supposed to be always active
m_toolManager->InvokeTool( "plEditor.InteractiveSelection" );
}
示例7: switch
void PCB_BASE_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
{
bool use_gal = false;
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
switch( aEvent.GetId() )
{
case ID_MENU_CANVAS_LEGACY:
break;
case ID_MENU_CANVAS_CAIRO:
use_gal = GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
if( use_gal )
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
break;
case ID_MENU_CANVAS_OPENGL:
use_gal = GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
if( use_gal )
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
break;
}
SaveCanvasTypeSetting( canvasType );
UseGalCanvas( use_gal );
}
示例8: GetGalCanvas
void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
{
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
ViewReloadBoard( m_Pcb );
}
示例9: SetGridVisibility
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
{
SetGridVisibility( !IsGridVisible() );
if( IsGalCanvasActive() )
{
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
m_canvas->Refresh();
}
示例10: GetGalCanvas
void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
{
PCB_BASE_FRAME::SetActiveLayer( aLayer );
GetGalCanvas()->SetHighContrastLayer( aLayer );
m_Layers->SelectLayer( GetActiveLayer() );
m_Layers->OnLayerSelected();
if( IsGalCanvasActive() )
GetGalCanvas()->Refresh();
}
示例11: GetGalCanvas
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;
}
示例12: ViewReloadBoard
void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
{
PCB_BASE_FRAME::SetBoard( aBoard );
if( GetGalCanvas() )
{
ViewReloadBoard( aBoard );
// update the tool manager with the new board and its view.
if( m_toolManager )
m_toolManager->SetEnvironment( aBoard, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
}
}
示例13: GetGalCanvas
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = !m_DisplayPadFill;
// Apply new display options to the GAL canvas
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt );
GetGalCanvas()->GetView()->RecacheAllItems( true );
m_canvas->Refresh();
}
示例14: GetGalCanvas
void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
{
PCB_BASE_FRAME::SetActiveLayer( aLayer );
GetGalCanvas()->SetHighContrastLayer( aLayer );
syncLayerWidgetLayer();
if( IsGalCanvasActive() )
{
m_toolManager->RunAction( COMMON_ACTIONS::layerChanged ); // notify other tools
GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere
GetGalCanvas()->Refresh();
}
}
示例15: EDA_DRAW_FRAME
PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
const wxString& aTitle,
const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName) :
EDA_DRAW_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
{
m_Pcb = NULL;
m_toolManager = NULL;
m_toolDispatcher = NULL;
m_DisplayPadFill = true; // How to draw pads
m_DisplayViaFill = true; // How to draw vias
m_DisplayPadNum = true; // show pads number
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
m_DisplayPcbTrackFill = true; // false = sketch , true = filled
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_UserGridSize = wxRealPoint( 100.0, 100.0 );
m_UserGridUnit = INCHES;
m_Collector = new GENERAL_COLLECTOR();
m_FastGrid1 = 0;
m_FastGrid2 = 0;
SetGalCanvas( new EDA_DRAW_PANEL_GAL(
this, -1, wxPoint( 0, 0 ), m_FrameSize,
EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) );
// Hide by default, it has to be explicitly shown
GetGalCanvas()->Hide();
m_auxiliaryToolBar = NULL;
}