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:
authorvng <viktor.govako@gmail.com>2014-09-06 13:54:20 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:26:10 +0300
commitd9ca6e56ef92b248221b66ab0f79437c573c469b (patch)
tree830f5d1ce26c3a0289fc2d8e7cfa04071d816c1c /map/ruler.hpp
parent573e647de3a22282d0e993c30ffa05f4075c1e93 (diff)
Minor refactoring of InformationDisplay:
- remove useless class data - do not recalculate layout on every frame draw; do it when size changed only - use unique_ptr instead of shared_ptr - remove useless includes
Diffstat (limited to 'map/ruler.hpp')
-rw-r--r--map/ruler.hpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/map/ruler.hpp b/map/ruler.hpp
index 995dfd1e6e..8f1c1c6a22 100644
--- a/map/ruler.hpp
+++ b/map/ruler.hpp
@@ -2,14 +2,10 @@
#include "../gui/element.hpp"
-#include "../geometry/screenbase.hpp"
-#include "../geometry/point2d.hpp"
-#include "../geometry/any_rect2d.hpp"
-
-#include "../graphics/display_list.hpp"
-
#include "../std/shared_ptr.hpp"
-#include "../std/list.hpp"
+#include "../std/unique_ptr.hpp"
+#include "../std/function.hpp"
+
namespace anim
{
@@ -18,19 +14,17 @@ namespace anim
namespace graphics
{
+ class DisplayList;
+
namespace gl
{
class OverlayRenderer;
}
}
-namespace gui
-{
- class CachedTextView;
-}
-
class Framework;
+
class Ruler : public gui::Element
{
typedef gui::Element base_t;
@@ -73,8 +67,10 @@ class Ruler : public gui::Element
private:
Framework & m_f;
+
shared_ptr<graphics::DisplayList> m_dl;
shared_ptr<graphics::DisplayList> m_textDL;
+
int m_textLengthInPx;
double m_scale;
double m_depth;
@@ -95,8 +91,9 @@ private:
RulerFrame * GetMainFrame();
RulerFrame * GetMainFrame() const;
- RulerFrame * m_mainFrame;
- RulerFrame * m_animFrame;
+
+ unique_ptr<RulerFrame> m_mainFrame;
+ unique_ptr<RulerFrame> m_animFrame;
Framework * m_framework;
@@ -113,6 +110,8 @@ public:
void AnimateShow();
void AnimateHide();
+ /// @name Override from graphics::OverlayElement and gui::Element.
+ //@{
vector<m2::AnyRectD> const & boundRects() const;
void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
@@ -120,4 +119,7 @@ public:
void layout();
void cache();
void purge();
+ //@}
+
+ int GetTextOffsetFromLine() const;
};