Commit ab056f3e authored by jean-pierre charras's avatar jean-pierre charras
Browse files

minor enhancements. Fixing a crash in build_BOM.cpp (temporary fix, until Dick...

minor enhancements. Fixing a crash in build_BOM.cpp (temporary fix, until Dick finishes fields rework)
parents fcbcb640 00008579
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -106,9 +106,9 @@ Installation from source code

   Some dependencies must be satisfied for the correct installation of KiCad:

wxWidgets           >= 2.6.3.3       http://www.wxwidgets.org/
CMake               >= 2.4.6         http://www.cmake.org/
Boost C++ Libraries                  http://www.boost.org/
wxWidgets           >= 2.8.11        http://www.wxwidgets.org/
CMake               >= 2.6.4         http://www.cmake.org/
Boost C++ Libraries  (files used by kicad are provided in kicad sources) http://www.boost.org/
OpenGL
  Linux:   Mesa 3D Graphics Library  http://www.mesa3d.org/
  Windows: built-in
+11 −1
Original line number Diff line number Diff line
@@ -9,7 +9,17 @@ set(BITMAP2COMPONENT_SRCS
    bitmap2cmp_gui
    )

add_executable(bitmap2component WIN32 MACOSX_BUNDLE ${BITMAP2COMPONENT_SRCS} ${BITMAP2COMPONENT_RESOURCES})
if(WIN32)
    if(MINGW)
        # BITMAP2COMPONENT_RESOURCES variable is set by the macro.
        mingw_resource_compiler(bitmap2component)
    else(MINGW)
        set(BITMAP2COMPONENT_RESOURCES bitmap2component.rc)
    endif(MINGW)
endif(WIN32)
add_executable(bitmap2component WIN32 MACOSX_BUNDLE
                            ${BITMAP2COMPONENT_SRCS}
                            ${BITMAP2COMPONENT_RESOURCES})


target_link_libraries( bitmap2component
+48 −20
Original line number Diff line number Diff line
@@ -23,17 +23,22 @@
 */
#include "wx/wx.h"
#include "wx/config.h"
#include "wx/filename.h"

#include "bitmap2cmp_gui_base.h"

#include "potracelib.h"
#include "bitmap_io.h"

#include "bitmap2component.xpm"

#define KEYWORD_FRAME_POSX wxT( "bmconverter_Pos_x" )
#define KEYWORD_FRAME_POSY wxT( "bmconverter_Pos_y" )
#define KEYWORD_FRAME_SIZEX wxT( "bmconverter_Size_x" )
#define KEYWORD_FRAME_SIZEY wxT( "bmconverter_Size_y" )

#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )

extern int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFormat );

@@ -49,7 +54,8 @@ private:
    wxBitmap  m_Greyscale_Bitmap;
    wxImage   m_NB_Image;
    wxBitmap  m_BN_Bitmap;
    wxString  m_ImgFileName;
    wxString  m_BitmapFileName;
    wxString  m_ConvertedFileName;
    wxSize m_FrameSize;
    wxPoint m_FramePos;
    wxConfig * m_Config;
@@ -72,7 +78,6 @@ private:
    void ExportFile( FILE* aOutfile, int aFormat );
};


BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
{
    m_Config = new wxConfig();
@@ -80,11 +85,18 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
    m_Config->Read( KEYWORD_FRAME_POSY, & m_FramePos.y, -1 );
    m_Config->Read( KEYWORD_FRAME_SIZEX, & m_FrameSize.x, -1 );
    m_Config->Read( KEYWORD_FRAME_SIZEY, & m_FrameSize.y, -1 );
    m_Config->Read( KEYWORD_LAST_INPUT_FILE, &m_BitmapFileName );
    m_Config->Read( KEYWORD_LAST_OUTPUT_FILE, &m_ConvertedFileName );

    #ifdef __WINDOWS__
    SetIcon( wxICON( bitmap2component_icon ) );
    #else
    SetIcon( wxICON( bitmap2component ) );
    #endif

    wxString msg( wxT( "  0000  " ) );
    wxString msg( wxT( "000000" ) );
    m_gridInfo->SetCellValue( 0, 0, msg );
    m_gridInfo->SetCellValue( 1, 0, msg );
    m_gridInfo->SetCellValue( 2, 0, msg );
    if( GetSizer() )
    {
        GetSizer()->SetSizeHints( this );
@@ -108,6 +120,8 @@ BM2CMP_FRAME::~BM2CMP_FRAME()
    m_Config->Write( KEYWORD_FRAME_POSY, (long) m_FramePos.y );
    m_Config->Write( KEYWORD_FRAME_SIZEX, (long) m_FrameSize.x );
    m_Config->Write( KEYWORD_FRAME_SIZEY, (long) m_FrameSize.y );
    m_Config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName );
    m_Config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );

    delete m_Config;

@@ -136,18 +150,24 @@ void BM2CMP_FRAME::OnPaint( wxPaintEvent& event )
 */
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
{
    wxFileDialog FileDlg( this, _( "Choose Image" ), ::wxGetCwd(), wxEmptyString,
    wxFileName fn(m_BitmapFileName);
    wxString path = fn.GetPath();
    if( path.IsEmpty() || !wxDirExists(path) )
        path = wxGetCwd();

    wxFileDialog FileDlg( this, _( "Choose Image" ), path, wxEmptyString,
                          _( "Image Files " ) + wxImage::GetImageExtWildcard(),
                          wxFD_OPEN );
    int          diag = FileDlg.ShowModal();

    if( diag != wxID_OK )
        return;
    m_ImgFileName = FileDlg.GetPath();

    if( !m_Pict_Image.LoadFile( m_ImgFileName ) )
    m_BitmapFileName = FileDlg.GetPath();

    if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
    {
        wxMessageBox( _( "Couldn't load image from '%s'." ), m_ImgFileName.c_str() );
        wxMessageBox( _( "Couldn't load image from <%s>" ), m_BitmapFileName.c_str() );
        return;
    }

@@ -236,22 +256,26 @@ void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )

void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event )
{
    wxFileName fn(m_ConvertedFileName);
    wxString path = fn.GetPath();
    if( path.IsEmpty() || !wxDirExists(path) )
        path = ::wxGetCwd();
    wxString     msg = _( "Schematic lib file (*.lib)|*.lib" );
    wxFileDialog FileDlg( this, _( "Create lib file" ), ::wxGetCwd(), wxEmptyString,
    wxFileDialog FileDlg( this, _( "Create lib file" ), path, wxEmptyString,
                          msg,
                          wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
    int          diag = FileDlg.ShowModal();

    if( diag != wxID_OK )
        return;
    wxString filename = FileDlg.GetPath();
    m_ConvertedFileName = FileDlg.GetPath();

    FILE*    outfile;
    outfile = wxFopen( filename, wxT( "w" ) );
    outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
    if( outfile == NULL )
    {
        wxString msg;
        msg.Printf( _( "File %s could not be created" ), filename.c_str() );
        msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
        wxMessageBox( msg );
        return;
    }
@@ -263,22 +287,26 @@ void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event )

void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event )
{
    wxFileName fn(m_ConvertedFileName);
    wxString path = fn.GetPath();
    if( path.IsEmpty() || !wxDirExists(path) )
        path = ::wxGetCwd();
    wxString     msg = _( "Footprint export file (*.emp)|*.emp" );
    wxFileDialog FileDlg( this, _( "Create footprint export file" ), ::wxGetCwd(), wxEmptyString,
    wxFileDialog FileDlg( this, _( "Create footprint export file" ), path, wxEmptyString,
                          msg,
                          wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
    int          diag = FileDlg.ShowModal();

    if( diag != wxID_OK )
        return;
    wxString filename = FileDlg.GetPath();
    m_ConvertedFileName = FileDlg.GetPath();

    FILE*    outfile;
    outfile = wxFopen( filename, wxT( "w" ) );
    outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
    if( outfile == NULL )
    {
        wxString msg;
        msg.Printf( _( "File %s could not be created" ), filename.c_str() );
        msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
        wxMessageBox( msg );
        return;
    }
+0 −2
Original line number Diff line number Diff line
@@ -32,10 +32,8 @@
#include <vector>

#include "potracelib.h"
//#include "bitmap_io.h"
#include "auxiliary.h"


#ifndef max
    #define max( a, b ) ( ( (a) > (b) ) ? (a) : (b) )
  #endif
+2.19 KiB
Loading image diff...
Loading