← Back to team overview

kicad-developers team mailing list archive

Re: 1: GAL Bug with Window Buttons

 

Hi all,

Here's a patch that adds support for the scrollbar buttons (and clicking in
the empty space) in GAL.
Seems to work okay in Linux, but that's all I can test tonight.
Let me know if you find any issues.


-Jon

On Wed, Sep 13, 2017 at 5:38 PM, Bernhard Stegmaier <stegmaier@xxxxxxxxxxxxx
> wrote:

> Yes, they are not shown for MacOS.
> I tried to get them working long ago, but didn’t succeed.
> However, this might just have been due to my inability… :)
>
>
> Regards,
> Bernhard
>
> On 13. Sep 2017, at 21:54, Jon Evans <jon@xxxxxxxxxxxxx> wrote:
>
> The scrollbars are also disabled on MacOS in the code (for reasons I don't
> know) -- is there a bug in LP for this already?  I couldn't find one with a
> quick search.
>
> On Wed, Sep 13, 2017 at 1:37 PM, Andrey Kuznetsov <kandrey89@xxxxxxxxx>
> wrote:
>
>> Same thing here:
>>
>> Application: kicad
>> Version: (2017-09-07 revision 90668f9ef)-makepkg, release build
>> Libraries:
>>     wxWidgets 3.0.3
>>     libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0
>> nghttp2/1.23.1 librtmp/2.3
>> Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian,
>> wxMSW
>> Build Info:
>>     wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
>>     Boost: 1.60.0
>>     Curl: 7.54.1
>>     Compiler: GCC 7.1.0 with C++ ABI 1011
>>
>> Build settings:
>>     USE_WX_GRAPHICS_CONTEXT=OFF
>>     USE_WX_OVERLAY=OFF
>>     KICAD_SCRIPTING=ON
>>     KICAD_SCRIPTING_MODULES=ON
>>     KICAD_SCRIPTING_WXPYTHON=ON
>>     KICAD_SCRIPTING_ACTION_MENU=ON
>>     BUILD_GITHUB_PLUGIN=ON
>>     KICAD_USE_OCE=ON
>>     KICAD_SPICE=ON
>>
>>
>> On Wed, Sep 13, 2017 at 3:02 AM, Marcos Chaparro <nitrousnrg@xxxxxxxxx>
>> wrote:
>>
>>> I can confirm this on sept 6 nighties.
>>>
>>> Regards
>>>
>>> On Sep 13, 2017 03:07, "Strontium" <strntydog@xxxxxxxxx> wrote:
>>>
>>>> On 13/09/17 13:24, Nick Østergaard wrote:
>>>>
>>>>> What version of kicad did he test?
>>>>>
>>>> Application: kicad
>>>> Version: no-vcs-found-8182369~60~ubuntu16.04.1, release build
>>>> Libraries:
>>>>     wxWidgets 3.0.2
>>>>     libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
>>>> Platform: Linux 4.4.0-93-generic x86_64, 64 bit, Little endian, wxGTK
>>>> Build Info:
>>>>     wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+
>>>> 2.24
>>>>     Boost: 1.58.0
>>>>     Curl: 7.47.0
>>>>     Compiler: GCC 5.4.0 with C++ ABI 1009
>>>>
>>>> Build settings:
>>>>     USE_WX_GRAPHICS_CONTEXT=OFF
>>>>     USE_WX_OVERLAY=OFF
>>>>     KICAD_SCRIPTING=ON
>>>>     KICAD_SCRIPTING_MODULES=ON
>>>>     KICAD_SCRIPTING_WXPYTHON=ON
>>>>     KICAD_SCRIPTING_ACTION_MENU=ON
>>>>     BUILD_GITHUB_PLUGIN=ON
>>>>     KICAD_USE_OCE=ON
>>>>     KICAD_SPICE=ON
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>> Remember The Past, Live The Present, Change The Future
>> Those who look only to the past or the present are certain to miss the
>> future [JFK]
>>
>> kandrey89@xxxxxxxxx
>> Live Long and Prosper,
>> Andrey
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
>
>
From 8a93c2d1ac32dcf4cc49f55ce49945d2317f4154 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Wed, 13 Sep 2017 20:07:29 -0400
Subject: [PATCH] Support scrollbar controls in GAL canvas

---
 common/view/wx_view_controls.cpp | 59 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 52 insertions(+), 7 deletions(-)

diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp
index 9f9dcdc8b..d403e6581 100644
--- a/common/view/wx_view_controls.cpp
+++ b/common/view/wx_view_controls.cpp
@@ -63,6 +63,14 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel
                             wxMouseEventHandler( WX_VIEW_CONTROLS::onLeave ), NULL, this );
     m_parentPanel->Connect( wxEVT_SCROLLWIN_THUMBTRACK,
                             wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
+    m_parentPanel->Connect( wxEVT_SCROLLWIN_LINEUP,
+                            wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
+    m_parentPanel->Connect( wxEVT_SCROLLWIN_LINEDOWN,
+                            wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
+    m_parentPanel->Connect( wxEVT_SCROLLWIN_PAGEUP,
+                            wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
+    m_parentPanel->Connect( wxEVT_SCROLLWIN_PAGEDOWN,
+                            wxScrollWinEventHandler( WX_VIEW_CONTROLS::onScroll ), NULL, this );
 
     m_panTimer.SetOwner( this );
     this->Connect( wxEVT_TIMER,
@@ -335,15 +343,52 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
 
 void WX_VIEW_CONTROLS::onScroll( wxScrollWinEvent& aEvent )
 {
-    VECTOR2D center = m_view->GetCenter();
-    const BOX2I& boundary = m_view->GetBoundary();
+    const double linePanDelta = 0.05;
+    const double pagePanDelta = 0.5;
+
+    int type = aEvent.GetEventType();
+    int dir = aEvent.GetOrientation();
 
-    if( aEvent.GetOrientation() == wxHORIZONTAL )
-        center.x = boundary.GetLeft() + aEvent.GetPosition() / m_scrollScale.x;
-    else if( aEvent.GetOrientation() == wxVERTICAL )
-        center.y = boundary.GetTop() + aEvent.GetPosition() / m_scrollScale.y;
+    if( type == wxEVT_SCROLLWIN_THUMBTRACK )
+    {
+        VECTOR2D center = m_view->GetCenter();
+        const BOX2I& boundary = m_view->GetBoundary();
+
+        if( dir == wxHORIZONTAL )
+            center.x = boundary.GetLeft() + aEvent.GetPosition() / m_scrollScale.x;
+        else
+            center.y = boundary.GetTop() + aEvent.GetPosition() / m_scrollScale.y;
+
+        m_view->SetCenter( center );
+    }
+    else
+    {
+        double dist = 0;
+
+        if( type == wxEVT_SCROLLWIN_PAGEUP )
+            dist = pagePanDelta;
+        else if( type == wxEVT_SCROLLWIN_PAGEDOWN )
+            dist = -pagePanDelta;
+        else if( type == wxEVT_SCROLLWIN_LINEUP )
+            dist = linePanDelta;
+        else if( type == wxEVT_SCROLLWIN_LINEDOWN )
+            dist = -linePanDelta;
+
+        VECTOR2D scroll = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) * dist;
+
+        double scrollX = 0.0;
+        double scrollY = 0.0;
+
+        if ( dir == wxHORIZONTAL )
+            scrollX = -scroll.x;
+        else
+            scrollY = -scroll.y;
+
+        VECTOR2D delta( scrollX, scrollY );
+
+        m_view->SetCenter( m_view->GetCenter() + delta );
+    }
 
-    m_view->SetCenter( center );
     m_parentPanel->Refresh();
 }
 
-- 
2.11.0


Follow ups

References