[escher/view] setFrame and layoutSubviews can be forced

This commit is contained in:
Léa Saviot
2019-10-02 11:22:49 +02:00
parent f85658f5e6
commit 9f018eb9d9
168 changed files with 421 additions and 405 deletions

View File

@@ -32,7 +32,7 @@ AppsContainer::AppsContainer() :
m_hardwareTestSnapshot(),
m_usbConnectedSnapshot()
{
m_emptyBatteryWindow.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height));
m_emptyBatteryWindow.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height), false);
#if __EMSCRIPTEN__
/* AppsContainer::poincareCircuitBreaker uses Ion::Keyboard::scan(), which
* calls emscripten_sleep. If we set the poincare circuit breaker, we would
@@ -208,7 +208,7 @@ bool AppsContainer::switchTo(App::Snapshot * snapshot) {
void AppsContainer::run() {
KDRect screenRect = KDRect(0, 0, Ion::Display::Width, Ion::Display::Height);
window()->setFrame(screenRect);
window()->setFrame(screenRect, false);
/* We push a white screen here, because fetching the exam mode takes some time
* and it is visible when reflashing a N0100 (there is some noise on the
* screen before the logo appears). */

View File

@@ -58,11 +58,11 @@ View * AppsWindow::subviewAtIndex(int index) {
return m_contentView;
}
void AppsWindow::layoutSubviews() {
void AppsWindow::layoutSubviews(bool force) {
KDCoordinate titleHeight = m_hideTitleBarView ? 0 : Metric::TitleBarHeight;
m_titleBarView.setFrame(KDRect(0, 0, bounds().width(), titleHeight));
m_titleBarView.setFrame(KDRect(0, 0, bounds().width(), titleHeight), force);
if (m_contentView != nullptr) {
m_contentView->setFrame(KDRect(0, titleHeight, bounds().width(), bounds().height()-titleHeight));
m_contentView->setFrame(KDRect(0, titleHeight, bounds().width(), bounds().height()-titleHeight), force);
}
}

View File

@@ -17,7 +17,7 @@ public:
void hideTitleBarView(bool hide);
private:
int numberOfSubviews() const override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
View * subviewAtIndex(int index) override;
TitleBarView m_titleBarView;
bool m_hideTitleBarView;

View File

@@ -25,12 +25,12 @@ View * EditExpressionController::ContentView::subviewAtIndex(int index) {
return &m_expressionField;
}
void EditExpressionController::ContentView::layoutSubviews() {
void EditExpressionController::ContentView::layoutSubviews(bool force) {
KDCoordinate inputViewFrameHeight = m_expressionField.minimalSizeForOptimalDisplay().height();
KDRect mainViewFrame(0, 0, bounds().width(), bounds().height() - inputViewFrameHeight);
m_mainView->setFrame(mainViewFrame);
m_mainView->setFrame(mainViewFrame, force);
KDRect inputViewFrame(0, bounds().height() - inputViewFrameHeight, bounds().width(), inputViewFrameHeight);
m_expressionField.setFrame(inputViewFrame);
m_expressionField.setFrame(inputViewFrame, force);
}
void EditExpressionController::ContentView::reload() {

View File

@@ -42,7 +42,7 @@ private:
private:
int numberOfSubviews() const override { return 2; }
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
TableView * m_mainView;
ExpressionField m_expressionField;
};

View File

@@ -120,22 +120,21 @@ View * HistoryViewCell::subviewAtIndex(int index) {
return views[index];
}
void HistoryViewCell::layoutSubviews() {
void HistoryViewCell::layoutSubviews(bool force) {
KDCoordinate maxFrameWidth = bounds().width();
KDSize inputSize = m_inputView.minimalSizeForOptimalDisplay();
m_inputView.setFrame(KDRect(
0,
0,
0, 0,
minCoordinate(maxFrameWidth, inputSize.width()),
inputSize.height()
));
inputSize.height()),
force);
KDSize outputSize = m_scrollableOutputView.minimalSizeForOptimalDisplay();
m_scrollableOutputView.setFrame(KDRect(
maxCoordinate(0, maxFrameWidth - outputSize.width()),
inputSize.height(),
minCoordinate(maxFrameWidth, outputSize.width()),
outputSize.height()
));
outputSize.height()),
force);
}
void HistoryViewCell::setCalculation(Calculation * calculation, bool expanded) {

View File

@@ -43,7 +43,7 @@ public:
void setCalculation(Calculation * calculation, bool expanded = false);
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
void didBecomeFirstResponder() override;
bool handleEvent(Ion::Events::Event event) override;
Shared::ScrollableExactApproximateExpressionsView * outputView();

View File

@@ -27,10 +27,10 @@ View * ConsoleEditCell::subviewAtIndex(int index) {
}
}
void ConsoleEditCell::layoutSubviews() {
void ConsoleEditCell::layoutSubviews(bool force) {
KDSize promptSize = m_promptView.minimalSizeForOptimalDisplay();
m_promptView.setFrame(KDRect(KDPointZero, promptSize.width(), bounds().height()));
m_textField.setFrame(KDRect(KDPoint(promptSize.width(), KDCoordinate(0)), bounds().width() - promptSize.width(), bounds().height()));
m_promptView.setFrame(KDRect(KDPointZero, promptSize.width(), bounds().height()), force);
m_textField.setFrame(KDRect(KDPoint(promptSize.width(), KDCoordinate(0)), bounds().width() - promptSize.width(), bounds().height()), force);
}
void ConsoleEditCell::didBecomeFirstResponder() {

View File

@@ -16,7 +16,7 @@ public:
// View
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
// Responder
void didBecomeFirstResponder() override;

View File

@@ -77,16 +77,16 @@ View * ConsoleLineCell::subviewAtIndex(int index) {
return &m_scrollableView;
}
void ConsoleLineCell::layoutSubviews() {
void ConsoleLineCell::layoutSubviews(bool force) {
if (m_line.isCommand()) {
KDSize promptSize = ConsoleController::k_font->stringSize(I18n::translate(I18n::Message::ConsolePrompt));
m_promptView.setFrame(KDRect(KDPointZero, promptSize.width(), bounds().height()));
m_scrollableView.setFrame(KDRect(KDPoint(promptSize.width(), 0), bounds().width() - promptSize.width(), bounds().height()));
m_promptView.setFrame(KDRect(KDPointZero, promptSize.width(), bounds().height()), force);
m_scrollableView.setFrame(KDRect(KDPoint(promptSize.width(), 0), bounds().width() - promptSize.width(), bounds().height()), force);
return;
}
assert(m_line.isResult());
m_promptView.setFrame(KDRectZero);
m_scrollableView.setFrame(bounds());
m_promptView.setFrame(KDRectZero, force);
m_scrollableView.setFrame(bounds(), force);
}
void ConsoleLineCell::didBecomeFirstResponder() {

View File

@@ -30,7 +30,7 @@ public:
/* View */
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
/* Responder */
void didBecomeFirstResponder() override;

View File

@@ -34,17 +34,17 @@ void EditorView::didBecomeFirstResponder() {
Container::activeApp()->setFirstResponder(&m_textArea);
}
void EditorView::layoutSubviews() {
void EditorView::layoutSubviews(bool force) {
m_gutterView.setOffset(0);
KDCoordinate gutterWidth = m_gutterView.minimalSizeForOptimalDisplay().width();
m_gutterView.setFrame(KDRect(0, 0, gutterWidth, bounds().height()));
m_gutterView.setFrame(KDRect(0, 0, gutterWidth, bounds().height()), force);
m_textArea.setFrame(KDRect(
gutterWidth,
0,
bounds().width()-gutterWidth,
bounds().height()
));
gutterWidth,
0,
bounds().width()-gutterWidth,
bounds().height()),
force);
}
/* EditorView::GutterView */

View File

@@ -26,7 +26,7 @@ public:
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
class GutterView : public View {
public:

View File

@@ -29,12 +29,13 @@ void ScriptNameCell::didBecomeFirstResponder() {
Container::activeApp()->setFirstResponder(&m_textField);
}
void ScriptNameCell::layoutSubviews() {
void ScriptNameCell::layoutSubviews(bool force) {
KDRect cellBounds = bounds();
m_textField.setFrame(KDRect(cellBounds.x() + k_leftMargin,
cellBounds.y(),
cellBounds.width() - k_leftMargin,
cellBounds.height()));
cellBounds.height()),
force);
}
}

View File

@@ -48,7 +48,7 @@ private:
assert(index == 0);
return &m_textField;
}
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
Shared::TextFieldWithExtension m_textField;
char m_textBody[TextField::maxBufferSize()];

View File

@@ -129,14 +129,14 @@ View * ExamPopUpController::ContentView::subviewAtIndex(int index) {
}
}
void ExamPopUpController::ContentView::layoutSubviews() {
void ExamPopUpController::ContentView::layoutSubviews(bool force) {
KDCoordinate height = bounds().height();
KDCoordinate width = bounds().width();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_warningTextView.setFrame(KDRect(0, k_topMargin, width, textHeight));
m_messageTextView1.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+textHeight, width, textHeight));
m_messageTextView2.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+2*textHeight, width, textHeight));
m_messageTextView3.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+3*textHeight, width, textHeight));
m_cancelButton.setFrame(KDRect(k_buttonMargin, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight));
m_okButton.setFrame(KDRect(2*k_buttonMargin+(width-3*k_buttonMargin)/2, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight));
m_warningTextView.setFrame(KDRect(0, k_topMargin, width, textHeight), force);
m_messageTextView1.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+textHeight, width, textHeight), force);
m_messageTextView2.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+2*textHeight, width, textHeight), force);
m_messageTextView3.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+3*textHeight, width, textHeight), force);
m_cancelButton.setFrame(KDRect(k_buttonMargin, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight), force);
m_okButton.setFrame(KDRect(2*k_buttonMargin+(width-3*k_buttonMargin)/2, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight), force);
}

View File

@@ -37,7 +37,7 @@ private:
constexpr static KDCoordinate k_paragraphHeight = 20;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
HighContrastButton m_cancelButton;
HighContrastButton m_okButton;
MessageTextView m_warningTextView;

View File

@@ -52,9 +52,9 @@ void TextFieldFunctionTitleCell::setHorizontalAlignment(float alignment) {
m_textField.setAlignment(alignment, verticalAlignment());
}
void TextFieldFunctionTitleCell::layoutSubviews() {
void TextFieldFunctionTitleCell::layoutSubviews(bool force) {
KDRect frame = subviewFrame();
m_textField.setFrame(frame);
m_textField.setFrame(frame, force);
KDCoordinate maxTextFieldX = frame.width() - m_textField.minimalSizeForOptimalDisplay().width();
float horizontalAlignment = maxFloat(
0.0f,

View File

@@ -34,7 +34,7 @@ public:
assert(index == 0);
return &m_textField;
}
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
// Responder
void didBecomeFirstResponder() override;

View File

@@ -12,8 +12,8 @@ void AbscissaTitleCell::drawRect(KDContext * ctx, KDRect rect) const {
}
}
void AbscissaTitleCell::layoutSubviews() {
m_messageTextView.setFrame(rectWithoutSeparator(bounds()));
void AbscissaTitleCell::layoutSubviews(bool force) {
m_messageTextView.setFrame(rectWithoutSeparator(bounds()), force);
}
void AbscissaTitleCell::didSetSeparator() {

View File

@@ -10,7 +10,7 @@ class AbscissaTitleCell : public EvenOddMessageTextCell, public Shared::Separabl
public:
AbscissaTitleCell() : EvenOddMessageTextCell(), Separable() {}
void drawRect(KDContext * ctx, KDRect rect) const override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
void didSetSeparator() override;
};

View File

@@ -20,7 +20,7 @@ void IntervalParameterSelectorController::viewDidDisappear() {
/* Deselect the table properly because it needs to be relayouted the next time
* it appears: the number of rows might change according to the plot type. */
m_selectableTableView.deselectTable(false);
m_selectableTableView.setFrame(KDRectZero);
m_selectableTableView.setFrame(KDRectZero, false);
}
void IntervalParameterSelectorController::didBecomeFirstResponder() {

View File

@@ -94,11 +94,11 @@ void BatteryTestController::ContentView::setColor(KDColor color) {
m_batteryChargingView.setBackgroundColor(color);
}
void BatteryTestController::ContentView::layoutSubviews() {
m_batteryStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height/2));
void BatteryTestController::ContentView::layoutSubviews(bool force) {
m_batteryStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height/2), force);
KDSize textSize = KDFont::SmallFont->glyphSize();
m_batteryLevelView.setFrame(KDRect(0, Ion::Display::Height-2*textSize.height(), Ion::Display::Width, textSize.height()));
m_batteryChargingView.setFrame(KDRect(0, Ion::Display::Height-textSize.height(), Ion::Display::Width, textSize.height()));
m_batteryLevelView.setFrame(KDRect(0, Ion::Display::Height-2*textSize.height(), Ion::Display::Width, textSize.height()), force);
m_batteryChargingView.setFrame(KDRect(0, Ion::Display::Height-textSize.height(), Ion::Display::Width, textSize.height()), force);
}
int BatteryTestController::ContentView::numberOfSubviews() const {

View File

@@ -21,7 +21,7 @@ private:
constexpr static int k_maxNumberOfCharacters = 20;
void setColor(KDColor color) override;
private:
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
constexpr static int k_margin = 4;

View File

@@ -20,7 +20,7 @@ void Code128BView::setData(const char * data) {
markRectAsDirty(bounds());
}
void Code128BView::layoutSubviews() {
void Code128BView::layoutSubviews(bool force) {
updateModuleWidth();
}

View File

@@ -10,7 +10,7 @@ public:
Code128BView();
void drawRect(KDContext * ctx, KDRect rect) const override;
void setData(const char * data);
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
static constexpr KDCoordinate k_outlineThickness = 1;
static constexpr KDCoordinate k_charPatternWidth = 11;

View File

@@ -33,8 +33,8 @@ void ColorsLCDTestController::ContentView::setColor(KDColor color) {
m_colorsLCDStateView.setBackgroundColor(color);
}
void ColorsLCDTestController::ContentView::layoutSubviews() {
m_colorsLCDStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height));
void ColorsLCDTestController::ContentView::layoutSubviews(bool force) {
m_colorsLCDStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height), force);
}
}

View File

@@ -22,7 +22,7 @@ private:
BufferTextView * colorsLCDStateTextView() { return &m_colorsLCDStateView; }
void setColor(KDColor color) override;
private:
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
int numberOfSubviews() const override { return 1; }
View * subviewAtIndex(int index) override {
assert(index == 0);

View File

@@ -46,9 +46,9 @@ void LCDDataTestController::ContentView::setStatus(bool success, int numberOfErr
m_lcdNumberPixelFailuresView.setText(buffer);
}
void LCDDataTestController::ContentView::layoutSubviews() {
m_lcdDataStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height));
m_lcdNumberPixelFailuresView.setFrame(KDRect(10, 10, Ion::Display::Width, 20));
void LCDDataTestController::ContentView::layoutSubviews(bool force) {
m_lcdDataStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height), force);
m_lcdNumberPixelFailuresView.setFrame(KDRect(10, 10, Ion::Display::Width, 20), force);
}
}

View File

@@ -24,7 +24,7 @@ private:
private:
constexpr static const char * k_lcdDataPassTest = "LCD DATA: OK";
constexpr static const char * k_lcdDataFailTest = "LCD DATA: FAIL";
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
int numberOfSubviews() const override { return 2; }
View * subviewAtIndex(int index) override {
assert(index >= 0 && index < 2);

View File

@@ -47,9 +47,9 @@ void LCDTimingTestController::ContentView::setStatus(bool success, int numberOfE
m_lcdNumberGlyphFailuresView.setText(buffer);
}
void LCDTimingTestController::ContentView::layoutSubviews() {
m_lcdTimingStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height));
m_lcdNumberGlyphFailuresView.setFrame(KDRect(10, 10, Ion::Display::Width, 20));
void LCDTimingTestController::ContentView::layoutSubviews(bool force) {
m_lcdTimingStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height), force);
m_lcdNumberGlyphFailuresView.setFrame(KDRect(10, 10, Ion::Display::Width, 20), force);
}
}

View File

@@ -25,7 +25,7 @@ private:
private:
constexpr static const char * k_lcdTimingPassTest = "LCD TIMING: OK";
constexpr static const char * k_lcdTimingFailTest = "LCD TIMING: FAIL";
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
int numberOfSubviews() const override { return 2; }
View * subviewAtIndex(int index) override {
assert(index >= 0 && index < 2);

View File

@@ -58,12 +58,12 @@ SolidColorView * LEDTestController::ContentView::LEDColorIndicatorView() {
return &m_ledColorIndicatorView;
}
void LEDTestController::ContentView::layoutSubviews() {
void LEDTestController::ContentView::layoutSubviews(bool force) {
KDSize ledSize = m_ledView.minimalSizeForOptimalDisplay();
m_ledView.setFrame(KDRect((Ion::Display::Width-ledSize.width()-k_indicatorSize-k_indicatorMargin)/2, k_arrowLength+2*k_arrowMargin, ledSize.width(), ledSize.height()));
m_ledColorIndicatorView.setFrame(KDRect((Ion::Display::Width-k_indicatorSize)/2+k_indicatorMargin/2+ledSize.width()/2, k_arrowLength+2*k_arrowMargin, k_indicatorSize, k_indicatorSize));
m_ledColorOutlineView.setFrame(KDRect((Ion::Display::Width-k_indicatorSize)/2+k_indicatorMargin/2+ledSize.width()/2-1, k_arrowLength+2*k_arrowMargin-1, k_indicatorSize+2, k_indicatorSize+2));
m_arrowView.setFrame(KDRect(0, k_arrowMargin, bounds().width(), k_arrowLength));
m_ledView.setFrame(KDRect((Ion::Display::Width-ledSize.width()-k_indicatorSize-k_indicatorMargin)/2, k_arrowLength+2*k_arrowMargin, ledSize.width(), ledSize.height()), force);
m_ledColorIndicatorView.setFrame(KDRect((Ion::Display::Width-k_indicatorSize)/2+k_indicatorMargin/2+ledSize.width()/2, k_arrowLength+2*k_arrowMargin, k_indicatorSize, k_indicatorSize), force);
m_ledColorOutlineView.setFrame(KDRect((Ion::Display::Width-k_indicatorSize)/2+k_indicatorMargin/2+ledSize.width()/2-1, k_arrowLength+2*k_arrowMargin-1, k_indicatorSize+2, k_indicatorSize+2), force);
m_arrowView.setFrame(KDRect(0, k_arrowMargin, bounds().width(), k_arrowLength), force);
}
int LEDTestController::ContentView::numberOfSubviews() const {

View File

@@ -18,7 +18,7 @@ private:
ContentView();
SolidColorView * LEDColorIndicatorView();
private:
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
SolidColorView m_ledColorIndicatorView;

View File

@@ -100,17 +100,17 @@ View * PopUpController::ContentView::subviewAtIndex(int index) {
}
}
void PopUpController::ContentView::layoutSubviews() {
void PopUpController::ContentView::layoutSubviews(bool force) {
KDCoordinate height = bounds().height();
KDCoordinate width = bounds().width();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_warningTextView.setFrame(KDRect(0, k_topMargin, width, textHeight));
m_messageTextView1.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+textHeight, width, textHeight));
m_messageTextView2.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+2*textHeight, width, textHeight));
m_messageTextView3.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+3*textHeight, width, textHeight));
m_messageTextView4.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+4*textHeight, width, textHeight));
m_cancelButton.setFrame(KDRect(k_buttonMargin, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight));
m_okButton.setFrame(KDRect(2*k_buttonMargin+(width-3*k_buttonMargin)/2, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight));
m_warningTextView.setFrame(KDRect(0, k_topMargin, width, textHeight), force);
m_messageTextView1.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+textHeight, width, textHeight), force);
m_messageTextView2.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+2*textHeight, width, textHeight), force);
m_messageTextView3.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+3*textHeight, width, textHeight), force);
m_messageTextView4.setFrame(KDRect(0, k_topMargin+k_paragraphHeight+4*textHeight, width, textHeight), force);
m_cancelButton.setFrame(KDRect(k_buttonMargin, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight), force);
m_okButton.setFrame(KDRect(2*k_buttonMargin+(width-3*k_buttonMargin)/2, height-k_buttonMargin-k_buttonHeight, (width-3*k_buttonMargin)/2, k_buttonHeight), force);
}
}

View File

@@ -25,7 +25,7 @@ private:
constexpr static KDCoordinate k_paragraphHeight = 20;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
Button m_cancelButton;
Button m_okButton;
MessageTextView m_warningTextView;

View File

@@ -33,8 +33,8 @@ void VBlankTestController::ContentView::setColor(KDColor color) {
m_vBlankStateView.setBackgroundColor(color);
}
void VBlankTestController::ContentView::layoutSubviews() {
m_vBlankStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height));
void VBlankTestController::ContentView::layoutSubviews(bool force) {
m_vBlankStateView.setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height), force);
}
}

View File

@@ -22,7 +22,7 @@ private:
BufferTextView * vBlankStateTextView() { return &m_vBlankStateView; }
void setColor(KDColor color) override;
private:
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
int numberOfSubviews() const override { return 1; }
View * subviewAtIndex(int index) override {
assert(index == 0);

View File

@@ -25,10 +25,10 @@ View * AppCell::subviewAtIndex(int index) {
return views[index];
}
void AppCell::layoutSubviews() {
m_iconView.setFrame(KDRect((bounds().width()-k_iconWidth)/2, k_iconMargin, k_iconWidth,k_iconHeight));
void AppCell::layoutSubviews(bool force) {
m_iconView.setFrame(KDRect((bounds().width()-k_iconWidth)/2, k_iconMargin, k_iconWidth,k_iconHeight), force);
KDSize nameSize = m_nameView.minimalSizeForOptimalDisplay();
m_nameView.setFrame(KDRect((bounds().width()-nameSize.width())/2-k_nameWidthMargin, bounds().height()-nameSize.height() - 2*k_nameHeightMargin, nameSize.width()+2*k_nameWidthMargin, nameSize.height()+2*k_nameHeightMargin));
m_nameView.setFrame(KDRect((bounds().width()-nameSize.width())/2-k_nameWidthMargin, bounds().height()-nameSize.height() - 2*k_nameHeightMargin, nameSize.width()+2*k_nameWidthMargin, nameSize.height()+2*k_nameHeightMargin), force);
}
void AppCell::setAppDescriptor(::App::Descriptor * descriptor) {

View File

@@ -12,7 +12,7 @@ public:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
void setVisible(bool visible);
void reloadCell() override;

View File

@@ -45,8 +45,8 @@ View * Controller::ContentView::subviewAtIndex(int index) {
return &m_selectableTableView;
}
void Controller::ContentView::layoutSubviews() {
m_selectableTableView.setFrame(bounds());
void Controller::ContentView::layoutSubviews(bool force) {
m_selectableTableView.setFrame(bounds(), force);
}
Controller::Controller(Responder * parentResponder, SelectableTableViewDataSource * selectionDataSource) :

View File

@@ -36,7 +36,7 @@ private:
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
SelectableTableView m_selectableTableView;
};
static constexpr KDCoordinate k_sideMargin = 4;

View File

@@ -23,8 +23,8 @@ View * LogoView::subviewAtIndex(int index) {
return &m_logoView;
}
void LogoView::layoutSubviews() {
m_logoView.setFrame(KDRect((Ion::Display::Width - ImageStore::LogoIcon->width())/2, (Ion::Display::Height - ImageStore::LogoIcon->height())/2, ImageStore::LogoIcon->width(), ImageStore::LogoIcon->height()));
void LogoView::layoutSubviews(bool force) {
m_logoView.setFrame(KDRect((Ion::Display::Width - ImageStore::LogoIcon->width())/2, (Ion::Display::Height - ImageStore::LogoIcon->height())/2, ImageStore::LogoIcon->width(), ImageStore::LogoIcon->height()), force);
}
}

View File

@@ -12,7 +12,7 @@ public:
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
ImageView m_logoView;
};

View File

@@ -30,7 +30,7 @@ View * PopUpController::MessageViewWithSkip::subviewAtIndex(int index) {
return nullptr;
}
void PopUpController::MessageViewWithSkip::layoutSubviews() {
void PopUpController::MessageViewWithSkip::layoutSubviews(bool force) {
// Layout the main message
MessageView::layoutSubviews();
// Layout the "skip (OK)"
@@ -38,8 +38,8 @@ void PopUpController::MessageViewWithSkip::layoutSubviews() {
KDCoordinate width = bounds().width();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
KDSize okSize = m_okView.minimalSizeForOptimalDisplay();
m_skipView.setFrame(KDRect(0, height-k_bottomMargin-textHeight, width-okSize.width()-k_okMargin-k_skipMargin, textHeight));
m_okView.setFrame(KDRect(width - okSize.width()-k_okMargin, height-okSize.height()-k_okMargin, okSize));
m_skipView.setFrame(KDRect(0, height-k_bottomMargin-textHeight, width-okSize.width()-k_okMargin-k_skipMargin, textHeight), force);
m_okView.setFrame(KDRect(width - okSize.width()-k_okMargin, height-okSize.height()-k_okMargin, okSize), force);
}
PopUpController::PopUpController(I18n::Message * messages, KDColor * colors, uint8_t numberOfMessages) :

View File

@@ -20,7 +20,7 @@ private:
protected:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
constexpr static KDCoordinate k_bottomMargin = 13;
constexpr static KDCoordinate k_okMargin = 10;

View File

@@ -67,10 +67,10 @@ View * CalculationCell::subviewAtIndex(int index) {
return &m_calculation;
}
void CalculationCell::layoutSubviews() {
void CalculationCell::layoutSubviews(bool force) {
KDSize textSize = m_text.minimalSizeForOptimalDisplay();
m_text.setFrame(KDRect(k_margin, 0, textSize.width(), bounds().height()));
m_calculation.setFrame(KDRect(2*k_margin+textSize.width()+ResponderImageCell::k_outline, ResponderImageCell::k_outline, calculationCellWidth(), ImageCell::k_height));
m_text.setFrame(KDRect(k_margin, 0, textSize.width(), bounds().height()), force);
m_calculation.setFrame(KDRect(2*k_margin+textSize.width()+ResponderImageCell::k_outline, ResponderImageCell::k_outline, calculationCellWidth(), ImageCell::k_height), force);
}
KDCoordinate CalculationCell::calculationCellWidth() const {

View File

@@ -22,7 +22,7 @@ private:
constexpr static KDCoordinate k_margin = 5;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
KDCoordinate calculationCellWidth() const;
MessageTextView m_text;
EditableTextCell m_calculation;

View File

@@ -46,12 +46,12 @@ View * CalculationController::ContentView::subviewAtIndex(int index) {
return &m_distributionCurveView;
}
void CalculationController::ContentView::layoutSubviews() {
void CalculationController::ContentView::layoutSubviews(bool force) {
KDCoordinate titleHeight = KDFont::SmallFont->glyphSize().height()+k_titleHeightMargin;
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight));
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight), force);
KDCoordinate calculationHeight = ResponderImageCell::k_oneCellHeight+2*k_tableMargin;
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), calculationHeight));
m_distributionCurveView.setFrame(KDRect(0, titleHeight+calculationHeight, bounds().width(), bounds().height() - calculationHeight - titleHeight));
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), calculationHeight), force);
m_distributionCurveView.setFrame(KDRect(0, titleHeight+calculationHeight, bounds().width(), bounds().height() - calculationHeight - titleHeight), force);
}
CalculationController::CalculationController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, Distribution * distribution, Calculation * calculation) :

View File

@@ -58,7 +58,7 @@ private:
constexpr static KDCoordinate k_titleHeightMargin = 5;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
MessageTextView m_titleView;
SelectableTableView * m_selectableTableView;
DistributionCurveView m_distributionCurveView;

View File

@@ -26,12 +26,12 @@ View * Cell::subviewAtIndex(int index) {
return &m_chevronView;
}
void Cell::layoutSubviews() {
void Cell::layoutSubviews(bool force) {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
m_labelView.setFrame(KDRect(1+k_iconWidth+2*k_iconMargin, 1, width-2-k_iconWidth-2*k_iconMargin - k_chevronWidth, height-2));
m_iconView.setFrame(KDRect(1+k_iconMargin, (height - k_iconHeight)/2, k_iconWidth, k_iconHeight));
m_chevronView.setFrame(KDRect(width-1-k_chevronWidth-k_chevronMargin, 1, k_chevronWidth, height - 2));
m_labelView.setFrame(KDRect(1+k_iconWidth+2*k_iconMargin, 1, width-2-k_iconWidth-2*k_iconMargin - k_chevronWidth, height-2), force);
m_iconView.setFrame(KDRect(1+k_iconMargin, (height - k_iconHeight)/2, k_iconWidth, k_iconHeight), force);
m_chevronView.setFrame(KDRect(width-1-k_chevronWidth-k_chevronMargin, 1, k_chevronWidth, height - 2), force);
}
void Cell::reloadCell() {

View File

@@ -20,7 +20,7 @@ private:
constexpr static KDCoordinate k_chevronMargin = 10;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
MessageTextView m_labelView;
ImageView m_iconView;
/* TODO: One day, we would rather store a mask (8bits/pixel) instead of two

View File

@@ -47,10 +47,10 @@ View * DistributionController::ContentView::subviewAtIndex(int index) {
return m_selectableTableView;
}
void DistributionController::ContentView::layoutSubviews() {
void DistributionController::ContentView::layoutSubviews(bool force) {
KDCoordinate titleHeight = KDFont::SmallFont->glyphSize().height()+k_titleMargin;
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight));
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), bounds().height()-titleHeight));
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight), force);
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), bounds().height()-titleHeight), force);
}
static I18n::Message sMessages[] = {

View File

@@ -29,7 +29,7 @@ private:
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
MessageTextView m_titleView;;
SelectableTableView * m_selectableTableView;
};

View File

@@ -35,8 +35,8 @@ View * ImageCell::subviewAtIndex(int index) {
return &m_iconView;
}
void ImageCell::layoutSubviews() {
m_iconView.setFrame(bounds());
void ImageCell::layoutSubviews(bool force) {
m_iconView.setFrame(bounds(), force);
}
}

View File

@@ -15,7 +15,7 @@ public:
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
ImageView m_iconView;
const Image * m_icon;
const Image * m_focusedIcon;

View File

@@ -50,19 +50,19 @@ View * ParametersController::ContentView::subviewAtIndex(int index) {
return &m_secondParameterDefinition;
}
void ParametersController::ContentView::layoutSubviews() {
void ParametersController::ContentView::layoutSubviews(bool force) {
KDCoordinate titleHeight = KDFont::SmallFont->glyphSize().height()+k_titleMargin;
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight));
m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight), force);
KDCoordinate tableHeight = m_selectableTableView->minimalSizeForOptimalDisplay().height();
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), tableHeight));
m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), tableHeight), force);
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
KDCoordinate defOrigin = (titleHeight+tableHeight)/2+(bounds().height()-textHeight)/2;
m_secondParameterDefinition.setFrame(KDRectZero);
m_secondParameterDefinition.setFrame(KDRectZero, force);
if (m_numberOfParameters == 2) {
defOrigin = (titleHeight+tableHeight)/2+(bounds().height()-2*textHeight-k_textMargin)/2;
m_secondParameterDefinition.setFrame(KDRect(0, defOrigin+textHeight+k_textMargin, bounds().width(), textHeight));
m_secondParameterDefinition.setFrame(KDRect(0, defOrigin+textHeight+k_textMargin, bounds().width(), textHeight), force);
}
m_firstParameterDefinition.setFrame(KDRect(0, defOrigin, bounds().width(), textHeight));
m_firstParameterDefinition.setFrame(KDRect(0, defOrigin, bounds().width(), textHeight), force);
}
/* Parameters Controller */

View File

@@ -31,7 +31,7 @@ private:
ContentView(Responder * parentResponder, SelectableTableView * selectableTableView);
void drawRect(KDContext * ctx, KDRect rect) const override;
MessageTextView * parameterDefinitionAtIndex(int index);
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
void setNumberOfParameters(int numberOfParameters);
private:
constexpr static KDCoordinate k_textMargin = 5;

View File

@@ -46,8 +46,8 @@ View * ResponderImageCell::subviewAtIndex(int index) {
return &m_imageCell;
}
void ResponderImageCell::layoutSubviews() {
m_imageCell.setFrame(KDRect(k_outline, k_outline, bounds().width()-2*k_outline, bounds().height()-2*k_outline));
void ResponderImageCell::layoutSubviews(bool force) {
m_imageCell.setFrame(KDRect(k_outline, k_outline, bounds().width()-2*k_outline, bounds().height()-2*k_outline), force);
}
}

View File

@@ -25,7 +25,7 @@ public:
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
ImageCell m_imageCell;
CalculationTypeController m_calculationTypeController;
};

View File

@@ -14,11 +14,11 @@ void ColumnTitleCell::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(KDRect(Metric::TableSeparatorThickness, 0, bounds().width(), k_colorIndicatorThickness), m_functionColor);
}
void ColumnTitleCell::layoutSubviews() {
void ColumnTitleCell::layoutSubviews(bool force) {
KDCoordinate width = bounds().width() - Metric::TableSeparatorThickness;
KDCoordinate height = bounds().height();
m_firstBufferTextView.setFrame(KDRect(Metric::TableSeparatorThickness, k_colorIndicatorThickness, width/2, height - k_colorIndicatorThickness));
m_secondBufferTextView.setFrame(KDRect(Metric::TableSeparatorThickness + width/2, k_colorIndicatorThickness, width - width/2, height - k_colorIndicatorThickness));
m_firstBufferTextView.setFrame(KDRect(Metric::TableSeparatorThickness, k_colorIndicatorThickness, width/2, height - k_colorIndicatorThickness), force);
m_secondBufferTextView.setFrame(KDRect(Metric::TableSeparatorThickness + width/2, k_colorIndicatorThickness, width - width/2, height - k_colorIndicatorThickness), force);
}
}

View File

@@ -14,7 +14,7 @@ public:
}
virtual void setColor(KDColor color);
void drawRect(KDContext * ctx, KDRect rect) const override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
constexpr static KDCoordinate k_colorIndicatorThickness = 2;
KDColor m_functionColor;

View File

@@ -88,11 +88,11 @@ View * EvenOddDoubleBufferTextCellWithSeparator::subviewAtIndex(int index) {
return &m_secondBufferTextView;
}
void EvenOddDoubleBufferTextCellWithSeparator::layoutSubviews() {
void EvenOddDoubleBufferTextCellWithSeparator::layoutSubviews(bool force) {
KDCoordinate width = bounds().width() - Metric::TableSeparatorThickness;
KDCoordinate height = bounds().height();
m_firstBufferTextView.setFrame(KDRect(Metric::TableSeparatorThickness, 0, width/2, height));
m_secondBufferTextView.setFrame(KDRect(Metric::TableSeparatorThickness + width/2, 0, width - width/2, height));
m_firstBufferTextView.setFrame(KDRect(Metric::TableSeparatorThickness, 0, width/2, height), force);
m_secondBufferTextView.setFrame(KDRect(Metric::TableSeparatorThickness + width/2, 0, width - width/2, height), force);
}
bool EvenOddDoubleBufferTextCellWithSeparator::handleEvent(Ion::Events::Event event) {

View File

@@ -25,7 +25,7 @@ public:
void drawRect(KDContext * ctx, KDRect rect) const override;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
bool handleEvent(Ion::Events::Event event) override;
protected:
bool m_firstTextSelected;

View File

@@ -52,11 +52,11 @@ View * SequenceTitleCell::subviewAtIndex(int index) {
return &m_titleTextView;
}
void SequenceTitleCell::layoutSubviews() {
void SequenceTitleCell::layoutSubviews(bool force) {
if (m_orientation == Orientation::VerticalIndicator) {
m_titleTextView.setAlignment(k_verticalOrientationHorizontalAlignment, verticalAlignment());
}
m_titleTextView.setFrame(subviewFrame());
m_titleTextView.setFrame(subviewFrame(), force);
}
float SequenceTitleCell::verticalAlignmentGivenExpressionBaselineAndRowHeight(KDCoordinate expressionBaseline, KDCoordinate rowHeight) const {

View File

@@ -25,7 +25,7 @@ private:
static constexpr float k_verticalOrientationHorizontalAlignment = 0.9f;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
float verticalAlignmentGivenExpressionBaselineAndRowHeight(KDCoordinate expressionBaseline, KDCoordinate rowHeight) const override;
EvenOddExpressionCell m_titleTextView;
};

View File

@@ -27,8 +27,8 @@ View * MessageTableCellWithEditableTextWithSeparator::subviewAtIndex(int index)
return &m_cell;
}
void MessageTableCellWithEditableTextWithSeparator::layoutSubviews() {
m_cell.setFrame(KDRect(0, k_margin, bounds().width(), bounds().height()-k_margin));
void MessageTableCellWithEditableTextWithSeparator::layoutSubviews(bool force) {
m_cell.setFrame(KDRect(0, k_margin, bounds().width(), bounds().height()-k_margin), force);
}
}

View File

@@ -20,7 +20,7 @@ private:
constexpr static KDCoordinate k_separatorThickness = Metric::CellSeparatorThickness;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
MessageTableCellWithEditableText m_cell;
};

View File

@@ -24,7 +24,7 @@ KDCoordinate BannerView::minimalHeightForOptimalDisplayGivenWidth(KDCoordinate w
return HeightGivenNumberOfLines(numberOfLinesGivenWidth(width));
}
void BannerView::layoutSubviews() {
void BannerView::layoutSubviews(bool force) {
if (m_frame.isEmpty()) {
/* If the frame has not been set yet, there is no point in layouting the
* subviews.
@@ -52,7 +52,7 @@ void BannerView::layoutSubviews() {
subviewPreviousLine = subviewAtIndex(j);
KDCoordinate width = subviewPreviousLine->minimalSizeForOptimalDisplay().width() + remainingWidth/nbOfSubviewsOnLine + (j == i-1) * roundingError;
KDCoordinate height = subviewPreviousLine->minimalSizeForOptimalDisplay().height();
subviewPreviousLine->setFrame(KDRect(x, y, width, height));
subviewPreviousLine->setFrame(KDRect(x, y, width, height), force);
x += width;
}
// Next line

View File

@@ -19,7 +19,7 @@ private:
static constexpr KDCoordinate LineSpacing = 2;
int numberOfSubviews() const override = 0;
View * subviewAtIndex(int index) override = 0;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
int numberOfLinesGivenWidth(KDCoordinate width) const;
};

View File

@@ -37,8 +37,8 @@ View * BufferFunctionTitleCell::subviewAtIndex(int index) {
return &m_bufferTextView;
}
void BufferFunctionTitleCell::layoutSubviews() {
m_bufferTextView.setFrame(bufferTextViewFrame());
void BufferFunctionTitleCell::layoutSubviews(bool force) {
m_bufferTextView.setFrame(bufferTextViewFrame(), force);
}
KDRect BufferFunctionTitleCell::bufferTextViewFrame() const {

View File

@@ -20,7 +20,7 @@ public:
}
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
protected:
KDRect bufferTextViewFrame() const;
EvenOddBufferTextCell * bufferTextView() { return &m_bufferTextView; }

View File

@@ -50,9 +50,9 @@ View * BufferTextViewWithTextField::subviewAtIndex(int index) {
return views[index];
}
void BufferTextViewWithTextField::layoutSubviews() {
m_bufferTextView.setFrame(KDRect(Metric::TitleBarExternHorizontalMargin, 0, k_bufferTextWidth, bounds().height()));
m_textField.setFrame(textFieldFrame());
void BufferTextViewWithTextField::layoutSubviews(bool force) {
m_bufferTextView.setFrame(KDRect(Metric::TitleBarExternHorizontalMargin, 0, k_bufferTextWidth, bounds().height()), force);
m_textField.setFrame(textFieldFrame(), force);
}
KDRect BufferTextViewWithTextField::textFieldFrame() const {

View File

@@ -20,7 +20,7 @@ private:
constexpr static KDCoordinate k_borderWidth = 1;
int numberOfSubviews() const override { return 2; }
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
KDRect textFieldFrame() const;
BufferTextView m_bufferTextView;
TextField m_textField;

View File

@@ -20,8 +20,8 @@ void ButtonWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
}
void ButtonWithSeparator::layoutSubviews() {
void ButtonWithSeparator::layoutSubviews(bool force) {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
m_messageTextView.setFrame(KDRect(k_lineThickness, k_margin + k_lineThickness, width-2*k_lineThickness, height - 4*k_lineThickness-k_margin));
m_messageTextView.setFrame(KDRect(k_lineThickness, k_margin + k_lineThickness, width-2*k_lineThickness, height - 4*k_lineThickness-k_margin), force);
}

View File

@@ -10,7 +10,7 @@ public:
private:
constexpr static KDCoordinate k_margin = 5;
constexpr static KDCoordinate k_lineThickness = 1;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
};
#endif

View File

@@ -7,7 +7,7 @@ namespace Shared {
class CursorView : public View {
public:
virtual void setCursorFrame(KDRect frame) { View::setFrame(frame); }
virtual void setCursorFrame(KDRect frame, bool force) { View::setFrame(frame, force); }
void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override;
private:

View File

@@ -722,15 +722,15 @@ void CurveView::stampAtLocation(KDContext * ctx, KDRect rect, float pxf, float p
ctx->blendRectWithMask(stampRect, color, (const uint8_t *)shiftedMask, workingBuffer);
}
void CurveView::layoutSubviews() {
void CurveView::layoutSubviews(bool force) {
if (m_curveViewCursor != nullptr && m_cursorView != nullptr) {
m_cursorView->setCursorFrame(cursorFrame());
m_cursorView->setCursorFrame(cursorFrame(), force);
}
if (m_bannerView != nullptr) {
m_bannerView->setFrame(bannerFrame());
m_bannerView->setFrame(bannerFrame(), force);
}
if (m_okView != nullptr) {
m_okView->setFrame(okFrame());
m_okView->setFrame(okFrame(), force);
}
}

View File

@@ -94,7 +94,7 @@ private:
* function shifts the stamp (by blending adjacent pixel colors) to draw with
* anti alising. */
void stampAtLocation(KDContext * ctx, KDRect rect, float pxf, float pyf, KDColor color) const;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
KDRect cursorFrame();
KDRect bannerFrame();
KDRect okFrame();

View File

@@ -18,9 +18,9 @@ void FunctionExpressionCell::drawRect(KDContext * ctx, KDRect rect) const {
}
void FunctionExpressionCell::layoutSubviews() {
void FunctionExpressionCell::layoutSubviews(bool force) {
KDRect expressionFrame(m_leftMargin, 0, bounds().width() - m_leftMargin - m_rightMargin, bounds().height()-k_separatorThickness);
m_expressionView.setFrame(expressionFrame);
m_expressionView.setFrame(expressionFrame, force);
}
}

View File

@@ -10,7 +10,7 @@ public:
FunctionExpressionCell() : EvenOddExpressionCell() {}
KDSize minimalSizeForOptimalDisplay() const override;
void drawRect(KDContext * ctx, KDRect rect) const override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
constexpr static KDCoordinate k_separatorThickness = Metric::CellSeparatorThickness;
};

View File

@@ -23,15 +23,15 @@ View * MessageView::subviewAtIndex(int index) {
return &(m_messageTextViews[index]);
}
void MessageView::layoutSubviews() {
void MessageView::layoutSubviews(bool force) {
if (m_numberOfMessages == 0) {
return;
}
KDCoordinate width = bounds().width();
KDCoordinate titleHeight = m_messageTextViews[0].minimalSizeForOptimalDisplay().height();
KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height();
m_messageTextViews[0].setFrame(KDRect(0, k_titleMargin, width, titleHeight));
m_messageTextViews[0].setFrame(KDRect(0, k_titleMargin, width, titleHeight), force);
for (uint8_t i = 1; i < m_numberOfMessages; i++) {
m_messageTextViews[i].setFrame(KDRect(0, k_paragraphHeight + (i-1) * textHeight, width, textHeight));
m_messageTextViews[i].setFrame(KDRect(0, k_paragraphHeight + (i-1) * textHeight, width, textHeight), force);
}
}

View File

@@ -10,7 +10,7 @@ public:
protected:
int numberOfSubviews() const override { return m_numberOfMessages; }
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
constexpr static KDCoordinate k_titleMargin = 40;
constexpr static KDCoordinate k_paragraphHeight = 90;

View File

@@ -35,11 +35,11 @@ void RoundCursorView::setColor(KDColor color) {
markRectAsDirty(bounds());
}
void RoundCursorView::setCursorFrame(KDRect f) {
void RoundCursorView::setCursorFrame(KDRect f, bool force) {
#if GRAPH_CURSOR_SPEEDUP
/* TODO This is quite dirty (we are out of the dirty tracking and we assume
* the cursor is the upmost view) but it works well. */
if (m_frame == f) {
if (m_frame == f && !force) {
return;
}
/* We want to avoid drawing the curve just because the cursor has been
@@ -51,7 +51,7 @@ void RoundCursorView::setCursorFrame(KDRect f) {
return;
}
#endif
CursorView::setCursorFrame(f);
CursorView::setCursorFrame(f, force);
}
#ifdef GRAPH_CURSOR_SPEEDUP

View File

@@ -13,7 +13,7 @@ public:
void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override;
void setColor(KDColor color);
void setCursorFrame(KDRect frame) override;
void setCursorFrame(KDRect frame, bool force) override;
#ifdef GRAPH_CURSOR_SPEEDUP
void resetMemoization() const { m_underneathPixelBufferLoaded = false; }
#endif

View File

@@ -43,8 +43,8 @@ View * ScrollableExactApproximateExpressionsCell::subviewAtIndex(int index) {
return &m_view;
}
void ScrollableExactApproximateExpressionsCell::layoutSubviews() {
m_view.setFrame(bounds());
void ScrollableExactApproximateExpressionsCell::layoutSubviews(bool force) {
m_view.setFrame(bounds(), force);
}
}

View File

@@ -24,7 +24,7 @@ public:
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
ScrollableExactApproximateExpressionsView m_view;
};

View File

@@ -94,11 +94,11 @@ View * ScrollableExactApproximateExpressionsView::ContentCell::subviewAtIndex(in
return views[index];
}
void ScrollableExactApproximateExpressionsView::ContentCell::layoutSubviews() {
void ScrollableExactApproximateExpressionsView::ContentCell::layoutSubviews(bool force) {
KDCoordinate height = bounds().height();
KDSize rightExpressionSize = m_rightExpressionView.minimalSizeForOptimalDisplay();
if (numberOfSubviews() == 1) {
m_rightExpressionView.setFrame(KDRect(0, 0, rightExpressionSize.width(), height));
m_rightExpressionView.setFrame(KDRect(0, 0, rightExpressionSize.width(), height), force);
return;
}
KDCoordinate leftBaseline = m_leftExpressionView.layout().baseline();
@@ -106,9 +106,9 @@ void ScrollableExactApproximateExpressionsView::ContentCell::layoutSubviews() {
KDCoordinate baseline = maxCoordinate(leftBaseline, rightBaseline);
KDSize leftExpressionSize = m_leftExpressionView.minimalSizeForOptimalDisplay();
KDSize approximateSignSize = m_approximateSign.minimalSizeForOptimalDisplay();
m_leftExpressionView.setFrame(KDRect(0, baseline-leftBaseline, leftExpressionSize));
m_rightExpressionView.setFrame(KDRect(2*Metric::CommonLargeMargin+leftExpressionSize.width()+approximateSignSize.width(), baseline-rightBaseline, rightExpressionSize));
m_approximateSign.setFrame(KDRect(Metric::CommonLargeMargin+leftExpressionSize.width(), baseline-approximateSignSize.height()/2, approximateSignSize));
m_leftExpressionView.setFrame(KDRect(0, baseline-leftBaseline, leftExpressionSize), force);
m_rightExpressionView.setFrame(KDRect(2*Metric::CommonLargeMargin+leftExpressionSize.width()+approximateSignSize.width(), baseline-rightBaseline, rightExpressionSize), force);
m_approximateSign.setFrame(KDRect(Metric::CommonLargeMargin+leftExpressionSize.width(), baseline-approximateSignSize.height()/2, approximateSignSize), force);
}
ScrollableExactApproximateExpressionsView::ScrollableExactApproximateExpressionsView(Responder * parentResponder) :

View File

@@ -54,7 +54,7 @@ private:
void setSelectedSubviewPosition(SubviewPosition subviewPosition);
bool displayLeftExpression() const { return m_displayLeftExpression; }
void setDisplayLeftExpression(bool display);
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
int numberOfSubviews() const override;
Poincare::Layout layout() const override;
private:

View File

@@ -11,9 +11,14 @@ void SeparatorEvenOddBufferTextCell::drawRect(KDContext * ctx, KDRect rect) cons
ctx->fillRect(separatorRect, Shared::HideableEvenOddEditableTextCell::hideColor());
}
void SeparatorEvenOddBufferTextCell::layoutSubviews() {
void SeparatorEvenOddBufferTextCell::layoutSubviews(bool force) {
KDRect boundsThis = bounds();
m_bufferTextView.setFrame(KDRect(boundsThis.left() + Metric::TableSeparatorThickness + k_horizontalMargin, boundsThis.top(), boundsThis.width() - Metric::TableSeparatorThickness - 2*k_horizontalMargin, boundsThis.height()));
KDRect frame = KDRect(
boundsThis.left() + Metric::TableSeparatorThickness + k_horizontalMargin,
boundsThis.top(),
boundsThis.width() - Metric::TableSeparatorThickness - 2*k_horizontalMargin,
boundsThis.height());
m_bufferTextView.setFrame(frame, force);
}
}

View File

@@ -10,7 +10,7 @@ class SeparatorEvenOddBufferTextCell : public EvenOddBufferTextCell {
public:
using EvenOddBufferTextCell::EvenOddBufferTextCell;
void drawRect(KDContext * ctx, KDRect rect) const override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
constexpr static KDCoordinate k_rightMargin = Metric::CellMargin;
};

View File

@@ -10,9 +10,9 @@ void StoreCell::drawRect(KDContext * ctx, KDRect rect) const {
}
}
void StoreCell::layoutSubviews() {
void StoreCell::layoutSubviews(bool force) {
KDRect boundsThis = bounds();
editableTextCell()->setFrame(rectWithoutSeparator(KDRect(boundsThis.left(), boundsThis.top(), boundsThis.width() - k_rightMargin, boundsThis.height())));
editableTextCell()->setFrame(rectWithoutSeparator(KDRect(boundsThis.left(), boundsThis.top(), boundsThis.width() - k_rightMargin, boundsThis.height())), force);
}
void StoreCell::didSetSeparator() {

View File

@@ -13,7 +13,7 @@ public:
Separable()
{}
void drawRect(KDContext * ctx, KDRect rect) const override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
static constexpr KDCoordinate k_rightMargin = Metric::CellMargin;
void didSetSeparator() override;

View File

@@ -44,10 +44,10 @@ View * StoreController::ContentView::subviewAtIndex(int index) {
return views[index];
}
void StoreController::ContentView::layoutSubviews() {
void StoreController::ContentView::layoutSubviews(bool force) {
KDRect dataViewFrame(0, 0, bounds().width(), bounds().height() - (m_displayFormulaInputView ? k_formulaInputHeight : 0));
m_dataView.setFrame(dataViewFrame);
m_formulaInputView.setFrame(formulaFrame());
m_dataView.setFrame(dataViewFrame, force);
m_formulaInputView.setFrame(formulaFrame(), force);
}
KDRect StoreController::ContentView::formulaFrame() const {

View File

@@ -64,7 +64,7 @@ protected:
static constexpr KDCoordinate k_formulaInputHeight = 31;
int numberOfSubviews() const override { return 1 + m_displayFormulaInputView; }
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
KDRect formulaFrame() const;
StoreSelectableTableView m_dataView;
BufferTextViewWithTextField m_formulaInputView;

View File

@@ -10,8 +10,8 @@ void StoreTitleCell::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(r, m_separatorLeft ? HideableEvenOddEditableTextCell::hideColor() : backgroundColor());
}
void StoreTitleCell::layoutSubviews() {
bufferTextView()->setFrame(rectWithoutSeparator(bufferTextViewFrame()));
void StoreTitleCell::layoutSubviews(bool force) {
bufferTextView()->setFrame(rectWithoutSeparator(bufferTextViewFrame()), force);
}
void StoreTitleCell::didSetSeparator() {

View File

@@ -13,7 +13,7 @@ public:
Separable()
{}
void drawRect(KDContext * ctx, KDRect rect) const override;
void layoutSubviews() override;
void layoutSubviews(bool force = false) override;
private:
void didSetSeparator() override;
};

View File

@@ -174,7 +174,7 @@ KDSize SumGraphController::LegendView::minimalSizeForOptimalDisplay() const {
void SumGraphController::LegendView::setLegendMessage(I18n::Message message, Step step) {
m_legend.setMessage(message);
layoutSubviews(step);
layoutSubviews(step, false);
}
void SumGraphController::LegendView::setEditableZone(double d) {
@@ -226,7 +226,7 @@ void SumGraphController::LegendView::setSumSymbol(Step step, double start, doubl
} else {
m_sum.setAlignment(0.0f, 0.5f);
}
layoutSubviews(step);
layoutSubviews(step, false);
}
View * SumGraphController::LegendView::subviewAtIndex(int index) {
@@ -240,21 +240,21 @@ View * SumGraphController::LegendView::subviewAtIndex(int index) {
return &m_legend;
}
void SumGraphController::LegendView::layoutSubviews() {
layoutSubviews(Step::FirstParameter);
void SumGraphController::LegendView::layoutSubviews(bool force) {
layoutSubviews(Step::FirstParameter, force);
}
void SumGraphController::LegendView::layoutSubviews(Step step) {
void SumGraphController::LegendView::layoutSubviews(Step step, bool force) {
KDCoordinate width = bounds().width();
KDCoordinate heigth = bounds().height();
KDSize legendSize = m_legend.minimalSizeForOptimalDisplay();
if (legendSize.width() > 0) {
m_sum.setFrame(KDRect(0, k_symbolHeightMargin, width-legendSize.width(), m_sum.minimalSizeForOptimalDisplay().height()));
m_legend.setFrame(KDRect(width-legendSize.width(), 0, legendSize.width(), heigth));
m_sum.setFrame(KDRect(0, k_symbolHeightMargin, width-legendSize.width(), m_sum.minimalSizeForOptimalDisplay().height()), force);
m_legend.setFrame(KDRect(width-legendSize.width(), 0, legendSize.width(), heigth), force);
} else {
m_sum.setFrame(bounds());
m_legend.setFrame(KDRectZero);
m_sum.setFrame(bounds(), force);
m_legend.setFrame(KDRectZero, force);
}
KDRect frame = (step == Step::Result) ? KDRectZero : KDRect(
@@ -262,7 +262,7 @@ void SumGraphController::LegendView::layoutSubviews(Step step) {
k_symbolHeightMargin + k_sigmaHeight/2 - (step == Step::SecondParameter) * editableZoneHeight(),
editableZoneWidth(), editableZoneHeight()
);
m_editableZone.setFrame(frame);
m_editableZone.setFrame(frame, force);
}
}

View File

@@ -65,8 +65,8 @@ private:
constexpr static KDCoordinate k_sigmaHeight = 18;
int numberOfSubviews() const override { return 3; }
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
void layoutSubviews(Step step);
void layoutSubviews(bool force = false) override;
void layoutSubviews(Step step, bool force);
ExpressionView m_sum;
Poincare::Layout m_sumLayout;
MessageTextView m_legend;

View File

@@ -102,10 +102,10 @@ View * ZoomParameterController::ContentView::subviewAtIndex(int index) {
return &m_legendView;
}
void ZoomParameterController::ContentView::layoutSubviews() {
void ZoomParameterController::ContentView::layoutSubviews(bool force) {
assert(bounds().height() == ZoomParameterController::k_standardViewHeight);
m_curveView->setFrame(KDRect(0, 0, bounds().width(), bounds().height() - k_legendHeight));
m_legendView.setFrame(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight));
m_curveView->setFrame(KDRect(0, 0, bounds().width(), bounds().height() - k_legendHeight), force);
m_legendView.setFrame(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), force);
}
CurveView * ZoomParameterController::ContentView::curveView() {
@@ -146,22 +146,22 @@ View * ZoomParameterController::ContentView::LegendView::subviewAtIndex(int inde
return &m_legendPictograms[index-k_numberOfLegends];
}
void ZoomParameterController::ContentView::LegendView::layoutSubviews() {
void ZoomParameterController::ContentView::LegendView::layoutSubviews(bool force) {
KDCoordinate height = bounds().height();
KDCoordinate xOrigin = 0;
KDCoordinate legendWidth = m_legends[0].minimalSizeForOptimalDisplay().width();
m_legends[0].setFrame(KDRect(xOrigin, 0, legendWidth, height));
m_legends[0].setFrame(KDRect(xOrigin, 0, legendWidth, height), force);
xOrigin += legendWidth;
for (int i = 0; i < k_numberOfTokens - 2; i++) {
m_legendPictograms[i].setFrame(KDRect(xOrigin, 0, k_tokenWidth, height));
m_legendPictograms[i].setFrame(KDRect(xOrigin, 0, k_tokenWidth, height), force);
xOrigin += k_tokenWidth;
}
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));
m_legends[i].setFrame(KDRect(xOrigin, 0, legendWidth, height), force);
xOrigin += legendWidth;
m_legendPictograms[k_numberOfTokens - 3 + i].setFrame(KDRect(xOrigin, 0, k_tokenWidth, height));
m_legendPictograms[k_numberOfTokens - 3 + i].setFrame(KDRect(xOrigin, 0, k_tokenWidth, height), force);
xOrigin += k_tokenWidth;
}
}

Some files were not shown because too many files have changed in this diff Show More