forked from organicmaps/organicmaps
review fixes
This commit is contained in:
parent
1b56d130db
commit
87ede26a7c
3 changed files with 60 additions and 85 deletions
|
@ -1,50 +1,50 @@
|
|||
<root>
|
||||
<ruler>
|
||||
<portrait>
|
||||
<anchor vertical="center" horizontal="right"/>
|
||||
<relative vertical="bottom" horizontal="right"/>
|
||||
<offset x="6" y="42"/>
|
||||
</portrait>
|
||||
<landscape>
|
||||
<anchor vertical="center" horizontal="right"/>
|
||||
<relative vertical="bottom" horizontal="right"/>
|
||||
<offset x="70.4" y="10.5"/>
|
||||
</landscape>
|
||||
</ruler>
|
||||
<compass>
|
||||
<portrait>
|
||||
<anchor vertical="center" horizontal="center"/>
|
||||
<relative vertical="bottom" horizontal="left"/>
|
||||
<offset x="27" y="57"/>
|
||||
</portrait>
|
||||
<landscape>
|
||||
<anchor vertical="center" horizontal="center"/>
|
||||
<relative vertical="bottom" horizontal="left"/>
|
||||
<offset x="18" y="11.4"/>
|
||||
</landscape>
|
||||
</compass>
|
||||
<copyright>
|
||||
<portrait>
|
||||
<anchor vertical="center" horizontal="right"/>
|
||||
<relative vertical="bottom" horizontal="right"/>
|
||||
<offset x="6" y="42"/>
|
||||
</portrait>
|
||||
<landscape>
|
||||
<anchor vertical="center" horizontal="right"/>
|
||||
<relative vertical="bottom" horizontal="right"/>
|
||||
<offset x="70.4" y="10.5"/>
|
||||
</landscape>
|
||||
</copyright>
|
||||
<country_status>
|
||||
<portrait>
|
||||
<anchor vertical="center" horizontal="center"/>
|
||||
<relative vertical="center" horizontal="center"/>
|
||||
<offset x="0" y="0"/>
|
||||
</portrait>
|
||||
<landscape>
|
||||
<anchor vertical="center" horizontal="center"/>
|
||||
<relative vertical="center" horizontal="center"/>
|
||||
<offset x="0" y="0"/>
|
||||
</landscape>
|
||||
</country_status>
|
||||
<ruler>
|
||||
<portrait>
|
||||
<anchor vertical="center" horizontal="right"/>
|
||||
<relative vertical="bottom" horizontal="right"/>
|
||||
<offset x="6" y="42"/>
|
||||
</portrait>
|
||||
<landscape>
|
||||
<anchor vertical="center" horizontal="right"/>
|
||||
<relative vertical="bottom" horizontal="right"/>
|
||||
<offset x="70.4" y="10.5"/>
|
||||
</landscape>
|
||||
</ruler>
|
||||
<compass>
|
||||
<portrait>
|
||||
<anchor vertical="center" horizontal="center"/>
|
||||
<relative vertical="bottom" horizontal="left"/>
|
||||
<offset x="27" y="57"/>
|
||||
</portrait>
|
||||
<landscape>
|
||||
<anchor vertical="center" horizontal="center"/>
|
||||
<relative vertical="bottom" horizontal="left"/>
|
||||
<offset x="18" y="11.4"/>
|
||||
</landscape>
|
||||
</compass>
|
||||
<copyright>
|
||||
<portrait>
|
||||
<anchor vertical="center" horizontal="right"/>
|
||||
<relative vertical="bottom" horizontal="right"/>
|
||||
<offset x="6" y="42"/>
|
||||
</portrait>
|
||||
<landscape>
|
||||
<anchor vertical="center" horizontal="right"/>
|
||||
<relative vertical="bottom" horizontal="right"/>
|
||||
<offset x="70.4" y="10.5"/>
|
||||
</landscape>
|
||||
</copyright>
|
||||
<country_status>
|
||||
<portrait>
|
||||
<anchor vertical="center" horizontal="center"/>
|
||||
<relative vertical="center" horizontal="center"/>
|
||||
<offset x="0" y="0"/>
|
||||
</portrait>
|
||||
<landscape>
|
||||
<anchor vertical="center" horizontal="center"/>
|
||||
<relative vertical="center" horizontal="center"/>
|
||||
<offset x="0" y="0"/>
|
||||
</landscape>
|
||||
</country_status>
|
||||
</root>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#include "gui_skin.hpp"
|
||||
#include "visual_params.hpp"
|
||||
|
||||
#include "../base/string_utils.hpp"
|
||||
#include "../coding/parse_xml.hpp"
|
||||
#include "../platform/platform.hpp"
|
||||
|
||||
#include "../coding/parse_xml.hpp"
|
||||
#include "../base/string_utils.hpp"
|
||||
#include "../std/function.hpp"
|
||||
|
||||
namespace df
|
||||
|
@ -85,21 +84,12 @@ public:
|
|||
ASSERT(m_element == Element::Offset, ());
|
||||
m_resolver.SetOffsetY(ParseFloat(value));
|
||||
}
|
||||
else if (attr == "vertical")
|
||||
else if (attr == "vertical" || attr == "horizontal")
|
||||
{
|
||||
if (m_element == Element::Anchor)
|
||||
m_resolver.SetAnchorVertical(ParseValueAnchor(value));
|
||||
m_resolver.AddAnchor(ParseValueAnchor(value));
|
||||
else if (m_element == Element::Relative)
|
||||
m_resolver.SetRelativeVertical(ParseValueAnchor(value));
|
||||
else
|
||||
ASSERT(false, ());
|
||||
}
|
||||
else if (attr == "horizontal")
|
||||
{
|
||||
if (m_element == Element::Anchor)
|
||||
m_resolver.SetAnchorHorizontal(ParseValueAnchor(value));
|
||||
else if (m_element == Element::Relative)
|
||||
m_resolver.SetRelativeHorizontal(ParseValueAnchor(value));
|
||||
m_resolver.AddRelative(ParseValueAnchor(value));
|
||||
else
|
||||
ASSERT(false, ());
|
||||
}
|
||||
|
@ -128,7 +118,7 @@ private:
|
|||
class SkinLoader
|
||||
{
|
||||
public:
|
||||
SkinLoader(map<GuiSkin::GuiElement, pair<PositionResolver, PositionResolver> > & skin)
|
||||
explicit SkinLoader(map<GuiSkin::GuiElement, pair<PositionResolver, PositionResolver> > & skin)
|
||||
: m_skin(skin) {}
|
||||
|
||||
bool Push(string const & element)
|
||||
|
@ -237,22 +227,12 @@ GuiPosition PositionResolver::Resolve(int w, int h) const
|
|||
return GuiPosition(m2::PointF(resultX, resultY), m_elementAnchor);
|
||||
}
|
||||
|
||||
void PositionResolver::SetAnchorVertical(dp::Anchor anchor)
|
||||
void PositionResolver::AddAnchor(dp::Anchor anchor)
|
||||
{
|
||||
m_elementAnchor = MergeAnchors(m_elementAnchor, anchor);
|
||||
}
|
||||
|
||||
void PositionResolver::SetAnchorHorizontal(dp::Anchor anchor)
|
||||
{
|
||||
m_elementAnchor = MergeAnchors(m_elementAnchor, anchor);
|
||||
}
|
||||
|
||||
void PositionResolver::SetRelativeVertical(dp::Anchor anchor)
|
||||
{
|
||||
m_resolveAnchor = MergeAnchors(m_resolveAnchor, anchor);
|
||||
}
|
||||
|
||||
void PositionResolver::SetRelativeHorizontal(dp::Anchor anchor)
|
||||
void PositionResolver::AddRelative(dp::Anchor anchor)
|
||||
{
|
||||
m_resolveAnchor = MergeAnchors(m_resolveAnchor, anchor);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "../coding/reader.hpp"
|
||||
|
||||
#include "../drape/drape_global.hpp"
|
||||
#include "../geometry/point2d.hpp"
|
||||
#include "../coding/reader.hpp"
|
||||
|
||||
#include "../std/map.hpp"
|
||||
|
||||
|
@ -23,13 +22,9 @@ struct GuiPosition
|
|||
class PositionResolver
|
||||
{
|
||||
public:
|
||||
PositionResolver() = default;
|
||||
|
||||
GuiPosition Resolve(int w, int h) const;
|
||||
void SetAnchorVertical(dp::Anchor anchor);
|
||||
void SetAnchorHorizontal(dp::Anchor anchor);
|
||||
void SetRelativeVertical(dp::Anchor anchor);
|
||||
void SetRelativeHorizontal(dp::Anchor anchor);
|
||||
void AddAnchor(dp::Anchor anchor);
|
||||
void AddRelative(dp::Anchor anchor);
|
||||
void SetOffsetX(float x);
|
||||
void SetOffsetY(float y);
|
||||
|
||||
|
@ -50,7 +45,7 @@ public:
|
|||
Copyright
|
||||
};
|
||||
|
||||
GuiSkin(ReaderPtr<Reader> const & reader);
|
||||
explicit GuiSkin(ReaderPtr<Reader> const & reader);
|
||||
|
||||
GuiPosition ResolvePosition(GuiElement name);
|
||||
void Resize(int w, int h);
|
||||
|
|
Loading…
Add table
Reference in a new issue