void LIB_FIELD::Init( int id ) { m_id = id; SetTextWidth( GetDefaultTextSize() ); SetTextHeight( GetDefaultTextSize() ); SetTextAngle( TEXT_ANGLE_HORIZ ); // constructor already did this. // fields in RAM must always have names, because we are trying to get // less dependent on field ids and more dependent on names. // Plus assumptions are made in the field editors. m_name = TEMPLATE_FIELDNAME::GetDefaultFieldName( id ); switch( id ) { case DATASHEET: case FOOTPRINT: // by contrast, VALUE and REFERENCE are are always constructed as // initially visible, and template fieldsnames' initial visibility // is controlled by the template fieldname configuration record. SetVisible( false ); break; } }
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_ITEM( NULL, SCH_SHEET_T ) { m_Layer = LAYER_SHEET; m_pos = pos; m_size = wxSize( MIN_SHEET_WIDTH, MIN_SHEET_HEIGHT ); SetTimeStamp( GetNewTimeStamp() ); m_sheetNameSize = GetDefaultTextSize(); m_fileNameSize = GetDefaultTextSize(); m_screen = NULL; m_name.Printf( wxT( "Sheet%8.8lX" ), (long) m_TimeStamp ); m_fileName.Printf( wxT( "file%8.8lX.sch" ), (long) m_TimeStamp ); }
void LIB_FIELD::Init( int id ) { m_id = id; m_Size.x = GetDefaultTextSize(); m_Size.y = GetDefaultTextSize(); m_typeName = _( "Field" ); m_Orient = TEXT_ORIENT_HORIZ; m_rotate = false; m_updateText = false; // fields in RAM must always have names, because we are trying to get // less dependent on field ids and more dependent on names. // Plus assumptions are made in the field editors. m_name = TEMPLATE_FIELDNAME::GetDefaultFieldName( id ); }
bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) { char Name1[256]; char Name2[256]; char Name3[256]; int thickness = 0, size = 0, orient = 0; Name1[0] = 0; Name2[0] = 0; Name3[0] = 0; char* sline = (char*) aLine; while( ( *sline != ' ' ) && *sline ) sline++; // sline points the start of parameters int ii = sscanf( sline, "%255s %d %d %d %d %255s %255s %d", Name1, &m_Pos.x, &m_Pos.y, &orient, &size, Name2, Name3, &thickness ); if( ii < 4 ) { aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ), aLine.LineNumber() ); return false; } if( !aLine.ReadLine() ) { aErrorMsg.Printf( wxT( "Eeschema file label load error atline %d" ), aLine.LineNumber() ); return false; } if( size == 0 ) size = GetDefaultTextSize(); char* text = strtok( (char*) aLine, "\n\r" ); if( text == NULL ) { aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ), aLine.LineNumber() ); return false; } m_Text = FROM_UTF8( text ); m_Size.x = m_Size.y = size; SetOrientation( orient ); if( isdigit( Name3[0] ) ) { thickness = atol( Name3 ); m_Bold = ( thickness != 0 ); m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0; } if( stricmp( Name2, "Italic" ) == 0 ) m_Italic = 1; return true; }
void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) { wxArrayString units; GRIDS grid_list = GetScreen()->GetGrids(); DIALOG_EESCHEMA_OPTIONS dlg( this ); units.Add( GetUnitsLabel( INCHES ) ); units.Add( GetUnitsLabel( MILLIMETRES ) ); dlg.SetUnits( units, g_UserUnit ); dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() ); dlg.SetBusWidth( GetDefaultBusThickness() ); dlg.SetLineWidth( GetDefaultLineThickness() ); dlg.SetPinLength( GetDefaultPinLength() ); dlg.SetTextSize( GetDefaultTextSize() ); dlg.SetRepeatHorizontal( g_RepeatStep.x ); dlg.SetRepeatVertical( g_RepeatStep.y ); dlg.SetRepeatLabel( g_RepeatDeltaLabel ); dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 ); dlg.SetRefIdSeparator( LIB_COMPONENT::GetSubpartIdSeparator( ), LIB_COMPONENT::GetSubpartFirstId() ); dlg.SetShowGrid( IsGridVisible() ); dlg.SetShowHiddenPins( m_showAllPins ); dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() ); dlg.SetEnableZoomNoCenter( m_canvas->GetEnableZoomNoCenter() ); dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() ); dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); dlg.SetEnableHVBusOrientation( GetForceHVLines() ); dlg.SetShowPageLimits( g_ShowPageLimits ); dlg.Layout(); dlg.Fit(); dlg.SetMinSize( dlg.GetSize() ); const TEMPLATE_FIELDNAMES& tfnames = m_TemplateFieldNames.GetTemplateFieldNames(); for( unsigned i=0; i<tfnames.size(); ++i ) { DBG(printf("dlg.SetFieldName(%d, '%s')\n", i, TO_UTF8( tfnames[i].m_Name) );) dlg.SetFieldName( i, tfnames[i].m_Name ); }
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME ) { m_showAxis = true; // true to draw axis SetShowDeMorgan( false ); m_DrawSpecificConvert = true; m_DrawSpecificUnit = false; m_hotkeysDescrList = g_Libedit_Hotkeys_Descr; m_SyncPinEdit = false; m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN; SetShowElectricalType( true ); m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs m_my_part = NULL; m_treePane = nullptr; m_libMgr = nullptr; m_unit = 1; m_convert = 1; m_AboutTitle = "LibEdit"; // Delayed initialization if( g_LastTextSize == -1 ) g_LastTextSize = GetDefaultTextSize(); // Initialize grid id to the default value 50 mils: m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) ); SetIcon( icon ); LoadSettings( config() ); // Ensure axis are always drawn KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions(); gal_opts.m_axesEnabled = true; m_dummyScreen = new SCH_SCREEN( aKiway ); SetScreen( m_dummyScreen ); GetScreen()->m_Center = true; GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); SetCrossHairPosition( wxPoint( 0, 0 ) ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); m_libMgr = new LIB_MANAGER( *this ); SyncLibraries( true ); m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr ); setupTools(); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); updateTitle(); DisplayCmpDoc(); RebuildSymbolUnitsList(); m_auimgr.SetManagedWindow( this ); m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1) .Caption( _( "Libraries" ) ).MinSize( 250, -1 ) .BestSize( m_defaultLibWidth, -1 ).Resizable() ); m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) ); m_auimgr.AddPane( m_canvas->GetWindow(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() ); m_auimgr.Update(); GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId ); Raise(); Show( true ); Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnConfigurePaths, this, ID_PREFERENCES_CONFIGURE_PATHS ); Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this, ID_EDIT_SYM_LIB_TABLE ); m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); SyncView(); GetGalCanvas()->GetViewControls()->SetSnapping( true ); GetGalCanvas()->GetView()->UseDrawPriority( true ); GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() ); GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); // Set the working/draw area size to display a symbol to a reasonable value: // A 600mm x 600mm with a origin at the area center looks like a large working area double max_size_x = Millimeter2iu( 600 ); double max_size_y = Millimeter2iu( 600 ); BOX2D bbox; bbox.SetOrigin( -max_size_x /2, -max_size_y/2 ); bbox.SetSize( max_size_x, max_size_y ); GetCanvas()->GetView()->SetBoundary( bbox ); }
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME ) { m_showAxis = true; // true to draw axis SetShowDeMorgan( false ); m_drawSpecificConvert = true; m_drawSpecificUnit = false; m_hotkeysDescrList = g_Libedit_Hokeys_Descr; m_editPinsPerPartOrConvert = false; m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN; m_my_part = NULL; m_tempCopyComponent = NULL; // Delayed initialization if( m_textSize == -1 ) m_textSize = GetDefaultTextSize(); // Initialize grid id to the default value 50 mils: m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; wxIcon icon; icon.CopyFromBitmap( KiBitmap( libedit_icon_xpm ) ); SetIcon( icon ); LoadSettings( config() ); SetScreen( new SCH_SCREEN( aKiway ) ); GetScreen()->m_Center = true; GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); SetCrossHairPosition( wxPoint( 0, 0 ) ); // Ensure m_LastGridSizeId is an offset inside the allowed schematic range if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000; SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); if( m_canvas ) m_canvas->SetEnableBlockCommands( true ); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); // Ensure the current alias name is valid if a part is loaded // Sometimes it is not valid. This is the case // when a part value (the part lib name), or the alias list was modified // during a previous session and the modifications not saved in lib. // Reopen libedit in a new session gives a non valid m_aliasName // because the curr part is reloaded from the library (and this is the unmodified part) // and the old alias name (from the previous edition) can be invalid LIB_PART* part = GetCurPart(); if( part == NULL ) m_aliasName.Empty(); else if( m_aliasName != part->GetName() ) { LIB_ALIAS* alias = part->GetAlias( m_aliasName ); if( !alias ) m_aliasName = part->GetName(); } CreateOptionToolbar(); DisplayLibInfos(); DisplayCmpDoc(); UpdateAliasSelectList(); UpdatePartSelectList(); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); EDA_PANEINFO vert; vert.VerticalToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) ); m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() ); m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() ); m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); m_auimgr.Update(); Raise(); Show( true ); wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE ); wxPostEvent( this, evt ); }
bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) { int fieldNdx, size; SCH_SHEET_PIN* sheetPin; char* ptcar; SetTimeStamp( GetNewTimeStamp() ); // sheets are added to the GetDrawItems() like other schematic components. // however, in order to preserve the hierarchy (through m_Parent pointers), // a duplicate of the sheet is added to m_SubSheet array. // must be a duplicate, references just work for a two-layer structure. // this is accomplished through the Sync() function. if( ((char*)aLine)[0] == '$' ) // line should be "$Sheet" { if( !aLine.ReadLine() ) { aErrorMsg.Printf( wxT( "Read File Error" ) ); return false; } } /* Next line: must be "S xx yy nn mm" with xx, yy = sheet position * ( upper left corner ) et nn,mm = sheet size */ if( ( sscanf( &((char*)aLine)[1], "%d %d %d %d", &m_pos.x, &m_pos.y, &m_size.x, &m_size.y ) != 4 ) || ( ((char*)aLine)[0] != 'S' ) ) { aErrorMsg.Printf( wxT( " ** Eeschema file sheet error at line %d, aborted\n" ), aLine.LineNumber() ); aErrorMsg << FROM_UTF8( ((char*)aLine) ); return false; } /* Read fields */ for( ; ; ) /* Analysis of lines "Fn" text. */ { if( !aLine.ReadLine() ) return false; if( ((char*)aLine)[0] == 'U' ) { sscanf( ((char*)aLine) + 1, "%lX", &m_TimeStamp ); if( m_TimeStamp == 0 ) // zero is not unique! SetTimeStamp( GetNewTimeStamp() ); continue; } if( ((char*)aLine)[0] != 'F' ) break; sscanf( ((char*)aLine) + 1, "%d", &fieldNdx ); /* Read the field: * If fieldNdx> = 2: Fn "text" t s posx posy * If F0 "text" for SheetName * F1 and "text" for filename */ ptcar = ((char*)aLine); while( *ptcar && ( *ptcar != '"' ) ) ptcar++; if( *ptcar != '"' ) { aErrorMsg.Printf( wxT( "Eeschema file sheet label F%d at line %d, aborted\n" ), fieldNdx, aLine.LineNumber() ); aErrorMsg << FROM_UTF8( (char*) aLine ); return false; } wxString sheetName; ptcar += ReadDelimitedText( &sheetName, ptcar ); if( *ptcar == 0 ) { aErrorMsg.Printf( wxT( "Eeschema file sheet field F at line %d, aborted\n" ), aLine.LineNumber() ); aErrorMsg << FROM_UTF8( (char*) aLine ); return false; } if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) ) { if( sscanf( ptcar, "%d", &size ) != 1 ) { aErrorMsg.Printf( wxT( "Eeschema file sheet Label error line %d, aborted\n" ), aLine.LineNumber() ); aErrorMsg << FROM_UTF8( (char*) aLine ); } if( size == 0 ) size = GetDefaultTextSize(); if( fieldNdx == 0 ) { m_name = sheetName; m_sheetNameSize = size; } else { SetFileName( sheetName ); m_fileNameSize = size; } } if( fieldNdx > 1 ) { sheetPin = new SCH_SHEET_PIN( this ); if( !sheetPin->Load( aLine, aErrorMsg ) ) { delete sheetPin; sheetPin = NULL; return false; } AddPin( sheetPin ); } } if( strnicmp( "$End", ((char*)aLine), 4 ) != 0 ) { aErrorMsg.Printf( wxT( "**Eeschema file end_sheet error at line %d, aborted\n" ), aLine.LineNumber() ); aErrorMsg << FROM_UTF8( ((char*)aLine) ); return false; } return true; }
bool SCH_SHEET_PIN::Load( LINE_READER& aLine, wxString& aErrorMsg ) { int size; char number[256]; char name[256]; char connectType[256]; char sheetSide[256]; char* line = aLine.Line(); char* cp; static const char delims[] = " \t"; // Read coordinates. // D( printf( "line: \"%s\"\n", line );) cp = strtok( line, delims ); strncpy( number, cp, sizeof(number) ); number[sizeof(number)-1] = 0; cp += strlen( number ) + 1; cp += ReadDelimitedText( name, cp, sizeof(name) ); cp = strtok( cp, delims ); strncpy( connectType, cp, sizeof(connectType) ); connectType[sizeof(connectType)-1] = 0; cp = strtok( NULL, delims ); strncpy( sheetSide, cp, sizeof(sheetSide) ); sheetSide[sizeof(sheetSide)-1] = 0; cp += strlen( sheetSide ) + 1; int r = sscanf( cp, "%d %d %d", &m_Pos.x, &m_Pos.y, &size ); if( r != 3 ) { aErrorMsg.Printf( wxT( "Eeschema file sheet hierarchical label error at line %d.\n" ), aLine.LineNumber() ); aErrorMsg << FROM_UTF8( line ); return false; } m_Text = FROM_UTF8( name ); if( size == 0 ) size = GetDefaultTextSize(); m_Size.x = m_Size.y = size; switch( connectType[0] ) { case 'I': m_shape = NET_INPUT; break; case 'O': m_shape = NET_OUTPUT; break; case 'B': m_shape = NET_BIDI; break; case 'T': m_shape = NET_TRISTATE; break; case 'U': m_shape = NET_UNSPECIFIED; break; } switch( sheetSide[0] ) { case 'R' : /* pin on right side */ SetEdge( 1 ); break; case 'T' : /* pin on top side */ SetEdge( 2 ); break; case 'B' : /* pin on bottom side */ SetEdge( 3 ); break; case 'L' : /* pin on left side */ default : SetEdge( 0 ); break; } return true; }
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType ) { SCH_TEXT* textItem = NULL; SetRepeatItem( NULL ); switch( aType ) { case LAYER_NOTES: textItem = new SCH_TEXT( GetCrossHairPosition() ); break; case LAYER_LOCLABEL: textItem = new SCH_LABEL( GetCrossHairPosition() ); break; case LAYER_HIERLABEL: textItem = new SCH_HIERLABEL( GetCrossHairPosition() ); textItem->SetShape( lastGlobalLabelShape ); break; case LAYER_GLOBLABEL: textItem = new SCH_GLOBALLABEL( GetCrossHairPosition() ); textItem->SetShape( lastGlobalLabelShape ); break; default: DisplayError( this, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) ); return NULL; } textItem->SetBold( lastTextBold ); textItem->SetItalic( lastTextItalic ); textItem->SetOrientation( lastTextOrientation ); textItem->SetSize( wxSize( GetDefaultTextSize(), GetDefaultTextSize() ) ); textItem->SetFlags( IS_NEW | IS_MOVED ); EditSchematicText( textItem ); if( textItem->GetText().IsEmpty() ) { delete textItem; return NULL; } lastTextBold = textItem->IsBold(); lastTextItalic = textItem->IsItalic(); lastTextOrientation = textItem->GetOrientation(); if( ( textItem->Type() == SCH_GLOBAL_LABEL_T ) || ( textItem->Type() == SCH_HIERARCHICAL_LABEL_T ) ) { lastGlobalLabelShape = textItem->GetShape(); } // Prepare display to move the new item textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); PrepareMoveItem( (SCH_ITEM*) textItem, aDC ); return textItem; }
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() ) { wxASSERT( aParent ); m_FrameName = GetLibEditFrameName(); m_showAxis = true; // true to draw axis m_configPath = wxT( "LibraryEditor" ); SetShowDeMorgan( false ); m_drawSpecificConvert = true; m_drawSpecificUnit = false; m_tempCopyComponent = NULL; m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr; m_editPinsPerPartOrConvert = false; // Delayed initialization if( m_textSize == -1 ) m_textSize = GetDefaultTextSize(); // Initialize grid id to the default value 50 mils: m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; wxIcon icon; icon.CopyFromBitmap( KiBitmap( libedit_icon_xpm ) ); SetIcon( icon ); SetScreen( new SCH_SCREEN() ); GetScreen()->m_Center = true; SetCrossHairPosition( wxPoint( 0, 0 ) ); LoadSettings( config() ); // Ensure m_LastGridSizeId is an offset inside the allowed schematic range if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000; SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); if( m_canvas ) m_canvas->SetEnableBlockCommands( true ); EnsureActiveLibExists(); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); CreateOptionToolbar(); DisplayLibInfos(); DisplayCmpDoc(); UpdateAliasSelectList(); UpdatePartSelectList(); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); EDA_PANEINFO vert; vert.VerticalToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) ); m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() ); m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() ); m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); m_auimgr.Update(); Show( true ); wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE ); wxPostEvent( this, evt ); }
void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) { wxArrayString units; GRIDS grid_list = GetScreen()->GetGrids(); bool saveProjectConfig = false; DIALOG_EESCHEMA_OPTIONS dlg( this ); units.Add( GetUnitsLabel( INCHES ) ); units.Add( GetUnitsLabel( MILLIMETRES ) ); dlg.SetUnits( units, g_UserUnit ); dlg.SetGridSizes( grid_list, GetScreen()->GetGridCmdId() ); dlg.SetBusWidth( GetDefaultBusThickness() ); dlg.SetLineWidth( GetDefaultLineThickness() ); dlg.SetTextSize( GetDefaultTextSize() ); dlg.SetRepeatHorizontal( GetRepeatStep().x ); dlg.SetRepeatVertical( GetRepeatStep().y ); dlg.SetRepeatLabel( GetRepeatDeltaLabel() ); dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 ); dlg.SetRefIdSeparator( LIB_PART::GetSubpartIdSeparator(), LIB_PART::GetSubpartFirstId() ); dlg.SetShowGrid( IsGridVisible() ); dlg.SetShowHiddenPins( m_showAllPins ); dlg.SetEnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); dlg.SetEnableZoomNoCenter( m_canvas->GetEnableZoomNoCenter() ); dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); dlg.SetEnableHVBusOrientation( GetForceHVLines() ); dlg.SetShowPageLimits( m_showPageLimits ); dlg.SetFootprintPreview( m_footprintPreview ); dlg.SetAutoplaceFields( m_autoplaceFields ); dlg.SetAutoplaceJustify( m_autoplaceJustify ); dlg.SetAutoplaceAlign( m_autoplaceAlign ); dlg.Layout(); dlg.Fit(); dlg.SetMinSize( dlg.GetSize() ); dlg.SetTemplateFields( m_TemplateFieldNames.GetTemplateFieldNames() ); if( dlg.ShowModal() == wxID_CANCEL ) return; g_UserUnit = (EDA_UNITS_T)dlg.GetUnitsSelection(); wxRealPoint gridsize = grid_list[ (size_t) dlg.GetGridSelection() ].m_Size; m_LastGridSizeId = GetScreen()->SetGrid( gridsize ); int sep, firstId; dlg.GetRefIdSeparator( sep, firstId); if( sep != (int)LIB_PART::GetSubpartIdSeparator() || firstId != (int)LIB_PART::GetSubpartFirstId() ) { LIB_PART::SetSubpartIdNotation( sep, firstId ); saveProjectConfig = true; } SetDefaultBusThickness( dlg.GetBusWidth() ); SetDefaultLineThickness( dlg.GetLineWidth() ); if( dlg.GetTextSize() != GetDefaultTextSize() ) { SetDefaultTextSize( dlg.GetTextSize() ); saveProjectConfig = true; } wxPoint step; step.x = dlg.GetRepeatHorizontal(); step.y = dlg.GetRepeatVertical(); SetRepeatStep( step ); SetRepeatDeltaLabel( dlg.GetRepeatLabel() ); SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 ); SetGridVisibility( dlg.GetShowGrid() ); m_showAllPins = dlg.GetShowHiddenPins(); m_canvas->SetEnableMousewheelPan( dlg.GetEnableMousewheelPan() ); m_canvas->SetEnableZoomNoCenter( dlg.GetEnableZoomNoCenter() ); m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() ); SetForceHVLines( dlg.GetEnableHVBusOrientation() ); m_showPageLimits = dlg.GetShowPageLimits(); m_autoplaceFields = dlg.GetAutoplaceFields(); m_autoplaceJustify = dlg.GetAutoplaceJustify(); m_autoplaceAlign = dlg.GetAutoplaceAlign(); m_footprintPreview = dlg.GetFootprintPreview(); // Delete all template fieldnames and then restore them using the template field data from // the options dialog DeleteAllTemplateFieldNames(); TEMPLATE_FIELDNAMES newFieldNames = dlg.GetTemplateFields(); for( TEMPLATE_FIELDNAMES::iterator dlgfld = newFieldNames.begin(); dlgfld != newFieldNames.end(); ++dlgfld ) { TEMPLATE_FIELDNAME fld = *dlgfld; AddTemplateFieldName( fld ); } SaveSettings( config() ); // save values shared by eeschema applications. if( saveProjectConfig ) SaveProjectSettings( true ); m_canvas->Refresh( true ); }