From 2823263f5cdc3aa2491431f619e81dc172d7d339 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Wed, 1 Jul 2026 14:59:42 +0900
Subject: kicker panner: rework code for scrolling timer

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
 kicker/libkicker/panner.cpp | 32 +++++++++++++++++++-------------
 kicker/libkicker/panner.h   |  2 ++
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/kicker/libkicker/panner.cpp b/kicker/libkicker/panner.cpp
index 0401cfcdc..23397e941 100644
--- a/kicker/libkicker/panner.cpp
+++ b/kicker/libkicker/panner.cpp
@@ -40,7 +40,8 @@ Panner::Panner( TQWidget* parent, const char* name )
       _luSB(0),
       _rdSB(0),
       _cwidth(0), _cheight(0),
-      _cx(0), _cy(0)
+      _cx(0), _cy(0),
+      _step(8)
 {
     TDEGlobal::locale()->insertCatalogue("libkicker");
     setBackgroundOrigin( AncestorOrigin );
@@ -58,6 +59,11 @@ Panner::Panner( TQWidget* parent, const char* name )
     _layout = new TQBoxLayout(this, TQBoxLayout::LeftToRight);
     _layout->addWidget(_clipper, 1);
     setOrientation(TQt::Horizontal);
+
+    // scrolling timer
+    _scrollDir = true;
+    _scrollTimer = new TQTimer(this);
+    connect(_scrollTimer, TQ_SIGNAL(timeout()), TQ_SLOT(timedScroll()));
 }
 
 Panner::~Panner() 
@@ -151,44 +157,44 @@ void Panner::scrollRightDown()
 {
     if(orientation() == TQt::Horizontal) // scroll right
         scrollBy( _step, 0 );
-    else // scroll down
+    else                                 // scroll down
         scrollBy( 0, _step );
-    if (_step < 64)
-    _step++;
 }
 
 void Panner::scrollLeftUp()
 {
     if(orientation() == TQt::Horizontal) // scroll left
         scrollBy( -_step, 0 );
-    else // scroll up
+    else                                 // scroll up
         scrollBy( 0, -_step );
+}
+
+void Panner::timedScroll()
+{
+    _scrollDir ? scrollLeftUp() : scrollRightDown();
     if (_step < 64)
         _step++;
 }
 
 void Panner::startScrollRightDown()
 {
-    _scrollTimer = new TQTimer(this);
-    connect(_scrollTimer, TQ_SIGNAL(timeout()), TQ_SLOT(scrollRightDown()));
+    _scrollDir = false;
     _scrollTimer->start(50);
     _step = 8;
-    scrollRightDown();
+    timedScroll();
 }
 
 void Panner::startScrollLeftUp()
 {
-    _scrollTimer = new TQTimer(this);
-    connect(_scrollTimer, TQ_SIGNAL(timeout()), TQ_SLOT(scrollLeftUp()));
+    _scrollDir = true;
     _scrollTimer->start(50);
     _step = 8;
-    scrollLeftUp();
+    timedScroll();
 }
 
 void Panner::stopScroll()
 {
-    delete _scrollTimer;
-    _scrollTimer = 0;
+    _scrollTimer->stop();
 }
 
 void Panner::reallyUpdateScrollButtons()
diff --git a/kicker/libkicker/panner.h b/kicker/libkicker/panner.h
index 6d73ba5a8..bb87521c2 100644
--- a/kicker/libkicker/panner.h
+++ b/kicker/libkicker/panner.h
@@ -78,6 +78,7 @@ public slots:
     void stopScroll();
     void scrollRightDown();
     void scrollLeftUp();
+    void timedScroll();
     void reallyUpdateScrollButtons();
     void scrollBy(int dx, int dy);
 
@@ -104,6 +105,7 @@ private:
     SimpleArrowButton *_rdSB; // Right Scroll Button
     TQTimer *_updateScrollButtonsTimer;
     TQTimer *_scrollTimer;
+    bool _scrollDir;  // true = left/up, false = right/down
     
     TQWidget *_clipper;
     TQWidget *_viewport;
-- 
cgit v1.2.3

