Commit Graph

48 Commits

Author SHA1 Message Date
jean-pierre charras b660b033ad All: remove macros MAX, MIN, ABS from macros.h and replace these macros by std::max, std::min and std::abs (mainly found in old code). 2012-09-22 13:19:37 +02:00
Lorenzo Marcantonio e771112259 Enforced EDA_COLOR_T type and minor const-ification 2012-09-02 14:06:47 +02:00
jean-pierre charras 4125ea7789 Gerbview: remove dependencies from Pcbnew.
Should allow Pcbnew code easier to change and Gerbview code more understandable and easier to maintain.
Code cleaning (remove dead code, add comments).
Minor other enhancements.
2012-05-04 19:44:42 +02:00
jean-pierre charras 758f22161a All: change MILS_TO_IU_SCALING_FACTOR constant to IU_PER_MILS ( and MM_TO_IU_SCALING_FACTOR to IU_PER_MM)
Also fix bug 985654.
2012-04-26 23:34:20 +02:00
jean-pierre charras 3b671e09d1 All: change MILS_TO_IU_SCALING_FACTOR constant to MILS_PER_IU ( and MM_TO_IU_SCALING_FACTOR to MM_PER_IU)
Also fix bug 985654.
2012-04-26 22:21:31 +02:00
jean-pierre charras fa3ebc4043 Define MM_TO_IU_SCALING_FACTOR (scaling factor from mm to internal units) only in convert_to_biu.h
Other scaling factors (MILS_TO_IU_SCALING_FACTOR and DECIMILS_TO_IU_SCALING_FACTOR)
also defined only in convert_to_biu.h.
Allows different scaling value for Gerbview.
Needs more tests.
2012-04-25 21:33:24 +02:00
Dick Hollenbeck c24863c078 // Dick Hollenbeck's KiROUND R&D
// This provides better project control over rounding to int from double
// than wxRound() did.  This scheme provides better logging in Debug builds
// and it provides for compile time calculation of constants.


#include <stdio.h>
#include <assert.h>
#include <limits.h>

//-----<KiROUND KIT>------------------------------------------------------------

/**
 * KiROUND
 * rounds a floating point number to an int using
 * "round halfway cases away from zero".
 * In Debug build an assert fires if will not fit into an int.
 */

#if defined( DEBUG )

// DEBUG: a macro to capture line and file, then calls this inline

static inline int KiRound( double v, int line, const char* filename )
{
    v = v < 0 ? v - 0.5 : v + 0.5;
    if( v > INT_MAX + 0.5 )
    {
        printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v );
    }
    else if( v < INT_MIN - 0.5 )
    {
        printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v );
    }
    return int( v );
}

#define KiROUND( v )    KiRound( v, __LINE__, __FILE__ )

#else

// RELEASE: a macro so compile can pre-compute constants.

#define KiROUND( v )  int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 )

#endif


//-----</KiROUND KIT>-----------------------------------------------------------

// Only a macro is compile time calculated, an inline function causes a static constructor
// in a situation like this.
// Therefore the Release build is best done with a MACRO not an inline function.
int Computed = KiROUND( 14.3 * 8 );


int main( int argc, char** argv )
{
    for( double d = double(INT_MAX)-1;  d < double(INT_MAX)+8;  d += 2.0 )
    {
        int i = KiROUND( d );

        printf( "t: %d  %.16g\n", i, d );
    }

    return 0;
}
2012-04-19 01:55:45 -05:00
jean-pierre charras f3e171797c Make Gerbview working with USE_PCBNEW_NANOMETRES option ON 2012-04-18 09:07:13 +02:00
Dick Hollenbeck b8a0ab4c52 switch to <> for includes from "" per conversation with Jean-Pierre and Wayne, adjust search paths 2012-01-22 22:33:36 -06:00
Dick Hollenbeck e6c8515873 switch to C++'s false and true from C's FALSE and TRUE 2012-01-22 11:20:22 -06:00
Wayne Stambaugh 2c251196c6 Minor dialog fixes and code cleaning.
* Grammar and spelling fixes in Eeschema, CvPcb, and Pcbnew path and
  library dialog tool tips.
* Translate the French file name subrill.cpp to highlight.cpp.
* Lots of coding style policy fixes.
2011-10-17 16:01:27 -04:00
Wayne Stambaugh edd35b4e90 PCB common library header rationalization.
* All header files used to create the PCB common library now compile as
  stand alone code.  This prevents the need to define them in a specific
  order to make source code compile properly.  It should also now be
  possible to relocate the source code to build the common PCB library
  to a separate folder.
2011-09-23 09:57:12 -04:00
Wayne Stambaugh 67f70fe079 Coding style and Doxygen comment fixes.
* Rename EDA_Rect class to EDA_RECT.
* Rename EDA_TextStruct class to EDA_TEXT.
* Remove duplicate Doxygen comments from sch_sheet_path.cpp.
2011-03-29 15:33:07 -04:00
jean-pierre charras a97f5c2530 Gerbview: code cleanup and very minor fix. 2011-03-14 22:19:13 +01:00
jean-pierre charras 81509a1160 Gerbview: code cleanup and a minoe enhancement. Kicad: minor code cleanup 2011-03-13 19:03:43 +01:00
jean-pierre charras f6669b7845 Gerbview: code cleanup: remove dead code and obsolete options. Coding policy class naming fixes.
others: fix minor issues.
2011-03-12 10:50:21 +01:00
jean-pierre charras 098a20a0d8 fix very minor bugs. 2011-03-03 20:08:13 +01:00
jean-pierre charras 2e2ecdd448 Gerbview: fix most of Doxygen warnings. 2010-12-18 19:47:58 +01:00
Dick Hollenbeck 636b2d301e function comments, fix ones in *.cpp files until they can be deleted if they exist in the headers 2010-11-12 10:36:43 -06:00
jean-pierre charras a9c1c49be0 Fixed minor issues in Gerbview 2010-10-25 11:57:00 +02:00
jean-pierre charras 1206177ce0 Gerbview: minor enhancement. Boost::Polygon: commit forgotten file 2010-10-23 20:12:11 +02:00
jean-pierre charras a8ebad2fc4 Gerbview: added: image polarity, axis select, layer rotation. Code cleanup. 2010-10-16 16:51:22 +02:00
jean-pierre charras 2a216a51b9 Gerbview: added support forSF (scale factor), IO (Image Offset), OF (Offset) and MI (Mirror) commands. 2010-10-10 19:57:54 +02:00
jean-pierre charras 035979d39f More work on Gerbview: code cleaning and cosmetic enhancements. 2010-10-06 19:28:07 +02:00
jean-pierre charras 9f4e57d428 Some cleanup and fixes in gerbview. Cleanup gr_basic.* and added in gr_basic.* a minor modification coming from "EEschema selection.patch". 2010-10-05 13:44:34 +02:00
jean-pierre charras bc0d79d587 finished Draw functions for aperture macros. Now aperture macros are drawn correctly.
Known bug: aperture macros having parameters are incorrect: parameters are not transmited correctly. Work still in progress.
2010-10-03 17:39:06 +02:00
jean-pierre charras 659299ee8f Gerbview: more about apertures macros and draw funtions. 2010-10-01 21:11:30 +02:00
jean-pierre charras 22f483e1d8 Gerbview: minor changes: Added comments, fixed errors in comments, fixed a very minor error. 2010-09-30 08:25:33 +02:00
jean-pierre charras cdf111d618 Fixed errors in comments. no new code 2010-09-29 21:00:35 +02:00
jean-pierre charras d696ee8cd5 Gerbview: added support og regular polygon aperure definition. 2010-09-28 21:34:16 +02:00
jean-pierre charras b992af3eb3 Gerbview code redesign 2010-09-28 16:42:05 +02:00
charras 0b41d484ff code cleaning 2009-12-20 19:48:58 +00:00
stambaughw 3c7df7b75d Complete comment translation of gerbview source. 2009-11-09 14:00:22 +00:00
stambaughw 689579bde1 Global variable unobfuscation, new library path search, and lots of other changes. See CHANGELOG.txt. 2009-04-05 20:49:15 +00:00
stambaughw b833a46bad More header file realignments to reduce recompiling and general code cleaning. 2009-02-04 15:25:03 +00:00
dickelbeck b603580355 WinEDA_BasePcbFrame::m_Pcb is now private, use GetBoard() to access it. 2009-01-05 05:21:35 +00:00
charras 53f69ece79 gerbview: add french translation, G55 command (a do nothing command) and solved a bug that can crashes gerbview with files without any DCODE tools info. 2008-12-17 14:51:39 +00:00
dickelbeck 26736baa9b gerbview cleanup, and working towards aperture macro support 2008-11-09 02:57:42 +00:00
dickelbeck df29e89c4a beginnings of aperture macro support 2008-11-08 06:44:07 +00:00
dickelbeck 721d878fcf GetScreen() work, menu capitalization, beautifying 2008-04-17 16:25:29 +00:00
lifekidyeaa c5cd85027b 2008-Feb-12 UPDATE Tim Hanson sideskate@gmail.com
================================================================================
+eeschema
        * commiting my changes to allow multiple instances of a given schematic file within 
a hierarchy:
        ** internally, m_currentScreen has been replaced with m_currentSheet,
                which is a list or 'path' of screens.  The path of screens is used to 
generate
                a series of timestamps, which is converted to flat component reference via 
a look-up
                table in the schematic files.
        ** this means that m_currentScreen is no longer used -- use GetScreen().
        ** GetScreen is virtual, as some of the dialogs keep around a WinEDA_BaseScreen 
pointer.
        ** all sub-sheets in a given schematic must have different names to generate a 
meaningful netlist.
2008-02-12 21:12:46 +00:00
CHARRAS bcd7a7395e gerbview enhancement: polygons can be shown in sketch mode. Some translations 2007-11-02 09:58:42 +00:00
dickelbeck 3cd47555ca see 2007-Oct-12 change_log.txt 2007-10-13 06:18:44 +00:00
plyatov bfa36f3142 Little correction of typos and termins. 2007-09-14 10:07:38 +00:00
dickelbeck 18d83b768c See my change_log.txt 2007-Sep-13 UPDATE 2007-09-13 11:55:46 +00:00
dickelbeck cc62305777 see change_log.txt for 2007-Aug-22 2007-08-23 04:28:46 +00:00
raburton dedb0228dc add files not currently available in source (e.g. docs, modules, etc.)
set svn:eol-style property to native for all ascii files to support cross platform development
2007-06-05 12:10:51 +00:00
plyatov 23c40f7e86 Initial import of KiCad. 2007-05-06 16:03:28 +00:00