forked from organicmaps/organicmaps
Factor out and order all GUI-element depth constants in one place.
This commit is contained in:
parent
f61cb071ff
commit
593cb1723b
8 changed files with 53 additions and 31 deletions
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "../../../../../graphics/opengl/framebuffer.hpp"
|
||||
#include "../../../../../graphics/opengl/opengl.hpp"
|
||||
#include "../../../../../graphics/depth_constants.hpp"
|
||||
|
||||
#include "../../../../../platform/platform.hpp"
|
||||
#include "../../../../../platform/location.hpp"
|
||||
|
@ -690,7 +691,7 @@ namespace android
|
|||
|
||||
BookmarkBalloon::Params bp;
|
||||
bp.m_position = graphics::EPosAbove;
|
||||
bp.m_depth = graphics::maxDepth;
|
||||
bp.m_depth = graphics::balloonBaseDepth;
|
||||
bp.m_pivot = m2::PointD(0, 0);
|
||||
bp.m_mainText = "Bookmark";
|
||||
bp.m_framework = &m_work;
|
||||
|
|
22
graphics/depth_constants.hpp
Normal file
22
graphics/depth_constants.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include "defines.hpp"
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
static const int debugDepth = maxDepth;
|
||||
static const int benchmarkDepth = maxDepth;
|
||||
|
||||
/// @todo 100 is a temporary solution fo iOS.
|
||||
/// Need to review logic of gui elements, glyphs and symbols caching
|
||||
/// (display_list_cache.dpp). Depth is hardcoded there.
|
||||
|
||||
static const int balloonContentInc = 100;
|
||||
static const int balloonBaseDepth = maxDepth - balloonContentInc;
|
||||
|
||||
static const int compassDepth = balloonBaseDepth - 10;
|
||||
static const int locationDepth = compassDepth - 10;
|
||||
|
||||
static const int countryStatusDepth = locationDepth - 10;
|
||||
static const int rulerDepth = countryStatusDepth;
|
||||
}
|
|
@ -142,6 +142,7 @@ HEADERS += \
|
|||
vertex_stream.hpp \
|
||||
path_view.hpp \
|
||||
path.hpp \
|
||||
depth_constants.hpp
|
||||
|
||||
win32* {
|
||||
SOURCES += opengl/opengl_win32.cpp
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "../graphics/brush.hpp"
|
||||
#include "../graphics/screen.hpp"
|
||||
#include "../graphics/path.hpp"
|
||||
#include "../graphics/depth_constants.hpp"
|
||||
|
||||
|
||||
namespace gui
|
||||
{
|
||||
|
@ -30,16 +32,11 @@ namespace gui
|
|||
m_textImageOffsetV(0.0),
|
||||
m_boundRects(1)
|
||||
{
|
||||
const int incDepth = 100;
|
||||
|
||||
if (depth() + incDepth > graphics::maxDepth)
|
||||
setDepth(graphics::maxDepth - incDepth);
|
||||
|
||||
TextView::Params tp;
|
||||
|
||||
tp.m_position = graphics::EPosAboveRight;
|
||||
tp.m_pivot = m2::PointD(0, 0);
|
||||
tp.m_depth = depth() + incDepth;
|
||||
tp.m_depth = depth() + graphics::balloonContentInc;
|
||||
|
||||
m_mainTextView.reset(new TextView(tp));
|
||||
m_mainTextView->setFont(Element::EActive, graphics::FontDesc(17, graphics::Color(0, 0, 0, 255)));
|
||||
|
@ -48,7 +45,7 @@ namespace gui
|
|||
auxTp.m_text = p.m_auxText;
|
||||
auxTp.m_position = graphics::EPosAboveRight;
|
||||
auxTp.m_pivot = m2::PointD(0, 0);
|
||||
auxTp.m_depth = depth() + incDepth;
|
||||
auxTp.m_depth = depth() + graphics::balloonContentInc;
|
||||
|
||||
m_auxTextView.reset(new TextView(auxTp));
|
||||
m_auxTextView->setFont(Element::EActive, graphics::FontDesc(12, graphics::Color(102, 102, 102, 255)));
|
||||
|
@ -59,7 +56,7 @@ namespace gui
|
|||
|
||||
ip.m_pivot = m2::PointD(0, 0);
|
||||
ip.m_position = graphics::EPosRight;
|
||||
ip.m_depth = depth() + incDepth;
|
||||
ip.m_depth = depth() + graphics::balloonContentInc;
|
||||
ip.m_image = p.m_image;
|
||||
|
||||
m_imageView.reset(new ImageView(ip));
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "../../../gui/controller.hpp"
|
||||
|
||||
#include "../../../graphics/depth_constants.hpp"
|
||||
|
||||
|
||||
@implementation BalloonView
|
||||
|
||||
|
@ -32,7 +34,7 @@
|
|||
// Init balloon.
|
||||
BookmarkBalloon::Params bp;
|
||||
bp.m_position = graphics::EPosAbove;
|
||||
bp.m_depth = graphics::maxDepth;
|
||||
bp.m_depth = graphics::balloonBaseDepth;
|
||||
bp.m_pivot = m2::PointD(0, 0);
|
||||
bp.m_mainText = "Bookmark";
|
||||
bp.m_framework = &f;
|
||||
|
|
|
@ -153,7 +153,7 @@ CountryStatusDisplay::CountryStatusDisplay(Params const & p)
|
|||
|
||||
gui::Button::Params bp;
|
||||
|
||||
bp.m_depth = graphics::maxDepth - 10;
|
||||
bp.m_depth = depth();
|
||||
bp.m_minWidth = 200;
|
||||
bp.m_minHeight = 40;
|
||||
bp.m_pivot = m2::PointD(0, 0);
|
||||
|
@ -172,7 +172,7 @@ CountryStatusDisplay::CountryStatusDisplay(Params const & p)
|
|||
m_downloadButton->setColor(EPressed, graphics::Color(graphics::Color(0, 0, 0, 0.4 * 255)));
|
||||
|
||||
gui::TextView::Params tp;
|
||||
tp.m_depth = graphics::maxDepth - 10;
|
||||
tp.m_depth = depth();
|
||||
tp.m_pivot = m2::PointD(0, 0);
|
||||
tp.m_text = "Downloading";
|
||||
|
||||
|
@ -259,8 +259,6 @@ void CountryStatusDisplay::draw(graphics::OverlayRenderer *r,
|
|||
|
||||
checkDirtyLayout();
|
||||
|
||||
//r->drawRectangle(roughBoundRect(), graphics::Color(0, 0, 255, 64), graphics::maxDepth);
|
||||
|
||||
if (m_downloadButton->isVisible())
|
||||
m_downloadButton->draw(r, m);
|
||||
if (m_statusMsg->isVisible())
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../graphics/defines.hpp"
|
||||
#include "../graphics/pen.hpp"
|
||||
#include "../graphics/straight_text_element.hpp"
|
||||
#include "../graphics/depth_constants.hpp"
|
||||
|
||||
#include "../base/string_utils.hpp"
|
||||
#include "../base/logging.hpp"
|
||||
|
@ -63,7 +64,7 @@ void InformationDisplay::InitRuler(Framework * fw)
|
|||
{
|
||||
Ruler::Params p;
|
||||
|
||||
p.m_depth = graphics::maxDepth - 10;
|
||||
p.m_depth = graphics::rulerDepth;
|
||||
p.m_position = graphics::EPosAboveLeft;
|
||||
p.m_framework = fw;
|
||||
|
||||
|
@ -76,7 +77,7 @@ void InformationDisplay::InitCountryStatusDisplay(Framework * fw)
|
|||
|
||||
p.m_pivot = m2::PointD(0, 0);
|
||||
p.m_position = graphics::EPosCenter;
|
||||
p.m_depth = graphics::maxDepth;
|
||||
p.m_depth = graphics::countryStatusDepth;
|
||||
p.m_storage = &fw->Storage();
|
||||
|
||||
m_countryStatusDisplay.reset(new CountryStatusDisplay(p));
|
||||
|
@ -87,7 +88,7 @@ void InformationDisplay::InitCompassArrow(Framework * fw)
|
|||
CompassArrow::Params p;
|
||||
|
||||
p.m_position = graphics::EPosCenter;
|
||||
p.m_depth = graphics::maxDepth;
|
||||
p.m_depth = graphics::compassDepth;
|
||||
p.m_arrowHeight = 50;
|
||||
p.m_arrowWidth = 16;
|
||||
p.m_pivot = m2::PointD(0, 0);
|
||||
|
@ -101,11 +102,11 @@ void InformationDisplay::InitLocationState(Framework * fw)
|
|||
location::State::Params p;
|
||||
|
||||
p.m_position = graphics::EPosCenter;
|
||||
p.m_depth = graphics::maxDepth - 1;
|
||||
p.m_depth = graphics::locationDepth;
|
||||
p.m_pivot = m2::PointD(0, 0);
|
||||
p.m_compassAreaColor = graphics::Color(255, 255, 255, 192);
|
||||
p.m_compassBorderColor = graphics::Color(255, 255, 255, 96);
|
||||
p.m_locationAreaColor = graphics::Color(11, 97, 210, 48);
|
||||
p.m_locationAreaColor = graphics::Color(11, 97, 210, 48);
|
||||
p.m_framework = fw;
|
||||
|
||||
m_locationState.reset(new location::State(p));
|
||||
|
@ -115,7 +116,7 @@ void InformationDisplay::InitCenterLabel()
|
|||
{
|
||||
gui::CachedTextView::Params p;
|
||||
|
||||
p.m_depth = graphics::maxDepth - 10;
|
||||
p.m_depth = graphics::rulerDepth;
|
||||
p.m_position = graphics::EPosUnderLeft;
|
||||
p.m_pivot = m2::PointD(0, 0);
|
||||
|
||||
|
@ -126,7 +127,7 @@ void InformationDisplay::InitDebugLabel()
|
|||
{
|
||||
gui::CachedTextView::Params p;
|
||||
|
||||
p.m_depth = graphics::maxDepth - 10;
|
||||
p.m_depth = graphics::debugDepth;
|
||||
p.m_position = graphics::EPosAboveRight;
|
||||
p.m_pivot = m2::PointD(0, 0);
|
||||
|
||||
|
@ -202,8 +203,8 @@ void InformationDisplay::drawDebugPoints(Drawer * pDrawer)
|
|||
for (int i = 0; i < sizeof(m_DebugPts) / sizeof(m2::PointD); ++i)
|
||||
if (m_DebugPts[i] != m2::PointD(0, 0))
|
||||
{
|
||||
pDrawer->screen()->drawArc(m_DebugPts[i], 0, math::pi * 2, 30, graphics::Color(0, 0, 255, 32), graphics::maxDepth);
|
||||
pDrawer->screen()->fillSector(m_DebugPts[i], 0, math::pi * 2, 30, graphics::Color(0, 0, 255, 32), graphics::maxDepth);
|
||||
pDrawer->screen()->drawArc(m_DebugPts[i], 0, math::pi * 2, 30, graphics::Color(0, 0, 255, 32), graphics::debugDepth);
|
||||
pDrawer->screen()->fillSector(m_DebugPts[i], 0, math::pi * 2, 30, graphics::Color(0, 0, 255, 32), graphics::debugDepth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,7 +289,7 @@ void InformationDisplay::drawMemoryWarning(Drawer * drawer)
|
|||
pos,
|
||||
graphics::EPosAboveRight,
|
||||
out.str(),
|
||||
graphics::maxDepth - 10,
|
||||
graphics::debugDepth,
|
||||
false);
|
||||
|
||||
if (m_lastMemoryWarning.ElapsedSeconds() > 5)
|
||||
|
@ -445,10 +446,11 @@ void InformationDisplay::drawBenchmarkInfo(Drawer * pDrawer)
|
|||
pos,
|
||||
graphics::EPosAboveRight,
|
||||
"benchmark info :",
|
||||
graphics::maxDepth,
|
||||
graphics::benchmarkDepth,
|
||||
false);
|
||||
|
||||
for (unsigned i = max(0, (int)m_benchmarkInfo.size() - 5); i < m_benchmarkInfo.size(); ++i)
|
||||
size_t const count = m_benchmarkInfo.size();
|
||||
for (size_t i = (count <= 5 ? 0 : count - 5); i < count; ++i)
|
||||
{
|
||||
ostringstream out;
|
||||
m2::RectD const & r = m_benchmarkInfo[i].m_rect;
|
||||
|
@ -464,11 +466,9 @@ void InformationDisplay::drawBenchmarkInfo(Drawer * pDrawer)
|
|||
pos,
|
||||
graphics::EPosAboveRight,
|
||||
out.str(),
|
||||
graphics::maxDepth,
|
||||
false
|
||||
);
|
||||
graphics::benchmarkDepth,
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InformationDisplay::doDraw(Drawer *drawer)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../gui/controller.hpp"
|
||||
|
||||
#include "../graphics/opengl/opengl.hpp"
|
||||
#include "../graphics/depth_constants.hpp"
|
||||
|
||||
#include "../platform/settings.hpp"
|
||||
#include "../platform/platform.hpp"
|
||||
|
@ -417,7 +418,7 @@ namespace qt
|
|||
BookmarkBalloon::Params bp;
|
||||
|
||||
bp.m_position = graphics::EPosAbove;
|
||||
bp.m_depth = graphics::maxDepth;
|
||||
bp.m_depth = graphics::balloonBaseDepth;
|
||||
bp.m_pivot = m2::PointD(0.0, 0.0);
|
||||
bp.m_mainText = "Bookmark";
|
||||
bp.m_framework = m_framework.get();
|
||||
|
|
Loading…
Add table
Reference in a new issue