Commit Graph

138 Commits

Author SHA1 Message Date
Dick Hollenbeck c63fa6ff31 Add EDA_BASE_FRAME::Show() and call SaveSettings() only from there for all derived wxFrames. Remove calls to SaveSettings() elsewhere. 2014-01-27 19:29:26 -06:00
Dick Hollenbeck 7ba078b620 remove USE_FP_LIB_TABLE code, make it the norm. Add lazy loading support to FOOTPRINT_INFO. 2013-12-12 10:01:03 -06:00
Dick Hollenbeck b0c739e7ee *) Implement "Copy On Write" (COW) support in GITHUB_PLUGIN. See class header
comment for GITHUB_PLUGIN which should flow into Doxygen output.
*) Rewrote: 
        PCB_BASE_FRAME::Save_Module_In_Library(): now uses fp-lib-table and PROPERTIES.  
        PCB_EDIT_FRAME::ArchiveModulesOnBoard(): now can archive to any writable library type.
        PCB_BASE_FRAME::SelectLibrary(): is now generic for selecting a library, not just the active library.
2013-11-27 00:04:04 -06:00
Dick Hollenbeck f3ad2463e2 *) Switch to later environment variable expansion in fp-lib-table.
*) Save library nickname in APP so upon module editor re-entry last is re-used.
*) Fix bug editing fp-lib-table Description field.
2013-11-19 11:24:45 -06:00
Orson 28b9317640 Fix redraw issue in modedit a modview, with GAL 2013-11-01 13:56:20 +01:00
Wayne Stambaugh 612ba67c10 Minor message box improvements
* Create a generic yes/no/cancel dialog from DIALOG_EXIT.
* Make DIALOG_EXIT return wxID_YES instead of wxID_OK so it is consistent
  with the standard message dialogs.
* Add missing license to confirm.h and confirm.cpp.
* Change Eeschema message dialog when loading a schematic if the current
  schematic is modified to be more consistent with the exit dialog.
* Change Pcbnew message dialog when loading a board if the current board
  is modified to be more consistent with the exit dialog.
* Remove some Eeschema block debug logging code left over from my last
  commit.
2013-10-18 09:32:22 -04:00
Dick Hollenbeck 3869cf4e10 Planning for PCB_BASE_FRAME::Save_Module_In_Library and PCB_EDIT_FRAME::ArchiveModulesOnBoard rewrites 2013-10-14 11:54:00 -05:00
Dick Hollenbeck afd6f292e7 *) Switch over to FP_LIB_TABLE::Footprint*() functions.
*) Set environment variable KISYSMOD before loading FP_LIB_TABLE so that
   FP_LIB_TABLE::ROW::SetFullURI() can do substitution up front.
*) De-emphasize the lib path in some of the footprint frames but keep it
   so the footprint editor can export a current library to another.
   You can even export a GITHUB library to a pretty library for local 
   installation.
*) Start the PLUGIN options editor.
*) Enhance cursor positioning in DIALOG_FP_LIB_TABLE.
2013-10-13 16:33:58 -05:00
Wayne Stambaugh 8580d87ef7 Footprint library table improvements.
* Add save table and set project path environment variable code to
  FP_LIB_TABLE object.
* Add code to Pcbnew and CvPcb to set project path environment variable.
* Create empty footprint table in Pcbnew when new board created.
* Save current project specific footprint library table to path on file save
  as or empty project path.
* Fix a bug in Pcbnew in file save function that would silently overwrite
  an existing board file.
* Disable selecting the current library in the module editor when there are
  no libraries defined.
* Catch exceptions and report errors when writing footprint library tables.
* Fix Boost build CMakeFile to fix bug when bootstrapping a Boost build in
  MSys.
2013-10-13 12:29:20 -04:00
jean-pierre charras 36ae78ff94 pcbnew: fix wxWidgets 2.8 compatibility issue (temporary fix, still have a minor cosmetic issue), and add missing file. 2013-09-03 21:37:52 +02:00
Dick Hollenbeck efb34166ea *) retain grid origin in the BOARD and save it in legacy and kicad board files.
*) add hotkey for setting the grid origin as 'S', in board editor, module editor.
*) re-position the function interface for cursor movement from BASE_SCREEN into
   class EDA_DRAW_FRAME.  This is a prelude to getting rid of BASE_SCREEN or
   splitting it up.
2013-08-03 00:15:23 -05:00
Wayne Stambaugh 5560cb54e2 More Pcbnew footprint library table work in progress.
* Add footprint library table loading to footprint editor.
* Overload FOOTPRINT_INFO::ReadFootprintFiles() to read footprints from the
  footprint library tables.
* Fix a bug in FP_LIB_TABLE::IsEmpty() when the table has a fallback table.
* Add code to FOOTPRINT_EDIT_FRAME to use footprint library tables.
* Add an optional build time version of PCB_EDIT_FRAME::loadFootprints() to
  populate netlist footprints from footprint library table.
* Remove adding footprints to board whenever GetModuleLibrary() is called and
  move loading locally as required.
* Add missing source file license comments and coding policy fixes.
2013-05-28 12:54:59 -04:00
Wayne Stambaugh 42d7bf6c8e Pcbnew encapsulation and code cleaning.
* Encapsulate most of the MODULE class.
* Start encapsulating the DIMENSION class.
* Lay some groundwork for EDA_TEXT encapsulation.
* Move cleverly hidden MODULE functions into class_module.cpp.
* Use std::swap to exchange TEXTE_PCB values for undo/redo.
* Remove unused members from MODULE class.
* The usual coding policy and documentation fixes.
2013-03-13 14:53:58 -04:00
jean-pierre charras c8ed3280f3 Pcbnew: Fix many minor issues in print dialog, mainly in modedit. 2013-03-12 16:17:44 +01:00
Jacobo Aragunde Perez da757938e6 Commit patch for bug 1116059 (Inconsistency between confirmation dialogs) 2013-02-07 18:35:37 +01:00
jean-pierre charras 7b8c89149b Pcbnew: Fix Bug #1097345 <module editor "change body item width (current)" does nothing.> 2013-01-19 13:58:54 +01:00
Wayne Stambaugh f8a56d446f Base object decoupling improvements.
* Improve MSG_PANEL_ITEM to handle message panel information.
* Create containers for passing message panel items between objects and
  the message panel.
* Rename EDA_ITEM::DisplayInfo to EDA_ITEM::GetMsgPanelInfo.
* Remove all direct manipulation of EDA_DRAW_FRAME from all objects derived
  from EDA_ITEM.
2013-01-12 12:32:24 -05:00
Dick Hollenbeck 2aa27122b0 Eliminate many assumptions in Pcbnew's library manager, pertaining to locality of libraries and
their type, by using the more abstract PLUGIN::Footprint*() functions.

This is an intermediate phase only, other changes will be necessary as library table support comes in.
Encapsulate usage of library path searching, since that will go away as library table support comes in.
Add FOOTPRINT_EDIT_FRAME::{get,set}LibPath() and FOOTPRINT_EDIT_FRAME::{get,set}LibNickName() functions
to provide this encapsulation.
2012-11-19 10:19:38 -06:00
Wayne Stambaugh 1468a4ae31 Pcbnew s-experssion footprint library implementation.
* Add footprint methods to PCB_IO.
* Add FP_CACHE and FP_CACHE_ITEM for handling new footprint library design.
* Add code to save legacy libraries in new format.
* Change behavior of BOARD_ITEM::GetLayerName() to return the default layer
  name when the item does not have a BOARD as a parent.
* Minor changes to the module output formatter when writing to module library
  files (no BOARD as parent).
* Add new (and some that I forgot along the way) CMake flags to
  EDA_BASE_FRAME::CopyVersionInfoToClipboard().
* Add -Wno-narrowing to GCC flags to stop GCC 4.7 from complaining about
  a conversion from int to unsigned in the Boost polygon library.
* Add INPUT_STREAM_READER to richio.cpp to allow using any object derived
  from wxInputStream as a LINE_READER (needs to be validated).
2012-10-07 11:37:25 -04:00
jean-pierre charras 93ebdb2cd0 All: better code to handle opened frames libview, libedit, modview, modedit.
Other minor fixes.
2012-09-12 11:53:11 +02:00
jean-pierre charras b810135e4e Code cleaning, minor fixes and minor coding style fixes. wxWidgets 2.9.4 compatibility fix( deprecated function MakeModal ) 2012-09-11 21:03:21 +02:00
jean-pierre charras 37ee239449 Pcbnew: in SVG export, add option to export only the board area, not the full page.
dialog plot functions: fix compil warnings with wxWidgets 2.8
2012-08-31 09:43:37 +02:00
jean-pierre charras abe5c08e20 3D-viewer: code cleaning. Added option in menu: show a 3D grid.
All: press ctrl+shift key when moving the mouse allows the graphic cursor to be moved outside the grid.
(useful to place graphic objects, texts in any position, regardless the current grid)
2012-08-11 14:52:13 +02:00
Miguel Angel Ajo db427cb2cd merge with lp:kicad 2012-06-25 22:51:19 +02:00
jean-pierre charras 7f07b48e88 Pcbnew: Update incorrect or incomplete copyrights in many files.
Minor code cleaning in autoroute files.
2012-06-08 11:56:42 +02:00
Miguel Angel Ajo 23bec4b80b * Footprint wizard UI: Added to module editor.
* Footprint wizard C++ generic classes
* Footprint wizard C++ to python wrappers 
* Automatic plugin loader from ~/.kicad/plugins
* Python plugin architecture: Footprint wizards
2012-05-09 19:37:25 +02:00
Dick Hollenbeck c24863c078 // Dick Hollenbeck's KiROUND R&D
// This provides better project control over rounding to int from double
// than wxRound() did.  This scheme provides better logging in Debug builds
// and it provides for compile time calculation of constants.


#include <stdio.h>
#include <assert.h>
#include <limits.h>

//-----<KiROUND KIT>------------------------------------------------------------

/**
 * KiROUND
 * rounds a floating point number to an int using
 * "round halfway cases away from zero".
 * In Debug build an assert fires if will not fit into an int.
 */

#if defined( DEBUG )

// DEBUG: a macro to capture line and file, then calls this inline

static inline int KiRound( double v, int line, const char* filename )
{
    v = v < 0 ? v - 0.5 : v + 0.5;
    if( v > INT_MAX + 0.5 )
    {
        printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v );
    }
    else if( v < INT_MIN - 0.5 )
    {
        printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v );
    }
    return int( v );
}

#define KiROUND( v )    KiRound( v, __LINE__, __FILE__ )

#else

// RELEASE: a macro so compile can pre-compute constants.

#define KiROUND( v )  int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 )

#endif


//-----</KiROUND KIT>-----------------------------------------------------------

// Only a macro is compile time calculated, an inline function causes a static constructor
// in a situation like this.
// Therefore the Release build is best done with a MACRO not an inline function.
int Computed = KiROUND( 14.3 * 8 );


int main( int argc, char** argv )
{
    for( double d = double(INT_MAX)-1;  d < double(INT_MAX)+8;  d += 2.0 )
    {
        int i = KiROUND( d );

        printf( "t: %d  %.16g\n", i, d );
    }

    return 0;
}
2012-04-19 01:55:45 -05:00
Dick Hollenbeck 1121b9cc3c * Coding standards, private functions are lowercase.
* Fix bug in PCBNEW dialog_pad_properties.cpp that I introduced several days ago.
  The m_Master_Pad stuff is stored in the PCB_EDIT_FRAME's BOARD_DESIGN_SETTINGS,
  not in the FOOTPRINT_EDIT_FRAME's BOARD_DESIGN_SETTINGS (i.e. not stored in 
  the module editor's dummy BOARD).  Now we properly initialize the
  DIALOG_PAD_PROPERTIES::m_Pad_Master reference to the correct master pad
  dope, instead of to the dummy module BOARD's master pad, which is not used.
2012-04-11 18:30:06 -05:00
Dick Hollenbeck f8490ff4af Remove g_PcbPlotOptions, use wxformbuilder to subclass DIALOG_SHIM on several dialogs 2012-04-05 13:27:56 -05:00
jean-pierre charras e90cc8adf5 All: added a standard exit dialog called by int DisplayExitDialog( wxWindow* aParent, const wxString& aMessage )
Called when closing pcbnew, cvpcb and eeschema.
Minor code cleaning: remove duplicate or not used strings (mainly file extensions and wildcards)
2012-03-08 18:47:23 +01:00
jean-pierre charras 6219291ddc ModEdit (and ModView): make "invisible" texts visible. They are not visible in the board editor, but must be visible in the footprint editor.
Minor doc update.
2012-02-26 19:49:00 +01:00
jean-pierre charras 197ace9e44 Modedit: add dialog to edit footprint body items. Fix also minor issues about footprint body items edition. 2012-02-12 20:39:37 +01:00
jean-pierre charras fa470d5c4a Pcbnew: Added: modview. This footprint viewer frame which has the same purpose as Viewlib in Eeschema.
this viewer is built using the new  FOOTPRINT_VIEWER_FRAME class.
2012-02-09 21:33:38 +01:00
Dick Hollenbeck 6c04e60587 see CHANGELOG.txt 2012-02-05 23:44:19 -06:00
Dick Hollenbeck 716d21d88a get rid of some globals, share BOARD_DESIGN_SETTINGS from PCB_EDIT_FRAME with FOOTPRINT_EDIT_FRAME 2012-02-02 11:45:37 -06:00
Dick Hollenbeck b8a0ab4c52 switch to <> for includes from "" per conversation with Jean-Pierre and Wayne, adjust search paths 2012-01-22 22:33:36 -06:00
Dick Hollenbeck dd091fc6b9 merge in mainline into KICAD_PLUGIN work, which is for the PCBNEW nanometer support 2012-01-05 10:30:58 -06:00
Dick Hollenbeck 697f912307 moving objects into BOARD which are saved in a *.brd file, for PLUGIN access 2011-12-30 23:44:00 -06:00
Wayne Stambaugh 8985a1807b Encapsulation and other minor improvements.
* EDA_DRAW_PANEL completely encapsulated.
* Moved OSX m_overlay member from EDA_DRAW_PANEL to EDA_DRAW_FRAME where
  it is used.
* Doxygen comment warning fixes.
2011-12-29 15:11:42 -05:00
Wayne Stambaugh c2e5fcaec8 More encapsulation improvements.
* EDA_DRAW_FRAME completely encapsulated.
* Encapsulate the the low hanging fruit in EDA_DRAW_PANEL.
2011-12-22 08:28:11 -05:00
Wayne Stambaugh fac288cffa More encapsulation work and other minor improvements.
* EDA_DRAW_FRAME completely encapsulated except for DrawFrame member.
* Moved members specific to Pcbnew from EDA_DRAW_FRAME to PCB_BASE_FRAME
  or PCB_EDIT_FRAME as appropriate.
* Replace EDA_TOOLBAR with wxAuiToolBar as EDA_TOOL bar provided no
  additional functionality and made code less readable.
* Remove EDA_TOOLBAR class definition from wxstruct.h and delete file
  wineda_toolbar.cpp.
* Rename tool bar members to something more descriptive since the
  horizontal and vertical references wont mean anything once the
  tool bars are movable.
* Lots of dead code removal.
2011-12-16 08:32:23 -05:00
Wayne Stambaugh 95891006cd More EDA_DRAW_FRAME encapsulation work. 2011-12-14 15:03:15 -05:00
Wayne Stambaugh 768ec258f7 Encapsulate LABEL_OBJECT class and message panel window member of EDA_DRAW_FRAME. 2011-12-12 09:02:37 -05:00
Dick Hollenbeck b979d1e0b9 plugin work, accessors 2011-12-12 02:37:05 -06:00
Dick Hollenbeck b26580d5df ++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
    having a BOARD being edited by more than one editor, it was a bad design.
    And this meant removing m_PcbFrame from BOARD.
  * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
  * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
  * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
  * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
    such as dialog_mask_clearance, dialog_drc, etc.
  * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
    with build_version.h's #define BOARD_FILE_VERSION, although there may be a
    better place for this constant.
  * Made the public functions in PARAM_CFG_ARRAY be type const.
    void SaveParam(..) const and void ReadParam(..) const
  * PARAM_CFG_BASE now has virtual destructor since we have various way of
    destroying the derived class and boost::ptr_vector must be told about this.
  * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
    an automatic PARAM_CFG_ARRAY which is on the stack.\
  * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
    since it has to access the current BOARD and the BOARD can change.
    Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
  * Made the m_BoundingBox member private, this was a brutally hard task,
    and indicative of the lack of commitment to accessors and object oriented
    design on the part of KiCad developers.  We must do better.
    Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
  * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 00:15:33 -06:00
Dick Hollenbeck 2515a806ae initial work on PCBNew PLUGIN support, in preparation for nanometer board load and save 2011-11-27 22:32:29 -06:00
Wayne Stambaugh cd0b231656 Minor fixes, dead code removal, and coding policy fixes.
* Use version of DateAndTime that returns a wxString and delete the
  version that takes a char* as it is no longer required.
* Merge StrNumICmp() and StrLenNumICmp() into StrLenNumCmp() to create a
  single function for comparing strings with integers and remove a lot
  of duplicate code.
* Remove unused strupper from string.cpp.
* Use wxArrayString for sorting the EDA_LIST_DIALOG contents.
2011-11-08 11:37:25 -05:00
Wayne Stambaugh edd35b4e90 PCB common library header rationalization.
* All header files used to create the PCB common library now compile as
  stand alone code.  This prevents the need to define them in a specific
  order to make source code compile properly.  It should also now be
  possible to relocate the source code to build the common PCB library
  to a separate folder.
2011-09-23 09:57:12 -04:00
Hauptmech bd19d31082 Hauptmech's centralized wxAuiPaneInfo patch. 2011-09-15 14:25:44 -04:00
Wayne Stambaugh cb78c9452b Undo changes from my last commit that caused a trace drag bug. 2011-09-14 11:08:44 -04:00