* Add hot key handled return indicator to DRAW_FRAME::GeneralControl() and
DRAW_FRAME::OnHotKey() and all classed derived from DRAW_FRAME.
* Add code to all GeneralControl() and OnHotKey() functions to return true if
hot key was handled.
* Call event skip in DRAW_PANEL::OnKeyEvent() when key event is not handled to
allow default menu event handler to function properly.
- Refactored the common part of cursor key movement and crosshair update
in the various GeneralControl
- Add x10 movement with the keyboard (CTRL modifier)
- Avoid fixup of the cursor position by dummy mouse movements generated
by cursor warping (original analysis and idea Chris Gibson)
- Do key handling in a way to permit sub-pixel cursor movement
*) add hotkey for setting the grid origin as 'S', in board editor, module editor.
*) re-position the function interface for cursor movement from BASE_SCREEN into
class EDA_DRAW_FRAME. This is a prelude to getting rid of BASE_SCREEN or
splitting it up.
// 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;
}
* EDA_DRAW_PANEL completely encapsulated.
* Moved OSX m_overlay member from EDA_DRAW_PANEL to EDA_DRAW_FRAME where
it is used.
* Doxygen comment warning fixes.
* CVPcb now uses wxUpdateUIEvent instead of set toolbars.
* Removed duplicate event handlers in CVPcb that were factored into
EDA_DRAW_FRAME.
* Fix definition of GeneralControle() in CVPcb that prevented it from being
called.
* Remove rarely used and scary refresh code GeneralControle() method in all
main frame windows.
* Factor zoom menu and tool bar command IDs down to EDA_DRAW_FRAME.
* Old control state handling code completely removed in all applications.
* Factor common control state handlers into EDA_DRAW_FRAME.
* Replaced EDA_ITEM test for newness with IsNew() method.
* Factor vertical right toolbar command handlers out of giant edit command
switch statement in EESchema and PCBNew.
* Rename all member variables and methods that reference the cross hair
code in draw panel object from cursor to cross hair to eliminate confusion
between the two concepts.
* Rename cursor capture call backs in draw panel object to improve code
readability.
* Create helper class for turning off the cross hair while drawing.
* Remove redundant block clear code.
* Remove redundant mouse capture call back reset code when end capture
call back is called.
* Remove unused function definitions in base draw frame object.
* Lots of minor coding policy and doxygen comment fixes.
* Changed managed cursor callback definition to include the current
cursor drawing position.
* Modified all managed cursor callbacks to match new definition.
* Added snap to grid option to base drawing frame object.
* Changed add no connect managed cursor callback to use new position
parameter instead of the stored one.
* Lots of coding policy fixes.
* Remove unused member variable m_SizeVisu from base screen object.
* Move nearest grid position code into base screen object.
* Add get cursor position method to base screen object.
* Add position parameter to OnHotKey method in base draw frame and all
derived objects.
* Pass logical position on left mouse button click and double click
events instead of device position.
* Pass logical position to on right mouse button click instead of device
position.
* Use logical event position parameter for locating items in EESchema
instead of the stored position.
* Remove unused position parameter when displaying component edit dialog
in EESchema.
* Comment out debugging macro in eeschema/template_field_names.cpp that was
preventing debug builds using wxWidgets 2.8.x.
* Make USE_WX_ZOOM clipping routine actually clip rather than just test
if line needs drawn.
* Clean up as many USE_WX_ZOOM #ifdefs as possible.
* Minor coordinate rounding improvements.
* Minor scrolling and panning improvements.
* Remove unused KicadGraphicContext object code.
* Implement code to allow wxDC to handle coordinate conversions between
device and drawing units.
* Add build settings to enable wxGCDC for wxGraphicsContext testing.
* Remove wxAUI conditional build cruft as it is now required to build
Kicad.
* Fix scroll increment size regression to prevent jumping around the
zoom center position.
* Add find GDI+ cmake module for building on WXMSW when wxGraphicsContext
is enabled.
* Create single event handler for grid size events.
* Fix all frame windows to use new grid size event handler.
* Use offset relative to ID instead of ComboBox index to save last grid size.
* Move last grid size load/save setting into WinEDA_DrawFrame.
* Add equality and assignment operators the GRID_TYPE.
* Add current grid helper methods to BASE_SCREEN.
* Add GetPins helper to LIB_COMPONENT to replace GetNextPin where applicable.
* Add AppendMsgPanel helper to WinEDA_DrawFrame.
* Improve rounding for display of coordinates when millimeter units are selected.
* Split out application specific command IDs to prevent unnecessary rebuilding.
* Eliminate duplicate menu and tool bar command IDs.
* Split component library editor and viewer definitions to separate header files.
* More component library and document file merge code.
* A bunch of minor string readability and consistency fixes.