本文整理汇总了C++中PCB_BASE_FRAME::GetBoard方法的典型用法代码示例。如果您正苦于以下问题:C++ PCB_BASE_FRAME::GetBoard方法的具体用法?C++ PCB_BASE_FRAME::GetBoard怎么用?C++ PCB_BASE_FRAME::GetBoard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCB_BASE_FRAME
的用法示例。
在下文中一共展示了PCB_BASE_FRAME::GetBoard方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnUpdateInsertModuleInBoard
void FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent )
{
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
MODULE* module_in_edit = GetBoard()->m_Modules;
bool canInsert = ( module_in_edit && !module_in_edit->m_Link );
// If the source was deleted, the module can inserted but not updated in the board.
if( module_in_edit && module_in_edit->m_Link ) // this is not a new module
{
BOARD* mainpcb = frame->GetBoard();
MODULE* source_module = mainpcb->m_Modules;
// search if the source module was not deleted:
for( ; source_module != NULL; source_module = source_module->Next() )
{
if( module_in_edit->m_Link == source_module->GetTimeStamp() )
break;
}
canInsert = ( source_module == NULL );
}
aEvent.Enable( canInsert );
}
示例2: Init
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
BOARD* board = m_parent->GetBoard();
SetReturnCode( ZONE_ABORT ); // Will be changed on button click
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness );
m_ZoneMinThicknessCtrl->SetValue( msg );
if( m_settings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
switch( m_settings.m_Zone_HatchingStyle )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
}
// Create one column in m_LayerSelectionCtrl
wxListItem column0;
column0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
// Create an icon list:
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int ii = 0;
int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;
if( m_zone )
lyrSelect = m_zone->GetLayer();
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii )
{
LAYER_ID layer = *seq;
EDA_COLOR_T layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) );
wxString msg = board->GetLayerName( layer );
msg.Trim();
int itemIndex = m_LayerSelectionCtrl->InsertItem(
m_LayerSelectionCtrl->GetItemCount(), msg, ii );
if(lyrSelect == layer )
m_LayerSelectionCtrl->Select( itemIndex );
}
}
示例3: ExportSetupToOtherCopperZones
void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
{
if( !AcceptOptions( true, true ) )
return;
// Export settings ( but layer and netcode ) to others copper zones
BOARD* pcb = m_Parent->GetBoard();
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = pcb->GetArea( ii );
// Cannot export settings from a copper zone
// to a zone keepout:
if( zone->GetIsKeepout() )
continue;
m_settings.ExportSetting( *zone, false ); // false = partial export
m_Parent->OnModify();
}
m_OnExitCode = ZONE_EXPORT_VALUES; // values are exported to others zones
}
示例4: drawPickedItems
static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset )
{
PICKED_ITEMS_LIST* itemsList = &aPanel->GetScreen()->m_BlockLocate.GetItems();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
g_Offset_Module = -aOffset;
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
switch( item->Type() )
{
case PCB_MODULE_T:
frame->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
((MODULE*) item)->DrawOutlinesWhenMoving( aPanel, aDC, g_Offset_Module );
break;
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_TRACE_T:
case PCB_VIA_T:
case PCB_TARGET_T:
case PCB_DIMENSION_T: // Currently markers are not affected by block commands
case PCB_MARKER_T:
item->Draw( aPanel, aDC, GR_XOR, aOffset );
break;
case PCB_ZONE_AREA_T:
item->Draw( aPanel, aDC, GR_XOR, aOffset );
((ZONE_CONTAINER*) item)->DrawFilledArea( aPanel, aDC, GR_XOR, aOffset );
break;
default:
break;
}
}
g_Offset_Module = wxPoint( 0, 0 );
}
示例5: buildAvailableListOfNets
void DIALOG_COPPER_ZONE::buildAvailableListOfNets()
{
wxArrayString listNetName;
m_Parent->GetBoard()->ReturnSortedNetnamesList( listNetName, m_NetSortingByPadCount );
if( m_NetFiltering )
{
wxString doNotShowFilter = m_DoNotShowNetNameFilter->GetValue();
wxString ShowFilter = m_ShowNetNameFilter->GetValue();
for( unsigned ii = 0; ii < listNetName.GetCount(); ii++ )
{
if( listNetName[ii].Matches( doNotShowFilter ) )
{
listNetName.RemoveAt( ii );
ii--;
}
else if( !listNetName[ii].Matches( ShowFilter ) )
{
listNetName.RemoveAt( ii );
ii--;
}
}
}
listNetName.Insert( wxT( "<no net>" ), 0 );
// Ensure currently selected net for the zone is visible, regardless of filters
int selectedNetListNdx = -1;
int net_select = m_settings.m_NetcodeSelection;
if( net_select > 0 )
{
NETINFO_ITEM* equipot = m_Parent->GetBoard()->FindNet( net_select );
if( equipot )
{
selectedNetListNdx = listNetName.Index( equipot->GetNetname() );
if( wxNOT_FOUND == selectedNetListNdx )
{
// the currently selected net must *always* be visible.
listNetName.Insert( equipot->GetNetname(), 0 );
selectedNetListNdx = 0;
}
}
}
else if( net_select == 0 )
selectedNetListNdx = 0; // SetSelection() on "<no net>"
else
{
// selectedNetListNdx remains -1, no net selected.
}
m_ListNetNameSelection->Clear();
m_ListNetNameSelection->InsertItems( listNetName, 0 );
m_ListNetNameSelection->SetSelection( 0 );
if( selectedNetListNdx >= 0 )
{
m_ListNetNameSelection->SetSelection( selectedNetListNdx );
m_ListNetNameSelection->EnsureVisible( selectedNetListNdx );
}
}
示例6: AcceptOptions
//.........这里部分代码省略.........
msg.Printf( _( "Clearance must be smaller than %f\" / %f mm." ),
ZONE_CLEARANCE_MAX_VALUE_MIL / 1000.0, ZONE_CLEARANCE_MAX_VALUE_MIL * 0.0254 );
DisplayError( this, msg );
return false;
}
txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_settings.m_ZoneMinThickness = ReturnValueFromString( g_UserUnit, txtvalue );
if( m_settings.m_ZoneMinThickness < (ZONE_THICKNESS_MIN_VALUE_MIL*IU_PER_MILS) )
{
wxString msg;
msg.Printf( _( "Minimum width must be larger than %f\" / %f mm." ),
ZONE_THICKNESS_MIN_VALUE_MIL / 1000.0, ZONE_THICKNESS_MIN_VALUE_MIL * 0.0254 );
DisplayError( this, msg );
return false;
}
m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
txtvalue = m_cornerSmoothingCtrl->GetValue();
m_settings.SetCornerRadius( ReturnValueFromString( g_UserUnit, txtvalue ) );
m_settings.m_ZonePriority = m_PriorityLevelCtrl->GetValue();
if( m_OrientEdgesOpt->GetSelection() == 0 )
m_settings.m_Zone_45_Only = false;
else
m_settings.m_Zone_45_Only = true;
m_settings.m_ThermalReliefGap = ReturnValueFromTextCtrl( *m_AntipadSizeValue );
m_settings.m_ThermalReliefCopperBridge = ReturnValueFromTextCtrl( *m_CopperWidthValue );
if( m_Config )
{
ConfigBaseWriteDouble( m_Config, ZONE_CLEARANCE_WIDTH_STRING_KEY,
(double) m_settings.m_ZoneClearance / IU_PER_MILS );
ConfigBaseWriteDouble( m_Config, ZONE_MIN_THICKNESS_WIDTH_STRING_KEY,
(double) m_settings.m_ZoneMinThickness / IU_PER_MILS );
ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
(double) m_settings.m_ThermalReliefGap / IU_PER_MILS );
ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
(double) m_settings.m_ThermalReliefCopperBridge / IU_PER_MILS );
}
if( m_settings.m_ThermalReliefCopperBridge <= m_settings.m_ZoneMinThickness )
{
DisplayError( this,
_( "Thermal relief spoke width is smaller than the minimum width." ) );
return false;
}
// If we use only exportable to others zones parameters, exit here:
if( aUseExportableSetupOnly )
return true;
// Get the layer selection for this zone
int ii = m_LayerSelectionCtrl->GetFirstSelected();
if( ii < 0 && aPromptForErrors )
{
DisplayError( this, _( "No layer selected." ) );
return false;
}
m_settings.m_CurrentZone_Layer = m_LayerId[ii];
// Get the net name selection for this zone
ii = m_ListNetNameSelection->GetSelection();
if( ii < 0 && aPromptForErrors )
{
DisplayError( this, _( "No net selected." ) );
return false;
}
if( ii == 0 ) // the not connected option was selected: this is not a good practice: warn:
{
if( !IsOK( this, _(
"You have chosen the \"not connected\" option. This will create insulated copper islands. Are you sure ?" ) )
)
return false;
}
wxString net_name = m_ListNetNameSelection->GetString( ii );
m_settings.m_NetcodeSelection = 0;
// Search net_code for this net, if a net was selected
if( m_ListNetNameSelection->GetSelection() > 0 )
{
NETINFO_ITEM* net = m_Parent->GetBoard()->FindNet( net_name );
if( net )
m_settings.m_NetcodeSelection = net->GetNet();
}
return true;
}
示例7: initDialog
void DIALOG_COPPER_ZONE::initDialog()
{
BOARD* board = m_Parent->GetBoard();
wxString msg;
if( m_settings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 );
AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit, m_settings.m_ZoneClearance );
m_ZoneClearanceCtrl->SetValue( msg );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness );
m_ZoneMinThicknessCtrl->SetValue( msg );
switch( m_settings.GetPadConnection() )
{
case THT_THERMAL: // Thermals only for THT pads
m_PadInZoneOpt->SetSelection( 2 );
break;
case PAD_NOT_IN_ZONE: // Pads are not covered
m_PadInZoneOpt->SetSelection( 3 );
break;
default:
case THERMAL_PAD: // Use thermal relief for pads
m_PadInZoneOpt->SetSelection( 1 );
break;
case PAD_IN_ZONE: // pads are covered by copper
m_PadInZoneOpt->SetSelection( 0 );
break;
}
// Antipad and spokes are significant only for thermals
if( m_settings.GetPadConnection() != THERMAL_PAD &&
m_settings.GetPadConnection() != THT_THERMAL )
{
m_AntipadSizeValue->Enable( false );
m_CopperWidthValue->Enable( false );
}
else
{
m_AntipadSizeValue->Enable( true );
m_CopperWidthValue->Enable( true );
}
m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority );
AddUnitSymbol( *m_AntipadSizeText, g_UserUnit );
AddUnitSymbol( *m_CopperBridgeWidthText, g_UserUnit );
PutValueInLocalUnits( *m_AntipadSizeValue, m_settings.m_ThermalReliefGap );
PutValueInLocalUnits( *m_CopperWidthValue, m_settings.m_ThermalReliefCopperBridge );
m_cornerSmoothingChoice->SetSelection( m_settings.GetCornerSmoothingType() );
PutValueInLocalUnits( *m_cornerSmoothingCtrl, m_settings.GetCornerRadius() );
switch( m_settings.m_Zone_HatchingStyle )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
}
m_ArcApproximationOpt->SetSelection(
m_settings.m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 );
// Create one column in m_LayerSelectionCtrl
wxListItem column0;
column0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
// Build copper layer list and append to layer widget
int layerCount = board->GetCopperLayerCount();
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names
for( LAYER_NUM ii = FIRST_LAYER; ii < layerCount; ++ii )
{
LAYER_NUM layerNumber = LAYER_N_BACK;
if( layerCount <= 1 || ii < layerCount - 1 )
layerNumber = ii;
else if( ii == layerCount - 1 )
layerNumber = LAYER_N_FRONT;
m_LayerId.insert( m_LayerId.begin(), layerNumber );
//.........这里部分代码省略.........
示例8: CreateArray
int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
{
// first, check if we have a selection, or try to get one
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
// Be sure that there is at least one item that we can modify
if( !hoverSelection( selection ) )
return 0;
bool originalItemsModified = false;
// we have a selection to work on now, so start the tool process
PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
editFrame->OnModify();
if( m_editModules )
{
// Module editors do their undo point upfront for the whole module
editFrame->SaveCopyInUndoList( editFrame->GetBoard()->m_Modules, UR_MODEDIT );
}
else
{
// We may also change the original item
editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED );
}
DIALOG_CREATE_ARRAY::ARRAY_OPTIONS* array_opts = NULL;
VECTOR2I rp = selection.GetCenter();
const wxPoint rotPoint( rp.x, rp.y );
DIALOG_CREATE_ARRAY dialog( editFrame, rotPoint, &array_opts );
int ret = dialog.ShowModal();
if( ret == wxID_OK && array_opts != NULL )
{
PICKED_ITEMS_LIST newItemList;
for( int i = 0; i < selection.Size(); ++i )
{
BOARD_ITEM* item = selection.Item<BOARD_ITEM>( i );
if( !item )
continue;
wxString cachedString;
if( item->Type() == PCB_MODULE_T )
{
cachedString = static_cast<MODULE*>( item )->GetReferencePrefix();
}
else if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( item ) )
{
// Copy the text (not just take a reference
cachedString = text->GetText();
}
// iterate across the array, laying out the item at the
// correct position
const unsigned nPoints = array_opts->GetArraySize();
for( unsigned ptN = 0; ptN < nPoints; ++ptN )
{
BOARD_ITEM* newItem = NULL;
if( ptN == 0 )
newItem = item;
else
{
// if renumbering, no need to increment
const bool increment = !array_opts->ShouldRenumberItems();
// Some items cannot be duplicated
// i.e. the ref and value fields of a footprint or zones
// therefore newItem can be null
if( m_editModules )
newItem = editFrame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment );
else
{
#if 0
// @TODO: see if we allow zone duplication here
// Duplicate zones is especially tricky (overlaping zones must be merged)
// so zones are not duplicated
if( item->Type() == PCB_ZONE_AREA_T )
newItem = NULL;
else
#endif
newItem = editFrame->GetBoard()->DuplicateAndAddItem( item, increment );
}
if( newItem )
{
array_opts->TransformItem( ptN, newItem, rotPoint );
m_toolMgr->RunAction( COMMON_ACTIONS::unselectItem, true, newItem );
newItemList.PushItem( newItem );
//.........这里部分代码省略.........
示例9: Duplicate
int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
{
bool increment = aEvent.IsAction( &COMMON_ACTIONS::duplicateIncrement );
// first, check if we have a selection, or try to get one
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
// Be sure that there is at least one item that we can modify
if( !hoverSelection( selection ) )
return 0;
// we have a selection to work on now, so start the tool process
PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
editFrame->OnModify();
// prevent other tools making undo points while the duplicate is going on
// so that if you cancel, you don't get a duplicate object hiding over
// the original
incUndoInhibit();
if( m_editModules )
editFrame->SaveCopyInUndoList( editFrame->GetBoard()->m_Modules, UR_MODEDIT );
std::vector<BOARD_ITEM*> old_items;
for( int i = 0; i < selection.Size(); ++i )
{
BOARD_ITEM* item = selection.Item<BOARD_ITEM>( i );
if( item )
old_items.push_back( item );
}
for( unsigned i = 0; i < old_items.size(); ++i )
{
BOARD_ITEM* item = old_items[i];
// Unselect the item, so we won't pick it up again
// Do this first, so a single-item duplicate will correctly call
// SetCurItem and show the item properties
m_toolMgr->RunAction( COMMON_ACTIONS::unselectItem, true, item );
BOARD_ITEM* new_item = NULL;
if( m_editModules )
new_item = editFrame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment );
else
{
#if 0
// @TODO: see if we allow zone duplication here
// Duplicate zones is especially tricky (overlaping zones must be merged)
// so zones are not duplicated
if( item->Type() != PCB_ZONE_AREA_T )
#endif
new_item = editFrame->GetBoard()->DuplicateAndAddItem( item, increment );
}
if( new_item )
{
if( new_item->Type() == PCB_MODULE_T )
{
static_cast<MODULE*>( new_item )->RunOnChildren( boost::bind( &KIGFX::VIEW::Add,
getView(), _1 ) );
}
editFrame->GetGalCanvas()->GetView()->Add( new_item );
// Select the new item, so we can pick it up
m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, new_item );
}
}
// record the new items as added
if( !m_editModules )
editFrame->SaveCopyInUndoList( selection.items, UR_NEW );
editFrame->DisplayToolMsg( wxString::Format( _( "Duplicated %d item(s)" ),
(int) old_items.size() ) );
// pick up the selected item(s) and start moving
// this works well for "dropping" copies around
TOOL_EVENT evt = COMMON_ACTIONS::editActivate.MakeEvent();
Main( evt );
// and re-enable undos
decUndoInhibit();
return 0;
}
示例10: Init
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
BOARD* board = m_parent->GetBoard();
SetReturnCode( ZONE_ABORT ); // Will be changed on button click
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness );
m_ZoneMinThicknessCtrl->SetValue( msg );
if( m_settings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
switch( m_settings.m_Zone_HatchingStyle )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
}
// Create one column in m_LayerSelectionCtrl
wxListItem column0;
column0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
// Create an icon list:
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer;
if( m_zone )
lyrSelect = m_zone->GetLayer();
int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names
int imgIdx = 0;
for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++imgIdx )
{
LAYER_ID layer = *seq;
EDA_COLOR_T layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) );
wxString msg = board->GetLayerName( layer );
msg.Trim();
int itemIndex = m_LayerSelectionCtrl->InsertItem(
m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx );
if(lyrSelect == layer )
m_LayerSelectionCtrl->Select( itemIndex );
wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) );
ctrlWidth = std::max( ctrlWidth, tsize.x );
}
// The most easy way to ensure the right size is to use wxLIST_AUTOSIZE
// unfortunately this option does not work well both on
// wxWidgets 2.8 ( column witdth too small), and
// wxWidgets 2.9 ( column witdth too large)
ctrlWidth += LAYER_BITMAP_SIZE_X + 25; // Add bitmap width + margin between bitmap and text
m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth );
ctrlWidth += 25; // add small margin between text and window borders
// and room for vertical scroll bar
m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) );
}
示例11: OnUpdateLoadModuleFromBoard
void FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent )
{
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
aEvent.Enable( frame->GetBoard()->m_Modules != NULL );
}
示例12: DrawPage
/*
* This is the real print function: print the active screen
*/
void BOARD_PRINTOUT_CONTROLER::DrawPage()
{
int tmpzoom;
wxPoint tmp_startvisu;
wxPoint old_org;
wxPoint DrawOffset; // Offset de trace
double userscale;
double DrawZoom = 1;
wxDC* dc = GetDC();
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
bool printMirror = m_PrintParams.m_PrintMirror;
wxBusyCursor dummy;
// Save old draw scale and draw offset
tmp_startvisu = screen->m_StartVisu;
tmpzoom = screen->GetZoom();
old_org = screen->m_DrawOrg;
// Change draw scale and offset to draw the whole page
screen->SetScalingFactor( DrawZoom );
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent;
wxSize pageSizeIU = pcbframe->GetPageSizeIU(); // internal units
EDA_RECT bbbox = pcbframe->GetBoard()->ComputeBoundingBox();
// In module editor, the module is located at 0,0 but for printing
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
// So the equivalent board must be moved:
if( m_Parent->IsType( MODULE_EDITOR_FRAME ) )
{
bbbox.Move( wxPoint( pageSizeIU.x/2, pageSizeIU.y/2 ) );
}
// Compute the PCB size in internal units
userscale = m_PrintParams.m_PrintScale;
if( userscale == 0 ) // fit in page
{
// Margin = 0.4 inch
#if defined(KICAD_NANOMETRE)
int extra_margin = int( 0.4 * 25400 ); // nanometers
#else
int extra_margin = int( 0.4 * 1000 ); // deci-mils
#endif
pageSizeIU.x = bbbox.GetWidth() + extra_margin * 2;
pageSizeIU.y = bbbox.GetHeight() + extra_margin * 2;
userscale = 0.99;
}
if( (m_PrintParams.m_PrintScale > 1.0) // scale > 1 -> Recadrage
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page
{
DrawOffset += bbbox.Centre();
}
if( m_PrintParams.m_PageSetupData )
{
wxSize pagesize;
pagesize.x = int( pageSizeIU.x / userscale );
pagesize.y = int( pageSizeIU.y / userscale );
FitThisSizeToPageMargins( pagesize, *m_PrintParams.m_PageSetupData );
}
// Compute Accurate scale 1
if( userscale == 1.0 )
{
// We want a 1:1 scale and margins for printing
MapScreenSizeToPaper();
int w, h;
GetPPIPrinter( &w, &h );
double accurate_Xscale = ( (double) ( DrawZoom * w ) ) / (double) PCB_INTERNAL_UNIT;
double accurate_Yscale = ( (double) ( DrawZoom * h ) ) / (double) PCB_INTERNAL_UNIT;
if( IsPreview() ) // Scale must take in account the DC size in Preview
{
// Get the size of the DC in pixels
wxSize PlotAreaSize;
dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y );
GetPageSizePixels( &w, &h );
accurate_Xscale *= PlotAreaSize.x;
accurate_Xscale /= (double) w;
accurate_Yscale *= PlotAreaSize.y;
accurate_Yscale /= (double) h;
}
accurate_Xscale *= m_PrintParams.m_XScaleAdjust;
accurate_Yscale *= m_PrintParams.m_YScaleAdjust;
// Fine scale adjust
dc->SetUserScale( accurate_Xscale, accurate_Yscale );
}
//.........这里部分代码省略.........