← Back to team overview

kicad-developers team mailing list archive

Re: Strange behaviour, schematic, moving components doesn't obey the grid

 

Arf, I already had my own personal welcome, when I started using kicad on
OSX,
packed Marco Serantoni wx patches into the KiCad builder.. and then Felix
Morgner contributed
a few more.

It looks like we will have a new one soon.

wxwidgets for macosx seems to poll over all the system available keyboards,
may be something
new I connected is acting as an evil keyboard...


bool wxGetKeyState (wxKeyCode key)
{

  [...]

  for(size_t i = 0; i < wxHIDModule::sm_keyboards.GetCount(); ++i)
    {
        wxHIDKeyboard* keyboard = (wxHIDKeyboard*)
                                wxHIDModule::sm_keyboards[i];

    switch(key)
    {
    case WXK_SHIFT:
            if( keyboard->IsActive(WXK_SHIFT) ||
                   keyboard->IsActive(WXK_RSHIFT) )
            {
                return true;
            }
        break;

Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 636 52 25 69
skype: ajoajoajo


2013/9/16 Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx>

> On 09/16/2013 03:54 PM, Miguel Angel wrote:
>
>> It really seems like a wx/MACOSX related bug to me,
>>
>>  Miguel,
>
> Welcome to the wonderful world of cross-platform compatibility of
> wxWidgets. This is exactly why we (me & Orson) don't want to use any sort
> of wx events in new tools.
>
> Cheers,
> Tom
>
>
>    printf("snapToGrid: %d , aHotkey:%d WXKSHIFT: %d, WXKCONTROL:
>> %d\n",snapToGrid,aHotKey ,wxGetKeyState( WXK_SHIFT ), wxGetKeyState(
>> WXK_CONTROL ));
>>     always print WXK_SHIFT and WXK_CONTROL as "true"....
>>
>> snapToGrid: 0 , aHotkey:0 WXKSHIFT: 1, WXKCONTROL: 1
>> snapToGrid: 0 , aHotkey:0 WXKSHIFT: 1, WXKCONTROL: 1
>> snapToGrid: 0 , aHotkey:0 WXKSHIFT: 1, WXKCONTROL: 1
>> snapToGrid: 0 , aHotkey:0 WXKSHIFT: 1, WXKCONTROL: 1
>> snapToGrid: 0 , aHotkey:0 WXKSHIFT: 1, WXKCONTROL: 1
>> snapToGrid: 0 , aHotkey:0 WXKSHIFT: 1, WXKCONTROL: 1
>> snapToGrid: 0 , aHotkey:0 WXKSHIFT: 1, WXKCONTROL: 1
>> snapToGrid: 0 , aHotkey:0 WXKSHIFT: 1, WXKCONTROL: 1
>>
>>
>>
>> For reference:
>>
>>
>>       ::wxGetKeyState
>>
>> *bool* *wxGetKeyState*(*wxKeyCode */key/)
>>
>>
>> For normal keys, returns true if the specified key is currently down.
>>
>> For togglable keys (Caps Lock, Num Lock and Scroll Lock), returns
>> true if the key is toggled such that its LED indicator is lit. There is
>> currently no way to test whether togglable keys are up or down.
>>
>> Even though there are virtual key codes defined for mouse buttons, they
>> cannot be used with this function currently.
>>
>> *Include files*
>>
>>
>> <wx/utils.h>
>>
>>
>> Miguel Angel Ajo Pelayo
>> http://www.nbee.es
>> +34 636 52 25 69
>> skype: ajoajoajo
>>
>>
>> 2013/9/16 Miguel Angel <miguelangel@xxxxxx <mailto:miguelangel@xxxxxx>>
>>
>>
>>     I highly suspect that this behaviour comes from here
>>     (eeschema/controle.cpp), may be a "wxBug(tm)" related to Mac OSX? ..
>>
>>
>>     this look like a lot of conditions to get satisfied by a bug......:
>>
>>          if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState(
>>     WXK_CONTROL ) )
>>              snapToGrid = false;
>>
>>     but this second line, really matches the behaviour described in my
>>     previous email:
>>
>>          // Cursor is left off grid only if no block in progress
>>          if( GetScreen()->m_BlockLocate.**GetState() != STATE_NO_BLOCK )
>>              snapToGrid = true;
>>
>>     stay tuned.
>>
>>     void SCH_EDIT_FRAME::**GeneralControl( wxDC* aDC, const wxPoint&
>>     aPosition, int aHotKey )
>>     {
>>          wxRealPoint gridSize;
>>          SCH_SCREEN* screen = GetScreen();
>>          wxPoint     oldpos;
>>          wxPoint     pos = aPosition;
>>
>>          // when moving mouse, use the "magnetic" grid, unless the
>>     shift+ctrl keys is pressed
>>          // for next cursor position
>>          // ( shift or ctrl key down are PAN command with mouse wheel)
>>          bool snapToGrid = true;
>>          if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState(
>>     WXK_CONTROL ) )
>>              snapToGrid = false;
>>
>>          // Cursor is left off grid only if no block in progress
>>          if( GetScreen()->m_BlockLocate.**GetState() != STATE_NO_BLOCK )
>>              snapToGrid = true;
>>
>>          if( snapToGrid )
>>              pos = GetNearestGridPosition( pos );
>>
>>          oldpos   = GetCrossHairPosition();
>>          gridSize = screen->GetGridSize();
>>
>>
>>     Miguel Angel Ajo Pelayo
>>     http://www.nbee.es
>>     +34 636 52 25 69 <tel:%2B34%20636%2052%2025%**2069>
>>     skype: ajoajoajo
>>
>>
>>     2013/9/16 Miguel Angel <miguelangel@xxxxxx <mailto:miguelangel@xxxxxx
>> >>
>>
>>
>>         More detail about this, it happens to me with bzr4313 and
>>         bzr4107 , I don't remember having problems with
>>         this previously.
>>
>>
>>         When I move a block of components, the grid snap works.
>>         If I move a single component ('M key') it moves, with no snap.
>>         If I draw a wire, no snap.
>>
>>         Could it be a misconfiguration on my side?, I erased the .pro
>>         eeschema section
>>         for just in case it was reading an old (no nanometer setting),
>>         but may be it's more like a system wide setting.
>>
>>         (Where) does eeschema/kicad store system wide settings?
>>
>>
>>         Miguel Angel Ajo Pelayo
>>         http://www.nbee.es
>>         +34 636 52 25 69 <tel:%2B34%20636%2052%2025%**2069>
>>
>>         skype: ajoajoajo
>>
>>
>>         2013/9/13 Miguel Angel <miguelangel@xxxxxx
>>         <mailto:miguelangel@xxxxxx>>
>>
>>
>>
>>             Is it normal/does it only happen on my system?,
>>
>>             When I draw a wire or when I move a component,
>>             the grid is painted, but doesn't seem to work.
>>
>>             It's making it impossible to me to match connections ':)
>>
>>
>>
>>             Miguel Angel Ajo Pelayo
>>             http://www.nbee.es
>>             +34 636 52 25 69 <tel:%2B34%20636%2052%2025%**2069>
>>             skype: ajoajoajo
>>
>>
>>
>>
>>
>>
>> ______________________________**_________________
>> Mailing list: https://launchpad.net/~kicad-**developers<https://launchpad.net/~kicad-developers>
>> Post to     : kicad-developers@lists.**launchpad.net<kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> Unsubscribe : https://launchpad.net/~kicad-**developers<https://launchpad.net/~kicad-developers>
>> More help   : https://help.launchpad.net/**ListHelp<https://help.launchpad.net/ListHelp>
>>
>>
>

References