[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    [PATCH] Fix table column resizing
From:       Sven Langkamp <longamp () reallygood ! de>
Date:       2003-12-05 20:56:42
[Download RAW message or body]

Hi

This patch applies to kword/kwtableframeset.cc
The patch fixes a bug, which destroyed one of my table for several times. The 
bug appear, when you resize a column of a table and drag it over another 
coloum. The result is that the columns overlap.

The patch forbids the user to resize the frame smaller than the minimum 
frame-size.

I have tested the it on HEAD, but be careful it's the first patch I ever 
created and I'am not very familiar with the koffice code, so there may be a 
better solution.

Sven



["tablepatch.diff" (text/x-diff)]

? tablepatch.diff
Index: kword/kwtableframeset.cc
===================================================================
RCS file: /home/kde/koffice/kword/kwtableframeset.cc,v
retrieving revision 1.258
diff -u -r1.258 kwtableframeset.cc
--- kword/kwtableframeset.cc	1 Dec 2003 16:01:53 -0000	1.258
+++ kword/kwtableframeset.cc	5 Dec 2003 20:22:59 -0000
@@ -707,7 +707,13 @@
 void KWTableFrameSet::resizeColumn( unsigned int col, double x )
 {
     kdDebug() << k_funcinfo << col << "," << x << endl;
-    m_colPositions[ col ] = x;
+    if ((col != 0) && (x - m_colPositions[ col-1 ] < s_minFrameWidth))
+      m_colPositions[ col ] = m_colPositions[ col-1 ] + s_minFrameWidth;
+    else
+      if ((col != m_colPositions.count()-1) && (m_colPositions[ col + 1 ] - x < s_minFrameWidth))
+        m_colPositions[col] = m_colPositions[ col + 1 ] - s_minFrameWidth;
+      else
+        m_colPositions[ col ] = x;
 
     // move all cells right of 'col'
     for (TableIter cell(this); cell; ++cell) {


____________________________________
koffice mailing list
koffice@mail.kde.org
To unsubscribe please visit:
https://mail.kde.org/mailman/listinfo/koffice


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic