[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kivio
From: Peter Simonsson <psn () linux ! se>
Date: 2005-12-16 19:52:10
Message-ID: 1134762730.681037.21281.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 489018 by psn:
First stab at supporting autoguidelines
M +37 -2 kiviopart/kivio_canvas.cpp
M +2 -0 kiviopart/kivio_canvas.h
M +1 -0 kiviopart/kivio_view.cpp
M +2 -0 plugins/kivioselecttool/tool_select.cpp
--- trunk/koffice/kivio/kiviopart/kivio_canvas.cpp #489017:489018
@@ -29,6 +29,7 @@
#include "kivio_stackbar.h"
#include "kivio_screen_painter.h"
#include "kivio_grid_data.h"
+#include "kivio_layer.h"
#include "kivio_pluginmanager.h"
@@ -404,6 +405,7 @@
if(m_pView->isShowGuides()) {
if(m_guides.mousePressEvent(e)) {
+ delegateThisEvent = false;
return;
}
}
@@ -415,6 +417,7 @@
return;
if(view()->isShowGuides() && m_guides.mouseReleaseEvent(e)) {
+ delegateThisEvent = false;
return;
}
}
@@ -781,6 +784,8 @@
{
e->accept();
startSpawnerDragDraw( e->pos() );
+ activePage()->unselectAllStencils();
+ updateAutoGuideLines();
}
}
@@ -966,11 +971,9 @@
p += diff;
if(status & KoGuides::SNAP_HORIZ) {
- kdDebug() << "TESTING X" << endl;
snappedY = true;
}
if(status & KoGuides::SNAP_VERT) {
- kdDebug() << "TESTING Y" << endl;
snappedX = true;
}
@@ -1195,4 +1198,36 @@
m_pasteMoving = false;
}
+void KivioCanvas::updateAutoGuideLines()
+{
+ QValueList<double> hGuideLines;
+ QValueList<double> vGuideLines;
+ QPtrList<KivioLayer> layerList = *(activePage()->layers());
+ QPtrListIterator<KivioLayer> layerIt(layerList);
+ KivioLayer* layer = 0;
+ QPtrList<KivioStencil> stencilList;
+ QPtrListIterator<KivioStencil> stencilIt(stencilList);
+ KivioStencil* stencil = 0;
+
+ while((layer = layerIt.current()) != 0) {
+ ++layerIt;
+
+ if(layer->visible()) {
+ stencilList = *(layer->stencilList());
+ stencilIt.toFirst();
+
+ while((stencil = stencilIt.current()) != 0) {
+ ++stencilIt;
+
+ if(!stencil->isSelected()) {
+ hGuideLines << stencil->y() << (stencil->y() + stencil->h());
+ vGuideLines << stencil->x() << (stencil->x() + stencil->w());
+ }
+ }
+ }
+ }
+
+ guideLines().setAutoGuideLines(hGuideLines, vGuideLines);
+}
+
#include "kivio_canvas.moc"
--- trunk/koffice/kivio/kiviopart/kivio_canvas.h #489017:489018
@@ -132,6 +132,8 @@
void startPasteMoving();
+ void updateAutoGuideLines();
+
protected:
virtual void mousePressEvent( QMouseEvent* );
virtual void mouseReleaseEvent( QMouseEvent* );
--- trunk/koffice/kivio/kiviopart/kivio_view.cpp #489017:489018
@@ -1713,6 +1713,7 @@
// Mark the page as modified and repaint
m_pDoc->updateView(m_pActivePage);
pluginManager()->activateDefaultTool();
+ m_pCanvas->updateAutoGuideLines();
}
void KivioView::alignStencilsDlg()
--- trunk/koffice/kivio/plugins/kivioselecttool/tool_select.cpp #489017:489018
@@ -292,6 +292,8 @@
pPage->unselectAllStencils();
pPage->selectStencil( pStencil );
+ // Update the auto guidelines
+ view()->canvasWidget()->updateAutoGuideLines();
}
// Create a new painter object
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic