Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExMix <rahuba.youri@mapswithme.com>2014-09-15 14:26:26 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:27:01 +0300
commit667f03e020af445b5ff23b11251926e3b2e0daf5 (patch)
treee49b65bb7281582957dcfd51e22ecad3f5d0d84f /map/information_display.cpp
parent78c3c6bb898dfa16fcb7f5ad866e5e8c2ed0ef60 (diff)
[core] copyright on first 3 second
Diffstat (limited to 'map/information_display.cpp')
-rw-r--r--map/information_display.cpp55
1 files changed, 50 insertions, 5 deletions
diff --git a/map/information_display.cpp b/map/information_display.cpp
index 915bf230f9..52f653e66d 100644
--- a/map/information_display.cpp
+++ b/map/information_display.cpp
@@ -4,6 +4,10 @@
#include "compass_arrow.hpp"
#include "framework.hpp"
#include "ruler.hpp"
+#include "alfa_animation_task.hpp"
+
+#include "../anim/task.hpp"
+#include "../anim/controller.hpp"
#include "../gui/controller.hpp"
#include "../gui/button.hpp"
@@ -20,23 +24,24 @@ using namespace graphics;
namespace
{
- static int const RULLER_X_OFFSET = 10;
- static int const RULLER_Y_OFFSET = 51;
+ static int const RULLER_X_OFFSET = 6;
+ static int const RULLER_Y_OFFSET = 42;
static int const FONT_SIZE = 14;
- static int const COMPASS_X_OFFSET = 21;
- static int const COMPASS_Y_OFFSET = 53;
+ static int const COMPASS_X_OFFSET = 27;
+ static int const COMPASS_Y_OFFSET = 57;
}
InformationDisplay::InformationDisplay(Framework * fw)
: m_visualScale(1)
{
- m_fontDesc.m_color = Color(0x44, 0x44, 0x44, 0xFF);
+ m_fontDesc.m_color = Color(0x4D, 0x4D, 0x4D, 0xCC);
InitRuler(fw);
InitCountryStatusDisplay(fw);
InitCompassArrow(fw);
InitLocationState(fw);
InitDebugLabel();
+ InitCopyright(fw);
enableDebugPoints(false);
enableDebugInfo(false);
@@ -76,6 +81,33 @@ void InformationDisplay::InitCountryStatusDisplay(Framework * fw)
m_countryStatusDisplay.reset(new CountryStatusDisplay(p));
}
+void InformationDisplay::InitCopyright(Framework * fw)
+{
+ gui::CachedTextView::Params p;
+
+ p.m_depth = rulerDepth;
+ p.m_position = EPosAboveLeft;
+ p.m_pivot = m2::PointD(0, 0);
+ p.m_text = "Map data © OpenStreetMap";
+
+ m_copyrightLabel.reset(new gui::CachedTextView(p));
+
+ shared_ptr<anim::Task> task(new AlfaAnimationTask(1.0, 0.0, 0.15, 3.0, fw));
+ task->AddCallback(anim::Task::EEnded, [this]()
+ {
+ m_controller->RemoveElement(m_copyrightLabel);
+ m_copyrightLabel.reset();
+ });
+
+ m_copyrightLabel->setAnimated([task]()
+ {
+ AlfaAnimationTask * t = static_cast<AlfaAnimationTask *>(task.get());
+ return t->GetCurrentAlfa();
+ });
+
+ fw->GetAnimController()->AddTask(task);
+}
+
void InformationDisplay::InitCompassArrow(Framework * fw)
{
CompassArrow::Params p;
@@ -120,6 +152,7 @@ void InformationDisplay::setController(gui::Controller * controller)
m_controller->AddElement(m_locationState);
m_controller->AddElement(m_ruler);
m_controller->AddElement(m_debugLabel);
+ m_controller->AddElement(m_copyrightLabel);
}
void InformationDisplay::setDisplayRect(m2::RectI const & rect)
@@ -135,6 +168,12 @@ void InformationDisplay::setDisplayRect(m2::RectI const & rect)
m_ruler->setPivot(m2::PointD(rect.maxX() - RULLER_X_OFFSET * m_visualScale,
rect.maxY() - RULLER_Y_OFFSET * m_visualScale));
+ if (m_copyrightLabel)
+ {
+ m_copyrightLabel->setPivot(m2::PointD(rect.maxX() - RULLER_X_OFFSET * m_visualScale,
+ rect.maxY() - RULLER_Y_OFFSET * m_visualScale));
+ }
+
m_debugLabel->setPivot(m2::PointD(rect.minX() + 10,
rect.minY() + 50 + 5 * m_visualScale));
}
@@ -159,6 +198,11 @@ void InformationDisplay::drawDebugPoints(Drawer * pDrawer)
}
}
+bool InformationDisplay::isCopyrightActive() const
+{
+ return m_copyrightLabel != nullptr;
+}
+
void InformationDisplay::enableRuler(bool doEnable)
{
if (doEnable)
@@ -179,6 +223,7 @@ void InformationDisplay::setVisualScale(double visualScale)
m_fontDesc.m_size = static_cast<uint32_t>(FONT_SIZE * m_visualScale);
m_ruler->setFont(gui::Element::EActive, m_fontDesc);
+ m_copyrightLabel->setFont(gui::Element::EActive, m_fontDesc);
m_debugLabel->setFont(gui::Element::EActive, m_fontDesc);
}