From f69a4914fead144b4749877738876c5c594f9e00 Mon Sep 17 00:00:00 2001 From: stambaughw Date: Wed, 10 Feb 2010 16:25:13 +0000 Subject: [PATCH] Minor drawing and build bug fixes. * Fixed clipping bug when USE_WX_ZOOM is enabled that causes rats nest to be drawn incorrectly. * Fix ambiguous function error in trigo.cpp when building with MSVS. * Add instructions for building wxWidgets with graphics context enabled (GDI+) using MinGW/MSYS to COMPILING.txt. * Initial EESchema find dialog work. * Set modified flag when using PCBNew global deletion dialog to prevent closing without warning user of changes. --- Documentation/compiling/COMPILING.txt | 31 +++++++++++++++++++++------ TODO.txt | 7 ++---- common/gr_basic.cpp | 4 ++++ common/trigo.cpp | 6 +++--- eeschema/find.cpp | 20 +++++++++++++++++ pcbnew/initpcb.cpp | 1 + 6 files changed, 55 insertions(+), 14 deletions(-) diff --git a/Documentation/compiling/COMPILING.txt b/Documentation/compiling/COMPILING.txt index 13adba77ab..fe39a479e2 100644 --- a/Documentation/compiling/COMPILING.txt +++ b/Documentation/compiling/COMPILING.txt @@ -64,11 +64,21 @@ there, and then: make install ---- -I think the default is to install into /usr/local/wxMSW-2.8.8. You can probably -pass --prefix= to configure above to change where "make install" -puts everything. We will refer to again below. Without the ---prefix= passed to configure, will likely be - /usr/local/wxMSW-2.8.8 +The default install path is /usr/local. Generally speaking MinGW likes header +files in /mingw/include and library link files in /mingw/lib. You can install +path by setting --prefix=/mingw to configure above to change where "make install" +puts everything. We will refer to the --prefix setting as below. + +If you are planning to enable the USE_WX_GRAPHICS_CONTEXT option (see options +section below) on Windows using MinGW/MSYS you must build wxWidgets with the +--enable-graphics_ctx switch added to the build configurations above. +Unfortunately it is not quite that simple because MinGW does not define the +Gdi+ header and link library files. First you must download the required Gdi+ +development files from + + + +and unzip them where MinGW is installed. Verify that wx-config is in your path. Modify your PATH environment variable if need be so you can run wx-config from a command prompt. You may have to @@ -103,7 +113,7 @@ Under Windows, if zlib is not installed, my cmake build will try to use the wxWidgets zlib build. So, under windows kicad build should work without zlib install. -If you are using the wxWidget zlib, make sure that the wxWidgets/src/zlib directory is copied +If you are using the wxWidget zlib, make sure that the wxWidgets/src/zlib directory is copied to ${wxWidgets_ROOT_DIR}/src/zlib Install CMake @@ -202,5 +212,14 @@ These should be set from command line: KICAD_PYTHON ON/OFF + USE_WX_ZOOM ON/OFF (OPTIONAL) + Experimental coordinate translation code using wxDC instead of custom + Kicad version. + + USE_WX_GRAPHICS_CONTEXT ON/OFF (OPTIONAL) + Experimental advanced drawing library code using wxGraphicsContext. It + requires wxWidgets to be built with the --enable-graphics_ctx switch. + See building wxWidgets above. + Note: that it is easy to build only a specific binary such as pcbnew alone: make pcbnew diff --git a/TODO.txt b/TODO.txt index b2ff7662e2..805b977a61 100644 --- a/TODO.txt +++ b/TODO.txt @@ -117,7 +117,8 @@ Use wxDC for coordinate scaling and offsetting fix. (Wayne) ------------------------------------------------------------ W1) Make wxAutoBufferedPaintDC function properly. -W2) Make bitmap grid drawing method function properly. +W2) Make bitmap grid drawing method function properly or figure out a more + efficient method for drawing the grid. W3) Use one cursor position (preferrably logical (drawing) units) instead of keeping track of both logical and device cursor positions at the same @@ -125,10 +126,6 @@ W3) Use one cursor position (preferrably logical (drawing) units) instead W4) Figure out why none of the apps render correctly using wxGCDC on Windows. -W5) Add instructions for building wxWidgets with GDI+ using MinGW/MSYS - on Windows so wxGraphicsContext is available without having to use - Visual Studio. - ** After (if?) new code accepted as project default: ** W6) Remove all old coordinate scaling and offset code from Kicad. diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 9ccf68c799..b4c162f5d2 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -262,7 +262,11 @@ static void WinClipAndDrawLine( EDA_Rect* ClipBox, wxDC* DC, xcliphi += width; ycliphi += width; +#ifdef USE_WX_ZOOM + if( !ClipBox->Inside( wxPoint( x1, y1 ) ) && !ClipBox->Inside( wxPoint( x2, y2 ) ) ) +#else if( clip_line( x1, y1, x2, y2 ) ) +#endif return; } diff --git a/common/trigo.cpp b/common/trigo.cpp index fe51d0ffc6..dbedec8e4f 100644 --- a/common/trigo.cpp +++ b/common/trigo.cpp @@ -402,9 +402,9 @@ wxPoint TwoPointVector( wxPoint startPoint, wxPoint endPoint ) double DistanceLinePoint( wxPoint linePointA, wxPoint linePointB, wxPoint referencePoint ) { - return fabs( (linePointB.x - linePointA.x) * (linePointA.y - referencePoint.y) - - (linePointA.x - referencePoint.x ) * (linePointB.y - linePointA.y) ) - / EuclideanNorm( TwoPointVector( linePointA, linePointB ) ); + return fabs( (double) ( (linePointB.x - linePointA.x) * (linePointA.y - referencePoint.y) - + (linePointA.x - referencePoint.x ) * (linePointB.y - linePointA.y) ) + / EuclideanNorm( TwoPointVector( linePointA, linePointB ) ) ); } diff --git a/eeschema/find.cpp b/eeschema/find.cpp index a684525c63..a823e498c5 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -23,9 +23,29 @@ #include "kicad_device_context.h" +#include // Use the wxFindReplaceDialog events, data, and enums. #include +/* Define schematic specific find and replace dialog flags based on the enum entries + * in wxFindReplaceFlags. These flags are intended to be used as bit masks in the + * wxFindReplaceData::m_Flags member variable. The varialble is defined as a wxUint32. + */ +enum SchematicFindReplaceFlags +{ + /* The last wxFindReplaceFlag enum is wxFR_MATCHCASE. */ + + /* Search the current sheet only. */ + schFR_CURRENT_SHEET_ONLY = wxFR_MATCHCASE << 1, + + /* Search for design rule check markers. */ + schFR_DRC_MARKERS = wxFR_MATCHCASE << 2, + + /* Search for component in all loaded libraries. */ + schFR_SEARCH_LIBS_FOR_COMPONENT = wxFR_MATCHCASE << 3 +}; + + /* Variables Locales */ static int s_ItemsCount, s_MarkerCount; static wxString s_OldStringFound; diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index fb5f01e56b..1edeabdca7 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -133,6 +133,7 @@ void WinEDA_PcbGlobalDeleteFrame::AcceptPcbDelete( wxCommandEvent& event ) } m_Parent->DrawPanel->Refresh(); + m_Parent->DrawPanel->GetScreen()->SetModify(); EndModal( 1 ); }