diff --git a/3d-viewer/3d_viewer.h b/3d-viewer/3d_viewer.h index edcd8880d0..44ff2598b5 100644 --- a/3d-viewer/3d_viewer.h +++ b/3d-viewer/3d_viewer.h @@ -124,7 +124,7 @@ public: double m_BoardScale; /* Normalization scale for coordinates: * when scaled between -1.0 and +1.0 */ double m_LayerZcoord[32]; - double m_ActZpos; + double m_ActZpos; public: Info_3D_Visu(); ~Info_3D_Visu(); }; @@ -170,13 +170,15 @@ public: void InitGL(); void SetLights(); void Draw3D_Track( TRACK* track ); - /** Function Draw3D_SolidPolygonsInZones + /** + * Function Draw3D_SolidPolygonsInZones * draw all solid polygons used as filles areas in a zone * @param aZone_c = the zone to draw */ - void Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone_c ); + void Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone_c ); - /** Function Draw3D_Polygon + /** + * Function Draw3D_Polygon * draw one solid polygon * @param aCornersList = a std::vector liste of corners, in physical coordinates * @param aZpos = the z position in 3D units @@ -185,12 +187,12 @@ public: void Draw3D_Via( SEGVIA* via ); void Draw3D_DrawSegment( DRAWSEGMENT* segment ); void Draw3D_DrawText( TEXTE_PCB* text ); - + /// Toggles ortographic projection on and off void ToggleOrtho(){ m_ortho = !m_ortho ; Refresh(true);}; /// Returns the orthographic projection flag bool ModeIsOrtho() { return m_ortho ;}; - + //int Get3DLayerEnable(int act_layer); @@ -230,7 +232,8 @@ public: void SetToolbars(); void GetSettings(); void SaveSettings(); - /** function ReloadRequest + /** + * Function ReloadRequest * must be called when reloading data from Pcbnew is needed * mainly after edition of the board or footprint beeing displayed. * mainly for the module editor. diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 952aa093a6..e3eb0c0913 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,27 @@ KiCad ChangeLog 2010 Please add newer entries at the top, list the date and your name with email address. +2010-nov-11 UPDATE Wayne Stambaugh +================================================================================ +++EESchema + * Make schematic object file naming consistent. + * Move annotate dialog to dialogs subdirectory and set the "Annotation" + button as the default. + * Move ERC dialog to dialogs subdirectory and set the "Test Erc" button + as the default. + * Move the print dialog to dialogs subdirectory and set the "Print" button + as the default. + * Create print dialog header and move the OnPrint() method into + schframe.cpp. + + +2010-nov-10 UPDATE Wayne Stambaugh +================================================================================ +++EESchema + * Header file rationalization. + * Move schematic object load code into the appropriate schematic object. + + 2010-nov-3 UPDATE Wayne Stambaugh ================================================================================ ++common diff --git a/CMakeModules/TokenList2DsnLexer.cmake b/CMakeModules/TokenList2DsnLexer.cmake index 0c310f9d0a..5e464c1af6 100644 --- a/CMakeModules/TokenList2DsnLexer.cmake +++ b/CMakeModules/TokenList2DsnLexer.cmake @@ -262,9 +262,9 @@ public: * this lower level function returning an int (so the enum does not collide * with another usage). * @return ${enum} - the type of token found next. - * @throw IOError - only if the LINE_READER throws it. + * @throw IO_ERROR - only if the LINE_READER throws it. */ - ${enum} NextTok() throw (IOError) + ${enum} NextTok() throw( IO_ERROR ) { return (${enum}) DSNLEXER::NextTok(); } @@ -273,11 +273,11 @@ public: * Function NeedSYMBOL * calls NextTok() and then verifies that the token read in * satisfies bool IsSymbol(). - * If not, an IOError is thrown. + * If not, an IO_ERROR is thrown. * @return int - the actual token read in. - * @throw IOError, if the next token does not satisfy IsSymbol() + * @throw IO_ERROR, if the next token does not satisfy IsSymbol() */ - ${enum} NeedSYMBOL() throw( IOError ) + ${enum} NeedSYMBOL() throw( IO_ERROR ) { return (${enum}) DSNLEXER::NeedSYMBOL(); } @@ -286,11 +286,11 @@ public: * Function NeedSYMBOLorNUMBER * calls NextTok() and then verifies that the token read in * satisfies bool IsSymbol() or tok==T_NUMBER. - * If not, an IOError is thrown. + * If not, an IO_ERROR is thrown. * @return int - the actual token read in. - * @throw IOError, if the next token does not satisfy the above test + * @throw IO_ERROR, if the next token does not satisfy the above test */ - ${enum} NeedSYMBOLorNUMBER() throw( IOError ) + ${enum} NeedSYMBOLorNUMBER() throw( IO_ERROR ) { return (${enum}) DSNLEXER::NeedSYMBOLorNUMBER(); } diff --git a/Documentation/coding_style_policy.pdf b/Documentation/coding_style_policy.pdf index 2cfac0d0dd..67ed1cf32f 100644 Binary files a/Documentation/coding_style_policy.pdf and b/Documentation/coding_style_policy.pdf differ diff --git a/common/dialog_page_settings.cpp b/common/dialog_page_settings.cpp index ad7d38c744..909de97fa8 100644 --- a/common/dialog_page_settings.cpp +++ b/common/dialog_page_settings.cpp @@ -12,13 +12,12 @@ #include "common.h" #include "base_struct.h" #include "class_drawpanel.h" -#include "class_base_screen.h" +#include "class_sch_screen.h" #include "wxstruct.h" #include "wx/valgen.h" #ifdef EESCHEMA -#include "program.h" #include "general.h" #endif diff --git a/common/sch_item_struct.cpp b/common/sch_item_struct.cpp index 6fabfa43c2..3163c657ee 100644 --- a/common/sch_item_struct.cpp +++ b/common/sch_item_struct.cpp @@ -11,7 +11,6 @@ #include "class_drawpanel.h" #include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" @@ -29,10 +28,17 @@ SCH_ITEM::SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) : m_Layer = 0; } + SCH_ITEM::~SCH_ITEM() { + // Do not let the connections container go out of scope with any ojbects or they + // will be deleted by the container will cause the EESchema to crash. These objects + // are owned by the sheet object container. + if( !m_connections.empty() ) + m_connections.release(); } + /** * place the struct in EEDrawList. * if it is a new item, it it also put in undo list diff --git a/cvpcb/class_DisplayFootprintsFrame.h b/cvpcb/class_DisplayFootprintsFrame.h index 5e55298632..f3dda4784c 100644 --- a/cvpcb/class_DisplayFootprintsFrame.h +++ b/cvpcb/class_DisplayFootprintsFrame.h @@ -26,18 +26,21 @@ public: void OnSelectOptionToolbar( wxCommandEvent& event ); - /** Function IsGridVisible() , virtual + /** + * Function IsGridVisible() , virtual * @return true if the grid must be shown */ virtual bool IsGridVisible(); - /** Function SetGridVisibility() , virtual + /** + * Function SetGridVisibility() , virtual * It may be overloaded by derived classes * if you want to store/retrieve the grid visiblity in configuration. * @param aVisible = true if the grid must be shown */ virtual void SetGridVisibility(bool aVisible); - /** Function GetGridColor() , virtual + /** + * Function GetGridColor() , virtual * @return the color of the grid */ virtual int GetGridColor(); @@ -64,7 +67,8 @@ public: } - /** Function SaveCopyInUndoList (overloaded). + /** + * Function SaveCopyInUndoList (overloaded). * Creates a new entry in undo list of commands. * add a list of pickers to handle a list of items * @param aItemsList = the list of items modified by the command to undo diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index e94d771730..79025de9f2 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -8,26 +8,16 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} set(EESCHEMA_SRCS annotate.cpp - annotate_dialog.cpp backanno.cpp block.cpp block_libedit.cpp build_BOM.cpp busentry.cpp bus-wire-junction.cpp - class_drawsheet.cpp - class_drawsheetpath.cpp class_drc_erc_item.cpp - class_hierarchical_PIN_sheet.cpp class_libentry.cpp class_library.cpp - class_marker_sch.cpp class_netlist_object.cpp - class_sch_cmp_field.cpp - class_sch_component.cpp - class_schematic_items.cpp - class_sch_screen.cpp - class_text-label.cpp cleanup.cpp cmp_library_keywords.cpp cmp_library_lexer.cpp @@ -43,7 +33,8 @@ set(EESCHEMA_SRCS dialogs/dialog_plot_schematic_HPGL_base.cpp dialogs/dialog_plot_schematic_PS.cpp dialogs/dialog_plot_schematic_PS_base.cpp - dialog_annotate_base.cpp + dialogs/annotate_dialog.cpp + dialogs/dialog_annotate_base.cpp dialog_bodygraphictext_properties_base.cpp dialog_build_BOM.cpp dialog_build_BOM_base.cpp @@ -59,8 +50,8 @@ set(EESCHEMA_SRCS dialog_eeschema_config_fbp.cpp dialog_eeschema_options_base.cpp dialog_eeschema_options.cpp - dialog_erc.cpp - dialog_erc_base.cpp + dialogs/dialog_erc.cpp + dialogs/dialog_erc_base.cpp dialog_libedit_dimensions.cpp dialog_libedit_dimensions_base.cpp dialog_lib_edit_draw_item.cpp @@ -69,8 +60,8 @@ set(EESCHEMA_SRCS dialog_lib_edit_pin_base.cpp dialog_lib_new_component.cpp dialog_lib_new_component_base.cpp - dialog_print_using_printer_base.cpp - dialog_print_using_printer.cpp + dialogs/dialog_print_using_printer_base.cpp + dialogs/dialog_print_using_printer.cpp dialog_sch_sheet_props.cpp dialog_sch_sheet_props_base.cpp dialogs/dialog_schematic_find.cpp @@ -122,7 +113,15 @@ set(EESCHEMA_SRCS operations_on_items_lists.cpp pinedit.cpp plot.cpp - read_from_file_schematic_items_descriptions.cpp + sch_component.cpp + sch_field.cpp + sch_items.cpp + sch_marker.cpp + sch_screen.cpp + sch_sheet.cpp + sch_sheet_path.cpp + sch_sheet_pin.cpp + sch_text.cpp schedit.cpp schematic_undo_redo.cpp schframe.cpp diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index 9666ff2bcd..142314134c 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -10,10 +10,12 @@ #include "class_drawpanel.h" #include "confirm.h" #include "wxstruct.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "class_library.h" #include "protos.h" +#include "sch_component.h" #include "netlist.h" #include "lib_pin.h" diff --git a/eeschema/backanno.cpp b/eeschema/backanno.cpp index 85adffd464..8f0722ecab 100644 --- a/eeschema/backanno.cpp +++ b/eeschema/backanno.cpp @@ -5,15 +5,16 @@ #include "fctsys.h" #include "common.h" -#include "program.h" #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" #include "appl_wxstruct.h" +#include "wxEeschemaStruct.h" +#include "build_version.h" #include "general.h" - -#include "build_version.h" +#include "sch_sheet_path.h" +#include "sch_component.h" /** function FillFootprintFieldForAllInstancesofComponent diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 395c6f9e90..bca34faedc 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -9,13 +9,20 @@ #include "class_drawpanel.h" #include "confirm.h" #include "block_commande.h" +#include "wxEeschemaStruct.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" -#include "class_marker_sch.h" #include "class_library.h" #include "lib_pin.h" #include "protos.h" +#include "sch_marker.h" +#include "sch_items.h" +#include "sch_text.h" +#include "sch_component.h" +#include "sch_sheet.h" + +#include // Imported functions: diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index aafb51cb0b..dab78a1c5c 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -9,7 +9,6 @@ #include "confirm.h" #include "block_commande.h" -#include "program.h" #include "general.h" #include "class_library.h" #include "protos.h" diff --git a/eeschema/build_BOM.cpp b/eeschema/build_BOM.cpp index 0323bef5a0..8fae3eb90d 100644 --- a/eeschema/build_BOM.cpp +++ b/eeschema/build_BOM.cpp @@ -15,12 +15,15 @@ #include "kicad_string.h" #include "gestfich.h" #include "appl_wxstruct.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "class_library.h" #include "netlist.h" #include "protos.h" +#include "sch_sheet.h" +#include "template_fieldnames.h" +#include "sch_component.h" #include "build_version.h" diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index c91aa5f3f8..dcf0e200e9 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -7,12 +7,17 @@ #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "wxEeschemaStruct.h" +#include "class_sch_screen.h" -#include "program.h" #include "lib_draw_item.h" #include "lib_pin.h" #include "general.h" #include "protos.h" +#include "sch_items.h" +#include "sch_text.h" +#include "sch_component.h" +#include "sch_sheet.h" /* Routines Locales */ @@ -119,7 +124,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) } newsegment->m_Flags = IS_NEW; - if( g_HVLines ) // We need 2 segments to go from a given start pint to + if( g_HVLines ) // We need 2 segments to go from a given start pin to // an end point { nextsegment = newsegment->GenCopy(); diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index 27b87539e9..b2202f8dfd 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -8,10 +8,13 @@ #include "class_drawpanel.h" #include "eeschema_id.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_items.h" + static int s_LastShape = '\\'; static wxPoint ItemInitialPosition; @@ -20,8 +23,7 @@ static wxPoint ItemInitialPosition; static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC ) { /* Exit bus entry mode. */ - SCH_BUS_ENTRY* BusEntry = - (SCH_BUS_ENTRY*) Panel->GetScreen()->GetCurItem(); + SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) Panel->GetScreen()->GetCurItem(); if( BusEntry ) { @@ -47,7 +49,7 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC ) static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { - /* Drawing of the bus entry segment" while moving the cursor. */ + // Draws the bus entry while moving the cursor BASE_SCREEN* screen = panel->GetScreen(); SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem(); @@ -67,21 +69,12 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) SCH_BUS_ENTRY* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC, int entry_type ) { - /* Create a new bus entry, and prepare moving function (for later place it) - */ + // Create and place a new bus entry at cursor position SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur, - s_LastShape, - entry_type ); - + s_LastShape, entry_type ); BusEntry->m_Flags = IS_NEW; - - DrawPanel->CursorOff( DC ); // Erase schematic cursor - RedrawOneStruct( DrawPanel, DC, BusEntry, g_XorMode ); - DrawPanel->CursorOn( DC ); // Display schematic cursor - + BusEntry->Place( this, DC );; OnModify( ); - - StartMoveBusEntry( BusEntry, DC ); return BusEntry; } diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 535438c471..bcd8efe1a4 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -4,14 +4,17 @@ #include "fctsys.h" #include "common.h" +#include "macros.h" #include "kicad_string.h" #include "class_drawpanel.h" #include "plot_common.h" #include "gr_basic.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "template_fieldnames.h" +#include "transform.h" #include "class_library.h" #include "class_libentry.h" #include "lib_pin.h" diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 13ebf18fa9..9ddf87d2be 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -5,6 +5,7 @@ #ifndef CLASS_LIBENTRY_H #define CLASS_LIBENTRY_H +#include "general.h" #include "lib_draw_item.h" #include "lib_field.h" @@ -521,13 +522,15 @@ public: int GetPartCount() { return m_unitCount; } - /** function IsMulti + /** + * Function IsMulti * @return true if the component has multiple parts per package. * When happens, the reference has a sub reference ti identify part */ bool IsMulti() { return m_unitCount > 1; } - /** function IsMulti + /** + * Function IsMulti * @return the sub reference for component having multiple parts per package. * The sub reference identify the part (or unit) * @param aUnit = the part identifier ( 1 to max count) diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index c6d0093ae7..c8361259f8 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -5,12 +5,13 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "kicad_string.h" #include "confirm.h" #include "gestfich.h" #include "eda_doc.h" +#include "wxstruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" diff --git a/eeschema/class_library.h b/eeschema/class_library.h index 77a650d83b..309a78fd1d 100644 --- a/eeschema/class_library.h +++ b/eeschema/class_library.h @@ -6,8 +6,11 @@ #define CLASS_LIBRARY_H +#include + #include "class_libentry.h" + /* * Component Library version and file header macros. */ diff --git a/eeschema/class_netlist_object.cpp b/eeschema/class_netlist_object.cpp index 7fa0c7a2bf..1abfae469a 100644 --- a/eeschema/class_netlist_object.cpp +++ b/eeschema/class_netlist_object.cpp @@ -5,9 +5,11 @@ #include "fctsys.h" #include "common.h" -#include "program.h" -#include "general.h" +#include "macros.h" +#include "wxEeschemaStruct.h" +#include "general.h" +#include "sch_component.h" #include "class_netlist_object.h" #if defined(DEBUG) diff --git a/eeschema/class_netlist_object.h b/eeschema/class_netlist_object.h index 9147151a32..c42a20b6a3 100644 --- a/eeschema/class_netlist_object.h +++ b/eeschema/class_netlist_object.h @@ -6,6 +6,8 @@ #ifndef _CLASS_NETLIST_OBJECT_H_ #define _CLASS_NETLIST_OBJECT_H_ +#include "sch_sheet_path.h" + #include "lib_pin.h" // LIB_PIN::ReturnPinStringNum( m_PinNum ) diff --git a/eeschema/cleanup.cpp b/eeschema/cleanup.cpp index 1cbca2cf24..5f66fd8b84 100644 --- a/eeschema/cleanup.cpp +++ b/eeschema/cleanup.cpp @@ -7,11 +7,12 @@ #include "trigo.h" #include "confirm.h" #include "macros.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "protos.h" #include "netlist.h" +#include "sch_items.h" /* Routine to start/end segment (BUS or wires) on junctions. diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 858faf8051..1affbf1d87 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -7,16 +7,19 @@ #include "common.h" #include "class_drawpanel.h" #include "eda_dde.h" -#include "eeschema_id.h" +#include "wxEeschemaStruct.h" -#include "program.h" +#include "eeschema_id.h" #include "general.h" #include "protos.h" #include "libeditframe.h" #include "viewlib_frame.h" #include "lib_draw_item.h" #include "lib_pin.h" -#include "class_marker_sch.h" +#include "sch_sheet.h" +#include "sch_sheet_path.h" +#include "sch_marker.h" +#include "sch_component.h" /** Function SchematicGeneralLocateAndDisplay diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index ac85a666c6..4e49c68126 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -5,14 +5,16 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "common.h" +#include "macros.h" #include "eda_dde.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "eeschema_id.h" #include "protos.h" #include "lib_draw_item.h" #include "lib_pin.h" +#include "sch_component.h" /***************************************************************/ diff --git a/eeschema/dangling_ends.cpp b/eeschema/dangling_ends.cpp index 163c35150a..11e4b0cd0a 100644 --- a/eeschema/dangling_ends.cpp +++ b/eeschema/dangling_ends.cpp @@ -4,12 +4,14 @@ #include "fctsys.h" #include "gr_basic.h" +#include "sch_item_struct.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_libentry.h" #include "lib_pin.h" +#include "sch_component.h" /* Returns true if the point P is on the segment S. */ diff --git a/eeschema/database.cpp b/eeschema/database.cpp index 5fcbd93afd..db6b8b75ea 100644 --- a/eeschema/database.cpp +++ b/eeschema/database.cpp @@ -5,11 +5,12 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "confirm.h" #include "eda_doc.h" #include "kicad_string.h" +#include "wxstruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" @@ -29,8 +30,7 @@ * Place the name of the component has loaded, select from a list in * BufName */ -wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, - wxString& BufName ) +wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, wxString& BufName ) { wxArrayString nameList; wxString msg; diff --git a/eeschema/delete.cpp b/eeschema/delete.cpp index 8db642d115..5e53032339 100644 --- a/eeschema/delete.cpp +++ b/eeschema/delete.cpp @@ -5,15 +5,19 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" -#include "class_marker_sch.h" +#include "sch_marker.h" +#include "sch_items.h" +#include "sch_sheet.h" +#include "sch_text.h" + // Imported function: -void DeleteItemsInList( WinEDA_DrawPanel* panel, - PICKED_ITEMS_LIST& aItemsList ); +void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ); /* @@ -28,7 +32,7 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame, bool TstJunction ) { SCH_ITEM* Struct; - int count = 0; + int count = 0; if( frame->LocatePinEnd( ListStruct, pos ) ) count++; diff --git a/eeschema/delsheet.cpp b/eeschema/delsheet.cpp index 7fd857293f..9fe864e090 100644 --- a/eeschema/delsheet.cpp +++ b/eeschema/delsheet.cpp @@ -6,10 +6,12 @@ #include "appl_wxstruct.h" #include "common.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_sheet.h" /**************************************************************************/ diff --git a/eeschema/dialog_SVG_print.cpp b/eeschema/dialog_SVG_print.cpp index d570b76884..a89ba7f15f 100644 --- a/eeschema/dialog_SVG_print.cpp +++ b/eeschema/dialog_SVG_print.cpp @@ -12,13 +12,16 @@ #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" #include "dialog_SVG_print_base.h" #include "dcsvg.h" -#include "program.h" #include "general.h" #include "libeditframe.h" +#include "sch_sheet_path.h" + // Keys for configuration #define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" ) diff --git a/eeschema/dialog_build_BOM.cpp b/eeschema/dialog_build_BOM.cpp index e46fcd4a6d..8b86d39211 100644 --- a/eeschema/dialog_build_BOM.cpp +++ b/eeschema/dialog_build_BOM.cpp @@ -10,8 +10,8 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "common.h" +#include "wxstruct.h" -#include "program.h" #include "general.h" #include "netlist.h" diff --git a/eeschema/dialog_build_BOM.h b/eeschema/dialog_build_BOM.h index 68a21d9100..80115117cb 100644 --- a/eeschema/dialog_build_BOM.h +++ b/eeschema/dialog_build_BOM.h @@ -10,6 +10,11 @@ #include "dialog_build_BOM_base.h" +class WinEDA_DrawFrame; +class SCH_COMPONENT; +class wxConfig; + + class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE { private: diff --git a/eeschema/dialog_create_component.cpp b/eeschema/dialog_create_component.cpp index 3606c4df4b..8912322f07 100644 --- a/eeschema/dialog_create_component.cpp +++ b/eeschema/dialog_create_component.cpp @@ -19,7 +19,6 @@ #include "common.h" #include "confirm.h" -#include "program.h" #include "class_libentry.h" #include "libeditframe.h" diff --git a/eeschema/dialog_edit_component_in_lib.cpp b/eeschema/dialog_edit_component_in_lib.cpp index 6f487b6b9c..3abd98f3fd 100644 --- a/eeschema/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialog_edit_component_in_lib.cpp @@ -9,12 +9,10 @@ #include "confirm.h" #include "gestfich.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" #include "class_library.h" -//#include "class_libentry.h" #include "dialog_edit_component_in_lib.h" diff --git a/eeschema/dialog_edit_component_in_schematic.cpp b/eeschema/dialog_edit_component_in_schematic.cpp index 9e33348520..8a93ebecda 100644 --- a/eeschema/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialog_edit_component_in_schematic.cpp @@ -8,11 +8,13 @@ #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" +#include "sch_component.h" #include "dialog_edit_component_in_schematic.h" diff --git a/eeschema/dialog_edit_component_in_schematic.h b/eeschema/dialog_edit_component_in_schematic.h index da07811160..868805a5a8 100644 --- a/eeschema/dialog_edit_component_in_schematic.h +++ b/eeschema/dialog_edit_component_in_schematic.h @@ -3,6 +3,9 @@ #define __dialog_edit_component_in_schematic__ +#include "sch_field.h" +#include "template_fieldnames.h" + #include "dialog_edit_component_in_schematic_fbp.h" /** @@ -85,7 +88,8 @@ public: void InitBuffers( SCH_COMPONENT* aComponent ); private: - /** Function updateDisplay + /** + * Function updateDisplay * update the listbox showing fields, according to the fields texts * must be called after a text change in fields, if this change is not an edition */ diff --git a/eeschema/dialog_edit_label.cpp b/eeschema/dialog_edit_label.cpp index 9b5d79e5fc..366b484240 100644 --- a/eeschema/dialog_edit_label.cpp +++ b/eeschema/dialog_edit_label.cpp @@ -8,13 +8,15 @@ #include "fctsys.h" #include "wx/valgen.h" +#include "wxEeschemaStruct.h" #include "common.h" #include "class_drawpanel.h" -#include "program.h" #include "general.h" #include "drawtxt.h" #include "confirm.h" +#include "sch_text.h" + #include "dialog_edit_label.h" diff --git a/eeschema/dialog_edit_label.h b/eeschema/dialog_edit_label.h index c95d51c0a0..3db275a0be 100644 --- a/eeschema/dialog_edit_label.h +++ b/eeschema/dialog_edit_label.h @@ -10,6 +10,11 @@ #include "dialog_edit_label_base.h" + +class WinEDA_SchematicFrame; +class SCH_TEXT; + + class DialogLabelEditor : public DialogLabelEditor_Base { private: diff --git a/eeschema/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialog_edit_libentry_fields_in_lib.cpp index 23dbd6dd23..9e373a9e94 100644 --- a/eeschema/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialog_edit_libentry_fields_in_lib.cpp @@ -9,12 +9,14 @@ #include "common.h" #include "confirm.h" #include "class_drawpanel.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" #include "class_library.h" +#include "sch_field.h" +#include "template_fieldnames.h" #include "dialog_edit_libentry_fields_in_lib_base.h" diff --git a/eeschema/dialog_eeschema_config.cpp b/eeschema/dialog_eeschema_config.cpp index ba8be14bc7..299fd87c25 100644 --- a/eeschema/dialog_eeschema_config.cpp +++ b/eeschema/dialog_eeschema_config.cpp @@ -12,8 +12,8 @@ #include "common.h" #include "confirm.h" #include "gestfich.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "netlist.h" diff --git a/eeschema/dialog_erc_listbox.h b/eeschema/dialog_erc_listbox.h index a97ac5226c..a1eadf6025 100644 --- a/eeschema/dialog_erc_listbox.h +++ b/eeschema/dialog_erc_listbox.h @@ -12,8 +12,7 @@ #include "fctsys.h" #include "class_drawpanel.h" -#include "program.h" -#include "class_marker_sch.h" +#include "sch_marker.h" /** * Class ERC_HTML_LISTBOX diff --git a/eeschema/dialog_libedit_dimensions.cpp b/eeschema/dialog_libedit_dimensions.cpp index b87808bf6f..2325378579 100644 --- a/eeschema/dialog_libedit_dimensions.cpp +++ b/eeschema/dialog_libedit_dimensions.cpp @@ -3,15 +3,12 @@ * Handles the dialog so set current texts and pins sizes in LibEdit */ #include "fctsys.h" -//#include "appl_wxstruct.h" #include "common.h" -//#include "class_drawpanel.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "libeditframe.h" - #include "dialog_libedit_dimensions_base.h" diff --git a/eeschema/annotate_dialog.cpp b/eeschema/dialogs/annotate_dialog.cpp similarity index 94% rename from eeschema/annotate_dialog.cpp rename to eeschema/dialogs/annotate_dialog.cpp index 9cf43da6b1..3d4e29fd70 100644 --- a/eeschema/annotate_dialog.cpp +++ b/eeschema/dialogs/annotate_dialog.cpp @@ -8,7 +8,7 @@ #include "appl_wxstruct.h" #include "bitmaps.h" #include "common.h" -#include "program.h" +#include "wxEeschemaStruct.h" #include "annotate_dialog.h" @@ -69,6 +69,8 @@ void DIALOG_ANNOTATE::InitValues() annotate_right_down_bitmap->SetBitmap(bitmap1); wxBitmap bitmap2(add_text_xpm); annotate_by_value_bitmap->SetBitmap(bitmap2); + + m_btnApply->SetDefault(); } @@ -92,12 +94,10 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) message += _( "on the current sheet?" ); message += _( "\n\nThis operation will change the current annotation and cannot be undone." ); - response = wxMessageBox( message, wxT( "" ), - wxICON_EXCLAMATION | wxOK | wxCANCEL ); + response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL ); if (response == wxCANCEL) return; - AnnotateComponents( m_Parent, GetLevel(), GetSortOrder(), - GetResetItems() , true ); + AnnotateComponents( m_Parent, GetLevel(), GetSortOrder(), GetResetItems() , true ); m_btnClear->Enable(); } diff --git a/eeschema/annotate_dialog.h b/eeschema/dialogs/annotate_dialog.h similarity index 97% rename from eeschema/annotate_dialog.h rename to eeschema/dialogs/annotate_dialog.h index e25c24b8d8..4b4c6af63c 100644 --- a/eeschema/annotate_dialog.h +++ b/eeschema/dialogs/annotate_dialog.h @@ -26,6 +26,11 @@ #include "dialog_annotate_base.h" + +class WinEDA_SchematicFrame; +class wxConfig; + + /*! * DIALOG_ANNOTATE class declaration */ diff --git a/eeschema/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp similarity index 100% rename from eeschema/dialog_annotate_base.cpp rename to eeschema/dialogs/dialog_annotate_base.cpp diff --git a/eeschema/dialog_annotate_base.fbp b/eeschema/dialogs/dialog_annotate_base.fbp similarity index 100% rename from eeschema/dialog_annotate_base.fbp rename to eeschema/dialogs/dialog_annotate_base.fbp diff --git a/eeschema/dialog_annotate_base.h b/eeschema/dialogs/dialog_annotate_base.h similarity index 100% rename from eeschema/dialog_annotate_base.h rename to eeschema/dialogs/dialog_annotate_base.h diff --git a/eeschema/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp similarity index 66% rename from eeschema/dialog_erc.cpp rename to eeschema/dialogs/dialog_erc.cpp index 793445bb99..e3318f04e1 100644 --- a/eeschema/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -9,12 +9,17 @@ #include "fctsys.h" #include "common.h" #include "class_drawpanel.h" +#include "kicad_string.h" +#include "gestfich.h" #include "bitmaps.h" +#include "appl_wxstruct.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "netlist.h" -#include "class_marker_sch.h" +#include "sch_marker.h" +#include "sch_sheet.h" #include "lib_pin.h" #include "protos.h" @@ -23,6 +28,9 @@ #include "erc.h" +bool DIALOG_ERC::m_writeErcFile = false; + + BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE ) EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( PIN_NMAX * PIN_NMAX ) - 1, wxEVT_COMMAND_BUTTON_CLICKED, @@ -49,15 +57,13 @@ void DIALOG_ERC::Init() for( int jj = 0; jj < PIN_NMAX; jj++ ) m_ButtonList[ii][jj] = NULL; - m_WriteResultOpt->SetValue( WriteFichierERC ); + m_WriteResultOpt->SetValue( m_writeErcFile ); wxString num; num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc ); m_TotalErrCount->SetLabel( num ); - num.Printf( wxT( - "%d" ), g_EESchemaVar.NbErrorErc - - g_EESchemaVar.NbWarningErc ); + num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc - g_EESchemaVar.NbWarningErc ); m_LastErrCount->SetLabel( num ); num.Printf( wxT( "%d" ), g_EESchemaVar.NbWarningErc ); @@ -67,6 +73,9 @@ void DIALOG_ERC::Init() // Init Panel Matrix ReBuildMatrixPanel(); + + // Set the run ERC button as the default button. + m_buttonERC->SetDefault(); } @@ -376,10 +385,171 @@ void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event ) if( new_bitmap_xpm ) { delete Butt; - Butt = new wxBitmapButton( m_PanelERCOptions, id, - wxBitmap( new_bitmap_xpm ), pos ); + Butt = new wxBitmapButton( m_PanelERCOptions, id, wxBitmap( new_bitmap_xpm ), pos ); m_ButtonList[y][x] = Butt; DiagErc[y][x] = DiagErc[x][y] = level; } } + + +void DIALOG_ERC::TestErc( wxArrayString* aMessagesList ) +{ + wxFileName fn; + unsigned NetItemRef; + unsigned OldItem; + unsigned StartNet; + + int NetNbItems, MinConn; + + if( !DiagErcTableInit ) + { + memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) ); + DiagErcTableInit = TRUE; + } + + m_writeErcFile = m_WriteResultOpt->GetValue(); + + ReAnnotatePowerSymbolsOnly(); + + if( m_Parent->CheckAnnotate( aMessagesList, false ) ) + { + if( aMessagesList ) + { + wxString msg = _( "Annotation required!" ); + msg += wxT( "\n" ); + aMessagesList->Add( msg ); + } + return; + } + + /* Erase all DRC markers */ + DeleteAllMarkers( MARK_ERC ); + + g_EESchemaVar.NbErrorErc = 0; + g_EESchemaVar.NbWarningErc = 0; + + /* Cleanup the entire hierarchy */ + SCH_SCREENS ScreenList; + + for( SCH_SCREEN* Screen = ScreenList.GetFirst(); + Screen != NULL; + Screen = ScreenList.GetNext() ) + { + bool ModifyWires; + ModifyWires = Screen->SchematicCleanUp( NULL ); + + /* if wire list has changed, delete Undo Redo list to avoid + * pointers on deleted data problems */ + if( ModifyWires ) + Screen->ClearUndoRedoList(); + } + + /* Test duplicate sheet names + * inside a given sheet, one cannot have sheets with duplicate names (file + * names can be duplicated). + */ + int errcnt = TestDuplicateSheetNames( true ); + g_EESchemaVar.NbErrorErc += errcnt; + + m_Parent->BuildNetListBase(); + + /* Reset the flag m_FlagOfConnection, that will be used next, in + * calculations */ + for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ ) + g_NetObjectslist[ii]->m_FlagOfConnection = UNCONNECTED; + + StartNet = OldItem = 0; + NetNbItems = 0; + MinConn = NOC; + + for( NetItemRef = 0; NetItemRef < g_NetObjectslist.size(); NetItemRef++ ) + { + if( g_NetObjectslist[OldItem]->GetNet() != g_NetObjectslist[NetItemRef]->GetNet() ) + { // New net found: + MinConn = NOC; + NetNbItems = 0; + StartNet = NetItemRef; + } + + switch( g_NetObjectslist[NetItemRef]->m_Type ) + { + case NET_ITEM_UNSPECIFIED: + case NET_SEGMENT: + case NET_BUS: + case NET_JONCTION: + case NET_LABEL: + case NET_BUSLABELMEMBER: + case NET_PINLABEL: + case NET_GLOBLABEL: + case NET_GLOBBUSLABELMEMBER: + + // These items do not create erc problems + break; + + case NET_HIERLABEL: + case NET_HIERBUSLABELMEMBER: + case NET_SHEETLABEL: + case NET_SHEETBUSLABELMEMBER: + + // ERC problems when pin sheets do not match hierarchical labels. + // Each pin sheet must match a hierarchical label + // Each hierarchical label must match a pin sheet + TestLabel( m_Parent->DrawPanel, NetItemRef, StartNet ); + break; + + case NET_NOCONNECT: + + // ERC problems when a noconnect symbol is connected to more than + // one pin. + MinConn = NET_NC; + if( NetNbItems != 0 ) + Diagnose( m_Parent->DrawPanel, g_NetObjectslist[NetItemRef], NULL, MinConn, UNC ); + break; + + case NET_PIN: + + // Look for ERC problems between pins: + TestOthersItems( m_Parent->DrawPanel, NetItemRef, StartNet, &NetNbItems, &MinConn ); + break; + } + + OldItem = NetItemRef; + } + + // Displays global results: + wxString num; + num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc ); + m_TotalErrCount->SetLabel( num ); + + num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc - g_EESchemaVar.NbWarningErc ); + m_LastErrCount->SetLabel( num ); + + num.Printf( wxT( "%d" ), g_EESchemaVar.NbWarningErc ); + m_LastWarningCount->SetLabel( num ); + + // Display diags: + DisplayERC_MarkersList(); + + // Display new markers: + m_Parent->DrawPanel->Refresh(); + + if( m_writeErcFile ) + { + fn = g_RootSheet->m_AssociatedScreen->m_FileName; + fn.SetExt( wxT( "erc" ) ); + + wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(), + _( "Electronic rule check file (.erc)|*.erc" ), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + + if( dlg.ShowModal() == wxID_CANCEL ) + return; + + if( WriteDiagnosticERC( dlg.GetPath() ) ) + { + Close( TRUE ); + ExecuteFile( this, wxGetApp().GetEditorName(), QuoteFullPath( fn ) ); + } + } +} diff --git a/eeschema/dialog_erc.h b/eeschema/dialogs/dialog_erc.h similarity index 95% rename from eeschema/dialog_erc.h rename to eeschema/dialogs/dialog_erc.h index a16ec1b608..b6d2144163 100644 --- a/eeschema/dialog_erc.h +++ b/eeschema/dialogs/dialog_erc.h @@ -14,7 +14,6 @@ #include "dialog_erc_base.h" /* Variable locales */ -extern int WriteFichierERC; extern int DiagErc[PIN_NMAX][PIN_NMAX]; extern bool DiagErcTableInit; // go to TRUE after DiagErc init extern int DefaultDiagErc[PIN_NMAX][PIN_NMAX]; @@ -35,7 +34,8 @@ class DIALOG_ERC : public DIALOG_ERC_BASE private: WinEDA_SchematicFrame* m_Parent; wxBitmapButton* m_ButtonList[PIN_NMAX][PIN_NMAX]; - bool m_Initialized; + bool m_Initialized; + static bool m_writeErcFile; public: diff --git a/eeschema/dialog_erc_base.cpp b/eeschema/dialogs/dialog_erc_base.cpp similarity index 100% rename from eeschema/dialog_erc_base.cpp rename to eeschema/dialogs/dialog_erc_base.cpp diff --git a/eeschema/dialog_erc_base.fbp b/eeschema/dialogs/dialog_erc_base.fbp similarity index 100% rename from eeschema/dialog_erc_base.fbp rename to eeschema/dialogs/dialog_erc_base.fbp diff --git a/eeschema/dialog_erc_base.h b/eeschema/dialogs/dialog_erc_base.h similarity index 100% rename from eeschema/dialog_erc_base.h rename to eeschema/dialogs/dialog_erc_base.h diff --git a/eeschema/dialogs/dialog_plot_schematic_DXF.cpp b/eeschema/dialogs/dialog_plot_schematic_DXF.cpp index 1f74a30f66..c5a9969175 100644 --- a/eeschema/dialogs/dialog_plot_schematic_DXF.cpp +++ b/eeschema/dialogs/dialog_plot_schematic_DXF.cpp @@ -28,13 +28,16 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "plot_common.h" #include "confirm.h" #include "worksheet.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_sheet_path.h" #include "dialog_plot_schematic_DXF_base.h" diff --git a/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp b/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp index b13ccef79b..15326a7860 100644 --- a/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp +++ b/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp @@ -31,10 +31,13 @@ #include "confirm.h" #include "plot_common.h" #include "worksheet.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_sheet_path.h" + #include "dialog_plot_schematic_HPGL_base.h" enum PageFormatReq diff --git a/eeschema/dialogs/dialog_plot_schematic_PS.cpp b/eeschema/dialogs/dialog_plot_schematic_PS.cpp index c0eb7a3a0b..98c8c6bf83 100644 --- a/eeschema/dialogs/dialog_plot_schematic_PS.cpp +++ b/eeschema/dialogs/dialog_plot_schematic_PS.cpp @@ -31,10 +31,13 @@ #include "confirm.h" #include "worksheet.h" #include "plot_common.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_sheet_path.h" + enum PageFormatReq { PAGE_SIZE_AUTO, diff --git a/eeschema/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp similarity index 89% rename from eeschema/dialog_print_using_printer.cpp rename to eeschema/dialogs/dialog_print_using_printer.cpp index a37e217d0b..b172cfc66f 100644 --- a/eeschema/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -8,35 +8,15 @@ #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "eeschema_config.h" +#include "sch_sheet.h" +#include "sch_sheet_path.h" -#include "dialog_print_using_printer_base.h" - - -/** - * Print schematic dialog. - * - * Class derived from DIALOG_PRINT_USING_PRINTER_base created by wxFormBuilder - */ -class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE -{ -public: - DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ); - ~DIALOG_PRINT_USING_PRINTER() {}; - - WinEDA_SchematicFrame* GetParent() const; - -private: - void OnCloseWindow( wxCloseEvent& event ); - void OnInitDialog( wxInitDialogEvent& event ); - void OnPageSetup( wxCommandEvent& event ); - void OnPrintPreview( wxCommandEvent& event ); - void OnPrintButtonClick( wxCommandEvent& event ); - void OnButtonCancelClick( wxCommandEvent& event ){ Close(); } -}; +#include "dialog_print_using_printer.h" /** @@ -107,25 +87,6 @@ BEGIN_EVENT_TABLE( SCH_PREVIEW_FRAME, wxPreviewFrame ) END_EVENT_TABLE() -void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event ) -{ - wxFileName fn; - DIALOG_PRINT_USING_PRINTER dlg( this ); - - dlg.ShowModal(); - - fn = g_RootSheet->m_AssociatedScreen->m_FileName; - - wxString default_name = NAMELESS_PROJECT; - default_name += wxT( ".sch" ); - if( fn.GetFullName() != default_name ) - { - fn.SetExt( ProjectFileExtension ); - wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() ); - } -} - - DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ) : DIALOG_PRINT_USING_PRINTER_BASE( aParent ) { @@ -161,6 +122,8 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) } SetFocus(); + + m_buttonPrint->SetDefault(); } diff --git a/eeschema/dialogs/dialog_print_using_printer.h b/eeschema/dialogs/dialog_print_using_printer.h new file mode 100644 index 0000000000..b6bf77c7ea --- /dev/null +++ b/eeschema/dialogs/dialog_print_using_printer.h @@ -0,0 +1,32 @@ + +#ifndef _DIALOG_PRINT_USING_PRINTER_H_ +#define _DIALOG_PRINT_USING_PRINTER_H_ + + +#include "dialog_print_using_printer_base.h" + + +/** + * Print schematic dialog. + * + * Class derived from DIALOG_PRINT_USING_PRINTER_base created by wxFormBuilder + */ +class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE +{ +public: + DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ); + ~DIALOG_PRINT_USING_PRINTER() {}; + + WinEDA_SchematicFrame* GetParent() const; + +private: + void OnCloseWindow( wxCloseEvent& event ); + void OnInitDialog( wxInitDialogEvent& event ); + void OnPageSetup( wxCommandEvent& event ); + void OnPrintPreview( wxCommandEvent& event ); + void OnPrintButtonClick( wxCommandEvent& event ); + void OnButtonCancelClick( wxCommandEvent& event ){ Close(); } +}; + + +#endif // _DIALOG_PRINT_USING_PRINTER_H_ diff --git a/eeschema/dialog_print_using_printer_base.cpp b/eeschema/dialogs/dialog_print_using_printer_base.cpp similarity index 100% rename from eeschema/dialog_print_using_printer_base.cpp rename to eeschema/dialogs/dialog_print_using_printer_base.cpp diff --git a/eeschema/dialog_print_using_printer_base.fbp b/eeschema/dialogs/dialog_print_using_printer_base.fbp similarity index 100% rename from eeschema/dialog_print_using_printer_base.fbp rename to eeschema/dialogs/dialog_print_using_printer_base.fbp diff --git a/eeschema/dialog_print_using_printer_base.h b/eeschema/dialogs/dialog_print_using_printer_base.h similarity index 100% rename from eeschema/dialog_print_using_printer_base.h rename to eeschema/dialogs/dialog_print_using_printer_base.h diff --git a/eeschema/edit_component_in_lib.cpp b/eeschema/edit_component_in_lib.cpp index ea5d08f81b..3aca9d4f01 100644 --- a/eeschema/edit_component_in_lib.cpp +++ b/eeschema/edit_component_in_lib.cpp @@ -5,11 +5,12 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 4ef26cb0ee..bbb24dcf52 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -7,11 +7,13 @@ #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" +#include "sch_component.h" static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC ); diff --git a/eeschema/edit_graphic_bodyitem_text.cpp b/eeschema/edit_graphic_bodyitem_text.cpp index 1b25f1013f..52b73cb031 100644 --- a/eeschema/edit_graphic_bodyitem_text.cpp +++ b/eeschema/edit_graphic_bodyitem_text.cpp @@ -9,7 +9,6 @@ #include "common.h" #include "class_drawpanel.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 1d4891a283..949942ecbf 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -10,10 +10,13 @@ #include "drawtxt.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_text.h" + static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC ); diff --git a/eeschema/eelayer.cpp b/eeschema/eelayer.cpp index f09debc1e6..2b94665806 100644 --- a/eeschema/eelayer.cpp +++ b/eeschema/eelayer.cpp @@ -9,9 +9,9 @@ #include "gr_basic.h" #include "common.h" #include "eeschema_id.h" +#include "wxstruct.h" #include "class_drawpanel.h" -#include "program.h" #include "general.h" #include "protos.h" diff --git a/eeschema/eelayer.h b/eeschema/eelayer.h index b04091777f..6a8edf24bc 100644 --- a/eeschema/eelayer.h +++ b/eeschema/eelayer.h @@ -7,6 +7,9 @@ #include "wx/statline.h" +#include "general.h" + + class wxBoxSizer; class wxStaticLine; class wxStdDialogButtonSizer; diff --git a/eeschema/eelibs_read_libraryfiles.cpp b/eeschema/eelibs_read_libraryfiles.cpp index 3c0f9c367a..fa9b9d50e1 100644 --- a/eeschema/eelibs_read_libraryfiles.cpp +++ b/eeschema/eelibs_read_libraryfiles.cpp @@ -4,9 +4,10 @@ #include "fctsys.h" #include "confirm.h" +#include "macros.h" #include "appl_wxstruct.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "class_library.h" diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index e652cd6591..c8301b44a8 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -8,14 +8,20 @@ #include "common.h" #include "class_drawpanel.h" #include "appl_wxstruct.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" +#include "sch_sheet.h" +#include "sch_sheet_path.h" +#include "sch_component.h" +#include "sch_items.h" #include "build_version.h" + static EDA_BaseStruct* HighLightStruct = NULL; diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index aa14d8edba..6b4f6c0d1f 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -11,8 +11,9 @@ #include "bitmaps.h" #include "eda_dde.h" #include "id.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "hotkeys.h" diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index e24eb74843..68d76f348a 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -5,11 +5,12 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "common.h" -#include "eeschema_id.h" #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" -#include "program.h" +#include "wxEeschemaStruct.h" + +#include "eeschema_id.h" #include "general.h" #include "netlist.h" #include "protos.h" @@ -17,6 +18,8 @@ #include "eeschema_config.h" #include "worksheet.h" #include "hotkeys.h" +#include "sch_sheet.h" + #include "dialog_eeschema_options.h" #include "dialog_hotkeys_editor.h" diff --git a/eeschema/eeschema_config.h b/eeschema/eeschema_config.h index 78cf8619c4..bc8d03d640 100644 --- a/eeschema/eeschema_config.h +++ b/eeschema/eeschema_config.h @@ -8,8 +8,6 @@ #define GROUPCOMMON wxT( "/common" ) #define GROUPLIB wxT( "libraries" ) -#include "netlist.h" - extern int g_PenMinWidth; /* saving parameters option : */ diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 2008e82b50..82fc65dd17 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -6,19 +6,18 @@ #include "common.h" #include "class_drawpanel.h" #include "kicad_string.h" -#include "gestfich.h" -#include "appl_wxstruct.h" #include "bitmaps.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "netlist.h" -#include "class_marker_sch.h" #include "lib_pin.h" #include "protos.h" #include "erc.h" - -#include "dialog_erc.h" +#include "sch_marker.h" +#include "sch_component.h" +#include "sch_sheet.h" /* ERC tests : @@ -28,21 +27,6 @@ */ -static bool WriteDiagnosticERC( const wxString& FullFileName ); -static void Diagnose( WinEDA_DrawPanel* panel, - NETLIST_OBJECT* NetItemRef, - NETLIST_OBJECT* NetItemTst, int MinConnexion, int Diag ); -static void TestOthersItems( WinEDA_DrawPanel* panel, - unsigned NetItemRef, - unsigned NetStart, - int* NetNbItems, int* MinConnexion ); -static void TestLabel( WinEDA_DrawPanel* panel, - unsigned NetItemRef, - unsigned StartNet ); - -/* Local variables */ -int WriteFichierERC = FALSE; - /* * Electrical type of pins: * PIN_INPUT = usual pin input: must be connected @@ -140,13 +124,6 @@ int DefaultDiagErc[PIN_NMAX][PIN_NMAX] = }; -/* Minimal connection table */ -#define NPI 4 /* Net with Pin isolated, but this pin has type Not Connected, and must be left N.C. */ -#define DRV 3 /* Net driven by a signal (a pin output for instance) */ -#define NET_NC 2 /* Net "connected" to a "NoConnect symbol" */ -#define NOD 1 /* Net not driven ( Such as 2 or more connected inputs )*/ -#define NOC 0 /* initial state of a net: no connection */ - /* Look up table which gives the minimal drive for a pair of connected pins on * a net * Initial state of a net is NOC (Net with No Connection) @@ -182,7 +159,7 @@ static int MinimalReq[PIN_NMAX][PIN_NMAX] = * @param aCreateMarker: true = create error markers in schematic, * false = calculate error count only */ -int TestDuplicateSheetNames(bool aCreateMarker) +int TestDuplicateSheetNames( bool aCreateMarker ) { int err_count = 0; SCH_SCREENS ScreenList; // Created the list of screen @@ -234,181 +211,14 @@ int TestDuplicateSheetNames(bool aCreateMarker) } -void DIALOG_ERC::TestErc( wxArrayString* aMessagesList ) -{ - wxFileName fn; - unsigned NetItemRef; - unsigned OldItem; - unsigned StartNet; - - int NetNbItems, MinConn; - - if( !DiagErcTableInit ) - { - memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) ); - DiagErcTableInit = TRUE; - } - - WriteFichierERC = m_WriteResultOpt->GetValue(); - - ReAnnotatePowerSymbolsOnly(); - if( m_Parent->CheckAnnotate( aMessagesList, false ) ) - { - if( aMessagesList ) - { - wxString msg = _( "Annotation required!" ); - msg += wxT( "\n" ); - aMessagesList->Add( msg ); - } - return; - } - - /* Erase all DRC markers */ - DeleteAllMarkers( MARK_ERC ); - - g_EESchemaVar.NbErrorErc = 0; - g_EESchemaVar.NbWarningErc = 0; - - /* Cleanup the entire hierarchy */ - SCH_SCREENS ScreenList; - - for( SCH_SCREEN* Screen = ScreenList.GetFirst(); - Screen != NULL; - Screen = ScreenList.GetNext() ) - { - bool ModifyWires; - ModifyWires = Screen->SchematicCleanUp( NULL ); - - /* if wire list has changed, delete Undo Redo list to avoid - * pointers on deleted data problems */ - if( ModifyWires ) - Screen->ClearUndoRedoList(); - } - - /* Test duplicate sheet names - * inside a given sheet, one cannot have sheets with duplicate names (file - * names can be duplicated). - */ - int errcnt = TestDuplicateSheetNames( true ); - g_EESchemaVar.NbErrorErc += errcnt; - - m_Parent->BuildNetListBase(); - - /* Reset the flag m_FlagOfConnection, that will be used next, in - * calculations */ - for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ ) - g_NetObjectslist[ii]->m_FlagOfConnection = UNCONNECTED; - - StartNet = OldItem = 0; - NetNbItems = 0; - MinConn = NOC; - - for( NetItemRef = 0; NetItemRef < g_NetObjectslist.size(); NetItemRef++ ) - { - if( g_NetObjectslist[OldItem]->GetNet() != - g_NetObjectslist[NetItemRef]->GetNet() ) - { // New ne found: - MinConn = NOC; - NetNbItems = 0; - StartNet = NetItemRef; - } - - switch( g_NetObjectslist[NetItemRef]->m_Type ) - { - case NET_ITEM_UNSPECIFIED: - case NET_SEGMENT: - case NET_BUS: - case NET_JONCTION: - case NET_LABEL: - case NET_BUSLABELMEMBER: - case NET_PINLABEL: - case NET_GLOBLABEL: - case NET_GLOBBUSLABELMEMBER: - - // These items do not create erc problems - break; - - case NET_HIERLABEL: - case NET_HIERBUSLABELMEMBER: - case NET_SHEETLABEL: - case NET_SHEETBUSLABELMEMBER: - - // ERC problems when pin sheets do not match hierarchical labels. - // Each pin sheet must match a hierarchical label - // Each hierarchical label must match a pin sheet - TestLabel( m_Parent->DrawPanel, NetItemRef, StartNet ); - break; - - case NET_NOCONNECT: - - // ERC problems when a noconnect symbol is connected to more than - // one pin. - MinConn = NET_NC; - if( NetNbItems != 0 ) - Diagnose( m_Parent->DrawPanel, - g_NetObjectslist[NetItemRef], NULL, MinConn, UNC ); - break; - - case NET_PIN: - - // Look for ERC problems between pins: - TestOthersItems( m_Parent->DrawPanel, - NetItemRef, StartNet, &NetNbItems, &MinConn ); - break; - } - - OldItem = NetItemRef; - } - - // Displays global results: - wxString num; - num.Printf( wxT( "%d" ), g_EESchemaVar.NbErrorErc ); - m_TotalErrCount->SetLabel( num ); - - num.Printf( wxT( - "%d" ), g_EESchemaVar.NbErrorErc - - g_EESchemaVar.NbWarningErc ); - m_LastErrCount->SetLabel( num ); - - num.Printf( wxT( "%d" ), g_EESchemaVar.NbWarningErc ); - m_LastWarningCount->SetLabel( num ); - - // Display diags: - DisplayERC_MarkersList(); - - // Display new markers: - m_Parent->DrawPanel->Refresh(); - - if( WriteFichierERC == TRUE ) - { - fn = g_RootSheet->m_AssociatedScreen->m_FileName; - fn.SetExt( wxT( "erc" ) ); - - wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(), - _( "Electronic rule check file (.erc)|*.erc" ), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - - if( dlg.ShowModal() == wxID_CANCEL ) - return; - - if( WriteDiagnosticERC( dlg.GetPath() ) ) - { - Close( TRUE ); - ExecuteFile( this, wxGetApp().GetEditorName(), - QuoteFullPath( fn ) ); - } - } -} - - /* Creates an ERC marker to show the ERC problem about aNetItemRef * or between aNetItemRef and aNetItemTst * if MinConn < 0: this is an error on labels */ -static void Diagnose( WinEDA_DrawPanel* aPanel, - NETLIST_OBJECT* aNetItemRef, - NETLIST_OBJECT* aNetItemTst, - int aMinConn, int aDiag ) +void Diagnose( WinEDA_DrawPanel* aPanel, + NETLIST_OBJECT* aNetItemRef, + NETLIST_OBJECT* aNetItemTst, + int aMinConn, int aDiag ) { SCH_MARKER* Marker = NULL; SCH_SCREEN* screen; @@ -433,7 +243,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel, if( aMinConn < 0 ) { if( (aNetItemRef->m_Type == NET_HIERLABEL) - || (aNetItemRef->m_Type == NET_HIERBUSLABELMEMBER) ) + || (aNetItemRef->m_Type == NET_HIERBUSLABELMEMBER) ) { msg.Printf( _( "HLabel %s not connected to SheetLabel" ), GetChars( aNetItemRef->m_Label ) ); @@ -461,8 +271,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel, string_pinnum = CONV_FROM_UTF8( ascii_buf ); cmp_ref = wxT( "?" ); if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link ) - cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef( - &aNetItemRef->m_SheetList ); + cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef( &aNetItemRef->m_SheetList ); if( aNetItemTst == NULL ) { @@ -495,8 +304,7 @@ static void Diagnose( WinEDA_DrawPanel* aPanel, if( aDiag == UNC ) { - msg.Printf( - _( "More than 1 Pin connected to UnConnect symbol" ) ); + msg.Printf( _( "More than 1 Pin connected to UnConnect symbol" ) ); Marker->SetData( ERCE_NOCONNECT_CONNECTED, aNetItemRef->m_Start, msg, @@ -540,10 +348,10 @@ static void Diagnose( WinEDA_DrawPanel* aPanel, /* Routine testing electrical conflicts between NetItemRef and other items * of the same net */ -static void TestOthersItems( WinEDA_DrawPanel* panel, - unsigned NetItemRef, - unsigned netstart, - int* NetNbItems, int* MinConnexion ) +void TestOthersItems( WinEDA_DrawPanel* panel, + unsigned NetItemRef, + unsigned netstart, + int* NetNbItems, int* MinConnexion ) { unsigned NetItemTst; @@ -684,7 +492,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, /* Create the Diagnostic file (.erc file) */ -static bool WriteDiagnosticERC( const wxString& FullFileName ) +bool WriteDiagnosticERC( const wxString& FullFileName ) { SCH_ITEM* DrawStruct; SCH_MARKER* Marker; @@ -703,9 +511,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName ) SCH_SHEET_LIST SheetList; - for( Sheet = SheetList.GetFirst(); - Sheet != NULL; - Sheet = SheetList.GetNext() ) + for( Sheet = SheetList.GetFirst(); Sheet != NULL; Sheet = SheetList.GetNext() ) { if( Sheet->Last() == g_RootSheet ) { @@ -761,9 +567,7 @@ static bool IsLabelsConnected( NETLIST_OBJECT* a, NETLIST_OBJECT* b ) /* Routine to perform erc on a sheetLabel that is connected to a corresponding * sub sheet Glabel */ -void TestLabel( WinEDA_DrawPanel* panel, - unsigned NetItemRef, - unsigned StartNet ) +void TestLabel( WinEDA_DrawPanel* panel, unsigned NetItemRef, unsigned StartNet ) { unsigned NetItemTst; int erc = 1; diff --git a/eeschema/erc.h b/eeschema/erc.h index a092a912da..e4c6439f74 100644 --- a/eeschema/erc.h +++ b/eeschema/erc.h @@ -25,6 +25,10 @@ #ifndef _ERC_H #define _ERC_H + +class WinEDA_DrawPanel; +class NETLIST_OBJECT; + /* For ERC markers: error types (used in diags, and to set the color): */ enum errortype @@ -46,5 +50,25 @@ enum errortype #define ERCE_HIERACHICAL_LABEL 6 // mismatch between hierarchical labels and pins sheets #define ERCE_NOCONNECT_CONNECTED 7 // a no connect symbol is connected to more than 1 pin +/* Minimal connection table */ +#define NPI 4 // Net with Pin isolated, this pin has type Not Connected and must be left N.C. +#define DRV 3 // Net driven by a signal (a pin output for instance) +#define NET_NC 2 // Net "connected" to a "NoConnect symbol" +#define NOD 1 // Net not driven ( Such as 2 or more connected inputs ) +#define NOC 0 // initial state of a net: no connection + + +extern bool WriteDiagnosticERC( const wxString& FullFileName ); + +extern void Diagnose( WinEDA_DrawPanel* panel, NETLIST_OBJECT* NetItemRef, + NETLIST_OBJECT* NetItemTst, int MinConnexion, int Diag ); + +extern void TestOthersItems( WinEDA_DrawPanel* panel, unsigned NetItemRef, unsigned NetStart, + int* NetNbItems, int* MinConnexion ); + +extern void TestLabel( WinEDA_DrawPanel* panel, unsigned NetItemRef, unsigned StartNet ); + +extern int TestDuplicateSheetNames( bool aCreateMarker ); + #endif // _ERC_H diff --git a/eeschema/events_called_functions_for_edit.cpp b/eeschema/events_called_functions_for_edit.cpp index 2b31d434bd..0866e6c5cf 100644 --- a/eeschema/events_called_functions_for_edit.cpp +++ b/eeschema/events_called_functions_for_edit.cpp @@ -2,15 +2,20 @@ * events_called_functions.cpp * some events functions */ + #include "fctsys.h" #include "gr_basic.h" #include "common.h" #include "class_drawpanel.h" -#include "program.h" #include "general.h" #include "kicad_device_context.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" #include "protos.h" +#include "sch_component.h" +#include "sch_text.h" + /** Event function WinEDA_SchematicFrame::OnCopySchematicItemRequest * duplicate the current located item diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index ae5fed0842..a5a9450e83 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -7,13 +7,14 @@ #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "eeschema_id.h" #include "class_library.h" #include "libeditframe.h" +#include "sch_sheet.h" diff --git a/eeschema/find.cpp b/eeschema/find.cpp index fc6000fa78..143907a0ad 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -14,13 +14,17 @@ #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" -#include "class_marker_sch.h" #include "protos.h" #include "class_library.h" #include "lib_pin.h" +#include "sch_marker.h" +#include "sch_component.h" +#include "sch_sheet.h" +#include "sch_sheet_path.h" #include "kicad_device_context.h" diff --git a/eeschema/general.h b/eeschema/general.h index f09863fe9b..b81fae02b1 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -10,11 +10,11 @@ #include "block_commande.h" -#include "program.h" - class SCH_ITEM; class SCH_SHEET; +class TRANSFORM; + #define EESCHEMA_VERSION 2 @@ -28,14 +28,14 @@ class SCH_SHEET; #define MAX_PIN_INFO 10 -#define TXTMARGE 10 /* Offset in mils for placement of labels - * and pin numbers. */ +#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers. #define HIGHLIGHT_COLOR WHITE /* Used for EDA_BaseStruct, .m_Select member */ #define IS_SELECTED 1 +#define TEXT_NO_VISIBLE 1 //#define GR_DEFAULT_DRAWMODE GR_COPY #define GR_DEFAULT_DRAWMODE GR_COPY @@ -105,6 +105,31 @@ typedef enum } FileSaveType; +/* Rotation, mirror of graphic items in components bodies are handled by a + * transform matrix. The default matix is useful to draw lib entries with + * a defualt matix ( no rotation, no mirror but Y axis is bottom to top, and + * Y draw axis is to to bottom so we must have a default matix that reverses + * the Y coordinate and keeps the X coordiate + */ +extern TRANSFORM DefaultTransform; + +#define MIN_BUSLINES_THICKNESS 12 // min bus lines and entries thickness + +#define MAX_LAYERS 44 + +class LayerStruct +{ +public: + char LayerNames[MAX_LAYERS + 1][8]; + int LayerColor[MAX_LAYERS + 1]; + char LayerStatus[MAX_LAYERS + 1]; + int NumberOfLayers; + int CurrentLayer; + int CurrentWidth; + int CommonColor; + int Flags; +}; + extern SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure used * by the repeat command. NULL if no * item to repeat */ diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index eb14e60fb9..9ac2c35fbd 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -8,11 +8,13 @@ #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" +#include "sch_component.h" #include "viewlib_frame.h" #include "get_component_dialog.h" diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index f90bcaf201..008778777c 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -8,9 +8,12 @@ #include "class_drawpanel.h" #include "confirm.h" #include "bitmaps.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" +#include "sch_sheet.h" +#include "sch_sheet_path.h" #include "wx/imaglist.h" #include "wx/treectrl.h" diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index b557a5202b..4124d36c94 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -6,12 +6,15 @@ #include "common.h" #include "eeschema_id.h" #include "hotkeys.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" #include "class_libentry.h" +#include "sch_items.h" +#include "sch_component.h" +#include "sch_sheet.h" #include "dialogs/dialog_schematic_find.h" @@ -100,16 +103,21 @@ static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + // Schematic editor static Ki_HotkeyInfo HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' ); +static Ki_HotkeyInfo HkAddHierarchicalLabel( wxT( "add Hierarchical Label" ), HK_ADD_HLABEL, 'H' ); +static Ki_HotkeyInfo HkAddGlobalLabel( wxT( "add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L' ); static Ki_HotkeyInfo HkAddJunction( wxT( "add Junction" ), HK_ADD_JUNCTION, 'J' ); static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' ); -static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), - HK_ADD_NEW_COMPONENT, 'A' ); -static Ki_HotkeyInfo HkAddNoConn( wxT( "Add NoConnected Flag" ), - HK_ADD_NOCONN_FLAG, 'Q' ); -static Ki_HotkeyInfo HkMirrorYComponent( wxT( "Mirror Y Component" ), - HK_MIRROR_Y_COMPONENT, 'Y' ); -static Ki_HotkeyInfo HkMirrorXComponent( wxT( "Mirror X Component" ), - HK_MIRROR_X_COMPONENT, 'X' ); +static Ki_HotkeyInfo HkBeginBus( wxT( "begin Bus" ), HK_BEGIN_BUS, 'B' ); +static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' ); +static Ki_HotkeyInfo HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P' ); +static Ki_HotkeyInfo HkAddNoConn( wxT( "Add NoConnected Flag" ), HK_ADD_NOCONN_FLAG, 'Q' ); +static Ki_HotkeyInfo HkAddHierSheet( wxT( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' ); +static Ki_HotkeyInfo HkAddBusEntry( wxT( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' ); +static Ki_HotkeyInfo HkAddWireEntry( wxT( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' ); +static Ki_HotkeyInfo HkAddGraphicPolyLine( wxT( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' ); +static Ki_HotkeyInfo HkAddGraphicText( wxT( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' ); +static Ki_HotkeyInfo HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y' ); +static Ki_HotkeyInfo HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X' ); static Ki_HotkeyInfo HkOrientNormalComponent( wxT( "Orient Normal Component" ), HK_ORIENT_NORMAL_COMPONENT, 'N' ); static Ki_HotkeyInfo HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' ); @@ -172,6 +180,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = &HkCopyComponentOrText, &HkDrag, &HkAddComponent, + &HkAddPower, &HkRotate, &HkMirrorXComponent, &HkMirrorYComponent, @@ -180,9 +189,17 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = &HkEditComponentValue, &HkEditComponentFootprint, &HkBeginWire, + &HkBeginBus, &HkAddLabel, + &HkAddHierarchicalLabel, + &HkAddGlobalLabel, &HkAddJunction, &HkAddNoConn, + &HkAddHierSheet, + &HkAddWireEntry, + &HkAddBusEntry, + &HkAddGraphicPolyLine, + &HkAddGraphicText, NULL }; @@ -379,6 +396,16 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, } break; + case HK_ADD_NEW_POWER: // Add power component + if( !itemInEdit ) + { + // switch to m_ID_current_state = ID_PLACE_POWER_BUTT; + if( m_ID_current_state != ID_PLACE_POWER_BUTT ) + SetToolID( ID_PLACE_POWER_BUTT, wxCURSOR_PENCIL, _( "Add Power" ) ); + OnLeftClick( DC, MousePos ); + } + break; + case HK_ADD_LABEL: if( notBusy ) { @@ -389,6 +416,26 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, } break; + case HK_ADD_HLABEL: + if( notBusy ) + { + // switch to m_ID_current_state = ID_HIERLABEL_BUTT; + if( m_ID_current_state != ID_HIERLABEL_BUTT ) + SetToolID( ID_HIERLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Hierarchical Label" ) ); + OnLeftClick( DC, MousePos ); + } + break; + + case HK_ADD_GLABEL: + if( notBusy ) + { + // switch to m_ID_current_state = ID_GLABEL_BUTT; + if( m_ID_current_state != ID_GLABEL_BUTT ) + SetToolID( ID_GLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Global Label" ) ); + OnLeftClick( DC, MousePos ); + } + break; + case HK_ADD_JUNCTION: if( notBusy ) { @@ -399,26 +446,99 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, } break; - case HK_BEGIN_WIRE: - // An item is selected. If not a wire, a new command is not possible + case HK_ADD_WIRE_ENTRY: if( notBusy ) { - if( DrawStruct && DrawStruct->m_Flags ) - { - if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) - { - SCH_LINE* segment = (SCH_LINE*) DrawStruct; - if( segment->GetLayer() != LAYER_WIRE ) - break; - } - else - break; - } + // switch to m_ID_current_state = ID_WIRETOBUS_ENTRY_BUTT; + if( m_ID_current_state != ID_WIRETOBUS_ENTRY_BUTT ) + SetToolID( ID_WIRETOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) ); + OnLeftClick( DC, MousePos ); + } + break; + case HK_ADD_BUS_ENTRY: + if( notBusy ) + { + // switch to m_ID_current_state = ID_BUSTOBUS_ENTRY_BUTT; + if( m_ID_current_state != ID_BUSTOBUS_ENTRY_BUTT ) + SetToolID( ID_BUSTOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) ); + OnLeftClick( DC, MousePos ); + } + break; + + case HK_ADD_HIER_SHEET: + if( notBusy ) + { + // switch to m_ID_current_state = ID_SHEET_SYMBOL_BUTT; + if( m_ID_current_state != ID_SHEET_SYMBOL_BUTT ) + SetToolID( ID_SHEET_SYMBOL_BUTT, wxCURSOR_PENCIL, _( "Add Sheet" ) ); + OnLeftClick( DC, MousePos ); + } + break; + + case HK_ADD_GRAPHIC_TEXT: + if( notBusy ) + { + // switch to m_ID_current_state = ID_TEXT_COMMENT_BUTT; + if( m_ID_current_state != ID_TEXT_COMMENT_BUTT ) + SetToolID( ID_TEXT_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Text" ) ); + OnLeftClick( DC, MousePos ); + } + break; + + case HK_ADD_GRAPHIC_POLYLINE: + if( notBusy ) + { + // switch to m_ID_current_state = ID_LINE_COMMENT_BUTT; + if( m_ID_current_state != ID_LINE_COMMENT_BUTT ) + SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Lines" ) ); + OnLeftClick( DC, MousePos ); + } + break; + + case HK_BEGIN_BUS: + // An item can be selected. If not a Bus, a begin command is not possible + if( notBusy ) + { + // switch to m_ID_current_state = ID_WIRE_BUTT; + if( m_ID_current_state != ID_BUS_BUTT ) + SetToolID( ID_BUS_BUTT, wxCURSOR_PENCIL, _( "Add Bus" ) ); + OnLeftClick( DC, MousePos ); + break; + } + if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_BUS_BUTT ) ) + { + if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) + { + SCH_LINE* segment = (SCH_LINE*) DrawStruct; + if( segment->GetLayer() != LAYER_BUS ) + break; + // Bus in progress: + OnLeftClick( DC, MousePos ); + } + } + break; + + case HK_BEGIN_WIRE: + // An item can be selected. If not a wire, a begin command is not possible + if( notBusy ) + { // switch to m_ID_current_state = ID_WIRE_BUTT; if( m_ID_current_state != ID_WIRE_BUTT ) SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _( "Add Wire" ) ); OnLeftClick( DC, MousePos ); + break; + } + if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_WIRE_BUTT ) ) + { + if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) + { + SCH_LINE* segment = (SCH_LINE*) DrawStruct; + if( segment->GetLayer() != LAYER_WIRE ) + break; + // Wire in progress: + OnLeftClick( DC, MousePos ); + } } break; diff --git a/eeschema/hotkeys.h b/eeschema/hotkeys.h index acd59b48c8..d7cfe462ce 100644 --- a/eeschema/hotkeys.h +++ b/eeschema/hotkeys.h @@ -30,9 +30,18 @@ enum hotkey_id_commnand { HK_COPY_COMPONENT_OR_LABEL, HK_DRAG, HK_ADD_NEW_COMPONENT, + HK_ADD_NEW_POWER, HK_BEGIN_WIRE, + HK_BEGIN_BUS, + HK_ADD_WIRE_ENTRY, + HK_ADD_BUS_ENTRY, HK_ADD_LABEL, + HK_ADD_HLABEL, + HK_ADD_GLABEL, HK_ADD_JUNCTION, + HK_ADD_HIER_SHEET, + HK_ADD_GRAPHIC_TEXT, + HK_ADD_GRAPHIC_POLYLINE, HK_ADD_NOCONN_FLAG }; diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 5ba66af66a..ae45a8d4e5 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -5,9 +5,11 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "plot_common.h" #include "trigo.h" +#include "wxstruct.h" #include "general.h" #include "protos.h" diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index 22aff0a61d..267c8ee976 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -5,9 +5,11 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "plot_common.h" #include "trigo.h" +#include "wxstruct.h" #include "bezier_curves.h" #include "general.h" diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index 7f9094afe6..4baf7b26d2 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -8,6 +8,7 @@ #include "class_drawpanel.h" #include "plot_common.h" #include "trigo.h" +#include "wxstruct.h" #include "general.h" #include "protos.h" diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp index 98a8830d29..40c7d071b3 100644 --- a/eeschema/lib_export.cpp +++ b/eeschema/lib_export.cpp @@ -15,7 +15,6 @@ #include "gestfich.h" #include "eeschema_id.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 68bbeef55d..b5c1b2eb50 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -6,6 +6,7 @@ #include "appl_wxstruct.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "base_struct.h" #include "drawtxt.h" #include "kicad_string.h" @@ -13,12 +14,12 @@ #include "plot_common.h" #include "trigo.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_libentry.h" #include "transform.h" #include "lib_field.h" +#include "template_fieldnames.h" /*******************/ diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index 614b393dc1..c824d6e7a3 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -5,7 +5,7 @@ #ifndef CLASS_LIBENTRY_FIELDS_H #define CLASS_LIBENTRY_FIELDS_H -#include "program.h" +//#include "general.h" #include "lib_draw_item.h" @@ -68,7 +68,8 @@ public: */ wxString GetName(); - /** Function GetPenSize virtual pure + /** + * Function GetPenSize virtual pure * @return the size of the "pen" that be used to draw or plot this item */ int GetPenSize( ); diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 4e78f0aa26..7aa8676a61 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -5,12 +5,13 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "gr_basic.h" +#include "macros.h" #include "trigo.h" #include "class_drawpanel.h" #include "drawtxt.h" #include "plot_common.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index aff617c0c0..3abff259e3 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -177,7 +177,8 @@ public: } - /** Function ReturnPinStringNum (static function) + /** + * Function ReturnPinStringNum (static function) * Pin num is coded as a long or 4 ascii chars * @param aPinNum = a long containing a pin num * @return aStringBuffer = the wxString to store the pin num as an diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 54ea4fd686..e29546ea00 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -5,15 +5,19 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "plot_common.h" #include "trigo.h" +#include "wxstruct.h" #include "general.h" #include "protos.h" #include "lib_polyline.h" #include "transform.h" +#include + LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) : LIB_DRAW_ITEM( COMPONENT_POLYLINE_DRAW_TYPE, aParent ) diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 0f022654bf..23844d53a1 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -8,6 +8,7 @@ #include "class_drawpanel.h" #include "plot_common.h" #include "trigo.h" +#include "wxstruct.h" #include "general.h" #include "protos.h" diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 91c22afc9a..0fa8766391 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -10,12 +10,13 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "plot_common.h" #include "drawtxt.h" #include "trigo.h" +#include "wxstruct.h" -#include "program.h" #include "lib_draw_item.h" #include "general.h" #include "protos.h" diff --git a/eeschema/libarch.cpp b/eeschema/libarch.cpp index 86e70ab6c4..62e3418634 100644 --- a/eeschema/libarch.cpp +++ b/eeschema/libarch.cpp @@ -5,12 +5,15 @@ #include "fctsys.h" #include "common.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxstruct.h" +#include "sch_item_struct.h" -#include "program.h" #include "general.h" #include "netlist.h" #include "protos.h" #include "class_library.h" +#include "sch_component.h" /* diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 194ada4ce6..30c9a6a0c8 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -5,17 +5,19 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "appl_wxstruct.h" #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" -#include "eeschema_id.h" +#include "class_sch_screen.h" -#include "program.h" +#include "eeschema_id.h" #include "general.h" #include "protos.h" #include "libeditframe.h" #include "class_library.h" +#include "template_fieldnames.h" #include "dialog_lib_new_component.h" diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index 316c085aee..693cba1129 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -12,7 +12,6 @@ #include "confirm.h" #include "eeschema_id.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index cc92be985b..dc99e240ad 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -8,12 +8,13 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "confirm.h" #include "bitmaps.h" #include "eeschema_id.h" #include "hotkeys.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/libedit_plot_component.cpp b/eeschema/libedit_plot_component.cpp index d0f7217e5f..6b594dbf4c 100644 --- a/eeschema/libedit_plot_component.cpp +++ b/eeschema/libedit_plot_component.cpp @@ -11,14 +11,13 @@ #include "confirm.h" #include "gestfich.h" #include "eeschema_id.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" - -//#include "protos.h" #include "libeditframe.h" #include "class_library.h" + /** function OnPlotCurrentComponent * plot in SVG or PNG format the curren component */ diff --git a/eeschema/libedit_undo_redo.cpp b/eeschema/libedit_undo_redo.cpp index 0e80ca4ec5..062761230b 100644 --- a/eeschema/libedit_undo_redo.cpp +++ b/eeschema/libedit_undo_redo.cpp @@ -6,7 +6,6 @@ #include "class_drawpanel.h" #include "common.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index a6714863e5..b2000e7002 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -7,13 +7,15 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "confirm.h" #include "eda_doc.h" #include "bitmaps.h" #include "gr_basic.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "eeschema_id.h" diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index fb24556f7f..3c8ab15835 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -6,14 +6,16 @@ #define __LIBEDITFRM_H__ #include "wxstruct.h" +#include "class_sch_screen.h" #include "lib_draw_item.h" -class SCH_SCREEN; +class WinEDA_SchematicFrame; class CMP_LIBRARY; class LIB_COMPONENT; class LIB_ALIAS; +class LIB_FIELD; class WinEDA_bodygraphics_PropertiesFrame; class Dialog_BodyGraphicText_Properties; @@ -120,7 +122,8 @@ public: Close( false ); } - /** Function OnModify() + /** + * Function OnModify() * Must be called after a schematic change * in order to set the "modify" flag of the current screen */ @@ -171,24 +174,28 @@ public: FILL_T GetFillStyle( void ) { return m_drawFillStyle; } - /** Function TempCopyComponent + /** + * Function TempCopyComponent * create a temporary copy of the current edited component * Used to prepare an Undo ant/or abort command before editing the component */ void TempCopyComponent(); - /** Function RestoreComponent + /** + * Function RestoreComponent * Restore the current edited component from its temporary copy. * Used to abort a command */ void RestoreComponent(); - /** Function GetTempCopyComponent + /** + * Function GetTempCopyComponent * @return the temporary copy of the current component. */ LIB_COMPONENT* GetTempCopyComponent() { return m_tempCopyComponent; } - /** Function ClearTempCopyComponent + /** + * Function ClearTempCopyComponent * delete temporary copy of the current component and clear pointer */ void ClearTempCopyComponent(); @@ -310,7 +317,8 @@ protected: friend class Dialog_BodyGraphicText_Properties; - /** function CreatePNGorJPEGFile + /** + * Function CreatePNGorJPEGFile * Create an image (screenshot) of the current component. * Output file format is png or jpeg * @param aFileName = the full filename @@ -331,7 +339,8 @@ protected: virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMask, bool aPrintMirrorMode, void * aData = NULL); - /** function SVG_Print_component + /** + * Function SVG_Print_component * Creates the SVG print file for the current edited component. * @param aFullFileName = the full filename of the file */ diff --git a/eeschema/libfield.cpp b/eeschema/libfield.cpp index b8b01ea07b..4309cad7d8 100644 --- a/eeschema/libfield.cpp +++ b/eeschema/libfield.cpp @@ -7,12 +7,13 @@ #include "common.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" #include "class_library.h" +#include "template_fieldnames.h" void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field ) diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index 1eec680fb7..d204ba6a27 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -5,23 +5,21 @@ #include "fctsys.h" #include "confirm.h" #include "kicad_string.h" - -#include "program.h" -#include "general.h" -#include "protos.h" -#include "class_marker_sch.h" +#include "wxEeschemaStruct.h" +#include "class_sch_screen.h" #include "richio.h" +#include "general.h" +#include "protos.h" +#include "sch_marker.h" +#include "sch_items.h" +#include "sch_component.h" +#include "sch_text.h" +#include "sch_sheet.h" -/* in read_from_file_schematic_items_description.cpp */ -SCH_ITEM* ReadTextDescr( LINE_READER* aLine, wxString& aMsgDiag, int aSchematicFileVersion ); - -int ReadSheetDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ); bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ); -int ReadPartDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ); - static void LoadLayers( LINE_READER* aLine ); @@ -31,17 +29,11 @@ static void LoadLayers( LINE_READER* aLine ); */ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName ) { - char Name1[256], - Name2[256]; - int ii, layer; - wxPoint pos; - bool Failed = FALSE; - SCH_ITEM* Phead, * Pnext; - SCH_JUNCTION* ConnectionStruct; - SCH_POLYLINE* PolylineStruct; - SCH_LINE* SegmentStruct; - SCH_BUS_ENTRY* busEntry; - SCH_NO_CONNECT* NoConnectStruct; + char Name1[256]; + bool itemLoaded = false; + SCH_ITEM* Phead; + SCH_ITEM* Pnext; + SCH_ITEM* item; wxString MsgDiag; // Error and log messages #define line ((char*)reader) @@ -72,8 +64,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F PrintMsg( MsgDiag ); if( !reader.ReadLine() - || strncmp( line + 9, SCHEMATIC_HEAD_STRING, - sizeof(SCHEMATIC_HEAD_STRING) - 1 ) != 0 ) + || strncmp( line + 9, SCHEMATIC_HEAD_STRING, sizeof(SCHEMATIC_HEAD_STRING) - 1 ) != 0 ) { MsgDiag = FullFileName + _( " is NOT an EESchema file!" ); DisplayError( this, MsgDiag ); @@ -113,6 +104,8 @@ again." ); while( reader.ReadLine() ) { + item = NULL; + char* sline = line; while( (*sline != ' ' ) && *sline ) sline++; @@ -121,186 +114,31 @@ again." ); { case '$': // identification block if( line[1] == 'C' ) - Failed = ReadPartDescr( &reader, MsgDiag, screen ); - + item = new SCH_COMPONENT(); else if( line[1] == 'S' ) - Failed = ReadSheetDescr( &reader, MsgDiag, screen ); - + item = new SCH_SHEET(); else if( line[1] == 'D' ) - Failed = ReadSchemaDescr( &reader, MsgDiag, screen ); - - else if( line[1] == 'T' ) // text part - { - printf( "**** TEXT PART\n" ); - SCH_ITEM* Struct = ReadTextDescr( &reader, MsgDiag, version ); - - if( Struct ) - { - Struct->SetNext( screen->EEDrawList ); - screen->EEDrawList = Struct; - } - else - { - Failed = true; - } - } + itemLoaded = ReadSchemaDescr( &reader, MsgDiag, screen ); break; case 'L': // Its a library item. - Failed = ReadPartDescr( &reader, MsgDiag, screen ); + item = new SCH_COMPONENT(); break; case 'W': // Its a Segment (WIRE or BUS) item. - if( sscanf( sline, "%s %s", Name1, Name2 ) != 2 ) - { - MsgDiag.Printf( wxT( "EESchema file segment error at line %d, aborted" ), - reader.LineNumber() ); - MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = true; - break; - } - - layer = LAYER_NOTES; - - if( Name1[0] == 'W' ) - layer = LAYER_WIRE; - if( Name1[0] == 'B' ) - layer = LAYER_BUS; - - SegmentStruct = new SCH_LINE( wxPoint( 0, 0 ), layer ); - - if( !reader.ReadLine() - || sscanf( line, "%d %d %d %d ", &SegmentStruct->m_Start.x, - &SegmentStruct->m_Start.y, &SegmentStruct->m_End.x, - &SegmentStruct->m_End.y ) != 4 ) - { - MsgDiag.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ), - reader.LineNumber() ); - MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = true; - SAFE_DELETE( SegmentStruct ); - break; - } - - if( !Failed ) - { - SegmentStruct->SetNext( screen->EEDrawList ); - screen->EEDrawList = SegmentStruct; - } + item = new SCH_LINE(); break; case 'E': // Its a WIRE or BUS item. - if( sscanf( sline, "%s %s", Name1, Name2 ) != 2 ) - { - MsgDiag.Printf( wxT( "EESchema file record struct error at line %d, aborted" ), - reader.LineNumber() ); - MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = true; - break; - } - - ii = WIRE_TO_BUS; - if( Name1[0] == 'B' ) - ii = BUS_TO_BUS; - - busEntry = new SCH_BUS_ENTRY( wxPoint( 0, 0 ), '\\', ii ); - - if( !reader.ReadLine() - || sscanf( line, "%d %d %d %d ", &busEntry->m_Pos.x, &busEntry->m_Pos.y, - &busEntry->m_Size.x, &busEntry->m_Size.y ) != 4 ) - { - MsgDiag.Printf( wxT( "EESchema file Bus Entry struct error at line %d, aborted" ), - reader.LineNumber() ); - MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = true; - SAFE_DELETE( busEntry ); - break; - } - - if( !Failed ) - { - busEntry->m_Size.x -= busEntry->m_Pos.x; - busEntry->m_Size.y -= busEntry->m_Pos.y; - busEntry->SetNext( screen->EEDrawList ); - screen->EEDrawList = busEntry; - } + item = new SCH_BUS_ENTRY(); break; case 'P': // Its a polyline item. - if( sscanf( sline, "%s %s %d", Name1, Name2, &ii ) != 3 ) - { - MsgDiag.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ), - reader.LineNumber() ); - MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = true; - break; - } - layer = LAYER_NOTES; - if( Name2[0] == 'W' ) - layer = LAYER_WIRE; - if( Name2[0] == 'B' ) - layer = LAYER_BUS; - - PolylineStruct = new SCH_POLYLINE( layer ); - - for( unsigned jj = 0; jj < (unsigned)ii; jj++ ) - { - wxPoint point; - - if( !reader.ReadLine() - || sscanf( line, "%d %d", &point.x, &point.y ) != 2 ) - { - MsgDiag.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ), - reader.LineNumber() ); - MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = true; - SAFE_DELETE( PolylineStruct ); - break; - } - - PolylineStruct->AddPoint( point ); - } - - if( !Failed ) - { - PolylineStruct->SetNext( screen->EEDrawList ); - screen->EEDrawList = PolylineStruct; - } + item = new SCH_POLYLINE(); break; - case 'C': // It is a connection item. - ConnectionStruct = new SCH_JUNCTION( wxPoint( 0, 0 ) ); - - if( sscanf( sline, "%s %d %d", Name1, &ConnectionStruct->m_Pos.x, - &ConnectionStruct->m_Pos.y ) != 3 ) - { - MsgDiag.Printf( wxT( "EESchema file connection struct error at line %d, aborted" ), - reader.LineNumber() ); - MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = true; - SAFE_DELETE( ConnectionStruct ); - } - else - { - ConnectionStruct->SetNext( screen->EEDrawList ); - screen->EEDrawList = ConnectionStruct; - } - break; - - case 'N': // It is a NoConnect item. - if( sscanf( sline, "%s %d %d", Name1, &pos.x, &pos.y ) != 3 ) - { - MsgDiag.Printf( wxT( "EESchema file NoConnect struct error at line %d, aborted" ), - reader.LineNumber() ); - MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = true; - } - else - { - NoConnectStruct = new SCH_NO_CONNECT( pos ); - NoConnectStruct->SetNext( screen->EEDrawList ); - screen->EEDrawList = NoConnectStruct; - } + case 'C': // It is a connection item. + item = new SCH_JUNCTION(); break; case 'K': // It is a Marker item. @@ -308,28 +146,50 @@ again." ); // demand in schematic break; + case 'N': // It is a NoConnect item. + item = new SCH_NO_CONNECT(); + break; + case 'T': // It is a text item. + if( sscanf( sline, "%s", Name1 ) != 1 ) { - SCH_ITEM* Struct = ReadTextDescr( &reader, MsgDiag, version); - if( Struct ) - { - Struct->SetNext( screen->EEDrawList ); - screen->EEDrawList = Struct; - } - else - Failed = true; + MsgDiag.Printf( wxT( "EESchema file text load error at line %d" ), + reader.LineNumber() ); + itemLoaded = false; } + else if( Name1[0] == 'L' ) + item = new SCH_LABEL(); + else if( Name1[0] == 'G' && ver > '1' ) + item = new SCH_GLOBALLABEL(); + else if( (Name1[0] == 'H') || (Name1[0] == 'G' && ver == '1') ) + item = new SCH_HIERLABEL(); + else + item = new SCH_TEXT(); break; default: - Failed = true; + itemLoaded = false; MsgDiag.Printf( wxT( "EESchema file undefined object at line %d, aborted" ), reader.LineNumber() ); MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - break; } - if( Failed ) + if( item ) + { + itemLoaded = item->Load( reader, MsgDiag ); + + if( !itemLoaded ) + { + SAFE_DELETE( item ); + } + else + { + item->SetNext( screen->EEDrawList ); + screen->EEDrawList = item; + } + } + + if( !itemLoaded ) { DisplayError( this, MsgDiag ); break; @@ -390,3 +250,117 @@ static void LoadLayers( LINE_READER* aLine ) break; } } + + +/* Read the schematic header. */ +bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ) +{ + char Text[256], buf[1024]; + int ii; + Ki_PageDescr* wsheet = &g_Sheet_A4; + static Ki_PageDescr* SheetFormatList[] = + { + &g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0, + &g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E, + &g_Sheet_user, NULL + }; + wxSize PageSize; + + sscanf( ((char*)(*aLine)), "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y ); + + wxString pagename = CONV_FROM_UTF8( Text ); + for( ii = 0; SheetFormatList[ii] != NULL; ii++ ) + { + wsheet = SheetFormatList[ii]; + if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */ + { + // Get the user page size and make it the default + if( wsheet == &g_Sheet_user ) + { + g_Sheet_user.m_Size = PageSize; + } + break; + } + } + + if( SheetFormatList[ii] == NULL ) + { + aMsgDiag.Printf( wxT( "EESchema file dimension definition error \ +line %d, \aAbort reading file.\n" ), + aLine->LineNumber() ); + aMsgDiag << CONV_FROM_UTF8( ((char*)(*aLine)) ); + } + + Window->m_CurrentSheetDesc = wsheet; + + for( ; ; ) + { + if( !aLine->ReadLine() ) + return TRUE; + + if( strnicmp( ((char*)(*aLine)), "$End", 4 ) == 0 ) + break; + + if( strnicmp( ((char*)(*aLine)), "Sheet", 2 ) == 0 ) + sscanf( ((char*)(*aLine)) + 5, " %d %d", + &Window->m_ScreenNumber, &Window->m_NumberOfScreen ); + + if( strnicmp( ((char*)(*aLine)), "Title", 2 ) == 0 ) + { + ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); + Window->m_Title = CONV_FROM_UTF8( buf ); + continue; + } + + if( strnicmp( ((char*)(*aLine)), "Date", 2 ) == 0 ) + { + ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); + Window->m_Date = CONV_FROM_UTF8( buf ); + continue; + } + + if( strnicmp( ((char*)(*aLine)), "Rev", 2 ) == 0 ) + { + ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); + Window->m_Revision = CONV_FROM_UTF8( buf ); + continue; + } + + if( strnicmp( ((char*)(*aLine)), "Comp", 4 ) == 0 ) + { + ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); + Window->m_Company = CONV_FROM_UTF8( buf ); + continue; + } + + if( strnicmp( ((char*)(*aLine)), "Comment1", 8 ) == 0 ) + { + ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); + Window->m_Commentaire1 = CONV_FROM_UTF8( buf ); + continue; + } + + if( strnicmp( ((char*)(*aLine)), "Comment2", 8 ) == 0 ) + { + ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); + Window->m_Commentaire2 = CONV_FROM_UTF8( buf ); + continue; + } + + if( strnicmp( ((char*)(*aLine)), "Comment3", 8 ) == 0 ) + { + ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); + Window->m_Commentaire3 = CONV_FROM_UTF8( buf ); + continue; + } + + if( strnicmp( ((char*)(*aLine)), "Comment4", 8 ) == 0 ) + { + ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); + Window->m_Commentaire4 = CONV_FROM_UTF8( buf ); + continue; + } + } + + return true; +} diff --git a/eeschema/locate.cpp b/eeschema/locate.cpp index e95395cfa0..9002da70ee 100644 --- a/eeschema/locate.cpp +++ b/eeschema/locate.cpp @@ -4,14 +4,19 @@ #include "fctsys.h" #include "common.h" -#include "program.h" #include "trigo.h" #include "macros.h" +#include "class_sch_screen.h" #include "general.h" -#include "class_marker_sch.h" #include "protos.h" #include "class_library.h" +#include "sch_marker.h" +#include "sch_items.h" +#include "sch_component.h" +#include "sch_sheet.h" +#include "lib_pin.h" +#include "template_fieldnames.h" static bool IsItemInBox(EDA_Rect& aBox, SCH_ITEM* DrawStruct ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index a499cb7156..c6440a83ee 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -10,8 +10,8 @@ #include "common.h" #include "appl_wxstruct.h" #include "bitmaps.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "eeschema_id.h" @@ -249,7 +249,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() wxMenu* placeMenu = new wxMenu; /* Component */ - text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr, HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_COMPONENT_BUTT, text, HELP_PLACE_COMPONENTS, wxITEM_NORMAL ); @@ -257,13 +257,15 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() placeMenu->Append( item ); /* Power port */ - item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, _( "&Power port" ), + text = AddHotkeyName( _( "Power port" ), s_Schematic_Hokeys_Descr, + HK_ADD_NEW_POWER, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text, HELP_PLACE_POWERPORT, wxITEM_NORMAL ); item->SetBitmap( add_power_xpm ); placeMenu->Append( item ); /* Wire */ - text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr, + text = AddHotkeyName( _( "Wire" ), s_Schematic_Hokeys_Descr, HK_BEGIN_WIRE, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, text, HELP_PLACE_WIRE, wxITEM_NORMAL ); @@ -271,19 +273,25 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() placeMenu->Append( item ); /* Bus */ - item = new wxMenuItem( placeMenu, ID_BUS_BUTT, _( "&Bus" ), + text = AddHotkeyName( _( "Bus" ), s_Schematic_Hokeys_Descr, + HK_BEGIN_BUS, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_BUS_BUTT, text, HELP_PLACE_BUS, wxITEM_NORMAL ); item->SetBitmap( add_bus_xpm ); placeMenu->Append( item ); - /* Wire to Bus */ - item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, _( "W&ire to bus entry" ), + /* Wire to Bus entry */ + text = AddHotkeyName( _( "Wire to bus entry" ), s_Schematic_Hokeys_Descr, + HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_NORMAL ); item->SetBitmap( add_line2bus_xpm ); placeMenu->Append( item ); - /* Bus to Bus */ - item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, _( "B&us to bus entry" ), + /* Bus to Bus entry */ + text = AddHotkeyName( _( "Bus to bus entry" ), s_Schematic_Hokeys_Descr, + HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, HELP_PLACE_BUS2BUS_ENTRY, wxITEM_NORMAL ); item->SetBitmap( add_bus2bus_xpm ); placeMenu->Append( item ); @@ -304,7 +312,9 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() placeMenu->Append( item ); /* Global label */ - item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, _( "Global label" ), + text = AddHotkeyName( _( "Global label" ), s_Schematic_Hokeys_Descr, + HK_ADD_GLABEL, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, text, HELP_PLACE_GLOBALLABEL, wxITEM_NORMAL ); item->SetBitmap( add_glabel_xpm ); placeMenu->Append( item ); @@ -321,13 +331,17 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() placeMenu->AppendSeparator(); /* Hierarchical label */ - item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, _( "Hierarchical label" ), + text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr, + HK_ADD_HLABEL, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, text, HELP_PLACE_HIER_LABEL, wxITEM_NORMAL ); item->SetBitmap( add_hierarchical_label_xpm ); placeMenu->Append( item ); /* Hierarchical sheet */ - item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, _( "Hierarchical sheet" ), + text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr, + HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text, HELP_PLACE_SHEET, wxITEM_NORMAL ); item->SetBitmap( add_hierarchical_subsheet_xpm ); placeMenu->Append( item ); @@ -348,13 +362,17 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() placeMenu->AppendSeparator(); /* Graphic line or polygon */ - item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, _( "Graphic line or polygon" ), + text = AddHotkeyName( _( "Graphic polyline" ), s_Schematic_Hokeys_Descr, + HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text, HELP_PLACE_GRAPHICLINES, wxITEM_NORMAL ); item->SetBitmap( add_dashed_line_xpm ); placeMenu->Append( item ); /* Graphic text */ - item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, _( "Graphic text" ), + text = AddHotkeyName( _( "Graphic text" ), s_Schematic_Hokeys_Descr, + HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut + item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text, HELP_PLACE_GRAPHICTEXTS, wxITEM_NORMAL ); item->SetBitmap( add_text_xpm ); placeMenu->Append( item ); diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index 6b23b3963c..4fa588b6e5 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -7,9 +7,7 @@ #include "appl_wxstruct.h" #include "bitmaps.h" -#include "program.h" #include "general.h" -//#include "protos.h" #include "libeditframe.h" #include "eeschema_id.h" #include "hotkeys.h" diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index 7547a56aff..a59ff87ec0 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -37,13 +37,18 @@ #include "kicad_string.h" #include "gestfich.h" #include "appl_wxstruct.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "netlist.h" #include "protos.h" #include "class_library.h" #include "lib_pin.h" +#include "sch_component.h" +#include "sch_text.h" +#include "sch_sheet.h" +#include "template_fieldnames.h" #include "xnode.h" // also nests: @@ -353,7 +358,7 @@ wxString EXPORT_HELP::MakeCommandLine( const wxString& aFormatString, * @return true if success. */ bool WinEDA_SchematicFrame::WriteNetListFile( int aFormat, const wxString& aFullFileName, - bool aUse_netnames ) + bool aUse_netnames ) { bool ret = true; FILE* f = NULL; diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 8bd6e4c824..b5ead6b4b1 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -4,16 +4,23 @@ #include "fctsys.h" #include "common.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "netlist.h" #include "protos.h" #include "class_library.h" #include "lib_pin.h" +#include "sch_items.h" +#include "sch_component.h" +#include "sch_text.h" +#include "sch_sheet.h" #include "algorithm" +#include + // Buffer to build the list of items used in netlist and erc calculations NETLIST_OBJECT_LIST g_NetObjectslist; diff --git a/eeschema/netlist.h b/eeschema/netlist.h index cf7cc49a86..91ade5f843 100644 --- a/eeschema/netlist.h +++ b/eeschema/netlist.h @@ -6,9 +6,14 @@ #define _NETLIST_H_ +#include "macros.h" + #include "class_libentry.h" +class SCH_COMPONENT; + + #define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1" #define ISBUS 1 diff --git a/eeschema/netlist_control.cpp b/eeschema/netlist_control.cpp index 36d721a0b2..09cff924da 100644 --- a/eeschema/netlist_control.cpp +++ b/eeschema/netlist_control.cpp @@ -17,12 +17,15 @@ #include "common.h" #include "confirm.h" #include "gestfich.h" +#include "wxEeschemaStruct.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "netlist.h" #include "protos.h" #include "netlist_control.h" +#include "sch_sheet.h" + //Imported function: int TestDuplicateSheetNames( bool aCreateMarker ); diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index 7d23887512..c77cfb5618 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -7,11 +7,16 @@ #include "eeschema_id.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" -#include "class_marker_sch.h" #include "protos.h" +#include "sch_text.h" +#include "sch_marker.h" +#include "sch_items.h" +#include "sch_component.h" +#include "sch_sheet.h" static wxArrayString s_CmpNameList; diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 32ec62f709..52162a5f59 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -8,13 +8,20 @@ #include "class_drawpanel.h" #include "confirm.h" #include "bitmaps.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" -#include "class_marker_sch.h" #include "protos.h" #include "hotkeys.h" #include "class_library.h" +#include "sch_marker.h" +#include "sch_text.h" +#include "sch_items.h" +#include "sch_component.h" +#include "sch_sheet.h" +#include "sch_sheet_path.h" + #include using namespace std; @@ -231,7 +238,8 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) msg = AddHotkeyName( _( "Rotate Field" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_FIELD, msg, rotate_field_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_FIELD, _( "Edit Field" ), edit_text_xpm ); + msg = AddHotkeyName( _( "Edit Field" ), s_Schematic_Hokeys_Descr, HK_EDIT ); + ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_FIELD, msg, edit_text_xpm ); } @@ -526,13 +534,13 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, WinEDA_SchematicFrame* fr PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm ); + msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION ); + ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm ); msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm ); // Add global label command only if the cursor is over one end of the wire. - if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y) - || ( pos.x == Wire->m_End.x && pos.y == Wire->m_End.y ) ) + if( ( pos == Wire->m_Start ) || ( pos == Wire->m_End ) ) ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm ); } @@ -541,24 +549,26 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, WinEDA_SchematicFrame* fram { bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE; wxPoint pos = frame->GetScreen()->m_Curseur; - + wxString msg; if( is_new ) { ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm ); return; } - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus" ), delete_bus_xpm ); + msg = AddHotkeyName( _( "Delete Bus" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_bus_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), break_bus_xpm ); PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ), add_line_label_xpm ); + msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION ); + ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm ); + msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL ); + ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm ); // Add global label command only if the cursor is over one end of the bus. - if( ( pos.x == Bus->m_Start.x && pos.y == Bus->m_Start.y) - || ( pos.x == Bus->m_End.x && pos.y == Bus->m_End.y ) ) + if( ( pos == Bus->m_Start ) || ( pos == Bus->m_End ) ) ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm ); } @@ -586,7 +596,6 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ) else { msg = AddHotkeyName( _( "Edit Sheet" ), s_Schematic_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, edit_sheet_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ), @@ -599,7 +608,8 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ) ADD_MENUITEM( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup PinSheets" ), options_pinsheet_xpm ); PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet" ), delete_sheet_xpm ); + msg = AddHotkeyName( _( "Delete Sheet" ), s_Schematic_Hokeys_Descr, HK_DELETE ); + ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_sheet_xpm ); } } diff --git a/eeschema/operations_on_items_lists.cpp b/eeschema/operations_on_items_lists.cpp index fcc137d3f7..13cc3233a6 100644 --- a/eeschema/operations_on_items_lists.cpp +++ b/eeschema/operations_on_items_lists.cpp @@ -8,11 +8,16 @@ #include "appl_wxstruct.h" #include "common.h" #include "class_drawpanel.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" -#include "class_marker_sch.h" #include "protos.h" +#include "sch_marker.h" +#include "sch_sheet.h" +#include "sch_component.h" +#include "sch_items.h" + void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& rotationPoint ) { diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 2afd3162c7..23bbef453e 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -7,8 +7,8 @@ #include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" -#include "program.h" #include "libeditframe.h" #include "eeschema_id.h" #include "class_libentry.h" diff --git a/eeschema/plot.cpp b/eeschema/plot.cpp index 1aeb361ec6..1babcfd792 100644 --- a/eeschema/plot.cpp +++ b/eeschema/plot.cpp @@ -10,11 +10,15 @@ #include "drawtxt.h" #include "trigo.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" #include "lib_pin.h" +#include "sch_items.h" +#include "sch_component.h" +#include "sch_sheet.h" +#include "sch_text.h" +#include "template_fieldnames.h" /* Local functions : */ diff --git a/eeschema/program.h b/eeschema/program.h deleted file mode 100644 index 377774077d..0000000000 --- a/eeschema/program.h +++ /dev/null @@ -1,54 +0,0 @@ -/********************************************/ -/* Definitions for the EESchema program: */ -/********************************************/ - -#ifndef PROGRAM_H -#define PROGRAM_H - - -class TRANSFORM; - - -#define HIGHLIGHT_COLOR WHITE -#define TEXT_NO_VISIBLE 1 - -#include "wxEeschemaStruct.h" -#include "macros.h" -#include "base_struct.h" - -#include "sch_item_struct.h" -#include "class_sch_component.h" -#include "class_sch_screen.h" -#include "class_drawsheet.h" -#include "class_drawsheetpath.h" -#include "class_text-label.h" -#include "class_schematic_items.h" - - -/* Rotation, mirror of graphic items in components bodies are handled by a - * transform matrix. The default matix is useful to draw lib entries with - * a defualt matix ( no rotation, no mirror but Y axis is bottom to top, and - * Y draw axis is to to bottom so we must have a default matix that reverses - * the Y coordinate and keeps the X coordiate - */ -extern TRANSFORM DefaultTransform; - -#define MIN_BUSLINES_THICKNESS 12 // min bus lines and entries thickness - -#define MAX_LAYERS 44 - -class LayerStruct -{ -public: - char LayerNames[MAX_LAYERS + 1][8]; - int LayerColor[MAX_LAYERS + 1]; - char LayerStatus[MAX_LAYERS + 1]; - int NumberOfLayers; - int CurrentLayer; - int CurrentWidth; - int CommonColor; - int Flags; -}; - - -#endif /* PROGRAM_H */ diff --git a/eeschema/read_from_file_schematic_items_descriptions.cpp b/eeschema/read_from_file_schematic_items_descriptions.cpp deleted file mode 100644 index 121c658616..0000000000 --- a/eeschema/read_from_file_schematic_items_descriptions.cpp +++ /dev/null @@ -1,843 +0,0 @@ -/* read_from_file_schematic_items_descriptions.cpp */ - -/*functions to read schematic items descriptions from file - */ -#include "fctsys.h" -#include "common.h" -#include "confirm.h" -#include "kicad_string.h" -#include "drawtxt.h" - -#include "program.h" -#include "general.h" -#include "protos.h" -#include "richio.h" - -#define line ((char*)(*aLine)) - -SCH_ITEM* ReadTextDescr( LINE_READER* aLine, wxString& aMsgDiag, int aSchematicFileVersion ) -{ -/** - * Function ReadTextDescr - * Reads the data structures for a Text (Comment, label, Hlabel and Hlabel - * from a FILE in "*.sch" format. - * @param aLine is a LINE_READER to use. - * @return a pointer to the new created object if success reading else NULL. - */ - SCH_ITEM* Struct = NULL; - char Name1[256]; - char Name2[256]; - char Name3[256]; - int thickness = 0, size = 0, orient = 0; - wxPoint pos; - - - Name1[0] = 0; Name2[0] = 0; Name3[0] = 0; - - char* sline = line; - while( (*sline != ' ' ) && *sline ) - sline++; - - // sline points the start of parameters - int ii = sscanf( sline, "%s %d %d %d %d %s %s %d", Name1, &pos.x, &pos.y, - &orient, &size, Name2, Name3, &thickness ); - - if( ii < 4 ) - { - aMsgDiag.Printf( - wxT( "EESchema file text struct error line %d, aborted" ), - aLine->LineNumber() ); - return NULL; - } - - if( !aLine->ReadLine() ) - { - aMsgDiag.Printf( - wxT( "EESchema file text struct error line %d (No text), aborted" ), - aLine->LineNumber() ); - return NULL; - } - - if( size == 0 ) - size = DEFAULT_SIZE_TEXT; - - char* text = strtok( line, "\n\r" ); - if( text == NULL ) - return NULL; - - if( Name1[0] == 'L' ) // Reading a simple label (SCH_LABEL item) - { - SCH_LABEL* TextStruct = new SCH_LABEL( pos, CONV_FROM_UTF8( text ) ); - - TextStruct->m_Size.x = TextStruct->m_Size.y = size; - TextStruct->SetSchematicTextOrientation( orient ); - if( isdigit( Name3[0] ) ) - { - thickness = atol( Name3 ); - TextStruct->m_Bold = (thickness != 0); - TextStruct->m_Width = - TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0; - } - Struct = TextStruct; - if( stricmp( Name2, "Italic" ) == 0 ) - TextStruct->m_Italic = 1; - } - else if( Name1[0] == 'G' && aSchematicFileVersion > '1' ) - { - // Reading a global label (SCH_GLOBALLABEL item). - SCH_GLOBALLABEL* TextStruct = - new SCH_GLOBALLABEL( pos, CONV_FROM_UTF8( text ) ); - - Struct = TextStruct; - TextStruct->m_Size.x = TextStruct->m_Size.y = size; - TextStruct->SetSchematicTextOrientation( orient ); - TextStruct->m_Shape = NET_INPUT; - TextStruct->m_Bold = (thickness != 0); - TextStruct->m_Width = - TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0; - - if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) - TextStruct->m_Shape = NET_OUTPUT; - if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) - TextStruct->m_Shape = NET_BIDI; - if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 ) - TextStruct->m_Shape = NET_TRISTATE; - if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 ) - TextStruct->m_Shape = NET_UNSPECIFIED; - if( stricmp( Name3, "Italic" ) == 0 ) - TextStruct->m_Italic = 1; - } - else if( (Name1[0] == 'H') - || (Name1[0] == 'G' && aSchematicFileVersion == '1') ) - { - // Reading a hierarchical label (SCH_HIERLABEL item). - // In schematic file version 1, glabels were actually hierarchical - // labels. - SCH_HIERLABEL* TextStruct = new SCH_HIERLABEL( pos, - CONV_FROM_UTF8( text ) ); - - Struct = TextStruct; - TextStruct->m_Size.x = TextStruct->m_Size.y = size; - TextStruct->SetSchematicTextOrientation( orient ); - TextStruct->m_Shape = NET_INPUT; - TextStruct->m_Bold = (thickness != 0); - TextStruct->m_Width = - TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0; - - if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) - TextStruct->m_Shape = NET_OUTPUT; - if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) - TextStruct->m_Shape = NET_BIDI; - if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 ) - TextStruct->m_Shape = NET_TRISTATE; - if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 ) - TextStruct->m_Shape = NET_UNSPECIFIED; - if( stricmp( Name3, "Italic" ) == 0 ) - TextStruct->m_Italic = 1; - } - else // reading a graphic text (comment) - { - wxString val = CONV_FROM_UTF8( text ); - - for( ;; ) - { - int i=val.find( wxT( "\\n" ) ); - - if( i == wxNOT_FOUND ) - break; - val.erase( i, 2 ); - val.insert( i, wxT( "\n" ) ); - } - - SCH_TEXT* TextStruct = new SCH_TEXT( pos, val ); - - TextStruct->m_Size.x = TextStruct->m_Size.y = size; - TextStruct->SetSchematicTextOrientation( orient ); - - if( isdigit( Name3[0] ) ) - { - thickness = atol( Name3 ); - TextStruct->m_Bold = (thickness != 0); - TextStruct->m_Width = - TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0; - } - - if( strnicmp( Name2, "Italic", 6 ) == 0 ) - TextStruct->m_Italic = 1; - - Struct = TextStruct; - } - - return Struct; -} - - -/* Function used by LoadEEFile(). - * Get the lines for a description of a piece of hierarchy. - */ -int ReadSheetDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ) -{ - int ii, fieldNdx, size; - char Name1[256], Char1[256], Char2[256]; - SCH_SHEET* SheetStruct; - SCH_SHEET_PIN* SheetLabelStruct; - int Failed = FALSE; - char* ptcar; - - SheetStruct = new SCH_SHEET(); - - SheetStruct->m_TimeStamp = GetTimeStamp(); - - // sheets are added to the EEDrawList 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( line[0] == '$' ) // line should be "$Sheet" - { - if( !aLine->ReadLine() ) - { - aMsgDiag.Printf( wxT( "Read File Errror" ) ); - return TRUE; - } - } - - /* Next line: must be "S xx yy nn mm" with xx, yy = sheet position - * ( upper left corner ) et nn,mm = sheet size */ - if( (sscanf( &line[1], "%d %d %d %d", - &SheetStruct->m_Pos.x, &SheetStruct->m_Pos.y, - &SheetStruct->m_Size.x, &SheetStruct->m_Size.y ) != 4) - || (line[0] != 'S' ) ) - { - aMsgDiag.Printf( - wxT( " ** EESchema file sheet struct error at line %d, aborted\n" ), - aLine->LineNumber() ); - - aMsgDiag << CONV_FROM_UTF8( line ); - Failed = TRUE; - return Failed; - } - - /* Read fields */ - for( ; ; ) /* Analysis of lines "Fn" text. */ - { - if( !aLine->ReadLine() ) - return TRUE; - - if( line[0] == 'U' ) - { - sscanf( line + 1, "%lX", &SheetStruct->m_TimeStamp ); - if( SheetStruct->m_TimeStamp == 0 ) // zero is not unique! - SheetStruct->m_TimeStamp = GetTimeStamp(); - continue; - } - - if( line[0] != 'F' ) - break; - - sscanf( line + 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 = line; - while( *ptcar && ( *ptcar != '"' ) ) - ptcar++; - - if( *ptcar != '"' ) - { - aMsgDiag.Printf( - wxT( "EESchema file sheet label F%d at line %d, aborted\n" ), - fieldNdx, aLine->LineNumber() ); - aMsgDiag << CONV_FROM_UTF8( line ); - return TRUE; - } - - for( ptcar++, ii = 0; ; ii++, ptcar++ ) - { - Name1[ii] = *ptcar; - - if( *ptcar == 0 ) - { - aMsgDiag.Printf( - wxT( "EESchema file sheet field F at line %d, aborted\n" ), - aLine->LineNumber() ); - aMsgDiag << CONV_FROM_UTF8( line ); - return TRUE; - } - - if( *ptcar == '"' ) - { - Name1[ii] = 0; - ptcar++; - break; - } - } - - if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) ) - { - if( sscanf( ptcar, "%d", &size ) != 1 ) - { - aMsgDiag.Printf( wxT( "EESchema file sheet Label Caract error line %d, aborted\n" ), - aLine->LineNumber() ); - - aMsgDiag << CONV_FROM_UTF8( line ); - } - if( size == 0 ) - size = DEFAULT_SIZE_TEXT; - - if( fieldNdx == 0 ) - { - SheetStruct->m_SheetName = CONV_FROM_UTF8( Name1 ); - SheetStruct->m_SheetNameSize = size; - } - else - { - SheetStruct->SetFileName( CONV_FROM_UTF8( Name1 ) ); - - //printf( "in ReadSheetDescr : SheetStruct->m_FileName = %s \n", - // Name1 ); - SheetStruct->m_FileNameSize = size; - } - } - - if( fieldNdx > 1 ) - { - int x, y; - - /* Read coordinates. */ - if( sscanf( ptcar, "%s %s %d %d %d", Char1, Char2, &x, &y, &size ) != 5 ) - { - aMsgDiag.Printf( wxT( "EESchema file sheet label error at line %d, ignoring.\n" ), - aLine->LineNumber() ); - aMsgDiag << CONV_FROM_UTF8( line ); - continue; - } - - SheetLabelStruct = new SCH_SHEET_PIN( SheetStruct, wxPoint( x, y ), - CONV_FROM_UTF8( Name1 ) ); - - if( size == 0 ) - size = DEFAULT_SIZE_TEXT; - - SheetLabelStruct->m_Size.x = SheetLabelStruct->m_Size.y = size; - SheetLabelStruct->m_Pos.x=x; //to readjust x of first label if vertical - switch( Char1[0] ) - { - case 'I': - SheetLabelStruct->m_Shape = NET_INPUT; - break; - - case 'O': - SheetLabelStruct->m_Shape = NET_OUTPUT; - break; - - case 'B': - SheetLabelStruct->m_Shape = NET_BIDI; - break; - - case 'T': - SheetLabelStruct->m_Shape = NET_TRISTATE; - break; - - case 'U': - SheetLabelStruct->m_Shape = NET_UNSPECIFIED; - break; - } - - switch( Char2[0] ) - { - case 'R' : /* pin on right side */ - SheetLabelStruct->SetEdge(1); - break; - case 'T' : /* pin on top side */ - SheetLabelStruct->SetEdge(2); - break; - case 'B' : /* pin on bottom side */ - SheetLabelStruct->SetEdge(3); - break; - case 'L' : /* pin on left side */ - default : - SheetLabelStruct->SetEdge(0); - break; - } - SheetStruct->AddLabel( SheetLabelStruct ); - } - } - - if( strnicmp( "$End", line, 4 ) != 0 ) - { - aMsgDiag.Printf( wxT( "**EESchema file end_sheet struct error at line %d, aborted\n" ), - aLine->LineNumber() ); - aMsgDiag << CONV_FROM_UTF8( line ); - Failed = TRUE; - } - - if( !Failed ) - { - SheetStruct->SetNext( Window->EEDrawList ); - Window->EEDrawList = SheetStruct; - SheetStruct->SetParent( Window ); - } - - return Failed; -} - - -/* Read the schematic header. */ -bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ) -{ - char Text[256], buf[1024]; - int ii; - Ki_PageDescr* wsheet = &g_Sheet_A4; - static Ki_PageDescr* SheetFormatList[] = - { - &g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0, - &g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E, - &g_Sheet_user, NULL - }; - wxSize PageSize; - - sscanf( line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y ); - - wxString pagename = CONV_FROM_UTF8( Text ); - for( ii = 0; SheetFormatList[ii] != NULL; ii++ ) - { - wsheet = SheetFormatList[ii]; - if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */ - { - // Get the user page size and make it the default - if( wsheet == &g_Sheet_user ) - { - g_Sheet_user.m_Size = PageSize; - } - break; - } - } - - if( SheetFormatList[ii] == NULL ) - { - aMsgDiag.Printf( wxT( "EESchema file dimension definition error \ -line %d, \aAbort reading file.\n" ), - aLine->LineNumber() ); - aMsgDiag << CONV_FROM_UTF8( line ); - } - - Window->m_CurrentSheetDesc = wsheet; - - for( ; ; ) - { - if( !aLine->ReadLine() ) - return TRUE; - - if( strnicmp( line, "$End", 4 ) == 0 ) - break; - - if( strnicmp( line, "Sheet", 2 ) == 0 ) - sscanf( line + 5, " %d %d", - &Window->m_ScreenNumber, &Window->m_NumberOfScreen ); - - if( strnicmp( line, "Title", 2 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - Window->m_Title = CONV_FROM_UTF8( buf ); - continue; - } - - if( strnicmp( line, "Date", 2 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - Window->m_Date = CONV_FROM_UTF8( buf ); - continue; - } - - if( strnicmp( line, "Rev", 2 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - Window->m_Revision = CONV_FROM_UTF8( buf ); - continue; - } - - if( strnicmp( line, "Comp", 4 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - Window->m_Company = CONV_FROM_UTF8( buf ); - continue; - } - - if( strnicmp( line, "Comment1", 8 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - Window->m_Commentaire1 = CONV_FROM_UTF8( buf ); - continue; - } - - if( strnicmp( line, "Comment2", 8 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - Window->m_Commentaire2 = CONV_FROM_UTF8( buf ); - continue; - } - - if( strnicmp( line, "Comment3", 8 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - Window->m_Commentaire3 = CONV_FROM_UTF8( buf ); - continue; - } - - if( strnicmp( line, "Comment4", 8 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - Window->m_Commentaire4 = CONV_FROM_UTF8( buf ); - continue; - } - } - - return false; -} - - -/* Function used by LoadEEFile (). - * Get the lines for a description of a schematic component. - */ - -int ReadPartDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ) -{ - int ii; - char Name1[256], Name2[256], - Char1[256], Char2[256], Char3[256]; - SCH_COMPONENT* component; - int Failed = 0, newfmt = 0; - char* ptcar; - wxString fieldName; - - component = new SCH_COMPONENT(); - - component->m_Convert = 1; - - if( line[0] == '$' ) - { - newfmt = 1; - - if( !aLine->ReadLine() ) - return TRUE; - } - - if( sscanf( &line[1], "%s %s", Name1, Name2 ) != 2 ) - { - aMsgDiag.Printf( - wxT( "EESchema Component descr error at line %d, aborted" ), - aLine->LineNumber() ); - aMsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); - Failed = TRUE; - return Failed; - } - - if( strcmp( Name1, NULL_STRING ) != 0 ) - { - for( ii = 0; ii < (int) strlen( Name1 ); ii++ ) - if( Name1[ii] == '~' ) - Name1[ii] = ' '; - - component->m_ChipName = CONV_FROM_UTF8( Name1 ); - if( !newfmt ) - component->GetField( VALUE )->m_Text = CONV_FROM_UTF8( Name1 ); - } - else - { - component->m_ChipName.Empty(); - component->GetField( VALUE )->m_Text.Empty(); - component->GetField( VALUE )->m_Orient = TEXT_ORIENT_HORIZ; - component->GetField( VALUE )->m_Attributs = TEXT_NO_VISIBLE; - } - - if( strcmp( Name2, NULL_STRING ) != 0 ) - { - bool isDigit = false; - for( ii = 0; ii < (int) strlen( Name2 ); ii++ ) - { - if( Name2[ii] == '~' ) - Name2[ii] = ' '; - - // get RefBase from this, too. store in Name1. - if( Name2[ii] >= '0' && Name2[ii] <= '9' ) - { - isDigit = true; - Name1[ii] = 0; //null-terminate. - } - if( !isDigit ) - { - Name1[ii] = Name2[ii]; - } - } - - Name1[ii] = 0; //just in case - int jj; - for( jj = 0; jjm_PrefixString = wxT( "U" ); - } - else - { - component->m_PrefixString = CONV_FROM_UTF8( &Name1[jj] ); - - //printf("prefix: %s\n", CONV_TO_UTF8(component->m_PrefixString)); - } - if( !newfmt ) - component->GetField( REFERENCE )->m_Text = CONV_FROM_UTF8( Name2 ); - } - else - { - component->GetField( REFERENCE )->m_Attributs = TEXT_NO_VISIBLE; - } - - /* Parse component description - * These lines begin with: - * "P" = Position - * U = Num Unit and Conversion - * "Fn" = Fields (0 .. n = = number of field) - * "Ar" = Alternate reference in the case of multiple sheets referring to - * one schematic file. - */ - for( ; ; ) - { - if( !aLine->ReadLine() ) - return TRUE; - - if( line[0] == 'U' ) - { - sscanf( line + 1, "%d %d %lX", - &component->m_Multi, &component->m_Convert, - &component->m_TimeStamp ); - } - else if( line[0] == 'P' ) - { - sscanf( line + 1, "%d %d", - &component->m_Pos.x, &component->m_Pos.y ); - - // Set fields position to a default position (that is the - // component position. For existing fields, the real position - // will be set later - for( int i = 0; iGetFieldCount(); ++i ) - { - if( component->GetField( i )->m_Text.IsEmpty() ) - component->GetField( i )->m_Pos = component->m_Pos; - } - } - else if( line[0] == 'A' && line[1] == 'R' ) - { - /* format: - * AR Path="/9086AF6E/67452AA0" Ref="C99" Part="1" - * where 9086AF6E is the unique timestamp of the containing sheet - * and 67452AA0 is the timestamp of this component. - * C99 is the reference given this path. - */ - int ii; - ptcar = line + 2; - - //copy the path. - ii = ReadDelimitedText( Name1, ptcar, 255 ); - ptcar += ii + 1; - wxString path = CONV_FROM_UTF8( Name1 ); - - // copy the reference - ii = ReadDelimitedText( Name1, ptcar, 255 ); - ptcar += ii + 1; - wxString ref = CONV_FROM_UTF8( Name1 ); - - // copy the multi, if exists - ii = ReadDelimitedText( Name1, ptcar, 255 ); - if( Name1[0] == 0 ) // Nothing read, put a default value - sprintf( Name1, "%d", component->m_Multi ); - int multi = atoi( Name1 ); - if( multi < 0 || multi > 25 ) - multi = 1; - component->AddHierarchicalReference( path, ref, multi ); - component->GetField( REFERENCE )->m_Text = ref; - } - else if( line[0] == 'F' ) - { - int fieldNdx; - - char FieldUserName[1024]; - GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER; - GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER; - - FieldUserName[0] = 0; - - ptcar = line; - - while( *ptcar && (*ptcar != '"') ) - ptcar++; - - if( *ptcar != '"' ) - { - aMsgDiag.Printf( - wxT( "EESchema file lib field F at line %d, aborted" ), - aLine->LineNumber() ); - return TRUE; - } - - for( ptcar++, ii = 0; ; ii++, ptcar++ ) - { - Name1[ii] = *ptcar; - if( *ptcar == 0 ) - { - aMsgDiag.Printf( - wxT( "Component field F at line %d, aborted" ), - aLine->LineNumber() ); - return TRUE; - } - - if( *ptcar == '"' ) - { - Name1[ii] = 0; - ptcar++; - break; - } - } - - fieldNdx = atoi( line + 2 ); - - ReadDelimitedText( FieldUserName, ptcar, sizeof(FieldUserName) ); - - if( !FieldUserName[0] ) - fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ); - else - fieldName = CONV_FROM_UTF8( FieldUserName ); - - if( fieldNdx >= component->GetFieldCount() ) - { - // The first MANDATOR_FIELDS _must_ be constructed within - // the SCH_COMPONENT constructor. This assert is simply here - // to guard against a change in that constructor. - wxASSERT( component->GetFieldCount() >= MANDATORY_FIELDS ); - - // Ignore the _supplied_ fieldNdx. It is not important anymore - // if within the user defined fields region (i.e. >= MANDATORY_FIELDS). - // We freely renumber the index to fit the next available field slot. - - fieldNdx = component->GetFieldCount(); // new has this index after insertion - - SCH_FIELD field( wxPoint( 0, 0 ), - -1, // field id is not relavant for user defined fields - component, fieldName ); - - component->AddField( field ); - } - else - { - component->GetField( fieldNdx )->m_Name = fieldName; - } - - component->GetField( fieldNdx )->m_Text = CONV_FROM_UTF8( Name1 ); - memset( Char3, 0, sizeof(Char3) ); - if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1, - &component->GetField( fieldNdx )->m_Pos.x, - &component->GetField( fieldNdx )->m_Pos.y, - &component->GetField( fieldNdx )->m_Size.x, - &component->GetField( fieldNdx )->m_Attributs, - Char2, Char3 ) ) < 4 ) - { - aMsgDiag.Printf( - wxT( "Component Field error line %d, aborted" ), - aLine->LineNumber() ); - continue; - } - - if( (component->GetField( fieldNdx )->m_Size.x == 0 ) || (ii == 4) ) - component->GetField( fieldNdx )->m_Size.x = DEFAULT_SIZE_TEXT; - - component->GetField( fieldNdx )->m_Orient = TEXT_ORIENT_HORIZ; - component->GetField( fieldNdx )->m_Size.y = - component->GetField( fieldNdx )->m_Size.x; - - if( Char1[0] == 'V' ) - component->GetField( fieldNdx )->m_Orient = TEXT_ORIENT_VERT; - - if( ii >= 7 ) - { - if( *Char2 == 'L' ) - hjustify = GR_TEXT_HJUSTIFY_LEFT; - else if( *Char2 == 'R' ) - hjustify = GR_TEXT_HJUSTIFY_RIGHT; - if( Char3[0] == 'B' ) - vjustify = GR_TEXT_VJUSTIFY_BOTTOM; - else if( Char3[0] == 'T' ) - vjustify = GR_TEXT_VJUSTIFY_TOP; - if( Char3[1] == 'I' ) - component->GetField( fieldNdx )->m_Italic = true; - else - component->GetField( fieldNdx )->m_Italic = false; - if( Char3[2] == 'B' ) - component->GetField( fieldNdx )->m_Bold = true; - else - component->GetField( fieldNdx )->m_Bold = false; - - component->GetField( fieldNdx )->m_HJustify = hjustify; - component->GetField( fieldNdx )->m_VJustify = vjustify; - } - - if( fieldNdx == REFERENCE ) - if( component->GetField( fieldNdx )->m_Text[0] == '#' ) - component->GetField( fieldNdx )->m_Attributs |= - TEXT_NO_VISIBLE; - } - else - break; - } - - if( sscanf( line, "%d %d %d", &component->m_Multi, - &component->m_Pos.x, &component->m_Pos.y ) != 3 ) - { - aMsgDiag.Printf( - wxT( "Component unit & pos error at line %d, aborted" ), - aLine->LineNumber() ); - Failed = TRUE; - return Failed; - } - - if( !aLine->ReadLine() || - sscanf( line, "%d %d %d %d", - &component->m_Transform.x1, - &component->m_Transform.y1, - &component->m_Transform.x2, - &component->m_Transform.y2 ) != 4 ) - { - aMsgDiag.Printf( wxT( "Component orient error at line %d, aborted" ), aLine->LineNumber() ); - Failed = TRUE; - return Failed; - } - - if( newfmt ) - { - if( !aLine->ReadLine() ) - return TRUE; - - if( strnicmp( "$End", line, 4 ) != 0 ) - { - aMsgDiag.Printf( - wxT( "Component End expected at line %d, aborted" ), - aLine->LineNumber() ); - Failed = TRUE; - } - } - - if( !Failed ) - { - component->SetNext( Window->EEDrawList ); - Window->EEDrawList = component; - component->SetParent( Window ); - } - - return Failed; -} diff --git a/eeschema/class_sch_component.cpp b/eeschema/sch_component.cpp similarity index 79% rename from eeschema/class_sch_component.cpp rename to eeschema/sch_component.cpp index de22999356..908138e750 100644 --- a/eeschema/class_sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1,6 +1,6 @@ -/**************************************************************/ -/* class_sch_component.cpp : handle the class SCH_COMPONENT */ -/**************************************************************/ +/*******************************************************/ +/* sch_component.cpp : handle the class SCH_COMPONENT */ +/*******************************************************/ #include "fctsys.h" #include "appl_wxstruct.h" @@ -8,16 +8,23 @@ #include "gr_basic.h" #include "common.h" #include "trigo.h" +#include "kicad_string.h" +#include "richio.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "macros.h" #include "protos.h" #include "class_library.h" -#include "dialogs/dialog_schematic_find.h" #include "lib_rectangle.h" #include "lib_pin.h" #include "lib_text.h" +#include "sch_component.h" +#include "sch_sheet.h" +#include "sch_sheet_path.h" +#include "template_fieldnames.h" + +#include "dialogs/dialog_schematic_find.h" #include @@ -1092,6 +1099,320 @@ bool SCH_COMPONENT::Save( FILE* f ) const } +bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) +{ + int ii; + char Name1[256], Name2[256], + Char1[256], Char2[256], Char3[256]; + int newfmt = 0; + char* ptcar; + wxString fieldName; + + m_Convert = 1; + + if( ((char*)aLine)[0] == '$' ) + { + newfmt = 1; + + if( !aLine.ReadLine() ) + return TRUE; + } + + if( sscanf( &((char*)aLine)[1], "%s %s", Name1, Name2 ) != 2 ) + { + aErrorMsg.Printf( wxT( "EESchema Component descr error at line %d, aborted" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( ((char*)aLine) ); + return false; + } + + if( strcmp( Name1, NULL_STRING ) != 0 ) + { + for( ii = 0; ii < (int) strlen( Name1 ); ii++ ) + if( Name1[ii] == '~' ) + Name1[ii] = ' '; + + m_ChipName = CONV_FROM_UTF8( Name1 ); + if( !newfmt ) + GetField( VALUE )->m_Text = CONV_FROM_UTF8( Name1 ); + } + else + { + m_ChipName.Empty(); + GetField( VALUE )->m_Text.Empty(); + GetField( VALUE )->m_Orient = TEXT_ORIENT_HORIZ; + GetField( VALUE )->m_Attributs = TEXT_NO_VISIBLE; + } + + if( strcmp( Name2, NULL_STRING ) != 0 ) + { + bool isDigit = false; + for( ii = 0; ii < (int) strlen( Name2 ); ii++ ) + { + if( Name2[ii] == '~' ) + Name2[ii] = ' '; + + // get RefBase from this, too. store in Name1. + if( Name2[ii] >= '0' && Name2[ii] <= '9' ) + { + isDigit = true; + Name1[ii] = 0; //null-terminate. + } + if( !isDigit ) + { + Name1[ii] = Name2[ii]; + } + } + + Name1[ii] = 0; //just in case + int jj; + for( jj = 0; jjm_PrefixString)); + } + + if( !newfmt ) + GetField( REFERENCE )->m_Text = CONV_FROM_UTF8( Name2 ); + } + else + { + GetField( REFERENCE )->m_Attributs = TEXT_NO_VISIBLE; + } + + /* Parse component description + * These lines begin with: + * "P" = Position + * U = Num Unit and Conversion + * "Fn" = Fields (0 .. n = = number of field) + * "Ar" = Alternate reference in the case of multiple sheets referring to + * one schematic file. + */ + for( ; ; ) + { + if( !aLine.ReadLine() ) + return false; + + if( ((char*)aLine)[0] == 'U' ) + { + sscanf( ((char*)aLine) + 1, "%d %d %lX", &m_Multi, &m_Convert, &m_TimeStamp ); + } + else if( ((char*)aLine)[0] == 'P' ) + { + sscanf( ((char*)aLine) + 1, "%d %d", &m_Pos.x, &m_Pos.y ); + + // Set fields position to a default position (that is the + // component position. For existing fields, the real position + // will be set later + for( int i = 0; im_Text.IsEmpty() ) + GetField( i )->m_Pos = m_Pos; + } + } + else if( ((char*)aLine)[0] == 'A' && ((char*)aLine)[1] == 'R' ) + { + /* format: + * AR Path="/9086AF6E/67452AA0" Ref="C99" Part="1" + * where 9086AF6E is the unique timestamp of the containing sheet + * and 67452AA0 is the timestamp of this component. + * C99 is the reference given this path. + */ + int ii; + ptcar = ((char*)aLine) + 2; + + //copy the path. + ii = ReadDelimitedText( Name1, ptcar, 255 ); + ptcar += ii + 1; + wxString path = CONV_FROM_UTF8( Name1 ); + + // copy the reference + ii = ReadDelimitedText( Name1, ptcar, 255 ); + ptcar += ii + 1; + wxString ref = CONV_FROM_UTF8( Name1 ); + + // copy the multi, if exists + ii = ReadDelimitedText( Name1, ptcar, 255 ); + if( Name1[0] == 0 ) // Nothing read, put a default value + sprintf( Name1, "%d", m_Multi ); + int multi = atoi( Name1 ); + if( multi < 0 || multi > 25 ) + multi = 1; + AddHierarchicalReference( path, ref, multi ); + GetField( REFERENCE )->m_Text = ref; + } + else if( ((char*)aLine)[0] == 'F' ) + { + int fieldNdx; + + char FieldUserName[1024]; + GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER; + GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER; + + FieldUserName[0] = 0; + + ptcar = (char*) aLine; + + while( *ptcar && (*ptcar != '"') ) + ptcar++; + + if( *ptcar != '"' ) + { + aErrorMsg.Printf( wxT( "EESchema file lib field F at line %d, aborted" ), + aLine.LineNumber() ); + return false; + } + + for( ptcar++, ii = 0; ; ii++, ptcar++ ) + { + Name1[ii] = *ptcar; + if( *ptcar == 0 ) + { + aErrorMsg.Printf( wxT( "Component field F at line %d, aborted" ), + aLine.LineNumber() ); + return false; + } + + if( *ptcar == '"' ) + { + Name1[ii] = 0; + ptcar++; + break; + } + } + + fieldNdx = atoi( ((char*)aLine) + 2 ); + + ReadDelimitedText( FieldUserName, ptcar, sizeof(FieldUserName) ); + + if( !FieldUserName[0] ) + fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ); + else + fieldName = CONV_FROM_UTF8( FieldUserName ); + + if( fieldNdx >= GetFieldCount() ) + { + // The first MANDATOR_FIELDS _must_ be constructed within + // the SCH_COMPONENT constructor. This assert is simply here + // to guard against a change in that constructor. + wxASSERT( GetFieldCount() >= MANDATORY_FIELDS ); + + // Ignore the _supplied_ fieldNdx. It is not important anymore + // if within the user defined fields region (i.e. >= MANDATORY_FIELDS). + // We freely renumber the index to fit the next available field slot. + + fieldNdx = GetFieldCount(); // new has this index after insertion + + SCH_FIELD field( wxPoint( 0, 0 ), + -1, // field id is not relavant for user defined fields + this, fieldName ); + + AddField( field ); + } + else + { + GetField( fieldNdx )->m_Name = fieldName; + } + + GetField( fieldNdx )->m_Text = CONV_FROM_UTF8( Name1 ); + memset( Char3, 0, sizeof(Char3) ); + if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1, + &GetField( fieldNdx )->m_Pos.x, + &GetField( fieldNdx )->m_Pos.y, + &GetField( fieldNdx )->m_Size.x, + &GetField( fieldNdx )->m_Attributs, + Char2, Char3 ) ) < 4 ) + { + aErrorMsg.Printf( wxT( "Component Field error line %d, aborted" ), + aLine.LineNumber() ); + continue; + } + + if( (GetField( fieldNdx )->m_Size.x == 0 ) || (ii == 4) ) + GetField( fieldNdx )->m_Size.x = DEFAULT_SIZE_TEXT; + + GetField( fieldNdx )->m_Orient = TEXT_ORIENT_HORIZ; + GetField( fieldNdx )->m_Size.y = GetField( fieldNdx )->m_Size.x; + + if( Char1[0] == 'V' ) + GetField( fieldNdx )->m_Orient = TEXT_ORIENT_VERT; + + if( ii >= 7 ) + { + if( *Char2 == 'L' ) + hjustify = GR_TEXT_HJUSTIFY_LEFT; + else if( *Char2 == 'R' ) + hjustify = GR_TEXT_HJUSTIFY_RIGHT; + if( Char3[0] == 'B' ) + vjustify = GR_TEXT_VJUSTIFY_BOTTOM; + else if( Char3[0] == 'T' ) + vjustify = GR_TEXT_VJUSTIFY_TOP; + if( Char3[1] == 'I' ) + GetField( fieldNdx )->m_Italic = true; + else + GetField( fieldNdx )->m_Italic = false; + if( Char3[2] == 'B' ) + GetField( fieldNdx )->m_Bold = true; + else + GetField( fieldNdx )->m_Bold = false; + + GetField( fieldNdx )->m_HJustify = hjustify; + GetField( fieldNdx )->m_VJustify = vjustify; + } + + if( fieldNdx == REFERENCE ) + if( GetField( fieldNdx )->m_Text[0] == '#' ) + GetField( fieldNdx )->m_Attributs |= TEXT_NO_VISIBLE; + } + else + break; + } + + if( sscanf( ((char*)aLine), "%d %d %d", &m_Multi, &m_Pos.x, &m_Pos.y ) != 3 ) + { + aErrorMsg.Printf( wxT( "Component unit & pos error at line %d, aborted" ), + aLine.LineNumber() ); + return false; + } + + if( !aLine.ReadLine() || + sscanf( ((char*)aLine), "%d %d %d %d", + &m_Transform.x1, + &m_Transform.y1, + &m_Transform.x2, + &m_Transform.y2 ) != 4 ) + { + aErrorMsg.Printf( wxT( "Component orient error at line %d, aborted" ), + aLine.LineNumber() ); + return false; + } + + if( newfmt ) + { + if( !aLine.ReadLine() ) + return false; + + if( strnicmp( "$End", ((char*)aLine), 4 ) != 0 ) + { + aErrorMsg.Printf( wxT( "Component End expected at line %d, aborted" ), + aLine.LineNumber() ); + return false; + } + } + + return true; +} + + /** * Function GetBoundingBox * returns the orthogonal, bounding box of this object for display purposes. diff --git a/eeschema/class_sch_component.h b/eeschema/sch_component.h similarity index 95% rename from eeschema/class_sch_component.h rename to eeschema/sch_component.h index ca6b1980d3..272b026bc6 100644 --- a/eeschema/class_sch_component.h +++ b/eeschema/sch_component.h @@ -6,12 +6,14 @@ #define COMPONENT_CLASS_H -#include "class_sch_screen.h" -#include "class_sch_cmp_field.h" +#include "sch_field.h" #include "transform.h" +#include "general.h" class SCH_SHEET_PATH; +class LIB_PIN; +class LIB_COMPONENT; /** @@ -132,6 +134,14 @@ public: */ bool Save( FILE* aFile ) const; + /** + * Load schematic component from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read the component from. + * @param aErrorMsg - Description of the error if an error occurs while loading the component. + * @return True if the component loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); /** * Function Load @@ -157,7 +167,8 @@ public: void SetOrientation( int aOrientation ); - /** function GetOrientation() + /** + * Function GetOrientation() * Used to display component orientation (in dialog editor or info) * @return the orientation and mirror * Note: Because there are different ways to have a given orientation/mirror, @@ -182,7 +193,8 @@ public: */ void ClearAnnotation( SCH_SHEET_PATH* aSheet ); - /** function SetTimeStamp + /** + * Function SetTimeStamp * Change the old time stamp to the new time stamp. * the time stamp is also modified in paths * @param aNewTimeStamp = new time stamp @@ -314,7 +326,8 @@ public: // Set the unit selection, for the given sheet path. void SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection ); - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item * for a component, has no meaning, but it is necessary to satisfy the * SCH_ITEM class requirements. diff --git a/eeschema/class_sch_cmp_field.cpp b/eeschema/sch_field.cpp similarity index 97% rename from eeschema/class_sch_cmp_field.cpp rename to eeschema/sch_field.cpp index d4a7942ca8..29bfd03f68 100644 --- a/eeschema/class_sch_cmp_field.cpp +++ b/eeschema/sch_field.cpp @@ -1,6 +1,6 @@ -/**************************************************************/ -/* class_sch_cmp_field.cpp : handle the class SCH_FIELD */ -/**************************************************************/ +/***********************************************/ +/* sch_field.cpp : handle the class SCH_FIELD */ +/***********************************************/ /* Fields are texts attached to a component, having a special meaning * Fields 0 and 1 are very important: reference and value @@ -18,11 +18,15 @@ #include "drawtxt.h" #include "macros.h" #include "trigo.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" +#include "sch_component.h" +#include "sch_field.h" +#include "template_fieldnames.h" SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, diff --git a/eeschema/class_sch_cmp_field.h b/eeschema/sch_field.h similarity index 96% rename from eeschema/class_sch_cmp_field.h rename to eeschema/sch_field.h index bccc8ee23f..6a9407119e 100644 --- a/eeschema/class_sch_cmp_field.h +++ b/eeschema/sch_field.h @@ -14,6 +14,12 @@ */ +#include "sch_item_struct.h" + +#include "general.h" + + +class WinEDA_SchematicFrame; class SCH_COMPONENT; class LIB_FIELD; @@ -66,19 +72,22 @@ public: void SwapData( SCH_FIELD* copyitem ); - /** Function ImportValues + /** + * Function ImportValues * copy parameters from a source. * Pointers and specific values (position) are not copied * @param aSource = the LIB_FIELD to read */ void ImportValues( const LIB_FIELD& aSource ); - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ int GetPenSize(); - /** Function IsVisible + /** + * Function IsVisible * @return true is this field is visible, false if flagged invisible */ bool IsVisible() diff --git a/eeschema/class_schematic_items.cpp b/eeschema/sch_items.cpp similarity index 84% rename from eeschema/class_schematic_items.cpp rename to eeschema/sch_items.cpp index 289fa14647..6c90c6a166 100644 --- a/eeschema/class_schematic_items.cpp +++ b/eeschema/sch_items.cpp @@ -4,12 +4,18 @@ #include "fctsys.h" #include "gr_basic.h" +#include "macros.h" #include "class_drawpanel.h" #include "trigo.h" #include "common.h" -#include "program.h" +#include "richio.h" + #include "general.h" #include "protos.h" +#include "sch_items.h" + +#include + /* used to calculate the pen size from default value * the actual pen size is default value * BUS_WIDTH_EXPAND @@ -94,6 +100,44 @@ bool SCH_BUS_ENTRY::Save( FILE* aFile ) const } +bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg ) +{ + char Name1[256]; + char Name2[256]; + char* line = (char*) aLine; + + while( (*line != ' ' ) && *line ) + line++; + + if( sscanf( line, "%s %s", Name1, Name2 ) != 2 ) + { + aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + m_Layer = LAYER_WIRE; + + if( Name1[0] == 'B' ) + m_Layer = LAYER_BUS; + + if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", &m_Pos.x, &m_Pos.y, + &m_Size.x, &m_Size.y ) != 4 ) + { + aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + m_Size.x -= m_Pos.x; + m_Size.y -= m_Pos.y; + + return true; +} + + EDA_Rect SCH_BUS_ENTRY::GetBoundingBox() { EDA_Rect box; @@ -246,6 +290,26 @@ bool SCH_JUNCTION::Save( FILE* aFile ) const } +bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg ) +{ + char name[256]; + char* line = (char*) aLine; + + while( (*line != ' ' ) && *line ) + line++; + + if( sscanf( line, "%s %d %d", name, &m_Pos.x, &m_Pos.y ) != 3 ) + { + aErrorMsg.Printf( wxT( "EESchema file connection load error at line %d, aborted" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + return true; +} + + EDA_Rect SCH_JUNCTION::GetBoundingBox() { EDA_Rect rect; @@ -435,6 +499,26 @@ bool SCH_NO_CONNECT::Save( FILE* aFile ) const } +bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg ) +{ + char name[256]; + char* line = (char*) aLine; + + while( (*line != ' ' ) && *line ) + line++; + + if( sscanf( line, "%s %d %d", name, &m_Pos.x, &m_Pos.y ) != 3 ) + { + aErrorMsg.Printf( wxT( "EESchema file No Connect load error at line %d" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( ((char*)aLine) ); + return false; + } + + return true; +} + + /** Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ @@ -631,6 +715,43 @@ bool SCH_LINE::Save( FILE* aFile ) const } +bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg ) +{ + char Name1[256]; + char Name2[256]; + char* line = (char*) aLine; + + while( (*line != ' ' ) && *line ) + line++; + + if( sscanf( line, "%s %s", Name1, Name2 ) != 2 ) + { + aErrorMsg.Printf( wxT( "EESchema file segment error at line %d, aborted" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + m_Layer = LAYER_NOTES; + + if( Name1[0] == 'W' ) + m_Layer = LAYER_WIRE; + if( Name1[0] == 'B' ) + m_Layer = LAYER_BUS; + + if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", + &m_Start.x, &m_Start.y, &m_End.x, &m_End.y ) != 4 ) + { + aErrorMsg.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + return true; +} + + /** Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ @@ -917,6 +1038,50 @@ bool SCH_POLYLINE::Save( FILE* aFile ) const } +bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg ) +{ + char Name1[256]; + char Name2[256]; + wxPoint pt; + int ii; + char* line = (char*) aLine; + + while( (*line != ' ' ) && *line ) + line++; + + if( sscanf( line, "%s %s %d", Name1, Name2, &ii ) != 3 ) + { + aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + m_Layer = LAYER_NOTES; + if( Name2[0] == 'W' ) + m_Layer = LAYER_WIRE; + if( Name2[0] == 'B' ) + m_Layer = LAYER_BUS; + + for( unsigned jj = 0; jj < (unsigned)ii; jj++ ) + { + wxPoint point; + + if( !aLine.ReadLine() || sscanf( ((char*) aLine), "%d %d", &pt.x, &pt.y ) != 2 ) + { + aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ), + aLine.LineNumber() ); + aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + AddPoint( pt ); + } + + return true; +} + + /** Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ diff --git a/eeschema/class_schematic_items.h b/eeschema/sch_items.h similarity index 80% rename from eeschema/class_schematic_items.h rename to eeschema/sch_items.h index 62d4be162e..fbfe4a2c28 100644 --- a/eeschema/class_schematic_items.h +++ b/eeschema/sch_items.h @@ -5,6 +5,12 @@ #ifndef CLASS_SCHEMATIC_ITEMS_H #define CLASS_SCHEMATIC_ITEMS_H + +#include "sch_item_struct.h" + +#include "general.h" + + /* Flags for BUS ENTRY (bus to bus or wire to bus */ #define WIRE_TO_BUS 0 #define BUS_TO_BUS 1 @@ -26,7 +32,7 @@ public: bool m_EndIsDangling; // TRUE if not connected (wires, tracks...) public: - SCH_LINE( const wxPoint& pos, int layer ); + SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES ); ~SCH_LINE() { } SCH_LINE* Next() const { return (SCH_LINE*) Pnext; } @@ -68,7 +74,18 @@ public: */ bool Save( FILE* aFile ) const; - /** Function GetPenSize + /** + * Load schematic line from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic line from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic line. + * @return True if the schematic line loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize(); @@ -132,7 +149,7 @@ public: wxSize m_Size; // size of this symbol public: - SCH_NO_CONNECT( const wxPoint& pos ); + SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) ); ~SCH_NO_CONNECT() { } virtual wxString GetClass() const { @@ -142,7 +159,8 @@ public: SCH_NO_CONNECT* GenCopy(); - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize(); @@ -160,7 +178,18 @@ public: */ bool Save( FILE* aFile ) const; - /** Function HitTest + /** + * Load schematic no connect entry from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic no connect from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic no connect. + * @return True if the schematic no connect loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + + /** + * Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test */ @@ -215,7 +244,7 @@ public: wxSize m_Size; public: - SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ); + SCH_BUS_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), int shape = '\\', int id = WIRE_TO_BUS ); ~SCH_BUS_ENTRY() { } virtual wxString GetClass() const @@ -239,6 +268,16 @@ public: */ bool Save( FILE* aFile ) const; + /** + * Load schematic bus entry from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic bus entry from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic bus entry. + * @return True if the schematic bus entry loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + /** * Function GetBoundingBox * returns the orthogonal, bounding box of this object for display @@ -249,7 +288,8 @@ public: */ EDA_Rect GetBoundingBox(); - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize(); @@ -288,7 +328,7 @@ public: std::vector m_PolyPoints; // list of points (>= 2) public: - SCH_POLYLINE( int layer ); + SCH_POLYLINE( int layer = LAYER_NOTES ); ~SCH_POLYLINE(); virtual wxString GetClass() const @@ -311,7 +351,18 @@ public: */ bool Save( FILE* aFile ) const; - /** Function AddPoint + /** + * Load schematic poly line entry from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic poly line from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic poly line. + * @return True if the schematic poly line loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + + /** + * Function AddPoint * add a corner to m_PolyPoints */ void AddPoint( const wxPoint& point ) @@ -320,13 +371,15 @@ public: } - /** Function GetCornerCount + /** + * Function GetCornerCount * @return the number of corners */ unsigned GetCornerCount() const { return m_PolyPoints.size(); } - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize(); @@ -361,7 +414,7 @@ public: wxSize m_Size; public: - SCH_JUNCTION( const wxPoint& pos ); + SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) ); ~SCH_JUNCTION() { } virtual wxString GetClass() const @@ -370,7 +423,8 @@ public: } - /** Function HitTest + /** + * Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test */ @@ -388,7 +442,8 @@ public: SCH_JUNCTION* GenCopy(); - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize(); @@ -405,6 +460,16 @@ public: */ bool Save( FILE* aFile ) const; + /** + * Load schematic junction entry from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic junction from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic junction. + * @return True if the schematic junction loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + // Geometric transforms (used in block operations): /** virtual function Move diff --git a/eeschema/class_marker_sch.cpp b/eeschema/sch_marker.cpp similarity index 96% rename from eeschema/class_marker_sch.cpp rename to eeschema/sch_marker.cpp index 4ef1ef7320..26d219ebde 100644 --- a/eeschema/class_marker_sch.cpp +++ b/eeschema/sch_marker.cpp @@ -3,16 +3,16 @@ /*******************************************/ #include "fctsys.h" +#include "wxstruct.h" #include "class_drawpanel.h" - #include "common.h" -#include "program.h" -#include "general.h" #include "trigo.h" -#include "class_marker_sch.h" +#include "general.h" +#include "sch_marker.h" #include "erc.h" + /* Marker are mainly used to show an ERC error * but they could be used to give a specific info */ @@ -51,8 +51,7 @@ SCH_MARKER::~SCH_MARKER() SCH_MARKER* SCH_MARKER::GenCopy() { - SCH_MARKER* newitem = new SCH_MARKER( GetPos(), - GetReporter().GetMainText() ); + SCH_MARKER* newitem = new SCH_MARKER( GetPos(), GetReporter().GetMainText() ); newitem->SetMarkerType( GetMarkerType() ); newitem->SetErrorLevel( GetErrorLevel() ); diff --git a/eeschema/class_marker_sch.h b/eeschema/sch_marker.h similarity index 98% rename from eeschema/class_marker_sch.h rename to eeschema/sch_marker.h index 66a840b604..5e10539512 100644 --- a/eeschema/class_marker_sch.h +++ b/eeschema/sch_marker.h @@ -53,14 +53,16 @@ public: */ bool Save( FILE* aFile ) const; - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item * for a marker, has no meaning, but it is necessary to satisfy the * SCH_ITEM class requirements */ virtual int GetPenSize() { return 0; }; - /** Function HitTest + /** + * Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test */ diff --git a/eeschema/class_sch_screen.cpp b/eeschema/sch_screen.cpp similarity index 98% rename from eeschema/class_sch_screen.cpp rename to eeschema/sch_screen.cpp index 4842158f7e..f29639d548 100644 --- a/eeschema/class_sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -6,11 +6,17 @@ #include "eeschema_id.h" #include "appl_wxstruct.h" #include "class_drawpanel.h" +#include "sch_item_struct.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" +#include "sch_items.h" +#include "sch_sheet.h" + +#include void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) diff --git a/eeschema/class_drawsheet.cpp b/eeschema/sch_sheet.cpp similarity index 84% rename from eeschema/class_drawsheet.cpp rename to eeschema/sch_sheet.cpp index 1f0cded178..a388c93191 100644 --- a/eeschema/class_drawsheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: class_drawsheet.cpp +// Name: sch_sheet.cpp // Purpose: member functions for SCH_SHEET -// header = class_drawsheet.h +// header = sch_sheet.h // Author: jean-pierre Charras // Modified by: // Created: 08/02/2006 18:37:02 @@ -13,18 +13,23 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "drawtxt.h" #include "confirm.h" #include "trigo.h" +#include "richio.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_sheet.h" +#include "sch_sheet_path.h" +#include "sch_component.h" -SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : - SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE ) +SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE ) { m_Layer = LAYER_SHEET; m_Pos = pos; @@ -96,6 +101,152 @@ bool SCH_SHEET::Save( FILE* aFile ) const } +bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) +{ + int ii, fieldNdx, size; + char Name1[256]; + SCH_SHEET_PIN* SheetLabel; + char* ptcar; + + m_TimeStamp = GetTimeStamp(); + + // sheets are added to the EEDrawList 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 Errror" ) ); + 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 struct error at line %d, aborted\n" ), + aLine.LineNumber() ); + + aErrorMsg << CONV_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! + m_TimeStamp = GetTimeStamp(); + 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 << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + for( ptcar++, ii = 0; ; ii++, ptcar++ ) + { + Name1[ii] = *ptcar; + + if( *ptcar == 0 ) + { + aErrorMsg.Printf( wxT( "EESchema file sheet field F at line %d, aborted\n" ), + aLine.LineNumber() ); + aErrorMsg << CONV_FROM_UTF8( (char*) aLine ); + return false; + } + + if( *ptcar == '"' ) + { + Name1[ii] = 0; + ptcar++; + break; + } + } + + 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 << CONV_FROM_UTF8( (char*) aLine ); + } + if( size == 0 ) + size = DEFAULT_SIZE_TEXT; + + if( fieldNdx == 0 ) + { + m_SheetName = CONV_FROM_UTF8( Name1 ); + m_SheetNameSize = size; + } + else + { + SetFileName( CONV_FROM_UTF8( Name1 ) ); + + //printf( "in ReadSheetDescr : m_FileName = %s \n", Name1 ); + m_FileNameSize = size; + } + } + + if( fieldNdx > 1 ) + { + SheetLabel = new SCH_SHEET_PIN( this ); + + if( !SheetLabel->Load( aLine, aErrorMsg ) ) + { + delete SheetLabel; + SheetLabel = NULL; + return false; + } + + AddLabel( SheetLabel ); + } + } + + if( strnicmp( "$End", ((char*)aLine), 4 ) != 0 ) + { + aErrorMsg.Printf( wxT( "**EESchema file end_sheet struct error at line %d, aborted\n" ), + aLine.LineNumber() ); + aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) ); + return false; + } + + return true; +} + + /* creates a copy of a sheet * The linked data itself (EEDrawList) is not duplicated */ diff --git a/eeschema/class_drawsheet.h b/eeschema/sch_sheet.h similarity index 90% rename from eeschema/class_drawsheet.h rename to eeschema/sch_sheet.h index 03ddac4d1b..7e00c4c68b 100644 --- a/eeschema/class_drawsheet.h +++ b/eeschema/sch_sheet.h @@ -5,12 +5,19 @@ #ifndef CLASS_DRAWSHEET_H #define CLASS_DRAWSHEET_H -#include "base_struct.h" #include #include -#include "class_text-label.h" +#include "sch_text.h" + + +class LINE_READER; +class SCH_SCREEN; +class SCH_SHEET; +class SCH_SHEET_PIN; +class SCH_SHEET_PATH; +class DANGLING_END_ITEM; +class WinEDA_SchematicFrame; -extern SCH_SHEET* g_RootSheet; /** * Pin (label) used in sheets to create hierarchical schematics. @@ -63,7 +70,8 @@ public: int aDraw_mode, int aColor = -1 ); - /** function CreateGraphicShape (virual) + /** + * Function CreateGraphicShape (virual) * Calculates the graphic shape (a polygon) associated to the text * @param aCorner_list = a buffer to fill with polygon corners coordinates * @param Pos = Position of the shape @@ -117,6 +125,16 @@ public: */ bool Save( FILE* aFile ) const; + /** + * Load schematic sheet hierarchical lable from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read the sheet hierarchical label from. + * @param aErrorMsg - Description of the error if an error occurs while loading the sheet + * hierarchical label. + * @return True if the sheet heirarchical label loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + #if defined(DEBUG) // comment inherited by Doxygen from Base_Struct @@ -124,12 +142,14 @@ public: #endif - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize(); - /** function CreateGraphicShape + /** + * Function CreateGraphicShape * Calculates the graphic shape (a polygon) associated to the text * @param aCorner_list = list to fill with polygon corners coordinates * @param Pos = Position of the shape @@ -157,7 +177,8 @@ public: virtual void Mirror_X( int aXaxis_position ); - /** function Matches + /** + * Function Matches * Compare hierarchical pin name against search string. * * @param aSearchData - Criteria to search against. @@ -169,7 +190,7 @@ public: */ virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); - virtual void GetEndPoints( std::vector & aItemList ); + virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ); }; @@ -229,6 +250,15 @@ public: */ bool Save( FILE* aFile ) const; + /** + * Load schematic sheet from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read the component from. + * @param aErrorMsg - Description of the error if an error occurs while loading the sheet. + * @return True if the sheet loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); SCH_SHEET* GenCopy(); void DisplayInfo( WinEDA_DrawFrame* frame ); @@ -298,12 +328,14 @@ public: */ bool HasUndefinedLabels(); - /** Function GetPenSize + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize(); - /** Function Draw + /** + * Function Draw * Draw the hierarchical sheet shape * @param aPanel = the current DrawPanel * @param aDc = the current Device Context @@ -318,26 +350,30 @@ public: int aDrawMode, int aColor = -1 ); - /** Function HitTest + /** + * Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test */ bool HitTest( const wxPoint& aPosRef ); - /** Function GetBoundingBox + /** + * Function GetBoundingBox * @return an EDA_Rect giving the bounding box of the sheet */ EDA_Rect GetBoundingBox(); void SwapData( SCH_SHEET* copyitem ); - /** Function ComponentCount + /** + * Function ComponentCount * count our own components, without the power components. * @return the component count. */ int ComponentCount(); - /** Function Load. + /** + * Function Load. * for the sheet: load the file m_FileName * if a screen already exists, the file is already read. * m_AssociatedScreen point on the screen, and its m_RefCount is @@ -349,7 +385,8 @@ public: */ bool Load( WinEDA_SchematicFrame* aFrame ); - /** Function SearchHierarchy + /** + * Function SearchHierarchy * search the existing hierarchy for an instance of screen "FileName". * @param aFilename = the filename to find * @param aFilename = a location to return a pointer to the screen (if @@ -358,7 +395,8 @@ public: */ bool SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen ); - /** Function LocatePathOfScreen + /** + * Function LocatePathOfScreen * search the existing hierarchy for an instance of screen "FileName". * don't bother looking at the root sheet - it must be unique, * no other references to its m_AssociatedScreen otherwise there would be @@ -371,14 +409,16 @@ public: bool LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList ); - /** Function CountSheets + /** + * Function CountSheets * calculates the number of sheets found in "this" * this number includes the full subsheets count * @return the full count of sheets+subsheets contained by "this" */ int CountSheets(); - /** Function GetFileName + /** + * Function GetFileName * return the filename corresponding to this sheet * @return a wxString containing the filename */ @@ -391,7 +431,8 @@ public: } - /** Function ChangeFileName + /** + * Function ChangeFileName * Set a new filename and manage data and associated screen * The main difficulty is the filename change in a complex hierarchy. * - if new filename is not already used: change to the new name (and if an @@ -453,12 +494,14 @@ public: */ void Resize( const wxSize& aSize ); - /** function GetSheetNamePosition + /** + * Function GetSheetNamePosition * @return the position of the anchor of sheet name text */ wxPoint GetSheetNamePosition (); - /** function GetFileNamePosition + /** + * Function GetFileNamePosition * @return the position of the anchor of filename text */ wxPoint GetFileNamePosition (); diff --git a/eeschema/class_drawsheetpath.cpp b/eeschema/sch_sheet_path.cpp similarity index 98% rename from eeschema/class_drawsheetpath.cpp rename to eeschema/sch_sheet_path.cpp index c47b6a1643..9312629c97 100644 --- a/eeschema/class_drawsheetpath.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: class_drawsheet.cpp -// Purpose: member functions for SCH_SHEET -// header = class_drawsheet.h +// Name: sch_sheet_path.cpp +// Purpose: member functions for SCH_SHEET_PATH +// header = sch_sheet_path.h // Author: jean-pierre Charras // Modified by: // License: License GNU @@ -10,9 +10,15 @@ #include "fctsys.h" #include "common.h" -#include "program.h" #include "general.h" #include "dlist.h" +#include "class_sch_screen.h" +#include "sch_item_struct.h" + +#include "sch_sheet.h" +#include "sch_sheet_path.h" +#include "sch_component.h" +#include "template_fieldnames.h" #include "dialogs/dialog_schematic_find.h" diff --git a/eeschema/class_drawsheetpath.h b/eeschema/sch_sheet_path.h similarity index 97% rename from eeschema/class_drawsheetpath.h rename to eeschema/sch_sheet_path.h index f32d096fad..7a6890de85 100644 --- a/eeschema/class_drawsheetpath.h +++ b/eeschema/sch_sheet_path.h @@ -50,7 +50,11 @@ */ +class wxFindReplaceData; +class SCH_SCREEN; class SCH_MARKER; +class SCH_SHEET; +class SCH_ITEM; /** @@ -89,25 +93,29 @@ public: } - /** Function Cmp + /** + * Function Cmp * Compare if this is the same sheet path as aSheetPathToTest * @param aSheetPathToTest = sheet path to compare * @return -1 if different, 0 if same */ int Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const; - /** Function Last + /** + * Function Last * returns a pointer to the last sheet of the list * One can see the others sheet as the "path" to reach this last sheet */ SCH_SHEET* Last(); - /** Function LastScreen + /** + * Function LastScreen * @return the SCH_SCREEN relative to the last sheet in list */ SCH_SCREEN* LastScreen(); - /** Function LastScreen + /** + * Function LastScreen * @return a pointer to the first schematic item handled by the * SCH_SCREEN relative to the last sheet in list */ @@ -121,7 +129,8 @@ public: */ SCH_ITEM* FirstDrawList(); - /** Function Push + /** + * Function Push * store (push) aSheet in list * @param aSheet = pointer to the SCH_SHEET to store in list * Push is used when entered a sheet to select or analyze it @@ -129,7 +138,8 @@ public: */ void Push( SCH_SHEET* aSheet ); - /** Function Pop + /** + * Function Pop * retrieves (pop) the last entered sheet and remove it from list * @return a SCH_SHEET* pointer to the removed sheet in list * Pop is used when leaving a sheet after a selection or analyze @@ -137,7 +147,8 @@ public: */ SCH_SHEET* Pop(); - /** Function Path + /** + * Function Path * the path uses the time stamps which do not changes even when editing * sheet parameters * a path is something like / (root) or /34005677 or /34005677/00AE4523 @@ -153,7 +164,8 @@ public: */ wxString PathHumanReadable() const; - /** Function BuildSheetPathInfoFromSheetPathValue + /** + * Function BuildSheetPathInfoFromSheetPathValue * Fill this with data to access to the hierarchical sheet known by its * path aPath * @param aPath = path of the sheet to reach (in non human readable format) diff --git a/eeschema/class_hierarchical_PIN_sheet.cpp b/eeschema/sch_sheet_pin.cpp similarity index 84% rename from eeschema/class_hierarchical_PIN_sheet.cpp rename to eeschema/sch_sheet_pin.cpp index 3a43994b9d..dc15dc977e 100644 --- a/eeschema/class_hierarchical_PIN_sheet.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -1,8 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// - -// Name: class_hierarchical_PIN_sheet.cpp +// Name: sch_sheet_pin.cpp // Purpose: member functions SCH_SHEET_PIN -// header = class_drawsheet.h +// header = sch_sheet.h // Author: jean-pierre Charras // Modified by: // Created: 08/02/2006 18:37:02 @@ -18,10 +17,13 @@ #include "drawtxt.h" #include "plot_common.h" #include "trigo.h" +#include "richio.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_sheet.h" + /* m_Edge define on which edge the pin is positionned: * @@ -259,6 +261,74 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const } +bool SCH_SHEET_PIN::Load( LINE_READER& aLine, wxString& aErrorMsg ) +{ + int size; + char number[256]; + char name[256]; + char connectType[256]; + char sheetSide[256]; + + /* Read coordinates. */ + if( sscanf( ((char*)aLine), "%s %s %s %s %d %d %d", + number, name, connectType, sheetSide, &m_Pos.x, &m_Pos.y, &size ) != 7 ) + { + aErrorMsg.Printf( wxT( "EESchema file sheet hierarchical label error at line %d.\n" ), + aLine.LineNumber() ); + aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) ); + return false; + } + + m_Text = CONV_FROM_UTF8( name ); + + m_Text = m_Text.AfterFirst( wxChar( '"' ) ); + m_Text = m_Text.BeforeLast( wxChar( '"' ) ); + + if( size == 0 ) + size = DEFAULT_SIZE_TEXT; + + 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; +} + + /** function Matches * Compare hierarchical pin name against search string. * @param aSearchData - Criteria to search against. diff --git a/eeschema/class_text-label.cpp b/eeschema/sch_text.cpp similarity index 83% rename from eeschema/class_text-label.cpp rename to eeschema/sch_text.cpp index a95060a900..a781cf4a07 100644 --- a/eeschema/class_text-label.cpp +++ b/eeschema/sch_text.cpp @@ -5,14 +5,16 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "trigo.h" #include "eeschema_id.h" #include "class_drawpanel.h" #include "drawtxt.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_text.h" /************************/ @@ -441,13 +443,8 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset, // Enable these line to draw the bounding box (debug tests purposes only) #if 0 { - EDA_Rect BoundaryBox; - BoundaryBox = GetBoundingBox(); - int x1 = BoundaryBox.GetX(); - int y1 = BoundaryBox.GetY(); - int x2 = BoundaryBox.GetRight(); - int y2 = BoundaryBox.GetBottom(); - GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN ); + EDA_Rect BoundaryBox = GetBoundingBox(); + GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); } #endif } @@ -490,6 +487,80 @@ bool SCH_TEXT::Save( FILE* aFile ) const } +bool SCH_TEXT::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, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.y, + &orient, &size, Name2, Name3, &thickness ); + + if( ii < 4 ) + { + aErrorMsg.Printf( wxT( "EESchema file text load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + if( !aLine.ReadLine() ) + { + aErrorMsg.Printf( wxT( "EESchema file text load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + if( size == 0 ) + size = DEFAULT_SIZE_TEXT; + + char* text = strtok( (char*) aLine, "\n\r" ); + + if( text == NULL ) + { + aErrorMsg.Printf( wxT( "EESchema file text load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + wxString val = CONV_FROM_UTF8( text ); + + for( ;; ) + { + int i = val.find( wxT( "\\n" ) ); + + if( i == wxNOT_FOUND ) + break; + val.erase( i, 2 ); + val.insert( i, wxT( "\n" ) ); + } + + m_Text = val; + m_Size.x = m_Size.y = size; + SetSchematicTextOrientation( orient ); + + if( isdigit( Name3[0] ) ) + { + thickness = atol( Name3 ); + m_Bold = ( thickness != 0 ); + m_Width = m_Bold ? GetPenSizeForBold( size ) : 0; + } + + if( strnicmp( Name2, "Italic", 6 ) == 0 ) + m_Italic = 1; + + return true; +} + + void SCH_TEXT::GetEndPoints( std::vector & aItemList ) { // Normal text labels cannot be tested for dangling ends. @@ -713,6 +784,68 @@ bool SCH_LABEL::Save( FILE* aFile ) const } +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, "%s %d %d %d %d %s %s %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 = DEFAULT_SIZE_TEXT; + + 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 = CONV_FROM_UTF8( text ); + m_Size.x = m_Size.y = size; + SetSchematicTextOrientation( orient ); + + if( isdigit( Name3[0] ) ) + { + thickness = atol( Name3 ); + m_Bold = ( thickness != 0 ); + m_Width = m_Bold ? GetPenSizeForBold( size ) : 0; + } + + if( stricmp( Name2, "Italic" ) == 0 ) + m_Italic = 1; + + return true; +} + + /** Function SCH_LABEL::Draw * a label is drawn like a text. So just call SCH_TEXT::Draw */ @@ -805,6 +938,71 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const } +bool SCH_GLOBALLABEL::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, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.y, + &orient, &size, Name2, Name3, &thickness ); + + if( ii < 4 ) + { + aErrorMsg.Printf( wxT( "EESchema file global label load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + if( !aLine.ReadLine() ) + { + aErrorMsg.Printf( wxT( "EESchema file global label load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + if( size == 0 ) + size = DEFAULT_SIZE_TEXT; + + char* text = strtok( (char*) aLine, "\n\r" ); + + if( text == NULL ) + { + aErrorMsg.Printf( wxT( "EESchema file global label load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + m_Text = CONV_FROM_UTF8( text ); + m_Size.x = m_Size.y = size; + SetSchematicTextOrientation( orient ); + m_Shape = NET_INPUT; + m_Bold = ( thickness != 0 ); + m_Width = m_Bold ? GetPenSizeForBold( size ) : 0; + + if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) + m_Shape = NET_OUTPUT; + if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) + m_Shape = NET_BIDI; + if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 ) + m_Shape = NET_TRISTATE; + if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 ) + m_Shape = NET_UNSPECIFIED; + if( stricmp( Name3, "Italic" ) == 0 ) + m_Italic = 1; + + return true; +} + + /** Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test @@ -825,7 +1023,7 @@ void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position ) { /* The global label is NOT really mirrored. * for an horizontal label, the schematic orientation is changed. - * for a vericalal label, the schematic orientation is not changed. + * for a vertical label, the schematic orientation is not changed. * and the label is moved to a suitable position */ switch( GetSchematicTextOrientation() ) @@ -1007,13 +1205,8 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, // Enable these line to draw the bounding box (debug tests purposes only) #if 0 { - EDA_Rect BoundaryBox; - BoundaryBox = GetBoundingBox(); - int x1 = BoundaryBox.GetX(); - int y1 = BoundaryBox.GetY(); - int x2 = BoundaryBox.GetRight(); - int y2 = BoundaryBox.GetBottom(); - GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN ); + EDA_Rect BoundaryBox = GetBoundingBox(); + GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); } #endif } @@ -1193,6 +1386,70 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const } +bool SCH_HIERLABEL::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, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.y, + &orient, &size, Name2, Name3, &thickness ); + + if( ii < 4 ) + { + aErrorMsg.Printf( wxT( "EESchema file hierarchical label load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + if( !aLine.ReadLine() ) + { + aErrorMsg.Printf( wxT( "EESchema file hierarchical label load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + if( size == 0 ) + size = DEFAULT_SIZE_TEXT; + + char* text = strtok( (char*) aLine, "\n\r" ); + + if( text == NULL ) + { + aErrorMsg.Printf( wxT( "EESchema file hierarchical label load error at line %d" ), + aLine.LineNumber() ); + return false; + } + + m_Text = CONV_FROM_UTF8( text ); + m_Size.x = m_Size.y = size; + SetSchematicTextOrientation( orient ); + m_Shape = NET_INPUT; + m_Bold = ( thickness != 0 ); + m_Width = m_Bold ? GetPenSizeForBold( size ) : 0; + + if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) + m_Shape = NET_OUTPUT; + if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) + m_Shape = NET_BIDI; + if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 ) + m_Shape = NET_TRISTATE; + if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 ) + m_Shape = NET_UNSPECIFIED; + if( stricmp( Name3, "Italic" ) == 0 ) + m_Italic = 1; + + return true; +} + /** Function HitTest * @return true if the point aPosRef is within item area @@ -1288,13 +1545,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, // Enable these line to draw the bounding box (debug tests purposes only) #if 0 { - EDA_Rect BoundaryBox; - BoundaryBox = GetBoundingBox(); - int x1 = BoundaryBox.GetX(); - int y1 = BoundaryBox.GetY(); - int x2 = BoundaryBox.GetRight(); - int y2 = BoundaryBox.GetBottom(); - GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN ); + EDA_Rect BoundaryBox = GetBoundingBox(); + GRRect( &panel->m_ClipBox, DC, BoundaryBox, 0, BROWN ); } #endif } diff --git a/eeschema/class_text-label.h b/eeschema/sch_text.h similarity index 84% rename from eeschema/class_text-label.h rename to eeschema/sch_text.h index 141f02a711..eb6cbdd951 100644 --- a/eeschema/class_text-label.h +++ b/eeschema/sch_text.h @@ -5,8 +5,13 @@ #ifndef CLASS_TEXT_LABEL_H #define CLASS_TEXT_LABEL_H + #include "macros.h" -#include "base_struct.h" +#include "sch_item_struct.h" + + +class LINE_READER; + /* Type of SCH_HIERLABEL and SCH_GLOBALLABEL * mainly used to handle the graphic associated shape @@ -23,8 +28,7 @@ typedef enum { extern const char* SheetLabelType[]; /* names of types of labels */ -class SCH_TEXT : public SCH_ITEM, - public EDA_TextStruct +class SCH_TEXT : public SCH_ITEM, public EDA_TextStruct { public: int m_Layer; @@ -61,7 +65,8 @@ public: } - /** function SetTextOrientAndJustifyParmeters + /** + * Function SetTextOrientAndJustifyParmeters * Set m_SchematicOrientation, and initialize * m_orient,m_HJustified and m_VJustified, according to the value of * m_SchematicOrientation (for a text ) @@ -77,7 +82,8 @@ public: int GetSchematicTextOrientation() { return m_SchematicOrientation; } - /** function GetSchematicTextOffset (virtual) + /** + * Function GetSchematicTextOffset (virtual) * @return the offset between the SCH_TEXT position and the text itself * position * This offset depend on orientation, and the type of text @@ -93,7 +99,8 @@ public: int draw_mode, int Color = -1 ); - /** function CreateGraphicShape + /** + * Function CreateGraphicShape * Calculates the graphic shape (a polygon) associated to the text * @param aCorner_list = a buffer to fill with polygon corners coordinates * @param Pos = Postion of the shape @@ -109,7 +116,8 @@ public: void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); - /** Function HitTest + /** + * Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test */ @@ -133,7 +141,18 @@ public: */ bool Save( FILE* aFile ) const; - /** Function GetPenSize + /** + * Load schematic text entry from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic text from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic text. + * @return True if the schematic text loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + + /** + * Function GetPenSize * @return the size of the "pen" that be used to draw or plot this item */ int GetPenSize(); @@ -204,7 +223,8 @@ public: } - /** function SetTextOrientAndJustifyParmeters + /** + * Function SetTextOrientAndJustifyParmeters * Set m_SchematicOrientation, and initialize * m_orient,m_HJustified and m_VJustified, according to the value of * m_SchematicOrientation (for a label) @@ -218,7 +238,8 @@ public: */ virtual void SetSchematicTextOrientation( int aSchematicOrientation ); - /** function GetSchematicTextOffset (virtual) + /** + * Function GetSchematicTextOffset (virtual) * @return the offset between the SCH_TEXT position and the text itself * position * This offset depend on orientation, and the type of text @@ -246,6 +267,16 @@ public: * @return bool - true if success writing else false. */ bool Save( FILE* aFile ) const; + + /** + * Load schematic label entry from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic label from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic label. + * @return True if the schematic label loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); }; @@ -267,7 +298,8 @@ public: } - /** function SetTextOrientAndJustifyParmeters + /** + * Function SetTextOrientAndJustifyParmeters * Set m_SchematicOrientation, and initialize * m_orient,m_HJustified and m_VJustified, according to the value of * m_SchematicOrientation @@ -281,7 +313,8 @@ public: */ virtual void SetSchematicTextOrientation( int aSchematicOrientation ); - /** function GetSchematicTextOffset (virtual) + /** + * Function GetSchematicTextOffset (virtual) * @return the offset between the SCH_TEXT position and the text itself * position * This offset depend on orientation, and the type of text @@ -299,7 +332,18 @@ public: */ bool Save( FILE* aFile ) const; - /** Function HitTest + /** + * Load schematic global label entry from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic global label from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic global label. + * @return True if the schematic global label loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + + /** + * Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test */ @@ -314,7 +358,8 @@ public: */ EDA_Rect GetBoundingBox(); - /** function CreateGraphicShape (virual) + /** + * Function CreateGraphicShape (virual) * Calculates the graphic shape (a polygon) associated to the text * @param aCorner_list = a buffer to fill with polygon corners coordinates * @param aPos = Position of the shape @@ -350,7 +395,8 @@ public: } - /** function SetTextOrientAndJustifyParmeters + /** + * Function SetTextOrientAndJustifyParmeters * Set m_SchematicOrientation, and initialize * m_orient,m_HJustified and m_VJustified, according to the value of * m_SchematicOrientation @@ -364,7 +410,8 @@ public: */ virtual void SetSchematicTextOrientation( int aSchematicOrientation ); - /** function GetSchematicTextOffset (virtual) + /** + * Function GetSchematicTextOffset (virtual) * @return the offset between the SCH_TEXT position and the text itself * position * This offset depend on orientation, and the type of text @@ -373,7 +420,8 @@ public: */ virtual wxPoint GetSchematicTextOffset(); - /** function CreateGraphicShape + /** + * Function CreateGraphicShape * Calculates the graphic shape (a polygon) associated to the text * @param aCorner_list = a buffer to fill with polygon corners coordinates * @param Pos = Postion of the shape @@ -390,7 +438,18 @@ public: */ bool Save( FILE* aFile ) const; - /** Function HitTest + /** + * Load schematic hierarchical label entry from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read schematic hierarchical label from. + * @param aErrorMsg - Description of the error if an error occurs while loading the + * schematic hierarchical label. + * @return True if the schematic hierarchical label loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + + /** + * Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test */ diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 16b237fec7..459a535321 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -9,14 +9,18 @@ #include "class_drawpanel.h" #include "confirm.h" #include "eda_doc.h" +#include "wxEeschemaStruct.h" +#include "class_sch_screen.h" +#include "kicad_device_context.h" -#include "class_marker_sch.h" -#include "program.h" #include "general.h" #include "eeschema_id.h" #include "protos.h" #include "class_library.h" -#include "kicad_device_context.h" +#include "sch_marker.h" +#include "sch_component.h" +#include "sch_items.h" +#include "sch_sheet.h" void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) @@ -188,7 +192,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_LINE_COMMENT_BUTT: - SetToolID( id, wxCURSOR_PENCIL, _( "Add Drawing" ) ); + SetToolID( id, wxCURSOR_PENCIL, _( "Add Lines" ) ); break; case ID_JUNCTION_BUTT: @@ -204,7 +208,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_HIERLABEL_BUTT: - SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchal label" ) ); + SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchical label" ) ); break; case ID_TEXT_COMMENT_BUTT: diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index ff46f7a829..0ecf98189e 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -5,11 +5,15 @@ #include "fctsys.h" #include "common.h" #include "class_drawpanel.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" -#include "class_marker_sch.h" +#include "sch_marker.h" +#include "sch_items.h" +#include "sch_component.h" +#include "sch_sheet.h" /* Functions to undo and redo edit commands. diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 690facda08..57cd14f9a0 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -13,23 +13,26 @@ #include "gestfich.h" #include "bitmaps.h" -#include "program.h" #include "general.h" #include "protos.h" #include "eeschema_id.h" #include "netlist.h" #include "lib_pin.h" #include "class_library.h" +#include "wxEeschemaStruct.h" +#include "class_sch_screen.h" -#include "annotate_dialog.h" #include "dialog_build_BOM.h" -#include "dialog_erc.h" #include "netlist_control.h" -#include "dialog_erc.h" #include "libeditframe.h" #include "viewlib_frame.h" #include "hotkeys.h" +#include "eeschema_config.h" +#include "sch_sheet.h" +#include "dialogs/annotate_dialog.h" +#include "dialogs/dialog_erc.h" +#include "dialogs/dialog_print_using_printer.h" #include "dialogs/dialog_schematic_find.h" @@ -757,3 +760,21 @@ void WinEDA_SchematicFrame::SetLanguage( wxCommandEvent& event ) m_LibeditFrame->WinEDA_BasicFrame::SetLanguage( event ); } + +void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event ) +{ + wxFileName fn; + DIALOG_PRINT_USING_PRINTER dlg( this ); + + dlg.ShowModal(); + + fn = g_RootSheet->m_AssociatedScreen->m_FileName; + + wxString default_name = NAMELESS_PROJECT; + default_name += wxT( ".sch" ); + if( fn.GetFullName() != default_name ) + { + fn.SetExt( ProjectFileExtension ); + wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() ); + } +} diff --git a/eeschema/selpart.cpp b/eeschema/selpart.cpp index 3cc774a493..0dcf13158f 100644 --- a/eeschema/selpart.cpp +++ b/eeschema/selpart.cpp @@ -6,8 +6,8 @@ #include "gr_basic.h" #include "common.h" #include "confirm.h" +#include "wxstruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "class_library.h" diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 5389ba3317..7f1afe0169 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -12,16 +12,21 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "confirm.h" #include "gestfich.h" +#include "wxEeschemaStruct.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_sheet.h" #include "dialog_sch_sheet_props.h" +#include + static int s_PreviousSheetWidth; static int s_PreviousSheetHeight; diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index 458fa91d49..e5561357b2 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -5,12 +5,15 @@ #include "fctsys.h" #include "gr_basic.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" +#include "sch_sheet.h" static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index 8d1845d25e..98d86c51f4 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -8,9 +8,9 @@ #include "gr_basic.h" #include "class_drawpanel.h" #include "confirm.h" +#include "class_sch_screen.h" #include "eeschema_id.h" -#include "program.h" #include "general.h" #include "libeditframe.h" #include "class_libentry.h" diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index 470c35f78e..6c6b601a16 100644 --- a/eeschema/symbedit.cpp +++ b/eeschema/symbedit.cpp @@ -8,12 +8,13 @@ #include "fctsys.h" #include "appl_wxstruct.h" #include "common.h" +#include "macros.h" #include "class_drawpanel.h" #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/template_fieldnames.cpp b/eeschema/template_fieldnames.cpp index 51f00740c0..5463c46bf4 100644 --- a/eeschema/template_fieldnames.cpp +++ b/eeschema/template_fieldnames.cpp @@ -1,7 +1,6 @@ #include "template_fieldnames.h" -//#include "class_sch_component.h" #include "dsnlexer.h" #include "macros.h" diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index 1d056d1273..7e04a6cbc4 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -8,7 +8,6 @@ #include "bitmaps.h" #include "eeschema_id.h" -#include "program.h" #include "general.h" #include "protos.h" #include "libeditframe.h" diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index da441add61..547f4e4d8c 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -7,8 +7,8 @@ #include "class_drawpanel.h" #include "confirm.h" #include "bitmaps.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "hotkeys.h" diff --git a/eeschema/tool_viewlib.cpp b/eeschema/tool_viewlib.cpp index e057a7fe2b..d745ff10db 100644 --- a/eeschema/tool_viewlib.cpp +++ b/eeschema/tool_viewlib.cpp @@ -5,9 +5,10 @@ #include "fctsys.h" #include "common.h" #include "bitmaps.h" +#include "macros.h" #include "eeschema_id.h" +#include "wxstruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "hotkeys.h" diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 071978f68e..f1fd8f0d51 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -8,8 +8,9 @@ #include "eeschema_id.h" #include "class_drawpanel.h" #include "bitmaps.h" +#include "class_sch_screen.h" +#include "wxEeschemaStruct.h" -#include "program.h" #include "general.h" #include "protos.h" #include "viewlib_frame.h" diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h index 72e4c9b639..e361773bef 100644 --- a/eeschema/viewlib_frame.h +++ b/eeschema/viewlib_frame.h @@ -2,6 +2,14 @@ #define __LIBVIEWFRM_H__ +#include + +#include "wxstruct.h" + + +class wxSashLayoutWindow; +class wxListBox; +class wxSemaphore; class WinEDAChoiceBox; class SCH_SCREEN; class CMP_LIBRARY; diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index cd01699226..ee6d5f92a5 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -9,8 +9,9 @@ #include "class_drawpanel.h" #include "confirm.h" #include "eda_doc.h" +#include "wxstruct.h" +#include "class_sch_screen.h" -#include "program.h" #include "general.h" #include "protos.h" #include "viewlib_frame.h" diff --git a/gerbview/class_GERBER.h b/gerbview/class_GERBER.h index 52f5446de0..1f5c812246 100644 --- a/gerbview/class_GERBER.h +++ b/gerbview/class_GERBER.h @@ -133,7 +133,8 @@ public: int ReturnUsedDcodeNumber(); void ResetDefaultValues(); - /** function GetLayerParams + /** + * Function GetLayerParams * @return the current layers params */ GERBER_LAYER& GetLayerParams() @@ -142,14 +143,16 @@ public: } - /** function ReportMessage + /** + * Function ReportMessage * Add a message (a string) in message list * for instance when reading a Gerber file * @param aMessage = the straing to add in list */ void ReportMessage( const wxString aMessage ); - /** function ClearMessageList + /** + * Function ClearMessageList * Clear the message list * Call it before reading a Gerber file */ @@ -160,12 +163,14 @@ public: */ void InitToolTable(); - /** function ReadXYCoord + /** + * Function ReadXYCoord * Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm) */ wxPoint ReadXYCoord( char*& Text ); - /** function ReadIJCoord + /** + * Function ReadIJCoord * Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) * These coordinates are relative, so if coordinate is absent, it's value * defaults to 0 @@ -229,7 +234,8 @@ public: */ APERTURE_MACRO* FindApertureMacro( const APERTURE_MACRO& aLookup ); - /** Function StepAndRepeatItem + /** + * Function StepAndRepeatItem * Gerber format has a command Step an Repeat * This function must be called when reading a gerber file and * after creating a new gerber item that must be repeated @@ -238,7 +244,8 @@ public: */ void StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem ); - /** Function DisplayImageInfo + /** + * Function DisplayImageInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. * Display info about Image Parameters. diff --git a/gerbview/class_aperture_macro.h b/gerbview/class_aperture_macro.h index f13921a465..45547b81ec 100644 --- a/gerbview/class_aperture_macro.h +++ b/gerbview/class_aperture_macro.h @@ -107,7 +107,8 @@ public: /* Draw functions: */ - /** function DrawBasicShape + /** + * Function DrawBasicShape * Draw the primitive shape for flashed items. * @param aParent = the parent GERBER_DRAW_ITEM which is actually drawn * @param aClipBox = DC clip box (NULL is no clip) @@ -134,7 +135,8 @@ public: private: - /** function ConvertShapeToPolygon + /** + * Function ConvertShapeToPolygon * convert a shape to an equivalent polygon. * Arcs and circles are approximated by segments * Useful when a shape is not a graphic primitive (shape with hole, @@ -155,7 +157,8 @@ struct APERTURE_MACRO wxString name; ///< The name of the aperture macro AM_PRIMITIVES primitives; ///< A sequence of AM_PRIMITIVEs - /** function DrawApertureMacroShape + /** + * Function DrawApertureMacroShape * Draw the primitive shape for flashed items. * When an item is flashed, this is the shape of the item * @param aParent = the parent GERBER_DRAW_ITEM which is actually drawn diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index d9f172fd15..86d369024e 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -120,7 +120,8 @@ public: return m_LayerNegative; } - /** function SetLayerParameters + /** + * Function SetLayerParameters * Initialize parameters from Image and Layer parameters * found in the gerber file: * m_UnitsMetric, @@ -194,14 +195,16 @@ public: int aDrawMode, const wxPoint& aOffset = ZeroOffset ); - /** function ConvertSegmentToPolygon + /** + * Function ConvertSegmentToPolygon * convert a line to an equivalent polygon. * Useful when a line is plotted using a rectangular pen. * In this case, the usual segment plot function cannot be used */ void ConvertSegmentToPolygon( ); - /** function DrawGbrPoly + /** + * Function DrawGbrPoly * a helper function used id ::Draw to draw the polygon stored in m_PolyCorners */ void DrawGbrPoly( EDA_Rect* aClipBox, diff --git a/gerbview/class_gerbview_layer_widget.h b/gerbview/class_gerbview_layer_widget.h index 15968f463e..ab6a4589b6 100644 --- a/gerbview/class_gerbview_layer_widget.h +++ b/gerbview/class_gerbview_layer_widget.h @@ -77,7 +77,8 @@ public: void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ); void OnRenderColorChange( int aId, int aColor ); void OnRenderEnable( int aId, bool isEnabled ); - /** Function SetLayersManagerTabsText + /** + * Function SetLayersManagerTabsText * Update the layer manager tabs labels * Useful when changing Language or to set labels to a non default value */ diff --git a/gerbview/dcode.h b/gerbview/dcode.h index 23637134f1..e80e9baf7d 100644 --- a/gerbview/dcode.h +++ b/gerbview/dcode.h @@ -189,7 +189,8 @@ public: */ static const wxChar* ShowApertureType( APERTURE_T aType ); - /** function DrawFlashedShape + /** + * Function DrawFlashedShape * Draw the dcode shape for flashed items. * When an item is flashed, the DCode shape is the shape of the item * @param aParent = the GERBER_DRAW_ITEM being drawn @@ -204,7 +205,8 @@ public: EDA_Rect* aClipBox, wxDC* aDC, int aColor, int aAltColor, wxPoint aShapePos, bool aFilledShape ); - /** function DrawFlashedPolygon + /** + * Function DrawFlashedPolygon * a helper function used id ::Draw to draw the polygon stored ion m_PolyCorners * Draw some Apertures shapes when they are defined as filled polygons. * APT_POLYGON is always a polygon, but some complex shapes are also converted to @@ -220,7 +222,8 @@ public: EDA_Rect* aClipBox, wxDC* aDC, int aColor, bool aFilled, const wxPoint& aPosition ); - /** function ConvertShapeToPolygon + /** + * Function ConvertShapeToPolygon * convert a shape to an equivalent polygon. * Arcs and circles are approximated by segments * Useful when a shape is not a graphic primitive (shape with hole, diff --git a/gerbview/wxGerberFrame.h b/gerbview/wxGerberFrame.h index d51f149d51..4ac379c375 100644 --- a/gerbview/wxGerberFrame.h +++ b/gerbview/wxGerberFrame.h @@ -63,7 +63,8 @@ public: void Update_config(); void OnCloseWindow( wxCloseEvent& Event ); - /** function ReportMessage + /** + * Function ReportMessage * Add a message (a string) in message list * for instance when reading a Gerber file * @param aMessage = the straing to add in list @@ -72,7 +73,8 @@ public: { m_Messages.Add( aMessage ); } - /** function ClearMessageList + /** + * Function ClearMessageList * Clear the message list * Call it before reading a Gerber file */ @@ -81,24 +83,28 @@ public: m_Messages.Clear( ); } - /** Function IsGridVisible() , virtual + /** + * Function IsGridVisible() , virtual * @return true if the grid must be shown */ virtual bool IsGridVisible(); - /** Function SetGridVisibility() , virtual + /** + * Function SetGridVisibility() , virtual * It may be overloaded by derived classes * if you want to store/retrieve the grid visiblity in configuration. * @param aVisible = true if the grid must be shown */ virtual void SetGridVisibility(bool aVisible); - /** Function GetGridColor() , virtual + /** + * Function GetGridColor() , virtual * @return the color of the grid */ virtual int GetGridColor(); - /** Function SetGridColor() , virtual + /** + * Function SetGridColor() , virtual * @param aColor = the new color of the grid */ virtual void SetGridColor(int aColor); @@ -178,7 +184,8 @@ public: */ void syncLayerBox(); - /** function UpdateTitleAndInfo + /** + * Function UpdateTitleAndInfo * displays the short filename (if exists) of the selected layer * on the caption of the main gerbview window * and some other parameters @@ -210,7 +217,8 @@ public: */ virtual void SaveSettings(); - /** function SetLanguage + /** + * Function SetLanguage * called on a language menu selection */ virtual void SetLanguage( wxCommandEvent& event ); @@ -279,13 +287,15 @@ public: void InstallDrillFrame( wxCommandEvent& event ); void ToPostProcess( wxCommandEvent& event ); - /** Function ToPlotter + /** + * Function ToPlotter * Open a dialog frame to create plot and drill files * relative to the current board */ void ToPlotter( wxCommandEvent& event ); - /** Function ToPrinter + /** + * Function ToPrinter * Open a dialog frame to print layers */ void ToPrinter( wxCommandEvent& event ); @@ -370,7 +380,8 @@ public: UndoRedoOpType aTypeCommand = UR_UNSPECIFIED, const wxPoint& aTransformPoint = wxPoint(0,0) ) { } - /** Function SaveCopyInUndoList (overloaded). + /** + * Function SaveCopyInUndoList (overloaded). * Creates a new entry in undo list of commands. * add a list of pickers to handle a list of items * @param aItemsList = the list of items modified by the command to undo diff --git a/include/appl_wxstruct.h b/include/appl_wxstruct.h index fac13ce486..0e46b63236 100644 --- a/include/appl_wxstruct.h +++ b/include/appl_wxstruct.h @@ -83,7 +83,8 @@ public: WinEDA_App(); virtual void MacOpenFile(const wxString &fileName); - /** Function InitEDA_Appl + /** + * Function InitEDA_Appl * initialize some general parameters * - Default paths (help, libs, bin)and configuration files names * - Language and locale @@ -97,7 +98,8 @@ public: WinEDA_App(); bool SetLanguage( bool first_time = FALSE ); - /** Function AddMenuLanguageList + /** + * Function AddMenuLanguageList * * Create menu list for language choice, and add it as submenu to a main * menu @@ -113,7 +115,8 @@ public: WinEDA_App(); void SetLanguagePath( void ); void InitOnLineHelp(); - /** Function GetSettings + /** + * Function GetSettings * Get application settings * @param aReopenLastUsedDirectory = true to switch to last opened * directory, false to use current CWD @@ -130,7 +133,8 @@ public: WinEDA_App(); const wxString& GroupName, PARAM_CFG_ARRAY& params ); - /** Function SaveCurrentSetupValues() + /** + * Function SaveCurrentSetupValues() * Save the current setup values in m_EDA_Config * saved parameters are parameters that have the .m_Setup member set to * true @@ -139,7 +143,8 @@ public: WinEDA_App(); void SaveCurrentSetupValues( PARAM_CFG_BASE** aList ); void SaveCurrentSetupValues( PARAM_CFG_ARRAY& List ); - /** Function ReadCurrentSetupValues() + /** + * Function ReadCurrentSetupValues() * Raed the current setup values previously saved, from m_EDA_Config * saved parameters are parameters that have the .m_Setup member set to * true @@ -207,14 +212,16 @@ public: WinEDA_App(); wxString ReturnFilenameWithRelativePathInLibPath( const wxString& aFullFilename ); - /** Function RemoveLibraryPath + /** + * Function RemoveLibraryPath * Removes the given path(s) from the library path list * @param aPaths = path or path list to remove. paths must be separated by * ";" */ void RemoveLibraryPath( const wxString& aPaths ); - /** Function InsertLibraryPath + /** + * Function InsertLibraryPath * insert path(s) int lib paths list. * @param aPaths = path or path list to add. paths must be separated by ";" * @param aIndex = insertion point diff --git a/include/base_struct.h b/include/base_struct.h index 94b79b2952..5767f005d4 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -236,7 +236,8 @@ public: */ EDA_Rect& Inflate( int aDelta ); - /** Function Merge + /** + * Function Merge * Modify Position and Size of this in order to contain the given rect * mainly used to calculate bounding boxes * @param aRect = given rect to merge with this @@ -586,7 +587,8 @@ public: int GetLength() const { return m_Text.Length(); }; - /** Function Draw + /** + * Function Draw * @param aPanel = the current DrawPanel * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) @@ -603,7 +605,8 @@ public: private: - /** Function DrawOneLineOfText + /** + * Function DrawOneLineOfText * Draw a single text line. * Used to draw each line of this EDA_TextStruct, that can be multiline * @param aPanel = the current DrawPanel @@ -650,7 +653,8 @@ public: */ int LenSize( const wxString& aLine ) const; - /** Function GetTextBox + /** + * Function GetTextBox * useful in multiline texts to calculate the full text or a line area (for * zones filling, locate functions....) * @return the rect containing the line of text (i.e. the position and the @@ -663,7 +667,8 @@ public: */ EDA_Rect GetTextBox( int aLine = -1 ); - /** Function GetInterline + /** + * Function GetInterline * return the distance between 2 text lines * has meaning only for multiline texts */ diff --git a/include/block_commande.h b/include/block_commande.h index 1a31cee9b3..3712508e40 100644 --- a/include/block_commande.h +++ b/include/block_commande.h @@ -76,13 +76,15 @@ public: BLOCK_SELECTOR(); ~BLOCK_SELECTOR(); - /** function InitData + /** + * Function InitData * Init the initial values of a BLOCK_SELECTOR, before starting a block *command */ void InitData( WinEDA_DrawPanel* Panel, const wxPoint& startpos ); - /** Function SetMessageBlock + /** + * Function SetMessageBlock * Displays the type of block command in the status bar of the window */ void SetMessageBlock( WinEDA_DrawFrame* frame ); @@ -92,13 +94,15 @@ public: int aDrawMode, int aColor ); - /** Function PushItem + /** + * Function PushItem * Add aItem to the list of items * @param aItem = an ITEM_PICKER to add to the list */ void PushItem( ITEM_PICKER& aItem ); - /** Function ClearListAndDeleteItems + /** + * Function ClearListAndDeleteItems * delete only the list of EDA_BaseStruct * pointers, AND the data printed * by m_Item */ @@ -110,6 +114,16 @@ public: { return m_ItemsSelection.GetCount(); } + + /** + * Function SetLastCursorPosition + * sets m_BlockLastCursorPosition + * @param aPosition = new position + **/ + void SetLastCursorPosition( wxPoint aPosition ) + { + m_BlockLastCursorPosition = aPosition; + } }; diff --git a/include/class_base_screen.h b/include/class_base_screen.h index 654c13b7da..3ee6043c8e 100644 --- a/include/class_base_screen.h +++ b/include/class_base_screen.h @@ -167,7 +167,8 @@ public: wxSize ReturnPageSize( void ); virtual int GetInternalUnits( void ); - /** Function CursorRealPosition + /** + * Function CursorRealPosition * @return the position in user units of location ScreenPos * @param ScreenPos = the screen (in pixel) position co convert */ @@ -185,7 +186,8 @@ public: /* general Undo/Redo command control */ - /** function ClearUndoORRedoList (virtual). + /** + * Function ClearUndoORRedoList (virtual). * this function must remove the aItemCount old commands from aList * and delete commands, pickers and picked items if needed * Because picked items must be deleted only if they are not in use, this @@ -198,14 +200,16 @@ public: */ virtual void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 ) = 0; - /** Function ClearUndoRedoList + /** + * Function ClearUndoRedoList * clear undo and redo list, using ClearUndoORRedoList() * picked items are deleted by ClearUndoORRedoList() according to their * status */ virtual void ClearUndoRedoList(); - /** function PushCommandToUndoList + /** + * Function PushCommandToUndoList * add a command to undo in undo list * delete the very old commands when the max count of undo commands is * reached @@ -213,7 +217,8 @@ public: */ virtual void PushCommandToUndoList( PICKED_ITEMS_LIST* aItem ); - /** function PushCommandToRedoList + /** + * Function PushCommandToRedoList * add a command to redo in redo list * delete the very old commands when the max count of redo commands is * reached @@ -258,7 +263,8 @@ public: //------------------------------------------------------------- - /** Function GetScalingFactor + /** + * Function GetScalingFactor * @return the the current scale used to draw items on screen * draw coordinates are user coordinates * GetScalingFactor( ) */ @@ -268,13 +274,15 @@ public: } - /** Function SetScalingFactor + /** + * Function SetScalingFactor * @param the the current scale used to draw items on screen * draw coordinates are user coordinates * GetScalingFactor( ) */ void SetScalingFactor( double aScale ); - /** Function GetZoom + /** + * Function GetZoom * @return the current zoom factor * Note: the zoom factor is NOT the scaling factor * the scaling factor is m_ZoomScalar * GetZoom() diff --git a/include/class_board_item.h b/include/class_board_item.h index 1ad7fd54ef..6cf5542261 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -280,7 +280,8 @@ public: */ NETCLASS* GetNetClass() const; - /** function GetNetClassName + /** + * Function GetNetClassName * @return the Net Class name of this item */ wxString GetNetClassName( ) const; diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index d2163be68b..84f7cfeb99 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -63,7 +63,7 @@ public: #ifdef USE_WX_OVERLAY // MAC Uses overlay to workaround the wxINVERT and wxXOR miss - wxOverlay m_overlay; + wxOverlay m_overlay; #endif /* Cursor management (used in editing functions) */ @@ -89,7 +89,8 @@ public: void OnPaint( wxPaintEvent& event ); void OnSize( wxSizeEvent& event ); - /** Function DrawBackGround + /** + * Function DrawBackGround * @param DC = current Device Context * Draws (if allowed) : * the grid @@ -98,7 +99,8 @@ public: */ void DrawBackGround( wxDC* DC ); - /** Function DrawGrid + /** + * Function DrawGrid * @param DC = current Device Context * draws the grid * - the grid is drawn only if the zoom level allows a good visibility @@ -106,7 +108,8 @@ public: */ void DrawGrid( wxDC* DC ); - /** function DrawAuxiliaryAxis + /** + * Function DrawAuxiliaryAxis * Draw the Auxiliary Axis, used in pcbnew which as origin coordinates * for gerber and excellon files * @param DC = current Device Context @@ -159,13 +162,15 @@ public: void SetBoundaryBox( wxDC* dc ); void ReDraw( wxDC* DC, bool erasebg = TRUE ); - /** Function CursorRealPosition + /** + * Function CursorRealPosition * @return the position in user units of location ScreenPos * @param ScreenPos = the screen (in pixel) position to convert */ wxPoint CursorRealPosition( const wxPoint& ScreenPos ); - /** Function CursorScreenPosition + /** + * Function CursorScreenPosition * @return the curseur current position in pixels in the screen draw area */ wxPoint CursorScreenPosition(); diff --git a/include/class_drc_item.h b/include/class_drc_item.h index 441f70c670..587be67b9a 100644 --- a/include/class_drc_item.h +++ b/include/class_drc_item.h @@ -76,7 +76,8 @@ public: } - /** Function SetData + /** + * Function SetData * initialize all data in item * @param aErrorCode = error code * @param aMainText = the text concerning the schematic or board item @@ -91,7 +92,8 @@ public: m_hasSecondItem = false; } - /** Function SetData + /** + * Function SetData * initialize all data in item * @param aErrorCode = error code * @param aMainText = the first text (main text) concerning the main schematic or board item @@ -111,7 +113,8 @@ public: m_hasSecondItem = true; } - /** Function SetAuxiliaryData + /** + * Function SetAuxiliaryData * initialize data for the second (auxiliary) item * @param aAuxiliaryText = the second text (main text) concerning the second schematic or board item * @param aAuxiliaryPos = position the second item diff --git a/include/class_marker_base.h b/include/class_marker_base.h index 22b85dfb43..de23a11c9e 100644 --- a/include/class_marker_base.h +++ b/include/class_marker_base.h @@ -51,7 +51,8 @@ public: ~MARKER_BASE(); - /** Function DrawMarker + /** + * Function DrawMarker */ void DrawMarker( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode, const wxPoint& offset ); @@ -66,7 +67,8 @@ public: } - /** Function SetColor + /** + * Function SetColor * Set the color of this marker */ void SetColor( EDA_Colors aColor ) @@ -75,7 +77,8 @@ public: } - /** Function to set/get error levels (warning, fatal ..) + /** + * Function to set/get error levels (warning, fatal ..) * this value is stored in m_MarkerType */ void SetErrorLevel( int aErrorLevel ) @@ -163,7 +166,8 @@ public: } - /** Function DisplayMarkerInfo() + /** + * Function DisplayMarkerInfo() * Displays the full info of this marker, in a HTML window */ void DisplayMarkerInfo(WinEDA_DrawFrame * aFrame); diff --git a/include/class_pcb_screen.h b/include/class_pcb_screen.h index ea8b92182c..9a0de4a8f5 100644 --- a/include/class_pcb_screen.h +++ b/include/class_pcb_screen.h @@ -50,7 +50,8 @@ public: // use BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aItem ) // use BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aItem ) - /** Function ClearUndoORRedoList + /** + * Function ClearUndoORRedoList * free the undo or redo list from List element * Wrappers are deleted. * datas pointed by wrappers are deleted if not in use in schematic diff --git a/include/class_sch_screen.h b/include/class_sch_screen.h index 24e45d1b68..41f43e2ea3 100644 --- a/include/class_sch_screen.h +++ b/include/class_sch_screen.h @@ -71,7 +71,8 @@ public: // use BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aItem ) // use BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aItem ) - /** Function ClearUndoORRedoList + /** + * Function ClearUndoORRedoList * free the undo or redo list from List element * Wrappers are deleted. * data pointed by wrappers are deleted if not in use in schematic diff --git a/include/class_undoredo_container.h b/include/class_undoredo_container.h index bfd643889c..3820ad3863 100644 --- a/include/class_undoredo_container.h +++ b/include/class_undoredo_container.h @@ -119,18 +119,21 @@ public: */ ITEM_PICKER PopItem(); - /** Function ClearItemsList + /** + * Function ClearItemsList * delete only the list of pickers, NOT the picked data itself */ void ClearItemsList(); - /** Function ClearListAndDeleteItems + /** + * Function ClearListAndDeleteItems * delete the list of pickers, AND the data pointed * by m_PickedItem or m_PickedItemLink, according to the type of undo/redo command recorded */ void ClearListAndDeleteItems(); - /** function GetCount() + /** + * Function GetCount() * @return the count of pickers stored in this list */ unsigned GetCount() const @@ -138,7 +141,8 @@ public: return m_ItemsList.size(); } - /** function ReversePickersListOrder() + /** + * Function ReversePickersListOrder() * reverses the order of pickers stored in this list * Useful when pop a list from Undo to Redo (and vice-versa) * because sometimes undo (or redo) a command needs to keep the @@ -148,7 +152,8 @@ public: void ReversePickersListOrder(); - /** function GetItemWrapper + /** + * Function GetItemWrapper * @return the picker of a picked item * @param aIdx = index of the picker in the picked list * if this picker does not exist, a picker is returned, @@ -156,40 +161,46 @@ public: */ ITEM_PICKER GetItemWrapper( unsigned int aIdx ); - /** function GetPickedItem + /** + * Function GetPickedItem * @return a pointer to the picked item * @param aIdx = index of the picked item in the picked list */ EDA_BaseStruct* GetPickedItem( unsigned int aIdx ); - /** function GetPickedItemLink + /** + * Function GetPickedItemLink * @return link of the picked item, or null if does not exist * @param aIdx = index of the picked item in the picked list */ EDA_BaseStruct* GetPickedItemLink( unsigned int aIdx ); - /** function GetPickedItemStatus + /** + * Function GetPickedItemStatus * @return the type of undo/redo opertaion associated to the picked item, * or UR_UNSPECIFIED if does not exist * @param aIdx = index of the picked item in the picked list */ UndoRedoOpType GetPickedItemStatus( unsigned int aIdx ); - /** function GetPickerFlags + /** + * Function GetPickerFlags * return the value of the picker flag * @param aIdx = index of the picker in the picked list * @return the value stored in the picker, if the picker exists, or 0 if does not exist */ int GetPickerFlags( unsigned aIdx ); - /** function SetPickedItem + /** + * Function SetPickedItem * @param aItem = a pointer to the item to pick * @param aIdx = index of the picker in the picked list * @return true if the pixker exists, or false if does not exist */ bool SetPickedItem( EDA_BaseStruct* aItem, unsigned aIdx ); - /** function SetPickedItem + /** + * Function SetPickedItem * @param aItem = a pointer to the item to pick * @param aStatus = the type of undo/redo operation associated to the item to pick * @param aIdx = index of the picker in the picked list @@ -197,7 +208,8 @@ public: */ bool SetPickedItem( EDA_BaseStruct* aItem, UndoRedoOpType aStatus, unsigned aIdx ); - /** function SetPickedItemLink + /** + * Function SetPickedItemLink * Set the link associated to a given picked item * @param aLink = the link to the item associated to the picked item * @param aIdx = index of the picker in the picked list @@ -205,7 +217,8 @@ public: */ bool SetPickedItemLink( EDA_BaseStruct* aLink, unsigned aIdx ); - /** function SetPickedItemStatus + /** + * Function SetPickedItemStatus * Set the type of undo/redo operation for a given picked item * @param aStatus = the type of undo/redo operation associated to the picked item * @param aIdx = index of the picker in the picked list @@ -213,7 +226,8 @@ public: */ bool SetPickedItemStatus( UndoRedoOpType aStatus, unsigned aIdx ); - /** function SetPickerFlags + /** + * Function SetPickerFlags * Set the flags of the picker (usually to the picked item m_Flags value) * @param aFlags = the value to save in picker * @param aIdx = index of the picker in the picked list @@ -221,14 +235,16 @@ public: */ bool SetPickerFlags( int aFlags, unsigned aIdx ); - /** function RemovePicker + /** + * Function RemovePicker * remove one entry (one picker) from the list of picked items * @param aIdx = index of the picker in the picked list * @return true if ok, or false if did not exist */ bool RemovePicker( unsigned aIdx ); - /** Function CopyList + /** + * Function CopyList * copy all data from aSource * Items picked are not copied. just pointer on them are copied */ diff --git a/include/dialog_load_error.h b/include/dialog_load_error.h index be3b35fc9e..f7b00bf95c 100644 --- a/include/dialog_load_error.h +++ b/include/dialog_load_error.h @@ -12,30 +12,33 @@ Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder. class DIALOG_LOAD_ERROR : public DIALOG_DISPLAY_HTML_TEXT_BASE { protected: - // Handlers for DIALOG_LOAD_ERROR_BASE events. - void OnCloseButtonClick( wxCommandEvent& event ); + // Handlers for DIALOG_LOAD_ERROR_BASE events. + void OnCloseButtonClick( wxCommandEvent& event ); public: - /** Constructor */ - DIALOG_LOAD_ERROR( wxWindow* parent ); + /** Constructor */ + DIALOG_LOAD_ERROR( wxWindow* parent ); - /** Function ListSet + /** + * Function ListSet * Add a list of items. * @param list = a string containing items. Items are separated by '\n' */ - void ListSet(const wxString &list); - /** Function ListSet + void ListSet(const wxString &list); + /** + * Function ListSet * Add a list of items. * @param list = a wxArrayString containing items. */ - void ListSet(const wxArrayString &list); + void ListSet(const wxArrayString &list); - void ListClear(); - /** Function MessageSet + void ListClear(); + /** + * Function MessageSet * Add a message (in bold) to message list. * @param message = the message */ - void MessageSet(const wxString &message); + void MessageSet(const wxString &message); }; #endif // __dialog_load_error_h_ diff --git a/include/gr_basic.h b/include/gr_basic.h index f89e047031..1e60f3af36 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -193,7 +193,7 @@ void GRFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, void GRFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color, int BgColor ); void GRRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int Color ); -void GRRect( EDA_Rect* ClipBox, wxDC* DC,const EDA_Rect& aRect, int Color ); +void GRRect( EDA_Rect* ClipBox, wxDC* DC,const EDA_Rect& aRect, int aWidth, int Color ); void GRRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int Color ); void GRRectPs( EDA_Rect* aClipBox, wxDC* aDC,const EDA_Rect& aRect, diff --git a/include/plot_common.h b/include/plot_common.h index 399e968036..aadff0e604 100644 --- a/include/plot_common.h +++ b/include/plot_common.h @@ -45,7 +45,8 @@ public: } - /** function GetPlotterType() + /** + * Function GetPlotterType() * @return the format of the plot file */ PlotFormat GetPlotterType() diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 6eadb588d9..2d60c508ac 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -12,6 +12,7 @@ using namespace std; class SCH_ITEM; +class LINE_READER; class WinEDA_SchematicFrame; class wxFindReplaceData; @@ -84,7 +85,8 @@ public: */ void SetLayer( int aLayer ) { m_Layer = aLayer; } - /** Function GetPenSize virtual pure + /** + * Function GetPenSize virtual pure * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ) = 0; @@ -127,6 +129,15 @@ public: */ virtual bool Save( FILE* aFile ) const = 0; + /** + * Load schematic item from \a aLine in a .sch file. + * + * @param aLine - Essentially this is file to read the object from. + * @param aErrorMsg - Description of the error if an error occurs while loading the object. + * @return True if the object loaded successfully. + */ + virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ) { return false; } + /** * Compare schematic item against search string. * diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 2ffa5a47f2..454d266ebe 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -193,7 +193,8 @@ public: MODULE* Copie_Module( MODULE* module ); - /** Function Save_Module_In_Library + /** + * Function Save_Module_In_Library * Save in an existing library a given footprint * @param aLibName = name of the library to use * @param aModule = the given footprint @@ -214,7 +215,8 @@ public: bool NewModulesOnly ); MODULE* GetModuleByName(); - /** Function OnModify() + /** + * Function OnModify() * Virtual * Must be called after a change * in order to set the "modify" flag of the current screen @@ -225,7 +227,8 @@ public: virtual void OnModify( ); // Modules (footprints) - /** Function Create_1_Module + /** + * Function Create_1_Module * Creates a new module or footprint : A new module contains 2 texts : * First = REFERENCE * Second = VALUE: "VAL**" @@ -257,7 +260,8 @@ public: wxDC* DC ); void AddPad( MODULE* Module, bool draw ); - /** Function DeletePad + /** + * Function DeletePad * Delete the pad aPad. * Refresh the modified screen area * Refresh modified parameters of the parent module (bounding box, last date) @@ -276,7 +280,8 @@ public: // loading footprints - /** function Get_Librairie_Module + /** + * Function Get_Librairie_Module * * Read active libraries or one library to find and load a given module * If found the module is linked to the tail of linked list of modules @@ -291,7 +296,8 @@ public: const wxString& aModuleName, bool aDisplayMessageError ); - /** Function Select_1_Module_From_List + /** + * Function Select_1_Module_From_List * Display a list of modules found in active libraries or a given library * @param aLibraryFullFilename = library to list (if aLibraryFullFilename * == void, list all modules) @@ -354,7 +360,8 @@ public: int masque_layer, GRTraceMode trace_mode ); - /** function PlotDrillMark + /** + * Function PlotDrillMark * Draw a drill mark for pads and vias. * Must be called after all drawings, because it * redraw the drill mark on a pad or via, as a negative (i.e. white) shape @@ -371,7 +378,8 @@ public: /* Functions relative to Undo/redo commands: */ - /** Function SaveCopyInUndoList (virtual pure) + /** + * Function SaveCopyInUndoList (virtual pure) * Creates a new entry in undo list of commands. * add a picker to handle aItemToCopy * @param aItemToCopy = the board item modified by the command to undo @@ -384,7 +392,8 @@ public: const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0; - /** Function SaveCopyInUndoList (virtual pure, overloaded). + /** + * Function SaveCopyInUndoList (virtual pure, overloaded). * Creates a new entry in undo list of commands. * add a list of pickers to handle a list of items * @param aItemsList = the list of items modified by the command to undo diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index f461724fca..dd38de512e 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -179,7 +179,8 @@ public: } - /** Function OnModify() + /** + * Function OnModify() * Must be called after a schematic change * in order to set the "modify" flag of the current screen * and update the date in frame reference @@ -238,7 +239,8 @@ public: /* netlist generation */ void BuildNetListBase(); - /** Function CreateNetlist + /** + * Function CreateNetlist * Create a netlist file: * build netlist info * test issues @@ -254,7 +256,8 @@ public: const wxString& aFullFileName, bool aUse_netnames ); - /** function WriteNetListFile + /** + * Function WriteNetListFile * Create the netlist file. Netlist info must be existing * @param aFormat = netlist format (NET_TYPE_PCBNEW ...) * @param aFullFileName = full netlist file name @@ -281,7 +284,8 @@ public: void InstallPreviousSheet(); void InstallNextScreen( SCH_SHEET* Sheet ); - /** Function GetUniqueFilenameForCurrentSheet + /** + * Function GetUniqueFilenameForCurrentSheet * @return a filename that can be used in plot and print functions * for the current screen and sheet path. * This filename is unique and must be used instead of the screen filename @@ -407,7 +411,8 @@ private: void OnUpdateHiddenPins( wxUpdateUIEvent& event ); void OnUpdateBusOrientation( wxUpdateUIEvent& event ); - /** function SetLanguage + /** + * Function SetLanguage * called on a language menu selection */ void SetLanguage( wxCommandEvent& event ); @@ -461,7 +466,8 @@ private: public: bool EditSheet( SCH_SHEET* Sheet, wxDC* DC ); - /** Function UpdateSheetNumberAndDate + /** + * Function UpdateSheetNumberAndDate * Set a sheet number, the sheet count for sheets in the whole schematic * and update the date in all screens */ @@ -513,7 +519,8 @@ private: /* Undo - redo */ public: - /** Function SaveCopyInUndoList. + /** + * Function SaveCopyInUndoList. * Creates a new entry in undo list of commands. * add a picker to handle aItemToCopy * @param aItemToCopy = the schematic item modified by the command to undo @@ -525,7 +532,8 @@ public: UndoRedoOpType aTypeCommand, const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); - /** Function SaveCopyInUndoList (overloaded). + /** + * Function SaveCopyInUndoList (overloaded). * Creates a new entry in undo list of commands. * add a list of pickers to handle a list of items * @param aItemsList = the list of items modified by the command to undo @@ -539,7 +547,8 @@ public: private: - /** Function PutDataInPreviousState() + /** + * Function PutDataInPreviousState() * Used in undo or redo command. * Put data pointed by List in the previous state, i.e. the state * memorized by List @@ -549,7 +558,8 @@ private: */ void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand ); - /** Function GetSchematicFromRedoList + /** + * Function GetSchematicFromRedoList * Redo the last edition: * - Save the current schematic in Undo list * - Get an old version of the schematic from Redo list @@ -557,7 +567,8 @@ private: */ void GetSchematicFromRedoList( wxCommandEvent& event ); - /** Function GetSchematicFromUndoList + /** + * Function GetSchematicFromUndoList * Undo the last edition: * - Save the current schematic in Redo list * - Get an old version of the schematic from Undo list diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 182de55447..108d8e34df 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -141,13 +141,15 @@ public: void OnQuit( wxCommandEvent & WXUNUSED(event) ); - /** Function ToPlotter + /** + * Function ToPlotter * Open a dialog frame to create plot and drill files * relative to the current board */ void ToPlotter( wxCommandEvent& event ); - /** function ToPrinter + /** + * Function ToPrinter * Install the print dialog */ void ToPrinter( wxCommandEvent& event ); @@ -167,24 +169,28 @@ public: void GetKicadAbout( wxCommandEvent& event ); - /** Function IsGridVisible() , virtual + /** + * Function IsGridVisible() , virtual * @return true if the grid must be shown */ virtual bool IsGridVisible(); - /** Function SetGridVisibility() , virtual + /** + * Function SetGridVisibility() , virtual * It may be overloaded by derived classes * if you want to store/retrieve the grid visibility in configuration. * @param aVisible = true if the grid must be shown */ virtual void SetGridVisibility(bool aVisible); - /** Function GetGridColor() , virtual + /** + * Function GetGridColor() , virtual * @return the color of the grid */ virtual int GetGridColor(); - /** Function SetGridColor() , virtual + /** + * Function SetGridColor() , virtual * @param aColor = the new color of the grid */ virtual void SetGridColor(int aColor); @@ -254,7 +260,8 @@ public: */ void SetLastNetListRead( const wxString& aNetListFile ); - /** Function OnHotKey. + /** + * Function OnHotKey. * ** Commands are case insensitive ** * Some commands are relatives to the item under the mouse cursor * @param aDC = current device context @@ -265,7 +272,8 @@ public: int aHotkeyCode, EDA_BaseStruct* aItem ); - /** Function OnHotkeyDeleteItem + /** + * Function OnHotkeyDeleteItem * Delete the item found under the mouse cursor * Depending on the current active tool:: * Tool track @@ -280,7 +288,8 @@ public: bool OnHotkeyEditItem( int aIdCommand ); - /** Function OnHotkeyMoveItem + /** + * Function OnHotkeyMoveItem * Moves or drag the item (footprint, track, text .. ) found under the mouse cursor * Only a footprint or a track can be dragged * @param aIdCommand = the hotkey command id @@ -288,7 +297,8 @@ public: */ bool OnHotkeyMoveItem( int aIdCommand ); - /** Function OnHotkeyRotateItem + /** + * Function OnHotkeyRotateItem * Rotate the item (text or footprint) found under the mouse cursor * @param aIdCommand = the hotkey command id * @return true if an item was moved @@ -357,7 +367,8 @@ public: void Show3D_Frame( wxCommandEvent& event ); void GeneralControle( wxDC* DC, wxPoint Mouse ); - /** function ShowDesignRulesEditor + /** + * Function ShowDesignRulesEditor * Display the Design Rules Editor. */ void ShowDesignRulesEditor( wxCommandEvent& event ); @@ -397,7 +408,8 @@ public: void OnSelectOptionToolbar( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event ); - /** Function SaveCopyInUndoList. + /** + * Function SaveCopyInUndoList. * Creates a new entry in undo list of commands. * add a picker to handle aItemToCopy * @param aItemToCopy = the board item modified by the command to undo @@ -410,7 +422,8 @@ public: const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); - /** Function SaveCopyInUndoList (overloaded). + /** + * Function SaveCopyInUndoList (overloaded). * Creates a new entry in undo list of commands. * add a list of pickers to handle a list of items * @param aItemsList = the list of items modified by the command to undo @@ -423,7 +436,8 @@ public: const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); - /** Function PutDataInPreviousState() + /** + * Function PutDataInPreviousState() * Used in undo or redo command. * Put data pointed by List in the previous state, i.e. the state memorized * by List @@ -439,7 +453,8 @@ public: bool aRedoCommand, bool aRebuildRatsnet = true ); - /** Function GetBoardFromRedoList + /** + * Function GetBoardFromRedoList * Redo the last edition: * - Save the current board in Undo list * - Get an old version of the board from Redo list @@ -447,7 +462,8 @@ public: */ void GetBoardFromRedoList( wxCommandEvent& event ); - /** Function GetBoardFromUndoList + /** + * Function GetBoardFromUndoList * Undo the last edition: * - Save the current board in Redo list * - Get an old version of the board from Undo list @@ -533,7 +549,8 @@ public: void OnFileHistory( wxCommandEvent& event ); void Files_io( wxCommandEvent& event ); - /** Function LoadOnePcbFile + /** + * Function LoadOnePcbFile * Load a Kicad board (.brd) file. * * @param aFileName - File name including path. If empty, a file dialog will @@ -564,7 +581,8 @@ public: // BOARD handling - /** function Clear_Pcb() + /** + * Function Clear_Pcb() * delete all and reinitialize the current board * @param aQuery = true to prompt user for confirmation, false to * initialize silently @@ -648,7 +666,8 @@ public: MODULE* ListAndSelectModuleName(); - /** Function ListNetsAndSelect + /** + * Function ListNetsAndSelect * called by a command event * displays the sorted list of nets in a dialog frame * If a net is selected, it is highlighted @@ -681,7 +700,8 @@ public: void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule ); - /** function Exchange_Module + /** + * Function Exchange_Module * Replaces OldModule by NewModule, using OldModule settings: * position, orientation, pad netnames ...) * OldModule is deleted or put in undo list. @@ -699,7 +719,8 @@ public: // Board handling void RemoveStruct( BOARD_ITEM* Item, wxDC* DC ); - /** Function OnEditItemRequest + /** + * Function OnEditItemRequest * Install the corresponding dialog editor for the given item * @param DC = the current device context * @param aItem = a pointer to the BOARD_ITEM to edit @@ -742,7 +763,8 @@ public: void Delete_net( wxDC* DC, TRACK* Track ); void Remove_One_Track( wxDC* DC, TRACK* pt_segm ); - /** function Reset_All_Tracks_And_Vias_To_Netclass_Values + /** + * Function Reset_All_Tracks_And_Vias_To_Netclass_Values * Reset all tracks width and/or vias diameters and drill * to their default Netclass value * @param aTrack : bool true to modify tracks @@ -751,7 +773,8 @@ public: bool Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia ); - /** function Change_Net_Tracks_And_Vias_Sizes + /** + * Function Change_Net_Tracks_And_Vias_Sizes * Reset all tracks width and vias diameters and drill * to their default Netclass value or current values * @param aNetcode : the netcode of the net to edit @@ -761,7 +784,8 @@ public: bool Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue ); - /** Function Edit_Track_Width + /** + * Function Edit_Track_Width * Modify a full track width (using DRC control). * a full track is the set of track segments between 2 ends: pads or a * point that has more than 2 segments ends connected @@ -770,7 +794,8 @@ public: */ void Edit_Track_Width( wxDC* DC, TRACK* Track ); - /** Function Edit_TrackSegm_Width + /** + * Function Edit_TrackSegm_Width * Modify one track segment width or one via diameter (using DRC control). * @param DC = the current device context (can be NULL) * @param aTrackItem = the track segment or via to modify @@ -790,7 +815,8 @@ public: bool Add_45_degrees_Segment( wxDC* DC ); bool Genere_Pad_Connexion( wxDC* DC, int layer ); - /** function EraseRedundantTrack + /** + * Function EraseRedundantTrack * Called after creating a track * Remove (if exists) the old track that have the same starting and the * same ending point as the new created track @@ -807,7 +833,8 @@ public: int aNewTrackSegmentsCount, PICKED_ITEMS_LIST* aItemsListPicker ); - /** Function SetTrackSegmentWidth + /** + * Function SetTrackSegmentWidth * Modify one track segment width or one via diameter (using DRC control). * Basic routine used by other routines when editing tracks or vias * @param aTrackItem = the track segment or via to modify @@ -824,7 +851,8 @@ public: // zone handling - /** Function Delete_Zone_Fill + /** + * Function Delete_Zone_Fill * Remove the zone filling which include the segment aZone, or the zone * which have the given time stamp. A zone is a group of segments which * have the same TimeStamp @@ -835,7 +863,8 @@ public: void Delete_Zone_Fill( SEGZONE* Track, long aTimestamp = 0 ); - /** Function Delete_LastCreatedCorner + /** + * Function Delete_LastCreatedCorner * Used only while creating a new zone outline * Remove and delete the current outline segment in progress * @return 0 if no corner in list, or corner number @@ -857,7 +886,8 @@ public: */ bool End_Zone( wxDC* DC ); - /** Function Fill_Zone() + /** + * Function Fill_Zone() * Calculate the zone filling for the outline zone_container * The zone outline is a frontier, and can be complex (with holes) * The filling starts from starting points like pads, tracks. @@ -868,7 +898,8 @@ public: */ int Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose = TRUE ); - /** Function Fill_All_Zones() + /** + * Function Fill_All_Zones() * Fill all zones on the board * The old fillings are removed * @param verbose = true to show error messages @@ -939,7 +970,8 @@ public: */ void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container ); - /** Function Delete_Zone + /** + * Function Delete_Zone * Remove the zone which include the segment aZone, or the zone which have * the given time stamp. A zone is a group of segments which have the * same TimeStamp @@ -984,7 +1016,8 @@ public: // netlist handling: void InstallNetlistFrame( wxDC* DC, const wxPoint& pos ); - /** Function ReadPcbNetlist + /** + * Function ReadPcbNetlist * Update footprints (load missing footprints and delete on request extra * footprints) * Update connectivity info ( Net Name list ) @@ -1017,7 +1050,8 @@ public: bool aDeleteExtraFootprints, bool aSelect_By_Timestamp ); - /** Function RemoveMisConnectedTracks + /** + * Function RemoveMisConnectedTracks * finds all track segments which are mis-connected (to more than one net). * When such a bad segment is found, mark it as needing to be removed. * and remove all tracks having at least one flagged segment. @@ -1031,12 +1065,14 @@ public: // Autoplacement: void AutoPlace( wxCommandEvent& event ); - /** function OnOrientFootprints + /** + * Function OnOrientFootprints * install the dialog box for the common Orient Footprints */ void OnOrientFootprints( void ); - /** function ReOrientModules + /** + * Function ReOrientModules * Set the orientation of footprints * @param ModuleMask = mask (wildcard allowed) selection * @param Orient = new orientation @@ -1083,7 +1119,8 @@ public: void Begin_Self( wxDC* DC ); MODULE* Genere_Self( wxDC* DC ); - /** function SetLanguage + /** + * Function SetLanguage * called on a language menu selection */ virtual void SetLanguage( wxCommandEvent& event ); diff --git a/include/wxstruct.h b/include/wxstruct.h index 2e9ed16c81..1b8d1d5b97 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -129,13 +129,15 @@ public: // Read/Save and Import/export hotkeys config - /** Function ReadHotkeyConfig + /** + * Function ReadHotkeyConfig * Read configuration data and fill the current hotkey list with hotkeys * @param aDescList = current hotkey list descr. to initialise. */ int ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); - /** Function WriteHotkeyConfig + /** + * Function WriteHotkeyConfig * Store the current hotkey list * It is stored using the standard wxConfig mechanism or a file. * @@ -148,7 +150,8 @@ public: int WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList, wxString * aFullFileName = NULL); - /** Function ReadHotkeyConfigFile + /** + * Function ReadHotkeyConfigFile * Read an old configuration file (.key) and fill the current hotkey list * with hotkeys * @param aFilename = file name to read. @@ -157,19 +160,22 @@ public: int ReadHotkeyConfigFile( const wxString& Filename, struct Ki_HotkeyInfoSectionDescriptor* aDescList ); - /** Function ImportHotkeyConfigFromFile + /** + * Function ImportHotkeyConfigFromFile * Prompt the user for an old hotkey file to read, and read it. * @param aDescList = current hotkey list descr. to initialise. */ void ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); - /** Function ExportHotkeyConfigToFile + /** + * Function ExportHotkeyConfigToFile * Prompt the user for an old hotkey file to read, and read it. * @param aDescList = current hotkey list descr. to initialise. */ void ExportHotkeyConfigToFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); - /** function SetLanguage + /** + * Function SetLanguage * called on a language menu selection * when using a derived function, do not forget to call this one */ @@ -266,7 +272,8 @@ public: virtual void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); - /** Function AddMenuZoomAndGrid (virtual) + /** + * Function AddMenuZoomAndGrid (virtual) * Add standard zoom commands and submenu zoom and grid selection to a popup menu * uses zoom hotkeys info base to add hotkeys info to menu commands * @param aMasterMenu = the menu to populate. @@ -277,7 +284,8 @@ public: void EraseMsgBox(); void Process_PageSettings( wxCommandEvent& event ); virtual void SetToolbars(); - /** function SetLanguage + /** + * Function SetLanguage * called on a language menu selection * when using a derived function, do not forget to call this one */ @@ -287,7 +295,8 @@ public: virtual void ReCreateVToolbar() = 0; virtual void ReCreateMenuBar(); virtual void ReCreateAuxiliaryToolbar(); - /** Function SetToolID + /** + * Function SetToolID * Enables the icon of the selected tool in the vertical toolbar. * (Or tool ID_NO_SELECT_BUTT default if no new selection) * @param aId = new m_ID_current_state value (if aId >= 0) @@ -306,7 +315,8 @@ public: * and /get/set grid color. * These parameters are saved in kicad config for each main frame */ - /** Function IsGridVisible() , virtual + /** + * Function IsGridVisible() , virtual * @return true if the grid must be shown */ virtual bool IsGridVisible() @@ -314,7 +324,8 @@ public: return m_DrawGrid; } - /** Function SetGridVisibility() , virtual + /** + * Function SetGridVisibility() , virtual * It may be overloaded by derived classes * @param aVisible = true if the grid must be shown */ @@ -323,7 +334,8 @@ public: m_DrawGrid = aVisible; } - /** Function GetGridColor() , virtual + /** + * Function GetGridColor() , virtual * @return the color of the grid */ virtual int GetGridColor() @@ -331,7 +343,8 @@ public: return m_GridColor; } - /** Function SetGridColor() , virtual + /** + * Function SetGridColor() , virtual * @param aColor = the new color of the grid */ virtual void SetGridColor(int aColor) @@ -361,13 +374,13 @@ public: virtual void OnZoom( wxCommandEvent& event ); void OnGrid( int grid_type ); void Recadre_Trace( bool ToMouse ); - + /** Adjust the coordinate to the nearest grid value * @param aCoord = coordinate to adjust - * @param aGridSize = pointer to a grid value. if NULL uses the current grid size + * @param aGridSize = pointer to a grid value. if NULL uses the current grid size */ - void PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize = NULL ); - + void PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize = NULL ); + void Zoom_Automatique( bool move_mouse_cursor ); /* Set the zoom level to show the area Rect */ @@ -384,7 +397,8 @@ public: void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen ); - /** Function GetXYSheetReferences + /** + * Function GetXYSheetReferences * Return the X,Y sheet references where the point position is located * @param aScreen = screen to use * @param aPosition = position to identify by YX ref @@ -805,7 +819,8 @@ public: void SetToolNormalBitmap( int id, const wxBitmap& bitmap ) {}; void SetRows( int nRows ) {}; - /** Function GetDimension + /** + * Function GetDimension * @return the dimension of this toolbar (Height if horizontal, Width if vertical. */ int GetDimension( ); diff --git a/kicad/kicad.h b/kicad/kicad.h index 9a09712aaf..b40bbffd87 100644 --- a/kicad/kicad.h +++ b/kicad/kicad.h @@ -77,7 +77,8 @@ public: ~WinEDA_MainFrame(); - /** Function CreateCommandToolbar + /** + * Function CreateCommandToolbar * Create the main buttons (fast launch buttons) */ void OnCloseWindow( wxCloseEvent& Event ); diff --git a/kicad/tree_project_frame.h b/kicad/tree_project_frame.h index 248e770ffc..7d267c83b6 100644 --- a/kicad/tree_project_frame.h +++ b/kicad/tree_project_frame.h @@ -50,13 +50,15 @@ protected: void NewFile( TreeFileType type ); void NewFile( const wxString& name, TreeFileType type, wxTreeItemId& root ); - /** function GetSelectedData + /** + * Function GetSelectedData * return the item data from item currently selected (highlighted) * Note this is not necessary the "clicked" item, * because when expanding, collapsing an item this item is not selected */ TREEPROJECT_ITEM* GetSelectedData(); - /** function GetItemIdData + /** + * Function GetItemIdData * return the item data corresponding to a wxTreeItemId identifier * @param aId = the wxTreeItemId identifier. * @return a TREEPROJECT_ITEM pointer correspondinfg to item id aId @@ -135,7 +137,8 @@ public: #endif - /** function AddFile + /** + * Function AddFile * @brief Add filename "name" to the tree \n * if name is a directory, add the sub directory file names * @param aName = the filename or the dirctory name to add diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index 8e89e5a48c..202e9052fc 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -18,12 +18,24 @@ #include "protos.h" +#define BLOCK_OUTLINE_COLOR YELLOW -#define BLOCK_COLOR BROWN - - -static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, - bool erase ); +/** Function drawPickedItems + * draws items currently selected in a block + * @param aPanel = Current draw panel + * @param aDC = Current device context + * @param aOffset = Drawing offset + **/ +static void drawPickedItems( WinEDA_DrawPanel* aPanel, wxDC* aDC, + wxPoint aOffset ); +/** Function drawMovingBlock + * handles drawing of a moving block + * @param aPanel = Current draw panel + * @param aDC = Current device context + * @param aErase = Erase block at current position + **/ +static void drawMovingBlock( WinEDA_DrawPanel* aPanel, wxDC* aDC, + bool aErase ); static bool Block_Include_Modules = TRUE; @@ -33,7 +45,7 @@ static bool Block_Include_Zones = TRUE; static bool Block_Include_Draw_Items = TRUE; static bool Block_Include_Edges_Items = TRUE; static bool Block_Include_PcbTextes = TRUE; - +static bool BlockDrawItems = TRUE; /************************************/ /* class WinEDA_ExecBlockCmdFrame */ @@ -51,6 +63,7 @@ private: wxCheckBox* m_Include_Draw_Items; wxCheckBox* m_Include_Edges_Items; wxCheckBox* m_Include_PcbTextes; + wxCheckBox* m_DrawBlockItems; public: @@ -150,7 +163,7 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent, fgSizer1->Add( m_Include_Zones, 0, wxALL, 5 ); m_Include_PcbTextes = new wxCheckBox( this, -1, - _( "Include Text on Copper Layers" ), + _( "Include Text Items" ), wxDefaultPosition, wxDefaultSize, 0 ); m_Include_PcbTextes->SetValue( Block_Include_PcbTextes ); @@ -169,6 +182,13 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent, m_Include_Edges_Items->SetValue( Block_Include_Edges_Items ); fgSizer1->Add( m_Include_Edges_Items, 0, wxALL, 5 ); + m_DrawBlockItems = new wxCheckBox( this, -1, + _( "Draw Block Items" ), + wxDefaultPosition, + wxDefaultSize, 0 ); + m_DrawBlockItems->SetValue( BlockDrawItems ); + fgSizer1->Add( m_DrawBlockItems, 0, wxALL, 5 ); + /* Sizer 2 creation */ wxFlexGridSizer* fgSizer2; fgSizer2 = new wxFlexGridSizer( 1, 2, 0, 0 ); @@ -212,6 +232,7 @@ void WinEDA_ExecBlockCmdFrame::ExecuteCommand( wxCommandEvent& event ) Block_Include_Draw_Items = m_Include_Draw_Items->GetValue(); Block_Include_Edges_Items = m_Include_Edges_Items->GetValue(); Block_Include_PcbTextes = m_Include_PcbTextes->GetValue(); + BlockDrawItems = m_DrawBlockItems->GetValue(); EndModal( 0 ); } @@ -328,6 +349,85 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC ) { int endcommande = TRUE; + // If coming here after cancel block, clean up and exit + if( GetScreen()->m_BlockLocate.m_State == STATE_NO_BLOCK ) + { + DrawPanel->ManageCurseur = NULL; + DrawPanel->ForceCloseManageCurseur = NULL; + GetScreen()->m_BlockLocate.m_Flags = 0; + GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; + GetScreen()->m_BlockLocate.ClearItemsList(); + DisplayToolMsg( wxEmptyString ); + return 0; + } + + // Show dialog if there are no selected items and + // we're not zooming + if ( !GetScreen()->m_BlockLocate.GetCount() && + GetScreen()->m_BlockLocate.m_Command != BLOCK_ZOOM ) + { + if( !InstallBlockCmdFrame( this, _( "Block Operation" ) ) ) + { + 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; + GetScreen()->m_BlockLocate.ClearItemsList(); + DisplayToolMsg( wxEmptyString ); + DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); + return 0; + } + DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); + Block_SelectItems(); + // Exit if no items found + if( !GetScreen()->m_BlockLocate.GetCount() ) { + 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; + GetScreen()->m_BlockLocate.ClearItemsList(); + DisplayToolMsg( wxEmptyString ); + return 0; + } + // Move cursor to the center of the smallest rectangle + // containing the centers of all selected items. + // Also set m_BlockLocate to the size of the rectangle. + PICKED_ITEMS_LIST* itemsList = &DrawPanel->GetScreen()->m_BlockLocate.m_ItemsSelection; + wxPoint blockCenter; + int minX, minY, maxX, maxY; + int tempX, tempY; + BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( 0 ); + minX = item->GetPosition().x; + minY = item->GetPosition().y; + maxX = minX; + maxY = minY; + for( unsigned ii = 1; ii < itemsList->GetCount(); ii++ ) + { + item = (BOARD_ITEM*) itemsList->GetPickedItem( ii ); + tempX = item->GetPosition().x; + tempY = item->GetPosition().y; + if( tempX > maxX ) + maxX = tempX; + if( tempX < minX ) + minX = tempX; + if( tempY > maxY ) + maxY = tempY; + if( tempY < minY ) + minY = tempY; + } + blockCenter.x = ( minX + maxX ) / 2; + blockCenter.y = ( minY + maxY ) / 2; + DrawPanel->CursorOff( DC ); + GetScreen()->m_Curseur = blockCenter; + GetScreen()->m_BlockLocate.SetLastCursorPosition( blockCenter ); + GetScreen()->m_BlockLocate.SetOrigin( minX, minY ); + GetScreen()->m_BlockLocate.SetEnd( maxX, maxY ); + DrawPanel->MouseToCursorSchema(); + DrawPanel->CursorOn( DC ); + } + if( DrawPanel->ManageCurseur ) switch( GetScreen()->m_BlockLocate.m_Command ) { @@ -341,35 +441,25 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC ) case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; endcommande = FALSE; - DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); - DrawPanel->ManageCurseur = DrawMovingBlockOutlines; + DrawPanel->ManageCurseur = drawMovingBlock; DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); break; case BLOCK_DELETE: /* Delete */ - - // Turn off the block rectangle now so it is not redisplayed DrawPanel->ManageCurseur = NULL; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; - DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); Block_Delete(); break; case BLOCK_ROTATE: /* Rotation */ - - // Turn off the block rectangle now so it is not redisplayed DrawPanel->ManageCurseur = NULL; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; - DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); Block_Rotate(); break; case BLOCK_FLIP: /* Flip */ - - // Turn off the block rectangle now so it is not redisplayed DrawPanel->ManageCurseur = NULL; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; - DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); Block_Flip(); break; @@ -377,8 +467,6 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC ) GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; if( GetScreen()->m_BlockLocate.GetCount() ) { - DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); - // TODO (if useful) Save_Block( ); } break; @@ -553,49 +641,108 @@ void WinEDA_PcbFrame::Block_SelectItems() } } - -/* Traces the outline of the block structures during move. - */ -static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, - bool erase ) +static void drawPickedItems( WinEDA_DrawPanel* aPanel, wxDC* aDC, + wxPoint aOffset ) { - int Color; - BASE_SCREEN* screen = panel->GetScreen(); - - Color = YELLOW; - - if( erase ) + PICKED_ITEMS_LIST* itemsList = &aPanel->GetScreen()->m_BlockLocate.m_ItemsSelection; + WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) 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 TYPE_MODULE: + { + MODULE* module = (MODULE*) item; + frame->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK; + DrawModuleOutlines( aPanel, aDC, module ); + break; + } + case TYPE_DRAWSEGMENT: + { + DRAWSEGMENT* segment = (DRAWSEGMENT*) item; + segment->Draw( aPanel, aDC, GR_XOR, aOffset ); + break; + } + case TYPE_TEXTE: + { + TEXTE_PCB* text = (TEXTE_PCB*) item; + text->Draw( aPanel, aDC, GR_XOR, aOffset ); + break; + } + case TYPE_TRACK: + case TYPE_VIA: + { + TRACK* track = (TRACK*) item; + track->Draw( aPanel, aDC, GR_XOR, aOffset ); + break; + } + case TYPE_MIRE: + { + MIREPCB* mire = (MIREPCB*) item; + mire->Draw( aPanel, aDC, GR_XOR, aOffset ); + break; + } + case TYPE_DIMENSION: + { + DIMENSION* dimension = (DIMENSION*) item; + dimension->Draw( aPanel, aDC, GR_XOR, aOffset ); + break; + } + case TYPE_ZONE_CONTAINER: + { + ZONE_CONTAINER* zoneContainer = (ZONE_CONTAINER*) item; + zoneContainer->Draw( aPanel, aDC, GR_XOR, aOffset ); + zoneContainer->DrawFilledArea( aPanel, aDC, GR_XOR, aOffset ); + break; + } + // Currently markers are not affected by block commands + case TYPE_MARKER_PCB: + { + MARKER_PCB* pcbMarker = (MARKER_PCB*) item; + pcbMarker->Draw( aPanel, aDC, GR_XOR, aOffset ); + break; + } + } + } + g_Offset_Module = wxPoint( 0, 0 ); +} + +static void drawMovingBlock( WinEDA_DrawPanel* aPanel, wxDC* aDC, + bool aErase ) +{ + BASE_SCREEN* screen = aPanel->GetScreen(); + + if( aErase ) { - screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, - Color ); if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { - screen->m_BlockLocate.Draw( panel, - DC, - screen->m_BlockLocate.m_MoveVector, - g_XorMode, - Color ); + if( !BlockDrawItems ) + screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, + GR_XOR, BLOCK_OUTLINE_COLOR ); + else + drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); } } if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP ) { screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - - screen->m_BlockLocate.GetRight(); + screen->m_BlockLocate.m_BlockLastCursorPosition.x; screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - - screen->m_BlockLocate.GetBottom(); + screen->m_BlockLocate.m_BlockLastCursorPosition.y; } - screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color ); if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { - screen->m_BlockLocate.Draw( panel, - DC, - screen->m_BlockLocate.m_MoveVector, - g_XorMode, - Color ); + if( !BlockDrawItems ) + screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, + GR_XOR, BLOCK_OUTLINE_COLOR ); + else + drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); } } @@ -605,13 +752,6 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, */ void WinEDA_PcbFrame::Block_Delete() { - if( !InstallBlockCmdFrame( this, _( "Delete Block" ) ) ) - return; - - Block_SelectItems(); - if( GetScreen()->m_BlockLocate.GetCount() == 0 ) - return; - OnModify(); SetCurItem( NULL ); @@ -681,13 +821,6 @@ void WinEDA_PcbFrame::Block_Rotate() wxPoint centre; // rotation cent-re for the rotation transform int rotAngle = 900; // rotation angle in 0.1 deg. - if( !InstallBlockCmdFrame( this, _( "Rotate Block" ) ) ) - return; - - Block_SelectItems(); - if( GetScreen()->m_BlockLocate.GetCount() == 0 ) - return; - oldpos = GetScreen()->m_Curseur; centre = GetScreen()->m_BlockLocate.Centre(); @@ -753,13 +886,6 @@ void WinEDA_PcbFrame::Block_Flip() wxPoint memo; wxPoint center; /* Position of the axis for inversion of all elements */ - if( !InstallBlockCmdFrame( this, _( "Flip Block" ) ) ) - return; - - Block_SelectItems(); - if( GetScreen()->m_BlockLocate.GetCount() == 0 ) - return; - OnModify(); PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; @@ -823,13 +949,6 @@ void WinEDA_PcbFrame::Block_Flip() */ void WinEDA_PcbFrame::Block_Move() { - if( !InstallBlockCmdFrame( this, _( "Move Block" ) ) ) - return; - - Block_SelectItems(); - if( GetScreen()->m_BlockLocate.GetCount() == 0 ) - return; - OnModify(); wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector; @@ -893,13 +1012,6 @@ void WinEDA_PcbFrame::Block_Duplicate() { wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector; - if( !InstallBlockCmdFrame( this, _( "Copy Block" ) ) ) - return; - - Block_SelectItems(); - if( GetScreen()->m_BlockLocate.GetCount() == 0 ) - return; - OnModify(); PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index c852d80c03..00b34f4904 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -379,7 +379,8 @@ public: void SetVisibleElementColor( int aPCB_VISIBLE, int aColor ); - /** Function GetBoardDesignSettings + /** + * Function GetBoardDesignSettings * @return the current BOARD_DESIGN_SETTINGS in use */ BOARD_DESIGN_SETTINGS* GetBoardDesignSettings() const @@ -388,7 +389,8 @@ public: } - /** Function SetBoardDesignSettings + /** + * Function SetBoardDesignSettings * @param aDesignSettings = the new BOARD_DESIGN_SETTINGS to use */ void SetBoardDesignSettings( BOARD_DESIGN_SETTINGS* aDesignSettings) @@ -396,7 +398,8 @@ public: m_boardDesignSettings = aDesignSettings; } - /** Function SetBoardSettings + /** + * Function SetBoardSettings * @return the current COLORS_DESIGN_SETTINGS in use */ COLORS_DESIGN_SETTINGS* GetColorsSettings() const @@ -404,7 +407,8 @@ public: return m_colorsSettings; } - /** Function SetColorsSettings + /** + * Function SetColorsSettings * @param aColorsSettings = the new COLORS_DESIGN_SETTINGS to use */ void SetColorsSettings(COLORS_DESIGN_SETTINGS* aColorsSettings) @@ -480,12 +484,14 @@ public: } - /** Function GetNodesCount + /** + * Function GetNodesCount * @return the number of pads members of nets (i.e. with netcode > 0) */ unsigned GetNodesCount(); - /** Function GetPadsCount + /** + * Function GetPadsCount * @return the number of pads in board */ unsigned GetPadsCount() @@ -572,7 +578,8 @@ public: int ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount ); /**************************************/ - /** function relative to NetClasses: **/ + /** + * Function relative to NetClasses: **/ /**************************************/ /** @@ -596,12 +603,14 @@ public: */ bool SetCurrentNetClass( const wxString& aNetClassName ); - /** function GetBiggestClearanceValue + /** + * Function GetBiggestClearanceValue * @return the biggest clearance value found in NetClasses list */ int GetBiggestClearanceValue(); - /** function GetCurrentTrackWidth + /** + * Function GetCurrentTrackWidth * @return the current track width, according to the selected options * ( using the default netclass value or a preset value ) * the default netclass is always in m_TrackWidthList[0] @@ -612,7 +621,8 @@ public: } - /** function GetCurrentViaSize + /** + * Function GetCurrentViaSize * @return the current via size, according to the selected options * ( using the default netclass value or a preset value ) * the default netclass is always in m_TrackWidthList[0] @@ -623,7 +633,8 @@ public: } - /** function GetCurrentViaDrill + /** + * Function GetCurrentViaDrill * @return the current via size, according to the selected options * ( using the default netclass value or a preset value ) * the default netclass is always in m_TrackWidthList[0] @@ -635,13 +646,15 @@ public: } - /** function GetCurrentMicroViaSize + /** + * Function GetCurrentMicroViaSize * @return the current micro via size, * that is the current netclass value */ int GetCurrentMicroViaSize(); - /** function GetCurrentMicroViaDrill + /** + * Function GetCurrentMicroViaDrill * @return the current micro via drill, * that is the current netclass value */ @@ -775,7 +788,8 @@ public: /* Functions used in test, merge and cut outlines */ - /** Function AddArea + /** + * Function AddArea * Add an empty copper area to board areas list * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands) * can be NULL @@ -874,7 +888,8 @@ public: bool bMessageBox, bool bUseUtility ); - /** Function RemoveArea + /** + * Function RemoveArea * remove copper area from net, and put it in a deleted list (if exists) * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands * can be NULL diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 712b9fd9c5..efca922f9c 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -532,8 +532,8 @@ void DIMENSION::Draw( WinEDA_DrawPanel* panel, wxDC* DC, { int ox, oy, typeaff, width, gcolor; - ox = offset.x; - oy = offset.y; + ox = -offset.x; + oy = -offset.y; m_Text->Draw( panel, DC, mode_color, offset ); diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 865d049ebe..aea6a8a9b6 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -40,7 +40,8 @@ public: */ void SetLayer( int aLayer ); - /** function AdjustDimensionDetails + /** + * Function AdjustDimensionDetails * Calculate coordinates of segments used to draw the dimension. * @param aDoNotChangeText (bool) if false, the dimension text is initialized */ diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index d146be4aab..5b23015de6 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -229,7 +229,7 @@ wxPoint DRAWSEGMENT::GetEnd() const void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, - int draw_mode, const wxPoint& notUsed ) + int draw_mode, const wxPoint& aOffset ) { int ux0, uy0, dx, dy; int l_piste; @@ -246,12 +246,12 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, l_piste = m_Width >> 1; /* half trace width */ // Line start point or Circle and Arc center - ux0 = m_Start.x; - uy0 = m_Start.y; + ux0 = m_Start.x + aOffset.x; + uy0 = m_Start.y + aOffset.y; // Line end point or circle and arc start point - dx = m_End.x; - dy = m_End.y; + dx = m_End.x + aOffset.x; + dy = m_End.y + aOffset.y; mode = DisplayOpt.DisplayDrawItems; if( m_Flags & FORCE_SKETCH ) diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index 92a4b1abd2..db12c2a666 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -65,7 +65,7 @@ public: void Draw( WinEDA_DrawPanel* panel, wxDC* DC, - int aDrawMode, const wxPoint& offset = ZeroOffset ); + int aDrawMode, const wxPoint& aOffset = ZeroOffset ); /** * Function DisplayInfo @@ -145,7 +145,8 @@ public: */ virtual void Flip( const wxPoint& aCentre ); - /** Function TransformShapeWithClearanceToPolygon + /** + * Function TransformShapeWithClearanceToPolygon * Convert the track shape to a closed polygon * Used in filling zones calculations * Circles and arcs are approximated by segments diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index b5bb8cd7ee..214bfea4c9 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -103,7 +103,8 @@ public: } - /** Function TransformShapeWithClearanceToPolygon + /** + * Function TransformShapeWithClearanceToPolygon * Convert the track shape to a closed polygon * Used in filling zones calculations * Circles and arcs are approximated by segments diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index 81cf24f304..7bb2141810 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -65,7 +65,8 @@ public: */ virtual void Flip(const wxPoint& aCentre ); - /** Function Draw + /** + * Function Draw */ void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset = ZeroOffset ) { @@ -82,7 +83,8 @@ public: } - /** Function HitTest + /** + * Function HitTest * @return true if the point aPosRef is within item area * @param aPosRef = a wxPoint to test */ diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index ba86b7a24f..0873afce3d 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -115,7 +115,8 @@ public: */ void Set_Rectangle_Encadrement(); - /** function SetRectangleExinscrit() + /** + * Function SetRectangleExinscrit() * Calculates the real bounding box according to the board position, * and real orientation and also calculates the area value (used in * automatic placement) @@ -217,7 +218,8 @@ public: /* drawing functions */ - /** Function Draw + /** + * Function Draw * Draw the text according to the footprint pos and orient * @param panel = draw panel, Used to know the clip box * @param DC = Current Device Context diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 8393c7bacb..58b78d23f9 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -57,7 +57,8 @@ public: } - /** function Draw + /** + * Function Draw */ void Draw( WinEDA_DrawPanel* panel, wxDC* DC, @@ -85,7 +86,8 @@ public: public: NETINFO_LIST( BOARD* aParent ); ~NETINFO_LIST(); - /** Function GetItem + /** + * Function GetItem * @param aNetcode = netcode to identify a given NETINFO_ITEM * @return a NETINFO_ITEM pointer to the selected NETINFO_ITEM by its * netcode, or NULL if not found @@ -105,18 +107,21 @@ public: NETINFO_LIST( BOARD* aParent ); */ void AppendNet( NETINFO_ITEM* aNewElement ); - /** Function DeleteData + /** + * Function DeleteData * delete the list of nets (and free memory) */ void DeleteData(); - /** Function BuildListOfNets + /** + * Function BuildListOfNets * Build or rebuild the list of NETINFO_ITEM m_NetBuffer * The list is sorted by names. */ void BuildListOfNets(); - /** Function GetPadsCount + /** + * Function GetPadsCount * @return the number of pads in board */ unsigned GetPadsCount() @@ -125,7 +130,8 @@ public: NETINFO_LIST( BOARD* aParent ); } - /** Function GetPad + /** + * Function GetPad * @return the pad idx from m_PadsFullList */ D_PAD* GetPad( unsigned aIdx ) @@ -139,7 +145,8 @@ public: NETINFO_LIST( BOARD* aParent ); private: - /** Function Build_Pads_Full_List + /** + * Function Build_Pads_Full_List * Create the pad list * initialise: * m_Pads (list of pads) @@ -322,7 +329,8 @@ public: bool Save( FILE* aFile ) const; - /** function Draw + /** + * Function Draw * @todo we actually could show a NET, simply show all the tracks and * a pads or net name on pad and vias */ diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index ceb15010ee..f73fff14f1 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -166,7 +166,8 @@ public: m_Pos = aPos; } - /** function TransformShapeWithClearanceToPolygon + /** + * Function TransformShapeWithClearanceToPolygon * Convert the pad shape to a closed polygon * Used in filling zones calculations * Circles and arcs are approximated by segments @@ -193,7 +194,8 @@ public: // Mask margins handling: - /** Function GetSolderMaskMargin + /** + * Function GetSolderMaskMargin * @return the margin for the solder mask layer * usually > 0 (mask shape bigger than pad * value is @@ -203,7 +205,8 @@ public: */ int GetSolderMaskMargin(); - /** Function GetSolderPasteMargin + /** + * Function GetSolderPasteMargin * @return the margin for the solder mask layer * usually < 0 (mask shape smaller than pad * because the margin can be dependent on the pad size, the margin has a x and a y value @@ -232,13 +235,15 @@ public: void Draw3D( Pcb3D_GLCanvas* glcanvas ); - /** function DrawShape + /** + * Function DrawShape * basic function to draw a pad. * used by Draw after calculation of parameters (color, ) final orientation ... */ void DrawShape( EDA_Rect* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ); - /** function BuildPadPolygon + /** + * Function BuildPadPolygon * Has meaning only for polygonal pads (trapezoid and rectangular) * Build the Corner list of the polygonal shape, * depending on shape, extra size (clearance ...) and orientation @@ -248,7 +253,8 @@ public: */ void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const; - /** function BuildSegmentFromOvalShape + /** + * Function BuildSegmentFromOvalShape * Has meaning only for OVAL (and ROUND) pads * Build an equivalent segment having the same shape as the OVAL shape, * Useful in draw function and in DRC and HitTest functions, diff --git a/pcbnew/class_pcb_layer_widget.h b/pcbnew/class_pcb_layer_widget.h index 1f54b4440b..9c1c3dbc7a 100644 --- a/pcbnew/class_pcb_layer_widget.h +++ b/pcbnew/class_pcb_layer_widget.h @@ -75,7 +75,8 @@ public: void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ); void OnRenderColorChange( int aId, int aColor ); void OnRenderEnable( int aId, bool isEnabled ); - /** Function SetLayersManagerTabsText + /** + * Function SetLayersManagerTabsText * Update the layer manager tabs labels * Useful when changing Language or to set labels to a non default value */ diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index 8abae5efdb..7a0bd5c389 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -111,7 +111,8 @@ public: return wxT("PTEXT"); } - /** Function TransformShapeWithClearanceToPolygon + /** + * Function TransformShapeWithClearanceToPolygon * Convert the track shape to a closed polygon * Used in filling zones calculations * Circles and arcs are approximated by segments diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index cbc74d8144..90d63ee7fb 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -50,7 +50,8 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); int GetDrawRotation(); // Return text rotation for drawings and // plotting - /** Function GetTextRect + /** + * Function GetTextRect * @return an EDA_Rect which gives the position and size of the text area * (for the 0 orient text and footprint) */ diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 3cbb7ea3aa..63544ae0ee 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -554,7 +554,8 @@ bool TRACK::Save( FILE* aFile ) const /*********************************************************************/ -void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& notUsed ) +void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, + const wxPoint& aOffset ) /*********************************************************************/ { int l_piste; @@ -610,7 +611,8 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN ) #endif { - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color ); + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, rayon, color ); } else { @@ -621,16 +623,20 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin if( panel->GetScreen()->Scale( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */ #endif { - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color ); + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, rayon, color ); } else if( ( !DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) ) { - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon - l_piste, color ); - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon + l_piste, color ); + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, rayon - l_piste, color ); + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, rayon + l_piste, color ); } else { - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, rayon, m_Width, color ); } } @@ -643,20 +649,23 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN ) #endif { - GRLine( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, - m_End.x, m_End.y, 0, color ); + GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, + m_End.x + aOffset.x, m_End.y + aOffset.y, 0, color ); return; } if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) { - GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, - m_End.x, m_End.y, m_Width, color ); + GRCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, + m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color ); } else { - GRFillCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, - m_End.x, m_End.y, m_Width, color ); + GRFillCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, + m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color ); } if( panel->GetScreen()->m_IsPrinting ) @@ -665,8 +674,9 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin // Show clearance for tracks, not for zone segments if( ShowClearance( this ) ) { - GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, - m_End.x, m_End.y, + GRCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, + m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width + (GetClearance() * 2), color ); } @@ -683,10 +693,12 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin return; #define THRESHOLD 10 - if( (m_End.x - m_Start.x) != 0 && (m_End.y - m_Start.y) != 0 ) + if( (m_End.x - m_Start.x) != 0 + && (m_End.y - m_Start.y) != 0 ) return; - int len = ABS( (m_End.x - m_Start.x) + (m_End.y - m_Start.y) ); + int len = ABS( (m_End.x - m_Start.x) + + (m_End.y - m_Start.y) ); if( len < THRESHOLD * m_Width ) return; @@ -738,7 +750,8 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin /*******************************************************************************************/ -void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& notUsed ) +void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, + const wxPoint& aOffset ) /*******************************************************************************************/ { int color; @@ -811,14 +824,17 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi } if( fillvia ) - GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, 0, color, color ); + GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, rayon, 0, color, color ); else { - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color ); + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, rayon, color ); if ( fast_draw ) return; - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, inner_rayon, color ); } @@ -850,8 +866,8 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi #else if( screen->Scale( drill_rayon ) > 1 ) /* draw hole if its size is enought */ #endif - GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x, - m_Start.y, drill_rayon, 0, color, color ); + GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, drill_rayon, 0, color, color ); if( screen->m_IsPrinting ) GRForceBlackPen( blackpenstate ); @@ -859,14 +875,16 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi else { if( drill_rayon < inner_rayon ) // We can show the via hole - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, drill_rayon, color ); } } } if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS ) - GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, + GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x, + m_Start.y + aOffset.y, rayon + GetClearance(), color ); // for Micro Vias, draw a partial cross : @@ -888,16 +906,24 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi } /* lines | or \ */ - GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay, - m_Start.x - bx, m_Start.y - by, 0, color ); - GRLine( &panel->m_ClipBox, DC, m_Start.x + bx, m_Start.y + by, - m_Start.x + ax, m_Start.y + ay, 0, color ); + GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax, + m_Start.y + aOffset.y - ay, + m_Start.x + aOffset.x - bx, + m_Start.y + aOffset.y - by, 0, color ); + GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x + bx, + m_Start.y + aOffset.y + by, + m_Start.x + aOffset.x + ax, + m_Start.y + aOffset.y + ay, 0, color ); /* lines - or / */ - GRLine( &panel->m_ClipBox, DC, m_Start.x + ay, m_Start.y - ax, - m_Start.x + by, m_Start.y - bx, 0, color ); - GRLine( &panel->m_ClipBox, DC, m_Start.x - by, m_Start.y + bx, - m_Start.x - ay, m_Start.y + ax, 0, color ); + GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x + ay, + m_Start.y + aOffset.y - ax, + m_Start.x + aOffset.x + by, + m_Start.y + aOffset.y - bx, 0, color ); + GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - by, + m_Start.y + aOffset.y + bx, + m_Start.x + aOffset.x - ay, + m_Start.y + aOffset.y + ax, 0, color ); } // for Buried Vias, draw a partial line : @@ -913,15 +939,19 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi /* lines for the top layer */ RotatePoint( &ax, &ay, layer_top * 3600 / brd->GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_top * 3600 / brd->GetCopperLayerCount( ) ); - GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay, - m_Start.x - bx, m_Start.y - by, 0, color ); + GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax, + m_Start.y + aOffset.y - ay, + m_Start.x + aOffset.x - bx, + m_Start.y + aOffset.y - by, 0, color ); /* lines for the bottom layer */ ax = 0; ay = rayon; bx = 0; by = drill_rayon; RotatePoint( &ax, &ay, layer_bottom * 3600 / brd->GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_bottom * 3600 / brd->GetCopperLayerCount( ) ); - GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay, - m_Start.x - bx, m_Start.y - by, 0, color ); + GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax, + m_Start.y + aOffset.y - ay, + m_Start.x + aOffset.x - bx, + m_Start.y + aOffset.y - by, 0, color ); } // Display the short netname: diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 364b8a9264..94faf2d8c8 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -144,12 +144,13 @@ public: /* Display on screen: */ - void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset ); + void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& aOffset = ZeroOffset ); /* divers */ int Shape() const { return m_Shape & 0xFF; } - /** Function TransformShapeWithClearanceToPolygon + /** + * Function TransformShapeWithClearanceToPolygon * Convert the track shape to a closed polygon * Used in filling zones calculations * Circles (vias) and arcs (ends of tracks) are approximated by segments @@ -341,7 +342,7 @@ public: } - void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset ); + void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& aOffset = ZeroOffset ); /** diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index ee2d771052..9ddadaf33b 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -133,7 +133,8 @@ public: */ void Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD* aPcb ); - /** function CalculateSubAreaBoundaryBox + /** + * Function CalculateSubAreaBoundaryBox * Calculates the bounding box of a a filled area ( list of CPolyPt ) * use m_FilledPolysList as list of CPolyPt (that are the corners of one or more polygons or filled areas ) * @return an EDA_Rect as bounding box @@ -177,7 +178,8 @@ public: */ bool HitTestFilledArea( const wxPoint& aRefPos ); - /** function BuildFilledPolysListData + /** + * Function BuildFilledPolysListData * Build m_FilledPolysList data from real outlines (m_Poly) * in order to have drawable (and plottable) filled polygons * drawable filled polygons are polygons without hole @@ -188,7 +190,8 @@ public: */ int BuildFilledPolysListData( BOARD* aPcb ); - /** function AddClearanceAreasPolygonsToPolysList + /** + * Function AddClearanceAreasPolygonsToPolysList * Add non copper areas polygons (pads and tracks with clearence) * to a filled copper area * used in BuildFilledPolysListData when calculating filled areas in a zone @@ -200,14 +203,16 @@ public: */ void AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ); - /** Function CopyPolygonsFromBoolengineToFilledPolysList + /** + * Function CopyPolygonsFromBoolengineToFilledPolysList * Copy (Add) polygons created by kbool (after Do_Operation) to m_FilledPolysList * @param aBoolengine = the kbool engine used in Do_Operation * @return the corner count */ int CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aBoolengine ); - /** Function CopyPolygonsFromFilledPolysListToBoolengine + /** + * Function CopyPolygonsFromFilledPolysListToBoolengine * Copy (Add) polygons created by kbool (after Do_Operation) to m_FilledPolysList * @param aBoolengine = kbool engine * @param aGroup = group in kbool engine (GROUP_A or GROUP_B only) @@ -253,7 +258,8 @@ public: */ int Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE ); - /** Function Fill_Zone_Areas_With_Segments() + /** + * Function Fill_Zone_Areas_With_Segments() * Fill sub areas in a zone with segments with m_ZoneMinThickness width * A scan is made line per line, on the whole filled areas, with a step of m_ZoneMinThickness. * all intersecting points with the horizontal infinite line and polygons to fill are calculated @@ -353,7 +359,8 @@ public: { return m_Poly->GetHatchStyle(); } - /** function IsSame() + /** + * Function IsSame() * test is 2 zones are equivalent: * 2 zones are equivalent if they have same parameters and same outlines * info relative to filling is not take in account diff --git a/pcbnew/class_zone_setting.h b/pcbnew/class_zone_setting.h index 93d0cb2a49..082728bd8a 100644 --- a/pcbnew/class_zone_setting.h +++ b/pcbnew/class_zone_setting.h @@ -26,13 +26,15 @@ public: public: ZONE_SETTING( void ); - /** function ImportSetting + /** + * Function ImportSetting * copy settings from a given zone * @param aSource: the given zone */ void ImportSetting( const ZONE_CONTAINER& aSource ); - /** function ExportSetting + /** + * Function ExportSetting * copy settings to a given zone * @param aTarget: the given zone * @param aFullExport: if false: some parameters are NOT exported diff --git a/pcbnew/dialog_export_3Dfiles_base.fbp b/pcbnew/dialog_export_3Dfiles_base.fbp index 3b5c0f1bcf..f48396c50a 100644 --- a/pcbnew/dialog_export_3Dfiles_base.fbp +++ b/pcbnew/dialog_export_3Dfiles_base.fbp @@ -1,8 +1,8 @@ - + - + C++ 1 UTF-8 @@ -12,64 +12,64 @@ none 1 dialog_export_3Dfiles - + . - + 1 1 0 - - - + + + 1 - - - + + + 0 wxID_ANY - - + + DIALOG_EXPORT_3DFILE_BASE - + 370,252 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + Vrml Board Export Options: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1,-1 bSizer1 @@ -89,50 +89,50 @@ wxTOP|wxRIGHT|wxLEFT 0 - - + + 1 - - + + 0 wxID_ANY Vrml main file filename: - - + + m_staticText1 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -140,52 +140,52 @@ wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 - - + + 1 - - + + 0 wxID_ANY - + Save VRML Board File -1,-1 m_filePicker protected - - + + wxFLP_SAVE|wxFLP_USE_TEXTCTRL - - - + + + *.wrl - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -193,50 +193,50 @@ wxTOP|wxRIGHT|wxLEFT 0 - - + + 1 - - + + 0 wxID_ANY Vrml 3D footprints shapes subdir: - - + + m_staticText3 protected - - - - - - - - + + + + + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -244,54 +244,54 @@ wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 - - + + 1 - - + + 0 wxID_ANY - + 0 - + m_SubdirNameCtrl protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -301,7 +301,7 @@ wxEXPAND 1 - + bLowerSizer wxHORIZONTAL none @@ -310,53 +310,53 @@ wxALL|wxEXPAND 1 - + "Inch" "mm" "Meter" - + 1 - - + + 0 wxID_ANY Units: 1 - - + + m_rbSelectUnits protected - + 0 - + wxRA_SPECIFY_COLS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -364,53 +364,53 @@ wxALL|wxEXPAND 1 - + "Copy 3D Shapes Files in Subdir" "Use Absolute Path in Vrml File " - + 1 - - + + 0 wxID_ANY 3D Shapes Files Option: 1 - - + + m_rb3DFilesOption protected - + 1 - + wxRA_SPECIFY_COLS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -420,48 +420,48 @@ wxEXPAND|wxRIGHT|wxLEFT 0 - - + + 1 - - + + 0 wxID_ANY - - + + m_staticline1 protected - - + + wxLI_HORIZONTAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -477,17 +477,17 @@ 1 0 0 - + m_sdbSizer1 protected - + OnCancelClick - - - + + + OnOkClick - - + + diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index d7af3f6f38..06604425d3 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -48,7 +48,8 @@ public: void Show3D_Frame( wxCommandEvent& event ); void GeneralControle( wxDC* DC, wxPoint Mouse ); - /** function LoadModuleFromBoard + /** + * Function LoadModuleFromBoard * called from the main toolbar * to load a footprint from board mainly to edit it */ @@ -62,7 +63,8 @@ public: */ virtual void OnModify( ); - /** function ToPrinter + /** + * Function ToPrinter * Install the print dialog */ void ToPrinter( wxCommandEvent& event ); @@ -82,7 +84,8 @@ public: // BOARD handling - /** function Clear_Pcb() + /** + * Function Clear_Pcb() * delete all and reinitialize the current board * @param aQuery = true to prompt user for confirmation, false to * initialize silently @@ -99,7 +102,8 @@ public: /* Undo and redo functions */ public: - /** Function SaveCopyInUndoList. + /** + * Function SaveCopyInUndoList. * Creates a new entry in undo list of commands. * add a picker to handle aItemToCopy * @param aItem = the board item modified by the command to undo @@ -112,7 +116,8 @@ public: const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); - /** Function SaveCopyInUndoList (overloaded). + /** + * Function SaveCopyInUndoList (overloaded). * Creates a new entry in undo list of commands. * add a list of pickers to handle a list of items * @param aItemsList = the list of items modified by the command to undo @@ -151,14 +156,16 @@ public: MODULE* Import_Module( ); - /** function Load_Module_From_BOARD + /** + * Function Load_Module_From_BOARD * load in Modedit a footfrint from the main board * @param Module = the module to load. If NULL, a module reference will we asked to user * @return true if a module isloaded, false otherwise. */ bool Load_Module_From_BOARD( MODULE* Module ); - /** Function Select_1_Module_From_BOARD + /** + * Function Select_1_Module_From_BOARD * Display the list of modules currently existing on the BOARD * @return a pointer to a module if this module is selected or NULL otherwise * @param aPcb = the board from modules can be loaded @@ -167,7 +174,8 @@ public: // functions to edit footprint edges - /** Function Edit_Edge_Width + /** + * Function Edit_Edge_Width * changes the width of module perimeter lines, EDGE_MODULEs. * param ModuleSegmentWidth (global) = new width * @param aEdge = edge to edit, or NULL. If aEdge == NULL change @@ -178,7 +186,8 @@ public: void Delete_Edge_Module( EDGE_MODULE* Edge ); EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge ); void End_Edge_Module( EDGE_MODULE* Edge ); - /** function Enter_Edge_Width + /** + * Function Enter_Edge_Width * Edition of the edge items width * Ask for a new width. * Change the width of EDGE_MODULE Edge if aEdge != NULL diff --git a/polygon/PolyLine.h b/polygon/PolyLine.h index 1a1785ff71..1886445290 100644 --- a/polygon/PolyLine.h +++ b/polygon/PolyLine.h @@ -23,10 +23,10 @@ // inflection modes for DS_LINE and DS_LINE_VERTEX, used in math_for_graphics.cpp enum { - IM_NONE = 0, - IM_90_45, - IM_45_90, - IM_90 + IM_NONE = 0, + IM_90_45, + IM_45_90, + IM_90 }; @@ -181,7 +181,8 @@ public: // KBOOL functions - /** Function AddPolygonsToBoolEng + /** + * Function AddPolygonsToBoolEng * and edges contours to a kbool engine, preparing a boolean op between polygons * @param aStart_contour: starting contour number (-1 = all, 0 is the outlines of zone, > 1 = holes in zone * @param aEnd_contour: ending contour number (-1 = all after aStart_contour) @@ -195,7 +196,8 @@ public: int aEnd_contour = -1, std::vector * arc_array = NULL ); - /** Function MakeKboolPoly + /** + * Function MakeKboolPoly * fill a kbool engine with a closed polyline contour * approximates arcs with multiple straight-line segments * @param aStart_contour: starting contour number (-1 = all, 0 is the outlines of zone, > 1 = holes in zone @@ -213,7 +215,8 @@ public: std::vector * arc_array = NULL, bool aConvertHoles = false); - /** Function NormalizeWithKbool + /** + * Function NormalizeWithKbool * Use the Kbool Library to clip contours: if outlines are crossing, the self-crossing polygon * is converted to non self-crossing polygon by adding extra points at the crossing locations * and reordering corners @@ -226,11 +229,13 @@ public: */ int NormalizeWithKbool( std::vector * aExtraPolyList, bool bRetainArcs ); - /** function GetKboolEngine + /** + * Function GetKboolEngine * @return the current used Kbool Engine (after normalization using kbool) */ Bool_Engine* GetKboolEngine( ) { return m_Kbool_Poly_Engine; } - /** function FreeKboolEngine + /** + * Function FreeKboolEngine * delete the current used Kbool Engine (free memory after normalization using kbool) */ void FreeKboolEngine( ) { delete m_Kbool_Poly_Engine; m_Kbool_Poly_Engine = NULL; }