From 73585a8514c3dd6c0d1012ef5b374409e61cbe07 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 15 Jan 2011 19:06:10 +0100 Subject: [PATCH] Fix minor bug (layer color not updated in toolbar when changed in layer manager) Pcbnew: fix that prevents loading modules from libraries (footprint name not identified in lib) Module Editor: Try to fix incorrect printing. Fixed now only for scale 1. Nor working for other scales. (Work in progress). Gerbview: Known bug: printing not working. VRML export: Fix incorrect export of 3D shapes rotations when the 3D shape was rotated. --- common/build_version.cpp | 2 +- common/filter_reader.cpp | 1 + .../dialog_edit_component_in_schematic.cpp | 5 +++-- gerbview/class_gerbview_layer_widget.cpp | 1 + packaging/windows/nsis/install.nsi | 2 +- pcbnew/class_pcb_layer_widget.cpp | 1 + pcbnew/export_vrml.cpp | 18 +++++++++++++----- pcbnew/print_board_functions.cpp | 9 +++++++++ pcbnew/printout_controler.cpp | 15 ++++++--------- version.txt | 4 ++-- 10 files changed, 38 insertions(+), 20 deletions(-) diff --git a/common/build_version.cpp b/common/build_version.cpp index 81f60c0a17..a78a6c3cb6 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -6,7 +6,7 @@ #endif #ifndef KICAD_BUILD_VERSION -#define KICAD_BUILD_VERSION "(2011-01-07 BZR 2718)" +#define KICAD_BUILD_VERSION "(2011-01-12 BZR 2730)" #endif //#define VERSION_STABILITY "stable" diff --git a/common/filter_reader.cpp b/common/filter_reader.cpp index a3367980f0..d6cf004c81 100644 --- a/common/filter_reader.cpp +++ b/common/filter_reader.cpp @@ -36,5 +36,6 @@ unsigned FILTER_READER::ReadLine() throw( IO_ERROR ) if( !strchr( "#\n\r", reader[0] ) ) break; } + strtok( reader, "\n\r" ); return ret; } diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index cb970ee958..f61850ee17 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -1,6 +1,8 @@ +/** + * @file dialog_edit_component_in_schematic.cpp + */ #include -#include #include "fctsys.h" #include "appl_wxstruct.h" @@ -12,7 +14,6 @@ #include "wxEeschemaStruct.h" #include "general.h" -#include "protos.h" #include "class_library.h" #include "sch_component.h" #include "dialog_helpers.h" diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index ce0e3747d3..f2201bb087 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -194,6 +194,7 @@ void GERBER_LAYER_WIDGET::ReFill() void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor ) { myframe->GetBoard()->SetLayerColor( aLayer, aColor ); + myframe->m_SelLayerBox->ResyncBitmapOnly(); myframe->DrawPanel->Refresh(); } diff --git a/packaging/windows/nsis/install.nsi b/packaging/windows/nsis/install.nsi index ef7c5cb772..b5c058b56b 100644 --- a/packaging/windows/nsis/install.nsi +++ b/packaging/windows/nsis/install.nsi @@ -17,7 +17,7 @@ ; General Product Description Definitions !define PRODUCT_NAME "KiCad" -!define PRODUCT_VERSION "2011.01.07" +!define PRODUCT_VERSION "2011.01.12" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define COMPANY_NAME "" diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index a07fd9ca1c..1a843fd3ba 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -289,6 +289,7 @@ void PCB_LAYER_WIDGET::ReFill() void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor ) { myframe->GetBoard()->SetLayerColor( aLayer, aColor ); + myframe->ReCreateLayerBox( NULL ); myframe->DrawPanel->Refresh(); } diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index de413ba8a5..dda230ed3d 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -1051,17 +1051,25 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule, * for footprints that are flipped * When flipped, axis rotation is the horizontal axis (X axis) */ - int rotx = wxRound( vrmlm->m_MatRotation.x ); + double rotx = - vrmlm->m_MatRotation.x; + double roty = - vrmlm->m_MatRotation.y; + double rotz = - vrmlm->m_MatRotation.z; if ( isFlipped ) - rotx += 1800; + { + rotx += 180.0; + NEGATE(roty); + NEGATE(rotz); + } /* Do some quaternion munching */ double q1[4], q2[4], rot[4]; - build_quat( 1, 0, 0, rotx / 1800.0 * M_PI, q1 ); - build_quat( 0, 1, 0, vrmlm->m_MatRotation.y / 1800.0 * M_PI, q2 ); + build_quat( 1, 0, 0, rotx / 180.0 * M_PI, q1 ); + build_quat( 0, 1, 0, roty / 180.0 * M_PI, q2 ); compose_quat( q1, q2, q1 ); - build_quat( 0, 0, 1, vrmlm->m_MatRotation.z / 1800.0 * M_PI, q2 ); + build_quat( 0, 0, 1, rotz / 180.0 * M_PI, q2 ); compose_quat( q1, q2, q1 ); + // Note here aModule->m_Orient is in 0.1 degrees, + // so module rotation is aModule->m_Orient / 1800.0 build_quat( 0, 0, 1, aModule->m_Orient / 1800.0 * M_PI, q2 ); compose_quat( q1, q2, q1 ); from_quat( q1, rot ); diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index d0941435d1..9dd655be88 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -81,9 +81,18 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC, Module = (MODULE*) Pcb->m_Modules; int tmp = D_PAD::m_PadSketchModePenSize; D_PAD::m_PadSketchModePenSize = defaultPenSize; + wxPoint offset; + offset.x = GetScreen()->m_CurrentSheetDesc->m_Size.x / 2; + offset.y = GetScreen()->m_CurrentSheetDesc->m_Size.y / 2; + // offset is in mils, converts in internal units + offset.x *= m_InternalUnits / 1000; + offset.y *= m_InternalUnits / 1000; + for( ; Module != NULL; Module = Module->Next() ) { + Module->Move( offset ); Print_Module( DrawPanel, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); + Module->Move( -offset ); } D_PAD::m_PadSketchModePenSize = tmp; diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index a6236e8e72..d32ff775e6 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -137,15 +137,9 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0; ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0; - // Gerbview uses a very large sheet (called "World" in gerber language) - // to print a sheet, uses A4 is better SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch - if( m_Parent->m_Ident == GERBER_FRAME ) - { - SheetSize = g_Sheet_A4.m_Size; // size in 1/1000 inch - } SheetSize.x *= m_Parent->m_InternalUnits / 1000; - SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels + SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in internal units WinEDA_BasePcbFrame* pcbframe = (WinEDA_BasePcbFrame*) m_Parent; pcbframe->GetBoard()->ComputeBoundaryBox(); @@ -234,8 +228,11 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() WinEDA_DrawPanel* panel = m_Parent->DrawPanel; EDA_Rect tmp = panel->m_ClipBox; + // SEt clip box to the max size + #define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer + // and that allows calculations without overflow panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) ); - panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ); + panel->m_ClipBox.SetSize( wxSize( MAX_VALUE, MAX_VALUE ) ); m_Parent->GetBaseScreen()->m_IsPrinting = true; int bg_color = g_DrawBgColor; @@ -280,7 +277,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() #else ActiveScreen->m_DrawOrg = DrawOffset; #endif - panel->m_ClipBox.SetOrigin( wxPoint( -0x7FFFFF, -0x7FFFFF ) ); + panel->m_ClipBox.SetOrigin( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ) ); } g_DrawBgColor = WHITE; diff --git a/version.txt b/version.txt index a0ab8436b8..63a2081032 100644 --- a/version.txt +++ b/version.txt @@ -1,4 +1,4 @@ release version: -2011 jan 07 (BZR 2718) +2011 jan 12 (BZR 2730) files (.zip,.tgz): -kicad-2011-01-07 +kicad-2011-01-12