[QGIS Commit] r8669 - in branches/advanced_printing_branch/src: app app/composer ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jun 22 10:59:40 EDT 2008


Author: mhugent
Date: 2008-06-22 10:59:40 -0400 (Sun, 22 Jun 2008)
New Revision: 8669

Modified:
   branches/advanced_printing_branch/src/app/CMakeLists.txt
   branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposer.h
   branches/advanced_printing_branch/src/app/composer/qgscomposeritem.h
   branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposermap.h
   branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.h
   branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposerview.h
   branches/advanced_printing_branch/src/app/composer/qgscomposition.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposition.h
   branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui
   branches/advanced_printing_branch/src/ui/qgscompositionbase.ui
Log:
Started scale bar implementations. Not in a usable state yet

Modified: branches/advanced_printing_branch/src/app/CMakeLists.txt
===================================================================
--- branches/advanced_printing_branch/src/app/CMakeLists.txt	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/CMakeLists.txt	2008-06-22 14:59:40 UTC (rev 8669)
@@ -63,8 +63,8 @@
   #composer/qgscomposerpicture.cpp
   composer/qgscomposermap.cpp
   composer/qgscomposermapwidget.cpp
-  #composer/qgscomposerscalebar.cpp
-  #composer/qgscomposerscalebarwidget.cpp
+  composer/qgscomposerscalebar.cpp
+  composer/qgscomposerscalebarwidget.cpp
   #composer/qgscomposervectorlegend.cpp
   composer/qgscomposerview.cpp
   composer/qgscomposition.cpp
@@ -125,7 +125,7 @@
   composer/qgscomposermap.h
   composer/qgscomposermapwidget.h
   #composer/qgscomposerpicture.h
-  #composer/qgscomposerscalebarwidget.h
+  composer/qgscomposerscalebarwidget.h
   #composer/qgscomposervectorlegend.h
   composer/qgscomposerview.h
   composer/qgscomposeritemgroup.h

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp	2008-06-22 14:59:40 UTC (rev 8669)
@@ -25,6 +25,8 @@
 #include "qgscomposerlabelwidget.h"
 #include "qgscomposermap.h"
 #include "qgscomposermapwidget.h"
+#include "qgscomposerscalebar.h"
+#include "qgscomposerscalebarwidget.h"
 #include "qgsexception.h"
 #include "qgsproject.h"
 #include "qgsmessageviewer.h"
@@ -91,6 +93,7 @@
   connect(mView, SIGNAL(composerLabelAdded(QgsComposerLabel*)), this, SLOT(addComposerLabel(QgsComposerLabel*)));
   connect(mView, SIGNAL(composerMapAdded(QgsComposerMap*)), this, SLOT(addComposerMap(QgsComposerMap*)));
   connect(mView, SIGNAL(itemRemoved(QgsComposerItem*)), this, SLOT(deleteItem(QgsComposerItem*)));
+  connect(mView, SIGNAL(composerScaleBarAdded(QgsComposerScaleBar*)), this, SLOT(addComposerScaleBar(QgsComposerScaleBar*)));
 
   mComposition  = new QgsComposition(mQgis->getMapCanvas());
   mView->setComposition(mComposition);
@@ -855,12 +858,12 @@
   QSvgGenerator generator;
   generator.setFileName(myOutputFileNameQString);
   generator.setSize(QSize( (int)mComposition->paperWidth(), (int)mComposition->paperHeight() ));
-  //generator.setResolution((int)(mComposition->resolution() / 25.4)); //because the rendering is done in mm, convert the dpi
- 
+  generator.setResolution(25.4); //because the rendering is done in mm, convert the dpi
+
   QPainter p(&generator);
   QRectF renderArea(0,0, mComposition->paperWidth(), mComposition->paperHeight());
 #endif
-  mComposition->render(&p, renderArea);
+  mComposition->render(&p, renderArea, renderArea);
   p.end();
 
   mComposition->setPlotStyle ( QgsComposition::Preview );
@@ -939,11 +942,10 @@
 
 void QgsComposer::on_mActionAddNewScalebar_activated(void)
 {
-#if 0
-  mComposition->setTool ( QgsComposition::AddScalebar );
-  setToolActionsOff();
-  mActionAddNewScalebar->setOn ( true );
-#endif //0
+  if(mView)
+    {
+      mView->setCurrentTool(QgsComposerView::AddScalebar);
+    }
 }
 
 void QgsComposer::on_mActionAddImage_activated(void)
@@ -1130,6 +1132,17 @@
   mItemWidgetMap.insert(label, labelWidget);
 }
 
+void QgsComposer::addComposerScaleBar(QgsComposerScaleBar* scalebar)
+{
+  if(!scalebar)
+    {
+      return;
+    }
+  
+  QgsComposerScaleBarWidget* sbWidget = new QgsComposerScaleBarWidget(scalebar);
+  mItemWidgetMap.insert(scalebar, sbWidget);
+}
+
 void QgsComposer::deleteItem(QgsComposerItem* item)
 {
   QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.find(item);

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposer.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposer.h	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposer.h	2008-06-22 14:59:40 UTC (rev 8669)
@@ -23,6 +23,7 @@
 class QgisApp;
 class QgsComposerLabel;
 class QgsComposerMap;
+class QgsComposerScaleBar;
 class QgsComposerView;
 class QgsComposition;
 class QgsMapCanvas;
@@ -166,6 +167,9 @@
     /**Adds a composer label to the item/widget map and creates a configuration widget for it*/
     void addComposerLabel(QgsComposerLabel* label);
 
+    /**Adds a composer scale bar to the item/widget map and creates a configuration widget for it*/
+    void addComposerScaleBar(QgsComposerScaleBar* scalebar);
+
     /**Removes item from the item/widget map and deletes the configuration widget*/
     void deleteItem(QgsComposerItem* item);
     

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposeritem.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposeritem.h	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposeritem.h	2008-06-22 14:59:40 UTC (rev 8669)
@@ -89,6 +89,8 @@
     virtual void addItem(QgsComposerItem* item) {}
     virtual void removeItems() {}
 
+    const QgsComposition* composition() const {return mComposition;}
+
 protected:
     
     QgsComposition* mComposition;

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp	2008-06-22 14:59:40 UTC (rev 8669)
@@ -36,12 +36,14 @@
 #include <iostream>
 #include <cmath>
 
+int QgsComposerMap::mCurrentComposerId = 0;
+
 QgsComposerMap::QgsComposerMap ( QgsComposition *composition, int x, int y, int width, int height )
   : QgsComposerItem(x, y, width, height, composition)
 {
     mComposition = composition;
     mMapCanvas = mComposition->mapCanvas();
-    mName = "Map"; //QString(tr("Map %1").arg(mId)); //todo: make static member as counter
+    mId = mCurrentComposerId++;
     
     // Cache
     mCacheUpdated = false;
@@ -65,7 +67,7 @@
 {
     mComposition = composition;
     mMapCanvas = mComposition->mapCanvas();
-    mName = "Map"; //QString(tr("Map %1").arg(mId)); //todo: make static member as counter
+    mId = mCurrentComposerId++;
     QGraphicsRectItem::show();
 }
 
@@ -233,11 +235,6 @@
   return calculator.calculate(mExtent, rect().width());
 }
 
-QString QgsComposerMap::name ( void ) 
-{
-    return mName;
-}
-
 void QgsComposerMap::resize(double dx, double dy)
 {
   //setRect

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposermap.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposermap.h	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposermap.h	2008-06-22 14:59:40 UTC (rev 8669)
@@ -71,8 +71,8 @@
     /** \brief Create cache image */
     void cache ( void );
     
-    /** \brief Map name, used in legend combobox etc. */
-    QString name ( void );
+    /** \brief Get identification number*/
+    int id() const {return mId;}
 
     /** resizes an item in x- and y direction (canvas coordinates)*/
     void resize(double dx, double dy);
@@ -113,8 +113,8 @@
     // Pointer to map canvas
     QgsMapCanvas *mMapCanvas;
     
-    /** \brief Map name, used in legend combobox etc. */
-    QString mName;
+    /**Unique identifier*/
+    int mId;
 
     // Map region in map units realy used for rendering 
     // It can be the same as mUserExtent, but it can be bigger in on dimension if mCalculate==Scale,
@@ -142,6 +142,9 @@
     /**Store last scale factor to avoid unnecessary repaints in case preview mode is 'Render'*/
     double mLastScaleFactorX;
 
+    /**For the generation of new unique ids*/
+    static int mCurrentComposerId;
+
     /**Returns the zoom factor of the graphics view. If no 
      graphics view exists, the default 1 is returned*/
     double horizontalViewScaleFactor() const;

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp	2008-06-22 14:59:40 UTC (rev 8669)
@@ -15,10 +15,14 @@
  ***************************************************************************/
 
 #include "qgscomposerscalebar.h"
+#include "qgscomposermap.h"
+#include "qgsrect.h"
+#include <QFontMetricsF>
+#include <QPainter>
 
-QgsComposerScaleBar::QgsComposerScaleBar(QgsComposition* composition): QgsComposerItem(0)
+QgsComposerScaleBar::QgsComposerScaleBar(QgsComposition* composition): QgsComposerItem(composition), mComposerMap(0), mStyle(QgsComposerScaleBar::Single_Box), mSegmentMM(0.0)
 {
-  
+  mLabelBarSpace = 3.0;
 }
 
 QgsComposerScaleBar::~QgsComposerScaleBar()
@@ -28,11 +32,174 @@
 
 void QgsComposerScaleBar::paint (QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget)
 {
-  //soon...
+  //calculate top level of the bar
+  QFontMetricsF labelFontMetrics(mFont);
+  double barTopPosition = labelFontMetrics.height() + mLabelBarSpace;
+
+  switch(mStyle)
+    {
+    case QgsComposerScaleBar::Single_Box:
+      drawScaleBarSingleBox(painter, barTopPosition);
+      break;
+    default:
+      break;
+    }
+
+  drawLabels(painter);
+
+  //draw frame and selection boxes if necessary
+  drawFrame(painter);
+  if(isSelected())
+    {
+      drawSelectionBoxes(painter);
+    }
 }
 
+void QgsComposerScaleBar::setNumUnitsPerSegment(double units)
+{
+  mNumUnitsPerSegment = units;
+  refreshSegmentMM();
+}
 
+void QgsComposerScaleBar::setComposerMap(const QgsComposerMap* map)
+{
+  mComposerMap = map;
+  refreshSegmentMM();
+}
 
+void QgsComposerScaleBar::refreshSegmentMM()
+{
+  if(mComposerMap)
+    {
+      //get extent of composer map
+      QgsRect composerMapRect = mComposerMap->extent();
+
+      //get mm dimension of composer map
+      QRectF composerItemRect = mComposerMap->rect();
+
+      //calculate size depending on mNumUnitsPerSegment
+      mSegmentMM = composerItemRect.width() / composerMapRect.width() * mNumUnitsPerSegment;
+    }
+}
+
+void QgsComposerScaleBar::applyDefaultSettings()
+{
+  mNumSegments = 3;
+  mNumSegmentsLeft = 1;
+
+  mHeight = 5;
+
+  mStyle = QgsComposerScaleBar::Single_Box;
+
+  mPen = QPen(QColor(0, 0, 0));
+  mPen.setWidthF(1.0);
+
+  mFont.setPointSizeF(8);
+
+  if(mComposerMap)
+    {
+      //calculate mNumUnitsPerSegment
+      QRectF composerItemRect = mComposerMap->rect();
+      QgsRect composerMapRect = mComposerMap->extent();
+
+      double widthScaleBar = composerItemRect.width() / 5;
+      mNumUnitsPerSegment = composerMapRect.width() / 5 / 4;
+    }
+
+  refreshSegmentMM();
+}
+
+void QgsComposerScaleBar::drawLabels(QPainter* p)
+{
+  if(!p)
+    {
+      return;
+    }
+
+  p->save();
+  p->setFont(mFont);
+
+  QFontMetricsF labelFontMetrics(mFont);
+  double fontHeight = labelFontMetrics.height();
+
+  double mCurrentXCoord = 0;
+
+  //draw labels of the left segments
+  for(int i = 0; i < mNumSegmentsLeft; ++i)
+    {
+      mCurrentXCoord += mSegmentMM / mNumSegmentsLeft;
+    }
+
+  double currentLabelNumber = 0.0;
+
+  //draw labels of the right segments
+  for(int i = 0; i < mNumSegments; ++i)
+    {
+      p->drawText(QPointF(mCurrentXCoord, fontHeight), QString::number(currentLabelNumber));
+      mCurrentXCoord += mSegmentMM;
+      currentLabelNumber += mNumUnitsPerSegment;
+    }
+  
+  p->restore();
+}
+
+void QgsComposerScaleBar::drawScaleBarSingleBox(QPainter* p, double barTopPosition) const
+{
+  if(!p)
+    {
+      return;
+    }
+
+  p->save();
+
+  //mHeight, mBrush, mPen
+  p->setPen(mPen);
+  p->setBrush(mBrush);
+
+  double mCurrentXCoord = 0;
+
+  bool useColor = true; //alternate brush color/white
+
+  //draw the left segments
+  for(int i = 0; i < mNumSegmentsLeft; ++i)
+    {
+      if(useColor) //alternating colors
+	{
+	  p->setBrush(QColor(255, 255, 255));
+	}
+      else
+	{
+	  p->setBrush(QColor(0, 0, 0));
+	}
+      QRectF segmentRect(mCurrentXCoord, barTopPosition, mSegmentMM/mNumSegmentsLeft, mHeight);
+      p->drawRect(segmentRect);
+      mCurrentXCoord += mSegmentMM / mNumSegmentsLeft;
+      useColor = !useColor;
+    }
+  
+  //draw the right segments
+  for(int i = 0; i < mNumSegments; ++i)
+    {
+      if(useColor) //alternating colors
+	{
+	  p->setBrush(QColor(255, 255, 255));
+	}
+      else
+	{
+	  p->setBrush(QColor(0, 0, 0));
+	}
+
+      QRectF segmentRect(mCurrentXCoord, barTopPosition, mSegmentMM, mHeight);
+      p->drawRect(segmentRect);
+      mCurrentXCoord += mSegmentMM;
+      useColor = !useColor;
+    }
+
+  p->restore();
+}
+
+
+
 #if 0
 #include "qgscomposerscalebar.h"
 #include "qgscomposermap.h"

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.h	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.h	2008-06-22 14:59:40 UTC (rev 8669)
@@ -19,6 +19,8 @@
 #include "qgscomposeritem.h"
 #include <QPen>
 
+class QgsComposerMap;
+
 class QgsComposerScaleBar: public QgsComposerItem
 {
  public:
@@ -46,7 +48,7 @@
   void setNumSegmentsLeft(int nSegmentsLeft) {mNumSegmentsLeft = nSegmentsLeft;}
 
   double numUnitsPerSegment() const {return mNumUnitsPerSegment;}
-  void setNumUnitsPerSegment(double units) {mNumUnitsPerSegment = units;}
+  void setNumUnitsPerSegment(double units);
 
   QString unitLabeling() const {return mUnitLabeling;}
   void setUnitLabeling(const QString& label){mUnitLabeling = label;}
@@ -63,11 +65,19 @@
   double height() const {return mHeight;}
   void setHeight(double h) {mHeight = h;}
 
+  void setComposerMap(const QgsComposerMap* map);
+  const QgsComposerMap* composerMap() const {return mComposerMap;}
+
+  /**Apply default settings (scale bar 1/5 of map item width)*/
+  void applyDefaultSettings();
+
+  void setStyle(QgsComposerScaleBar::Style style){mStyle = style;}
+
   
  protected:
 
   /**Reference to composer map object*/
-  QgsComposerMap* mComposerMap;
+  const QgsComposerMap* mComposerMap;
   /**Number of segments on right side*/
   int mNumSegments;
   /**Number of segments on left side*/
@@ -84,7 +94,23 @@
   QBrush mBrush;
   /**Height of bars/lines*/
   double mHeight;
+  /**Scalebar style*/
+  QgsComposerScaleBar::Style mStyle;
+  /**Space between bar and Text labels*/
+  double mLabelBarSpace;
+
+  /**Width of a segment (in mm)*/
+  double mSegmentMM;
+
+  /**Calculates with of a segment in mm and stores it in mSegmentMM*/
+  void refreshSegmentMM();
   
+  /**Draw text labels using the current font*/
+  void drawLabels(QPainter* p);
+
+  /**Draws this bar using single box style
+   @param barTopPosition Item coordinates of the bar top. Necessary because of Labels*/
+  void drawScaleBarSingleBox(QPainter* p, double barTopPosition) const;
 };
 
 #endif //QGSCOMPOSERSCALEBAR_H

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp	2008-06-22 14:59:40 UTC (rev 8669)
@@ -22,6 +22,7 @@
 #include "qgscomposerlabel.h"
 #include "qgscomposermap.h"
 #include "qgscomposeritemgroup.h"
+#include "qgscomposerscalebar.h"
 
 QgsComposerView::QgsComposerView( QWidget* parent, const char* name, Qt::WFlags f) :
   QGraphicsView(parent), mShiftKeyPressed(false), mRubberBandItem(0)
@@ -91,6 +92,27 @@
     }
     break;
 
+  case AddScalebar:
+    {
+      QgsComposerScaleBar* newScaleBar = new QgsComposerScaleBar(composition());
+      
+      //take first available map...
+      QList<const QgsComposerMap*> mapItemList = composition()->composerMapItems();
+      if(mapItemList.size() > 0)
+	{
+	  newScaleBar->setComposerMap(mapItemList.at(0));
+	}
+
+      newScaleBar->applyDefaultSettings(); //4 segments, 1/5 of composer map width
+      scene()->addItem(newScaleBar);
+      emit composerScaleBarAdded(newScaleBar);
+      newScaleBar->setSceneRect(QRectF(scenePoint.x(), scenePoint.y(), 20, 20)); //todo: change this...
+      scene()->clearSelection();
+      newScaleBar->setSelected(true);
+      emit selectedItemChanged(newScaleBar);
+    }
+    break;
+
   default:
     break;
   }
@@ -119,6 +141,7 @@
 	  }
 
 	QgsComposerMap* composerMap = new QgsComposerMap(composition(), mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height());
+	composerMap->setPreviewMode(QgsComposerMap::Rectangle);
 
 	emit composerMapAdded(composerMap);
 

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerview.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerview.h	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerview.h	2008-06-22 14:59:40 UTC (rev 8669)
@@ -26,6 +26,7 @@
 class QgsComposerItem;
 class QgsComposerLabel;
 class QgsComposerMap;
+class QgsComposerScaleBar;
 
 /**Widget to display the composer items. Manages the composer tools and the mouse/key events. 
  Creates the composer items according to the current map tools and keeps track off the rubber band item*/
@@ -88,6 +89,8 @@
   void composerLabelAdded(QgsComposerLabel* label);
   /**Is emitted when new composer map has been added to the view*/
   void composerMapAdded(QgsComposerMap* map);
+  /**Is emmitted when new composer scale bar has been added*/
+  void composerScaleBarAdded(QgsComposerScaleBar* scalebar);
   /**Is emitted when a composer item has been removed from the scene*/
   void itemRemoved(QgsComposerItem*);
 };

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposition.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposition.cpp	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposition.cpp	2008-06-22 14:59:40 UTC (rev 8669)
@@ -16,6 +16,7 @@
 
 #include "qgscomposition.h"
 #include "qgscomposeritem.h"
+#include "qgscomposermap.h"
 #include <QGraphicsRectItem>
 
 QgsComposition::QgsComposition(QgsMapCanvas* mapCanvas): QGraphicsScene(0), mMapCanvas(mapCanvas), mPlotStyle(QgsComposition::Preview), mPaperItem(0)
@@ -92,1015 +93,41 @@
   return composerItemList;
 }
 
-#if 0
-
-#include <typeinfo>
-
-#include "qgscomposition.h"
-
-#include "qgscomposer.h"
-#include "qgscomposeritem.h"
-#include "qgscomposeritemgroup.h"
-#include "qgscomposerlabel.h"
-#include "qgscomposerlabelwidget.h"
-
-#include "qgscomposermap.h"
-#include "qgscomposermapwidget.h"
-#include "qgscomposerpicture.h"
-#include "qgscomposerscalebar.h"
-#include "qgscomposervectorlegend.h"
-
-#include "qgscomposerview.h"
-#include "qgsmapcanvas.h"
-#include "qgsproject.h"
-
-#include <QGraphicsRectItem>
-#include <QMatrix>
-#include <QMessageBox>
-#include <QMouseEvent>
-
-#include <iostream>
-#include <math.h>
-
-QgsCompositionPaper::QgsCompositionPaper ( QString name, int w, int h, bool c) 
-  :mName(name), mWidth(w), mHeight(h), mCustom(c)
+QList<const QgsComposerMap*> QgsComposition::composerMapItems() const
 {
-}
+  QList<const QgsComposerMap*> resultList;
 
-QgsCompositionPaper::~QgsCompositionPaper ( )
-{
-}
-
-
-QgsComposition::QgsComposition( QgsComposer *c, int id ) 
-{
-  setupUi(this);
-  connect(mPaperWidthLineEdit, SIGNAL(editingFinished()), this, SLOT(paperSizeChanged()));
-  connect(mPaperHeightLineEdit, SIGNAL(editingFinished()), this, SLOT(paperSizeChanged()));
-  connect(mPaperOrientationComboBox, SIGNAL(activated(int)), this, SLOT(paperSizeChanged()));
-  connect(mPaperSizeComboBox, SIGNAL(activated(int)), this, SLOT(paperSizeChanged()));
-  connect(mResolutionLineEdit, SIGNAL(editingFinished()), this, SLOT(resolutionChanged()));
-
-#ifdef QGISDEBUG
-  std::cerr << "QgsComposition::QgsComposition()" << std::endl;
-#endif
-
-  mId = id;
-  mNextItemId = 1;
-  mCanvas = 0;
-  mPaperItem = 0;
-
-  mComposer = c;
-  mMapCanvas = c->mapCanvas();
-  mView = c->view();
-  mSelectedItem = 0;
-  mPlotStyle = Preview;
-  
-  // Attention: Qt4.1 writes line width to PS/PDF still as integer 
-  // (using QPen->width() to get the value) so we MUST use mScale > 1
-  
-  // Note: It seems that Qt4.2 is using widthF so that we can set mScale to 1
-  //       and hopefuly we can remove mScale completely
-
-  // Note: scale 10 make it inacceptable slow: QgsComposerMap 900x900mm on paper 1500x1000
-  //          cannot be smoothly moved even if mPreviewMode == Rectangle and no zoom in
-  //       scale 2 results in minimum line width 0.5 mmm which is too much
-  mScale = 1;
-
-  // Add paper sizes and set default. 
-  mPapers.push_back ( QgsCompositionPaper( tr("Custom"), 0, 0, 1 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("A5 (148x210 mm)"), 148, 210 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("A4 (210x297 mm)"), 210, 297 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("A3 (297x420 mm)"), 297, 420 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("A2 (420x594 mm)"), 420, 594 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("A1 (594x841 mm)"), 594, 841 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("A0 (841x1189 mm)"), 841, 1189 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("B5 (176 x 250 mm)"), 176, 250 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("B4 (250 x 353 mm)"), 250, 353 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("B3 (353 x 500 mm)"), 353, 500 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("B2 (500 x 707 mm)"), 500, 707 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("B1 (707 x 1000 mm)"), 707, 1000 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("B0 (1000 x 1414 mm)"), 1000, 1414 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("Letter (8.5x11 inches)"),  216, 279 ) );
-  mPapers.push_back ( QgsCompositionPaper( tr("Legal (8.5x14 inches)"), 216, 356 ) );
-
-  mPaper = mDefaultPaper = mCustomPaper = 0;
-  for( int i = 0; i < (int)mPapers.size(); i++ ) {
-    mPaperSizeComboBox->insertItem( mPapers[i].mName );
-    // Map - A4 land for now, if future read from template
-    if ( mPapers[i].mWidth == 210 && mPapers[i].mHeight == 297 ){
-      mDefaultPaper = i;
-    }
-    if ( mPapers[i].mCustom ) mCustomPaper = i;
-  }
-
-  // Orientation
-  mPaperOrientationComboBox->insertItem( tr("Portrait"), Portrait );
-  mPaperOrientationComboBox->insertItem( tr("Landscape"), Landscape );
-  mPaperOrientation = Landscape;
-
-  mPaperUnitsComboBox->insertItem( "mm" );
-
-  // Create canvas 
-  mPaperWidth = 1;
-  mPaperHeight = 1;
-  createCanvas();
-
-  // Tool
-  mRectangleItem = 0;
-  mNewCanvasItem = 0;
-  mTool = Select;
-  mToolStep = 0;
-}
-
-void QgsComposition::createDefault(void) 
-{
-  mPaperSizeComboBox->setCurrentItem(mDefaultPaper);
-  mPaperOrientationComboBox->setCurrentItem(Landscape);
-
-  mUserPaperWidth = mPapers[mDefaultPaper].mWidth;
-  mUserPaperHeight = mPapers[mDefaultPaper].mHeight;
-
-  recalculate();
-
-  mResolution = 300;
-
-  setOptions();
-
-  // Add the map to composition
-  /*
-     QgsComposerMap *m = new QgsComposerMap ( this, mNextItemId++, 
-     mScale*15, mScale*15, mScale*180, mScale*180 );
-     mItems.push_back(m);
-     */
-
-  // Add vector legend
-  /*
-     QgsComposerVectorLegend *vl = new QgsComposerVectorLegend ( this, mNextItemId++, 
-     mScale*210, mScale*100, 10 );
-     mItems.push_back(vl);
-     */
-
-  // Title
-  /*
-     QgsComposerLabel *tit = new QgsComposerLabel ( this, mNextItemId++, 
-     mScale*238, mScale*40, "Map", 24 );
-     mItems.push_back(tit);
-     */
-
-  // Tool
-  mRectangleItem = 0;
-  mNewCanvasItem = 0;
-  mTool = Select;
-  mToolStep = 0;
-
-  writeSettings();
-}
-
-void QgsComposition::createCanvas(void) 
-{
-  if ( mCanvas ) delete mCanvas;
-
-  mCanvas = new QGraphicsScene (0, 0, (int) mPaperWidth, (int) mPaperHeight);//top, left, width, height
-  mCanvas->setBackgroundBrush( QColor(180,180,180) );
-
-  // Paper
-  if ( mPaperItem ) delete mPaperItem;
-  mPaperItem = new QGraphicsRectItem( 0, 0, (int) mPaperWidth, (int) mPaperHeight, mPaperItem, mCanvas );
-
-  mPaperItem->setBrush( QColor(255,255,255) );
-  mPaperItem->setPen( QPen(QColor(0,0,0), 0) ); // 0 line width makes it use a cosmetic pen - 1px, regardless of scale.
-  mPaperItem->setZValue(0);
-  mPaperItem->setAcceptedMouseButtons(0);
-  mPaperItem->show();
-}
-
-void QgsComposition::resizeCanvas(void) 
-{
-  mCanvas->setSceneRect(0, 0, (int) mPaperWidth * mScale, (int) mPaperHeight * mScale );
-#ifdef QGISDEBUG
-  std::cout << "mCanvas width = " << mCanvas->width() << " height = " << mCanvas->height() << std::endl;
-#endif
-  mPaperItem->setRect(QRectF(0, 0, (int) mPaperWidth * mScale, (int) mPaperHeight * mScale ));
-}
-
-QgsComposition::~QgsComposition()
-{
-  mView->setScene ( 0 );
-
-  delete mPaperItem;
-  delete mCanvas;
-}
-
-QgsMapCanvas *QgsComposition::mapCanvas(void) { return mMapCanvas; }
-
-void QgsComposition::setActive (  bool active )
-{
-  if ( active ) {
-    mView->setScene ( mCanvas );
-    mComposer->showCompositionOptions ( this );
-  } else {
-    // TODO
-  }
-}
-
-void QgsComposition::mousePressEvent(QMouseEvent* e, bool shiftKeyPressed)
-{
-#ifdef QGISDEBUG
-  std::cerr << "QgsComposition::mousePressEvent() mTool = " << mTool << " mToolStep = "
-    << mToolStep << std::endl;
-#endif
-
-  QPointF p = mView->mapToScene(e->pos());
-
-//  mGrabPoint = mCanvas.mapToItem(p);
-
-  switch ( mTool ) 
+  QList<QGraphicsItem *> itemList = items();
+  QList<QGraphicsItem *>::iterator itemIt = itemList.begin();
+  for(; itemIt != itemList.end(); ++itemIt)
     {
-    case Select:
-      {
-
-        QGraphicsItem* newItem = 0;
-        newItem = mCanvas->itemAt(p);
-        if(newItem == mPaperItem) //ignore clicks on the paper
-        {
-	      newItem = 0;
-        }
-
-	QgsComposerItem* selectedItem = dynamic_cast<QgsComposerItem*>(newItem);
-	if(selectedItem)
-	  {
-	    if(!shiftKeyPressed)
-	      {
-		canvas()->clearSelection();
-	      }
-	    
-	    //toggle selection state of selected item
-	    bool currentSelectState = selectedItem->isSelected();
-	    selectedItem->setSelected(!currentSelectState);
-	    mComposer->showItemOptions(selectedItem);
-	  }
-	break;
-      }
-
-    case AddMap:
-
-#ifdef QGISDEBUG
-      std::cerr << "AddMap" << std::endl;
-#endif
-      if ( mToolStep == 0 ) 
+      const QgsComposerMap* composerMap = dynamic_cast<const QgsComposerMap*>(*itemIt);
+      if(composerMap)
 	{
-	  mRectangleItem = new QGraphicsRectItem( p.x(), p.y(), 0, 0, 0, mCanvas );//null parent
-	  mRectangleItem->setBrush( Qt::NoBrush );
-	  mRectangleItem->setPen( QPen(QColor(0,0,0), 0) );
-	  mRectangleItem->setZValue(100);
-	  mRectangleItem->show();
-	  mToolStep = 1;
+	  resultList.push_back(composerMap);
 	}
-#ifdef QGISDEBUG
-      std::cerr << "mToolStep = " << mToolStep << std::endl;
-#endif
-      break;
-    case AddLabel:
-      if(mToolStep == 0)
-	{
-	  QgsComposerLabel* newLabelItem = new QgsComposerLabel(this);
-	  newLabelItem->setText("Quantum GIS");
-	  newLabelItem->adjustSizeToText();
-	  newLabelItem->setSceneRect(QRectF(p.x(), p.y(), newLabelItem->rect().width(), newLabelItem->rect().height()));
-	  newLabelItem->setZValue(60);
-	  
-	  QgsComposerLabelWidget* newLabelWidget = new QgsComposerLabelWidget(newLabelItem);
-	  
-	  mComposer->addItem(newLabelItem, newLabelWidget);
-	  mItems.push_back(newLabelItem);
-	  canvas()->addItem(newLabelItem);
-	  newLabelItem->setSelected ( true );
-	  mCanvas->update();
-	  mComposer->showItemOptions(newLabelItem);
-	  mSelectedItem = newLabelItem;
-	  newLabelItem->show();
-	  mToolStep = 1;
-	  setTool(Select);
-	}
-      break;
-      /* //other items besides map disabled for the moment
-    case AddVectorLegend:
-      {
-        mNewCanvasItem->setPos(p);
-        QgsComposerVectorLegend *vl = dynamic_cast <QgsComposerVectorLegend*> (mNewCanvasItem);
-        vl->writeSettings();
-        mItems.push_back(vl);
-        mNewCanvasItem = 0;
-        mComposer->selectItem(); // usually just one legend
-
-        // Select and show options
-        vl->setSelected ( true );
-        mComposer->showItemOptions ( vl->options() );
-        mSelectedItem = dynamic_cast <QGraphicsItem*> (vl);
-
-        mCanvas->update();
-      }
-      break;
-    case AddScalebar:
-      {
-        mNewCanvasItem->setPos(p);
-        QgsComposerScalebar *sb = dynamic_cast <QgsComposerScalebar*> (mNewCanvasItem);
-        sb->writeSettings();
-        mItems.push_back(sb);
-        mNewCanvasItem = 0;
-        mComposer->selectItem(); // usually just one ???
-
-        // Select and show options
-        sb->setSelected ( true );
-        mComposer->showItemOptions ( sb->options() );
-        mSelectedItem = dynamic_cast <QGraphicsItem*> (sb);
-
-        mCanvas->update();
-      }
-      break;
-
-    case AddPicture:
-      {
-        //set up the bounding rectangle
-        //note: this rectangle gets used to keep track of the beginning click point for a picture
-        mRectangleItem = new QGraphicsRectItem( p.x(), p.y(), 0, 0, 0, mCanvas );//null parent
-        mRectangleItem->setBrush( Qt::NoBrush );
-        mRectangleItem->setPen( QPen(QColor(0,0,0), 0, Qt::DashLine) );
-        mRectangleItem->setZValue(100);
-        mRectangleItem->show();
-
-
-        mNewCanvasItem->setPos(p);
-
-        QgsComposerPicture *pi = dynamic_cast <QgsComposerPicture*> (mNewCanvasItem);
-
-        pi->setSize( 0, 0 );
-
-        mCanvas->update();
-
-        mToolStep = 1;
-      }
-      break;
-      */
- }
-}
-
-void QgsComposition::mouseMoveEvent(QMouseEvent* e)
-{
-
-#ifdef QGISDEBUG
-  std::cerr << "QgsComposition::mouseMoveEvent() mTool = " << mTool << " mToolStep = "
-    << mToolStep << std::endl;
-#endif
-
-  QPointF p = mView->mapToScene(e->pos());
-
-  switch ( mTool ) {
-    case Select:
-      if ( mSelectedItem ) {
-        //mSelectedItem->setPos(p - mGrabPoint);
-        //mCanvas->update();
-      }
-      break;
-
-    case AddMap:
-      if ( mToolStep == 1 ) // draw rectangle while dragging
-      {
-        double x, y;
-        double w, h;
-
-        x = p.x() < mRectangleItem->x() ? p.x() : mRectangleItem->rect().x();
-        y = p.y() < mRectangleItem->y() ? p.y() : mRectangleItem->rect().y();
-
-        w = fabs ( p.x() - mRectangleItem->rect().x() );
-        h = fabs ( p.y() - mRectangleItem->rect().y() );
-
-        mRectangleItem->setRect(QRectF(x, y, w, h));
-
-        mCanvas->update();
-      }//END if(mToolStep == 1)
-      break;
-      /* //other items besides map disabled for the moment
-    case AddPicture:
-      if ( mToolStep == 1 )
-      {
-        QgsComposerPicture *pi = dynamic_cast <QgsComposerPicture*> (mNewCanvasItem);
-
-        double x, y;
-        double w, h;
-
-        x = p.x() < mRectangleItem->x() ? p.x() : mRectangleItem->rect().x();
-        y = p.y() < mRectangleItem->y() ? p.y() : mRectangleItem->rect().y();
-
-        w = fabs ( p.x() - mRectangleItem->rect().x() );
-        h = fabs ( p.y() - mRectangleItem->rect().y() );
-
-        pi->setPos(x + w/2, y + h/2);
-        pi->setSize(w, h);
-
-        mRectangleItem->setRect(QRectF(x, y, w, h));
-
-        mCanvas->update();
-      }//END if(mToolStep == 1)
-      break;
-
-    case AddScalebar:
-    case AddVectorLegend:
-    case AddLabel:
-      */
-
-      mNewCanvasItem->setPos(p);
-      mCanvas->update();
-      break;
-
-  }
-}
-
-void QgsComposition::mouseReleaseEvent(QMouseEvent* e)
-{
-#ifdef QGISDEBUG
-  std::cerr << "QgsComposition::mouseReleaseEvent() mTool = " << mTool 
-    << " mToolStep = " << mToolStep << std::endl;
-#endif
-
-  QPoint p = mView->mapFromScene(e->pos());
-
-  switch ( mTool ) {
-    case AddMap: // mToolStep should be always 1 but rectangle can be 0 size
-      {
-        double x = mRectangleItem->rect().x();
-        double y = mRectangleItem->rect().y();
-        double w = mRectangleItem->rect().width();
-        double h = mRectangleItem->rect().height();
-        delete mRectangleItem;
-        mRectangleItem = 0;
-
-	QgsComposerMap* m = 0;
-
-        if ( w > 0 && h > 0 ) 
-	  {
-	    mComposer->selectItem(); // usually just one map
-
-	    m = new QgsComposerMap ( this, x, y, w, h );
-	    QgsComposerMapWidget* w = new QgsComposerMapWidget(m);
-	    mComposer->addItem(m, w);
-	    mItems.push_back(m);
-	    m->setSelected ( true );
-	    mCanvas->update();
-	    mComposer->showItemOptions(m);
-	    mSelectedItem = m;
-	  } 
-	else 
-	  {
-	    mToolStep = 0;
-	  }
-        //mCanvas->update();
-        mView->unsetCursor();
-      }
-      break;
-      /* //other items besides map are disabled for the moment
-    case AddPicture:
-      {
-        double w = mRectangleItem->rect().width();
-        double h = mRectangleItem->rect().height();
-        delete mRectangleItem;
-        mRectangleItem = 0;
-
-        QgsComposerPicture *pi = dynamic_cast <QgsComposerPicture*> (mNewCanvasItem);
-	pi->setSize(w, h);
-
-	delete mRectangleItem;
-        mRectangleItem = 0;
-
-        if ( w > 0 && h > 0 )
-        {
-	      mNewCanvasItem = 0; // !!! Must be before mComposer->selectItem()
-	      mComposer->selectItem(); // usually just one ???
-
-          pi->writeSettings();
-          mItems.push_back(pi);
-
-          pi->setSelected ( true );
-          mComposer->showItemOptions ( pi->options() );
-          mSelectedItem = dynamic_cast <QGraphicsItem*> (pi);
-
-          mCanvas->update();
-
-        } else {
-            mToolStep = 0;
-        }
-        mView->unsetCursor();
-      }
-      break;
-      */
-
-    case Select:
-      if ( mSelectedItem ) {
-        // the object was probably moved
-        QgsComposerItem *ci = dynamic_cast <QgsComposerItem *> (mSelectedItem);
-        ci->writeSettings();
-      }
-      break;
-
-    //We don't do anything special for labels, scalebars, or vector legends
-    /*case AddLabel:
-    case AddScalebar:
-    case AddVectorLegend:
-    break;*/
-
-  }
-}
-
-void QgsComposition::keyPressEvent ( QKeyEvent * e )
-{
-#ifdef QGISDEBUG
-  std::cout << "QgsComposition::keyPressEvent() key = " << e->key() << std::endl;
-#endif
-
-  QList<QGraphicsItem *> selectionList = canvas()->selectedItems();
-
-  if ( e->key() == Qt::Key_Delete) { // delete
-
-    QList<QGraphicsItem *> selectionList = canvas()->selectedItems();
-    QList<QGraphicsItem *>::iterator sIt = selectionList.begin();
-    for(; sIt != selectionList.end(); ++sIt)
-      {
-	mComposer->removeItem(dynamic_cast<QgsComposerItem *>(*sIt));
-      }
-
-    mSelectedItem = 0;
-    mCanvas->update();
-  }
-
-  if(e->key() == Qt::Key_Left)
-    {
-      QList<QGraphicsItem *>::iterator sIt = selectionList.begin();
-      for(; sIt != selectionList.end(); ++sIt)
-	{
-	  ((QgsComposerItem*)(*sIt))->move(-1.0, 0.0);
-	}
     }
-  else if(e->key() == Qt::Key_Right)
-    {
-      QList<QGraphicsItem *>::iterator sIt = selectionList.begin();
-      for(; sIt != selectionList.end(); ++sIt)
-	{
-	  ((QgsComposerItem*)(*sIt))->move(1.0, 0.0);
-	}
-    }
-  else if(e->key() == Qt::Key_Down)
-    {
-      QList<QGraphicsItem *>::iterator sIt = selectionList.begin();
-      for(; sIt != selectionList.end(); ++sIt)
-	{
-	  ((QgsComposerItem*)(*sIt))->move(0.0, 1.0);
-	}
-    }
-  else if(e->key() == Qt::Key_Up)
-    {
-      QList<QGraphicsItem *>::iterator sIt = selectionList.begin();
-      for(; sIt != selectionList.end(); ++sIt)
-	{
-	  ((QgsComposerItem*)(*sIt))->move(0.0, -1.0);
-	}
-    }
-}
 
-void QgsComposition::paperSizeChanged ( void )
-{
-#ifdef QGISDEBUG
-  std::cout << "QgsComposition::paperSizeChanged" << std::endl;
-#endif
-
-  mPaper = mPaperSizeComboBox->currentItem();
-  mPaperOrientation = mPaperOrientationComboBox->currentItem();
-#ifdef QGISDEBUG
-  std::cout << "custom = " << mPapers[mPaper].mCustom << std::endl;
-  std::cout << "orientation = " << mPaperOrientation << std::endl;
-#endif
-  if ( mPapers[mPaper].mCustom ) {
-    mUserPaperWidth = mPaperWidthLineEdit->text().toDouble();
-    mUserPaperHeight = mPaperHeightLineEdit->text().toDouble();
-    mPaperWidthLineEdit->setEnabled( TRUE );
-    mPaperHeightLineEdit->setEnabled( TRUE );
-  } else {
-    mUserPaperWidth = mPapers[mPaper].mWidth;
-    mUserPaperHeight = mPapers[mPaper].mHeight;
-    mPaperWidthLineEdit->setEnabled( FALSE );
-    mPaperHeightLineEdit->setEnabled( FALSE );
-    setOptions();
-  }
-
-  try
-  {
-    recalculate();
-  }
-  catch (std::bad_alloc& ba)
-  {
-    Q_UNUSED(ba);
-    // A better solution here would be to set the canvas back to the
-    // original size and carry on, but for the moment this will
-    // prevent a crash due to an uncaught exception.
-    QMessageBox::critical( 0, tr("Out of memory"),
-                           tr("Qgis is unable to resize the paper size due to "
-                              "insufficient memory.\n It is best that you avoid "
-                              "using the map composer until you restart qgis.\n") );
-  }
-
-//  mView->repaintContents(); //just repaint();?
-  writeSettings();
+  return resultList;
 }
 
-void QgsComposition::recalculate ( void ) 
+const QgsComposerMap* QgsComposition::getComposerMapById(int id) const
 {
-  if ( (mPaperOrientation == Portrait &&  mUserPaperWidth < mUserPaperHeight) ||
-      (mPaperOrientation == Landscape &&  mUserPaperWidth > mUserPaperHeight) ) 
-  {
-    mPaperWidth = mUserPaperWidth;
-    mPaperHeight = mUserPaperHeight;
-  } else {
-    mPaperWidth = mUserPaperHeight;
-    mPaperHeight = mUserPaperWidth;
-  }
-#ifdef QGISDEBUG
-  std::cout << "mPaperWidth = " << mPaperWidth << " mPaperHeight = " << mPaperHeight << std::endl;
-#endif
-  resizeCanvas();
-  mComposer->zoomFull();
-}
+  QList<const QgsComposerMap*> resultList;
 
-void QgsComposition::resolutionChanged ( void )
-{
-  mResolution = mResolutionLineEdit->text().toInt();
-  writeSettings();
-}
-
-void QgsComposition::setOptions ( void )
-{
-  mPaperSizeComboBox->setCurrentItem(mPaper);
-  mPaperOrientationComboBox->setCurrentItem(mPaperOrientation);
-  mPaperWidthLineEdit->setText ( QString("%1").arg(mUserPaperWidth,0,'g') );
-  mPaperHeightLineEdit->setText ( QString("%1").arg(mUserPaperHeight,0,'g') );
-  mResolutionLineEdit->setText ( QString("%1").arg(mResolution) );
-}
-
-void QgsComposition::setPlotStyle (  PlotStyle p )
-{
-  mPlotStyle = p;
-
-  // Set all items
-  for (std::list < QgsComposerItem * >::iterator it = mItems.begin(); it != mItems.end(); ++it) {
-    (*it)->setPlotStyle( p ) ;
-  }
-
-  // Remove paper if Print, reset if Preview
-  if ( mPlotStyle == Print ) {
-//    mPaperItem->setScene(0);
-//    mCanvas->setBackgroundColor( Qt::white );
-  } else { 
-//    mPaperItem->setScene(mCanvas);
-//    mCanvas->setBackgroundColor( QColor(180,180,180) );
-
-  }
-}
-
-double QgsComposition::viewScale ( void ) 
-{
-  double scale = mView->matrix().m11();
-  return scale; 
-}
-
-//does this even work?
-void QgsComposition::refresh()
-{
-#if 0
-  // TODO add signals to map canvas
-  for (std::list < QgsComposerItem * >::iterator it = mItems.begin(); it != mItems.end(); ++it)    {
-    QgsComposerItem *ci = (*it);
-    if (  typeid (*ci) == typeid(QgsComposerMap) ) {
-      QgsComposerMap *cm = dynamic_cast<QgsComposerMap*>(ci);
-      cm->setCacheUpdated(false);
-    } else if (  typeid (*ci) == typeid(QgsComposerVectorLegend) ) {
-      QgsComposerVectorLegend *vl = dynamic_cast<QgsComposerVectorLegend*>(ci);
-      vl->recalculate();
-    }
-  }
-#endif //0
-  mCanvas->update();
-}
-
-int QgsComposition::id ( void ) { return mId; }
-
-QgsComposer *QgsComposition::composer(void) { return mComposer; }
-
-QGraphicsScene *QgsComposition::canvas(void) { return mCanvas; }
-
-double QgsComposition::paperWidth ( void ) { return mPaperWidth; }
-
-double QgsComposition::paperHeight ( void ) { return mPaperHeight; }
-
-int QgsComposition::paperOrientation ( void ) { return mPaperOrientation; }
-
-int QgsComposition::resolution ( void ) { return mResolution; }
-
-int QgsComposition::scale( void ) { return mScale; }
-
-double QgsComposition::toMM ( int v ) { return v/mScale ; }
-
-int QgsComposition::fromMM ( double v ) { return (int) (v * mScale); }
-
-void QgsComposition::setTool ( Tool tool )
-{
-  // Stop old in progress
-  if ( mSelectedItem ) {
-    QgsComposerItem *coi = dynamic_cast <QgsComposerItem *> (mSelectedItem);
-    coi->setSelected ( false );
-    mCanvas->update();
-  }
-  mSelectedItem = 0;
-  mComposer->showItemOptions (0);
-
-  if ( mNewCanvasItem ) {
-    mNewCanvasItem->setPos(-1000, -1000);
-    mCanvas->update();
-
-    delete mNewCanvasItem;
-    mNewCanvasItem = 0;
-  }
-
-  if ( mRectangleItem ) {
-    delete mRectangleItem;
-    mRectangleItem = 0;
-  }
-
-  // Start new
-  /*if ( tool == AddVectorLegend ) { // Create temporary object
-    if ( mNewCanvasItem ) delete mNewCanvasItem;
-
-    // Create new object outside the visible area
-    QgsComposerVectorLegend *vl = new QgsComposerVectorLegend ( this, mNextItemId++, -1000, -1000, (int) (mPaperHeight/50));
-    mNewCanvasItem = dynamic_cast <QGraphicsItem *> (vl);
-    mComposer->showItemOptions(vl);
-
-    mView->viewport()->setMouseTracking ( true ); // to recieve mouse move
-
-  }
-  else if ( tool == AddLabel ) {
-    if ( mNewCanvasItem ) delete mNewCanvasItem;
-
-    // Create new object outside the visible area
-    //QgsComposerLabel *lab = new QgsComposerLabel ( this, mNextItemId++, -1000, -1000, tr("Label"), (int) (mPaperHeight/20));
-    
-
-    //mNewCanvasItem = dynamic_cast <QGraphicsItem *> (lab);
-    //mComposer->showItemOptions(lab);
-
-    mView->viewport()->setMouseTracking ( true ); // to recieve mouse move
-    }
- else if ( tool == AddScalebar ) {
-    if ( mNewCanvasItem ) delete mNewCanvasItem;
-
-    // Create new object outside the visible area
-    QgsComposerScalebar *sb = new QgsComposerScalebar ( this, mNextItemId++, -1000, -1000);
-    mNewCanvasItem = dynamic_cast <QGraphicsItem*> (sb);
-    mComposer->showItemOptions(sb);
-
-    mView->viewport()->setMouseTracking ( true ); // to recieve mouse move
-  }
-  else if ( tool == AddPicture )
-  {
-    if ( mNewCanvasItem ) delete mNewCanvasItem;
-
-    while ( 1 ) // keep trying until we get a valid image or the user clicks cancel
+  QList<QGraphicsItem *> itemList = items();
+  QList<QGraphicsItem *>::iterator itemIt = itemList.begin();
+  for(; itemIt != itemList.end(); ++itemIt)
     {
-	  QString file = QgsComposerPicture::pictureDialog();
-
-      if ( file.isNull() ) //user clicked cancel
-	  {
-	    // TODO: This is not nice, because selectItem() calls 
-            //       this function, do it better
-	    mComposer->selectItem();
-	    tool = Select;
-	    break; //quit the loop
-      }
-
-	  // Create new object outside the visible area
-	  QgsComposerPicture *pi = new QgsComposerPicture ( this, mNextItemId++, file );
-
-	  if ( pi->pictureValid() )
-	  {
-#ifdef QGISDEBUG
-  	    std::cout << "picture is valid" << std::endl;
-#endif
-	    mNewCanvasItem = dynamic_cast <QGraphicsItem *> (pi);
-	    mComposer->showItemOptions(pi);
-
-	    mView->viewport()->setMouseTracking ( true ); // start tracking the mouse
-        break; //quit the loop
-	  }
-	  else
-      {
-	    QMessageBox::warning( this, tr("Warning"),
-                         tr("Cannot load picture.") );
-	    delete pi;
-	  }
-    }
-
-  }//END if(tool == AddPicture)*/
-
-  mTool = tool;
-  mToolStep = 0;
-}
-
-void QgsComposition::groupItems()
-{
-  if(!mComposer || !canvas())
-    {
-      return;
-    }
-  QList<QGraphicsItem *> selectedItems = canvas()->selectedItems();
-
-  if(selectedItems.size() < 2)
-    {
-      return; //not enough items for a group
-    }
-
-  QgsComposerItemGroup* itemGroup = new QgsComposerItemGroup(this);
-
-  QList<QGraphicsItem *>::iterator itemIt = selectedItems.begin();
-  for(; itemIt != selectedItems.end(); ++itemIt)
-    {
-      itemGroup->addItem((QgsComposerItem*)(*itemIt));
-    }
-
-  mComposer->addItem(itemGroup, 0);
-  mCanvas->addItem(itemGroup);
-  mItems.push_back(itemGroup);
-  itemGroup->setSelected(true);
-  mComposer->showItemOptions(0);
-}
-
-void QgsComposition::ungroupItems()
-{
-  if(!mComposer || !canvas())
-    {
-      return;
-    }
-  QList<QGraphicsItem *> selectedItems = canvas()->selectedItems();
-  QList<QGraphicsItem *>::iterator itemIt = selectedItems.begin();
-  for(; itemIt != selectedItems.end(); ++itemIt)
-    {
-      QgsComposerItemGroup* itemGroup = dynamic_cast<QgsComposerItemGroup*>(*itemIt);
-      if(itemGroup)
+      const QgsComposerMap* composerMap = dynamic_cast<const QgsComposerMap*>(*itemIt);
+      if(composerMap)
 	{
-	  itemGroup->removeItems();
-	  mCanvas->removeItem(itemGroup);
-	  mComposer->removeItem(itemGroup);
+	  if(composerMap->id() == id)
+	    {
+	      return composerMap;
+	    }
 	}
     }
-}
 
-std::vector<QgsComposerMap*> QgsComposition::maps(void) 
-{
-  std::vector<QgsComposerMap*> v;
-  for (std::list < QgsComposerItem * >::iterator it = mItems.begin(); it != mItems.end(); ++it) {
-    QgsComposerItem *ci = (*it);
-    if (  typeid (*ci) == typeid(QgsComposerMap) ) {
-      v.push_back ( dynamic_cast<QgsComposerMap*>(ci) );
-    }
-  }
-
-  return v;
+  return 0;
 }
-
-double QgsComposition::selectionBoxSize ( void )
-{
-  // Scale rectangle based on the zoom level, so we keep the rectangle a fixed size on the screen
-  return 7.0/viewScale();
-}
-
-QPen QgsComposition::selectionPen ( void ) 
-{
-  return QPen( QColor(0,0,255), 0) ;
-}
-
-QBrush QgsComposition::selectionBrush ( void )
-{
-  return QBrush ( QBrush(QColor(0,0,255), Qt::SolidPattern) );
-}
-
-void QgsComposition::emitMapChanged ( int id )
-{
-  emit mapChanged ( id );
-}
-
-bool QgsComposition::writeSettings ( void )
-{
-#if 0
-  QString path, val;
-  path.sprintf("/composition_%d/", mId );
-  QgsProject::instance()->writeEntry( "Compositions", path+"width", mUserPaperWidth );
-  QgsProject::instance()->writeEntry( "Compositions", path+"height", mUserPaperHeight );
-  QgsProject::instance()->writeEntry( "Compositions", path+"resolution", mResolution );
-
-  if ( mPaperOrientation == Landscape ) {
-    val = "landscape";
-  } else {
-    val = "portrait";
-  }
-  QgsProject::instance()->writeEntry( "Compositions", path+"orientation", val );
-
-#endif //0
-  return true;
-}
-
-bool QgsComposition::readSettings ( void )
-{
-#if 0
-
-#ifdef QGISDEBUG
-  std::cout << "QgsComposition::readSettings" << std::endl;
-#endif
-
-  bool ok;
-
-  mPaper = mCustomPaper;
-
-  QString path, val;
-  path.sprintf("/composition_%d/", mId );
-  mUserPaperWidth = QgsProject::instance()->readDoubleEntry( "Compositions", path+"width", 297, &ok);
-  mUserPaperHeight = QgsProject::instance()->readDoubleEntry( "Compositions", path+"height", 210, &ok);
-  mResolution = QgsProject::instance()->readNumEntry( "Compositions", path+"resolution", 300, &ok);
-
-  val = QgsProject::instance()->readEntry( "Compositions", path+"orientation", "landscape", &ok);
-  if ( val.compare("landscape") == 0 ) {
-    mPaperOrientation = Landscape;
-  } else {
-    mPaperOrientation = Portrait;
-  }
-
-  recalculate();
-  setOptions();
-
-  // Create objects
-  path.sprintf("/composition_%d", mId );
-  QStringList el = QgsProject::instance()->subkeyList ( "Compositions", path );
-
-  // First create the map(s) because they are often required by other objects
-  for ( QStringList::iterator it = el.begin(); it != el.end(); ++it ) {
-#ifdef QGISDEBUG
-    std::cout << "key: " << (*it).toLocal8Bit().data() << std::endl;
-#endif
-
-    QStringList l = QStringList::split( '_', (*it) );
-    if ( l.size() == 2 ) {
-      QString name = l.first();
-      QString ids = l.last();
-      int id = ids.toInt();
-
-      if ( name.compare("map") == 0 ) {
-        QgsComposerMap *map = new QgsComposerMap ( this, id );
-        mItems.push_back(map);
-      }
-
-      if ( id >= mNextItemId ) mNextItemId = id + 1;
-    }
-  }
-
-  for ( QStringList::iterator it = el.begin(); it != el.end(); ++it ) {
-#ifdef QGISDEBUG
-    std::cout << "key: " << (*it).toLocal8Bit().data() << std::endl;
-#endif
-
-    QStringList l = QStringList::split( '_', (*it) );
-    if ( l.size() == 2 ) {
-      QString name = l.first();
-      QString ids = l.last();
-      int id = ids.toInt();
-
-      if ( name.compare("vectorlegend") == 0 ) {
-        QgsComposerVectorLegend *vl = new QgsComposerVectorLegend ( this, id );
-        mItems.push_back(vl);
-      } else if ( name.compare("label") == 0 ) {
-        QgsComposerLabel *lab = new QgsComposerLabel ( this, id );
-        mItems.push_back(lab);
-      } else if ( name.compare("scalebar") == 0 ) {
-        QgsComposerScalebar *sb = new QgsComposerScalebar ( this, id );
-        mItems.push_back(sb);
-      } else if ( name.compare("picture") == 0 ) {
-        QgsComposerPicture *pi = new QgsComposerPicture ( this, id );
-        mItems.push_back(pi);
-      }
-
-      if ( id >= mNextItemId ) mNextItemId = id + 1;
-    }
-  }
-
-
-  mCanvas->update();
-#endif //0
-  return true;
-}
-
-#endif //0

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposition.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposition.h	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposition.h	2008-06-22 14:59:40 UTC (rev 8669)
@@ -19,6 +19,7 @@
 #include <QGraphicsScene>
 
 class QgsComposerItem;
+class QgsComposerMap;
 class QGraphicsRectItem;
 class QgsMapCanvas;
 
@@ -52,6 +53,13 @@
 
   QList<QgsComposerItem*> selectedComposerItems();
 
+  /**Returns pointers to all composer maps in the scene*/
+  QList<const QgsComposerMap*> composerMapItems() const;
+
+  /**Returns the composer map with specified id
+   @return id or 0 pointer if the composer map item does not exist*/
+  const QgsComposerMap* getComposerMapById(int id) const;
+
   /**Returns pointer to qgis map canvas*/
   QgsMapCanvas* mapCanvas(){return mMapCanvas;}
 
@@ -68,309 +76,5 @@
 
 #endif 
 
-#if 0
-#include "ui_qgscompositionbase.h"
 
-#include <list>
-#include <vector>
 
-class QgsComposer;
-class QgsComposerItem;
-class QgsComposerMap;
-class QgsComposerView;
-class QgsMapCanvas;
-
-class QGraphicsScene;
-class QGraphicsItem;
-class QGraphicsRectItem;
-
-class QDomDocument;
-class QDomNode;
-class QKeyEvent;
-class QMouseEvent;
-
-class QgsCompositionPaper
-{
-public:
-    QString mName;
-    int mWidth;
-    int mHeight;
-    int mCustom;
-
-    QgsCompositionPaper( QString name, int w, int h, bool c = false);
-    ~QgsCompositionPaper();
-};
-
-/** \class QgsComposition
- * \brief This class can store, write as XML and read from XML the description
- *        map composition for printing.
- */
-class QgsComposition: public QWidget, private Ui::QgsCompositionBase
-{
-    Q_OBJECT
-public:
-    /** \brief Constructor. */
-    QgsComposition ( QgsComposer *c, int id ); 
-
-    /** \brief The destuctor.  */
-    ~QgsComposition();
-
-    /** \brief Orientation  */
-    enum Orientation {
-	Portrait = 0,
-	Landscape
-    };
-
-    /** \brief Current tool  */
-    enum Tool {
-	Select = 0,      // Select/Move item
-	AddMap,          // add new map 
-	AddVectorLegend, // add vector legend
-	AddLabel,        // add label
-	AddScalebar,     // add scalebar
-	AddPicture       // add raster/vector picture
-    };
-
-    /** \brief Scaling mode, defines which parameters are fixed and which are changing  */
-    enum Calculate {
-	Scale = 0, // Extent and paper are defined by user, scale is calculated
-	Paper,     // Extent and scale are defined by user, paper is calculated
-	Extent     // Paper and scale are defined by user, extent is calculated
-    };
-
-    /** \brief Plot type */
-    enum PlotStyle {
-	Preview = 0, // Use cache etc
-	Print,       // Render well
-	Postscript   // Fonts need different scaling!
-    };
-
-    /** \brief Font scaling factor for PostScript output
-     *
-     *  For output to Postscript the font must be scaled. But how?  
-     *  The factor is an empirical value. In any case, each font scales
-     *  in in different way even if painter.scale() is used instead of
-     *  font size!!! -> Postscript is never exactly the same as in preview.
-     */
-
-    // Hopefully no more needed
-    /*
-    static const double psFontScaleFactor() {
-#ifdef Q_OS_MACX
-    return 1.85;
-#else
-    return 2.45; // I have no idea why 2.45 - it is an empirical value
-#endif
-    }
-    */
-
-    /** \brief Composition ID */
-    int id ( void );
-
-    /** \brief Get paper width */
-    double paperWidth ( void );
-
-    /** \brief Get paper height */
-    double paperHeight ( void );
-    
-    /** \brief Get paper orientation */
-    int paperOrientation ( void );
-
-    /** \brief Get resolutin */
-    int resolution ( void );
-
-    /**Get active tool*/
-    QgsComposition::Tool tool() const {return mTool;}
-
-    /** \brief Create default composition */
-    void createDefault ( void );
-
-    /** \brief Remove all items */
-    void clear ( void );
-
-    /** \brief Recalculate page size according to mUserPaperWidth/Height and mPaperOrientation,
-     *         resize canvas and zoomFull */
-    void recalculate(void);
-
-    /** \brief pointer to map canvas */
-    QgsMapCanvas *mapCanvas(void);
-
-    /** \brief pointer to composer */
-    QgsComposer *composer(void);
-
-    /** \brief Set this composition as active, show its canvas with items and show general options */
-    void setActive ( bool active );
-
-    /** \brief returns pointer to canvas */
-    QGraphicsScene *canvas(void);
-    
-    /** \brief recieves mousePressEvent from view */
-    void mousePressEvent(QMouseEvent*, bool shiftKeyPressed = false);
-    
-    /** \brief recieves mouseReleaseEvent from view */
-    void mouseReleaseEvent(QMouseEvent*);
-
-    /** \brief recieves mouseMoveEvent from view */
-    void mouseMoveEvent(QMouseEvent*);
-
-    /** \brief recieves keyPressEvent from view */
-    void keyPressEvent ( QKeyEvent * e );
-
-    /** \brief set plot style, use before print */
-    void setPlotStyle ( PlotStyle p );
-
-    /**  \brief Set composition optiones in GUI */
-    void setOptions ( void );
-    
-    /**  \brief Set tool */
-    void setTool ( Tool tool );
-
-    /**Insert a group containing the selected items*/
-    void groupItems();
-
-    /**Removes items from selected group and also the group item*/
-    void ungroupItems();
-
-    /** Refresh. Refresh objects which are not updated automaticaly, e.g. map object does not know
-     * if a layer was switched on/off. Later should be substituted by appropriate signals 
-     * se by map canvas */
-    void refresh();
-
-    /**  \brief Canvas scale */
-    int scale (void);
-
-    /**  \brief convert canvas unit to mm */
-    double toMM ( int v );
-    
-    /**  \brief convert mm to canvas unit */
-    int fromMM ( double v );
-
-    /** \brief Return number screen pixels / canvas point */
-    double viewScale( void );
-
-    /** \brief Selection box size in _scene_ units */
-    double selectionBoxSize ( void );
-    
-    /** \brief Selection box pen and brush */
-    QPen selectionPen ( void );
-    QBrush selectionBrush ( void );
-    
-    /** \brief vector of pointers to maps available in composition */
-    std::vector<QgsComposerMap*> maps(void);
-
-    /** \brief stores statei in project */
-    bool writeSettings ( void );
-
-    /** \brief read state from project */
-    bool readSettings ( void );
-
-    /** \brief  stores state in DOM node */
-    bool writeXML( QDomNode & node, QDomDocument & doc, bool templ = false );
-
-    /** \brief sets state from DOM document */
-    bool readXML( QDomNode & node );
-
-    /**  \brief Called map objects if changed, so that the composition can emit signal */
-    void emitMapChanged ( int id );
-
-public slots:
-    /**  \brief Called by GUI if paper size was changed */
-    void paperSizeChanged ( void );
-    
-    /**  \brief Called by GUI if resolution was changed */
-    void resolutionChanged ( void );
-
-signals:
-    /**  \brief Emitted when map was changed */    
-    void mapChanged ( int id );
-
-private:
-    /** \brief composition id */
-    int mId;
-
-    /** \brief paper width in mm in GUI */
-    double mUserPaperWidth;
-
-    /** \brief paper height in mm in GUI */
-    double mUserPaperHeight;
-
-    /** \brief paper width in mm (orientaion applied)  */
-    double mPaperWidth;
-
-    /** \brief paper height in mm (orientaion applied) */
-    double mPaperHeight;
-
-    /** \brief Papers */
-    std::vector<QgsCompositionPaper> mPapers;
-
-    /** \brief Current paper */
-    int mPaper;
-	
-    /** \brief Default paper index */
-    int mDefaultPaper;
-
-    /** \brief Custom paper index */
-    int mCustomPaper;
-
-    /** \brief Orientation */
-    int mPaperOrientation;
-
-    /** \brief pointer to map canvas */
-    QgsMapCanvas *mMapCanvas;
-
-    /** \brief pointer to composer */
-    QgsComposer *mComposer;
-
-    /** \brief Canvas. One per composition, created by QgsComposition */
-    QGraphicsScene *mCanvas;
-
-    /** \brief Pointer to canvas view */
-    QgsComposerView *mView;
-
-    /** \brief List of all composer items */
-    std::list<QgsComposerItem*> mItems;
-
-    /** \brief Selected item, 0 if no item is selected */ 
-    QGraphicsItem* mSelectedItem; 
-
-    /** \brief Item representing the paper */
-    QGraphicsRectItem *mPaperItem;
-
-    /** \brief  Plot style */
-    PlotStyle mPlotStyle;
-    
-    /** \brief  Current tool */
-    Tool mTool;
-    
-    /** \brief  Tool step first is 0 */
-    int mToolStep;
-    
-    /** \brief Temporary rectangle item used as rectangle drawn by mouse */
-    QGraphicsRectItem *mRectangleItem;
-
-    /** \brief Temporary item used as pointer to new objecs which must be drawn */ 
-    QGraphicsItem *mNewCanvasItem; 
-
-    /** \brief Resolution in DPI */
-    int mResolution; 
-
-    /** \brief canvas scale */
-    int mScale;
-
-    /** \brief id for next new item */
-    int mNextItemId;
-
-	QGraphicsRectItem *sizeBox;
-
-    /** \brief Create canvas */
-    void createCanvas(void);
-    
-    /** \brief Resize canvas to current paper size */
-    void resizeCanvas(void);
-
-    /** \brief Grab point, set with MousePressEvent */
-    QPointF mGrabPoint;
-};
-
-#endif
-

Modified: branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui
===================================================================
--- branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui	2008-06-22 14:59:40 UTC (rev 8669)
@@ -30,7 +30,11 @@
     </widget>
    </item>
    <item row="0" column="2" >
-    <widget class="QDoubleSpinBox" name="mSegmentSizeSpinBox" />
+    <widget class="QDoubleSpinBox" name="mSegmentSizeSpinBox" >
+     <property name="maximum" >
+      <double>9999999999999.000000000000000</double>
+     </property>
+    </widget>
    </item>
    <item row="1" column="0" colspan="2" >
     <widget class="QLabel" name="mNumbereOfSegmentsLabel" >

Modified: branches/advanced_printing_branch/src/ui/qgscompositionbase.ui
===================================================================
--- branches/advanced_printing_branch/src/ui/qgscompositionbase.ui	2008-06-21 19:08:34 UTC (rev 8668)
+++ branches/advanced_printing_branch/src/ui/qgscompositionbase.ui	2008-06-22 14:59:40 UTC (rev 8669)
@@ -10,9 +10,7 @@
    </rect>
   </property>
   <property name="sizePolicy" >
-   <sizepolicy>
-    <hsizetype>7</hsizetype>
-    <vsizetype>7</vsizetype>
+   <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
     <horstretch>0</horstretch>
     <verstretch>0</verstretch>
    </sizepolicy>
@@ -21,33 +19,55 @@
    <string>Composition</string>
   </property>
   <layout class="QGridLayout" >
-   <property name="margin" >
+   <property name="leftMargin" >
     <number>9</number>
    </property>
-   <property name="spacing" >
+   <property name="topMargin" >
+    <number>9</number>
+   </property>
+   <property name="rightMargin" >
+    <number>9</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>9</number>
+   </property>
+   <property name="horizontalSpacing" >
     <number>6</number>
    </property>
+   <property name="verticalSpacing" >
+    <number>6</number>
+   </property>
    <item row="0" column="0" colspan="2" >
     <widget class="QGroupBox" name="groupBox" >
      <property name="title" >
       <string>Paper</string>
      </property>
      <layout class="QGridLayout" >
-      <property name="margin" >
+      <property name="leftMargin" >
        <number>9</number>
       </property>
-      <property name="spacing" >
+      <property name="topMargin" >
+       <number>9</number>
+      </property>
+      <property name="rightMargin" >
+       <number>9</number>
+      </property>
+      <property name="bottomMargin" >
+       <number>9</number>
+      </property>
+      <property name="horizontalSpacing" >
        <number>6</number>
       </property>
+      <property name="verticalSpacing" >
+       <number>6</number>
+      </property>
       <item row="4" column="1" >
        <widget class="QComboBox" name="mPaperOrientationComboBox" >
         <property name="enabled" >
          <bool>true</bool>
         </property>
         <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>7</hsizetype>
-          <vsizetype>0</vsizetype>
+         <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -66,9 +86,7 @@
          <bool>false</bool>
         </property>
         <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>7</hsizetype>
-          <vsizetype>0</vsizetype>
+         <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -81,9 +99,7 @@
          <bool>true</bool>
         </property>
         <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>7</hsizetype>
-          <vsizetype>0</vsizetype>
+         <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -93,9 +109,7 @@
       <item row="4" column="0" >
        <widget class="QLabel" name="textLabel7" >
         <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>5</hsizetype>
-          <vsizetype>5</vsizetype>
+         <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -111,9 +125,7 @@
       <item row="3" column="0" >
        <widget class="QLabel" name="textLabel6" >
         <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>5</hsizetype>
-          <vsizetype>5</vsizetype>
+         <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -129,9 +141,7 @@
       <item row="2" column="0" >
        <widget class="QLabel" name="textLabel4" >
         <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>5</hsizetype>
-          <vsizetype>5</vsizetype>
+         <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -147,9 +157,7 @@
       <item row="1" column="0" >
        <widget class="QLabel" name="textLabel5" >
         <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>5</hsizetype>
-          <vsizetype>5</vsizetype>
+         <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -165,9 +173,7 @@
       <item row="0" column="0" >
        <widget class="QLabel" name="textLabel3" >
         <property name="sizePolicy" >
-         <sizepolicy>
-          <hsizetype>5</hsizetype>
-          <vsizetype>5</vsizetype>
+         <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -183,7 +189,7 @@
      </layout>
     </widget>
    </item>
-   <item row="2" column="0" colspan="2" >
+   <item rowspan="2" row="1" column="0" colspan="2" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
@@ -199,27 +205,6 @@
      </property>
     </spacer>
    </item>
-   <item row="1" column="0" >
-    <widget class="QLabel" name="textLabel1" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>5</hsizetype>
-       <vsizetype>5</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text" >
-      <string>Resolution (dpi)</string>
-     </property>
-     <property name="buddy" >
-      <cstring>mResolutionLineEdit</cstring>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="1" >
-    <widget class="QLineEdit" name="mResolutionLineEdit" />
-   </item>
   </layout>
  </widget>
  <layoutdefault spacing="6" margin="11" />



More information about the QGIS-commit mailing list