[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Sat Apr 24 08:45:49 CEST 2004


CVS commit by arwalker: 

Base various alignment, resizing algorithms on focus view object.


  M +56 -41    ksttoplevelview.cpp   1.33


--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.32:1.33
@@ -554,7 +554,9 @@ bool KstTopLevelView::popupMenu(KPopupMe
 
 void KstTopLevelView::makeSameWidth() {
-  QRect gg = _selectionList.first()->geometry();
+  QRect gg;
   QSize size;
 
+  if( _pressTarget ) {
+    gg = _pressTarget->geometry();
   size.setWidth( gg.width() );
   for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
@@ -562,4 +564,5 @@ void KstTopLevelView::makeSameWidth() {
     (*i)->resize(size);
   }
+  }
 
   paint(true);
@@ -568,7 +571,9 @@ void KstTopLevelView::makeSameWidth() {
 
 void KstTopLevelView::makeSameHeight() {
-  QRect gg = _selectionList.first()->geometry();
+  QRect gg;
   QSize size;
 
+  if( _pressTarget ) {
+    gg = _pressTarget->geometry();
   size.setHeight( gg.height() );
   for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
@@ -576,5 +581,5 @@ void KstTopLevelView::makeSameHeight() {
     (*i)->resize(size);
   }
-
+  }
   paint(true);
 }
@@ -582,7 +587,9 @@ void KstTopLevelView::makeSameHeight() {
 
 void KstTopLevelView::makeSameSize() {
-  QRect gg = _selectionList.first()->geometry();
+  QRect gg;
   QSize size;
 
+  if( _pressTarget ) {
+    gg = _pressTarget->geometry();
   size.setHeight( gg.height() );
   size.setWidth( gg.width() );
@@ -590,5 +597,5 @@ void KstTopLevelView::makeSameSize() {
     (*i)->resize(size);
   }
-
+  }
   paint(true);
 }
@@ -596,7 +603,9 @@ void KstTopLevelView::makeSameSize() {
 
 void KstTopLevelView::alignLeft() {
-  QRect gg = _selectionList.first()->geometry();
+  QRect gg;
   QPoint point;
 
+  if( _pressTarget ) {
+    gg = _pressTarget->geometry();
   point.setX( gg.x() );
   for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
@@ -604,5 +613,5 @@ void KstTopLevelView::alignLeft() {
     (*i)->move(point);
   }
-
+  }
   paint(true);
 }
@@ -610,7 +619,9 @@ void KstTopLevelView::alignLeft() {
 
 void KstTopLevelView::alignRight() {
-  QRect gg = _selectionList.first()->geometry();
+  QRect gg;
   QPoint point;
 
+  if( _pressTarget ) {  
+    gg = _pressTarget->geometry();
   for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
     point.setX( gg.x() + gg.width() - (*i)->geometry().width() );
@@ -618,5 +629,5 @@ void KstTopLevelView::alignRight() {
     (*i)->move(point);
   }
-  
+  }
   paint(true);
 }
@@ -624,7 +635,9 @@ void KstTopLevelView::alignRight() {
 
 void KstTopLevelView::alignTop() {
-  QRect gg = _selectionList.first()->geometry();
+  QRect gg;
   QPoint point;
 
+  if( _pressTarget ) {
+    gg = _pressTarget->geometry();
   point.setY( gg.y() );
   for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
@@ -632,5 +645,5 @@ void KstTopLevelView::alignTop() {
     (*i)->move(point);
   }
-  
+  }
   paint(true);
 }
@@ -638,7 +651,9 @@ void KstTopLevelView::alignTop() {
 
 void KstTopLevelView::alignBottom() {
-  QRect gg = _selectionList.first()->geometry();
+  QRect gg;
   QPoint point;
 
+  if( _pressTarget ) {
+    gg = _pressTarget->geometry();
   for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
     point.setX( (*i)->geometry().x() );
@@ -646,5 +661,5 @@ void KstTopLevelView::alignBottom() {
     (*i)->move(point);
   }
-
+  }
   paint(true);
 }





More information about the Kst mailing list