[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - 5 commits - chart2/source include/vcl vcl/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Sun May 25 18:25:58 PDT 2014
chart2/source/view/charttypes/GL3DBarChart.cxx | 29 +++++++++++++++++++------
chart2/source/view/inc/GL3DBarChart.hxx | 3 +-
include/vcl/openglwin.hxx | 2 -
vcl/source/window/openglwin.cxx | 2 -
4 files changed, 27 insertions(+), 9 deletions(-)
New commits:
commit 667c3ea13d1afe8eb0fa9b9581383b3140229a0c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon May 26 03:20:12 2014 +0200
react only to left mouse click
Change-Id: Ia4c2c52b8803cd36d7ed32be559ba446589377e7
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index ea589ac..3f330a8 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -306,11 +306,14 @@ public:
}
-void GL3DBarChart::clickedAt(const Point& /*rPos*/)
+void GL3DBarChart::clickedAt(const Point& /*rPos*/, sal_uInt16 nButtons)
{
if(mbBlockUserInput)
return;
+ if(nButtons != MOUSE_LEFT)
+ return;
+
mbBlockUserInput = true;
sal_uInt32 nId = 5;
/*
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 377b18c..eb436db 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -50,7 +50,7 @@ public:
virtual void update() SAL_OVERRIDE;
- virtual void clickedAt(const Point& rPos) SAL_OVERRIDE;
+ virtual void clickedAt(const Point& rPos, sal_uInt16 nButtons) SAL_OVERRIDE;
virtual void mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 nButtons) SAL_OVERRIDE;
virtual void scroll(long nDelta) SAL_OVERRIDE;
virtual void contextDestroyed() SAL_OVERRIDE;
diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx
index d2e86cc..85d1940 100644
--- a/include/vcl/openglwin.hxx
+++ b/include/vcl/openglwin.hxx
@@ -24,7 +24,7 @@ class VCLOPENGL_DLLPUBLIC IRenderer
public:
virtual ~IRenderer() {}
virtual void update() = 0;
- virtual void clickedAt(const Point& rPos) = 0;
+ virtual void clickedAt(const Point& rPos, sal_uInt16 nButtons) = 0;
virtual void mouseDragMove(const Point& rPosBegin, const Point& rPosEnd, sal_uInt16 nButtons) = 0;
virtual void scroll(long nDelta) = 0;
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 455e455..1983376 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -68,7 +68,7 @@ void OpenGLWindow::MouseButtonUp( const MouseEvent& rMEvt )
Color aColor = GetPixel(aPoint);
SAL_WARN("vcl.opengl", aColor.GetColor());
if(mpRenderer)
- mpRenderer->clickedAt(aPoint);
+ mpRenderer->clickedAt(aPoint, rMEvt.GetButtons());
}
else
{
commit 4dc6f2d72a1c4faf05b42df0c5d441b2c00372ac
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon May 26 03:15:18 2014 +0200
remove unnecessary debug message
Change-Id: I63e65bce671d1feab4ea93bdff906b597ce180c3
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 03897df..ea589ac 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -347,13 +347,13 @@ void GL3DBarChart::clickedAt(const Point& /*rPos*/)
}
-void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 nButtons)
+void GL3DBarChart::mouseDragMove(const Point& , const Point& , sal_uInt16 nButtons)
{
if(mbBlockUserInput)
return;
mbBlockUserInput = true;
- SAL_WARN("chart2.opengl", "Dragging: " << rStartPos << " to : " << rEndPos << " Buttons: " << nButtons);
+
if(nButtons == MOUSE_RIGHT)
{
mnCornerId = (mnCornerId + 1) % 4;
commit 24a243f8207aba16412e6b0ea3a67e645d19c9fc
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon May 26 03:14:48 2014 +0200
improve screen text positioning
Change-Id: Ia1f4ae40b8dbed2324c600f7ef68a33a5b04027b
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 73a41d8..03897df 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -343,7 +343,7 @@ void GL3DBarChart::clickedAt(const Point& /*rPos*/)
maShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache,
OUString("Value: ") + OUString::number(rBarInfo.mnVal), 0));
opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maShapes.back());
- pScreenText->setPosition(glm::vec2(-1.0f, 0.9f), glm::vec2(-0.6f, 0.75f));
+ pScreenText->setPosition(glm::vec2(-0.9f, 0.9f), glm::vec2(-0.6f, 0.8f));
}
commit 8d6776d00ea4313bb5a592db2ea31e7d50f6813e
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon May 26 03:11:22 2014 +0200
block user input while we are in another user interaction
Change-Id: I25a846b0648d2d28585a58066a9bb1088d607c24
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 951188d..73a41d8 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -34,7 +34,8 @@ GL3DBarChart::GL3DBarChart(
mpTextCache(new opengl3D::TextCache()),
mnStep(0),
mnStepsTotal(0),
- mnCornerId(0)
+ mnCornerId(0),
+ mbBlockUserInput(false)
{
Size aSize = mrWindow.GetSizePixel();
mpRenderer->SetSize(aSize);
@@ -307,6 +308,10 @@ public:
void GL3DBarChart::clickedAt(const Point& /*rPos*/)
{
+ if(mbBlockUserInput)
+ return;
+
+ mbBlockUserInput = true;
sal_uInt32 nId = 5;
/*
{
@@ -344,6 +349,10 @@ void GL3DBarChart::clickedAt(const Point& /*rPos*/)
void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 nButtons)
{
+ if(mbBlockUserInput)
+ return;
+
+ mbBlockUserInput = true;
SAL_WARN("chart2.opengl", "Dragging: " << rStartPos << " to : " << rEndPos << " Buttons: " << nButtons);
if(nButtons == MOUSE_RIGHT)
{
@@ -413,6 +422,7 @@ IMPL_LINK_NOARG(GL3DBarChart, MoveCamera)
}
else
{
+ mbBlockUserInput = false;
mnStep = 0;
}
@@ -434,6 +444,7 @@ IMPL_LINK_NOARG(GL3DBarChart, MoveToBar)
else
{
maShapes.pop_back();
+ mbBlockUserInput = false;
mnStep = 0;
}
@@ -442,6 +453,9 @@ IMPL_LINK_NOARG(GL3DBarChart, MoveToBar)
void GL3DBarChart::scroll(long nDelta)
{
+ if(mbBlockUserInput)
+ return;
+
glm::vec3 maDir = glm::normalize(maCameraPosition - maCameraDirection);
maCameraPosition -= (float((nDelta/10)) * maDir);
mpCamera->setPosition(maCameraPosition);
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 1f54cc6..377b18c 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -107,6 +107,7 @@ private:
std::map<sal_uInt32, const BarInformation> maBarMap;
+ bool mbBlockUserInput;
};
}
commit bed4d4a4344e2bf5d3f7eb6c3d2a5e5a92b7e490
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon May 26 03:08:08 2014 +0200
adapt bar size to demo
Change-Id: Id746ce00f9e91397a3edf0b39bf7dbb08ea59885
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 6131e05..951188d 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -97,7 +97,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
// guarantee they are positioned correctly. In fact, they are guaranteed
// to be positioned incorrectly.
- const float nBarSizeX = 10.0f;
+ const float nBarSizeX = 5.0f;
const float nBarSizeY = 30.0f;
const float nBarDistanceX = 5.0f;
const float nBarDistanceY = 5.0;
More information about the Libreoffice-commits
mailing list