=== modified file 'pcbnew/io_mgr.h'
--- pcbnew/io_mgr.h	2012-04-07 18:05:56 +0000
+++ pcbnew/io_mgr.h	2012-04-13 19:48:10 +0000
@@ -144,6 +144,97 @@
      */
     static void Save( PCB_FILE_T aFileType, const wxString& aFileName,
                       BOARD* aBoard, PROPERTIES* aProperties = NULL );
+    
+    
+    
+    /**
+     * Function ListModules
+     * finds the requested PLUGIN and if found, calls the PLUGIN->ListModules(..) 
+     * function on it using the arguments passed to this function.  
+     * After the PLUGIN->ListModules() function returns, the PLUGIN 
+     * is Released() as part of this call.
+     *
+     * @param aFileType is the PCB_FILE_T of file to load.
+     *
+     * @param aLibraryPath is the path to the library file or directory.
+     * 
+     * @param aSearchPattern is the search pattern of the modules we want
+     *  to get listed from this library. "*" pattern should return all the
+     *  modules, "" pattern shouldn't return anything.
+     *
+     * @param aProperties is an associative array that can be used to tell the
+     *  plugin how to access the library file.
+     *  The caller continues to own this object (plugin may not delete it), and
+     *  plugins should expect it to be optionally NULL.
+     *
+     *  @return wxArrayString - is the array of available modules names inside  
+     *   a library
+     *
+     * @throw IO_ERROR if the PLUGIN cannot be found, library cannot be found,
+     *  or module cannot be loaded.
+     */
+    
+    static wxArrayString ListModules ( PCB_FILE_T aFileType,
+                                       const wxString& aLibraryPath,
+                                       const wxString& aSearchPattern,
+                                       PROPERTIES* aProperties = NULL);
+    
+    /**
+     * Function LoadModule
+     * finds the requested PLUGIN and if found, calls the PLUGIN->LoadModule(..) 
+     * function on it using the arguments passed to this function.  
+     * After the PLUGIN->LoadModule() function returns, the PLUGIN 
+     * is Released() as part of this call.
+     *
+     * @param aFileType is the PCB_FILE_T of file to load.
+     *
+     * @param aModuleName is the name of the module to load.
+     * 
+     * @param aProperties is an associative array that can be used to tell the
+     *  saver how to save the file, because it can take any number of
+     *  additional named tuning arguments that the plugin is known to support.
+     *  The caller continues to own this object (plugin may not delete it), and
+     *  plugins should expect it to be optionally NULL.
+     *
+     * @return MODULE* - caller owns it unless it's added to a BOARD, in that
+     *  case BOARD will take care of deletion when BOARD is deleted. Never NULL 
+     *  because exception thrown if error.
+     *    
+     * @throw IO_ERROR if the PLUGIN cannot be found, library cannot be found,
+     *  or module cannot be loaded.
+     */
+    static MODULE* LoadModule( PCB_FILE_T aFileType, 
+                                const wxString& aLibraryPath,
+                                wxString& aModuleName,
+                                PROPERTIES* aProperties = NULL);
+
+    /**
+     * Function SaveModule
+     * will write a module to an existing library, or just create the library
+     * if it doesn't exist
+     *
+     * @param aFileType is the PCB_FILE_T of file to save.
+     *
+     * @param aLibraryPath is the path of the library where we want the module
+     *  to be stored in.
+     * 
+     * @param aModuleName the name we want to use for this module inside the
+     *  library.
+     *
+     * @param aModule is the module object that we want to store in the library.
+     *   The caller continues to own the MODULE.
+     * 
+     * @param aProperties is an associative array that can be used to tell the
+     *  saver how to save the file, because it can take any number of
+     *  additional named tuning arguments that the plugin is known to support.
+     *  The caller continues to own this object (plugin may not delete it), and
+     *  plugins should expect it to be optionally NULL.
+     *
+     * @throw IO_ERROR if there is a problem saving or exporting.
+     */
+     static void SaveModule( PCB_FILE_T aFileType, const wxString& aLibraryPath,
+                              const wxString& aModuleName,
+                              MODULE* aModule, PROPERTIES* aProperties = NULL);
 };
 
 
@@ -212,7 +303,7 @@
      *  input file if possible.
      */
     virtual BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
-                         PROPERTIES* aProperties = NULL );
+                         PROPERTIES* aProperties = NULL )=0;
 
     /**
      * Function Save
@@ -235,8 +326,92 @@
      * @throw IO_ERROR if there is a problem saving or exporting.
      */
     virtual void Save( const wxString& aFileName, BOARD* aBoard,
-                       PROPERTIES* aProperties = NULL );
-
+                       PROPERTIES* aProperties = NULL )=0;
+
+    
+    /**
+     * Function ListModules
+     * 
+     * Get an array with the names of all available modules inside a pcb library.
+     *
+     * @param aLibraryPath is the path to the library file or directory.
+     * 
+     * @param aSearchPattern is the search pattern of the modules we want
+     *  to get listed from this library. "*" pattern should return all the
+     *  modules, "" pattern shouldn't return anything.
+     *
+     *
+     * @param aProperties is an associative array that can be used to tell the
+     *  plugin how to access the library.
+     *  The caller continues to own this object (plugin may not delete it), and
+     *  plugins should expect it to be optionally NULL.
+     *
+     * @return wxArrayString - is the array of available modules names inside  
+     *   a library
+     *
+     * @throw IO_ERROR if the PLUGIN cannot be found, library cannot be found,
+     *  or module cannot be loaded.
+     */
+    
+    virtual wxArrayString ListModules (const wxString& aLibraryPath,
+                                        const wxString& aSearchPattern,
+                                       PROPERTIES* aProperties = NULL)=0;
+     /**
+     * Function LoadModule
+     * 
+     *  will load a MODULE object from the library format this PLUGIN 
+     * knows about.
+     *
+     * @param aModuleName is the name of the module to load.
+     *
+     * @param aAppendToBoard is an existing BOARD to append the module to, 
+     *         use NULL if you don't want the module added to a BOARD
+     * 
+     * @return MODULE* - caller owns it unless it's added to a BOARD, in that
+     *  case BOARD will take care of deletion when BOARD is deleted. Never NULL 
+     *  because exception thrown if error.
+     *    
+     * @param aProperties is an associative array that can be used to tell the
+     *  saver how to save the file, because it can take any number of
+     *  additional named tuning arguments that the plugin is known to support.
+     *  The caller continues to own this object (plugin may not delete it), and
+     *  plugins should expect it to be optionally NULL.
+     *
+     * @throw IO_ERROR if the PLUGIN cannot be found, library cannot be found,
+     *  or module cannot be loaded.
+     */
+    static MODULE* LoadModule( const wxString& aLibraryPath,
+                                wxString& aModuleName,
+                                BOARD* aAppendToBoard = NULL,
+                                PROPERTIES* aProperties = NULL)=0;
+
+    /**
+     * Function SaveModule
+     * will write a module to an existing library, or just create the library
+     * if it doesn't exist
+     *
+     * @param aLibraryPath is the path of the library where we want the module
+     *  to be stored in.
+     * 
+     * @param aModuleName the name we want to use for this module inside the
+     *  library.
+     *
+     * @param aModule is the module object that we want to store in the library.
+     *   The caller continues to own the MODULE.
+     * 
+     * @param aProperties is an associative array that can be used to tell the
+     *  saver how to save the file, because it can take any number of
+     *  additional named tuning arguments that the plugin is known to support.
+     *  The caller continues to own this object (plugin may not delete it), and
+     *  plugins should expect it to be optionally NULL.
+     *
+     * @throw IO_ERROR if there is a problem saving or exporting.
+     */
+     static void SaveModule( const wxString& aLibraryPath, 
+                              const wxString& aModuleName,
+                              MODULE* aModule, PROPERTIES* aProperties = NULL);
+    
+    
     //-----</PUBLIC PLUGIN API>------------------------------------------------
 
     /*  The compiler writes the "zero argument" constructor for a PLUGIN

