From 9cf56261b6457205cb85a87ac1809c466f15510f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 20 Jun 2010 16:47:30 +0200 Subject: [PATCH] give an icon to bitmapt2component frame --- bitmap2component/CMakeLists.txt | 12 +++++- bitmap2component/bitmap2cmp_gui.cpp | 4 +- bitmap2component/bitmap2component.cpp | 2 - bitmap2component/bitmap2component.xpm | 54 +++++++++++++++++++++++++++ eeschema/build_BOM.cpp | 18 +++++---- pcbnew/class_edge_mod.cpp | 6 +-- 6 files changed, 81 insertions(+), 15 deletions(-) create mode 100644 bitmap2component/bitmap2component.xpm diff --git a/bitmap2component/CMakeLists.txt b/bitmap2component/CMakeLists.txt index 455795469d..307b60dfb2 100644 --- a/bitmap2component/CMakeLists.txt +++ b/bitmap2component/CMakeLists.txt @@ -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 diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index 999241c827..679c636446 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -29,6 +29,8 @@ #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" ) @@ -72,7 +74,6 @@ private: void ExportFile( FILE* aOutfile, int aFormat ); }; - BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL ) { m_Config = new wxConfig(); @@ -81,6 +82,7 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL ) m_Config->Read( KEYWORD_FRAME_SIZEX, & m_FrameSize.x, -1 ); m_Config->Read( KEYWORD_FRAME_SIZEY, & m_FrameSize.y, -1 ); + SetIcon( wxICON( bitmap2component_icon ) ); wxString msg( wxT( " 0000 " ) ); m_gridInfo->SetCellValue( 1, 0, msg ); diff --git a/bitmap2component/bitmap2component.cpp b/bitmap2component/bitmap2component.cpp index 8c67b3d742..f61f8348f6 100644 --- a/bitmap2component/bitmap2component.cpp +++ b/bitmap2component/bitmap2component.cpp @@ -32,10 +32,8 @@ #include #include "potracelib.h" -//#include "bitmap_io.h" #include "auxiliary.h" - #ifndef max #define max( a, b ) ( ( (a) > (b) ) ? (a) : (b) ) #endif diff --git a/bitmap2component/bitmap2component.xpm b/bitmap2component/bitmap2component.xpm new file mode 100644 index 0000000000..b33d7a583b --- /dev/null +++ b/bitmap2component/bitmap2component.xpm @@ -0,0 +1,54 @@ +/* XPM */ +static const char *bitmap2component_xpm[] = { +/* columns rows colors chars-per-pixel */ +"32 32 16 1", +"@ c #592904", +"# c #974704", +"$ c #5455D0", +"o c #090915", +"- c #2E1604", +"+ c #4B4BB5", +"* c #222352", +"X c #0F1128", +": c #BE5904", +" c #0CFA0C", +"% c #FC7A04", +"= c #323378", +"; c #753704", +"O c #3C3B8F", +"& c #DF6904", +". c #050204", +/* pixels */ +" . ..", +" .", +" ", +"........................ .. ", +"........................ .. ", +" X.oO ... ", +"+++X@#.X+ $ ... .", +"...o@%&@.*$$X.o= ... ..", +"....@%%%#-..-#;.... ........", +"....@%%&%&-.#%%-.... .......", +"....@%%%%;..;%&......====O+$ ", +"....@%%:-....o..............= ", +"....@&@.... +*O ......%%%%&#.X ", +"....-..... .....%%&%%%:...", +"OO O=+ . *.%%%%%&%@X ", +" ... =.%%%%%%%#..", +" . O.%%%%&%%;.=", +".......... .....%%%%%%%-..", +"....@@..... ......%%%%%%;...", +"....@%:-....X.........###;;-.= ", +"....@%%&#...-#@...........o*$ ", +"....@%%%%&-.#%%...... $ ", +"....@%%%%#..;%%..... .......", +"....@%%&-....-..... ........", +"XXXo@%;.X+ +*=$ ... ..", +" X-.oO ... .", +" X.= ... ", +"........................ .. ", +"........................ .. ", +" ", +" .", +" . .." +}; diff --git a/eeschema/build_BOM.cpp b/eeschema/build_BOM.cpp index 8ae9417846..94c9dae54c 100644 --- a/eeschema/build_BOM.cpp +++ b/eeschema/build_BOM.cpp @@ -798,7 +798,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( for( int jj = FOOTPRINT; jj < currCmp->GetFieldCount(); jj++ ) { //Ensure fields exists in dummy component - if( dummyCmp.GetFieldCount() < currCmp->GetFieldCount() ) + if( dummyCmp.GetFieldCount() <= jj ) dummyCmp.AddField( *currCmp->GetField( jj ) ); // store useful data if( !currCmp->GetField( jj )->m_Text.IsEmpty() ) @@ -849,23 +849,27 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( CONV_TO_UTF8( currCmp->GetField( DATASHEET) ->m_Text ) ); #endif + fprintf( f, "%c%s", s_ExportSeparatorSymbol, + CONV_TO_UTF8( RNames ) ); + // print fields, on demand - for( int jj = FIELD1; jj <= FIELD8 ; jj++ ) + int last_nonempty_field_idx = 0; + for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ ) + if ( !dummyCmp.GetField( jj )->m_Text.IsEmpty() ) + last_nonempty_field_idx = jj; + for( int jj = FIELD1; jj <= last_nonempty_field_idx ; jj++ ) { - if( dummyCmp.GetFieldCount() >= jj ) - break; if ( IsFieldChecked( jj ) ) fprintf( f, "%c%4s", s_ExportSeparatorSymbol, CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) ); } - fprintf( f, "%c%s\n", s_ExportSeparatorSymbol, - CONV_TO_UTF8( RNames ) ); + fprintf( f, "\n" ); // Clear strings and values, to prepare next component qty = 0; RNames.Empty(); - for( int jj = FOOTPRINT; jj < currCmp->GetFieldCount(); jj++ ) + for( int jj = FOOTPRINT; jj < dummyCmp.GetFieldCount(); jj++ ) dummyCmp.GetField( jj )->m_Text.Empty(); } diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 1f946ec046..509289409a 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -105,12 +105,10 @@ EDA_Rect EDGE_MODULE::GetBoundingBox() if( Module ) { RotatePoint( &pt.x, &pt.y, Module->m_Orient ); - pt.x += Module->m_Pos.x; - pt.y += Module->m_Pos.y; + pt += Module->m_Pos; } - pt.x += m_Start0.x; - pt.y += m_Start0.y; + pt += m_Start0; bbox.m_Pos.x = MIN( bbox.m_Pos.x, pt.x ); bbox.m_Pos.y = MIN( bbox.m_Pos.y, pt.y ); p_end.x = MAX( p_end.x, pt.x );