[apps/shared] Change rendering of interactive zoom in graph view

Change-Id: If18fd9d9b46d473b5f5e16be646a328f66e1e9d9
This commit is contained in:
Émilie Feral
2017-03-17 10:23:06 +01:00
parent fd299df4c8
commit 5e6470f776
4 changed files with 34 additions and 39 deletions

View File

@@ -17,7 +17,7 @@ constexpr static char deviationFrenchDefinition[] = {Ion::Charset::SmallSigma, '
constexpr static char deviationEnglishDefinition[] = {Ion::Charset::SmallSigma, ' ', ':', ' ', 'S', 't', 'a', 'n', 'd', 'a', 'r', 'd', ' ','d','e', 'v', 'i', 'a', 't','i','o','n', 0};
constexpr static char deviationSpanishDefinition[] = {Ion::Charset::SmallSigma, ' ', ':', ' ', 'D', 'e','s','v','i','a','c','i','o','n',' ','t','i','p','i','c','a',0};
const char * messages[200][3] {
const char * messages[196][3] {
{"Attention", "Warning", "Cuidado"},
{"Valider", "Confirm", "Confirmar"},
{"Suivant", "Next", "Siguiente"},
@@ -107,13 +107,9 @@ const char * messages[200][3] {
{"Zoom interactif", "Interactive zoom", "Zoom interactivo"},
{"Zoom predefini", "Predefined zoom", "Zoom predefinido"},
{"Initialisation", "Preadjustment", "Inicializacion"},
{"HAUT", "TOP", "???"},
{"GAUCHE", "LEFT", "???"},
{"BAS", "BOTTM", "???"},
{"DROITE", "RIGHT", "???"},
{"ZOOM", "ZOOM", "ZOOM"},
{"Se deplacer", "Move", "Mover"},
{"Zoomer", "Zoom", "Zoom"},
{" Deplacer : ", "Move: ", "Mover : "},
{"Zoomer : ", "Zoom: ", "Zoom : "},
{" ou ", " or ", " o "},
{"Trigonometrique", "Trigonometrical", "Trigonometrico"},
{"Abscisses entieres", "Integer", "Abscisas enteras"},
{"Orthonorme", "Orthonormal", "Ortonormal"},

View File

@@ -92,13 +92,9 @@ namespace I18n {
InteractiveZoom,
PredefinedZoom,
Initialization,
TopCapital,
LeftCapital,
BottomCapital,
RightCapital,
ZoomCapital,
Move,
ToZoom,
Or,
Trigonometric,
RoundAbscissa,
Orthonormal,

View File

@@ -93,14 +93,12 @@ CurveView * ZoomParameterController::ContentView::curveView() {
/* Legend View */
ZoomParameterController::ContentView::LegendView::LegendView() :
m_legends{MessageTextView(KDText::FontSize::Small, I18n::Message::TopCapital, 0.0f, 0.5f, KDColorBlack, Palette::GreyBright),
MessageTextView(KDText::FontSize::Small, I18n::Message::LeftCapital, 0.0f, 0.5f, KDColorBlack, Palette::GreyBright),
MessageTextView(KDText::FontSize::Small, I18n::Message::ZoomCapital, 0.5f, 0.5f, KDColorBlack, Palette::GreyBright),
MessageTextView(KDText::FontSize::Small, I18n::Message::BottomCapital, 1.0f, 0.5f, KDColorBlack, Palette::GreyBright),
MessageTextView(KDText::FontSize::Small, I18n::Message::RightCapital, 1.0f, 0.5f, KDColorBlack, Palette::GreyBright)},
m_legendPictograms{KeyView(KeyView::Type::Up), KeyView(KeyView::Type::Left),
KeyView(KeyView::Type::Plus), KeyView(KeyView::Type::Minus),
KeyView(KeyView::Type::Down), KeyView(KeyView::Type::Right)}
m_legends{MessageTextView(KDText::FontSize::Small, I18n::Message::Move, 1.0f, 0.5f, KDColorBlack, Palette::GreyBright),
MessageTextView(KDText::FontSize::Small, I18n::Message::ToZoom, 1.0f, 0.5f, KDColorBlack, Palette::GreyBright),
MessageTextView(KDText::FontSize::Small, I18n::Message::Or, 0.5f, 0.5f, KDColorBlack, Palette::GreyBright)},
m_legendPictograms{KeyView(KeyView::Type::Up), KeyView(KeyView::Type::Down),
KeyView(KeyView::Type::Left), KeyView(KeyView::Type::Right),
KeyView(KeyView::Type::Plus), KeyView(KeyView::Type::Minus)}
{
}
@@ -109,31 +107,35 @@ void ZoomParameterController::ContentView::LegendView::drawRect(KDContext * ctx,
}
int ZoomParameterController::ContentView::LegendView::numberOfSubviews() const {
return 2*k_numberOfLegends-1;
return k_numberOfLegends+k_numberOfTokens;
}
View * ZoomParameterController::ContentView::LegendView::subviewAtIndex(int index) {
assert(index >= 0 && index < 2*k_numberOfLegends);
if (index < k_numberOfLegends-1) {
assert(index >= 0 && index < k_numberOfTokens+k_numberOfLegends);
if (index < k_numberOfLegends) {
return &m_legends[index];
}
return &m_legendPictograms[index-k_numberOfLegends+1];
return &m_legendPictograms[index-k_numberOfLegends];
}
void ZoomParameterController::ContentView::LegendView::layoutSubviews() {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
for (int row = 0; row < 2; row++) {
m_legends[row].setFrame(KDRect(k_tokenWidth, row*height/2, width/3 - k_tokenWidth, height/2));
m_legends[3+row].setFrame(KDRect(2*width/3, row*height/2, width/3 - k_tokenWidth, height/2));
KDCoordinate xOrigin = 0;
KDCoordinate legendWidth = m_legends[0].minimalSizeForOptimalDisplay().width();
m_legends[0].setFrame(KDRect(xOrigin, 0, legendWidth, height));
xOrigin += legendWidth;
for (int i = 0; i < k_numberOfTokens - 2; i++) {
m_legendPictograms[i].setFrame(KDRect(xOrigin, 0, k_tokenWidth, height));
xOrigin += k_tokenWidth;
}
m_legends[2].setFrame(KDRect(width/3, 0, width/3, height));
for (int row = 0; row < 2; row++) {
m_legendPictograms[row].setFrame(KDRect(0, row*height/2, k_tokenWidth, height/2));
m_legendPictograms[4+row].setFrame(KDRect(width-k_tokenWidth, row*height/2, k_tokenWidth, height/2));
xOrigin = bounds().width()/2;
for (int i = 1; i < k_numberOfLegends; i++) {
KDCoordinate legendWidth = m_legends[i].minimalSizeForOptimalDisplay().width();
m_legends[i].setFrame(KDRect(xOrigin, 0, legendWidth, height));
xOrigin += legendWidth;
m_legendPictograms[k_numberOfTokens - 3 + i].setFrame(KDRect(xOrigin, 0, k_tokenWidth, height));
xOrigin += k_tokenWidth;
}
m_legendPictograms[2].setFrame(KDRect(width/3, 0, k_tokenWidth, height));
m_legendPictograms[3].setFrame(KDRect(2*width/3-k_tokenWidth, 0, k_tokenWidth, height));
}
}

View File

@@ -28,13 +28,14 @@ private:
LegendView();
void drawRect(KDContext * ctx, KDRect rect) const override;
private:
constexpr static int k_numberOfLegends = 6;
constexpr static KDCoordinate k_tokenWidth = 35;
constexpr static int k_numberOfLegends = 3;
constexpr static int k_numberOfTokens = 6;
constexpr static KDCoordinate k_tokenWidth = 10;
void layoutSubviews() override;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
MessageTextView m_legends[k_numberOfLegends-1];
KeyView m_legendPictograms[k_numberOfLegends];
MessageTextView m_legends[k_numberOfLegends];
KeyView m_legendPictograms[k_numberOfTokens];
};
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;